rubendal / SSBU-Dump-Scripts

Script to dump character game animcmd scripts programatically using r2pipe (3.0.0 and later versions only)
9 stars 6 forks source link

TypeError when using a NX2ELF converted NRO #1

Open NyxTheShield opened 5 years ago

NyxTheShield commented 5 years ago

As the title implies, I am getting a TypeError when using a NX2ELF converted NRO (Specifically, 3.0.0 lua2cpp_fox.elf)

Traceback (most recent call last): File "C:\Users\felip\Desktop\ProjectNX Dev\Releases\Script Dumper\main.py", line 118, in <module> dump("lua2cpp_fox.elf") File "C:\Users\felip\Desktop\ProjectNX Dev\Releases\Script Dumper\main.py", line 21, in dump sections = SectionTable(aux).sections File "C:\Users\felip\Desktop\ProjectNX Dev\Releases\Script Dumper\sectionTable.py", line 6, in __init__ for l in text.split('\r'): TypeError: a bytes-like object is required, not 'str'

When manually converting the type for both errors using encodes, I get the followuing output, with no scripts being extracted on the output folder

Opening file lua2cpp_fox.elf lua2cpp::create_agent_fighter_animcmd_game_fox(phx::Hash40,app::BattleObject*,app::BattleObjectModuleAccessor*,lua_State*) found Scripts extracted

rubendal commented 5 years ago

It's an issue related with latest r2pipe version, try using r2pipe v1.2.0

Updated Readme with r2pipe version on requirements

NyxTheShield commented 5 years ago

Uninstalled the latest release and used r2pipe 1.2.0 (installing with pip install r2pipe==1.2.0). Doesnt need the decode fixes but it still gets no output in the output folder.

NyxTheShield commented 5 years ago

According to @jugeeya, replacing the \r linebreaks into \n for windows users should work, but it still doesnt work on my setup (32bit Python 3.7.2, 1.2.0 r2pipe, Radare2 3.5.1)

rubendal commented 5 years ago

In my case I have \r linebreaks on output and I'm using windows, I tried forcing radare2 output to have both linebreaks using a replace in an attempt to solve this issue, can you test if it works without replacing \r with \n on splits with latest version? https://github.com/rubendal/SSBU-Dump-Scripts/commit/a31afd347eeefa630e361625b6eebb49a50611b6