knot126 / Marmalade-Modding

Some quickly made tools working with games made with the Marmalade SDK
4 stars 0 forks source link

dump_s3e.py arch: list index out of range #2

Closed cweiske closed 13 hours ago

cweiske commented 14 hours ago

I am trying to dump the information of a PlayJam GameStick console UI .s3e file, and it fails with:

./dump_s3e.py ../../fw-2071/marmalade/Console.s3e.decompressed 
 *** BASIC HEADER *** 
ident        = 0x55334558 (XE3U)
version      = 0x42400 (4.36.0)
flags        = 0b10 (gcc)
Traceback (most recent call last):
  File "/home/cweiske/dev/gamestick/marmalade/Marmalade-Modding/./dump_s3e.py", line 246, in <module>
    main()
  File "/home/cweiske/dev/gamestick/marmalade/Marmalade-Modding/./dump_s3e.py", line 104, in main
    print(f"arch         = {hex(s3e_arch & 0xff)} ({interpret_s3e_arch(s3e_arch)})")
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cweiske/dev/gamestick/marmalade/Marmalade-Modding/./dump_s3e.py", line 243, in interpret_s3e_arch
    return ["ARMv4t", "ARMv4", "ARMv5t", "ARMv5te", "ARMv5tej", "ARMv6", "ARMv6k", "ARMv6t2", "ARMv6z", "x86", "PPC", "AMD64", "x86_64", "ARMv7a", "ARMv8a", "ARMv8a-aarch64", "NACL-x86_64"][arch]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
IndexError: list index out of range

When disabling the arch interpretation, I get

arch         = 0x3

The list index it tries to read is 259.

The PlayJam GameSticks had an ARM Cortex-A9 processor, which should have a ARM v7 architecture.

The file is available at https://tmp.cweiske.de/Console.s3e.decompressed

cweiske commented 13 hours ago

I don't know why you do & 0xff when printing the arch value but don't do that when interpreting it. When adding & 0xff to the interpretation call, it returns ARMv5te.

knot126 commented 12 hours ago

Yeah sorry, I forgot to do that when getting the arch. The reason that needs to be done is because the most significant 8 bits of the 16 bit integer are used to store if the s3e needs a hardware floating point unit (VFP) on ARM or not.

cweiske commented 12 hours ago

Thanks!