SkyTemple/skytemple-files

Deserialize error for JP ASM Patches

Closed this issue · 2 comments

Although the ASM patches AppraiseAll and ChooseStarter have JP support, SkyTemple throws errors upon attempting to apply both. The following error is an example:

Failed applying patch 'ChooseStarter'. The ROM may be corrupted now.
Traceback (most recent call last):
  File "skytemple_files/common/string_codec.py", line 340, in pmd2_decode
ValueError: Input byte stream contains unknown characters. Can not convert. First unknown char: 173

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "module/patch/controller/asm.py", line 147, in on_btn_apply_clicked
  File "module/patch/controller/asm.py", line 320, in _apply
  File "skytemple_files/patch/patches.py", line 305, in apply
  File "skytemple_files/patch/handler/choose_starter.py", line 125, in apply
  File "skytemple_files/data/str/handler.py", line 28, in deserialize
  File "skytemple_files/data/str/model.py", line 53, in __init__
  File "skytemple_files/data/str/model.py", line 56, in _read_string
  File "skytemple_files/common/util.py", line 280, in read_var_length_string
ValueError: decoding with 'pmd2str' codec failed (ValueError: Input byte stream contains unknown characters. Can not convert. First unknown char: 173)

Fixing this error will not mark these patches as completed in #405, as I have yet to test them and adjust the Text Strings used.

Can you also post the stack trace for AppraiseAll?

Actually, probably not neccesary. The issue is that StrHandler gets no string codec as a parameter for serialize and deserailize. It needs to get the codec defined in the static data.