"Nintendo DS",
"54" => "Nintendo DSi",
"53" => "Nintendo DSi (DLC)",
"64" => "Nintendo 3DS",
"79" => "Nintendo 3DS (DLC)",
);
// If we're in generate mode
if ($gen == "1")
{
// Copied these from generate.php
$version = date("YmdHis");
$datname = $systems[$system].' Scene Releases';
$header = "
";
$vals = array();
// Populate vals
if ($system == "28")
{
for ($i = 0; $i <= 6623; $i++)
{
$vals[] = str_pad($i, 4, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 165; $i++)
{
$vals[] = "z".str_pad($i, 3, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 3; $i++)
{
$vals[] = "xB".str_pad($i, 2, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 197; $i++)
{
$vals[] = "x".str_pad($i, 3, "0", STR_PAD_LEFT);
}
}
elseif ($system == "54")
{
for ($i = 1; $i <= 9; $i++)
{
$vals[] = str_pad($i, 4, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 1; $i++)
{
$vals[] = "z".str_pad($i, 3, "0", STR_PAD_LEFT);
}
}
elseif ($system == "53")
{
for ($i = 1; $i <= 393; $i++)
{
$vals[] = str_pad($i, 4, "0", STR_PAD_LEFT);
}
}
elseif ($system == "64")
{
for ($i = 0; $i <= 1552; $i++)
{
$vals[] = str_pad($i, 4, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 11; $i++)
{
$vals[] = "z".str_pad($i, 3, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 48; $i++)
{
$vals[] = "x".str_pad($i, 3, "0", STR_PAD_LEFT);
}
}
elseif ($system == "79")
{
for ($i = 0; $i <= 582; $i++)
{
$vals[] = str_pad($i, 4, "0", STR_PAD_LEFT);
}
for ($i = 1; $i <= 298; $i++)
{
$vals[] = "z".str_pad($i, 3, "0", STR_PAD_LEFT);
}
}
else
{
echo "No suitable system found for id ".$system."!\n\n";
}
for ($i = $start; /*$i < $start + 50 &&*/ $i < sizeof($vals); $i++)
{
$id = $vals[$i];
// Don't anger the No-Intro admins..
echo "Waiting 30 seconds...\n";
ob_flush(); flush();
sleep(30);
echo ($i.": Retrieving file information for ".$id."\n");
$filename = "http://datomatic.no-intro.org/index.php?page=show_record&s=".$system."&n=".$id;
$query = implode("", file($filename));
//$query = get_data($filename);
// If we're in an error state, break
if (strpos($query, "I am too busy for this") !== FALSE)
{
echo "\tError page found, breaking at http://datomatic.no-intro.org/index.php?page=show_record&s=".$system."&n=".$id."\n";
$start = $i;
echo "\nNext\n";
break;
}
// Get leading edge of the scene releases
$query = explode("Scene releases", $query);
if (!isset($query[1]))
{
echo "\tNo scene information found\n";
}
else
{
$query = $query[1];
// Get trailing edge of the scene releases
$query = explode("", $query);
$query = $query[0];
// Now all that's left are the scene releases
// Let's replace all of the obnoxious spaces with single ones
$query = preg_replace("/\s+/", " ", $query);
// Now all of the spaces should be fixed.
// Let's separate it by "Directory"
$query = explode("Directory:", $query);
unset($query[0]);
// Now there are little chunks of page that contain the directory
$xmlr = new XMLReader;
foreach ($query as $release)
{
$data = array();
$release = str_replace("&", "&", $release);
$enddiv = strpos($release, "");
$xmlr->XML(($enddiv !== false ? "| ".$release.($enddiv === false ? " |