Finalized 'ROM audit' functionality. Still TODO is test in Windows and OSX.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1431 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-03-14 23:52:17 +00:00
parent ea4305760b
commit 7e0314a9c2
11 changed files with 66 additions and 58 deletions

View File

@ -85,7 +85,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "06742cf522f23797157f215a1dc8a1a9", "", "", "Healthbars (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "0685bd0bcb975ceef7041749a5454a48", "Piero Cavina", "", "11 Sprite Demo (Piero Cavina) (PD)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "06953ed762220dba63d63930d4ad0cc3", "", "", "Star Fire - Eckhard WIP (MP)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "069c17beb1e8e0557adb8539fdcf6cba", "", "", "Phantom II / Pirate (PAL60)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "PAL60", "", "", "", "", "" },
{ "069c17beb1e8e0557adb8539fdcf6cba", "", "", "Phantom II & Pirate (PAL60)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "PAL60", "", "", "", "", "" },
{ "06b6c5031b8353f3a424a5b86b8fe409", "Activision, Mike Lorenzen - Ariola", "EAX-023 - 711 023-720", "Oink! (1983) (Activision) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "250", "", "", "" },
{ "06cfd57f0559f38b9293adae9128ff88", "Telegames", "4317 A009", "Adventures on GX-12 (1989) (Telegames) (PAL)", "AKA Adventures of Tron", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "06db908011065e5ebb37f4e253c2a0b0", "", "", "Goufer (Unknown) (PAL)", "AKA Gopher", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -1572,7 +1572,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "8454ed9787c9d8211748ccddb673e920", "Froggo", "FG1002", "Spiderdroid (1987) (Froggo)", "AKA Amidar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8490e1014c2baa0d3a3a08854e5d68b3", "Xonox, Anthony R. Henderson", "99006, 6220", "Sir Lancelot (1983) (Xonox) [a2]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "84db818cd4111542a15c2a795369a256", "Starpath Corporation, Steve Mundry, Scott Nelson", "AR-4401", "Survival Island (1983) (Starpath) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "84df0704e6c777e1f9a16ec92ad80df0", "Gray Games & AtariAge", "", "E.T. Book Cart (PAL/60)", "Charles F. Gray & Michael Rideout", "", "", "", "", "", "", "", "", "", "", "PAL60", "15", "240", "YES", "55", "" },
{ "84df0704e6c777e1f9a16ec92ad80df0", "Gray Games & AtariAge", "", "E.T. Book Cart (PAL60)", "Charles F. Gray & Michael Rideout", "", "", "", "", "", "", "", "", "", "", "PAL60", "15", "240", "YES", "55", "" },
{ "84ea80e31b306059f56fdce2f07b758f", "", "", "Death Derby (19-01-2003) (TJ)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "850ffd5849c911946b24544ea1e60496", "", "", "Invasion (07-10-2002) (CT)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "851cc1f3c64eaedd10361ea26345acea", "Activision, David Crane", "AG-009, AG-009-04", "Freeway (1981) (Activision) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -2714,7 +2714,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "e932f44fad2a66b6d5faec9addec208e", "", "", "Atari Logo Demo 1 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e94632b0d863dd76459d689a9865bb33", "Jone Yuan Telephonic Enterprise Co", "", "Combat (Jone Yuan) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e957eb4612d6bd5940d3492dfa749668", "", "", "Tunnel Demo (27-03-2003) (CT)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e959b5a2c882ccaacb43c32790957c2d", "", "", "Phantom II / Pirate (NTSC)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e959b5a2c882ccaacb43c32790957c2d", "", "", "Phantom II & Pirate (NTSC)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e9be3e8e4a7e73dd63ed4235a3a1a25f", "", "", "MMetall (Hack)", "Hack of Miniature Golf", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e9c5d04643855949a23ff29349af74ea", "", "", "SCSIcide (Score Hack 2) (24-02-2001) (Joe Grand) (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e9c71f8cdba6037521c9a3c70819d171", "Action Hi Tech - Hi-Score", "", "Bank Heist (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FSNode.hxx,v 1.14 2008-03-14 19:34:56 stephena Exp $
// $Id: FSNode.hxx,v 1.15 2008-03-14 23:52:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -141,9 +141,9 @@ class AbstractFilesystemNode
static bool makeDir(const string& path);
/**
Rename the given file/directory with a new name.
Rename the given file with a new name.
*/
static bool rename(const string& oldpath, const string& newpath);
static bool renameFile(const string& oldfile, const string& newfile);
/* TODO:
bool isReadable();

View File

@ -486,7 +486,7 @@
""
"Cartridge.MD5" "069c17beb1e8e0557adb8539fdcf6cba"
"Cartridge.Name" "Phantom II / Pirate (PAL60)"
"Cartridge.Name" "Phantom II & Pirate (PAL60)"
"Cartridge.Rarity" "Homebrew"
"Display.Format" "PAL60"
""
@ -9342,7 +9342,7 @@
"Cartridge.MD5" "84df0704e6c777e1f9a16ec92ad80df0"
"Cartridge.Manufacturer" "Gray Games & AtariAge"
"Cartridge.Name" "E.T. Book Cart (PAL/60)"
"Cartridge.Name" "E.T. Book Cart (PAL60)"
"Cartridge.Note" "Charles F. Gray & Michael Rideout"
"Display.Format" "PAL60"
"Display.YStart" "15"
@ -16113,7 +16113,7 @@
""
"Cartridge.MD5" "e959b5a2c882ccaacb43c32790957c2d"
"Cartridge.Name" "Phantom II / Pirate (NTSC)"
"Cartridge.Name" "Phantom II & Pirate (NTSC)"
"Cartridge.Rarity" "Homebrew"
""

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FSNodeGP2X.cxx,v 1.7 2008-03-14 19:34:56 stephena Exp $
// $Id: FSNodeGP2X.cxx,v 1.8 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -229,9 +229,8 @@ bool AbstractFilesystemNode::makeDir(const string& path)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::rename(const string& oldpath,
const string& newpath)
bool AbstractFilesystemNode::renameFile(const string& oldfile,
const string& newfile)
{
// TODO - implement this
return false;
return rename(oldfile.c_str(), newfile.c_str()) == 0;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: LauncherDialog.cxx,v 1.80 2008-03-14 19:34:56 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.81 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -278,10 +278,11 @@ void LauncherDialog::loadRomInfo()
{
if(!(myRomInfoFlag && myRomInfoWidget)) return;
int item = myList->getSelected();
if(item < 0 || myGameList->isDir(item)) return;
if(item < 0) return;
string extension;
if(instance()->isValidRomName(myGameList->name(item), extension))
if(!myGameList->isDir(item) &&
instance()->isValidRomName(myGameList->name(item), extension))
{
// Make sure we have a valid md5 for this ROM
if(myGameList->md5(item) == "")

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OptionsDialog.cxx,v 1.66 2008-03-14 15:23:23 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.67 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -135,7 +135,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
boss, x, y, w, h);
w = 280; h = 120;
w = 240; h = 115;
myRomAuditDialog = new RomAuditDialog(myOSystem, parent, font, x, y, w, h);
w = 255; h = 190;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ProgressDialog.cxx,v 1.11 2008-02-06 13:45:24 stephena Exp $
// $Id: ProgressDialog.cxx,v 1.12 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -56,10 +56,8 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
xpos = fontWidth; ypos += 2 * lineHeight;
mySlider = new SliderWidget(this, font, xpos, ypos, lwidth, lineHeight, "", 0, 0);
mySlider->setMinValue(100);
mySlider->setMaxValue(200);
mySlider->setValue(100); // Prevents the slider from initially drawing
// across the entire screen for a split-second
mySlider->setMinValue(1);
mySlider->setMaxValue(100);
parent()->addDialog(this);
instance()->frameBuffer().update();
@ -87,20 +85,19 @@ void ProgressDialog::setRange(int start, int finish, int step)
{
myStart = start;
myFinish = finish;
myStep = step;
myCurrentStep = 100;
myStep = (int)((step / 100.0) * (myFinish - myStart + 1));
mySlider->setMinValue(myStart);
mySlider->setMaxValue(myFinish);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ProgressDialog::setProgress(int progress)
{
// Only increase the progress bar if we have arrived at a new step
// IE, we only increase in intervals specified by setRange()
int p = (int) (((double)progress / myFinish) * 100 + 100);
if(p >= myCurrentStep)
if(progress - mySlider->getValue() > myStep)
{
myCurrentStep += myStep;
mySlider->setValue(p);
mySlider->setValue(progress);
instance()->frameBuffer().update();
}
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RomAuditDialog.cxx,v 1.2 2008-03-14 19:34:56 stephena Exp $
// $Id: RomAuditDialog.cxx,v 1.3 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -42,7 +42,8 @@ RomAuditDialog::RomAuditDialog(OSystem* osystem, DialogContainer* parent,
const int vBorder = 8;
const int bwidth = font.getStringWidth("Audit path:") + 20,
bheight = font.getLineHeight() + 4,
fontHeight = font.getLineHeight();
fontHeight = font.getLineHeight(),
lwidth = font.getStringWidth("ROMs with properties (renamed): ");
int xpos = vBorder, ypos = vBorder;
WidgetArray wid;
ButtonWidget* b;
@ -58,15 +59,25 @@ RomAuditDialog::RomAuditDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myRomPath);
// Show results of ROM audit
xpos = 10; ypos += bheight;
myResults1 = new StaticTextWidget(this, font, xpos, ypos, _w - 20, fontHeight,
"", kTextAlignLeft);
xpos = vBorder + 10; ypos += bheight + 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);
ypos += bheight;
myResults2 = new StaticTextWidget(this, font, xpos, ypos, _w - 20, fontHeight,
"", kTextAlignLeft);
new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
"ROMs without properties: ", kTextAlignLeft);
myResults2 = new StaticTextWidget(this, font, xpos + lwidth, ypos,
_w - lwidth - 20, fontHeight, "",
kTextAlignLeft);
myResults2->setFlags(WIDGET_CLEARBG);
ypos += bheight + 8;
new StaticTextWidget(this, font, xpos, ypos, _w - 20, fontHeight,
"(*) Warning: this operation cannot be undone",
kTextAlignLeft);
// Add OK & Cancel buttons
#ifndef MAC_OSX
@ -101,12 +112,16 @@ RomAuditDialog::~RomAuditDialog()
void RomAuditDialog::loadConfig()
{
myRomPath->setEditString(instance()->settings().getString("romdir"));
myResults1->setLabel("");
myResults2->setLabel("");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomAuditDialog::auditRoms()
{
const string& auditPath = myRomPath->getEditString();
myResults1->setLabel("");
myResults2->setLabel("");
FilesystemNode node(auditPath);
FSList files = node.listDir(FilesystemNode::kListFilesOnly);
@ -115,7 +130,7 @@ void RomAuditDialog::auditRoms()
// the ROMs, since this is usually a time-consuming operation
ProgressDialog progress(this, instance()->launcherFont(),
"Auditing ROM files ...");
progress.setRange(0, files.size() - 1, 10);
progress.setRange(0, files.size() - 1, 5);
// Create a entry for the GameList for each file
Properties props;
@ -133,11 +148,11 @@ void RomAuditDialog::auditRoms()
const string& name = props.get(Cartridge_Name);
// Only rename the file if we found a valid properties entry
if(name != "" && name != files[idx].path())
if(name != "" && name != files[idx].displayName())
{
const string& newfile =
auditPath + BSPF_PATH_SEPARATOR + name + "." + extension;
if(FilesystemNode::rename(files[idx].path(), newfile))
if(FilesystemNode::renameFile(files[idx].path(), newfile))
renamed++;
}
else
@ -149,9 +164,8 @@ void RomAuditDialog::auditRoms()
}
progress.done();
cerr << "scanned files: " << (files.size() - 1) << endl;
cerr << "renamed files: " << renamed << endl;
cerr << "files without properties: " << notfound << endl;
myResults1->setValue(renamed);
myResults2->setValue(notfound);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -184,6 +198,8 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
{
FilesystemNode dir(myBrowser->getResult());
myRomPath->setEditString(dir.path());
myResults1->setLabel("");
myResults2->setLabel("");
break;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RomInfoWidget.cxx,v 1.5 2008-03-13 22:58:07 stephena Exp $
// $Id: RomInfoWidget.cxx,v 1.6 2008-03-14 23:52:17 stephena Exp $
//============================================================================
#include <cstring>
@ -176,7 +176,6 @@ void RomInfoWidget::parseProperties()
in.close();
mySurfaceErrorMsg = msg;
return;
}
}
else

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FSNodePOSIX.cxx,v 1.13 2008-03-14 19:34:56 stephena Exp $
// $Id: FSNodePOSIX.cxx,v 1.14 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -233,10 +233,8 @@ bool AbstractFilesystemNode::makeDir(const string& path)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::rename(const string& oldpath,
const string& newpath)
bool AbstractFilesystemNode::renameFile(const string& oldfile,
const string& newfile)
{
cerr << "rename: " << oldpath << " -> " << newpath << endl;
// TODO - implement this
return true;
return rename(oldfile.c_str(), newfile.c_str()) == 0;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FSNodeWin32.cxx,v 1.13 2008-03-14 19:34:56 stephena Exp $
// $Id: FSNodeWin32.cxx,v 1.14 2008-03-14 23:52:17 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -282,10 +282,8 @@ bool AbstractFilesystemNode::makeDir(const string& path)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::rename(const string& oldpath,
const string& newpath)
bool AbstractFilesystemNode::renameFile(const string& oldfile,
const string& newfile)
{
cerr << "rename: " << oldpath << " -> " << newpath << endl;
// TODO - implement this
return false;
return MoveFile(oldfile.c_str(), newfile.c_str()) != 0;
}