libretro / fuse-libretro

A port of the Fuse Unix Spectrum Emulator to libretro
GNU General Public License v3.0
36 stars 46 forks source link

Vita retroarch nightly builds post 1.6.0 PR can’t load a rom #95

Closed snoofly closed 3 years ago

snoofly commented 3 years ago

Made issue as comment below in closed PR maybe looked over.

Any news on the Vita port? The retroarch nightly fuse builds for vita crash when trying to load a rom since the merge. I checked a fuse self from the 7th (1.1.1) and it works fine. Thanks

Originally posted by @snoofly in https://github.com/libretro/fuse-libretro/issues/89#issuecomment-819805112

tomconte commented 3 years ago

I don't own a Vita to test; any chance you could share a stack trace of the crash?

snoofly commented 3 years ago

I used the latest libretro nightly (16th April) fuse self and info files (build 1.6.0 21c8ffb)

I loaded the core fine, then when trying to load test rom (3D Escape (1982)(New Generation Software).z80) I get the attached core dump. If I try to load the tzx of the same game I get "Failed to load content" As mentioned files prior to the 1.6.0 upgrade work ok.

I uploaded the original .psp2dmp file (extension renamed to txt to upload) as well as a s/shot from Vitashell of the dmp file as when I try to view the psp2dmp file on PC it gives unreadable characters

psp2core-1618683686-0x00000e303b-fuse_libretro.self.txt

vita_fuse

Hope it helps

leiradel commented 3 years ago

I seem to remember an issue with the PS Vita port where the compiler will use 16-bit integers for enumerations. Using the appropriate compiler flag to use a 32-bit integer fixed the problem.

snoofly commented 3 years ago

OK thanks, I'll try setting up a vita build env tomorrow and use -fno-short-enums flag and see how it goes

snoofly commented 3 years ago

Built fuse_libretro.self ensuring -fno-short-enums used by compiler (it was already set) and still same issue.

tomconte commented 3 years ago

Here is what I got out of vita-parse-core:

=== THREADS ===
    RETROVITA
        ID: 0x40010003
        Stop reason: 0x30004 (Data abort exception)
        Status: 0x1 (Running)
        PC: 0x8120442c (retroarch_vita.elf@1 + 0x18c42c => startup_manager_run at ??:?)
    SceCommonDialogWorker
        ID: 0x400100c3
        Stop reason: 0x0 (No reason)
        Status: 0x8 (Waiting)
        PC: 0xe00093d4 (SceLibKernel@1 + 0x6304)

        ID: 0x40010125
        Stop reason: 0x0 (No reason)
        Status: 0x8 (Waiting)
        PC: 0xe00093d4 (SceLibKernel@1 + 0x6304)

=== THREAD "RETROVITA" <0x40010003> CRASHED (Data abort exception) ===

DISASSEMBLY AROUND PC: 0x8120442c (ARM):

8118c41c <startup_manager_run+0x10c>:
8118c41c:  3101        adds    r1, #1
8118c41e:  42bc        cmp r4, r7
8118c420:  d043        beq.n   8118c4aa <startup_manager_run+0x19a>
8118c422:  691f        ldr r7, [r3, #16]
8118c424:  f10c 0102   add.w   r1, ip, #2
8118c428:  42bc        cmp r4, r7
8118c42a:  d03e        beq.n   8118c4aa <startup_manager_run+0x19a>
!!!        695f        ldr r7, [r3, #20] !!!
8118c42e:  f10c 0103   add.w   r1, ip, #3
8118c432:  42bc        cmp r4, r7
8118c434:  d039        beq.n   8118c4aa <startup_manager_run+0x19a>
8118c436:  699f        ldr r7, [r3, #24]
8118c438:  f10c 0104   add.w   r1, ip, #4


DISASSEMBLY AROUND LR: 0x811ceffe (Thumb):

81156fee <main_ignore+0x96>:
81156fee:  f8c6 4604   str.w   r4, [r6, #1540] ; 0x604
81156ff2:  e7d1        b.n 81156f98 <main_ignore+0x40>

81156ff4 <fuse_emulation_pause>:
81156ff4:  f24d 53a8   movw    r3, #54696  ; 0xd5a8
81156ff8:  b510        push    {r4, lr}
81156ffa:  f2c8 137b   movt    r3, #33147  ; 0x817b
!!!        691c        ldr r4, [r3, #16] !!!
81157000:  1c62        adds    r2, r4, #1
81157002:  611a        str r2, [r3, #16]
81157004:  b984        cbnz    r4, 81157028 <fuse_emulation_pause+0x34>
81157006:  f644 2074   movw    r0, #19060  ; 0x4a74
8115700a:  f2c8 1080   movt    r0, #33152  ; 0x8180

REGISTERS:
    R0: 0x812cb9b4
    R1: 0x0
    R2: 0x0
    R3: 0x0
    R4: 0x0
    R5: 0x81a79760
    R6: 0x81751b50
    R7: 0x1
    R8: 0x81d00070
    R9: 0x2
    R10: 0x8177af68
    R11: 0x8177af64
    R12: 0x8
    SP: 0x816bbec0
    PC: 0x8120442c (retroarch_vita.elf@1 + 0x18c42c)
    LR: 0x811cefff (retroarch_vita.elf@1 + 0x156fff)

STACK CONTENTS AROUND SP:
          0x816bbe80: 0x0
          0x816bbe84: 0x0
          0x816bbe88: 0x0
          0x816bbe8c: 0x0
          0x816bbe90: 0x0
          0x816bbe94: 0x0
          0x816bbe98: 0x0
          0x816bbe9c: 0x0
          0x816bbea0: 0x0
          0x816bbea4: 0x0
          0x816bbea8: 0x0
          0x816bbeac: 0x0
          0x816bbeb0: 0x0
          0x816bbeb4: 0x0
          0x816bbeb8: 0x0
          0x816bbebc: 0x81d01829
    SP => 0x816bbec0: 0x0
          0x816bbec4: 0x81d01829
          0x816bbec8: 0x81751b50 (retroarch_vita.elf@2 + 0x51b50)
          0x816bbecc: 0x811cefff (retroarch_vita.elf@1 + 0x156fff => fuse_emulation_pause at ??:?)
          0x816bbed0: 0x811af579 (retroarch_vita.elf@1 + 0x137579 => retro_run at ??:?)
          0x816bbed4: 0x8108a4dd (retroarch_vita.elf@1 + 0x124dd => command_event at ??:?)
          0x816bbed8: 0x40
          0x816bbedc: 0xffffffff
          0x816bbee0: 0xffffffff
          0x816bbee4: 0xffffffff
          0x816bbee8: 0x81782b50 (retroarch_vita.elf@2 + 0x82b50)
          0x816bbeec: 0x81734b50 (retroarch_vita.elf@2 + 0x34b50)
          0x816bbef0: 0x1
          0x816bbef4: 0x2
          0x816bbef8: 0x0
          0x816bbefc: 0x0
          0x816bbf00: 0xffffffff
          0x816bbf04: 0xffffffff
          0x816bbf08: 0xffffffff
          0x816bbf0c: 0xffffffff
          0x816bbf10: 0xffffffff
          0x816bbf14: 0xffffffff
          0x816bbf18: 0x81bd0900 (retroarch_vita.elf@2 + 0x4d0900)
          0x816bbf1c: 0x0
tomconte commented 3 years ago

I have back ported a couple of Vita-specific changes in this branch:

https://github.com/libretro/fuse-libretro/tree/fix-vita

I am not really sure those could lead to a crash, but could you maybe give it a try?

If it still crashes, could you please post both the .psp2dmp and the .elf file you ran somewhere (the statically linked RetroArch executable), so I am sure I am looking at the right thing? Thanks!

snoofly commented 3 years ago

Sir, you are a legend. The latest fixes resolve the issue and I can load the tzx and z80 fine now!

tomconte commented 3 years ago

All the credit should go to the original authors and the blame on me for overwriting their fixes :-D

I will open a PR to merge this to master.