diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index cd51f863d..19cbc8702 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -2026,7 +2026,10 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val) if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) { - addon.write08(adr, val); + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + if(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7) + {} //prohibited + else addon.write08(ARMCPU_ARM9, adr, val); return; } @@ -2295,7 +2298,10 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val) if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) { - addon.write16(adr, val); + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + if(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7) + {} //prohibited + else addon.write16(ARMCPU_ARM9, adr, val); return; } @@ -2750,7 +2756,10 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val) if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) { - addon.write32(adr, val); + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + if(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7) + {} //prohibited + else addon.write32(ARMCPU_ARM9, adr, val); return; } @@ -3179,7 +3188,12 @@ u8 FASTCALL _MMU_ARM9_read08(u32 adr) return T1ReadByte(MMU.ARM9_ITCM, adr&0x7FFF); if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) - return addon.read08(adr); + { + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + if(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7) + return 0; //prohibited + else return addon.read08(ARMCPU_ARM9, adr); + } if (adr >> 24 == 4) { //Address is an IO register @@ -3266,7 +3280,12 @@ u16 FASTCALL _MMU_ARM9_read16(u32 adr) return T1ReadWord_guaranteedAligned(MMU.ARM9_ITCM, adr & 0x7FFE); if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) - return addon.read16(adr); + { + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + if(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7) + return 0; //prohibited + else return addon.read16(ARMCPU_ARM9, adr); + } if (adr >> 24 == 4) { @@ -3360,7 +3379,12 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr) return T1ReadLong_guaranteedAligned(MMU.ARM9_ITCM, adr&0x7FFC); if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) - return addon.read32(adr); + { + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + if(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7) + return 0; //prohibited + else return addon.read32(ARMCPU_ARM9, adr); + } // Address is an IO register if((adr >> 24) == 4) @@ -3486,7 +3510,10 @@ void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val) if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) { - addon.write08(adr, val); + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x204); + if(!(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7)) + {} //prohibited + else addon.write08(ARMCPU_ARM7,adr, val); return; } @@ -3611,7 +3638,10 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val) if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) { - addon.write16(adr, val); + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x204); + if(!(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7)) + {} //prohibited + else addon.write16(ARMCPU_ARM7,adr, val); return; } @@ -3974,7 +4004,10 @@ void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val) if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) { - addon.write32(adr, val); + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x204); + if(!(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7)) + {} //prohibited + else addon.write32(ARMCPU_ARM7,adr, val); return; } @@ -4086,7 +4119,12 @@ u8 FASTCALL _MMU_ARM7_read08(u32 adr) } if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) - return addon.read08(adr); + { + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x204); + if(!(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7)) + return 0; //prohibited + else return addon.read08(ARMCPU_ARM7,adr); + } if ((adr>=0x04000400)&&(adr<0x04000520)) { @@ -4141,7 +4179,12 @@ u16 FASTCALL _MMU_ARM7_read16(u32 adr) return WIFI_read16(adr) ; if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) - return addon.read16(adr); + { + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x204); + if(!(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7)) + return 0; //prohibited + else return addon.read16(ARMCPU_ARM7,adr); + } if ((adr>=0x04000400)&&(adr<0x04000520)) { @@ -4230,7 +4273,12 @@ u32 FASTCALL _MMU_ARM7_read32(u32 adr) return (WIFI_read16(adr) | (WIFI_read16(adr+2) << 16)); if ( (adr >= 0x08000000) && (adr < 0x0A010000) ) - return addon.read32(adr); + { + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x204); + if(!(exmemcnt & EXMEMCNT_MASK_SLOT2_ARM7)) + return 0; //prohibited + else return addon.read32(ARMCPU_ARM7,adr); + } if ((adr>=0x04000400)&&(adr<0x04000520)) { diff --git a/desmume/src/Makefile.am b/desmume/src/Makefile.am index a34f89c3d..9d30db6a3 100644 --- a/desmume/src/Makefile.am +++ b/desmume/src/Makefile.am @@ -80,7 +80,7 @@ libdesmume_a_SOURCES = \ utils/libfat/partition.cpp \ utils/libfat/partition.h \ addons.cpp addons.h \ - addons/slot2_mpcf.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp addons/guitarGrip.cpp addons/expMemory.cpp addons/piano.cpp addons/slot1_none.cpp addons/slot1_r4.cpp addons/slot1_retail.cpp \ + addons/slot2_mpcf.cpp addons/slot2_paddle.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp addons/guitarGrip.cpp addons/expMemory.cpp addons/piano.cpp addons/slot1_none.cpp addons/slot1_r4.cpp addons/slot1_retail.cpp \ cheatSystem.cpp cheatSystem.h \ texcache.cpp texcache.h rasterize.cpp rasterize.h \ metaspu/metaspu.cpp metaspu/metaspu.h \ diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 2b5878f28..c6b85d260 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -2371,6 +2371,7 @@ void NDS_Reset() nds.old = 0; nds.touchX = nds.touchY = 0; nds.isTouch = 0; + nds.paddle = 0; nds.debugConsole = CommonSettings.DebugConsole; nds.ensataEmulation = CommonSettings.EnsataEmulation; nds.ensataHandshake = ENSATA_HANDSHAKE_none; @@ -2826,6 +2827,12 @@ static void NDS_applyFinalInput() ((input.buttons.W ? 1 : 0) << 2)| ((input.buttons.E ? 1 : 0) << 1); + //these values are arbitrarily chosen to make arkanoid paddle control act similarly to its dpad controls + if(input.buttons.R) + nds.paddle += 5; + else if(input.buttons.L) + nds.paddle -= 5; + // TODO: low power IRQ } @@ -2878,6 +2885,35 @@ void emu_halt() { #endif } +//returns true if exmemcnt specifies satisfactory parameters for the device, which calls this function +bool ValidateSlot2Access(u32 procnum, u32 demandSRAMSpeed, u32 demand1stROMSpeed, u32 demand2ndROMSpeed, int clockbits) +{ + static const u32 _sramSpeeds[] = {10,8,6,18}; + static const u32 _rom1Speeds[] = {10,8,6,18}; + static const u32 _rom2Speeds[] = {6,4}; + u16 exmemcnt = T1ReadWord(MMU.MMU_MEM[procnum][0x40], 0x204); + u16 exmemcnt9 = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x204); + u32 arm7access = (exmemcnt9 & EXMEMCNT_MASK_SLOT2_ARM7); + u32 sramSpeed = _sramSpeeds[(exmemcnt & EXMEMCNT_MASK_SLOT2_SRAM_TIME)]; + u32 romSpeed1 = _rom1Speeds[(exmemcnt & EXMEMCNT_MASK_SLOT2_ROM_1ST_TIME)>>2]; + u32 romSpeed2 = _rom2Speeds[(exmemcnt & EXMEMCNT_MASK_SLOT2_ROM_2ND_TIME)>>4]; + u32 curclockbits = (exmemcnt & EXMEMCNT_MASK_SLOT2_CLOCKRATE)>>5; + + if(procnum==ARMCPU_ARM9 && arm7access) return false; + if(procnum==ARMCPU_ARM7 && !arm7access) return false; + + //what we're interested in here is whether the rom/ram are too low -> too fast. then accesses won't have enough time to work. + //i'm not sure if this gives us enough flexibility, but it is good enough for now. + //should make the arguments to this function bitmasks later if we need better. + if(sramSpeed < demandSRAMSpeed) return false; + if(romSpeed1 < demand1stROMSpeed) return false; + if(romSpeed2 < demand2ndROMSpeed) return false; + + if(clockbits != -1 && clockbits != (int)curclockbits) return false; + + return true; +} + //these templates needed to be instantiated manually template void NDS_exec(s32 nb); template void NDS_exec(s32 nb); diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 12648e985..84ebbd397 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -168,6 +168,8 @@ struct NDSSystem u16 touchY; BOOL isTouch; u16 pad; + + u16 paddle; u8 *FW_ARM9BootCode; u8 *FW_ARM7BootCode; @@ -595,5 +597,7 @@ void MovieSRAM(); void ClearAutoHold(void); +bool ValidateSlot2Access(u32 procnum, u32 demandSRAMSpeed, u32 demand1stROMSpeed, u32 demand2ndROMSpeed, int clockbits); + #endif diff --git a/desmume/src/addons.cpp b/desmume/src/addons.cpp index 447eddc64..15a52df52 100644 --- a/desmume/src/addons.cpp +++ b/desmume/src/addons.cpp @@ -36,6 +36,7 @@ extern ADDONINTERFACE addonGBAgame; extern ADDONINTERFACE addonGuitarGrip; extern ADDONINTERFACE addonExpMemory; extern ADDONINTERFACE addonPiano; +extern ADDONINTERFACE addonPaddle; //extern ADDONINTERFACE addonExternalMic; ADDONINTERFACE addonList[NDS_ADDON_COUNT] = { @@ -46,6 +47,7 @@ ADDONINTERFACE addonList[NDS_ADDON_COUNT] = { addonGuitarGrip, addonExpMemory, addonPiano, + addonPaddle }; ADDONINTERFACE addon = addonCFlash; // default none pak diff --git a/desmume/src/addons.h b/desmume/src/addons.h index ea165b723..b89bf1441 100644 --- a/desmume/src/addons.h +++ b/desmume/src/addons.h @@ -42,14 +42,14 @@ struct ADDONINTERFACE void (*config)(void); //called when the emulator write to addon - void (*write08)(u32 adr, u8 val); - void (*write16)(u32 adr, u16 val); - void (*write32)(u32 adr, u32 val); + void (*write08)(u32 procnum, u32 adr, u8 val); + void (*write16)(u32 procnum, u32 adr, u16 val); + void (*write32)(u32 procnum, u32 adr, u32 val); //called when the emulator read from addon - u8 (*read08)(u32 adr); - u16 (*read16)(u32 adr); - u32 (*read32)(u32 adr); + u8 (*read08)(u32 procnum, u32 adr); + u16 (*read16)(u32 procnum, u32 adr); + u32 (*read32)(u32 procnum, u32 adr); //called when the user get info about addon pak (description) void (*info)(char *info); @@ -64,6 +64,7 @@ enum NDS_ADDON_TYPE NDS_ADDON_GUITARGRIP, // Guitar Grip NDS_ADDON_EXPMEMORY, // Memory Expansion NDS_ADDON_PIANO, // Piano + NDS_ADDON_PADDLE, //NDS_ADDON_EXTERNALMIC, NDS_ADDON_COUNT // use for counter addons - MUST TO BE LAST!!! }; diff --git a/desmume/src/addons/expMemory.cpp b/desmume/src/addons/expMemory.cpp index 416c4662b..ff2239321 100644 --- a/desmume/src/addons/expMemory.cpp +++ b/desmume/src/addons/expMemory.cpp @@ -51,7 +51,7 @@ static void ExpMemory_close(void) } } static void ExpMemory_config(void) {} -static void ExpMemory_write08(u32 adr, u8 val) +static void ExpMemory_write08(u32 procnum, u32 adr, u8 val) { if (adr >= 0x09000000) { @@ -61,7 +61,7 @@ static void ExpMemory_write08(u32 adr, u8 val) } EXPINFO("ExpMemory: write 08 at 0x%08X = 0x%02X\n", adr, val); } -static void ExpMemory_write16(u32 adr, u16 val) +static void ExpMemory_write16(u32 procnum, u32 adr, u16 val) { if (adr >= 0x09000000) { @@ -71,7 +71,7 @@ static void ExpMemory_write16(u32 adr, u16 val) } EXPINFO("ExpMemory: write 16 at 0x%08X = 0x%04X\n", adr, val); } -static void ExpMemory_write32(u32 adr, u32 val) +static void ExpMemory_write32(u32 procnum, u32 adr, u32 val) { if (adr >= 0x09000000) @@ -90,7 +90,7 @@ static u8 header_0x00B0[] = 0xFF, 0xFF, 0xFF, 0x7F }; -static u8 ExpMemory_read08(u32 adr) +static u8 ExpMemory_read08(u32 procnum, u32 adr) { EXPINFO("ExpMemory: read 08 at 0x%08X\n", adr); @@ -106,7 +106,7 @@ static u8 ExpMemory_read08(u32 adr) return 0xFF; } -static u16 ExpMemory_read16(u32 adr) +static u16 ExpMemory_read16(u32 procnum, u32 adr) { if(adr>=0x080000B0 && adr<0x080000C0) return T1ReadWord(header_0x00B0,adr-0x080000B0); @@ -124,7 +124,7 @@ static u16 ExpMemory_read16(u32 adr) EXPINFO("ExpMemory: read 16 at 0x%08X\n", adr); return 0xFFFF; } -static u32 ExpMemory_read32(u32 adr) +static u32 ExpMemory_read32(u32 procnum, u32 adr) { if(adr>=0x080000B0 && adr<0x080000C0) return T1ReadLong(header_0x00B0,adr-0x080000B0); diff --git a/desmume/src/addons/gbagame.cpp b/desmume/src/addons/gbagame.cpp index 6cc851606..2cba25268 100644 --- a/desmume/src/addons/gbagame.cpp +++ b/desmume/src/addons/gbagame.cpp @@ -367,7 +367,7 @@ static void GBAgame_close(void) static void GBAgame_config(void) {} -static void GBAgame_write08(u32 adr, u8 val) +static void GBAgame_write08(u32 procnum, u32 adr, u8 val) { //INFO("GBAgame: write08 at 0x%08X val=0x%02X\n", adr, val); if ( (adr >= 0x0A000000) && (adr < 0x0A010000) ) @@ -385,17 +385,17 @@ static void GBAgame_write08(u32 adr, u8 val) //return (u8)T1ReadByte(saveData, (adr - 0x0A000000)); } } -static void GBAgame_write16(u32 adr, u16 val) +static void GBAgame_write16(u32 procnum, u32 adr, u16 val) { //INFO("GBAgame: write16 at 0x%08X val=0x%04X\n", adr, val); } -static void GBAgame_write32(u32 adr, u32 val) +static void GBAgame_write32(u32 procnum, u32 adr, u32 val) { //INFO("GBAgame: write32 at 0x%08X val=0x%08X\n", adr, val); } -static u8 GBAgame_read08(u32 adr) +static u8 GBAgame_read08(u32 procnum, u32 adr) { //INFO("GBAgame: read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000))); @@ -423,7 +423,7 @@ static u8 GBAgame_read08(u32 adr) return 0xFF; } -static u16 GBAgame_read16(u32 adr) +static u16 GBAgame_read16(u32 procnum, u32 adr) { //INFO("GBAgame: read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000))); @@ -438,7 +438,7 @@ static u16 GBAgame_read16(u32 adr) return 0xFFFF; } -static u32 GBAgame_read32(u32 adr) +static u32 GBAgame_read32(u32 procnum, u32 adr) { //INFO("GBAgame: read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000))); diff --git a/desmume/src/addons/guitarGrip.cpp b/desmume/src/addons/guitarGrip.cpp index e49dcc0d7..6e48d6fcc 100644 --- a/desmume/src/addons/guitarGrip.cpp +++ b/desmume/src/addons/guitarGrip.cpp @@ -30,22 +30,22 @@ static void guitarGrip_reset(void) } static void guitarGrip_close(void) {} static void guitarGrip_config(void) {} -static void guitarGrip_write08(u32 adr, u8 val) {} -static void guitarGrip_write16(u32 adr, u16 val) {} -static void guitarGrip_write32(u32 adr, u32 val) {} -static u8 guitarGrip_read08(u32 adr) +static void guitarGrip_write08(u32 procnum, u32 adr, u8 val) {} +static void guitarGrip_write16(u32 procnum, u32 adr, u16 val) {} +static void guitarGrip_write32(u32 procnum, u32 adr, u32 val) {} +static u8 guitarGrip_read08(u32 procnum, u32 adr) { //INFO("GuitarGrip: read 08 at 0x%08X\n", adr); if (adr == 0x0A000000) return (~guitarKeyStatus); else if(adr&1) return 0xFF; else return 0xF9; } -static u16 guitarGrip_read16(u32 adr) +static u16 guitarGrip_read16(u32 procnum, u32 adr) { //INFO("GuitarGrip: read 16 at 0x%08X\n", adr); return 0xF9FF; } -static u32 guitarGrip_read32(u32 adr) +static u32 guitarGrip_read32(u32 procnum, u32 adr) { //INFO("GuitarGrip: read 32 at 0x%08X\n", adr); return (0xF9FFF9FF); diff --git a/desmume/src/addons/none.cpp b/desmume/src/addons/none.cpp index 1fbad5e5a..60acb415b 100644 --- a/desmume/src/addons/none.cpp +++ b/desmume/src/addons/none.cpp @@ -25,12 +25,12 @@ static BOOL None_init(void) { return (TRUE); } static void None_reset(void) {} static void None_close(void) {} static void None_config(void) {} -static void None_write08(u32 adr, u8 val) {} -static void None_write16(u32 adr, u16 val) {} -static void None_write32(u32 adr, u32 val) {} -static u8 None_read08(u32 adr){ return (0xFF); } -static u16 None_read16(u32 adr){ return (0xFFFF); } -static u32 None_read32(u32 adr){ return (0xFFFFFFFF); } +static void None_write08(u32 procnum, u32 adr, u8 val) {} +static void None_write16(u32 procnum, u32 adr, u16 val) {} +static void None_write32(u32 procnum, u32 adr, u32 val) {} +static u8 None_read08(u32 procnum, u32 adr){ return (0xFF); } +static u16 None_read16(u32 procnum, u32 adr){ return (0xFFFF); } +static u32 None_read32(u32 procnum, u32 adr){ return (0xFFFFFFFF); } static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); } ADDONINTERFACE addonNone = { diff --git a/desmume/src/addons/piano.cpp b/desmume/src/addons/piano.cpp index 794f55041..96abd7887 100644 --- a/desmume/src/addons/piano.cpp +++ b/desmume/src/addons/piano.cpp @@ -31,20 +31,20 @@ static void piano_reset(void) static void piano_close(void) {} static void piano_config(void) {} -static void piano_write08(u32 adr, u8 val) +static void piano_write08(u32 procnum, u32 adr, u8 val) { //INFO("piano: write 08 at 0x%08X = %02X\n", adr, val); } -static void piano_write16(u32 adr, u16 val) +static void piano_write16(u32 procnum, u32 adr, u16 val) { //INFO("piano: write 16 at 0x%08X = %04X\n", adr, val); } -static void piano_write32(u32 adr, u32 val) +static void piano_write32(u32 procnum, u32 adr, u32 val) { //INFO("piano: write 32 at 0x%08X = %08X\n", adr, val); } extern int currFrameCounter; -static u8 piano_read08(u32 adr) +static u8 piano_read08(u32 procnum, u32 adr) { //printf("piano: read 08 at 0x%08X\n", adr); @@ -78,12 +78,12 @@ static u8 piano_read08(u32 adr) if(adr&1) return 0x07; else return 0x00; } -static u16 piano_read16(u32 adr) +static u16 piano_read16(u32 procnum, u32 adr) { //printf("piano: read 16 at 0x%08X\n", adr); return 0x07FF; } -static u32 piano_read32(u32 adr) +static u32 piano_read32(u32 procnum, u32 adr) { //printf("piano: read 32 at 0x%08X\n", adr); return 0x07FF07FF; diff --git a/desmume/src/addons/rumblepak.cpp b/desmume/src/addons/rumblepak.cpp index 6d650d7b6..9e340e816 100644 --- a/desmume/src/addons/rumblepak.cpp +++ b/desmume/src/addons/rumblepak.cpp @@ -39,11 +39,11 @@ static void RumblePak_close(void) {} static void RumblePak_config(void) {} -static void RumblePak_write08(u32 adr, u8 val) +static void RumblePak_write08(u32 procnum, u32 adr, u8 val) { } -static void RumblePak_write16(u32 adr, u16 val) +static void RumblePak_write16(u32 procnum, u32 adr, u16 val) { if (!FeedbackON) return; @@ -58,22 +58,22 @@ static void RumblePak_write16(u32 adr, u16 val) FeedbackON(val); } -static void RumblePak_write32(u32 adr, u32 val) +static void RumblePak_write32(u32 procnum, u32 adr, u32 val) { } -static u8 RumblePak_read08(u32 adr) +static u8 RumblePak_read08(u32 procnum, u32 adr) { if(adr&1) return 0xFF; else return 0xFD; } -static u16 RumblePak_read16(u32 adr) +static u16 RumblePak_read16(u32 procnum, u32 adr) { return 0xFFFD; } -static u32 RumblePak_read32(u32 adr) +static u32 RumblePak_read32(u32 procnum, u32 adr) { return 0xFFFDFFFD; } diff --git a/desmume/src/addons/slot2_mpcf.cpp b/desmume/src/addons/slot2_mpcf.cpp index 8c4b9d0a3..f5c5777fc 100644 --- a/desmume/src/addons/slot2_mpcf.cpp +++ b/desmume/src/addons/slot2_mpcf.cpp @@ -292,32 +292,32 @@ static void config(void) { } -static void write08(u32 adr, u8 val) +static void write08(u32 procnum, u32 adr, u8 val) { cflash_write(adr, val); } -static void write16(u32 adr, u16 val) +static void write16(u32 procnum, u32 adr, u16 val) { cflash_write(adr, val); } -static void write32(u32 adr, u32 val) +static void write32(u32 procnum, u32 adr, u32 val) { cflash_write(adr, val); } -static u8 read08(u32 adr) +static u8 read08(u32 procnum, u32 adr) { return (cflash_read(adr)); } -static u16 read16(u32 adr) +static u16 read16(u32 procnum, u32 adr) { return (cflash_read(adr)); } -static u32 read32(u32 adr) +static u32 read32(u32 procnum, u32 adr) { return (cflash_read(adr)); } diff --git a/desmume/src/registers.h b/desmume/src/registers.h index d4b2b84c5..68c005a58 100644 --- a/desmume/src/registers.h +++ b/desmume/src/registers.h @@ -418,4 +418,10 @@ #define TSC_MEASURE_AUX 6 #define TSC_MEASURE_TEMP2 7 +#define EXMEMCNT_MASK_SLOT2_ARM7 (1<<7) +#define EXMEMCNT_MASK_SLOT2_SRAM_TIME (3) +#define EXMEMCNT_MASK_SLOT2_ROM_1ST_TIME (3<<2) +#define EXMEMCNT_MASK_SLOT2_ROM_2ND_TIME (1<<4) +#define EXMEMCNT_MASK_SLOT2_CLOCKRATE (3<<5) + #endif diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index 64cbefce7..d41f0dad5 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -171,6 +171,7 @@ SFORMAT SF_NDS[]={ { "_SLP", 4, 1, &nds.sleeping}, { "_FBS", 4, 1, &nds.freezeBus}, { "_CEJ", 4, 1, &nds.cardEjected}, + { "_PDL", 2, 1, &nds.paddle}, { "_P00", 1, 1, &nds.power1.lcd}, { "_P01", 1, 1, &nds.power1.gpuMain}, { "_P02", 1, 1, &nds.power1.gfx3d_render}, diff --git a/desmume/src/windows/DeSmuME_2005.vcproj b/desmume/src/windows/DeSmuME_2005.vcproj index 6ea31a92f..4f6bfcc4e 100644 --- a/desmume/src/windows/DeSmuME_2005.vcproj +++ b/desmume/src/windows/DeSmuME_2005.vcproj @@ -1671,6 +1671,10 @@ RelativePath="..\addons\slot2_mpcf.cpp" > + + + + + diff --git a/desmume/src/windows/DeSmuME_2010.vcxproj.filters b/desmume/src/windows/DeSmuME_2010.vcxproj.filters index 84c877877..f945be4ad 100644 --- a/desmume/src/windows/DeSmuME_2010.vcxproj.filters +++ b/desmume/src/windows/DeSmuME_2010.vcxproj.filters @@ -441,6 +441,9 @@ Core\utils + + Core\addons + diff --git a/desmume/src/windows/gbaslot_config.cpp b/desmume/src/windows/gbaslot_config.cpp index 15af63846..747274470 100644 --- a/desmume/src/windows/gbaslot_config.cpp +++ b/desmume/src/windows/gbaslot_config.cpp @@ -217,6 +217,19 @@ INT_PTR CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam return FALSE; } +INT_PTR CALLBACK GbaSlotPaddle(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + _OKbutton = TRUE; + return TRUE; + } + } + return FALSE; +} + INT_PTR CALLBACK GbaSlotRumblePak(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) @@ -436,7 +449,8 @@ u32 GBAslot_IDDs[NDS_ADDON_COUNT] = { IDD_GBASLOT_GBAGAME, IDD_GBASLOT_GUITARGRIP, IDD_GBASLOT_NONE, //expmem - IDD_GBASLOT_PIANO + IDD_GBASLOT_PIANO, + IDD_GBASLOT_NONE, //padd;e }; DLGPROC GBAslot_Procs[NDS_ADDON_COUNT] = { @@ -446,7 +460,8 @@ DLGPROC GBAslot_Procs[NDS_ADDON_COUNT] = { GbaSlotGBAgame, GbaSlotGuitarGrip, GbaSlotNone, //expmem - GbaSlotPiano + GbaSlotPiano, + GbaSlotPaddle }; @@ -571,6 +586,12 @@ void GBAslotDialog(HWND hwnd) else needReset = false; break; + case NDS_ADDON_PADDLE: + if (temp_type != addon_type) + needReset = true; + else + needReset = false; + break; case NDS_ADDON_GBAGAME: strcpy(GBAgameName, tmp_gbagame_filename); WritePrivateProfileString("GBAslot.GBAgame","filename",GBAgameName,IniName); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 6bbe5d28d..d57eea995 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -2773,6 +2773,8 @@ int _main() break; case NDS_ADDON_PIANO: break; + case NDS_ADDON_PADDLE: + break; default: addon_type = NDS_ADDON_NONE; break; diff --git a/desmume/src/wx/wxDeSmuME_2008.vcproj b/desmume/src/wx/wxDeSmuME_2008.vcproj index dd11ddfe0..0b150b8ac 100644 --- a/desmume/src/wx/wxDeSmuME_2008.vcproj +++ b/desmume/src/wx/wxDeSmuME_2008.vcproj @@ -1028,6 +1028,10 @@ RelativePath="..\addons\slot2_mpcf.cpp" > + +