Added GP2X port, thanks to Alex Zaballa. This is the first commit,

so I may have broken something.

Improved 'joystick is mouse' code in the GUI.  Also account for devices
where the D-pad sends button events instead of the normal axis events.

Treat joystick events as other types of controllers based on the
virtual port entry in stella.pro.  This means that mappings for a
joystick will emulate other devices when necessary, and should
help on 'small' devices with few inputs.

Added 'sp' developer commandline argument, which sets the
"Console.SwapPorts" property and swaps the arrangement of the
virtual ports.  Useful for games like "Raiders of the Lost Ark",
where the joysticks are normally swapped.  Updated stella.pro
for Raiders to use this property.

Moved ugly #ifdef code for screen dimensions out of FrameBuffer and
directly into the respective OSystemXXX classes.

Added 'freq', 'tiafreq' and 'clipvol' commandline arguments, which
affect the sound subsystem.  Note that none of these add new
functionality; they merely expose what were previously constants
in the code:
 - freq: sets sound sample output frequency
 - tiafreq: sets sound sample generation frequency
 - clipvol: clips volume to eliminate huge cracks when pausing sound


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@940 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-01-08 02:28:04 +00:00
parent d3fdd90347
commit 07f320e1f1
39 changed files with 1104 additions and 232 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: Makefile,v 1.14 2005-12-17 01:26:58 stephena Exp $ ## $Id: Makefile,v 1.15 2006-01-08 02:28:01 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
@ -231,5 +231,8 @@ psp-layout:
cp -v src/psp/data/stellarc.psp $(PSP-MOUNTPOINT)/stella/stellarc cp -v src/psp/data/stellarc.psp $(PSP-MOUNTPOINT)/stella/stellarc
umount $(PSP-MOUNTPOINT) umount $(PSP-MOUNTPOINT)
# GP2X exec needs strip
gp2x-strip: $(EXECUTABLE)
$(GP2X-STRIP) stella.gpe
.PHONY: deb bundle test win32dist install uninstall .PHONY: deb bundle test win32dist install uninstall

39
stella/configure vendored
View File

@ -384,6 +384,11 @@ psp)
_sdlpath=$(psp-config --pspdev-path)/psp/bin:$_sdlpath _sdlpath=$(psp-config --pspdev-path)/psp/bin:$_sdlpath
PATH=$(psp-config --pspdev-path)/psp/bin:$(psp-config --pspdev-path)/bin:$PATH PATH=$(psp-config --pspdev-path)/psp/bin:$(psp-config --pspdev-path)/bin:$PATH
;; ;;
gp2x)
_host_os=gp2x
_host_cpu=arm
_png=yes
;;
*) *)
guessed_host=`$_srcdir/config.guess` guessed_host=`$_srcdir/config.guess`
_host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` _host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@ -405,6 +410,9 @@ arm-riscos-aof)
psp) psp)
EXEEXT=".elf" EXEEXT=".elf"
;; ;;
gp2x)
EXEEXT=".gpe"
;;
*) *)
EXEEXT="" EXEEXT=""
;; ;;
@ -438,6 +446,10 @@ if [ "$_host" = "psp" ] ; then
compilers="$CXX psp-g++ psp-c++" compilers="$CXX psp-g++ psp-c++"
CXX="psp-c++" CXX="psp-c++"
fi fi
if [ "$_host" = "gp2x" ] ; then
compilers="$CXX arm-linux-g++ arm-linux-c++"
CXX="arm-linux-c++"
fi
for compiler in $compilers; do for compiler in $compilers; do
if test_compiler $compiler; then if test_compiler $compiler; then
@ -532,6 +544,11 @@ if test -n "$_host"; then
;; ;;
psp) psp)
;; ;;
gp2x)
echo "Cross-compiling to $_host, forcing static build, and disabling openGL."
_build_static=yes
_build_gl=no
;;
*) *)
echo "Cross-compiling to unknown target, please add your target to configure." echo "Cross-compiling to unknown target, please add your target to configure."
exit 1 exit 1
@ -803,6 +820,15 @@ case $_host_os in
INCLUDES="$INCLUDES -Isrc/psp -I`psp-config --pspsdk-path`/include" INCLUDES="$INCLUDES -Isrc/psp -I`psp-config --pspsdk-path`/include"
DEFINES="$DEFINES -Dmain=SDL_main -DPSP -DBSPF_PSP -DPSP_DEBUG" DEFINES="$DEFINES -Dmain=SDL_main -DPSP -DBSPF_PSP -DPSP_DEBUG"
;; ;;
gp2x)
DEFINES="$DEFINES -DBSPF_GP2X -DGP2X -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
MODULES="$MODULES $SRC/gp2x"
INCLUDES="$INCLUDES -I$SRC/gp2x"
_ranlib="arm-linux-ranlib"
_ar="arm-linux-ar cru"
# GP2X ARM Linux Specific strip
GP2X_STRIP="arm-linux-strip"
;;
*) *)
echo "WARNING: host system not currenty supported" echo "WARNING: host system not currenty supported"
exit exit
@ -844,6 +870,13 @@ if test "$_host_os" = unix ; then
fi fi
fi fi
# Works for GP2X which needs a static build.
if test "$_host_os" = gp2x ; then
if test "$_build_static" = yes ; then
LIBS="`echo \"$LIBS\" | sed 's/-lz -lpng/-lpng -lz/'`"
fi
fi
echo "Creating config.mak" echo "Creating config.mak"
cat > config.mak << EOF cat > config.mak << EOF
# -------- Generated by configure ----------- # -------- Generated by configure -----------
@ -895,6 +928,12 @@ PSP-MOUNTPOINT := $PSP_MOUNTPOINT
EOF EOF
fi fi
if test $_host_os = "gp2x" ; then
cat >> config.mak << EOF
GP2X-STRIP := $GP2X_STRIP
EOF
fi
# This should be taken care of elsewhere, but I'm not sure where # This should be taken care of elsewhere, but I'm not sure where
rm -f stella-conf* rm -f stella-conf*

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: mainSDL.cxx,v 1.59 2005-12-23 20:48:50 stephena Exp $ // $Id: mainSDL.cxx,v 1.60 2006-01-08 02:28:02 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -40,10 +40,12 @@
#elif defined(MAC_OSX) #elif defined(MAC_OSX)
#include "SettingsMACOSX.hxx" #include "SettingsMACOSX.hxx"
#include "OSystemMACOSX.hxx" #include "OSystemMACOSX.hxx"
extern "C" { extern "C" {
int stellaMain(int argc, char* argv[]); int stellaMain(int argc, char* argv[]);
} }
#elif defined(GP2X)
#include "SettingsGP2X.hxx"
#include "OSystemGP2X.hxx"
#elif defined(PSP) #elif defined(PSP)
#include "SettingsPSP.hxx" #include "SettingsPSP.hxx"
#include "OSystemPSP.hxx" #include "OSystemPSP.hxx"
@ -136,6 +138,9 @@ int main(int argc, char* argv[])
#elif defined(MAC_OSX) #elif defined(MAC_OSX)
theOSystem = new OSystemMACOSX(); theOSystem = new OSystemMACOSX();
SettingsMACOSX settings(theOSystem); SettingsMACOSX settings(theOSystem);
#elif defined(GP2X)
theOSystem = new OSystemGP2X();
SettingsGP2X settings(theOSystem);
#elif defined(PSP) #elif defined(PSP)
fprintf(stderr,"---------------- Stderr Begins ----------------\n"); fprintf(stderr,"---------------- Stderr Begins ----------------\n");
fprintf(stdout,"---------------- Stdout Begins ----------------\n"); fprintf(stdout,"---------------- Stdout Begins ----------------\n");

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.78 2005-12-23 20:48:50 stephena Exp $ // $Id: Console.cxx,v 1.79 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -92,48 +92,63 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
string left = myProperties.get("Controller.Left", true); string left = myProperties.get("Controller.Left", true);
string right = myProperties.get("Controller.Right", true); string right = myProperties.get("Controller.Right", true);
// Construct left controller // Swap the ports if necessary
if(left == "BOOSTER-GRIP") // Note that this doesn't swap the actual controllers,
// just the ports that they're attached to
Controller::Jack leftjack, rightjack;
if(myProperties.get("Console.SwapPorts", true) == "NO")
{ {
myControllers[0] = new BoosterGrip(Controller::Left, *myEvent); leftjack = Controller::Left;
} rightjack = Controller::Right;
else if(left == "DRIVING")
{
myControllers[0] = new Driving(Controller::Left, *myEvent);
}
else if((left == "KEYBOARD") || (left == "KEYPAD"))
{
myControllers[0] = new Keyboard(Controller::Left, *myEvent);
}
else if(left == "PADDLES")
{
myControllers[0] = new Paddles(Controller::Left, *myEvent);
} }
else else
{ {
myControllers[0] = new Joystick(Controller::Left, *myEvent); leftjack = Controller::Right;
rightjack = Controller::Left;
}
// Construct left controller
if(left == "BOOSTER-GRIP")
{
myControllers[0] = new BoosterGrip(leftjack, *myEvent);
}
else if(left == "DRIVING")
{
myControllers[0] = new Driving(leftjack, *myEvent);
}
else if((left == "KEYBOARD") || (left == "KEYPAD"))
{
myControllers[0] = new Keyboard(leftjack, *myEvent);
}
else if(left == "PADDLES")
{
myControllers[0] = new Paddles(leftjack, *myEvent);
}
else
{
myControllers[0] = new Joystick(leftjack, *myEvent);
} }
// Construct right controller // Construct right controller
if(right == "BOOSTER-GRIP") if(right == "BOOSTER-GRIP")
{ {
myControllers[1] = new BoosterGrip(Controller::Right, *myEvent); myControllers[1] = new BoosterGrip(rightjack, *myEvent);
} }
else if(right == "DRIVING") else if(right == "DRIVING")
{ {
myControllers[1] = new Driving(Controller::Right, *myEvent); myControllers[1] = new Driving(rightjack, *myEvent);
} }
else if((right == "KEYBOARD") || (right == "KEYPAD")) else if((right == "KEYBOARD") || (right == "KEYPAD"))
{ {
myControllers[1] = new Keyboard(Controller::Right, *myEvent); myControllers[1] = new Keyboard(rightjack, *myEvent);
} }
else if(right == "PADDLES") else if(right == "PADDLES")
{ {
myControllers[1] = new Paddles(Controller::Right, *myEvent); myControllers[1] = new Paddles(rightjack, *myEvent);
} }
else else
{ {
myControllers[1] = new Joystick(Controller::Right, *myEvent); myControllers[1] = new Joystick(rightjack, *myEvent);
} }
// Create switches for the console // Create switches for the console
@ -615,6 +630,10 @@ void Console::setDeveloperProperties()
if(s != "") if(s != "")
myProperties.set("Console.TelevisionType", s); myProperties.set("Console.TelevisionType", s);
s = settings.getString("sp");
if(s != "")
myProperties.set("Console.SwapPorts", s);
s = settings.getString("lc"); s = settings.getString("lc");
if(s != "") if(s != "")
myProperties.set("Controller.Left", s); myProperties.set("Controller.Left", s);

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.140 2006-01-05 18:53:23 stephena Exp $ // $Id: EventHandler.cxx,v 1.141 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -643,15 +643,31 @@ void EventHandler::poll(uInt32 time)
int button = event.jbutton.button; int button = event.jbutton.button;
int state = event.jbutton.state == SDL_PRESSED ? 1 : 0; int state = event.jbutton.state == SDL_PRESSED ? 1 : 0;
if(state && eventStateChange(myJoyTable[stick][button])) // Account for buttons which represent diagonal movement
return; // We just generate two equivalent button events representing
// combined movement
// Determine which mode we're in, then send the event to the appropriate place switch(button)
if(myState == S_EMULATE) {
handleEvent(myJoyTable[stick][button], state); case kJDirUpLeft:
else if(myOverlay != NULL) handleJoyEvent(stick, kJDirUp, state);
myOverlay->handleJoyEvent(stick, button, state); handleJoyEvent(stick, kJDirLeft, state);
break; // Regular joystick button break;
case kJDirDownLeft:
handleJoyEvent(stick, kJDirDown, state);
handleJoyEvent(stick, kJDirLeft, state);
break;
case kJDirDownRight:
handleJoyEvent(stick, kJDirDown, state);
handleJoyEvent(stick, kJDirRight, state);
break;
case kJDirUpRight:
handleJoyEvent(stick, kJDirUp, state);
handleJoyEvent(stick, kJDirRight, state);
break;
default:
handleJoyEvent(stick, button, state);
break;
}
} }
case JT_STELLADAPTOR_LEFT: case JT_STELLADAPTOR_LEFT:
@ -857,6 +873,19 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, int state)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::handleJoyEvent(int stick, int button, int state)
{
if(state && eventStateChange(myJoyTable[stick][button]))
return;
// Determine which mode we're in, then send the event to the appropriate place
if(myState == S_EMULATE)
handleEvent(myJoyTable[stick][button], state);
else if(myOverlay != NULL)
myOverlay->handleJoyEvent(stick, button, state);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::handleJoyAxisEvent(int stick, int axis, int value) void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
{ {
@ -923,8 +952,11 @@ void EventHandler::handleEvent(Event::Type event, int state)
switch((int)event) switch((int)event)
{ {
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Make sure that simultaneous events that are impossible on a real // Preprocess joystick events, converting them to events from whichever
// Atari 2600 cannot happen. Maybe this should be in the Event class?? // controller is plugged into the corresponding virtual port.
// This duplicates z26 behaviour, whereby the joystick can be used
// for almost all types of input.
// Yes, this is messy, but it's also as fast as possible ...
case Event::JoystickZeroUp: case Event::JoystickZeroUp:
if(state) myEvent->set(Event::JoystickZeroDown, 0); if(state) myEvent->set(Event::JoystickZeroDown, 0);
break; break;
@ -932,10 +964,50 @@ void EventHandler::handleEvent(Event::Type event, int state)
if(state) myEvent->set(Event::JoystickZeroUp, 0); if(state) myEvent->set(Event::JoystickZeroUp, 0);
break; break;
case Event::JoystickZeroLeft: case Event::JoystickZeroLeft:
if(state) myEvent->set(Event::JoystickZeroRight, 0); switch((int)myController[0])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(state) myEvent->set(Event::JoystickZeroRight, 0);
myEvent->set(Event::JoystickZeroLeft, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleZeroDecrease, state);
return;
case Controller::Driving:
myEvent->set(Event::DrivingZeroCounterClockwise, state);
return;
}
break; break;
case Event::JoystickZeroRight: case Event::JoystickZeroRight:
if(state) myEvent->set(Event::JoystickZeroLeft, 0); switch((int)myController[0])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(state) myEvent->set(Event::JoystickZeroLeft, 0);
myEvent->set(Event::JoystickZeroRight, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleZeroIncrease, state);
return;
case Controller::Driving:
myEvent->set(Event::DrivingZeroClockwise, state);
return;
}
break;
case Event::JoystickZeroFire:
switch((int)myController[0])
{
case Controller::Joystick:
myEvent->set(Event::JoystickZeroFire, state);
return;
case Controller::Paddles:
myEvent->set(Event::PaddleZeroFire, state);
return;
case Controller::Driving:
myEvent->set(Event::DrivingZeroFire, state);
return;
}
break; break;
case Event::JoystickOneUp: case Event::JoystickOneUp:
if(state) myEvent->set(Event::JoystickOneDown, 0); if(state) myEvent->set(Event::JoystickOneDown, 0);
@ -944,10 +1016,50 @@ void EventHandler::handleEvent(Event::Type event, int state)
if(state) myEvent->set(Event::JoystickOneUp, 0); if(state) myEvent->set(Event::JoystickOneUp, 0);
break; break;
case Event::JoystickOneLeft: case Event::JoystickOneLeft:
if(state) myEvent->set(Event::JoystickOneRight, 0); switch((int)myController[1])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(state) myEvent->set(Event::JoystickOneRight, 0);
myEvent->set(Event::JoystickOneLeft, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleOneDecrease, state);
return;
case Controller::Driving:
myEvent->set(Event::DrivingOneCounterClockwise, state);
return;
}
break; break;
case Event::JoystickOneRight: case Event::JoystickOneRight:
if(state) myEvent->set(Event::JoystickOneLeft, 0); switch((int)myController[1])
{
case Controller::Joystick:
case Controller::BoosterGrip:
if(state) myEvent->set(Event::JoystickOneLeft, 0);
myEvent->set(Event::JoystickOneRight, state);
return;
case Controller::Paddles:
handleEvent(Event::PaddleZeroIncrease, state);
return;
case Controller::Driving:
myEvent->set(Event::DrivingOneClockwise, state);
return;
}
break;
case Event::JoystickOneFire:
switch((int)myController[1])
{
case Controller::Joystick:
myEvent->set(Event::JoystickOneFire, state);
return;
case Controller::Paddles:
myEvent->set(Event::PaddleOneFire, state);
return;
case Controller::Driving:
myEvent->set(Event::DrivingOneFire, state);
return;
}
break; break;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@ -2141,31 +2253,31 @@ ActionList EventHandler::ourActionList[kActionListSize] = {
{ Event::DrivingOneClockwise, "P2 Driving Controller Right", "" }, { Event::DrivingOneClockwise, "P2 Driving Controller Right", "" },
{ Event::DrivingOneFire, "P2 Driving Controller Fire", "" }, { Event::DrivingOneFire, "P2 Driving Controller Fire", "" },
{ Event::KeyboardZero1, "P1 KeyPad 1", "" }, { Event::KeyboardZero1, "P1 Keyboard 1", "" },
{ Event::KeyboardZero2, "P1 KeyPad 2", "" }, { Event::KeyboardZero2, "P1 Keyboard 2", "" },
{ Event::KeyboardZero3, "P1 KeyPad 3", "" }, { Event::KeyboardZero3, "P1 Keyboard 3", "" },
{ Event::KeyboardZero4, "P1 KeyPad 4", "" }, { Event::KeyboardZero4, "P1 Keyboard 4", "" },
{ Event::KeyboardZero5, "P1 KeyPad 5", "" }, { Event::KeyboardZero5, "P1 Keyboard 5", "" },
{ Event::KeyboardZero6, "P1 KeyPad 6", "" }, { Event::KeyboardZero6, "P1 Keyboard 6", "" },
{ Event::KeyboardZero7, "P1 KeyPad 7", "" }, { Event::KeyboardZero7, "P1 Keyboard 7", "" },
{ Event::KeyboardZero8, "P1 KeyPad 8", "" }, { Event::KeyboardZero8, "P1 Keyboard 8", "" },
{ Event::KeyboardZero9, "P1 KeyPad 9", "" }, { Event::KeyboardZero9, "P1 Keyboard 9", "" },
{ Event::KeyboardZeroStar, "P1 KeyPad *", "" }, { Event::KeyboardZeroStar, "P1 Keyboard *", "" },
{ Event::KeyboardZero0, "P1 KeyPad 0", "" }, { Event::KeyboardZero0, "P1 Keyboard 0", "" },
{ Event::KeyboardZeroPound, "P1 KeyPad #", "" }, { Event::KeyboardZeroPound, "P1 Keyboard #", "" },
{ Event::KeyboardOne1, "P2 KeyPad 1", "" }, { Event::KeyboardOne1, "P2 Keyboard 1", "" },
{ Event::KeyboardOne2, "P2 KeyPad 2", "" }, { Event::KeyboardOne2, "P2 Keyboard 2", "" },
{ Event::KeyboardOne3, "P2 KeyPad 3", "" }, { Event::KeyboardOne3, "P2 Keyboard 3", "" },
{ Event::KeyboardOne4, "P2 KeyPad 4", "" }, { Event::KeyboardOne4, "P2 Keyboard 4", "" },
{ Event::KeyboardOne5, "P2 KeyPad 5", "" }, { Event::KeyboardOne5, "P2 Keyboard 5", "" },
{ Event::KeyboardOne6, "P2 KeyPad 6", "" }, { Event::KeyboardOne6, "P2 Keyboard 6", "" },
{ Event::KeyboardOne7, "P2 KeyPad 7", "" }, { Event::KeyboardOne7, "P2 Keyboard 7", "" },
{ Event::KeyboardOne8, "P2 KeyPad 8", "" }, { Event::KeyboardOne8, "P2 Keyboard 8", "" },
{ Event::KeyboardOne9, "P2 KeyPad 9", "" }, { Event::KeyboardOne9, "P2 Keyboard 9", "" },
{ Event::KeyboardOneStar, "P2 KeyPad *", "" }, { Event::KeyboardOneStar, "P2 Keyboard *", "" },
{ Event::KeyboardOne0, "P2 KeyPad 0", "" }, { Event::KeyboardOne0, "P2 Keyboard 0", "" },
{ Event::KeyboardOnePound, "P2 KeyPad #", "" } { Event::KeyboardOnePound, "P2 Keyboard #", "" }
}; };
#else #else
ActionList EventHandler::ourActionList[kActionListSize]; ActionList EventHandler::ourActionList[kActionListSize];

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.71 2006-01-05 18:53:23 stephena Exp $ // $Id: EventHandler.hxx,v 1.72 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -34,6 +34,32 @@ class DialogContainer;
class EventMappingWidget; class EventMappingWidget;
class EventStreamer; class EventStreamer;
// Used for those platforms which implement joystick directions
// as buttons instead of axis (which is a broken design IMHO)
// These are defined as constants vs. using platform-specific methods
// and variables for performance reasons
// Buttons not implemented for specific hardware are represented by numbers < 0,
// since no button can have those values (this isn't the cleanest code, but
// it *is* the fastest)
enum {
#if defined(GP2X)
kJDirUp = 0, kJDirUpLeft = 1,
kJDirLeft = 2, kJDirDownLeft = 3,
kJDirDown = 4, kJDirDownRight = 5,
kJDirRight = 6, kJDirUpRight = 7
#elif defined(PSP)
kJDirUp = 8, kJDirUpLeft = -1,
kJDirLeft = 7, kJDirDownLeft = -2,
kJDirDown = 6, kJDirDownRight = -3,
kJDirRight = 9, kJDirUpRight = -4
#else
kJDirUp = -1, kJDirUpLeft = -2,
kJDirLeft = -3, kJDirDownLeft = -4,
kJDirDown = -5, kJDirDownRight = -6,
kJDirRight = -7, kJDirUpRight = -8
#endif
};
enum MouseButton { enum MouseButton {
EVENT_LBUTTONDOWN, EVENT_LBUTTONDOWN,
EVENT_LBUTTONUP, EVENT_LBUTTONUP,
@ -88,6 +114,7 @@ struct JoyMouse {
unsigned int last_time, delay_time, x_down_time, y_down_time; unsigned int last_time, delay_time, x_down_time, y_down_time;
}; };
/** /**
This class takes care of event remapping and dispatching for the This class takes care of event remapping and dispatching for the
Stella core, as well as keeping track of the current 'mode'. Stella core, as well as keeping track of the current 'mode'.
@ -101,7 +128,7 @@ struct JoyMouse {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.71 2006-01-05 18:53:23 stephena Exp $ @version $Id: EventHandler.hxx,v 1.72 2006-01-08 02:28:03 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -351,7 +378,16 @@ class EventHandler
void handleMouseButtonEvent(SDL_Event& event, int state); void handleMouseButtonEvent(SDL_Event& event, int state);
/** /**
Send a joystick axis event to the handler (directions are encoded as buttons) Send a joystick button event to the handler
@param stick The joystick number
@param button The joystick button
@param state The state of the button (pressed or released)
*/
void handleJoyEvent(int stick, int button, int state);
/**
Send a joystick axis event to the handler
@param stick The joystick number @param stick The joystick number
@param axis The joystick axis @param axis The joystick axis

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: EventStreamer.cxx,v 1.4 2006-01-04 01:24:17 stephena Exp $ // $Id: EventStreamer.cxx,v 1.5 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -47,7 +47,7 @@ EventStreamer::~EventStreamer()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventStreamer::reset() void EventStreamer::reset()
{ {
cerr << "EventStreamer::reset()\n"; //cerr << "EventStreamer::reset()\n";
myEventWriteFlag = false; myEventWriteFlag = false;
myEventReadFlag = false; myEventReadFlag = false;
myFrameCounter = -1; myFrameCounter = -1;

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.68 2005-11-19 22:26:13 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.69 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -36,11 +36,7 @@
#include "Debugger.hxx" #include "Debugger.hxx"
#endif #endif
#if defined(MAC_OSX) #if defined(OS2) // FIXME - make proper OS/2 port
#include "macOSXDisplay.h"
#elif defined(PSP)
#include "DisplayPSP.hxx"
#elif defined(OS2)
#define INCL_WIN #define INCL_WIN
#include <os2emx.h> #include <os2emx.h>
#endif #endif
@ -90,33 +86,14 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
setWindowIcon(); setWindowIcon();
} }
// Calculate the desktop size // Query the desktop size
// This is really the job of SDL // This is really the job of SDL
myDesktopDim.w = myDesktopDim.h = 0; myDesktopDim.w = myDesktopDim.h = 0;
#if defined(UNIX) && !defined(OS2) #if defined(OS2) // FIXME - make proper OS/2 port
SDL_SysWMinfo myWMInfo;
SDL_VERSION(&myWMInfo.version);
if(SDL_GetWMInfo(&myWMInfo) > 0 && myWMInfo.subsystem == SDL_SYSWM_X11)
{
myWMInfo.info.x11.lock_func();
myDesktopDim.w = DisplayWidth(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myDesktopDim.h = DisplayHeight(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myWMInfo.info.x11.unlock_func();
}
#elif defined(WIN32)
myDesktopDim.w = (uInt16) GetSystemMetrics(SM_CXSCREEN);
myDesktopDim.h = (uInt16) GetSystemMetrics(SM_CYSCREEN);
#elif defined(MAC_OSX)
myDesktopDim.w = macOSXDisplayWidth();
myDesktopDim.h = macOSXDisplayHeight();
#elif defined(PSP)
myDesktopDim.w = PSP_SCREEN_WIDTH;
myDesktopDim.h = PSP_SCREEN_HEIGHT;
#elif defined(OS2)
myDesktopDim.w = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); myDesktopDim.w = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
myDesktopDim.h = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); myDesktopDim.h = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
#else
myOSystem->getScreenDimensions((int&)myDesktopDim.w, (int&)myDesktopDim.h);
#endif #endif
// Set fullscreen flag // Set fullscreen flag

View File

@ -13,14 +13,13 @@
// 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.59 2005-10-18 18:49:46 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.60 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
#define FRAMEBUFFER_HXX #define FRAMEBUFFER_HXX
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h>
#include "bspf.hxx" #include "bspf.hxx"
#include "Event.hxx" #include "Event.hxx"
@ -52,7 +51,7 @@ enum FrameStyle {
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.59 2005-10-18 18:49:46 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.60 2006-01-08 02:28:03 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {

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.52 2006-01-05 18:53:23 stephena Exp $ // $Id: OSystem.cxx,v 1.53 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -445,12 +445,6 @@ bool OSystem::openROM(const string& rom, string& md5, uInt8** image, int* size)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::getJoyButtonDirections(int& up, int& down, int& left, int& right)
{
up = down = left = right = -1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setDefaultJoymap() void OSystem::setDefaultJoymap()
{ {

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.hxx,v 1.33 2006-01-05 18:53:23 stephena Exp $ // $Id: OSystem.hxx,v 1.34 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_HXX #ifndef OSYSTEM_HXX
@ -44,7 +44,7 @@ class CheatManager;
other objects belong. other objects belong.
@author Stephen Anthony @author Stephen Anthony
@version $Id: OSystem.hxx,v 1.33 2006-01-05 18:53:23 stephena Exp $ @version $Id: OSystem.hxx,v 1.34 2006-01-08 02:28:03 stephena Exp $
*/ */
class OSystem class OSystem
{ {
@ -313,22 +313,15 @@ class OSystem
*/ */
virtual uInt32 getTicks() = 0; virtual uInt32 getTicks() = 0;
/**
This method queries the dimensions of the screen for the given device.
*/
virtual void getScreenDimensions(int& width, int& height) = 0;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// The following methods are system-specific and can be overrided in // The following methods are system-specific and can be overrided in
// derived classes. Otherwise, the base methods will be used. // derived classes. Otherwise, the base methods will be used.
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/**
This method gives joystick button numbers representing the 'up', 'down',
'left' and 'right' directions for use in the internal GUI. A normal
joystick will use axes for this, but some hardware uses buttons instead.
@up Button number to assign to the 'up' direction
@down Button number to assign to the 'down' direction
@left Button number to assign to the 'left' direction
@right Button number to assign to the 'right' direction
*/
virtual void getJoyButtonDirections(int& up, int& down, int& left, int& right);
/** /**
This method determines the default mapping of joystick buttons to This method determines the default mapping of joystick buttons to
Stella events for a specific system/platform. Stella events for a specific system/platform.

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.14 2005-10-19 00:59:51 stephena Exp $ // $Id: PropsSet.cxx,v 1.15 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -222,6 +222,7 @@ const Properties& PropertiesSet::defaultProperties()
ourDefaultProperties.set("Console.LeftDifficulty", "B"); ourDefaultProperties.set("Console.LeftDifficulty", "B");
ourDefaultProperties.set("Console.RightDifficulty", "B"); ourDefaultProperties.set("Console.RightDifficulty", "B");
ourDefaultProperties.set("Console.TelevisionType", "Color"); ourDefaultProperties.set("Console.TelevisionType", "Color");
ourDefaultProperties.set("Console.SwapPorts", "No");
ourDefaultProperties.set("Controller.Left", "Joystick"); ourDefaultProperties.set("Controller.Left", "Joystick");
ourDefaultProperties.set("Controller.Right", "Joystick"); ourDefaultProperties.set("Controller.Right", "Joystick");

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: Settings.cxx,v 1.70 2006-01-06 00:31:56 stephena Exp $ // $Id: Settings.cxx,v 1.71 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -330,6 +330,7 @@ void Settings::usage()
<< " -ld <arg> Sets the 'Console.LeftDifficulty' property\n" << " -ld <arg> Sets the 'Console.LeftDifficulty' property\n"
<< " -rd <arg> Sets the 'Console.RightDifficulty' property\n" << " -rd <arg> Sets the 'Console.RightDifficulty' property\n"
<< " -tv <arg> Sets the 'Console.TelevisionType' property\n" << " -tv <arg> Sets the 'Console.TelevisionType' property\n"
<< " -sp <arg> Sets the 'Console.SwapPorts' property\n"
<< " -lc <arg> Sets the 'Controller.Left' property\n" << " -lc <arg> Sets the 'Controller.Left' property\n"
<< " -rc <arg> Sets the 'Controller.Right' property\n" << " -rc <arg> Sets the 'Controller.Right' property\n"
<< " -bc <arg> Same as using both -lc and -rc\n" << " -bc <arg> Same as using both -lc and -rc\n"

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: bspf.hxx,v 1.12 2005-10-11 17:14:35 stephena Exp $ // $Id: bspf.hxx,v 1.13 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#ifndef BSPF_HXX #ifndef BSPF_HXX
@ -24,7 +24,7 @@
that need to be defined for different operating systems. that need to be defined for different operating systems.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: bspf.hxx,v 1.12 2005-10-11 17:14:35 stephena Exp $ @version $Id: bspf.hxx,v 1.13 2006-01-08 02:28:03 stephena Exp $
*/ */
// Types for 8-bit signed and unsigned integers // Types for 8-bit signed and unsigned integers
@ -69,6 +69,8 @@ typedef unsigned int uInt32;
#define BSPF_PATH_SEPARATOR "/" #define BSPF_PATH_SEPARATOR "/"
#elif defined BSPF_PSP #elif defined BSPF_PSP
#define BSPF_PATH_SEPARATOR "/" #define BSPF_PATH_SEPARATOR "/"
#elif defined BSPF_GP2X
#define BSPF_PATH_SEPARATOR "/"
#endif #endif
// I wish Windows had a complete POSIX layer // I wish Windows had a complete POSIX layer

View File

@ -2477,6 +2477,8 @@
"Display.Format" "PAL" "Display.Format" "PAL"
"Display.Height" "193" "Display.Height" "193"
"Display.YStart" "64" "Display.YStart" "64"
"Cartridge.Note" "Console ports are swapped"
"Console.SwapPorts" "Yes"
"" ""
"Cartridge.MD5" "1cf59fc7b11cdbcefe931e41641772f6" "Cartridge.MD5" "1cf59fc7b11cdbcefe931e41641772f6"
@ -12503,7 +12505,7 @@
"Cartridge.Name" "Omega Race (1983) (CBS Electronics)" "Cartridge.Name" "Omega Race (1983) (CBS Electronics)"
"Cartridge.Manufacturer" "CBS Electronics" "Cartridge.Manufacturer" "CBS Electronics"
"Cartridge.ModelNo" "4L-2737" "Cartridge.ModelNo" "4L-2737"
"Cartridge.Note" "Uses Booster Grip Controller; set right difficulty to 'A' to use Booster-Grip in both ports" "Cartridge.Note" "Set right difficulty to 'A' for Booster-Grip in both ports"
"Cartridge.Rarity" "Uncommon" "Cartridge.Rarity" "Uncommon"
"Console.RightDifficulty" "A" "Console.RightDifficulty" "A"
"Controller.Left" "Booster-Grip" "Controller.Left" "Booster-Grip"
@ -19865,6 +19867,8 @@
"Cartridge.Type" "F8" "Cartridge.Type" "F8"
"Display.Height" "192" "Display.Height" "192"
"Display.YStart" "37" "Display.YStart" "37"
"Cartridge.Note" "Console ports are swapped"
"Console.SwapPorts" "Yes"
"" ""
"Cartridge.MD5" "f7a138eed69665b5cd1bfa796a550b01" "Cartridge.MD5" "f7a138eed69665b5cd1bfa796a550b01"

View File

@ -0,0 +1,247 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FSNodeGP2X.cxx,v 1.1 2006-01-08 02:28:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "FSNode.hxx"
#ifdef MACOSX
#include <sys/types.h>
#endif
#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
#include <sstream>
/*
* Implementation of the Stella file system API based on POSIX (for Linux and OSX)
*/
class POSIXFilesystemNode : public AbstractFilesystemNode
{
public:
POSIXFilesystemNode();
POSIXFilesystemNode(const string& path);
POSIXFilesystemNode(const POSIXFilesystemNode* node);
virtual string displayName() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual string path() const { return _path; }
virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const;
virtual AbstractFilesystemNode* parent() const;
protected:
string _displayName;
bool _isDirectory;
bool _isValid;
string _path;
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static const char* lastPathComponent(const string& str)
{
const char *start = str.c_str();
const char *cur = start + str.size() - 2;
while (cur > start && *cur != '/')
--cur;
return cur+1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static string validatePath(const string& p)
{
string path = p;
if(p.size() <= 0 || p[0] != '/')
path = "/";
return path;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode* FilesystemNode::getRoot()
{
return new POSIXFilesystemNode();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode* FilesystemNode::getNodeForPath(const string& path)
{
return new POSIXFilesystemNode(validatePath(path));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POSIXFilesystemNode::POSIXFilesystemNode()
{
char buf[MAXPATHLEN];
getcwd(buf, MAXPATHLEN);
_path = buf;
_displayName = lastPathComponent(_path);
_path += '/';
_isValid = true;
_isDirectory = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POSIXFilesystemNode::POSIXFilesystemNode(const string& p)
{
string path = validatePath(p);
Int32 len = 0, offset = path.size();
struct stat st;
_path = path;
// Extract last component from path
const char *str = path.c_str();
while (offset > 0 && str[offset-1] == '/')
offset--;
while (offset > 0 && str[offset-1] != '/')
{
len++;
offset--;
}
_displayName = string(str + offset, len);
// Check whether it is a directory, and whether the file actually exists
_isValid = (0 == stat(_path.c_str(), &st));
_isDirectory = S_ISDIR(st.st_mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POSIXFilesystemNode::POSIXFilesystemNode(const POSIXFilesystemNode* node)
{
_displayName = node->_displayName;
_isValid = node->_isValid;
_isDirectory = node->_isDirectory;
_path = node->_path;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FSList POSIXFilesystemNode::listDir(ListMode mode) const
{
assert(_isDirectory);
DIR *dirp = opendir(_path.c_str());
struct stat st;
struct dirent *dp;
FSList myList;
if (dirp == NULL)
return myList;
// ... loop over dir entries using readdir
while ((dp = readdir(dirp)) != NULL)
{
// Skip 'invisible' files
if (dp->d_name[0] == '.')
continue;
POSIXFilesystemNode entry;
entry._displayName = dp->d_name;
entry._path = _path;
if (entry._path.length() > 0 && entry._path[entry._path.length()-1] != '/')
entry._path += '/';
entry._path += dp->d_name;
if (stat(entry._path.c_str(), &st))
continue;
entry._isDirectory = S_ISDIR(st.st_mode);
// Honor the chosen mode
if ((mode == kListFilesOnly && entry._isDirectory) ||
(mode == kListDirectoriesOnly && !entry._isDirectory))
continue;
if (entry._isDirectory)
entry._path += "/";
myList.push_back(wrap(new POSIXFilesystemNode(&entry)));
}
closedir(dirp);
return myList;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFilesystemNode *POSIXFilesystemNode::parent() const
{
if (_path == "/")
return 0;
POSIXFilesystemNode* p = new POSIXFilesystemNode();
const char *start = _path.c_str();
const char *end = lastPathComponent(_path);
p->_path = string(start, end - start);
p->_displayName = lastPathComponent(p->_path);
p->_isValid = true;
p->_isDirectory = true;
return p;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::fileExists(const string& path)
{
struct stat st;
if(stat(path.c_str(), &st) != 0)
return false;
return S_ISREG(st.st_mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::dirExists(const string& path)
{
struct stat st;
if(stat(path.c_str(), &st) != 0)
return false;
return S_ISDIR(st.st_mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::makeDir(const string& path)
{
return mkdir(path.c_str(), 0777) == 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string AbstractFilesystemNode::modTime(const string& path)
{
struct stat st;
if(stat(path.c_str(), &st) != 0)
return "";
ostringstream buf;
buf << st.st_mtime;
return buf.str();
}

View File

@ -0,0 +1,220 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystemGP2X.cxx,v 1.1 2006-01-08 02:28:03 stephena Exp $
// Modified on 2006/01/06 by Alex Zaballa for use on GP2X
//============================================================================
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "bspf.hxx"
#include "OSystem.hxx"
#include "OSystemGP2X.hxx"
#ifdef HAVE_GETTIMEOFDAY
#include <time.h>
#include <sys/time.h>
#endif
/**
Each derived class is responsible for calling the following methods
in its constructor:
setBaseDir()
setStateDir()
setPropertiesDir()
setConfigFiles()
setCacheFile()
And for initializing the following variables:
myDriverList (a StringList)
See OSystem.hxx for a further explanation
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemGP2X::OSystemGP2X()
{
// GP2X needs all config files in exec directory
char *currdir = getcwd(NULL, 0);
string basedir = currdir;
free(currdir);
setBaseDir(basedir);
string statedir = basedir + "/state";
setStateDir(statedir);
setPropertiesDir(basedir, basedir);
string userPropertiesFile = basedir + "/user.pro";
string systemPropertiesFile = basedir + "/stella.pro";
setConfigFiles(userPropertiesFile, systemPropertiesFile);
string userConfigFile = basedir + "/stellarc";
string systemConfigFile = statedir + "/stellarc";
setConfigFiles(userConfigFile, systemConfigFile);
string cacheFile = basedir + "/stella.cache";
setCacheFile(cacheFile);
// No drivers are specified for Unix
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemGP2X::~OSystemGP2X()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemGP2X::mainLoop()
{
// These variables are common to both timing options
// and are needed to calculate the overall frames per second.
uInt32 frameTime = 0, numberOfFrames = 0;
if(mySettings->getBool("accurate")) // normal, CPU-intensive timing
{
// Set up accurate timing stuff
uInt32 startTime, delta;
// Set the base for the timers
frameTime = 0;
// Main game loop
for(;;)
{
// Exit if the user wants to quit
if(myEventHandler->doQuit())
break;
startTime = getTicks();
myEventHandler->poll(startTime);
myFrameBuffer->update();
// Now, waste time if we need to so that we are at the desired frame rate
for(;;)
{
delta = getTicks() - startTime;
if(delta >= myTimePerFrame)
break;
}
frameTime += getTicks() - startTime;
++numberOfFrames;
}
}
else // less accurate, less CPU-intensive timing
{
// Set up less accurate timing stuff
uInt32 startTime, virtualTime, currentTime;
// Set the base for the timers
virtualTime = getTicks();
frameTime = 0;
// Main game loop
for(;;)
{
// Exit if the user wants to quit
if(myEventHandler->doQuit())
break;
startTime = getTicks();
myEventHandler->poll(startTime);
myFrameBuffer->update();
currentTime = getTicks();
virtualTime += myTimePerFrame;
if(currentTime < virtualTime)
{
SDL_Delay((virtualTime - currentTime)/1000);
}
currentTime = getTicks() - startTime;
frameTime += currentTime;
++numberOfFrames;
}
}
// Only print console information if a console was actually created
if(mySettings->getBool("showinfo") && myConsole)
{
double executionTime = (double) frameTime / 1000000.0;
double framesPerSecond = (double) numberOfFrames / executionTime;
cout << endl;
cout << numberOfFrames << " total frames drawn\n";
cout << framesPerSecond << " frames/second\n";
cout << endl;
cout << "Cartridge Name: " << myConsole->properties().get("Cartridge.Name");
cout << endl;
cout << "Cartridge MD5: " << myConsole->properties().get("Cartridge.MD5");
cout << endl << endl;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 OSystemGP2X::getTicks()
{
#ifdef HAVE_GETTIMEOFDAY
timeval now;
gettimeofday(&now, 0);
return (uInt32) (now.tv_sec * 1000000 + now.tv_usec);
#else
return (uInt32) SDL_GetTicks() * 1000;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemGP2X::getScreenDimensions(int& width, int& height)
{
width = 320;
height = 240;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemGP2X::setDefaultJoymap()
{
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroUp, 0, 0); // Up
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroLeft, 0, 2); // Left
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroDown, 0, 4); // Down
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroRight, 0, 6); // Right
myEventHandler->setDefaultJoyMapping(Event::LauncherMode, 0, 8); // Start
myEventHandler->setDefaultJoyMapping(Event::CmdMenuMode, 0, 9); // Select
myEventHandler->setDefaultJoyMapping(Event::ConsoleReset, 0, 10); // L
myEventHandler->setDefaultJoyMapping(Event::ConsoleSelect, 0, 11); // R
myEventHandler->setDefaultJoyMapping(Event::TakeSnapshot, 0, 12); // A
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroFire, 0, 13); // B
myEventHandler->setDefaultJoyMapping(Event::Pause, 0, 14); // X
myEventHandler->setDefaultJoyMapping(Event::MenuMode, 0, 15); // Y
myEventHandler->setDefaultJoyMapping(Event::VolumeIncrease, 0, 16); // Vol+
myEventHandler->setDefaultJoyMapping(Event::VolumeDecrease, 0, 17); // Vol-
myEventHandler->setDefaultJoyMapping(Event::NoType, 0, 18); // Click
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemGP2X::setDefaultJoyAxisMap()
{
}

View File

@ -0,0 +1,75 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystemGP2X.hxx,v 1.1 2006-01-08 02:28:03 stephena Exp $
// Modified by Alex Zaballa on 2006/01/04 for use on GP2X
//============================================================================
#ifndef OSYSTEM_GP2X_HXX
#define OSYSTEM_GP2X_HXX
#include "bspf.hxx"
/**
This class defines GP2X system specific settings.
*/
class OSystemGP2X : public OSystem
{
public:
/**
Create a new GP2X-specific operating system object
*/
OSystemGP2X();
/**
Destructor
*/
virtual ~OSystemGP2X();
public:
/**
This method runs the main loop. Since different platforms
may use different timing methods and/or algorithms, this method has
been abstracted to each platform.
*/
virtual void mainLoop();
/**
This method returns number of ticks in microseconds.
@return Current time in microseconds.
*/
virtual uInt32 getTicks();
/**
This method queries the dimensions of the screen for this hardware.
*/
virtual void getScreenDimensions(int& width, int& height);
/**
This method determines the default mapping of joystick buttons to
Stella events for the PSP device.
*/
void setDefaultJoymap();
/**
This method determines the default mapping of joystick axis to
Stella events for for the PSP device.
*/
void setDefaultJoyAxisMap();
};
#endif

View File

@ -0,0 +1,43 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SettingsGP2X.cxx,v 1.1 2006-01-08 02:28:03 stephena Exp $
// Modified on 2006/01/04 by Alex Zaballa for use on GP2X
//============================================================================
#include "bspf.hxx"
#include "OSystem.hxx"
#include "Settings.hxx"
#include "SettingsGP2X.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsGP2X::SettingsGP2X(OSystem* osystem)
: Settings(osystem)
{
// Some of these settings might be redundant, but are crucial for GP2X
set("center", "true");
set("accurate", "false");
set("volume", "50");
set("sound", "true");
set("zoom", "1");
set("fragsize", "512");
set("tiafreq", "22050");
set("clipvol", "false");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsGP2X::~SettingsGP2X()
{
}

View File

@ -0,0 +1,44 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SettingsGP2X.hxx,v 1.1 2006-01-08 02:28:03 stephena Exp $
// Modified by Alex Zaballa on 2006/01/04 for use on GP2X
//============================================================================
#ifndef SETTINGS_GP2X_HXX
#define SETTINGS_GP2X_HXX
class OSystem;
#include "bspf.hxx"
/**
This class defines GP2X system specific settings.
*/
class SettingsGP2X : public Settings
{
public:
/**
Create a new GP2X settings object
*/
SettingsGP2X(OSystem* osystem);
/**
Destructor
*/
virtual ~SettingsGP2X();
};
#endif

11
stella/src/gp2x/module.mk Normal file
View File

@ -0,0 +1,11 @@
MODULE := src/gp2x
MODULE_OBJS := \
src/gp2x/FSNodeGP2X.o \
src/gp2x/OSystemGP2X.o \
src/gp2x/SettingsGP2X.o
MODULE_DIRS += \
src/gp2x
# Include common rules
include $(srcdir)/common.rules

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: Dialog.cxx,v 1.39 2005-12-24 22:50:52 stephena Exp $ // $Id: Dialog.cxx,v 1.40 2006-01-08 02:28:03 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
@ -192,6 +192,12 @@ bool Dialog::wantsEvents()
return _focusedWidget && _focusedWidget->wantsEvents(); return _focusedWidget && _focusedWidget->wantsEvents();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Dialog::wantsAllEvents()
{
return _focusedWidget && _focusedWidget->wantsAllEvents();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::draw() void Dialog::draw()
{ {

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: Dialog.hxx,v 1.24 2005-12-24 22:09:36 stephena Exp $ // $Id: Dialog.hxx,v 1.25 2006-01-08 02:28:03 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
@ -36,7 +36,7 @@ class TabWidget;
This is the base class for all dialog boxes. This is the base class for all dialog boxes.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Dialog.hxx,v 1.24 2005-12-24 22:09:36 stephena Exp $ @version $Id: Dialog.hxx,v 1.25 2006-01-08 02:28:03 stephena Exp $
*/ */
class Dialog : public GuiObject class Dialog : public GuiObject
{ {
@ -85,7 +85,11 @@ class Dialog : public GuiObject
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
virtual void handleScreenChanged() {} virtual void handleScreenChanged() {}
/** The dialog wants all events except those that have some special function */
virtual bool wantsEvents(); virtual bool wantsEvents();
/** The dialog wants all events, without exception */
virtual bool wantsAllEvents();
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any Widget* findWidget(int x, int y); // Find the widget at pos x,y if any

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: DialogContainer.cxx,v 1.25 2006-01-06 00:31:56 stephena Exp $ // $Id: DialogContainer.cxx,v 1.26 2006-01-08 02:28:03 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -274,20 +274,35 @@ void DialogContainer::handleJoyEvent(int stick, int button, uInt8 state)
// Send the event to the dialog box on the top of the stack // Send the event to the dialog box on the top of the stack
Dialog* activeDialog = myDialogStack.top(); Dialog* activeDialog = myDialogStack.top();
// Some buttons act as directions. In those cases, translate them // Only preprocess button events if the dialog absolutely doesn't want them
// to axis events instead of mouse button events if(!activeDialog->wantsAllEvents())
int up, down, left, right = -1; {
int value = state > 0 ? 32767 : 0; // Some buttons act as directions. In those cases, translate them
myOSystem->getJoyButtonDirections(up, down, left, right); // to axis events instead of mouse button events
if(button == up) int value = state > 0 ? 32767 : 0;
handleJoyAxisEvent(stick, 1, -value); // axis 1, -value ==> UP bool handled = true;
else if(button == down) switch(button)
handleJoyAxisEvent(stick, 1, value); // axis 1, +value ==> DOWN {
else if(button == left) case kJDirUp:
handleJoyAxisEvent(stick, 0, -value); // axis 0, -value ==> LEFT handleJoyAxisEvent(stick, 1, -value); // axis 1, -value ==> UP
else if(button == right) break;
handleJoyAxisEvent(stick, 0, value); // axis 0, +value ==> RIGHT case kJDirLeft:
else if(activeDialog->wantsEvents()) handleJoyAxisEvent(stick, 0, -value); // axis 0, -value ==> LEFT
break;
case kJDirDown:
handleJoyAxisEvent(stick, 1, value); // axis 1, +value ==> DOWN
break;
case kJDirRight:
handleJoyAxisEvent(stick, 0, value); // axis 0, +value ==> RIGHT
break;
default:
handled = false;
}
if(handled)
return;
}
if(activeDialog->wantsEvents())
{ {
if(state == 1) if(state == 1)
activeDialog->handleJoyDown(stick, button); activeDialog->handleJoyDown(stick, button);
@ -295,8 +310,8 @@ void DialogContainer::handleJoyEvent(int stick, int button, uInt8 state)
activeDialog->handleJoyUp(stick, button); activeDialog->handleJoyUp(stick, button);
} }
else else
myOSystem->eventHandler().createMouseButtonEvent( myOSystem->eventHandler().createMouseButtonEvent(
ourJoyMouse.x, ourJoyMouse.y, state); ourJoyMouse.x, ourJoyMouse.y, state);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.7 2005-12-24 22:50:53 stephena Exp $ // $Id: EventMappingWidget.cxx,v 1.8 2006-01-08 02:28:03 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
@ -127,7 +127,7 @@ void EventMappingWidget::startRemapping()
// Make sure that this widget receives all events, // Make sure that this widget receives all events,
// and they aren't handled anywhere else // and they aren't handled anywhere else
myActionsList->setFlags(WIDGET_WANTS_EVENTS); myActionsList->setFlags(WIDGET_WANTS_EVENTS|WIDGET_WTALL_EVENTS);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -164,7 +164,7 @@ void EventMappingWidget::stopRemapping()
} }
// Widget is now free to process events normally // Widget is now free to process events normally
myActionsList->clearFlags(WIDGET_WANTS_EVENTS); myActionsList->clearFlags(WIDGET_WANTS_EVENTS|WIDGET_WTALL_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: GameInfoDialog.cxx,v 1.19 2005-10-15 22:30:29 stephena Exp $ // $Id: GameInfoDialog.cxx,v 1.20 2006-01-08 02:28:03 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
@ -120,7 +120,7 @@ GameInfoDialog::GameInfoDialog(
addToFocusList(wid, tabID); addToFocusList(wid, tabID);
// 2) Console/Controller properties // 2) Console properties
wid.clear(); wid.clear();
tabID = myTab->addTab("Console"); tabID = myTab->addTab("Console");
@ -155,6 +155,16 @@ GameInfoDialog::GameInfoDialog(
myTVType->appendEntry("B & W", 2); myTVType->appendEntry("B & W", 2);
wid.push_back(myTVType); wid.push_back(myTVType);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
"Swap ports:", kTextAlignLeft);
mySwapPorts = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight,
"", 0, 0);
mySwapPorts->appendEntry("Yes", 1);
mySwapPorts->appendEntry("No", 2);
wid.push_back(mySwapPorts);
// Add items for tab 1 // Add items for tab 1
addToFocusList(wid, tabID); addToFocusList(wid, tabID);
@ -335,6 +345,14 @@ void GameInfoDialog::loadConfig()
else else
myTVType->setSelectedTag(0); myTVType->setSelectedTag(0);
s = myGameProperties->get("Console.SwapPorts", true);
if(s == "YES")
mySwapPorts->setSelectedTag(1);
else if(s == "NO")
mySwapPorts->setSelectedTag(2);
else
mySwapPorts->setSelectedTag(0);
// Controller properties // Controller properties
s = myGameProperties->get("Controller.Left", true); s = myGameProperties->get("Controller.Left", true);
for(i = 0; i < 5; ++i) for(i = 0; i < 5; ++i)
@ -435,6 +453,10 @@ void GameInfoDialog::saveConfig()
s = (tag == 1) ? "Color" : "BlackAndWhite"; s = (tag == 1) ? "Color" : "BlackAndWhite";
myGameProperties->set("Console.TelevisionType", s); myGameProperties->set("Console.TelevisionType", s);
tag = mySwapPorts->getSelectedTag();
s = (tag == 1) ? "Yes" : "No";
myGameProperties->set("Console.SwapPorts", s);
// Controller properties // Controller properties
tag = myLeftController->getSelectedTag(); tag = myLeftController->getSelectedTag();
for(i = 0; i < 5; ++i) for(i = 0; i < 5; ++i)

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: GameInfoDialog.hxx,v 1.12 2005-10-01 01:42:36 stephena Exp $ // $Id: GameInfoDialog.hxx,v 1.13 2006-01-08 02:28:03 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
@ -70,6 +70,7 @@ class GameInfoDialog : public Dialog, public CommandSender
PopUpWidget* myLeftDiff; PopUpWidget* myLeftDiff;
PopUpWidget* myRightDiff; PopUpWidget* myRightDiff;
PopUpWidget* myTVType; PopUpWidget* myTVType;
PopUpWidget* mySwapPorts;
// Controller properties // Controller properties
PopUpWidget* myLeftController; PopUpWidget* myLeftController;

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: Widget.hxx,v 1.44 2006-01-04 01:24:17 stephena Exp $ // $Id: Widget.hxx,v 1.45 2006-01-08 02:28:03 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
@ -46,7 +46,8 @@ enum {
WIDGET_NODRAW_FOCUS = 1 << 8, WIDGET_NODRAW_FOCUS = 1 << 8,
WIDGET_STICKY_FOCUS = 1 << 9, WIDGET_STICKY_FOCUS = 1 << 9,
WIDGET_WANTS_TAB = 1 << 10, WIDGET_WANTS_TAB = 1 << 10,
WIDGET_WANTS_EVENTS = 1 << 11 WIDGET_WANTS_EVENTS = 1 << 11,
WIDGET_WTALL_EVENTS = 1 << 12
}; };
enum { enum {
@ -74,7 +75,7 @@ enum {
This is the base class for all widgets. This is the base class for all widgets.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Widget.hxx,v 1.44 2006-01-04 01:24:17 stephena Exp $ @version $Id: Widget.hxx,v 1.45 2006-01-08 02:28:03 stephena Exp $
*/ */
class Widget : public GuiObject class Widget : public GuiObject
{ {
@ -118,6 +119,7 @@ class Widget : public GuiObject
bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); } bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); }
bool isSticky() const { return _flags & WIDGET_STICKY_FOCUS; } bool isSticky() const { return _flags & WIDGET_STICKY_FOCUS; }
bool wantsEvents() const { return _flags & WIDGET_WANTS_EVENTS; } bool wantsEvents() const { return _flags & WIDGET_WANTS_EVENTS; }
bool wantsAllEvents() const { return _flags & WIDGET_WTALL_EVENTS; }
void setID(int id) { _id = id; } void setID(int id) { _id = id; }
int getID() { return _id; } int getID() { return _id; }

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: OSystemMACOSX.cxx,v 1.6 2005-09-14 01:50:42 markgrebe Exp $ // $Id: OSystemMACOSX.cxx,v 1.7 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#include <cstdlib> #include <cstdlib>
@ -36,7 +36,9 @@
#endif #endif
extern "C" { extern "C" {
void macOpenConsole(char *romname); void macOpenConsole(char *romname);
uInt16 macOSXDisplayWidth(void);
uInt16 macOSXDisplayHeight(void);
} }
// Pointer to the main parent osystem object or the null pointer // Pointer to the main parent osystem object or the null pointer
@ -173,3 +175,10 @@ uInt32 OSystemMACOSX::getTicks()
return (uInt32) SDL_GetTicks() * 1000; return (uInt32) SDL_GetTicks() * 1000;
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemMACOSX::getScreenDimensions(int& width, int& height)
{
width = (int)macOSXDisplayWidth();
height = (int)macOSXDisplayHeight();
}

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: OSystemMACOSX.hxx,v 1.2 2005-06-16 01:11:29 stephena Exp $ // $Id: OSystemMACOSX.hxx,v 1.3 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_MACOSX_HXX #ifndef OSYSTEM_MACOSX_HXX
@ -26,7 +26,7 @@
This class defines UNIX-like OS's (Linux) system specific settings. This class defines UNIX-like OS's (Linux) system specific settings.
@author Mark Grebe @author Mark Grebe
@version $Id: OSystemMACOSX.hxx,v 1.2 2005-06-16 01:11:29 stephena Exp $ @version $Id: OSystemMACOSX.hxx,v 1.3 2006-01-08 02:28:04 stephena Exp $
*/ */
class OSystemMACOSX : public OSystem class OSystemMACOSX : public OSystem
{ {
@ -56,6 +56,10 @@ class OSystemMACOSX : public OSystem
*/ */
virtual uInt32 getTicks(); virtual uInt32 getTicks();
/**
This method queries the dimensions of the screen for this hardware.
*/
virtual void getScreenDimensions(int& width, int& height);
}; };
#endif #endif

View File

@ -1,14 +0,0 @@
/* macOSXDisplay.h - Header for display size
support functions for the
Macintosh OS X SDL port of Stella
Mark Grebe <atarimac@cox.net>
*/
/* $Id: macOSXDisplay.h,v 1.1 2005-09-07 03:11:33 markgrebe Exp $ */
extern "C" {
uInt16 macOSXDisplayWidth(void);
uInt16 macOSXDisplayHeight(void);
}

View File

@ -2618,14 +2618,6 @@
settings = { settings = {
}; };
}; };
2DDB4E1308BD52F8001BF554 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
path = macOSXDisplay.h;
refType = 2;
sourceTree = SOURCE_ROOT;
};
2DDB4E1408BD52F8001BF554 = { 2DDB4E1408BD52F8001BF554 = {
fileRef = 2DDB4E1308BD52F8001BF554; fileRef = 2DDB4E1308BD52F8001BF554;
isa = PBXBuildFile; isa = PBXBuildFile;

View File

@ -1,27 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DisplayPSP.hxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
//============================================================================
#ifndef DISPLAY_PSP_HXX
#define DISPLAY_PSP_HXX
// FIXME - at some point, this should be integrated into either SDL or OSystem
#define PSP_SCREEN_WIDTH 480
#define PSP_SCREEN_HEIGHT 272
#endif

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: OSystemPSP.cxx,v 1.4 2006-01-05 18:53:23 stephena Exp $ // $Id: OSystemPSP.cxx,v 1.5 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#include <cstdlib> #include <cstdlib>
@ -141,12 +141,10 @@ uInt32 OSystemPSP::getTicks()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemPSP::getJoyButtonDirections(int& up, int& down, int& left, int& right) void OSystemPSP::getScreenDimensions(int& width, int& height)
{ {
up = 8; width = 480;
down = 6; height = 272;
left = 7;
right = 9;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: OSystemPSP.hxx,v 1.2 2006-01-05 18:53:23 stephena Exp $ // $Id: OSystemPSP.hxx,v 1.3 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_PSP_HXX #ifndef OSYSTEM_PSP_HXX
@ -26,7 +26,7 @@
This class defines PSP-specific settings. This class defines PSP-specific settings.
@author Stephen Anthony @author Stephen Anthony
@version $Id: OSystemPSP.hxx,v 1.2 2006-01-05 18:53:23 stephena Exp $ @version $Id: OSystemPSP.hxx,v 1.3 2006-01-08 02:28:04 stephena Exp $
*/ */
class OSystemPSP : public OSystem class OSystemPSP : public OSystem
{ {
@ -56,12 +56,6 @@ class OSystemPSP : public OSystem
*/ */
uInt32 getTicks(); uInt32 getTicks();
/**
This method gives joystick button numbers representing the 'up', 'down',
'left' and 'right' directions for use in the internal GUI.
*/
void getJoyButtonDirections(int& up, int& down, int& left, int& right);
/** /**
This method determines the default mapping of joystick buttons to This method determines the default mapping of joystick buttons to
Stella events for the PSP device. Stella events for the PSP device.
@ -73,6 +67,11 @@ class OSystemPSP : public OSystem
Stella events for for the PSP device. Stella events for for the PSP device.
*/ */
void setDefaultJoyAxisMap(); void setDefaultJoyAxisMap();
/**
This method queries the dimensions of the screen for this hardware.
*/
virtual void getScreenDimensions(int& width, int& height);
}; };
#endif #endif

View File

@ -13,9 +13,12 @@
// 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: OSystemUNIX.cxx,v 1.13 2005-09-11 22:55:51 stephena Exp $ // $Id: OSystemUNIX.cxx,v 1.14 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h>
#include <SDL_syswm.h>
#include <cstdlib> #include <cstdlib>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
@ -178,3 +181,19 @@ uInt32 OSystemUNIX::getTicks()
return (uInt32) SDL_GetTicks() * 1000; return (uInt32) SDL_GetTicks() * 1000;
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemUNIX::getScreenDimensions(int& width, int& height)
{
SDL_SysWMinfo myWMInfo;
SDL_VERSION(&myWMInfo.version);
if(SDL_GetWMInfo(&myWMInfo) > 0 && myWMInfo.subsystem == SDL_SYSWM_X11)
{
myWMInfo.info.x11.lock_func();
width = DisplayWidth(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
height = DisplayHeight(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myWMInfo.info.x11.unlock_func();
}
}

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: OSystemUNIX.hxx,v 1.8 2005-06-16 01:11:29 stephena Exp $ // $Id: OSystemUNIX.hxx,v 1.9 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_UNIX_HXX #ifndef OSYSTEM_UNIX_HXX
@ -26,7 +26,7 @@
This class defines UNIX-like OS's (Linux) system specific settings. This class defines UNIX-like OS's (Linux) system specific settings.
@author Stephen Anthony @author Stephen Anthony
@version $Id: OSystemUNIX.hxx,v 1.8 2005-06-16 01:11:29 stephena Exp $ @version $Id: OSystemUNIX.hxx,v 1.9 2006-01-08 02:28:04 stephena Exp $
*/ */
class OSystemUNIX : public OSystem class OSystemUNIX : public OSystem
{ {
@ -55,6 +55,12 @@ class OSystemUNIX : public OSystem
@return Current time in microseconds. @return Current time in microseconds.
*/ */
virtual uInt32 getTicks(); virtual uInt32 getTicks();
/**
This method queries the dimensions of the screen for this hardware.
It is assumed that a UNIX SDL framebuffer is using X11.
*/
virtual void getScreenDimensions(int& width, int& height);
}; };
#endif #endif

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: OSystemWin32.cxx,v 1.7 2005-09-11 22:55:51 stephena Exp $ // $Id: OSystemWin32.cxx,v 1.8 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -128,3 +128,10 @@ uInt32 OSystemWin32::getTicks()
{ {
return (uInt32) SDL_GetTicks() * 1000; return (uInt32) SDL_GetTicks() * 1000;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemWin32::getScreenDimensions(int& width, int& height)
{
width = (int) GetSystemMetrics(SM_CXSCREEN);
height = (int) GetSystemMetrics(SM_CYSCREEN);
}

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: OSystemWin32.hxx,v 1.4 2005-06-16 01:11:29 stephena Exp $ // $Id: OSystemWin32.hxx,v 1.5 2006-01-08 02:28:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_WIN32_HXX #ifndef OSYSTEM_WIN32_HXX
@ -21,12 +21,11 @@
#include "bspf.hxx" #include "bspf.hxx"
/** /**
This class defines Windows system specific settings. This class defines Windows system specific settings.
@author Stephen Anthony @author Stephen Anthony
@version $Id: OSystemWin32.hxx,v 1.4 2005-06-16 01:11:29 stephena Exp $ @version $Id: OSystemWin32.hxx,v 1.5 2006-01-08 02:28:04 stephena Exp $
*/ */
class OSystemWin32 : public OSystem class OSystemWin32 : public OSystem
{ {
@ -55,6 +54,11 @@ class OSystemWin32 : public OSystem
@return Current time in microseconds. @return Current time in microseconds.
*/ */
virtual uInt32 getTicks(); virtual uInt32 getTicks();
/**
This method queries the dimensions of the screen for this hardware.
*/
virtual void getScreenDimensions(int& width, int& height);
}; };
#endif #endif