mirror of https://github.com/stella-emu/stella.git
Updated several tools to automatically perform the work that I've been doing
manually up to this point: - 'rom_diff.pl' command inspects two directories and looks at differences in filenames, and copies ROMs into 3 new directories (ADDED, REMOVED, and CHANGED). This is most useful for when RomHunter releases new romsets. - 'merge_props.pl' command merges all properties from a source file that also exist in a destination file. This is useful when I do a mass-edit of many ROMs, with the info being saved into my personal stella.pro file. Running this command afterwards will 'merge' them into the master stella.pro file, and then Stella can be recompiled with the new properties. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2379 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
716dd485cb
commit
da9cfd8109
|
@ -1936,7 +1936,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
|
||||||
{ "947317a89af38a49c4864d6bdd6a91fb", "CBS Electronics, Bob Curtiss", "4L 2487 5000", "Solar Fox (1983) (CBS Electronics)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
{ "947317a89af38a49c4864d6bdd6a91fb", "CBS Electronics, Bob Curtiss", "4L 2487 5000", "Solar Fox (1983) (CBS Electronics)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||||
{ "94b92a882f6dbaa6993a46e2dcc58402", "Activision, Larry Miller", "AX-026, AX-026-04", "Enduro (1983) (Activision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
{ "94b92a882f6dbaa6993a46e2dcc58402", "Activision, Larry Miller", "AX-026, AX-026-04", "Enduro (1983) (Activision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||||
{ "94d90f63678e086f6b6d5e1bc6c4c8c2", "Digivision", "", "Seaquest (Digivision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
{ "94d90f63678e086f6b6d5e1bc6c4c8c2", "Digivision", "", "Seaquest (Digivision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||||
{ "94e3fbc19107a169909e274187247a9d", "", "2402-044-01", "Freeway (Unknown)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
{ "94e3fbc19107a169909e274187247a9d", "", "2402-044-01", "2-in-1 Freeway and Tennis (Unknown)", "", "", "", "2IN1", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||||
{ "94e4c9b924286038527f49cdc20fda69", "Retroactive", "", "Qb (V2.12) (Stella) (2001) (Retroactive)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
|
{ "94e4c9b924286038527f49cdc20fda69", "Retroactive", "", "Qb (V2.12) (Stella) (2001) (Retroactive)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
|
||||||
{ "94e7cc6342d11e508e7e8b2ddf53c255", "", "", "Missile Command (208 in 1) (Unknown) (PAL) (Hack)", "", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
{ "94e7cc6342d11e508e7e8b2ddf53c255", "", "", "Missile Command (208 in 1) (Unknown) (PAL) (Hack)", "", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||||
{ "94ff6b7489ed401dcaaf952fece10f67", "Atari - GCC, Mark Ackerman, Noellie Alito", "CX2692", "Moon Patrol (07-31-1983) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
{ "94ff6b7489ed401dcaaf952fece10f67", "Atari - GCC, Mark Ackerman, Noellie Alito", "CX2692", "Moon Patrol (07-31-1983) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||||
|
|
37366
src/emucore/stella.pro
37366
src/emucore/stella.pro
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,7 @@
|
||||||
package PropSet;
|
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 = (
|
my %prop_type = (
|
||||||
"Cartridge.MD5" => 0,
|
"Cartridge.MD5" => 0,
|
||||||
"Cartridge.Manufacturer" => 1,
|
"Cartridge.Manufacturer" => 1,
|
||||||
|
@ -23,6 +25,29 @@ my %prop_type = (
|
||||||
"Display.Phosphor" => 19,
|
"Display.Phosphor" => 19,
|
||||||
"Display.PPBlend" => 20
|
"Display.PPBlend" => 20
|
||||||
);
|
);
|
||||||
|
my @prop_type_as_string = (
|
||||||
|
"Cartridge.MD5",
|
||||||
|
"Cartridge.Manufacturer",
|
||||||
|
"Cartridge.ModelNo",
|
||||||
|
"Cartridge.Name",
|
||||||
|
"Cartridge.Note",
|
||||||
|
"Cartridge.Rarity",
|
||||||
|
"Cartridge.Sound",
|
||||||
|
"Cartridge.Type",
|
||||||
|
"Console.LeftDifficulty",
|
||||||
|
"Console.RightDifficulty",
|
||||||
|
"Console.TelevisionType",
|
||||||
|
"Console.SwapPorts",
|
||||||
|
"Controller.Left",
|
||||||
|
"Controller.Right",
|
||||||
|
"Controller.SwapPaddles",
|
||||||
|
"Controller.MouseAxis",
|
||||||
|
"Display.Format",
|
||||||
|
"Display.YStart",
|
||||||
|
"Display.Height",
|
||||||
|
"Display.Phosphor",
|
||||||
|
"Display.PPBlend"
|
||||||
|
);
|
||||||
|
|
||||||
my @prop_defaults = (
|
my @prop_defaults = (
|
||||||
"",
|
"",
|
||||||
|
@ -93,6 +118,26 @@ sub load_prop_set($) {
|
||||||
return %propset;
|
return %propset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Load and parse a properties file into an hash table of property
|
||||||
|
# objects, indexed by md5sum
|
||||||
|
sub save_prop_set {
|
||||||
|
my $file = shift;
|
||||||
|
my $hashref = shift;
|
||||||
|
print "Saving " . keys(%$hashref) . " properties to file: $file\n";
|
||||||
|
|
||||||
|
open(OUTFILE, ">$file");
|
||||||
|
while (($md5, $props) = each(%$hashref)) {
|
||||||
|
my @array = @$props;
|
||||||
|
for (my $i = 0; $i < @array; $i++) {
|
||||||
|
if ($array[$i] ne "") {
|
||||||
|
print OUTFILE "\"$prop_type_as_string[$i]\" \"$array[$i]\"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print OUTFILE "\"\"\n\n";
|
||||||
|
}
|
||||||
|
close(OUTFILE);
|
||||||
|
}
|
||||||
|
|
||||||
# Get the number of property tags in one PropSet element
|
# Get the number of property tags in one PropSet element
|
||||||
sub num_prop_types {
|
sub num_prop_types {
|
||||||
return keys( %prop_type );
|
return keys( %prop_type );
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Locate the 'PropSet' module
|
||||||
|
use FindBin;
|
||||||
|
use lib "$FindBin::Bin";
|
||||||
use PropSet;
|
use PropSet;
|
||||||
|
|
||||||
usage() if @ARGV != 2;
|
usage() if @ARGV != 2;
|
||||||
|
@ -65,6 +68,8 @@ close(OUTFILE);
|
||||||
|
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print "create_props.pl <INPUT STELLA PROPS> <OUTPUT C++ header>\n";
|
print "create_props.pl <INPUT properties file> <OUTPUT C++ header>\n";
|
||||||
|
print "\n";
|
||||||
|
print "Convert the given properties file into a C++ compatible header file.\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Locate the 'PropSet' module
|
||||||
|
use FindBin;
|
||||||
|
use lib "$FindBin::Bin";
|
||||||
|
use PropSet;
|
||||||
|
|
||||||
|
usage() if @ARGV != 2;
|
||||||
|
|
||||||
|
my %usr_propset = PropSet::load_prop_set($ARGV[0]);
|
||||||
|
my %sys_propset = PropSet::load_prop_set($ARGV[1]);
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print "Valid properties found in user file: " . keys (%usr_propset) . "\n";
|
||||||
|
print "Valid properties found in system file: " . keys (%sys_propset) . "\n";
|
||||||
|
|
||||||
|
# Determine which properties exist in both files
|
||||||
|
for my $key ( keys %usr_propset ) {
|
||||||
|
if (defined $sys_propset{$key}) {
|
||||||
|
$sys_propset{$key} = $usr_propset{$key};
|
||||||
|
delete $usr_propset{$key};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print "Updated properties found in user file: " . keys (%usr_propset) . "\n";
|
||||||
|
print "Updated properties found in system file: " . keys (%sys_propset) . "\n";
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
# Write both files back to disk
|
||||||
|
PropSet::save_prop_set($ARGV[0], \%usr_propset);
|
||||||
|
PropSet::save_prop_set($ARGV[1], \%sys_propset);
|
||||||
|
|
||||||
|
|
||||||
|
sub usage {
|
||||||
|
print "merge_props.pl <USER properties file> <SYSTEM properties file>\n";
|
||||||
|
print "\n";
|
||||||
|
print "Scan both properties files, and for every entry found in both files,\n";
|
||||||
|
print "remove it from the USER file and overwrite it in the SYSTEM file.\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
usage() if @ARGV != 2;
|
||||||
|
|
||||||
|
# Generate md5sums for source and destination directories
|
||||||
|
my @src_files = `md5sum $ARGV[0]/*`;
|
||||||
|
my @dest_files = `md5sum $ARGV[1]/*`;
|
||||||
|
|
||||||
|
# Build hash for source ROMs
|
||||||
|
my %src_md5 = ();
|
||||||
|
foreach $file (@src_files) {
|
||||||
|
chomp $file;
|
||||||
|
($md5, $name) = split(" ", $file);
|
||||||
|
$src_md5{ $md5 } = $name;
|
||||||
|
}
|
||||||
|
print "Found " . keys( %src_md5 ) . " ROMs in " . $ARGV[0] . "\n";
|
||||||
|
|
||||||
|
# Build hash for destination ROMs
|
||||||
|
my %dest_md5 = ();
|
||||||
|
foreach $file (@dest_files) {
|
||||||
|
chomp $file;
|
||||||
|
($md5, $name) = split(" ", $file);
|
||||||
|
$dest_md5{ $md5 } = $name;
|
||||||
|
}
|
||||||
|
print "Found " . keys( %dest_md5 ) . " ROMs in " . $ARGV[1] . "\n";
|
||||||
|
|
||||||
|
my @added = (), @removed = (), @changed = ();
|
||||||
|
|
||||||
|
# Check for added ROMs
|
||||||
|
for my $key ( keys %dest_md5 ) {
|
||||||
|
if (defined $src_md5{$key}) {
|
||||||
|
($src_rom,$path,$type) = fileparse($src_md5{$key});
|
||||||
|
($dest_rom,$path,$type) = fileparse($dest_md5{$key});
|
||||||
|
if($src_rom ne $dest_rom) {
|
||||||
|
push(@changed, $dest_md5{$key});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
push(@added, $dest_md5{$key});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for removed ROMs
|
||||||
|
for my $key ( keys %src_md5 ) {
|
||||||
|
if (!defined $dest_md5{$key}) {
|
||||||
|
push(@removed, $src_md5{$key});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Report our findings, create directories and copy files
|
||||||
|
print "\n";
|
||||||
|
my $numAdded = @added;
|
||||||
|
print "Added ROMs: $numAdded\n";
|
||||||
|
if ($numAdded > 0) {
|
||||||
|
system("mkdir -p ADDED");
|
||||||
|
foreach $rom (@added) {
|
||||||
|
system("cp \"$rom\" ADDED/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $numRemoved = @removed;
|
||||||
|
print "Removed ROMs: $numRemoved\n";
|
||||||
|
if ($numRemoved > 0) {
|
||||||
|
system("mkdir -p REMOVED");
|
||||||
|
foreach $rom (@removed) {
|
||||||
|
system("cp \"$rom\" REMOVED/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $numChanged = @changed;
|
||||||
|
print "Changed ROMs: $numChanged\n";
|
||||||
|
if ($numChanged > 0) {
|
||||||
|
system("mkdir -p CHANGED");
|
||||||
|
foreach $rom (@changed) {
|
||||||
|
system("cp \"$rom\" CHANGED/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub usage {
|
||||||
|
print "rom_diff.pl <source directory> <destination directory>\n";
|
||||||
|
print "\n";
|
||||||
|
print "Analyze the ROMs in both directories by md5sum and name.\n";
|
||||||
|
print "Three directories are created named 'ADDED', 'REMOVED' and 'CHANGED',\n";
|
||||||
|
print "indicating the differences in ROMs from the source and destination\n";
|
||||||
|
print "directories. ROMs are then copied into these new directories as specified.\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
Loading…
Reference in New Issue