mirror of https://github.com/stella-emu/stella.git
OK, some huge changes across the board, so lets see if I get it all:
After much request, added ability to access the settings menu from the ROM browser dialog. This menu now contains almost all items that can be selected in Stella, and can be accessed in-game as before. Completely removed pause functionality from the core code. It made sense back when Stella was a single-mode program: there were two modes; emulation and pause. Now that there are other event modes, the EventHandler state machine is getting too complicated. If you want to pause, you can simply enter one of the in-game menus. Related to this, when the app is minimized, Stella enters the menu dialog state. Previously, minimizing the app caused a pause, but since there was no onscreen feedback, many people assumed the app locked up. Added centering to all Dialog boxes, which is done dynamically, as they're placed on the dialog stack to be drawn to the screen. Cleaned up the API of Console/FrameBuffer/OSystem classes wrt to palettes and timing. Parts of each were being done in different classes; now it should be more consistent. Started infrastructure for user-selectable UI palettes. For now, there's no way to change it in the GUI, and it defaults to the normal palette. Eventually, there will be several choices selectable from an in-game menu. Removed '-channels' commandline argument, since that feature can be set from the ROM properties. Added '128' to the choices for fragment size in AudioDialog. Tweaked the OpenGL dynamic loading code to test both the given GL lib, and if that fails to use auto-detection. It seems in the OSX port, the first approach works for some people, and not the other (and vice-versa), git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1255 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
16f99140d2
commit
fc4e4b7b17
|
@ -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: CheatCodeDialog.cxx,v 1.12 2006-12-08 16:48:55 stephena Exp $
|
||||
// $Id: CheatCodeDialog.cxx,v 1.13 2006-12-30 22:26:27 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -67,7 +67,7 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
|||
StringList labels;
|
||||
labels.push_back("Name: ");
|
||||
labels.push_back("Code: ");
|
||||
myCheatInput = new InputTextDialog(this, font, labels, _x+20, _y+20);
|
||||
myCheatInput = new InputTextDialog(this, font, labels, 0, 0);
|
||||
myCheatInput->setTarget(this);
|
||||
|
||||
// Add OK and Cancel buttons **** FIXME - coordinates
|
||||
|
@ -139,12 +139,14 @@ void CheatCodeDialog::saveConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CheatCodeDialog::addCheat()
|
||||
{
|
||||
// We have to add the dialog first, so it can be centered
|
||||
// The methods after this depend on the dialog having the correct dimensions
|
||||
parent()->addDialog(myCheatInput);
|
||||
myCheatInput->setEditString("", 0);
|
||||
myCheatInput->setEditString("", 1);
|
||||
myCheatInput->setTitle("");
|
||||
myCheatInput->setFocus(0);
|
||||
myCheatInput->setEmitSignal(kCheatAdded);
|
||||
parent()->addDialog(myCheatInput);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -158,12 +160,14 @@ void CheatCodeDialog::editCheat()
|
|||
const string& name = list[idx]->name();
|
||||
const string& code = list[idx]->code();
|
||||
|
||||
// We have to add the dialog first, so it can be centered
|
||||
// The methods after this depend on the dialog having the correct dimensions
|
||||
parent()->addDialog(myCheatInput);
|
||||
myCheatInput->setEditString(name, 0);
|
||||
myCheatInput->setEditString(code, 1);
|
||||
myCheatInput->setTitle("");
|
||||
myCheatInput->setFocus(1);
|
||||
myCheatInput->setEmitSignal(kCheatEdited);
|
||||
parent()->addDialog(myCheatInput);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -176,12 +180,14 @@ void CheatCodeDialog::removeCheat()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CheatCodeDialog::addOneShotCheat()
|
||||
{
|
||||
// We have to add the dialog first, so it can be centered
|
||||
// The methods after this depend on the dialog having the correct dimensions
|
||||
parent()->addDialog(myCheatInput);
|
||||
myCheatInput->setEditString("One-shot cheat", 0);
|
||||
myCheatInput->setEditString("", 1);
|
||||
myCheatInput->setTitle("");
|
||||
myCheatInput->setFocus(1);
|
||||
myCheatInput->setEmitSignal(kOneShotCheatAdded);
|
||||
parent()->addDialog(myCheatInput);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: FrameBufferGL.cxx,v 1.80 2006-12-29 15:16:47 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.81 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
|
@ -123,8 +123,12 @@ bool FrameBufferGL::loadFuncs(const string& library)
|
|||
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
||||
const char* gl_ptr = library != "" ? library.c_str() : 0;
|
||||
if(SDL_GL_LoadLibrary(gl_ptr) < 0)
|
||||
// Try both the specified library and auto-detection
|
||||
bool libLoaded = (library != "" && SDL_GL_LoadLibrary(library.c_str()) >= 0);
|
||||
bool autoLoaded = false;
|
||||
if(!libLoaded) autoLoaded = (SDL_GL_LoadLibrary(0) >= 0);
|
||||
|
||||
if(!libLoaded && !autoLoaded)
|
||||
return false;
|
||||
|
||||
// Otherwise, fill the function pointers for GL functions
|
||||
|
|
|
@ -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: ContextMenu.cxx,v 1.7 2006-12-08 16:49:10 stephena Exp $
|
||||
// $Id: ContextMenu.cxx,v 1.8 2006-12-30 22:26:28 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -33,6 +33,8 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font)
|
|||
_rowHeight(font.getLineHeight()),
|
||||
_font(&font)
|
||||
{
|
||||
// Context menus pop up wherever the mouse is clicked
|
||||
setCenter(false);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: RamWidget.cxx,v 1.9 2006-12-08 16:49:12 stephena Exp $
|
||||
// $Id: RamWidget.cxx,v 1.10 2006-12-30 22:26:28 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -144,6 +144,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
|||
myInputBox = new InputTextDialog(boss, font, label,
|
||||
x + lwidth + 20, y + 2*lineHeight - 5);
|
||||
myInputBox->setTarget(this);
|
||||
myInputBox->setCenter(false);
|
||||
|
||||
// Start with these buttons disabled
|
||||
myCompareButton->clearFlags(WIDGET_ENABLED);
|
||||
|
@ -207,17 +208,17 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
break;
|
||||
|
||||
case kSearchCmd:
|
||||
parent()->addDialog(myInputBox);
|
||||
myInputBox->setEditString("");
|
||||
myInputBox->setTitle("");
|
||||
myInputBox->setEmitSignal(kSValEntered);
|
||||
parent()->addDialog(myInputBox);
|
||||
break;
|
||||
|
||||
case kCmpCmd:
|
||||
parent()->addDialog(myInputBox);
|
||||
myInputBox->setEditString("");
|
||||
myInputBox->setTitle("");
|
||||
myInputBox->setEmitSignal(kCValEntered);
|
||||
parent()->addDialog(myInputBox);
|
||||
break;
|
||||
|
||||
case kRestartCmd:
|
||||
|
|
|
@ -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: RomWidget.cxx,v 1.18 2006-12-08 16:49:12 stephena Exp $
|
||||
// $Id: RomWidget.cxx,v 1.19 2006-12-30 22:26:28 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -102,6 +102,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
|||
label.push_back("Filename: ");
|
||||
mySaveRom = new InputTextDialog(boss, font, label, _x + 50, _y + 80);
|
||||
mySaveRom->setTarget(this);
|
||||
mySaveRom->setCenter(false);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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.115 2006-12-28 20:40:00 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.116 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -73,10 +73,8 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
// Attach the event subsystem to the current console
|
||||
myEvent = myOSystem->eventHandler().event();
|
||||
|
||||
// Load user-defined palette for this ROM and initialize them
|
||||
// depending on PAL colour-loss effect
|
||||
// Load user-defined palette for this ROM
|
||||
loadUserPalette();
|
||||
setColorLossPalette(myOSystem->settings().getBool("colorloss"));
|
||||
|
||||
// Setup the controllers based on properties
|
||||
string left = myProperties.get(Controller_Left);
|
||||
|
@ -256,7 +254,7 @@ Console::~Console()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::toggleFormat()
|
||||
{
|
||||
uInt32 framerate = 60;
|
||||
int framerate = 60;
|
||||
if(myDisplayFormat == "NTSC")
|
||||
{
|
||||
myDisplayFormat = "PAL";
|
||||
|
@ -364,7 +362,7 @@ void Console::setPalette(const string& type)
|
|||
else // return normal palette by default
|
||||
palette = (myDisplayFormat.compare(0, 3, "PAL") == 0) ? ourPALPalette : ourNTSCPalette;
|
||||
|
||||
myOSystem->frameBuffer().setPalette(palette);
|
||||
myOSystem->frameBuffer().setTIAPalette(palette);
|
||||
|
||||
// FIXME - maybe add an error message that requested palette not available?
|
||||
}
|
||||
|
@ -398,24 +396,29 @@ void Console::setProperties(const Properties& props)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::initialize()
|
||||
void Console::initializeVideo(bool full)
|
||||
{
|
||||
// Set the correct framerate based on the format of the ROM
|
||||
// This can be overridden by changing the framerate in the
|
||||
// VideoDialog box or on the commandline, but it can't be saved
|
||||
// (ie, framerate is now solely determined based on ROM format).
|
||||
int framerate = myOSystem->settings().getInt("framerate");
|
||||
if(framerate == -1)
|
||||
if(full)
|
||||
{
|
||||
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60")
|
||||
framerate = 60;
|
||||
else if(myDisplayFormat == "PAL")
|
||||
framerate = 50;
|
||||
else
|
||||
framerate = 60;
|
||||
string title = string("Stella ") + STELLA_VERSION +
|
||||
": \"" + myProperties.get(Cartridge_Name) + "\"";
|
||||
myOSystem->frameBuffer().initialize(title,
|
||||
myMediaSource->width() << 1,
|
||||
myMediaSource->height());
|
||||
}
|
||||
myOSystem->setFramerate(framerate);
|
||||
|
||||
bool enable = myProperties.get(Display_Phosphor) == "YES";
|
||||
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
|
||||
myOSystem->frameBuffer().enablePhosphor(enable, blend);
|
||||
setColorLossPalette(myOSystem->settings().getBool("colorloss"));
|
||||
setPalette(myOSystem->settings().getString("palette"));
|
||||
|
||||
myOSystem->setFramerate(getFrameRate());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::initializeAudio()
|
||||
{
|
||||
// Initialize the sound interface.
|
||||
// The # of channels can be overridden in the AudioDialog box or on
|
||||
// the commandline, but it can't be saved.
|
||||
|
@ -430,44 +433,8 @@ void Console::initialize()
|
|||
|
||||
myOSystem->sound().close();
|
||||
myOSystem->sound().setChannels(channels);
|
||||
myOSystem->sound().setFrameRate(framerate);
|
||||
myOSystem->sound().setFrameRate(getFrameRate());
|
||||
myOSystem->sound().initialize();
|
||||
|
||||
// Initialize the options menu system with updated values from the framebuffer
|
||||
myOSystem->menu().initialize();
|
||||
|
||||
// Initialize the command menu system with updated values from the framebuffer
|
||||
myOSystem->commandMenu().initialize();
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
// Finally, initialize the debugging system, since it depends on the current ROM
|
||||
myOSystem->debugger().setConsole(this);
|
||||
myOSystem->debugger().initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::initializeVideo()
|
||||
{
|
||||
string title = string("Stella ") + STELLA_VERSION +
|
||||
": \"" + myProperties.get(Cartridge_Name) + "\"";
|
||||
myOSystem->frameBuffer().initialize(title,
|
||||
myMediaSource->width() << 1,
|
||||
myMediaSource->height());
|
||||
bool enable = myProperties.get(Display_Phosphor) == "YES";
|
||||
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
|
||||
myOSystem->frameBuffer().enablePhosphor(enable, blend);
|
||||
setPalette(myOSystem->settings().getString("palette"));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::setChannels(int channels)
|
||||
{
|
||||
myOSystem->sound().setChannels(channels);
|
||||
|
||||
// Save to properties
|
||||
string sound = channels == 2 ? "Stereo" : "Mono";
|
||||
myProperties.set(Cartridge_Sound, sound);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -641,7 +608,7 @@ void Console::changeHeight(int direction)
|
|||
else if(direction == -1) // decrease Height
|
||||
{
|
||||
height--;
|
||||
if(height < 100)
|
||||
if(height < 200)
|
||||
{
|
||||
myOSystem->frameBuffer().showMessage("Height at minimum");
|
||||
return;
|
||||
|
@ -741,7 +708,7 @@ void Console::setColorLossPalette(bool loss)
|
|||
continue;
|
||||
|
||||
// If color-loss is enabled, fill the odd numbered palette entries
|
||||
// with grays values (calculated using the standard RGB -> grayscale
|
||||
// with gray values (calculated using the standard RGB -> grayscale
|
||||
// conversion formula)
|
||||
for(int j = 0; j < 128; ++j)
|
||||
{
|
||||
|
@ -761,6 +728,27 @@ void Console::setColorLossPalette(bool loss)
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 Console::getFrameRate() const
|
||||
{
|
||||
// Set the correct framerate based on the format of the ROM
|
||||
// This can be overridden by changing the framerate in the
|
||||
// VideoDialog box or on the commandline, but it can't be saved
|
||||
// (ie, framerate is now solely determined based on ROM format).
|
||||
int framerate = myOSystem->settings().getInt("framerate");
|
||||
if(framerate == -1)
|
||||
{
|
||||
if(myDisplayFormat == "NTSC" || myDisplayFormat == "PAL60")
|
||||
framerate = 60;
|
||||
else if(myDisplayFormat == "PAL")
|
||||
framerate = 50;
|
||||
else
|
||||
framerate = 60;
|
||||
}
|
||||
|
||||
return framerate;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 Console::ourNTSCPalette[256] = {
|
||||
0x000000, 0, 0x4a4a4a, 0, 0x6f6f6f, 0, 0x8e8e8e, 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: Console.hxx,v 1.56 2006-12-28 20:40:00 stephena Exp $
|
||||
// $Id: Console.hxx,v 1.57 2006-12-30 22:26:28 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.56 2006-12-28 20:40:00 stephena Exp $
|
||||
@version $Id: Console.hxx,v 1.57 2006-12-30 22:26:28 stephena Exp $
|
||||
*/
|
||||
class Console
|
||||
{
|
||||
|
@ -172,26 +172,20 @@ class Console
|
|||
*/
|
||||
void toggleColorLoss();
|
||||
|
||||
/**
|
||||
Initialize the basic properties of the console.
|
||||
TODO - This is a workaround for a bug in the TIA rendering, whereby
|
||||
XStart/YStart values cause incorrect coordinates to be passed to the
|
||||
in-game GUI rendering.
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
Initialize the video subsystem wrt this class.
|
||||
This is required for changing window size, title, etc.
|
||||
|
||||
@param full Whether we want a full initialization,
|
||||
or only reset certain attributes.
|
||||
*/
|
||||
void initializeVideo();
|
||||
void initializeVideo(bool full = true);
|
||||
|
||||
/**
|
||||
Sets the number of sound channels
|
||||
|
||||
@param channels Number of channels (indicates stereo or mono)
|
||||
Initialize the audio subsystem wrt this class.
|
||||
This is required any time the sound settings change.
|
||||
*/
|
||||
void setChannels(int channels);
|
||||
void initializeAudio();
|
||||
|
||||
/**
|
||||
"Fry" the Atari (mangle memory/TIA contents)
|
||||
|
@ -266,6 +260,12 @@ class Console
|
|||
*/
|
||||
const uInt32* getPalette(int direction) const;
|
||||
|
||||
/**
|
||||
Returns the framerate based on a number of factors
|
||||
(whether 'framerate' is set, what display format is in use, etc)
|
||||
*/
|
||||
uInt32 getFrameRate() const;
|
||||
|
||||
private:
|
||||
// Pointer to the osystem object
|
||||
OSystem* myOSystem;
|
||||
|
|
|
@ -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: Event.hxx,v 1.23 2006-12-08 16:49:25 stephena Exp $
|
||||
// $Id: Event.hxx,v 1.24 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENT_HXX
|
||||
|
@ -26,7 +26,7 @@ class EventStreamer;
|
|||
|
||||
/**
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Event.hxx,v 1.23 2006-12-08 16:49:25 stephena Exp $
|
||||
@version $Id: Event.hxx,v 1.24 2006-12-30 22:26:28 stephena Exp $
|
||||
*/
|
||||
class Event
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ class Event
|
|||
DrivingOneClockwise, DrivingOneCounterClockwise, DrivingOneValue,
|
||||
DrivingOneFire,
|
||||
|
||||
ChangeState, LoadState, SaveState, TakeSnapshot, Pause, Quit,
|
||||
ChangeState, LoadState, SaveState, TakeSnapshot, Quit,
|
||||
MenuMode, CmdMenuMode, DebuggerMode, LauncherMode, Fry,
|
||||
VolumeDecrease, VolumeIncrease,
|
||||
|
||||
|
|
|
@ -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.191 2006-12-28 18:31:26 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.192 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -62,7 +62,6 @@ EventHandler::EventHandler(OSystem* osystem)
|
|||
myOverlay(NULL),
|
||||
myState(S_NONE),
|
||||
myLSState(0),
|
||||
myPauseFlag(false),
|
||||
myGrabMouseFlag(false),
|
||||
myUseLauncherFlag(false),
|
||||
myFryingFlag(false),
|
||||
|
@ -161,9 +160,6 @@ void EventHandler::reset(State state)
|
|||
setEventState(state);
|
||||
|
||||
myLSState = 0;
|
||||
myPauseFlag = false;
|
||||
|
||||
pause(false);
|
||||
myEvent->clear();
|
||||
|
||||
if(myState == S_LAUNCHER)
|
||||
|
@ -211,20 +207,6 @@ void EventHandler::refreshDisplay(bool forceUpdate)
|
|||
myOSystem->frameBuffer().update();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::pause(bool status)
|
||||
{
|
||||
myPauseFlag = status;
|
||||
|
||||
if(&myOSystem->frameBuffer())
|
||||
myOSystem->frameBuffer().pause(myPauseFlag);
|
||||
if(&myOSystem->sound())
|
||||
myOSystem->sound().mute(myPauseFlag);
|
||||
|
||||
// Inform the OSystem of the change in pause
|
||||
myOSystem->pauseChanged(myPauseFlag);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::setupJoysticks()
|
||||
{
|
||||
|
@ -657,8 +639,7 @@ void EventHandler::poll(uInt32 time)
|
|||
|
||||
case SDL_ACTIVEEVENT:
|
||||
if((event.active.state & SDL_APPACTIVE) && (event.active.gain == 0))
|
||||
if(!myPauseFlag)
|
||||
handleEvent(Event::Pause, 1);
|
||||
if(myState == S_EMULATE) enterMenuMode(S_MENU);
|
||||
break; // SDL_ACTIVEEVENT
|
||||
|
||||
case SDL_QUIT:
|
||||
|
@ -1168,41 +1149,36 @@ void EventHandler::handleEvent(Event::Type event, int state)
|
|||
return;
|
||||
|
||||
case Event::Fry:
|
||||
if(!myPauseFlag)
|
||||
myFryingFlag = bool(state);
|
||||
myFryingFlag = bool(state);
|
||||
return;
|
||||
|
||||
case Event::VolumeDecrease:
|
||||
case Event::VolumeIncrease:
|
||||
if(state && !myPauseFlag)
|
||||
if(state)
|
||||
myOSystem->sound().adjustVolume(event == Event::VolumeIncrease ? 1 : -1);
|
||||
return;
|
||||
|
||||
case Event::SaveState:
|
||||
if(state && !myPauseFlag) saveState();
|
||||
if(state) saveState();
|
||||
return;
|
||||
|
||||
case Event::ChangeState:
|
||||
if(state && !myPauseFlag) changeState();
|
||||
if(state) changeState();
|
||||
return;
|
||||
|
||||
case Event::LoadState:
|
||||
if(state && !myPauseFlag) loadState();
|
||||
if(state) loadState();
|
||||
return;
|
||||
|
||||
case Event::TakeSnapshot:
|
||||
if(state && !myPauseFlag) takeSnapshot();
|
||||
return;
|
||||
|
||||
case Event::Pause:
|
||||
if(state)
|
||||
pause(!myPauseFlag);
|
||||
if(state) takeSnapshot();
|
||||
return;
|
||||
|
||||
case Event::LauncherMode:
|
||||
// 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 && state)
|
||||
if((myState == S_EMULATE || myState == S_CMDMENU) &&
|
||||
myUseLauncherFlag && state)
|
||||
{
|
||||
myOSystem->settings().saveConfig();
|
||||
myOSystem->deleteConsole();
|
||||
|
@ -1234,27 +1210,17 @@ bool EventHandler::eventStateChange(Event::Type type)
|
|||
switch(type)
|
||||
{
|
||||
case Event::MenuMode:
|
||||
if(!myPauseFlag)
|
||||
{
|
||||
if(myState == S_EMULATE)
|
||||
enterMenuMode(S_MENU);
|
||||
else
|
||||
handled = false;
|
||||
}
|
||||
if(myState == S_EMULATE)
|
||||
enterMenuMode(S_MENU);
|
||||
else
|
||||
handled = false;
|
||||
break;
|
||||
|
||||
case Event::CmdMenuMode:
|
||||
if(!myPauseFlag)
|
||||
{
|
||||
if(myState == S_EMULATE)
|
||||
enterMenuMode(S_CMDMENU);
|
||||
else if(myState == S_CMDMENU)
|
||||
leaveMenuMode();
|
||||
else
|
||||
handled = false;
|
||||
}
|
||||
if(myState == S_EMULATE)
|
||||
enterMenuMode(S_CMDMENU);
|
||||
else if(myState == S_CMDMENU)
|
||||
leaveMenuMode();
|
||||
else
|
||||
handled = false;
|
||||
break;
|
||||
|
@ -1769,7 +1735,6 @@ void EventHandler::setDefaultKeymap(EventMode mode)
|
|||
myKeyTable[ SDLK_F10 ][mode] = Event::ChangeState;
|
||||
myKeyTable[ SDLK_F11 ][mode] = Event::LoadState;
|
||||
myKeyTable[ SDLK_F12 ][mode] = Event::TakeSnapshot;
|
||||
myKeyTable[ SDLK_PAUSE ][mode] = Event::Pause;
|
||||
myKeyTable[ SDLK_BACKSPACE ][mode] = Event::Fry;
|
||||
myKeyTable[ SDLK_TAB ][mode] = Event::MenuMode;
|
||||
myKeyTable[ SDLK_BACKSLASH ][mode] = Event::CmdMenuMode;
|
||||
|
@ -2224,8 +2189,8 @@ void EventHandler::enterMenuMode(State state)
|
|||
myOverlay->reStack();
|
||||
|
||||
refreshDisplay();
|
||||
|
||||
myOSystem->frameBuffer().setCursorState();
|
||||
|
||||
myOSystem->sound().mute(true);
|
||||
myEvent->clear();
|
||||
}
|
||||
|
@ -2236,8 +2201,8 @@ void EventHandler::leaveMenuMode()
|
|||
setEventState(S_EMULATE);
|
||||
|
||||
refreshDisplay();
|
||||
|
||||
myOSystem->frameBuffer().setCursorState();
|
||||
|
||||
myOSystem->sound().mute(false);
|
||||
myEvent->clear();
|
||||
}
|
||||
|
@ -2253,11 +2218,9 @@ bool EventHandler::enterDebugMode()
|
|||
myOSystem->createFrameBuffer();
|
||||
myOverlay->reStack();
|
||||
myOSystem->frameBuffer().setCursorState();
|
||||
myOSystem->sound().mute(true);
|
||||
myEvent->clear();
|
||||
|
||||
if(!myPauseFlag) // Pause when entering debugger mode
|
||||
handleEvent(Event::Pause, 1);
|
||||
|
||||
// Make sure debugger starts in a consistent state
|
||||
myOSystem->debugger().setStartState();
|
||||
|
||||
|
@ -2265,7 +2228,7 @@ bool EventHandler::enterDebugMode()
|
|||
// (sometimes entering on a breakpoint doesn't draw contents)
|
||||
refreshDisplay();
|
||||
#else
|
||||
myOSystem->frameBuffer().showMessage("Developer/debugger unsupported");
|
||||
myOSystem->frameBuffer().showMessage("Debugger unsupported");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -2286,10 +2249,8 @@ void EventHandler::leaveDebugMode()
|
|||
myOSystem->createFrameBuffer();
|
||||
refreshDisplay();
|
||||
myOSystem->frameBuffer().setCursorState();
|
||||
myOSystem->sound().mute(false);
|
||||
myEvent->clear();
|
||||
|
||||
if(myPauseFlag) // Un-Pause when leaving debugger mode
|
||||
handleEvent(Event::Pause, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2586,7 +2547,6 @@ EventHandler::ActionList EventHandler::ourEmulActionList[kEmulActionListSize] =
|
|||
{ Event::ChangeState, "Change State", 0 },
|
||||
{ Event::LoadState, "Load State", 0 },
|
||||
{ Event::TakeSnapshot, "Snapshot", 0 },
|
||||
{ Event::Pause, "Pause", 0 },
|
||||
{ Event::Fry, "Fry cartridge", 0 },
|
||||
{ Event::VolumeDecrease, "Decrease volume", 0 },
|
||||
{ Event::VolumeIncrease, "Increase volume", 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: EventHandler.hxx,v 1.96 2006-12-28 18:31:26 stephena Exp $
|
||||
// $Id: EventHandler.hxx,v 1.97 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENTHANDLER_HXX
|
||||
|
@ -62,7 +62,7 @@ enum EventMode {
|
|||
mapping can take place.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: EventHandler.hxx,v 1.96 2006-12-28 18:31:26 stephena Exp $
|
||||
@version $Id: EventHandler.hxx,v 1.97 2006-12-30 22:26:28 stephena Exp $
|
||||
*/
|
||||
class EventHandler
|
||||
{
|
||||
|
@ -178,16 +178,6 @@ class EventHandler
|
|||
*/
|
||||
void refreshDisplay(bool forceUpdate = false);
|
||||
|
||||
/**
|
||||
This method pauses the entire emulator.
|
||||
*/
|
||||
void pause(bool status);
|
||||
|
||||
/**
|
||||
This method indicates whether a pause event has been received.
|
||||
*/
|
||||
inline bool isPaused() { return myPauseFlag; }
|
||||
|
||||
/**
|
||||
This method indicates that the system should terminate.
|
||||
*/
|
||||
|
@ -467,7 +457,7 @@ class EventHandler
|
|||
|
||||
private:
|
||||
enum {
|
||||
kEmulActionListSize = 81,
|
||||
kEmulActionListSize = 80,
|
||||
kMenuActionListSize = 15
|
||||
};
|
||||
|
||||
|
@ -547,9 +537,6 @@ class EventHandler
|
|||
// Indicates the current state to use for state loading/saving
|
||||
uInt32 myLSState;
|
||||
|
||||
// Indicates the current pause status
|
||||
bool myPauseFlag;
|
||||
|
||||
// Indicates whether the mouse cursor is grabbed
|
||||
bool myGrabMouseFlag;
|
||||
|
||||
|
|
|
@ -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.113 2006-12-29 16:52:43 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.114 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -110,10 +110,6 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
|
|||
// (lowercase vs. uppercase characters)
|
||||
SDL_EnableUNICODE(1);
|
||||
|
||||
// Set palette for GUI
|
||||
for(int i = 0; i < kNumColors-256; i++)
|
||||
myDefPalette[i+256] = mapRGB(ourGUIColors[i][0], ourGUIColors[i][1], ourGUIColors[i][2]);
|
||||
|
||||
// Erase any messages from a previous run
|
||||
myMessage.counter = 0;
|
||||
|
||||
|
@ -136,20 +132,14 @@ void FrameBuffer::update()
|
|||
{
|
||||
case EventHandler::S_EMULATE:
|
||||
{
|
||||
bool mediaSourceChanged = false;
|
||||
// Run the console for one frame
|
||||
myOSystem->console().mediaSource().update();
|
||||
if(myOSystem->eventHandler().frying())
|
||||
myOSystem->console().fry();
|
||||
|
||||
// Draw changes to the mediasource
|
||||
if(!myOSystem->eventHandler().isPaused())
|
||||
{
|
||||
myOSystem->console().mediaSource().update();
|
||||
if(myOSystem->eventHandler().frying())
|
||||
myOSystem->console().fry();
|
||||
mediaSourceChanged = true; // mediasource changed, so force an update
|
||||
}
|
||||
// And update the screen
|
||||
drawMediaSource();
|
||||
|
||||
// Only update the screen if it's been invalidated
|
||||
if(mediaSourceChanged || theRedrawTIAIndicator)
|
||||
drawMediaSource();
|
||||
break; // S_EMULATE
|
||||
}
|
||||
|
||||
|
@ -301,11 +291,6 @@ inline void FrameBuffer::drawMessage()
|
|||
addDirtyRect(myMessage.x, myMessage.y, myMessage.w, myMessage.h);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::pause(bool status)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::refresh()
|
||||
{
|
||||
|
@ -313,16 +298,16 @@ void FrameBuffer::refresh()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::setPalette(const uInt32* palette)
|
||||
void FrameBuffer::setTIAPalette(const uInt32* palette)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
// Set palette for normal fill
|
||||
for(i = 0; i < 256; ++i)
|
||||
{
|
||||
Uint8 r = (Uint8) ((palette[i] & 0x00ff0000) >> 16);
|
||||
Uint8 g = (Uint8) ((palette[i] & 0x0000ff00) >> 8);
|
||||
Uint8 b = (Uint8) (palette[i] & 0x000000ff);
|
||||
Uint8 r = (palette[i] >> 16) & 0xff;
|
||||
Uint8 g = (palette[i] >> 8) & 0xff;
|
||||
Uint8 b = palette[i] & 0xff;
|
||||
|
||||
myDefPalette[i] = mapRGB(r, g, b);
|
||||
}
|
||||
|
@ -332,12 +317,12 @@ void FrameBuffer::setPalette(const uInt32* palette)
|
|||
{
|
||||
for(j = 0; j < 256; ++j)
|
||||
{
|
||||
uInt8 ri = (uInt8) ((palette[i] & 0x00ff0000) >> 16);
|
||||
uInt8 gi = (uInt8) ((palette[i] & 0x0000ff00) >> 8);
|
||||
uInt8 bi = (uInt8) (palette[i] & 0x000000ff);
|
||||
uInt8 rj = (uInt8) ((palette[j] & 0x00ff0000) >> 16);
|
||||
uInt8 gj = (uInt8) ((palette[j] & 0x0000ff00) >> 8);
|
||||
uInt8 bj = (uInt8) (palette[j] & 0x000000ff);
|
||||
uInt8 ri = (palette[i] >> 16) & 0xff;
|
||||
uInt8 gi = (palette[i] >> 8) & 0xff;
|
||||
uInt8 bi = palette[i] & 0xff;
|
||||
uInt8 rj = (palette[j] >> 16) & 0xff;
|
||||
uInt8 gj = (palette[j] >> 8) & 0xff;
|
||||
uInt8 bj = palette[j] & 0xff;
|
||||
|
||||
Uint8 r = (Uint8) getPhosphor(ri, rj);
|
||||
Uint8 g = (Uint8) getPhosphor(gi, gj);
|
||||
|
@ -350,6 +335,19 @@ void FrameBuffer::setPalette(const uInt32* palette)
|
|||
theRedrawTIAIndicator = true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::setUIPalette(const uInt32* palette)
|
||||
{
|
||||
// Set palette for GUI
|
||||
for(int i = 0; i < kNumColors-256; ++i)
|
||||
{
|
||||
Uint8 r = (palette[i] >> 16) & 0xff;
|
||||
Uint8 g = (palette[i] >> 8) & 0xff;
|
||||
Uint8 b = palette[i] & 0xff;
|
||||
myDefPalette[i+256] = mapRGB(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::toggleFullscreen()
|
||||
{
|
||||
|
@ -747,21 +745,6 @@ const string& FrameBuffer::currentScalerName()
|
|||
myOSystem->settings().getString("scale_ui") );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const uInt8 FrameBuffer::ourGUIColors[kNumColors-256][3] = {
|
||||
{ 104, 104, 104 }, // kColor
|
||||
{ 0, 0, 0 }, // kBGColor
|
||||
{ 64, 64, 64 }, // kShadowColor
|
||||
{ 200, 200, 255 }, // kHiliteColor
|
||||
{ 32, 160, 32 }, // kTextColor
|
||||
#if !defined(GP2X) // Quick GP2X hack to change colours, until an in-game GUI is added
|
||||
{ 0, 255, 0 }, // kTextColorHi
|
||||
#else
|
||||
{ 0, 0, 255 }, // kTextColorHi
|
||||
#endif
|
||||
{ 200, 0, 0 } // kTextColorEm
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Scaler FrameBuffer::ourScalers[kScalerListSize] = {
|
||||
{ kZOOM1X, "Zoom1x", "zoom1x", 1 },
|
||||
|
|
|
@ -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.hxx,v 1.82 2006-12-19 12:40:30 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.83 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -93,7 +93,7 @@ struct Scaler {
|
|||
All GUI elements (ala ScummVM) are drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.82 2006-12-19 12:40:30 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.83 2006-12-30 22:26:28 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -172,13 +172,6 @@ class FrameBuffer
|
|||
*/
|
||||
inline const uInt32 imageHeight() { return myImageDim.h; }
|
||||
|
||||
/**
|
||||
Handle the pause event; currently this updates the palette.
|
||||
|
||||
@param status Whether pause has been enabled or disabled
|
||||
*/
|
||||
void pause(bool status);
|
||||
|
||||
/**
|
||||
Indicates that the TIA area is dirty, and certain areas need
|
||||
to be redrawn.
|
||||
|
@ -238,11 +231,18 @@ class FrameBuffer
|
|||
void setWindowTitle(const string& title);
|
||||
|
||||
/**
|
||||
Set up the palette for a screen of any depth > 8.
|
||||
Set up the TIA/emulation palette for a screen of any depth > 8.
|
||||
|
||||
@param palette The array of colors
|
||||
*/
|
||||
virtual void setPalette(const uInt32* palette);
|
||||
virtual void setTIAPalette(const uInt32* palette);
|
||||
|
||||
/**
|
||||
Set up the user interface palette for a screen of any depth > 8.
|
||||
|
||||
@param palette The array of colors
|
||||
*/
|
||||
virtual void setUIPalette(const uInt32* palette);
|
||||
|
||||
/**
|
||||
This method should be called to draw a rectangular box with sides
|
||||
|
@ -493,9 +493,6 @@ class FrameBuffer
|
|||
// Amount to blend when using phosphor effect
|
||||
int myPhosphorBlend;
|
||||
|
||||
// Table of RGB values for GUI elements
|
||||
static const uInt8 ourGUIColors[kNumColors-256][3];
|
||||
|
||||
private:
|
||||
/**
|
||||
Set the icon for the main SDL window.
|
||||
|
|
|
@ -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.86 2006-12-28 20:40:00 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.87 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -136,6 +136,18 @@ bool OSystem::create()
|
|||
myLauncherFont = new GUI::Font(GUI::stellaDesc); // FIXME
|
||||
myConsoleFont = new GUI::Font(GUI::consoleDesc);
|
||||
|
||||
// Create the event handler for the system
|
||||
myEventHandler = new EventHandler(this);
|
||||
myEventHandler->initialize();
|
||||
|
||||
// Create a properties set for us to use and set it up
|
||||
myPropSet = new PropertiesSet(this);
|
||||
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
myCheatManager = new CheatManager(this);
|
||||
myCheatManager->loadCheatDatabase();
|
||||
#endif
|
||||
|
||||
// Create menu and launcher GUI objects
|
||||
myMenu = new Menu(this);
|
||||
myCommandMenu = new CommandMenu(this);
|
||||
|
@ -143,17 +155,6 @@ bool OSystem::create()
|
|||
#ifdef DEBUGGER_SUPPORT
|
||||
myDebugger = new Debugger(this);
|
||||
#endif
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
myCheatManager = new CheatManager(this);
|
||||
myCheatManager->loadCheatDatabase();
|
||||
#endif
|
||||
|
||||
// Create the event handler for the system
|
||||
myEventHandler = new EventHandler(this);
|
||||
myEventHandler->initialize();
|
||||
|
||||
// Create a properties set for us to use and set it up
|
||||
myPropSet = new PropertiesSet(this);
|
||||
|
||||
// Create the sound object; the sound subsystem isn't actually
|
||||
// opened until needed, so this is non-blocking (on those systems
|
||||
|
@ -170,7 +171,6 @@ bool OSystem::create()
|
|||
#ifdef JOYSTICK_SUPPORT
|
||||
myFeatures += "Joystick ";
|
||||
#endif
|
||||
myFeatures += "Snapshot ";
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
myFeatures += "Debugger ";
|
||||
#endif
|
||||
|
@ -243,18 +243,6 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
case EventHandler::S_MENU:
|
||||
case EventHandler::S_CMDMENU:
|
||||
myConsole->initializeVideo();
|
||||
if(showmessage)
|
||||
{
|
||||
switch(myFrameBuffer->type())
|
||||
{
|
||||
case kSoftBuffer:
|
||||
myFrameBuffer->showMessage("Software mode");
|
||||
break;
|
||||
case kGLBuffer:
|
||||
myFrameBuffer->showMessage("OpenGL mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break; // S_EMULATE, S_MENU, S_CMDMENU
|
||||
|
||||
case EventHandler::S_LAUNCHER:
|
||||
|
@ -274,6 +262,27 @@ bool OSystem::createFrameBuffer(bool showmessage)
|
|||
// Setup the SDL joysticks (must be done after FrameBuffer is created)
|
||||
if(changeBuffer) myEventHandler->setupJoysticks();
|
||||
|
||||
// Update the UI palette
|
||||
// For now, we just use the standard palette
|
||||
// Once an interface is created for this, it will be changable
|
||||
// within the emulation
|
||||
int palette = 0; // 1 indicates GP2X, but it should be called something else
|
||||
// Perhaps tweaked and called high-contrast or something??
|
||||
myFrameBuffer->setUIPalette(&ourGUIColors[palette][0]);
|
||||
|
||||
if(showmessage)
|
||||
{
|
||||
switch(myFrameBuffer->type())
|
||||
{
|
||||
case kSoftBuffer:
|
||||
myFrameBuffer->showMessage("Software mode");
|
||||
break;
|
||||
case kGLBuffer:
|
||||
myFrameBuffer->showMessage("OpenGL mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -290,28 +299,14 @@ void OSystem::toggleFrameBuffer()
|
|||
else // a driver that doesn't exist was requested, so use software mode
|
||||
video = "soft";
|
||||
|
||||
myEventHandler->handleEvent(Event::Pause, 0);
|
||||
|
||||
// Remember the pause state
|
||||
bool pause = myEventHandler->isPaused();
|
||||
|
||||
// Update the settings and create the framebuffer
|
||||
mySettings->setString("video", video);
|
||||
createFrameBuffer(true); // show onscreen message
|
||||
|
||||
// And re-pause the system
|
||||
myEventHandler->pause(pause);
|
||||
createFrameBuffer(true); // show onscreen message, re-initialize framebuffer
|
||||
|
||||
// The palette and phosphor info for the framebuffer will be lost
|
||||
// when a new framebuffer is created; we must restore it
|
||||
if(myConsole)
|
||||
{
|
||||
const Properties& props = myConsole->properties();
|
||||
bool enable = props.get(Display_Phosphor) == "YES";
|
||||
int blend = atoi(props.get(Display_PPBlend).c_str());
|
||||
myFrameBuffer->enablePhosphor(enable, blend);
|
||||
myConsole->setPalette(mySettings->getString("palette"));
|
||||
}
|
||||
myConsole->initializeVideo(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -359,11 +354,13 @@ bool OSystem::createConsole(const string& romfile)
|
|||
#ifdef CHEATCODE_SUPPORT
|
||||
myCheatManager->loadCheats(md5);
|
||||
#endif
|
||||
setFramerate(60); // We need to set framerate to see messages
|
||||
myEventHandler->reset(EventHandler::S_EMULATE);
|
||||
createFrameBuffer(false);
|
||||
myFrameBuffer->setCursorState();
|
||||
myConsole->initialize(); // Must be done *after* the framebuffer is created
|
||||
createFrameBuffer(false); // Takes care of initializeVideo()
|
||||
myConsole->initializeAudio();
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
myDebugger->setConsole(myConsole);
|
||||
myDebugger->initialize();
|
||||
#endif
|
||||
|
||||
if(showmessage)
|
||||
myFrameBuffer->showMessage("New console created");
|
||||
|
@ -375,6 +372,7 @@ bool OSystem::createConsole(const string& romfile)
|
|||
// Update the timing info for a new console run
|
||||
resetLoopTiming();
|
||||
|
||||
myFrameBuffer->setCursorState();
|
||||
retval = true;
|
||||
}
|
||||
else
|
||||
|
@ -685,11 +683,6 @@ void OSystem::stateChanged(EventHandler::State state)
|
|||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::pauseChanged(bool status)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::mainLoop()
|
||||
{
|
||||
|
@ -711,6 +704,25 @@ void OSystem::mainLoop()
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/*
|
||||
Palette is defined as follows:
|
||||
kColor
|
||||
kBGColor
|
||||
kShadowColor
|
||||
kHiliteColor
|
||||
kTextColor
|
||||
kTextColorHi
|
||||
kTextColorEm
|
||||
*/
|
||||
uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = {
|
||||
// Normal mode
|
||||
{ 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x00ff00, 0xc80000 },
|
||||
// GP2X
|
||||
{ 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x0000ff, 0xc80000 }
|
||||
// Others to be added ...
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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.49 2006-12-28 18:31:26 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.50 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -45,7 +45,7 @@ class VideoDialog;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.49 2006-12-28 18:31:26 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.50 2006-12-30 22:26:28 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -355,11 +355,6 @@ class OSystem
|
|||
*/
|
||||
virtual void stateChanged(EventHandler::State state);
|
||||
|
||||
/**
|
||||
Informs the OSystem of a change in pause status.
|
||||
*/
|
||||
virtual void pauseChanged(bool status);
|
||||
|
||||
protected:
|
||||
/**
|
||||
Set the base directory for all Stella files
|
||||
|
@ -430,6 +425,7 @@ class OSystem
|
|||
bool myQuitLoop;
|
||||
|
||||
private:
|
||||
enum { kNumUIPalettes = 2 };
|
||||
string myBaseDir;
|
||||
string myStateDir;
|
||||
|
||||
|
@ -460,6 +456,9 @@ class OSystem
|
|||
};
|
||||
TimingInfo myTimingInfo;
|
||||
|
||||
// Table of RGB values for GUI elements
|
||||
static uInt32 ourGUIColors[kNumUIPalettes][kNumColors-256];
|
||||
|
||||
private:
|
||||
/**
|
||||
Creates the various framebuffers/renderers available in this system
|
||||
|
|
|
@ -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.109 2006-12-28 20:40:00 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.110 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -241,14 +241,6 @@ void Settings::validate()
|
|||
#endif
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
i = getInt("fragsize");
|
||||
if(i != 256 && i != 512 && i != 1024 && i != 2048 && i != 4096)
|
||||
#ifdef WIN32
|
||||
setInternal("fragsize", "2048");
|
||||
#else
|
||||
setInternal("fragsize", "512");
|
||||
#endif
|
||||
|
||||
i = getInt("volume");
|
||||
if(i < 0 || i > 100)
|
||||
setInternal("volume", "100");
|
||||
|
@ -325,7 +317,6 @@ void Settings::usage()
|
|||
<< endl
|
||||
#ifdef SOUND_SUPPORT
|
||||
<< " -sound <1|0> Enable sound generation\n"
|
||||
<< " -channels <1|2> Enable mono or stereo sound\n"
|
||||
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n"
|
||||
<< " -freq <number> Set sound sample output frequency (0 - 48000)\n"
|
||||
<< " -tiafreq <number> Set sound sample generation frequency (0 - 48000)\n"
|
||||
|
|
|
@ -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: OSystemGP2X.cxx,v 1.23 2006-12-28 18:31:26 stephena Exp $
|
||||
// $Id: OSystemGP2X.cxx,v 1.24 2006-12-30 22:26:28 stephena Exp $
|
||||
// Modified on 2006/01/06 by Alex Zaballa for use on GP2X
|
||||
//============================================================================
|
||||
|
||||
|
@ -106,7 +106,7 @@ void OSystemGP2X::setDefaultJoymap()
|
|||
myEventHandler->setDefaultJoyMapping(Event::CmdMenuMode, kEmulationMode, 0, 12); // A
|
||||
myEventHandler->setDefaultJoyMapping(Event::JoystickZeroFire, kEmulationMode, 0, 13); // B
|
||||
myEventHandler->setDefaultJoyMapping(Event::MenuMode, kEmulationMode, 0, 14); // Y
|
||||
myEventHandler->setDefaultJoyMapping(Event::Pause, kEmulationMode, 0, 15); // X
|
||||
// myEventHandler->setDefaultJoyMapping(Event::Pause, kEmulationMode, 0, 15); // X
|
||||
myEventHandler->setDefaultJoyMapping(Event::VolumeIncrease, kEmulationMode, 0, 16); // Vol+
|
||||
myEventHandler->setDefaultJoyMapping(Event::VolumeDecrease, kEmulationMode, 0, 17); // Vol-
|
||||
myEventHandler->setDefaultJoyMapping(Event::NoType, kEmulationMode, 0, 18); // Click
|
||||
|
|
|
@ -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: AudioDialog.cxx,v 1.22 2006-12-08 16:49:32 stephena Exp $
|
||||
// $Id: AudioDialog.cxx,v 1.23 2006-12-30 22:26:28 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -65,11 +65,12 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myFragsizePopup = new PopUpWidget(this, font, xpos, ypos,
|
||||
pwidth + myVolumeLabel->getWidth() - 4, lineHeight,
|
||||
"Fragment size: ", lwidth);
|
||||
myFragsizePopup->appendEntry("256", 1);
|
||||
myFragsizePopup->appendEntry("512", 2);
|
||||
myFragsizePopup->appendEntry("1024", 3);
|
||||
myFragsizePopup->appendEntry("2048", 4);
|
||||
myFragsizePopup->appendEntry("4096", 5);
|
||||
myFragsizePopup->appendEntry("128", 1);
|
||||
myFragsizePopup->appendEntry("256", 2);
|
||||
myFragsizePopup->appendEntry("512", 3);
|
||||
myFragsizePopup->appendEntry("1024", 4);
|
||||
myFragsizePopup->appendEntry("2048", 5);
|
||||
myFragsizePopup->appendEntry("4096", 6);
|
||||
wid.push_back(myFragsizePopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
|
@ -97,14 +98,8 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.push_back(myTiaFreqPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Stereo sound
|
||||
mySoundTypeCheckbox = new CheckboxWidget(this, font, 20, ypos,
|
||||
"Stereo mode", 0);
|
||||
wid.push_back(mySoundTypeCheckbox);
|
||||
|
||||
// Clip volume
|
||||
myClipVolumeCheckbox = new CheckboxWidget(this, font,
|
||||
40 + mySoundTypeCheckbox->getWidth(), ypos,
|
||||
myClipVolumeCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
|
||||
"Clip volume", 0);
|
||||
wid.push_back(myClipVolumeCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
@ -155,11 +150,12 @@ void AudioDialog::loadConfig()
|
|||
|
||||
// Fragsize
|
||||
i = instance()->settings().getInt("fragsize");
|
||||
if(i == 256) i = 1;
|
||||
else if(i == 512) i = 2;
|
||||
else if(i == 1024) i = 3;
|
||||
else if(i == 2048) i = 4;
|
||||
else if(i == 4096) i = 5;
|
||||
if(i == 128) i = 1;
|
||||
else if(i == 256) i = 2;
|
||||
else if(i == 512) i = 3;
|
||||
else if(i == 1024) i = 4;
|
||||
else if(i == 2048) i = 5;
|
||||
else if(i == 4096) i = 6;
|
||||
myFragsizePopup->setSelectedTag(i);
|
||||
|
||||
// Output frequency
|
||||
|
@ -182,10 +178,6 @@ void AudioDialog::loadConfig()
|
|||
else i = 3; // default to '31400'
|
||||
myTiaFreqPopup->setSelectedTag(i);
|
||||
|
||||
// Stereo mode
|
||||
i = instance()->settings().getInt("channels");
|
||||
mySoundTypeCheckbox->setState(i == 2);
|
||||
|
||||
// Clip volume
|
||||
b = instance()->settings().getBool("clipvol");
|
||||
myClipVolumeCheckbox->setState(b);
|
||||
|
@ -201,71 +193,39 @@ void AudioDialog::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AudioDialog::saveConfig()
|
||||
{
|
||||
Settings& settings = instance()->settings();
|
||||
string s;
|
||||
bool b;
|
||||
int i;
|
||||
bool b, restart = false;
|
||||
|
||||
// Volume
|
||||
i = myVolumeSlider->getValue();
|
||||
instance()->sound().setVolume(i);
|
||||
|
||||
// Fragsize (requires a restart to take effect)
|
||||
i = 1;
|
||||
i <<= (myFragsizePopup->getSelectedTag() + 7);
|
||||
if(instance()->settings().getInt("fragsize") != i)
|
||||
{
|
||||
instance()->settings().setInt("fragsize", i);
|
||||
restart = true;
|
||||
}
|
||||
// Fragsize
|
||||
s = myFragsizePopup->getSelectedString();
|
||||
settings.setString("fragsize", s);
|
||||
|
||||
// Output frequency (requires a restart to take effect)
|
||||
// Output frequency
|
||||
s = myFreqPopup->getSelectedString();
|
||||
if(instance()->settings().getString("freq") != s)
|
||||
{
|
||||
instance()->settings().setString("freq", s);
|
||||
restart = true;
|
||||
}
|
||||
settings.setString("freq", s);
|
||||
|
||||
// TIA frequency (requires a restart to take effect)
|
||||
// TIA frequency
|
||||
s = myTiaFreqPopup->getSelectedString();
|
||||
if(instance()->settings().getString("tiafreq") != s)
|
||||
{
|
||||
instance()->settings().setString("tiafreq", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Enable/disable stereo sound (requires a restart to take effect)
|
||||
b = mySoundTypeCheckbox->getState();
|
||||
if((instance()->settings().getInt("channels") == 2) != b)
|
||||
{
|
||||
instance()->console().setChannels(b ? 2 : 1);
|
||||
restart = true;
|
||||
}
|
||||
settings.setString("tiafreq", s);
|
||||
|
||||
// Enable/disable volume clipping (requires a restart to take effect)
|
||||
b = myClipVolumeCheckbox->getState();
|
||||
if(instance()->settings().getBool("clipvol") != b)
|
||||
{
|
||||
instance()->settings().setBool("clipvol", b);
|
||||
restart = true;
|
||||
}
|
||||
settings.setBool("clipvol", b);
|
||||
|
||||
// Enable/disable sound (requires a restart to take effect)
|
||||
b = mySoundEnableCheckbox->getState();
|
||||
if(instance()->settings().getBool("sound") != b)
|
||||
{
|
||||
instance()->sound().setEnabled(b);
|
||||
restart = true;
|
||||
}
|
||||
instance()->sound().setEnabled(b);
|
||||
|
||||
// Only force a re-initialization when necessary, since it can
|
||||
// be a time-consuming operation
|
||||
if(restart)
|
||||
{
|
||||
instance()->sound().close();
|
||||
instance()->sound().initialize();
|
||||
instance()->sound().mute(true);
|
||||
}
|
||||
if(&instance()->console())
|
||||
instance()->console().initializeAudio();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -275,15 +235,14 @@ void AudioDialog::setDefaults()
|
|||
myVolumeLabel->setLabel("100");
|
||||
|
||||
#ifdef WIN32
|
||||
myFragsizePopup->setSelectedTag(4);
|
||||
myFragsizePopup->setSelectedTag(5);
|
||||
#else
|
||||
myFragsizePopup->setSelectedTag(2);
|
||||
myFragsizePopup->setSelectedTag(3);
|
||||
#endif
|
||||
myFreqPopup->setSelectedTag(3);
|
||||
myTiaFreqPopup->setSelectedTag(3);
|
||||
|
||||
myClipVolumeCheckbox->setState(true);
|
||||
mySoundTypeCheckbox->setState(false);
|
||||
mySoundEnableCheckbox->setState(true);
|
||||
|
||||
// Make sure that mutually-exclusive items are not enabled at the same time
|
||||
|
@ -300,7 +259,6 @@ void AudioDialog::handleSoundEnableChange(bool active)
|
|||
myFragsizePopup->setEnabled(active);
|
||||
myFreqPopup->setEnabled(active);
|
||||
myTiaFreqPopup->setEnabled(active);
|
||||
mySoundTypeCheckbox->setEnabled(active);
|
||||
myClipVolumeCheckbox->setEnabled(active);
|
||||
}
|
||||
|
||||
|
|
|
@ -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: AudioDialog.hxx,v 1.9 2006-12-08 16:49:32 stephena Exp $
|
||||
// $Id: AudioDialog.hxx,v 1.10 2006-12-30 22:26:28 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -33,11 +33,6 @@ class CheckboxWidget;
|
|||
#include "OSystem.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
enum {
|
||||
kVolumeChanged = 'ADvc',
|
||||
kSoundEnableChanged = 'ADse'
|
||||
};
|
||||
|
||||
class AudioDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
|
@ -51,7 +46,6 @@ class AudioDialog : public Dialog
|
|||
PopUpWidget* myFragsizePopup;
|
||||
PopUpWidget* myFreqPopup;
|
||||
PopUpWidget* myTiaFreqPopup;
|
||||
CheckboxWidget* mySoundTypeCheckbox;
|
||||
CheckboxWidget* myClipVolumeCheckbox;
|
||||
CheckboxWidget* mySoundEnableCheckbox;
|
||||
|
||||
|
@ -62,6 +56,11 @@ class AudioDialog : public Dialog
|
|||
|
||||
void handleSoundEnableChange(bool active);
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
enum {
|
||||
kVolumeChanged = 'ADvc',
|
||||
kSoundEnableChanged = 'ADse'
|
||||
};
|
||||
};
|
||||
|
||||
#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: CommandDialog.cxx,v 1.10 2006-12-08 16:49:32 stephena Exp $
|
||||
// $Id: CommandDialog.cxx,v 1.11 2006-12-30 22:26:28 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -42,8 +42,6 @@ CommandDialog::CommandDialog(OSystem* osystem, DialogContainer* parent)
|
|||
// Set real dimensions
|
||||
_w = 4 * (lwidth) + 5;
|
||||
_h = 4 * (buttonHeight+5) + 5;
|
||||
_x = (osystem->frameBuffer().baseWidth() - _w) / 2;
|
||||
_y = (osystem->frameBuffer().baseHeight() - _h) / 2;
|
||||
|
||||
WidgetArray wid;
|
||||
ButtonWidget* b;
|
||||
|
@ -186,26 +184,28 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
case kFormatCmd:
|
||||
instance()->eventHandler().leaveMenuMode();
|
||||
instance()->console().toggleFormat();
|
||||
return;
|
||||
execute = false;
|
||||
break;
|
||||
|
||||
case kPaletteCmd:
|
||||
instance()->eventHandler().leaveMenuMode();
|
||||
instance()->console().togglePalette();
|
||||
return;
|
||||
execute = false;
|
||||
break;
|
||||
|
||||
case kReloadRomCmd:
|
||||
instance()->eventHandler().leaveMenuMode();
|
||||
instance()->deleteConsole();
|
||||
instance()->createConsole();
|
||||
return;
|
||||
execute = false;
|
||||
break;
|
||||
|
||||
case kExitCmd:
|
||||
if(instance()->eventHandler().useLauncher())
|
||||
event = Event::LauncherMode;
|
||||
instance()->eventHandler().handleEvent(Event::LauncherMode, 1);
|
||||
else
|
||||
event = Event::Quit;
|
||||
instance()->quit();
|
||||
execute = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -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: CommandMenu.cxx,v 1.4 2006-12-08 16:49:32 stephena Exp $
|
||||
// $Id: CommandMenu.cxx,v 1.5 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
@ -24,16 +24,10 @@
|
|||
CommandMenu::CommandMenu(OSystem* osystem)
|
||||
: DialogContainer(osystem)
|
||||
{
|
||||
myBaseDialog = new CommandDialog(myOSystem, this);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CommandMenu::~CommandMenu()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CommandMenu::initialize()
|
||||
{
|
||||
delete myBaseDialog;
|
||||
myBaseDialog = new CommandDialog(myOSystem, 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: CommandMenu.hxx,v 1.2 2006-12-08 16:49:32 stephena Exp $
|
||||
// $Id: CommandMenu.hxx,v 1.3 2006-12-30 22:26:28 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef COMMAND_MENU_HXX
|
||||
|
@ -28,7 +28,7 @@ class OSystem;
|
|||
The base dialog for common commands in Stella.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: CommandMenu.hxx,v 1.2 2006-12-08 16:49:32 stephena Exp $
|
||||
@version $Id: CommandMenu.hxx,v 1.3 2006-12-30 22:26:28 stephena Exp $
|
||||
*/
|
||||
class CommandMenu : public DialogContainer
|
||||
{
|
||||
|
@ -42,12 +42,6 @@ class CommandMenu : public DialogContainer
|
|||
Destructor
|
||||
*/
|
||||
virtual ~CommandMenu();
|
||||
|
||||
public:
|
||||
/**
|
||||
Updates the basedialog to be of the type defined for this derived class.
|
||||
*/
|
||||
void initialize();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,12 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Dialog.cxx,v 1.51 2006-12-08 20:19:58 stephena Exp $
|
||||
// $Id: Dialog.cxx,v 1.52 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Menu.hxx"
|
||||
|
@ -46,6 +44,7 @@ Dialog::Dialog(OSystem* instance, DialogContainer* parent,
|
|||
_okWidget(0),
|
||||
_cancelWidget(0),
|
||||
_visible(true),
|
||||
_center(true),
|
||||
_ourTab(NULL),
|
||||
_focusID(0)
|
||||
{
|
||||
|
@ -87,6 +86,17 @@ void Dialog::close()
|
|||
parent()->removeDialog();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::center()
|
||||
{
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
if(_center && &fb)
|
||||
{
|
||||
_x = (fb.baseWidth() - _w) / 2;
|
||||
_y = (fb.baseHeight() - _h) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::releaseFocus()
|
||||
{
|
||||
|
|
|
@ -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: Dialog.hxx,v 1.32 2006-12-08 16:49:33 stephena Exp $
|
||||
// $Id: Dialog.hxx,v 1.33 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -36,7 +36,7 @@ class TabWidget;
|
|||
This is the base class for all dialog boxes.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Dialog.hxx,v 1.32 2006-12-08 16:49:33 stephena Exp $
|
||||
@version $Id: Dialog.hxx,v 1.33 2006-12-30 22:26:29 stephena Exp $
|
||||
*/
|
||||
class Dialog : public GuiObject
|
||||
{
|
||||
|
@ -58,6 +58,7 @@ class Dialog : public GuiObject
|
|||
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
virtual void center();
|
||||
virtual void drawDialog();
|
||||
virtual void loadConfig() {}
|
||||
virtual void saveConfig() {}
|
||||
|
@ -70,6 +71,7 @@ class Dialog : public GuiObject
|
|||
void addOKWidget(Widget* w) { _okWidget = w; }
|
||||
void addCancelWidget(Widget* w) { _cancelWidget = w; }
|
||||
void setFocus(Widget* w);
|
||||
void setCenter(bool state) { _center = state; }
|
||||
|
||||
protected:
|
||||
virtual void draw();
|
||||
|
@ -107,6 +109,7 @@ class Dialog : public GuiObject
|
|||
Widget* _okWidget;
|
||||
Widget* _cancelWidget;
|
||||
bool _visible;
|
||||
bool _center;
|
||||
|
||||
private:
|
||||
FocusList _ourFocusList;
|
||||
|
|
|
@ -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: DialogContainer.cxx,v 1.34 2006-12-08 16:49:33 stephena Exp $
|
||||
// $Id: DialogContainer.cxx,v 1.35 2006-12-30 22:26:29 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
|
@ -111,6 +111,7 @@ void DialogContainer::addDialog(Dialog* d)
|
|||
{
|
||||
myDialogStack.push(d);
|
||||
|
||||
d->center();
|
||||
d->open();
|
||||
d->setDirty(); // Next update() will take care of drawing
|
||||
}
|
||||
|
|
|
@ -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: DialogContainer.hxx,v 1.19 2006-12-08 16:49:33 stephena Exp $
|
||||
// $Id: DialogContainer.hxx,v 1.20 2006-12-30 22:26:29 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DIALOG_CONTAINER_HXX
|
||||
|
@ -36,7 +36,7 @@ class OSystem;
|
|||
a stack, and handles their events.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: DialogContainer.hxx,v 1.19 2006-12-08 16:49:33 stephena Exp $
|
||||
@version $Id: DialogContainer.hxx,v 1.20 2006-12-30 22:26:29 stephena Exp $
|
||||
*/
|
||||
class DialogContainer
|
||||
{
|
||||
|
@ -124,30 +124,34 @@ class DialogContainer
|
|||
void draw();
|
||||
|
||||
/**
|
||||
Add a dialog box to the stack
|
||||
Add a dialog box to the stack.
|
||||
*/
|
||||
void addDialog(Dialog* d);
|
||||
|
||||
/**
|
||||
Remove the topmost dialog box from the stack
|
||||
Remove the topmost dialog box from the stack.
|
||||
*/
|
||||
void removeDialog();
|
||||
|
||||
/**
|
||||
Reset dialog stack to the main configuration menu
|
||||
Reset dialog stack to the main configuration menu.
|
||||
*/
|
||||
void reStack();
|
||||
|
||||
/**
|
||||
Redraw all dialogs on the stack
|
||||
Redraw all dialogs on the stack.
|
||||
*/
|
||||
void refresh() { myRefreshFlag = true; }
|
||||
|
||||
/**
|
||||
(Re)initialize the menuing system. This is necessary if a new Console
|
||||
has been loaded, since in most cases the screen dimensions will have changed.
|
||||
Return the bottom-most dialog of this container.
|
||||
*/
|
||||
virtual void initialize() = 0;
|
||||
const Dialog* baseDialog() const { return myBaseDialog; }
|
||||
|
||||
/**
|
||||
(Re)initialize the menuing system. This isn't necessary in most cases.
|
||||
*/
|
||||
virtual void initialize() {}
|
||||
|
||||
private:
|
||||
void reset();
|
||||
|
|
|
@ -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: LauncherOptionsDialog.cxx,v 1.20 2006-12-08 16:49:35 stephena Exp $
|
||||
// $Id: FileSnapDialog.cxx,v 1.1 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -21,21 +21,21 @@
|
|||
|
||||
#include "DialogContainer.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
#include "LauncherOptionsDialog.hxx"
|
||||
#include "FileSnapDialog.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherOptionsDialog::LauncherOptionsDialog(
|
||||
FileSnapDialog::FileSnapDialog(
|
||||
OSystem* osystem, DialogContainer* parent,
|
||||
const GUI::Font& font, GuiObject* boss,
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
CommandSender(boss),
|
||||
myBrowser(NULL)
|
||||
myBrowser(NULL),
|
||||
myIsGlobal(boss != 0)
|
||||
{
|
||||
const int vBorder = 4;
|
||||
int xpos, ypos, bwidth, bheight;
|
||||
|
@ -51,9 +51,9 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
|||
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 2*bheight - ypos);
|
||||
addTabWidget(myTab);
|
||||
|
||||
// 1) The ROM locations tab
|
||||
// 1) The browser settings tab
|
||||
wid.clear();
|
||||
tabID = myTab->addTab("ROM Settings");
|
||||
tabID = myTab->addTab("Browser Settings");
|
||||
|
||||
// ROM path
|
||||
xpos = 15; ypos += 5;
|
||||
|
@ -80,6 +80,16 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
|||
// myReloadButton->setEditable(true);
|
||||
wid.push_back(myReloadButton);
|
||||
|
||||
// ROM settings are disabled while in game mode
|
||||
if(!myIsGlobal)
|
||||
{
|
||||
myTab->disableTab(0);
|
||||
// TODO - until I get the above method working, we also need to
|
||||
// disable the specific widgets ourself
|
||||
myRomPath->clearFlags(WIDGET_ENABLED);
|
||||
for(unsigned int i = 0; i < wid.size(); ++i)
|
||||
wid[i]->clearFlags(WIDGET_ENABLED);
|
||||
}
|
||||
// Add focus widgets for ROM tab
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
|
@ -134,19 +144,17 @@ LauncherOptionsDialog::LauncherOptionsDialog(
|
|||
addToFocusList(wid);
|
||||
|
||||
// Create file browser dialog
|
||||
int baseW = instance()->frameBuffer().baseWidth();
|
||||
int baseH = instance()->frameBuffer().baseHeight();
|
||||
myBrowser = new BrowserDialog(this, font, 60, 20, baseW - 120, baseH - 40);
|
||||
myBrowser = new BrowserDialog(this, font, 60, 20, 200, 200);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LauncherOptionsDialog::~LauncherOptionsDialog()
|
||||
FileSnapDialog::~FileSnapDialog()
|
||||
{
|
||||
delete myBrowser;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::loadConfig()
|
||||
void FileSnapDialog::loadConfig()
|
||||
{
|
||||
string s;
|
||||
bool b;
|
||||
|
@ -168,7 +176,7 @@ void LauncherOptionsDialog::loadConfig()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::saveConfig()
|
||||
void FileSnapDialog::saveConfig()
|
||||
{
|
||||
string s;
|
||||
bool b;
|
||||
|
@ -190,36 +198,39 @@ void LauncherOptionsDialog::saveConfig()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::openRomBrowser()
|
||||
void FileSnapDialog::openRomBrowser()
|
||||
{
|
||||
parent()->addDialog(myBrowser);
|
||||
|
||||
myBrowser->setTitle("Select ROM directory:");
|
||||
myBrowser->setEmitSignal(kRomDirChosenCmd);
|
||||
myBrowser->setStartPath(myRomPath->getLabel());
|
||||
|
||||
parent()->addDialog(myBrowser);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::openSnapBrowser()
|
||||
void FileSnapDialog::openSnapBrowser()
|
||||
{
|
||||
parent()->addDialog(myBrowser);
|
||||
|
||||
myBrowser->setTitle("Select snapshot directory:");
|
||||
myBrowser->setEmitSignal(kSnapDirChosenCmd);
|
||||
myBrowser->setStartPath(mySnapPath->getLabel());
|
||||
|
||||
parent()->addDialog(myBrowser);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
void FileSnapDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
sendCommand(kBrowseChangedCmd, 0, 0); // Call this before refreshing ROMs
|
||||
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
|
||||
if(myIsGlobal)
|
||||
{
|
||||
sendCommand(kBrowseChangedCmd, 0, 0); // Call this before refreshing ROMs
|
||||
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
|
||||
}
|
||||
break;
|
||||
|
||||
case kChooseRomDirCmd:
|
||||
|
@ -230,12 +241,6 @@ void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
openSnapBrowser();
|
||||
break;
|
||||
|
||||
/*
|
||||
case kBrowseDirCmd:
|
||||
myReloadButton->setEnabled(!myBrowseCheckbox->getState());
|
||||
break;
|
||||
*/
|
||||
|
||||
case kRomDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
|
@ -13,14 +13,14 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: LauncherOptionsDialog.hxx,v 1.12 2006-12-08 16:49:35 stephena Exp $
|
||||
// $Id: FileSnapDialog.hxx,v 1.1 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef LAUNCHER_OPTIONS_DIALOG_HXX
|
||||
#define LAUNCHER_OPTIONS_DIALOG_HXX
|
||||
#ifndef FILE_SNAP_DIALOG_HXX
|
||||
#define FILE_SNAP_DIALOG_HXX
|
||||
|
||||
class OSystem;
|
||||
class GuiObject;
|
||||
|
@ -34,13 +34,13 @@ class TabWidget;
|
|||
#include "Dialog.hxx"
|
||||
#include "Command.hxx"
|
||||
|
||||
class LauncherOptionsDialog : public Dialog, public CommandSender
|
||||
class FileSnapDialog : public Dialog, public CommandSender
|
||||
{
|
||||
public:
|
||||
LauncherOptionsDialog(OSystem* osystem, DialogContainer* parent,
|
||||
const GUI::Font& font, GuiObject* boss,
|
||||
int x, int y, int w, int h);
|
||||
~LauncherOptionsDialog();
|
||||
FileSnapDialog(OSystem* osystem, DialogContainer* parent,
|
||||
const GUI::Font& font, GuiObject* boss,
|
||||
int x, int y, int w, int h);
|
||||
~FileSnapDialog();
|
||||
|
||||
virtual void loadConfig();
|
||||
virtual void saveConfig();
|
||||
|
@ -69,6 +69,9 @@ class LauncherOptionsDialog : public Dialog, public CommandSender
|
|||
// Snapshot controls
|
||||
StaticTextWidget* mySnapPath;
|
||||
CheckboxWidget* mySnapSingleCheckbox;
|
||||
|
||||
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||
bool myIsGlobal;
|
||||
};
|
||||
|
||||
#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: GameInfoDialog.cxx,v 1.34 2006-12-26 02:09:29 stephena Exp $
|
||||
// $Id: GameInfoDialog.cxx,v 1.35 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -332,8 +332,11 @@ GameInfoDialog::~GameInfoDialog()
|
|||
void GameInfoDialog::loadConfig()
|
||||
{
|
||||
myDefaultsSelected = false;
|
||||
myGameProperties = myOSystem->console().properties();
|
||||
loadView();
|
||||
if(&myOSystem->console())
|
||||
{
|
||||
myGameProperties = myOSystem->console().properties();
|
||||
loadView();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: LauncherDialog.cxx,v 1.62 2006-12-22 22:32:49 stephena Exp $
|
||||
// $Id: LauncherDialog.cxx,v 1.63 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -34,7 +34,7 @@
|
|||
#include "GuiUtils.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "ProgressDialog.hxx"
|
||||
#include "LauncherOptionsDialog.hxx"
|
||||
#include "OptionsDialog.hxx"
|
||||
#include "LauncherDialog.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -131,10 +131,8 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
#endif
|
||||
mySelectedItem = 0; // Highlight 'Rom Listing'
|
||||
|
||||
// Create the launcher options dialog, where you can change ROM
|
||||
// and snapshot paths
|
||||
myOptions = new LauncherOptionsDialog(osystem, parent, font, this,
|
||||
20, 60, _w - 40, _h - 120);
|
||||
// Create an options dialog, similar to the in-game one
|
||||
myOptions = new OptionsDialog(osystem, parent, this, true); // not in game mode
|
||||
|
||||
// Create a game list, which contains all the information about a ROM that
|
||||
// the launcher needs
|
||||
|
@ -184,17 +182,7 @@ void LauncherDialog::updateListing(bool fullReload)
|
|||
myGameList->clear();
|
||||
myNote->setLabel("");
|
||||
|
||||
// If this is the first time using Stella, the romdir won't be set.
|
||||
// In that case, display the options dialog, and don't let Stella proceed
|
||||
// until the options are set.
|
||||
string romdir = instance()->settings().getString("romdir");
|
||||
if(romdir == "")
|
||||
{
|
||||
myOptionsButton->setEnabled(true);
|
||||
myQuitButton->setEnabled(true);
|
||||
parent()->addDialog(myOptions);
|
||||
return;
|
||||
}
|
||||
|
||||
// If in ROM browse mode, just load the current directory and
|
||||
// don't translate by md5sum at all
|
||||
|
|
|
@ -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: LauncherDialog.hxx,v 1.22 2006-12-08 16:49:35 stephena Exp $
|
||||
// $Id: LauncherDialog.hxx,v 1.23 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define LAUNCHER_DIALOG_HXX
|
||||
|
||||
class DialogContainer;
|
||||
class LauncherOptionsDialog;
|
||||
class OptionsDialog;
|
||||
class ProgressDialog;
|
||||
class CommandSender;
|
||||
class StaticTextWidget;
|
||||
|
@ -69,8 +69,8 @@ class LauncherDialog : public Dialog
|
|||
StaticTextWidget* myRomCount;
|
||||
GameList* myGameList;
|
||||
|
||||
LauncherOptionsDialog* myOptions;
|
||||
ProgressDialog* myProgressBar;
|
||||
OptionsDialog* myOptions;
|
||||
ProgressDialog* myProgressBar;
|
||||
|
||||
private:
|
||||
void enableButtons(bool enable);
|
||||
|
|
|
@ -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: Menu.cxx,v 1.14 2006-12-08 16:49:36 stephena Exp $
|
||||
// $Id: Menu.cxx,v 1.15 2006-12-30 22:26:29 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
@ -27,16 +27,10 @@ class Properties;
|
|||
Menu::Menu(OSystem* osystem)
|
||||
: DialogContainer(osystem)
|
||||
{
|
||||
myBaseDialog = new OptionsDialog(myOSystem, this, 0, false); // in game mode
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Menu::~Menu()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Menu::initialize()
|
||||
{
|
||||
delete myBaseDialog;
|
||||
myBaseDialog = new OptionsDialog(myOSystem, 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: Menu.hxx,v 1.13 2006-12-08 16:49:36 stephena Exp $
|
||||
// $Id: Menu.hxx,v 1.14 2006-12-30 22:26:29 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef MENU_HXX
|
||||
|
@ -27,7 +27,7 @@ class OSystem;
|
|||
The base dialog for all configuration menus in Stella.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Menu.hxx,v 1.13 2006-12-08 16:49:36 stephena Exp $
|
||||
@version $Id: Menu.hxx,v 1.14 2006-12-30 22:26:29 stephena Exp $
|
||||
*/
|
||||
class Menu : public DialogContainer
|
||||
{
|
||||
|
@ -41,11 +41,6 @@ class Menu : public DialogContainer
|
|||
Destructor
|
||||
*/
|
||||
virtual ~Menu();
|
||||
|
||||
/**
|
||||
Updates the basedialog to be of the type defined for this derived class.
|
||||
*/
|
||||
void initialize();
|
||||
};
|
||||
|
||||
#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: OptionsDialog.cxx,v 1.45 2006-12-08 16:49:36 stephena Exp $
|
||||
// $Id: OptionsDialog.cxx,v 1.46 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -27,6 +27,8 @@
|
|||
#include "VideoDialog.hxx"
|
||||
#include "AudioDialog.hxx"
|
||||
#include "InputDialog.hxx"
|
||||
//#include "UIDialog.hxx"
|
||||
#include "FileSnapDialog.hxx"
|
||||
#include "GameInfoDialog.hxx"
|
||||
#include "HelpDialog.hxx"
|
||||
#include "AboutDialog.hxx"
|
||||
|
@ -38,50 +40,29 @@
|
|||
|
||||
#include "bspf.hxx"
|
||||
|
||||
enum {
|
||||
kVidCmd = 'VIDO',
|
||||
kAudCmd = 'AUDO',
|
||||
kInptCmd = 'INPT',
|
||||
kInfoCmd = 'INFO',
|
||||
kHelpCmd = 'HELP',
|
||||
kAboutCmd = 'ABOU',
|
||||
kExitCmd = 'EXIM',
|
||||
kCheatCmd = 'CHET'
|
||||
};
|
||||
|
||||
enum {
|
||||
kRowHeight = 22,
|
||||
kBigButtonWidth = 90,
|
||||
kMainMenuWidth = (kBigButtonWidth + 2 * 8),
|
||||
kMainMenuHeight = 8 * kRowHeight + 10,
|
||||
};
|
||||
|
||||
#define addBigButton(label, cmd) \
|
||||
new ButtonWidget(this, font, xoffset, yoffset, kBigButtonWidth, 18, label, cmd); yoffset += kRowHeight
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
||||
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
|
||||
GuiObject* boss, bool global)
|
||||
: Dialog(osystem, parent, 0, 0, kMainMenuWidth, kMainMenuHeight),
|
||||
myVideoDialog(NULL),
|
||||
myAudioDialog(NULL),
|
||||
myInputDialog(NULL),
|
||||
myUIDialog(NULL),
|
||||
myFileSnapDialog(NULL),
|
||||
myGameInfoDialog(NULL),
|
||||
myCheatCodeDialog(NULL),
|
||||
myHelpDialog(NULL),
|
||||
myAboutDialog(NULL)
|
||||
myAboutDialog(NULL),
|
||||
myIsGlobal(global)
|
||||
{
|
||||
int yoffset = 7;
|
||||
const int xoffset = (_w - kBigButtonWidth) / 2;
|
||||
const int fbWidth = osystem->frameBuffer().baseWidth(),
|
||||
fbHeight = osystem->frameBuffer().baseHeight();
|
||||
const GUI::Font& font = instance()->font(); // FIXME - change reference to optionsFont()
|
||||
int xoffset = 10, yoffset = 10;
|
||||
WidgetArray wid;
|
||||
ButtonWidget* b = NULL;
|
||||
|
||||
// Set actual dialog dimensions
|
||||
_x = (fbWidth - kMainMenuWidth) / 2;
|
||||
_y = (fbHeight - kMainMenuHeight) / 2;
|
||||
|
||||
b = addBigButton("Video Settings", kVidCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
|
@ -94,15 +75,24 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
b = addBigButton("Input Settings", kInptCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
b = addBigButton("Game Properties", kInfoCmd);
|
||||
b = addBigButton("UI Settings", kUsrIfaceCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
b = addBigButton("Cheat Code", kCheatCmd);
|
||||
#ifndef CHEATCODE_SUPPORT
|
||||
b->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
b = addBigButton("Files & Snapshots", kFileSnapCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
// Move to second column
|
||||
xoffset += kBigButtonWidth + 10; yoffset = 10;
|
||||
|
||||
myGameInfoButton = addBigButton("Game Properties", kInfoCmd);
|
||||
wid.push_back(myGameInfoButton);
|
||||
|
||||
myCheatCodeButton = addBigButton("Cheat Code", kCheatCmd);
|
||||
#ifndef CHEATCODE_SUPPORT
|
||||
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
wid.push_back(myCheatCodeButton);
|
||||
|
||||
b = addBigButton("Help", kHelpCmd);
|
||||
wid.push_back(b);
|
||||
|
||||
|
@ -114,40 +104,49 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
addCancelWidget(b);
|
||||
|
||||
// Set some sane values for the dialog boxes
|
||||
int x, y, w, h;
|
||||
int x = 0, y = 0, w, h;
|
||||
|
||||
// Now create all the dialogs attached to each menu button
|
||||
w = 230; h = 135;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myVideoDialog = new VideoDialog(myOSystem, parent, font, x, y, w, h);
|
||||
|
||||
w = 200; h = 140;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h);
|
||||
|
||||
w = 230; h = 185;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);
|
||||
|
||||
w = 230; h = 185;
|
||||
myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);
|
||||
|
||||
w = 280; h = 120;
|
||||
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
|
||||
boss, x, y, w, h);
|
||||
|
||||
|
||||
|
||||
w = 255; h = 190;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, font, this, x, y, w, h);
|
||||
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
w = 230; h = 150;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myCheatCodeDialog = new CheatCodeDialog(myOSystem, parent, font, x, y, w, h);
|
||||
#endif
|
||||
|
||||
w = 255; h = 150;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myHelpDialog = new HelpDialog(myOSystem, parent, font, x, y, w, h);
|
||||
|
||||
w = 255; h = 150;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myAboutDialog = new AboutDialog(myOSystem, parent, font, x, y, w, h);
|
||||
|
||||
addToFocusList(wid);
|
||||
|
||||
// Certain buttons are always disabled while in game mode
|
||||
if(myIsGlobal)
|
||||
{
|
||||
myGameInfoButton->clearFlags(WIDGET_ENABLED);
|
||||
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -156,22 +155,14 @@ OptionsDialog::~OptionsDialog()
|
|||
delete myVideoDialog;
|
||||
delete myAudioDialog;
|
||||
delete myInputDialog;
|
||||
// delete myUIDialog;
|
||||
delete myFileSnapDialog;
|
||||
delete myGameInfoDialog;
|
||||
delete myCheatCodeDialog;
|
||||
delete myHelpDialog;
|
||||
delete myAboutDialog;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OptionsDialog::checkBounds(int width, int height,
|
||||
int* x, int* y, int* w, int* h)
|
||||
{
|
||||
if(*w > width) *w = width;
|
||||
if(*h > height) *h = height;
|
||||
*x = (width - *w) / 2;
|
||||
*y = (height - *h) / 2;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
|
@ -190,6 +181,15 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
parent()->addDialog(myInputDialog);
|
||||
break;
|
||||
|
||||
case kUsrIfaceCmd:
|
||||
// parent()->addDialog(myGameInfoDialog);
|
||||
cerr << "UI dialog\n";
|
||||
break;
|
||||
|
||||
case kFileSnapCmd:
|
||||
parent()->addDialog(myFileSnapDialog);
|
||||
break;
|
||||
|
||||
case kInfoCmd:
|
||||
parent()->addDialog(myGameInfoDialog);
|
||||
break;
|
||||
|
@ -209,7 +209,10 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
|
||||
case kExitCmd:
|
||||
instance()->eventHandler().leaveMenuMode();
|
||||
if(myIsGlobal)
|
||||
close();
|
||||
else
|
||||
instance()->eventHandler().leaveMenuMode();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -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.hxx,v 1.20 2006-12-08 16:49:36 stephena Exp $
|
||||
// $Id: OptionsDialog.hxx,v 1.21 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -24,8 +24,12 @@
|
|||
|
||||
class CommandSender;
|
||||
class DialogContainer;
|
||||
class GuiObject;
|
||||
class VideoDialog;
|
||||
class AudioDialog;
|
||||
class InputDialog;
|
||||
class UIDialog;
|
||||
class FileSnapDialog;
|
||||
class GameInfoDialog;
|
||||
class CheatCodeDialog;
|
||||
class HelpDialog;
|
||||
|
@ -33,13 +37,13 @@ class AboutDialog;
|
|||
class OSystem;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "GameInfoDialog.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class OptionsDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
OptionsDialog(OSystem* osystem, DialogContainer* parent);
|
||||
OptionsDialog(OSystem* osystem, DialogContainer* parent, GuiObject* boss,
|
||||
bool global);
|
||||
virtual ~OptionsDialog();
|
||||
|
||||
private:
|
||||
|
@ -50,10 +54,38 @@ class OptionsDialog : public Dialog
|
|||
VideoDialog* myVideoDialog;
|
||||
AudioDialog* myAudioDialog;
|
||||
InputDialog* myInputDialog;
|
||||
UIDialog* myUIDialog;
|
||||
FileSnapDialog* myFileSnapDialog;
|
||||
GameInfoDialog* myGameInfoDialog;
|
||||
CheatCodeDialog* myCheatCodeDialog;
|
||||
HelpDialog* myHelpDialog;
|
||||
AboutDialog* myAboutDialog;
|
||||
|
||||
ButtonWidget* myGameInfoButton;
|
||||
ButtonWidget* myCheatCodeButton;
|
||||
|
||||
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||
bool myIsGlobal;
|
||||
|
||||
enum {
|
||||
kVidCmd = 'VIDO',
|
||||
kAudCmd = 'AUDO',
|
||||
kInptCmd = 'INPT',
|
||||
kUsrIfaceCmd = 'URIF',
|
||||
kFileSnapCmd = 'FLSN',
|
||||
kInfoCmd = 'INFO',
|
||||
kCheatCmd = 'CHET',
|
||||
kHelpCmd = 'HELP',
|
||||
kAboutCmd = 'ABOU',
|
||||
kExitCmd = 'EXIM'
|
||||
};
|
||||
|
||||
enum {
|
||||
kRowHeight = 22,
|
||||
kBigButtonWidth = 90,
|
||||
kMainMenuWidth = (2*kBigButtonWidth + 30),
|
||||
kMainMenuHeight = 5*kRowHeight + 20
|
||||
};
|
||||
};
|
||||
|
||||
#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: PopUpWidget.cxx,v 1.30 2006-12-08 20:19:58 stephena Exp $
|
||||
// $Id: PopUpWidget.cxx,v 1.31 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -68,7 +68,6 @@ void PopUpDialog::drawDialog()
|
|||
{
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
//cerr << "PopUpDialog::drawDialog()\n";
|
||||
// Draw the menu border
|
||||
fb.hLine(_x, _y, _x + _w - 1, kColor);
|
||||
fb.hLine(_x, _y + _h - 1, _x + _w - 1, kShadowColor);
|
||||
|
@ -200,7 +199,6 @@ void PopUpDialog::handleEvent(Event::Type e)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpDialog::drawMenuEntry(int entry, bool hilite)
|
||||
{
|
||||
//cerr << "PopUpDialog::drawMenuEntry\n";
|
||||
FrameBuffer& fb = instance()->frameBuffer();
|
||||
|
||||
// Draw one entry of the popup menu, including selection
|
||||
|
@ -253,6 +251,9 @@ void PopUpDialog::recalc()
|
|||
// Perform clipping / switch to scrolling mode if we don't fit on the screen
|
||||
const int height = instance()->frameBuffer().baseHeight();
|
||||
|
||||
_x = _popUpBoss->getAbsX() + _popUpBoss->_labelWidth;
|
||||
_y = _popUpBoss->getAbsY() + _popUpBoss->getHeight();
|
||||
|
||||
_h = _popUpBoss->_entries.size() * _popUpBoss->_fontHeight + 2;
|
||||
|
||||
// HACK: For now, we do not do scrolling. Instead, we draw the dialog
|
||||
|
@ -484,11 +485,6 @@ void PopUpWidget::appendEntry(const string& entry, int tag)
|
|||
e.name = entry;
|
||||
e.tag = tag;
|
||||
_entries.push_back(e);
|
||||
|
||||
// Each time an entry is added, the popup dialog gets larger
|
||||
// This isn't as efficient as it could be, since it's called
|
||||
// each time an entry is added (which can be dozens of times).
|
||||
myPopUpDialog->recalc();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: PopUpWidget.hxx,v 1.15 2006-12-08 16:49:36 stephena Exp $
|
||||
// $Id: PopUpWidget.hxx,v 1.16 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -107,6 +107,7 @@ class PopUpDialog : public Dialog
|
|||
PopUpDialog(PopUpWidget* boss, int clickX, int clickY);
|
||||
|
||||
void drawDialog();
|
||||
void center() { recalc(); }
|
||||
|
||||
protected:
|
||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||
|
|
|
@ -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: TabWidget.cxx,v 1.23 2006-12-08 16:49:37 stephena Exp $
|
||||
// $Id: TabWidget.cxx,v 1.24 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -69,6 +69,7 @@ int TabWidget::addTab(const string& title)
|
|||
newTab.title = title;
|
||||
newTab.firstWidget = NULL;
|
||||
newTab.parentWidget = NULL;
|
||||
newTab.enabled = true;
|
||||
|
||||
_tabs.push_back(newTab);
|
||||
|
||||
|
@ -108,6 +109,15 @@ void TabWidget::setActiveTab(int tabID, bool show)
|
|||
sendCommand(kTabChangedCmd, _activeTab, -1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TabWidget::disableTab(int tabID)
|
||||
{
|
||||
assert(0 <= tabID && tabID < (int)_tabs.size());
|
||||
|
||||
_tabs[tabID].enabled = false;
|
||||
// TODO - alsa disable all widgets belonging to this tab
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TabWidget::updateActiveTab()
|
||||
{
|
||||
|
@ -255,12 +265,13 @@ void TabWidget::drawWidget(bool hilite)
|
|||
int i, x = _x + kTabLeftOffset;
|
||||
for (i = 0; i < (int)_tabs.size(); ++i)
|
||||
{
|
||||
int color = (i == _activeTab) ? kColor : kShadowColor;
|
||||
int yOffset = (i == _activeTab) ? 0 : 2;
|
||||
box(x, _y + yOffset, _tabWidth, _tabHeight - yOffset, color, color, (i == _activeTab));
|
||||
int fontcolor = _tabs[i].enabled ? kTextColor : kColor;
|
||||
int boxcolor = (i == _activeTab) ? kColor : kShadowColor;
|
||||
int yOffset = (i == _activeTab) ? 0 : 2;
|
||||
box(x, _y + yOffset, _tabWidth, _tabHeight - yOffset, boxcolor, boxcolor, (i == _activeTab));
|
||||
fb.drawString(_font, _tabs[i].title, x + kTabPadding,
|
||||
_y + yOffset / 2 + (_tabHeight - _fontHeight - 1),
|
||||
_tabWidth - 2 * kTabPadding, kTextColor, kTextAlignCenter);
|
||||
_tabWidth - 2 * kTabPadding, fontcolor, kTextAlignCenter);
|
||||
x += _tabWidth + kTabSpacing;
|
||||
}
|
||||
|
||||
|
|
|
@ -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: TabWidget.hxx,v 1.14 2006-12-08 16:49:37 stephena Exp $
|
||||
// $Id: TabWidget.hxx,v 1.15 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -34,6 +34,7 @@ class TabWidget : public Widget, public CommandSender
|
|||
string title;
|
||||
Widget* firstWidget;
|
||||
Widget* parentWidget;
|
||||
bool enabled;
|
||||
};
|
||||
typedef Common::Array<Tab> TabList;
|
||||
|
||||
|
@ -54,6 +55,7 @@ class TabWidget : public Widget, public CommandSender
|
|||
//void removeTab(int tabID);
|
||||
// Setting the active tab:
|
||||
void setActiveTab(int tabID, bool show = false);
|
||||
void disableTab(int tabID);
|
||||
void activateTabs();
|
||||
void cycleTab(int direction);
|
||||
// setActiveTab changes the value of _firstWidget. This means Widgets added afterwards
|
||||
|
|
|
@ -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.39 2006-12-28 20:40:01 stephena Exp $
|
||||
// $Id: VideoDialog.cxx,v 1.40 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -45,25 +45,15 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
pwidth = font.getStringWidth("Software");
|
||||
WidgetArray wid;
|
||||
|
||||
// Use dirty rectangle updates
|
||||
xpos = 5; ypos = 10;
|
||||
myDirtyPopup = new PopUpWidget(this, font, xpos, ypos,
|
||||
pwidth, lineHeight, "Dirty Rects: ", lwidth);
|
||||
myDirtyPopup->appendEntry("Yes", 1);
|
||||
myDirtyPopup->appendEntry("No", 2);
|
||||
wid.push_back(myDirtyPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Video renderer
|
||||
myRendererPopup = new PopUpWidget(this, font, xpos, ypos,
|
||||
pwidth, lineHeight, "Renderer: ", lwidth,
|
||||
kRendererChanged);
|
||||
myRendererPopup->appendEntry("Software", 1);
|
||||
#ifdef PSP
|
||||
myRendererPopup->appendEntry("Hardware", 2);
|
||||
#endif
|
||||
#ifdef DISPLAY_OPENGL
|
||||
myRendererPopup->appendEntry("OpenGL", 3);
|
||||
myRendererPopup->appendEntry("OpenGL", 2);
|
||||
#endif
|
||||
wid.push_back(myRendererPopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
@ -98,16 +88,27 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.push_back(myPalettePopup);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Available scalers
|
||||
myScalerPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
|
||||
lineHeight, "Scaler: ", lwidth);
|
||||
myScalerPopup->appendEntry("Zoom1x", 1);
|
||||
myScalerPopup->appendEntry("Zoom2x", 2);
|
||||
myScalerPopup->appendEntry("Zoom3x", 3);
|
||||
myScalerPopup->appendEntry("Zoom4x", 4);
|
||||
myScalerPopup->appendEntry("Zoom5x", 5);
|
||||
myScalerPopup->appendEntry("Zoom6x", 6);
|
||||
wid.push_back(myScalerPopup);
|
||||
// Available TIA scalers
|
||||
myTIAScalerPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
|
||||
lineHeight, "TIA Scaler: ", lwidth);
|
||||
myTIAScalerPopup->appendEntry("Zoom1x", 1);
|
||||
myTIAScalerPopup->appendEntry("Zoom2x", 2);
|
||||
myTIAScalerPopup->appendEntry("Zoom3x", 3);
|
||||
myTIAScalerPopup->appendEntry("Zoom4x", 4);
|
||||
myTIAScalerPopup->appendEntry("Zoom5x", 5);
|
||||
myTIAScalerPopup->appendEntry("Zoom6x", 6);
|
||||
wid.push_back(myTIAScalerPopup);
|
||||
|
||||
ypos += lineHeight + 4;
|
||||
myUIScalerPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
|
||||
lineHeight, "UI Scaler: ", lwidth);
|
||||
myUIScalerPopup->appendEntry("Zoom1x", 1);
|
||||
myUIScalerPopup->appendEntry("Zoom2x", 2);
|
||||
myUIScalerPopup->appendEntry("Zoom3x", 3);
|
||||
myUIScalerPopup->appendEntry("Zoom4x", 4);
|
||||
myUIScalerPopup->appendEntry("Zoom5x", 5);
|
||||
myUIScalerPopup->appendEntry("Zoom6x", 6);
|
||||
wid.push_back(myUIScalerPopup);
|
||||
|
||||
// Move over to the next column
|
||||
xpos += 115; ypos = 10;
|
||||
|
@ -130,6 +131,18 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
wid.push_back(myFullscreenCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// PAL color-loss effect
|
||||
myColorLossCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||
"PAL color-loss");
|
||||
wid.push_back(myColorLossCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use dirty rectangle merging
|
||||
myDirtyRectCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||
"Dirty-rect merging");
|
||||
wid.push_back(myDirtyRectCheckbox);
|
||||
ypos += lineHeight + 4;
|
||||
|
||||
// Use desktop res in OpenGL
|
||||
myUseDeskResCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||
"Desktop Res in FS");
|
||||
|
@ -138,7 +151,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
|||
|
||||
// Use sync to vblank in OpenGL
|
||||
myUseVSyncCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
|
||||
"Enable VSync");
|
||||
"GL VSync");
|
||||
wid.push_back(myUseVSyncCheckbox);
|
||||
ypos += lineHeight + 20;
|
||||
|
||||
|
@ -178,17 +191,10 @@ void VideoDialog::loadConfig()
|
|||
int i;
|
||||
double f;
|
||||
|
||||
// Driver setting
|
||||
b = instance()->settings().getBool("dirtyrects");
|
||||
i = b ? 1 : 2;
|
||||
myDirtyPopup->setSelectedTag(i);
|
||||
|
||||
// Renderer setting
|
||||
s = instance()->settings().getString("video");
|
||||
if(s == "soft") myRendererPopup->setSelectedTag(1);
|
||||
else if(s == "hard") myRendererPopup->setSelectedTag(2);
|
||||
else if(s == "gl") myRendererPopup->setSelectedTag(3);
|
||||
else myRendererPopup->setSelectedTag(1);
|
||||
if(s == "soft") myRendererPopup->setSelectedTag(1);
|
||||
else if(s == "gl") myRendererPopup->setSelectedTag(2);
|
||||
|
||||
// Filter setting
|
||||
s = instance()->settings().getString("gl_filter");
|
||||
|
@ -198,16 +204,8 @@ void VideoDialog::loadConfig()
|
|||
// Aspect ratio - another huge hack
|
||||
s = instance()->settings().getString("gl_aspect");
|
||||
f = instance()->settings().getFloat("gl_aspect");
|
||||
if(f < 1.1)
|
||||
{
|
||||
f = 1.1;
|
||||
s = "1.1";
|
||||
}
|
||||
else if(f > 2.0)
|
||||
{
|
||||
f = 2.0;
|
||||
s = "2.0";
|
||||
}
|
||||
if(f < 1.1) { f = 1.1; s = "1.1"; }
|
||||
else if(f > 2.0) { f = 2.0; s = "2.0"; }
|
||||
i = (int)((f * 10) - 10) * 10;
|
||||
myAspectRatioSlider->setValue(i);
|
||||
myAspectRatioLabel->setLabel(s);
|
||||
|
@ -219,30 +217,51 @@ void VideoDialog::loadConfig()
|
|||
else if(s == "z26") myPalettePopup->setSelectedTag(3);
|
||||
else if(s == "user") myPalettePopup->setSelectedTag(4);
|
||||
|
||||
// Scaler
|
||||
// TIA Scaler
|
||||
s = instance()->settings().getString("scale_tia");
|
||||
if(s == "zoom1x") myScalerPopup->setSelectedTag(1);
|
||||
else if(s == "zoom2x") myScalerPopup->setSelectedTag(2);
|
||||
else if(s == "zoom3x") myScalerPopup->setSelectedTag(3);
|
||||
else if(s == "zoom4x") myScalerPopup->setSelectedTag(4);
|
||||
else if(s == "zoom5x") myScalerPopup->setSelectedTag(5);
|
||||
else if(s == "zoom6x") myScalerPopup->setSelectedTag(6);
|
||||
else myScalerPopup->setSelectedTag(0);
|
||||
if(s == "zoom1x") myTIAScalerPopup->setSelectedTag(1);
|
||||
else if(s == "zoom2x") myTIAScalerPopup->setSelectedTag(2);
|
||||
else if(s == "zoom3x") myTIAScalerPopup->setSelectedTag(3);
|
||||
else if(s == "zoom4x") myTIAScalerPopup->setSelectedTag(4);
|
||||
else if(s == "zoom5x") myTIAScalerPopup->setSelectedTag(5);
|
||||
else if(s == "zoom6x") myTIAScalerPopup->setSelectedTag(6);
|
||||
else myTIAScalerPopup->setSelectedTag(0);
|
||||
|
||||
// UI Scaler
|
||||
s = instance()->settings().getString("scale_ui");
|
||||
if(s == "zoom1x") myUIScalerPopup->setSelectedTag(1);
|
||||
else if(s == "zoom2x") myUIScalerPopup->setSelectedTag(2);
|
||||
else if(s == "zoom3x") myUIScalerPopup->setSelectedTag(3);
|
||||
else if(s == "zoom4x") myUIScalerPopup->setSelectedTag(4);
|
||||
else if(s == "zoom5x") myUIScalerPopup->setSelectedTag(5);
|
||||
else if(s == "zoom6x") myUIScalerPopup->setSelectedTag(6);
|
||||
else myUIScalerPopup->setSelectedTag(0);
|
||||
|
||||
// FIXME - what to do with this??
|
||||
myFrameRateSlider->setEnabled(false);
|
||||
|
||||
// Fullscreen
|
||||
b = instance()->settings().getBool("fullscreen");
|
||||
myFullscreenCheckbox->setState(b);
|
||||
|
||||
// Use desktop resolution in fullscreen mode
|
||||
// PAL color-loss effect
|
||||
b = instance()->settings().getBool("colorloss");
|
||||
myColorLossCheckbox->setState(b);
|
||||
|
||||
// Dirty-rect merging (software mode only)
|
||||
b = instance()->settings().getBool("dirtyrects");
|
||||
myDirtyRectCheckbox->setState(b);
|
||||
|
||||
// Use desktop resolution in fullscreen mode (GL mode only)
|
||||
b = instance()->settings().getBool("gl_fsmax");
|
||||
myUseDeskResCheckbox->setState(b);
|
||||
|
||||
// Use sync to vertical blank
|
||||
// Use sync to vertical blank (GL mode only)
|
||||
b = instance()->settings().getBool("gl_vsync");
|
||||
myUseVSyncCheckbox->setState(b);
|
||||
|
||||
// Make sure that mutually-exclusive items are not enabled at the same time
|
||||
i = myRendererPopup->getSelectedTag() - 1;
|
||||
i = myRendererPopup->getSelectedTag();
|
||||
handleRendererChange(i);
|
||||
}
|
||||
|
||||
|
@ -251,45 +270,23 @@ void VideoDialog::saveConfig()
|
|||
{
|
||||
string s;
|
||||
int i;
|
||||
bool b, restart = false;
|
||||
|
||||
// Dirty rectangle updates
|
||||
i = myDirtyPopup->getSelectedTag();
|
||||
b = (i == 1) ? 1 : 0;
|
||||
if(b != instance()->settings().getBool("dirtyrects"))
|
||||
{
|
||||
instance()->settings().setBool("dirtyrects", b);
|
||||
restart = true;
|
||||
}
|
||||
bool b;
|
||||
|
||||
// Renderer setting
|
||||
i = myRendererPopup->getSelectedTag();
|
||||
if(i == 1) s = "soft";
|
||||
else if(i == 2) s = "hard";
|
||||
else if(i == 3) s = "gl";
|
||||
if(s != instance()->settings().getString("video"))
|
||||
{
|
||||
instance()->settings().setString("video", s);
|
||||
restart = true;
|
||||
}
|
||||
else if(i == 2) s = "gl";
|
||||
instance()->settings().setString("video", s);
|
||||
|
||||
// Filter setting
|
||||
i = myFilterPopup->getSelectedTag();
|
||||
if(i == 1) s = "linear";
|
||||
else if(i == 2) s = "nearest";
|
||||
if(s != instance()->settings().getString("gl_filter"))
|
||||
{
|
||||
instance()->settings().setString("gl_filter", s);
|
||||
restart = true;
|
||||
}
|
||||
instance()->settings().setString("gl_filter", s);
|
||||
|
||||
// Aspect ratio
|
||||
s = myAspectRatioLabel->getLabel();
|
||||
if(s != instance()->settings().getString("gl_aspect"))
|
||||
{
|
||||
instance()->settings().setString("gl_aspect", s);
|
||||
restart = true;
|
||||
}
|
||||
instance()->settings().setString("gl_aspect", s);
|
||||
|
||||
// Palette
|
||||
i = myPalettePopup->getSelectedTag();
|
||||
|
@ -298,64 +295,68 @@ void VideoDialog::saveConfig()
|
|||
else if(i == 3) s = "z26";
|
||||
else if(i == 4) s = "user";
|
||||
instance()->settings().setString("palette", s);
|
||||
instance()->console().setPalette(s);
|
||||
|
||||
// Scaler
|
||||
i = myScalerPopup->getSelectedTag();
|
||||
// TIA Scaler
|
||||
i = myTIAScalerPopup->getSelectedTag();
|
||||
if(i == 1) s = "zoom1x";
|
||||
else if(i == 2) s = "zoom2x";
|
||||
else if(i == 3) s = "zoom3x";
|
||||
else if(i == 4) s = "zoom4x";
|
||||
else if(i == 5) s = "zoom5x";
|
||||
else if(i == 6) s = "zoom6x";
|
||||
if(s != instance()->settings().getString("scale_tia"))
|
||||
{
|
||||
instance()->settings().setString("scale_tia", s);
|
||||
restart = true;
|
||||
}
|
||||
instance()->settings().setString("scale_tia", s);
|
||||
|
||||
// Framerate
|
||||
// UI Scaler
|
||||
i = myUIScalerPopup->getSelectedTag();
|
||||
if(i == 1) s = "zoom1x";
|
||||
else if(i == 2) s = "zoom2x";
|
||||
else if(i == 3) s = "zoom3x";
|
||||
else if(i == 4) s = "zoom4x";
|
||||
else if(i == 5) s = "zoom5x";
|
||||
else if(i == 6) s = "zoom6x";
|
||||
instance()->settings().setString("scale_ui", s);
|
||||
|
||||
// Framerate FIXME - I haven't figured out what to do with this yet
|
||||
/*
|
||||
i = myFrameRateSlider->getValue();
|
||||
if(i > 0)
|
||||
instance()->setFramerate(i);
|
||||
*/
|
||||
|
||||
// Fullscreen (the setFullscreen method takes care of updating settings)
|
||||
// Fullscreen
|
||||
b = myFullscreenCheckbox->getState();
|
||||
instance()->frameBuffer().setFullscreen(b);
|
||||
instance()->settings().setBool("fullscreen", b);
|
||||
|
||||
// Use desktop resolution in fullscreen mode
|
||||
// PAL color-loss effect
|
||||
b = myColorLossCheckbox->getState();
|
||||
instance()->settings().setBool("colorloss", b);
|
||||
|
||||
// Dirty rectangle merging (software mode only)
|
||||
b = myDirtyRectCheckbox->getState();
|
||||
instance()->settings().setBool("dirtyrects", b);
|
||||
|
||||
// Use desktop resolution in fullscreen mode (GL mode only)
|
||||
b = myUseDeskResCheckbox->getState();
|
||||
if(b != instance()->settings().getBool("gl_fsmax"))
|
||||
{
|
||||
instance()->settings().setBool("gl_fsmax", b);
|
||||
restart = true;
|
||||
}
|
||||
instance()->settings().setBool("gl_fsmax", b);
|
||||
|
||||
// Use sync to vertical blank
|
||||
// Use sync to vertical blank (GL mode only)
|
||||
b = myUseVSyncCheckbox->getState();
|
||||
if(b != instance()->settings().getBool("gl_vsync"))
|
||||
{
|
||||
instance()->settings().setBool("gl_vsync", b);
|
||||
restart = true;
|
||||
}
|
||||
instance()->settings().setBool("gl_vsync", b);
|
||||
|
||||
// Finally, issue a complete framebuffer re-initialization
|
||||
// Not all options may require a full re-initialization, so we only
|
||||
// do it when necessary
|
||||
if(restart)
|
||||
instance()->createFrameBuffer();
|
||||
instance()->createFrameBuffer(false);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void VideoDialog::setDefaults()
|
||||
{
|
||||
myDirtyPopup->setSelectedTag(1);
|
||||
myRendererPopup->setSelectedTag(1);
|
||||
myFilterPopup->setSelectedTag(1);
|
||||
myPalettePopup->setSelectedTag(1);
|
||||
myScalerPopup->setSelectedTag(1);
|
||||
myFrameRateSlider->setValue(0);
|
||||
myFrameRateLabel->setLabel("0");
|
||||
myTIAScalerPopup->setSelectedTag(2);
|
||||
myUIScalerPopup->setSelectedTag(2);
|
||||
// myFrameRateSlider->setValue(0);
|
||||
// myFrameRateLabel->setLabel("0");
|
||||
|
||||
// For some unknown reason (ie, a bug), slider widgets can only
|
||||
// take certain ranges of numbers. So we have to fudge things ...
|
||||
|
@ -363,27 +364,31 @@ void VideoDialog::setDefaults()
|
|||
myAspectRatioLabel->setLabel("2.0");
|
||||
|
||||
myFullscreenCheckbox->setState(false);
|
||||
myColorLossCheckbox->setState(false);
|
||||
myDirtyRectCheckbox->setState(false);
|
||||
myUseDeskResCheckbox->setState(true);
|
||||
myUseVSyncCheckbox->setState(true);
|
||||
|
||||
// Make sure that mutually-exclusive items are not enabled at the same time
|
||||
handleRendererChange(0); // 0 indicates software mode
|
||||
handleRendererChange(1); // 1 indicates software mode
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void VideoDialog::handleRendererChange(int item)
|
||||
{
|
||||
// When we're in software mode, certain OpenGL-related options are disabled
|
||||
bool active = (item == 0 || item == 1) ? false : true;
|
||||
bool gl = (item > 1) ? true : false;
|
||||
|
||||
myFilterPopup->setEnabled(active);
|
||||
myAspectRatioSlider->setEnabled(active);
|
||||
myAspectRatioLabel->setEnabled(active);
|
||||
myUseDeskResCheckbox->setEnabled(active);
|
||||
myUseVSyncCheckbox->setEnabled(active);
|
||||
myFilterPopup->setEnabled(gl);
|
||||
myAspectRatioSlider->setEnabled(gl);
|
||||
myAspectRatioLabel->setEnabled(gl);
|
||||
myUseDeskResCheckbox->setEnabled(gl);
|
||||
myUseVSyncCheckbox->setEnabled(gl);
|
||||
|
||||
// Also, in OpenGL mode, certain software related items are disabled
|
||||
myDirtyPopup->setEnabled(!active);
|
||||
myDirtyRectCheckbox->setEnabled(!gl);
|
||||
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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.hxx,v 1.17 2006-12-28 20:40:01 stephena Exp $
|
||||
// $Id: VideoDialog.hxx,v 1.18 2006-12-30 22:26:29 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -49,16 +49,19 @@ class VideoDialog : public Dialog
|
|||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
private:
|
||||
PopUpWidget* myDirtyPopup;
|
||||
PopUpWidget* myRendererPopup;
|
||||
PopUpWidget* myFilterPopup;
|
||||
SliderWidget* myAspectRatioSlider;
|
||||
StaticTextWidget* myAspectRatioLabel;
|
||||
PopUpWidget* myPalettePopup;
|
||||
PopUpWidget* myTIAScalerPopup;
|
||||
PopUpWidget* myUIScalerPopup;
|
||||
|
||||
SliderWidget* myFrameRateSlider;
|
||||
StaticTextWidget* myFrameRateLabel;
|
||||
PopUpWidget* myScalerPopup;
|
||||
CheckboxWidget* myFullscreenCheckbox;
|
||||
CheckboxWidget* myColorLossCheckbox;
|
||||
CheckboxWidget* myDirtyRectCheckbox;
|
||||
CheckboxWidget* myUseDeskResCheckbox;
|
||||
CheckboxWidget* myUseVSyncCheckbox;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ MODULE_OBJS := \
|
|||
src/gui/EditableWidget.o \
|
||||
src/gui/EditTextWidget.o \
|
||||
src/gui/EventMappingWidget.o \
|
||||
src/gui/FileSnapDialog.o \
|
||||
src/gui/Font.o \
|
||||
src/gui/GameInfoDialog.o \
|
||||
src/gui/GameList.o \
|
||||
|
@ -19,7 +20,6 @@ MODULE_OBJS := \
|
|||
src/gui/InputTextDialog.o \
|
||||
src/gui/Launcher.o \
|
||||
src/gui/LauncherDialog.o \
|
||||
src/gui/LauncherOptionsDialog.o \
|
||||
src/gui/ListWidget.o \
|
||||
src/gui/Menu.o \
|
||||
src/gui/OptionsDialog.o \
|
||||
|
|
Loading…
Reference in New Issue