From b81c210530d60c0d1ea984f6e5bb3a9926909a01 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sun, 12 Feb 2006 23:23:52 +0000 Subject: [PATCH] New format for mapper handlers to support keeping keys pressed. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2488 --- include/debug.h | 2 +- include/mapper.h | 4 ++-- src/debug/debug.cpp | 8 +++++--- src/gui/sdl_mapper.cpp | 12 +++++++----- src/ints/bios_disk.cpp | 6 ++++-- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/debug.h b/include/debug.h index 112f668e..ce8a0028 100644 --- a/include/debug.h +++ b/include/debug.h @@ -20,7 +20,7 @@ void DEBUG_SetupConsole(void); void DEBUG_DrawScreen(void); bool DEBUG_Breakpoint(void); bool DEBUG_IntBreakpoint(Bit8u intNum); -void DEBUG_Enable(void); +void DEBUG_Enable(bool pressed); void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off); bool DEBUG_ExitLoop(void); void DEBUG_RefreshPage(char scroll); diff --git a/include/mapper.h b/include/mapper.h index 90813f06..d789deda 100644 --- a/include/mapper.h +++ b/include/mapper.h @@ -25,11 +25,11 @@ enum MapKeys { }; -typedef void (MAPPER_Handler)(void); +typedef void (MAPPER_Handler)(bool pressed); void MAPPER_AddHandler(MAPPER_Handler * handler,MapKeys key,Bitu mods,char * eventname,char * buttonname); void MAPPER_Init(void); void MAPPER_StartUp(Section * sec); -void MAPPER_Run(void); +void MAPPER_Run(bool pressed); void MAPPER_LosingFocus(void); diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index a4792c94..9c781bf4 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug.cpp,v 1.74 2006-02-09 11:47:48 qbix79 Exp $ */ +/* $Id: debug.cpp,v 1.75 2006-02-12 23:23:52 harekiet Exp $ */ #include #include @@ -1660,7 +1660,9 @@ Bitu DEBUG_Loop(void) { return DEBUG_CheckKeys(); } -void DEBUG_Enable(void) { +void DEBUG_Enable(bool pressed) { + if (!pressed) + return; static bool showhelp=false; debugging=true; SetCodeWinStart(); @@ -1947,7 +1949,7 @@ void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off) Bitu DEBUG_EnableDebugger(void) { exitLoop = true; - DEBUG_Enable(); + DEBUG_Enable(true); CPU_Cycles=CPU_CycleLeft=0; return 0; }; diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index 9e4b0c8b..f8438d8f 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdl_mapper.cpp,v 1.19 2006-02-09 11:47:48 qbix79 Exp $ */ +/* $Id: sdl_mapper.cpp,v 1.20 2006-02-12 23:23:52 harekiet Exp $ */ #define OLD_JOYSTICK 1 @@ -996,7 +996,7 @@ public: handlergroup.push_back(this); } void Active(bool yesno) { - if (yesno) (*handler)(); + (*handler)(yesno); }; char * ButtonName(void) { return buttonname; @@ -1502,8 +1502,8 @@ static void CreateBindGroups(void) { case JOY_2AXIS: default: new CStickBindGroup(joyno); - if((joyno+1) < numsticks) - new CStickBindGroup(joyno+1); + if((joyno+1U) < numsticks) + new CStickBindGroup(joyno+1U); break; } } @@ -1515,7 +1515,9 @@ void MAPPER_LosingFocus(void) { } } -void MAPPER_Run(void) { +void MAPPER_Run(bool pressed) { + if (!pressed) + return; /* Deactive all running binds */ for (CEventVector_it evit=events.begin();evit!=events.end();evit++) { (*evit)->DeActivateAll(); diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index d1721388..72f66a72 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios_disk.cpp,v 1.26 2006-02-09 11:47:56 qbix79 Exp $ */ +/* $Id: bios_disk.cpp,v 1.27 2006-02-12 23:23:52 harekiet Exp $ */ #include "dosbox.h" #include "callback.h" @@ -112,7 +112,9 @@ void swapInDisks(void) { } } -void swapInNextDisk(void) { +void swapInNextDisk(bool pressed) { + if (!pressed) + return; /* Hack/feature: rescan all disks as well */ for(Bitu i=0;iEmptyCache();