mirror of https://github.com/stella-emu/stella.git
Added PSP Stella port by David Voswinkel. Hope I didn't break
anything. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@745 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
374a2a1bb9
commit
fb749d3325
|
@ -13,7 +13,7 @@
|
|||
## See the file "license" for information on usage and redistribution of
|
||||
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
##
|
||||
## $Id: Makefile,v 1.6 2005-07-01 13:59:40 stephena Exp $
|
||||
## $Id: Makefile,v 1.7 2005-08-25 15:19:17 stephena Exp $
|
||||
##
|
||||
## Based on code from ScummVM - Scumm Interpreter
|
||||
## Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -109,7 +109,7 @@ DEPFILES =
|
|||
|
||||
# The build rule for the Stella executable
|
||||
$(EXECUTABLE): $(OBJS)
|
||||
$(CXX) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) -o $@
|
||||
$(LD) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) -o $@
|
||||
|
||||
distclean: clean
|
||||
$(RM_REC) $(DEPDIRS)
|
||||
|
@ -248,5 +248,39 @@ win32dist: scummvm$(EXEEXT)
|
|||
cp /usr/local/bin/SDL.dll $(WIN32PATH)
|
||||
u2d $(WIN32PATH)/*.txt
|
||||
|
||||
# Special target to create psp stuff
|
||||
psp-package: $(EXECUTABLE)
|
||||
$(MKSFO) 'Stella' PARAM.SFO
|
||||
mkdir -p "psp/stella"
|
||||
$(PSP-STRIP) stella.elf -o psp/stella/EBOOT.PBP
|
||||
mkdir -p "psp/stella%"
|
||||
$(PACK-PBP) "psp/stella%/EBOOT.PBP" PARAM.SFO src/psp/data/ICON0.PNG NULL NULL src/psp/data/PIC1.PNG NULL NULL NULL
|
||||
rm -f PARAM.SFO
|
||||
|
||||
psp-upload: psp-package
|
||||
mount | grep $(PSP-MOUNTPOINT) || mount $(PSP-MOUNTPOINT)
|
||||
cp -rv "psp/stella" "psp/stella%" $(PSP-MOUNTPOINT)/psp/game/
|
||||
umount $(PSP-MOUNTPOINT)
|
||||
|
||||
psp-debug:
|
||||
mount | grep \$(PSP-MOUNTPOINT) || mount $(PSP-MOUNTPOINT)
|
||||
@cat $(PSP-MOUNTPOINT)/stderr.txt
|
||||
@echo -e "\n\n------------------------------------------------------------"
|
||||
@cat $(PSP-MOUNTPOINT)/stdout.txt
|
||||
umount $(PSP-MOUNTPOINT)
|
||||
|
||||
psp-cleanup:
|
||||
rm -rf psp
|
||||
mount | grep $(PSP-MOUNTPOINT) || mount $(PSP-MOUNTPOINT)
|
||||
rm -rf $(PSP-MOUNTPOINT)/std*
|
||||
umount $(PSP-MOUNTPOINT)
|
||||
|
||||
psp-layout:
|
||||
mount | grep $(PSP-MOUNTPOINT) || mount $(PSP-MOUNTPOINT)
|
||||
mkdir -p $(PSP-MOUNTPOINT)/stella/roms
|
||||
mkdir -p $(PSP-MOUNTPOINT)/stella/snapshots
|
||||
cp -v src/psp/data/stellarc.psp $(PSP-MOUNTPOINT)/stella/stellarc
|
||||
umount $(PSP-MOUNTPOINT)
|
||||
|
||||
|
||||
.PHONY: deb bundle test osxsnap win32dist dist install uninstall
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
STELLA port for the Sony PSP contributed by
|
||||
David Voswinekl <david@optixx.org>
|
||||
|
||||
|
||||
Building
|
||||
--------
|
||||
To build for the PSP, make sure psp-config is in the path and run:
|
||||
|
||||
./configure --host=psp
|
||||
make
|
||||
make psp-upload
|
||||
make psp-layout
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
o psp-toolchain
|
||||
o pspsdk
|
||||
o libsdl
|
||||
o libpng
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
Video - Support for scaled software mode and framebuffer hardware mode
|
||||
Audio - Working
|
||||
Input - Mouse emulation via Joystick
|
||||
Snapshot - Working
|
||||
Lauchner - Working
|
||||
Menu - Working
|
||||
Debugger - Not useable
|
||||
|
||||
|
||||
Keymap
|
||||
------
|
||||
|
||||
Menu
|
||||
Cross - Left Mouse Button
|
||||
Circle - Right Mouse Button
|
||||
|
||||
|
||||
Emulation
|
||||
Cross - Fire
|
||||
Circle - Snapshot
|
||||
Square - toggle PAL/NTSC
|
||||
Triangle - Pause
|
||||
Select - toggle Menu
|
||||
Start - back to Launcher
|
||||
|
||||
|
||||
Known Bugs
|
||||
----------
|
||||
o SDL video driver is in early stage, so expect flickering and update problems
|
||||
o Stella will only compile/run with lastest sdl, pspskd and toolchain.
|
||||
o Stella will crash if SDL is compiled with --disable-stdio-redirect.
|
||||
Also you need a custom libSDLmain which has a debugHandler for stdout.
|
||||
|
|
@ -112,15 +112,19 @@ find_sdlconfig()
|
|||
_sdlconfig=
|
||||
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
|
||||
|
||||
done=0
|
||||
for path_dir in $_sdlpath; do
|
||||
for sdlconfig in $sdlconfigs; do
|
||||
if test -x "$path_dir/$sdlconfig" ; then
|
||||
_sdlconfig="$path_dir/$sdlconfig"
|
||||
echo $_sdlconfig
|
||||
done=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test $done -eq 1 ; then
|
||||
echo $_sdlconfig
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
IFS="$ac_save_ifs"
|
||||
|
@ -341,6 +345,14 @@ ppc-amigaos)
|
|||
_host_os=amigaos
|
||||
_host_cpu=ppc
|
||||
;;
|
||||
psp)
|
||||
_host_os=psp
|
||||
_host_cpu=mips
|
||||
_png=yes
|
||||
# force psp sdl path
|
||||
_sdlpath=$(psp-config --pspdev-path)/psp/bin:$_sdlpath
|
||||
PATH=$(psp-config --pspdev-path)/psp/bin:$(psp-config --pspdev-path)/bin:$PATH
|
||||
;;
|
||||
*)
|
||||
guessed_host=`$_srcdir/config.guess`
|
||||
_host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
|
@ -359,6 +371,9 @@ mingw* | cygwin*)
|
|||
arm-riscos-aof)
|
||||
EXEEXT=",ff8"
|
||||
;;
|
||||
psp)
|
||||
EXEEXT=".elf"
|
||||
;;
|
||||
*)
|
||||
EXEEXT=""
|
||||
;;
|
||||
|
@ -375,6 +390,11 @@ else
|
|||
fi
|
||||
|
||||
CXX=
|
||||
if [ "$_host" = "psp" ] ; then
|
||||
compilers="$CXX psp-g++ psp-c++"
|
||||
CXX="psp-c++"
|
||||
fi
|
||||
|
||||
for compiler in $compilers; do
|
||||
if test_compiler $compiler; then
|
||||
CXX=$compiler
|
||||
|
@ -392,7 +412,7 @@ fi
|
|||
|
||||
echocheck "compiler version"
|
||||
|
||||
cxx_name=`( $cc -v ) 2>&1 | tail -1 | cut -d ' ' -f 1`
|
||||
cxx_name=`( $cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1`
|
||||
cxx_version=`( $CXX -dumpversion ) 2>&1`
|
||||
if test "$?" -gt 0; then
|
||||
cxx_version="not found"
|
||||
|
@ -466,6 +486,8 @@ if test -n "$_host"; then
|
|||
CXXFLAGS="$CFLAGS -newlib -mstrict-align -mcpu=750 -mtune=7400"
|
||||
LDFLAGS="$LDFLAGS -newlib"
|
||||
;;
|
||||
psp)
|
||||
;;
|
||||
*)
|
||||
echo "Cross-compiling to unknown target, please add your target to configure."
|
||||
exit 1
|
||||
|
@ -669,7 +691,7 @@ else
|
|||
fi
|
||||
|
||||
LIBS="$LIBS `$_sdlconfig $_sdl_conf_libs` -lz"
|
||||
|
||||
LD=$CXX
|
||||
case $_host_os in
|
||||
unix)
|
||||
DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
|
||||
|
@ -693,6 +715,33 @@ case $_host_os in
|
|||
LIBS="$LIBS -lopengl32"
|
||||
fi
|
||||
;;
|
||||
psp)
|
||||
# -O3 is need for speed
|
||||
# -G0 to avoid c++ link problems
|
||||
CXXFLAGS="-G0 -O3 -fomit-frame-pointer -funroll-loops"
|
||||
# 2 times -lc to avoid link problems. psp-gcc seems to to forget the first -lc wiile stdc++ linking
|
||||
LIBS="-L `psp-config --pspsdk-path`/lib -L`psp-config --pspsdk-path`/../lib "
|
||||
LIBS="$LIBS -lSDLmain -lSDL -lpng -lm -lpspsdk -lpspdebug -lpspgu -lpspctrl "
|
||||
LIBS="$LIBS -lpspaudio -lc -lz -lpspkernel -lpspuser -lpspge -lpspdisplay -lpsphprm -lstdc++ -lc"
|
||||
# psp compiler
|
||||
CC="psp-gcc"
|
||||
LD="psp-gcc"
|
||||
_ranlib="psp-ranlib"
|
||||
_ar="psp-ar cru"
|
||||
|
||||
MODULES="$MODULES src/psp"
|
||||
|
||||
# psp specific tool
|
||||
PSP_STRIP=`psp-config --pspdev-path`"/bin/psp-strip"
|
||||
PACK_PBP=`psp-config --pspdev-path`"/bin/pack-pbp"
|
||||
MKSFO="`psp-config --pspdev-path`/bin/mksfo"
|
||||
|
||||
# mount point of psp
|
||||
PSP_MOUNTPOINT="/mnt/psp"
|
||||
|
||||
INCLUDES="$INCLUDES -Isrc/psp -I`psp-config --pspsdk-path`/include"
|
||||
DEFINES="$DEFINES -Dmain=SDL_main -DPSP -DBSPF_PSP -DPSP_DEBUG"
|
||||
;;
|
||||
*)
|
||||
echo "WARNING: host system not currenty supported"
|
||||
exit
|
||||
|
@ -726,6 +775,7 @@ cat > config.mak << EOF
|
|||
|
||||
CXX := $CXX
|
||||
CXXFLAGS := $CXXFLAGS
|
||||
LD := $LD
|
||||
LIBS += $LIBS
|
||||
RANLIB := $_ranlib
|
||||
INSTALL := $_install
|
||||
|
@ -758,5 +808,16 @@ DEFINES += $DEFINES
|
|||
LDFLAGS += $LDFLAGS
|
||||
EOF
|
||||
|
||||
if test $_host_os = "psp" ; then
|
||||
cat >> config.mak << EOF
|
||||
|
||||
PSP-STRIP := $PSP_STRIP
|
||||
PACK-PBP := $PACK_PBP
|
||||
MKSFO := $MKSFO
|
||||
PSP-MOUNTPOINT := $PSP_MOUNTPOINT
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# This should be taken care of elsewhere, but I'm not sure where
|
||||
rm -f stella-conf*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferSoft.cxx,v 1.35 2005-08-24 01:07:36 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.36 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -98,6 +98,29 @@ bool FrameBufferSoft::createScreen()
|
|||
// In software mode, the image and screen dimensions are always the same
|
||||
myImageDim = myScreenDim;
|
||||
|
||||
#ifdef PSP
|
||||
if (myUseHardSurface)
|
||||
{
|
||||
/* double buff is broken */
|
||||
mySDLFlags = SDL_HWSURFACE;
|
||||
myScreenDim.w = myDesktopDim.w;
|
||||
myScreenDim.h = myDesktopDim.w;
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout, "FrameBufferSoft::createScreen Hardware Mode "
|
||||
"myScreenDim.w='%i' myScreenDim.h='%i'\n",
|
||||
myScreenDim.w,myScreenDim.h);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout, "FrameBufferSoft::createScreen Software Mode "
|
||||
"myScreenDim.w='%i' myScreenDim.h='%i'\n",
|
||||
myScreenDim.w,myScreenDim.h);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
myScreen = SDL_SetVideoMode(myScreenDim.w, myScreenDim.h, 0, mySDLFlags);
|
||||
if(myScreen == NULL)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Snapshot.cxx,v 1.7 2005-06-28 23:18:15 stephena Exp $
|
||||
// $Id: Snapshot.cxx,v 1.8 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
|
@ -74,6 +74,12 @@ string Snapshot::savePNG(string filename)
|
|||
uInt32 width = myFrameBuffer.imageWidth();
|
||||
uInt32 height = myFrameBuffer.imageHeight();
|
||||
|
||||
// FIXME - this should really call something like OSystem::message()
|
||||
// so we can get rid of annoying ifdefs everywhere
|
||||
#ifdef PSP
|
||||
fprintf(stdout,"ok w=%i h=%i\n",width,height);
|
||||
#endif
|
||||
|
||||
ofstream* out = new ofstream(filename.c_str(), ios_base::binary);
|
||||
if(!out)
|
||||
return "Couldn't create snapshot file";
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SoundSDL.cxx,v 1.19 2005-06-28 23:18:15 stephena Exp $
|
||||
// $Id: SoundSDL.cxx,v 1.20 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
@ -98,8 +98,14 @@ void SoundSDL::initialize(bool forcerestart)
|
|||
uInt32 fragsize = myOSystem->settings().getInt("fragsize");
|
||||
|
||||
SDL_AudioSpec desired;
|
||||
#ifndef PSP
|
||||
desired.freq = 31400;
|
||||
desired.format = AUDIO_U8;
|
||||
else
|
||||
desired.freq = 44100;
|
||||
desired.format = AUDIO_U16;
|
||||
#endif
|
||||
|
||||
desired.channels = 1;
|
||||
desired.samples = fragsize;
|
||||
desired.callback = callback;
|
||||
|
@ -138,7 +144,7 @@ void SoundSDL::initialize(bool forcerestart)
|
|||
*/
|
||||
|
||||
// Now initialize the TIASound object which will actually generate sound
|
||||
Tia_sound_init(31400, myHardwareSpec.freq);
|
||||
Tia_sound_init(desired.freq, myHardwareSpec.freq);
|
||||
|
||||
// And start the SDL sound subsystem ...
|
||||
SDL_PauseAudio(0);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: mainSDL.cxx,v 1.48 2005-06-28 04:40:21 urchlay Exp $
|
||||
// $Id: mainSDL.cxx,v 1.49 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -45,9 +45,16 @@
|
|||
#elif defined(MAC_OSX)
|
||||
#include "SettingsMACOSX.hxx"
|
||||
#include "OSystemMACOSX.hxx"
|
||||
|
||||
extern "C" {
|
||||
int stellaMain(int argc, char* argv[]);
|
||||
}
|
||||
#elif defined(PSP)
|
||||
#include "SettingsPSP.hxx"
|
||||
#include "OSystemPSP.hxx"
|
||||
extern "C" {
|
||||
int SDL_main(int argc, char* argv[]);
|
||||
}
|
||||
#else
|
||||
#error Unsupported platform!
|
||||
#endif
|
||||
|
@ -104,6 +111,8 @@ void Cleanup()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
#if defined(MAC_OSX)
|
||||
int stellaMain(int argc, char* argv[])
|
||||
#elif defined(PSP)
|
||||
int SDL_main(int argc, char* argv[])
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
#endif
|
||||
|
@ -118,9 +127,15 @@ int main(int argc, char* argv[])
|
|||
#elif defined(MAC_OSX)
|
||||
theOSystem = new OSystemMACOSX();
|
||||
SettingsMACOSX settings(theOSystem);
|
||||
#elif defined(PSP)
|
||||
fprintf(stderr,"---------------- Stderr Begins ----------------\n");
|
||||
fprintf(stdout,"---------------- Stdout Begins ----------------\n");
|
||||
theOSystem = new OSystemPSP();
|
||||
SettingsPSP settings(theOSystem);
|
||||
#else
|
||||
#error Unsupported platform!
|
||||
#endif
|
||||
|
||||
theOSystem->settings().loadConfig();
|
||||
|
||||
// Take care of commandline arguments
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventHandler.cxx,v 1.86 2005-08-24 22:54:30 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.87 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -56,7 +56,12 @@ EventHandler::EventHandler(OSystem* osystem)
|
|||
myQuitFlag(false),
|
||||
myGrabMouseFlag(false),
|
||||
myUseLauncherFlag(false),
|
||||
myPaddleMode(0)
|
||||
myPaddleMode(0),
|
||||
myMouseX(0),
|
||||
myMouseY(0),
|
||||
myLastMouseMoveX(0),
|
||||
myLastMouseMoveY(0)
|
||||
|
||||
{
|
||||
// Add this eventhandler object to the OSystem
|
||||
myOSystem->attach(this);
|
||||
|
@ -472,6 +477,7 @@ void EventHandler::poll(uInt32 time)
|
|||
break; // SDL_KEYUP, SDL_KEYDOWN
|
||||
}
|
||||
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
handleMouseMotionEvent(event);
|
||||
break; // SDL_MOUSEMOTION
|
||||
|
@ -533,14 +539,19 @@ void EventHandler::poll(uInt32 time)
|
|||
|
||||
code = event.jbutton.button;
|
||||
state = event.jbutton.state == SDL_PRESSED ? 1 : 0;
|
||||
|
||||
#ifdef PSP
|
||||
handleWarpMouseButton(code,state);
|
||||
#endif
|
||||
handleJoyEvent(stick, code, state);
|
||||
break;
|
||||
|
||||
case SDL_JOYAXISMOTION:
|
||||
axis = event.jaxis.axis;
|
||||
value = event.jaxis.value;
|
||||
|
||||
#ifdef PSP
|
||||
if (state!=S_EMULATE)
|
||||
handleMouseWarp(stick,axis,value);
|
||||
#endif
|
||||
if(axis == 0) // x-axis
|
||||
{
|
||||
handleJoyEvent(stick, kJAxisLeft, (value < -16384) ? 1 : 0);
|
||||
|
@ -807,6 +818,126 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, uInt8 state)
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::handleWarpMouseButton(uInt8 event_button, uInt8 state)
|
||||
{
|
||||
#ifdef PSP
|
||||
// Determine which mode we're in, then send the event to the appropriate place
|
||||
switch(myState)
|
||||
{
|
||||
case S_EMULATE:
|
||||
{
|
||||
/* map joypad button to sdl key events*/
|
||||
if (event_button == 11){ /*start*/
|
||||
handleKeyEvent(0,SDLK_ESCAPE,(SDLMod)0,state);
|
||||
} else if (event_button == 10){ /*select*/
|
||||
handleKeyEvent(0,SDLK_TAB,(SDLMod)0,state);
|
||||
} else if (event_button == 6){
|
||||
handleKeyEvent(0,SDLK_UP,(SDLMod)0,state);
|
||||
} else if (event_button == 8){
|
||||
handleKeyEvent(0,SDLK_DOWN,(SDLMod)0,state);
|
||||
} else if (event_button == 9){
|
||||
handleKeyEvent(0,SDLK_RIGHT,(SDLMod)0,state);
|
||||
} else if (event_button == 7){
|
||||
handleKeyEvent(0,SDLK_LEFT,(SDLMod)0,state);
|
||||
} else if (event_button == 0){ /*triangle*/
|
||||
handleKeyEvent(0,SDLK_PAUSE,(SDLMod)0,state);
|
||||
} else if (event_button == 2){ /*cross*/
|
||||
handleKeyEvent(0,SDLK_SPACE,(SDLMod)0,state);
|
||||
} else if (event_button == 1){ /*circle*/
|
||||
handleKeyEvent(0,SDLK_F12,(SDLMod)0,state);
|
||||
} else if (event_button == 3 && state){ /*square*/
|
||||
myOSystem->console().toggleFormat();
|
||||
} else if (event_button == 4){ /*left trigger*/
|
||||
handleKeyEvent(0,SDLK_F11,(SDLMod)0,state);
|
||||
} else if (event_button == 5){ /*right trigger*/
|
||||
handleKeyEvent(0,SDLK_F9,(SDLMod)0,state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case S_MENU:
|
||||
case S_LAUNCHER:
|
||||
case S_DEBUGGER:
|
||||
{
|
||||
/* map up and down buttions to sdl events */
|
||||
if (event_button == 8){
|
||||
handleKeyEvent(0,SDLK_UP,(SDLMod)0,state);
|
||||
break;
|
||||
} else if (event_button == 6){
|
||||
handleKeyEvent(0,SDLK_DOWN,(SDLMod)0,state);
|
||||
break;
|
||||
}
|
||||
Int32 x = myMouseX;
|
||||
Int32 y = myMouseY;
|
||||
myOSystem->frameBuffer().translateCoords(&x, &y);
|
||||
MouseButton button;
|
||||
|
||||
/* enable 'select' button */
|
||||
if (event_button == 10 && state){
|
||||
handleKeyEvent(0,SDLK_TAB,(SDLMod)0,state);
|
||||
break;
|
||||
}
|
||||
/* map the buttons to sdl mouse buttton events*/
|
||||
if(state)
|
||||
{
|
||||
if(event_button == 2)
|
||||
button = EVENT_LBUTTONDOWN;
|
||||
else if(event_button == 1)
|
||||
button = EVENT_RBUTTONDOWN;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(event_button == 2)
|
||||
button = EVENT_LBUTTONUP;
|
||||
else if(event_button == 1)
|
||||
button = EVENT_RBUTTONUP;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(myState == S_MENU)
|
||||
myOSystem->menu().handleMouseButtonEvent(button, x, y, state);
|
||||
else if(myState == S_LAUNCHER)
|
||||
myOSystem->launcher().handleMouseButtonEvent(button, x, y, state);
|
||||
else
|
||||
myOSystem->debugger().handleMouseButtonEvent(button, x, y, state);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::handleMouseWarp(uInt8 stick,uInt8 axis,Int16 value)
|
||||
{
|
||||
#ifdef PSP
|
||||
Int32 new_x = myMouseX;
|
||||
Int32 new_y = myMouseY;
|
||||
value = value / 4000;
|
||||
if (axis == 0)
|
||||
{
|
||||
myLastMouseMoveX = value;
|
||||
}
|
||||
else if (axis == 1)
|
||||
{
|
||||
myLastMouseMoveY = value;
|
||||
}
|
||||
new_x += myLastMouseMoveX;
|
||||
new_y += myLastMouseMoveY;
|
||||
|
||||
if (new_x >=0 and new_x <= PSP_SCREEN_WIDTH)
|
||||
myMouseX = new_x;
|
||||
if (new_y >=0 and new_y <= PSP_SCREEN_HEIGHT)
|
||||
myMouseY = new_y;
|
||||
SDL_WarpMouse(myMouseX,myMouseY);
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::handleJoyEvent(uInt8 stick, uInt32 code, uInt8 state)
|
||||
|
@ -1293,17 +1424,22 @@ void EventHandler::loadState(int state)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::takeSnapshot()
|
||||
{
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"EventHandler::takeSnapshot\n");
|
||||
#endif
|
||||
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
// Figure out the correct snapshot name
|
||||
string filename;
|
||||
string sspath = myOSystem->settings().getString("ssdir");
|
||||
string ssname = myOSystem->settings().getString("ssname");
|
||||
|
||||
char separator = ssname[ssname.length()-1] != '/' ? BSPF_PATH_SEPARATOR : '';
|
||||
if(ssname == "romname")
|
||||
sspath = sspath + BSPF_PATH_SEPARATOR +
|
||||
sspath = sspath + separator +
|
||||
myOSystem->console().properties().get("Cartridge.Name");
|
||||
else if(ssname == "md5sum")
|
||||
sspath = sspath + BSPF_PATH_SEPARATOR +
|
||||
sspath = sspath + separator +
|
||||
myOSystem->console().properties().get("Cartridge.MD5");
|
||||
|
||||
// Check whether we want multiple snapshots created
|
||||
|
@ -1319,6 +1455,9 @@ void EventHandler::takeSnapshot()
|
|||
{
|
||||
buf.str("");
|
||||
buf << sspath << "_" << i << ".png";
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"EventHandler::takeSnapshot '%s'\n",buf.str().c_str());
|
||||
#endif
|
||||
if(!FilesystemNode::fileExists(buf.str()))
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventHandler.hxx,v 1.45 2005-08-11 19:12:38 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.46 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -74,7 +74,7 @@ struct Stella_Joystick {
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.45 2005-08-11 19:12:38 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.46 2005-08-25 15:19:17 stephena Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -279,6 +279,8 @@ class EventHandler
|
|||
@param state state of code (pressed/released)
|
||||
*/
|
||||
void handleJoyEvent(uInt8 stick, uInt32 code, uInt8 state);
|
||||
void handleMouseWarp(uInt8 stick, uInt8 axis, Int16 value);
|
||||
void handleWarpMouseButton(uInt8 event_button, uInt8 state);
|
||||
|
||||
/**
|
||||
The following methods take care of assigning action mappings.
|
||||
|
@ -350,6 +352,11 @@ class EventHandler
|
|||
|
||||
// The current joymap in string form
|
||||
string myJoymapString;
|
||||
|
||||
Int32 myMouseX;
|
||||
Int32 myMouseY;
|
||||
Int32 myLastMouseMoveX;
|
||||
Int32 myLastMouseMoveY;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBuffer.cxx,v 1.64 2005-08-25 01:20:11 markgrebe Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.65 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -35,8 +35,10 @@
|
|||
#include "Debugger.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef MAC_OSX
|
||||
#if defined(MAC_OSX)
|
||||
#include "macOSXDisplay.h"
|
||||
#elif defined(PSP)
|
||||
#include "DisplayPSP.hxx"
|
||||
#endif
|
||||
|
||||
#include "stella.xpm" // The Stella icon
|
||||
|
@ -85,15 +87,12 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
|||
}
|
||||
|
||||
// Calculate the desktop size
|
||||
// This is really the job of SDL
|
||||
myDesktopDim.w = myDesktopDim.h = 0;
|
||||
|
||||
// Get the system-specific WM information
|
||||
#if defined(UNIX)
|
||||
SDL_SysWMinfo myWMInfo;
|
||||
SDL_VERSION(&myWMInfo.version);
|
||||
if(SDL_GetWMInfo(&myWMInfo) > 0)
|
||||
{
|
||||
#if defined(UNIX)
|
||||
if(myWMInfo.subsystem == SDL_SYSWM_X11)
|
||||
if(SDL_GetWMInfo(&myWMInfo) > 0 && myWMInfo.subsystem == SDL_SYSWM_X11)
|
||||
{
|
||||
myWMInfo.info.x11.lock_func();
|
||||
myDesktopDim.w = DisplayWidth(myWMInfo.info.x11.display,
|
||||
|
@ -105,11 +104,12 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
|||
#elif defined(WIN32)
|
||||
myDesktopDim.w = (uInt16) GetSystemMetrics(SM_CXSCREEN);
|
||||
myDesktopDim.h = (uInt16) GetSystemMetrics(SM_CYSCREEN);
|
||||
#endif
|
||||
}
|
||||
#if defined(MAC_OSX)
|
||||
#elif defined(MAC_OSX)
|
||||
myDesktopDim.w = macOSXDisplayWidth();
|
||||
myDesktopDim.h = macOSXDisplayHeight();
|
||||
#elif defined(PSP)
|
||||
myDesktopDim.w = PSP_SCREEN_WIDTH;
|
||||
myDesktopDim.h = PSP_SCREEN_HEIGHT;
|
||||
#endif
|
||||
|
||||
// Set fullscreen flag
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OSystem.cxx,v 1.32 2005-08-24 22:54:30 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.33 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -187,7 +187,6 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
|
||||
// And recreate a new one
|
||||
string video = mySettings->getString("video");
|
||||
cout << " ==> video: " << video << endl;
|
||||
|
||||
if(video == "soft")
|
||||
myFrameBuffer = new FrameBufferSoft(this);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Settings.cxx,v 1.55 2005-08-24 01:07:36 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.56 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -84,6 +84,11 @@ void Settings::loadConfig()
|
|||
string line, key, value;
|
||||
string::size_type equalPos, garbage;
|
||||
|
||||
// FIXME - add infrastructure to print output
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"Settings::loadConfig '%s'\n",myOSystem->configInputFilename().c_str());
|
||||
#endif
|
||||
|
||||
ifstream in(myOSystem->configInputFilename().c_str());
|
||||
if(!in || !in.is_open())
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: bspf.hxx,v 1.8 2005-07-20 17:49:26 stephena Exp $
|
||||
// $Id: bspf.hxx,v 1.9 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef BSPF_HXX
|
||||
|
@ -24,7 +24,7 @@
|
|||
that need to be defined for different operating systems.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: bspf.hxx,v 1.8 2005-07-20 17:49:26 stephena Exp $
|
||||
@version $Id: bspf.hxx,v 1.9 2005-08-25 15:19:17 stephena Exp $
|
||||
*/
|
||||
|
||||
// Types for 8-bit signed and unsigned integers
|
||||
|
@ -52,6 +52,10 @@ typedef unsigned int uInt32;
|
|||
using namespace std;
|
||||
#endif
|
||||
|
||||
#ifdef PSP
|
||||
#include "pspstdint.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
@ -63,6 +67,8 @@ typedef unsigned int uInt32;
|
|||
#define BSPF_PATH_SEPARATOR "\\"
|
||||
#elif defined BSPF_MAC_OSX
|
||||
#define BSPF_PATH_SEPARATOR "/"
|
||||
#elif defined BSPF_PSP
|
||||
#define BSPF_PATH_SEPARATOR "/"
|
||||
#endif
|
||||
|
||||
// I wish Windows had a complete POSIX layer
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: AboutDialog.cxx,v 1.6 2005-08-11 21:57:30 stephena Exp $
|
||||
// $Id: AboutDialog.cxx,v 1.7 2005-08-25 15:19:17 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -111,6 +111,8 @@ void AboutDialog::updateStrings(int page, int lines, string& title, string* &dsc
|
|||
ADD_ATEXT("\\L\\c2"" Original author for OS/2 port");
|
||||
ADD_ATEXT("\\L\\c0"" Doodle");
|
||||
ADD_ATEXT("\\L\\c2"" Current maintainer for OS/2 port");
|
||||
ADD_ATEXT("\\L\\c0"" David Voswinkel");
|
||||
ADD_ATEXT("\\L\\c2"" Maintainer for PSP port");
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: VideoDialog.cxx,v 1.22 2005-08-24 01:07:36 stephena Exp $
|
||||
// $Id: VideoDialog.cxx,v 1.23 2005-08-25 15:19:17 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -171,7 +171,6 @@ void VideoDialog::loadConfig()
|
|||
|
||||
// Renderer setting
|
||||
s = instance()->settings().getString("video");
|
||||
cout << " ==> video: " << s << endl;
|
||||
if(s == "soft")
|
||||
myRendererPopup->setSelectedTag(1);
|
||||
else if(s == "hard")
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
|
@ -0,0 +1,285 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: FSNodePSP.cxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "FSNode.hxx"
|
||||
|
||||
#include <pspdebug.h>
|
||||
#include <pspiofilemgr.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
|
||||
/*
|
||||
* Implementation of the Stella file system API based on POSIX for PSP
|
||||
*/
|
||||
|
||||
class PSPFilesystemNode : public AbstractFilesystemNode
|
||||
{
|
||||
public:
|
||||
PSPFilesystemNode();
|
||||
PSPFilesystemNode(const string& path);
|
||||
PSPFilesystemNode(const PSPFilesystemNode* 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;
|
||||
static void stripTailingSlashes(char * buf);
|
||||
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 void stripTailingSlashes(char * buf)
|
||||
{
|
||||
char * ptr;
|
||||
ptr = buf + strlen(buf)-1;
|
||||
while(*(ptr)=='/') *(ptr--)='\0';
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static string validatePath(const string& p)
|
||||
{
|
||||
string path = p;
|
||||
if(p.size() <= 0 || p[0] == '/')
|
||||
path = "ms0:/";
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getRoot()
|
||||
{
|
||||
return new PSPFilesystemNode();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getNodeForPath(const string& path)
|
||||
{
|
||||
return new PSPFilesystemNode(validatePath(path));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PSPFilesystemNode::PSPFilesystemNode()
|
||||
{
|
||||
const char buf[] = "ms0:/stella/";
|
||||
_path = buf;
|
||||
_displayName = string("stella");
|
||||
_isValid = true;
|
||||
_isDirectory = true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PSPFilesystemNode::PSPFilesystemNode(const string& p)
|
||||
{
|
||||
string path = validatePath(p);
|
||||
|
||||
Int32 len = 0, offset = path.size();
|
||||
SceIoStat 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);
|
||||
_isValid = (0 == sceIoGetstat(_path.c_str(), &st));
|
||||
_isDirectory = FIO_S_ISDIR(st.st_mode);
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PSPFilesystemNode::PSPFilesystemNode(const PSPFilesystemNode* node)
|
||||
{
|
||||
_displayName = node->_displayName;
|
||||
_isValid = node->_isValid;
|
||||
_isDirectory = node->_isDirectory;
|
||||
_path = node->_path;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FSList PSPFilesystemNode::listDir(ListMode mode) const
|
||||
{
|
||||
// assert(_isDirectory);
|
||||
FSList myList;
|
||||
SceUID dfd = sceIoDopen (_path.c_str());
|
||||
SceIoDirent *dp;
|
||||
dp = (SceIoDirent*)malloc(sizeof(SceIoDirent));
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"PSPFilesystemNode::listDir: dir='%s'\n",_path.c_str());
|
||||
#endif
|
||||
|
||||
if (!dfd){
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"PSPFilesystemNode::listDir: no dir handle\n");
|
||||
#endif
|
||||
return myList;
|
||||
}
|
||||
|
||||
while (sceIoDread(dfd,dp) > 0){
|
||||
|
||||
if (dp->d_name[0]=='.')
|
||||
continue;
|
||||
|
||||
PSPFilesystemNode 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;
|
||||
entry._isDirectory = dp->d_stat.st_attr & FIO_SO_IFDIR;
|
||||
|
||||
// Honor the chosen mode
|
||||
if ((mode == kListFilesOnly && entry._isDirectory) ||
|
||||
(mode == kListDirectoriesOnly && !entry._isDirectory))
|
||||
continue;
|
||||
|
||||
if (entry._isDirectory)
|
||||
entry._path += "/";
|
||||
|
||||
myList.push_back(wrap(new PSPFilesystemNode(&entry)));
|
||||
}
|
||||
sceIoDclose(dfd);
|
||||
free(dp);
|
||||
return myList;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode *PSPFilesystemNode::parent() const
|
||||
{
|
||||
if (_path == "/")
|
||||
return 0;
|
||||
|
||||
PSPFilesystemNode* p = new PSPFilesystemNode();
|
||||
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)
|
||||
{
|
||||
SceIoStat st;
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::fileExists '%s'\n",path.c_str());
|
||||
#endif
|
||||
if(sceIoGetstat(path.c_str(), &st) != 0){
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::fileExists error \n");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::fileExists return '%i'\n", !FIO_SO_ISREG(st.st_mode));
|
||||
#endif
|
||||
return !FIO_SO_ISREG(st.st_mode);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool AbstractFilesystemNode::dirExists(const string& in)
|
||||
{
|
||||
char tmp_buf[1024];
|
||||
strncpy(tmp_buf,in.c_str(),1023);
|
||||
stripTailingSlashes(tmp_buf);
|
||||
string path = (char*)tmp_buf;
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::dirExists '%s'\n", path.c_str());
|
||||
#endif
|
||||
SceIoStat st;
|
||||
if(sceIoGetstat(path.c_str(), &st) != 0)
|
||||
return false;
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::dirExists return '%i'\n", !FIO_SO_ISDIR(st.st_mode));
|
||||
#endif
|
||||
return !FIO_SO_ISDIR(st.st_mode);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool AbstractFilesystemNode::makeDir(const string& path)
|
||||
{
|
||||
return sceIoMkdir(path.c_str(), 0777) == 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string AbstractFilesystemNode::modTime(const string& in)
|
||||
{
|
||||
char tmp_buf[1024];
|
||||
strncpy(tmp_buf,in.c_str(),1023);
|
||||
stripTailingSlashes(tmp_buf);
|
||||
string path = (char*)tmp_buf;
|
||||
SceIoStat st;
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::modTime '%s'\n",path.c_str());
|
||||
#endif
|
||||
|
||||
if(sceIoGetstat(path.c_str(), &st) < 0){
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::modTime returns error\n");
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
ostringstream buf;
|
||||
buf << (unsigned short)st.st_mtime.year
|
||||
<< (unsigned short)st.st_mtime.month
|
||||
<< (unsigned short)st.st_mtime.day
|
||||
<< (unsigned short)st.st_mtime.hour
|
||||
<< (unsigned short)st.st_mtime.minute
|
||||
<< (unsigned short)st.st_mtime.second;
|
||||
|
||||
#ifdef PSP_DEBUG
|
||||
fprintf(stdout,"AbstractFilesystemNode::modTime returns '%s'\n",buf.str().c_str());
|
||||
#endif
|
||||
return buf.str();
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: OSystemPSP.cxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "OSystemPSP.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()
|
||||
setPropertiesFiles()
|
||||
setConfigFiles()
|
||||
setCacheFile()
|
||||
|
||||
And for initializing the following variables:
|
||||
|
||||
myDriverList (a StringList)
|
||||
|
||||
See OSystem.hxx for a further explanation
|
||||
*/
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemPSP::OSystemPSP()
|
||||
{
|
||||
// First set variables that the OSystem needs
|
||||
string basedir = string("ms0:/stella");
|
||||
setBaseDir(basedir);
|
||||
|
||||
string statedir = basedir + "/state";
|
||||
setStateDir(statedir);
|
||||
|
||||
string userPropertiesFile = basedir + "/stella.pro";
|
||||
string systemPropertiesFile = "/etc/stella.pro";
|
||||
setPropertiesFiles(userPropertiesFile, systemPropertiesFile);
|
||||
|
||||
string userConfigFile = basedir + "/stellarc";
|
||||
string systemConfigFile = "/etc/stellarc";
|
||||
setConfigFiles(userConfigFile, systemConfigFile);
|
||||
|
||||
string cacheFile = basedir + "/stella.cache";
|
||||
setCacheFile(cacheFile);
|
||||
|
||||
// No drivers are specified for Unix
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemPSP::~OSystemPSP()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystemPSP::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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 OSystemPSP::getTicks()
|
||||
{
|
||||
#if defined(HAVE_GETTIMEOFDAY)
|
||||
timeval now;
|
||||
gettimeofday(&now, 0);
|
||||
return (uInt32) (now.tv_sec * 1000000 + now.tv_usec);
|
||||
#else
|
||||
return (uInt32) SDL_GetTicks() * 1000;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: OSystemPSP.hxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_PSP_HXX
|
||||
#define OSYSTEM_PSP_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
|
||||
/**
|
||||
This class defines PSP-like OS's (Linux) system specific settings.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystemPSP.hxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
*/
|
||||
class OSystemPSP : public OSystem
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create a new PSP-specific operating system object
|
||||
*/
|
||||
OSystemPSP();
|
||||
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
virtual ~OSystemPSP();
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,39 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: SettingsPSP.cxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsPSP.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsPSP::SettingsPSP(OSystem* osystem)
|
||||
: Settings(osystem)
|
||||
{
|
||||
set("accurate", "false");
|
||||
set("zoom", "1");
|
||||
set("romdir", "ms0:/stella/roms/");
|
||||
set("ssdir", "ms0:/stella/snapshots/");
|
||||
set("grabmouse", "1");
|
||||
set("sound", "true");
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsPSP::~SettingsPSP()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: SettingsPSP.hxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_PSP_HXX
|
||||
#define SETTINGS_PSP_HXX
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
/**
|
||||
This class defines PSP-like OS's (Linux) system specific settings.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: SettingsPSP.hxx,v 1.1 2005-08-25 15:19:17 stephena Exp $
|
||||
*/
|
||||
class SettingsPSP : public Settings
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create a new PSP settings object
|
||||
*/
|
||||
SettingsPSP(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
virtual ~SettingsPSP();
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 153 KiB |
|
@ -0,0 +1,40 @@
|
|||
; Stella configuration file
|
||||
;
|
||||
; Lines starting with ';' are comments and are ignored.
|
||||
; Spaces and tabs are ignored.
|
||||
;
|
||||
; Format MUST be as follows:
|
||||
; command = value
|
||||
;
|
||||
; Commmands are the same as those specified on the commandline,
|
||||
; without the '-' character.
|
||||
;
|
||||
; Values are the same as those allowed on the commandline.
|
||||
; Boolean values are specified as 1 (or true) and 0 (or false)
|
||||
;
|
||||
video = soft
|
||||
video_driver =
|
||||
gl_filter = nearest
|
||||
gl_aspect = 2.0
|
||||
gl_fsmax = false
|
||||
zoom = 1
|
||||
fullscreen = false
|
||||
grabmouse = 1
|
||||
center = true
|
||||
palette = standard
|
||||
debugheight = 20
|
||||
sound = 1
|
||||
fragsize = 1024
|
||||
volume = 100
|
||||
keymap = 0:0:0:0:0:0:0:0:74:71:0:0:0:0:0:0:0:0:0:69:0:0:0:0:0:0:0:73:0:0:0:0:15:0:0:0:0:0:0:0:0:0:0:0:54:0:55:56:47:33:34:35:21:22:23:24:45:46:0:53:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:72:39:0:44:41:38:20:18:17:48:19:51:52:0:0:49:50:36:0:40:0:0:0:37:43:16:42:0:0:0:0:62:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:11:12:14:13:58:60:64:57:61:9:10:3:4:5:6:7:8:67:65:66:68:0:0:0:0:0:0:0:0:0:0:0:0:15:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
|
||||
joymap = 15:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:11:12:13:14:20:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:16:17:18:19:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:
|
||||
paddle = 0
|
||||
showinfo = false
|
||||
ssdir = ms0:/stella/snapshots/
|
||||
ssname = romname
|
||||
sssingle = false
|
||||
romdir = ms0:/stella/roms/
|
||||
lastrom =
|
||||
modtime = 2005820191330
|
||||
accurate = false
|
||||
break =
|
|
@ -0,0 +1,12 @@
|
|||
MODULE := src/psp
|
||||
|
||||
MODULE_OBJS := \
|
||||
src/psp/FSNodePSP.o \
|
||||
src/psp/OSystemPSP.o \
|
||||
src/psp/SettingsPSP.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/psp
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/common.rules
|
|
@ -0,0 +1,175 @@
|
|||
/* SCE CONFIDENTIAL
|
||||
PSP(TM) Programmer Tool Runtime Library Release 1.5.0
|
||||
*
|
||||
* Copyright (C) 2005 Sony Computer Entertainment Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* PSP(TM) integer types
|
||||
*
|
||||
* pspstdint.h
|
||||
*
|
||||
* Version Date Design Log
|
||||
* --------------------------------------------------------------------
|
||||
* 0.00 2005-01-19 kono the first version
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SCE_PSPSTDINT_H
|
||||
#define _SCE_PSPSTDINT_H
|
||||
|
||||
/* Exact-width integer types */
|
||||
#ifndef _SCE_PSPSTDINT_int8_t_DEFINED
|
||||
#define _SCE_PSPSTDINT_int8_t_DEFINED
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#if defined(__GNUC__)
|
||||
__extension__ typedef long long int64_t __attribute__((mode(DI)));
|
||||
__extension__ typedef unsigned long long uint64_t __attribute__((mode(DI)));
|
||||
#else /* defined(__GNUC__) */
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif /* defined(__GNUC__) */
|
||||
#endif /* _SCE_PSPSTDINT_int8_t_DEFINED */
|
||||
|
||||
|
||||
/* Minimum-width integer types */
|
||||
#ifndef _SCE_PSPSTDINT_int_least8_t_DEFINED
|
||||
#define _SCE_PSPSTDINT_int_least8_t_DEFINED
|
||||
typedef signed char int_least8_t;
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef short int_least16_t;
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef int int_least32_t;
|
||||
typedef unsigned int uint_least32_t;
|
||||
#if defined(__GNUC__)
|
||||
__extension__ typedef long long int_least64_t __attribute__((mode(DI)));
|
||||
__extension__ typedef unsigned long long uint_least64_t __attribute__((mode(DI)));
|
||||
#else /* defined(__GNUC__) */
|
||||
typedef long long int_least64_t;
|
||||
typedef unsigned long long uint_least64_t;
|
||||
#endif /* defined(__GNUC__) */
|
||||
#endif /* _SCE_PSPSTDINT_int_least8_t_DEFINED */
|
||||
|
||||
|
||||
/* Fastest minimum-width integer types */
|
||||
#ifndef _SCE_PSPSTDINT_int_fast8_t_DEFINED
|
||||
#define _SCE_PSPSTDINT_int_fast8_t_DEFINED
|
||||
typedef char int_fast8_t;
|
||||
typedef unsigned char uint_fast8_t;
|
||||
typedef int int_fast16_t;
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef int int_fast32_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
#if defined(__GNUC__)
|
||||
__extension__ typedef long long int_fast64_t __attribute__((mode(DI)));
|
||||
__extension__ typedef unsigned long long uint_fast64_t __attribute__((mode(DI)));
|
||||
#else /* defined(__GNUC__) */
|
||||
typedef long long int_fast64_t;
|
||||
typedef unsigned long long uint_fast64_t;
|
||||
#endif /* defined(__GNUC__) */
|
||||
#endif /* _SCE_PSPSTDINT_int_fast8_t_DEFINED */
|
||||
|
||||
|
||||
/* Integer types capable of holding object pointers */
|
||||
#ifndef _SCE_PSPSTDINT_intptr_t_DEFINED
|
||||
#define _SCE_PSPSTDINT_intptr_t_DEFINED
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif /* _SCE_PSPSTDINT_intptr_t_DEFINED */
|
||||
|
||||
|
||||
/* Gereat-width integer types */
|
||||
#ifndef _SCE_PSPSTDINT_intmax_t_DEFINED
|
||||
#define _SCE_PSPSTDINT_intmax_t_DEFINED
|
||||
#if defined(__GNUC__)
|
||||
typedef long long intmax_t __attribute__((mode(DI)));
|
||||
typedef unsigned long long uintmax_t __attribute__((mode(DI)));
|
||||
#else /* defined(__GNUC__) */
|
||||
typedef long long intmax_t;
|
||||
typedef unsigned long long uintmax_t;
|
||||
#endif /* defined(__GNUC__) */
|
||||
#endif /* _SCE_PSPSTDINT_intmax_t_DEFINED */
|
||||
|
||||
|
||||
/* Limits of specified-width intger types */
|
||||
#if (!(defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)))||defined(__STDC_CONSTANT_MACROS)
|
||||
|
||||
/* Limits of exact-width integer types */
|
||||
#define INT8_MIN (-128)
|
||||
#define INT16_MIN (-32767-1)
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#define INT64_MIN (-9223372036854775807LL-1)
|
||||
#define INT8_MAX (127)
|
||||
#define INT16_MAX (32767)
|
||||
#define INT32_MAX (2147483647)
|
||||
#define INT64_MAX (9223372036854775807LL)
|
||||
#define UINT8_MAX (255)
|
||||
#define UINT16_MAX (65535)
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#define UINT64_MAX (18446744073709551615ULL)
|
||||
|
||||
/* Limits of minimum-width integer types */
|
||||
#define INT_LEAST8_MIN (-128)
|
||||
#define INT_LEAST16_MIN (-32767-1)
|
||||
#define INT_LEAST32_MIN (-2147483647-1)
|
||||
#define INT_LEAST64_MIN (-9223372036854775807LL-1)
|
||||
#define INT_LEAST8_MAX (127)
|
||||
#define INT_LEAST16_MAX (32767)
|
||||
#define INT_LEAST32_MAX (2147483647)
|
||||
#define INT_LEAST64_MAX (9223372036854775807LL)
|
||||
#define UINT_LEAST8_MAX (255)
|
||||
#define UINT_LEAST16_MAX (65535)
|
||||
#define UINT_LEAST32_MAX (4294967295U)
|
||||
#define UINT_LEAST64_MAX (18446744073709551615ULL)
|
||||
|
||||
/* Limits of fastest minimum-width integer types */
|
||||
#define INT_FAST8_MIN (-128)
|
||||
#define INT_FAST16_MIN (-2147483647-1)
|
||||
#define INT_FAST32_MIN (-2147483647-1)
|
||||
#define INT_FAST64_MIN (-9223372036854775807LL-1)
|
||||
#define INT_FAST8_MAX (127)
|
||||
#define INT_FAST16_MAX (2147483647)
|
||||
#define INT_FAST32_MAX (2147483647)
|
||||
#define INT_FAST64_MAX (9223372036854775807LL)
|
||||
#define UINT_FAST8_MAX (255)
|
||||
#define UINT_FAST16_MAX (4294967295U)
|
||||
#define UINT_FAST32_MAX (4294967295U)
|
||||
#define UINT_FAST64_MAX (18446744073709551615ULL)
|
||||
|
||||
/* Limits of integer types capable of holding object pointers */
|
||||
#define INTPTR_MIN (-2147483647-1)
|
||||
#define INTPTR_MAX (2147483647)
|
||||
#define UINTPTR_MAX (4294967295U)
|
||||
|
||||
/* Limits of greates-width intger types */
|
||||
#define INTMAX_MIN (-9223372036854775807LL-1)
|
||||
#define INTMAX_MAX (9223372036854775807LL)
|
||||
#define UINTMAX_MAX (18446744073709551615ULL)
|
||||
|
||||
|
||||
/* Macros for minimum-width integer constants */
|
||||
#define INT8_C(c) c
|
||||
#define INT16_C(c) c
|
||||
#define INT32_C(c) c
|
||||
#define INT64_C(c) c ## LL
|
||||
#define UINT8_C(c) c ## U
|
||||
#define UINT16_C(c) c ## U
|
||||
#define UINT32_C(c) c ## U
|
||||
#define UINT64_C(c) c ## ULL
|
||||
|
||||
/* Macros for greatest-width integer constants */
|
||||
#define INTMAX_C(c) c ## LL
|
||||
#define UINTMAX_C(c) c ## ULL
|
||||
|
||||
|
||||
#endif /* (!(defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)))||defined(__STDC_CONSTANT_MACROS) */
|
||||
|
||||
#endif /* _SCE_PSPSTDINT_H */
|
||||
|
Loading…
Reference in New Issue