Skip to content

Commit

Permalink
Fix issue #19
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOnlyZac authored Feb 8, 2025
1 parent 68e3338 commit a2ee568
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self, game: int, region: str, lang: str = None, strings_address: in
try:
self.game_info = GAME_INFO[game][region]
except KeyError as e:
raise(f"Error: Game or region not supported ({game}/{region})")
raise ValueError(f"Error: Game or region not supported ({game}/{region})")

self.strings_adr = self.game_info.strings_adr if strings_address is None else strings_address
self.code_address = self.game_info.asm_adr if code_address is None else code_address
Expand Down
13 changes: 0 additions & 13 deletions generator/pnach.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,3 @@ def __repr__(self) -> str:
Returns a string representation of the pnach object.
"""
return f"Pnach: {len(self._chunks)} chunks ({sum(len(chunk) for chunk in self._chunks)} bytes)"

def main():
"""
Main function for testing.
"""
sample_bytes = b""
with open("./out/mod.bin", "rb") as sample_file:
sample_bytes = sample_file.read()
sample_pnach = Pnach(0x202E60B0, sample_bytes)
print(sample_pnach)

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion generator/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def gen_pnach_chunks(self, patch_format: str) -> Tuple[pnach.Chunk, List[pnach.C
# gen pnach chunks for strings that have a target address
manual_chunks = []
for string in manual_address_strings:
chunk = pnach.Chunk(string[2], string[1], patch_format)
chunk = pnach.Chunk(string[2], string[1], patch_format=patch_format)
manual_chunks.append(chunk)

# 3 - Generate the pointers to the strings
Expand Down

0 comments on commit a2ee568

Please sign in to comment.