diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index d024d685e..094f2f6a4 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -4009,8 +4009,11 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val) if(nds.adc_jitterctr == 25) { nds.adc_jitterctr = 0; - nds.adc_touchY ^= 16; - nds.adc_touchX ^= 16; + if (nds.stylusJitter) + { + nds.adc_touchY ^= 16; + nds.adc_touchX ^= 16; + } } if(MMU.SPI_CNT&(1<<11)) { diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 7f05287b2..724ddd13d 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -2522,6 +2522,7 @@ void NDS_Reset() nds.ConsoleType = CommonSettings.ConsoleType; nds._DebugConsole = CommonSettings.DebugConsole; nds.ensataEmulation = CommonSettings.EnsataEmulation; + nds.stylusJitter = CommonSettings.StylusJitter; nds.ensataHandshake = ENSATA_HANDSHAKE_none; nds.ensataIpcSyncCounter = 0; SetupMMU(nds.Is_DebugConsole(),nds.Is_DSI()); diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 56f20b67b..117ad0f52 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -177,6 +177,7 @@ struct NDSSystem u16 adc_touchX; u16 adc_touchY; s32 adc_jitterctr; + BOOL stylusJitter; //the DSI returns calibrated touch coords from its TSC (?), so we need to save these separately u16 scr_touchX; @@ -507,6 +508,7 @@ extern struct TCommonSettings { , spu_advanced(false) , StylusPressure(50) , ConsoleType(NDS_CONSOLE_TYPE_FAT) + , StylusJitter(true) { strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM7BIOS, "biosnds7.bin"); @@ -558,6 +560,7 @@ extern struct TCommonSettings { bool rigorous_timing; int StylusPressure; + bool StylusJitter; bool dispLayers[2][5]; diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index 864dda3e8..d4363a66c 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -464,6 +464,12 @@ void HK_DecreasePressure(int, bool justPressed) { if(CommonSettings.StylusPressure<0) CommonSettings.StylusPressure = 0; osd->addLine("Stylus Pressure to %d%%",CommonSettings.StylusPressure); } +void HK_ToggleStylusJitter(int, bool justPressed) { + CommonSettings.StylusJitter = !CommonSettings.StylusJitter; + nds.stylusJitter = CommonSettings.StylusJitter; + WritePrivateProfileBool("Emulation", "StylusJitter", CommonSettings.StylusJitter, IniName); + osd->addLine("Stylus Jitter %s",CommonSettings.StylusJitter ? "On" : "Off"); +} void HK_Rotate0(int, bool justPressed) { SetRotate(MainWindow->getHWnd(), 0);} void HK_Rotate90(int, bool justPressed) { SetRotate(MainWindow->getHWnd(), 90);} @@ -579,6 +585,12 @@ void InitCustomKeys (SCustomKeys *keys) keys->DecreasePressure.key = VK_OEM_MINUS; keys->DecreasePressure.modifiers = CUSTKEY_SHIFT_MASK; + keys->ToggleStylusJitter.handleKeyDown = HK_ToggleStylusJitter; + keys->ToggleStylusJitter.code = "ToggleStylusJitter"; + keys->ToggleStylusJitter.name = STRW(ID_LABEL_HK61); + keys->ToggleStylusJitter.page = HOTKEY_PAGE_MAIN; + keys->ToggleStylusJitter.key = NULL; + keys->Microphone.handleKeyDown = HK_MicrophoneKeyDown; keys->Microphone.handleKeyUp = HK_MicrophoneKeyUp; keys->Microphone.code = "Microphone"; diff --git a/desmume/src/windows/hotkey.h b/desmume/src/windows/hotkey.h index 8c028dcf6..94760d694 100644 --- a/desmume/src/windows/hotkey.h +++ b/desmume/src/windows/hotkey.h @@ -71,7 +71,7 @@ struct SCustomKeys SCustomKey Rotate0, Rotate90, Rotate180, Rotate270; - SCustomKey OpenROM, ReloadROM, Reset, Pause, CpuMode, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed, FrameLimitToggle, Microphone, IncreasePressure, DecreasePressure; + SCustomKey OpenROM, ReloadROM, Reset, Pause, CpuMode, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed, FrameLimitToggle, Microphone, IncreasePressure, DecreasePressure, ToggleStylusJitter; SCustomKey PlayMovie, RecordMovie, StopMovie, ToggleReadOnly; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index f96cadcad..b3720fbce 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -805,6 +805,7 @@ #define ID_LABEL_HK58 4523 #define ID_LABEL_HK59 4524 #define ID_LABEL_HK60 4525 +#define ID_LABEL_HK61 4526 #define IDD_MICROPHONE 5000 #define IDM_MICROPHONESETTINGS 5001 #define IDC_MICSAMPLEBROWSE 5003 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 25274f200..079c27f45 100644 Binary files a/desmume/src/windows/resources.rc and b/desmume/src/windows/resources.rc differ