aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ds
diff options
context:
space:
mode:
authorMax Horn2010-11-18 17:42:28 +0000
committerMax Horn2010-11-18 17:42:28 +0000
commit7444a06c61749dcaf90a68233c78e26540377913 (patch)
tree42a55d8fab23a5144583894d0b9909622d05f3d8 /backends/platform/ds
parent487feb38433aa6a704dcac5f7b8288ba81772078 (diff)
downloadscummvm-rg350-7444a06c61749dcaf90a68233c78e26540377913.tar.gz
scummvm-rg350-7444a06c61749dcaf90a68233c78e26540377913.tar.bz2
scummvm-rg350-7444a06c61749dcaf90a68233c78e26540377913.zip
DS: cleanup
svn-id: r54334
Diffstat (limited to 'backends/platform/ds')
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.cpp50
1 files changed, 23 insertions, 27 deletions
diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp
index c07a204e7a..069f0fc09e 100644
--- a/backends/platform/ds/arm9/source/cdaudio.cpp
+++ b/backends/platform/ds/arm9/source/cdaudio.cpp
@@ -77,6 +77,7 @@ struct decoderFormat {
unsigned char sample[1024];
} __attribute__ ((packed));
+static bool s_started = false;
static bool s_active = false;
static WaveHeader waveHeader;
static Header blockHeader;
@@ -143,9 +144,8 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
char str[100];
- if (path[strlen(path.c_str()) - 1] != '/') {
- path = path + "/";
- }
+ if (path.lastChar() != '/')
+ path += '/';
Common::String fname;
@@ -199,7 +199,6 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
dataChunkStart = DS::std_ftell(s_file);
- static bool started = false;
sampleNum = 0;
blockCount = 0;
@@ -207,11 +206,11 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
IPC->streamFillNeeded[1] = true;
IPC->streamFillNeeded[2] = true;
IPC->streamFillNeeded[3] = true;
- if (!started) {
+ if (!s_started) {
fillPos = 0;
audioBuffer = (s16 *) malloc(BUFFER_SIZE * 2);
decompressionBuffer = (s16 *) malloc(waveHeader.fmtExtra * 2);
- started = true;
+ s_started = true;
// consolePrintf("****Starting buffer*****\n");
memset(audioBuffer, 0, BUFFER_SIZE * 2);
memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2);
@@ -472,20 +471,20 @@ void stopTrack() {
}
bool trackExists(int num) {
- Common::String path = ConfMan.get("path");
-
+ Common::String path;
char fname[128];
+ FILE *file;
sprintf(fname, "track%d.wav", num);
- if (path[strlen(path.c_str()) - 1] == '/') {
- path = path + fname;
- } else {
- path = path + "/" + fname;
- }
+ path = ConfMan.get("path");
+ if (path.lastChar() != '/')
+ path += '/';
+ path += fname;
+
consolePrintf("Looking for %s...", path.c_str());
- FILE *file = DS::std_fopen(path.c_str(), "r");
+ file = DS::std_fopen(path.c_str(), "r");
if (file) {
consolePrintf("Success!\n");
setActive(true);
@@ -495,27 +494,24 @@ bool trackExists(int num) {
sprintf(fname, "track%02d.wav", num);
- path = ConfMan.get("path");
-
- if (path[strlen(path.c_str()) - 1] == '/') {
- path = path + fname;
- } else {
- path = path + "/" + fname;
- }
+ path = ConfMan.get("path");
+ if (path.lastChar() != '/')
+ path += '/';
+ path += fname;
consolePrintf("Looking for %s...", path.c_str());
-
- if ((file = DS::std_fopen(path.c_str(), "r"))) {
+ file = DS::std_fopen(path.c_str(), "r");
+ if (file) {
consolePrintf("Success!\n");
setActive(true);
DS::std_fclose(file);
return true;
- } else {
- setActive(false);
- consolePrintf("Failed!\n");
- return false;
}
+
+ setActive(false);
+ consolePrintf("Failed!\n");
+ return false;
}
bool checkCD() {