mirror of https://github.com/stella-emu/stella.git
Added first pass of the ROM launcher. When you press 'Start' in the ROM
launcher, it launches Frostbite. Then pressing 'Escape' goes back to the launcher, and you're able to then launch Frostbite again! Success !!! Still TODO is actually get a ROM listing and use the selected game, but the fact that it works multiple times for some game means that the infrastructure is working correctly :) Changed behaviour of the 'Escape' key. Specifically, it now only acts as a key to enter ROM launcher mode. In the case where the emulation was started without the launcher, the key will now do nothing. From now on, the only way to quit Stella is Ctrl-Q (or equivalent for OSX), close the window, or from the 'Quit' button. Also, the 'Enter launcher mode' event will eventually be made remappable, as will the 'Enter menu mode' event (currently the 'Tab' key). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@412 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
4bd9ef8b3d
commit
b27b595a78
|
@ -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.74 2005-05-04 19:04:38 stephena Exp $
|
||||
## $Id: makefile,v 1.75 2005-05-06 18:38:59 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -155,9 +155,11 @@ win32-gl:
|
|||
###############################################################################
|
||||
M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o
|
||||
|
||||
GUI_OBJS = StellaFont.o Menu.o Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o \
|
||||
GUI_OBJS = StellaFont.o Menu.o Launcher.o \
|
||||
Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o \
|
||||
Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \
|
||||
EventMappingDialog.o GameInfoDialog.o HelpDialog.o
|
||||
EventMappingDialog.o GameInfoDialog.o HelpDialog.o \
|
||||
LauncherDialog.o BrowserDialog.o
|
||||
|
||||
CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
|
||||
CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \
|
||||
|
@ -371,6 +373,9 @@ StellaFont.o: $(GUI)/StellaFont.cxx $(GUI)/StellaFont.hxx
|
|||
Menu.o: $(GUI)/Menu.cxx $(GUI)/Menu.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Menu.cxx
|
||||
|
||||
Launcher.o: $(GUI)/Launcher.cxx $(GUI)/Launcher.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Launcher.cxx
|
||||
|
||||
Widget.o: $(GUI)/Widget.cxx $(GUI)/Widget.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/Widget.cxx
|
||||
|
||||
|
@ -406,3 +411,9 @@ GameInfoDialog.o: $(GUI)/GameInfoDialog.cxx $(GUI)/GameInfoDialog.hxx
|
|||
|
||||
HelpDialog.o: $(GUI)/HelpDialog.cxx $(GUI)/HelpDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/HelpDialog.cxx
|
||||
|
||||
LauncherDialog.o: $(GUI)/LauncherDialog.cxx $(GUI)/LauncherDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/LauncherDialog.cxx
|
||||
|
||||
BrowserDialog.o: $(GUI)/BrowserDialog.cxx $(GUI)/BrowserDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/BrowserDialog.cxx
|
||||
|
|
|
@ -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.36 2005-05-05 19:00:44 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.37 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -62,15 +62,6 @@ void SetupProperties(PropertiesSet& set)
|
|||
string theAltPropertiesFile = theOSystem->settings().getString("altpro");
|
||||
string thePropertiesFile = theOSystem->propertiesInputFilename();
|
||||
|
||||
/*
|
||||
// When 'listrominfo' or 'mergeprops' is specified, we need to have the
|
||||
// full list in memory
|
||||
if(theOSystem->settings().getBool("listrominfo") ||
|
||||
theOSystem->settings().getBool("mergeprops") ||
|
||||
theOSystem->settings().getBool("browser"))
|
||||
useMemList = true;
|
||||
*/
|
||||
|
||||
stringstream buf;
|
||||
if(theAltPropertiesFile != "")
|
||||
{
|
||||
|
@ -195,17 +186,13 @@ int main(int argc, char* argv[])
|
|||
//// Main loop ////
|
||||
// First we check if a ROM is specified on the commandline. If so, and if
|
||||
// the ROM actually exists, use it to create a new console.
|
||||
// If not, use the built-in ROM browser. In this case, we enter 'browser'
|
||||
// If not, use the built-in ROM launcher. In this case, we enter 'launcher'
|
||||
// mode and let the main event loop take care of opening a new console/ROM.
|
||||
string romfile = argv[argc - 1];
|
||||
if(theOSystem->fileExists(romfile))
|
||||
{
|
||||
theOSystem->createConsole(romfile);
|
||||
}
|
||||
if(argc == 1 || !theOSystem->fileExists(romfile))
|
||||
theOSystem->createLauncher();
|
||||
else
|
||||
{
|
||||
theOSystem->eventHandler().reset(EventHandler::S_BROWSER);
|
||||
}
|
||||
theOSystem->createConsole(romfile);
|
||||
|
||||
// Start the main loop, and don't exit until the user issues a QUIT command
|
||||
theOSystem->mainLoop();
|
||||
|
|
|
@ -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.51 2005-05-05 19:00:46 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.52 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include "Sound.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Menu.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
|
||||
|
@ -45,6 +46,7 @@ EventHandler::EventHandler(OSystem* osystem)
|
|||
myExitGameFlag(false),
|
||||
myQuitFlag(false),
|
||||
myGrabMouseFlag(false),
|
||||
myUseLauncherFlag(false),
|
||||
myPaddleMode(0)
|
||||
{
|
||||
// Add this eventhandler object to the OSystem
|
||||
|
@ -108,6 +110,25 @@ void EventHandler::reset(State state)
|
|||
myExitGameFlag = false;
|
||||
myQuitFlag = false;
|
||||
myPaddleMode = 0;
|
||||
|
||||
switch(myState)
|
||||
{
|
||||
case S_EMULATE:
|
||||
break;
|
||||
|
||||
case S_MENU:
|
||||
break;
|
||||
|
||||
case S_LAUNCHER:
|
||||
myUseLauncherFlag = true;
|
||||
break;
|
||||
|
||||
case S_DEBUGGER:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -381,8 +402,8 @@ void EventHandler::handleKeyEvent(SDLKey key, SDLMod mod, uInt8 state)
|
|||
myOSystem->menu().handleKeyEvent((uInt16) key, (Int32) mod, state);
|
||||
break;
|
||||
|
||||
case S_BROWSER:
|
||||
//FIXME myOSystem->browser().handleKeyEvent(key, mod, state);
|
||||
case S_LAUNCHER:
|
||||
myOSystem->launcher().handleKeyEvent((uInt16) key, (Int32) mod, state);
|
||||
break;
|
||||
|
||||
case S_DEBUGGER:
|
||||
|
@ -438,8 +459,15 @@ void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
|||
break;
|
||||
}
|
||||
|
||||
case S_BROWSER:
|
||||
// Not yet implemented
|
||||
case S_LAUNCHER:
|
||||
{
|
||||
// Take window zooming into account
|
||||
Int32 x = event.motion.x, y = event.motion.y;
|
||||
myOSystem->frameBuffer().translateCoords(&x, &y);
|
||||
//cerr << "Motion: x = " << x << ", y = " << y << endl;
|
||||
myOSystem->launcher().handleMouseMotionEvent(x, y, 0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case S_DEBUGGER:
|
||||
|
@ -467,6 +495,7 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, uInt8 state)
|
|||
break;
|
||||
|
||||
case S_MENU:
|
||||
case S_LAUNCHER:
|
||||
{
|
||||
// Take window zooming into account
|
||||
Int32 x = event.button.x, y = event.button.y;
|
||||
|
@ -497,14 +526,14 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, uInt8 state)
|
|||
else
|
||||
break;
|
||||
}
|
||||
myOSystem->menu().handleMouseButtonEvent(button, x, y, state);
|
||||
|
||||
if(myState == S_MENU)
|
||||
myOSystem->menu().handleMouseButtonEvent(button, x, y, state);
|
||||
else
|
||||
myOSystem->launcher().handleMouseButtonEvent(button, x, y, state);
|
||||
break;
|
||||
}
|
||||
|
||||
case S_BROWSER:
|
||||
// Not yet implemented
|
||||
break;
|
||||
|
||||
case S_DEBUGGER:
|
||||
// Not yet implemented
|
||||
break;
|
||||
|
@ -568,10 +597,14 @@ void EventHandler::handleEvent(Event::Type event, Int32 state)
|
|||
}
|
||||
else if(event == Event::ExitGame)
|
||||
{
|
||||
myExitGameFlag = true;
|
||||
myOSystem->sound().mute(true);
|
||||
myOSystem->settings().saveConfig();
|
||||
return;
|
||||
// ExitGame will only work when we've launched stella using the ROM
|
||||
// launcher. Otherwise, the only way to exit the main loop is to Quit.
|
||||
if(myState == S_EMULATE && myUseLauncherFlag)
|
||||
{
|
||||
myOSystem->settings().saveConfig();
|
||||
myOSystem->createLauncher();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(event == Event::Quit)
|
||||
{
|
||||
|
|
|
@ -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.25 2005-05-05 00:10:48 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.26 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -57,7 +57,7 @@ struct ActionList {
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.25 2005-05-05 00:10:48 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.26 2005-05-06 18:38:59 stephena Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ class EventHandler
|
|||
virtual ~EventHandler();
|
||||
|
||||
// Enumeration representing the different states of operation
|
||||
enum State { S_NONE, S_EMULATE, S_BROWSER, S_MENU, S_DEBUGGER };
|
||||
enum State { S_NONE, S_EMULATE, S_LAUNCHER, S_MENU, S_DEBUGGER };
|
||||
|
||||
/**
|
||||
Returns the event object associated with this handler class.
|
||||
|
@ -251,6 +251,9 @@ class EventHandler
|
|||
// Indicates whether the mouse cursor is grabbed
|
||||
bool myGrabMouseFlag;
|
||||
|
||||
// Indicates whether to use launcher mode when exiting a game
|
||||
bool myUseLauncherFlag;
|
||||
|
||||
// Indicates which paddle the mouse currently emulates
|
||||
Int8 myPaddleMode;
|
||||
|
||||
|
|
|
@ -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.31 2005-05-05 00:10:48 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.32 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include "StellaFont.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Menu.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
#include "stella.xpm" // The Stella icon
|
||||
|
@ -55,7 +56,7 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
|
|||
{0, 0, 0},
|
||||
{64, 64, 64},
|
||||
{32, 160, 32},
|
||||
{0, 255, 0}
|
||||
{0, 255, 0} // FIXME - add kTextColorEm
|
||||
};
|
||||
|
||||
for(uInt8 i = 0; i < 5; i++)
|
||||
|
@ -212,9 +213,27 @@ void FrameBuffer::update()
|
|||
break;
|
||||
}
|
||||
|
||||
case EventHandler::S_BROWSER:
|
||||
// FIXME myOSystem->gui().browser().draw();
|
||||
case EventHandler::S_LAUNCHER:
|
||||
{
|
||||
// Only update the screen if it's been invalidated or the menus have changed
|
||||
if(theRedrawEntireFrameIndicator || theMenuChangedIndicator)
|
||||
{
|
||||
// Overlay the ROM launcher
|
||||
myOSystem->launcher().draw();
|
||||
|
||||
// Now the screen is up to date
|
||||
theRedrawEntireFrameIndicator = false;
|
||||
|
||||
// This is a performance hack to only draw the menus when necessary
|
||||
// Software mode is single-buffered, so we don't have to worry
|
||||
// However, OpenGL mode is double-buffered, so we need to draw the
|
||||
// menus at least twice (so they'll be in both buffers)
|
||||
// Otherwise, we get horrible flickering
|
||||
myMenuRedraws--;
|
||||
theMenuChangedIndicator = (myMenuRedraws != 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EventHandler::S_DEBUGGER:
|
||||
// Not yet implemented
|
||||
|
@ -497,124 +516,3 @@ void FrameBuffer::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|||
vLine(x, y, y + h - 1, color);
|
||||
vLine(x + w - 1, y, y + h - 1, color);
|
||||
}
|
||||
|
||||
/*
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::sendKeyEvent(StellaEvent::KeyCode key, Int32 state)
|
||||
{
|
||||
if(myCurrentWidget == W_NONE || state != 1)
|
||||
return;
|
||||
|
||||
// Redraw the menus whenever a key event is received
|
||||
theMenuChangedIndicator = true;
|
||||
myMenuRedraws = 2;
|
||||
|
||||
// Check which type of widget is pending
|
||||
switch(myCurrentWidget)
|
||||
{
|
||||
case MAIN_MENU:
|
||||
if(key == StellaEvent::KCODE_RETURN)
|
||||
myCurrentWidget = currentSelectedWidget();
|
||||
else if(key == StellaEvent::KCODE_UP)
|
||||
moveCursorUp(1);
|
||||
else if(key == StellaEvent::KCODE_DOWN)
|
||||
moveCursorDown(1);
|
||||
else if(key == StellaEvent::KCODE_PAGEUP)
|
||||
moveCursorUp(4);
|
||||
else if(key == StellaEvent::KCODE_PAGEDOWN)
|
||||
moveCursorDown(4);
|
||||
|
||||
break; // MAIN_MENU
|
||||
|
||||
case REMAP_MENU:
|
||||
if(myRemapEventSelectedFlag)
|
||||
{
|
||||
if(key == StellaEvent::KCODE_ESCAPE)
|
||||
deleteBinding(mySelectedEvent);
|
||||
else
|
||||
addKeyBinding(mySelectedEvent, key);
|
||||
|
||||
myRemapEventSelectedFlag = false;
|
||||
}
|
||||
else if(key == StellaEvent::KCODE_RETURN)
|
||||
{
|
||||
mySelectedEvent = currentSelectedEvent();
|
||||
myRemapEventSelectedFlag = true;
|
||||
}
|
||||
else if(key == StellaEvent::KCODE_UP)
|
||||
moveCursorUp(1);
|
||||
else if(key == StellaEvent::KCODE_DOWN)
|
||||
moveCursorDown(1);
|
||||
else if(key == StellaEvent::KCODE_PAGEUP)
|
||||
moveCursorUp(4);
|
||||
else if(key == StellaEvent::KCODE_PAGEDOWN)
|
||||
moveCursorDown(4);
|
||||
else if(key == StellaEvent::KCODE_ESCAPE)
|
||||
{
|
||||
myCurrentWidget = MAIN_MENU;
|
||||
theRedrawEntireFrameIndicator = true;
|
||||
}
|
||||
|
||||
break; // REMAP_MENU
|
||||
|
||||
case INFO_MENU:
|
||||
if(key == StellaEvent::KCODE_ESCAPE)
|
||||
{
|
||||
myCurrentWidget = MAIN_MENU;
|
||||
theRedrawEntireFrameIndicator = true;
|
||||
}
|
||||
|
||||
break; // INFO_MENU
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::sendJoyEvent(StellaEvent::JoyStick stick,
|
||||
StellaEvent::JoyCode code, Int32 state)
|
||||
{
|
||||
if(myCurrentWidget == W_NONE || state != 1)
|
||||
return;
|
||||
|
||||
// Redraw the menus whenever a joy event is received
|
||||
theMenuChangedIndicator = true;
|
||||
|
||||
// Check which type of widget is pending
|
||||
switch(myCurrentWidget)
|
||||
{
|
||||
case MAIN_MENU:
|
||||
// if(key == StellaEvent::KCODE_RETURN)
|
||||
// myCurrentWidget = currentSelectedWidget();
|
||||
if(code == StellaEvent::JAXIS_UP)
|
||||
moveCursorUp(1);
|
||||
else if(code == StellaEvent::JAXIS_DOWN)
|
||||
moveCursorDown(1);
|
||||
|
||||
break; // MAIN_MENU
|
||||
|
||||
case REMAP_MENU:
|
||||
if(myRemapEventSelectedFlag)
|
||||
{
|
||||
addJoyBinding(mySelectedEvent, stick, code);
|
||||
myRemapEventSelectedFlag = false;
|
||||
}
|
||||
else if(code == StellaEvent::JAXIS_UP)
|
||||
moveCursorUp(1);
|
||||
else if(code == StellaEvent::JAXIS_DOWN)
|
||||
moveCursorDown(1);
|
||||
// else if(key == StellaEvent::KCODE_PAGEUP)
|
||||
// movePageUp();
|
||||
// else if(key == StellaEvent::KCODE_PAGEDOWN)
|
||||
// movePageDown();
|
||||
// else if(key == StellaEvent::KCODE_ESCAPE)
|
||||
// myCurrentWidget = MAIN_MENU;
|
||||
|
||||
break; // REMAP_MENU
|
||||
|
||||
default:
|
||||
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: OSystem.cxx,v 1.10 2005-05-05 19:00:47 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.11 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -36,7 +36,7 @@
|
|||
#include "PropsSet.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "Menu.hxx"
|
||||
//#include "Browser.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
|
@ -49,19 +49,19 @@ OSystem::OSystem()
|
|||
myPropSet(NULL),
|
||||
myConsole(NULL),
|
||||
myMenu(NULL),
|
||||
// myBrowser(NULL),
|
||||
myLauncher(NULL),
|
||||
myRomFile("")
|
||||
{
|
||||
// Create gui-related classes
|
||||
// Create menu and launcher GUI objects
|
||||
myMenu = new Menu(this);
|
||||
// myBrowser = new Browser(this);
|
||||
myLauncher = new Launcher(this);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystem::~OSystem()
|
||||
{
|
||||
delete myMenu;
|
||||
// delete myBrowser;
|
||||
delete myLauncher;
|
||||
|
||||
// Remove any game console that is currently attached
|
||||
delete myConsole;
|
||||
|
@ -159,8 +159,8 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
}
|
||||
break; // S_EMULATE, S_MENU
|
||||
|
||||
case EventHandler::S_BROWSER:
|
||||
break; // S_BROWSER
|
||||
case EventHandler::S_LAUNCHER:
|
||||
break; // S_LAUNCHER
|
||||
|
||||
case EventHandler::S_DEBUGGER:
|
||||
break;
|
||||
|
@ -211,8 +211,8 @@ void OSystem::createSound()
|
|||
myConsole->initializeAudio();
|
||||
break; // S_EMULATE, S_MENU
|
||||
|
||||
case EventHandler::S_BROWSER:
|
||||
break; // S_BROWSER
|
||||
case EventHandler::S_LAUNCHER:
|
||||
break; // S_LAUNCHER
|
||||
|
||||
case EventHandler::S_DEBUGGER:
|
||||
break;
|
||||
|
@ -275,6 +275,23 @@ bool OSystem::createConsole(const string& romfile)
|
|||
return retval;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::createLauncher()
|
||||
{
|
||||
myEventHandler->reset(EventHandler::S_LAUNCHER);
|
||||
|
||||
// Create the window
|
||||
string title = "Stella: ROM Launcher"; // FIXME - include version of Stella
|
||||
myFrameBuffer->initialize(title, kLauncherWidth, kLauncherHeight);
|
||||
|
||||
// And start the base dialog
|
||||
myLauncher->initialize();
|
||||
myLauncher->reStack();
|
||||
myFrameBuffer->refresh();
|
||||
myFrameBuffer->setCursorState();
|
||||
mySound->mute(true);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystem::OSystem(const OSystem& osystem)
|
||||
{
|
||||
|
|
|
@ -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.10 2005-05-05 19:00:47 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.11 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -22,7 +22,7 @@
|
|||
class PropertiesSet;
|
||||
|
||||
class Menu;
|
||||
class Browser;
|
||||
class Launcher;
|
||||
|
||||
#include "EventHandler.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
|
@ -38,7 +38,7 @@ class Browser;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.10 2005-05-05 19:00:47 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.11 2005-05-06 18:38:59 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -125,11 +125,11 @@ class OSystem
|
|||
Menu& menu(void) const { return *myMenu; }
|
||||
|
||||
/**
|
||||
Get the ROM browser of the system.
|
||||
Get the ROM launcher of the system.
|
||||
|
||||
@return The browser object
|
||||
@return The launcher object
|
||||
*/
|
||||
Browser& browser(void) const { return *myBrowser; }
|
||||
Launcher& launcher(void) const { return *myLauncher; }
|
||||
|
||||
/**
|
||||
Set the framerate for the video system. It's placed in this class since
|
||||
|
@ -229,6 +229,11 @@ class OSystem
|
|||
*/
|
||||
bool createConsole(const string& romfile = "");
|
||||
|
||||
/**
|
||||
Creates a new ROM launcher, to select a new ROM to emulate.
|
||||
*/
|
||||
void createLauncher();
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// The following methods are system-specific and must be implemented
|
||||
|
@ -299,8 +304,8 @@ class OSystem
|
|||
// Pointer to the Menu object
|
||||
Menu* myMenu;
|
||||
|
||||
// Pointer to the Browser object
|
||||
Browser* myBrowser;
|
||||
// Pointer to the Launcher object
|
||||
Launcher* myLauncher;
|
||||
|
||||
// Time per frame for a video update, based on the current framerate
|
||||
uInt32 myTimePerFrame;
|
||||
|
|
|
@ -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.37 2005-05-05 19:00:48 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.38 2005-05-06 18:38:59 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -119,13 +119,6 @@ void Settings::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Settings::loadCommandLine(Int32 argc, char** argv)
|
||||
{
|
||||
// Make sure we have the correct number of command line arguments
|
||||
if(argc == 1)
|
||||
{
|
||||
usage();
|
||||
return false;
|
||||
}
|
||||
|
||||
for(Int32 i = 1; i < argc; ++i)
|
||||
{
|
||||
// strip off the '-' character
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: BrowserDialog.cxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "ListWidget.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Event.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BrowserDialog::BrowserDialog(OSystem* osystem, uInt16 x, uInt16 y,
|
||||
uInt16 w, uInt16 h)
|
||||
: Dialog(osystem, x, y, w, h)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BrowserDialog::~BrowserDialog()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void BrowserDialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void BrowserDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: BrowserDialog.hxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef BROWSER_DIALOG_HXX
|
||||
#define BROWSER_DIALOG_HXX
|
||||
|
||||
class CommandSender;
|
||||
class ButtonWidget;
|
||||
class StaticTextWidget;
|
||||
class ListWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class BrowserDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
BrowserDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
~BrowserDialog();
|
||||
|
||||
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
enum {
|
||||
kStartMapCmd = 'map ',
|
||||
kEraseCmd = 'eras',
|
||||
kStopMapCmd = 'smap'
|
||||
};
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Launcher.cxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "LauncherDialog.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "Launcher.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Launcher::Launcher(OSystem* osystem)
|
||||
: DialogContainer(osystem)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Launcher::~Launcher()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Launcher::initialize()
|
||||
{
|
||||
delete myBaseDialog;
|
||||
myBaseDialog = new LauncherDialog(myOSystem, 0, 0, kLauncherWidth, kLauncherHeight);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Launcher.hxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef LAUNCHER_HXX
|
||||
#define LAUNCHER_HXX
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "DialogContainer.hxx"
|
||||
|
||||
enum {
|
||||
kLauncherWidth = 400,
|
||||
kLauncherHeight = 300
|
||||
};
|
||||
|
||||
/**
|
||||
The base dialog for the ROM launcher in Stella.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Launcher.hxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
*/
|
||||
class Launcher : public DialogContainer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create a new menu stack
|
||||
*/
|
||||
Launcher(OSystem* osystem);
|
||||
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
virtual ~Launcher();
|
||||
|
||||
public:
|
||||
/**
|
||||
Updates the basedialog to be of the type defined for this derived class.
|
||||
*/
|
||||
void initialize();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,340 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: LauncherDialog.cxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "ListWidget.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Event.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
enum {
|
||||
kStartCmd = 'STRT',
|
||||
kLocationCmd = 'LOCA',
|
||||
kReloadCmd = 'RELO',
|
||||
kQuitCmd = 'QUIT',
|
||||
|
||||
kCmdGlobalGraphicsOverride = 'OGFX',
|
||||
kCmdGlobalAudioOverride = 'OSFX',
|
||||
kCmdGlobalVolumeOverride = 'OVOL',
|
||||
|
||||
kCmdExtraBrowser = 'PEXT',
|
||||
kCmdGameBrowser = 'PGME',
|
||||
kCmdSaveBrowser = 'PSAV'
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherDialog::LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y,
|
||||
uInt16 w, uInt16 h)
|
||||
: Dialog(osystem, x, y, w, h)
|
||||
{
|
||||
// Show game name
|
||||
new StaticTextWidget(this, 10, 8, 300, kLineHeight, "Select a game from the list ...",
|
||||
kTextAlignCenter);
|
||||
|
||||
// Add three buttons at the bottom
|
||||
const int border = 10;
|
||||
const int space = 8;
|
||||
const int buttons = 4;
|
||||
const int width = (_w - 2 * border - space * (buttons - 1)) / buttons;
|
||||
int xpos = border;
|
||||
|
||||
new ButtonWidget(this, xpos, _h - 24, width, 16, "Play", kStartCmd, 'S');
|
||||
xpos += space + width;
|
||||
new ButtonWidget(this, xpos, _h - 24, width, 16, "Options", kLocationCmd, 'O');
|
||||
xpos += space + width;
|
||||
new ButtonWidget(this, xpos, _h - 24, width, 16, "Reload", kReloadCmd, 'R');
|
||||
xpos += space + width;
|
||||
new ButtonWidget(this, xpos, _h - 24, width, 16, "Quit", kQuitCmd, 'Q');
|
||||
xpos += space + width;
|
||||
|
||||
// Add list with game titles
|
||||
myList = new ListWidget(this, 10, 24, 300, 142);
|
||||
myList->setEditable(false);
|
||||
myList->setNumberingMode(kListNumberingOff);
|
||||
|
||||
// Populate the list
|
||||
updateListing();
|
||||
|
||||
// Restore last selection
|
||||
/*
|
||||
string last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
|
||||
if (!last.isEmpty())
|
||||
{
|
||||
int itemToSelect = 0;
|
||||
StringList::const_iterator iter;
|
||||
for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect)
|
||||
{
|
||||
if (last == *iter)
|
||||
{
|
||||
myList->setSelected(itemToSelect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// En-/Disable the buttons depending on the list selection
|
||||
updateButtons();
|
||||
|
||||
// Create file browser dialog
|
||||
//FIXME myBrowser = new BrowserDialog("Select directory with game data");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherDialog::~LauncherDialog()
|
||||
{
|
||||
delete myBrowser;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::loadConfig()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::close()
|
||||
{
|
||||
/*
|
||||
// Save last selection
|
||||
const int sel = _list->getSelected();
|
||||
if (sel >= 0)
|
||||
ConfMan.set(String("lastselectedgame"), _domains[sel], ConfigManager::kApplicationDomain);
|
||||
else
|
||||
ConfMan.removeKey(String("lastselectedgame"), ConfigManager::kApplicationDomain);
|
||||
|
||||
ConfMan.flushToDisk();
|
||||
Dialog::close();
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::updateListing()
|
||||
{
|
||||
// FIXME - add bulk of KStella code here wrt loading from stella.cache
|
||||
cerr << "LauncherDialog::updateListing()\n";
|
||||
/*
|
||||
Common::StringList l;
|
||||
|
||||
// Retrieve a list of all games defined in the config file
|
||||
_domains.clear();
|
||||
const ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
|
||||
ConfigManager::DomainMap::const_iterator iter = domains.begin();
|
||||
for (iter = domains.begin(); iter != domains.end(); ++iter) {
|
||||
String name(iter->_value.get("gameid"));
|
||||
String description(iter->_value.get("description"));
|
||||
|
||||
if (name.isEmpty())
|
||||
name = iter->_key;
|
||||
if (description.isEmpty()) {
|
||||
GameSettings g = GameDetector::findGame(name);
|
||||
if (g.description)
|
||||
description = g.description;
|
||||
}
|
||||
|
||||
if (!name.isEmpty() && !description.isEmpty()) {
|
||||
// Insert the game into the launcher list
|
||||
int pos = 0, size = l.size();
|
||||
|
||||
while (pos < size && (scumm_stricmp(description.c_str(), l[pos].c_str()) > 0))
|
||||
pos++;
|
||||
l.insert_at(pos, description);
|
||||
_domains.insert_at(pos, iter->_key);
|
||||
}
|
||||
}
|
||||
|
||||
_list->setList(l);
|
||||
updateButtons();
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::reloadListing()
|
||||
{
|
||||
// FIXME - add bulk of KStella code here wrt loading from disk
|
||||
cerr << "LauncherDialog::reloadListing()\n";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::addGame()
|
||||
{
|
||||
/*
|
||||
// Allow user to add a new game to the list.
|
||||
// 1) show a dir selection dialog which lets the user pick the directory
|
||||
// the game data resides in.
|
||||
// 2) try to auto detect which game is in the directory, if we cannot
|
||||
// determine it uniquely preent a list of candidates to the user
|
||||
// to pick from
|
||||
// 3) Display the 'Edit' dialog for that item, letting the user specify
|
||||
// an alternate description (to distinguish multiple versions of the
|
||||
// game, e.g. 'Monkey German' and 'Monkey English') and set default
|
||||
// options for that game.
|
||||
|
||||
if (_browser->runModal() > 0) {
|
||||
// User made his choice...
|
||||
FilesystemNode dir(_browser->getResult());
|
||||
FSList files = dir.listDir(FilesystemNode::kListAll);
|
||||
|
||||
// ...so let's determine a list of candidates, games that
|
||||
// could be contained in the specified directory.
|
||||
DetectedGameList candidates(PluginManager::instance().detectGames(files));
|
||||
|
||||
int idx;
|
||||
if (candidates.isEmpty()) {
|
||||
// No game was found in the specified directory
|
||||
MessageDialog alert("ScummVM could not find any game in the specified directory!");
|
||||
alert.runModal();
|
||||
idx = -1;
|
||||
} else if (candidates.size() == 1) {
|
||||
// Exact match
|
||||
idx = 0;
|
||||
} else {
|
||||
// Display the candidates to the user and let her/him pick one
|
||||
StringList list;
|
||||
for (idx = 0; idx < (int)candidates.size(); idx++)
|
||||
list.push_back(candidates[idx].description);
|
||||
|
||||
ChooserDialog dialog("Pick the game:");
|
||||
dialog.setList(list);
|
||||
idx = dialog.runModal();
|
||||
}
|
||||
if (0 <= idx && idx < (int)candidates.size()) {
|
||||
DetectedGame result = candidates[idx];
|
||||
|
||||
// The auto detector or the user made a choice.
|
||||
// Pick a domain name which does not yet exist (after all, we
|
||||
// are *adding* a game to the config, not replacing).
|
||||
String domain(result.name);
|
||||
if (ConfMan.hasGameDomain(domain)) {
|
||||
char suffix = 'a';
|
||||
domain += suffix;
|
||||
while (ConfMan.hasGameDomain(domain)) {
|
||||
assert(suffix < 'z');
|
||||
domain.deleteLastChar();
|
||||
suffix++;
|
||||
domain += suffix;
|
||||
}
|
||||
ConfMan.set("gameid", result.name, domain);
|
||||
ConfMan.set("description", result.description, domain);
|
||||
}
|
||||
ConfMan.set("path", dir.path(), domain);
|
||||
|
||||
const bool customLanguage = (result.language != Common::UNK_LANG);
|
||||
const bool customPlatform = (result.platform != Common::kPlatformUnknown);
|
||||
|
||||
// Set language if specified
|
||||
if (customLanguage)
|
||||
ConfMan.set("language", Common::getLanguageCode(result.language), domain);
|
||||
|
||||
// Set platform if specified
|
||||
if (customPlatform)
|
||||
ConfMan.set("platform", Common::getPlatformCode(result.platform), domain);
|
||||
|
||||
// Adapt the description string if custom platform/language is set
|
||||
if (customLanguage || customPlatform) {
|
||||
String desc = result.description;
|
||||
desc += " (";
|
||||
if (customLanguage)
|
||||
desc += Common::getLanguageDescription(result.language);
|
||||
if (customLanguage && customPlatform)
|
||||
desc += "/";
|
||||
if (customPlatform)
|
||||
desc += Common::getPlatformDescription(result.platform);
|
||||
desc += ")";
|
||||
|
||||
ConfMan.set("description", desc, domain);
|
||||
}
|
||||
|
||||
// Display edit dialog for the new entry
|
||||
EditGameDialog editDialog(domain, result);
|
||||
if (editDialog.runModal() > 0) {
|
||||
// User pressed OK, so make changes permanent
|
||||
|
||||
// Write config to disk
|
||||
ConfMan.flushToDisk();
|
||||
|
||||
// Update the ListWidget and force a redraw
|
||||
updateListing();
|
||||
draw();
|
||||
} else {
|
||||
// User aborted, remove the the new domain again
|
||||
ConfMan.removeGameDomain(domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
|
||||
{
|
||||
Int32 item = myList->getSelected();
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case kStartCmd:
|
||||
case kListItemActivatedCmd:
|
||||
case kListItemDoubleClickedCmd:
|
||||
cerr << "Game selected: " << item << endl;
|
||||
// FIXME - start a new console based on the filename selected
|
||||
// this is only here for testing
|
||||
instance()->createConsole("frostbite.a26");
|
||||
close();
|
||||
break;
|
||||
|
||||
case kLocationCmd:
|
||||
cerr << "kLocationCmd from LauncherDialog\n";
|
||||
// instance()->launcher().addDialog(myLocationDialog);
|
||||
break;
|
||||
|
||||
case kReloadCmd:
|
||||
reloadListing();
|
||||
break;
|
||||
|
||||
case kListSelectionChangedCmd:
|
||||
updateButtons();
|
||||
break;
|
||||
|
||||
case kQuitCmd:
|
||||
close();
|
||||
instance()->eventHandler().quit();
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::updateButtons()
|
||||
{
|
||||
/*
|
||||
bool enable = (myList->getSelected() >= 0);
|
||||
if (enable != _startButton->isEnabled()) {
|
||||
_startButton->setEnabled(enable);
|
||||
_startButton->draw();
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: LauncherDialog.hxx,v 1.1 2005-05-06 18:39:00 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef LAUNCHER_DIALOG_HXX
|
||||
#define LAUNCHER_DIALOG_HXX
|
||||
|
||||
class CommandSender;
|
||||
class ButtonWidget;
|
||||
class StaticTextWidget;
|
||||
class BrowserDialog;
|
||||
class ListWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class LauncherDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h);
|
||||
~LauncherDialog();
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
|
||||
|
||||
protected:
|
||||
void updateListing();
|
||||
void reloadListing();
|
||||
void updateButtons();
|
||||
|
||||
void close();
|
||||
virtual void addGame();
|
||||
void removeGame(int item);
|
||||
void editGame(int item);
|
||||
void loadConfig();
|
||||
|
||||
protected:
|
||||
ListWidget* myList;
|
||||
BrowserDialog* myBrowser;
|
||||
};
|
||||
|
||||
#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: OSystemUNIX.cxx,v 1.5 2005-05-05 00:10:49 stephena Exp $
|
||||
// $Id: OSystemUNIX.cxx,v 1.6 2005-05-06 18:39:00 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -115,7 +115,8 @@ void OSystemUNIX::mainLoop()
|
|||
}
|
||||
}
|
||||
|
||||
if(mySettings->getBool("showinfo"))
|
||||
// Only print console information if a console was actually created
|
||||
if(mySettings->getBool("showinfo") && myConsole)
|
||||
{
|
||||
double executionTime = (double) frameTime / 1000000.0;
|
||||
double framesPerSecond = (double) numberOfFrames / executionTime;
|
||||
|
|
Loading…
Reference in New Issue