Skip to content

Instantly share code, notes, and snippets.

@BigETI
Created January 21, 2019 08:03
Show Gist options
  • Save BigETI/8de891c494d592e1058af4f52b21826c to your computer and use it in GitHub Desktop.
Save BigETI/8de891c494d592e1058af4f52b21826c to your computer and use it in GitHub Desktop.
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
const SFXFiles =
[
// ['banks' => 7, 'name' => 'FEET'],
// ['banks' => 137, 'name' => 'GENRL'],
// ['banks' => 3, 'name' => 'PAIN_A'],
['banks' => 218, 'name' => 'SCRIPT'],
['banks' => 46, 'name' => 'SPC_EA'],
['banks' => 18, 'name' => 'SPC_FA'],
['banks' => 209, 'name' => 'SPC_GA'],
['banks' => 52, 'name' => 'SPC_NA'],
['banks' => 20, 'name' => 'SPC_PA']
];
const StreamsFiles =
[
['banks' => 66, 'name' => 'AA'],
['banks' => 69, 'name' => 'ADVERTS'],
['banks' => 0, 'name' => ''],
['banks' => 40, 'name' => 'AMBIENCE'],
['banks' => 10, 'name' => 'BEATS'],
['banks' => 130, 'name' => 'CH'],
['banks' => 155, 'name' => 'CO'],
['banks' => 156, 'name' => 'CR'],
['banks' => 141, 'name' => 'CUTSCENE'],
['banks' => 179, 'name' => 'DS'],
['banks' => 115, 'name' => 'HC'],
['banks' => 152, 'name' => 'MH'],
['banks' => 147, 'name' => 'MR'],
['banks' => 130, 'name' => 'NJ'],
['banks' => 161, 'name' => 'RE'],
['banks' => 170, 'name' => 'RG'],
['banks' => 101, 'name' => 'TK']
];
function GetSAMPSoundURL($sampSoundID)
{
$ret = false;
if ($sampSoundID >= 2000)
{
$bank_index = floor(($sampSoundID - 2000) / 200);
foreach (SFXFiles as $sfx_file)
{
if ($bank_index >= $sfx_file['banks'])
{
$bank_index -= $sfx_file['banks'];
}
else
{
$ret = 'https://bigeti.de/demmuzik/GTA%20San%20Andreas/sfx/' . $sfx_file['name'] . '/' . $bank_index . '/' . $sfx_file['name'] . '.' . $bank_index . '.' . ($sampSoundID % 200) . '.wav';
break;
}
}
}
else if ($sampSoundID >= 2)
{
$bank_index = $sampSoundID;
foreach (StreamsFiles as $streams_file)
{
if ($bank_index >= $streams_file['banks'])
{
$bank_index -= $streams_file['banks'];
}
else
{
$ret = 'https://bigeti.de/demmuzik/GTA%20San%20Andreas/streams/' . $streams_file['name'] . '/' . $streams_file['name'] . '.' . $bank_index . '.ogg';
break;
}
}
}
return $ret;
}
if (isset($_GET['id']))
{
$output = GetSAMPSoundURL(intval($_GET['id']));
if ($output !== false)
{
header('Location: ' . $output);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment