mirror of https://github.com/stella-emu/stella.git
Added ability for cartridge frying to be remapped.
Fixed bug where Escape key (by default assigned to enter Launcher) couldn't be remapped to anything else. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@878 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
fb79186648
commit
2d2bd5f62d
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.cxx,v 1.112 2005-11-13 03:55:24 stephena Exp $
|
// $Id: EventHandler.cxx,v 1.113 2005-11-13 16:17:10 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -1147,7 +1147,7 @@ bool EventHandler::eventStateChange(Event::Type type)
|
||||||
void EventHandler::setActionMappings()
|
void EventHandler::setActionMappings()
|
||||||
{
|
{
|
||||||
// Fill the ActionList with the current key and joystick mappings
|
// Fill the ActionList with the current key and joystick mappings
|
||||||
for(Int32 i = 0; i < 62; ++i)
|
for(Int32 i = 0; i < kActionListSize; ++i)
|
||||||
{
|
{
|
||||||
uInt32 j;
|
uInt32 j;
|
||||||
|
|
||||||
|
@ -1257,7 +1257,7 @@ void EventHandler::setJoymap()
|
||||||
void EventHandler::addKeyMapping(Event::Type event, uInt16 key)
|
void EventHandler::addKeyMapping(Event::Type event, uInt16 key)
|
||||||
{
|
{
|
||||||
// These keys cannot be remapped.
|
// These keys cannot be remapped.
|
||||||
if(key == SDLK_TAB || key == SDLK_ESCAPE)
|
if(key == SDLK_TAB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myKeyTable[key] = event;
|
myKeyTable[key] = event;
|
||||||
|
@ -1282,7 +1282,7 @@ void EventHandler::eraseMapping(Event::Type event)
|
||||||
|
|
||||||
// Erase the KeyEvent arrays
|
// Erase the KeyEvent arrays
|
||||||
for(i = 0; i < SDLK_LAST; ++i)
|
for(i = 0; i < SDLK_LAST; ++i)
|
||||||
if(myKeyTable[i] == event && i != SDLK_TAB && i != SDLK_ESCAPE)
|
if(myKeyTable[i] == event && i != SDLK_TAB)
|
||||||
myKeyTable[i] = Event::NoType;
|
myKeyTable[i] = Event::NoType;
|
||||||
saveKeyMapping();
|
saveKeyMapping();
|
||||||
|
|
||||||
|
@ -1375,11 +1375,11 @@ void EventHandler::setDefaultKeymap()
|
||||||
myKeyTable[ SDLK_F11 ] = Event::LoadState;
|
myKeyTable[ SDLK_F11 ] = Event::LoadState;
|
||||||
myKeyTable[ SDLK_F12 ] = Event::TakeSnapshot;
|
myKeyTable[ SDLK_F12 ] = Event::TakeSnapshot;
|
||||||
myKeyTable[ SDLK_PAUSE ] = Event::Pause;
|
myKeyTable[ SDLK_PAUSE ] = Event::Pause;
|
||||||
|
myKeyTable[ SDLK_BACKSPACE ] = Event::Fry;
|
||||||
myKeyTable[ SDLK_TAB ] = Event::MenuMode;
|
myKeyTable[ SDLK_TAB ] = Event::MenuMode;
|
||||||
myKeyTable[ SDLK_BACKSLASH ] = Event::CmdMenuMode;
|
myKeyTable[ SDLK_BACKSLASH ] = Event::CmdMenuMode;
|
||||||
myKeyTable[ SDLK_BACKQUOTE ] = Event::DebuggerMode;
|
myKeyTable[ SDLK_BACKQUOTE ] = Event::DebuggerMode;
|
||||||
myKeyTable[ SDLK_ESCAPE ] = Event::LauncherMode;
|
myKeyTable[ SDLK_ESCAPE ] = Event::LauncherMode;
|
||||||
myKeyTable[ SDLK_BACKSPACE ] = Event::Fry;
|
|
||||||
|
|
||||||
saveKeyMapping();
|
saveKeyMapping();
|
||||||
}
|
}
|
||||||
|
@ -1983,7 +1983,7 @@ void EventHandler::setSDLMappings()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// FIXME - this must be handled better in the future ///
|
// FIXME - this must be handled better in the future ///
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
ActionList EventHandler::ourActionList[62] = {
|
ActionList EventHandler::ourActionList[kActionListSize] = {
|
||||||
{ Event::ConsoleSelect, "Select", "" },
|
{ Event::ConsoleSelect, "Select", "" },
|
||||||
{ Event::ConsoleReset, "Reset", "" },
|
{ Event::ConsoleReset, "Reset", "" },
|
||||||
{ Event::ConsoleColor, "Color TV", "" },
|
{ Event::ConsoleColor, "Color TV", "" },
|
||||||
|
@ -1997,6 +1997,7 @@ ActionList EventHandler::ourActionList[62] = {
|
||||||
{ Event::LoadState, "Load State", "" },
|
{ Event::LoadState, "Load State", "" },
|
||||||
{ Event::TakeSnapshot, "Snapshot", "" },
|
{ Event::TakeSnapshot, "Snapshot", "" },
|
||||||
{ Event::Pause, "Pause", "" },
|
{ Event::Pause, "Pause", "" },
|
||||||
|
{ Event::Fry, "Fry cartridge", "" },
|
||||||
{ Event::MenuMode, "Toggle options menu mode", "" },
|
{ Event::MenuMode, "Toggle options menu mode", "" },
|
||||||
{ Event::CmdMenuMode, "Toggle command menu mode", "" },
|
{ Event::CmdMenuMode, "Toggle command menu mode", "" },
|
||||||
{ Event::DebuggerMode, "Toggle debugger mode", "" },
|
{ Event::DebuggerMode, "Toggle debugger mode", "" },
|
||||||
|
@ -2056,7 +2057,7 @@ ActionList EventHandler::ourActionList[62] = {
|
||||||
{ Event::KeyboardOnePound, "P2 GamePad #", "" }
|
{ Event::KeyboardOnePound, "P2 GamePad #", "" }
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
ActionList EventHandler::ourActionList[62];
|
ActionList EventHandler::ourActionList[kActionListSize];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.hxx,v 1.55 2005-11-12 22:04:57 stephena Exp $
|
// $Id: EventHandler.hxx,v 1.56 2005-11-13 16:17:10 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef EVENTHANDLER_HXX
|
#ifndef EVENTHANDLER_HXX
|
||||||
|
@ -46,6 +46,10 @@ struct ActionList {
|
||||||
string key;
|
string key;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kActionListSize = 63
|
||||||
|
};
|
||||||
|
|
||||||
// Joystick related items
|
// Joystick related items
|
||||||
enum {
|
enum {
|
||||||
kNumJoysticks = 8,
|
kNumJoysticks = 8,
|
||||||
|
@ -83,7 +87,7 @@ struct Joystick_Map {
|
||||||
mapping can take place.
|
mapping can take place.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: EventHandler.hxx,v 1.55 2005-11-12 22:04:57 stephena Exp $
|
@version $Id: EventHandler.hxx,v 1.56 2005-11-13 16:17:10 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class EventHandler
|
class EventHandler
|
||||||
{
|
{
|
||||||
|
@ -240,7 +244,7 @@ class EventHandler
|
||||||
void saveProperties();
|
void saveProperties();
|
||||||
|
|
||||||
// Holds static strings for the remap menu
|
// Holds static strings for the remap menu
|
||||||
static ActionList ourActionList[62];
|
static ActionList ourActionList[kActionListSize];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send an event directly to the event handler.
|
Send an event directly to the event handler.
|
||||||
|
@ -251,7 +255,7 @@ class EventHandler
|
||||||
*/
|
*/
|
||||||
void handleEvent(Event::Type type, Int32 value);
|
void handleEvent(Event::Type type, Int32 value);
|
||||||
|
|
||||||
bool frying() { return myFryingFlag; }
|
inline bool frying() { return myFryingFlag; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventMappingDialog.cxx,v 1.19 2005-08-22 18:17:10 stephena Exp $
|
// $Id: EventMappingDialog.cxx,v 1.20 2005-11-13 16:17:10 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -74,7 +74,7 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
|
||||||
// Get actions names
|
// Get actions names
|
||||||
StringList l;
|
StringList l;
|
||||||
|
|
||||||
for(int i = 0; i < 61; ++i)
|
for(int i = 0; i < kActionListSize; ++i)
|
||||||
l.push_back(EventHandler::ourActionList[i].action);
|
l.push_back(EventHandler::ourActionList[i].action);
|
||||||
|
|
||||||
myActionsList->setList(l);
|
myActionsList->setList(l);
|
||||||
|
|
Loading…
Reference in New Issue