Coder Social home page Coder Social logo

marcrobledo / rompatcher.js Goto Github PK

View Code? Open in Web Editor NEW
636.0 19.0 132.0 306 KB

An IPS/UPS/APS/BPS/RUP/PPF/xdelta ROM patcher made in HTML5.

Home Page: https://www.marcrobledo.com/RomPatcher.js/

License: Other

HTML 6.92% JavaScript 87.40% CSS 5.68%
patcher rom romhacking ips ups

rompatcher.js's People

Contributors

admentus64 avatar asparaguseduardo avatar dankrank avatar den13501 avatar destitute-streetdwelling-guttersnipe avatar epicpkmn11 avatar felipefpl avatar flagrama avatar ghostlydark avatar laqieer avatar marcrobledo avatar natizyskunk avatar patryckpo avatar romhack avatar seve32 avatar starfang208 avatar tsolete avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rompatcher.js's Issues

Error using a BPS patch

I tried to use the English translation patch (a BPS file) for Super Famicom Wars rom using the patcher, but I got this error. Am I doing anything wrong?

Uncaught RangeError: Offset is outside the bounds of the DataView
at DataView.getUint8 (<anonymous>)
at MarcBinFile.readByte (RomPatcher.js:291)
at BPS.apply (bps.js:82)
at applyPatchFile (RomPatcher.js:140)
at HTMLButtonElement.onclick ((index):65)

Hardcoded patcher feature

Hello!
I was wondering, if it was possible to implement something like an online patcher with patch file already placed on server. Say, for translation group trying to distribute it's patch, it would be cool to have a styled nice page with just one input for ROM file and button 'apply patch'.
I was trying to add additional onload function for getting this patch online. Something like:

		var blob = null;
		var xhr = new XMLHttpRequest();
		xhr.open("GET", "./1.ips");
		xhr.responseType = "blob";//force the HTTP response, response-type header to be blob
		xhr.onload = function()
		{
			blob = xhr.response;//xhr.response is now a blob object
			openPatchFile(blob);
		}
		xhr.send();

But only succeeded on local file. As soon as I place all the files on server I cannot get proper blob for processing.

Ability to create BPS patches?

This patches may support applying IPS, UPS, APS, and BPS patches, but it only supports creating IPS, UPS, and APS patches - support for creating BPS patches is notably absent.

This is kind of unfortunate as I'm trying to find a BPS patch creation utility that actually functions correctly with GameCube games and their 1.35GB size - beat just sits there doing nothing while Floating IPS throws up an error saying "files are too big" even though BPS as a format supposedly has no file size limit...

Make Portable

Currently, this patcher is heavily tied to the interface that you see publicly in the demo. So much so that it even calls specific DOM elements by id in the main patcher js.

It would be nice to separate the logic of the actual patcher itself from the GUI elements so that it can be easily imported and used on other websites and not, very specifically, the one provided.

Additionally, the patcher seems to require a very specific structure, with a js folder at root, etc. Quite a few of the internal scripts (particularly as it relates to creating workers in RomPatcher.js for example) rely on this specific structure. It would be nice if imports were a lot less absolute and more relative, so that we might be able to import these in arbitrary folders irrespective of position relative to the root directory (so, for example, static/Rompatcher/js/RomPatcher.js should work rather than just /js/RomPatcher.js).

[New format request] Double IPS Patch (SPATCH) support

Some old rom hacks use double .ips patches, which is supported by SPATCH. It extends IPS format to support different filesizes in the old days before widely use of some better patch format like UPS. Considering it is not widely used anymore nowadays, this feature request is only to support some really old rom patches, so it doesn't have a high priority.

Links:

Note: the example above includes patches in both IPS and UPS patch format for you to compare patched ROMs.

Cannot generate .ips files for Switch due to file size limit

Since this tool doesn't allow generating .ips patches over 16 megabytes, it's impossible to create patches for Switch mods of some games. I've bypassed the limit in my local copy to generate a patch for a 35 MB binary which worked fine, so it seems like this limit could be removed without any problems.

Check for headered ROM?

Often a patch requires a specific ROM. Maybe headered, maybe unheadered.

Eg. Seiken Densetsu 3.

But your tool doesnt check for headers so it's possible to patch the wrong ROM?

Unable to Patch .nds file using .xdelta?

Following error occured when trying to patch .nds ROM using .xdelta patch
image

CRC32:
ffd28f00
MD5:
ae2a483d0a5e8130d39f44f41a86df57
SHA-1:
30793e274fb4c7ba070ae226edbdfe355504b1f5

Option to consume this library as a CommonJS module for use in Node.js

I'm working on a Node.js command line app that needs to have IPS patching functionality. This repo has a lot of great functionality, but from what I can tell, it assumes consumption in the browser with a GUI. Would be nice to be able to do stuff like this:

// Node.js script
let romPatcher = require('RomPatcher')
romPatcher.patch(inputRomPath, inputIpsPath, outputRomPath)
// the above writes to outputRomPath using Node.js fs module

Any zelda rom i try the end results are the same

whats with this tool? lots of ppl reccemend it to be useful & works 100% for them yet when i try to use it to patch zelda ocarina of time with any patch i get this error instantly i could have used every single one i could find for the game even if i dump it with the real game card id still get the same results are the roms at fault or the patches im trying to use?
image

Can’t select IPS file in iPhone

On an iPhone, I access the page and if I click the “patch file” button I can browse the files in my Files app but the IPS file is not selectable. I can however select the ROM by clicking in “ROM file”.

Using setMessage Doesn't Set A data-localize Attribute

When using setMessage it doesn't set a data-localize attribute on the element the message is added to. Due to this if you change the language after setMessage has set a message it will still appear in the previously selected language.

I think ideally instead of msg you take in the localization key instead, then set data-localize to that key and set the message by passing the key to _ inside of setMessage.

I can write up a quick PR if this implementation sounds good to you.

Creating patches -- Offset is out of range

I'm actually encountering errors when trying to create patches, using Chrome 65.0.3325.181. Worth pointing out that the errors aren't handled so it fails silently and the UI simply appears to be unresponsive.

This is the most common and occurred in multiple scenarios (different ROMs, trying to create both IPS and UPS). For example, trying to create a patch from "Metroid (U).nes" to MDbTroid, both IPS and UPS:

RomPatcher.js:239 Uncaught RangeError: Offset is outside the bounds of the DataView
    at DataView.getUint8 (<anonymous>)
    at MarcBinFile.readByte (RomPatcher.js:239)
    at createIPSFromFiles (ips.js:154)
    at createPatchFile (RomPatcher.js:132)
    at HTMLButtonElement.onclick ((index):103)

This comes up if the source and modified ROM are the same.

ips.js:72 Uncaught TypeError: Cannot read property 'truncate' of undefined
    at IPS.export (ips.js:72)
    at createPatchFile (RomPatcher.js:144)
    at HTMLButtonElement.onclick ((index):103)
  | IPS.export | @ | ips.js:72
  | createPatchFile | @ | RomPatcher.js:144
  | onclick | @ | (index):103

Permission to use this on my website?

I wanted to ask if I could use this on a website of mine that is related to hacking arcade games? I provide new revisions of older Midway games and the method for distribution is patches to the original ROMs. Some more info on setup would be much appreciated if you have the time as well. Thank you for your time Marco.

-Paul

Only Allow Patching Valid CRC32, Only Download Custom Patches On Apply Click

This isn't a feature request but more a quick discussion on if one or both parts of the title would be features the patcher would be better off with. I've written both for my own purposes and was wondering if they would be appreciated in a PR before I clean it up to do so.

The changes are as follows:

  • (Dis)enabling the Apply Button and the rest of the UI are separated so that it can be toggled separately
  • If using the custom patcher the CRC from the currently selected CUSTOM_PATCHER object are stored to be compared later.
  • If there is no patch but there is a romFile and a patchFileCrc stored validateSource checks equality of the hashes to enable the Apply button, if there are both a patch and a romFile the Apply button is also enabled if their hashes match. Otherwise it disabled.
  • fetchPatch has been made a Promise which is required to avoid trying to apply a patch before it is downloaded due the async nature of Javascript.
  • If using the custom patcher clicking apply will try to fetch the Patch before trying to apply the Patch, otherwise it will just try to apply the chosen patch file.
  • The previous fetchPatch usages have been replaced with saving the CRC of the selectedPatch and changing the selected patch will invoke validateSource.

Only the Apply button being disabled with an invalid CRC affects the normal patcher, and both features would be pretty easy to implement independently if one of them isn't desired.

Is there a reason to apply to a ROM that doesn't match the CRC32? It seems kind of silly to apply a patch in this case as it is usually just more likely to break the ROM. However, if there is a valid reason to do so I can understand.

I think regardless of the above question it would be nice if the custom patches were only downloaded on demand when the user actually wants to use it instead of downloading each on the select box being changed to save on server bandwidth. Is there any reason you wouldn't want this?

BPS Linear Patch creation - Infinite Loop on BPS_getVLVLen

Dear Marc,

Please try to create a BPS patch from these two files: https://we.tl/t-sqb2zBb9KX

Original: Tomb Raider - The Last Revelation (USA) (Rev 1).bin
Final: Tomb Raider - The Last Revelation (USA) (Rev 1) - TR4 Improved [Fix by Farglior v1.0].bin

I know these are big files, but to me they just expose some underlining problem with the BPS linear patch creation algorithm that could happen with smaller ones.

Best,
Juan

feature request: name output file to patch name, not input name (patched)

with most files, esp smw romhacks, it makes more sense to name it the name of the patch than to name it a generic smw patched thing. i might dive through the source code myself and find what makes the name, but i am garbage at js and would rather leave it to someone who knows what theyre doing.

Verify checksums

Is it possible to check uploaded ROM against required checksum listed on RHDN patch page?

This way we can avoid more incorrect ROM patching.

Feature Request

Hello! Sorry for my bad english. Сurrently only one patch can be applied. I very want to apply several predefined patches at once. Сan you make this feature?

Add custom SNES Header name (optional)

just a suggestion, it would be pretty cool to add your own header name to the ROM, just so it doesn't get labelled as andother version of a game you already have in an emulator like zSNES

"Invalid regular expression: invalid group specifier name" in Safari 15.0/macOS 11.6

When loading a file on Safari 15.0/macOS 11.6, I get:

[Error] SyntaxError: Invalid regular expression: invalid group specifier name
(anonymous function) (zip.js:7)
[Error] ReferenceError: Can't find variable: ZIP_MAGIC
_parseROM (RomPatcher.js:188)
(anonymous function) (MarcFile.js:26)

The line corresponds to

const FILTER_ROMS=/(?<!\.(txt|diz|rtf|docx?|html?|pdf|jpe?g|gif|png|bmp|zip|rar|7z))$/i;
.

This works on Firefox 95.0.1.

[Feature Request] Add Proper Xdelta/VCDIFF Support (Including Secondary Compression)

I have no idea why you used nine year old code, incomplete based on some short glances, from a school related project as a base for Xdelta3 format support, but I recommend you use official source material instead. v3.1.0 is an appropriate version to use, majority of offline Xdelta patching solutions use this version already. The secondary compression formats are important here given some patches out in the wild actually use them, not to mention are backwards compatible with older versions of Xdelta3 when using front end solutions like Xdelta UI (uses v3.0u). Patches made with newer versions of Xdelta3 do not work with the online patcher since the code used doesn't understand the newer algorithm format that these newer patches are in. Due to this issue, it actually makes it difficult for some users out there who do not have access to a computer or uses an operating system that doesn't have a compiled patcher solution of sorts to work with.

Side note, v3.1.1 exists under the current source page, but it's kind of buggy, hence why v3.1.0 is a more appropriate version to use, so chances are you'll want to examine the GPL based source.

Sources:
https://github.com/jmacd/xdelta (Current)
https://github.com/jmacd/xdelta-gpl (Original)

.DIFF / .PATCH support?

Apparently the ".DIFF" / ".PATCH" format has been the go-to solution for like 50 years in terms of source code patching rather than binary patching. I don't suppose it'd be too difficult to add it then?

Basically there's an open-source piece of software that people have created patch fixes for in .DIFF format, but me and my lack of code savvy-ness is making things a bit difficult to get this working which made me wonder why an easy-to-use patcher doesn't exist for the format if it's as prevalent as it sounds (my guess is that it's kind of a "for coders by coders" and so nobody ever ran into the situation of a non-coding-savvy user needing to run such a file)

ASM Support?

ASM Is The Format Of Patches That LunarIPS Uses For "WIP Hacks", Meaning They're Held At Addresses, Could Support For These Types Of Files Be Added Please?

Feature Request: Automatically rename patched ROM

It would be useful to have the patched ROM automatically renamed to the original name of the patch file, rather than "Original ROM (patched).ext". As it is now, I find myself always renaming the output files afterwards to the name of the patch.

So how it could be:

Input:
OriginalGame.sfc
CustomGame2023.bps

Output:
CustomGame2023.sfc

Where MyCustomGame2023.sfc is the output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.