diff options
Diffstat (limited to 'backends/platform/ds')
-rw-r--r-- | backends/platform/ds/arm7/source/main.cpp | 694 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/cdaudio.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.cpp | 53 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.h | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/dsoptions.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/fat/disc_io.c | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 3 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 4 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/wordcompletion.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/zipreader.cpp | 3 | ||||
-rw-r--r-- | backends/platform/ds/ds.mk | 23 |
11 files changed, 374 insertions, 416 deletions
diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index c4a22b8f68..617a1edc87 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -26,7 +26,7 @@ // -- modified by Darkain and others ////////////////////////////////////////////////////////////////////// -//#define USE_LIBCARTRESET +// #define USE_LIBCARTRESET #include <nds.h> @@ -37,7 +37,7 @@ #include <system.h> #include <stdlib.h> #include <string.h> -#include <registers_alt.h> // Needed for SOUND_CR +#include <registers_alt.h> // Needed for SOUND_CR #include <NDS/scummvm_ipc.h> ////////////////////////////////////////////////////////////////////// #ifdef USE_DEBUGGER @@ -54,8 +54,8 @@ #define SCREEN_HEIGHT 192 s32 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1; s32 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1; -s32 TOUCH_OFFSET_X = ( ((SCREEN_WIDTH -60) * TOUCH_CAL_X1) / TOUCH_WIDTH ) - 28; -s32 TOUCH_OFFSET_Y = ( ((SCREEN_HEIGHT-60) * TOUCH_CAL_Y1) / TOUCH_HEIGHT ) - 28; +s32 TOUCH_OFFSET_X = ( ((SCREEN_WIDTH - 60) * TOUCH_CAL_X1) / TOUCH_WIDTH ) - 28; +s32 TOUCH_OFFSET_Y = ( ((SCREEN_HEIGHT - 60) * TOUCH_CAL_Y1) / TOUCH_HEIGHT ) - 28; vu8 *soundData; @@ -71,163 +71,157 @@ int temp; int adpcmBufferNum = 0; // those are pixel positions of the two points you click when calibrating -#define TOUCH_CNTRL_X1 (*(vu8 *)0x027FFCDC) -#define TOUCH_CNTRL_Y1 (*(vu8 *)0x027FFCDD) -#define TOUCH_CNTRL_X2 (*(vu8 *)0x027FFCE2) -#define TOUCH_CNTRL_Y2 (*(vu8 *)0x027FFCE3) - - -////////////////////////////////////////////////////////////////////// +#define TOUCH_CNTRL_X1 (*(vu8 *)0x027FFCDC) +#define TOUCH_CNTRL_Y1 (*(vu8 *)0x027FFCDD) +#define TOUCH_CNTRL_X2 (*(vu8 *)0x027FFCE2) +#define TOUCH_CNTRL_Y2 (*(vu8 *)0x027FFCE3) /* -void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) { - SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate); - SCHANNEL_SOURCE(channel) = (uint32)data; - SCHANNEL_LENGTH(channel) = bytes; - SCHANNEL_CR(channel) = SOUND_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT); +void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel = 0, u8 vol = 0x7F, u8 pan = 63, u8 format = 0) { + SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate); + SCHANNEL_SOURCE(channel) = (uint32)data; + SCHANNEL_LENGTH(channel) = bytes; + SCHANNEL_CR(channel) = SOUND_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT); } - s8 getFreeSoundChannel() { - for (int i=0; i<16; i++) { - if ( (SCHANNEL_CR(i) & SOUND_ENABLE) == 0 ) return i; - } - return -1; + for (int i = 0; i < 16; i++) { + if ( (SCHANNEL_CR(i) & SOUND_ENABLE) == 0 ) + return i; + } + return -1; } */ - s8 getFreeSoundChannel() { -// return 0; - for (int i=0; i<16; i++) { - if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 ) return i; - } - return -1; + // return 0; + for (int i = 0; i < 16; i++) { + if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 ) + return i; + } + return -1; } -void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) { -// REG_IME = IME_DISABLE; +void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel = 0, u8 vol = 0x7F, u8 pan = 63, u8 format = 0) { + // REG_IME = IME_DISABLE; - channel = getFreeSoundChannel(); -/* if (format == 2) { - channel = 1; - } else { - channel = 0; - }*/ + channel = getFreeSoundChannel(); + /* + if (format == 2) { + channel = 1; + } else { + channel = 0; + } + */ - if (channel > 1) channel = 1; + if (channel > 1) + channel = 1; - bytes &= ~7; // Multiple of 4 bytes! -// bytes += 4; + bytes &= ~7; // Multiple of 4 bytes! + // bytes += 4; - SCHANNEL_CR(channel) = 0; - SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate); - SCHANNEL_SOURCE(channel) = ((uint32) (data)); - SCHANNEL_LENGTH(channel) = ((bytes & 0x7FFFFFFF) >> 2); - SCHANNEL_REPEAT_POINT(channel) = 0; + SCHANNEL_CR(channel) = 0; + SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate); + SCHANNEL_SOURCE(channel) = (uint32)data; + SCHANNEL_LENGTH(channel) = (bytes & 0x7FFFFFFF) >> 2; + SCHANNEL_REPEAT_POINT(channel) = 0; - SCHANNEL_CR(channel + 2) = 0; - SCHANNEL_TIMER(channel + 2) = SOUND_FREQ(sampleRate); - SCHANNEL_SOURCE(channel + 2) = ((uint32) (data)); - SCHANNEL_LENGTH(channel + 2) = ((bytes & 0x7FFFFFFF) >> 2); - SCHANNEL_REPEAT_POINT(channel + 2) = 0; + SCHANNEL_CR(channel + 2) = 0; + SCHANNEL_TIMER(channel + 2) = SOUND_FREQ(sampleRate); + SCHANNEL_SOURCE(channel + 2) = (uint32)data; + SCHANNEL_LENGTH(channel + 2) = (bytes & 0x7FFFFFFF) >> 2; + SCHANNEL_REPEAT_POINT(channel + 2) = 0; - uint32 flags = SCHANNEL_ENABLE | SOUND_VOL(vol) | SOUND_PAN(pan); + uint32 flags = SCHANNEL_ENABLE | SOUND_VOL(vol) | SOUND_PAN(pan); - switch (format) { + switch (format) { case 1: { flags |= SOUND_FORMAT_8BIT; - flags |= SOUND_REPEAT;// | (1 << 15); + flags |= SOUND_REPEAT; // | (1 << 15); break; } case 0: { flags |= SOUND_FORMAT_16BIT; - flags |= SOUND_REPEAT;// | (1 << 15); + flags |= SOUND_REPEAT; // | (1 << 15); break; } case 2: { flags |= SOUND_FORMAT_ADPCM; - flags |= SOUND_ONE_SHOT;// | (1 << 15); + flags |= SOUND_ONE_SHOT; // | (1 << 15); - SCHANNEL_SOURCE(channel) = (unsigned int) IPC->adpcm.buffer[0]; - //bytes += 32; - SCHANNEL_LENGTH(channel) = (((bytes + 4) & 0x7FFFFFFF) >> 2); + SCHANNEL_SOURCE(channel) = (unsigned int)IPC->adpcm.buffer[0]; + // bytes += 32; + SCHANNEL_LENGTH(channel) = ((bytes + 4) & 0x7FFFFFFF) >> 2; SCHANNEL_CR(channel + 1) = 0; - SCHANNEL_SOURCE(channel + 1) = (unsigned int) IPC->adpcm.buffer[0]; - SCHANNEL_LENGTH(channel + 1) = (((bytes + 4) & 0x7FFFFFFF) >> 2); - SCHANNEL_TIMER(channel + 1) = SOUND_FREQ(sampleRate); + SCHANNEL_SOURCE(channel + 1) = (unsigned int)IPC->adpcm.buffer[0]; + SCHANNEL_LENGTH(channel + 1) = ((bytes + 4) & 0x7FFFFFFF) >> 2; + SCHANNEL_TIMER(channel + 1) = SOUND_FREQ(sampleRate); SCHANNEL_REPEAT_POINT(channel + 1) = 0; SCHANNEL_CR(channel + 1) = flags; temp = bytes; adpcmBufferNum = 0; break; } - } - - -// if (bytes & 0x80000000) { -// flags |= SOUND_REPEAT; -// } else { -// } - - - + } - soundData = (vu8 *) data; + /* + if (bytes & 0x80000000) { + flags |= SOUND_REPEAT; + } else { + } + */ - SCHANNEL_CR(channel) = flags; - SCHANNEL_CR(channel + 2) = flags; + soundData = (vu8 *)data; + SCHANNEL_CR(channel) = flags; + SCHANNEL_CR(channel + 2) = flags; + if (channel == 0) { + for (volatile int i = 0; i < 16384 * 2; i++) { + // Delay loop - this makes everything stay in sync! + } - if (channel == 0) { - for (volatile int i = 0; i < 16384 * 2; i++) { - // Delay loop - this makes everything stay in sync! - } + TIMER0_CR = 0; + TIMER0_DATA = SOUND_FREQ(sampleRate) * 2; + TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1; - TIMER0_CR = 0; - TIMER0_DATA = SOUND_FREQ(sampleRate) * 2; - TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1; + TIMER1_CR = 0; + TIMER1_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer + TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; - TIMER1_CR = 0; - TIMER1_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer - TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; + playingSection = 0; + } else { + for (volatile int i = 0; i < 16384 * 2; i++) { + // Delay loop - this makes everything stay in sync! + } - playingSection = 0; - } else { - for (volatile int i = 0; i < 16384 * 2; i++) { - // Delay loop - this makes everything stay in sync! - } + TIMER2_CR = 0; + TIMER2_DATA = SOUND_FREQ(sampleRate) * 2; + TIMER2_CR = TIMER_ENABLE | TIMER_DIV_1; - TIMER2_CR = 0; - TIMER2_DATA = SOUND_FREQ(sampleRate) * 2; - TIMER2_CR = TIMER_ENABLE | TIMER_DIV_1; + TIMER3_CR = 0; + TIMER3_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer + TIMER3_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; - TIMER3_CR = 0; - TIMER3_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer - TIMER3_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; + for (int r = 0; r < 4; r++) { + // IPC->streamFillNeeded[r] = true; + } - for (int r = 0; r < 4; r++) { -// IPC->streamFillNeeded[r] = true; + IPC->streamPlayingSection = 0; } - IPC->streamPlayingSection = 0; - } - - - -// IPC->fillSoundFirstHalf = true; -// IPC->fillSoundSecondHalf = true; -// soundFirstHalf = true; + // IPC->fillSoundFirstHalf = true; + // IPC->fillSoundSecondHalf = true; + // soundFirstHalf = true; -// REG_IME = IME_ENABLE; + // REG_IME = IME_ENABLE; } void stopSound(int chan) { - SCHANNEL_CR(chan) = 0; + SCHANNEL_CR(chan) = 0; } void DummyHandler() { @@ -235,146 +229,132 @@ void DummyHandler() { } void powerManagerWrite(uint32 command, u32 data, bool enable) { - - uint16 result; - SerialWaitBusy(); - - // Write the command and wait for it to complete - REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11); - REG_SPIDATA = command | 0x80; - SerialWaitBusy(); - - // Write the second command and clock in the data - REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz; - REG_SPIDATA = 0; - SerialWaitBusy(); - - result = REG_SPIDATA & 0xFF; - - - - // Write the command and wait for it to complete - REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11); - REG_SPIDATA = command; - SerialWaitBusy(); - - // Write the second command and clock in the data - REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz; - REG_SPIDATA = enable? (result | data): (result & ~data); - SerialWaitBusy(); + uint16 result; + SerialWaitBusy(); + + // Write the command and wait for it to complete + REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11); + REG_SPIDATA = command | 0x80; + SerialWaitBusy(); + + // Write the second command and clock in the data + REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz; + REG_SPIDATA = 0; + SerialWaitBusy(); + + result = REG_SPIDATA & 0xFF; + + // Write the command and wait for it to complete + REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11); + REG_SPIDATA = command; + SerialWaitBusy(); + + // Write the second command and clock in the data + REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz; + REG_SPIDATA = enable ? (result | data) : (result & ~data); + SerialWaitBusy(); } /* void performSleep() { + powerManagerWrite(0, 0x30, true); - powerManagerWrite(0, 0x30, true); - - // Here, I set up a dummy interrupt handler, then trigger all interrupts. - // These are just aknowledged by the handler without doing anything else. - // Why? Because without it the sleep mode will only happen once, and then - // never again. I got the idea from reading the MoonShell source. - IME = 0; - u32 irq = (u32) IRQ_HANDLER; - IRQ_HANDLER = DummyHandler; - IF = ~0; - IME = 1; + // Here, I set up a dummy interrupt handler, then trigger all interrupts. + // These are just aknowledged by the handler without doing anything else. + // Why? Because without it the sleep mode will only happen once, and then + // never again. I got the idea from reading the MoonShell source. + IME = 0; + u32 irq = (u32)IRQ_HANDLER; + IRQ_HANDLER = DummyHandler; + IF = ~0; + IME = 1; + // Now save which interrupts are enabled, then set only the screens unfolding + // interrupt to be enabled, so that the first interrupt that happens is the + // one I want. + int saveInts = IE; - // Now save which interrupts are enabled, then set only the screens unfolding - // interrupt to be enabled, so that the first interrupt that happens is the - // one I want. - int saveInts = IE; + IE = IRQ_TIMER0; // Screens unfolding interrupt + // Now call the sleep function in the bios + bool b; + do { + TIMER0_CR = 0; + TIMER0_DATA = TIMER_FREQ(20); + TIMER0_CR = TIMER_ENABLE | TIMER_DIV_64; + swiDelay(100); - IE = IRQ_TIMER0; // Screens unfolding interrupt + swiSleep(); - // Now call the sleep function in the bios - bool b; - do { - TIMER0_CR = 0; - TIMER0_DATA = TIMER_FREQ(20); - TIMER0_CR = TIMER_ENABLE | TIMER_DIV_64; + swiDelay(100); - swiDelay(100); - - swiSleep(); - - swiDelay(100); - - powerManagerWrite(0, 0x30, b = !b); - } while (!(TIMER0_CR & TIMER_ENABLE)); - - TIMER0_CR = 0; - - // We're back from sleep, now restore the interrupt state and IRQ handler - IRQ_HANDLER = (void (*)()) irq; - IE = saveInts; - IF = ~0; - IME = 1; + powerManagerWrite(0, 0x30, b = !b); + } while (!(TIMER0_CR & TIMER_ENABLE)); + TIMER0_CR = 0; + // We're back from sleep, now restore the interrupt state and IRQ handler + IRQ_HANDLER = (void (*)())irq; + IE = saveInts; + IF = ~0; + IME = 1; - powerManagerWrite(0, 0x30, false); + powerManagerWrite(0, 0x30, false); } - */ -void performSleep() { - powerManagerWrite(0, 0x30, true); - IPC->performArm9SleepMode = true; // Tell ARM9 to sleep +void performSleep() { + powerManagerWrite(0, 0x30, true); -// u32 irq = (u32) IRQ_HANDLER; -// IRQ_HANDLER = DummyHandler; -// POWER_CR &= ~POWER_SOUND; + IPC->performArm9SleepMode = true; // Tell ARM9 to sleep -// int saveInts = REG_IE; -// REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open -// *((u32 *) (0x0380FFF8)) = *((u32 *) (0x0380FFF8)) | (REG_IE & REG_IF); -// VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK; + // u32 irq = (u32)IRQ_HANDLER; + // IRQ_HANDLER = DummyHandler; + // POWER_CR &= ~POWER_SOUND; + // int saveInts = REG_IE; + // REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open + // *((u32 *)(0x0380FFF8)) = *((u32 *)(0x0380FFF8)) | (REG_IE & REG_IF); + // VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK; - int r = 0; - while ((REG_KEYXY & (1 << 7))) { // Wait for lid to open - swiDelay(1000000); - r++; - } + int r = 0; + while ((REG_KEYXY & (1 << 7))) { // Wait for lid to open + swiDelay(1000000); + r++; + } -// IRQ_HANDLER = (void (*)()) irq; - IPC->performArm9SleepMode = false; // Tell ARM9 to wake up -// REG_IE = saveInts; + // IRQ_HANDLER = (void (*)())irq; + IPC->performArm9SleepMode = false; // Tell ARM9 to wake up + // REG_IE = saveInts; -// POWER_CR |= POWER_SOUND; + // POWER_CR |= POWER_SOUND; - powerManagerWrite(0, 0x30, false); + powerManagerWrite(0, 0x30, false); } void powerOff() { powerManagerWrite(0, 0x40, true); } -////////////////////////////////////////////////////////////////////// - - void InterruptTimer1() { - IPC->fillNeeded[playingSection] = true; soundFilled[playingSection] = false; if (playingSection == 3) { -// IME = IME_DISABLED; + // IME = IME_DISABLED; - // while (SCHANNEL_CR(0) & SCHANNEL_ENABLE) { - // } -// SCHANNEL_CR(0) &= ~SCHANNEL_ENABLE; + // while (SCHANNEL_CR(0) & SCHANNEL_ENABLE) { + // } + // SCHANNEL_CR(0) &= ~SCHANNEL_ENABLE; -// SCHANNEL_CR(0) |= SCHANNEL_ENABLE; -// TIMER1_CR = 0; -// TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; + // SCHANNEL_CR(0) |= SCHANNEL_ENABLE; + // TIMER1_CR = 0; + // TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; playingSection = 0; -// IME = IME_ENABLED; + // IME = IME_ENABLED; } else { playingSection++; } @@ -395,8 +375,8 @@ void InterruptTimer1() { } void InterruptTimer3() { - 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 + 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 IPC->streamFillNeeded[IPC->streamPlayingSection] = true; @@ -406,153 +386,145 @@ void InterruptTimer3() { IPC->streamPlayingSection++; } - IPC->adpcm.semaphore = false; } -// IPC->performArm9SleepMode = false; - - // precalculate some values -// static int16 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1; -// static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1; -// static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - (TOUCH_CNTRL_X1 - 8); -// static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - (TOUCH_CNTRL_Y1 - 8); - - +// IPC->performArm9SleepMode = false; +// precalculate some values +// static int16 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1; +// static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1; +// static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - (TOUCH_CNTRL_X1 - 8); +// static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - (TOUCH_CNTRL_Y1 - 8); void InterruptVBlank() { - uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0, batt=0, aux=0; - int t1=0, t2=0; - uint32 temp=0; - uint8 ct[sizeof(IPC->curtime)]; + uint16 but = 0, x = 0, y = 0, xpx = 0, ypx = 0, z1 = 0, z2 = 0, batt = 0, aux = 0; + int t1 = 0, t2 = 0; + uint32 temp = 0; + uint8 ct[sizeof(IPC->curtime)]; static int heartbeat = 0; - // Update the heartbeat - heartbeat++; - - // Read the X/Y buttons and the /PENIRQ line - but = REG_KEYXY; - if (!(but & 0x40)) { - // Read the touch screen - touchPosition p; - touchReadXY(&p); - -// x = touchRead(TSC_MEASURE_X); - // y = touchRead(TSC_MEASURE_Y); + // Update the heartbeat + heartbeat++; - x = p.rawx; - y = p.rawy; + // Read the X/Y buttons and the /PENIRQ line + but = REG_KEYXY; + if (!(but & 0x40)) { + // Read the touch screen + touchPosition p; + touchReadXY(&p); - xpx = p.px; - ypx = p.py; + // x = touchRead(TSC_MEASURE_X); + // y = touchRead(TSC_MEASURE_Y); -// xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X; - // ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y; + x = p.rawx; + y = p.rawy; -// xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8); - // ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8); + // xpx = p.px; + // ypx = p.py; + xpx = ( ((SCREEN_WIDTH - 60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X; + ypx = ( ((SCREEN_HEIGHT - 60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y; - z1 = touchRead(TSC_MEASURE_Z1); - z2 = touchRead(TSC_MEASURE_Z2); - } + // xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8); + // ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8); - if (but & (1 << 7)) { // Check if screen is folded - needSleep = true; + z1 = touchRead(TSC_MEASURE_Z1); + z2 = touchRead(TSC_MEASURE_Z2); } + // Check if screen is folded + if (but & (1 << 7)) { + needSleep = true; + } - batt = touchRead(TSC_MEASURE_BATTERY); - aux = touchRead(TSC_MEASURE_AUX); - - // Read the time - rtcGetTime((uint8 *)ct); - BCDToInteger((uint8 *)&(ct[1]), 7); - - // Read the temperature - temp = touchReadTemperature(&t1, &t2); - - - // Update the IPC struct - IPC->heartbeat = heartbeat; - IPC->buttons = but; - IPC->touchX = x; - IPC->touchY = y; - IPC->touchXpx = xpx; - IPC->touchYpx = ypx; - IPC->touchZ1 = z1; - IPC->touchZ2 = z2; - IPC->battery = batt; - IPC->aux = aux; - - for (u32 i=0; i<sizeof(ct); i++) { - IPC->curtime[i] = ct[i]; - } - - IPC->temperature = temp; - IPC->tdiode1 = t1; - IPC->tdiode2 = t2; - - + batt = touchRead(TSC_MEASURE_BATTERY); + aux = touchRead(TSC_MEASURE_AUX); + + // Read the time + rtcGetTime((uint8 *)ct); + BCDToInteger((uint8 *)&(ct[1]), 7); + + // Read the temperature + temp = touchReadTemperature(&t1, &t2); + + // Update the IPC struct + IPC->heartbeat = heartbeat; + IPC->buttons = but; + IPC->touchX = x; + IPC->touchY = y; + IPC->touchXpx = xpx; + IPC->touchYpx = ypx; + IPC->touchZ1 = z1; + IPC->touchZ2 = z2; + IPC->battery = batt; + IPC->aux = aux; + + for (u32 i = 0; i < sizeof(ct); i++) { + IPC->curtime[i] = ct[i]; + } - //sound code :) - TransferSound *snd = IPC->soundData; - IPC->soundData = 0; - if (snd) { - for (int i=0; i<snd->count; i++) { - s8 chan = getFreeSoundChannel(); - if (snd->data[i].rate > 0) { - if (chan >= 0) { - startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format); + IPC->temperature = temp; + IPC->tdiode1 = t1; + IPC->tdiode2 = t2; + + // sound code :) + TransferSound *snd = IPC->soundData; + IPC->soundData = 0; + if (snd) { + for (int i = 0; i < snd->count; i++) { + s8 chan = getFreeSoundChannel(); + if (snd->data[i].rate > 0) { + if (chan >= 0) { + startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format); + } + } else { + stopSound(-snd->data[i].rate); } - } else { - stopSound(-snd->data[i].rate); } - } - } - + } - #ifdef USE_DEBUGGER - Wifi_Update(); // update wireless in vblank - #endif +#ifdef USE_DEBUGGER + Wifi_Update(); // update wireless in vblank +#endif } -////////////////////////////////////////////////////////////////////// - - #ifdef USE_DEBUGGER - // callback to allow wifi library to notify arm9 void arm7_synctoarm9() { // send fifo message - REG_IPC_FIFO_TX = 0x87654321; + REG_IPC_FIFO_TX = 0x87654321; } + // interrupt handler to allow incoming notifications from arm9 void arm7_fifo() { // check incoming fifo messages - u32 msg = REG_IPC_FIFO_RX; - if (msg==0x87654321) Wifi_Sync(); + u32 msg = REG_IPC_FIFO_RX; + if (msg == 0x87654321) + Wifi_Sync(); } - - void initDebugger() { - // set up the wifi irq irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt irqEnable(IRQ_WIFI); - //get them talking together + // get them talking together // sync with arm9 and init wifi u32 fifo_temp; while (1) { // wait for magic number - while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); - fifo_temp=REG_IPC_FIFO_RX; - if (fifo_temp==0x12345678) break; + while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY) + swiWaitForVBlank(); + + fifo_temp = REG_IPC_FIFO_RX; + + if (fifo_temp == 0x12345678) + break; } - while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank(); - fifo_temp=REG_IPC_FIFO_RX; // give next value to wifi_init + while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY) + swiWaitForVBlank(); + + fifo_temp = REG_IPC_FIFO_RX; // give next value to wifi_init Wifi_Init(fifo_temp); irqSet(IRQ_FIFO_NOT_EMPTY,arm7_fifo); // set up fifo irq @@ -561,7 +533,6 @@ void initDebugger() { Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9 // arm7 wifi init complete - } #endif @@ -571,82 +542,75 @@ void reboot() { } #endif - int main(int argc, char ** argv) { - - #ifdef USE_DEBUGGER - REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; + REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; #endif - // Reset the clock if needed - rtcReset(); - - //enable sound -// powerOn(POWER_SOUND); - SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F); - IPC->soundData = 0; - IPC->reset = false; - - - //fifoInit(); + // Reset the clock if needed + rtcReset(); - for (int r = 0; r < 8; r++) { - IPC->adpcm.arm7Buffer[r] = (u8 *) malloc(512); - } + // enable sound + // powerOn(POWER_SOUND); + SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F); + IPC->soundData = 0; + IPC->reset = false; - for (int r = 0; r < 4; r++) { - soundFilled[r] = false; - } + // fifoInit(); + for (int r = 0; r < 8; r++) { + IPC->adpcm.arm7Buffer[r] = (u8 *)malloc(512); + } - // Set up the interrupt handler + for (int r = 0; r < 4; r++) { + soundFilled[r] = false; + } - irqInit(); + // Set up the interrupt handler - irqSet(IRQ_VBLANK, InterruptVBlank); - irqEnable(IRQ_VBLANK); + irqInit(); - irqSet(IRQ_TIMER1, InterruptTimer1); - irqEnable(IRQ_TIMER1); + irqSet(IRQ_VBLANK, InterruptVBlank); + irqEnable(IRQ_VBLANK); - irqSet(IRQ_TIMER3, InterruptTimer3); - irqEnable(IRQ_TIMER3); + irqSet(IRQ_TIMER1, InterruptTimer1); + irqEnable(IRQ_TIMER1); -/* REG_IME = 0; - IRQ_HANDLER = &InterruptHandler; - REG_IE = IRQ_VBLANK | IRQ_TIMER1 | IRQ_TIMER3; - REG_IF = ~0; - DISP_SR = DISP_VBLANK_IRQ; - REG_IME = 1; - */ + irqSet(IRQ_TIMER3, InterruptTimer3); + irqEnable(IRQ_TIMER3); + /* + REG_IME = 0; + IRQ_HANDLER = &InterruptHandler; + REG_IE = IRQ_VBLANK | IRQ_TIMER1 | IRQ_TIMER3; + REG_IF = ~0; + DISP_SR = DISP_VBLANK_IRQ; + REG_IME = 1; + */ #ifdef USE_DEBUGGER - initDebugger(); + initDebugger(); #endif - // Keep the ARM7 out of main RAM - while ((1)) { - if (needSleep) { - performSleep(); - needSleep = false; - } + // Keep the ARM7 out of main RAM + while ((1)) { + if (needSleep) { + performSleep(); + needSleep = false; + } #ifdef USE_LIBCARTRESET - if (passmeloopQuery()) { - reboot(); - } + if (passmeloopQuery()) { + reboot(); + } #endif - if (IPC->reset) { - powerOff(); + if (IPC->reset) { + powerOff(); + } + + swiWaitForVBlank(); } - swiWaitForVBlank(); - } - return 0; + return 0; } - - -////////////////////////////////////////////////////////////////////// diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index c963f4d8bd..3952eeb6ab 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -23,10 +23,10 @@ // Disable symbol overrides for FILE as that is used in FLAC headers #define FORBIDDEN_SYMBOL_EXCEPTION_FILE +#include "dsmain.h" #include "cdaudio.h" #include "backends/fs/ds/ds-fs.h" #include "common/config-manager.h" -#include "dsmain.h" #include "NDS/scummvm_ipc.h" #define WAV_FORMAT_IMA_ADPCM 0x14 diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index b7c9c108a6..041892aed6 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -68,8 +68,9 @@ // - Try discworld? -#define FORBIDDEN_SYMBOL_ALLOW_ALL - +// Allow use of stuff in <nds.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_printf +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h #include <nds.h> @@ -439,12 +440,12 @@ void playSound(const void *data, u32 length, bool loop, bool adpcm, int rate) { 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 - soundControl.data[soundControl.count].pan = 64; - soundControl.data[soundControl.count].vol = 127; - soundControl.data[soundControl.count].format = adpcm? 2: 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 + soundControl.data[soundControl.count].pan = 64; + soundControl.data[soundControl.count].vol = 127; + soundControl.data[soundControl.count].format = adpcm ? 2 : 0; soundControl.count++; @@ -573,7 +574,7 @@ void initGame() { s_currentGame = &gameList[0]; // Default game for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) { - if (!stricmp(gameName, gameList[r].gameId)) { + if (!scumm_stricmp(gameName, gameList[r].gameId)) { s_currentGame = &gameList[r]; // consolePrintf("Game list num: %d\n", r); } @@ -640,7 +641,7 @@ 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); @@ -659,7 +660,7 @@ void displayMode8Bit() { BG3_YDY = (int) ((200.0f / 192.0f) * 256); } 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); @@ -690,7 +691,7 @@ void displayMode8Bit() { consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true, true); // Set this again because consoleinit resets it - 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); // Move the cursor to the bottom of the screen using ANSI escape code consolePrintf("\033[23;0f"); @@ -970,7 +971,7 @@ void displayMode16BitFlipBuffer() { u16 *back = get16BitBackBuffer(); // highBuffer = !highBuffer; -// BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer? 1: 0); +// BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer ? 1 : 0); if (isCpuScalerEnabled()) { Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512); @@ -1805,13 +1806,13 @@ void triggerIcon(int imageNum) { 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); } @@ -1841,7 +1842,7 @@ void updateStatus() { } if (indyFightState) { - setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true); + setIcon(1, (190 - 32), 150, 3, (indyFightRight ? 0 : ATTR1_FLIP_X), true); // consolePrintf("%d\n", indyFightRight); } else { // setIcon(1, 0, 0, 0, 0, false); @@ -2164,19 +2165,11 @@ void VBlankHandler(void) { } - subScTargetX = xCenter - ((subScreenWidth >> 1) << 8); + subScTargetX = xCenter - ((subScreenWidth >> 1) << 8); subScTargetY = yCenter - ((subScreenHeight >> 1) << 8); - - - - if (subScTargetX < 0) subScTargetX = 0; - if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8; - - if (subScTargetY < 0) subScTargetY = 0; - if (subScTargetY > (gameHeight - subScreenHeight) << 8) subScTargetY = (gameHeight - subScreenHeight) << 8; - - + subScTargetX = CLIP(subScTargetX, 0, (gameWidth - subScreenWidth) << 8); + subScTargetY = CLIP(subScTargetY, 0, (gameHeight - subScreenHeight) << 8); subScX += (subScTargetX - subScX) >> 2; subScY += (subScTargetY - subScY) >> 2; @@ -2499,7 +2492,7 @@ void penUpdate() { // if (getKeysHeld() & KEY_L) consolePrintf("%d, %d penX=%d, penY=%d tz=%d\n", IPC->touchXpx, IPC->touchYpx, penX, penY, IPC->touchZ1); - bool penDownThisFrame = (IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0); + bool penDownThisFrame = (!(IPC->buttons & 0x40)) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0); static bool moved = false; if (( (tapScreenClicks) || getKeyboardEnable() ) && (getIsDisplayMode8Bit())) { @@ -2626,7 +2619,7 @@ void penUpdate() { penDownSaved = true; } - if ((IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0)) { + if ((!(IPC->buttons & 0x40)) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0)) { penX = IPC->touchXpx + touchXOffset; penY = IPC->touchYpx + touchYOffset; moved = true; @@ -2648,7 +2641,7 @@ void penUpdate() { - if ((IPC->touchZ1 > 0) || ((penDownFrames == 2)) ) { + if ((!(IPC->buttons & 0x40)) || ((penDownFrames == 2)) ) { penDownLastFrame = true; penDownFrames++; } else { diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index fec97d878e..7345fc2ceb 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -23,6 +23,8 @@ #ifndef _DSMAIN_H #define _DSMAIN_H +#define FORBIDDEN_SYMBOL_ALLOW_ALL + #include <nds.h> #include "osystem_ds.h" diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 733592e958..562038166b 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -20,8 +20,8 @@ * */ -#include "dsoptions.h" #include "dsmain.h" +#include "dsoptions.h" #include "gui/dialog.h" #include "gui/gui-manager.h" #include "gui/widgets/list.h" diff --git a/backends/platform/ds/arm9/source/fat/disc_io.c b/backends/platform/ds/arm9/source/fat/disc_io.c index 5896cbb750..74fc8fb09b 100644 --- a/backends/platform/ds/arm9/source/fat/disc_io.c +++ b/backends/platform/ds/arm9/source/fat/disc_io.c @@ -367,7 +367,7 @@ bool disc_setDsSlotInterface (void) active_interface = DLDI_GetInterface(); - if (stricmp((char *)(&_dldi_driver_name), "Default (No interface)")) { + if (strcasecmp((char *)(&_dldi_driver_name), "Default (No interface)")) { char name[48]; memcpy(name, &_dldi_driver_name, 48); name[47] = '\0'; diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 861ee2e0c5..c35433d3fc 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -23,6 +23,9 @@ // Allow use of stuff in <time.h> #define FORBIDDEN_SYMBOL_EXCEPTION_time_h +// Allow use of stuff in <nds.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_printf +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h #include "common/scummsys.h" #include "common/system.h" diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index f883bd14d1..c8698ca418 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -24,6 +24,10 @@ #ifndef _OSYSTEM_DS_H_ #define _OSYSTEM_DS_H_ +// Allow use of stuff in <nds.h> +#define FORBIDDEN_SYMBOL_EXCEPTION_printf +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h + #include "backends/base-backend.h" #include "common/events.h" #include "nds.h" diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp index 36fa31247c..2257c49005 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.cpp +++ b/backends/platform/ds/arm9/source/wordcompletion.cpp @@ -20,8 +20,8 @@ * */ -#include "wordcompletion.h" #include "osystem_ds.h" +#include "wordcompletion.h" #include "engines/agi/agi.h" // Caution for #define for NUM_CHANNELS, causes problems in mixer_intern.h #ifdef ENABLE_AGI diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp index 0de2b0c981..2ad0a39ed2 100644 --- a/backends/platform/ds/arm9/source/zipreader.cpp +++ b/backends/platform/ds/arm9/source/zipreader.cpp @@ -23,6 +23,7 @@ #define FORBIDDEN_SYMBOL_ALLOW_ALL #include "common/scummsys.h" +#include "common/str.h" #include "zipreader.h" ZipFile::ZipFile() { @@ -193,7 +194,7 @@ bool ZipFile::findFile(const char *search) { } - if (!stricmp(name, searchName)) { + if (!scumm_stricmp(name, searchName)) { // consolePrintf("'%s'=='%s'\n", name, searchName); return true; // Got it! } else { diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 78216cb9a2..18feea00c2 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -75,7 +75,7 @@ endif # Compiler options for files which should be optimised for speed -OPT_SPEED := -O3 -mno-thumb +OPT_SPEED := -O3 -marm # Compiler options for files which should be optimised for space OPT_SIZE := -Os -mthumb @@ -134,7 +134,8 @@ engines/teenagent/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) # ############################################################################# -all: scummvm.nds scummvm.ds.gba +# FIXME: Newer versions of devkitARM don't include dsbuild, which is needed to create scummvm.ds.gba +all: scummvm.nds # scummvm.ds.gba clean: dsclean @@ -145,11 +146,8 @@ dsclean: # TODO: Add a 'dsdist' target ? -%.bin: %.elf - $(OBJCOPY) -S -O binary $< $@ - -%.nds: %.bin $(ndsdir)/arm7/arm7.bin - ndstool -c $@ -9 $< -7 $(ndsdir)/arm7/arm7.bin -b $(srcdir)/$(ndsdir)/$(LOGO) "$(@F);ScummVM $(VERSION);DS Port" +%.nds: %.elf $(ndsdir)/arm7/arm7.elf + ndstool -c $@ -9 $< -7 $(ndsdir)/arm7/arm7.elf -b $(srcdir)/$(ndsdir)/$(LOGO) "$(@F);ScummVM $(VERSION);DS Port" %.ds.gba: %.nds dsbuild $< -o $@ -l $(srcdir)/$(ndsdir)/arm9/ndsloader.bin @@ -170,10 +168,7 @@ dsclean: # HACK/FIXME: C compiler, for cartreset.c -- we should switch this to use CXX # as soon as possible. -CC := $(DEVKITPRO)/devkitARM/bin/arm-eabi-gcc - -# HACK/TODO: Pointer to objcopy. This should really be set by configure -OBJCOPY := $(DEVKITPRO)/devkitARM/bin/arm-eabi-objcopy +CC := $(DEVKITPRO)/devkitARM/bin/arm-none-eabi-gcc # # Set various flags @@ -194,7 +189,7 @@ ARM7_CFLAGS := -g -Wall -O2\ ARM7_CXXFLAGS := $(ARM7_CFLAGS) -fno-exceptions -fno-rtti -ARM7_LDFLAGS := -g $(ARM7_ARCH) -mno-fpu +ARM7_LDFLAGS := -g $(ARM7_ARCH) -mfloat-abi=soft # HACK/FIXME: Define a custom build rule for cartreset.c. # We do this because it is a .c file, not a .cpp file and so is outside our @@ -218,10 +213,6 @@ $(ndsdir)/arm7/arm7.elf: \ $(ndsdir)/arm7/source/main.o $(CXX) $(ARM7_LDFLAGS) -specs=ds_arm7.specs $+ -L$(DEVKITPRO)/libnds/lib -lnds7 -o $@ -# Rule for creating ARM7 .bin files from .elf files -$(ndsdir)/arm7/arm7.bin: $(ndsdir)/arm7/arm7.elf - $(OBJCOPY) -O binary $< $@ - |