Override properties dialog is now called 'Power-on options', and includes

extended abilities (see changelog and docs for more info).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2783 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-08-09 13:09:47 +00:00
parent ed49f9ba1d
commit 893bfd4a41
15 changed files with 319 additions and 161 deletions

View File

@ -48,6 +48,28 @@
hexadecimal display between upper/lower case. This setting is
also saved in the settings file as argument 'dbg.uhex'.
* Renamed 'Override properties' dialog (accessible from the ROM
launcher by a right-mouse-button click) to 'Power-on options', with
the following new options:
- Set start-up state for both joysticks as well as console select/
reset buttons. Related to this, added 'holdjoy01' and 'holdjoy1'
commandline arguments, and removed 'holdbutton0' argument.
- The ability to load the ROM directly from this dialog, after
changing any settings.
- Added more detailed information as to how to use this
functionality to the UI.
- Buttons held down are reset approx. 0.5 seconds after starting
the ROM, to simulate pressing and releasing the buttons on a
real console.
* Fixed bug when using event remapping; any changes were being saved only
when launching a ROM from the launcher, not in standalone mode.
* Added properties database info for "Princess Rescue" ROM.
* For the Linux/UNIX port:
- Fixed bug whereby a maximize button was always present in the
window title bar. Stella could not be expanded in this way,
@ -56,11 +78,6 @@
- Added Startup notification protocol patch to the .desktop
file from Dan Fandrich.
* Fixed bug when using event remapping; it was only working when
launching a ROM from the launcher, not in standalone mode.
* Added properties database info for "Princess Rescue" ROM.
* Updated included PNG library to latest stable version.
-Have fun!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -10,7 +10,7 @@
<br><br>
<center><h2><b>A multi-platform Atari 2600 VCS emulator</b></h2></center>
<center><h4><b>Release 3.9</b></h4></center>
<center><h4><b>Release 3.9.1</b></h4></center>
<br><br>
<center><h2><b>User's Guide</b></h2></center>
@ -54,7 +54,7 @@
<br><br><br>
<center><b>February 1999 - June 2013</b></center>
<center><b>February 1999 - August 2013</b></center>
<center><b>The Stella Team</b></center>
<center><b><a href="http://stella.sourceforge.net">Stella Homepage</a></b></center>
@ -2230,8 +2230,15 @@
</tr>
<tr>
<td><pre>-holdreset</pre></td>
<td>Start the emulator with the Game Reset switch held down.</td>
<td><pre>-holdjoy0 &lt;U,D,L,R,F&gt;</pre></td>
<td>Start the emulator with the left joystick direction/button held down
(ie, use 'UF' for up and fire).</td>
</tr>
<tr>
<td><pre>-holdjoy1 &lt;U,D,L,R,F&gt;</pre></td>
<td>Start the emulator with the right joystick direction/button held down
(ie, use 'UF' for up and fire).</td>
</tr>
<tr>
@ -2240,8 +2247,8 @@
</tr>
<tr>
<td><pre>-holdbutton0</pre></td>
<td>Start the emulator with the left joystick button held down.</td>
<td><pre>-holdreset</pre></td>
<td>Start the emulator with the Game Reset switch held down.</td>
</tr>
<tr>
@ -2673,11 +2680,11 @@
contains the following items:</p>
<p><ol>
<li><p><b>Override properties</b>: Selecting this option shows a dialog whereby
ROM properties can be temporarily overriden. Selecting options from this
dialog will cause all ROMs launched after that to use those properties
you specify. Clicking <b>Default</b> will disable its functionality,
and use ROM properties as defined by the ROM itself. The dialog is as
<li><p><b>Power-on options</b>: Selecting this option shows a dialog whereby
ROM properties can be temporarily overriden, and joystick/console buttons can be
temporarily held down. Selecting options from this dialog will cause all ROMs launched
after that to use those properties you specify. Clicking <b>Defaults</b> will disable
its functionality, and use ROM properties as defined by the ROM itself. The dialog is as
follows (See <b>Advanced Configuration - <a href="#Properties">Game Properties</a></b>
for more information concerning ROM properties):</p>
<table border="5" cellpadding="2" frame="box" rules="none">
@ -2691,9 +2698,10 @@
<tr><td>Left Difficulty</td><td>-ld</td></tr>
<tr><td>Right Difficulty</td><td>-rd</td></tr>
<tr><td>TV Type</td><td>-tv</td></tr>
<tr><td>Hold Select down</td><td>-holdselect</td></tr>
<tr><td>Hold Reset down</td><td>-holdreset</td></tr>
<tr><td>Hold Button 0 down</td><td>-holdbutton0</td></tr>
<tr><td>Left joy items</td><td>-holdjoy0</td></tr>
<tr><td>Right joy items</td><td>-holdjoy1</td></tr>
<tr><td>Console: Select</td><td>-holdselect</td></tr>
<tr><td>Console: Reset</td><td>-holdreset</td></tr>
</table>
<p></p>
</td>

View File

@ -365,7 +365,7 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len)
// The callback is requesting 8-bit (unsigned) data, but the TIA sound
// emulator deals in 16-bit (signed) data
// So, we need to convert the pointer and half the length
sound->processFragment((Int16*)stream, (uInt32)len / 2);
sound->processFragment((Int16*)stream, (uInt32)len >> 1);
}
}

View File

@ -32,8 +32,7 @@ TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
{
_type = kTogglePixelWidget;
_rowHeight = font.getLineHeight();
_colWidth = 15;
_rowHeight = _colWidth = font.getLineHeight();
// Calculate real dimensions
_w = _colWidth * cols + 1;

View File

@ -130,6 +130,12 @@ void EventHandler::reset(State state)
myOSystem->state().reset();
setContinuousSnapshots(0);
// Reset events almost immediately after starting emulation mode
// We wait a little while, since 'hold' events may be present, and we want
// time for the ROM to process them
if(state == S_EMULATE)
SDL_AddTimer(500, resetEventsCallback, (void*)this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2176,6 +2182,13 @@ void EventHandler::setEventState(State state)
mySkipMouseMotion = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 EventHandler::resetEventsCallback(uInt32 interval, void* param)
{
((EventHandler*)param)->myEvent.clear();
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setSDLMappings()
{

View File

@ -356,6 +356,9 @@ class EventHandler
void setEventState(State state);
// Callback function invoked by the event-reset SDL Timer
static uInt32 resetEventsCallback(uInt32 interval, void* param);
private:
// Structure used for action menu items
struct ActionList {

View File

@ -593,8 +593,30 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
myEventHandler->handleEvent(Event::ConsoleReset, 1);
if(mySettings->getBool("holdselect"))
myEventHandler->handleEvent(Event::ConsoleSelect, 1);
if(mySettings->getBool("holdbutton0"))
const string& holdjoy0 = mySettings->getString("holdjoy0");
if(BSPF_containsIgnoreCase(holdjoy0, "U"))
myEventHandler->handleEvent(Event::JoystickZeroUp, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "D"))
myEventHandler->handleEvent(Event::JoystickZeroDown, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "L"))
myEventHandler->handleEvent(Event::JoystickZeroLeft, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "R"))
myEventHandler->handleEvent(Event::JoystickZeroRight, 1);
if(BSPF_containsIgnoreCase(holdjoy0, "F"))
myEventHandler->handleEvent(Event::JoystickZeroFire, 1);
const string& holdjoy1 = mySettings->getString("holdjoy1");
if(BSPF_containsIgnoreCase(holdjoy1, "U"))
myEventHandler->handleEvent(Event::JoystickOneUp, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "D"))
myEventHandler->handleEvent(Event::JoystickOneDown, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "L"))
myEventHandler->handleEvent(Event::JoystickOneLeft, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "R"))
myEventHandler->handleEvent(Event::JoystickOneRight, 1);
if(BSPF_containsIgnoreCase(holdjoy1, "F"))
myEventHandler->handleEvent(Event::JoystickOneFire, 1);
}
return EmptyString;
}

View File

@ -219,9 +219,10 @@ string Settings::loadCommandLine(int argc, char** argv)
return "";
}
// Take care of arguments without an option
// Take care of arguments without an option or ones that shouldn't
// be saved to the config file
if(key == "rominfo" || key == "debug" || key == "holdreset" ||
key == "holdselect" || key == "holdbutton0" || key == "takesnapshot")
key == "holdselect" || key == "takesnapshot")
{
setExternal(key, "true");
continue;
@ -431,7 +432,8 @@ void Settings::usage()
<< " -maxres <WxH> Used by developers to force the maximum size of the application window\n"
<< " -holdreset Start the emulator with the Game Reset switch held down\n"
<< " -holdselect Start the emulator with the Game Select switch held down\n"
<< " -holdbutton0 Start the emulator with the left joystick button held down\n"
<< " -holdjoy0 <U,D,L,R,F> Start the emulator with the left joystick direction/fire button held down\n"
<< " -holdjoy1 <U,D,L,R,F> Start the emulator with the right joystick direction/fire button held down\n"
<< " -tiadriven <1|0> Drive unused TIA pins randomly on a read/peek\n"
<< " -cpurandom <1|0> Randomize the contents of CPU registers on reset\n"
<< " -ramrandom <1|0> Randomize the contents of RAM on reset\n"

View File

@ -132,43 +132,43 @@ GameInfoDialog::GameInfoDialog(
"Type:", kTextAlignLeft);
pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
items.clear();
items.push_back("Auto-detect", "AUTO" );
items.push_back("0840 (8K ECONObank)", "0840" );
items.push_back("2IN1 Multicart (4-32K)", "2IN1" );
items.push_back("4IN1 Multicart (8-32K)", "4IN1" );
items.push_back("8IN1 Multicart (16-64K)", "8IN1" );
items.push_back("16IN1 Multicart (32-128K)", "16IN1");
items.push_back("32IN1 Multicart (64/128K)", "32IN1");
items.push_back("64IN1 Multicart (128/256K)", "64IN1");
items.push_back("128IN1 Multicart (256/512K)","128IN1");
items.push_back("2K (64-2048 bytes Atari)", "2K" );
items.push_back("3E (32K Tigervision)", "3E" );
items.push_back("3F (512K Tigervision)", "3F" );
items.push_back("4A50 (64K 4A50 + ram)", "4A50" );
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("CM (SpectraVideo CompuMate)", "CM" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("DPC+ (Enhanced DPC)", "DPC+" );
items.push_back("E0 (8K Parker Bros)", "E0" );
items.push_back("E7 (16K M-network)", "E7" );
items.push_back("EF (64K H. Runner)", "EF" );
items.push_back("EFSC (64K H. Runner + ram)", "EFSC" );
items.push_back("F0 (Dynacom Megaboy)", "F0" );
items.push_back("F4 (32K Atari)", "F4" );
items.push_back("F4SC (32K Atari + ram)", "F4SC" );
items.push_back("F6 (16K Atari)", "F6" );
items.push_back("F6SC (16K Atari + ram)", "F6SC" );
items.push_back("F8 (8K Atari)", "F8" );
items.push_back("F8SC (8K Atari + ram)", "F8SC" );
items.push_back("FA (CBS RAM Plus)", "FA" );
items.push_back("FA2 (CBS RAM Plus 24/28K)", "FA2" );
items.push_back("FE (8K Decathlon)", "FE" );
items.push_back("MC (C. Wilkson Megacart)", "MC" );
items.push_back("SB (128-256K SUPERbank)", "SB" );
items.push_back("UA (8K UA Ltd.)", "UA" );
items.push_back("X07 (64K AtariAge)", "X07" );
items.push_back("Auto-detect", "AUTO" );
items.push_back("0840 (8K ECONObank)", "0840" );
items.push_back("2IN1 Multicart (4-32K)", "2IN1" );
items.push_back("4IN1 Multicart (8-32K)", "4IN1" );
items.push_back("8IN1 Multicart (16-64K)", "8IN1" );
items.push_back("16IN1 Multicart (32-128K)", "16IN1" );
items.push_back("32IN1 Multicart (64/128K)", "32IN1" );
items.push_back("64IN1 Multicart (128/256K)", "64IN1" );
items.push_back("128IN1 Multicart (256/512K)", "128IN1");
items.push_back("2K (64-2048 bytes Atari)", "2K" );
items.push_back("3E (32K Tigervision)", "3E" );
items.push_back("3F (512K Tigervision)", "3F" );
items.push_back("4A50 (64K 4A50 + ram)", "4A50" );
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("CM (SpectraVideo CompuMate)", "CM" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("DPC+ (Enhanced DPC)", "DPC+" );
items.push_back("E0 (8K Parker Bros)", "E0" );
items.push_back("E7 (16K M-network)", "E7" );
items.push_back("EF (64K H. Runner)", "EF" );
items.push_back("EFSC (64K H. Runner + ram)", "EFSC" );
items.push_back("F0 (Dynacom Megaboy)", "F0" );
items.push_back("F4 (32K Atari)", "F4" );
items.push_back("F4SC (32K Atari + ram)", "F4SC" );
items.push_back("F6 (16K Atari)", "F6" );
items.push_back("F6SC (16K Atari + ram)", "F6SC" );
items.push_back("F8 (8K Atari)", "F8" );
items.push_back("F8SC (8K Atari + ram)", "F8SC" );
items.push_back("FA (CBS RAM Plus)", "FA" );
items.push_back("FA2 (CBS RAM Plus 24/28K)", "FA2" );
items.push_back("FE (8K Decathlon)", "FE" );
items.push_back("MC (C. Wilkson Megacart)", "MC" );
items.push_back("SB (128-256K SUPERbank)", "SB" );
items.push_back("UA (8K UA Ltd.)", "UA" );
items.push_back("X07 (64K AtariAge)", "X07" );
myType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myType);

View File

@ -26,13 +26,14 @@
#include "Settings.hxx"
#include "StringList.hxx"
#include "Widget.hxx"
#include "LauncherDialog.hxx"
#include "GlobalPropsDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GlobalPropsDialog::
GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 0, 0)
GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 0, 0),
CommandSender(boss)
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),
@ -44,10 +45,11 @@ GlobalPropsDialog::
pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
WidgetArray wid;
VariantList items;
const GUI::Font& infofont = instance().infoFont();
// Set real dimensions
_w = lwidth + pwidth + fontWidth*3 + 15;
_h = 10 * (lineHeight + 4) + buttonHeight + 10;
_h = 15 * (lineHeight + 4) + buttonHeight + 20;
xpos = 10; ypos = 10;
@ -61,43 +63,43 @@ GlobalPropsDialog::
new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight,
"Bankswitch type:", kTextAlignLeft);
items.clear();
items.push_back("Auto-detect", "AUTO" );
items.push_back("0840 (8K ECONObank)", "0840" );
items.push_back("2IN1 Multicart (4-32K)", "2IN1" );
items.push_back("4IN1 Multicart (8-32K)", "4IN1" );
items.push_back("8IN1 Multicart (16-64K)", "8IN1" );
items.push_back("16IN1 Multicart (32-128K)", "16IN1");
items.push_back("32IN1 Multicart (64/128K)", "32IN1");
items.push_back("64IN1 Multicart (128/256K)", "64IN1");
items.push_back("128IN1 Multicart (256/512K)","128IN1");
items.push_back("2K (64-2048 bytes Atari)", "2K" );
items.push_back("3E (32K Tigervision)", "3E" );
items.push_back("3F (512K Tigervision)", "3F" );
items.push_back("4A50 (64K 4A50 + ram)", "4A50" );
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("CM (SpectraVideo CompuMate)", "CM" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("DPC+ (Enhanced DPC)", "DPC+" );
items.push_back("E0 (8K Parker Bros)", "E0" );
items.push_back("E7 (16K M-network)", "E7" );
items.push_back("EF (64K H. Runner)", "EF" );
items.push_back("EFSC (64K H. Runner + ram)", "EFSC" );
items.push_back("F0 (Dynacom Megaboy)", "F0" );
items.push_back("F4 (32K Atari)", "F4" );
items.push_back("F4SC (32K Atari + ram)", "F4SC" );
items.push_back("F6 (16K Atari)", "F6" );
items.push_back("F6SC (16K Atari + ram)", "F6SC" );
items.push_back("F8 (8K Atari)", "F8" );
items.push_back("F8SC (8K Atari + ram)", "F8SC" );
items.push_back("FA (CBS RAM Plus)", "FA" );
items.push_back("FA2 (CBS RAM Plus 24/28K)", "FA2" );
items.push_back("FE (8K Decathlon)", "FE" );
items.push_back("MC (C. Wilkson Megacart)", "MC" );
items.push_back("SB (128-256K SUPERbank)", "SB" );
items.push_back("UA (8K UA Ltd.)", "UA" );
items.push_back("X07 (64K AtariAge)", "X07" );
items.push_back("Auto-detect", "AUTO" );
items.push_back("0840 (8K ECONObank)", "0840" );
items.push_back("2IN1 Multicart (4-32K)", "2IN1" );
items.push_back("4IN1 Multicart (8-32K)", "4IN1" );
items.push_back("8IN1 Multicart (16-64K)", "8IN1" );
items.push_back("16IN1 Multicart (32-128K)", "16IN1" );
items.push_back("32IN1 Multicart (64/128K)", "32IN1" );
items.push_back("64IN1 Multicart (128/256K)", "64IN1" );
items.push_back("128IN1 Multicart (256/512K)", "128IN1");
items.push_back("2K (64-2048 bytes Atari)", "2K" );
items.push_back("3E (32K Tigervision)", "3E" );
items.push_back("3F (512K Tigervision)", "3F" );
items.push_back("4A50 (64K 4A50 + ram)", "4A50" );
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("CM (SpectraVideo CompuMate)", "CM" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("DPC+ (Enhanced DPC)", "DPC+" );
items.push_back("E0 (8K Parker Bros)", "E0" );
items.push_back("E7 (16K M-network)", "E7" );
items.push_back("EF (64K H. Runner)", "EF" );
items.push_back("EFSC (64K H. Runner + ram)", "EFSC" );
items.push_back("F0 (Dynacom Megaboy)", "F0" );
items.push_back("F4 (32K Atari)", "F4" );
items.push_back("F4SC (32K Atari + ram)", "F4SC" );
items.push_back("F6 (16K Atari)", "F6" );
items.push_back("F6SC (16K Atari + ram)", "F6SC" );
items.push_back("F8 (8K Atari)", "F8" );
items.push_back("F8SC (8K Atari + ram)", "F8SC" );
items.push_back("FA (CBS RAM Plus)", "FA" );
items.push_back("FA2 (CBS RAM Plus 24/28K)", "FA2" );
items.push_back("FE (8K Decathlon)", "FE" );
items.push_back("MC (C. Wilkson Megacart)", "MC" );
items.push_back("SB (128-256K SUPERbank)", "SB" );
items.push_back("UA (8K UA Ltd.)", "UA" );
items.push_back("X07 (64K AtariAge)", "X07" );
myBSType = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myBSType);
@ -135,38 +137,40 @@ GlobalPropsDialog::
myTVType = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myTVType);
ypos += lineHeight + 5;
ypos += lineHeight + 10;
xpos = 30; ypos += 10;
// Start console with buttons held down
new StaticTextWidget(this, font, xpos, ypos+1,
font.getStringWidth("Start console with the following held down:"),
fontHeight, "Start console with the following held down:",
kTextAlignLeft);
xpos += 10; ypos += lineHeight;
new StaticTextWidget(this, infofont, xpos, ypos+1, _w - 40, infofont.getFontHeight(),
"(*) Buttons are automatically released shortly",
kTextAlignLeft);
ypos += infofont.getLineHeight();
new StaticTextWidget(this, infofont, xpos, ypos+1, _w - 40, infofont.getFontHeight(),
" after emulation has started",
kTextAlignLeft);
// Start with Select held down
myHoldSelect = new CheckboxWidget(this, font, xpos, ypos,
"Hold Select down");
wid.push_back(myHoldSelect);
ypos += lineHeight + 4;
// Start with Reset held down
myHoldReset = new CheckboxWidget(this, font, xpos, ypos,
"Hold Reset down");
wid.push_back(myHoldReset);
ypos += lineHeight + 4;
// Start with joy button 0 held down
myHoldButton0 = new CheckboxWidget(this, font, xpos, ypos,
"Hold Button 0 down");
wid.push_back(myHoldButton0);
// Start with console joystick direction/buttons held down
xpos = 30; ypos += lineHeight + 10;
ypos = addHoldWidgets(font, xpos, ypos, wid);
// Add message concerning usage
lwidth = font.getStringWidth("(*) These changes are not saved");
new StaticTextWidget(this, font, 10, _h - 2*buttonHeight - 10, lwidth, fontHeight,
"(*) These changes are not saved", kTextAlignLeft);
xpos = 10; ypos += 2 * fontHeight;
new StaticTextWidget(this, infofont, xpos, ypos, _w - 20, infofont.getFontHeight(),
"(*) These options are not saved, but apply to all", kTextAlignLeft);
ypos += infofont.getLineHeight();
new StaticTextWidget(this, infofont, xpos, ypos, _w - 20, infofont.getFontHeight(),
" further ROMs until clicking 'Defaults'", kTextAlignLeft);
// Add Defaults, OK and Cancel buttons
ButtonWidget* b;
b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10,
buttonWidth, buttonHeight, "Defaults", kDefaultsCmd);
wid.push_back(b);
addOKCancelBGroup(wid, font);
addOKCancelBGroup(wid, font, "Load ROM");
addToFocusList(wid);
}
@ -176,6 +180,70 @@ GlobalPropsDialog::~GlobalPropsDialog()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int GlobalPropsDialog::addHoldWidgets(const GUI::Font& font, int x, int y,
WidgetArray& wid)
{
const int fontHeight = font.getFontHeight();
int xpos = x, ypos = y;
// Left joystick
StaticTextWidget* t = new StaticTextWidget(this, font, xpos, ypos+2,
font.getStringWidth("Left Joy:"), fontHeight, "Left Joy:",
kTextAlignLeft);
xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 10;
myJoy[kJ0Up] = new CheckboxWidget(this, font, xpos, ypos, "", kJ0Up);
ypos += myJoy[kJ0Up]->getHeight() * 2 + 10;
myJoy[kJ0Down] = new CheckboxWidget(this, font, xpos, ypos, "", kJ0Down);
xpos -= myJoy[kJ0Up]->getWidth() + 5;
ypos -= myJoy[kJ0Up]->getHeight() + 5;
myJoy[kJ0Left] = new CheckboxWidget(this, font, xpos, ypos, "", kJ0Left);
xpos += (myJoy[kJ0Up]->getWidth() + 5) * 2;
myJoy[kJ0Right] = new CheckboxWidget(this, font, xpos, ypos, "", kJ0Right);
xpos -= (myJoy[kJ0Up]->getWidth() + 5) * 2;
ypos += myJoy[kJ0Down]->getHeight() * 2 + 10;
myJoy[kJ0Fire] = new CheckboxWidget(this, font, xpos, ypos, "Fire", kJ0Fire);
int final_y = ypos;
xpos = _w / 3; ypos = y;
// Right joystick
t = new StaticTextWidget(this, font, xpos, ypos+2,
font.getStringWidth("Right Joy:"), fontHeight, "Right Joy:",
kTextAlignLeft);
xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 10;
myJoy[kJ1Up] = new CheckboxWidget(this, font, xpos, ypos, "", kJ1Up);
ypos += myJoy[kJ1Up]->getHeight() * 2 + 10;
myJoy[kJ1Down] = new CheckboxWidget(this, font, xpos, ypos, "", kJ1Down);
xpos -= myJoy[kJ1Up]->getWidth() + 5;
ypos -= myJoy[kJ1Up]->getHeight() + 5;
myJoy[kJ1Left] = new CheckboxWidget(this, font, xpos, ypos, "", kJ1Left);
xpos += (myJoy[kJ1Up]->getWidth() + 5) * 2;
myJoy[kJ1Right] = new CheckboxWidget(this, font, xpos, ypos, "", kJ1Right);
xpos -= (myJoy[kJ1Up]->getWidth() + 5) * 2;
ypos += myJoy[kJ1Down]->getHeight() * 2 + 10;
myJoy[kJ1Fire] = new CheckboxWidget(this, font, xpos, ypos, "Fire", kJ1Fire);
xpos = 2 * _w / 3; ypos = y;
// Console Select/Reset
t = new StaticTextWidget(this, font, xpos, ypos+2,
font.getStringWidth("Console:"), fontHeight, "Console:",
kTextAlignLeft);
xpos -= 10; ypos += t->getHeight() + 10;
myHoldSelect = new CheckboxWidget(this, font, xpos, ypos, "Select");
ypos += myHoldSelect->getHeight() + 5;
myHoldReset = new CheckboxWidget(this, font, xpos, ypos, "Reset");
for(int i = kJ0Up; i <= kJ1Fire; ++i)
wid.push_back(myJoy[i]);
wid.push_back(myHoldSelect);
wid.push_back(myHoldReset);
return final_y;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalPropsDialog::loadConfig()
{
@ -186,9 +254,15 @@ void GlobalPropsDialog::loadConfig()
myRightDiff->setSelected(settings.getString("rd"), "DEFAULT");
myTVType->setSelected(settings.getString("tv"), "DEFAULT");
const string& holdjoy0 = settings.getString("holdjoy0");
for(int i = kJ0Up; i <= kJ0Fire; ++i)
myJoy[i]->setState(BSPF_containsIgnoreCase(holdjoy0, ourJoyState[i]));
const string& holdjoy1 = settings.getString("holdjoy1");
for(int i = kJ1Up; i <= kJ1Fire; ++i)
myJoy[i]->setState(BSPF_containsIgnoreCase(holdjoy1, ourJoyState[i]));
myHoldSelect->setState(settings.getBool("holdselect"));
myHoldReset->setState(settings.getBool("holdreset"));
myHoldButton0->setState(settings.getBool("holdbutton0"));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -213,22 +287,32 @@ void GlobalPropsDialog::saveConfig()
if(s == "DEFAULT") s = "";
settings.setValue("tv", s);
s = "";
for(int i = kJ0Up; i <= kJ0Fire; ++i)
if(myJoy[i]->getState()) s += ourJoyState[i];
settings.setValue("holdjoy0", s);
s = "";
for(int i = kJ1Up; i <= kJ1Fire; ++i)
if(myJoy[i]->getState()) s += ourJoyState[i];
settings.setValue("holdjoy1", s);
settings.setValue("holdselect", myHoldSelect->getState());
settings.setValue("holdreset", myHoldReset->getState());
settings.setValue("holdbutton0", myHoldButton0->getState());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalPropsDialog::setDefaults()
{
myBSType->setSelected("AUTO", "");
myLeftDiff->setSelected("DEFAULT", "");
myRightDiff->setSelected("DEFAULT", "");
myTVType->setSelected("DEFAULT", "");
myBSType->setSelected("AUTO");
myLeftDiff->setSelected("DEFAULT");
myRightDiff->setSelected("DEFAULT");
myTVType->setSelected("DEFAULT");
for(int i = kJ0Up; i <= kJ1Fire; ++i)
myJoy[i]->setState(false);
myHoldSelect->setState(false);
myHoldReset->setState(false);
myHoldButton0->setState(false);
_dirty = true;
}
@ -242,6 +326,8 @@ void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd,
case kOKCmd:
saveConfig();
close();
// Inform parent to load the ROM
sendCommand(LauncherDialog::kLoadROMCmd, 0, 0);
break;
case kDefaultsCmd:
@ -253,3 +339,8 @@ void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd,
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* GlobalPropsDialog::ourJoyState[10] = {
"U", "D", "L", "R", "F", "U", "D", "L", "R", "F"
};

View File

@ -29,13 +29,15 @@ class OSystem;
#include "Dialog.hxx"
#include "bspf.hxx"
class GlobalPropsDialog : public Dialog
class GlobalPropsDialog : public Dialog, public CommandSender
{
public:
GlobalPropsDialog(GuiObject* boss, const GUI::Font& font);
virtual ~GlobalPropsDialog();
private:
int addHoldWidgets(const GUI::Font& font, int x, int y, WidgetArray& wid);
void loadConfig();
void saveConfig();
void setDefaults();
@ -43,14 +45,21 @@ class GlobalPropsDialog : public Dialog
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
PopUpWidget* myBSType;
PopUpWidget* myLeftDiff;
PopUpWidget* myRightDiff;
PopUpWidget* myTVType;
enum {
kJ0Up, kJ0Down, kJ0Left, kJ0Right, kJ0Fire,
kJ1Up, kJ1Down, kJ1Left, kJ1Right, kJ1Fire
};
PopUpWidget* myBSType;
PopUpWidget* myLeftDiff;
PopUpWidget* myRightDiff;
PopUpWidget* myTVType;
CheckboxWidget* myJoy[10];
CheckboxWidget* myHoldSelect;
CheckboxWidget* myHoldReset;
CheckboxWidget* myHoldButton0;
static const char* ourJoyState[10];
};
#endif

View File

@ -135,7 +135,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
xpos = 10; ypos += myDir->getHeight() + 4;
#ifndef MAC_OSX
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Select", kStartCmd);
"Select", kLoadROMCmd);
wid.push_back(myStartButton);
xpos += bwidth + 8;
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
@ -181,7 +181,7 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
// Create context menu for ROM list options
VariantList l;
l.push_back("Override properties", "override");
l.push_back("Power-on options", "override");
l.push_back("Filter listing", "filter");
l.push_back("Reload listing", "reload");
myMenu = new ContextMenu(this, osystem->font(), l);
@ -481,7 +481,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
{
switch (cmd)
{
case kStartCmd:
case kLoadROMCmd:
case ListWidget::kActivatedCmd:
case ListWidget::kDoubleClickedCmd:
{

View File

@ -49,6 +49,7 @@ class LauncherDialog : public Dialog
public:
// These must be accessible from dialogs created by this class
enum {
kLoadROMCmd = 'STRT', // load currently selected ROM
kRomDirChosenCmd = 'romc', // rom chosen
kReloadRomDirCmd = 'rdrl', // reload the current listing
kReloadFiltersCmd = 'rlfl' // reload filtering options and current listing
@ -124,7 +125,6 @@ class LauncherDialog : public Dialog
StringList myRomExts;
enum {
kStartCmd = 'STRT',
kPrevDirCmd = 'PRVD',
kOptionsCmd = 'OPTI',
kQuitCmd = 'QUIT',

View File

@ -4,6 +4,7 @@
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <list>
using namespace std;
@ -12,9 +13,9 @@ typedef unsigned int uInt32;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int searchForBytes(const uInt8* image, uInt32 imagesize,
const uInt8* signature, uInt32 sigsize)
const uInt8* signature, uInt32 sigsize,
list<int>& locations)
{
#if 1
uInt32 count = 0;
for(uInt32 i = 0; i < imagesize - sigsize; ++i)
{
@ -27,26 +28,13 @@ int searchForBytes(const uInt8* image, uInt32 imagesize,
break;
}
if(matches == sigsize)
++count;
}
return count;
#else
uInt32 minhits = 2;
uInt32 count = 0;
for(uInt32 i = 0; i < imagesize - 3; ++i)
{
if(image[i] == 0xEA && image[i+2] >= 0x60 && image[i+2] <= 0x6F)
{
++count;
i += 3;
locations.push_back(i);
}
if(count >= minhits)
break;
}
return count;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -79,9 +67,15 @@ int main(int ac, char* av[])
}
// cerr << "sig size = " << hex << s_size << endl;
int result = searchForBytes(image, i_size, sig, s_size);
list<int> locations;
int result = searchForBytes(image, i_size, sig, s_size, locations);
if(result > 0)
cout << setw(3) << result << " hits: \'" << av[2] << "\' - \"" << av[1] << "\"" << endl;
{
cout << setw(3) << result << " hits: \'" << av[2] << "\' - \"" << av[1] << "\" @";
for(list<int>::iterator it = locations.begin(); it != locations.end(); ++it)
cout << ' ' << hex << (int)*it;
cout << endl;
}
delete[] image;
delete[] sig;