aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ds
diff options
context:
space:
mode:
authorEugene Sandulenko2009-01-01 15:06:43 +0000
committerEugene Sandulenko2009-01-01 15:06:43 +0000
commit696897b0583ad52ebc6f7666525277847619a8ce (patch)
tree5ac2be2991e94dce32c5bb7fdb0dcc4188221503 /backends/platform/ds
parent05d3633eb32ead8e11435b85a9db1ddaa1482fcb (diff)
downloadscummvm-rg350-696897b0583ad52ebc6f7666525277847619a8ce.tar.gz
scummvm-rg350-696897b0583ad52ebc6f7666525277847619a8ce.tar.bz2
scummvm-rg350-696897b0583ad52ebc6f7666525277847619a8ce.zip
Whoa! Removing trailing spaces.
svn-id: r35648
Diffstat (limited to 'backends/platform/ds')
-rw-r--r--backends/platform/ds/arm9/source/blitters.cpp108
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.cpp166
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.h2
-rw-r--r--backends/platform/ds/arm9/source/console2.h4
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp616
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h4
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.cpp38
-rw-r--r--backends/platform/ds/arm9/source/fat/disc_io.h6
-rw-r--r--backends/platform/ds/arm9/source/fat/gba_nds_fat.h28
-rw-r--r--backends/platform/ds/arm9/source/fat/io_dldi.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_fcsr.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_m3_common.h6
-rw-r--r--backends/platform/ds/arm9/source/fat/io_m3cf.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_mmcf.h2
-rw-r--r--backends/platform/ds/arm9/source/fat/io_mpcf.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_njsd.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_nmmc.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_sccf.h4
-rw-r--r--backends/platform/ds/arm9/source/fat/io_scsd.h8
-rw-r--r--backends/platform/ds/arm9/source/fat/io_sd_common.h10
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp44
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.h18
-rw-r--r--backends/platform/ds/arm9/source/keys.cpp16
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp98
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h30
-rw-r--r--backends/platform/ds/arm9/source/portdefs.h4
-rw-r--r--backends/platform/ds/arm9/source/ramsave.cpp82
-rw-r--r--backends/platform/ds/arm9/source/ramsave.h44
-rw-r--r--backends/platform/ds/arm9/source/scummconsole.h2
-rw-r--r--backends/platform/ds/arm9/source/scummhelp.cpp2
-rw-r--r--backends/platform/ds/arm9/source/scummhelp.h4
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.cpp104
-rw-r--r--backends/platform/ds/arm9/source/touchkeyboard.h2
-rw-r--r--backends/platform/ds/arm9/source/wordcompletion.cpp16
-rw-r--r--backends/platform/ds/arm9/source/zipreader.cpp62
-rw-r--r--backends/platform/ds/arm9/source/zipreader.h16
36 files changed, 785 insertions, 785 deletions
diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp
index 582e15eb13..07c6b3fee1 100644
--- a/backends/platform/ds/arm9/source/blitters.cpp
+++ b/backends/platform/ds/arm9/source/blitters.cpp
@@ -27,25 +27,25 @@
namespace DS {
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
int vsPitch, int vmScreenWidth, int textSurfacePitch) {
if (height <= 0) height = 1;
if (width < 4) return;
-
-
+
+
width &= ~4;
// src = (const byte *) (((int) (src)) & (~4));
// dst = (byte *) (((int) (dst)) & (~4));
// text = (const byte *) (((int) (text)) & (~4));
-
+
asm ( "mov r5, %0\n" // Height
- "yLoop:\n"
+ "yLoop:\n"
"mov r3, #0\n" // X pos
-
+
"xLoop:\n"
-
+
"ldr r4, [%2, r3]\n" // Load text layer word
"cmp r4, %5\n"
"bne singleByteCompare\n"
@@ -54,7 +54,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"add r3, r3, #4\n"
"cmp r3, %1\n" // x == width?
"blt xLoop\n"
-
+
"add %2, %2, %8\n" // src += vs->pitch
"add %3, %3, %6\n" // dst += _vm->_screenWidth
"add %4, %4, %7\n" // text += _textSurface.pitch
@@ -62,8 +62,8 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"cmp r5, #0\n" // y == 0?
"bne yLoop\n"
"b end\n"
-
-
+
+
"singleByteCompare:\n"
"ldrb r4, [%2, r3]\n" // Load text byte
"cmps r4, %5, lsr #24\n" // Compare with mask
@@ -78,7 +78,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
"streqb r4, [%4, r3]\n" // Store it
"add r3, r3, #1\n"
-
+
"ldrb r4, [%2, r3]\n" // Load text byte
"cmps r4, %5, lsr #24\n" // Compare with mask
"strneb r4, [%4, r3]\n" // Store if not equal
@@ -91,7 +91,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"strneb r4, [%4, r3]\n" // Store if not equal
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
"streqb r4, [%4, r3]\n" // Store it
- "add r3, r3, #1\n"
+ "add r3, r3, #1\n"
"cmps r3, %1\n" // x == width?
"blt xLoop\n" // Repeat
@@ -101,10 +101,10 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
"sub r5, r5, #1\n" // y -= 1
"cmp r5, #0\n" // y == 0?
"bne yLoop\n"
-
+
"end:\n"
: /* no output registers */
- : "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
+ : "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
"r" (vsPitch), "r" (vmScreenWidth), "r" (textSurfacePitch)
: "r5", "r3", "r4", "%2", "%3", "%4", "memory");
}
@@ -115,7 +115,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) {
asm("ands r0, %3, #1\n"
"addne %3, %3, #1\n"
"bne roll2\n"
-
+
"yLoop2:\n"
"ldr r0, [%2, #0]\n"
"str r0, [%0, #0]\n"
@@ -131,7 +131,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) {
"add %0, %0, %1\n"
"add %2, %2, %1\n"
"subs %3, %3, #2\n"
- "bne yLoop2\n"
+ "bne yLoop2\n"
: /* no output registers */
: "r" (dst), "r" (dstPitch), "r" (src), "r" (height)
@@ -150,7 +150,7 @@ void ComputeDivBy5TableIFN()
for (int i=0; i<160; ++i)
{
DIV_BY_5[i] = (2*i+5)/10;
- }
+ }
}
#ifdef PERFECT_5_TO_4_RESCALING
@@ -163,13 +163,13 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
u32 bs3 = s3 & 0x1F;
u32 bs4 = s4 & 0x1F;
-#if 0
+#if 0
u32 gs0 = (s0 >> 5) & 0x1F;
u32 gs1 = (s1 >> 5) & 0x1F;
u32 gs2 = (s2 >> 5) & 0x1F;
u32 gs3 = (s3 >> 5) & 0x1F;
u32 gs4 = (s4 >> 5) & 0x1F;
-
+
u32 rs0 = (s0 >> 10) & 0x1F;
u32 rs1 = (s1 >> 10) & 0x1F;
u32 rs2 = (s2 >> 10) & 0x1F;
@@ -191,22 +191,22 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
asm("and %0, %2, %1, lsr #10" : "=r"(rs3) : "r"(s3), "r"(mask) : );
asm("and %0, %2, %1, lsr #10" : "=r"(rs4) : "r"(s4), "r"(mask) : );
#endif
-
+
u32 rd0 = 4*rs0 + rs1;
u32 rd1 = 2*rs1 + rs1 + 2*rs2;
u32 rd2 = 2*rs2 + 2*rs3 + rs3;
u32 rd3 = rs3 + 4*rs4;
-
+
u32 gd0 = 4*gs0 + gs1;
u32 gd1 = 2*gs1 + gs1 + 2*gs2;
u32 gd2 = 2*gs2 + 2*gs3 + gs3;
u32 gd3 = gs3 + 4*gs4;
-
+
u32 bd0 = 4*bs0 + bs1;
u32 bd1 = 2*bs1 + bs1 + 2*bs2;
u32 bd2 = 2*bs2 + 2*bs3 + bs3;
u32 bd3 = bs3 + 4*bs4;
-
+
#if 0
// Offsetting for correct rounding
rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5;
@@ -217,14 +217,14 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9;
bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9;
#else
- rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
- gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
- bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
+ rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
+ gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
+ bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
#endif
-
+
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-
+
((u32*)dest)[0] = d10;
((u32*)dest)[1] = d32;
}
@@ -233,7 +233,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
u16* dest)
{
static const u32 MASK = 0x03E07C1F;
-
+
u32 argbargbs0 = u32(s0) | (u32(s0) << 16);
u32 argbargbs1 = u32(s1) | (u32(s1) << 16);
u32 argbargbs2 = u32(s2) | (u32(s2) << 16);
@@ -245,32 +245,32 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
u32 grbs2 = argbargbs2 & MASK;
u32 grbs3 = argbargbs3 & MASK;
u32 grbs4 = argbargbs4 & MASK;
-
+
u32 grbd0 = (3*grbs0 + grbs1) >> 2;
u32 grbd1 = ( grbs1 + grbs2) >> 1;
u32 grbd2 = ( grbs2 + grbs3) >> 1;
u32 grbd3 = ( grbs3 + 3*grbs4) >> 2;
-
+
grbd0 &= MASK;
grbd1 &= MASK;
grbd2 &= MASK;
grbd3 &= MASK;
-
+
u32 d0 = grbd0 | (grbd0 >> 16);
u32 d1 = grbd1 | (grbd1 >> 16);
u32 d2 = grbd2 | (grbd2 >> 16);
u32 d3 = grbd3 | (grbd3 >> 16);
-
- d0 &= 0xFFFF;
- d1 &= 0xFFFF;
- d2 &= 0xFFFF;
- d3 &= 0xFFFF;
-
- d0 |= 0x8000;
- d1 |= 0x8000;
- d2 |= 0x8000;
- d3 |= 0x8000;
-
+
+ d0 &= 0xFFFF;
+ d1 &= 0xFFFF;
+ d2 &= 0xFFFF;
+ d3 &= 0xFFFF;
+
+ d0 |= 0x8000;
+ d1 |= 0x8000;
+ d2 |= 0x8000;
+ d3 |= 0x8000;
+
dest[0] = d0;
dest[1] = d1;
dest[2] = d2;
@@ -287,13 +287,13 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
u32 bd0 = (d0 << 24) >> 24;
u32 bd1 = (d1 << 24) >> 24;
u32 gd0 = (d0 << 16) >> 24;
- u32 gd1 = (d1 << 16) >> 24;
+ u32 gd1 = (d1 << 16) >> 24;
u32 rd0 = (d0 >> 16);
u32 rd1 = (d1 >> 16);
-
+
rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1];
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
- bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
+ bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
((u32*)dest)[0] = d10;
@@ -307,11 +307,11 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
u32 rd2 = (d2 >> 16);
u32 rd3 = (d3 >> 16);
- rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
- gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
- bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
+ rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
+ gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
+ bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-
+
((u32*)dest)[1] = d32;
}
@@ -320,7 +320,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette)
{
ComputeDivBy5TableIFN();
-
+
for (size_t i=0; i<64; ++i)
{
u32 s0 = palette[src[5*i+0]];
@@ -353,7 +353,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const
static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src)
{
ComputeDivBy5TableIFN();
-
+
for (size_t i=0; i<64; ++i)
{
u16 s0 = src[5*i+0];
@@ -384,7 +384,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri
for (size_t i=0; i<200; ++i)
{
- Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
+ Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
}
}
#else
@@ -396,7 +396,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri
for (size_t i=0; i<200; ++i)
{
- Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
+ Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
}
}
#endif
diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp
index 56ac4e8c09..4f66401b53 100644
--- a/backends/platform/ds/arm9/source/cdaudio.cpp
+++ b/backends/platform/ds/arm9/source/cdaudio.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#include "cdaudio.h"
#include "backends/fs/ds/ds-fs.h"
#include "common/config-manager.h"
@@ -53,9 +53,9 @@ struct WaveHeader {
u16 fmtExtraData; // Number of extra fmt bytes
u16 fmtExtra; // Samples per block (only for IMA-ADPCM files)
} __attribute__ ((packed));
-
+
struct chunkHeader {
- char name[4];
+ char name[4];
u32 size;
} __attribute__ ((packed));
@@ -112,7 +112,7 @@ void decompressBlock();
void allocBuffers() {
-
+
}
void setActive(bool active) {
@@ -125,17 +125,17 @@ bool getActive() {
void playTrack(int track, int numLoops, int startFrame, int duration) {
Common::String path = ConfMan.get("path");
-
+
if (isPlayingFlag) {
stopTrack();
}
-
+
if (trackStartsAt2) {
track++;
}
-
-
-
+
+
+
char str[100];
if (path[strlen(path.c_str()) - 1] == '/') {
@@ -145,50 +145,50 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
sprintf(str, "/track%d.wav", track);
path = path + str;
}
-
-
+
+
//1820160
-
+
file = DS::std_fopen(path.c_str(), "rb");
-
+
if (!file) {
consolePrintf("Failed to open %s!\n", path.c_str());
return;
}
-
-
+
+
DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
-
+
consolePrintf("Playing track %d\n", track);
consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
consolePrintf("Rate : %d\n", waveHeader.fmtSamPerSec);
consolePrintf("Bits : %d\n", waveHeader.fmtBitsPerSam);
consolePrintf("BlkSz : %d\n", waveHeader.fmtExtra);
-
+
if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) {
consolePrintf("Wave file is in the wrong format! You must use IMA-ADPCM 4-bit mono.\n");
DS::std_fclose(file);
return;
}
-
+
for (int r = 0; r < 8; r++) {
IPC->adpcm.buffer[r] = (u8 * volatile) (decoderFormat *) malloc(waveHeader.fmtBlockAlign);
IPC->adpcm.filled[r] = false;
IPC->adpcm.arm7Dirty[r] = false;
}
-
+
// Skip chunks until we reach the data chunk
chunkHeader chunk;
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
-
+
while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) {
DS::std_fseek(file, chunk.size, SEEK_CUR);
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
}
-
+
dataChunkStart = DS::std_ftell(file);
-
-
+
+
static bool started = false;
sampleNum = 0;
blockCount = 0;
@@ -206,35 +206,35 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
memset(audioBuffer, 0, BUFFER_SIZE * 2);
memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2);
DS::playSound(audioBuffer, BUFFER_SIZE * 2, false, false, waveHeader.fmtSamPerSec);
-
- }
+
+ }
fillPos = (IPC->streamPlayingSection + 1) & 3;
isPlayingFlag = true;
-
-
+
+
// Startframe is a 75Hz timer. Dunno why, since nothing else
// seems to run at that rate.
int tenths = (startFrame * 10) / 75;
-
+
// Seek to the nearest block start to the start time
int samples = (tenths * waveHeader.fmtSamPerSec) / 10;
int block = samples / waveHeader.fmtExtra;
-
-
+
+
if (duration == 0) {
blocksLeft = 0;
} else {
blocksLeft = ((((duration * 100) / 75) * (waveHeader.fmtSamPerSec)) / (waveHeader.fmtExtra) / 100) + 10;
}
// consolePrintf("Playing %d blocks (%d)\n\n", blocksLeft, duration);
-
+
// No need to seek if we're starting from the beginning
if (block != 0) {
DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET);
// consolePrintf("Startframe: %d msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block);
}
-
-
+
+
//decompressBlock();
playNextBlock();
DS::CD::numLoops = numLoops;
@@ -252,21 +252,21 @@ extern "C" void ARM_adcpm(int *block, int len, int stepTableIndex,
void decompressBlock() {
int block[2048];
bool loop = false;
-
+
blockCount++;
-
+
if (blockCount < 10) return;
-
-
+
+
do {
DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file);
-
+
DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file);
if (DS::std_feof(file) ) {
// Reached end of file, so loop
-
-
+
+
if ((numLoops == -1) || (numLoops > 1)) {
// Seek file to first packet
if (numLoops != -1) {
@@ -283,14 +283,14 @@ void decompressBlock() {
stopTrack();
return;
}
-
+
} else {
loop = false;
}
-
+
} while (loop);
-
-
+
+
if (blocksLeft > 0) {
blocksLeft--;
// consolePrintf("%d ", blocksLeft);
@@ -305,37 +305,37 @@ void decompressBlock() {
blockHeader.stepTableIndex,
blockHeader.firstSample,
decompressionBuffer);
-#else
+#else
// First sample is in header
decompressionBuffer[0] = blockHeader.firstSample;
-
+
// Set up initial table indeces
int stepTableIndex = blockHeader.stepTableIndex;
int prevSample = blockHeader.firstSample;
-
+
// consolePrintf("Decompressing block step=%d fs=%d\n", stepTableIndex, prevSample);
for (int r = 0; r < waveHeader.fmtExtra - 1; r++) {
-
+
int word = block[r >> 3];
int offset = 0;
-
+
switch (7 - (r & 0x0007)) {
case 0: {
offset = (word & 0xF0000000) >> 28;
break;
}
-
+
case 1: {
offset = (word & 0x0F000000) >> 24;
break;
}
-
+
case 2: {
offset = (word & 0x00F00000) >> 20;
break;
}
-
+
case 3: {
offset = (word & 0x000F0000) >> 16;
break;
@@ -361,41 +361,41 @@ void decompressBlock() {
break;
}
}
-
+
int diff = 0;
-
+
if (offset & 4) {
diff = diff + stepTab[stepTableIndex];
}
-
+
if (offset & 2) {
diff = diff + (stepTab[stepTableIndex] >> 1);
}
-
+
if (offset & 1) {
diff = diff + (stepTab[stepTableIndex] >> 2);
}
-
+
diff = diff + (stepTab[stepTableIndex] >> 3);
-
+
if (offset & 8) {
- diff = -diff;
+ diff = -diff;
}
-
+
int newSample = prevSample + diff;
-
+
if (newSample > 32767) newSample = 32767;
if (newSample < -32768) newSample = -32768;
-
+
decompressionBuffer[r + 1] = newSample;
-
+
prevSample = newSample;
-
+
stepTableIndex += indexTab[offset];
-
+
if (stepTableIndex > 88) stepTableIndex = 88;
if (stepTableIndex < 0) stepTableIndex = 0;
-
+
}
#endif
@@ -404,21 +404,21 @@ void decompressBlock() {
void playNextBlock() {
if (!isPlayingFlag) return;
int lastBlockId = -1;
-
+
while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed
IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7
// DC_FlushAll();
-
+
//-8644, 25088
for (int block = fillPos + 1; block < fillPos + 4; block++) {
int blockId = block & 3;
-
+
if (IPC->streamFillNeeded[blockId]) {
-
+
IPC->streamFillNeeded[blockId] = false;
// DC_FlushAll();
-
+
/* if (!(REG_KEYINPUT & KEY_R)) {
//consolePrintf("Align: %d First: %d Step:%d Res:%d\n", waveHeader.fmtBlockAlign, blockHeader.firstSample, blockHeader.stepTableIndex, blockHeader.reserved);
consolePrintf("Filling buffer %d\n", blockId);
@@ -432,19 +432,19 @@ void playNextBlock() {
}
}
}
-
+
lastBlockId = blockId;
IPC->streamFillNeeded[blockId] = false;
// DC_FlushAll();
}
-
-
-
+
+
+
}
-
-
-
+
+
+
if (lastBlockId != -1) {
fillPos = lastBlockId;
/* if (!(REG_KEYINPUT & KEY_R)) {
@@ -459,18 +459,18 @@ void stopTrack() {
if (!isPlayingFlag) return;
DS::std_fclose(file);
-
+
isPlayingFlag = false;
-
+
for (int r = 0; r < BUFFER_SIZE; r++) {
audioBuffer[r] = 0;
}
-
+
for (int r= 0; r < waveHeader.fmtExtra; r++) {
decompressionBuffer[r] = 0;
}
// DS::stopSound(1);
-
+
// free(audioBuffer);
// free(decompressionBuffer);
@@ -507,7 +507,7 @@ bool trackExists(int num) {
bool checkCD() {
// Need to check whethe CD audio files are present - do this by trying to open Track1.wav.
consolePrintf("Attempted to open cd drive\n");
-
+
if (trackExists(1)) {
trackStartsAt2 = false;
return true;
diff --git a/backends/platform/ds/arm9/source/cdaudio.h b/backends/platform/ds/arm9/source/cdaudio.h
index d1897d3e5d..aac303dd5e 100644
--- a/backends/platform/ds/arm9/source/cdaudio.h
+++ b/backends/platform/ds/arm9/source/cdaudio.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _CDAUDIO_H_
#define _CDAUDIO_H_
diff --git a/backends/platform/ds/arm9/source/console2.h b/backends/platform/ds/arm9/source/console2.h
index 6b9a677cc7..86434dcb93 100644
--- a/backends/platform/ds/arm9/source/console2.h
+++ b/backends/platform/ds/arm9/source/console2.h
@@ -25,7 +25,7 @@
//
// Changelog:
// 0.1: First version
-// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
+// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
// Changed some register defines for consistency.
//
//////////////////////////////////////////////////////////////////////
@@ -87,7 +87,7 @@ void consoleClear(void);
//
// Changelog:
// 0.1: First version
-// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
+// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
// Changed some register defines for consistency.
//
//////////////////////////////////////////////////////////////////////
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index 458cfe7923..492b7384ec 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
// - Remove scummconsole.c
// - Delete files
@@ -244,8 +244,8 @@ bool cpuScalerEnable = false;
// 150 192
// 200 128
- // (256 << 8) / scale
-
+ // (256 << 8) / scale
+
#ifdef USE_PROFILER
@@ -259,7 +259,7 @@ u8* scalerBackBuffer = NULL;
gameListType gameList[NUM_SUPPORTED_GAMES] = {
// Unknown game - use normal SCUMM controls
{"unknown", CONT_SCUMM_ORIGINAL},
-
+
// SCUMM games
{"maniac", CONT_SCUMM_ORIGINAL},
{"zak", CONT_SCUMM_ORIGINAL},
@@ -270,7 +270,7 @@ gameListType gameList[NUM_SUPPORTED_GAMES] = {
{"monkey2", CONT_SCUMM_ORIGINAL},
{"tentacle", CONT_SCUMM_ORIGINAL},
{"samnmax", CONT_SCUMM_SAMNMAX},
-
+
// Non-SCUMM games
{"sky", CONT_SKY},
{"simon1", CONT_SIMON},
@@ -356,8 +356,8 @@ void setTopScreenZoom(int percentage) {
// 150 192
// 200 128
- // (256 << 8) / scale
-
+ // (256 << 8) / scale
+
s32 scale = (percentage << 8) / 100;
subScreenScale = (256 * 256) / scale;
@@ -374,11 +374,11 @@ controlType getControlType() {
//plays an 8 bit mono sample at 11025Hz
void playSound(const void* data, u32 length, bool loop, bool adpcm, int rate)
{
-
+
if (!IPC->soundData) {
soundControl.count = 0;
}
-
+
soundControl.data[soundControl.count].data = data;
soundControl.data[soundControl.count].len = length | (loop? 0x80000000: 0x00000000);
soundControl.data[soundControl.count].rate = rate; // 367 samples per frame
@@ -428,14 +428,14 @@ void initSprites() {
sprites[i].attribute[2] = 0;
sprites[i].filler = 0;
}
-
+
for (int i = 0; i < 128; i++) {
spritesMain[i].attribute[0] = ATTR0_DISABLED;
spritesMain[i].attribute[1] = 0;
spritesMain[i].attribute[2] = 0;
spritesMain[i].filler = 0;
}
-
+
updateOAM();
}
@@ -446,7 +446,7 @@ void saveGameBackBuffer() {
// So, I lock the video memory here, as if I'm going to modify it. This
// forces OSystem_DS to create a system memory copy if one doesn't exist.
// This will be automatially resotred by OSystem_DS::updateScreen().
-
+
OSystem_DS::instance()->lockScreen();
OSystem_DS::instance()->unlockScreen();
}
@@ -460,22 +460,22 @@ void startSound(int freq, int buffer) {
bufferFirstHalf = false;
bufferSecondHalf = true;
-
+
int bytes = (2 * (bufferSamples)) + 100;
-
+
soundBuffer = (s16 *) malloc(bytes * 2);
if (!soundBuffer)
consolePrintf("Sound buffer alloc failed\n");
soundHiPart = true;
-
+
for (int r = 0; r < bytes; r++) {
soundBuffer[r] = 0;
}
soundFrequency = freq;
-
+
swiWaitForVBlank();
swiWaitForVBlank();
@@ -507,14 +507,14 @@ void initGame() {
// consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
currentGame = &gameList[0]; // Default game
-
+
for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
if (!stricmp(gameName, gameList[r].gameId)) {
currentGame = &gameList[r];
// consolePrintf("Game list num: %d\n", currentGame);
}
}
-
+
/* if (firstTime) {
firstTime = false;
@@ -557,7 +557,7 @@ void displayMode8Bit() {
consolePrintf("displayMode8Bit...");
#endif
u16 buffer[32 * 32];
-
+
setKeyboardEnable(false);
if (!displayModeIs8Bit) {
@@ -568,7 +568,7 @@ void displayMode8Bit() {
consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2), (u16*)CHAR_BASE_BLOCK(0), 16);
consolePrintSet(0, 23);
-
+
if (!displayModeIs8Bit) {
for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK(2))[r] = buffer[r];
@@ -577,20 +577,20 @@ void displayMode8Bit() {
}
displayModeIs8Bit = true;
-
+
if (isCpuScalerEnabled())
{
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
-
+
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
-
+
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
vramSetBankD(VRAM_D_SUB_SPRITE);
-
+
vramSetBankH(VRAM_H_LCD);
-
+
BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(8);
BG3_XDX = 256;
@@ -601,27 +601,27 @@ void displayMode8Bit() {
}
else
{
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
-
+
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
-
+
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
vramSetBankD(VRAM_D_SUB_SPRITE);
-
+
vramSetBankH(VRAM_H_LCD);
-
+
BG3_CR = BG_BMP8_512x256 | BG_BMP_BASE(8);
-
+
BG3_XDX = (int) (((float) (gameWidth) / 256.0f) * 256);
BG3_XDY = 0;
BG3_YDX = 0;
BG3_YDY = (int) ((200.0f / 192.0f) * 256);
- }
-
+ }
+
SUB_BG3_CR = BG_BMP8_512x256;
-
+
SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
SUB_BG3_XDY = 0;
SUB_BG3_YDX = 0;
@@ -633,15 +633,15 @@ void displayMode8Bit() {
BG0_CR = BG_MAP_BASE(2) | BG_TILE_BASE(0);
BG0_Y0 = 0;
-
- // Restore palette entry used by text in the front-end
+
+ // Restore palette entry used by text in the front-end
// PALETTE_SUB[255] = savedPalEntry255;
-
-
+
+
initGame();
-
+
#ifdef HEAVY_LOGGING
consolePrintf("done\n");
#endif
@@ -653,9 +653,9 @@ void displayMode8Bit() {
}
uploadSpriteGfx();
-
+
keyboardEnable = false;
-
+
}
void setGameID(int id) {
@@ -668,22 +668,22 @@ void dummyHandler() {
void checkSleepMode() {
if (IPC->performArm9SleepMode) {
-
+
consolePrintf("ARM9 Entering sleep mode\n");
-
+
int intSave = REG_IE;
irqSet(IRQ_VBLANK, dummyHandler);
// int irqHandlerSave = (int) IRQ_HANDLER;
REG_IE = IRQ_VBLANK;
//IRQ_HANDLER = dummyHandler;
-
+
int powerSave = POWER_CR;
POWER_CR &= ~POWER_ALL;
-
+
while (IPC->performArm9SleepMode) {
swiWaitForVBlank();
}
-
+
POWER_CR = powerSave;
// IRQ_HANDLER = (void (*)()) irqHandlerSave;
irqSet(IRQ_VBLANK, VBlankHandler);
@@ -722,18 +722,18 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
{
int off = 128*64;
-
-
+
+
memset(SPRITE_GFX + off, 0, 32 * 32 * 2);
memset(SPRITE_GFX_SUB + off, 0, 32 * 32 * 2);
-
+
for (uint y=0; y<h; y++) {
for (uint x=0; x<w; x++) {
int color = icon[y*w+x];
//consolePrintf("%d:%d ", color, OSystem_DS::instance()->getDSPaletteEntry(color));
-
+
if (color == keycolor) {
SPRITE_GFX[off+(y)*32+x] = 0x0000; // black background
SPRITE_GFX_SUB[off+(y)*32+x] = 0x0000; // black background
@@ -743,23 +743,23 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
}
}
}
-
+
}
if (currentGame->control != CONT_SCUMM_SAMNMAX)
return;
uint16 border = RGB15(24,24,24) | 0x8000;
-
-
+
+
int off = 176*64;
memset(SPRITE_GFX_SUB+off, 0, 64*64*2);
memset(SPRITE_GFX+off, 0, 64*64*2);
-
+
int pos = 190 - (w+2);
-
-
+
+
// make border
for (uint i=0; i<w+2; i++) {
SPRITE_GFX[off+i] = border;
@@ -775,7 +775,7 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
SPRITE_GFX_SUB[off+(i*64)] = border;
SPRITE_GFX_SUB[off+(i*64)+(w+1)] = border;
}
-
+
int offset = (32 - h) >> 1;
for (uint y=0; y<h; y++) {
@@ -791,8 +791,8 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX,
}
}
}
-
-
+
+
if ((cursorEnable)) {
sprites[1].attribute[0] = ATTR0_BMP | 150;
sprites[1].attribute[1] = ATTR1_SIZE_64 | pos;
@@ -827,7 +827,7 @@ void displayMode16Bit() {
}
- videoSetMode(MODE_5_2D | /*DISPLAY_BG0_ACTIVE |*/ DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | /*DISPLAY_BG0_ACTIVE |*/ DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE |/* DISPLAY_BG1_ACTIVE |*/ DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
vramSetBankA(VRAM_A_MAIN_BG);
@@ -838,10 +838,10 @@ void displayMode16Bit() {
BG3_CR = BG_BMP16_512x256;
highBuffer = false;
-
+
memset(BG_GFX, 0, 512 * 256 * 2);
-
+
savedPalEntry255 = PALETTE_SUB[255];
PALETTE_SUB[255] = RGB15(31,31,31);//by default font will be rendered with color 255
@@ -860,11 +860,11 @@ void displayMode16Bit() {
consolePrintSet(0, 23);
consolePrintf("\n");
-
+
// Show keyboard
SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(12);
//drawKeyboard(1, 12);
-
+
POWER_CR &= ~POWER_SWAP_LCDS;
displayModeIs8Bit = false;
@@ -887,10 +887,10 @@ void displayMode16BitFlipBuffer() {
#endif
if (!displayModeIs8Bit) {
u16* back = get16BitBackBuffer();
-
+
// highBuffer = !highBuffer;
// BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer? 1: 0);
-
+
if (isCpuScalerEnabled())
{
Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
@@ -912,14 +912,14 @@ void displayMode16BitFlipBuffer() {
#endif
const u8* back = (const u8*)get8BitBackBuffer();
u16* base = BG_GFX + 0x10000;
- Rescale_320x256xPAL8_To_256x256x1555(
+ Rescale_320x256xPAL8_To_256x256x1555(
base,
back,
256,
get8BitBackBufferStride(),
- BG_PALETTE,
+ BG_PALETTE,
getGameHeight() );
-
+
#ifdef SCALER_PROFILE
// 10 pixels : 1ms
u16 t1 = TIMER1_DATA;
@@ -982,10 +982,10 @@ void doSoundCallback() {
if (OSystem_DS::instance())
if (OSystem_DS::instance()->getMixerImpl()) {
lastCallbackFrame = frameCount;
-
+
for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) {
int chunk = r & 3;
-
+
if (IPC->fillNeeded[chunk]) {
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
@@ -993,9 +993,9 @@ void doSoundCallback() {
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
}
-
+
}
-
+
}
#ifdef HEAVY_LOGGING
consolePrintf("done\n");
@@ -1007,7 +1007,7 @@ void doTimerCallback() {
if (callbackTimer <= 0) {
callbackTimer += callbackInterval;
callback(callbackInterval);
- }
+ }
}
}
@@ -1016,15 +1016,15 @@ void soundUpdate() {
// playSound(soundBuffer, (bufferSamples * 2), true);
}
// consolePrintf("%x\n", IPC->test);
-
-
+
+
if (bufferFrame == 0) {
// bufferFirstHalf = true;
- }
+ }
if (bufferFrame == bufferSize >> 1) {
//bufferSecondHalf = true;
- }
-
+ }
+
bufferFrame++;
if (bufferFrame == bufferSize) {
bufferFrame = 0;
@@ -1037,20 +1037,20 @@ void memoryReport() {
do {
p = (int *) malloc(r * 8192);
free(p);
- r++;
+ r++;
} while ((p) && (r < 512));
-
+
int t = -1;
void* block[1024];
do {
t++;
block[t] = (int *) malloc(4096);
- } while ((t < 1024) && (block[t]));
-
+ } while ((t < 1024) && (block[t]));
+
for (int q = 0; q < t; q++) {
free(block[q]);
}
-
+
consolePrintf("Free: %dK, Largest: %dK\n", t * 4, r * 8);
}
@@ -1061,7 +1061,7 @@ void addIndyFightingKeys() {
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
-
+
// consolePrintf("Fight keys\n");
if ((getKeysDown() & KEY_L)) {
@@ -1091,16 +1091,16 @@ void addIndyFightingKeys() {
event.kbd.keycode = Common::KEYCODE_6;
event.kbd.ascii = '6';
system->addEvent(event);
- }
+ }
if ((getKeysChanged() & KEY_DOWN)) {
event.type = getKeyEvent(KEY_DOWN);
event.kbd.keycode = Common::KEYCODE_2;
event.kbd.ascii = '2';
system->addEvent(event);
}
-
+
if (indyFightRight) {
-
+
if ((getKeysChanged() & KEY_X)) {
event.type = getKeyEvent(KEY_X);
event.kbd.keycode = Common::KEYCODE_9;
@@ -1118,7 +1118,7 @@ void addIndyFightingKeys() {
event.kbd.keycode = Common::KEYCODE_3;
event.kbd.ascii = '3';
system->addEvent(event);
- }
+ }
} else {
@@ -1139,18 +1139,18 @@ void addIndyFightingKeys() {
event.kbd.keycode = Common::KEYCODE_1;
event.kbd.ascii = '1';
system->addEvent(event);
- }
-
+ }
+
}
-
-
+
+
if ((getKeysChanged() & KEY_Y)) {
event.type = getKeyEvent(KEY_Y);
event.kbd.keycode = Common::KEYCODE_5;
event.kbd.ascii = '5';
system->addEvent(event);
}
-}
+}
void setKeyboardEnable(bool en) {
@@ -1162,8 +1162,8 @@ void setKeyboardEnable(bool en) {
DS::drawKeyboard(1, 15, backupBank);
-
-
+
+
SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(15);
if (displayModeIs8Bit) {
@@ -1185,10 +1185,10 @@ void setKeyboardEnable(bool en) {
for (int r = 0; r < 256; r++) {
BG_PALETTE_SUB[r] = BG_PALETTE[r];
}
-
-
+
+
//restoreVRAM(1, 12, backupBank);
-
+
if (displayModeIs8Bit) {
// Copy the sub screen VRAM from the top screen - they should always be
// the same.
@@ -1200,17 +1200,17 @@ void setKeyboardEnable(bool en) {
BG_GFX_SUB[y * 256 + x] = buffer[(y * (stride / 2)) + x];
}
}
-/*
+/*
for (int r = 0; r < (512 * 256) >> 1; r++)
BG_GFX_SUB[r] = buffer[r];
- */
+ */
SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer
SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE; // Turn on game layer
} else {
SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer
SUB_DISPLAY_CR |= DISPLAY_BG0_ACTIVE; // Turn on console layer
}
-
+
// Restore the screens so they're the right way round
if (gameScreenSwap) {
POWER_CR |= POWER_SWAP_LCDS;
@@ -1321,7 +1321,7 @@ void doButtonSelectMode(OSystem_DS* system)
if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) {
- if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
+ if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
if ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit)) {
event.type = Common::EVENT_LBUTTONDOWN;
leftButtonDown = true;
@@ -1333,7 +1333,7 @@ void doButtonSelectMode(OSystem_DS* system)
event.mouse = Common::Point(getPenX(), getPenY());
system->addEvent(event);
}
-
+
} else {
// In hover mode, D-pad left and right click the mouse when the pen is on the screen
@@ -1369,7 +1369,7 @@ void doButtonSelectMode(OSystem_DS* system)
if (getKeysDown() & KEY_LEFT) {
mouseMode = MOUSE_LEFT;
}
-
+
if (rightButtonDown)
{
Common::Event event;
@@ -1378,8 +1378,8 @@ void doButtonSelectMode(OSystem_DS* system)
system->addEvent(event);
rightButtonDown = false;
}
-
-
+
+
if (getKeysDown() & KEY_RIGHT) {
if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) {
mouseMode = MOUSE_RIGHT;
@@ -1387,7 +1387,7 @@ void doButtonSelectMode(OSystem_DS* system)
// If we're playing sam and max, click and release the right mouse
// button to change verb
Common::Event event;
-
+
if (currentGame->control == CONT_FUTURE_WARS) {
event.mouse = Common::Point(320 - 128, 200 - 128);
event.type = Common::EVENT_MOUSEMOVE;
@@ -1395,20 +1395,20 @@ void doButtonSelectMode(OSystem_DS* system)
} else {
event.mouse = Common::Point(getPenX(), getPenY());
}
-
+
rightButtonDown = true;
-
-
+
+
event.type = Common::EVENT_RBUTTONDOWN;
system->addEvent(event);
-
+
//event.type = Common::EVENT_RBUTTONUP;
//system->addEvent(event);
}
}
-
-
-
+
+
+
if (getKeysDown() & KEY_UP) {
mouseMode = MOUSE_HOVER;
}
@@ -1423,7 +1423,7 @@ void addEventsToQueue() {
OSystem_DS* system = OSystem_DS::instance();
Common::Event event;
-
+
#ifdef USE_PROFILER
if (keysDown() & KEY_R) {
cygprofile_begin();
@@ -1435,7 +1435,7 @@ void addEventsToQueue() {
}
#endif
-
+
if (system->isEventQueueEmpty()) {
/*
@@ -1444,7 +1444,7 @@ void addEventsToQueue() {
consolePrintf("Tweak: %d\n", tweak);
IPC->tweakChanged = true;
}
-
+
if (getKeysDown() & KEY_R) {
tweak++;
@@ -1460,14 +1460,14 @@ void addEventsToQueue() {
if (!indyFightState) {
- if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {
+ if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {
if (currentGame->control == CONT_AGI) {
event.kbd.keycode = Common::KEYCODE_RETURN;
event.kbd.ascii = 13;
event.kbd.flags = 0;
} else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = 27;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = 27;
event.kbd.flags = 0;
}
@@ -1477,11 +1477,11 @@ void addEventsToQueue() {
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
-
+
}
-
-
-
+
+
+
if ((!getIndyFightState()) && (getKeysDown() & KEY_Y)) {
consoleEnable = !consoleEnable;
if (displayModeIs8Bit) {
@@ -1490,7 +1490,7 @@ void addEventsToQueue() {
displayMode16Bit();
}
}
-
+
if ((getKeyboardEnable())) {
event.kbd.flags = 0;
@@ -1498,30 +1498,30 @@ void addEventsToQueue() {
bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
bool shoulders = getKeysHeld() & (KEY_L | KEY_R);
- if ( (down && (!shoulders)) || release)
+ if ( (down && (!shoulders)) || release)
{
-
+
if (getKeysChanged() & KEY_LEFT) {
event.kbd.keycode = Common::KEYCODE_LEFT;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_LEFT);
system->addEvent(event);
}
-
+
if (getKeysChanged() & KEY_RIGHT) {
event.kbd.keycode = Common::KEYCODE_RIGHT;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_RIGHT);
system->addEvent(event);
}
-
+
if (getKeysChanged() & KEY_UP) {
event.kbd.keycode = Common::KEYCODE_UP;
event.kbd.ascii = 0;
event.type = getKeyEvent(KEY_UP);
system->addEvent(event);
}
-
+
if (getKeysChanged() & KEY_DOWN) {
event.kbd.keycode = Common::KEYCODE_DOWN;
event.kbd.ascii = 0;
@@ -1529,9 +1529,9 @@ void addEventsToQueue() {
system->addEvent(event);
}
}
-
+
}
-
+
if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) {
if ((getKeysDown() & KEY_A) && (!indyFightState)) {
@@ -1544,10 +1544,10 @@ void addEventsToQueue() {
}
}
-
-
-
-
+
+
+
+
}
if ((getKeysDown() & KEY_SELECT)) {
@@ -1556,18 +1556,18 @@ void addEventsToQueue() {
showOptionsDialog();
}
-
+
}
-
+
if (!getIndyFightState() && !((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_X)) {
setKeyboardEnable(!keyboardEnable);
}
-
- updateStatus();
-
+
+ updateStatus();
+
Common::Event event;
-
+
if (!keyboardEnable) {
if ((tapScreenClicks) && (getIsDisplayMode8Bit()))
@@ -1578,11 +1578,11 @@ void addEventsToQueue() {
{
doButtonSelectMode(system);
}
-
+
if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) {
// Controls specific to the control method
-
-
+
+
if (currentGame->control == CONT_SKY) {
// Extra controls for Beneath a Steel Sky
if ((getKeysDown() & KEY_DOWN)) {
@@ -1595,7 +1595,7 @@ void addEventsToQueue() {
// Extra controls for Simon the Sorcerer
if ((getKeysDown() & KEY_DOWN)) {
Common::Event event;
-
+
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = Common::KEYCODE_F10; // F10 or # - show hotspots
event.kbd.ascii = Common::ASCII_F10;
@@ -1608,13 +1608,13 @@ void addEventsToQueue() {
}
}
-
-
+
+
if (currentGame->control == CONT_SCUMM_ORIGINAL) {
// Extra controls for Scumm v1-5 games
if ((getKeysDown() & KEY_DOWN)) {
Common::Event event;
-
+
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = Common::KEYCODE_PERIOD; // Full stop - skips current dialogue line
event.kbd.ascii = '.';
@@ -1624,19 +1624,19 @@ void addEventsToQueue() {
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
-
+
if (indyFightState) {
addIndyFightingKeys();
}
-
+
}
-
+
}
}
-
+
if (!displayModeIs8Bit) {
// Front end controls
-
+
if (leftHandedSwap(getKeysChanged()) & KEY_UP) {
event.type = getKeyEvent(leftHandedSwap(KEY_UP));
event.kbd.keycode = Common::KEYCODE_UP;
@@ -1663,10 +1663,10 @@ void addEventsToQueue() {
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
-
+
}
-
+
if ((getKeysChanged() & KEY_START)) {
event.type = getKeyEvent(KEY_START);
if (currentGame->control == CONT_FUTURE_WARS) {
@@ -1688,34 +1688,34 @@ void addEventsToQueue() {
system->addEvent(event);
}
-
+
if (keyboardEnable) {
DS::addKeyboardEvents();
}
-
+
consumeKeys();
-
+
consumePenEvents();
}
}
-
+
void triggerIcon(int imageNum) {
triggeredIcon = imageNum;
- triggeredIconTimeout = 120;
+ triggeredIconTimeout = 120;
}
-
+
void setIcon(int num, int x, int y, int imageNum, int flags, bool enable) {
- sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0);
+ sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0);
sprites[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
}
void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) {
- spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0);
+ spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0);
spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
}
@@ -1744,17 +1744,17 @@ void updateStatus() {
break;
}
}
-
+
setIcon(0, 208, 150, offs, 0, true);
}
-
+
if (indyFightState) {
setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true);
// consolePrintf("%d\n", indyFightRight);
} else {
// setIcon(1, 0, 0, 0, 0, false);
}
-
+
if (triggeredIconTimeout > 0) {
triggeredIconTimeout--;
setIcon(4, 16, 150, triggeredIcon, 0, true);
@@ -1793,7 +1793,7 @@ void soundBufferEmptyHandler() {
} else {
// bufferFirstHalf = true;
}
-
+
soundHiPart = !soundHiPart;
}
@@ -1804,7 +1804,7 @@ void setMainScreenScroll(int x, int y) {
} else */{
BG3_CX = x + (((frameCount & 1) == 0)? 64: 0);
BG3_CY = y;
-
+
if ((!gameScreenSwap) || (touchPadStyle)) {
touchX = x >> 8;
touchY = y >> 8;
@@ -1827,14 +1827,14 @@ void setMainScreenScale(int x, int y) {
BG3_YDY = y;
}
else
- {
+ {
BG3_XDX = x;
BG3_XDY = 0;
BG3_YDX = 0;
BG3_YDY = y;
}
-
- if ((!gameScreenSwap) || (touchPadStyle)) {
+
+ if ((!gameScreenSwap) || (touchPadStyle)) {
touchScX = x;
touchScY = y;
}
@@ -1845,7 +1845,7 @@ void setZoomedScreenScroll(int x, int y, bool shake) {
/* if (gameScreenSwap) {
BG3_CX = x + ((shake && ((frameCount & 1) == 0))? 64: 0);
BG3_CY = y;
-
+
touchX = x >> 8;
touchY = y >> 8;
} else */{
@@ -1908,7 +1908,7 @@ void VBlankHandler(void) {
soundUpdate();
-
+
if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) {
if (currentGame) {
@@ -1923,14 +1923,14 @@ void VBlankHandler(void) {
}
}
}
-
+
penUpdate();
keysUpdate();
frameCount++;
-
+
if ((cursorEnable) && (mouseCursorVisible)) {
if (!keyboardEnable) {
storedMouseX = penX;
@@ -1953,31 +1953,31 @@ void VBlankHandler(void) {
if (callback) {
callbackTimer -= FRAME_TIME;
}
-
+
if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
-
+
if ((!dragging) && (getPenHeld()) && (penDownFrames > 5)) {
dragging = true;
dragStartX = penX;
dragStartY = penY;
-
+
if (gameScreenSwap) {
dragScX = subScTargetX;
dragScY = subScTargetY;
} else {
dragScX = scX;
- dragScY = scY;
- }
-
-
+ dragScY = scY;
+ }
+
+
}
-
+
if ((dragging) && (!getPenHeld())) {
dragging = false;
}
-
+
if (dragging) {
-
+
if (gameScreenSwap) {
subScTargetX = dragScX + ((dragStartX - penX) << 8);
subScTargetY = dragScY + ((dragStartY - penY) << 8);
@@ -1985,18 +1985,18 @@ void VBlankHandler(void) {
scX = dragScX + ((dragStartX - penX));
scY = dragScY + ((dragStartY - penY));
}
-
+
// consolePrintf("X:%d Y:%d\n", dragStartX - penX, dragStartY - penY);
}
- }
-
-
+ }
+
+
/* if ((frameCount & 1) == 0) {
SUB_BG3_CX = subScX;
} else {
SUB_BG3_CX = subScX + 64;
}
-
+
SUB_BG3_CY = subScY + (shakePos << 8);*/
/*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
@@ -2005,26 +2005,26 @@ void VBlankHandler(void) {
SUB_BG3_YDY = (int) (subScreenHeight / 192.0f * 256);*/
static int ratio = (320 << 8) / SCUMM_GAME_WIDTH;
-
+
bool zooming = false;
-
+
if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
if ((getKeysHeld() & KEY_A) && (subScreenScale < ratio)) {
subScreenScale += 1;
zooming = true;
}
-
+
if ((getKeysHeld() & KEY_B) && (subScreenScale > 128)) {
subScreenScale -=1;
zooming = true;
}
}
-
+
int xCenter = subScTargetX + ((subScreenWidth >> 1) << 8);
int yCenter = subScTargetY + ((subScreenHeight >> 1) << 8);
-
+
if (twoHundredPercentFixedScale) {
subScreenWidth = 256 >> 1;
subScreenHeight = 192 >> 1;
@@ -2033,9 +2033,9 @@ void VBlankHandler(void) {
// subScreenHeight = SCUMM_GAME_HEIGHT * subScreenScale >> 8;
- subScreenWidth = (256 * subScreenScale) >> 8;
+ subScreenWidth = (256 * subScreenScale) >> 8;
subScreenHeight = (192 * subScreenScale) >> 8;
-
+
if ( ((subScreenWidth) > 256 - 8) && ((subScreenWidth) < 256 + 8) ) {
subScreenWidth = 256;
subScreenHeight = 192;
@@ -2064,13 +2064,13 @@ void VBlankHandler(void) {
//triggerIcon(-1);
}
}
-
+
subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
subScTargetY = yCenter - ((subScreenHeight >> 1) << 8);
-
-
+
+
if (subScTargetX < 0) subScTargetX = 0;
if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8;
@@ -2082,30 +2082,30 @@ void VBlankHandler(void) {
subScX += (subScTargetX - subScX) >> 2;
subScY += (subScTargetY - subScY) >> 2;
-
+
if (displayModeIs8Bit) {
-
+
if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
-
+
int offsX = 0, offsY = 0;
if (getKeysHeld() & KEY_LEFT) {
offsX -= 1;
}
-
+
if (getKeysHeld() & KEY_RIGHT) {
offsX += 1;
}
-
+
if (getKeysHeld() & KEY_UP) {
offsY -= 1;
}
-
+
if (getKeysHeld() & KEY_DOWN) {
offsY += 1;
}
-
+
if (((gameScreenSwap) && (getKeysHeld() & KEY_L)) || ((!gameScreenSwap) && (getKeysHeld() & KEY_R))) {
subScTargetX += offsX << 8;
subScTargetY += offsY << 8;
@@ -2116,32 +2116,32 @@ void VBlankHandler(void) {
}
if (!scaledMode) {
-
+
if (scX + 256 > gameWidth - 1) {
scX = gameWidth - 1 - 256;
}
-
+
if (scX < 0) {
scX = 0;
}
-
+
if (scY + 192 > gameHeight - 1) {
scY = gameHeight - 1 - 192;
}
-
+
if (scY < 0) {
scY = 0;
}
-
+
setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
-
-
+
+
setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8));
setMainScreenScale(256, 256); // 1:1 scale
-
+
} else {
-
+
if (scY > gameHeight - 192 - 1) {
scY = gameHeight - 192 - 1;
}
@@ -2149,13 +2149,13 @@ void VBlankHandler(void) {
if (scY < 0) {
scY = 0;
}
-
+
setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
-
+
setMainScreenScroll(64, (scY << 8) + (shakePos << 8));
setMainScreenScale(320, 256); // 1:1 scale
-
+
}
} else {
setZoomedScreenScroll(0, 0, true);
@@ -2164,12 +2164,12 @@ void VBlankHandler(void) {
setMainScreenScroll(0, 0);
setMainScreenScale(320, 256); // 1:1 scale
}
-
+
// Enable on screen keyboard when pen taps icon
if ((keyboardIcon) && (penX < 32) && (penY > 160) && (penHeld)) {
setKeyboardEnable(true);
}
-
+
if (keyboardEnable) {
if (DS::getKeyboardClosed()) {
setKeyboardEnable(false);
@@ -2219,7 +2219,7 @@ void setTopScreenTarget(int x, int y) {
if (subScTargetY < 0) subScTargetY = 0;
if (subScTargetY > gameHeight - subScreenHeight) subScTargetY = gameHeight - subScreenHeight;
-
+
subScTargetX <<=8;
subScTargetY <<=8;
}
@@ -2233,8 +2233,8 @@ void hBlankHandler() {
#endif
void uploadSpriteGfx() {
- vramSetBankD(VRAM_D_SUB_SPRITE);
- vramSetBankE(VRAM_E_MAIN_SPRITE);
+ vramSetBankD(VRAM_D_SUB_SPRITE);
+ vramSetBankE(VRAM_E_MAIN_SPRITE);
// Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit!
u8* srcTex = (u8 *) ::icons_raw;
@@ -2242,7 +2242,7 @@ void uploadSpriteGfx() {
SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
}
-
+
}
void initHardware() {
@@ -2253,12 +2253,12 @@ void initHardware() {
penInit();
powerON(POWER_ALL);
-/* vramSetBankA(VRAM_A_MAIN_BG);
- vramSetBankB(VRAM_B_MAIN_BG);
+/* vramSetBankA(VRAM_A_MAIN_BG);
+ vramSetBankB(VRAM_B_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG); */
- vramSetBankD(VRAM_D_SUB_SPRITE);
- vramSetBankE(VRAM_E_MAIN_SPRITE);
-
+ vramSetBankD(VRAM_D_SUB_SPRITE);
+ vramSetBankE(VRAM_E_MAIN_SPRITE);
+
currentTimeMillis = 0;
@@ -2286,8 +2286,8 @@ void initHardware() {
// Allocate save buffer for game screen
// savedBuffer = new u8[320 * 200];
displayMode16Bit();
-
- memset(BG_GFX, 0, 512 * 256 * 2);
+
+ memset(BG_GFX, 0, 512 * 256 * 2);
scaledMode = true;
scX = 0;
scY = 0;
@@ -2295,33 +2295,33 @@ void initHardware() {
subScY = 0;
subScTargetX = 0;
subScTargetY = 0;
-
+
//lcdSwap();
POWER_CR &= ~POWER_SWAP_LCDS;
-
+
frameCount = 0;
callback = NULL;
-
-// vramSetBankH(VRAM_H_SUB_BG);
-
+
+// vramSetBankH(VRAM_H_SUB_BG);
+
// // Do text stuff
//BG0_CR = BG_MAP_BASE(0) | BG_TILE_BASE(1);
// BG0_Y0 = 48;
-
+
PALETTE[255] = RGB15(31,31,31);//by default font will be rendered with color 255
-
+
//consoleInit() is a lot more flexible but this gets you up and running quick
// consoleInitDefault((u16*)SCREEN_BASE_BLOCK(0), (u16*)CHAR_BASE_BLOCK(1), 16);
//consolePrintSet(0, 6);
-
+
//irqs are nice
irqInit();
// irqInitHandler();
irqSet(IRQ_VBLANK, VBlankHandler);
irqSet(IRQ_TIMER0, timerTickHandler);
irqSet(IRQ_TIMER2, soundBufferEmptyHandler);
-
+
irqEnable(IRQ_VBLANK);
irqEnable(IRQ_TIMER0);
irqEnable(IRQ_TIMER2);
@@ -2330,15 +2330,15 @@ void initHardware() {
irqSet(IRQ_HBLANK, hBlankHandler);
irqEnable(IRQ_HBLANK);
#endif
-
-
+
+
// Set up a millisecond timer
#ifdef HEAVY_LOGGING
consolePrintf("Setting up timer...");
#endif
TIMER0_CR = 0;
TIMER0_DATA = (u32) TIMER_FREQ(1000);
- TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
+ TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
REG_IME = 1;
#ifdef HEAVY_LOGGING
consolePrintf("done\n");
@@ -2347,7 +2347,7 @@ void initHardware() {
PALETTE[255] = RGB15(0,0,31);
initSprites();
-
+
// videoSetModeSub(MODE_3_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
// If the software scaler's back buffer has not been allocated, do it now
@@ -2405,7 +2405,7 @@ void penUpdate() {
if ((tapTimeout >= 0)) {
tapTimeout++;
-
+
if (((tapTimeout > 15) || (tapCount == 2)) && (tapCount > 0)) {
tapComplete = tapCount;
tapCount = 0;
@@ -2413,7 +2413,7 @@ void penUpdate() {
}
}
-
+
if ((penHeld) && (!penDownThisFrame)) {
if ((touchPadStyle) || (moved) || (tapCount == 1)) {
@@ -2427,15 +2427,15 @@ void penUpdate() {
}
}
-
+
if ((touchPadStyle) && (getIsDisplayMode8Bit())) {
-
- if ((penDownFrames > 0)) {
-
-
+
+ if ((penDownFrames > 0)) {
+
+
if ((penHeld)) {
-
+
if (penDownThisFrame)
{
if (penDownFrames >= 2) {
@@ -2446,13 +2446,13 @@ void penUpdate() {
if ((ABS(diffX) < 35) && (ABS(diffY) < 35))
{
-
+
if (speed >= 8)
{
diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
}
-
+
penX += diffX;
penY += diffY;
if (penX > 255) penX = 255;
@@ -2460,30 +2460,30 @@ void penUpdate() {
if (penY > 191) penY = 191;
if (penY < 0) penY = 0;
}
-
+
// consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY);
penDownX = IPC->touchXpx;
penDownY = IPC->touchYpx;
-
+
}
}
else
{
}
-
-
+
+
} else {
penDown = true;
penHeld = true;
penDownSaved = true;
-
+
// First frame, so save pen positions
if (penDownThisFrame) {
penDownX = IPC->touchXpx;
penDownY = IPC->touchYpx;
}
}
-
+
} else {
if (penHeld) {
penReleased = true;
@@ -2491,13 +2491,13 @@ void penUpdate() {
} else {
penReleased = false;
}
-
+
penDown = false;
penHeld = false;
}
} else {
if ((penDownFrames > 1)) { // Is this right? Dunno, but it works for me.
-
+
if ((penHeld)) {
penHeld = true;
penDown = false;
@@ -2512,9 +2512,9 @@ void penUpdate() {
penY = IPC->touchYpx + touchYOffset;
moved = true;
}
-
-
+
+
} else {
if (penHeld) {
penReleased = true;
@@ -2522,12 +2522,12 @@ void penUpdate() {
} else {
penReleased = false;
}
-
+
penDown = false;
penHeld = false;
}
-
-
+
+
}
@@ -2545,20 +2545,20 @@ int leftHandedSwap(int keys) {
// Start and select are unchanged
if (leftHandedMode) {
int result = keys & (~(KEY_R | KEY_L | KEY_Y | KEY_A | KEY_B | KEY_X | KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN));
-
+
if (keys & KEY_L) result |= KEY_R;
if (keys & KEY_R) result |= KEY_L;
-
+
if (keys & KEY_LEFT) result |= KEY_Y;
if (keys & KEY_RIGHT) result |= KEY_A;
if (keys & KEY_DOWN) result |= KEY_B;
if (keys & KEY_UP) result |= KEY_X;
-
+
if (keys & KEY_Y) result |= KEY_LEFT;
if (keys & KEY_A) result |= KEY_RIGHT;
if (keys & KEY_B) result |= KEY_DOWN;
if (keys & KEY_X) result |= KEY_UP;
-
+
return result;
} else {
return keys;
@@ -2647,10 +2647,10 @@ int getPenY() {
GLvector getPenPos() {
GLvector v;
-
+
v.x = (penX * inttof32(1)) / SCREEN_WIDTH;
v.y = (penY * inttof32(1)) / SCREEN_HEIGHT;
-
+
return v;
}
@@ -2659,18 +2659,18 @@ GLvector getPenPos() {
void formatSramOption() {
consolePrintf("The following files are present in save RAM:\n");
DSSaveFileManager::instance()->listFiles();
-
+
consolePrintf("\nAre you sure you want to\n");
consolePrintf("DELETE all files?\n");
consolePrintf("A = Yes, X = No\n");
-
+
while (true) {
if (keysHeld() & KEY_A) {
DSSaveFileManager::instance()->formatSram();
consolePrintf("SRAM cleared!\n");
return;
}
-
+
if (keysHeld() & KEY_X) {
consolePrintf("Whew, that was close!\n");
return;
@@ -2708,7 +2708,7 @@ void* fastRamAlloc(int size) {
if(fastRamPointer > fastRamData + FAST_RAM_SIZE) {
consolePrintf("FastRam (ITCM) allocation failed!\n");
return NULL;
- }
+ }
return result;
}
@@ -2723,7 +2723,7 @@ void fastRamReset() {
bool GBAMPAvail = false;
-bool initGBAMP(int mode) {
+bool initGBAMP(int mode) {
if (FAT_InitFiles()) {
if (mode == 2) {
disc_IsInserted();
@@ -2748,14 +2748,14 @@ void initDebugger() {
set_verbosity(VERBOSE_INFO | VERBOSE_ERROR);
wireless_init(0);
wireless_connect();
-
+
// This is where the address of the computer running the Java
// stub goes.
debugger_connect_tcp(192, 168, 0, 1);
- debugger_init();
-
+ debugger_init();
+
// Update function - should really call every frame
- user_debugger_update();
+ user_debugger_update();
}
@@ -2788,7 +2788,7 @@ cardTranslate cardReaderTable[] = {
void reboot() {
int deviceType = -1;
-
+
if (disc_getDeviceId() == DEVICE_DLDI) {
char id[6];
@@ -2855,7 +2855,7 @@ void dsExceptionHandler() {
consolePrintf("Blue screen of death");
setExceptionHandler(NULL);
-
+
u32 currentMode = getCPSR() & 0x1f;
u32 thumbState = ((*(u32*)0x027FFD90) & 0x20);
@@ -2871,7 +2871,7 @@ void dsExceptionHandler() {
exceptionAddress = getExceptionAddress( codeAddress, thumbState);
else
exceptionAddress = codeAddress;
-
+
} else {
if (thumbState)
offset = 2;
@@ -2919,13 +2919,13 @@ int main(void) {
initDebugger();
}
#endif
-
+
// Let arm9 read cartridge
*((u16 *) (0x04000204)) &= ~0x0080;
-
+
lastCallbackFrame = 0;
tweak = 0;
-
+
indyFightState = false;
indyFightRight = true;
@@ -2938,25 +2938,25 @@ int main(void) {
// bufferSize = 10;
-
+
/*bufferRate = 44100;
bufferFrame = 0;
bufferSamples = 8192;
bufferFirstHalf = false;
bufferSecondHalf = true;
-
+
int bytes = (2 * (bufferSamples)) + 100;
-
+
soundBuffer = (s16 *) malloc(bytes * 2);
soundHiPart = true;
-
+
for (int r = 0; r < bytes; r++) {
soundBuffer[r] = 0;
}
-
+
swiWaitForVBlank();
swiWaitForVBlank();
@@ -2965,29 +2965,29 @@ int main(void) {
swiWaitForVBlank();
swiWaitForVBlank();
*/
-
+
lastEventFrame = 0;
mouseMode = MOUSE_LEFT;
-
+
/*
TIMER1_CR = 0;
TIMER1_DATA = TIMER_FREQ(bufferRate);
TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1;
-
+
TIMER2_CR = 0;
TIMER2_DATA = 0xFFFF - (bufferSamples / 2);
TIMER2_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
*/
// 2945 - 2947
-
-
+
+
// for (int r = 2946; r < 3000; r++) {
// soundBuffer[r] = 30000;
// }
-
+
//2372
consolePrintf("-------------------------------\n");
@@ -3040,7 +3040,7 @@ int main(void) {
consolePrintf("\n");
#endif
-
+
#ifdef USE_BUILT_IN_DRIVER_SELECTION
// Do M3 detection selectioon
int extraData = DSSaveFileManager::getExtraData();
@@ -3079,7 +3079,7 @@ int main(void) {
disc_setEnable(mode);
DSSaveFileManager::setExtraData(mode);
#else
-
+
int mode = 0;
#endif
@@ -3125,11 +3125,11 @@ int main(void) {
}
delete node;
-
+
updateStatus();
-
-
+
+
// OSystem_DS::instance();
g_system = new OSystem_DS();
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index ab74554917..7efd4a9365 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _DSMAIN_H
#define _DSMAIN_H
@@ -93,7 +93,7 @@ int getMillis(); // Return the current runtime in milliseconds
void doTimerCallback(); // Call callback function if required
// Sound
-void doSoundCallback();
+void doSoundCallback();
void startSound(int freq, int buffer); // Start sound hardware
// Call function if sound buffers need more data
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp
index 60f3c2225b..a6996c0fcb 100644
--- a/backends/platform/ds/arm9/source/dsoptions.cpp
+++ b/backends/platform/ds/arm9/source/dsoptions.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#include "dsoptions.h"
#include "dsmain.h"
#include "gui/dialog.h"
@@ -98,7 +98,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
_tab->setActiveTab(0);
_radioButtonMode = false;
-
+
#ifdef DS_SCUMM_BUILD
if (!DS::isGBAMPAvailable()) {
// addButton(this, 100, 140, "Delete Save", 'dels', 'D');
@@ -112,7 +112,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
// _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
//#endif
-
+
@@ -145,13 +145,13 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
_unscaledCheckbox->setState(false);
}
-
+
if (ConfMan.hasKey("topscreenzoom", "ds")) {
- _100PercentCheckbox->setState(false);
- _150PercentCheckbox->setState(false);
- _200PercentCheckbox->setState(false);
-
+ _100PercentCheckbox->setState(false);
+ _150PercentCheckbox->setState(false);
+ _200PercentCheckbox->setState(false);
+
switch (ConfMan.getInt("topscreenzoom", "ds"))
{
case 100: {
@@ -237,7 +237,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) {
if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) {
_hardScaler->setState(true);
}
-
+
_radioButtonMode = true;
}
@@ -293,17 +293,17 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
_cpuScaler->setState(false);
_hardScaler->setState(false);
_unscaledCheckbox->setState(false);
-
+
if ((sender == _cpuScaler) && (cmd == 0x10000002))
{
_cpuScaler->setState(true);
}
-
+
if ((sender == _hardScaler) && (cmd == 0x10000001))
{
_hardScaler->setState(true);
}
-
+
if ((sender == _unscaledCheckbox) && (cmd == 0x10000003))
{
_unscaledCheckbox->setState(true);
@@ -392,11 +392,11 @@ void togglePause() {
OSystem_DS* system = OSystem_DS::instance();
event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = Common::KEYCODE_p;
+ event.kbd.keycode = Common::KEYCODE_p;
event.kbd.ascii = 'p';
event.kbd.flags = 0;
system->addEvent(event);
-
+
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
@@ -407,12 +407,12 @@ void showOptionsDialog() {
togglePause();
DS::displayMode16Bit();
-
+
DSOptionsDialog* d = new DSOptionsDialog();
d->runModal();
delete d;
-
+
DS::displayMode8Bit();
togglePause();
@@ -487,7 +487,7 @@ void setOptions() {
} else {
DS::setCpuScalerEnable(false);
}
-#endif
+#endif
if (ConfMan.hasKey("screentaps", "ds")) {
DS::setTapScreenClicksEnable(ConfMan.getBool("screentaps", "ds"));
@@ -497,7 +497,7 @@ void setOptions() {
if (ConfMan.hasKey("touchpad", "ds")) {
bool enable = ConfMan.getBool("touchpad", "ds");
-
+
DS::setTrackPadStyleEnable(enable);
if ((enable) and (firstLoad)) {
@@ -509,7 +509,7 @@ void setOptions() {
if (enable) {
DS::setTapScreenClicksEnable(true);
}
-
+
} else {
DS::setTrackPadStyleEnable(false);
}
diff --git a/backends/platform/ds/arm9/source/fat/disc_io.h b/backends/platform/ds/arm9/source/fat/disc_io.h
index 2d3da1fc6f..d9a3c67353 100644
--- a/backends/platform/ds/arm9/source/fat/disc_io.h
+++ b/backends/platform/ds/arm9/source/fat/disc_io.h
@@ -7,7 +7,7 @@
// Use DMA to read the card, remove this line to use normal reads/writes
// #define _CF_USE_DMA
-// Allow buffers not aligned to 16 bits when reading files.
+// Allow buffers not aligned to 16 bits when reading files.
// Note that this will slow down access speed, so only use if you have to.
// It is also incompatible with DMA
#define _CF_ALLOW_UNALIGNED
@@ -43,7 +43,7 @@
// This allows the code to build on an earlier version of libnds, before the register was renamed
#ifndef REG_EXMEMCNT
-#define REG_EXMEMCNT REG_EXEMEMCNT
+#define REG_EXMEMCNT REG_EXEMEMCNT
#endif
#ifndef REG_EXEMEMCNT
@@ -70,7 +70,7 @@
#endif
// Disable NDS specific hardware and features if running on a GBA
-#ifndef NDS
+#ifndef NDS
#undef SUPPORT_NMMC
#undef DISC_CACHE
#endif
diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
index 539f94fef7..f9746560e0 100644
--- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
+++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
@@ -147,7 +147,7 @@ bool FAT_GetAlias (char* alias);
/*-----------------------------------------------------------------
FAT_GetLongFilename
-Get the long name of the last file or directory retrived with
+Get the long name of the last file or directory retrived with
GetDirEntry. Also works for FindFirstFile and FindNextFile
char* filename: OUT will be filled with the filename, should be at
least 256 bytes long
@@ -210,7 +210,7 @@ FAT_FindNextFile
Gets the name of the next directory entry
(can be a file or subdirectory)
char* filename: OUT filename, must be at least 13 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindNextFile (char* filename);
@@ -220,7 +220,7 @@ FAT_FindFirstFile
Gets the name of the first directory entry and resets the count
(can be a file or subdirectory)
char* filename: OUT filename, must be at least 13 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindFirstFile (char* filename);
@@ -230,7 +230,7 @@ FAT_FindFirstFileLFN
Gets the long file name of the first directory entry and resets
the count (can be a file or subdirectory)
char* lfn: OUT long file name, must be at least 256 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindFirstFileLFN(char* lfn);
@@ -240,16 +240,16 @@ FAT_FindNextFileLFN
Gets the long file name of the next directory entry
(can be a file or subdirectory)
char* lfn: OUT long file name, must be at least 256 chars long
-FILE_TYPE return: OUT returns FT_NONE if failed,
+FILE_TYPE return: OUT returns FT_NONE if failed,
FT_FILE if it found a file and FT_DIR if it found a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FindNextFileLFN(char* lfn);
/*-----------------------------------------------------------------
FAT_FileExists
-Returns the type of file
+Returns the type of file
char* filename: IN filename of the file to look for
-FILE_TYPE return: OUT returns FT_NONE if there is now file with
+FILE_TYPE return: OUT returns FT_NONE if there is now file with
that name, FT_FILE if it is a file and FT_DIR if it is a directory
-----------------------------------------------------------------*/
FILE_TYPE FAT_FileExists (const char* filename);
@@ -269,7 +269,7 @@ u32 FAT_GetFileSystemTotalSize (void);
/*-----------------------------------------------------------------
FAT_chdir
Changes the current working directory
-const char* path: IN null terminated string of directory separated by
+const char* path: IN null terminated string of directory separated by
forward slashes, / is root
bool return: OUT returns true if successful
-----------------------------------------------------------------*/
@@ -282,12 +282,12 @@ bool FAT_chdir (const char* path);
/*-----------------------------------------------------------------
FAT_fopen(filename, mode)
Opens a file
-const char* path: IN null terminated string of filename and path
+const char* path: IN null terminated string of filename and path
separated by forward slashes, / is root
const char* mode: IN mode to open file in
Supported modes: "r", "r+", "w", "w+", "a", "a+", don't use
"b" or "t" in any mode, as all files are openned in binary mode
-FAT_FILE* return: OUT handle to open file, returns -1 if the file
+FAT_FILE* return: OUT handle to open file, returns -1 if the file
couldn't be openned
-----------------------------------------------------------------*/
FAT_FILE* FAT_fopen(const char* path, const char* mode);
@@ -338,7 +338,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file);
FAT_fwrite(buffer, size, count, file)
Writes size * count bytes into file from buffer, starting
from current position. It then sets the current position to the
- byte after the last byte written. If the file was openned in
+ byte after the last byte written. If the file was openned in
append mode it always writes to the end of the file.
const void* buffer IN: Pointer to buffer containing data. Should be
at least as big as the number of bytes to be written.
@@ -371,7 +371,7 @@ int FAT_remove (const char* path);
#ifdef CAN_WRITE_TO_DISC
/*-----------------------------------------------------------------
FAT_mkdir (path)
-Makes a new directory, so long as no other directory or file has
+Makes a new directory, so long as no other directory or file has
the same name.
const char* path IN: Path and filename of directory to make
int return OUT: zero if successful, non-zero if not
@@ -403,9 +403,9 @@ FAT_fgets (char *tgtBuffer, int num, FAT_FILE* file)
Gets a up to num bytes from file, stopping at the first
newline.
-CAUTION: does not do strictly streaming. I.e. it's
+CAUTION: does not do strictly streaming. I.e. it's
reading more then needed bytes and seeking back.
- shouldn't matter for random access
+ shouldn't matter for random access
char *tgtBuffer OUT: buffer to write to
int num IN: size of target buffer
diff --git a/backends/platform/ds/arm9/source/fat/io_dldi.h b/backends/platform/ds/arm9/source/fat/io_dldi.h
index 053de3a94c..034c6aace3 100644
--- a/backends/platform/ds/arm9/source/fat/io_dldi.h
+++ b/backends/platform/ds/arm9/source/fat/io_dldi.h
@@ -1,8 +1,8 @@
/*
- io_dldi.h
+ io_dldi.h
Reserved space for new drivers
-
+
This software is completely free. No warranty is provided.
If you use it, please give me credit and email me about your
project at chishm@hotmail.com
diff --git a/backends/platform/ds/arm9/source/fat/io_fcsr.h b/backends/platform/ds/arm9/source/fat/io_fcsr.h
index 2f87c1c8aa..ef390a8ad6 100644
--- a/backends/platform/ds/arm9/source/fat/io_fcsr.h
+++ b/backends/platform/ds/arm9/source/fat/io_fcsr.h
@@ -1,5 +1,5 @@
/*
- io_fcsr.h
+ io_fcsr.h
Hardware Routines for using a GBA Flash Cart with SRAM
@@ -23,7 +23,7 @@ extern LPIO_INTERFACE FCSR_GetInterface(void) ;
#endif // define IO_FCSR_H
/*
- io_fcsr.h
+ io_fcsr.h
Hardware Routines for using a GBA Flash Cart with SRAM
diff --git a/backends/platform/ds/arm9/source/fat/io_m3_common.h b/backends/platform/ds/arm9/source/fat/io_m3_common.h
index 92e6bed980..6d0c669783 100644
--- a/backends/platform/ds/arm9/source/fat/io_m3_common.h
+++ b/backends/platform/ds/arm9/source/fat/io_m3_common.h
@@ -1,5 +1,5 @@
/*
- io_m3_common.h
+ io_m3_common.h
Routines common to all version of the M3
@@ -7,7 +7,7 @@
Some code written by SaTa may have been unknowingly used.
Copyright (c) 2006 Michael "Chishm" Chisholm
-
+
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -40,7 +40,7 @@
// Values for changing mode
#define M3_MODE_ROM 0x00400004
-#define M3_MODE_MEDIA 0x00400003
+#define M3_MODE_MEDIA 0x00400003
extern void _M3_changeMode (u32 mode);
diff --git a/backends/platform/ds/arm9/source/fat/io_m3cf.h b/backends/platform/ds/arm9/source/fat/io_m3cf.h
index bade53f511..006c283adc 100644
--- a/backends/platform/ds/arm9/source/fat/io_m3cf.h
+++ b/backends/platform/ds/arm9/source/fat/io_m3cf.h
@@ -1,5 +1,5 @@
/*
- io_m3cf.h
+ io_m3cf.h
Hardware Routines for reading a compact flash card
using the M3 CF
@@ -24,7 +24,7 @@ extern LPIO_INTERFACE M3CF_GetInterface(void) ;
#endif // define IO_M3CF_H
/*
- io_m3cf.h
+ io_m3cf.h
Hardware Routines for reading a compact flash card
using the M3 CF
diff --git a/backends/platform/ds/arm9/source/fat/io_mmcf.h b/backends/platform/ds/arm9/source/fat/io_mmcf.h
index baa43ac59f..fa9e6536ee 100644
--- a/backends/platform/ds/arm9/source/fat/io_mmcf.h
+++ b/backends/platform/ds/arm9/source/fat/io_mmcf.h
@@ -1,5 +1,5 @@
/*
- io_mmcf.h
+ io_mmcf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
diff --git a/backends/platform/ds/arm9/source/fat/io_mpcf.h b/backends/platform/ds/arm9/source/fat/io_mpcf.h
index 58cab41b4c..8ec8859097 100644
--- a/backends/platform/ds/arm9/source/fat/io_mpcf.h
+++ b/backends/platform/ds/arm9/source/fat/io_mpcf.h
@@ -1,5 +1,5 @@
/*
- io_mpcf.h
+ io_mpcf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
@@ -24,7 +24,7 @@ extern LPIO_INTERFACE MPCF_GetInterface(void) ;
#endif // define IO_MPCF_H
/*
- io_mpcf.h
+ io_mpcf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
diff --git a/backends/platform/ds/arm9/source/fat/io_njsd.h b/backends/platform/ds/arm9/source/fat/io_njsd.h
index a297cda112..dce469cad6 100644
--- a/backends/platform/ds/arm9/source/fat/io_njsd.h
+++ b/backends/platform/ds/arm9/source/fat/io_njsd.h
@@ -1,11 +1,11 @@
/*
- io_njsd.h
+ io_njsd.h
Hardware Routines for reading an SD card using
a NinjaDS SD adapter.
Copyright (c) 2006 Michael "Chishm" Chisholm
-
+
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
diff --git a/backends/platform/ds/arm9/source/fat/io_nmmc.h b/backends/platform/ds/arm9/source/fat/io_nmmc.h
index 5244d21868..0249e3a864 100644
--- a/backends/platform/ds/arm9/source/fat/io_nmmc.h
+++ b/backends/platform/ds/arm9/source/fat/io_nmmc.h
@@ -1,5 +1,5 @@
/*
- io_NMMC.h
+ io_NMMC.h
Hardware Routines for reading an SD or MMC card using
a Neoflash MK2 or MK3.
@@ -26,7 +26,7 @@ extern LPIO_INTERFACE NMMC_GetInterface(void) ;
#endif // define IO_NMMC_H
/*
- io_NMMC.h
+ io_NMMC.h
Hardware Routines for reading an SD or MMC card using
a Neoflash MK2 or MK3.
diff --git a/backends/platform/ds/arm9/source/fat/io_sccf.h b/backends/platform/ds/arm9/source/fat/io_sccf.h
index 961909fbce..2270c4eab1 100644
--- a/backends/platform/ds/arm9/source/fat/io_sccf.h
+++ b/backends/platform/ds/arm9/source/fat/io_sccf.h
@@ -1,5 +1,5 @@
/*
- io_sccf.h
+ io_sccf.h
Hardware Routines for reading a compact flash card
using the Supercard CF
@@ -24,7 +24,7 @@ extern LPIO_INTERFACE SCCF_GetInterface(void) ;
#endif // define IO_SCCF_H
/*
- io_sccf.h
+ io_sccf.h
Hardware Routines for reading a compact flash card
using the Supercard CF
diff --git a/backends/platform/ds/arm9/source/fat/io_scsd.h b/backends/platform/ds/arm9/source/fat/io_scsd.h
index 75115b8d62..492492f619 100644
--- a/backends/platform/ds/arm9/source/fat/io_scsd.h
+++ b/backends/platform/ds/arm9/source/fat/io_scsd.h
@@ -1,12 +1,12 @@
/*
io_scsd.h by SaTa.
based on io_sccf.h
-
-
+
+
*/
/*
- io_sccf.h
+ io_sccf.h
Hardware Routines for reading a compact flash card
using the GBA Movie Player
@@ -26,4 +26,4 @@
// export interface
extern LPIO_INTERFACE SCSD_GetInterface(void) ;
-#endif // define IO_SCSD_H \ No newline at end of file
+#endif // define IO_SCSD_H
diff --git a/backends/platform/ds/arm9/source/fat/io_sd_common.h b/backends/platform/ds/arm9/source/fat/io_sd_common.h
index 09abffab39..8962d88890 100644
--- a/backends/platform/ds/arm9/source/fat/io_sd_common.h
+++ b/backends/platform/ds/arm9/source/fat/io_sd_common.h
@@ -8,7 +8,7 @@
SD routines partially based on sd.s by Romman
Copyright (c) 2006 Michael "Chishm" Chisholm
-
+
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -32,7 +32,7 @@
2006-07-11 - Chishm
* Original release
-
+
2006-07-28 - Chishm
* Changed voltage range that the SD card can use
*/
@@ -76,7 +76,7 @@
#define SD_STATE_IDENT 2 // Identification state, after ALL_SEND_CID
#define SD_STATE_STBY 3 // Standby state, when card is deselected
#define SD_STATE_TRAN 4 // Transfer state, after card is selected and ready for data transfer
-#define SD_STATE_DATA 5 //
+#define SD_STATE_DATA 5 //
#define SD_STATE_RCV 6 // Receive data state
#define SD_STATE_PRG 7 // Programming state
#define SD_STATE_DIS 8 // Disconnect state
@@ -85,7 +85,7 @@
#define READY_FOR_DATA 1 // bit 8 in card status
/*
-Calculate the CRC7 of a command and return it preshifted with
+Calculate the CRC7 of a command and return it preshifted with
an end bit added
*/
extern u8 _SD_CRC7(u8* data, int size);
@@ -106,7 +106,7 @@ cmd_17byte_response: a pointer to a function that sends the SD card a command an
use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
*/
-extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
+extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
_SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
bool use4bitBus,
u32 *RCA);
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index a53ab9739d..8814fc4957 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -93,40 +93,40 @@ uint32 GBAMPSaveFile::write(const void *buf, uint32 size) {
memcpy(buffer + bufferPos, buf, size);
bufferPos += size;
-
+
saveSize += size;
/* int pos = 0;
-
+
int rest = SAVE_BUFFER_SIZE - bufferPos;
memcpy(buffer + bufferPos, buf, rest);
bufferPos = 512;
pos += rest;
- flushSaveBuffer();
+ flushSaveBuffer();
size -= rest;
// consolePrintf("First section: %d\n", rest);
-
+
while (size >= 512) {
DS::std_fwrite(((char *) (buf)) + pos, 1, 512, handle);
size -= 512;
pos += 512;
// consolePrintf("Full chunk, %d left ", size);
}
-
+
bufferPos = 0;
memcpy(buffer + bufferPos, ((char *) (buf)) + pos, size);
bufferPos += size;
// consolePrintf("%d left in buffer ", bufferPos);*/
-
+
} else {
-
+
memcpy(buffer + bufferPos, buf, size);
bufferPos += size;
-
+
saveSize += size;
}
-
+
// if ((size > 100) || (size <= 0)) consolePrintf("Write %d bytes\n", size);
return size;
}
@@ -146,24 +146,24 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() {
GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
char fileSpec[128];
-
+
strcpy(fileSpec, getSavePath());
-
+
if (fileSpec[strlen(fileSpec) - 1] == '/') {
sprintf(fileSpec, "%s%s", getSavePath(), name);
} else {
sprintf(fileSpec, "%s/%s", getSavePath(), name);
}
-
+
// consolePrintf("Opening the file: %s\n", fileSpec);
GBAMPSaveFile* sf = new GBAMPSaveFile(fileSpec, saveOrLoad);
if (sf->isOpen()) {
// consolePrintf("Ok");
- return sf;
+ return sf;
} else {
// consolePrintf("Fail");
delete sf;
- return NULL;
+ return NULL;
}
}
@@ -189,11 +189,11 @@ const char *GBAMPSaveFileManager::getSavePath() const {
return dir;
}
-Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
+Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
char name[256];
-
+
{
char dir[128];
strcpy(dir, getSavePath());
@@ -218,13 +218,13 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
// consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(), pattern);
-
+
int fileType = FAT_FindFirstFileLFN(name);
Common::StringList list;
do {
-
+
if (fileType == TYPE_FILE) {
FAT_GetLongFilename(name);
@@ -232,18 +232,18 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
for (int r = 0; name[r] != 0; r++) {
name[r] = tolower(name[r]);
}
-
-
+
+
if (Common::matchString(name, pattern)) {
list.push_back(name);
}
}
} while ((fileType = FAT_FindNextFileLFN(name)));
-
+
FAT_chdir("/");
return list;
-}
+}
diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h
index 6ddc4fd964..c92d5d6151 100644
--- a/backends/platform/ds/arm9/source/gbampsave.h
+++ b/backends/platform/ds/arm9/source/gbampsave.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _GBAMPSAVE_H_
#define _GBAMPSAVE_H_
@@ -38,19 +38,19 @@ class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
public:
GBAMPSaveFile(char* name, bool saveOrLoad);
virtual ~GBAMPSaveFile();
-
+
virtual uint32 read(void *buf, uint32 size);
virtual uint32 write(const void *buf, uint32 size);
-
+
virtual bool eos() const;
virtual bool skip(uint32 bytes);
virtual int32 pos() const;
virtual int32 size() const;
virtual bool seek(int32 pos, int whence);
-
+
void flushSaveBuffer();
-
+
virtual bool isOpen() const {
return handle != 0;
}
@@ -61,17 +61,17 @@ class GBAMPSaveFileManager : public Common::SaveFileManager {
public:
GBAMPSaveFileManager();
~GBAMPSaveFileManager();
-
+
// static GBAMPSaveFileManager* instance() { return instancePtr; }
GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad);
-
+
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
-
+
virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
virtual Common::StringList listSavefiles(const char *pattern);
-
+
void deleteFile(char* name);
void listFiles();
diff --git a/backends/platform/ds/arm9/source/keys.cpp b/backends/platform/ds/arm9/source/keys.cpp
index dcec2287b9..8bfc983565 100644
--- a/backends/platform/ds/arm9/source/keys.cpp
+++ b/backends/platform/ds/arm9/source/keys.cpp
@@ -27,26 +27,26 @@
$Log: keys.c,v $
Revision 1.13 2006/01/12 09:10:47 wntrmute
Added key repeat as suggested by pepsiman
-
+
Revision 1.12 2005/11/27 12:30:25 wntrmute
reverted to correct hardware REGisters
-
+
Revision 1.11 2005/11/27 07:48:45 joatski
Renamed REG_KEYINPUT and REG_KEYCNT back to KEYS and KEYS_CR, as the alternatives are defined in registers_alt.h.
Changed function returns to uint32
-
+
Revision 1.10 2005/11/03 23:38:49 wntrmute
don't use enum for key function returns
-
+
Revision 1.9 2005/10/13 16:30:11 dovoto
Changed KEYPAD_BITS to a typedef enum, this resolved some issues with multiple redefinition of KEYPAD_BITS (although this error did not allways occur).
-
+
Revision 1.8 2005/10/03 21:21:59 wntrmute
use enum types
-
+
Revision 1.7 2005/09/07 18:06:27 wntrmute
use new register names
-
+
Revision 1.6 2005/08/23 17:06:10 wntrmute
converted all endings to unix
@@ -148,4 +148,4 @@ uint32 keysUp(void) {
}
-} // namespace ds \ No newline at end of file
+} // namespace ds
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 5ddcb50b15..dac9e59588 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -63,7 +63,7 @@ int OSystem_DS::timerHandler(int t) {
tm->handler();
return t;
}
-
+
void OSystem_DS::initBackend() {
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_medium_quality", true);
@@ -80,7 +80,7 @@ void OSystem_DS::initBackend() {
_mixer->setOutputRate(DS::getSoundFrequency());
_mixer->setReady(true);
-
+
OSystem::initBackend();
}
@@ -149,13 +149,13 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
int red = *colors;
int green = *(colors + 1);
int blue = *(colors + 2);
-
+
red >>= 3;
green >>= 3;
blue >>= 3;
-
+
// if (r != 255)
- {
+ {
u16 paletteValue = red | (green << 5) | (blue << 10);
if (DS::getIsDisplayMode8Bit()) {
@@ -168,7 +168,7 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
_palette[r] = paletteValue;
}
// if (num == 255) consolePrintf("pal:%d r:%d g:%d b:%d\n", r, red, green, blue);
-
+
colors += 4;
}
}
@@ -180,14 +180,14 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) {
int red = *colors;
int green = *(colors + 1);
int blue = *(colors + 2);
-
+
red >>= 3;
green >>= 3;
blue >>= 3;
-
+
u16 paletteValue = red | (green << 5) | (blue << 10);
_cursorPalette[r] = paletteValue;
-
+
colors += 4;
}
@@ -198,7 +198,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
surf->create(DS::getGameWidth(), DS::getGameHeight(), 1);
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
-
+
const u16* image = (const u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
@@ -215,7 +215,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
// consolePrintf("Grabpalette");
-
+
for (unsigned int r = start; r < start + num; r++) {
*colors++ = (BG_PALETTE[r] & 0x001F) << 3;
*colors++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3;
@@ -228,11 +228,11 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
//consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h);
- if (!_graphicsEnable) return;
+ if (!_graphicsEnable) return;
if (w <= 1) return;
if (h < 0) return;
if (!DS::getIsDisplayMode8Bit()) return;
-
+
u16* bg;
s32 stride;
u16* bgSub = (u16 *) BG_GFX_SUB;
@@ -258,7 +258,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
u8* dest = ((u8 *) (bg)) + (dy * stride) + x;
u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x;
u8* src = (u8 *) buf + (pitch * by);
-
+
u32 dx;
u32 pixelsLeft = w;
@@ -306,7 +306,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
}
by++;
-
+
}
// consolePrintf("Slow method used!\n");
@@ -315,40 +315,40 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
} else {
// Stuff is aligned to 16-bit boundaries, so it's safe to do DMA.
-
+
u16* src = (u16 *) buf;
-
+
if (DS::getKeyboardEnable()) {
-
+
for (int dy = y; dy < y + h; dy++) {
u16* dest = bg + (dy * (stride >> 1)) + (x >> 1);
-
+
DC_FlushRange(src, w << 1);
DC_FlushRange(dest, w << 1);
dmaCopyHalfWords(3, src, dest, w);
-
+
while (dmaBusy(3));
-
+
src += pitch >> 1;
}
-
+
} else {
for (int dy = y; dy < y + h; dy++) {
u16* dest1 = bg + (dy * (stride >> 1)) + (x >> 1);
u16* dest2 = bgSub + (dy << 8) + (x >> 1);
-
+
DC_FlushRange(src, w << 1);
DC_FlushRange(dest1, w << 1);
DC_FlushRange(dest2, w << 1);
-
+
dmaCopyHalfWords(3, src, dest1, w);
-
+
if ((!_frameBufferExists) || (buf == _framebuffer.pixels)) {
dmaCopyHalfWords(2, src, dest2, w);
}
-
+
while (dmaBusy(2) || dmaBusy(3));
-
+
src += pitch >> 1;
}
}
@@ -402,36 +402,36 @@ void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) {
void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
u16* bg = (u16 *) DS::get16BitBackBuffer();
const u16* src = (const u16 *) buf;
-
+
// if (x + w > 256) w = 256 - x;
//if (x + h > 256) h = 256 - y;
// consolePrintf("Copy rect ovl %d, %d %d, %d %d\n", x, y, w, h, pitch);
-
-
+
+
for (int dy = y; dy < y + h; dy++) {
-
-
+
+
// Slow but save copy:
for (int dx = x; dx < x + w; dx++) {
-
+
*(bg + (dy * 512) + dx) = *src;
//if ((*src) != 0) consolePrintf("%d,%d: %d ", dx, dy, *src);
//consolePrintf("%d,", *src);
src++;
}
src += (pitch - w);
-
+
// Fast but broken copy: (why?)
/*
REG_IME = 0;
dmaCopy(src, bg + (dy << 9) + x, w * 2);
REG_IME = 1;
-
+
src += pitch;*/
}
-
+
// consolePrintf("Copy rect ovl done");
}
@@ -446,7 +446,7 @@ int16 OSystem_DS::getOverlayWidth() {
return getWidth();
}
-
+
bool OSystem_DS::showMouse(bool visible) {
DS::setShowCursor(visible);
return true;
@@ -498,7 +498,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
return true;
}
}
-
+
return false;
/* if (lastPenFrame != DS::getMillis()) {
@@ -511,7 +511,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
if (eventNum == 1) {
eventNum = 0;
lastPenFrame = DS::getMillis();
- if (DS::getPenDown()) {
+ if (DS::getPenDown()) {
event.type = Common::EVENT_LBUTTONDOWN;
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y);
@@ -538,12 +538,12 @@ void OSystem_DS::delayMillis(uint msecs) {
int st = getMillis();
DS::addEventsToQueue();
DS::CD::update();
-
+
DS::doSoundCallback();
while (st + msecs >= getMillis()) {
DS::doSoundCallback();
}
-
+
DS::doTimerCallback();
DS::checkSleepMode();
DS::addEventsToQueue();
@@ -599,7 +599,7 @@ void OSystem_DS::quit() {
/* consolePrintf("Soft resetting...");
IPC->reset = 1;
REG_IE = 0;
-
+
asm("swi 0x26\n");
swiSoftReset();*/
}
@@ -618,10 +618,10 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() {
} else {
forceSram = false;
}
- if (forceSram) {
+ if (forceSram) {
consolePrintf("Using SRAM save method!\n");
}
-
+
if (DS::isGBAMPAvailable() && (!forceSram)) {
return &mpSaveManager;
} else {
@@ -653,21 +653,21 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
} else {
-
+
s32 height = DS::getGameHeight();
s32 width = DS::getGameWidth();
s32 stride = DS::get8BitBackBufferStride();
-
+
u16* src = DS::get8BitBackBuffer();
u16* dest = DS::getScalerBuffer();
for (int y = 0; y < height; y++) {
-
+
u16* destLine = dest + (y * (width / 2));
u16* srcLine = src + (y * (stride / 2));
DC_FlushRange(srcLine, width);
-
+
dmaCopyHalfWords(3, srcLine, destLine, width);
}
@@ -681,7 +681,7 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
_frameBufferExists = true;
-/*
+/*
size_t imageStrideInBytes = DS::get8BitBackBufferStride();
size_t imageStrideInWords = imageStrideInBytes / 2;
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 27adf88198..ce494011d0 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
-
+
+
#ifndef _OSYSTEM_DS_H_
#define _OSYSTEM_DS_H_
#include "common/system.h"
@@ -33,13 +33,13 @@
#include "sound/mixer_intern.h"
#include "graphics/surface.h"
-class DSAudioMixer : public Audio::MixerImpl {
+class DSAudioMixer : public Audio::MixerImpl {
public:
DSAudioMixer(OSystem* system) : Audio::MixerImpl(system) { }
};
-class DSTimerManager : public DefaultTimerManager {
+class DSTimerManager : public DefaultTimerManager {
};
@@ -48,10 +48,10 @@ protected:
int eventNum;
int lastPenFrame;
-
+
Common::Event eventQueue[96];
int queuePos;
-
+
#ifdef GBA_SRAM_SAVE
DSSaveFileManager saveManager;
#endif
@@ -75,7 +75,7 @@ protected:
byte _cursorKey;
int _cursorScale;
-
+
Graphics::Surface* createTempFrameBuffer();
bool _disableCursorPalette;
@@ -114,7 +114,7 @@ public:
virtual int16 getOverlayHeight();
virtual int16 getOverlayWidth();
virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); }
-
+
virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
@@ -146,21 +146,21 @@ public:
virtual void displayMessageOnOSD(const char *msg);
virtual Common::SaveFileManager *getSavefileManager();
-
+
void addEvent(Common::Event& e);
bool isEventQueueEmpty() { return queuePos == 0; }
-
+
virtual bool grabRawScreen(Graphics::Surface* surf);
-
+
virtual void setFocusRectangle(const Common::Rect& rect);
-
+
virtual void clearFocusRectangle();
-
+
virtual void initBackend();
-
+
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
-
+
virtual Audio::Mixer* getMixer() { return _mixer; }
Audio::MixerImpl* getMixerImpl() { return _mixer; }
diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 2e5f2097d8..8a14420907 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _PORTDEFS_H_
#define _PORTDEFS_H_
@@ -82,7 +82,7 @@ int consolePrintf(const char* s, ...);
#define ITCM_DATA __attribute__((section(".itcm")))
// Since I can't change the engine at the moment (post lockdown) this define can go here.
-// This define changes the mouse-relative motion which doesn't make sense on a touch screen to
+// This define changes the mouse-relative motion which doesn't make sense on a touch screen to
// a more conventional form of input where the menus can be clicked on.
#define LURE_CLICKABLE_MENUS
diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp
index a9f4e3d2fc..113dd5df72 100644
--- a/backends/platform/ds/arm9/source/ramsave.cpp
+++ b/backends/platform/ds/arm9/source/ramsave.cpp
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ *
*/
#ifdef GBA_SRAM_SAVE
@@ -53,18 +53,18 @@ DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) {
ownsData = true;
saveCompressed = false;
// consolePrintf("Decompressed. name=%s size=%d (%d)", save.name, save.size, save.compressedSize);
-
+
} else {
ownsData = false;
origHeader = s;
}
-
+
if (save.magic == (int) 0xBEEFCAFE) {
save.isValid = true;
} else {
save.isValid = false;
}
-
+
isTempFile = false;
eosReached = false;
}
@@ -80,7 +80,7 @@ DSSaveFile::~DSSaveFile() {
}
bool DSSaveFile::loadFromSaveRAM(vu8* address) {
-
+
SCUMMSave newSave;
for (int t = 0; t < (int) sizeof(newSave); t++) {
@@ -91,13 +91,13 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) {
newSave.isValid = true;
*((u16 *) (0x4000204)) |= 0x3;
-
+
saveData = new unsigned char[newSave.compressedSize];
-
+
for (int t = 0; t < (int) newSave.compressedSize; t++) {
((char *) (saveData))[t] = *(address + t + sizeof(newSave));
}
-
+
if (ownsData) delete this->saveData;
save = newSave;
saveCompressed = true;
@@ -107,7 +107,7 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) {
return true;
}
-
+
return false;
}
@@ -116,11 +116,11 @@ void DSSaveFile::compress() {
unsigned char* compBuffer = new unsigned char[(save.size * 110) / 100];
int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size);
save.compressedSize = compSize;
-
-
-
+
+
+
delete saveData;
-
+
// Make the save smaller
saveData = (u8 *) realloc(compBuffer, save.compressedSize);
saveCompressed = true;
@@ -131,39 +131,39 @@ int DSSaveFile::saveToSaveRAM(vu8* address) {
unsigned char* compBuffer;
bool failed;
-
+
int compSize;
-
+
compress();
-
+
compSize = save.compressedSize;
compBuffer = saveData;
-
+
if (DSSaveFileManager::instance()->getBytesFree() >= getRamUsage()) {
DSSaveFileManager::instance()->addBytesFree(-getRamUsage());
-
+
// Write header
for (int t = 0; t < sizeof(save); t++) {
while (*(address + t) != ((char *) (&save))[t]) {
*(address + t) = ((char *) (&save))[t];
}
}
-
+
// Write compressed buffer
for (int t = sizeof(save); t < (int) sizeof(save) + compSize; t++) {
while (*(address + t) != compBuffer[t - sizeof(save)]) {
*(address + t) = compBuffer[t - sizeof(save)];
}
}
-
+
failed = false;
} else {
failed = true;
}
-
+
return failed? 0: compSize + sizeof(save);
}
@@ -181,7 +181,7 @@ uint32 DSSaveFile::read(void *buf, uint32 size) {
}
memcpy(buf, saveData + ptr, size);
// consolePrintf("byte: %d ", ((u8 *) (buf))[0]);
-
+
ptr += size;
return size;
}
@@ -260,7 +260,7 @@ bool DSSaveFile::matches(const char *filename) {
return false;
}
}
-
+
void DSSaveFile::setName(char *name) {
save.isValid = true;
save.magic = 0xBEEFCAFE;
@@ -269,7 +269,7 @@ void DSSaveFile::setName(char *name) {
save.compressedSize = 0;
saveData = new unsigned char[DS_MAX_SAVE_SIZE];
strcpy(save.name, name);
-
+
if ((strstr(name, ".s99")) || (strstr(name, ".c"))) {
isTempFile = true;
} else {
@@ -309,10 +309,10 @@ void DSSaveFile::deleteFile() {
DSSaveFileManager::DSSaveFileManager() {
instancePtr = this;
-
+
*((u16 *) (0x4000204)) |= 0x3;
swiWaitForVBlank();
-
+
loadAllFromSRAM();
}
@@ -322,7 +322,7 @@ DSSaveFileManager::~DSSaveFileManager() {
void DSSaveFileManager::loadAllFromSRAM() {
int addr = 1;
-
+
for (int r = 0; r < 8; r++) {
gbaSave[r].deleteFile();
}
@@ -343,7 +343,7 @@ void DSSaveFileManager::formatSram() {
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
*(CART_RAM + r) = 0;
}
-
+
loadAllFromSRAM();
}
@@ -369,7 +369,7 @@ DSSaveFile *DSSaveFileManager::openSavefile(const char* filename, bool saveOrLoa
return gbaSave[r].clone();
}
}
-
+
if (saveOrLoad) {
return makeSaveFile(filename, saveOrLoad);
} else {
@@ -429,20 +429,20 @@ void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num)
}
}
}
-
+
}
*/
DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
-
+
// Find a free save slot
int r = 0;
-
+
while ((r < 8) && (gbaSave[r].isValid())) {
r++;
}
-
+
if ((r == 8) && (gbaSave[r].isValid())) {
// No more saves
return NULL;
@@ -459,9 +459,9 @@ void DSSaveFileManager::flushToSaveRAM() {
int cartAddr = 1;
int s;
int extraData = DSSaveFileManager::getExtraData();
-
+
*((u16 *) (0x4000204)) |= 0x3;
-
+
swiWaitForVBlank();
int size = 0;
@@ -471,20 +471,20 @@ void DSSaveFileManager::flushToSaveRAM() {
if (!gbaSave[r].isTemp()) size += gbaSave[r].getRamUsage();
}
}
-
+
if (size <= SRAM_SAVE_MAX) {
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
*(CART_RAM + r) = 0;
}
-
+
sramBytesFree = SRAM_SAVE_MAX;
-
+
for (int r = 0; (r < 8); r++) {
if (gbaSave[r].isValid() && (!gbaSave[r].isTemp())) {
-
+
cartAddr += s = gbaSave[r].saveToSaveRAM(CART_RAM + cartAddr);
-
+
/* if (s == 0) {
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.", gbaSave[r].getName());
failed = true;
@@ -495,7 +495,7 @@ void DSSaveFileManager::flushToSaveRAM() {
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.");
loadAllFromSRAM();
-
+
}
DSSaveFileManager::setExtraData(extraData);
diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h
index 034e957b7f..709b6fc6c1 100644
--- a/backends/platform/ds/arm9/source/ramsave.h
+++ b/backends/platform/ds/arm9/source/ramsave.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _RAMSAVE_H_
#define _RAMSAVE_H_
@@ -46,58 +46,58 @@ class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
u16 extraMagic; // 32
u32 reserved; // 36
} __attribute__ ((packed));
-
+
SCUMMSave save;
u8* saveData;
SCUMMSave* origHeader;
bool isOpenFlag;
bool isTempFile;
bool eosReached;
-
+
public:
DSSaveFile();
DSSaveFile(SCUMMSave* s, bool saveCompressed, u8* data);
~DSSaveFile();
-
+
void reset();
-
+
bool isOpen() const { return isOpenFlag; }
virtual bool eos() const;
virtual void clearErr();
virtual bool skip(uint32 size);
-
+
virtual int32 pos() const;
virtual int32 size() const;
virtual bool seek(int32 pos, int whence);
uint32 read(void *buf, uint32 size);
uint32 write(const void *buf, uint32 size);
-
+
void setName(char *name);
char* getName() { return save.name; }
-
+
bool isValid() { return save.isValid; }
bool isTemp() { return isTempFile; }
bool matches(const char *prefix, int num);
bool matches(const char *filename);
-
+
void clearData();
void compress();
-
+
int getRamUsage() { return sizeof(save) + save.compressedSize; }
char* getRamImage() { return (char *) &save; }
-
+
int getSize() { return save.size; }
-
+
DSSaveFile* clone();
-
+
bool loadFromSaveRAM(vu8* address);
int saveToSaveRAM(vu8* address);
-
-
+
+
void deleteFile();
-
+
void operator delete(void *p) {
// consolePrintf("Finished! size=%d\n", ((DSSaveFile *) (p))->save->size);
}
@@ -109,25 +109,25 @@ public:
class DSSaveFileManager : public Common::SaveFileManager {
-
+
DSSaveFile gbaSave[8];
static DSSaveFileManager* instancePtr;
int sramBytesFree;
-
+
public:
DSSaveFileManager();
~DSSaveFileManager();
-
+
static DSSaveFileManager* instance() { return instancePtr; }
DSSaveFile *openSavefile(const char *filename, bool saveOrLoad);
-
+
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
virtual bool removeSavefile(const char *filename);
virtual Common::StringList listSavefiles(const char *pattern);
-
+
void flushToSaveRAM();
void addBytesFree(int size) { sramBytesFree += size; }
@@ -136,7 +136,7 @@ public:
void deleteFile(char* name);
void listFiles();
void formatSram();
-
+
void loadAllFromSRAM();
static bool isExtraDataPresent();
diff --git a/backends/platform/ds/arm9/source/scummconsole.h b/backends/platform/ds/arm9/source/scummconsole.h
index 543ffc9409..f7aa30f125 100644
--- a/backends/platform/ds/arm9/source/scummconsole.h
+++ b/backends/platform/ds/arm9/source/scummconsole.h
@@ -25,7 +25,7 @@
//
// Changelog:
// 0.1: First version
-// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
+// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
// Changed some register defines for consistency.
//
//////////////////////////////////////////////////////////////////////
diff --git a/backends/platform/ds/arm9/source/scummhelp.cpp b/backends/platform/ds/arm9/source/scummhelp.cpp
index 452f782dc5..f9efd58276 100644
--- a/backends/platform/ds/arm9/source/scummhelp.cpp
+++ b/backends/platform/ds/arm9/source/scummhelp.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#include "scummhelp.h"
#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while (0)
diff --git a/backends/platform/ds/arm9/source/scummhelp.h b/backends/platform/ds/arm9/source/scummhelp.h
index e79c863cbd..602cb5f788 100644
--- a/backends/platform/ds/arm9/source/scummhelp.h
+++ b/backends/platform/ds/arm9/source/scummhelp.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _SCUMMHELP_H_
#define _SCUMMHELP_H_
@@ -30,7 +30,7 @@ namespace DS {
void updateStrings(byte gameId, byte version, Common::Platform platform,
int page, Common::String &title, Common::String *&key, Common::String *&dsc);
-
+
}
#endif
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp
index ea09f174c2..6ff8a60392 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.cpp
+++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp
@@ -45,7 +45,7 @@ struct key_data {
key_data keys[DS_NUM_KEYS] = {
// Key number x y character
-
+
// Numbers
{28, 3, 0, '1'},
{29, 5, 0, '2'},
@@ -116,7 +116,7 @@ key_data keys[DS_NUM_KEYS] = {
{54, 29, 8, Common::KEYCODE_DOWN},
{53, 31, 8, Common::KEYCODE_RIGHT},
{51, 29, 6, Common::KEYCODE_UP},
-
+
// Close button
{56, 30, 0, Common::KEYCODE_INVALID},
@@ -133,7 +133,7 @@ key_data keys[DS_NUM_KEYS] = {
{66, 26, -2, Common::KEYCODE_F10},
{67, 28, -2, Common::KEYCODE_F11},
{68, 30, -2, Common::KEYCODE_F12},
-
+
};
int keyboardX;
@@ -162,7 +162,7 @@ void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) {
/* for (int r = 0; r < 32 * 32; r++) {
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
}
-
+
for (int r = 0; r < 4096; r++) {
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = *saveSpace++;
}*/
@@ -175,19 +175,19 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {
// *saveSpace++ = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r];
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = 0;
}
-
+
for (int r = 0; r < KEYBOARD_DATA_SIZE / 2; r++) {
// *saveSpace++ = ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r];
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = ((u16 *) (::keyboard_raw))[r];
}
-
+
for (int r = 0; r < 16; r++) {
BG_PALETTE_SUB[r] = ((u16 *) (keyboard_pal_raw))[r];
}
// this is the font
for (int tile = 0; tile < 94; tile++) {
-
+
u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32)));
u8* src = ((u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8;
@@ -197,55 +197,55 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {
| ((*(src + (y * 752) + (x * 4) + 1) & 0x0F) << 4)
| ((*(src + (y * 752) + (x * 4) + 2) & 0x0F) << 8)
| ((*(src + (y * 752) + (x * 4) + 3) & 0x0F) << 12);
-
+
}
}
}
-
+
for (int r = 0; r < 16; r++) {
int col = ((u16 *) (keyboard_pal_raw))[r];
-
+
int red = col & 0x001F;
int green = (col & 0x03E0) >> 5;
int blue = (col & 0x7C00) >> 10;
-
+
red = (red * 8) / 16;
green = (green * 24) / 16;
blue = (blue * 8) / 16;
if (green > 31) green = 31;
-
+
BG_PALETTE_SUB[16 + r] = red | (green << 5) | (blue << 10);
}
-
+
keyboardX = -2;
keyboardY = 2;
-
+
DS::mapBase = mapBase;
DS::tileBase = tileBase;
-
+
shiftState = false;
capsLockState = false;
-
+
int x = keyboardX;
int y = keyboardY;
-
+
u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase));
baseAddress = base;
-
+
for (int r = 0; r < DS_NUM_KEYS; r++) {
base[(y + keys[r].y) * 32 + x + keys[r].x] = 10 + keys[r].keyNum * 2;
base[(y + keys[r].y) * 32 + x + keys[r].x + 1] = 10 + keys[r].keyNum * 2 + 1;
-
+
base[(y + keys[r].y + 1) * 32 + x + keys[r].x] = 10 + 148 + keys[r].keyNum * 2;
base[(y + keys[r].y + 1) * 32 + x + keys[r].x + 1] = 10 + 148 + keys[r].keyNum * 2 + 1;
-
+
keys[r].pressed = false;
}
-
+
closed = false;
clearAutoComplete();
}
@@ -257,7 +257,7 @@ void drawAutoComplete() {
baseAddress[y * 32 + x] = 0;
}
}
-
+
for (int r = 0; r < autoCompleteCount; r++) {
int y = 12 + (r % 6) * 2;
@@ -265,15 +265,15 @@ void drawAutoComplete() {
for (int p = 0; autoCompleteWord[r][p] != 0; p++) {
char c = autoCompleteWord[r][p];
-
+
int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
if (selectedCompletion == r) {
tile |= 0x1000;
}
- baseAddress[y * 32 + x + p] = tile;
-
+ baseAddress[y * 32 + x + p] = tile;
+
}
}
@@ -330,7 +330,7 @@ void typeCompletion(int current) {
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
system->addEvent(event);
-
+
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
@@ -351,13 +351,13 @@ void updateTypeEvents()
{
Common::Event event;
OSystem_DS* system = OSystem_DS::instance();
-
+
event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0];
event.kbd.ascii = autoCompleteBuffer[0];
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
system->addEvent(event);
-
+
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
@@ -380,16 +380,16 @@ void createKeyEvent(int keyNum, Common::Event& event)
} else {
event.kbd.keycode = (Common::KeyCode) (Common::KEYCODE_F1 - (keys[keyNum].character - '1'));
event.kbd.ascii = 0;
- }
-
+ }
+
} else if ((keys[keyNum].character >= 'A') && (keys[keyNum].character <= 'Z')) {
-
+
if ((!DS::shiftState) && (!DS::capsLockState)) {
event.kbd.ascii = keys[keyNum].character + 32; // Make key lowercase.
} else {
event.kbd.ascii = keys[keyNum].character;
}
-
+
event.kbd.keycode = (Common::KeyCode) event.kbd.ascii;
} else {
if ((keys[keyNum].character >= Common::KEYCODE_F1) && (keys[keyNum].character >= Common::KEYCODE_F12)) {
@@ -399,7 +399,7 @@ void createKeyEvent(int keyNum, Common::Event& event)
event.kbd.ascii = keys[keyNum].character;
event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
}
- }
+ }
}
void releaseAllKeys() {
@@ -408,7 +408,7 @@ void releaseAllKeys() {
DS::setKeyHighlight(r, false);
OSystem_DS* system = OSystem_DS::instance();
-
+
Common::Event event;
createKeyEvent(r, event);
event.type = Common::EVENT_KEYUP;
@@ -416,7 +416,7 @@ void releaseAllKeys() {
keys[r].pressed = false;
}
- }
+ }
}
void addKeyboardEvents() {
@@ -427,7 +427,7 @@ void addKeyboardEvents() {
if (DS::getPenDown()) {
int x = IPC->touchXpx;
int y = IPC->touchYpx;
-
+
int tx = (x >> 3);
int ty = (y >> 3);
@@ -451,63 +451,63 @@ void addKeyboardEvents() {
tx -= keyboardX;
ty -= keyboardY;
-
+
// consolePrintf("x=%d y=%d\n", tx, ty);
-
+
for (int r = 0; r < DS_NUM_KEYS; r++) {
- if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
+ if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
(ty >= keys[r].y) && (ty <= keys[r].y + 1)) {
OSystem_DS* system = OSystem_DS::instance();
Common::Event event;
-
+
// consolePrintf("Key: %d\n", r);
if ((keys[r].character == Common::KEYCODE_INVALID)) {
// Close button
//DS::closed = true;
} else {
createKeyEvent(r, event);
- }
-
- //event.kbd.keycode = keys[r].character;
- //event.kbd.ascii = keys[r].character;
+ }
+
+ //event.kbd.keycode = keys[r].character;
+ //event.kbd.ascii = keys[r].character;
event.type = Common::EVENT_KEYDOWN;
system->addEvent(event);
// event.type = Common::EVENT_KEYUP;
// system->addEvent(event);
-
+
switch (keys[r].character) {
case DS_SHIFT: {
DS::shiftState = !DS::shiftState;
DS::setKeyHighlight(r, DS::shiftState);
break;
}
-
+
case DS_CAPSLOCK: {
DS::capsLockState = !DS::capsLockState;
DS::setKeyHighlight(r, DS::capsLockState);
break;
}
-
+
default: {
DS::setKeyHighlight(r, true);
keys[r].pressed = true;
break;
}
}
-
+
}
}
}
-
+
if (DS::getPenReleased()) {
-
+
for (int r = 0; r < DS_NUM_KEYS; r++) {
if (keys[r].pressed) {
DS::setKeyHighlight(r, false);
OSystem_DS* system = OSystem_DS::instance();
-
+
Common::Event event;
if ((keys[r].character == Common::KEYCODE_INVALID)) {
// Close button
@@ -524,7 +524,7 @@ void addKeyboardEvents() {
resetShift = true;
}
}
- }
+ }
}
diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h
index 91efbc1e9a..2f9da16ace 100644
--- a/backends/platform/ds/arm9/source/touchkeyboard.h
+++ b/backends/platform/ds/arm9/source/touchkeyboard.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _TOUCHKEYBOARD_H_
#define _TOUCHKEYBOARD_H_
diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp
index 60ac673b69..54d74c68d5 100644
--- a/backends/platform/ds/arm9/source/wordcompletion.cpp
+++ b/backends/platform/ds/arm9/source/wordcompletion.cpp
@@ -23,7 +23,7 @@ void addAutoCompleteLine(char* line) {
{
char word[32];
int length;
-
+
// Skip the T9-style numbers
while (*line != ' ')
{
@@ -37,7 +37,7 @@ void addAutoCompleteLine(char* line) {
if (*line == ' ') line++;
- // Copy the new word
+ // Copy the new word
do {
word[length++] = *line++;
} while ((*line != '\0') && (*line != ' ') && (*line != '\n'));
@@ -47,7 +47,7 @@ void addAutoCompleteLine(char* line) {
// Store a pointer to the start of the word
wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos];
-
+
// copy the new word into the buffer
strcpy(&wordBuffer[wordBufferPos], word);
wordBufferPos += strlen(word) + 1;
@@ -103,11 +103,11 @@ bool findWordCompletions(char* input)
// Get the word from the dictonary line
word = wordBufferPtr[position];
-
+
// Now check to see if the word is before or after the stub we're after
int result = scumm_stricmp((const char *) partialWord, (const char *) word);
-
+
if (result == 0) {
// We've found the whole word. Aren't we good.
break;
@@ -127,10 +127,10 @@ bool findWordCompletions(char* input)
word = wordBufferPtr[position];
//consolePrintf("Final word: %s\n", word);
-
+
system->setCharactersEntered(strlen(partialWord));
-
+
bool match = true;
@@ -160,7 +160,7 @@ bool findWordCompletions(char* input)
break;
}
}
-
+
if (match) {
system->addAutoComplete(word);
}
diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp
index 01321f44f5..7af0718a44 100644
--- a/backends/platform/ds/arm9/source/zipreader.cpp
+++ b/backends/platform/ds/arm9/source/zipreader.cpp
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ *
*/
@@ -29,25 +29,25 @@
ZipFile::ZipFile() {
// Locate a zip file in cartridge memory space
-
+
// consolePrintf("ZIP file check...");
-
+
char* p = (char *) ZF_SEARCH_START;
bool found = false;
-
+
_zipFile = NULL;
-
+
while ((p != (char *) ZF_SEARCH_END) && (!found)) {
// Zip file header is: 0x504B0304
-
+
if ( (*p == 0x50) && (*(p + 1) == 0x4B) && (*(p + 2) == 0x03) && (*(p + 3) == 0x04) ) {
// Found header!
found = true;
_zipFile = p;
}
-
+
if (!found) p += ZF_SEARCH_STRIDE;
-
+
}
if (_zipFile) {
@@ -56,14 +56,14 @@ ZipFile::ZipFile() {
// consolePrintf("Not in use!\n");
return;
}
-
+
changeToRoot();
restartFile();
-
+
if (_currentFile->compSize != (u32) getFileSize()) {
consolePrintf("Error: ZIP file contains compression!\n");
}
-
+
_allFilesVisible = false;
}
@@ -83,19 +83,19 @@ bool ZipFile::restartFile() {
getFileName(name);
more = skipFile();
}
-
+
return more;
}
bool ZipFile::currentFileInFolder() {
char name[128];
-
+
if (_allFilesVisible) return true;
-
+
getFileName(name);
// consolePrintf("N:'%s'D:'%s'\n", name, _directory);
-
+
if (_directory[0] == 0) { // Root directory
name[strlen(name) - 1] = 0;
return !strchr(name, '\\'); // Not in root if contains a / character before the last character
@@ -104,52 +104,52 @@ bool ZipFile::currentFileInFolder() {
&& (no slashes after the directory || it's the last character)
&& (slash follows directory)
*/
- if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory))
+ if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory))
&& ((strchr(name + strlen(_directory) + 1, '\\') == NULL)
|| (strchr(name + strlen(_directory) + 1, '\\') == name + strlen(name) - 1))
&& (*(name + strlen(_directory)) == '\\')) {
return true;
}
}
-
+
return false;
}
void ZipFile::getFileName(char* name) {
strncpy(name, (char *) (_currentFile + 1), _currentFile->nameLength);
-
+
for (int r = 0; r < (int) strlen(name); r++) {
if (name[r] == '/') name[r] = '\\';
}
name[_currentFile->nameLength] = 0;
-
+
if (name[strlen(name) - 1] == '\\') {
name[strlen(name) - 1] = 0;
- }
+ }
}
bool ZipFile::skipFile() {
bool valid;
do {
-
+
// Move on to the next file
_currentFile = (FileHeader *) (
((char *) (_currentFile)) + sizeof(*_currentFile) + _currentFile->nameLength + _currentFile->fileSize + _currentFile->extraLength
);
-
+
// Return true if there are more files. Check this by looking for the magic number
valid = (_currentFile->magic[0] == 0x50) &&
(_currentFile->magic[1] == 0x4B) &&
(_currentFile->magic[2] == 0x03) &&
(_currentFile->magic[3] == 0x04);
-
-
+
+
} while (valid && !currentFileInFolder());
-
+
return valid;
-
+
// Currently doesn't handle data descriptors!
}
@@ -180,7 +180,7 @@ char* ZipFile::getFile() {
bool ZipFile::findFile(char* search) {
changeToRoot();
restartFile();
-
+
char searchName[128];
strcpy(searchName, search);
for (int r = 0; r < (int) strlen(searchName); r++) {
@@ -191,15 +191,15 @@ bool ZipFile::findFile(char* search) {
*(searchName + strlen(searchName) - 1) = '\0'; // which we need to dispose of.
}
-
+
do {
char name[128];
getFileName(name);
if (*(name + strlen(name) - 1) == '\\') { // Directories have a terminating slash
*(name + strlen(name) - 1) = '\0'; // which we need to dispose of.
}
-
-
+
+
if (!stricmp(name, searchName)) {
// consolePrintf("'%s'=='%s'\n", name, searchName);
return true; // Got it!
@@ -222,7 +222,7 @@ void ZipFile::changeDirectory(char* dir) {
for (int r = 0; r < (int) strlen(_directory); r++) {
if (_directory[r] == '/') _directory[r] = '\\';
}
-
+
if (_directory[strlen(_directory) - 1] == '\\') {
_directory[strlen(_directory) - 1] = '\0';
}
diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h
index 19aa3d9f31..cd7244dba5 100644
--- a/backends/platform/ds/arm9/source/zipreader.h
+++ b/backends/platform/ds/arm9/source/zipreader.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
+
#ifndef _ZIPREADER_H_
#define _ZIPREADER_H_
#include "portdefs.h"
@@ -45,9 +45,9 @@ class ZipFile {
char* _zipFile;
char _directory[128];
-
+
bool _allFilesVisible;
-
+
FileHeader* _currentFile;
public:
@@ -55,25 +55,25 @@ public:
~ZipFile();
bool isReady();
-
+
// These operations set the current file
bool restartFile();
bool skipFile();
- bool findFile(char* search);
+ bool findFile(char* search);
// These return the file's data and information
char* getFile();
int getFileSize();
void getFileName(char* name);
bool isDirectory();
-
+
// These set the current directory
void changeDirectory(char* name);
void changeToRoot();
void setAllFilesVisible(bool state) { _allFilesVisible = state; }
-
+
bool currentFileInFolder();
-
+
u16 misaligned16(u16* v);
u32 misaligned32(u32* v);