From d3acae2ed78698141b7fac8bf8a835242c184dd7 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 28 Jul 2016 11:02:20 -0700 Subject: [PATCH] Cleanup This is a bulk cleanup of all of the functions that have since been surpassed by their desktop counterparts. A lot of effort went into these original features but the effort that was expended to make the desktop better far exceeded this. I thank the efforts of everyone who helped to make the web version a reality in the first place since it provided the strong base that SabreTools has become. This will still be maintained purely as a way of checking files online as will be required when the WoD DATs are properly recreated. --- admin/clean.php | 124 ---- admin/deheader.php | 144 ----- admin/edit.php | 874 --------------------------- admin/import.php | 564 ------------------ admin/index.php | 7 - admin/parenting.php | 5 - admin/parenting/add_parent_db.php | 24 - admin/parenting/index.php | 115 ---- admin/parenting/list_parents.php | 98 --- admin/parenting/list_sets.php | 131 ---- admin/parenting/rem_parent_db.php | 3 - admin/parenting/set_parent.php | 25 - admin/reset.php | 43 -- headers/a7800.xml | 17 - headers/fds.xml | 25 - headers/lynx.xml | 17 - headers/mega.xml | 87 --- headers/n64.xml | 24 - headers/nes.xml | 13 - headers/snes.xml | 24 - includes/functions.php | 153 ----- includes/remapping.php | 956 ------------------------------ index.php | 9 - pages/generate.php | 723 ---------------------- pages/view.php | 279 --------- sites/CPC-Power.php | 8 +- 26 files changed, 5 insertions(+), 4487 deletions(-) delete mode 100644 admin/clean.php delete mode 100644 admin/deheader.php delete mode 100644 admin/edit.php delete mode 100644 admin/import.php delete mode 100644 admin/parenting.php delete mode 100644 admin/parenting/add_parent_db.php delete mode 100644 admin/parenting/index.php delete mode 100644 admin/parenting/list_parents.php delete mode 100644 admin/parenting/list_sets.php delete mode 100644 admin/parenting/rem_parent_db.php delete mode 100644 admin/parenting/set_parent.php delete mode 100644 admin/reset.php delete mode 100644 headers/a7800.xml delete mode 100644 headers/fds.xml delete mode 100644 headers/lynx.xml delete mode 100644 headers/mega.xml delete mode 100644 headers/n64.xml delete mode 100644 headers/nes.xml delete mode 100644 headers/snes.xml delete mode 100644 includes/remapping.php delete mode 100644 pages/generate.php delete mode 100644 pages/view.php diff --git a/admin/clean.php b/admin/clean.php deleted file mode 100644 index 9d453a3..0000000 --- a/admin/clean.php +++ /dev/null @@ -1,124 +0,0 @@ -\n"; -} -else -{ - echo "Deleting game dupes failed!
\n".mysqli_error($link); -} - -// Delete dupes from files -$query = "DELETE files - FROM files LEFT OUTER JOIN ( - SELECT MIN(id) as id, setid, name, type, lastupdated - FROM files - GROUP BY setid, name, type, lastupdated - ) as KeepRows ON - files.id = KeepRows.id - WHERE KeepRows.id IS NULL"; -if (gettype($result) == "boolean" && $result) -{ - echo "Deleting file dupes succeeded!
\n"; -} -else -{ - echo "Deleting file dupes failed!
\n".mysqli_error($link); -} - -// Delete orphaned files -$query = "DELETE FROM files - WHERE NOT EXISTS ( - SELECT * - FROM games - WHERE files.setid = games.id)"; -$result = mysqli_query($link, $query); -if (gettype($result) == "boolean" && $result) -{ - echo "Deleting file orphans succeeded!
\n"; -} -else -{ - echo "Deleting file orphans failed!
\n".mysqli_error($link); -} - -// Delete orphaned checksums -$query = "DELETE FROM checksums - WHERE NOT EXISTS ( - SELECT * - FROM files - WHERE checksums.file = files.id)"; -$result = mysqli_query($link, $query); -if (gettype($result) == "boolean" && $result) -{ - echo "Deleting checksum orphans succeeded!
\n"; -} -else -{ - echo "Deleting checksum orphans failed!
\n".mysqli_error($link); -} - -// Fix the names of games that have spacing issues -$query = "SELECT * FROM games - WHERE name LIKE ' %' - ORDER BY name ASC"; -$result = mysqli_query($link, $query); - -while ($line = mysqli_fetch_assoc($result)) -{ - $query = "UPDATE games - SET name='".trim($line["name"])."' - WHERE id=".$line["id"]; - $result2 = mysqli_query($link, $query); - if (gettype($result2) == "boolean" && $result2) - { - echo "Trimming game names succeeded!
\n"; - } - else - { - echo "Trimming game names failed!
\n".mysqli_error($link); - } -} - -// Fix the names of files that have spacing issues -$query = "SELECT * FROM files - WHERE name LIKE ' %' - ORDER BY name ASC"; -$result = mysqli_query($link, $query); - -while ($line = mysqli_fetch_assoc($result)) -{ - $query = "UPDATE files - SET name='".trim($line["name"])."' - WHERE id=".$line["id"]; - $result2 = mysqli_query($link, $query); - if (gettype($result2) == "boolean" && $result2) - { - echo "Trimming file names succeeded!
\n"; - } - else - { - echo "Trimming file names failed!
\n".mysqli_error($link); - } -} - -?> \ No newline at end of file diff --git a/admin/deheader.php b/admin/deheader.php deleted file mode 100644 index 9035b02..0000000 --- a/admin/deheader.php +++ /dev/null @@ -1,144 +0,0 @@ - 128, - "fds" => 16, - "lynx" => 64, - "nes" => 16, - "snes" => 512, -); - -$dir = (isset($_GET["dir"]) ? urldecode($_GET["dir"]) : ""); -$type = (isset($_GET["type"]) ? $_GET["type"] : ""); - -echo "

Remove File Headers

"; - -// If the directory isn't set or it's not a directory, prompt the user to enter a directory and set which type it is -if (trim($dir) == "" || !is_dir($dir)) -{ - echo << - - Enter a directory name:

- Select rom type:
-EOL; - - foreach ($types as $typename => $val) - { - echo "\t".$typename."
\n"; - } - - echo << -
-

-EOL; -} - -// If a directory is given but the type isn't defined or it's incorrect, give the options for file type -elseif (trim($type) == "" || !$types[$type] === "") -{ - echo << - - - Select rom type:
-EOL; - - foreach ($types as $typename => $val) - { - echo "\t".$typename."
\n"; - } - - echo << -
-

-EOL; -} - -// Otherwise, process the folder -else -{ - $dir = $dir."/"; - $roms = scandir($dir); - echo "\n\n"; - foreach ($roms as $rom) - { - if ($rom == "." || $rom == ".." || is_dir($dir.$rom)) - { - continue; - } - - $hs = $types[$type]; - - $handle = fopen($dir.$rom, "r"); - $header = fread($handle, $hs); - $header = bin2hex($header); - $header = strtoupper($header); - - switch ($type) - { - case "a7800": - $a7800a = preg_match("/^.415441524937383030/", $header); - $a7800b = preg_match("/^.{64}41435455414C20434152542044415441205354415254532048455245/", $header); - - $has_header = ($a7800a == 1 || $a7800b == 1); - break; - case "fds": - $fdsa = preg_match("/^4644531A010000000000000000000000/", $header); - $fdsb = preg_match("/^4644531A020000000000000000000000/", $header); - $fdsc = preg_match("/^4644531A030000000000000000000000/", $header); - $fdsd = preg_match("/^4644531A040000000000000000000000/", $header); - - $has_header = ($fdsa == 1 || $fdsb == 1 || $fdsc == 1 || $fdsd == 1); - break; - case "lynx": - $lynxa = preg_match("/^4C594E58/", $header); - $lynxb = preg_match("/^425339/", $header); - - $has_header = ($lynxa == 1 || $lynxb == 1); - break; - case "nes": - $nes = preg_match("/^4E45531A/", $header); - - $has_header = ($nes == 1); - break; - case "snes": - $fig = preg_match("/^.{16}0000000000000000/", $header); - $smc = preg_match("/^.{16}AABB040000000000/", $header); - $ufo = preg_match("/^.{16}535550455255464F/", $header); - - $has_header = ($fig == 1 || $smc == 1 || $ufo == 1); - break; - default: - $has_header = false; - break; - } - - echo "\n"; - - if ($has_header) - { - $data = fread($handle, filesize($dir.$rom) - 512); - $outhandle = fopen($dir.$rom.".new", "w"); - fwrite($outhandle, $data); - fclose($outhandle); - } - - fclose($handle); - } - echo "
NameHas Header
".$rom."".($has_header ? "true" : "false")."
\n"; -} - -?> \ No newline at end of file diff --git a/admin/edit.php b/admin/edit.php deleted file mode 100644 index 822194e..0000000 --- a/admin/edit.php +++ /dev/null @@ -1,874 +0,0 @@ -"; - - $query = "UPDATE games SET system=0 WHERE system=".$system; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "Files altered successfully! No further action required.
"; - } - else - { - echo "Something has gone wrong, please manually alter all files with system '".$system."' to have value 0
"; - } - } - else - { - echo "System could not be deleted. Try again later.
"; - } - } - // If a source is being removed (can't remove default) - elseif ($remove == "source" && $source != "" && $source != "0") - { - $query = "DELETE FROM source where id=".$system; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "Source deleted successfully! Altering all related files.
"; - - $query = "UPDATE games SET source=0 WHERE source=".$source; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "Files altered successfully! No further action required.
"; - } - else - { - echo "Something has gone wrong, please manually alter all files with source '".$source."' to have value 0
"; - } - } - else - { - echo "System could not be deleted. Try again later.
"; - } - } - // If a game is being removed - elseif ($remove == "game" && $game != "") - { - $query = "DELETE FROM games - JOIN files - ON games.id=files.setid - JOIN checksums - ON files.id=checksums.file - WHERE games.id=".$game; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "Game and dependent files deleted successfully!
"; - } - else - { - echo "Could not delete game or dependent files. Please try again
";; - } - } - // If a file is being removed - elseif ($remove == "file" && $file != "") - { - $query = "DELETE FROM files - JOIN checksums - ON files.id=checksums.file - WHERE files.id=".$file; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "File deleted successfully!
"; - } - else - { - echo "Could not delete file. Please try again
";; - } - } -} -// Handle the POST cases. They do not have to be mutually exclusive -else -{ - // If a system is being edited or added via POST - if ($system != "" && $manufacturer != "" && $systemname != "") - { - // If the system is new and being added - if ($system == "-1") - { - // Always check if this exact combination is already there. This might have been in error - $query = "SELECT * FROM systems WHERE manufacturer='".$manufacturer." AND system='".$systemname."'"; - $result = mysqli_query($link, $query); - - // If we find this system, tell the user and don't move forward - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This system has been found. No further action is required
"; - } - // If the system is not found, add it - else - { - $query = "INSERT INTO systems (manufacturer, system) VALUES ('".$manufacturer."', '".$systemname."')"; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The system '".$manufacturer." - ".$systemname."' has been added successfully!
"; - } - else - { - echo "The system '".$manufacturer." - ".$systemname."' could not be added, try again later
"; - } - } - } - // If the system is being edited - else - { - // Check if the system exists first - $query = "SELECT * FROM systems WHERE id=".$system; - $result = mysqli_query($link, $query); - - // If we don't find the system, don't add it. This might have been in error - if (gettype($result) == "boolean" && !$result) - { - echo "The system with id '".$system."' could not be found, try again later
"; - } - // If we find the system, update with the new information, if not a duplicate of another - else - { - $query = "SELECT * FROM systems WHERE manufacturer='".$manufacturer." AND system='".$systemname."'"; - $result = mysqli_query($link, $query); - - // If the system is found or unchanged, don't readd it - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This system has been found. No further action is required
"; - } - // If the system really has changed or is not a duplicate, add it - else - { - $query = "UPDATE systems SET manufacturer='".$manufacturer."', system='".$systemname."' WHERE id=".$system; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The system '".$manufacturer." - ".$systemname."' has been updated successfully!
"; - } - else - { - echo "The system '".$manufacturer." - ".$systemname."' could not be updated, try again later
"; - } - } - } - } - } - // If a source is being edited or added via POST - if ($source != "" && $sourcename != "" && $url != "") - { - // If the source is new and being added - if ($source == "-1") - { - // Always check if this exact combination is already there. This might have been in error - $query = "SELECT * FROM sources WHERE name='".$sourcename."'"; - $result = mysqli_query($link, $query); - - // If we find this source, tell the user and don't move forward - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This source has been found. No further action is required
"; - } - // If the source is not found, add it - else - { - $query = "INSERT INTO sources (name, url) VALUES ('".$sourcename."', '".$url."')"; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The source '".$sourcename."' has been added successfully!
"; - } - else - { - echo "The source '".$sourcename."' could not be added, try again later
"; - } - } - } - // If the source is being edited - else - { - // Check if the source exists first - $query = "SELECT * FROM sources WHERE id=".$system; - $result = mysqli_query($link, $query); - - // If we don't find the source, don't add it. This might have been in error - if (gettype($result) == "boolean" && !$result) - { - echo "The source with id '".$source."' could not be found, try again later
"; - } - // If we find the source, update with the new information, if not a duplicate of another - else - { - $query = "SELECT * FROM sources WHERE name='".$sourcename."'"; - $result = mysqli_query($link, $query); - - // If the source is found or unchanged, don't readd it - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This source has been found. No further action is required
"; - } - // If the source really has changed or is not a duplicate, add it - else - { - $query = "UPDATE sources SET name='".$sourcename."', url='".$url."' WHERE id=".$source; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The source '".$sourcename."' has been updated successfully!
"; - } - else - { - echo "The source '".$sourcename."' could not be updated, try again later
"; - } - } - } - } - } - // If a game is being edited or added via POST - if ($game != "" && $gamename != "" && $system != "" && $source != "") - { - // If the game is new and being added - if ($game == "-1") - { - // Always check if this exact combination is already there. This might have been in error - $query = "SELECT * FROM games WHERE name='".$gamename."' AND system=".$system." AND source=".$source; - $result = mysqli_query($link, $query); - - // If we find this game, tell the user and don't move forward - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This game has been found. No further action is required
"; - } - // If the game is not found, add it - else - { - $query = "INSERT INTO games (name, system, source) VALUES ('".$gamename."', ".$system.", ".$source.")"; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The game '".$gamename."' has been added successfully!
"; - } - else - { - echo "The game '".$gamename."' could not be added, try again later
"; - } - } - } - // If the game is being edited - else - { - // Check if the game exists first - $query = "SELECT * FROM games WHERE id=".$game; - $result = mysqli_query($link, $query); - - // If we don't find the game, don't add it. This might have been in error - if (gettype($result) == "boolean" && !$result) - { - echo "The game with id '".$game."' could not be found, try again later
"; - } - // If we find the game, update with the new information, if not a duplicate of another - else - { - $query = "SELECT * FROM games WHERE name='".$gamename."' AND system=".$system." AND source=".$source; - $result = mysqli_query($link, $query); - - // If the game is found elsewhere or unchanged, don't readd it - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This source has been found. No further action is required
"; - } - // If the game really has changed or is not a duplicate, add it - else - { - $query = "UPDATE game SET name='".$gamename."', system=".$system.", source=".$source." WHERE id=".$game; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The game '".$gamename."' has been updated successfully!
"; - } - else - { - echo "The game '".$gamename."' could not be updated, try again later
"; - } - } - } - } - } - // If a file is being edited or added via POST - if ($file != "" && $filename != "" && $game != "" && $type != "" && - (($type == "rom" && $size != "" && ($crc != "" || $md5 != "" || $sha1 != "")) || - ($type == "disk" && ($md5 != "" || $sha1 != "")))) - { - // If the file is new and being added - if ($file == "-1") - { - // Always check if this exact combination is already there. This might have been in error - $query = "SELECT * FROM files - JOIN checksums ON files.id=checksums.file - WHERE files.name='".$filename. - "' AND files.setid=".$game. - " AND files.type='".$type. - "' AND checksums.size=".$size. - "' AND checksums.crc='".$crc. - "' AND checksums.md5='".$md5. - "' AND checksums.sha1='".$sha1; - $result = mysqli_query($link, $query); - - // If we find this file, tell the user and don't move forward - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This file has been found. No further action is required
"; - } - // If the file is not found, add it - else - { - $query = "INSERT INTO files (name, game, type) - VALUES ('".$filename."', ".$game.", ".$type.")"; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The file '".$filename."' has been added successfully! Adding checksums.
"; - - $file = mysqli_insert_id($link); - $query = "INSERT INTO checksums (game, size, crc, md5, sha1) - VALUES (".$game.", ".$size.", '".$crc."', '".$md5."', '".$sha1."')"; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The checksums have been added!
"; - } - else - { - echo "The checksums could not be added, please try again later
"; - } - } - else - { - echo "The file '".$filename."' could not be added, try again later
"; - } - } - } - // If the file is being edited - else - { - // Check if the file exists first - $query = "SELECT * FROM files WHERE id=".$file; - $result = mysqli_query($link, $query); - - // If we don't find the file, don't add it. This might have been in error - if (gettype($result) == "boolean" && !$result) - { - echo "The game with id '".$file."' could not be found, try again later
"; - } - // If we find the file, update with the new information, if not a duplicate of another - else - { - $query = "SELECT * FROM files - JOIN checksums ON files.id=checksums.file - WHERE files.name='".$filename. - "' AND files.setid=".$game. - " AND files.type='".$type. - "' AND checksums.size=".$size. - "' AND checksums.crc='".$crc. - "' AND checksums.md5='".$md5. - "' AND checksums.sha1='".$sha1; - $result = mysqli_query($link, $query); - - // If the file is found elsewhere or unchanged, don't readd it - if (gettype($result) != "boolean" && mysqli_num_rows($result) > 0) - { - echo "This file has been found. No further action is required
"; - } - // If the source really has changed or is not a duplicate, add it - else - { - $query = "UPDATE file - JOIN checksums ON files.id=checksums.file - SET files.name='".$filename. - "' AND files.setid=".$game. - " AND files.type='".$type. - "' AND checksums.size=".$size. - "' AND checksums.crc='".$crc. - "' AND checksums.md5='".$md5. - "' AND checksums.sha1='".$sha1; - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - echo "The file '".$filename."' has been updated successfully!
"; - } - else - { - echo "The file '".$filename."' could not be updated, try again later
"; - } - } - } - } - } -} - -// Assuming there are no relevent params (or processing POST is done), show the basic page -if ($system == "" && $source == "" && $game == "" && $file == "") -{ - show_default($link); -} -// First and foremost, capture file edit mode. It's exclusive above all others. -elseif ($file != "") -{ - // Retrieve the file info - $query = "SELECT files.id AS file, - files.name AS name, - files.type AS type, - checksums.size AS size, - checksums.crc AS crc, - checksums.md5 AS md5, - checksums.sha1 AS sha1 - FROM files - JOIN checksums - ON files.id=checksums.file - WHERE files.id=".$file; - $result = mysqli_query($link, $query); - $rom = mysqli_fetch_assoc($result); - - // Now output the editable information - echo "

- - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
Type
Size
CRC
MD5
SHA-1
- - -

"; - -} -// Then capture game edit mode, it also takes precidence over the others. -elseif ($game != "") -{ - // Retrieve the system listing - $query = "SELECT id, manufacturer, system FROM systems - ORDER BY manufacturer ASC, - system ASC"; - $result = mysqli_query($link, $query); - $systems = array(); - while ($row = mysqli_fetch_assoc($result)) - { - array_push($systems, $row); - } - - // Retrieve the sources listing - $query = "SELECT id, name FROM sources - ORDER BY name ASC"; - $result = mysqli_query($link, $query); - $sources = array(); - while ($row = mysqli_fetch_assoc($result)) - { - array_push($sources, $row); - } - - // Get the total count in the case that it needs limiting - $query = "SELECT COUNT(*) as count - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - JOIN files - ON games.id=files.setid - JOIN checksums - ON files.id=checksums.file - WHERE games.id=".$game; - $count = mysqli_query($link, $query); - $count = mysqli_fetch_assoc($count); - $count = $count["count"]; - settype($count, "integer"); - - // Retrieve the game info - $query = "SELECT systems.manufacturer AS manufacturer, - systems.system AS system, - systems.id AS systemid, - sources.name AS source, - sources.id AS sourceid, - games.name AS game, - files.id AS file, - files.name AS name, - files.type AS type, - checksums.size AS size, - checksums.crc AS crc, - checksums.md5 AS md5, - checksums.sha1 AS sha1 - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - JOIN files - ON games.id=files.setid - JOIN checksums - ON files.id=checksums.file - WHERE games.id=".$game. - " LIMIT 50 OFFSET ".($offset == "" ? "0" : ($offset*5)."0"); - $result = mysqli_query($link, $query); - if (gettype($result) == "boolean" || mysqli_num_rows($result) == 0) - { - echo "No game info could be retrieved! There might be an error.
"; - exit; - } - $roms = mysqli_fetch_all($result); - $game_info = $roms[0]; - - echo "
- -

Edit the Game Information Below

- - - - - - - - - - - - - - -
System
Source
Name

- - - - -"; - - foreach ($roms as $rom) - { - echo " - "; - for ($i = 7; $i < 13; $i++) - { - echo ""; - } - echo "\n"; - } - - echo "
NameTypeSizeCRCMD5SHA-1
".$rom[$i]."
". - "\n

"; - - echo "
"; - if ($offset != "" && $offset > 0) - { - echo "Last 50 "; - } - if ($count > (mysqli_num_rows($result) + ($offset == "" ? 0 : $offset*50))) - { - echo "Next 50"; - } - echo "
"; - - echo "Back to previous page
\n"; - -} -else -{ - // Retrieve source info only so it's not duplicated - if ($source_set) - { - $query = "SELECT name, url FROM sources WHERE id='".$source."'"; - $source_result = mysqli_query($link, $query); - $source_info = mysqli_fetch_assoc($source_result); - } - // Retrieve system info only so it's not duplicated - if ($system_set) - { - $query = "SELECT manufacturer, system FROM systems WHERE id='".$system."'"; - $system_result = mysqli_query($link, $query); - $system_info = mysqli_fetch_assoc($system_result); - } - - // Get the total count in the case that it needs limiting - $query = "SELECT COUNT(*) as count - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - WHERE ". - ($source_set ? "sources.id=".$source : ""). - ($source_set && $system_set ? " AND " : ""). - ($system_set ? "systems.id=".$system : ""); - $count = mysqli_query($link, $query); - $count = mysqli_fetch_assoc($count); - $count = $count["count"]; - settype($count, "integer"); - - // Then get all games assocated - $query = "SELECT games.name AS name, - games.id AS id, - systems.manufacturer AS manufacturer, - systems.system AS system, - sources.name AS source - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - WHERE ". - ($source_set ? "sources.id=".$source : ""). - ($source_set && $system_set ? " AND " : ""). - ($system_set ? "systems.id=".$system : ""). - " ORDER BY games.name ASC - LIMIT 50 OFFSET ".($offset == "" ? "0" : ($offset*5)."0"); - $games_result = mysqli_query($link, $query); - - echo "
\n"; - - if ($source_set) - { - echo "\n". - "Source: \n". - "URL(s):
\n"; - } - if ($system_set) - { - echo "\n". - "Manufacturer: \n". - "Name:
\n"; - } - - echo "\n

\n"; - - echo "

Games With This ". - ($source_set ? "Source" : ""). - ($source_set && $system_set ? " And " : ""). - ($system_set ? "System" : "")."

\n"; - if (gettype($games_result) != "boolean") - { - while ($game = mysqli_fetch_assoc($games_result)) - { - echo "".$game["name"]; - if ($source_set && !$system_set) - { - echo " (".$game["manufacturer"]." - ".$game["system"].")"; - } - if (!$source_set && $system_set) - { - echo " (".$game["source"].")"; - } - echo "
\n"; - } - echo "
"; - if ($offset != "" && $offset > 0) - { - echo "Last 50 "; - } - if ($count > (mysqli_num_rows($games_result) + ($offset == "" ? 0 : $offset*50))) - { - echo "Next 50"; - } - echo "
"; - } - else - { - echo "No games could be found!"; - } - echo "
"; -} - -// Requires the mysqli link -function show_default($link) -{ - // Retrieve the system listing - $query = "SELECT id, manufacturer, system FROM systems - ORDER BY manufacturer ASC, - system ASC"; - $result = mysqli_query($link, $query); - $systems = array(); - while ($row = mysqli_fetch_assoc($result)) - { - array_push($systems, $row); - } - - // Retrieve the sources listing - $query = "SELECT id, name FROM sources - ORDER BY name ASC"; - $result = mysqli_query($link, $query); - $sources = array(); - while ($row = mysqli_fetch_assoc($result)) - { - array_push($sources, $row); - } - - // Output the input selection form - echo << - -

Select a System or Source

- -

- - -

Or Add a New One

-
- -

Source Add

-Name: -URL(s):
- -

System Add

-Manufacturer: -Name:

- -\n

\n"; -} - -?> \ No newline at end of file diff --git a/admin/import.php b/admin/import.php deleted file mode 100644 index f4e07ab..0000000 --- a/admin/import.php +++ /dev/null @@ -1,564 +0,0 @@ -Import From Datfile"; - -ini_set('max_execution_time', 0); // Set the execution time to infinite. This is a bad idea in production. - -// Verify GET variables -$auto = isset($_GET["auto"]) && $_GET["auto"] == "1"; -$size = isset($_GET["size"]) && $_GET["size"] == "1"; - -// Set import path -$importroot = "../temp/import/"; - -if (!isset($_GET["filename"])) -{ - // List all files, auto-generate links to proper pages - echo "

Automatically add all DATs
\n". - "Sort list by name
\n". - "Sort list by size

\n"; - - $files = scandir($importroot); - if (sizeof($files) != 0) - { - if ($size) - { - usort($files, function ($a, $b) - { - global $importroot; - $size_a = filesize($importroot.$a); - $size_b = filesize($importroot.$b); - - return $size_a - $size_b; - }); - } - - foreach ($files as $file) - { - if (preg_match("/^.*\.dat$/", $file) || preg_match("/^.*\.xml$/", $file)) - { - // If we want to import everything in the folder... - if ($auto) - { - import_dat($file); - sleep(1); - echo ""; - } - else - { - echo "".htmlspecialchars($file)." (".filesize($importroot.$file)." bytes)
\n"; - } - } - } - } -} -else -{ - import_dat($_GET["filename"]); - sleep(1); - echo ""; -} - -function import_dat ($filename) -{ - global $link, $normalize_chars, $search_pattern, $importroot, - $mapping_mame, $mapping_nointro, $mapping_redump, $mapping_tosec, $mapping_trurip; - - $_defaultPattern = @"/^(.+?) - (.+?) \((.*) (.*)\)\.dat$/"; - $_mamePattern = @"/^(.*)\.xml$/"; - $_noIntroPattern = @"/^(.*?) \((\d{8}-\d{6})_CM\)\.dat$/"; - $_noIntroNumberedPattern = @"/(.*? - .*?) \(\d.*?_CM\).dat/"; - $_noIntroSpecialPattern = @"/(.*? - .*?) \((\d{8})\)\.dat/"; - $_redumpPattern = @"/^(.*?) \((\d{8} \d{2}-\d{2}-\d{2})\)\.dat$/"; - $_redumpBiosPattern = @"/^(.*?) \(\d+\) \((\d{4}-\d{2}-\d{2})\)\.dat$/"; - $_tosecPattern = @"/^(.*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$/"; - $_tosecSpecialPatternA = @"/^(.*? - .*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$/"; - $_tosecSpecialPatternB = @"/^(.*? - .*? - .*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$/"; - $_truripPattern = @"/^(.*) - .* \(trurip_XML\)\.dat$/"; - - // Regex Mapped Name Patterns - $_remappedPattern = @"/^(.*) - (.*)$/"; - - // Regex Date Patterns - $_defaultDatePattern = @"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/"; - $_noIntroDatePattern = @"/(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})/"; - $_noIntroSpecialDatePattern = @"/(\d{4})(\d{2})(\d{2})/"; - $_redumpDatePattern = @"/(\d{4})(\d{2})(\d{2}) (\d{2})-(\d{2})-(\d{2})/"; - $_tosecDatePattern = @"/(\d{4})-(\d{2})-(\d{2})/"; - - // Check the file is valid - if (!file_exists($importroot.$filename)) - { - echo "The file you supply must be in ".$importroot."
"; - echo "Go back to import page"; - - return; - } - - // Then determine the type of the DAT - $type = ""; - if (preg_match($_mamePattern, $filename, $fileinfo)) - { - $type = "mame"; - } - elseif (preg_match($_noIntroPattern, $filename, $fileinfo)) - { - $type = "nointro"; - } - // For numbered DATs only - elseif (preg_match($_noIntroNumberedPattern, $filename, $fileinfo)) - { - $type = "nointro"; - } - // For N-Gage and Gizmondo only - elseif (preg_match($_noIntroSpecialPattern, $filename, $fileinfo)) - { - $type = "nointro"; - } - elseif (preg_match($_redumpPattern, $filename, $fileinfo)) - { - $type = "redump"; - } - // For special BIOSes only - elseif (preg_match($_redumpBiosPattern, $filename, $fileinfo)) - { - $type = "redump"; - } - elseif (preg_match($_tosecPattern, $filename, $fileinfo)) - { - $type = "tosec"; - } - elseif (preg_match($_truripPattern, $filename, $fileinfo)) - { - $type = "trurip"; - } - elseif (preg_match($_defaultPattern, $filename, $fileinfo)) - { - $type = "custom"; - } - else - { - echo "DAT type could not be determined from file name!
\n"; - echo "Go back to import page"; - - return; - } - - echo "

The file ".$filename." has a proper pattern!

\n"; - - // Next, get information from the database on the current machine - switch ($type) - { - case "mame": - preg_match($_remappedPattern, $mapping_mame[$fileinfo[1]], $name); - $manufacturer = $name[1]; - $system = $name[2]; - $source = "MAME"; - $datestring = filemtime($importroot.$filename); - $date = date("Y-m-d G:i:s", $datestring); - break; - case "nointro": - preg_match($_remappedPattern, $mapping_nointro[$fileinfo[1]], $name); - $manufacturer = $name[1]; - $system = $name[2]; - $source = "no-Intro"; - - if (fileinfo.Count < 2) - { - $date = date("Y-m-d H:i:s", filemtime($importroot.$filename)); - } - elseif (preg_match($_noIntroDatePattern, $fileinfo[2])) - { - $datestring = $fileinfo[2]; - preg_match($_noIntroDatePattern, $datestring, $date); - $date = $date[1]."-".$date[2]."-".$date[3]." ".$date[4].":".$date[5].":".$date[6]; - } - else - { - $datestring = $fileinfo[2]; - preg_match($_noIntroSpecialDatePattern, $datestring, $date); - $date = $date[1]."-".$date[2]."-".$date[3]." 00:00:00"; - } - break; - case "redump": - if (!isset($mapping_redump[$fileinfo[1]])) - { - // Handle special case mappings found only in Redump - preg_match($_redumpBiosPattern, $filename, $fileinfo); - - if (!isset($mapping_redump[$fileinfo[1]])) - { - echo "The filename ".$fileinfo[1]." could not be mapped! Please check the mappings and try again"; - return false; - } - } - preg_match($_remappedPattern, $mapping_redump[$fileinfo[1]], $name); - $manufacturer = $name[1]; - $system = $name[2]; - $source = "Redump"; - $datestring = $fileinfo[2]; - preg_match($_redumpDatePattern, $datestring, $date); - $date = $date[1]."-".$date[2]."-".$date[3]." ".$date[4].":".$date[5].":".$date[6]; - break; - case "tosec": - // If it's a special case, try to see if it's one of the odd TOSEC's - if (!isset($mapping_tosec[$fileinfo[1]])) - { - preg_match($_tosecSpecialPatternA, $filename, $fileinfo); - if (!isset($mapping_tosec[$fileinfo[1]])) - { - preg_match($_tosecSpecialPatternB, $filename, $fileinfo); - if (!isset($mapping_tosec[$fileinfo[1]])) - { - echo "The filename ".$fileinfo[1]." could not be mapped! Please check the mappings and try again"; - return false; - } - } - } - preg_match($_remappedPattern, $mapping_tosec[$fileinfo[1]], $name); - $manufacturer = $name[1]; - $system = $name[2]; - $source = "TOSEC"; - $datestring = $fileinfo[2]; - preg_match($_tosecDatePattern, $datestring, $date); - $date = $date[1]."-".$date[2]."-".$date[3]." 00:00:00"; - break; - case "trurip": - preg_match($_remappedPattern, $mapping_trurip[$fileinfo[1]], $name); - $manufacturer = $name[1]; - $system = $name[2]; - $source = "trurip"; - $datestring = filemtime($importroot.$filename); - $date = date("Y-m-d G:i:s", $datestring); - break; - case "custom": - default: - $manufacturer = $fileinfo[1]; - $system = $fileinfo[2]; - $source = $fileinfo[3]; - $datestring = $fileinfo[4]; - preg_match($_defaultDatePattern, $datestring, $date); - $date = $date[1]."-".$date[2]."-".$date[3]." ".$date[4].":".$date[5].":".$date[6]; - break; - } - - $query = "SELECT id - FROM systems - WHERE manufacturer='$manufacturer' - AND system='$system'"; - $result = mysqli_query($link, $query); - - if (!gettype($result) == "boolean" || mysqli_num_rows($result) == 0) - { - echo('Error: No suitable system found! Please add the system and then try again
'); - return; - } - - $sysid = mysqli_fetch_assoc($result); - $sysid = $sysid["id"]; - - $query = "SELECT id - FROM sources - WHERE name='".$source."'"; - $result = mysqli_query($link, $query); - - if (!gettype($result) == "boolean" || mysqli_num_rows($result) == 0) - { - echo('Error: No suitable source found! Please add the source and then try again
'); - return; - } - - $srcid = mysqli_fetch_assoc($result); - $srcid = $srcid["id"]; - - // Try to open the file as XML - $superdat = false; - $xmlr = new XmlReader; - - // If the file doesn't start with the right thing, convert it - $handle = fopen($importroot.$filename, "r"); - if ($handle === false) - { - echo "The file was not valid!

\n"; - return; - } - - $file = fgets($handle); - fclose($handle); - if (strpos($file, "<") !== 0) - { - $xmlr->XML(rv2xml($importroot.$filename)); - - } - else - { - $result = $xmlr->open($importroot.$filename); - - // If it can't be opened, then it doesn't exist - if (!$result) - { - echo "The file was not valid!

\n"; - return; - } - } - - // Read until we find the main body - while ($xmlr->name !== "datafile" && $xmlr->name !== "softwarelist") - { - $xmlr->read(); - } - - // Now find the header inside of that - while ($xmlr->name !== "header") - { - $xmlr->read(); - } - - // Check for SuperDAT mode by finding the name - while ($xmlr->name !== "name") - { - $xmlr->read(); - } - if (strpos($xmlr->readString(), " - SuperDAT") !== false) - { - $superdat = true; - } - - // Now seek to the end of the header - while (!($xmlr->name === "header" && $xmlr->nodeType === XMLReader::END_ELEMENT)) - { - $xmlr->read(); - } - - // Now loop over the main body - echo "

Roms Added:

- - \n"; - while ($xmlr->read()) - { - //var_dump($xmlr->name, $xmlr->nodeType, $xmlr->depth, $xmlr->readString(), "
\n"); - - // For each game, find all of the roms inside of it - if ($xmlr->nodeType === XMLReader::ELEMENT && ($xmlr->name == "machine" || $xmlr->name == "game" || $xmlr->name == "software")) - { - $gameid = 0; - $tempname = ""; - if ($xmlr->name == "software") - { - while ($xmlr->name != "description") - { - $xmlr->read(); - } - $tempname = $xmlr->readString(); - } - else - { - $tempname = $xmlr->getAttribute("name"); - } - - // If we're in SuperDAT mode, strip the folder out - if ($superdat) - { - preg_match("/.*?\\(.*)/", $tempname, $tempname); - $tempname = $tempname[1]; - } - - $gameid = add_game($sysid, $tempname, $srcid); - - // For each of the roms in the machine - $delim = $xmlr->name; - while ($xmlr->read() && $xmlr->name != $delim) - { - // If we find a rom or disk, add it - if ($xmlr->nodeType === XMLReader::ELEMENT && ($xmlr->name == "rom" || $xmlr->name == "disk")) - { - // If there's no name, skip it because it can't be added - $name = ""; - if ($xmlr->getAttribute("name") === null) - { - continue; - } - - // Take care of hex-sized files - $size = -1; - if ($xmlr->getAttribute("size") !== null && strpos($xmlr->getAttribute("size"), "0x") !== false) - { - $size = hexdec($xmlr->getAttribute("size")); - } - elseif ($xmlr->getAttribute("size") !== null) - { - $size = (real)$xmlr->getAttribute("size"); - } - - add_rom($tempname, - $xmlr->name, - $gameid, - $xmlr->getAttribute("name"), - $date, - $size, - ($xmlr->getAttribute("crc") !== null ? trim($xmlr->getAttribute("crc")) : ""), - ($xmlr->getAttribute("md5") !== null ? trim($xmlr->getAttribute("md5")) : ""), - ($xmlr->getAttribute("sha1") !== null ? trim($xmlr->getAttribute("sha1")) : "") - ); - } - } - } - } - $xmlr->close(); - echo "
MachineRomSizeCRC32MD5SHA1

\n"; - - // Add the imported file to the zip and delete - $extfilename = $importroot.$filename; - $zip = new ZipArchive(); - $zip->open("../temp/imported".($type != "" ? "-".$type : "").".zip", ZIPARCHIVE::CREATE); - $zip->addFile($extfilename, $filename); - $zip->close(); - unlink($extfilename); -} - -function add_game ($sysid, $machinename, $srcid) -{ - global $link, $normalize_chars, $search_pattern; - - // WoD gets rid of anything past the first "(" or "[" as the name, we will do the same - preg_match("/(([[(].*[\)\]] )?([^([]+))/", $machinename, $machinename); - $machinename = $machinename[1]; - - // Run the name through the filters to make sure that it's correct - $machinename = strtr($machinename, $normalize_chars); - $machinename = ru2lat($machinename); - $machinename = preg_replace($search_pattern["EXT"], $search_pattern["REP"], $machinename); - $machinename = trim($machinename); - - // This is an issue, apparently - if ($machinename == "") - { - echo "
\n"; - die("Machinename is blank!"); - } - - $query = "SELECT id - FROM games - WHERE system=".$sysid." - AND name='".addslashes($machinename)."' - AND source=".$srcid; - - $result = mysqli_query($link, $query); - if (gettype($result) == "boolean" || mysqli_num_rows($result) == 0) - { - $query = "INSERT INTO games (system, name, source) - VALUES (".$sysid.", '".addslashes($machinename)."', ".$srcid.")"; - $result = mysqli_query($link, $query); - $gameid = mysqli_insert_id($link); - } - else - { - $gameid = mysqli_fetch_assoc($result); - $gameid = $gameid["id"]; - } - - return $gameid; -} - -function add_rom ($machinename, $romtype, $gameid, $name, $date, $size, $crc, $md5, $sha1) -{ - global $link, $normalize_chars, $search_pattern; - - // Run the name through the filters to make sure that it's correct - $name = strtr($name, $normalize_chars); - $name = ru2lat($name); - $name = str_replace($search_pattern["EXT"], $search_pattern["REP"], $name); - - // WOD origninally stripped out any subdirs from the imported files, we do the same - $name = explode("\\", $name); - $name = $name[sizeof($name) - 1]; - - if ($romtype != "rom" && $romtype != "disk") - { - $romtype = "rom"; - } - - // Check for the existance of the rom in the given system and game - // If it doesn't exist, create the rom with the information provided - $query = "SELECT files.id - FROM files - JOIN checksums - ON files.id=checksums.file - WHERE files.name='".addslashes($name)."' ". - "AND files.type='".$romtype."' ". - "AND files.setid=".$gameid." ". - ($size != "" ? " AND checksums.size=".$size : ""). - ($crc != "" ? " AND checksums.crc='".$crc."'" : ""). - ($md5 != "" ? " AND checksums.md5='".$md5."'" : ""). - ($sha1 != "" ? " AND checksums.sha1='".$sha1."'" : ""); - - $result = mysqli_query($link, $query); - if (gettype($result) == "boolean" || mysqli_num_rows($result) == 0) - { - $query = "INSERT INTO files (setid, name, type, lastupdated) - VALUES (".$gameid.", - '".addslashes($name)."', - '".$romtype."', - '".$date."')"; - - $result = mysqli_query($link, $query); - - if (gettype($result) == "boolean" && $result) - { - $romid = mysqli_insert_id($link); - - $query = "INSERT INTO checksums (file". - ($size != "" ? ", size" : ""). - ($crc != "" ? ", crc" : ""). - ($md5!= "" ? ", md5" : ""). - ($sha1 != "" ? ", sha1" : ""). - ") - VALUES (".$romid. - ($size != "" ? ", ".$size : ""). - ($crc != "" ? ", '".strtolower($crc)."'" : ""). - ($md5 != "" ? ", '".strtolower($md5)."'" : ""). - ($sha1 != "" ? ", '".strtolower($sha1)."'" : ""). - ")"; - - $result = mysqli_query($link, $query); - - if (gettype($result)=="boolean" && $result) - { - echo "".$machinename."".$name."".$size."".$crc."".$md5."".$sha1."\n"; - ob_flush(); flush(); - echo ""; - } - else - { - echo("MYSQL Error! ".mysqli_error($link)."
"); - return; - } - } - else - { - echo("MYSQL Error! ".mysqli_error($link)."
"); - return; - } - } -} - -?> \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 50e29c0..487a157 100644 --- a/admin/index.php +++ b/admin/index.php @@ -25,7 +25,6 @@ Administrative Functions Homepage

    -
  1. Add/Edit/Remove a system/source/game/file
  2. -
  3. Add/Edit/Remove a parent
  4. -
  5. Bulk add from DAT
  6. -
  7. Create all available DATs
  8. Check for new files online
  9. -
  10. Deheader files in a local (server) folder
  11. Import or generate scene release information
  12. -
  13. Clean the database of dupes and orphans (CAUTION! CANNOT BE UNDONE!)
"; } diff --git a/admin/parenting.php b/admin/parenting.php deleted file mode 100644 index 9da6d90..0000000 --- a/admin/parenting.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/admin/parenting/add_parent_db.php b/admin/parenting/add_parent_db.php deleted file mode 100644 index 77d15ac..0000000 --- a/admin/parenting/add_parent_db.php +++ /dev/null @@ -1,24 +0,0 @@ -" . mysqli_error($link); - } - - mysqli_close($link); - -?> \ No newline at end of file diff --git a/admin/parenting/index.php b/admin/parenting/index.php deleted file mode 100644 index d332200..0000000 --- a/admin/parenting/index.php +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - TITLE - - - - - - - - - - - - -
-
- - - - Filter by Family:
- Filter by Title:
-
-
-
- - - - - -
- -
- -
- - - - Filter by System:
- Filter by Title:
-
-
- - - - -
- -
- - - - - \ No newline at end of file diff --git a/admin/parenting/list_parents.php b/admin/parenting/list_parents.php deleted file mode 100644 index bee8bdb..0000000 --- a/admin/parenting/list_parents.php +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - id - Game Family - Game Title - - - "; - - if (!isset($_GET['name']) OR $_GET['name'] == "") - { - $filter = "1"; - } else { - #only list parents as per the filtered name - $filter = "name LIKE \"%".$_GET['name']."%\""; - } - //Get all existing "parent" table entries - $sql = "SELECT id, name FROM parent WHERE $filter;"; - $res = mysqli_query($link, $sql) OR die(mysqli_error($link)); - - if(!$res) - { - - } - else - { - //We have data! - $found=false; - while ($row = mysqli_fetch_assoc($res)) - { - $found = true; - echo " - - ".$row['id']." - unsupported - ".$row['name']." - "; - - } - echo " - - - "; - - echo "
"; - if (!$found) - { - //No result found, want to add a new parent? - echo "

Parent not found. Add new?

"; - echo " - Game Family:
- Game Title:
- - "; - } - } - - mysqli_close($link); -?> - -
-
\ No newline at end of file diff --git a/admin/parenting/list_sets.php b/admin/parenting/list_sets.php deleted file mode 100644 index 5580077..0000000 --- a/admin/parenting/list_sets.php +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Action - id - Parent - Set Title - - - "; - - if (!isset($_GET['name']) OR $_GET['name'] == "") - { - $filter = "1"; - } else { - #only list parents as per the filtered name - $filter = "name LIKE \"%".$_GET['name']."%\""; - } - //Get all existing "parent" table entries - $sql = "SELECT id, name, parent FROM games WHERE $filter;"; - $res = mysqli_query($link, $sql) OR die(mysqli_error($link)); - - if(!$res) - { - - } - else - { - //We have data! - $found=false; - while ($row = mysqli_fetch_assoc($res)) - { - $found = true; - $daddy = getMyParent($row['parent'],$link); - - if($daddy == "none") { - $daddy = ""; - } - - echo " - - <<< Add - ".$row['id']." - ".$daddy." - ".$row['name']." - "; - - } - echo " - - - "; - - echo "
"; - if (!$found) - { - //No result found, want to add a new parent? - echo "

No sets found

"; - } - } - - function getMyParent($parentID, $link) { - - #TODO: Move the connection away from here, use whatever the main system uses globally - - - $sql = "SELECT name FROM parent WHERE id=$parentID;"; - $res = mysqli_query($link, $sql) OR die(mysqli_error($link)); - - if(!$res) - { - - } - else - { - $row = mysqli_fetch_assoc($res); - if (!$row['name'] || $row['name']=="") - $name = "none"; - else - $name = $row['name']; - - return $name; - - } - } - - mysqli_close($link); - -?> - -
-
\ No newline at end of file diff --git a/admin/parenting/rem_parent_db.php b/admin/parenting/rem_parent_db.php deleted file mode 100644 index 15c5adc..0000000 --- a/admin/parenting/rem_parent_db.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/admin/parenting/set_parent.php b/admin/parenting/set_parent.php deleted file mode 100644 index 2a164be..0000000 --- a/admin/parenting/set_parent.php +++ /dev/null @@ -1,25 +0,0 @@ -" . mysqli_error($link); - } - - mysqli_close($link); - -?> \ No newline at end of file diff --git a/admin/reset.php b/admin/reset.php deleted file mode 100644 index b034889..0000000 --- a/admin/reset.php +++ /dev/null @@ -1,43 +0,0 @@ -\n"; -} -else -{ - echo "Resetting database failed!
\n".mysqli_error($link); -} - -?> \ No newline at end of file diff --git a/headers/a7800.xml b/headers/a7800.xml deleted file mode 100644 index bd80b96..0000000 --- a/headers/a7800.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Atari 7800 - Roman Scherzer - 1.0 - - - - - - - - - - diff --git a/headers/fds.xml b/headers/fds.xml deleted file mode 100644 index 1599498..0000000 --- a/headers/fds.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - fds - Yori Yoshizuki - 1.0 - - - - - - - - - - - - - - - - - - diff --git a/headers/lynx.xml b/headers/lynx.xml deleted file mode 100644 index 31570a9..0000000 --- a/headers/lynx.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Atari Lynx - Roman Scherzer - 1.0 - - - - - - - - - - diff --git a/headers/mega.xml b/headers/mega.xml deleted file mode 100644 index 58b2dd4..0000000 --- a/headers/mega.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - MEGAMERGED - Roman Scherzer, Yori Yoshizuki, CUE, Matt Nadareski (darksabre76) - 1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/headers/n64.xml b/headers/n64.xml deleted file mode 100644 index 4c3fedc..0000000 --- a/headers/n64.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Nintendo 64 - ABCD - CUE - 1.1 - - - - - - - - - - - - - - - - - diff --git a/headers/nes.xml b/headers/nes.xml deleted file mode 100644 index 9b6da5c..0000000 --- a/headers/nes.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Nintendo Famicon/NES - Roman Scherzer - 1.1 - - - - - - diff --git a/headers/snes.xml b/headers/snes.xml deleted file mode 100644 index cda21eb..0000000 --- a/headers/snes.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Nintendo Super Famicom/SNES - Matt Nadareski (darksabre76) - 1.0 - - - - - - - - - - - - - - - - - diff --git a/includes/functions.php b/includes/functions.php index 476c2c2..bb1329b 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -40,157 +40,4 @@ function get_data($url) return $content; } -// Convert an old-style DAT to XML -function rv2xml ($filename) -{ - //ob_end_clean(); - ini_set('max_execution_time', 0); // Set the execution time to infinite. This is a bad idea in production. - - // Set the complex regex patterns - $headerPattern = @"/(.*?) \($/m"; - $itemPattern = @"/^(.*?) (.*)/"; - $endPattern = @"/^\)\s*$/"; - - // Get the file open for reading - $file = fopen($filename, "r"); - - // If there's an error, return null - if ($file === false) - { - return null; - } - - // Create the XMLWriter - $xmlw = new XMLWriter; - $xmlw->openMemory(); - $xmlw->setIndent(true); - $xmlw->setIndentString("\t"); - $xmlw->startDocument(); - $xmlw->startElement("datafile"); - - $block = false; $header = false; - while (($line = fgets($file)) !== false) - { - $line = trim($line); - - // If the line is the header or a game - if (preg_match($headerPattern, $line, $matches) !== 0) - { - if ($matches[1] == "clrmamepro" || $matches[1] == "romvault") - { - $xmlw->startElement("header"); - $header = true; - } - else - { - $xmlw->startElement($matches[1]); - } - - $block = true; - } - - // If the line is a rom or disk and we're in a block - elseif ((strpos(trim($line), "rom (") === 0 || strpos(trim($line), "disk (") === 0) && $block) - { - $line = explode(" ", $line); - - $xmlw->startElement($line[0]); - - // Loop over all attributes and add them if possible - $quote = false; $attrib = ""; $val = ""; - for ($i = 2; $i < sizeof($line); $i++) - { - // Get the number of quotes - preg_match_all(@"/\"/", $line[$i], $quotes); - $quotes = sizeof($quotes[0]); - - // Even number of quotes, not in a quote, not in attribute - if ($quotes % 2 == 0 && !$quote && $attrib == "") - { - $attrib = str_replace("\"", "", $line[$i]); - } - // Even number of quotes, not in a quote, in attribute - elseif ($quotes % 2 == 0 && !$quote && $attrib != "") - { - $xmlw->writeAttribute($attrib, str_replace("\"", "", $line[$i])); - - $attrib = ""; - } - // Even number of quotes, in a quote, not in attribute - elseif ($quotes % 2 == 0 && $quote && $attrib == "") - { - // Attributes can't have quoted names - } - // Even number of quotes, in a quote, in attribute - elseif ($quotes % 2 == 0 && $quote && $attrib != "") - { - $val .= " ".$line[$i]; - } - // Odd number of quotes, not in a quote, not in attribute - elseif ($quotes % 2 == 1 && !$quote && $attrib == "") - { - // Attributes can't have quoted names - } - // Odd number of quotes, not in a quote, in attribute - elseif ($quotes % 2 == 1 && !$quote && $attrib != "") - { - $val = str_replace("\"", "", $line[$i]); - $quote = true; - } - // Odd number of quotes, in a quote, not in attribute - elseif ($quotes % 2 == 1 && $quote && $attrib == "") - { - $quote = false; - } - // Odd number of quotes, in a quote, in attribute - elseif ($quotes % 2 == 1 && $quote && $attrib != "") - { - $val .= " ".str_replace("\"", "", $line[$i]); - $xmlw->writeAttribute($attrib, $val); - - $quote = false; - $attrib = ""; - $val = ""; - } - } - - $xmlw->endElement(); - } - // If the line is anything but a rom or disk and we're in a block - elseif (preg_match($itemPattern, $line, $matches) !== 0 && $block) - { - $matches[2] = str_replace("\"", "", $matches[2]); - - if ($matches[1] == "name" && !$header) - { - $xmlw->writeAttribute($matches[1], $matches[2]); - $xmlw->writeElement("description", $matches[2]); - } - else - { - $xmlw->writeElement($matches[1], $matches[2]); - } - } - - // If we find an end bracket that's not associated with anything else, the block is done - elseif (preg_match($endPattern, $line) !== 0 && $block) - { - $block = false; - $xmlw->endElement(); - $header = false; - } - - // Somehow didn't match anything - else - { - //echo "
".$line."

\n"; - } - } - $xmlw->endElement(); - $xmlw->endDocument(); - fclose($file); - - return $xmlw->outputMemory(); -} - ?> \ No newline at end of file diff --git a/includes/remapping.php b/includes/remapping.php deleted file mode 100644 index 4a7967d..0000000 --- a/includes/remapping.php +++ /dev/null @@ -1,956 +0,0 @@ - "Sega - 32X", - "3do_m2" => "Panasonic - 3DO M2", - "a2600" => "Atari - 2600", - "a2600_cass" => "Atari - 2600", - "a5200" => "Atari - 5200", - "a7800" => "Atari - 7800", - "a800" => "Atari - 8bit", - "a800_flop" => "Atari - 8bit", - "abc1600" => "Luxor - ABC 1600", - "abc800" => "Luxor - ABC 800", - "abc800_hdd" => "Luxor - ABC 800", - "abc806" => "Luxor - ABC 806", - "abc80_cass" => "Luxor - ABC 80", - "abc80_flop" => "Luxor - ABC 80", - "adam_cart" => "Coleco - ColecoVision, ColecoVision ADAM", - "adam_cass" => "Coleco - ColecoVision, ColecoVision ADAM", - "adam_flop" => "Coleco - ColecoVision, ColecoVision ADAM", - "advantage" => "NorthStar - Advantage", - "advision" => "Entex - Adventure Vision", - "aim65_cart" => "Rockwell - AIM 65", - "aleste" => "Patisonic - Aleste 520EX", - "alice32" => "Matra Hachette - Alice 32 & 90", - "alice90" => "Matra Hachette - Alice 32 & 90", - "alphatro_flop" => "Triumph-Adler - Alphatronic PC", - "altos5" => "Altos Computer Systems - Series 5", - "amiga_a1000" => "Commodore - Amiga", - "amiga_a3000" => "Commodore - Amiga", - "amiga_apps" => "Commodore - Amiga", - "amiga_flop" => "Commodore - Amiga", - "amiga_hardware" => "Commodore - Amiga", - "amiga_workbench" => "Commodore - Amiga", - "amigaaga_flop" => "Commodore - Amiga", - "amigaecs_flop" => "Commodore - Amiga", - "amigaocs_flop" => "Commodore - Amiga", - "ampro" => "Ampro - Little Board", - "apc" => "NEC - Advanced Personal Computer", - "apfimag_cass" => "APF - M-1000", - "apfm1000" => "APF - M-1000", - "apogee" => "Radio-86RK - Apogej BK-01", - "apollo_ctape" => "Hewlett-Packard - Apollo", - "apple1" => "Apple - I", - "apple2" => "Apple - II", - "apple2gs" => "Apple - II", - "apple3" => "Apple - III", - "aquarius" => "Mattel - Aquarius", - "arcadia" => "Emerson - Arcadia 2001", - "archimedes" => "Acorn - Archimedes", - "astrocde" => "Bally Professional - Arcade, Astrocade", - "atom" => "Acorn - Atom", - "atom_cass" => "Acorn - Atom", - "atom_flop" => "Acorn - Atom", - "atom_rom" => "Acorn - Atom", - "attache" => "Otrona - Attache", - "b2m" => "BNPO - Bashkiria-2M", - "bbc_32016_flop" => "Acorn - BBC, Electron", - "bbc_65c102_flop" => "Acorn - BBC, Electron", - "bbc_68000_flop" => "Acorn - BBC, Electron", - "bbc_80186_flop" => "Acorn - BBC, Electron", - "bbc_arm_flop" => "Acorn - BBC, Electron", - "bbc_flop_32016" => "Acorn - BBC, Electron", - "bbc_flop_6502" => "Acorn - BBC, Electron", - "bbc_flop_65c102" => "Acorn - BBC, Electron", - "bbc_flop_68000" => "Acorn - BBC, Electron", - "bbc_flop_80186" => "Acorn - BBC, Electron", - "bbc_flop_arm" => "Acorn - BBC, Electron", - "bbc_flop_torch" => "Acorn - BBC, Electron", - "bbc_flop_z80" => "Acorn - BBC, Electron", - "bbc_torch_flop" => "Acorn - BBC, Electron", - "bbc_z80_flop" => "Acorn - BBC, Electron", - "bbca_cass" => "Acorn - BBC, Electron", - "bbcb_cass" => "Acorn - BBC, Electron", - "bbcb_cass_de" => "Acorn - BBC, Electron", - "bbcb_de_cass" => "Acorn - BBC, Electron", - "bbcb_flop" => "Acorn - BBC, Electron", - "bbcb_flop_orig" => "Acorn - BBC, Electron", - "bbcb_flop_us" => "Acorn - BBC, Electron", - "bbcb_orig_flop" => "Acorn - BBC, Electron", - "bbcb_us_flop" => "Acorn - BBC, Electron", - "bbcbc" => "BBC - Bridge Companion", - "bbcm_cart" => "Acorn - BBC, Electron", - "bbcm_cass" => "Acorn - BBC, Electron", - "bbcm_flop" => "Acorn - BBC, Electron", - "bbcmc_flop" => "Acorn - BBC, Electron", - "bk0010" => "Elektronika - BK-0010", - "bml3_flop" => "Hitachi - Basic Master Level 3", - "bw12" => "Bondwell - 12", - "bw14" => "Bondwell - 14", - "bw2" => "Bondwell - 2", - "bx256hp_flop" => "Commodore - BX256-80HP, CBM 730", - "c128_cart" => "Commodore - 128", - "c128_flop" => "Commodore - 128", - "c128_rom" => "Commodore - 128", - "c64_cart" => "Commodore - 64", - "c64_cass" => "Commodore - 64", - "c64_flop" => "Commodore - 64", - "c65_flop" => "Commodore - 65", - "casloopy" => "Casio - Loopy", - "cbm2_cart" => "Commodore - CBM-II", - "cbm2_flop" => "Commodore - CBM-II", - "cbm8096_flop" => "Commodore - 8096", - "cbm8296_flop" => "Commodore - 8296", - "cc40_cart" => "Texas Instruments - CC-40", - "cd32" => "Commodore - Amiga", - "cdi" => "Philips - CD-i", - "cdtv" => "Commodore - Amiga", - "cgenie_cart" => "EACA - EG2000 Colour Genie", - "cgenie_cass" => "EACA - EG2000 Colour Genie", - "channelf" => "Fairchild - Channel F", - "coco_cart" => "Tandy Radio Shack - TRS-80 Color Computer", - "coco_flop" => "Tandy Radio Shack - TRS-80 Color Computer", - "coleco" => "Coleco - ColecoVision, ColecoVision ADAM", - "compclr2_flop" => "ISC - Compucolor II", - "compis" => "Telenova - Compis", - "comx35_flop" => "COMX - COMX-35", - "copera" => "Sega - PICO", - "cpc_cass" => "Amstrad - CPC", - "cpc_flop" => "Amstrad - CPC", - "crvision" => "VTech - CreatiVision", - "cx3000tc" => "Palson - CX 3000 Tele Computer", - "dai_cass" => "DAI - Personal Computer", - "database" => "Voltmace - Database", - "dim68k" => "Dimension - 68000", - "dmv" => "NCR - Decision Mate V", - "dps1" => "Ithaca InterSystems - DPS-1", - "ec1841" => "MPO BT - EC 1841", - "einstein" => "Tatung - Einstein TC-01", - "electron_cart" => "Acorn - BBC, Electron", - "electron_cass" => "Acorn - BBC, Electron", - "ep64_cart" => "Enterprise - 64, 128", - "ep64_cass" => "Enterprise - 64, 128", - "ep64_flop" => "Enterprise - 64, 128", - "epson_cpm" => "Epson - CPM", - "exl100" => "Exelvision - Exeltel, EXL100", - "famicom_cass" => "Nintendo - Famicom BASIC", - "famicom_flop" => "Nintendo - Famicom Disk System", - "fidel_scc" => "Fidelity - SCC", - "fm77av" => "Fujitsu - FM-77AV", - "fm7_cass" => "Fujitsu - FM-7", - "fm7_disk" => "Fujitsu - FM-7", - "fmtowns_cd" => "Fujitsu - FM Towns", - "g7400" => "Philips - Videopac+, Odyssey2", - "galaxy" => "Galaksija - Galaksija, Galaksija Plus", - "gamate" => "Bit Corp - Gamate", - "gameboy" => "Nintendo - Game Boy", - "gamecom" => "Tiger Electronics - Game.com", - "gamegear" => "Sega - Game Gear", - "gameking" => "TimeTop - GameKing", - "gameking3" => "TimeTop - GameKing", - "gamepock" => "Epoch - Game Pocket Computer", - "gba" => "Nintendo - Game Boy Advance", - "gbcolor" => "Nintendo - Game Boy Color", - "genius" => "VTech - Genius", - "gimix" => "Gimix - 6809", - "gjmovie" => "VTech - Genius", - "gl2000" => "VTech - Genius", - "gl6000sl" => "VTech - Genius", - "glcolor" => "VTech - Genius", - "gmaster" => "Hartung - Game Master", - "gp32" => "GamePark - GP32", - "guab" => "JPM - Give us a Break", - "gx4000" => "Amstrad - GX4000", - "h21" => "TRQ - Video Computer H-21", - "horizon" => "NorthStar - Horizon", - "hp9835a_rom" => "Hewlett-Packard - 9835", - "hp9845a_rom" => "Hewlett-Packard - 9845", - "hp9845b_rom" => "Hewlett-Packard - 9845", - "ht68k" => "Hawthorne Technologies - HT68K", - "i7000_card" => "Itautec - I-7000", - "ibm5140" => "IBM - PC Compatibles", - "ibm5150" => "IBM - PC Compatibles", - "ibm5150_cass" => "IBM - PC Compatibles", - "ibm5160_flop" => "IBM - PC Compatibles", - "ibm5170" => "IBM - PC Compatibles", - "ibm5170_cdrom" => "IBM - PC Compatibles", - "ibmpcjr_cart" => "IBM - PC Jr", - "ibmpcjr_flop" => "IBM - PC Jr", - "interact" => "Interact - Family Computer", - "intv" => "Mattel - Intellivision", - "intvecs" => "Mattel - Intellivision", - "iq128" => "VTech - Genius", - "iq151_cart" => "ZPA Novy Bor - IQ-151", - "iq151_flop" => "ZPA Novy Bor - IQ-151", - "jaguar" => "Atari - Jaguar", - "juicebox" => "Mattel - Juice Box", - "jupace_cass" => "Jupiter Cantab - Jupiter Ace", - "k28m2" => "Tiger Electronics - K28", - "kayproii" => "Kaypro - II", - "kc_cart" => "Robotron - KC85", - "kc_cass" => "Robotron - KC85", - "kc_flop" => "Robotron - KC85", - "korvet_flop" => "Moscow State University - Korvet", - "lantutor" => "Texas Instruments - Language Tutor", - "leapster" => "LeapFrog - Leapster Learning Game System", - "lisa" => "Apple - Lisa", - "lisa2" => "Apple - Lisa 2", - "lviv" => "Lviv - PC-01", - "lynx" => "Atari - Lynx", - "m20" => "Olivetti - M20", - "m5_cart" => "Sord - M5", - "m5_cass" => "Sord - M5", - "m5_flop" => "Sord - M5", - "mac_flop" => "Apple - Macintosh", - "mac_hdd" => "Apple - Macintosh", - "mbc200" => "Sanyo - MBC-200, MBC-1200", - "mbc55x" => "Sanyo - MBC-550, MBC-555", - "mc10" => "Tandy Radio Shack - TRS-80 MC-10", - "mc1000_cass" => "CCE - MC-1000", - "mc1502_flop" => "Elektronika - MC 1502", - "md2_flop" => "Morrow - Micro Decision MD-2", - "megacd" => "Sega - Mega-CD, Sega CD", - "megacdj" => "Sega - Mega-CD, Sega CD", - "megadriv" => "Sega - Mega Drive, Genesis", - "megaduck" => "Creatronic - Mega Duck, Cougar Boy", - "megapc" => "Amstrad - Mega PC", - "megatech" => "Sega - Megatech", - "microvision" => "Milton Bradley - MicroVision", - "mikro80" => "Radio-86RK - Mikro-80", - "mikrosha_cart" => "Radio-86RK - Mikrosha", - "mikrosha_cass" => "Radio-86RK - Mikrosha", - "misterx" => "Yeno - MisterX", - "mm1_flop" => "Nokia - MikroMikko 1", - "mo5_cart" => "Thomson - 8bit", - "mpu1000" => "Acetronic - MPU-1000", - "mpz80" => "Morrow - MPZ80", - "msx1_cart" => "Microsoft - MSX, MSX 2", - "msx1_cass" => "Microsoft - MSX, MSX 2", - "msx1_flop" => "Microsoft - MSX, MSX 2", - "msx2_cart" => "Microsoft - MSX, MSX 2", - "msx2_cass" => "Microsoft - MSX, MSX 2", - "msx2_flop" => "Microsoft - MSX, MSX 2", - "msx2p_flop" => "Microsoft - MSX, MSX 2", - "msxr_flop" => "Microsoft - MSX, MSX 2", - "mtx_cass" => "Memotech - MTX512", - "myvision" => "Nichibutsu - My Vision", - "mz2000_cass" => "Sharp - MZ-2000", - "mz2000_flop" => "Sharp - MZ-2000", - "mz2500" => "Sharp - MZ-2500", - "mz700_cass" => "Sharp - MZ-700", - "mz800_cass" => "Sharp - MZ-800, MZ-1500", - "n64" => "Nintendo - Nintendo 64", - "n64dd" => "Nintendo - Nintendo 64DD", - "nascom_flop" => "Nascom - I, II", - "nascom_socket" => "Nascom - I, II", - "neocd" => "SNK - Neo Geo CD", - "neogeo" => "SNK - Neo Geo", - "nes" => "Nintendo - Nintendo Entertainment System", - "nes_ade" => "Nintendo - Nintendo Entertainment System", - "nes_datach" => "Nintendo - Nintendo Entertainment System", - "nes_kstudio" => "Nintendo - Nintendo Entertainment System", - "nes_ntbrom" => "Nintendo - Nintendo Entertainment System", - "next" => "NeXT - NeXT", - "ngp" => "SNK - Neo Geo Pocket", - "ngpc" => "SNK - Neo Geo Pocket Color", - "nimbus" => "RM - Nimbus PC", - "odyssey2" => "Philips - Videopac+, Odyssey2", - "ondra" => "Tesla - Ondra, Ondra ViLi", - "orao" => "PEL Varazdin - Orao", - "orion_cart" => "Orion - Orion 128, OrionPro", - "orion_cass" => "Orion - Orion 128, OrionPro", - "orion_flop" => "Orion - Orion 128, OrionPro", - "orionpro_flop" => "Orion - Orion 128, OrionPro", - "osborne1" => "OCC - Osborne 1, 2, 3, 4", - "osborne2" => "OCC - Osborne 1, 2, 3, 4", - "p500_flop" => "Commodore - P500", - "partner_cass" => "Radio-86RK - Partner-01.01", - "partner_flop" => "Radio-86RK - Partner-01.01", - "pasogo" => "Koei - PasoGo", - "pb2000c" => "Casio - PB-2000C", - "pc1000" => "VTech - PreComputer 1000", - "pc1512" => "Amstrad - PC1512", - "pc1640" => "Amstrad - PC1640", - "pc8201" => "NEC - PC-8201", - "pc8801_cass" => "NEC - PC-8801", - "pc8801_flop" => "NEC - PC-8801", - "pc88va" => "NEC - PC-88VA", - "pc98" => "NEC - PC-9801", - "pce" => "NEC - PC Engine, TurboGrafx 16", - "pcecd" => "NEC - PC Engine CD, TurboGrafx 16 CD", - "pcw" => "Amstrad - PCW", - "pcw16" => "Amstrad - PCW", - "pecom_cass" => "Elektronska Industrija Nis - PECOM 32, 64", - "pegasus_cart" => "Technosys - Aamber Pegasus", - "pencil2" => "Hanimex - Pencil II", - "pentagon_cass" => "Pentagon - 1024SL", - "pet_cass" => "Commodore - PET", - "pet_flop" => "Commodore - PET", - "pet_hdd" => "Commodore - PET", - "pet_rom" => "Commodore - PET", - "pico" => "Sega - PICO", - "pippin" => "Bandai - Pippin", - "pippin_flop" => "Bandai - Pippin", - "plus4_cart" => "Commodore - Plus-4", - "plus4_cass" => "Commodore - Plus-4", - "plus4_flop" => "Commodore - Plus-4", - "pmd85_cass" => "Tesla - PMD 85", - "pockchalv1" => "Benesse - Pocket Challenge V", - "pockchalv2" => "Benesse - Pocket Challenge V", - "pokemini" => "Nintendo - Pokemon Mini", - "pro128_cart" => "Olivetti - Prodest PC 128", - "pro128s_flop" => "Olivetti - Prodest PC 128", - "prof180" => "Conitec - PROF-180", - "prof80" => "Conitec - PROF-80", - "psion1" => "Psion - Organiser I", - "psion2" => "Psion - Organiser II", - "psx" => "Sony - PlayStation", - "pt68k2" => "Peripheral Technology - PT68K", - "pv1000" => "Casio - PV-1000", - "pv2000" => "Casio - PV-2000", - "px4_cart" => "Epson - PX-4", - "pyl601" => "SASDF - Pyldin-601", - "ql_cart" => "Sinclair - QL", - "ql_cass" => "Sinclair - QL", - "ql_flop" => "Sinclair - QL", - "qx10_flop" => "Epson - QX-10", - "r9751" => "ROLM - CBX 9751", - "radio86_cart" => "Radio-86RK - Radio-86RK", - "radio86_cass" => "Radio-86RK - Radio-86RK", - "rainbow" => "DEC - Rainbow 100", - "rwtrntcs" => "Rowtron - Television Computer System", - "rx78" => "Gundam - RX-78", - "sage2" => "Sage - Sage II", - "samcoupe_cass" => "MGT - Sam Coupe", - "samcoupe_flop" => "MGT - Sam Coupe", - "sat_cart" => "Sega - Saturn", - "saturn" => "Sega - Saturn", - "sawatte" => "Sega - PICO", - "sc3000_cart" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "sc3000_cass" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "scv" => "Epoch - Super Cassette Vision", - "segacd" => "Sega - Mega-CD, Sega CD", - "sf7000" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "sg1000" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "sgx" => "NEC - Super Grafx", - "smc777" => "Sony - SMC777", - "sms" => "Sega - Master System, Mark III", - "snes" => "Nintendo - Super Nintendo Entertainment System", - "snes_bspack" => "Nintendo - Super Nintendo Entertainment System", - "snes_strom" => "Nintendo - Super Nintendo Entertainment System", - "snes_vkun" => "Nintendo - Super Nintendo Entertainment System", - "snotec" => "Bandai - Super Note Club", - "snread" => "Texas Instruments - Speak & Read", - "snspell" => "Texas Instruments - Speak & Spell", - "socrates" => "VTech - Socrates", - "softbox" => "SSE - SoftBox", - "sol20_cass" => "PTC - Sol Terminal Computer SOL-20", - "sorcerer_cart" => "Exidy - Sorcerer", - "sorcerer_cass" => "Exidy - Sorcerer", - "sorcerer_flop" => "Exidy - Sorcerer", - "spc1000_cass" => "Samsung - SPC-1000", - "special_cass" => "Specialist - Specialist", - "special_flop" => "Specialist - Specialist", - "specpls3_flop" => "Sinclair - ZX Spectrum", - "spectrum_cart" => "Sinclair - ZX Spectrum", - "spectrum_cass" => "Sinclair - ZX Spectrum", - "st_cart" => "Atari - ST", - "st_flop" => "Atari - ST", - "studio2" => "RCA - Studio II", - "stv" => "Sega - Titan Video", - "super6" => "ADC - Super Six", - "superpet_flop" => "Commodore - SuperPET, MMF 9000", - "supracan" => "Funtech - Super Acan", - "sv8000" => "Bandai - Super Vision 8000", - "svi318_cart" => "Spectravideo - SVI-318, SVI-328", - "svi318_cass" => "Spectravideo - SVI-318, SVI-328", - "svi318_flop" => "Spectravideo - SVI-318, SVI-328", - "svision" => "Watara - Supervision", - "svmu" => "Sega - Visual Memory System", - "tandy200" => "Tandy Radio Shack - TRS-80 Model 200", - "tandy2k" => "Tandy Radio Shack - 2000", - "tandy6k" => "Tandy Radio Shack - 6000", - "tdv2324" => "Tandberg - TDV 2324", - "tek4052_cart" => "Tektronix - 4052", - "tg16" => "NEC - PC Engine, TurboGrafx 16", - "ti74_cart" => "Texas Instruments - TI-74", - "ti99_cart" => "Texas Instruments - TI-99 4A", - "tiki100" => "Tiki Data - Kontiki-100, Tiki-100", - "timex_dock" => "Timex - TS-2068", - "tntell" => "Texas Instruments - Touch & Tell", - "to770_cart" => "Thomson - 8bit", - "to7_cart" => "Thomson - 8bit", - "trs80m2" => "Tandy Radio Shack - TRS-80 Model II", - "trsm100" => "Tandy Radio Shack - TRS-80 Model 100", - "tutor" => "Tomy - Tutor, Pyuuta", - "tvc_cart" => "Videoton - TV-Computer", - "tvc_cass" => "Videoton - TV-Computer", - "tvc_flop" => "Videoton - TV-Computer", - "unichamp" => "Unisonic - Champion 2711", - "ut88" => "Radio-86RK - YuT-88", - "uzebox" => "Uzebox - Uzebox", - "v1050_flop" => "Visual Technology - Visual 1050", - "v1050_hdd" => "Visual Technology - Visual 1050", - "vboy" => "Nintendo - Virtual Boy", - "vc4000" => "Interton - VC 4000", - "vector06_cart" => "Temirazov & Sokolov - Vector-06C", - "vectrex" => "GCE - Vectrex", - "vg5k" => "Philips - VG 5000", - "vic10" => "Commodore - VIC-10", - "vic1001_cart" => "Commodore - VIC-20", - "vic1001_cass" => "Commodore - VIC-20", - "vic1001_flop" => "Commodore - VIC-20", - "victor9k_flop" => "Sirius - Victor 9000", - "vidbrain" => "VideoBrain - Family Computer", - "vii" => "Chintendo - Vii", - "vip" => "RCA - Vip", - "visicom" => "Toshiba - Visicom", - "vixen" => "OCC - Osborne 1, 2, 3, 4", - "vreader" => "VTech - V.Reader, Storio", - "vsmile_cart" => "VTech - V.Smile, V.Disc", - "vsmile_cd" => "VTech - V.Smile, V.Disc", - "vz_cass" => "Dick Smith Electronics - VZ-200, VZ-300", - "wangpc" => "Wang - PC", - "wicat" => "Millennium Systems - Wicat", - "wmbullet" => "WaveMate - Bullet", - "wscolor" => "Bandai - WonderSwan Color", - "wswan" => "Bandai - WonderSwan", - "x07_card" => "Canon - X-07", - "x07_cass" => "Canon - X-07", - "x1_cass" => "Sharp - X1", - "x1_flop" => "Sharp - X1", - "x68k_flop" => "Sharp - X68000", - "xegs" => "Atari - 8bit", - "xerox820" => "Xerox - 820", - "xerox820ii" => "Xerox - 820 II", -); - -// No-Intro DAT name base mapping -$mapping_nointro = array ( - "Atari - 5200" => "Atari - 5200", - "Atari - 7800" => "Atari - 7800", - "Atari - Jaguar" => "Atari - Jaguar", - "Atari - Lynx" => "Atari - Lynx", - "Atari - ST" => "Atari - ST", - "Bandai - WonderSwan" => "Bandai - WonderSwan", - "Bandai - WonderSwan Color" => "Bandai - WonderSwan Color", - "Casio - Loopy" => "Casio - Loopy", - "Casio - PV-1000" => "Casio - PV-1000", - "Coleco - ColecoVision" => "Coleco - ColecoVision, ColecoVision ADAM", - "Commodore - 64" => "Commodore - 64", - "Commodore - 64 (PP)" => "Commodore - 64", - "Commodore - 64 (Tapes)" => "Commodore - 64", - "Commodore - Amiga" => "Commodore - Amiga", - "Commodore - Plus-4" => "Commodore - Plus-4", - "Commodore - VIC-20" => "Commodore - VIC-20", - "Emerson - Arcadia 2001" => "Emerson - Arcadia 2001", - "Entex - Adventure Vision" => "Entex - Adventure Vision", - "Epoch - Super Cassette Vision" => "Epoch - Super Cassette Vision", - "Fairchild - Channel F" => "Fairchild - Channel F", - "Funtech - Super Acan" => "Funtech - Super Acan", - "GamePark - GP32" => "GamePark - GP32", - "GCE - Vectrex" => "GCE - Vectrex", - "Hartung - Game Master" => "Hartung - Game Master", - "LeapFrog - Leapster Learning Game System" => "LeapFrog - Leapster Learning Game System", - "Magnavox - Odyssey2" => "Philips - Videopac+, Odyssey2", - "Microsoft - MSX" => "Microsoft - MSX, MSX 2", - "Microsoft - MSX 2" => "Microsoft - MSX, MSX 2", - "Microsoft - XBOX 360 (DLC)" => "Microsoft - Xbox 360", - "Microsoft - XBOX 360 (Games on Demand)" => "Microsoft - Xbox 360", - "Microsoft - XBOX 360 (Title Updates)" => "Microsoft - Xbox 360", - "NEC - PC Engine - TurboGrafx 16" => "NEC - PC Engine, TurboGrafx 16", - "NEC - Super Grafx" => "NEC - Super Grafx", - "Nintendo - Famicom Disk System" => "Nintendo - Famicom Disk System", - "Nintendo - Game Boy" => "Nintendo - Game Boy", - "Nintendo - Game Boy Advance" => "Nintendo - Game Boy Advance", - "Nintendo - Game Boy Advance (e-Cards)" => "Nintendo - Game Boy Advance", - "Nintendo - Game Boy Color" => "Nintendo - Game Boy Color", - "Nintendo - New Nintendo 3DS" => "Nintendo - Nintendo 3DS", - "Nintendo - New Nintendo 3DS (DLC)" => "Nintendo - Nintendo 3DS", - "Nintendo - Nintendo 3DS" => "Nintendo - Nintendo 3DS", - "Nintendo - Nintendo 3DS (DLC)" => "Nintendo - Nintendo 3DS", - "Nintendo - Nintendo 64" => "Nintendo - Nintendo 64", - "Nintendo - Nintendo 64DD" => "Nintendo - Nintendo 64DD", - "Nintendo - Nintendo DS" => "Nintendo - Nintendo DS", - "Nintendo - Nintendo DS Decrypted" => "Nintendo - Nintendo DS", - "Nintendo - Nintendo DS Encrypted" => "Nintendo - Nintendo DS", - "Nintendo - Nintendo DS (Download Play) (BETA)" => "Nintendo - Nintendo DS", - "Nintendo - Nintendo DSi" => "Nintendo - Nintendo DSi", - "Nintendo - Nintendo DSi Decrypted" => "Nintendo - Nintendo DSi", - "Nintendo - Nintendo DSi Encrypted" => "Nintendo - Nintendo DSi", - "Nintendo - Nintendo DSi (DLC)" => "Nintendo - Nintendo DSi", - "Nintendo - Nintendo Entertainment System" => "Nintendo - Nintendo Entertainment System", - "Nintendo - Nintendo Wii (DLC)" => "Nintendo - Nintendo Wii", - "Nintendo - Pokemon Mini" => "Nintendo - Pokemon Mini", - "Nintendo - Satellaview" => "Nintendo - Super Nintendo Entertainment System", - "Nintendo - Sufami Turbo" => "Nintendo - Super Nintendo Entertainment System", - "Nintendo - Super Nintendo Entertainment System" => "Nintendo - Super Nintendo Entertainment System", - "Nintendo - Virtual Boy" => "Nintendo - Virtual Boy", - "Nokia - N-Gage" => "Nokia - N-Gage", - "Philips - Videopac+" => "Philips - Videopac+, Odyssey2", - "RCA - Studio II" => "RCA - Studio II", - "Sega - 32X" => "Sega - 32X", - "Sega - Game Gear" => "Sega - Game Gear", - "Sega - Master System - Mark III" => "Sega - Master System, Mark III", - "Sega - Mega Drive - Genesis" => "Sega - Mega Drive, Genesis", - "Sega - PICO" => "Sega - PICO", - "Sega - SG-1000" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "Sinclair - ZX Spectrum +3" => "Sinclair - ZX Spectrum", - "Sony - PlayStation 3 (DLC)" => "Sony - PlayStation 3", - "Sony - PlayStation 3 (Downloadable)" => "Sony - PlayStation 3", - "Sony - PlayStation 3 (PSN)" => "Sony - PlayStation 3", - "Sony - PlayStation Portable" => "Sony - PlayStation Portable", - "Sony - PlayStation Portable (DLC)" => "Sony - PlayStation Portable", - "Sony - PlayStation Portable (PSN)" => "Sony - PlayStation Portable", - "Sony - PlayStation Portable (PSX2PSP)" => "Sony - PlayStation Portable", - "Sony - PlayStation Portable (UMD Music)" => "Sony - PlayStation Portable", - "Sony - PlayStation Portable (UMD Video)" => "Sony - PlayStation Portable", - "SNK - Neo Geo Pocket" => "SNK - Neo Geo Pocket", - "SNK - Neo Geo Pocket Color" => "SNK - Neo Geo Pocket Color", - "Tiger - Game.com" => "Tiger Electronics - Game.com", - "Tiger - Gizmondo" => "Tiger Telematics - Gizmondo", - "VTech - CreatiVision" => "VTech - CreatiVision", - "VTech - V.Smile" => "VTech - V.Smile, V.Disc", - "Watara - Supervision" => "Watara - Supervision", -); - -// Redump DAT name base mapping -$mapping_redump = array ( - "Apple - Macintosh" => "Apple - Macintosh", - "Arcade - Namco - Sega - Nintendo - Triforce" => "Namco - Triforce", - "Arcade - Sega - Chihiro" => "Sega - Chihiro", - "Arcade - Sega - Lindbergh" => "Sega - Lindbergh", - "Arcade - Sega - Naomi" => "Sega - Naomi, Naomi 2, Atomiswave", - "Bandai - Apple - Pippin" => "Bandai - Pippin", - "Bandai - Playdia" => "Bandai - Playdia", - "Commodore - Amiga CD" => "Commodore - Amiga", - "Commodore - Amiga CD32" => "Commodore - Amiga", - "Commodore - Amiga CDTV" => "Commodore - Amiga", - "Fujitsu - FM-Towns" => "Fujitsu - FM Towns", - "IBM - PC compatible" => "IBM - PC Compatibles", - "Mattel - HyperScan" => "Mattel - HyperScan", - "Microsoft - Xbox - BIOS Images" => "Microsoft - Xbox", - "Microsoft - Xbox" => "Microsoft - Xbox", - "Microsoft - Xbox 360" => "Microsoft - Xbox 360", - "Microsoft - Xbox One" => "Microsoft - Xbox One", - "NEC - PC Engine CD - TurboGrafx-CD" => "NEC - PC Engine CD, TurboGrafx 16 CD", - "NEC - PC-88 series" => "NEC - PC-8801", - "NEC - PC-98 series" => "NEC - PC-9801", - "NEC - PC-FX - PC-FXGA" => "NEC - PC FX, PC FXGA", - "Nintendo - GameCube - BIOS Images" => "Nintendo - GameCube", - "Nintendo - GameCube" => "Nintendo - GameCube", - "Nintendo - Wii" => "Nintendo - Nintendo Wii", - "Nintendo - Wii U" => "Nintendo - Nintendo Wii U", - "Palm" => "Hewlett-Packard - Palm", - "Panasonic - 3DO Interactive Multiplayer" => "Panasonic - 3DO Interactive Multiplayer", - "Philips - CD-i" => "Philips - CD-i", - "Sega - Dreamcast" => "Sega - Dreamcast", - "Sega - Mega-CD - Sega CD" => "Sega - Mega-CD, Sega CD", - "Sega - Saturn" => "Sega - Saturn", - "SNK - Neo Geo CD" => "SNK - Neo Geo CD", - "Sony - PlayStation - BIOS Images" => "Sony - PlayStation", - "Sony - PlayStation" => "Sony - PlayStation", - "Sony - PlayStation 2 - BIOS Images" => "Sony - PlayStation 2", - "Sony - PlayStation 2" => "Sony - PlayStation 2", - "Sony - PlayStation 3" => "Sony - PlayStation 3", - "Sony - PlayStation 4" => "Sony - PlayStation 4", - "Sony - PlayStation Portable" => "Sony - PlayStation Portable", - "VTech - V.Flash" => "VTech - V.Flash Home Edutainment System", -); - -// TOSEC DAT name base mapping -$mapping_tosec = array ( - "3DO 3DO Interactive Multiplayer" => "Panasonic - 3DO Interactive Multiplayer", - "APF Imagination Machine" => "APF - M-1000", - "Acorn Archimedes" => "Acorn - Archimedes", - "Acorn BBC" => "Acorn - BBC, Electron", - "Acorn BBC Micro" => "Acorn - BBC, Electron", - "Acorn Electron" => "Acorn - BBC, Electron", - "Altos Computer Systems ACS-186, 586 & 986" => "Altos Computer Systems - ACS-186, 586, 986", - "Altos Computer Systems ACS-8000" => "Altos Computer Systems - ACS-8000", - "Altos Computer Systems Series 5" => "Altos Computer Systems - Series 5", - "American Laser Games CD-ROM System" => "American Laser Games - CD-ROM System", - "Amstrad CPC" => "Amstrad - CPC", - "Amstrad GX4000" => "Amstrad - GX4000", - "Amstrad PCW" => "Amstrad - PCW", - "Apple 1" => "Apple - I", - "Apple I" => "Apple - I", - "Apple II" => "Apple - II", - "Apple IIGS" => "Apple - II", - "Apple III" => "Apple - III", - "Apple Lisa" => "Apple - Lisa", - "Apple Macintosh" => "Apple - Macintosh", - "Applied Technology MicroBee" => "Applied Technology - MicroBee", - "Atari 2600 & VCS" => "Atari - 2600", - "Atari 5200" => "Atari - 5200", - "Atari 7800" => "Atari - 7800", - "Atari 8bit" => "Atari - 8bit", - "Atari Jaguar CD" => "Atari - Jaguar CD", - "Atari Jaguar" => "Atari - Jaguar", - "Atari Lynx" => "Atari - Lynx", - "Atari ST" => "Atari - ST", - "Bally Midway Astrocade" => "Bally Professional - Arcade, Astrocade", - "Bally Professional Arcade & Astrocade" => "Bally Professional - Arcade, Astrocade", - "Bandai Pippin @World & Pippin Atmark" => "Bandai - Pippin", - "Bandai Pippin Atmark" => "Bandai - Pippin", - "Bandai Playdia" => "Bandai - Playdia", - "Bandai WonderSwan Color" => "Bandai - WonderSwan Color", - "Bandai WonderSwan" => "Bandai - WonderSwan", - "Bondwell 12" => "Bondwell - 12", - "Bondwell 2" => "Bondwell - 2", - "Bondwell Model 2" => "Bondwell - 2", - "CBS ColecoVision ADAM" => "Coleco - ColecoVision, ColecoVision ADAM", - "CBS ColecoVision" => "Coleco - ColecoVision, ColecoVision ADAM", - "Cambridge University EDSAC" => "University of Cambridge - EDSAC", - "Camputers Lynx" => "Camputers - Lynx", - "Capcom CP System III" => "Capcom - CPS III", - "Casio CFX-9850" => "Casio - CFX-9850", - "Casio Loopy" => "Casio - Loopy", - "Casio PB-1000" => "Casio - PB-1000", - "Casio PV-2000" => "Casio - PV-2000", - "Coleco ColecoVision ADAM" => "Coleco - ColecoVision, ColecoVision ADAM", - "Coleco ColecoVision" => "Coleco - ColecoVision, ColecoVision ADAM", - "Commodore Amiga CD32" => "Commodore - Amiga", - "Commodore Amiga CDTV" => "Commodore - Amiga", - "Commodore Amiga" => "Commodore - Amiga", - "Commodore C128" => "Commodore - 128", - "Commodore C16, C116 & Plus-4" => "Commodore - Plus-4", - "Commodore C64" => "Commodore - 64", - "Commodore C64DTV" => "Commodore - 64 DTV", - "Commodore C65" => "Commodore - 65", - "Commodore MAX Machine & VIC10" => "Commodore - VIC-10", - "Commodore PET" => "Commodore - PET", - "Commodore VIC10" => "Commodore - VIC-10", - "Commodore VIC20" => "Commodore - VIC-20", - "Creatronic Mega Duck & Cougar Boy" => "Creatronic - Mega Duck, Cougar Boy", - "Cybiko Cybiko" => "Cybiko - Cybiko", - "Cybiko Xtreme" => "Cybiko - Xtreme", - "DEC PDP-1" => "DEC - PDP-1", - "DEC PDP-10" => "DEC - PDP-10", - "DEC PDP-11" => "DEC - PDP-11", - "DEC PDP-12" => "DEC - PDP-12", - "DEC PDP-15" => "DEC - PDP-15", - "DEC PDP-7" => "DEC - PDP-7", - "DEC PDP-8" => "DEC - PDP-8", - "DEC PDP-9" => "DEC - PDP-9", - "Dragon 32 & 64" => "Dragon Data - Dragon", - "Dragon Data Dragon" => "Dragon Data - Dragon", - "EACA Colour Genie EG-2000" => "EACA - EG2000 Colour Genie", - "EACA EG2000 Colour Genie" => "EACA - EG2000 Colour Genie", - "ETL Mark 2" => "ETL - Mark II", - "ETL Mark 4" => "ETL - Mark IV", - "ETL Mark 4a" => "ETL - Mark IV A", - "ETL Mark II" => "ETL - Mark II", - "ETL Mark IV A" => "ETL - Mark IV A", - "ETL Mark IV" => "ETL - Mark IV", - "Elektronika BK-0010-0011M" => "Elektronika - BK-0010", - "Elektronika BK-0011-411" => "Elektronika - BK-0011", - "Elektronska Industrija Nis PECOM 32 & 64" => "Elektronska Industrija Nis - PECOM 32, 64", - "Emerson Arcadia 2001" => "Emerson - Arcadia 2001", - "Enterprise 64 & 128" => "Enterprise - 64, 128", - "Entex Adventure Vision" => "Entex - Adventure Vision", - "Epoch Super Cassette Vision" => "Epoch - Super Cassette Vision", - "Epson PX-8, HC-88 & Geneva" => "Epson - PX-8, HC-88, Geneva", - "Exelvision EXL100" => "Exelvision - Exeltel, EXL100", - "Exelvision Exeltel" => "Exelvision - Exeltel, EXL100", - "Exidy Sorcerer" => "Exidy - Sorcerer", - "FM Towns Marty" => "Fujitsu - FM Towns", - "Fairchild Channel F" => "Fairchild - Channel F", - "Fairchild Saba" => "Fairchild - Channel F", - "Fairchild VES & Channel F" => "Fairchild - Channel F", - "Front Fareast Magic Drive" => "Front Fareast - Magic Drive", - "Fuji C" => "Fuji Photo Film - FUJIC", - "Fuji Photo Film FUJIC" => "Fuji Photo Film - FUJIC", - "Fujitsu FM Towns" => "Fujitsu - FM Towns", - "Fujitsu FM-7" => "Fujitsu - FM-7", - "Funtech - Super Acan" => "Funtech - Super Acan", - "Funtech Super Acan" => "Funtech - Super Acan", - "GCE Vectrex" => "GCE - Vectrex", - "Galaksija Galaksija Plus" => "Galaksija - Galaksija, Galaksija Plus", - "Galaksija Galaksija" => "Galaksija - Galaksija, Galaksija Plus", - "Game Park GP32" => "GamePark - GP32", - "Hewlett-Packard HP48" => "Hewlett-Packard - HP48", - "Hewlett-Packard HP49" => "Hewlett-Packard - HP49", - "HomeLab BraiLab" => "HomeLab - BraiLab", - "HomeLab HomeLab" => "HomeLab - HomeLab", - "IBM PC Compatible" => "IBM - PC Compatibles", - "IBM PC Compatibles" => "IBM - PC Compatibles", - "IBM PCjr" => "IBM - PC Jr", - "Incredible Technologies Eagle" => "Incredible Technologies - Eagle", - "Infocom Z-Machine" => "Infocom - Z-Machine", - "Interact Family Computer" => "Interact - Family Computer", - "Jupiter Cantab Jupiter Ace" => "Jupiter Cantab - Jupiter Ace", - "Kaypro II" => "Kaypro - II", - "Keio University K-1" => "University of Keio - K-1", - "Konami Bemani System 573 Analog" => "Konami - System 573", - "Konami Bemani System 573 Digital" => "Konami - System 573", - "Konami System 573" => "Konami - System 573", - "Luxor ABC 80" => "Luxor - ABC 80", - "Luxor ABC 800" => "Luxor - ABC 800", - "Luxor Video Entertainment System" => "Luxor - Video Entertainment System", - "MGT Sam Coupe" => "MGT - Sam Coupe", - "MITS Altair 8800" => "MITS - Altair 8800", - "MSX MSX" => "Microsoft - MSX, MSX 2", - "MSX MSX2" => "Microsoft - MSX, MSX 2", - "MSX MSX2+" => "Microsoft - MSX, MSX 2", - "MSX Turbo-R" => "Microsoft - MSX, MSX 2", - "MSX TurboR" => "Microsoft - MSX, MSX 2", - "Magnavox Odyssey2" => "Philips - Videopac+, Odyssey2", - "Matra Hachette Alice 32" => "Matra Hachette - Alice 32 & 90", - "Matsushita National JR 200" => "Matsushita National - JR 200", - "Mattel Aquarius" => "Mattel - Aquarius", - "Mattel HyperScan" => "Mattel - HyperScan", - "Mattel Intellivision" => "Mattel - Intellivision", - "Memorex Video Information System" => "Memorex - Video Information System", - "Memotech MTX" => "Memotech - MTX512", - "Memotech MTX512" => "Memotech - MTX512", - "MicroBee" => "Applied Technology - MicroBee", - "Microkey Primo" => "Microkey - Primo", - "Miles Gordon Technology Sam Coupe" => "MGT - Sam Coupe", - "NCR Decision Mate V" => "NCR - Decision Mate V", - "NCR Decision V" => "NCR - Decision Mate V", - "NEC PC-6001" => "NEC - PC-6001", - "NEC PC-8001" => "NEC - PC-8001", - "NEC PC-8201" => "NEC - PC-8201", - "NEC PC-8801" => "NEC - PC-8801", - "NEC PC-88VA" => "NEC - PC-88VA", - "NEC PC-9801" => "NEC - PC-9801", - "NEC PC-9821" => "NEC - PC-9801", - "NEC PC-Engine & TurboGrafx-16" => "NEC - PC Engine, TurboGrafx 16", - "NEC PC-Engine CD & TurboGrafx-16 CD" => "NEC - PC Engine CD, TurboGrafx 16 CD", - "NEC PC-FX" => "NEC - PC FX, PC FXGA", - "NEC PC-FXGA" => "NEC - PC FX, PC FXGA", - "NEC PC6001" => "NEC - PC-6001", - "NEC SuperGrafx" => "NEC - Super Grafx", - "Nascom I & II" => "Nascom - I, II", - "Nintendo 64" => "Nintendo - Nintendo 64", - "Nintendo 64DD" => "Nintendo - Nintendo 64DD", - "Nintendo Famicom & Entertainment System" => "Nintendo - Nintendo Entertainment System", - "Nintendo Famicom Disk System" => "Nintendo - Famicom Disk System", - "Nintendo Game Boy Advance" => "Nintendo - Game Boy Advance", - "Nintendo Game Boy Color" => "Nintendo - Game Boy Color", - "Nintendo Game Boy" => "Nintendo - Game Boy", - "Nintendo GameCube" => "Nintendo - GameCube", - "Nintendo N64" => "Nintendo - Nintendo 64", - "Nintendo Pokemon Mini" => "Nintendo - Pokemon Mini", - "Nintendo Super Famicom & Super Entertainment System" => "Nintendo - Super Nintendo Entertainment System", - "Nintendo Super Famicom" => "Nintendo - Super Nintendo Entertainment System", - "Nintendo Virtual Boy" => "Nintendo - Virtual Boy", - "OCC Osborne 1 & Osborne Executive" => "OCC - Osborne 1, 2, 3, 4", - "OpenPandora Pandora" => "OpenPandora - Pandora", - "Osborne OSBORNE 1 & Executive" => "OCC - Osborne 1, 2, 3, 4", - "Othello Multivision" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "PEL Varazdin Orao" => "PEL Varazdin - Orao", - "PTC Sol Terminal Computer SOL-20" => "PTC - Sol Terminal Computer SOL-20", - "Philips CD-i" => "Philips - CD-i", - "Philips G7000" => "Philips - Videopac+, Odyssey2", - "Philips P2000" => "Philips - P2000", - "Philips P2000T" => "Philips - P2000", - "Philips VG 5000" => "Philips - VG 5000", - "Philips Videopac G7000" => "Philips - Videopac+, Odyssey2", - "Philips Videopac+" => "Philips - Videopac+, Odyssey2", - "Pioneer LaserActive" => "Pioneer - LaserActive", - "RCA Chip-8" => "RCA - Chip-8", - "RCA Studio II" => "RCA - Studio II", - "RCA Superchip" => "RCA - Superchip", - "REAL 3DO Interactive Multiplayer" => "Panasonic - 3DO Interactive Multiplayer", - "RM Nimbus PC" => "RM - Nimbus PC", - "RM Nimbus PC-186" => "RM - Nimbus PC", - "Radica Arcade Legends & Play TV Legends" => "Radica - Arcade Legends, Play TV Legends", - "Radio-86RK Apogej BK-01" => "Radio-86RK - Apogej BK-01", - "Radio-86RK Mikro-80" => "Radio-86RK - Mikro-80", - "Radio-86RK Mikrosha" => "Radio-86RK - Mikrosha", - "Radio-86RK Partner-01.01" => "Radio-86RK - Partner-01.01", - "Radio-86RK Radio-86RK" => "Radio-86RK - Radio-86RK", - "Radio-86RK YuT-88" => "Radio-86RK - YuT-88", - "Robotron HC900, KC85 2, KC85 3 & KC85 4" => "Robotron - KC85", - "Robotron KC Compact" => "Robotron - KC Compact", - "Robotron KC85 2-4" => "Robotron - KC85", - "Robotron Z1013" => "Robotron - Z1013", - "Robotron Z9001 & KC85 1" => "Robotron - KC85", - "Robotron Z9001" => "Robotron - KC85", - "SABA Videoplay" => "Fairchild - Channel F", - "SNK Hyper Neo-Geo 64" => "SNK - Hyper Neo Geo 64", - "SNK Neo-Geo CD" => "SNK - Neo Geo CD", - "SNK Neo-Geo Pocket Color" => "SNK - Neo Geo Pocket Color", - "SNK Neo-Geo Pocket" => "SNK - Neo Geo Pocket", - "Sega 32X" => "Sega - 32X", - "Sega Computer 3000" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "Sega Dreamcast" => "Sega - Dreamcast", - "Sega Game 1000" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "Sega Game Gear" => "Sega - Game Gear", - "Sega Mark III & Master System" => "Sega - Master System, Mark III", - "Sega Master System & Mark III" => "Sega - Master System, Mark III", - "Sega Mega Drive & Genesis" => "Sega - Mega Drive, Genesis", - "Sega Mega-CD & Sega CD" => "Sega - Mega-CD, Sega CD", - "Sega Mega-CD and Sega CD" => "Sega - Mega-CD, Sega CD", - "Sega NAOMI 2" => "Sega - Naomi, Naomi 2, Atomiswave", - "Sega NAOMI" => "Sega - Naomi, Naomi 2, Atomiswave", - "Sega NAOMI GD-ROM" => "Sega - Naomi, Naomi 2, Atomiswave", - "Sega Pico" => "Sega - PICO", - "Sega Saturn" => "Sega - Saturn", - "Sega Super Control Station" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "Sega Visual Memory System" => "Sega - Visual Memory System", - "Sega Visual Memory Unit" => "Sega - Visual Memory System", - "Sega WonderMega" => "Sega - Mega-CD, Sega CD", - "Sharp MZ-700" => "Sharp - MZ-700", - "Sharp MZ-800 & MZ-1500" => "Sharp - MZ-800, MZ-1500", - "Sharp X1 Turbo" => "Sharp - X1", - "Sharp X1" => "Sharp - X1", - "Sharp X68000" => "Sharp - X68000", - "Sinclair QL" => "Sinclair - QL", - "Sinclair ZX Spectrum" => "Sinclair - ZX Spectrum", - "Sinclair ZX-81" => "Sinclair - ZX81", - "Sinclair ZX81" => "Sinclair - ZX81", - "Sony PlayStation 2" => "Sony - PlayStation 2", - "Sony PlayStation" => "Sony - PlayStation", - "Sony PocketStation" => "Sony - PocketStation", - "Sord M5" => "Sord - M5", - "Spectravideo SVI 318 & SVI 328" => "Spectravideo - SVI-318, SVI-328", - "Spectravideo SVI 318-328" => "Spectravideo - SVI-318, SVI-328", - "Spectravideo SVI-318 & SVI-328" => "Spectravideo - SVI-318, SVI-328", - "TESLA PMD-85" => "Tesla - PMD 85", - "Tandy MC-10" => "Tandy Radio Shack - TRS-80 MC-10", - "Tandy Radio Shack - CoCo" => "Tandy Radio Shack - TRS-80 Color Computer", - "Tandy Radio Shack - TRS-80 - Model 1" => "Tandy Radio Shack - TRS-80 Model I", - "Tandy Radio Shack - TRS-80 - Model 3" => "Tandy Radio Shack - TRS-80 Model III", - "Tandy Radio Shack - TRS-80 - Model 4" => "Tandy Radio Shack - TRS-80 Model IV", - "Tandy Radio Shack - TRS-80 Color Computer" => "Tandy Radio Shack - TRS-80 Color Computer", - "Tandy Radio Shack - TRS-80 MC-10" => "Tandy Radio Shack - TRS-80 MC-10", - "Tandy Radio Shack - TRS-80 Model 4" => "Tandy Radio Shack - TRS-80 Model IV", - "Tandy Radio Shack - TRS-80 Model I" => "Tandy Radio Shack - TRS-80 Model I", - "Tandy Radio Shack - TRS-80 Model III" => "Tandy Radio Shack - TRS-80 Model III", - "Tandy Radio Shack TRS-80 Color Computer" => "Tandy Radio Shack - TRS-80 Color Computer", - "Tandy Radio Shack TRS-80 MC-10" => "Tandy Radio Shack - TRS-80 MC-10", - "Tandy Radio Shack TRS-80 Model 100" => "Tandy Radio Shack - TRS-80 Model 100", - "Tandy Radio Shack TRS-80 Model 4" => "Tandy Radio Shack - TRS-80 Model IV", - "Tandy Radio Shack TRS-80 Model I" => "Tandy Radio Shack - TRS-80 Model I", - "Tandy Radio Shack TRS-80 Model III" => "Tandy Radio Shack - TRS-80 Model III", - "Tangerine MICROTAN 65" => "Tangerine - Microtan 65", - "Tangerine Microtan 65" => "Tangerine - Microtan 65", - "Tangerine ORIC 1-Atmos-Telestrat" => "Tangerine - Oric-1, Oric Atmos", - "Tangerine Oric-1 & Atmos" => "Tangerine - Oric-1, Oric Atmos", - "Tangerine Oric-1 & Oric Atmos" => "Tangerine - Oric-1, Oric Atmos", - "Tatung Einstein TC-01" => "Tatung - Einstein TC-01", - "Technosys Aamber Pegasus" => "Technosys - Aamber Pegasus", - "Tesla PMD 85" => "Tesla - PMD 85", - "Texas Instruments CC-40" => "Texas Instruments - CC-40", - "Texas Instruments TI-73" => "Texas Instruments - TI-73", - "Texas Instruments TI-80" => "Texas Instruments - TI-80", - "Texas Instruments TI-81" => "Texas Instruments - TI-81", - "Texas Instruments TI-82" => "Texas Instruments - TI-82", - "Texas Instruments TI-83" => "Texas Instruments - TI-83", - "Texas Instruments TI-85" => "Texas Instruments - TI-85", - "Texas Instruments TI-86" => "Texas Instruments - TI-86", - "Texas Instruments TI-89" => "Texas Instruments - TI-89", - "Texas Instruments TI-92" => "Texas Instruments - TI-92", - "Texas Instruments TI-99 4A" => "Texas Instruments - TI-99 4A", - "Texas Instruments TI-99-4A+" => "Texas Instruments - TI-99 4A", - "Texas Instruments TI73" => "Texas Instruments - TI-73", - "Texas Instruments TI80" => "Texas Instruments - TI-80", - "Thomson MO5" => "Thomson - 8bit", - "Thomson MO6" => "Thomson - 8bit", - "Thomson TO7" => "Thomson - 8bit", - "Thomson TO8" => "Thomson - 8bit", - "Thomson TO9+" => "Thomson - 8bit", - "Tiger Game.com" => "Tiger Electronics - Game.com", - "Tiki Data Kontiki-100 & Tiki-100" => "Tiki Data - Kontiki-100, Tiki-100", - "Tomy KISS-Site" => "Tomy - Kiss-site", - "Tomy Tutor & Pyuuta" => "Tomy - Tutor, Pyuuta", - "Tsukuda Original Othello Multivision" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "Tsukuda Othello Multivision" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "University of Cambridge EDSAC" => "University of Cambridge - EDSAC", - "University of Tokyo PC-1" => "University of Tokyo - PC-1", - "VM Labs Nuon" => "VM Labs - Nuon", - "VTech Creativision" => "VTech - CreatiVision", - "VTech Laser 200" => "VTech - Laser", - "VTech Laser 2001 & CreatiVision" => "VTech - CreatiVision", - "VTech Laser 310" => "VTech - Laser", - "VTech V.Flash Home Edutainment System" => "VTech - V.Flash Home Edutainment System", - "Videoton TV Computer 64" => "Videoton - TV-Computer", - "Videoton TV-Computer" => "Videoton - TV-Computer", - "Visual Technology Visual 1050" => "Visual Technology - Visual 1050", - "Wang VS" => "Wang - VS", - "Watara Supervision" => "Watara - Supervision", - "ZAPiT Games Game Wave Family Entertainment System" => "ZAPiT Games - Game Wave Family Entertainment System", -); - -// TruRip DAT name base mapping -$mapping_trurip = array ( - "Acorn Archimedes" => "Acorn - Archimedes", - "Acorn Archimedes CD" => "Acorn - Archimedes", - "Acorn BBC Microcomputer System" => "Acorn - BBC, Electron", - "American Laser Games American Laser Games (Arcade)" => "American Laser Games - CD-ROM System", - "Amstrad GX4000" => "Amstrad - GX4000", - "Andamiro Pump It Up (Arcade)" => "Andamiro - Pump It Up", - "Apple Macintosh CD" => "Apple - Macintosh", - "Atari 5200" => "Atari - 5200", - "Atari 7800" => "Atari - 7800", - "Atari Jaguar CD" => "Atari - Jaguar CD", - "Atari Lynx" => "Atari - Lynx", - "Bandai Pippin @World & Atmark" => "Bandai - Pippin", - "Bandai Playdia" => "Bandai - Playdia", - "Bandai WonderSwan Color (SwanCrystal)" => "Bandai - WonderSwan Color", - "Bandai WonderSwan" => "Bandai - WonderSwan", - "Capcom CP SYSTEM III" => "Capcom - CPS III", - "Capcom CP SYSTEM III (CPS3)" => "Capcom - CPS III", - "Commodore Amiga CD" => "Commodore - Amiga", - "Commodore Amiga CD32" => "Commodore - Amiga", - "Commodore Amiga CDTV" => "Commodore - Amiga", - "Fairchild Channel F (Video Entertainment System)" => "Fairchild - Channel F", - "Fujitsu FM Towns (Marty)" => "Fujitsu - FM Towns", - "IBM Compatible IBM PC compatible" => "IBM - PC Compatibles", - "IBM PC Compatible IBM PC compatible" => "IBM - PC Compatibles", - "Incredible Technologies IT Eagle" => "Incredible Technologies - Eagle", - "Incredible Technologies IT PC" => "Incredible Technologies - PC", - "Konami Bemani FireBeat" => "Konami - Bemani FireBeat", - "Konami Bemani Twinkle" => "Konami - Bemani Twinkle", - "Konami M2" => "Panasonic - 3DO M2", - "Konami System 573" => "Konami - System 573", - "Mattel HyperScan" => "Mattel - HyperScan", - "Memorex VIS interactive Video Information" => "Memorex - Video Information System", - "MSX MSX CD" => "Microsoft - MSX, MSX 2", - "Namco - Sega - Nintendo Triforce" => "Namco - Triforce", - "Namco System 2x6" => "Namco - System 246, System 256", - "NCR Decision Mate V" => "NCR - Decision Mate V", - "NEC PC Engine CD & TurboGrafx CD" => "NEC - PC Engine CD, TurboGrafx 16 CD", - "NEC PC-FX" => "NEC - PC FX, PC FXGA", - "NEC PC-FXGA" => "NEC - PC FX, PC FXGA", - "Panasonic 3DO Interactive Multiplayer" => "Panasonic - 3DO Interactive Multiplayer", - "Philips CD-i & VCD" => "Philips - CD-i", - "Philips Videopac + G7400" => "Philips - Videopac+, Odyssey2", - "Sega Chihiro" => "Sega - Chihiro", - "Sega Dreamcast" => "Sega - Dreamcast", - "Sega Lindbergh" => "Sega - Lindbergh", - "Sega Mega-CD & Sega CD" => "Sega - Mega-CD, Sega CD", - "Sega Mega-CD & Sega CD - Games" => "Sega - 32X CD", - "Sega NAOMI 2" => "Sega - Naomi, Naomi 2, Atomiswave", - "Sega NAOMI" => "Sega - Naomi, Naomi 2, Atomiswave", - "Sega RingWide" => "Sega - RingWide", - "Sega Saturn" => "Sega - Saturn", - "Sharp X1" => "Sharp - X1", - "SNK Neo-Geo CD" => "SNK - Neo Geo CD", - "Sony PlayStation & PSone" => "Sony - PlayStation", - "Sord CGL M 5 (M 5, Game M 5)" => "Sord - M5", - "Spectravideo SV-318 & SV-328" => "Spectravideo - SVI-318, SVI-328", - "Tesla PMD-85" => "Tesla - PMD 85", - "Tiger Game.com" => "Tiger Electronics - Game.com", - "Tomy Grandstand Tutor (Tutor, Pyuuta)" => "Tomy - Tutor, Pyuuta", - "Tomy Kiss-site" => "Tomy - Kiss-site", - "Tsukuda Original Othello Multivision" => "Sega - SG-1000, SC-3000, SF-7000, Othello Multivision", - "Videoton TV-Computer" => "Videoton - TV-Computer", - "VM Labs Nuon" => "VM Labs - Nuon", - "VTech V.Flash Home Edutainment System" => "VTech - V.Flash Home Edutainment System", - "Wang VS" => "Wang - VS", - "Watara SuperVision (Quickshot, Hartung SV-100, HiperVision, Tiger Boy)" => "Watara - Supervision", - "ZAPiT Games Game Wave Family Entertainment System" => "ZAPiT Games - Game Wave Family Entertainment System", -); - -?> \ No newline at end of file diff --git a/index.php b/index.php index 3715a4d..e7f0409 100644 --- a/index.php +++ b/index.php @@ -14,7 +14,6 @@ ob_start(); Welcome to the WoD Revival homepage! - -

Access administrative functions (admin/admin)

"; } diff --git a/pages/generate.php b/pages/generate.php deleted file mode 100644 index d47c14f..0000000 --- a/pages/generate.php +++ /dev/null @@ -1,723 +0,0 @@ - "a7800.xml", - "228" => "fds.xml", - "31" => "lynx.xml", - "0" => "mega.xml", // Merged version of all other headers - "234" => "n64.xml", - "238" => "nes.xml", - "241" => "snes.xml", // Self-created to deal with various headers -); - -ini_set('max_execution_time', 0); // Set the execution time to infinite. This is a bad idea in production. -ini_set("memory_limit", "-1"); // Set the maximum memory to infinite. This is a bad idea in production. - -//Get the values for all parameters -foreach ($getvars as $var) -{ - $$var = (isset($_GET[$var]) ? trim($_GET[$var]) : ""); -} - -//Get the values for all parameters -foreach ($postvars as $var) -{ - $$var = (isset($_POST[$var]) ? trim($_POST[$var]) : ""); -} - -// Specifically deal with MEGA being set -if ($mega == "1") -{ - $system = ""; - $source = ""; -} - -// If not generating or creating MEGAMERGED, show the list of all available DATs -if ($generate != "1" && $mega != "1" && $auto != "1") -{ - echo <<Export to Datfile - - - -
SystemSource
-
-
- -
-
"; - - // If the system is set, it takes precidence in DAT creation - if ($system != "") - { - echo << - - -

Sources:

-All sources OR Select a source below:

\n - -EOL; - - $query = "SELECT DISTINCT sources.id, sources.name - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - WHERE systems.id=".$system. - " ORDER BY sources.name"; - $result = mysqli_query($link, $query); - - while($src = mysqli_fetch_assoc($result)) - { - echo "".$src["name"]."
"; - } - } - - // If the source is set, show all values for the source - else if ($source != "") - { - echo << - - -

Systems:

-All systems OR Select a system below:

\n - -EOL; - - $query = "SELECT DISTINCT systems.id, systems.manufacturer, systems.system - FROM sources - JOIN games - ON sources.id=games.source - JOIN systems - ON games.system=systems.id - WHERE sources.id=".$source. - " ORDER BY systems.manufacturer, systems.system"; - $result = mysqli_query($link, $query); - - while($sys = mysqli_fetch_assoc($result)) - { - echo "".$sys["manufacturer"]." - ".$sys["system"]."
"; - } - } - - echo "

Datfile format:

-XML Format
-Old Format

- -

-Create DAT of all available files
"; -} - -// If auto is set, create all DATs and zip for distribution -elseif ($auto == "1") -{ - echo "

Generate All DATs

"; - - $query = "SELECT DISTINCT systems.id, systems.manufacturer, systems.system - FROM systems - JOIN games - ON systems.id=games.system - ORDER BY systems.manufacturer, systems.system"; - $result = mysqli_query($link, $query); - - // Generate system-merged and custom DATs - while($sys = mysqli_fetch_assoc($result)) - { - echo "Beginning generate ".$sys["manufacturer"]." - ".$sys["system"]." (merged)
\n"; - generate_dat($sys["id"], ""); - sleep(2); - - $squery = "SELECT DISTINCT sources.id, sources.name - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - WHERE systems.id=".$sys["id"]." - ORDER BY sources.name"; - $sresult = mysqli_query($link, $squery); - - while($src = mysqli_fetch_assoc($sresult)) - { - // If the source is not one of the import-only ones - if ((int) $src["id"] > 14) - { - echo "Beginning generate ".$sys["manufacturer"]." - ".$sys["system"]." (".$src["name"].")
\n"; - generate_dat($sys["id"], $src["id"]); - sleep(2); - } - } - - // Free up some memory if possible - unset($sresult); - } - - // Free up some memory if possible - unset($result); - - // Generate source-merged DATs - $query = "SELECT DISTINCT sources.id, sources.name - FROM sources - JOIN games - ON sources.id=games.source - ORDER BY sources.name"; - $result = mysqli_query($link, $query); - - while($src = mysqli_fetch_assoc($result)) - { - echo "Beginning generate ALL (".$src["name"].")
\n"; - generate_dat("", $src["id"]); - sleep(2); - } - - // Free up some memory if possible - unset($result); - - // Create the MEGAMERGED as part of the generation process - echo "Beginning generate ALL (merged)
\n"; - generate_dat("", ""); - - //echo "Creating new zipfile...
\n"; - $zip = new ZipArchive(); - $zip->open("temp/dats-".date("Ymd").".zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); - - // Seems unnecessary, but helps make sure the zipfile is populated correctly - $zip->addEmptyDir("merged-system"); - $zip->addEmptyDir("merged-source"); - $zip->addEmptyDir("custom"); - - //echo "Zipfile created successfully!
\n"; - foreach (scandir("temp/output") as $item) - { - if (strpos($item, ".xml") !== FALSE || strpos($item, ".dat") !== FALSE) - { - //echo "Adding ".$item."
\n"; - $zip->addFile("temp/output/".$item, - (strpos($item, "ALL (merged") !== FALSE ? $item : - (strpos($item, "merged") !== FALSE ? "merged-system/".$item : - (strpos($item, "ALL") !== FALSE ? "merged-source/".$item : "custom/".$item)))); - } - } - - $zip->close(); - - // http://php.net/manual/en/function.unlink.php#109971 - array_map("unlink", glob("temp/output/*.*")); -} - -// If we are generating an individual DAT -elseif ($generate == "1" || $mega == "1") -{ - $systems = array(); - $sources = array(); - - // If we have a source, treat all POST vars as systems - if ($system == "" && $source != "") - { - $sources = $source; - - if ($all == "1") - { - $systems = ""; - } - else - { - foreach ($_POST as $key => $value) - { - if (!in_array($key, $postvars) && $value == "1") - { - $systems[] = $key; - } - } - - $systems = implode(", ", $systems); - } - } - // If we have a system, treat all POST vars as sources - elseif ($system != "" && $source == "") - { - $systems = $system; - - if ($all == "1") - { - $sources = ""; - } - else - { - foreach ($_POST as $key => $value) - { - if (!in_array($key, $postvars) && $value == "1") - { - $sources[] = $key; - } - } - - $sources = implode(", ", $sources); - } - } - // If we have neither, then it's MEGA - else - { - $systems = ""; - $sources = ""; - } - - // If the source is not one of the import-only ones - if (!($sources != "" && sizeof(explode(", ", $sources)) == 1 && (int) $sources <= 14)) - { - generate_dat($systems, $sources, true); - } - exit(); -} - -/* - If just the source is set, create a DAT that has each game suffixed by system and merged - If just the system is set, create a DAT that has each game suffixed by source and merged (merged) - If both system and source are set, create a DAT that has each rom unsuffixed and unmerged (custom) - */ -function generate_dat ($systems, $sources, $lone = false) -{ - global $link, $headers; - - // Get the systems and sources names for the given inputs - $querysy = "SELECT manufacturer, system FROM systems WHERE id IN (".$systems.")"; - $resultsy = mysqli_query($link, $querysy); - - $syslist = ""; - // If the result has data, populate the srclist - if (gettype($resultsy) != "boolean" && mysqli_num_rows($resultsy) > 0) - { - $syslist = array(); - while ($sys = mysqli_fetch_assoc($resultsy)) - { - $syslist[] = $sys["manufacturer"]." - ".$sys["system"]; - } - $syslist = implode("; ", (sizeof($syslist) > 3 ? array($syslist[0], $syslist[1], "etc.") : $syslist)); - } - - // Free up some memory if possible - unset($resultsy); - - $queryso = "SELECT name FROM sources WHERE id IN (".$sources.")"; - $resultso = mysqli_query($link, $queryso); - - $srclist = ""; - // If the result has data, populate the srclist - if (gettype($resultso) != "boolean" && mysqli_num_rows($resultso) > 0) - { - $srclist = array(); - while ($src = mysqli_fetch_assoc($resultso)) - { - $srclist[] = $src["name"]; - } - $srclist = implode("; ", (sizeof($srclist) > 3 ? array($srclist[0], $srclist[1], "etc.") : $srclist)); - } - - // Free up some memory if possible - unset($resultso); - - // Retrieve the roms in a preprocessed order - $roms = process_roms($systems, $sources); - - $version = date("YmdHis"); - - // Create a name for the file based on the retrieved information - $datname = ($syslist != "" ? $syslist : "ALL")." (".($srclist != "" ? $srclist : "merged")." ".$version.")"; - - // Create and open an output file for writing (currently uses current time, change to "last updated time" - if ($lone) - { - ob_end_clean(); - - //First thing first, push the http headers - header('content-type: application/x-gzip'); - header('Content-Disposition: attachment; filename="'.$datname.($old == "1" ? ".dat" : ".xml").'.gz"'); - } - else - { - echo "Opening file for writing: temp/output/".$datname.($old == "1" ? ".dat" : ".xml")."
\n"; - $handle = fopen("temp/output/".$datname.($old == "1" ? ".dat" : ".xml"), "w"); - } - - // Temporarilly set $system if we're in MEGAMERGED mode to get the right header skip XML - if ($systems == "" && $sources == "") - { - $systems = "0"; - } - - $header_old = "clrmamepro ( - name \"".htmlspecialchars($datname)."\" - description \"".htmlspecialchars($datname)."\" - version \"".$version."\" - ".($system != "" && array_key_exists($systems, $headers) ? " header \"".$headers[$systems]."\"" : "")." - comment \"\" - author \"The Wizard of DATz\" -)\n"; - - $header = " - - - -
- ".htmlspecialchars($datname)." - ".htmlspecialchars($datname)." - The Wizard of DATz - ".$version." - ".$version." - The Wizard of DATz - -
\n"; - - $footer = "\n
"; - - // Unset $system again if we're in MEGAMERGED mode - if ($system == "0" && $source == "") - { - $system = ""; - } - - if (!$lone) - { - echo "Writing data to file
\n"; - } - $lastgame = ""; - if ($old == "1") - { - // Write the header out - if ($lone) - { - echo gzencode($header_old, 9); - } - else - { - fwrite($handle, $header_old); - } - - // Write out each of the machines and roms - foreach ($roms as $rom) - { - $state = ""; - if ($lastgame != "" && $lastgame != $rom["game"]) - { - $state = $state.")\n"; - } - if ($lastgame != $rom["game"]) - { - $state = $state."game (\n". - "\tname \"".$rom["game"]."\"\n". - "\tdescription \"".$rom["game"]."\"\n"; - } - $state = $state."\t".$rom["type"]." ( name \"".$rom["name"]."\"". - ($rom["size"] != "0" ? " size ".$rom["size"] : ""). - ($rom["crc"] != "" ? " crc ".$rom["crc"] : ""). - ($rom["md5"] != "" ? " md5 ".$rom["md5"] : ""). - ($rom["sha1"] != "" ? " sha1 ".$rom["sha1"] : ""). - " )\n"; - - $lastgame = $rom["game"]; - - if ($lone) - { - echo gzencode($state, 9); - } - else - { - fwrite($handle, $state); - } - } - - if ($lone) - { - echo gzencode(")", 9); - } - else - { - fwrite($handle, ")"); - } - } - else - { - // Write the header out - if ($lone) - { - echo gzencode($header, 9); - } - else - { - fwrite($handle, $header); - } - - // Write out each of the machines and roms - foreach ($roms as $rom) - { - // Preprocess each game and rom name for safety - $rom["game"] = htmlspecialchars(utf8_encode($rom["game"])); - $rom["name"] = htmlspecialchars(utf8_encode($rom["name"])); - - $state = ""; - - if ($lastgame != "" && $lastgame != $rom["game"]) - { - $state = $state."\t\n"; - } - if ($lastgame != $rom["game"]) - { - $state = $state."\t\n". - "\t\t".$rom["game"]."\n"; - } - $state = $state."\t\t<".$rom["type"]." name=\"".$rom["name"]."\"". - ($rom["size"] != "" ? " size=\"".$rom["size"]."\"" : ""). - ($rom["crc"] != "" ? " crc=\"".$rom["crc"]."\"" : ""). - ($rom["md5"] != "" ? " md5=\"".$rom["md5"]."\"" : ""). - ($rom["sha1"] != "" ? " sha1=\"".$rom["sha1"]."\"" : ""). - " />\n"; - - $lastgame = $rom["game"]; - - if ($lone) - { - echo gzencode($state, 9); - } - else - { - fwrite($handle, $state); - } - } - - if ($lone) - { - echo gzencode("\t", 9); - echo gzencode($footer, 9); - } - else - { - fwrite($handle, "\t"); - fwrite($handle, $footer); - } - } - - if (!$lone) - { - fclose($handle); - echo "File written!
\n"; - } -} - -// Change duplicate names and remove duplicates (merged only) -function process_roms($systems, $sources) -{ - global $link; - - // Check if we're in a merged mode - $sysmerged = $systems == "" || sizeof(explode(", ", $systems)) > 1; - $srcmerged = $sources == "" || sizeof(explode(", ", $sources)) > 1; - $merged = $sysmerged || $srcmerged; - - // Since the source and/or system are valid, retrive all files - $query = "SELECT DISTINCT systems.manufacturer AS manufacturer, systems.system AS system, systems.id AS systemid, - sources.name AS source, sources.url AS url, sources.id AS sourceid, - games.name AS game, files.name AS name, files.type AS type, checksums.size AS size, checksums.crc AS crc, - checksums.md5 AS md5, checksums.sha1 AS sha1 -FROM systems -JOIN games - ON systems.id=games.system -JOIN sources - ON games.source=sources.id -JOIN files - ON games.id=files.setid -JOIN checksums - ON files.id=checksums.file". - (!$sysmerged || !$srcmerged ? "\nWHERE" : ""). - (!$srcmerged ? " sources.id IN (".$sources.")" : ""). - (!$srcmerged && !$sysmerged ? " AND" : ""). - (!$sysmerged ? " systems.id IN (".$systems.")" : "")." -ORDER BY ". - ($merged ? "checksums.size, checksums.crc, checksums.md5, checksums.sha1" - : "systems.id, sources.id, games.name, files.name"); - $result = mysqli_query($link, $query); - - // If there are no games for this set of parameters, tell the user - if (gettype($result) == "boolean" || mysqli_num_rows($result) == 0) - { - echo "No games could be found with those inputs. Please check and try again.
"; - echo "Go Back"; - exit; - } - - // Retrieve the array from the sql result - $roms = mysqli_fetch_all($result, MYSQLI_ASSOC); - - // If we're in merged mode, take care of merging before renaming - if ($merged) - { - // First, dedupe the set - $lastgood = 0; - for ($i = 0; $i < sizeof($roms); $i++) - { - $rom = $roms[$i]; - $last = $roms[$lastgood]; - - // Check if the rom is a duplicate - $dupe = false; - if ($rom["type"] == "rom" && $last["type"] == "rom") - { - $dupe = (($rom["size"] != -1 && $rom["size"] == $last["size"]) && ( - ($rom["crc"] != "" && $last["crc"] != "" && $rom["crc"] == $last["crc"]) || - ($rom["md5"] != "" && $last["md5"] != "" && $rom["md5"] == $last["md5"]) || - ($rom["sha1"] != "" && $last["sha1"] != "" && $rom["sha1"] == $last["sha1"]) - ) - ); - } - else if ($rom["type"] == "disk" && $lasttype == "disk") - { - $dupe = (($rom["md5"] != "" && $last["md5"] != "" && $rom["md5"] == $last["md5"]) || - ($rom["sha1"] != "" && $last["sha1"] != "" && $rom["sha1"] == $last["sha1"]) - ); - } - - // If it's a duplicate, unset it so it's not in the output, but add the info to the previous item - if ($dupe) - { - $last["crc"] = ($last["crc"] == "" && $rom["crc"] != "" ? $rom["crc"] : $last["crc"]); - $last["md5"] = ($last["md5"] == "" && $rom["md5"] != "" ? $rom["md5"] : $last["md5"]); - $last["sha1"] = ($last["sha1"] == "" && $rom["sha1"] != "" ? $rom["sha1"] : $last["sha1"]); - $roms[$lastgood] = $last; - - unset($roms[$i]); - } - // Otherwise, set the last unset rom - else - { - $lastgood = $i; - } - } - - // Then we put it in the right order - usort($roms, function ($a, $b) - { - if ($a["systemid"] == $b["systemid"]) - { - if ($a["sourceid"] == $b["sourceid"]) - { - if ($a["game"] == $b["game"]) - { - return strcmp($a["name"], $b["name"]); - } - return strcmp($a["game"], $b["game"]); - } - return (int) $a["sourceid"] - (int) $b["sourceid"]; - } - return (int) $a["systemid"] - (int) $b["systemid"]; - }); - } - - // Rename the games and roms if necessary - $lastname = ""; $lastgame = ""; - foreach ($roms as &$rom) - { - // If we're in merged mode, rename the game associated - if ($merged) - { - $rom["game"] = $rom["game"]. - ($sysmerged ? " [".$rom["manufacturer"]." - ".$rom["system"]."]" : ""). - ($srcmerged ? " [".$rom["source"]."]" : ""); - } - - // Now relable any roms that have the same name inside of the same game - $samename = false; $samegame = false; - if ($rom["name"] != "") - { - $samename = ($lastname == $rom["name"]); - } - if ($rom["game"] != "") - { - $samegame = ($lastgame == $rom["game"]); - } - - $lastname = $rom["name"]; - $lastgame = $rom["game"]; - - // If the name and set are the same, rename it with whatever is different - if ($samename && $samegame) - { - $rom["name"] = preg_replace("/^(.*)(\..*)/", "$1 (". - ($rom["crc"] != "" ? $rom["crc"] : - ($rom["md5"] != "" ? $rom["md5"] : - ($rom["sha1"] != "" ? $rom["sha1"] : "Alt"))). - ")$2", $rom["name"]); - } - } - - // Return the sorted list of roms - return $roms; -} - -?> \ No newline at end of file diff --git a/pages/view.php b/pages/view.php deleted file mode 100644 index a27e062..0000000 --- a/pages/view.php +++ /dev/null @@ -1,279 +0,0 @@ -"; - exit; - } - $roms = mysqli_fetch_all($result); - $game_info = $roms[0]; - - echo "

View the Game Information Below

- - - - - - - - - - - - - - -
System".$game_info[0]." - ".$game_info[1]."
Source".$game_info[3]."
Name".$game_info[5]."

- - - - -"; - - foreach ($roms as $rom) - { - echo "\n"; - for ($i = 7; $i < 13; $i++) - { - echo "\t\n"; - } - echo "\n"; - } - - echo "
NameTypeSizeCRCMD5SHA-1
".$rom[$i]."

"; - - echo "
"; - if ($offset != "" && $offset > 0) - { - echo "Last 50 "; - } - if ($count > (mysqli_num_rows($result) + ($offset == "" ? 0 : $offset*50))) - { - echo "Next 50"; - } - echo "
"; - - echo "Back to previous page
\n"; - -} -else -{ - // Retrieve source info only so it's not duplicated - if ($source != "") - { - $query = "SELECT name, url FROM sources WHERE id='".$source."'"; - $source_result = mysqli_query($link, $query); - $source_info = mysqli_fetch_assoc($source_result); - } - // Retrieve system info only so it's not duplicated - if ($system != "") - { - $query = "SELECT manufacturer, system FROM systems WHERE id='".$system."'"; - $system_result = mysqli_query($link, $query); - $system_info = mysqli_fetch_assoc($system_result); - } - - // Get the total count in the case that it needs limiting - $query = "SELECT COUNT(*) as count - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - WHERE ". - ($source != "" ? "sources.id=".$source : ""). - ($source != "" && $system != "" ? " AND " : ""). - ($system != "" ? "systems.id=".$system : ""); - $count = mysqli_query($link, $query); - $count = mysqli_fetch_assoc($count); - $count = $count["count"]; - settype($count, "integer"); - - // Then get all games assocated - $query = "SELECT games.name AS name, - games.id AS id, - systems.manufacturer AS manufacturer, - systems.system AS system, - sources.name AS source - FROM systems - JOIN games - ON systems.id=games.system - JOIN sources - ON games.source=sources.id - WHERE ". - ($source != "" ? "sources.id=".$source : ""). - ($source != "" && $system != "" ? " AND " : ""). - ($system != "" ? "systems.id=".$system : ""). - " ORDER BY games.name ASC - LIMIT 50 OFFSET ".($offset == "" ? "0" : ($offset*5)."0"); - $games_result = mysqli_query($link, $query); - - echo "

Games With This ". - ($source != "" ? "Source" : ""). - ($source != "" && $system != "" ? " And " : ""). - ($system != "" ? "System" : "")."

\n"; - if (gettype($games_result) != "boolean") - { - while ($game = mysqli_fetch_assoc($games_result)) - { - echo "".$game["name"]; - if ($source != "" && !$system != "") - { - echo " (".$game["manufacturer"]." - ".$game["system"].")"; - } - if (!$source != "" && $system != "") - { - echo " (".$game["source"].")"; - } - echo "
\n"; - } - echo "
"; - if ($offset != "" && $offset > 0) - { - echo "Last 50 "; - } - if ($count > (mysqli_num_rows($games_result) + ($offset == "" ? 0 : $offset*50))) - { - echo "Next 50"; - } - echo "
"; - } - else - { - echo "No games could be found!"; - } - echo "
"; -} - -// Requires the mysqli link -function show_default($link) -{ - // Retrieve the system listing - $query = "SELECT id, manufacturer, system FROM systems - ORDER BY manufacturer ASC, - system ASC"; - $result = mysqli_query($link, $query); - $systems = mysqli_fetch_all($result, MYSQLI_ASSOC); - - // Retrieve the sources listing - $query = "SELECT id, name FROM sources - ORDER BY name ASC"; - $result = mysqli_query($link, $query); - $sources = mysqli_fetch_all($result, MYSQLI_ASSOC); - - // Output the input selection form - echo << - -

Select a System or Source

- -
- -

\n"; - - // Retieve the last 30 games to be updated, based on lastupdated time - $query = "SELECT games.name as name, files.lastupdated as lu, systems.manufacturer as manufacturer, systems.system as system - FROM files - JOIN games ON files.setid=games.id - JOIN systems ON games.system=systems.id - ORDER BY files.lastupdated DESC - LIMIT 30"; - $result = mysqli_query($link, $query); - echo " - \n"; - while ($row = mysqli_fetch_assoc($result)) - { - echo "\n"; - } - echo "
GameSystemLast Updated
".$row["name"]."".$row["manufacturer"]." - ".$row["system"]."".$row["lu"]."


\n"; -} - -?> \ No newline at end of file diff --git a/sites/CPC-Power.php b/sites/CPC-Power.php index a024c37..ec24a09 100644 --- a/sites/CPC-Power.php +++ b/sites/CPC-Power.php @@ -6,6 +6,7 @@ print "
";
 print "load full\n";
 print "load updates\n";
 
+/*
 if ($_GET["type"] == "updates")
 {
 	$full_query = implode('', file("../sites/".$source."_full.txt"));
@@ -23,7 +24,8 @@ if ($_GET["type"] == "updates")
 		$old = 0;
 
 		print "load :".$fullURL."\n";
-		$query = get_data($fullURL);
+		$query = get_data("http://www.cpc-power.com".$fullURL);
+		
 		$query = explode('   ', $row);
 			$name = explode('<', $name[1]);
 			$name = $name[0];
-			
-			print "found ".$crc." # ".$name." # ".$url."\n";
 
 			if (!$r_query[$crc])
 			{
@@ -125,6 +126,7 @@ if ($u_query)
 				}
 				else
 				{
+					print "found ".$crc." # ".$name." # ".$url."\n";
 					$found[] = array($url, $name, $crc);
 					$r_query[$crc] = true;
 					$new++;