From 5a83ac4e744b5303f44ae68c9ea87d55bf3118cd Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 2 Oct 2005 19:10:39 +0000 Subject: [PATCH] Added 'joymouse' argument, which controls whether 'joystick emulates mouse' code in GUI mode is activated. This is deactivated by default, since it could cause problems on systems that don't have joysticks properly calibrated. Added more descriptive names for Cartridge types in GameInfoDialog, since I could never remember which ones were which. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@807 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/EventHandler.cxx | 25 +++++----------- stella/src/emucore/EventHandler.hxx | 7 +++-- stella/src/emucore/Settings.cxx | 4 ++- stella/src/gui/GameInfoDialog.cxx | 46 ++++++++++++++--------------- 4 files changed, 38 insertions(+), 44 deletions(-) diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 93886ae72..0daa858db 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.102 2005-09-30 18:17:29 stephena Exp $ +// $Id: EventHandler.cxx,v 1.103 2005-10-02 19:10:39 stephena Exp $ //============================================================================ #include @@ -65,6 +65,7 @@ EventHandler::EventHandler(OSystem* osystem) myQuitFlag(false), myGrabMouseFlag(false), myUseLauncherFlag(false), + myEmulateMouseFlag(false), myPaddleMode(0), myMouseMove(3) { @@ -105,6 +106,7 @@ EventHandler::EventHandler(OSystem* osystem) setActionMappings(); myGrabMouseFlag = myOSystem->settings().getBool("grabmouse"); + myEmulateMouseFlag = myOSystem->settings().getBool("joymouse"); myFryingFlag = false; @@ -282,7 +284,8 @@ void EventHandler::poll(uInt32 time) SDL_Event event; // Handle joystick to mouse emulation - handleJoyMouse(time); + if(myEmulateMouseFlag) + handleJoyMouse(time); // Check for an event while(SDL_PollEvent(&event)) @@ -706,21 +709,6 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta else // Determine which dialog to send events to { // Make sure the unicode field is valid -/* - if (key >= SDLK_F1 && key <= SDLK_F9) - unicode = key - SDLK_F1 + 315; - else if (key >= SDLK_KP0 && key <= SDLK_KP9) - unicode = key - SDLK_KP0 + '0'; - else if (key == SDLK_BACKSPACE || key == SDLK_DELETE || - (key >= SDLK_UP && key <= SDLK_PAGEDOWN)) - unicode = key; - else if (key >= 'a' && key <= 'z' && mod & KMOD_SHIFT) - unicode = key & ~0x20; - else if (key >= SDLK_NUMLOCK && key <= SDLK_UNDO) - return; - else - unicode = key; -*/ if (key == SDLK_BACKSPACE || key == SDLK_DELETE || (key >= SDLK_UP && key <= SDLK_PAGEDOWN)) unicode = key; @@ -1011,7 +999,8 @@ void EventHandler::handleMouseWarp(uInt8 stick, uInt8 axis, Int16 value) void EventHandler::handleJoyEvent(uInt8 stick, uInt32 code, uInt8 state) { // Joystick button zero acts as left mouse button and cannot be remapped - if(myState != S_EMULATE && code == JOYMOUSE_LEFT_BUTTON) + if(myState != S_EMULATE && code == JOYMOUSE_LEFT_BUTTON && + myEmulateMouseFlag) { // This button acts as mouse button zero, and can never be remapped SDL_MouseButtonEvent mouseEvent; diff --git a/stella/src/emucore/EventHandler.hxx b/stella/src/emucore/EventHandler.hxx index d9c0d6cf5..ce179ac99 100644 --- a/stella/src/emucore/EventHandler.hxx +++ b/stella/src/emucore/EventHandler.hxx @@ -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.hxx,v 1.51 2005-09-30 18:17:29 stephena Exp $ +// $Id: EventHandler.hxx,v 1.52 2005-10-02 19:10:39 stephena Exp $ //============================================================================ #ifndef EVENTHANDLER_HXX @@ -74,7 +74,7 @@ struct Stella_Joystick { mapping can take place. @author Stephen Anthony - @version $Id: EventHandler.hxx,v 1.51 2005-09-30 18:17:29 stephena Exp $ + @version $Id: EventHandler.hxx,v 1.52 2005-10-02 19:10:39 stephena Exp $ */ class EventHandler { @@ -364,6 +364,9 @@ class EventHandler // Indicates whether to use launcher mode when exiting a game bool myUseLauncherFlag; + // Indicates whether the joystick emulates the mouse in GUI mode + bool myEmulateMouseFlag; + // Indicates whether or not we're in frying mode bool myFryingFlag; diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 5c08a19b9..4a02ce48c 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.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: Settings.cxx,v 1.61 2005-09-22 22:10:57 stephena Exp $ +// $Id: Settings.cxx,v 1.62 2005-10-02 19:10:39 stephena Exp $ //============================================================================ #include @@ -58,6 +58,7 @@ Settings::Settings(OSystem* osystem) set("keymap", ""); set("joymap", ""); set("paddle", "0"); + set("joymouse", "false"); set("showinfo", "false"); @@ -279,6 +280,7 @@ void Settings::usage() << endl #endif << " -paddle <0|1|2|3> Indicates which paddle the mouse should emulate\n" + << " -joymouse <1|0> Enable joystick emulates mouse in GUI\n" << " -showinfo <1|0> Shows some game info\n" #ifdef UNIX << " -accurate <1|0> Accurate game timing (uses more CPU)\n" diff --git a/stella/src/gui/GameInfoDialog.cxx b/stella/src/gui/GameInfoDialog.cxx index f9ff251f4..cd73286bc 100644 --- a/stella/src/gui/GameInfoDialog.cxx +++ b/stella/src/gui/GameInfoDialog.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: GameInfoDialog.cxx,v 1.16 2005-10-01 01:42:36 stephena Exp $ +// $Id: GameInfoDialog.cxx,v 1.17 2005-10-02 19:10:39 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -110,8 +110,8 @@ GameInfoDialog::GameInfoDialog( new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, "Type:", kTextAlignLeft); myType = new PopUpWidget(myTab, xpos+lwidth, ypos, - font.getStringWidth("Auto-detect") + 15, lineHeight, - "", 0, 0); + font.getStringWidth("CV (Commavid extra ram)") + 15, + lineHeight, "", 0, 0); for(i = 0; i < 21; ++i) myType->appendEntry(ourCartridgeList[i].name, i+1); wid.push_back(myType); @@ -508,24 +508,24 @@ const PropType GameInfoDialog::ourControllerList[5] = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const PropType GameInfoDialog::ourCartridgeList[21] = { { "Auto-detect", "AUTO-DETECT" }, - { "Cart2K", "2K" }, - { "Cart3E", "3E" }, - { "Cart3F", "3F" }, - { "Cart4K", "4K" }, - { "CartAR", "AR" }, - { "CartCV", "CV" }, - { "CartDPC", "DPC" }, - { "CartE0", "E0" }, - { "CartE7", "E7" }, - { "CartF4", "F4" }, - { "CartF4SC", "F4SC" }, - { "CartF6", "F6" }, - { "CartF6SC", "F6SC" }, - { "CartF8", "F8" }, - { "CartF8SC", "F8SC" }, - { "CartFASC", "FASC" }, - { "CartFE", "FE" }, - { "CartMB", "MB" }, - { "CartMC", "MC" }, - { "CartUA", "UA" } + { "2K (2K Atari)", "2K" }, + { "3E (32K Tigervision)", "3E" }, + { "3F (512K Tigervision)", "3F" }, + { "4K (4K Atari)", "4K" }, + { "AR (Supercharger)", "AR" }, + { "CV (Commavid extra ram)", "CV" }, + { "DPC (Pitfall II)", "DPC" }, + { "E0 (8K Parker Bros)", "E0" }, + { "E7 (16K M-network)", "E7" }, + { "F4 (32K Atari)", "F4" }, + { "F4SC (32K Atari + ram)", "F4SC" }, + { "F6 (16K Atari)", "F6" }, + { "F6SC (16K Atari + ram)", "F6SC" }, + { "F8 (8K Atari)", "F8" }, + { "F8SC (8K Atari + ram)", "F8SC" }, + { "FASC (CBS RAM Plus)", "FASC" }, + { "FE (8K Decathlon)", "FE" }, + { "MB (Dynacom Megaboy)", "MB" }, + { "MC (C. Wilkson Megacart)", "MC" }, + { "UA (8K UA Ltd.)", "UA" } };