Fixes to RomAuditDialog for recent surface changes. Also, if a ROM

already has the correct name, we no longer rename it anyway (renaming
a correctly-named ROM was updating a counter that should only show
ROMs that *really* had to be renamed).

First pass at integrating RomHunters V4 romset database into internal
properties.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1586 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-12-31 01:33:03 +00:00
parent 8ba2482f50
commit 051969e56a
7 changed files with 998 additions and 990 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: LauncherDialog.cxx,v 1.91 2008-12-30 02:34:49 stephena Exp $ // $Id: LauncherDialog.cxx,v 1.92 2008-12-31 01:33:03 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -51,7 +51,6 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myQuitButton(NULL), myQuitButton(NULL),
myList(NULL), myList(NULL),
myGameList(NULL), myGameList(NULL),
myProgressBar(NULL),
myRomInfoWidget(NULL), myRomInfoWidget(NULL),
mySelectedItem(0) mySelectedItem(0)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: LauncherDialog.hxx,v 1.36 2008-12-29 20:42:15 stephena Exp $ // $Id: LauncherDialog.hxx,v 1.37 2008-12-31 01:33:03 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -30,7 +30,6 @@ class DialogContainer;
class GameList; class GameList;
class OptionsDialog; class OptionsDialog;
class OSystem; class OSystem;
class ProgressDialog;
class Properties; class Properties;
class RomInfoWidget; class RomInfoWidget;
class StaticTextWidget; class StaticTextWidget;
@ -81,8 +80,6 @@ class LauncherDialog : public Dialog
GameList* myGameList; GameList* myGameList;
OptionsDialog* myOptions; OptionsDialog* myOptions;
ProgressDialog* myProgressBar;
RomInfoWidget* myRomInfoWidget; RomInfoWidget* myRomInfoWidget;
private: private:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ProgressDialog.cxx,v 1.13 2008-06-13 13:14:51 stephena Exp $ // $Id: ProgressDialog.cxx,v 1.14 2008-12-31 01:33:03 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -46,8 +46,6 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
lwidth = font.getStringWidth(message); lwidth = font.getStringWidth(message);
_w = lwidth + 2 * fontWidth; _w = lwidth + 2 * fontWidth;
_h = lineHeight * 5; _h = lineHeight * 5;
_x = (boss->getWidth() - _w) / 2;
_y = (boss->getHeight() - _h) / 2;
xpos = fontWidth; ypos = lineHeight; xpos = fontWidth; ypos = lineHeight;
myMessage = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight, myMessage = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
@ -60,7 +58,6 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
mySlider->setMaxValue(100); mySlider->setMaxValue(100);
parent().addDialog(this); parent().addDialog(this);
instance().frameBuffer().update();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -68,12 +65,6 @@ ProgressDialog::~ProgressDialog()
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ProgressDialog::done()
{
parent().removeDialog();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ProgressDialog::setMessage(const string& message) void ProgressDialog::setMessage(const string& message)
{ {
@ -98,6 +89,12 @@ void ProgressDialog::setProgress(int progress)
if(progress - mySlider->getValue() > myStep) if(progress - mySlider->getValue() > myStep)
{ {
mySlider->setValue(progress); mySlider->setValue(progress);
// Since this dialog is usually called in a tight loop that doesn't
// yield, we need to manually tell the framebuffer that a redraw is
// necessary
// This isn't really an ideal solution, since all redrawing and
// event handling is suspended until the dialog is closed
instance().frameBuffer().update(); instance().frameBuffer().update();
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ProgressDialog.hxx,v 1.5 2008-02-06 13:45:24 stephena Exp $ // $Id: ProgressDialog.hxx,v 1.6 2008-12-31 01:33:03 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -38,7 +38,6 @@ class ProgressDialog : public Dialog
void setMessage(const string& message); void setMessage(const string& message);
void setRange(int begin, int end, int step); void setRange(int begin, int end, int step);
void setProgress(int progress); void setProgress(int progress);
void done();
protected: protected:
StaticTextWidget* myMessage; StaticTextWidget* myMessage;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: RomAuditDialog.cxx,v 1.6 2008-12-25 23:05:16 stephena Exp $ // $Id: RomAuditDialog.cxx,v 1.7 2008-12-31 01:33:03 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -113,7 +113,7 @@ void RomAuditDialog::auditRoms()
// Create a progress dialog box to show the progress of processing // Create a progress dialog box to show the progress of processing
// the ROMs, since this is usually a time-consuming operation // the ROMs, since this is usually a time-consuming operation
ProgressDialog progress(this, instance().launcherFont(), ProgressDialog progress(this, instance().font(),
"Auditing ROM files ..."); "Auditing ROM files ...");
progress.setRange(0, files.size() - 1, 5); progress.setRange(0, files.size() - 1, 5);
@ -135,8 +135,13 @@ void RomAuditDialog::auditRoms()
// Only rename the file if we found a valid properties entry // Only rename the file if we found a valid properties entry
if(name != "" && name != files[idx].displayName()) if(name != "" && name != files[idx].displayName())
{ {
const string& newfile = // Check for terminating separator
auditPath + BSPF_PATH_SEPARATOR + name + "." + extension; string newfile = auditPath;
if(newfile.find_last_of(BSPF_PATH_SEPARATOR) != newfile.length()-1)
newfile += BSPF_PATH_SEPARATOR;
newfile += name + "." + extension;
if(files[idx].path() != newfile)
if(FilesystemNode::renameFile(files[idx].path(), newfile)) if(FilesystemNode::renameFile(files[idx].path(), newfile))
renamed++; renamed++;
} }
@ -147,7 +152,7 @@ void RomAuditDialog::auditRoms()
// Update the progress bar, indicating one more ROM has been processed // Update the progress bar, indicating one more ROM has been processed
progress.setProgress(idx); progress.setProgress(idx);
} }
progress.done(); progress.close();
myResults1->setValue(renamed); myResults1->setValue(renamed);
myResults2->setValue(notfound); myResults2->setValue(notfound);