Added CRC32 patcher tool, updated Audacity instructions

Audacity instructions were for Audacity 2.x, have now been updated for 3.x
This commit is contained in:
vonmillhausen 2023-05-26 13:01:55 +01:00
parent 51bbbbf0a9
commit da406c350d
3 changed files with 179 additions and 9 deletions

View File

@ -150,7 +150,7 @@ When the device is powered on, a "Welcome" image is displayed for a short time b
![Boot Logo](/images/bootlogo.png)
The image is _actually_ displayed at half-resolution on the internal display though, `256x100`, centred in the middle of the screen. The boot logo can be changed to an arbitrary `256x100` image using a web-based tool I wrote, which you can [find here](https://vonmillhausen.github.io/sf2000/tools/bootLogoChanger.html).
The image is _actually_ displayed at half-resolution on the internal display though, `256x100`, centred in the middle of the screen. The boot logo can be changed to an arbitrary `256x100` image using a web-based tool I wrote, which you can [find here](https://vonmillhausen.github.io/sf2000/tools/bootLogoChanger.htm).
---
@ -355,6 +355,8 @@ And here's my current understanding of what each line is used for:
- `24 184 144 208`: These numbers control the position and size of the game artwork in each system's game-list. The first two numbers are the X and Y coordinates from the top-left corner of the screen for where to start drawing the artwork; the second two numbers are the width and height of the artwork to draw. Note that the SF2000 doesn't do any image scaling; the dimensions are for the rectangular area the device will begin adding each pixel of the source artwork to. If the artwork's dimensions don't exactly match the dimensions specified here, the artwork will not display properly
- `40 24`: The width and height of the icon shown beside the currently selected/highlighted game in a game-list. Again, these are the dimensions of the rectangular area the SF2000 draws the pixel data into, so if these numbers don't match the dimensions of the list indicator image, the image will not display properly
NOTE: While the text colours above work just fine with the SF2000 _first_ boots up, after loading a game and returning to the menu some text colours revert to default, and are likely being pulled from inside the BIOS somewhere.
### ROM Lists
Credit for this section goes to `taizou#9644`, author of [FROGTOOL](https://github.com/tzlion/frogtool). These files relate to the built-in game-lists under each main system; the list of games is pulled from these files instead of being built at runtime - annoying, but presumably for performance reasons. It means if you want to change the list of built-in games (instead of using the User ROMs section), you have to edit these files - hence FROGTOOL, you should really check it out.
@ -373,16 +375,18 @@ There are several sound files in the `20230420` firmware, stored in raw signed 1
If you want to do it using [Audacity](https://www.audacityteam.org/) , the steps are:
1. Open your audio file
2. In lower left corner of Audacity window, set "Project Rate (Hz)" to "22050"
3. If your track is stereo, downmix to mono: "Tracks" menu > "Mix" > "Mix Stereo Down to Mono"
4. "Tracks" menu > "Resample..."
2. Click the "Audio Setup" button on the top toolbar, choose "Audio Settings..."
* Set "Project Sample Rate" to "22050 Hz"
* Click "OK"
3. Click the "Select" button in the lower-left corner of your audio track area to select all the audio
4. If your track is stereo, downmix to mono: "Tracks" menu > "Mix" > "Mix Stereo Down to Mono"
5. "Tracks" menu > "Resample..."
* Set "New sample rate (Hz)" to "22050"
* Click "OK"
5. Press "Ctrl-A" to select the full audio range
"Effect" menu > "Change Speed..."
6. "Effect" menu > "Pitch and Tempo" > "Change Speed..."
* Set "Speed Multiplier" to "1.023"
* Click "OK" (your audio will now sound slightly too high-pitched if you play it back, but don't worry - the SF2000 plays everything slightly slow/low-pitched, so we speed/pitch things up before exporting so it plays back correctly)
6. "File" menu > "Export" > "Export Audio..."
* Click "Apply" (your audio will now sound slightly too high-pitched if you play it back, but don't worry - the SF2000 plays everything slightly slow/low-pitched, so we speed/pitch things up before exporting so it plays back correctly)
7. "File" menu > "Export" > "Export Audio..."
* Set "Save as type" to "Other uncompressed files"
* In "Format Options", set "Header" to "RAW (header-less)"; set "Encoding" to "Signed 16-bit PCM"
* Enter your "File name", and click "Save"
@ -412,7 +416,8 @@ These are files that I have not yet determined what they do; if anyone has any i
## Tools and Links
All of these are linked above already in their relevant sections, but just in case you prefer to see them as a pulled-out list, here they are again:
- [Boot Logo Changer](https://vonmillhausen.github.io/sf2000/tools/bootLogoChanger.html)
- [BIOS CRC32 Patcher](https://vonmillhausen.github.io/sf2000/tools/biosCRC32Patcher.htm)
- [Boot Logo Changer](https://vonmillhausen.github.io/sf2000/tools/bootLogoChanger.htm)
- [Button Mapping Tool](https://vonmillhausen.github.io/sf2000/tools/buttonMappingChanger.htm)
- [Data Frog's firmware update tutorial](https://www.youtube.com/watch?v=j8dT2fdGfck)
- [FROGTOOL](https://github.com/tzlion/frogtool) (for updating the built-in game lists)
@ -422,6 +427,8 @@ All of these are linked above already in their relevant sections, but just in ca
---
## Version History
- `20230526 - 1.13`: Updated Audacity instructions to support latest version of Audacity. Added a BIOS CRC32 patcher tool for the reckless and brave. Added a note about `Foldername.ini` text colours reverting after loading a game (thanks `Zerter#4954`!)
- `20230525 - 1.12`: Added a section about the internals of the `Foldername.ini` file. Added a note to the Arcade section about the "inrom" column in `adcockm#8175`'s metadata document. Added a small firmware note for the May 22nd about community-spotted GBA performance improvements. Added specific emulator versions and Git commit links for each emulator (thanks `osaka#9664` and `notv37#4200`!). Added specific steps for producting SF2000-format audio files using Audacity.
- `20230524 - 1.11`: Added my new [Generic Image Tool](https://vonmillhausen.github.io/sf2000/tools/genericImageTool.htm). Added more exceptional information from `adcockm#8175` in regards to arcade emulation on the SF2000, and cleaned up the old info accordingly. Corrected some typos related to `bisrv.asd` (thanks `Luke#4448`!). Usage of `nvinf.hsp` was tracked down to the numbers of games available on the main menu pages (thanks `kid_sinn#9691`!).

163
tools/biosCRC32Patcher.htm Normal file
View File

@ -0,0 +1,163 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Data Frog SF2000 BIOS CRC32 Patcher</title>
<meta name="viewport" content="width=device-width">
<style type="text/css">
:root {
--background: rgb(240, 235, 220);
--text: rgb(50, 40, 20);
--errorBackground: rgb(200, 65, 65);
--errorText: rgb(255, 255, 255);
--mappingBox: rgba(50, 40, 20, 0.1);
}
@media (prefers-color-scheme: dark) {
:root {
--background: rgb(70, 75, 100);
--text: rgb(190, 190, 200);
--errorBackground: rgb(130, 85, 75);
--errorText: rgb(245, 200, 200);
--mappingBox: rgba(190, 190, 200, 0.1);
}
}
body {
background-color: var(--background);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
}
a, a:visited, a:hover, a:active { color: var(--text); }
hr {
border: 1px solid var(--text);
margin: 2em 0;
}
p.errorMessage{
background-color: var(--errorBackground);
border: 1px dashed var(--errorText);
color: var(--errorText);
border-radius: 10px;
padding: 10px;
margin: 20px;
}
h1:first-child { text-align: center; }
p:last-child { text-align: center; }
.controlContainer {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.control {
display: inline;
background-color: var(--mappingBox);
padding: 1em;
border-radius: 1em;
margin: 0.5em;
}
</style>
</head>
<body>
<h1>Data Frog SF2000 BIOS CRC32 Patcher</h1>
<p>This tool will recalculate and patch the CRC32 check bits for a modified <code>bisrv.asd</code> BIOS file for the SF2000; only really useful if you've manually modified data outside of the "safe" areas covered by my other tools. If you haven't done your own hex editing of the BIOS, then this tool probably isn't for you! 🙂</p>
<p><strong><em>IMPORTANT NOTE:</em></strong> This tool will just blindly modify bytes <code>0x18c</code> to <code>0x18f</code> of whatever input file you provide; correct usage of this tool is therefore up to you, not me! 🤣</p>
<hr>
<div id="steps">
<section id="bisrvSection">
<h2>Step 1: Select Your <code>bisrv.asd</code></h2>
<p>Select your <code>bisrv.asd</code> file. You should probably make a backup of the file first, just in case!</p>
<div id="bisrvOutput"></div>
<div class="controlContainer">
<label class="control">Open <code>bisrv.asd</code>: <input id="bisrvSelector" type="file" accept=".asd,application/octet-stream" onchange="bisrvLoad(event.target.files[0])"></label>
</div>
</section>
</div>
<script type="text/javascript">
// Global variables...
var bisrvData; // Used to store the binary data from the bisrv.asd file
function bisrvLoad(file) {
// We've got a new file - clear any old error messages and any HTML after
// Step 1...
document.getElementById("bisrvOutput").innerHTML = "";
while(document.getElementById("bisrvSection").nextSibling) {
document.getElementById("bisrvSection").nextSibling.remove();
}
// Check to make sure the file is at least ~512-bytes-ish long (CRC32 for
// bisrv.asd is calculated for bytes 512 onwards)...
if (file.size < 520) {
document.getElementById("bisrvOutput").innerHTML = "<p class=\"errorMessage\">ERROR: Provided file is too small!</p>";
return;
}
// If we're here then we should be good - read in our file and store its
// contents in bisrvData...
var frBisrv = new FileReader();
frBisrv.readAsArrayBuffer(file);
frBisrv.onload = function(event) {
// Read the provided file's data into an array...
bisrvData = new Uint8Array(event.target.result);
// And display Step 2...
stepTwo();
};
}
function stepTwo() {
// Start building our HTML...
var html = "<section id=\"downloadSection\"><h2>Step 2: Download Patched <code>bisrv.asd</code></h2><p>Click the download button for the patched <code>bisrv.asd</code> file; use it to replace the one in the <code>bios</code> folder on your SF2000's microSD card.</p><div id=\"downloadSectionMessages\"></div>";
// Add our download button...
html += "<div class=\"controlContainer\"><div class=\"control\"><input id=\"downloadButton\" type=\"button\" value=\"Download\"></div></div>";
// Finally, add a <hr> separator after the last step, and append the new step...
document.getElementById("steps").insertAdjacentHTML("beforeend", "<hr>");
document.getElementById("steps").insertAdjacentHTML("beforeend", html);
// Attach our event handler to our download button...
var dButton = document.getElementById("downloadButton");
dButton.addEventListener("click", function() {
download();
});
}
function download() {
// Easy peasy - we're going to recalculate the CRC32 check bytes for our binary
// data, plonk them into the data in the right place, and then send it to the
// user's browser...
// Calculate a new CRC32 for the updated bisrv.asd and apply it; credit to
// osaka#9664 for this code!
var c;
var tabCRC32 = new Int32Array(256);
for (var i = 0; i < 256; i++) {
c = i << 24;
for (var j = 0; j < 8; j++) {
c = c & (1 << 31) ? c << 1 ^ 0x4c11db7 : c << 1;
}
tabCRC32[i] = c;
}
c = ~0;
for (var i = 512; i < bisrvData.length; i++) {
c = c << 8 ^ tabCRC32[c >>> 24 ^ bisrvData[i]];
}
bisrvData[0x18c] = c & 255;
bisrvData[0x18d] = c >>> 8 & 255;
bisrvData[0x18e] = c >>> 16 & 255;
bisrvData[0x18f] = c >>> 24;
// Send the data to the user's browser as a file download...
var link = document.createElement("a");
link.href = window.URL.createObjectURL(new Blob([bisrvData], {type: "application/octet-stream"}));
link.download = "bisrv.asd";
link.style.display = "none";
document.body.appendChild(link);
link.click();
window.URL.revokeObjectURL(link.href);
document.body.removeChild(link);
}
</script>
<hr>
<p><a rel="license" href="http://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: public domain. Version 1.0, 20230526.1</p>
</body>
</html>