notaz / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
291 stars 165 forks source link

(sdl) Picodrive crashes when loading chd content #84

Closed orbea closed 3 years ago

orbea commented 6 years ago

OS: Slackware64-current Picodrive: 079bc1 gcc-7.3.0

When trying to load chd files of segacd games that where created from redump bin/cue files Picodrive will crash. The bin/cue files work in Picodrive and the chd file works in Genesis-Plus-GX which uses libchdr.

However the libretro core does not crash and will only show a black screen while the RetroArch menu is still responsive.

Ideally Picodrive should at least fail safely and at best should also support chd files with libchdr.

GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-slackware-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from PicoDrive...done.
(gdb) r Lunar\ -\ Eternal\ Blue\ \(USA\).chd
Starting program: /usr/games/PicoDrive Lunar\ -\ Eternal\ Blue\ \(USA\).chd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: video overlay is not hardware accelerated, not going to use it.
warning: failed to do hugetlb mmap (0x2000000, 206045184): 22

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff68db353 in __memset_sse2_unaligned_erms () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff68db353 in __memset_sse2_unaligned_erms () from /lib64/libc.so.6
#1  0x000000000040ebfb in load_progress_cb (percent=-10)
    at platform/common/menu_pico.c:173
#2  0x000000000041ceba in PicoCartLoad (f=0xc940c0, prom=0x7fffffffde70, 
    psize=0x7fffffffde6c, is_sms=0) at pico/cart.c:564
#3  0x0000000000435999 in PicoLoadMedia (
    filename=0xcb8d10 "Lunar - Eternal Blue (USA).chd", 
    carthw_cfg_fname=0x7fffffffded0 "/home/orbea/.picodrive/carthw.cfg", 
    get_bios_filename=0x406e8c <find_bios>, 
    do_region_override=0x407564 <do_region_override>) at pico/media.c:252
#4  0x00000000004078ba in emu_reload_rom (
    rom_fname_in=0x7fffffffe543 "Lunar - Eternal Blue (USA).chd")
    at platform/common/emu.c:434
#5  0x00000000004068b3 in main (argc=2, argv=0x7fffffffe228)
    at platform/common/main.c:100
(gdb) bt fiull
#0  0x00007ffff68db353 in __memset_sse2_unaligned_erms () from /lib64/libc.so.6
No symbol table info available.
#1  0x000000000040ebfb in load_progress_cb (percent=-10)
    at platform/common/menu_pico.c:173
        ln = 8
        len = -64
        dst = 0x7ffff4edd400
#2  0x000000000041ceba in PicoCartLoad (f=0xc940c0, prom=0x7fffffffde70, 
    psize=0x7fffffffde6c, is_sms=0) at pico/cart.c:564
        todo = 262144
        ret = 262144
        p = 0x3480000 ""
        rom = 0x2000000 "MComprHD"
        size = 205552624
        bytes_read = 21495808
#3  0x0000000000435999 in PicoLoadMedia (
    filename=0xcb8d10 "Lunar - Eternal Blue (USA).chd", 
    carthw_cfg_fname=0x7fffffffded0 "/home/orbea/.picodrive/carthw.cfg", 
    get_bios_filename=0x406e8c <find_bios>, 
    do_region_override=0x407564 <do_region_override>) at pico/media.c:252
        rom_fname = 0xcb8d10 "Lunar - Eternal Blue (USA).chd"
        media_type = PM_MD_CART
        cd_img_type = CIT_NOT_CD
        rom_data = 0x0
        rom_size = 0
        rom = 0xc940c0
        cd_region = 0
        ret = 0
#4  0x00000000004078ba in emu_reload_rom (
    rom_fname_in=0x7fffffffe543 "Lunar - Eternal Blue (USA).chd")
    at platform/common/emu.c:434
        autoload = 0
        rom_fname = 0xcb8d10 "Lunar - Eternal Blue (USA).chd"
        ext = ".chd"
        media_type = -7904
        menu_romload_started = 1
        carthw_path = "/home/orbea/.picodrive/carthw.cfg", '\000' <repeats 478 times>
        retval = 0
#5  0x00000000004068b3 in main (argc=2, argv=0x7fffffffe228)
    at platform/common/main.c:100
No locals.
(gdb) t a a f

Thread 1 (Thread 0x7ffff7fb9740 (LWP 24632)):
#5  0x00000000004068b3 in main (argc=2, argv=0x7fffffffe228)
    at platform/common/main.c:100
100         if (emu_reload_rom(rom_fname_reload)) {