Fixed bug in 'ROM Audit' mode; sometimes ROMs without properties

would be erroneously renamed.  Also improved ROM Audit dialog a little.

Updated changelog.
This commit is contained in:
Stephen Anthony 2017-05-06 21:23:15 -02:30
parent 50cef57670
commit 670c72a1ed
3 changed files with 43 additions and 29 deletions

View File

@ -46,6 +46,9 @@
addresses; previously they only worked for write addresses addresses; previously they only worked for write addresses
- The previous trap'm' commands are now renamed 'trap', 'trapread' - The previous trap'm' commands are now renamed 'trap', 'trapread'
and 'trapwrite' and 'trapwrite'
- The TIA tab now shows 'old' contents of player and ball registers
- Various UI items are crossed out when disabled, to more clearly
indicate their current state
- Command completion now works with internal functions and pseudo-ops - Command completion now works with internal functions and pseudo-ops
(basically, anything starting with the '_' character) (basically, anything starting with the '_' character)
- In general, input error checking is much more strictly enforced - In general, input error checking is much more strictly enforced
@ -71,6 +74,12 @@
this bug has only ever occurred in Windows XP, but it's been there this bug has only ever occurred in Windows XP, but it's been there
since Stella 4.1. since Stella 4.1.
* Fixed bug in 'Rom Audit' functionality; sometimes ROMs without a
valid properties entry were being renamed as "Untitled.bin".
* For the entire UI, removed colons and generally made the UI items
easier to read.
* When in 'ROM launcher mode', Stella now uses slightly less CPU time. * When in 'ROM launcher mode', Stella now uses slightly less CPU time.
* Added ROM properties for D.K. VCS homebrew ROM, thanks to Andreas * Added ROM properties for D.K. VCS homebrew ROM, thanks to Andreas
@ -112,8 +121,11 @@
both libraries are now compiled into the app whenever one is selected. both libraries are now compiled into the app whenever one is selected.
This fixes issues with a newer ZLIB not working with an older PNG, etc. This fixes issues with a newer ZLIB not working with an older PNG, etc.
* Updated build scripts for Visual Studio 2017 (Windows) and MacOS
Sierra (latest version of Xcode).
* Updated UNIX configure script to work with the clang 5+ and gcc 7+ * Updated UNIX configure script to work with the clang 5+ and gcc 7+
compiler versions. compiler versions, and fixed compile issues on aarch64 architectures.
-Have fun! -Have fun!

View File

@ -46,7 +46,7 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
buttonWidth = font.getStringWidth("Audit path") + 20, buttonWidth = font.getStringWidth("Audit path") + 20,
buttonHeight = font.getLineHeight() + 4, buttonHeight = font.getLineHeight() + 4,
lwidth = font.getStringWidth("ROMs without properties (skipped): "); lwidth = font.getStringWidth("ROMs without properties (skipped) ");
int xpos = vBorder, ypos = vBorder; int xpos = vBorder, ypos = vBorder;
WidgetArray wid; WidgetArray wid;
@ -68,17 +68,15 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
xpos = vBorder + 10; ypos += buttonHeight + 10; xpos = vBorder + 10; ypos += buttonHeight + 10;
new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight, new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
"ROMs with properties (renamed) ", kTextAlignLeft); "ROMs with properties (renamed) ", kTextAlignLeft);
myResults1 = new StaticTextWidget(this, font, xpos + lwidth, ypos, myResults1 = new EditTextWidget(this, font, xpos + lwidth, ypos - 2,
_w - lwidth - 20, fontHeight, "", _w - xpos - lwidth - 10, lineHeight, "");
kTextAlignLeft); myResults1->setEditable(false, true);
myResults1->setFlags(WIDGET_CLEARBG);
ypos += buttonHeight; ypos += buttonHeight;
new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight, new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
"ROMs without properties (skipped) ", kTextAlignLeft); "ROMs without properties (skipped) ", kTextAlignLeft);
myResults2 = new StaticTextWidget(this, font, xpos + lwidth, ypos, myResults2 = new EditTextWidget(this, font, xpos + lwidth, ypos - 2,
_w - lwidth - 20, fontHeight, "", _w - xpos - lwidth - 10, lineHeight, "");
kTextAlignLeft); myResults2->setEditable(false, true);
myResults2->setFlags(WIDGET_CLEARBG);
ypos += buttonHeight + 8; ypos += buttonHeight + 8;
new StaticTextWidget(this, font, xpos, ypos, _w - 20, fontHeight, new StaticTextWidget(this, font, xpos, ypos, _w - 20, fontHeight,
@ -102,16 +100,16 @@ void RomAuditDialog::loadConfig()
instance().settings().getString("romdir") : currentdir; instance().settings().getString("romdir") : currentdir;
myRomPath->setText(path); myRomPath->setText(path);
myResults1->setLabel(""); myResults1->setText("");
myResults2->setLabel(""); myResults2->setText("");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomAuditDialog::auditRoms() void RomAuditDialog::auditRoms()
{ {
const string& auditPath = myRomPath->getText(); const string& auditPath = myRomPath->getText();
myResults1->setLabel(""); myResults1->setText("");
myResults2->setLabel(""); myResults2->setText("");
FilesystemNode node(auditPath); FilesystemNode node(auditPath);
FSList files; FSList files;
@ -129,6 +127,7 @@ void RomAuditDialog::auditRoms()
int renamed = 0, notfound = 0; int renamed = 0, notfound = 0;
for(uInt32 idx = 0; idx < files.size(); idx++) for(uInt32 idx = 0; idx < files.size(); idx++)
{ {
bool renameSucceeded = false;
string extension; string extension;
if(files[idx].isFile() && if(files[idx].isFile() &&
LauncherFilterDialog::isValidRomName(files[idx], extension)) LauncherFilterDialog::isValidRomName(files[idx], extension))
@ -136,19 +135,22 @@ void RomAuditDialog::auditRoms()
// Calculate the MD5 so we can get the rest of the info // Calculate the MD5 so we can get the rest of the info
// from the PropertiesSet (stella.pro) // from the PropertiesSet (stella.pro)
const string& md5 = MD5::hash(files[idx]); const string& md5 = MD5::hash(files[idx]);
instance().propSet().getMD5(md5, props); if(instance().propSet().getMD5(md5, props))
const string& name = props.get(Cartridge_Name);
// Only rename the file if we found a valid properties entry
if(name != "" && name != files[idx].getName())
{ {
const string& newfile = node.getPath() + name + "." + extension; const string& name = props.get(Cartridge_Name);
if(files[idx].getPath() != newfile && files[idx].rename(newfile)) // Only rename the file if we found a valid properties entry
renamed++; if(name != "" && name != files[idx].getName())
{
const string& newfile = node.getPath() + name + "." + extension;
if(files[idx].getPath() != newfile && files[idx].rename(newfile))
renameSucceeded = true;
}
} }
if(renameSucceeded)
++renamed;
else else
notfound++; ++notfound;
} }
// Update the progress bar, indicating one more ROM has been processed // Update the progress bar, indicating one more ROM has been processed
@ -156,8 +158,8 @@ void RomAuditDialog::auditRoms()
} }
progress.close(); progress.close();
myResults1->setValue(renamed); myResults1->setText(Variant(renamed).toString());
myResults2->setValue(notfound); myResults2->setText(Variant(notfound).toString());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -198,8 +200,8 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
{ {
FilesystemNode dir(myBrowser->getResult()); FilesystemNode dir(myBrowser->getResult());
myRomPath->setText(dir.getShortPath()); myRomPath->setText(dir.getShortPath());
myResults1->setLabel(""); myResults1->setText("");
myResults2->setLabel(""); myResults2->setText("");
break; break;
} }

View File

@ -58,8 +58,8 @@ class RomAuditDialog : public Dialog
EditTextWidget* myRomPath; EditTextWidget* myRomPath;
// Show the results of the ROM audit // Show the results of the ROM audit
StaticTextWidget* myResults1; EditTextWidget* myResults1;
StaticTextWidget* myResults2; EditTextWidget* myResults2;
// Show a message about the dangers of using this function // Show a message about the dangers of using this function
unique_ptr<GUI::MessageBox> myConfirmMsg; unique_ptr<GUI::MessageBox> myConfirmMsg;