diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100755 index 0000000..b7393f8 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,83 @@ +{ + "configurations": [ + { + "name": "Mac", + "includePath": [ + "/usr/local/include", + "${workspaceFolder}", + "${workspaceFolder}/include", + "${workspaceFolder}/build", + "/opt/devkitPro/libnds/include", + "/opt/devkitPro/devkitARM/arm-none-eabi/include", + "/opt/devkitPro/devkitARM/lib/gcc/arm-none-eabi/10.2.0/include" + ], + "defines": [], + "intelliSenseMode": "clang-x64", + "browse": { + "path": [ + "/usr/local/include", + "${workspaceFolder}", + "${workspaceFolder}/include", + "/opt/devkitPro/libnds/include", + "/opt/devkitPro/devkitARM/arm-none-eabi/include", + "/opt/devkitPro/devkitARM/lib/gcc/arm-none-eabi/10.2.0/include" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + }, + "macFrameworkPath": [ + "/System/Library/Frameworks", + "/Library/Frameworks" + ] + }, + { + "name": "Linux", + "includePath": [ + "/usr/include", + "/usr/local/include", + "${workspaceFolder}/include" + ], + "defines": [], + "intelliSenseMode": "clang-x64", + "browse": { + "path": [ + "/usr/include", + "/usr/local/include", + "${workspaceFolder}/include" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + }, + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/include", + "C:/devkitPro/devkitARM/arm-none-eabi/include", + "C:/devkitPro/devkitARM/lib/gcc/arm-none-eabi/10.2.0/include" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE", + "ARM7", + "WIN32" + ], + "intelliSenseMode": "msvc-x64", + "browse": { + "path": [ + "${workspaceFolder}", + "${workspaceFolder}/include", + "C:/devkitPro/devkitARM/arm-none-eabi/include", + "C:/devkitPro/devkitARM/lib/gcc/arm-none-eabi/10.2.0/include" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + }, + "cStandard": "c11", + "cppStandard": "c++17" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100755 index 0000000..ce6813f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,41 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "2.0.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "preLaunchTask": "gdb-debug", + "postDebugTask": "stop emulation", + "serverLaunchTimeout": 10000, + "stopAtEntry": true, + "program": "${workspaceFolder}/${workspaceFolderBasename}.elf", + "MIMode": "gdb", + "externalConsole": true, + "cwd": "${workspaceFolder}", + "targetArchitecture": "arm", + "miDebuggerServerAddress": "localhost:2345", + "windows": { + "miDebuggerPath": "C:/devkitPro/devkitARM/bin/arm-none-eabi-gdb.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "ignoreFailures": true, + "text": "file ${workspaceFolder}/${workspaceFolderBasename}.elf -enable-pretty-printing" + }] + }, + "osx":{ + "miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "ignoreFailures": true, + "text": "file ${workspaceFolder}/${workspaceFolderBasename}.elf -enable-pretty-printing" + }] + }, + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100755 index 0000000..420a65a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,82 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "stop emulation", + "type": "shell", + "windows": { + "command": "taskkill /im mGBA.exe /F" + }, + "osx": { + "command": "killall mGBA" + } + }, + { + "label": "make debug", + "type": "process", + "command": "make", + "args": [ + "DEBUG=1" + ], + "problemMatcher": [] + }, + { + "label": "make release", + "type": "process", + "command": "make", + "args": [ + "DEBUG=0" + ], + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "clean", + "type": "shell", + "command": "make clean" + }, + { + "label": "gdb-debug", + "type": "shell", + "dependsOn": [ + "make debug" + ], + "isBackground": false, + "windows": { + "command": "C:/mGBA/mGBA.exe -g ${workspaceFolder}/${workspaceFolderBasename}.nds;sleep 5;echo debuggerReady" + }, + "osx": { + "command": "/Applications/desmume.app/Contents/MacOS/desmume", + "args": [ + "-g", + "${workspaceFolder}/${workspaceFolderBasename}.nds" + ] + }, + "presentation": { + "clear": true, + "reveal": "always", + "panel": "new" + }, + "command": "debuggerReady", + "problemMatcher": { + "background": { + "activeOnStart": true, + "beginsPattern": "^.*debuggerReady.*$", + "endsPattern": "^.*debuggerReady.*$" + } + } + }, + { + "label": "run", + "type": "shell", + "isBackground": true, + "command": "C:/NO$GBADebugger/NO$GBA.exe ${workspaceFolder}/${workspaceFolderBasename}.elf", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/History.txt b/History.txt index 07e50bf..8da14a1 100644 --- a/History.txt +++ b/History.txt @@ -2,6 +2,14 @@ S8DS revision history -=-=-=-=-=-=-=-=-=-=-=- +V1.1.4 - 2021-10-16 (FluBBa) + Reverted a GG_IO optimization. + Fixed TV noise graphics after Power off. + Fixed file extension checking. + Fixed menu glitch if loading game directly. + Fixed pause on older Sega machines. + Better selection of machines. + V1.1.3 - 2021-10-12 (FluBBa) Fixed crash at startup. Added ui to enable/disable YM2413. diff --git a/README.md b/README.md index b1e72a4..dc6ed3f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# S8DS V1.1.3 +# S8DS V1.1.4 This is a SEGA 8Bit emulator for the NDS, it support the following systems: @@ -121,10 +121,29 @@ better 3D effect, I have only tested with red/cyan glasses. ### About: Some dumb info... -Sleep: Put the NDS into sleepmode. - START+SELECT wakes up from sleep mode (activated from this menu or from - 5/10/30 minutes of inactivity). !!! Doesn't work !!! - +## Arcade roms +After Burner MT - mt_aftrb.zip +Alien Syndrom MT - mt_asyn.zip +Astro Warrior MT - mt_astro.zip +Fantasy Zone MT - mt_fz.zip +Great Football MT - mt_gfoot.zip +Great Golf MT - mt_ggolf.zip +Great Soccer MT - mt_gsocr.zip +Out Run MT - mt_orun.zip +Parlour Games MT - mt_parlg.zip +Shinobi MT - mt_shnbi.zip + +Champion Boxing SG-AC - chboxing.zip +Champion Wrestling SG-AC - chwrestl.zip (encrypted) +Doki Doki Penguin SG-AC - dokidoki.zip + +Astro Flash System-E - astrofl.zip (encrypted) +Fantasy Zone 2 System-E - fantzn2.zip (encrypted) +Hang On Jr System-E - hangonjr.zip +Opa Opa System-E - opaopa.zip (encrypted) +Riddle Of Pythagoras System-E - ridleofp.zip +Tetris System-E - tetrisse.zip +Transformer System-E - transfrm.zip ## Credits: @@ -137,5 +156,7 @@ Omar Cornut (http://www.smspower.org/) for help with various SMS stuff. The crew at PocketHeaven for their support. Fredrik Olsson + Twitter @TheRealFluBBa + http://www.github.com/FluBBaOfWard diff --git a/source/Cart.s b/source/Cart.s index ab335da..bbb505d 100644 --- a/source/Cart.s +++ b/source/Cart.s @@ -15,7 +15,7 @@ .global g_cartFlags .global g_machine .global g_machineSet -// .global g_config + .global g_config .global g_configSet .global g_region .global gArcadeGameSet diff --git a/source/Gfx.s b/source/Gfx.s index 28991f0..36264fc 100644 --- a/source/Gfx.s +++ b/source/Gfx.s @@ -67,7 +67,7 @@ .align 2 antSeed: - .long 0x8000 + .long 0x800000 ;@---------------------------------------------------------------------------- antWars: .type antWars STT_FUNC @@ -109,7 +109,7 @@ antLoop0: mov r2,#8 antLoop1: movs r3,r3,lsr#1 - eorcs r3,r3,#0x90000 + eorcs r3,r3,#0xE10000 mov r4,r4,lsl#4 orrcs r4,r4,#0xF subs r2,r2,#1 diff --git a/source/Gui.c b/source/Gui.c index 236e584..c4880f6 100644 --- a/source/Gui.c +++ b/source/Gui.c @@ -29,7 +29,7 @@ #include "AY38910/Version.h" #include "SCC/Version.h" -#define EMUVERSION "V1.1.3 2021-10-12" +#define EMUVERSION "V1.1.4 2021-10-16" extern u8 sordM5Input; // SordM5.s @@ -83,6 +83,7 @@ static void countrySet(void); static void machineSet(void); static void biosSet(void); static void ym2413Set(void); +static void selectMachine(void); static void dip0Set0_1(void); static void dip0Set1_1(void); @@ -106,18 +107,6 @@ static void dip1Set6_2(void); static void dip1Sub0_4(void); static void dip1Set4_4(void); -static void uiNullSG1000(void); -static void uiNullOMV(void); -static void uiNullSC3000(void); -static void uiNullSG1000II(void); -static void uiNullMark3(void); -static void uiNullSMS1(void); -static void uiNullSMS2(void); -static void uiNullGG(void); -static void uiNullMD(void); -static void uiNullColeco(void); -static void uiNullMSX(void); -static void uiNullSordM5(void); static void uiFile(void); static void uiSettings(void); static void uiAbout(void); @@ -125,10 +114,12 @@ static void uiOptions(void); static void uiController(void); static void uiDisplay(void); static void uiMachine(void); +static void uiSelectMachine(void); static void uiSettings(void); static void uiBios(void); static void uiDipSwitches(void); +static void touchConsoleSet(void); static void uiDipSwitchesSGAC(void); static void uiDipSwitchesHangOnJr(void); static void uiDipSwitchesTransformer(void); @@ -140,9 +131,10 @@ static void uiDipSwitchesMegaTech(void); static void ui9(void); static void ui11(void); +static void ui20(void); -const fptr fnMain[] = {nullUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI}; +const fptr fnMain[] = {nullUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI,subUI}; static const fptr fnList0[] = {uiDummy}; static const fptr fnList1[] = {selectGame, loadState, saveState, saveSRAM, saveSettings, ejectGame, powerOnOff, resetGame, ui9}; @@ -150,8 +142,8 @@ static const fptr fnList2[] = {ui4, ui5, ui6, ui7, ui11}; static const fptr fnList3[] = {uiDummy}; static const fptr fnList4[] = {autoBSet, autoASet, controllerSet, swapABSet, joypadSet, selectSet, rffSet}; static const fptr fnList5[] = {scalingSet, flickSet, brightSet, colorSet, borderSet, spriteSet, glassesSet, bgrLayerSet, sprLayerSet}; -static const fptr fnList6[] = {countrySet, machineSet, ui8, ym2413Set}; -static const fptr fnList7[] = {speedSet, autoStateSet, autoSettingsSet, autoNVRAMSet, autoPauseGameSet, powerSaveSet, screenSwapSet, debugTextSet, sleepSet}; +static const fptr fnList6[] = {countrySet, ui20, ui8, ym2413Set}; +static const fptr fnList7[] = {speedSet, autoStateSet, autoSettingsSet, autoNVRAMSet, autoPauseGameSet, powerSaveSet, screenSwapSet, debugTextSet, touchConsoleSet}; static const fptr fnList8[] = {biosSet, selectUSBios, selectJPBios, selectGGBios, selectCOLECOBios, selectMSXBios, selectSORDM5Bios}; static const fptr fnList9[] = {exitEmulator, backOutOfMenu}; static const fptr fnList10[] = {uiDummy}; @@ -164,10 +156,11 @@ static const fptr fnList16[] = {dip0Set0_4,dip0Set4_4,dip1Set1_1,dip1Set2_2,dip1 static const fptr fnList17[] = {dip0Set0_4,dip0Set4_4,dip1Set1_1,dip1Set2_2,dip1Set4_2,dip1Set6_2}; static const fptr fnList18[] = {dip0Set0_4,dip0Set4_4,dip1Set1_1,dip1Set4_2}; static const fptr fnList19[] = {dip1Sub0_4,dip0Sub5_3,dip0Set1_1,dip0Set0_1,dip0Set2_3,dip1Set4_4}; -const fptr *const fnListX[] = {fnList0,fnList1,fnList2,fnList3,fnList4,fnList5,fnList6,fnList7,fnList8,fnList9,fnList10,fnList11,fnList12,fnList13,fnList14,fnList15,fnList16,fnList17,fnList18}; -u8 menuXitems[] = {ARRSIZE(fnList0),ARRSIZE(fnList1),ARRSIZE(fnList2),ARRSIZE(fnList3),ARRSIZE(fnList4),ARRSIZE(fnList5),ARRSIZE(fnList6),ARRSIZE(fnList7),ARRSIZE(fnList8),ARRSIZE(fnList9),ARRSIZE(fnList10),ARRSIZE(fnList11),ARRSIZE(fnList12),ARRSIZE(fnList13),ARRSIZE(fnList14),ARRSIZE(fnList15),ARRSIZE(fnList16),ARRSIZE(fnList17),ARRSIZE(fnList18),ARRSIZE(fnList19)}; -const fptr drawuiX[] = {uiNullNormal,uiFile,uiOptions,uiAbout,uiController,uiDisplay,uiMachine,uiSettings,uiBios,uiYesNo,uiDummy,uiDipSwitches,uiDipSwitchesSGAC,uiDipSwitchesHangOnJr,uiDipSwitchesTransformer,uiDipSwitchesPythagoras,uiDipSwitchesOpaOpa,uiDipSwitchesFantasyZone2,uiDipSwitchesTetris,uiDipSwitchesMegaTech}; -const u8 menuXback[] = {0,0,0,0,2,2,2,2,6,2,1,2,2,2,2,2,2,2,2}; +static const fptr fnList20[] = {selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine,selectMachine}; +const fptr *const fnListX[] = {fnList0,fnList1,fnList2,fnList3,fnList4,fnList5,fnList6,fnList7,fnList8,fnList9,fnList10,fnList11,fnList12,fnList13,fnList14,fnList15,fnList16,fnList17,fnList18,fnList19,fnList20}; +u8 menuXItems[] = {ARRSIZE(fnList0),ARRSIZE(fnList1),ARRSIZE(fnList2),ARRSIZE(fnList3),ARRSIZE(fnList4),ARRSIZE(fnList5),ARRSIZE(fnList6),ARRSIZE(fnList7),ARRSIZE(fnList8),ARRSIZE(fnList9),ARRSIZE(fnList10),ARRSIZE(fnList11),ARRSIZE(fnList12),ARRSIZE(fnList13),ARRSIZE(fnList14),ARRSIZE(fnList15),ARRSIZE(fnList16),ARRSIZE(fnList17),ARRSIZE(fnList18),ARRSIZE(fnList19),ARRSIZE(fnList20)}; +const fptr drawUIX[] = {uiNullNormal,uiFile,uiOptions,uiAbout,uiController,uiDisplay,uiMachine,uiSettings,uiBios,uiYesNo,uiDummy,uiDipSwitches,uiDipSwitchesSGAC,uiDipSwitchesHangOnJr,uiDipSwitchesTransformer,uiDipSwitchesPythagoras,uiDipSwitchesOpaOpa,uiDipSwitchesFantasyZone2,uiDipSwitchesTetris,uiDipSwitchesMegaTech,uiSelectMachine}; +const u8 menuXBack[] = {0,0,0,0,2,2,2,2,6,2,1,2,2,2,2,2,2,2,2,2,6}; static int sdscPtr = 0; static char sdscBuffer[80]; @@ -211,9 +204,9 @@ static char *const languageTxt[] = {"English","Japanese","English"}; //---------------------------------------------------------------------- void setupGUI() { - emuSettings = AUTOPAUSE_EMULATION | AUTOSLEEP_OFF; + emuSettings = AUTOPAUSE_EMULATION | AUTOSLEEP_OFF | (1<<12); keysSetRepeat(25, 4); // Delay, repeat. - menuXitems[1] = ARRSIZE(fnList1) - (enableExit?0:1); + menuXItems[1] = ARRSIZE(fnList1) - (enableExit?0:1); openMenu(); } @@ -233,91 +226,33 @@ void quickSelectGame(void) { void uiNullNormal() { if (g_machine == HW_SMS1) { - uiNullSMS1(); + setupSMS1Background(); } else if (g_machine == HW_SMS2) { - uiNullSMS2(); + setupSMS2Background(); } else if (g_machine == HW_GG) { - uiNullGG(); + setupGGBackground(); } else if (g_machine == HW_MEGADRIVE) { - uiNullMD(); + setupMDBackground(); } else if (g_machine == HW_OMV) { - uiNullOMV(); + setupOMVBackground(); } else if (g_machine == HW_SC3000) { - uiNullSC3000(); + setupSC3000Background(); } else if (g_machine == HW_SG1000) { - uiNullSG1000(); + setupSG1000Background(); } else if (g_machine == HW_SG1000II) { - uiNullSG1000II(); + setupSG1000IIBackground(); } else if (g_machine == HW_MARK3) { - uiNullMark3(); + setupMARK3Background(); } else if (g_machine == HW_COLECO) { - uiNullColeco(); + setupColecoBackground(); } else if (g_machine == HW_MSX) { - uiNullMSX(); + setupMSXBackground(); } else if (g_machine == HW_SORDM5) { - uiNullSordM5(); + setupSordM5Background(); } else { uiNullDefault(); + return; } -} - -static void uiNullSG1000() { - setupSG1000Background(); - drawItem("Menu",27,1,0); -} - -static void uiNullSG1000II() { - setupSG1000IIBackground(); - drawItem("Menu",27,1,0); -} - -static void uiNullOMV() { - setupOMVBackground(); - drawItem("Menu",27,1,0); -} - -static void uiNullSC3000() { - setupSC3000Background(); - drawItem("Menu",27,1,0); -} - -static void uiNullMark3() { - setupMARK3Background(); - drawItem("Menu",27,1,0); -} - -static void uiNullSMS1() { - setupSMS1Background(); - drawItem("Menu",27,1,0); -} - -static void uiNullSMS2() { - setupSMS2Background(); - drawItem("Menu",27,1,0); -} - -static void uiNullGG() { - setupGGBackground(); - drawItem("Menu",27,1,0); -} - -static void uiNullMD() { - setupMDBackground(); - drawItem("Menu",27,1,0); -} - -static void uiNullColeco() { - setupColecoBackground(); - drawItem("Menu",27,1,0); -} - -static void uiNullMSX() { - setupMSXBackground(); - drawItem("Menu",27,1,0); -} - -static void uiNullSordM5() { - setupSordM5Background(); drawItem("Menu",27,1,0); } @@ -406,6 +341,24 @@ static void uiMachine() { drawSubItem("YM2413: ",biosTxt[ym2413Enabled&1]); } +static void uiSelectMachine() { + setupSubMenu("Select Machine"); + drawMenuItem(" Auto"); + drawMenuItem(" SG-1000"); + drawMenuItem(" SC-3000"); + drawMenuItem(" Othello Multi Vision"); + drawMenuItem(" SG-1000 II"); + drawMenuItem(" Mark III"); + drawMenuItem(" Master System"); + drawMenuItem(" Master System 2"); + drawMenuItem(" Game Gear"); + drawMenuItem(" Mega Drive + PBC"); + drawMenuItem(" Coleco"); + drawMenuItem(" MSX"); + drawMenuItem(" Sord M5"); + drawMenuItem(""); // Cheating to remove last row. +} + static void uiSettings() { setupSubMenu("Settings"); drawSubItem("Speed: ", speedTxt[(emuSettings>>6)&3]); @@ -415,8 +368,8 @@ static void uiSettings() { drawSubItem("Autopause Game: ", autoTxt[emuSettings&1]); drawSubItem("Powersave 2nd Screen: ", autoTxt[(emuSettings>>1)&1]); drawSubItem("Emulator on Bottom: ", autoTxt[(emuSettings>>8)&1]); - drawSubItem("Debug Output: ", autoTxt[g_debugSet&1]); - drawSubItem("Autosleep: ", sleepTxt[(emuSettings>>4)&3]); + drawSubItem("Debug Output: ", autoTxt[gDebugSet&1]); + drawSubItem("Console Touch: ", autoTxt[(emuSettings>>12)&1]); } static void uiBios() { @@ -502,6 +455,9 @@ static void uiDipSwitchesMegaTech() { drawSubItem("Time per credit: ", mtTimerTxt[(dipSwitch1>>4) & 0xF]); } +void ui9() { + setSelectedMenu(9); +} void ui11() { int ds = 11; if (gArcadeGameSet == AC_CHAMPION_BOXING || gArcadeGameSet == AC_CHAMPION_WRESTLING || gArcadeGameSet == AC_DOKI_DOKI_PENGUIN) { @@ -524,11 +480,16 @@ void ui11() { setSelectedMenu(ds); } -void ui9() { - setSelectedMenu(9); +void ui20() { + setSelectedMenu(20); + selected = g_machineSet; } void nullUINormal(int keyHit) { + if (!(emuSettings & (1<<12))) { + nullUIDebug(keyHit); // Just check touch, open menu. + return; + } switch (g_machine) { case HW_SMS1: nullUISMS1(keyHit); @@ -564,9 +525,7 @@ void nullUINormal(int keyHit) { nullUISordM5(keyHit); break; default: - if (g_debugSet) { - nullUIDebug(keyHit); - } else if (keyHit&KEY_TOUCH) { + if (keyHit&KEY_TOUCH) { openMenu(); } break; @@ -580,7 +539,7 @@ void nullUIDebug(int keyHit) { } static void cartridgePortTouched(int keyHit) { - if (keyHit&KEY_TOUCH) { + if (keyHit & KEY_TOUCH) { if (gameInserted) { ejectGame(); } else { @@ -592,7 +551,7 @@ static void cartridgePortTouched(int keyHit) { void nullUISG1000(int keyHit) { int xpos, ypos; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -613,7 +572,7 @@ void nullUIOMV(int keyHit) { int xpos, ypos; sc3Keyboard = 0xFF; // 0xFF = nokey - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>3); @@ -684,7 +643,7 @@ void nullUISC3000(int keyHit) { int xpos, ypos; sc3Keyboard = 0xFF; // 0xFF = nokey - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -839,7 +798,7 @@ void nullUISC3000(int keyHit) { void nullUISG1000II(int keyHit) { int xpos, ypos; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -859,7 +818,7 @@ void nullUISG1000II(int keyHit) { void nullUIMark3(int keyHit) { int xpos, ypos; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -880,7 +839,7 @@ void nullUISMS1(int keyHit) { int xpos, ypos; static bool prePower = false; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -918,7 +877,7 @@ void nullUISMS1(int keyHit) { void nullUISMS2(int keyHit) { int xpos, ypos; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -943,7 +902,7 @@ void nullUISMS2(int keyHit) { void nullUIMD(int keyHit) { int xpos, ypos; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -972,7 +931,7 @@ void nullUIColeco(int keyHit) { int xpos, ypos; colecoKey = 0; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>3); @@ -1017,7 +976,7 @@ void nullUIMSX(int keyHit) { int xpos, ypos; sc3Keyboard = 0xFF; // 0xFF = nokey - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -1202,7 +1161,7 @@ void nullUISordM5(int keyHit) { keyboardRows[6] = 0; keyboardRows[7] = 0; sordM5Input &= ~0x80; - if (EMUinput&KEY_TOUCH) { + if (EMUinput & KEY_TOUCH) { touchPosition myTouch; touchRead(&myTouch); xpos = (myTouch.px>>2); @@ -1540,10 +1499,19 @@ void machineSet() { } } +void selectMachine() { + g_machineSet = selected; + backOutOfMenu(); +} + void ym2413Set() { ym2413Enabled ^= 0x01; } +void touchConsoleSet() { + emuSettings ^= (1<<12); +} + void dip0Set0_1() { dipSwitch0 ^= 0x01; diff --git a/source/Shared b/source/Shared index cdd41af..2a5ab3e 160000 --- a/source/Shared +++ b/source/Shared @@ -1 +1 @@ -Subproject commit cdd41af5e310d6297d7d94db25f3225e4819d0f8 +Subproject commit 2a5ab3e4809cea87c70121e3de2d4328de7228fd diff --git a/source/cpu.s b/source/cpu.s index eea74b0..6ef1454 100644 --- a/source/cpu.s +++ b/source/cpu.s @@ -46,9 +46,9 @@ runStart: movpl r1,#224-SCREEN_HEIGHT @ strb r1,[r2] + ldr z80optbl,=Z80OpTable bl refreshEMUjoypads ;@ Z=1 if communication ok - ldr z80optbl,=Z80OpTable add r0,z80optbl,#z80Regs ldmia r0,{z80f-z80pc,z80sp} ;@ Restore Z80 state diff --git a/source/io.s b/source/io.s index 267dcdd..66fe869 100644 --- a/source/io.s +++ b/source/io.s @@ -457,6 +457,10 @@ refreshSMSJoypads: cmp r1,#HW_SYSE cmpne r1,#HW_SGAC beq noPause + ldr r0,=g_config + ldrb r0,[r0] + tst r0,#0x20 + biceq r4,r4,#0x04 ;@ Remove Reset if disabled ldr r0,=g_emuFlags ldrb r0,[r0] tst r0,#GG_MODE @@ -900,6 +904,9 @@ Low0_IO_R: ;@ GG start button & country, 0x00 and r0,r0,#0x04 ;@ NDS X mov r0,r0,lsl#5 orr r0,r0,r1,lsl#5 + ldrb r1,joy0State + tst r1,#0x80 + orrne r0,r0,#0x80 ;@ orr r0,r0,#0x40 ;@ JAP/EXPORT ;@ orr r0,r0,#0x20 ;@ NTSC/PAL eor r0,r0,#0xC0