From d76d9247c21c6e1853254f2054bc3b5614002e19 Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 1 Nov 2005 16:32:27 +0000 Subject: [PATCH] Fixed bug where pressing the keys to enter menu, commandmenu or debugger were accessible from the launcher, and were causing a segfault when pressed. Fixed bug where 'mouse is paddle xxx' number wasn't being set when starting Stella for the first time. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@873 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/EventHandler.cxx | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index ce28cc984..9ae87e6e4 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EventHandler.cxx,v 1.108 2005-10-30 20:29:56 stephena Exp $ +// $Id: EventHandler.cxx,v 1.109 2005-11-01 16:32:27 stephena Exp $ //============================================================================ #include @@ -114,6 +114,8 @@ EventHandler::EventHandler(OSystem* osystem) myGrabMouseFlag = myOSystem->settings().getBool("grabmouse"); myEmulateMouseFlag = myOSystem->settings().getBool("joymouse"); + setPaddleMode(myOSystem->settings().getInt("paddle"), false); + myFryingFlag = false; memset(&myJoyMouse, 0, sizeof(myJoyMouse)); @@ -152,7 +154,6 @@ void EventHandler::reset(State state) myLSState = 0; myPauseFlag = false; myQuitFlag = false; - myPaddleMode = 0; myOSystem->frameBuffer().pause(myPauseFlag); myOSystem->sound().mute(myPauseFlag); @@ -1082,28 +1083,38 @@ bool EventHandler::eventStateChange(Event::Type type) case Event::MenuMode: if(!myPauseFlag) { - if(myState != S_MENU) + if(myState == S_EMULATE) enterMenuMode(S_MENU); - else + else if(myState == S_MENU) leaveMenuMode(); + else + handled = false; } + else + handled = false; break; case Event::CmdMenuMode: if(!myPauseFlag) { - if(myState != S_CMDMENU) + if(myState == S_EMULATE) enterMenuMode(S_CMDMENU); - else + else if(myState == S_CMDMENU) leaveMenuMode(); + else + handled = false; } + else + handled = false; break; case Event::DebuggerMode: - if(myState != S_DEBUGGER) + if(myState == S_EMULATE) enterDebugMode(); - else + else if(myState == S_DEBUGGER) leaveDebugMode(); + else + handled = false; break; default: @@ -1579,6 +1590,9 @@ void EventHandler::takeSnapshot() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::setPaddleMode(uInt32 num, bool showmessage) { + if(num < 0 || num > 3) + return; + myPaddleMode = num; if(showmessage)