[Feature Request]: 32-bit check types for pnach #12297
Labels
Enhancement / Feature Request
FR: Low Priority
Niche request that does not benefit many users.
FR: Medium Complexity
Requires some codebase knowledge. A proficient developer should be able to manage.
Description
Currently, pnach is mostly based on PS2 Patch Engine, which consists of 8-bit (1 byte) and 16-bit (2-byte) checks in the form of the E and D types. This feature request is proposing two new modes for the D and E types that allow for 32-bit checks. PR #10606 (F type) would also have to receive these modes if it gets implemented.
32-bit Multi-Line "if" Conditional
Compares value at address
@a
to value@v
, and executes next@n
lines only if the test condition@t
is true. Test condition values are:0 = Equal To
1 = Not Equal To
2 = Less Than
3 = Greater Than
32-bit Multi-Line "if float" Conditional
Same operation, but the value
@v
and the value read at address@a
are interpreted as floats rather than a decimal/hexadecimal number (i.e. value of 0xC1B80000 would be treated as a float of -23 rather than decimal 3250061312)Reason
The justification for the plain 32-bit mode existing is simple - there's only 8-bit and 16-bit checks for this type, so why not 32-bit? Additionally, 32-bit checks already partially exist with the C type, just not in "if" conditional form.
The justification for the 32-bit float mode is a bit more complicated. Currently, the only way to check if a value is between two floats is by either:
Examples
An example is trying to compare the floats 45 (first two bytes are 0x4234) and -23 (first two bytes are 0xC1B8):
Not only does being limited to 16-bit reduce the accuracy of the check since you can't check for the last two bytes as well, but it also uses decimal logic rather than float logic, so it interprets the 0xC1B8 as larger than the 0x4234 which isn't correct in float logic, so the check breaks. The whole thing is a mess and it would be beneficial if a 32-bit float check type existed.
The text was updated successfully, but these errors were encountered: