Added remaining properties (except cartridge type) to GameInfoDialog.

So pressing 'OK' in that dialog will merge the properties into user.pro,
and doing a reload of ROM (Crtl-r) or exit/enter ROM will use the new
settings.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@803 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-09-30 18:17:29 +00:00
parent 95c826f3d1
commit 7dcfdedda6
5 changed files with 76 additions and 21 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.cxx,v 1.101 2005-09-29 18:50:51 stephena Exp $ // $Id: EventHandler.cxx,v 1.102 2005-09-30 18:17:29 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -386,7 +386,7 @@ void EventHandler::poll(uInt32 time)
break; break;
case SDLK_s: // Alt-s merges properties into user properties (user.pro) case SDLK_s: // Alt-s merges properties into user properties (user.pro)
myOSystem->console().saveProperties(myOSystem->userProperties(), true); saveProperties();
break; break;
} }
} }
@ -1717,6 +1717,12 @@ void EventHandler::leaveDebugMode()
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::saveProperties()
{
myOSystem->console().saveProperties(myOSystem->userProperties(), true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setSDLMappings() void EventHandler::setSDLMappings()
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.hxx,v 1.50 2005-09-16 18:15:44 stephena Exp $ // $Id: EventHandler.hxx,v 1.51 2005-09-30 18:17:29 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -74,7 +74,7 @@ struct Stella_Joystick {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.50 2005-09-16 18:15:44 stephena Exp $ @version $Id: EventHandler.hxx,v 1.51 2005-09-30 18:17:29 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -230,6 +230,7 @@ class EventHandler
void leaveCmdMenuMode(); void leaveCmdMenuMode();
bool enterDebugMode(); bool enterDebugMode();
void leaveDebugMode(); void leaveDebugMode();
void saveProperties();
// Holds static strings for the remap menu // Holds static strings for the remap menu
static ActionList ourActionList[62]; static ActionList ourActionList[62];

View File

@ -13,15 +13,12 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GameInfoDialog.cxx,v 1.14 2005-09-30 00:40:34 stephena Exp $ // $Id: GameInfoDialog.cxx,v 1.15 2005-09-30 18:17:29 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#include <cctype>
#include <algorithm>
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Props.hxx" #include "Props.hxx"
@ -324,14 +321,6 @@ void GameInfoDialog::loadConfig()
else else
myRightDiff->setSelectedTag(0); myRightDiff->setSelectedTag(0);
s = myGameProperties->get("Console.RightDifficulty", true);
if(s == "B")
myRightDiff->setSelectedTag(1);
else if(s == "A")
myRightDiff->setSelectedTag(2);
else
myRightDiff->setSelectedTag(0);
s = myGameProperties->get("Console.TelevisionType", true); s = myGameProperties->get("Console.TelevisionType", true);
if(s == "COLOR") if(s == "COLOR")
myTVType->setSelectedTag(1); myTVType->setSelectedTag(1);
@ -395,7 +384,7 @@ void GameInfoDialog::loadConfig()
void GameInfoDialog::saveConfig() void GameInfoDialog::saveConfig()
{ {
string s; string s;
int i; int i, tag;
// Cartridge properties // Cartridge properties
s = myName->getEditString(); s = myName->getEditString();
@ -413,14 +402,66 @@ void GameInfoDialog::saveConfig()
s = myNote->getEditString(); s = myNote->getEditString();
myGameProperties->set("Cartridge.Note", s); myGameProperties->set("Cartridge.Note", s);
i = mySound->getSelectedTag(); tag = mySound->getSelectedTag();
s = (i == 1) ? "Mono" : "Stereo"; s = (tag == 1) ? "Mono" : "Stereo";
myGameProperties->set("Cartridge.Sound", s); myGameProperties->set("Cartridge.Sound", s);
// FIXME - type // FIXME - type
// Console properties
tag = myLeftDiff->getSelectedTag();
s = (tag == 1) ? "B" : "A";
myGameProperties->set("Console.LeftDifficulty", s);
tag = myRightDiff->getSelectedTag();
s = (tag == 1) ? "B" : "A";
myGameProperties->set("Console.RightDifficulty", s);
tag = myTVType->getSelectedTag();
s = (tag == 1) ? "Color" : "BlackAndWhite";
myGameProperties->set("Console.TelevisionType", s);
// Controller properties
tag = myLeftController->getSelectedTag();
for(i = 0; i < 5; ++i)
{
if(i == tag-1)
{
myGameProperties->set("Controller.Left", ourControllerList[i].name);
break;
}
}
tag = myRightController->getSelectedTag();
for(i = 0; i < 5; ++i)
{
if(i == tag-1)
{
myGameProperties->set("Controller.Right", ourControllerList[i].name);
break;
}
}
// Display properties
tag = myFormat->getSelectedTag();
s = (tag == 1) ? "NTSC" : "PAL";
myGameProperties->set("Display.Format", s);
s = myXStart->getEditString();
myGameProperties->set("Cartridge.XStart", s);
s = myWidth->getEditString();
myGameProperties->set("Cartridge.Width", s);
s = myYStart->getEditString();
myGameProperties->set("Cartridge.YStart", s);
s = myHeight->getEditString();
myGameProperties->set("Cartridge.Height", s);
tag = myHmoveBlanks->getSelectedTag();
s = (tag == 1) ? "Yes" : "No";
myGameProperties->set("Emulation.HmoveBlanks", s);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -431,6 +472,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
{ {
case kOKCmd: case kOKCmd:
saveConfig(); saveConfig();
instance()->eventHandler().saveProperties();
close(); close();
break; break;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ListWidget.cxx,v 1.33 2005-09-23 23:35:02 stephena Exp $ // $Id: ListWidget.cxx,v 1.34 2005-09-30 18:17:29 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -367,6 +367,11 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect ListWidget::getRect() const
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::scrollToCurrent(int item) void ListWidget::scrollToCurrent(int item)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ListWidget.hxx,v 1.13 2005-09-13 18:27:42 stephena Exp $ // $Id: ListWidget.hxx,v 1.14 2005-09-30 18:17:29 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -69,6 +69,7 @@ class ListWidget : public EditableWidget
virtual bool handleKeyUp(int ascii, int keycode, int modifiers); virtual bool handleKeyUp(int ascii, int keycode, int modifiers);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
virtual GUI::Rect getRect() const;
virtual bool wantsFocus() { return true; } virtual bool wantsFocus() { return true; }
void startEditMode(); void startEditMode();