1
0
Fork 0
mirror of https://github.com/marcrobledo/RomPatcher.js.git synced 2025-06-27 16:25:54 +00:00

Updated Embedding Rom Patcher JS (markdown)

Marc Robledo 2024-08-09 19:22:34 +02:00
parent 5ba1089794
commit e17b72615d

@ -1,4 +1,3 @@
# Embedding Rom Patcher JS in your site
If you are self-hosting your own translations and/or hack patches, you can embed Rom Patcher JS and provide a nice solution for your users, allowing them to easily apply your patches to their ROMs without requiring them to download a single file, all thanks to the magic of the web!
Take a look at [`index_template.html`](https://github.com/marcrobledo/RomPatcher.js/blob/master/index_template.html) for a template. Basically you need to:
@ -33,7 +32,7 @@ Take a look at [`index_template.html`](https://github.com/marcrobledo/RomPatcher
 
## Providing additional patch information
# Providing additional patch information
If you want to improve the user experience, you can provide additional information of your patches.<br/>
Instead of a simple file path, you can build a JSON object like this:
```js
@ -71,7 +70,7 @@ RomPatcherWeb.initialize(myPatcherSettings, {
&nbsp;
## Events
# Events
If you want to go further, you can run your own code via events:
```js
const myPatcherSettings={
@ -98,7 +97,7 @@ In all events, the `romFile` parameter is an instance of [BinFile.js](https://gi
&nbsp;
### Example: Fix ROM endianness
## Example: Fix ROM endianness
N64 ROM files are usually stored in `.z64` (Big Endian) or `.n64` (Little Endian) formats. You can make your patcher compatible with both formats by changing the provided ROM file endianness before patching (and then restoring it after patching).<br/>
```js
const SSB_LITTE_ENDIAN_CRC32 = 0xf0b7c200;
@ -138,7 +137,7 @@ N64 ROM files are usually stored in `.z64` (Big Endian) or `.n64` (Little Endian
```
&nbsp;
### Example: Choose correct patch automatically
## Example: Choose correct patch automatically
If your zip file contains several patches for different ROMs, you can make Rom Patcher JS so it picks automatically the patch for the provided ROM.
```js
const SML2_CHECKSUM_WORLD = 0xd5ec24e4;
@ -187,7 +186,7 @@ If your zip file contains several patches for different ROMs, you can make Rom P
```
&nbsp;
### Example: Remove header
## Example: Remove header
SNES ROM files are usually stored in `.sfc` (headerless) or `.smc` (headered) formats. You can make your patcher compatible with both formats by detecting if the ROM is headered and remove the header before the ROM is validated.<br/>
```js
RomPatcher.initialize(