mirror of https://github.com/stella-emu/stella.git
Some infrastructure work for CompuMate handling. The CM handler now
disables normal keyboard input when in the debugger. This fixes issues where commands/shortcut keys typed in the debugger would be interpreted as actual CompuMate input. For now, in-debugger key processing is completely disabled in such a case. Eventually, we should probably add a virtual keyboard to the CM RIOT area, and have it send its data directly to the CM handler. Bumped version # slightly. I hope to get the next release ready to go in a few weeks. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2705 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
9a8dc860c0
commit
247d10fee9
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#define STELLA_VERSION "3.9_pre"
|
#define STELLA_VERSION "3.9_alpha1"
|
||||||
#define STELLA_BUILD atoi("$Rev$" + 6)
|
#define STELLA_BUILD atoi("$Rev$" + 6)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,8 +39,20 @@ CompuMate::CompuMate(CartridgeCM& cart, const Event& event,
|
||||||
myLeftController->myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
myLeftController->myAnalogPinValue[Controller::Five] = Controller::minimumResistance;
|
||||||
myRightController->myAnalogPinValue[Controller::Nine] = Controller::minimumResistance;
|
myRightController->myAnalogPinValue[Controller::Nine] = Controller::minimumResistance;
|
||||||
myRightController->myAnalogPinValue[Controller::Five] = Controller::maximumResistance;
|
myRightController->myAnalogPinValue[Controller::Five] = Controller::maximumResistance;
|
||||||
|
}
|
||||||
|
|
||||||
myKeyTable = event.getKeys();
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void CompuMate::enableKeyHandling(bool enable)
|
||||||
|
{
|
||||||
|
if(enable)
|
||||||
|
myKeyTable = myEvent.getKeys();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(uInt32 i = 0; i < KBDK_LAST; ++i)
|
||||||
|
myInternalKeyTable[i] = false;
|
||||||
|
|
||||||
|
myKeyTable = myInternalKeyTable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
This class acts as a 'parent' for cartridge and both the left and right
|
This class acts as a 'parent' for cartridge and both the left and right
|
||||||
CMControl's, taking care of their creation and communication between them.
|
CMControl's, taking care of their creation and communication between them.
|
||||||
|
It also allows to enable/disable the users actual keyboard when required.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@ -65,6 +66,22 @@ class CompuMate
|
||||||
Controller* leftController() { return myLeftController; }
|
Controller* leftController() { return myLeftController; }
|
||||||
Controller* rightController() { return myRightController; }
|
Controller* rightController() { return myRightController; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
In normal key-handling mode, the update handler receives key events
|
||||||
|
from the keyboard. This is meant to used during emulation.
|
||||||
|
|
||||||
|
Otherwise, the update handler ignores keys from the keyboard and uses
|
||||||
|
its own internal buffer, which essentially can only be set directly
|
||||||
|
within the class itself (by the debugger).
|
||||||
|
|
||||||
|
This is necessary since Stella is otherwise event-based, whereas
|
||||||
|
reading from the keyboard (in the current code) bypasses the event
|
||||||
|
system. This leads to issues where typing commands in the debugger
|
||||||
|
would then be processed by the update handler as if they were
|
||||||
|
entered on the CompuMate keyboard.
|
||||||
|
*/
|
||||||
|
void enableKeyHandling(bool enable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Called by the controller(s) when all pins have been written
|
Called by the controller(s) when all pins have been written
|
||||||
|
@ -126,6 +143,10 @@ class CompuMate
|
||||||
// The keyboard state array (tells us the current state of the keyboard)
|
// The keyboard state array (tells us the current state of the keyboard)
|
||||||
const bool* myKeyTable;
|
const bool* myKeyTable;
|
||||||
|
|
||||||
|
// Array of keyboard key states when in the debugger (the normal keyboard
|
||||||
|
// keys are ignored in such a case)
|
||||||
|
bool myInternalKeyTable[KBDK_LAST];
|
||||||
|
|
||||||
// System cycle at which the update() method is called
|
// System cycle at which the update() method is called
|
||||||
// Multiple calls at the same cycle should be ignored
|
// Multiple calls at the same cycle should be ignored
|
||||||
uInt32 myCycleAtLastUpdate;
|
uInt32 myCycleAtLastUpdate;
|
||||||
|
|
|
@ -924,6 +924,14 @@ void Console::addDebugger()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Console::stateChanged(EventHandler::State state)
|
||||||
|
{
|
||||||
|
// For now, only the CompuMate cares about state changes
|
||||||
|
if(myCMHandler)
|
||||||
|
myCMHandler->enableKeyHandling(state == EventHandler::S_EMULATE);
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 Console::ourNTSCPalette[256] = {
|
uInt32 Console::ourNTSCPalette[256] = {
|
||||||
0x000000, 0, 0x4a4a4a, 0, 0x6f6f6f, 0, 0x8e8e8e, 0,
|
0x000000, 0, 0x4a4a4a, 0, 0x6f6f6f, 0, 0x8e8e8e, 0,
|
||||||
|
|
|
@ -135,6 +135,14 @@ class Console : public Serializable
|
||||||
*/
|
*/
|
||||||
M6532& riot() const { return *myRiot; }
|
M6532& riot() const { return *myRiot; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the CompuMate handler used by the console
|
||||||
|
(only valid for CompuMate ROMs)
|
||||||
|
|
||||||
|
@return The CompuMate handler for this console (if it exists), otherwise 0
|
||||||
|
*/
|
||||||
|
CompuMate* compumate() const { return myCMHandler; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Saves the current state of this console class to the given Serializer.
|
Saves the current state of this console class to the given Serializer.
|
||||||
|
|
||||||
|
@ -175,6 +183,11 @@ class Console : public Serializable
|
||||||
*/
|
*/
|
||||||
void addDebugger();
|
void addDebugger();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Informs the Console of a change in EventHandler state.
|
||||||
|
*/
|
||||||
|
void stateChanged(EventHandler::State state);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Overloaded assignment operator
|
Overloaded assignment operator
|
||||||
|
|
|
@ -2157,6 +2157,10 @@ void EventHandler::setEventState(State state)
|
||||||
myOSystem->frameBuffer().stateChanged(myState);
|
myOSystem->frameBuffer().stateChanged(myState);
|
||||||
myOSystem->frameBuffer().setCursorState();
|
myOSystem->frameBuffer().setCursorState();
|
||||||
}
|
}
|
||||||
|
if(&myOSystem->console())
|
||||||
|
{
|
||||||
|
myOSystem->console().stateChanged(myState);
|
||||||
|
}
|
||||||
|
|
||||||
// Always clear any pending events when changing states
|
// Always clear any pending events when changing states
|
||||||
myEvent.clear();
|
myEvent.clear();
|
||||||
|
|
|
@ -896,16 +896,6 @@ void OSystem::setDefaultJoymap(Event::Type event, EventMode mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void OSystem::pollEvent()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void OSystem::stateChanged(EventHandler::State state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt64 OSystem::getTicks() const
|
uInt64 OSystem::getTicks() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -502,12 +502,12 @@ class OSystem
|
||||||
/**
|
/**
|
||||||
This method creates events from platform-specific hardware.
|
This method creates events from platform-specific hardware.
|
||||||
*/
|
*/
|
||||||
virtual void pollEvent();
|
virtual void pollEvent() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Informs the OSystem of a change in EventHandler state.
|
Informs the OSystem of a change in EventHandler state.
|
||||||
*/
|
*/
|
||||||
virtual void stateChanged(EventHandler::State state);
|
virtual void stateChanged(EventHandler::State state) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the default save and load paths for the snapshot directory.
|
Returns the default save and load paths for the snapshot directory.
|
||||||
|
|
Loading…
Reference in New Issue