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
- The previous trap'm' commands are now renamed 'trap', 'trapread'
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
(basically, anything starting with the '_' character)
- 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
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.
* 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.
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+
compiler versions.
compiler versions, and fixed compile issues on aarch64 architectures.
-Have fun!

View File

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

View File

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