Conditional compilation of some joystick stuff in EventHandler, for ports

where the extra code was causing a slowdown at startup.  Also removed
some dead JS code.

Disable phosphor effect by default for GP2X, since the FrameBuffer isn't
optimized enough yet to handle it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@981 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-01-25 01:42:47 +00:00
parent bb195d033f
commit c440951c4d
4 changed files with 33 additions and 65 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: Console.cxx,v 1.81 2006-01-11 14:13:19 stephena Exp $ // $Id: Console.cxx,v 1.82 2006-01-25 01:42:46 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -78,10 +78,8 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
// Search for the properties based on MD5 // Search for the properties based on MD5
myOSystem->propSet().getMD5(md5, myProperties); myOSystem->propSet().getMD5(md5, myProperties);
#ifdef DEVELOPER_SUPPORT
// A developer can override properties from the commandline // A developer can override properties from the commandline
setDeveloperProperties(); setDeveloperProperties();
#endif
// Make sure height is set properly for PAL ROM // Make sure height is set properly for PAL ROM
if(myProperties.get("Display.Format", true) == "PAL") if(myProperties.get("Display.Format", true) == "PAL")

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.cxx,v 1.148 2006-01-19 00:45:12 stephena Exp $ // $Id: EventHandler.cxx,v 1.149 2006-01-25 01:42:46 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -89,6 +89,7 @@ EventHandler::EventHandler(OSystem* osystem)
ourSDLMapping[i] = ""; ourSDLMapping[i] = "";
} }
#ifdef JOYSTICK_SUPPORT
// Erase the joystick button mapping array // Erase the joystick button mapping array
for(i = 0; i < kNumJoysticks; ++i) for(i = 0; i < kNumJoysticks; ++i)
for(j = 0; j < kNumJoyButtons; ++j) for(j = 0; j < kNumJoyButtons; ++j)
@ -104,6 +105,7 @@ EventHandler::EventHandler(OSystem* osystem)
for(j = 0; j < kNumJoyHats; ++j) for(j = 0; j < kNumJoyHats; ++j)
for(k = 0; k < 4; ++k) for(k = 0; k < 4; ++k)
myJoyHatTable[i][j][k] = Event::NoType; myJoyHatTable[i][j][k] = Event::NoType;
#endif
// Erase the Message array // Erase the Message array
for(i = 0; i < Event::LastType; ++i) for(i = 0; i < Event::LastType; ++i)
@ -915,6 +917,7 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, int state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::handleJoyEvent(int stick, int button, int state) void EventHandler::handleJoyEvent(int stick, int button, int state)
{ {
#ifdef JOYSTICK_SUPPORT
if(state && eventStateChange(myJoyTable[stick][button])) if(state && eventStateChange(myJoyTable[stick][button]))
return; return;
@ -923,11 +926,13 @@ void EventHandler::handleJoyEvent(int stick, int button, int state)
handleEvent(myJoyTable[stick][button], state); handleEvent(myJoyTable[stick][button], state);
else if(myOverlay != NULL) else if(myOverlay != NULL)
myOverlay->handleJoyEvent(stick, button, state); myOverlay->handleJoyEvent(stick, button, state);
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::handleJoyAxisEvent(int stick, int axis, int value) void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
{ {
#ifdef JOYSTICK_SUPPORT
// Every axis event has two associated values, negative and positive // Every axis event has two associated values, negative and positive
Event::Type eventAxisNeg = myJoyAxisTable[stick][axis][0]; Event::Type eventAxisNeg = myJoyAxisTable[stick][axis][0];
Event::Type eventAxisPos = myJoyAxisTable[stick][axis][1]; Event::Type eventAxisPos = myJoyAxisTable[stick][axis][1];
@ -964,61 +969,15 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
handleEvent(value < 0 ? eventAxisNeg : eventAxisPos, 1); handleEvent(value < 0 ? eventAxisNeg : eventAxisPos, 1);
break; break;
} }
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::handleJoyHatEvent(int stick, int hat, int value) void EventHandler::handleJoyHatEvent(int stick, int hat, int value)
{ {
#ifdef JOYSTICK_SUPPORT
if(myState == S_EMULATE) if(myState == S_EMULATE)
{ {
cerr << "stick = " << stick << ", hat = " << hat;
switch(value) {
case kJHatCentered: cerr << " centered\n"; break;
case kJHatUp: cerr << " up\n"; break;
case kJHatDown: cerr << " down\n"; break;
case kJHatLeft: cerr << " left\n"; break;
case kJHatRight: cerr << " right\n"; break;
}
// Treat hats as pairs of directions, similar to joystick axes
// Every hat pair has two associated values, negative and positive
// Analog events are stored in the negative portion
Event::Type eventHatAnalog;
switch(value)
{
case kJHatUp:
case kJHatDown:
eventHatAnalog = myJoyHatTable[stick][hat][0];
break;
case kJHatLeft:
case kJHatRight:
eventHatAnalog = myJoyHatTable[stick][hat][2];
break;
default:
eventHatAnalog = Event::NoType;
break;
}
// Check for analog events, which are handled differently
switch((int)eventHatAnalog)
{
case Event::PaddleZeroAnalog:
myEvent->set(Event::PaddleZeroResistance,
(int)(1000000.0 * (32767 - value) / 65534));
break;
case Event::PaddleOneAnalog:
myEvent->set(Event::PaddleOneResistance,
(int)(1000000.0 * (32767 - value) / 65534));
break;
case Event::PaddleTwoAnalog:
myEvent->set(Event::PaddleTwoResistance,
(int)(1000000.0 * (32767 - value) / 65534));
break;
case Event::PaddleThreeAnalog:
myEvent->set(Event::PaddleThreeResistance,
(int)(1000000.0 * (32767 - value) / 65534));
break;
default:
// Otherwise, we know the event is digital
if(value == kJHatCentered) if(value == kJHatCentered)
{ {
// Turn off all associated events, since we don't know exactly // Turn off all associated events, since we don't know exactly
@ -1029,12 +988,11 @@ case kJHatRight: cerr << " right\n"; break;
handleEvent(myJoyHatTable[stick][hat][3], 0); handleEvent(myJoyHatTable[stick][hat][3], 0);
} }
else else
handleEvent(myJoyHatTable[stick][hat][value] , 1); handleEvent(myJoyHatTable[stick][hat][value], 1);
break;
}
} }
else if(myOverlay != NULL) else if(myOverlay != NULL)
myOverlay->handleJoyHatEvent(stick, hat, value); myOverlay->handleJoyHatEvent(stick, hat, value);
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1344,6 +1302,7 @@ void EventHandler::setActionMappings()
key = key + ", " + ourSDLMapping[j]; key = key + ", " + ourSDLMapping[j];
} }
} }
#ifdef JOYSTICK_SUPPORT
// Joystick button mapping/labeling // Joystick button mapping/labeling
for(stick = 0; stick < kNumJoysticks; ++stick) for(stick = 0; stick < kNumJoysticks; ++stick)
{ {
@ -1415,6 +1374,7 @@ void EventHandler::setActionMappings()
} }
} }
} }
#endif
// There are some keys which are hardcoded. These should be represented too. // There are some keys which are hardcoded. These should be represented too.
string prepend = ""; string prepend = "";
@ -1455,6 +1415,7 @@ void EventHandler::setKeymap()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setJoymap() void EventHandler::setJoymap()
{ {
#ifdef JOYSTICK_SUPPORT
string list = myOSystem->settings().getString("joymap"); string list = myOSystem->settings().getString("joymap");
IntArray map; IntArray map;
@ -1468,11 +1429,13 @@ void EventHandler::setJoymap()
} }
else else
setDefaultJoymap(); setDefaultJoymap();
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setJoyAxisMap() void EventHandler::setJoyAxisMap()
{ {
#ifdef JOYSTICK_SUPPORT
string list = myOSystem->settings().getString("joyaxismap"); string list = myOSystem->settings().getString("joyaxismap");
IntArray map; IntArray map;
@ -1487,11 +1450,13 @@ void EventHandler::setJoyAxisMap()
} }
else else
setDefaultJoyAxisMap(); setDefaultJoyAxisMap();
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setJoyHatMap() void EventHandler::setJoyHatMap()
{ {
#ifdef JOYSTICK_SUPPORT
string list = myOSystem->settings().getString("joyhatmap"); string list = myOSystem->settings().getString("joyhatmap");
IntArray map; IntArray map;
@ -1506,6 +1471,7 @@ void EventHandler::setJoyHatMap()
} }
else else
setDefaultJoyHatMap(); setDefaultJoyHatMap();
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1632,6 +1598,7 @@ void EventHandler::eraseMapping(Event::Type event)
myKeyTable[i] = Event::NoType; myKeyTable[i] = Event::NoType;
saveKeyMapping(); saveKeyMapping();
#ifdef JOYSTICK_SUPPORT
// Erase the JoyEvent array // Erase the JoyEvent array
for(i = 0; i < kNumJoysticks; ++i) for(i = 0; i < kNumJoysticks; ++i)
for(j = 0; j < kNumJoyButtons; ++j) for(j = 0; j < kNumJoyButtons; ++j)
@ -1654,6 +1621,7 @@ void EventHandler::eraseMapping(Event::Type event)
if(myJoyHatTable[i][j][k] == event) if(myJoyHatTable[i][j][k] == event)
myJoyHatTable[i][j][k] = Event::NoType; myJoyHatTable[i][j][k] = Event::NoType;
saveJoyHatMapping(); saveJoyHatMapping();
#endif
setActionMappings(); setActionMappings();
} }

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: PropsSet.cxx,v 1.17 2006-01-11 01:17:11 stephena Exp $ // $Id: PropsSet.cxx,v 1.18 2006-01-25 01:42:47 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -209,6 +209,7 @@ bool PropertiesSet::merge(const Properties& properties, const string& filename)
const Properties& PropertiesSet::defaultProperties() const Properties& PropertiesSet::defaultProperties()
{ {
// Make sure the <key,value> pairs are in the default properties object // Make sure the <key,value> pairs are in the default properties object
ourDefaultProperties.set("Cartridge.Cheats", "");
ourDefaultProperties.set("Cartridge.Filename", ""); ourDefaultProperties.set("Cartridge.Filename", "");
ourDefaultProperties.set("Cartridge.MD5", ""); ourDefaultProperties.set("Cartridge.MD5", "");
ourDefaultProperties.set("Cartridge.Manufacturer", ""); ourDefaultProperties.set("Cartridge.Manufacturer", "");

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: SettingsGP2X.cxx,v 1.2 2006-01-08 13:55:03 stephena Exp $ // $Id: SettingsGP2X.cxx,v 1.3 2006-01-25 01:42:47 stephena Exp $
// Modified on 2006/01/04 by Alex Zaballa for use on GP2X // Modified on 2006/01/04 by Alex Zaballa for use on GP2X
//============================================================================ //============================================================================
@ -36,6 +36,7 @@ SettingsGP2X::SettingsGP2X(OSystem* osystem)
set("tiafreq", "22050"); set("tiafreq", "22050");
set("clipvol", "false"); set("clipvol", "false");
set("joymouse", "true"); set("joymouse", "true");
set("pp", "no"); // always disable phosphor until we get a faster framebuffer
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -