Move ROM properties normal enum to 'enum class'; this actually spread to other issues:

- properties names for 'Cartridge' changed to 'Cart'; this can speed up processing
- fixed several bugs in stella.pro (missing newlines)
- fixed 'create_props'; now it works from either the base directory or the tools directory
Reworked properties database names
This commit is contained in:
Stephen Anthony 2019-04-20 15:42:46 -02:30
parent 18babfc7a5
commit bf865e37ab
24 changed files with 13408 additions and 13384 deletions

View File

@ -31,7 +31,9 @@
* Added proper Retron77 port. (TODO: doc)
* Completely removed 'Display_Height' stuff. (TODO: doc)
* Reworked ROM properties database, making it load faster in certain
cases. Related to this, completely removed 'Display_Height' stuff.
(TODO: doc)
* Disabled some developer options for 'Player settings'. (TODO: doc)

View File

@ -108,7 +108,7 @@ MouseControl::MouseControl(Console& console, const string& mode)
// Now consider the possible modes for the mouse based on the left
// and right controllers
bool noswap = BSPF::equalsIgnoreCase(myProps.get(Console_SwapPorts), "NO");
bool noswap = BSPF::equalsIgnoreCase(myProps.get(PropType::Console_SwapPorts), "NO");
if(noswap)
{
addLeftControllerModes(noswap);
@ -203,7 +203,7 @@ void MouseControl::addPaddleModes(int lport, int rport, int lname, int rname)
msg << "Mouse is Paddle " << rname << " controller";
MouseMode mode1(type, rport, type, rport, msg.str());
if(BSPF::equalsIgnoreCase(myProps.get(Controller_SwapPaddles), "NO"))
if(BSPF::equalsIgnoreCase(myProps.get(PropType::Controller_SwapPaddles), "NO"))
{
myModeList.push_back(mode0);
myModeList.push_back(mode1);

View File

@ -293,7 +293,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
string sspath = myOSystem.snapshotSaveDir() +
(myOSystem.settings().getString("snapname") != "int" ?
myOSystem.romFile().getNameWithExt("")
: myOSystem.console().properties().get(Cartridge_Name));
: myOSystem.console().properties().get(PropType::Cart_Name));
// Check whether we want multiple snapshots created
if(number > 0)
@ -333,10 +333,10 @@ void PNGLibrary::takeSnapshot(uInt32 number)
<< BSPF::ARCH << "]";
VarList::push_back(comments, "Software", version.str());
const string& name = (myOSystem.settings().getString("snapname") == "int")
? myOSystem.console().properties().get(Cartridge_Name)
? myOSystem.console().properties().get(PropType::Cart_Name)
: myOSystem.romFile().getName();
VarList::push_back(comments, "ROM Name", name);
VarList::push_back(comments, "ROM MD5", myOSystem.console().properties().get(Cartridge_MD5));
VarList::push_back(comments, "ROM MD5", myOSystem.console().properties().get(PropType::Cart_MD5));
VarList::push_back(comments, "TV Effects", myOSystem.frameBuffer().tiaSurface().effectsInfo());
// Now create a PNG snapshot

View File

@ -209,7 +209,7 @@ void StateManager::loadState(int slot)
ostringstream buf;
buf << myOSystem.stateDir()
<< myOSystem.console().properties().get(Cartridge_Name)
<< myOSystem.console().properties().get(PropType::Cart_Name)
<< ".st" << slot;
// Make sure the file can be opened in read-only mode
@ -255,7 +255,7 @@ void StateManager::saveState(int slot)
ostringstream buf;
buf << myOSystem.stateDir()
<< myOSystem.console().properties().get(Cartridge_Name)
<< myOSystem.console().properties().get(PropType::Cart_Name)
<< ".st" << slot;
// Make sure the file can be opened for writing

View File

@ -815,7 +815,7 @@ string CartDebug::loadConfigFile()
if(myCfgFile == "")
{
const string& propsname =
myConsole.properties().get(Cartridge_Name) + ".cfg";
myConsole.properties().get(PropType::Cart_Name) + ".cfg";
FilesystemNode case1(myOSystem.romFile().getParent().getPath() + propsname);
FilesystemNode case2(myOSystem.cfgDir() + propsname);
@ -930,13 +930,13 @@ string CartDebug::saveConfigFile()
else
{
const string& propsname =
myConsole.properties().get(Cartridge_Name) + ".cfg";
myConsole.properties().get(PropType::Cart_Name) + ".cfg";
node = FilesystemNode(myOSystem.cfgDir() + propsname);
}
const string& name = myConsole.properties().get(Cartridge_Name);
const string& md5 = myConsole.properties().get(Cartridge_MD5);
const string& name = myConsole.properties().get(PropType::Cart_Name);
const string& md5 = myConsole.properties().get(PropType::Cart_MD5);
ofstream out(node.getPath());
if(!out.is_open())
@ -965,7 +965,7 @@ string CartDebug::saveDisassembly()
if(myDisasmFile == "")
{
const string& propsname =
myConsole.properties().get(Cartridge_Name) + ".asm";
myConsole.properties().get(PropType::Cart_Name) + ".asm";
myDisasmFile = FilesystemNode(myOSystem.defaultSaveDir() + propsname).getPath();
}
@ -1080,8 +1080,8 @@ string CartDebug::saveDisassembly()
out << "; Disassembly of " << myOSystem.romFile().getShortPath() << "\n"
<< "; Disassembled " << std::put_time(&timeinfo, "%c\n")
<< "; Using Stella " << STELLA_VERSION << "\n;\n"
<< "; ROM properties name : " << myConsole.properties().get(Cartridge_Name) << "\n"
<< "; ROM properties MD5 : " << myConsole.properties().get(Cartridge_MD5) << "\n"
<< "; ROM properties name : " << myConsole.properties().get(PropType::Cart_Name) << "\n"
<< "; ROM properties MD5 : " << myConsole.properties().get(PropType::Cart_MD5) << "\n"
<< "; Bankswitch type : " << myConsole.cartridge().about() << "\n;\n"
<< "; Legend: * = CODE not yet run (tentative code)\n"
<< "; D = DATA directive (referenced in some way)\n"
@ -1212,7 +1212,7 @@ string CartDebug::saveDisassembly()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::saveRom()
{
const string& rom = myConsole.properties().get(Cartridge_Name) + ".a26";
const string& rom = myConsole.properties().get(PropType::Cart_Name) + ".a26";
FilesystemNode node(myOSystem.defaultSaveDir() + rom);
ofstream out(node.getPath(), std::ios::binary);

View File

@ -1062,7 +1062,8 @@ void DebuggerParser::executeDump()
else
{
ostringstream file;
file << debugger.myOSystem.defaultSaveDir() << debugger.myOSystem.console().properties().get(Cartridge_Name) << "_dbg_";
file << debugger.myOSystem.defaultSaveDir()
<< debugger.myOSystem.console().properties().get(PropType::Cart_Name) << "_dbg_";
if(execDepth > 0)
{
file << execPrefix;

View File

@ -46,7 +46,8 @@ class ControllerWidget : public Widget, public CommandSender, public ControllerL
protected:
bool isLeftPort()
{
bool swappedPorts = instance().console().properties().get(Console_SwapPorts) == "YES";
bool swappedPorts =
instance().console().properties().get(PropType::Console_SwapPorts) == "YES";
return (controller().jack() == Controller::Jack::Left) ^ swappedPorts;
}

View File

@ -66,7 +66,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
}
ostringstream sspath;
sspath << instance().snapshotSaveDir()
<< instance().console().properties().get(Cartridge_Name);
<< instance().console().properties().get(PropType::Cart_Name);
sspath << "_dbg_";
if (execDepth > 0 && !execPrefix.empty()) {
sspath << execPrefix << "_";

View File

@ -121,7 +121,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
// Let the cart know how to query for the 'Cartridge.StartBank' property
myCart->setStartBankFromPropsFunc([this]() {
const string& startbank = myProperties.get(Cartridge_StartBank);
const string& startbank = myProperties.get(PropType::Cart_StartBank);
return startbank == EmptyString ? -1 : atoi(startbank.c_str());
});
@ -130,11 +130,11 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
// Auto-detect NTSC/PAL mode if it's requested
string autodetected = "";
myDisplayFormat = myProperties.get(Display_Format);
myDisplayFormat = myProperties.get(PropType::Display_Format);
// Add the real controllers for this system
// This must be done before the debugger is initialized
const string& md5 = myProperties.get(Cartridge_MD5);
const string& md5 = myProperties.get(PropType::Cart_MD5);
setControllers(md5);
// Mute audio and clear framebuffer while autodetection runs
@ -145,7 +145,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
{
autodetectFrameLayout();
if(myProperties.get(Display_Format) == "AUTO")
if(myProperties.get(PropType::Display_Format) == "AUTO")
{
autodetected = "*";
myCurrentFormat = 0;
@ -153,7 +153,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
}
}
if (atoi(myProperties.get(Display_YStart).c_str()) == 0) {
if (atoi(myProperties.get(PropType::Display_YStart).c_str()) == 0) {
autodetectYStart();
}
@ -203,9 +203,9 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
mySystem->reset();
// Finally, add remaining info about the console
myConsoleInfo.CartName = myProperties.get(Cartridge_Name);
myConsoleInfo.CartMD5 = myProperties.get(Cartridge_MD5);
bool swappedPorts = properties().get(Console_SwapPorts) == "YES";
myConsoleInfo.CartName = myProperties.get(PropType::Cart_Name);
myConsoleInfo.CartMD5 = myProperties.get(PropType::Cart_MD5);
bool swappedPorts = properties().get(PropType::Console_SwapPorts) == "YES";
myConsoleInfo.Control0 = myLeftControl->about(swappedPorts);
myConsoleInfo.Control1 = myRightControl->about(swappedPorts);
myConsoleInfo.BankSwitch = myCart->about();
@ -430,7 +430,7 @@ void Console::setFormat(uInt32 format)
myFormatAutodetected = false;
break;
}
myProperties.set(Display_Format, saveformat);
myProperties.set(PropType::Display_Format, saveformat);
myConsoleInfo.DisplayFormat = myDisplayFormat + autodetected;
@ -550,13 +550,13 @@ void Console::togglePhosphor()
{
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
{
myProperties.set(Display_Phosphor, "NO");
myProperties.set(PropType::Display_Phosphor, "NO");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(false);
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
}
else
{
myProperties.set(Display_Phosphor, "YES");
myProperties.set(PropType::Display_Phosphor, "YES");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
}
@ -565,7 +565,7 @@ void Console::togglePhosphor()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changePhosphor(int direction)
{
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
int blend = atoi(myProperties.get(PropType::Display_PPBlend).c_str());
if(direction == +1) // increase blend
{
@ -594,7 +594,7 @@ void Console::changePhosphor(int direction)
ostringstream val;
val << blend;
myProperties.set(Display_PPBlend, val.str());
myProperties.set(PropType::Display_PPBlend, val.str());
myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str());
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
}
@ -614,7 +614,7 @@ FBInitStatus Console::initializeVideo(bool full)
{
bool devSettings = myOSystem.settings().getBool("dev.settings");
const string& title = string("Stella ") + STELLA_VERSION +
": \"" + myProperties.get(Cartridge_Name) + "\"";
": \"" + myProperties.get(PropType::Cart_Name) + "\"";
fbstatus = myOSystem.frameBuffer().createDisplay(title,
TIAConstants::viewableWidth, TIAConstants::viewableHeight);
if(fbstatus != FBInitStatus::Success)
@ -707,13 +707,13 @@ void Console::changeYStart(int direction)
ystart = myAutodetectedYstart;
myYStartAutodetected = true;
myProperties.set(Display_YStart, "0");
myProperties.set(PropType::Display_YStart, "0");
}
else {
ostringstream ss;
ss << ystart;
myProperties.set(Display_YStart, ss.str());
myProperties.set(PropType::Display_YStart, ss.str());
}
if (ystart != myTIA->ystart()) myTIA->setYStart(ystart);
@ -747,7 +747,7 @@ void Console::updateYStart(uInt32 ystart)
void Console::setTIAProperties()
{
// FIXME - ystart is probably disappearing soon, or at least autodetection is
uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str());
uInt32 ystart = atoi(myProperties.get(PropType::Display_YStart).c_str());
if(ystart != 0)
ystart = BSPF::clamp(ystart, 0u, TIAConstants::maxYStart);
else {
@ -777,7 +777,7 @@ void Console::setTIAProperties()
void Console::createAudioQueue()
{
bool useStereo = myOSystem.settings().getBool(AudioSettings::SETTING_STEREO)
|| myProperties.get(Cartridge_Sound) == "STEREO";
|| myProperties.get(PropType::Cart_Sound) == "STEREO";
myAudioQueue = make_shared<AudioQueue>(
myEmulationTiming.audioFragmentSize(),
@ -809,11 +809,11 @@ void Console::setControllers(const string& rommd5)
else
{
// Setup the controllers based on properties
string left = myProperties.get(Controller_Left);
string right = myProperties.get(Controller_Right);
string left = myProperties.get(PropType::Controller_Left);
string right = myProperties.get(PropType::Controller_Right);
uInt32 size = 0;
const uInt8* image = myCart->getImage(size);
const bool swappedPorts = myProperties.get(Console_SwapPorts) != "NO";
const bool swappedPorts = myProperties.get(PropType::Console_SwapPorts) != "NO";
// Try to detect controllers
if(image != nullptr || size != 0)
@ -871,7 +871,7 @@ unique_ptr<Controller> Console::getControllerPort(const string& rommd5,
else if(BSPF::startsWithIgnoreCase(controllerName, "PADDLES"))
{
// Also check if we should swap the paddles plugged into a jack
bool swapPaddles = myProperties.get(Controller_SwapPaddles) == "YES";
bool swapPaddles = myProperties.get(PropType::Controller_SwapPaddles) == "YES";
bool swapAxis = false, swapDir = false;
if(controllerName == "PADDLES_IAXIS")
swapAxis = true;

View File

@ -491,7 +491,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][21] = {
{ "2319922df4d0c820b3e5f15faa870cc3", "Atari - GCC, Mike Feinstein", "CX2681, CX2681P", "Battlezone (1983) (Atari) (PAL) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2327456f86d7e0deda94758c518d05b3", "Digitel", "", "Mr. Postman (Digitel)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2351d26d0bfdee3095bec9c05cbcf7b0", "", "", "Warring Worms (19-01-2002) (Billy Eno)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2353725ec98e0f0073462109e886efd7", "Champ Games", "CG-03-P", "Scramble (PAL60)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "2353725ec98e0f0073462109e886efd7", "Champ Games", "CG-03-P", "Scramble (PAL60)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "GENESIS", "", "", "", "PAL60", "", "YES", "" },
{ "235436ab0832370e73677c9c6f0c8b06", "", "", "Beast Invaders (Double Shot) (Hack)", "Hack of Space Invaders", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2365e1534d67f94d8670394ab99150ce", "Thomas Jentzsch", "", "Missile Command (Atari Mouse) (2002) (TJ)", "Uses Atari ST Mouse Controller", "Homebrew", "", "", "", "", "", "", "", "ATARIMOUSE", "ATARIMOUSE", "", "", "", "", "YES", "" },
{ "23d445ea19a18fb78d5035878d9fb649", "CBS Electronics - JWDA, Sylvia Day, Todd Marshall, Henry Will IV", "4L1818, 4L1819, 4L1820, 4L1821", "Mouse Trap (1983) (CBS Electronics) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
@ -1232,7 +1232,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][21] = {
{ "59e53894b3899ee164c91cfa7842da66", "Data Age", "", "Survival Run (1983) (Data Age) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "59e96de9628e8373d1c685f5e57dcf10", "PlayAround - J.H.M.", "204", "Beat 'Em & Eat 'Em (1982) (PlayAround)", "Uses the Paddle Controllers", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "AUTO 45", "", "", "", "" },
{ "59f596285d174233c84597dee6f34f1f", "CCE", "C-811", "River Raid (1983) (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5a0ff99ba10bd26d542e1d6f59f56850", "Champ Games", "CG-04-P", "Super Cobra Arcade (PAL60)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "5a0ff99ba10bd26d542e1d6f59f56850", "Champ Games", "CG-04-P", "Super Cobra Arcade (PAL60)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "GENESIS", "", "", "", "PAL60", "", "YES", "" },
{ "5a17e30e6e911e74ccd7b716d02b16c6", "Activision, Dan Kitchen", "AX-029", "Crackpots (1983) (Activision) (8K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5a272012a62becabcd52920348c7c60b", "Star Game", "", "Pitfall (Star Game)", "AKA Pitfall!", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5a2f2dcd775207536d9299e768bcd2df", "Otto Versand", "781698", "Flippern (Double-Game Package) (1983) (Otto Versand) (PAL)", "AKA Video Pinball", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -1828,7 +1828,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][21] = {
{ "83f50fa0fbae545e4b88bb53b788c341", "Atari, Larry Kaplan - Sears", "CX2643 - 6-99815", "Codebreaker (1978) (Atari) (4K)", "Uses Keypad Controllers", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "83fafd7bd12e3335166c6314b3bde528", "Epyx, Steven A. Baker, Tod Frye, Peter Engelbrite", "80561-00251", "Winter Games (1987) (Epyx)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "840a5a2eaea24d95d289f514fd12f9bb", "", "", "GBImprov (Hack)", "Hack of Ghostbusters", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "841057f83ce3731e6bbfda1707cbca58", "Champ Games", "CG-04-N", "Super Cobra Arcade (NTSC)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "841057f83ce3731e6bbfda1707cbca58", "Champ Games", "CG-04-N", "Super Cobra Arcade (NTSC)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "GENESIS", "", "", "", "", "", "YES", "" },
{ "841b7bc1cad05f5408302308777d49dc", "Activision", "", "Unknown Activision Game (10-22-1982) (Activision) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "84290e333ff7567c2380f179430083b8", "Imagic, Dave Johnson", "13211, EIX-004-04I", "Quick Step! (1983) (Imagic) (PAL) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "843435eb360ed72085f7ab9374f9749a", "Joe Grand", "", "SCSIcide (1.31) (Joe Grand)", "Uses the Paddle Controllers", "New Release", "", "", "", "", "", "", "", "PADDLES_IAXDR", "", "", "AUTO 65", "", "", "", "" },
@ -3146,7 +3146,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][21] = {
{ "e9db2f91efe6ff7ea3546e2c2578fb09", "Omegamatrix", "", "Millipede (Atari Mouse) v6.5 (Omegamatrix)", "Uses Atari Mouse Controller", "", "", "", "", "", "", "", "", "", "", "", "", "PAL60", "", "", "" },
{ "e9e646f730b8400cd5da08c849ef3e3b", "Tron", "", "Enduro (Tron)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e9e6ad30549a6e2cd89fe93b7691d447", "Atari - Bobco, Robert C. Polaro", "CX26140, CX26140P", "Desert Falcon (05-27-1987) (Atari) (Prototype) (PAL)", "AKA Nile Flyer, Sphinx", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e9f25c7af4f27c9e1b5b8f6fe6141e8c", "Champ Games", "CG-03-N", "Scramble (NTSC)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e9f25c7af4f27c9e1b5b8f6fe6141e8c", "Champ Games", "CG-03-N", "Scramble (NTSC)", "Compatible with Genesis controller", "Homebrew", "", "", "", "", "", "", "", "GENESIS", "", "", "", "", "", "YES", "" },
{ "ea38fcfc06ad87a0aed1a3d1588744e4", "Atari, Lou Harp", "CX26122", "Sinistar (1984) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "ea6d40db5498d6386571a76df448aa4c", "", "", "Vertical Playfield Demo 2 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "ea7e25ade3fe68f5b786ee0aa82b1fe5", "", "", "Galatic (208 in 1) (Unknown) (PAL)", "AKA Challenge of.... Nexar, The", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -109,7 +109,7 @@ void EventHandler::initialize()
Common::Base::setHexUppercase(myOSystem.settings().getBool("dbg.uhex"));
// Default phosphor blend
Properties::setDefault(Display_PPBlend,
Properties::setDefault(PropType::Display_PPBlend,
myOSystem.settings().getString("tv.phosblend"));
}
@ -1106,7 +1106,7 @@ void EventHandler::setMouseControllerMode(const string& enable)
}
const string& control = usemouse ?
myOSystem.console().properties().get(Controller_MouseAxis) : "none";
myOSystem.console().properties().get(PropType::Controller_MouseAxis) : "none";
myMouseControl = make_unique<MouseControl>(myOSystem.console(), control);
myMouseControl->next(); // set first available mode

View File

@ -475,49 +475,52 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
myPropSet->getMD5(md5, props);
// Local helper method
auto CMDLINE_PROPS_UPDATE = [&](const string& name, PropertyType prop)
auto CMDLINE_PROPS_UPDATE = [&](const string& name, PropType prop)
{
const string& s = mySettings->getString(name);
if(s != "") props.set(prop, s);
};
CMDLINE_PROPS_UPDATE("bs", Cartridge_Type);
CMDLINE_PROPS_UPDATE("type", Cartridge_Type);
CMDLINE_PROPS_UPDATE("bs", PropType::Cart_Type);
CMDLINE_PROPS_UPDATE("type", PropType::Cart_Type);
// Now create the cartridge
string cartmd5 = md5;
const string& type = props.get(Cartridge_Type);
const string& type = props.get(PropType::Cart_Type);
unique_ptr<Cartridge> cart =
CartDetector::create(romfile, image, size, cartmd5, type, *mySettings);
// It's possible that the cart created was from a piece of the image,
// and that the md5 (and hence the cart) has changed
if(props.get(Cartridge_MD5) != cartmd5)
if(props.get(PropType::Cart_MD5) != cartmd5)
{
if(!myPropSet->getMD5(cartmd5, props))
{
// Cart md5 wasn't found, so we create a new props for it
props.set(Cartridge_MD5, cartmd5);
props.set(Cartridge_Name, props.get(Cartridge_Name)+cart->multiCartID());
props.set(PropType::Cart_MD5, cartmd5);
props.set(PropType::Cart_Name, props.get(PropType::Cart_Name)+cart->multiCartID());
myPropSet->insert(props, false);
}
}
CMDLINE_PROPS_UPDATE("sp", Console_SwapPorts);
CMDLINE_PROPS_UPDATE("lc", Controller_Left);
CMDLINE_PROPS_UPDATE("rc", Controller_Right);
CMDLINE_PROPS_UPDATE("sp", PropType::Console_SwapPorts);
CMDLINE_PROPS_UPDATE("lc", PropType::Controller_Left);
CMDLINE_PROPS_UPDATE("rc", PropType::Controller_Right);
const string& s = mySettings->getString("bc");
if(s != "") { props.set(Controller_Left, s); props.set(Controller_Right, s); }
CMDLINE_PROPS_UPDATE("cp", Controller_SwapPaddles);
CMDLINE_PROPS_UPDATE("ma", Controller_MouseAxis);
CMDLINE_PROPS_UPDATE("channels", Cartridge_Sound);
CMDLINE_PROPS_UPDATE("ld", Console_LeftDifficulty);
CMDLINE_PROPS_UPDATE("rd", Console_RightDifficulty);
CMDLINE_PROPS_UPDATE("tv", Console_TelevisionType);
CMDLINE_PROPS_UPDATE("format", Display_Format);
CMDLINE_PROPS_UPDATE("ystart", Display_YStart);
CMDLINE_PROPS_UPDATE("pp", Display_Phosphor);
CMDLINE_PROPS_UPDATE("ppblend", Display_PPBlend);
if(s != "") {
props.set(PropType::Controller_Left, s);
props.set(PropType::Controller_Right, s);
}
CMDLINE_PROPS_UPDATE("cp", PropType::Controller_SwapPaddles);
CMDLINE_PROPS_UPDATE("ma", PropType::Controller_MouseAxis);
CMDLINE_PROPS_UPDATE("channels", PropType::Cart_Sound);
CMDLINE_PROPS_UPDATE("ld", PropType::Console_LeftDiff);
CMDLINE_PROPS_UPDATE("rd", PropType::Console_RightDiff);
CMDLINE_PROPS_UPDATE("tv", PropType::Console_TVType);
CMDLINE_PROPS_UPDATE("format", PropType::Display_Format);
CMDLINE_PROPS_UPDATE("ystart", PropType::Display_YStart);
CMDLINE_PROPS_UPDATE("pp", PropType::Display_Phosphor);
CMDLINE_PROPS_UPDATE("ppblend", PropType::Display_PPBlend);
// Finally, create the cart with the correct properties
if(cart)
@ -534,7 +537,7 @@ void OSystem::closeConsole()
{
#ifdef CHEATCODE_SUPPORT
// If a previous console existed, save cheats before creating a new one
myCheatManager->saveCheats(myConsole->properties().get(Cartridge_MD5));
myCheatManager->saveCheats(myConsole->properties().get(PropType::Cart_MD5));
#endif
myConsole.reset();
}
@ -717,7 +720,7 @@ void OSystem::mainLoop()
// Cleanup time
#ifdef CHEATCODE_SUPPORT
if(myConsole)
myCheatManager->saveCheats(myConsole->properties().get(Cartridge_MD5));
myCheatManager->saveCheats(myConsole->properties().get(PropType::Cart_MD5));
myCheatManager->saveCheatDatabase();
#endif

View File

@ -33,38 +33,39 @@ Properties::Properties(const Properties& properties)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::set(PropertyType key, const string& value)
void Properties::set(PropType key, const string& value)
{
if(key != LastPropType)
uInt8 pos = static_cast<uInt8>(key);
if(pos < static_cast<uInt8>(PropType::NumTypes))
{
myProperties[key] = value;
if(BSPF::equalsIgnoreCase(myProperties[key], "AUTO-DETECT"))
myProperties[key] = "AUTO";
myProperties[pos] = value;
if(BSPF::equalsIgnoreCase(myProperties[pos], "AUTO-DETECT"))
myProperties[pos] = "AUTO";
switch(key)
{
case Cartridge_Type:
case Display_Format:
case Cartridge_Sound:
case Console_LeftDifficulty:
case Console_RightDifficulty:
case Console_TelevisionType:
case Console_SwapPorts:
case Controller_Left:
case Controller_Right:
case Controller_SwapPaddles:
case Controller_MouseAxis:
case Display_Phosphor:
case PropType::Cart_Sound:
case PropType::Cart_Type:
case PropType::Console_LeftDiff:
case PropType::Console_RightDiff:
case PropType::Console_TVType:
case PropType::Console_SwapPorts:
case PropType::Controller_Left:
case PropType::Controller_Right:
case PropType::Controller_SwapPaddles:
case PropType::Controller_MouseAxis:
case PropType::Display_Format:
case PropType::Display_Phosphor:
{
BSPF::toUpperCase(myProperties[key]);
BSPF::toUpperCase(myProperties[pos]);
break;
}
case Display_PPBlend:
case PropType::Display_PPBlend:
{
int blend = atoi(myProperties[key].c_str());
int blend = atoi(myProperties[pos].c_str());
if(blend < 0 || blend > 100)
myProperties[key] = ourDefaultProperties[key];
myProperties[pos] = ourDefaultProperties[pos];
break;
}
@ -102,7 +103,7 @@ istream& operator>>(istream& is, Properties& p)
return is;
// Set the property
PropertyType type = Properties::getPropertyType(key);
PropType type = Properties::getPropType(key);
p.set(type, value);
}
@ -114,7 +115,7 @@ ostream& operator<<(ostream& os, const Properties& p)
{
// Write out each of the key and value pairs
bool changed = false;
for(int i = 0; i < LastPropType; ++i)
for(uInt8 i = 0; i < static_cast<uInt8>(PropType::NumTypes); ++i)
{
// Try to save some space by only saving the items that differ from default
if(p.myProperties[i] != Properties::ourDefaultProperties[i])
@ -191,7 +192,7 @@ void Properties::writeQuotedString(ostream& out, const string& s)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Properties::operator==(const Properties& properties) const
{
for(int i = 0; i < LastPropType; ++i)
for(uInt8 i = 0; i < static_cast<uInt8>(PropType::NumTypes); ++i)
if(myProperties[i] != properties.myProperties[i])
return false;
@ -218,79 +219,79 @@ Properties& Properties::operator=(const Properties& properties)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::setDefault(PropertyType key, const string& value)
void Properties::setDefault(PropType key, const string& value)
{
ourDefaultProperties[key] = value;
ourDefaultProperties[static_cast<uInt8>(key)] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::copy(const Properties& properties)
{
// Now, copy each property from properties
for(int i = 0; i < LastPropType; ++i)
for(uInt8 i = 0; i < static_cast<uInt8>(PropType::NumTypes); ++i)
myProperties[i] = properties.myProperties[i];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::print() const
{
cout << get(Cartridge_MD5) << "|"
<< get(Cartridge_Name) << "|"
<< get(Cartridge_Manufacturer) << "|"
<< get(Cartridge_ModelNo) << "|"
<< get(Cartridge_Note) << "|"
<< get(Cartridge_Rarity) << "|"
<< get(Cartridge_Sound) << "|"
<< get(Cartridge_StartBank) << "|"
<< get(Cartridge_Type) << "|"
<< get(Console_LeftDifficulty) << "|"
<< get(Console_RightDifficulty)<< "|"
<< get(Console_TelevisionType) << "|"
<< get(Console_SwapPorts) << "|"
<< get(Controller_Left) << "|"
<< get(Controller_Right) << "|"
<< get(Controller_SwapPaddles) << "|"
<< get(Controller_MouseAxis) << "|"
<< get(Display_Format) << "|"
<< get(Display_YStart) << "|"
<< get(Display_Phosphor) << "|"
<< get(Display_PPBlend)
cout << get(PropType::Cart_MD5) << "|"
<< get(PropType::Cart_Name) << "|"
<< get(PropType::Cart_Manufacturer) << "|"
<< get(PropType::Cart_ModelNo) << "|"
<< get(PropType::Cart_Note) << "|"
<< get(PropType::Cart_Rarity) << "|"
<< get(PropType::Cart_Sound) << "|"
<< get(PropType::Cart_StartBank) << "|"
<< get(PropType::Cart_Type) << "|"
<< get(PropType::Console_LeftDiff) << "|"
<< get(PropType::Console_RightDiff) << "|"
<< get(PropType::Console_TVType) << "|"
<< get(PropType::Console_SwapPorts) << "|"
<< get(PropType::Controller_Left) << "|"
<< get(PropType::Controller_Right) << "|"
<< get(PropType::Controller_SwapPaddles) << "|"
<< get(PropType::Controller_MouseAxis) << "|"
<< get(PropType::Display_Format) << "|"
<< get(PropType::Display_YStart) << "|"
<< get(PropType::Display_Phosphor) << "|"
<< get(PropType::Display_PPBlend)
<< endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::setDefaults()
{
for(int i = 0; i < LastPropType; ++i)
for(uInt8 i = 0; i < static_cast<uInt8>(PropType::NumTypes); ++i)
myProperties[i] = ourDefaultProperties[i];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyType Properties::getPropertyType(const string& name)
PropType Properties::getPropType(const string& name)
{
for(int i = 0; i < LastPropType; ++i)
for(uInt8 i = 0; i < static_cast<uInt8>(PropType::NumTypes); ++i)
if(ourPropertyNames[i] == name)
return PropertyType(i);
return PropType(i);
// Otherwise, indicate that the item wasn't found
return LastPropType;
return PropType::NumTypes;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Properties::printHeader()
{
cout << "Cartridge_MD5|"
<< "Cartridge_Name|"
<< "Cartridge_Manufacturer|"
<< "Cartridge_ModelNo|"
<< "Cartridge_Note|"
<< "Cartridge_Rarity|"
<< "Cartridge_Sound|"
<< "Cartridge_StartBank|"
<< "Cartridge_Type|"
<< "Console_LeftDifficulty|"
<< "Console_RightDifficulty|"
<< "Console_TelevisionType|"
cout << "Cart_MD5|"
<< "Cart_Name|"
<< "Cart_Manufacturer|"
<< "Cart_ModelNo|"
<< "Cart_Note|"
<< "Cart_Rarity|"
<< "Cart_Sound|"
<< "Cart_StartBank|"
<< "Cart_Type|"
<< "Console_LeftDiff|"
<< "Console_RightDiff|"
<< "Console_TVType|"
<< "Console_SwapPorts|"
<< "Controller_Left|"
<< "Controller_Right|"
@ -304,44 +305,46 @@ void Properties::printHeader()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Properties::ourDefaultProperties[LastPropType] = {
"", // Cartridge.MD5
"", // Cartridge.Manufacturer
"", // Cartridge.ModelNo
"Untitled", // Cartridge.Name
"", // Cartridge.Note
"", // Cartridge.Rarity
"MONO", // Cartridge.Sound
"", // Cartridge.StartBank
"AUTO", // Cartridge.Type
"B", // Console.LeftDifficulty
"B", // Console.RightDifficulty
"COLOR", // Console.TelevisionType
"NO", // Console.SwapPorts
"AUTO", // Controller.Left
"AUTO", // Controller.Right
"NO", // Controller.SwapPaddles
"AUTO", // Controller.MouseAxis
"AUTO", // Display.Format
"0", // Display.YStart
"NO", // Display.Phosphor
"0" // Display.PPBlend
string Properties::ourDefaultProperties[static_cast<uInt8>(PropType::NumTypes)] =
{
"", // Cart.MD5
"", // Cart.Manufacturer
"", // Cart.ModelNo
"", // Cart.Name
"", // Cart.Note
"", // Cart.Rarity
"MONO", // Cart.Sound
"", // Cart.StartBank
"AUTO", // Cart.Type
"B", // Console.LeftDiff
"B", // Console.RightDiff
"COLOR", // Console.TVType
"NO", // Console.SwapPorts
"AUTO", // Controller.Left
"AUTO", // Controller.Right
"NO", // Controller.SwapPaddles
"AUTO", // Controller.MouseAxis
"AUTO", // Display.Format
"0", // Display.YStart
"NO", // Display.Phosphor
"0" // Display.PPBlend
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* const Properties::ourPropertyNames[LastPropType] = {
"Cartridge.MD5",
"Cartridge.Manufacturer",
"Cartridge.ModelNo",
"Cartridge.Name",
"Cartridge.Note",
"Cartridge.Rarity",
"Cartridge.Sound",
"Cartridge.StartBank",
"Cartridge.Type",
"Console.LeftDifficulty",
"Console.RightDifficulty",
"Console.TelevisionType",
const char* const Properties::ourPropertyNames[static_cast<uInt8>(PropType::NumTypes)] =
{
"Cart.MD5",
"Cart.Manufacturer",
"Cart.ModelNo",
"Cart.Name",
"Cart.Note",
"Cart.Rarity",
"Cart.Sound",
"Cart.StartBank",
"Cart.Type",
"Console.LeftDiff",
"Console.RightDiff",
"Console.TVType",
"Console.SwapPorts",
"Controller.Left",
"Controller.Right",

View File

@ -20,19 +20,19 @@
#include "bspf.hxx"
enum PropertyType {
Cartridge_MD5,
Cartridge_Manufacturer,
Cartridge_ModelNo,
Cartridge_Name,
Cartridge_Note,
Cartridge_Rarity,
Cartridge_Sound,
Cartridge_StartBank,
Cartridge_Type,
Console_LeftDifficulty,
Console_RightDifficulty,
Console_TelevisionType,
enum class PropType : uInt8 {
Cart_MD5,
Cart_Manufacturer,
Cart_ModelNo,
Cart_Name,
Cart_Note,
Cart_Rarity,
Cart_Sound,
Cart_StartBank,
Cart_Type,
Console_LeftDiff,
Console_RightDiff,
Console_TVType,
Console_SwapPorts,
Controller_Left,
Controller_Right,
@ -42,7 +42,7 @@ enum PropertyType {
Display_YStart,
Display_Phosphor,
Display_PPBlend,
LastPropType
NumTypes
};
/**
@ -81,8 +81,9 @@ class Properties
@param key The key of the property to lookup
@return The value of the property
*/
const string& get(PropertyType key) const {
return key != LastPropType ? myProperties[key] : EmptyString;
const string& get(PropType key) const {
uInt8 pos = static_cast<uInt8>(key);
return pos < static_cast<uInt8>(PropType::NumTypes) ? myProperties[pos] : EmptyString;
}
/**
@ -91,7 +92,7 @@ class Properties
@param key The key of the property to set
@param value The value to assign to the property
*/
void set(PropertyType key, const string& value);
void set(PropType key, const string& value);
/**
Load properties from the specified input stream
@ -142,7 +143,7 @@ class Properties
@param key The key of the property to set
@param value The value to assign to the property
*/
static void setDefault(PropertyType key, const string& value);
static void setDefault(PropType key, const string& value);
private:
/**
@ -175,9 +176,9 @@ class Properties
/**
Get the property type associated with the named property
@param name The PropertyType key associated with the given string
@param name The PropType key associated with the given string
*/
static PropertyType getPropertyType(const string& name);
static PropType getPropType(const string& name);
/**
When printing each collection of ROM properties, it is useful to
@ -188,13 +189,13 @@ class Properties
private:
// The array of properties
string myProperties[LastPropType];
string myProperties[static_cast<uInt8>(PropType::NumTypes)];
// List of default properties to use when none have been provided
static string ourDefaultProperties[LastPropType];
static string ourDefaultProperties[static_cast<uInt8>(PropType::NumTypes)];
// The text strings associated with each property type
static const char* const ourPropertyNames[LastPropType];
static const char* const ourPropertyNames[static_cast<uInt8>(PropType::NumTypes)];
};
#endif

View File

@ -101,13 +101,14 @@ bool PropertiesSet::getMD5(const string& md5, Properties& properties,
while(low <= high)
{
int i = (low + high) / 2;
int cmp = BSPF::compareIgnoreCase(md5, DefProps[i][Cartridge_MD5]);
int cmp = BSPF::compareIgnoreCase(md5,
DefProps[i][static_cast<uInt8>(PropType::Cart_MD5)]);
if(cmp == 0) // found it
{
for(int p = 0; p < LastPropType; ++p)
for(uInt8 p = 0; p < static_cast<uInt8>(PropType::NumTypes); ++p)
if(DefProps[i][p][0] != 0)
properties.set(PropertyType(p), DefProps[i][p]);
properties.set(PropType(p), DefProps[i][p]);
found = true;
break;
@ -128,9 +129,9 @@ void PropertiesSet::getMD5WithInsert(const FilesystemNode& rom,
{
if(!getMD5(md5, properties))
{
properties.set(Cartridge_MD5, md5);
properties.set(PropType::Cart_MD5, md5);
// Create a name suitable for using in properties
properties.set(Cartridge_Name, rom.getNameWithExt(""));
properties.set(PropType::Cart_Name, rom.getNameWithExt(""));
insert(properties, false);
}
@ -149,7 +150,7 @@ void PropertiesSet::insert(const Properties& properties, bool save)
// most people tend not to do
// Since the PropSet is keyed by md5, we can't insert without a valid one
const string& md5 = properties.get(Cartridge_MD5);
const string& md5 = properties.get(PropType::Cart_MD5);
if(md5 == "")
return;
@ -196,11 +197,11 @@ void PropertiesSet::print() const
for(int i = 0; i < DEF_PROPS_SIZE; ++i)
{
properties.setDefaults();
for(int p = 0; p < LastPropType; ++p)
for(uInt8 p = 0; p < static_cast<uInt8>(PropType::NumTypes); ++p)
if(DefProps[i][p][0] != 0)
properties.set(PropertyType(p), DefProps[i][p]);
properties.set(PropType(p), DefProps[i][p]);
list.emplace(DefProps[i][Cartridge_MD5], properties);
list.emplace(DefProps[i][static_cast<uInt8>(PropType::Cart_MD5)], properties);
}
// Now, print the resulting list

View File

@ -27,7 +27,7 @@ Switches::Switches(const Event& event, const Properties& properties,
mySwitches(0xFF),
myIs7800(false)
{
if(properties.get(Console_RightDifficulty) == "B")
if(properties.get(PropType::Console_RightDiff) == "B")
{
mySwitches &= ~0x80;
}
@ -36,7 +36,7 @@ Switches::Switches(const Event& event, const Properties& properties,
mySwitches |= 0x80;
}
if(properties.get(Console_LeftDifficulty) == "B")
if(properties.get(PropType::Console_LeftDiff) == "B")
{
mySwitches &= ~0x40;
}
@ -45,7 +45,7 @@ Switches::Switches(const Event& event, const Properties& properties,
mySwitches |= 0x40;
}
if(properties.get(Console_TelevisionType) == "COLOR")
if(properties.get(PropType::Console_TVType) == "COLOR")
{
mySwitches |= 0x08;
}

View File

@ -86,8 +86,8 @@ void TIASurface::initialize(const Console& console,
}
else
{
p_blend = atoi(console.properties().get(Display_PPBlend).c_str());
enable = console.properties().get(Display_Phosphor) == "YES";
p_blend = atoi(console.properties().get(PropType::Display_PPBlend).c_str());
enable = console.properties().get(PropType::Display_Phosphor) == "YES";
}
enablePhosphor(enable, p_blend);

File diff suppressed because it is too large Load Diff

View File

@ -363,7 +363,7 @@ void GameInfoDialog::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadEmulationProperties(const Properties& props)
{
myBSType->setSelected(props.get(Cartridge_Type), "AUTO");
myBSType->setSelected(props.get(PropType::Cart_Type), "AUTO");
if(instance().hasConsole() && myBSType->getSelectedTag().toString() == "AUTO")
{
@ -377,7 +377,7 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
else
myTypeDetected->setLabel("");
myFormat->setSelected(props.get(Display_Format), "AUTO");
myFormat->setSelected(props.get(PropType::Display_Format), "AUTO");
if(instance().hasConsole() && myFormat->getSelectedTag().toString() == "AUTO")
{
const string& format = instance().console().about().DisplayFormat;
@ -389,7 +389,7 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
// if phosphor is always enabled, disable game specific phosphor settings
bool alwaysPhosphor = instance().settings().getString("tv.phosphor") == "always";
bool usePhosphor = props.get(Display_Phosphor) == "YES";
bool usePhosphor = props.get(PropType::Display_Phosphor) == "YES";
myPhosphor->setState(usePhosphor);
myPhosphor->setEnabled(!alwaysPhosphor);
if (alwaysPhosphor)
@ -398,10 +398,10 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
myPhosphor->setLabel("Phosphor");
myPPBlend->setEnabled(!alwaysPhosphor && usePhosphor);
const string& blend = props.get(Display_PPBlend);
const string& blend = props.get(PropType::Display_PPBlend);
myPPBlend->setValue(atoi(blend.c_str()));
mySound->setState(props.get(Cartridge_Sound) == "STEREO");
mySound->setState(props.get(PropType::Cart_Sound) == "STEREO");
// if stereo is always enabled, disable game specific stereo setting
mySound->setEnabled(!instance().audioSettings().stereo());
}
@ -409,18 +409,18 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadConsoleProperties(const Properties& props)
{
myLeftDiffGroup->setSelected(props.get(Console_LeftDifficulty) == "A" ? 0 : 1);
myRightDiffGroup->setSelected(props.get(Console_RightDifficulty) == "A" ? 0 : 1);
myTVTypeGroup->setSelected(props.get(Console_TelevisionType) == "BW" ? 1 : 0);
myLeftDiffGroup->setSelected(props.get(PropType::Console_LeftDiff) == "A" ? 0 : 1);
myRightDiffGroup->setSelected(props.get(PropType::Console_RightDiff) == "A" ? 0 : 1);
myTVTypeGroup->setSelected(props.get(PropType::Console_TVType) == "BW" ? 1 : 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadControllerProperties(const Properties& props)
{
bool swapPorts = props.get(Console_SwapPorts) == "YES";
bool swapPorts = props.get(PropType::Console_SwapPorts) == "YES";
bool autoDetect = false;
BytePtr image;
string md5 = props.get(Cartridge_MD5);
string md5 = props.get(PropType::Cart_MD5);
uInt32 size = 0;
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
@ -430,7 +430,7 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
autoDetect = true;
string label = "";
string controller = props.get(Controller_Left);
string controller = props.get(PropType::Controller_Left);
myLeftPort->setSelected(controller, "AUTO");
if(myLeftPort->getSelectedTag().toString() == "AUTO")
@ -446,7 +446,7 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
myLeftPortDetected->setLabel(label);
label = "";
controller = props.get(Controller_Right);
controller = props.get(PropType::Controller_Right);
myRightPort->setSelected(controller, "AUTO");
if(myRightPort->getSelectedTag().toString() == "AUTO")
@ -461,11 +461,11 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
}
myRightPortDetected->setLabel(label);
mySwapPorts->setState(props.get(Console_SwapPorts) == "YES");
mySwapPaddles->setState(props.get(Controller_SwapPaddles) == "YES");
mySwapPorts->setState(props.get(PropType::Console_SwapPorts) == "YES");
mySwapPaddles->setState(props.get(PropType::Controller_SwapPaddles) == "YES");
// MouseAxis property (potentially contains 'range' information)
istringstream m_axis(props.get(Controller_MouseAxis));
istringstream m_axis(props.get(PropType::Controller_MouseAxis));
string m_control, m_range;
m_axis >> m_control;
bool autoAxis = BSPF::equalsIgnoreCase(m_control, "AUTO");
@ -497,36 +497,36 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadCartridgeProperties(const Properties& props)
{
myName->setText(props.get(Cartridge_Name));
myMD5->setText(props.get(Cartridge_MD5));
myManufacturer->setText(props.get(Cartridge_Manufacturer));
myModelNo->setText(props.get(Cartridge_ModelNo));
myRarity->setText(props.get(Cartridge_Rarity));
myNote->setText(props.get(Cartridge_Note));
myName->setText(props.get(PropType::Cart_Name));
myMD5->setText(props.get(PropType::Cart_MD5));
myManufacturer->setText(props.get(PropType::Cart_Manufacturer));
myModelNo->setText(props.get(PropType::Cart_ModelNo));
myRarity->setText(props.get(PropType::Cart_Rarity));
myNote->setText(props.get(PropType::Cart_Note));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::saveConfig()
{
// Emulation properties
myGameProperties.set(Cartridge_Type, myBSType->getSelectedTag().toString());
myGameProperties.set(Display_Format, myFormat->getSelectedTag().toString());
myGameProperties.set(Display_Phosphor, myPhosphor->getState() ? "YES" : "NO");
myGameProperties.set(PropType::Cart_Type, myBSType->getSelectedTag().toString());
myGameProperties.set(PropType::Display_Format, myFormat->getSelectedTag().toString());
myGameProperties.set(PropType::Display_Phosphor, myPhosphor->getState() ? "YES" : "NO");
myGameProperties.set(Display_PPBlend, myPPBlend->getValueLabel() == "Off" ? "0" :
myGameProperties.set(PropType::Display_PPBlend, myPPBlend->getValueLabel() == "Off" ? "0" :
myPPBlend->getValueLabel());
myGameProperties.set(Cartridge_Sound, mySound->getState() ? "STEREO" : "MONO");
myGameProperties.set(PropType::Cart_Sound, mySound->getState() ? "STEREO" : "MONO");
// Console properties
myGameProperties.set(Console_LeftDifficulty, myLeftDiffGroup->getSelected() ? "B" : "A");
myGameProperties.set(Console_RightDifficulty, myRightDiffGroup->getSelected() ? "B" : "A");
myGameProperties.set(Console_TelevisionType, myTVTypeGroup->getSelected() ? "BW" : "COLOR");
myGameProperties.set(PropType::Console_LeftDiff, myLeftDiffGroup->getSelected() ? "B" : "A");
myGameProperties.set(PropType::Console_RightDiff, myRightDiffGroup->getSelected() ? "B" : "A");
myGameProperties.set(PropType::Console_TVType, myTVTypeGroup->getSelected() ? "BW" : "COLOR");
// Controller properties
myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString());
myGameProperties.set(Controller_Right, myRightPort->getSelectedTag().toString());
myGameProperties.set(Console_SwapPorts, (mySwapPorts->isEnabled() && mySwapPorts->getState()) ? "YES" : "NO");
myGameProperties.set(Controller_SwapPaddles, (/*mySwapPaddles->isEnabled() &&*/ mySwapPaddles->getState()) ? "YES" : "NO");
myGameProperties.set(PropType::Controller_Left, myLeftPort->getSelectedTag().toString());
myGameProperties.set(PropType::Controller_Right, myRightPort->getSelectedTag().toString());
myGameProperties.set(PropType::Console_SwapPorts, (mySwapPorts->isEnabled() && mySwapPorts->getState()) ? "YES" : "NO");
myGameProperties.set(PropType::Controller_SwapPaddles, (/*mySwapPaddles->isEnabled() &&*/ mySwapPaddles->getState()) ? "YES" : "NO");
// MouseAxis property (potentially contains 'range' information)
string mcontrol = "AUTO";
@ -536,14 +536,14 @@ void GameInfoDialog::saveConfig()
string range = myMouseRange->getValueLabel();
if(range != "100")
mcontrol += " " + range;
myGameProperties.set(Controller_MouseAxis, mcontrol);
myGameProperties.set(PropType::Controller_MouseAxis, mcontrol);
// Cartridge properties
myGameProperties.set(Cartridge_Name, myName->getText());
myGameProperties.set(Cartridge_Manufacturer, myManufacturer->getText());
myGameProperties.set(Cartridge_ModelNo, myModelNo->getText());
myGameProperties.set(Cartridge_Rarity, myRarity->getText());
myGameProperties.set(Cartridge_Note, myNote->getText());
myGameProperties.set(PropType::Cart_Name, myName->getText());
myGameProperties.set(PropType::Cart_Manufacturer, myManufacturer->getText());
myGameProperties.set(PropType::Cart_ModelNo, myModelNo->getText());
myGameProperties.set(PropType::Cart_Rarity, myRarity->getText());
myGameProperties.set(PropType::Cart_Note, myNote->getText());
// Always insert; if the properties are already present, nothing will happen
instance().propSet().insert(myGameProperties);
@ -571,7 +571,7 @@ void GameInfoDialog::setDefaults()
{
// Load the default properties
Properties defaultProperties;
const string& md5 = myGameProperties.get(Cartridge_MD5);
const string& md5 = myGameProperties.get(PropType::Cart_MD5);
instance().propSet().getMD5(md5, defaultProperties, true);

View File

@ -145,7 +145,7 @@ void RomAuditDialog::auditRoms()
const string& md5 = MD5::hash(files[idx]);
if(instance().propSet().getMD5(md5, props))
{
const string& name = props.get(Cartridge_Name);
const string& name = props.get(PropType::Cart_Name);
// Only rename the file if we found a valid properties entry
if(name != "" && name != files[idx].getName())

View File

@ -100,7 +100,7 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
// Get a valid filename representing a snapshot file for this rom
const string& filename = instance().snapshotLoadDir() +
myProperties.get(Cartridge_Name) + ".png";
myProperties.get(PropType::Cart_Name) + ".png";
// Read the PNG file
try
@ -121,20 +121,20 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
mySurface->setVisible(mySurfaceIsValid);
// Now add some info for the message box below the image
myRomInfo.push_back("Name: " + myProperties.get(Cartridge_Name));
myRomInfo.push_back("Manufacturer: " + myProperties.get(Cartridge_Manufacturer));
myRomInfo.push_back("Model: " + myProperties.get(Cartridge_ModelNo));
myRomInfo.push_back("Rarity: " + myProperties.get(Cartridge_Rarity));
myRomInfo.push_back("Note: " + myProperties.get(Cartridge_Note));
bool swappedPorts = myProperties.get(Console_SwapPorts) == "YES";
myRomInfo.push_back("Name: " + myProperties.get(PropType::Cart_Name));
myRomInfo.push_back("Manufacturer: " + myProperties.get(PropType::Cart_Manufacturer));
myRomInfo.push_back("Model: " + myProperties.get(PropType::Cart_ModelNo));
myRomInfo.push_back("Rarity: " + myProperties.get(PropType::Cart_Rarity));
myRomInfo.push_back("Note: " + myProperties.get(PropType::Cart_Note));
bool swappedPorts = myProperties.get(PropType::Console_SwapPorts) == "YES";
// Load the image for controller auto detection
string left = myProperties.get(Controller_Left);
string right = myProperties.get(Controller_Right);
string left = myProperties.get(PropType::Controller_Left);
string right = myProperties.get(PropType::Controller_Right);
try
{
BytePtr image;
string md5 = myProperties.get(Cartridge_MD5);
string md5 = myProperties.get(PropType::Cart_MD5);
uInt32 size = 0;
if(node.exists() && !node.isDirectory() &&

View File

@ -239,8 +239,8 @@ void StellaSettingsDialog::saveConfig()
levelToValue(myTVScanIntense->getValue()));
// Controller properties
myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString());
myGameProperties.set(Controller_Right, myRightPort->getSelectedTag().toString());
myGameProperties.set(PropType::Controller_Left, myLeftPort->getSelectedTag().toString());
myGameProperties.set(PropType::Controller_Right, myRightPort->getSelectedTag().toString());
// Always insert; if the properties are already present, nothing will happen
instance().propSet().insert(myGameProperties);
@ -271,7 +271,7 @@ void StellaSettingsDialog::setDefaults()
// Load the default game properties
Properties defaultProperties;
const string& md5 = myGameProperties.get(Cartridge_MD5);
const string& md5 = myGameProperties.get(PropType::Cart_MD5);
instance().propSet().getMD5(md5, defaultProperties, true);
@ -342,7 +342,7 @@ void StellaSettingsDialog::loadControllerProperties(const Properties& props)
{
bool autoDetect = false;
BytePtr image;
string md5 = props.get(Cartridge_MD5);
string md5 = props.get(PropType::Cart_MD5);
uInt32 size = 0;
const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom());
@ -352,8 +352,8 @@ void StellaSettingsDialog::loadControllerProperties(const Properties& props)
autoDetect = true;
string label = "";
string controller = props.get(Controller_Left);
bool swapPorts = props.get(Console_SwapPorts) == "YES";
string controller = props.get(PropType::Controller_Left);
bool swapPorts = props.get(PropType::Console_SwapPorts) == "YES";
myLeftPort->setSelected(controller, "AUTO");
if (myLeftPort->getSelectedTag().toString() == "AUTO")
@ -369,7 +369,7 @@ void StellaSettingsDialog::loadControllerProperties(const Properties& props)
myLeftPortDetected->setLabel(label);
label = "";
controller = props.get(Controller_Right);
controller = props.get(PropType::Controller_Right);
myRightPort->setSelected(controller, "AUTO");
if (myRightPort->getSelectedTag().toString() == "AUTO")

View File

@ -3,18 +3,18 @@ package PropSet;
# NOTE: If the property types ever change in Stella, the following hashmap
# and array must be updated (and stay in sequence)
my %prop_type = (
"Cartridge.MD5" => 0,
"Cartridge.Manufacturer" => 1,
"Cartridge.ModelNo" => 2,
"Cartridge.Name" => 3,
"Cartridge.Note" => 4,
"Cartridge.Rarity" => 5,
"Cartridge.Sound" => 6,
"Cartridge.StartBank" => 7,
"Cartridge.Type" => 8,
"Console.LeftDifficulty" => 9,
"Console.RightDifficulty" => 10,
"Console.TelevisionType" => 11,
"Cart.MD5" => 0,
"Cart.Manufacturer" => 1,
"Cart.ModelNo" => 2,
"Cart.Name" => 3,
"Cart.Note" => 4,
"Cart.Rarity" => 5,
"Cart.Sound" => 6,
"Cart.StartBank" => 7,
"Cart.Type" => 8,
"Console.LeftDiff" => 9,
"Console.RightDiff" => 10,
"Console.TVType" => 11,
"Console.SwapPorts" => 12,
"Controller.Left" => 13,
"Controller.Right" => 14,
@ -26,18 +26,18 @@ my %prop_type = (
"Display.PPBlend" => 20
);
my @prop_type_as_string = (
"Cartridge.MD5",
"Cartridge.Manufacturer",
"Cartridge.ModelNo",
"Cartridge.Name",
"Cartridge.Note",
"Cartridge.Rarity",
"Cartridge.Sound",
"Cartridge.StartBank",
"Cartridge.Type",
"Console.LeftDifficulty",
"Console.RightDifficulty",
"Console.TelevisionType",
"Cart.MD5",
"Cart.Manufacturer",
"Cart.ModelNo",
"Cart.Name",
"Cart.Note",
"Cart.Rarity",
"Cart.Sound",
"Cart.StartBank",
"Cart.Type",
"Console.LeftDiff",
"Console.RightDiff",
"Console.TVType",
"Console.SwapPorts",
"Controller.Left",
"Controller.Right",
@ -53,7 +53,7 @@ my @prop_defaults = (
"",
"",
"",
"Untitled",
"",
"",
"",
"MONO",

View File

@ -15,8 +15,16 @@ if (@ARGV != 2)
usage();
}
# Saves me from having to type these paths *every single time*
$infile = "../emucore/stella.pro";
$outfile = "../emucore/DefProps.hxx";
if (-f "src/emucore/stella.pro") {
$infile = "src/emucore/stella.pro";
} else {
$infile = "../emucore/stella.pro";
}
if (-f "src/emucore/DefProps.hxx") {
$outfile = "src/emucore/DefProps.hxx";
} else {
$outfile = "../emucore/DefProps.hxx";
}
}
else
{