Made config settings for state dir, palette file, cheatfile, and properties

file configurable from the commandline and in the UI.  Because of this,
removed support for BASEDIR functionality added in the last release.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1327 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-07-19 16:21:39 +00:00
parent 80296e2bed
commit b5782deae1
24 changed files with 275 additions and 298 deletions

View File

@ -1,58 +0,0 @@
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 --disable-debugger
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
Emulation
Cross - Fire
Circle - Load State
Square - Save State
Triangle - Snapshot
Select - Console Select
Start - Console Reset
Left Trigger - Games Menu
Right Trigger - Command Menu
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.

View 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: CheatManager.cxx,v 1.13 2007-01-01 18:04:39 stephena Exp $
// $Id: CheatManager.cxx,v 1.14 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <sstream>
@ -230,7 +230,7 @@ void CheatManager::enable(const string& code, bool enable)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheatManager::loadCheatDatabase()
{
string cheatfile = myOSystem->baseDir() + BSPF_PATH_SEPARATOR + "stella.cht";
const string& cheatfile = myOSystem->cheatFile();
ifstream in(cheatfile.c_str(), ios::in);
if(!in)
return;
@ -271,7 +271,7 @@ void CheatManager::saveCheatDatabase()
if(!myListIsDirty)
return;
string cheatfile = myOSystem->baseDir() + BSPF_PATH_SEPARATOR + "stella.cht";
const string& cheatfile = myOSystem->cheatFile();
ofstream out(cheatfile.c_str(), ios::out);
if(!out)
return;

View 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.36 2007-01-01 18:04:40 stephena Exp $
// $Id: SoundSDL.cxx,v 1.37 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#ifdef SOUND_SUPPORT
@ -96,17 +96,12 @@ void SoundSDL::initialize()
Int32 tiafreq = myOSystem->settings().getInt("tiafreq");
SDL_AudioSpec desired;
#ifndef PSP
desired.freq = frequency;
#ifndef GP2X
desired.format = AUDIO_U8;
#else
desired.format = AUDIO_U16;
#endif
#else
desired.freq = 44100;
desired.format = AUDIO_U16;
#endif
desired.channels = myNumChannels;
desired.samples = fragsize;
desired.callback = callback;

View 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: mainSDL.cxx,v 1.72 2007-01-01 18:04:40 stephena Exp $
// $Id: mainSDL.cxx,v 1.73 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <SDL.h>
@ -45,12 +45,6 @@
#elif defined(GP2X)
#include "SettingsGP2X.hxx"
#include "OSystemGP2X.hxx"
#elif defined(PSP)
#include "SettingsPSP.hxx"
#include "OSystemPSP.hxx"
extern "C" {
int SDL_main(int argc, char* argv[]);
}
#else
#error Unsupported platform!
#endif
@ -80,36 +74,23 @@ 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
{
// Get the base directory for storing all Stella settings/statefiles/etc
// This can't be stored in the actual settings file for obvious reasons,
// so we get it from an environment var (if it exists)
const char* bd_ptr = getenv("STELLA_BASEDIR");
const string& basedir = bd_ptr ? string(bd_ptr) : "";
// Create the parent OSystem object and settings
#if defined(UNIX)
theOSystem = new OSystemUNIX(basedir);
theOSystem = new OSystemUNIX();
SettingsUNIX settings(theOSystem);
#elif defined(WIN32)
theOSystem = new OSystemWin32(basedir);
theOSystem = new OSystemWin32();
SettingsWin32 settings(theOSystem);
#elif defined(MAC_OSX)
theOSystem = new OSystemMACOSX(basedir);
theOSystem = new OSystemMACOSX();
SettingsMACOSX settings(theOSystem);
#elif defined(GP2X)
theOSystem = new OSystemGP2X(basedir);
theOSystem = new OSystemGP2X();
SettingsGP2X settings(theOSystem);
#elif defined(PSP)
fprintf(stderr,"---------------- Stderr Begins ----------------\n");
fprintf(stdout,"---------------- Stdout Begins ----------------\n");
theOSystem = new OSystemPSP(basedir);
SettingsPSP settings(theOSystem);
#else
#error Unsupported platform!
#endif
@ -153,7 +134,6 @@ int main(int argc, char* argv[])
}
// Request that the SDL window be centered, if possible
// At some point, this should be properly integrated into the UI
if(theOSystem->settings().getBool("center"))
putenv("SDL_VIDEO_CENTERED=1");

View 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: Cart2K.cxx,v 1.9 2007-01-14 16:17:52 stephena Exp $
// $Id: Cart2K.cxx,v 1.10 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <cassert>
@ -67,7 +67,7 @@ void Cartridge2K::install(System& system)
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))
{
access.directPeekBase = &myImage[address & 0x07FF];
mySystem->setPageAccess(address >> mySystem->pageShift(), access);
mySystem->setPageAccess(address >> shift, access);
}
}

View 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: Console.cxx,v 1.126 2007-02-22 02:15:46 stephena Exp $
// $Id: Console.cxx,v 1.127 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <cassert>
@ -540,9 +540,7 @@ void Console::enableBits(bool enable) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::loadUserPalette()
{
const string& palette = myOSystem->baseDir() +
BSPF_PATH_SEPARATOR + "stella.pal";
const string& palette = myOSystem->paletteFile();
ifstream in(palette.c_str(), ios::binary);
if(!in)
return;

View 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: Console.hxx,v 1.59 2007-02-06 23:34:31 stephena Exp $
// $Id: Console.hxx,v 1.60 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#ifndef CONSOLE_HXX
@ -38,7 +38,7 @@ class System;
This class represents the entire game console.
@author Bradford W. Mott
@version $Id: Console.hxx,v 1.59 2007-02-06 23:34:31 stephena Exp $
@version $Id: Console.hxx,v 1.60 2007-07-19 16:21:39 stephena Exp $
*/
class Console
{
@ -225,7 +225,7 @@ class Console
void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true) const;
/**
Loads a user-defined palette file from 'stella.pal', filling the
Loads a user-defined palette file (from OSystem::paletteFile), filling the
appropriate user-defined palette arrays.
*/
void loadUserPalette();

View 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: MediaFactory.cxx,v 1.7 2007-01-01 18:04:48 stephena Exp $
// $Id: MediaFactory.cxx,v 1.8 2007-07-19 16:21:39 stephena Exp $
//============================================================================
////////////////////////////////////////////////////////////////////
@ -31,8 +31,6 @@
#if defined(GP2X)
#include "FrameBufferGP2X.hxx"
#elif defined(PSP)
#include "FrameBufferPSP.hxx"
#elif defined (_WIN32_WCE)
#include "FrameBufferWinCE.hxx"
#else
@ -70,8 +68,6 @@ FrameBuffer* MediaFactory::createVideo(OSystem* osystem)
{
#if defined (GP2X)
fb = new FrameBufferGP2X(osystem);
#elif defined (PSP)
fb = new FrameBufferPSP(osystem);
#elif defined (_WIN32_WCE)
fb = new FrameBufferWinCE(osystem);
#else

View 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: OSystem.cxx,v 1.97 2007-06-20 16:33:22 stephena Exp $
// $Id: OSystem.cxx,v 1.98 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <cassert>
@ -147,6 +147,9 @@ OSystem::~OSystem()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool OSystem::create()
{
// Get updated paths for all configuration files
setConfigPaths();
// Get relevant information about the video hardware
// This must be done before any graphics context is created, since
// it may be needed to initialize the size of graphical objects
@ -185,6 +188,34 @@ bool OSystem::create()
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setConfigPaths()
{
myStateDir = mySettings->getString("statedir");
if(myStateDir == "")
myStateDir = myBaseDir + BSPF_PATH_SEPARATOR + "state";
if(!FilesystemNode::dirExists(myStateDir))
FilesystemNode::makeDir(myStateDir);
mySettings->setString("statedir", myStateDir);
myGameListCacheFile = myBaseDir + BSPF_PATH_SEPARATOR + "stella.cache";
myCheatFile = mySettings->getString("cheatfile");
if(myCheatFile == "")
myCheatFile = myBaseDir + BSPF_PATH_SEPARATOR + "stella.cht";
mySettings->setString("cheatfile", myCheatFile);
myPaletteFile = mySettings->getString("palettefile");
if(myPaletteFile == "")
myPaletteFile = myBaseDir + BSPF_PATH_SEPARATOR + "stella.pal";
mySettings->setString("palettefile", myPaletteFile);
myPropertiesFile = mySettings->getString("propsfile");
if(myPropertiesFile == "")
myPropertiesFile = myBaseDir + BSPF_PATH_SEPARATOR + "stella.pro";
mySettings->setString("propsfile", myPropertiesFile);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setBaseDir(const string& basedir)
{
@ -193,26 +224,6 @@ void OSystem::setBaseDir(const string& basedir)
FilesystemNode::makeDir(myBaseDir);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setStateDir(const string& statedir)
{
myStateDir = statedir;
if(!FilesystemNode::dirExists(myStateDir))
FilesystemNode::makeDir(myStateDir);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setPropertiesDir(const string& path)
{
myPropertiesFile = path + BSPF_PATH_SEPARATOR + "stella.pro";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setConfigFile(const string& file)
{
myConfigFile = file;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setFramerate(uInt32 framerate)
{

View 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: OSystem.hxx,v 1.52 2007-06-20 16:33:22 stephena Exp $
// $Id: OSystem.hxx,v 1.53 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -51,7 +51,7 @@ typedef Common::Array<Resolution> ResolutionList;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.52 2007-06-20 16:33:22 stephena Exp $
@version $Id: OSystem.hxx,v 1.53 2007-07-19 16:21:39 stephena Exp $
*/
class OSystem
{
@ -192,6 +192,11 @@ class OSystem
*/
virtual void setFramerate(uInt32 framerate);
/**
Set all config file paths for the OSystem.
*/
void setConfigPaths();
/**
Get the current framerate for the video system.
@ -222,6 +227,21 @@ class OSystem
*/
const string& stateDir() const { return myStateDir; }
/**
This method should be called to get the full path of the gamelist
cache file (used by the Launcher to show a listing of available games).
@return String representing the full path of the gamelist cache file.
*/
const string& cacheFile() const { return myGameListCacheFile; }
/**
This method should be called to get the full path of the cheat file.
@return String representing the full path of the cheat filename.
*/
const string& cheatFile() const { return myCheatFile; }
/**
This method should be called to get the full path of the config file.
@ -229,6 +249,14 @@ class OSystem
*/
const string& configFile() const { return myConfigFile; }
/**
This method should be called to get the full path of the
(optional) palette file.
@return String representing the full path of the properties filename.
*/
const string& paletteFile() const { return myPaletteFile; }
/**
This method should be called to get the full path of the
properties file (stella.pro).
@ -237,14 +265,6 @@ class OSystem
*/
const string& propertiesFile() const { return myPropertiesFile; }
/**
This method should be called to get the full path of the gamelist
cache file (used by the Launcher to show a listing of available games).
@return String representing the full path of the gamelist cache file.
*/
const string& cacheFile() const { return myGameListCacheFile; }
/**
This method should be called to get the full path of the currently
loaded ROM.
@ -375,32 +395,22 @@ class OSystem
*/
virtual void queryVideoHardware();
protected:
/**
Set the base directory for all Stella files
Set the base directory for all Stella files (these files may be
located in other places through settings).
*/
void setBaseDir(const string& basedir);
/**
Set the directory where state files are stored
*/
void setStateDir(const string& statedir);
/**
Set the locations of game properties file
*/
void setPropertiesDir(const string& path);
/**
Set the locations of config file
*/
void setConfigFile(const string& file);
/**
Set the location of the gamelist cache file
*/
void setCacheFile(const string& cachefile) { myGameListCacheFile = cachefile; }
/**
Set the locations of config file
*/
void setConfigFile(const string& file) { myConfigFile = file; }
protected:
// Pointer to the EventHandler object
EventHandler* myEventHandler;
@ -455,7 +465,9 @@ class OSystem
string myBaseDir;
string myStateDir;
string myCheatFile;
string myConfigFile;
string myPaletteFile;
string myPropertiesFile;
string myGameListCacheFile;

View 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: PropsSet.cxx,v 1.32 2007-04-09 18:12:40 stephena Exp $
// $Id: PropsSet.cxx,v 1.33 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <sstream>
@ -31,28 +31,11 @@ PropertiesSet::PropertiesSet(OSystem* osystem)
myRoot(NULL),
mySize(0)
{
// Several properties files can exist, so we attempt to load from
// all of them. If the user has specified a properties file, use
// that one. Otherwise, load both the system and user properties
// files, and have the user file override all entries from the
// system file.
ostringstream buf;
string altpro = myOSystem->settings().getString("pro");
if(altpro != "")
{
buf << "User game properties: \'" << altpro << "\'\n";
load(altpro, false); // don't save alternate properties
}
else
{
const string& props = myOSystem->propertiesFile();
buf << "User game properties: \'" << props << "\'\n";
load(props, true); // do save these properties
}
const string& props = myOSystem->propertiesFile();
load(props, true); // do save these properties
if(myOSystem->settings().getBool("showinfo"))
cout << buf.str() << endl;
cout << "User game properties: \'" << props << "\'\n";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View 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: Settings.cxx,v 1.118 2007-06-20 20:36:28 stephena Exp $
// $Id: Settings.cxx,v 1.119 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <cassert>
@ -83,6 +83,11 @@ Settings::Settings(OSystem* osystem)
setInternal("launcherres", "320x240");
setInternal("uipalette", "0");
setInternal("autoslot", "false");
setInternal("statedir", "");
setInternal("cheatfile", "");
setInternal("palettefile", "");
setInternal("propsfile", "");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -330,6 +335,10 @@ void Settings::usage()
<< " -rominfo <rom> Display detailed information for the given ROM\n"
<< " -launcherres <res> The resolution to use in ROM launcher mode\n"
<< " -uipalette <1|2> Used the specified palette for UI elements\n"
<< " -statedir <dir> Directory in which to save state files\n"
<< " -cheatfile <file> Full pathname of cheatfile database\n"
<< " -palettefile <file> Full pathname of user-defined palette file\n"
<< " -propsfile <file> Full pathname of ROM properties file\n"
<< " -help Show the text you're now reading\n"
#ifdef DEBUGGER_SUPPORT
<< endl
@ -343,7 +352,6 @@ void Settings::usage()
<< " -holdselect Start the emulator with the Game Select switch held down\n"
<< " -holdbutton0 Start the emulator with the left joystick button held down\n"
<< endl
<< " -pro <props file> Use the given properties file instead of stella.pro\n"
<< " -type <arg> Sets the 'Cartridge.Type' property\n"
<< " -ld <arg> Sets the 'Console.LeftDifficulty' property\n"
<< " -rd <arg> Sets the 'Console.RightDifficulty' property\n"

View 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: bspf.hxx,v 1.15 2006-12-15 16:43:11 stephena Exp $
// $Id: bspf.hxx,v 1.16 2007-07-19 16:21:39 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.15 2006-12-15 16:43:11 stephena Exp $
@version $Id: bspf.hxx,v 1.16 2007-07-19 16:21:39 stephena Exp $
*/
// Types for 8-bit signed and unsigned integers
@ -51,10 +51,6 @@ typedef unsigned int uInt32;
#include <string>
using namespace std;
#endif
#ifdef PSP
#include "pspstdint.h"
#endif
#ifdef HAVE_INTTYPES
#include <inttypes.h>
@ -67,8 +63,6 @@ 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 "/"
#elif defined BSPF_GP2X
#define BSPF_PATH_SEPARATOR "/"
#endif

View 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: AboutDialog.cxx,v 1.18 2007-01-01 18:04:51 stephena Exp $
// $Id: AboutDialog.cxx,v 1.19 2007-07-19 16:21:39 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -119,8 +119,6 @@ void AboutDialog::updateStrings(int page, int lines, string& title, string* &dsc
ADD_ATEXT("\\L\\c2"" Maintainer for Solaris port");
ADD_ATEXT("\\L\\c0"" Darrell Spice Jr. & Doodle");
ADD_ATEXT("\\L\\c2"" Authors for OS/2 port");
ADD_ATEXT("\\L\\c0"" David Voswinkel");
ADD_ATEXT("\\L\\c2"" Maintainer for PSP port");
ADD_ATEXT("\\L\\c0"" Kostas Nakos");
ADD_ATEXT("\\L\\c2"" Author/maintainer for WinCE port");
ADD_ATEXT("\\L\\c0"" Alex Zaballa");

View 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: FileSnapDialog.cxx,v 1.6 2007-01-24 19:17:33 stephena Exp $
// $Id: FileSnapDialog.cxx,v 1.7 2007-07-19 16:21:39 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -61,7 +61,7 @@ FileSnapDialog::FileSnapDialog(
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
kChooseRomDirCmd);
wid.push_back(b);
xpos += bwidth + 20;
xpos += bwidth + 10;
myRomPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
@ -94,16 +94,58 @@ FileSnapDialog::FileSnapDialog(
// Add focus widgets for ROM tab
addToFocusList(wid, tabID);
// 2) The snapshot settings tab
// 2) The configuration files tab
wid.clear();
tabID = myTab->addTab(" Snapshot Settings ");
tabID = myTab->addTab(" Config Files ");
bwidth = font.getStringWidth("Properties file:") + 20;
// State directory
xpos = 15; ypos = vBorder + 5;
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "State path:",
kChooseStateDirCmd);
wid.push_back(b);
xpos += bwidth + 10;
myStatePath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
// Cheat file
xpos = 15; ypos += b->getHeight() + 3;
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Cheat file:",
kChooseCheatFileCmd);
wid.push_back(b);
xpos += bwidth + 10;
myCheatFile = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
// Palette file
xpos = 15; ypos += b->getHeight() + 3;
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Palette file:",
kChoosePaletteFileCmd);
wid.push_back(b);
xpos += bwidth + 10;
myPaletteFile = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
// Properties file
xpos = 15; ypos += b->getHeight() + 3;
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Properties file:",
kChoosePropsFileCmd);
wid.push_back(b);
xpos += bwidth + 10;
myPropsFile = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
// Snapshot path
xpos = 15; ypos = vBorder + 5;
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
xpos = 15; ypos += b->getHeight() + 3;
b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Snapshot path:",
kChooseSnapDirCmd);
wid.push_back(b);
xpos += bwidth + 20;
xpos += bwidth + 10;
mySnapPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
@ -117,6 +159,9 @@ FileSnapDialog::FileSnapDialog(
// Add focus widgets for Snapshot tab
addToFocusList(wid, tabID);
// Activate the first tab
myTab->setActiveTab(0);
// Add OK & Cancel buttons
wid.clear();
#ifndef MAC_OSX
@ -149,21 +194,16 @@ FileSnapDialog::~FileSnapDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileSnapDialog::loadConfig()
{
string s;
bool b;
s = instance()->settings().getString("romdir");
myRomPath->setLabel(s);
b = instance()->settings().getBool("rombrowse");
myRomPath->setLabel(instance()->settings().getString("romdir"));
bool b = instance()->settings().getBool("rombrowse");
myBrowseCheckbox->setState(b);
myReloadButton->setEnabled(myIsGlobal && !b);
s = instance()->settings().getString("ssdir");
mySnapPath->setLabel(s);
b = instance()->settings().getBool("sssingle");
mySnapSingleCheckbox->setState(!b);
myStatePath->setLabel(instance()->stateDir());
myCheatFile->setLabel(instance()->cheatFile());
myPaletteFile->setLabel(instance()->paletteFile());
myPropsFile->setLabel(instance()->propertiesFile());
mySnapPath->setLabel(instance()->settings().getString("ssdir"));
mySnapSingleCheckbox->setState(!instance()->settings().getBool("sssingle"));
myTab->loadConfig();
}
@ -191,23 +231,14 @@ void FileSnapDialog::saveConfig()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileSnapDialog::openRomBrowser()
void FileSnapDialog::openBrowser(const string& title, const string& startpath,
int cmd)
{
parent()->addDialog(myBrowser);
myBrowser->setTitle("Select ROM directory:");
myBrowser->setEmitSignal(kRomDirChosenCmd);
myBrowser->setStartPath(myRomPath->getLabel());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FileSnapDialog::openSnapBrowser()
{
parent()->addDialog(myBrowser);
myBrowser->setTitle("Select snapshot directory:");
myBrowser->setEmitSignal(kSnapDirChosenCmd);
myBrowser->setStartPath(mySnapPath->getLabel());
myBrowser->setTitle(title);
myBrowser->setEmitSignal(cmd);
myBrowser->setStartPath(startpath);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -227,11 +258,33 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kChooseRomDirCmd:
openRomBrowser();
openBrowser("Select ROM directory:", myRomPath->getLabel(),
kRomDirChosenCmd);
break;
case kChooseStateDirCmd:
openBrowser("Select state directory:", myStatePath->getLabel(),
kStateDirChosenCmd);
break;
case kChooseCheatFileCmd:
openBrowser("Select cheat file:", myCheatFile->getLabel(),
kCheatFileChosenCmd);
break;
case kChoosePaletteFileCmd:
openBrowser("Select palette file:", myPaletteFile->getLabel(),
kPaletteFileChosenCmd);
break;
case kChoosePropsFileCmd:
openBrowser("Select properties file:", myPropsFile->getLabel(),
kPropsFileChosenCmd);
break;
case kChooseSnapDirCmd:
openSnapBrowser();
openBrowser("Select snapshot directory:", mySnapPath->getLabel(),
kSnapDirChosenCmd);
break;
case kRomDirChosenCmd:
@ -241,6 +294,34 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
case kStateDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
myStatePath->setLabel(dir.path());
break;
}
case kCheatFileChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
myCheatFile->setLabel(dir.path());
break;
}
case kPaletteFileChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
myPaletteFile->setLabel(dir.path());
break;
}
case kPropsFileChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
myPropsFile->setLabel(dir.path());
break;
}
case kSnapDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());

View 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: FileSnapDialog.hxx,v 1.2 2007-01-01 18:04:52 stephena Exp $
// $Id: FileSnapDialog.hxx,v 1.3 2007-07-19 16:21:39 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -48,16 +48,24 @@ class FileSnapDialog : public Dialog, public CommandSender
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
void openRomBrowser();
void openSnapBrowser();
void openBrowser(const string& title, const string& startpath, int cmd);
private:
enum {
kChooseRomDirCmd = 'LOrm', // rom select
kChooseSnapDirCmd = 'LOsn', // snap select
kBrowseDirCmd = 'LObd' // browse mode
kChooseRomDirCmd = 'LOrm', // rom select
kChooseStateDirCmd = 'LOsd', // state dir
kChooseCheatFileCmd = 'LOcf', // cheatfile (stella.cht)
kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal)
kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro)
kChooseSnapDirCmd = 'LOsn', // snap select
kBrowseDirCmd = 'LObd', // browse mode
kStateDirChosenCmd = 'LOsc', // state dir changed
kCheatFileChosenCmd = 'LOcc', // cheatfile changed
kPaletteFileChosenCmd = 'LOpc', // palette file changed
kPropsFileChosenCmd = 'LOrc' // properties file changed
};
BrowserDialog* myBrowser;
TabWidget* myTab;
@ -66,7 +74,11 @@ class FileSnapDialog : public Dialog, public CommandSender
CheckboxWidget* myBrowseCheckbox;
ButtonWidget* myReloadButton;
// Snapshot controls
// Config paths
StaticTextWidget* myStatePath;
StaticTextWidget* myCheatFile;
StaticTextWidget* myPaletteFile;
StaticTextWidget* myPropsFile;
StaticTextWidget* mySnapPath;
CheckboxWidget* mySnapSingleCheckbox;

View 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: OptionsDialog.cxx,v 1.53 2007-06-21 12:27:00 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.54 2007-07-19 16:21:39 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -127,7 +127,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
w = 200; h = 105;
myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h);
w = 280; h = 120;
w = 280; h = 180;
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
boss, x, y, w, h);

View 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: OSystemMACOSX.cxx,v 1.16 2007-01-03 12:59:23 stephena Exp $
// $Id: OSystemMACOSX.cxx,v 1.17 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <cstdlib>
@ -56,25 +56,26 @@ extern char parentdir[MAXPATHLEN];
// the OS into the application.
void macOpenConsole(char *romname)
{
theOSystem->deleteConsole();
theOSystem->createConsole(romname);
theOSystem->deleteConsole();
theOSystem->createConsole(romname);
}
// Allow the Menus Objective-C object to pass event sends into the
// application.
void macOSXSendMenuEvent(int event)
{
switch(event) {
case MENU_OPEN:
theOSystem->eventHandler().handleEvent(Event::LauncherMode, 1);
break;
case MENU_VOLUME_INCREASE:
theOSystem->eventHandler().handleEvent(Event::VolumeIncrease, 1);
break;
case MENU_VOLUME_DECREASE:
theOSystem->eventHandler().handleEvent(Event::VolumeDecrease, 1);
break;
}
switch(event)
{
case MENU_OPEN:
theOSystem->eventHandler().handleEvent(Event::LauncherMode, 1);
break;
case MENU_VOLUME_INCREASE:
theOSystem->eventHandler().handleEvent(Event::VolumeIncrease, 1);
break;
case MENU_VOLUME_DECREASE:
theOSystem->eventHandler().handleEvent(Event::VolumeDecrease, 1);
break;
}
}
/**
@ -82,27 +83,18 @@ void macOSXSendMenuEvent(int event)
in its constructor:
setBaseDir()
setStateDir()
setPropertiesFiles()
setConfigFile()
setCacheFile()
See OSystem.hxx for a further explanation
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemMACOSX::OSystemMACOSX(const string& path) : OSystem()
OSystemMACOSX::OSystemMACOSX()
: OSystem()
{
const string& basedir = (path.length() > 0) ? path :
string(getenv("HOME")) + "/.stella";
const string& basedir = string(getenv("HOME")) + "/.stella";
setBaseDir(basedir);
setStateDir(basedir + "/state");
setPropertiesDir(basedir);
setConfigFile(basedir + "/stellarc");
setCacheFile(basedir + "/stella.cache");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View 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: OSystemMACOSX.hxx,v 1.9 2007-01-03 12:59:24 stephena Exp $
// $Id: OSystemMACOSX.hxx,v 1.10 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#ifndef OSYSTEM_MACOSX_HXX
@ -26,7 +26,7 @@
This class defines UNIX-like OS's (Linux) system specific settings.
@author Mark Grebe
@version $Id: OSystemMACOSX.hxx,v 1.9 2007-01-03 12:59:24 stephena Exp $
@version $Id: OSystemMACOSX.hxx,v 1.10 2007-07-19 16:21:39 stephena Exp $
*/
class OSystemMACOSX : public OSystem
{
@ -34,7 +34,7 @@ class OSystemMACOSX : public OSystem
/**
Create a new UNIX-specific operating system object
*/
OSystemMACOSX(const string& path);
OSystemMACOSX();
/**
Destructor

View File

@ -13,11 +13,9 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystemUNIX.cxx,v 1.26 2007-06-20 16:33:23 stephena Exp $
// $Id: OSystemUNIX.cxx,v 1.27 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include <SDL.h>
#include <cstdlib>
#include <sstream>
#include <fstream>
@ -40,27 +38,18 @@
in its constructor:
setBaseDir()
setStateDir()
setPropertiesDir()
setConfigFile()
setCacheFile()
See OSystem.hxx for a further explanation
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemUNIX::OSystemUNIX(const string& path) : OSystem()
OSystemUNIX::OSystemUNIX()
: OSystem()
{
const string& basedir = (path.length() > 0) ? path :
string(getenv("HOME")) + "/.stella";
const string& basedir = string(getenv("HOME")) + "/.stella";
setBaseDir(basedir);
setStateDir(basedir + "/state");
setPropertiesDir(basedir);
setConfigFile(basedir + "/stellarc");
setCacheFile(basedir + "/stella.cache");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View 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: OSystemUNIX.hxx,v 1.15 2007-06-20 16:33:23 stephena Exp $
// $Id: OSystemUNIX.hxx,v 1.16 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#ifndef OSYSTEM_UNIX_HXX
@ -25,7 +25,7 @@
This class defines UNIX-like OS's (Linux) system specific settings.
@author Stephen Anthony
@version $Id: OSystemUNIX.hxx,v 1.15 2007-06-20 16:33:23 stephena Exp $
@version $Id: OSystemUNIX.hxx,v 1.16 2007-07-19 16:21:39 stephena Exp $
*/
class OSystemUNIX : public OSystem
{
@ -33,7 +33,7 @@ class OSystemUNIX : public OSystem
/**
Create a new UNIX-specific operating system object
*/
OSystemUNIX(const string& path);
OSystemUNIX();
/**
Destructor

View 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: SettingsUNIX.cxx,v 1.21 2007-01-01 18:04:55 stephena Exp $
// $Id: SettingsUNIX.cxx,v 1.22 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -29,8 +29,6 @@ SettingsUNIX::SettingsUNIX(OSystem* osystem)
setInternal("gl_lib", "libGL.so");
// Most Linux GL implementations don't support this yet
setInternal("gl_vsync", "false");
// For whatever reason, this is very efficient in Linux
setInternal("dirtyrects", "true");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View 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: OSystemWin32.hxx,v 1.10 2007-06-20 20:36:28 stephena Exp $
// $Id: OSystemWin32.hxx,v 1.11 2007-07-19 16:21:39 stephena Exp $
//============================================================================
#ifndef OSYSTEM_WIN32_HXX
@ -25,7 +25,7 @@
This class defines Windows system specific settings.
@author Stephen Anthony
@version $Id: OSystemWin32.hxx,v 1.10 2007-06-20 20:36:28 stephena Exp $
@version $Id: OSystemWin32.hxx,v 1.11 2007-07-19 16:21:39 stephena Exp $
*/
class OSystemWin32 : public OSystem
{
@ -33,7 +33,7 @@ class OSystemWin32 : public OSystem
/**
Create a new Win32 operating system object
*/
OSystemWin32(const string& path);
OSystemWin32();
/**
Destructor

View File

@ -242,9 +242,6 @@ DEP_CPP_ABOUT=\
".\sdl\SDL_version.h"\
".\sdl\SDL_video.h"\
NODEP_CPP_ABOUT=\
"..\emucore\m6502\src\bspf\src\pspstdint.h"\
!ELSEIF "$(CFG)" == "PocketStella - Win32 (WCE ARM) Debug"
@ -300,9 +297,6 @@ DEP_CPP_ABOUT=\
".\sdl\SDL_version.h"\
".\sdl\SDL_video.h"\
NODEP_CPP_ABOUT=\
"..\emucore\m6502\src\bspf\src\pspstdint.h"\
!ELSEIF "$(CFG)" == "PocketStella - Win32 (WCE x86) Release"
@ -358,9 +352,6 @@ DEP_CPP_ABOUT=\
".\sdl\SDL_version.h"\
".\sdl\SDL_video.h"\
NODEP_CPP_ABOUT=\
"..\emucore\m6502\src\bspf\src\pspstdint.h"\
!ELSEIF "$(CFG)" == "PocketStella - Win32 (WCE x86) Debug"
@ -416,9 +407,6 @@ DEP_CPP_ABOUT=\
".\sdl\SDL_version.h"\
".\sdl\SDL_video.h"\
NODEP_CPP_ABOUT=\
"..\emucore\m6502\src\bspf\src\pspstdint.h"\
!ENDIF