mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement MxVector2/3/4 and MxMatrix (#100)
* All of the MxVectors share an inheritance chain. MxVector4 inherits from MxVector3 which inherits from MxVector2. * They all operate on a shared `float*` data member which points to the underlying storage. * There are also MxVector3/4Data classes, which inherit from Vector3/4, but add concrete storage for the Vector data rather than just an abstract data pointer. * The same is true for MxMatrix, with there being an abstract and a concrete variant of it. * Also improve reccmp.py register matching algorithm. It previously could not recognize an effective match when a swap had to take place between two registers used on the same line. It turns out this happens a lot in floating point math code so I adjusted the implementation to break the disassembly lines on spaces rather than just linebreaks allowing the existing effective match code to handle that case too.
This commit is contained in:
@@ -343,14 +343,15 @@ def replace_register(lines: list[str], start_line: int, reg: str, replacement: s
|
||||
|
||||
# Is it possible to make new_asm the same as original_asm by swapping registers?
|
||||
def can_resolve_register_differences(original_asm, new_asm):
|
||||
# Split the ASM on spaces to get more granularity, and so
|
||||
# that we don't modify the original arrays passed in.
|
||||
original_asm = [part for line in original_asm for part in line.split()]
|
||||
new_asm = [part for line in new_asm for part in line.split()]
|
||||
|
||||
# Swapping ain't gonna help if the lengths are different
|
||||
if len(original_asm) != len(new_asm):
|
||||
return False
|
||||
|
||||
# Make copies so we don't modify the original
|
||||
original_asm = original_asm.copy()
|
||||
new_asm = new_asm.copy()
|
||||
|
||||
# Look for the mismatching lines
|
||||
for i in range(len(original_asm)):
|
||||
new_line = new_asm[i]
|
||||
|
Reference in New Issue
Block a user