Finally, we have CVS access back!!

Finalized remapping of GUI/menu events, and added an interface to change
these mappings from 'Input Settings'.

Fixed bug with taking snapshots having a previously overlaid message
being part of the image.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1102 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-05-15 12:24:09 +00:00
parent ebf39cb52d
commit 893716abcd
8 changed files with 477 additions and 352 deletions

View File

@ -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: Event.hxx,v 1.20 2006-05-04 17:45:24 stephena Exp $ // $Id: Event.hxx,v 1.21 2006-05-15 12:24:09 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENT_HXX #ifndef EVENT_HXX
@ -26,7 +26,7 @@ class EventStreamer;
/** /**
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: Event.hxx,v 1.20 2006-05-04 17:45:24 stephena Exp $ @version $Id: Event.hxx,v 1.21 2006-05-15 12:24:09 stephena Exp $
*/ */
class Event class Event
{ {
@ -81,7 +81,7 @@ class Event
VolumeDecrease, VolumeIncrease, VolumeDecrease, VolumeIncrease,
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown, UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UIPrevDir, UINavNext, UINavPrev, UITabNext, UITabPrev, UISelect, UISelect, UIPrevDir, UINavPrev, UINavNext, UITabPrev, UITabNext,
LastType LastType
}; };

File diff suppressed because it is too large Load Diff

View File

@ -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.87 2006-05-05 18:00:51 stephena Exp $ // $Id: EventHandler.hxx,v 1.88 2006-05-15 12:24:09 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -61,12 +61,14 @@ struct ActionList {
}; };
enum { enum {
kActionListSize = 81 kEmulActionListSize = 81,
kMenuActionListSize = 14
}; };
enum EventMode { enum EventMode {
kEmulationMode, kEmulationMode = 0, // make sure these are set correctly,
kMenuMode kMenuMode = 1, // since they'll be used as array indices
kNumModes = 2
}; };
// Joystick related items // Joystick related items
@ -112,12 +114,10 @@ struct JoyMouse {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.87 2006-05-05 18:00:51 stephena Exp $ @version $Id: EventHandler.hxx,v 1.88 2006-05-15 12:24:09 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
friend class EventMappingWidget;
public: public:
/** /**
Create a new event handler object Create a new event handler object
@ -166,30 +166,36 @@ class EventHandler
Set the default action for a joystick button to the given event Set the default action for a joystick button to the given event
@param event The event we are assigning @param event The event we are assigning
@param mode The mode where this event is active
@param stick The joystick number @param stick The joystick number
@param button The joystick button @param button The joystick button
*/ */
void setDefaultJoyMapping(Event::Type event, int stick, int button); void setDefaultJoyMapping(Event::Type event, EventMode mode,
int stick, int button);
/** /**
Set the default for a joystick axis to the given event Set the default for a joystick axis to the given event
@param event The event we are assigning @param event The event we are assigning
@param mode The mode where this event is active
@param stick The joystick number @param stick The joystick number
@param axis The joystick axis @param axis The joystick axis
@param value The value on the given axis @param value The value on the given axis
*/ */
void setDefaultJoyAxisMapping(Event::Type event, int stick, int axis, int value); void setDefaultJoyAxisMapping(Event::Type event, EventMode mode,
int stick, int axis, int value);
/** /**
Set the default for a joystick hat to the given event Set the default for a joystick hat to the given event
@param event The event we are assigning @param event The event we are assigning
@param mode The mode where this event is active
@param stick The joystick number @param stick The joystick number
@param axis The joystick axis @param axis The joystick axis
@param value The value on the given axis @param value The value on the given axis
*/ */
void setDefaultJoyHatMapping(Event::Type event, int stick, int hat, int value); void setDefaultJoyHatMapping(Event::Type event, EventMode mode,
int stick, int hat, int value);
/** /**
Returns the current state of the EventHandler Returns the current state of the EventHandler
@ -333,67 +339,83 @@ class EventHandler
inline SDL_Joystick* getJoystick(int i) { return ourJoysticks[i].stick; } inline SDL_Joystick* getJoystick(int i) { return ourJoysticks[i].stick; }
StringList getEmulationActions(); StringList getActionList(EventMode mode);
StringList getMenuActions();
Event::Type eventForKey(int key, EventMode mode); inline Event::Type eventForKey(int key, EventMode mode)
Event::Type eventForJoyButton(int stick, int button, EventMode mode); { return myKeyTable[key][mode]; }
Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode); inline Event::Type eventForJoyButton(int stick, int button, EventMode mode)
Event::Type eventForJoyHat(int stick, int hat, int value, EventMode mode); { return myJoyTable[stick][button][mode]; }
inline Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode)
{ return myJoyAxisTable[stick][axis][(value > 0)][mode]; }
inline Event::Type eventForJoyHat(int stick, int hat, int value, EventMode mode)
{ return myJoyHatTable[stick][hat][value][mode]; }
Event::Type eventAtIndex(int idx, EventMode mode);
string actionAtIndex(int idx, EventMode mode);
string keyAtIndex(int idx, EventMode mode);
private:
/** /**
Bind a key to an event/action and regenerate the mapping array(s) Bind a key to an event/action and regenerate the mapping array(s)
@param event The event we are remapping @param event The event we are remapping
@param mode The mode where this event is active
@param key The key to bind to this event @param key The key to bind to this event
*/ */
bool addKeyMapping(Event::Type event, int key); bool addKeyMapping(Event::Type event, EventMode mode, int key);
/** /**
Bind a joystick button to an event/action and regenerate the Bind a joystick button to an event/action and regenerate the
mapping array(s) mapping array(s)
@param event The event we are remapping @param event The event we are remapping
@param mode The mode where this event is active
@param stick The joystick number @param stick The joystick number
@param button The joystick button @param button The joystick button
*/ */
bool addJoyMapping(Event::Type event, int stick, int button); bool addJoyMapping(Event::Type event, EventMode mode, int stick, int button);
/** /**
Bind a joystick axis direction to an event/action and regenerate Bind a joystick axis direction to an event/action and regenerate
the mapping array(s) the mapping array(s)
@param event The event we are remapping @param event The event we are remapping
@param mode The mode where this event is active
@param stick The joystick number @param stick The joystick number
@param axis The joystick axis @param axis The joystick axis
@param value The value on the given axis @param value The value on the given axis
*/ */
bool addJoyAxisMapping(Event::Type event, int stick, int axis, int value); bool addJoyAxisMapping(Event::Type event, EventMode mode,
int stick, int axis, int value);
/** /**
Bind a joystick hat direction to an event/action and regenerate Bind a joystick hat direction to an event/action and regenerate
the mapping array(s) the mapping array(s)
@param event The event we are remapping @param event The event we are remapping
@param mode The mode where this event is active
@param stick The joystick number @param stick The joystick number
@param axis The joystick hat @param axis The joystick hat
@param value The value on the given hat @param value The value on the given hat
*/ */
bool addJoyHatMapping(Event::Type event, int stick, int hat, int value); bool addJoyHatMapping(Event::Type event, EventMode mode,
int stick, int hat, int value);
/** /**
Erase the specified mapping Erase the specified mapping
@event The event for which we erase all mappings @event The event for which we erase all mappings
@param mode The mode where this event is active
*/ */
void eraseMapping(Event::Type event); void eraseMapping(Event::Type event, EventMode mode);
/** /**
Resets the event mappings to default values Resets the event mappings to default values
*/
void setDefaultMapping();
@param mode The mode for which the defaults are set
*/
void setDefaultMapping(EventMode mode);
private:
/** /**
Send a mouse motion event to the handler. Send a mouse motion event to the handler.
@ -446,16 +468,16 @@ class EventHandler
/** /**
The following methods take care of assigning action mappings. The following methods take care of assigning action mappings.
*/ */
void setActionMappings(); void setActionMappings(EventMode mode);
void setSDLMappings(); void setSDLMappings();
void setKeymap(); void setKeymap();
void setJoymap(); void setJoymap();
void setJoyAxisMap(); void setJoyAxisMap();
void setJoyHatMap(); void setJoyHatMap();
void setDefaultKeymap(); void setDefaultKeymap(EventMode mode);
void setDefaultJoymap(); void setDefaultJoymap(EventMode mode);
void setDefaultJoyAxisMap(); void setDefaultJoyAxisMap(EventMode mode);
void setDefaultJoyHatMap(); void setDefaultJoyHatMap(EventMode mode);
void saveKeyMapping(); void saveKeyMapping();
void saveJoyMapping(); void saveJoyMapping();
void saveJoyAxisMapping(); void saveJoyAxisMapping();
@ -510,16 +532,16 @@ class EventHandler
DialogContainer* myOverlay; DialogContainer* myOverlay;
// Array of key events, indexed by SDLKey // Array of key events, indexed by SDLKey
Event::Type myKeyTable[SDLK_LAST]; Event::Type myKeyTable[SDLK_LAST][kNumModes];
// Array of joystick button events // Array of joystick button events
Event::Type myJoyTable[kNumJoysticks][kNumJoyButtons]; Event::Type myJoyTable[kNumJoysticks][kNumJoyButtons][kNumModes];
// Array of joystick axis events // Array of joystick axis events
Event::Type myJoyAxisTable[kNumJoysticks][kNumJoyAxis][2]; Event::Type myJoyAxisTable[kNumJoysticks][kNumJoyAxis][2][kNumModes];
// Array of joystick hat events (we don't record diagonals) // Array of joystick hat events (we don't record diagonals)
Event::Type myJoyHatTable[kNumJoysticks][kNumJoyHats][4]; Event::Type myJoyHatTable[kNumJoysticks][kNumJoyHats][4][kNumModes];
// Array of messages for each Event // Array of messages for each Event
string ourMessageTable[Event::LastType]; string ourMessageTable[Event::LastType];
@ -566,8 +588,9 @@ class EventHandler
// Type of device on each controller port (based on ROM properties) // Type of device on each controller port (based on ROM properties)
Controller::Type myController[2]; Controller::Type myController[2];
// Holds static strings for the remap menu // Holds static strings for the remap menu (emulation and menu events)
static ActionList ourActionList[kActionListSize]; static ActionList ourEmulActionList[kEmulActionListSize];
static ActionList ourMenuActionList[kMenuActionListSize];
// Lookup table for paddle resistance events // Lookup table for paddle resistance events
static const Event::Type Paddle_Resistance[4]; static const Event::Type Paddle_Resistance[4];

View File

@ -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: FrameBuffer.cxx,v 1.86 2006-05-04 17:45:24 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.87 2006-05-15 12:24:09 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -331,6 +331,13 @@ void FrameBuffer::pause(bool status)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refresh()
{
theRedrawTIAIndicator = true;
myMessage.counter = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setPalette(const uInt32* palette) void FrameBuffer::setPalette(const uInt32* palette)
{ {

View File

@ -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: FrameBuffer.hxx,v 1.69 2006-03-25 00:34:17 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.70 2006-05-15 12:24:09 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -82,7 +82,7 @@ enum {
All GUI elements (ala ScummVM) are drawn here as well. All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.69 2006-03-25 00:34:17 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.70 2006-05-15 12:24:09 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -172,7 +172,7 @@ class FrameBuffer
Indicates that the TIA area is dirty, and certain areas need Indicates that the TIA area is dirty, and certain areas need
to be redrawn. to be redrawn.
*/ */
void refresh() { theRedrawTIAIndicator = true; } void refresh();
/** /**
Toggles between fullscreen and window mode. Toggles between fullscreen and window mode.

View File

@ -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: OSystem.cxx,v 1.68 2006-03-27 12:52:19 stephena Exp $ // $Id: OSystem.cxx,v 1.69 2006-05-15 12:24:09 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -453,36 +453,42 @@ bool OSystem::openROM(const string& rom, string& md5, uInt8** image, int* size)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setDefaultJoymap() void OSystem::setDefaultJoymap()
{ {
// Left joystick (assume joystick zero, button zero) EventMode mode;
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroFire, 0, 0);
mode = kEmulationMode; // Default emulation events
// Left joystick (assume joystick zero, button zero)
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroFire, mode, 0, 0);
// Right joystick (assume joystick one, button zero) // Right joystick (assume joystick one, button zero)
myEventHandler->setDefaultJoyMapping(Event::JoystickOneFire, 1, 0); myEventHandler->setDefaultJoyMapping(Event::JoystickOneFire, mode, 1, 0);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setDefaultJoyAxisMap() void OSystem::setDefaultJoyAxisMap()
{ {
EventMode mode;
mode = kEmulationMode; // Default emulation events
// Left joystick left/right directions (assume joystick zero) // Left joystick left/right directions (assume joystick zero)
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroLeft, 0, 0, 0); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroLeft, mode, 0, 0, 0);
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroRight, 0, 0, 1); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroRight, mode, 0, 0, 1);
// Left joystick up/down directions (assume joystick zero) // Left joystick up/down directions (assume joystick zero)
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroUp, 0, 1, 0); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroUp, mode, 0, 1, 0);
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroDown, 0, 1, 1); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickZeroDown, mode, 0, 1, 1);
// Right joystick left/right directions (assume joystick one) // Right joystick left/right directions (assume joystick one)
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneLeft, 1, 0, 0); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneLeft, mode, 1, 0, 0);
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneRight, 1, 0, 1); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneRight, mode, 1, 0, 1);
// Right joystick left/right directions (assume joystick one) // Right joystick left/right directions (assume joystick one)
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneUp, 1, 1, 0); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneUp, mode, 1, 1, 0);
myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneDown, 1, 1, 1); myEventHandler->setDefaultJoyAxisMapping(Event::JoystickOneDown, mode, 1, 1, 1);
mode = kMenuMode; // Default menu/UI events
// FIXME - add UI events
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setDefaultJoyHatMap() void OSystem::setDefaultJoyHatMap()
{ {
// FIXME - add emul and UI events
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: EventMappingWidget.cxx,v 1.16 2006-05-05 18:00:51 stephena Exp $ // $Id: EventMappingWidget.cxx,v 1.17 2006-05-15 12:24:09 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
@ -42,7 +42,6 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
myRemapStatus(false), myRemapStatus(false),
myFirstTime(true) myFirstTime(true)
{ {
// FIXME
const int fontHeight = font.getFontHeight(), const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int xpos = 5, ypos = 5; int xpos = 5, ypos = 5;
@ -93,7 +92,6 @@ EventMappingWidget::~EventMappingWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventMappingWidget::loadConfig() void EventMappingWidget::loadConfig()
{ {
cerr << "EventMappingWidget::loadConfig() for " << myEventMode << endl;
if(myFirstTime) if(myFirstTime)
{ {
myActionsList->setSelected(0); myActionsList->setSelected(0);
@ -129,7 +127,7 @@ void EventMappingWidget::startRemapping()
// And show a message indicating which key is being remapped // And show a message indicating which key is being remapped
ostringstream buf; ostringstream buf;
buf << "Select action for '" buf << "Select action for '"
<< EventHandler::ourActionList[ myActionSelected ].action << instance()->eventHandler().actionAtIndex(myActionSelected, myEventMode)
<< "' event"; << "' event";
myKeyMapping->setColor(kTextColorEm); myKeyMapping->setColor(kTextColorEm);
myKeyMapping->setLabel(buf.str()); myKeyMapping->setLabel(buf.str());
@ -145,8 +143,9 @@ void EventMappingWidget::eraseRemapping()
if(myActionSelected < 0) if(myActionSelected < 0)
return; return;
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event; Event::Type event =
instance()->eventHandler().eraseMapping(event); instance()->eventHandler().eventAtIndex(myActionSelected, myEventMode);
instance()->eventHandler().eraseMapping(event, myEventMode);
drawKeyMapping(); drawKeyMapping();
} }
@ -182,7 +181,8 @@ void EventMappingWidget::drawKeyMapping()
if(myActionSelected >= 0) if(myActionSelected >= 0)
{ {
ostringstream buf; ostringstream buf;
buf << "Action: " << EventHandler::ourActionList[ myActionSelected ].key; buf << "Action: "
<< instance()->eventHandler().keyAtIndex(myActionSelected, myEventMode);
myKeyMapping->setColor(kTextColor); myKeyMapping->setColor(kTextColor);
myKeyMapping->setLabel(buf.str()); myKeyMapping->setLabel(buf.str());
} }
@ -194,8 +194,9 @@ bool EventMappingWidget::handleKeyDown(int ascii, int keycode, int modifiers)
// Remap keys in remap mode // Remap keys in remap mode
if(myRemapStatus && myActionSelected >= 0) if(myRemapStatus && myActionSelected >= 0)
{ {
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event; Event::Type event =
if(instance()->eventHandler().addKeyMapping(event, keycode)) instance()->eventHandler().eventAtIndex(myActionSelected, myEventMode);
if(instance()->eventHandler().addKeyMapping(event, myEventMode, keycode))
stopRemapping(); stopRemapping();
} }
return true; return true;
@ -207,8 +208,9 @@ void EventMappingWidget::handleJoyDown(int stick, int button)
// Remap joystick buttons in remap mode // Remap joystick buttons in remap mode
if(myRemapStatus && myActionSelected >= 0) if(myRemapStatus && myActionSelected >= 0)
{ {
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event; Event::Type event =
if(instance()->eventHandler().addJoyMapping(event, stick, button)) instance()->eventHandler().eventAtIndex(myActionSelected, myEventMode);
if(instance()->eventHandler().addJoyMapping(event, myEventMode, stick, button))
stopRemapping(); stopRemapping();
} }
} }
@ -219,8 +221,10 @@ void EventMappingWidget::handleJoyAxis(int stick, int axis, int value)
// Remap joystick axes in remap mode // Remap joystick axes in remap mode
if(myRemapStatus && myActionSelected >= 0) if(myRemapStatus && myActionSelected >= 0)
{ {
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event; Event::Type event =
if(instance()->eventHandler().addJoyAxisMapping(event, stick, axis, value)) instance()->eventHandler().eventAtIndex(myActionSelected, myEventMode);
if(instance()->eventHandler().addJoyAxisMapping(event, myEventMode,
stick, axis, value))
stopRemapping(); stopRemapping();
} }
} }
@ -233,8 +237,10 @@ bool EventMappingWidget::handleJoyHat(int stick, int hat, int value)
// Remap joystick hats in remap mode // Remap joystick hats in remap mode
if(myRemapStatus && myActionSelected >= 0) if(myRemapStatus && myActionSelected >= 0)
{ {
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event; Event::Type event =
if(instance()->eventHandler().addJoyHatMapping(event, stick, hat, value)) instance()->eventHandler().eventAtIndex(myActionSelected, myEventMode);
if(instance()->eventHandler().addJoyHatMapping(event, myEventMode,
stick, hat, value))
{ {
stopRemapping(); stopRemapping();
result = true; result = true;
@ -284,7 +290,7 @@ void EventMappingWidget::handleCommand(CommandSender* sender, int cmd,
break; break;
case kDefaultsCmd: case kDefaultsCmd:
instance()->eventHandler().setDefaultMapping(); instance()->eventHandler().setDefaultMapping(myEventMode);
drawKeyMapping(); drawKeyMapping();
break; break;
} }

View File

@ -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: InputDialog.cxx,v 1.15 2006-05-05 18:00:51 stephena Exp $ // $Id: InputDialog.cxx,v 1.16 2006-05-15 12:24:09 stephena Exp $
//============================================================================ //============================================================================
// FIXME - this whole dialog should be a dialog of buttons instead of // FIXME - this whole dialog should be a dialog of buttons instead of
@ -54,7 +54,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
// 1) Event mapper for emulation actions // 1) Event mapper for emulation actions
tabID = myTab->addTab("Emul. Events"); tabID = myTab->addTab("Emul. Events");
const StringList& eactions = instance()->eventHandler().getEmulationActions(); const StringList& eactions = instance()->eventHandler().getActionList(kEmulationMode);
myEmulEventMapper = new EventMappingWidget(myTab, font, 2, 2, myEmulEventMapper = new EventMappingWidget(myTab, font, 2, 2,
myTab->getWidth(), myTab->getWidth(),
myTab->getHeight() - ypos, myTab->getHeight() - ypos,
@ -64,7 +64,7 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
// 2) Event mapper for menu actions // 2) Event mapper for menu actions
tabID = myTab->addTab("Menu Events"); tabID = myTab->addTab("Menu Events");
const StringList& mactions = instance()->eventHandler().getMenuActions(); const StringList& mactions = instance()->eventHandler().getActionList(kMenuMode);
myMenuEventMapper = new EventMappingWidget(myTab, font, 2, 2, myMenuEventMapper = new EventMappingWidget(myTab, font, 2, 2,
myTab->getWidth(), myTab->getWidth(),
myTab->getHeight() - ypos, myTab->getHeight() - ypos,
@ -209,9 +209,6 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::loadConfig() void InputDialog::loadConfig()
{ {
myEmulEventMapper->loadConfig();
myMenuEventMapper->loadConfig();
// Left & right ports // Left & right ports
const string& sa1 = instance()->settings().getString("sa1"); const string& sa1 = instance()->settings().getString("sa1");
int lport = sa1 == "right" ? 2 : 1; int lport = sa1 == "right" ? 2 : 1;
@ -237,6 +234,8 @@ void InputDialog::loadConfig()
myPaddleLabel[2]->setLabel(instance()->settings().getString("p3speed")); myPaddleLabel[2]->setLabel(instance()->settings().getString("p3speed"));
myPaddleSpeed[3]->setValue(instance()->settings().getInt("p4speed")); myPaddleSpeed[3]->setValue(instance()->settings().getInt("p4speed"));
myPaddleLabel[3]->setLabel(instance()->settings().getString("p4speed")); myPaddleLabel[3]->setLabel(instance()->settings().getString("p4speed"));
myTab->loadConfig();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -