The BPS format allows distributing patches that are smaller and that do
not contain copyrighted content if data is relocated
(unlike non-trivial IPS patches).
This is essential for games such as Majora's Mask 3D that have three
barely different code revisions. Supporting all three versions would
demand an unreasonable amount of work; with BPS patches only one
version has to be supported.
The patcher is written in C++ in order to make it possible to share the
implementation with Citra and because a C version would be a lot more
ugly and tedious to write. The patcher is non-intrusive for the rest of
the codebase and self-contained so hopefully that isn't an issue.
This adds roughly ~0x500 bytes of code to the loader sysmodule.
Code looks reasonably optimised (in IDA). Tested and works on an o3DS.
This was previously using the value of the uninitialized sz variable
before it was actually assigned a value, rather than assigning the size
indicated within the command buffer.
Based off the conditions, this is a potential null pointer dereference
that can occur. We need to check for null before accessing
nbPendingNotifications.
This is unlikely to occur in common usage, however it's a fairly
straightforward amendment.
Rethinked and revised this function.
This previous one worked by "accident".
More a sheer luck of offsets on current firmware (as of writing)
But now, this is more mathematically correct way of creating a
THUMB -> ARM BLX instruction.
Also setting the new op in a set of 2 u16,
because patching code is in thumb.
* Add most extended CTRPF codes
* Fix some stuff
* FIx a couple more things
* Make the loop break actually work
* Make break work properyly v2
* Clean up a bit
* Get rid of redundant assignment
* Fix off-by-one error
* Fix possible out-of-bounds
* Switch to statically allocated cheat page
* Style changes.
Awaiting further input for the last couple
* Use more booleans