Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sigfault scanning MAME roms #6553

Closed
i30817 opened this issue Apr 10, 2018 · 26 comments
Closed

Sigfault scanning MAME roms #6553

i30817 opened this issue Apr 10, 2018 · 26 comments

Comments

@i30817
Copy link
Contributor

i30817 commented Apr 10, 2018

First and foremost consider this:

  • Only RetroArch bugs should be filed here. Not core bugs or game bugs
  • This is not a forum or a help section, this is strictly developer oriented

Description

A segfault occurs while scanning current MAME roms. Namely a chd of Tekken 4. I triggered this by scanning the MAME rom dir but could also trigger by scanning the 'tekken4/tef1dvd0.chd' file.

File checksum is:
md5sum tef1dvd0.chd
5ab32b5d6342c48deb7af7e8973c8216 tef1dvd0.chd

size is:
du -b tef1dvd0.chd
735896857 tef1dvd0.chd

Expected behavior

Not to crash.

Actual behavior

Thread 2 "retroarch" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeb910700 (LWP 18048)]
0x0000000000609b5b in chd_close (chd=0x7fffcc014da0)
at libretro-common/formats/libchdr/chd.c:1554
1554 switch (chd->codecintf[i]->compression)
(gdb) bt
#0 0x0000000000609b5b in chd_close (chd=0x7fffcc014da0)
at libretro-common/formats/libchdr/chd.c:1554
#1 0x0000000000609a09 in chd_open_file (file=0x7fffcc014690, mode=1,
parent=0x0, chd=0x7fffeb90fa38)
at libretro-common/formats/libchdr/chd.c:1484
#2 0x0000000000609a7b in chd_open (
filename=0x7fffcc001c60 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", mode=1, parent=0x0, chd=0x7fffeb90fa38)
at libretro-common/formats/libchdr/chd.c:1518
#3 0x000000000060db81 in chdstream_open (
path=0x7fffcc001c60 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", track=-1) at libretro-common/streams/chd_stream.c:209
#4 0x0000000000439a6c in intfstream_open (intf=0x7fffcc012e50,
path=0x7fffcc001c60 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", mode=1, hints=0)
at libretro-common/streams/interface_stream.c:127
#5 0x000000000043a235 in intfstream_open_chd_track (
path=0x7fffcc001c60 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", mode=1, hints=0, track=-1)
at libretro-common/streams/interface_stream.c:474
#6 0x00000000005070c8 in task_database_chd_get_serial (
name=0x7fffcc001c60 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", serial=0x1200b47 "") at tasks/task_database.c:327
#7 0x0000000000507ced in task_database_iterate_playlist (
db_state=0x1200928, db=0x7fffcc0008c0,
name=0x7fffcc001c60 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd") at tasks/task_database.c:652
#8 0x0000000000508bbe in task_database_iterate (db=0x1200900,
db_state=0x1200928, db=0x7fffcc0008c0) at tasks/task_database.c:1107
#9 0x0000000000509055 in task_database_handler (task=0x11fecc0)
at tasks/task_database.c:1236
#10 0x000000000042ca51 in threaded_worker (userdata=0x0)
at libretro-common/queues/task_queue.c:462
#11 0x000000000059dae6 in thread_wrap (data
=0xbbc670)
at libretro-common/rthreads/rthreads.c:145
#12 0x00007ffff69fd6ba in start_thread (arg=0x7fffeb910700)
at pthread_create.c:333
#13 0x00007ffff2eaa41d in clone ()
---Type to continue, or q to quit---

Steps to reproduce the bug

  1. get tekken4 for recent mame
  2. scan the chd file

Bisect Results

[Try to bisect and tell us when this started happening]

Version/Commit

You can find this information under Information/System Information

Environment information

  • OS: linux x86-64
  • Compiler: gcc
@orbea
Copy link
Contributor

orbea commented Apr 26, 2018

Your backtrace is not complete...

---Type to continue, or q to quit---

You need to press something to continue and see the full backtrace.

@i30817
Copy link
Contributor Author

i30817 commented Apr 26, 2018

In my limited debugging experience, the inner part is more important but ok, it's not like this is expecially hard to trigger since it reproduces 100% of the time even now when scanning the tekken4 chd.

The version is the latest master, i just cloned it.


Thread 2 "retroarch" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeb910700 (LWP 20339)]
0x000000000060d017 in chd_close (chd=0x7fffcc00c290)
    at libretro-common/formats/libchdr/libchdr_chd.c:1030
1030	         switch (chd->codecintf[i]->compression)
(gdb) bt
#0  0x000000000060d017 in chd_close (chd=0x7fffcc00c290)
    at libretro-common/formats/libchdr/libchdr_chd.c:1030
#1  0x000000000060cdb6 in chd_open_file (file=0x7fffcc009fa0, mode=1, 
    parent=0x0, chd=0x7fffeb90fa38)
    at libretro-common/formats/libchdr/libchdr_chd.c:929
#2  0x000000000060ce2d in chd_open (
    filename=0x7fffcc00df90 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", mode=1, parent=0x0, chd=0x7fffeb90fa38)
    at libretro-common/formats/libchdr/libchdr_chd.c:966
#3  0x0000000000610456 in chdstream_open (
    path=0x7fffcc00df90 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", track=-1) at libretro-common/streams/chd_stream.c:209
#4  0x0000000000439d12 in intfstream_open (intf=0x7fffcc000fe0, 
    path=0x7fffcc00df90 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", mode=1, hints=0) at libretro-common/streams/interface_stream.c:127
#5  0x000000000043a4e3 in intfstream_open_chd_track (
    path=0x7fffcc00df90 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", mode=1, hints=0, track=-1)
    at libretro-common/streams/interface_stream.c:476
#6  0x0000000000509dae in task_database_chd_get_serial (
    name=0x7fffcc00df90 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd", serial=0x1708517 "") at tasks/task_database.c:327
#7  0x000000000050a9d3 in task_database_iterate_playlist (db_state=0x17082f8, 
---Type <return> to continue, or q <return> to quit---
    db=0x7fffcc0008c0, 
    name=0x7fffcc00df90 "/media/i30817/backup/Documents/Games/MAME/tekken4/tef1dvd0.chd") at tasks/task_database.c:652
#8  0x000000000050b8a4 in task_database_iterate (_db=0x17082d0, 
    db_state=0x17082f8, db=0x7fffcc0008c0) at tasks/task_database.c:1107
#9  0x000000000050bd3b in task_database_handler (task=0xcc2810)
    at tasks/task_database.c:1236
#10 0x000000000042ccc2 in threaded_worker (userdata=0x0)
    at libretro-common/queues/task_queue.c:462
#11 0x00000000005a1bea in thread_wrap (data_=0xbc7580)
    at libretro-common/rthreads/rthreads.c:145
#12 0x00007ffff69fd6ba in start_thread (arg=0x7fffeb910700)
    at pthread_create.c:333
#13 0x00007ffff2eaa41d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) 

@orbea
Copy link
Contributor

orbea commented Apr 26, 2018

Thanks. Do you know if this was always present or is it a regression?

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

no idea but since MAME chd V5 is not older than retroarch chd support (i think), i'd guess a 'regression' caused by mame switching to v5 chds. Ie: not actually a regression, just a format change from upstream.

Segfaulting is still a harsh price to pay if you're not supposed to support chd v5.

If you are, it's a bigger bug.

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

chdman says this about the chd if you don't have it:

i30817@AIVAS:/media/i30817/backup/Documents/Games/MAME/tekken4$ chdman info -v -i tef1dvd0.chd 
chdman - MAME Compressed Hunks of Data (CHD) manager 0.160 (Mar 31 2015)
Input file:   tef1dvd0.chd
File Version: 5
Logical size: 2,375,331,840 bytes
Hunk Size:    4,096 bytes
Total Hunks:  579,915
Unit Size:    512 bytes
Total Units:  4,639,320
Compression:  lzma (LZMA), zlib (Deflate), huff (Huffman), flac (FLAC)
CHD size:     735,896,857 bytes
Ratio:        31.0%
SHA1:         f39aa37156245f622a6e19e8a0e081418e247b36
Data SHA1:    020100e7d9fbed862a5d9a262f5a94e1a68df523
Metadata:     Tag='GDDD'  Index=0  Length=35 bytes
              CYLS:5260,HEADS:14,SECS:63,BPS:512.

     Hunks  Percent  Name
----------  -------  ------------------------------------
    44,217     7.6%  Uncompressed                            
   349,541    60.3%  Copy from self                          
    83,257    14.4%  LZMA                                    
     6,283     1.1%  Deflate                                 
    96,612    16.7%  Huffman                                 
         5     0.0%  FLAC        

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

My suspicion is there is a problem in the chd v5 support and I can reproduce it with a chd file here.

$ chdman info -v -i Lunar\ -\ Eternal\ Blue\ \(USA\).chd 
chdman - MAME Compressed Hunks of Data (CHD) manager 0.194 (unknown)
Input file:   Lunar - Eternal Blue (USA).chd
File Version: 5
Logical size: 608,357,376 bytes
Hunk Size:    19,584 bytes
Total Hunks:  31,064
Unit Size:    2,448 bytes
Total Units:  248,512
Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)
CHD size:     205,552,621 bytes
Ratio:        33.8%
SHA1:         e93c3f2cd946e0ea1ea3cdecbf24e55d7acb5732
Data SHA1:    6c6eb7b999056ccdfc2fad2b30858a6bf83e3f7e
Metadata:     Tag='CHT2'  Index=0  Length=93 bytes
              TRACK:1 TYPE:MODE1_RAW SUBTYPE:NONE FRAMES:199641 PREGAP:0 PGTYPE:MODE1 PGSUB:NONE POSTGAP:0.
Metadata:     Tag='CHT2'  Index=1  Length=91 bytes
              TRACK:2 TYPE:AUDIO SUBTYPE:NONE FRAMES:21735 PREGAP:150 PGTYPE:VAUDIO PGSUB:NONE POSTGAP:0.
Metadata:     Tag='CHT2'  Index=2  Length=91 bytes
              TRACK:3 TYPE:AUDIO SUBTYPE:NONE FRAMES:27131 PREGAP:150 PGTYPE:VAUDIO PGSUB:NONE POSTGAP:0.

     Hunks  Percent  Name
----------  -------  ------------------------------------
        71     0.2%  Copy from self                          
    24,885    80.1%  CD LZMA                                 
        75     0.2%  CD Deflate                              
     6,033    19.4%  CD FLAC 

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

Where are you installing RetroArch from? To be very blunt, if you bisected this when posting this issue it wouldn't of sat untouched 17 days...

It appears to be a regression between v1.7.1 and v1.7.2 and only occurs if RetroArch is built with --disable-builtinflac and having a system installed flac. You should be able to work around it by building RetroArch without that configuration flag.

Also what flac version do you have installed? I have flac-1.3.2.

Git bisect revealed this commit.

997c24ae0c45a40e055f9c9d90debc7c13782350 is the first bad commit
commit 997c24ae0c45a40e055f9c9d90debc7c13782350
Author: twinaphex <libretro@gmail.com>
Date:   Sun Apr 22 20:19:07 2018 +0200

    Make FLAC, zlib and LZMA support in libchdr optional

:100644 100644 ef5f2b7a4dcfed293c23d59cd773e6c9861cdac0 81f850788e3f0596c0b23eef58725ebb67f6fc7e M	Makefile.common
:040000 040000 398b2483ef2c5fef31d53cd890d3b8dfe3a75507 f6aaa3af7cc950cb0c60f7910942c7e8a8260015 M	griffin
:040000 040000 eb49719acdbcee0ff2f7a5b1e7815d2d023e0320 fad4edb2a2acab6910edc5e2fa841dd7de321756 M	libretro-common
:040000 040000 74b4c6d5b909f358c9600e1f1256797c271dd6aa 56de2805b7493f236ac8f9ba0c551a110ef8c7f0 M	qb

997c24a

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

The retroarch testing PPA (but the local build has the same problem). My ./configure says it's picking up Checking presence of package flac ... 1.3.1

i30817@AIVAS:/media/i30817/Huggin/Documents/projects/RetroArch$ ./configure
Checking operating system ... Linux (Ubuntu 16.04.4 LTS 16.04)
Checking for suitable working C compiler ... /usr/bin/gcc works
Checking for suitable working C++ compiler ... /usr/bin/g++ works
Checking for pkg-config ... /usr/bin/pkg-config
Checking for availability of switch -std=gnu99 in /usr/bin/gcc ... yes
Checking for availability of switch -Wno-unused-result in /usr/bin/gcc ... yes
Checking for availability of switch -Wno-unused-variable in /usr/bin/gcc ... yes
Checking function sd_get_machine_names in -lsystemd ... no
Checking presence of package bcm_host ... no
Checking function bcm_host_init in -lbcm_host ... no
Checking presence of package egl ... 17.2.8
Checking function ass_library_init in -lass ... no
Checking function pthread_create in -lpthread ... yes
Checking function pthread_key_create in -lpthread ... yes
Checking function dlopen in -ldl ... yes
Checking function socket in -lc ... yes
Checking function getaddrinfo in -lc ... yes
Checking existence of -lminiupnpc ... no
Checking function fcntl in -lc ... yes
Checking function getopt_long in -lc ... yes
Checking presence of package alsa ... 1.1.0
Checking presence of header file sys/soundcard.h ... yes
Checking presence of header file soundcard.h ... no
Checking existence of -lossaudio ... no
Checking function alcOpenDevice in -lopenal ... yes
Checking presence of package rsound >= 1.1 ... no
Checking presence of package libroar ... no
Checking presence of package jack >= 0.120.1 ... 1.9.11
Checking presence of package libpulse ... 8.0
Checking presence of package sdl >= 1.2.10 ... 1.2.15
Checking presence of package sdl2 >= 2.0.0 ... 2.0.4
Notice: SDL drivers will be replaced by SDL2 ones.
Checking presence of package flac ... 1.3.1
Checking presence of package libusb-1.0 >= 1.0.13 ... no
Checking existence of -lusb-1.0 ... no
Checking presence of header file GL/gl.h ... yes
Checking existence of -lGL ... yes
Checking function cgCreateContext in -lCg -lCgGL ... yes
Checking presence of package zlib ... 1.2.8
Checking presence of package libavcodec >= 54 ... 56.60.100
Checking presence of package libavformat >= 54 ... no
Checking presence of package libavdevice ... no
Checking presence of package libswresample ... 1.2.101
Checking presence of package libavresample ... no
Checking presence of package libavutil >= 51 ... 54.31.100
Checking presence of package libswscale >= 2.1 ... no
Checking existence of -lavformat ... no
Checking existence of -lavdevice ... no
Checking existence of -lavresample ... no
Checking existence of -lswscale ... no
Checking presence of header file libavutil/channel_layout.h ... yes
Notice: FFmpeg built-in support disabled due to missing or unsuitable packages.
Checking function dlopen in -ldl ... yes
Checking presence of package gbm >= 9.0 ... 17.2.8
Checking presence of package libdrm ... 2.4.83
Checking presence of package libxml-2.0 ... 2.9.3
Checking presence of package vg ... no
Checking existence of -lOpenVG ... no
Checking presence of package libv4l2 ... no
Checking presence of package freetype2 ... 18.1.12
Checking presence of package x11 ... 1.6.3
Checking presence of package xcb ... 1.11.1
Checking presence of package wayland-egl ... 17.2.8
Checking presence of package wayland-cursor ... 1.12.0
Checking presence of package xkbcommon >= 0.3.2 ... 0.5.0
Checking presence of package xext ... 1.3.3
Checking presence of package xxf86vm ... 1.1.4
Checking existence of -lv4l2 ... no
Checking presence of package xinerama ... 1.1.3
Checking presence of package xv ... 1.0.10
Checking presence of package libudev ... 229
Checking presence of header file linux/parport.h ... yes
Checking presence of header file linux/ppdev.h ... yes
Checking function strcasestr in -lc ... yes
Checking function mmap in -lc ... yes
Checking function vkCreateInstance in -lvulkan ... no
Creating make config: config.mk
Creating config header: config.h
i30817@AIVAS:/media/i30817/Huggin/Documents/projects/RetroArch$ 

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

That bisect makes no sense... if you look at the time i opened this issue, it's much earlier than the commit at 10 april 2018, when that commit is 22 april 2018.

Also i didn't build RA with that flag, unless it's set automatically. I pretty much did ./configure && make DEBUG=1 and nothing else.

I suppose i can try a bisect if you give me a 'early good build' with chd v5 support for me to check... would have to fetch some revisions because i did git clone --depth 1 like the lazy git i am... better check on the net how it's done.

edit: git fetch --depth XXX obvious ...

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

Oh, you're using another file to bisect ofc. So it might be two bugs, joy.

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

I fixed it on my side. It should use the builtin flac by default, but will check if its found or not regardless because the builtin flac may be disabled with the make argument C89_BUILD=1. I'm not sure if my fix will work for you given your comments, could you give it a try? The ppa might be using a system flac too though?

It will still crash with --disable-flac though even if the chd file will run fine then.

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

Also, if the issue still persists, sharing the contents of config.mk would be more helpful than the configure output.

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

I suppose i can try a bisect if you give me a 'early good build' with chd v5 support for me to check... would have to fetch some revisions because i did git clone --depth 1 like the lazy git i am... better check on the net how it's done.

You make your repo not shallow with: git fetch --unshallow. After that you can checkout older release tags until you find one that works or you find none of them worked. For example: git checkout v1.7.1 or git checkout v1.7.0. After you find a good and bad commit or release tag you can bisect normally.

You're right that the commit I bisected happened after your initial failure. I suppose there is more than one issue lurking here... I unfortunately would need to source more chd files to help test further.

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

Did not help. Here is config.mk:

config.mk.txt

edit: opps wrong

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

I don't see anything suspicious in your config.mk unfortunately. My new hypothesis is that only certain kinds of chd v5 files will crash, I don't have many chd files to test this though...

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

Also i tried a checkout of d41ea34 (which is one of the earliest libchd commits ) and it crashed on the same place (with line drift ofc). I think it was always there.

edit: wait a sec, let me retry this...

edit2: uh, no it didn't now. Time to bisect.

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

The next question is if this is something that only happens in RetroArch's libchdr code or is upstream affected too? Assuming upstream is affected, has it since been fixed? I can try to find more chd files, but since you already have affected files it may be easier for you to investigate this.

Do you have any chd v5 files that are not affected? I created mine manually from segacd redump files with chdman.

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

a536532e3079514630ffe32ddf6f35967c610d7f is the first bad commit
commit a536532e3079514630ffe32ddf6f35967c610d7f
Author: Brian Koropoff <bkoropoff@gmail.com>
Date:   Sun Sep 17 22:04:29 2017 -0700

    Unleash the compressed hunks of data

:040000 040000 3f0bd0d6153b11acd9e6cf1c9bcc9e6419aa8baa 137754fad0b6395d943e5c3fb9ea234a3bcd9806 M	qb

this is the bisect result. A warning: before this the chd wasn't 'scanned' (that is inserted into a playlist) but it simply didn't crash with that backtrace. I don't know if this was because RA using different rdb files at the time or something deeper.

edit: or because mame games need both the chd and and the rom file to scan... or just the rom file.

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

Well that commit is unhelpful.

a536532

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

As for others, most of them don't have this problem. The only other here is carnevil, which has the same backtrace and has chdman:


chdman - MAME Compressed Hunks of Data (CHD) manager 0.160 (Mar 31 2015)
Input file:   carnevil.chd
File Version: 5
Logical size: 4,310,046,720 bytes
Hunk Size:    4,096 bytes
Total Hunks:  1,052,258
Unit Size:    512 bytes
Total Units:  8,418,060
Compression:  lzma (LZMA), zlib (Deflate), huff (Huffman), flac (FLAC)
CHD size:     1,467,863,024 bytes
Ratio:        34.1%
SHA1:         5cffb0de63ad36eb01c5951bab04d3f8a9e23e16
Data SHA1:    ba32b7ef9721d730ce58bd753d47fb947b6ae9b6
Metadata:     Tag='GDDD'  Index=0  Length=35 bytes
              CYLS:524,HEADS:255,SECS:63,BPS:512.

i suspect (but didn't bother to confirm) this correlates with using FLAC or not

@orbea
Copy link
Contributor

orbea commented Apr 27, 2018

Do you notice any patterns with working and non-working chd files? With the limited number of files here the only thing I notice is the Compression line.

Compression:  cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)

and

Compression:  lzma (LZMA), zlib (Deflate), huff (Huffman), flac (FLAC)

Do the differences in zlib, flac or huff remain consistent for you?

@i30817
Copy link
Contributor Author

i30817 commented Apr 27, 2018

carnevil and tekken4, wcombat, sscopex crash:
Compression: lzma (LZMA), zlib (Deflate), huff (Huffman), flac (FLAC)

some have a sizable flac size, some have a tiny one - scopex is only 165 hunks but still crashes.

     1,805     0.2%  Uncompressed                            
   318,771    30.3%  Copy from self                          
   682,815    64.9%  LZMA                                    
    23,517     2.2%  Deflate                                 
     1,790     0.2%  Huffman                                 
    23,560     2.2%  FLAC 

sfrushrk.chd, crash:
Compression: lzma (LZMA), zlib (Deflate), huff (Huffman), flac (FLAC)

 1,763,818    96.2%  Copy from self                          
    63,540     3.5%  LZMA                                    
     4,162     0.2%  Deflate                                 
     1,794     0.1%  Huffman                                 
       105     0.0%  FLAC  

cvsgd (capcom vs snk millennium fight something), scan:
Compression: cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)

     5,337     7.8%  Copy from self                          
    56,343    82.1%  CD LZMA                                 
     6,715     9.8%  CD Deflate                              
       250     0.4%  CD FLAC    

jojo, scan:
Compression: cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)

        21     0.6%  Copy from self                          
     3,105    92.4%  CD LZMA                                 
       234     7.0%  CD Deflate                              
         1     0.0%  CD FLAC

hotd3 scan:
Compression: cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC)

etc, so it appears you're right.

@i30817
Copy link
Contributor Author

i30817 commented Apr 28, 2018

I'm thinking that the libchd library chokes on 'chd' which aren't 'cd chd'. Thing is, i'm not sure it needs to scan them. Remember that MAME requires a pair (rom file, chd) in order to play rom files with chds iirc. That's why the chd are in a sub directory in mame.

edit: turns out that the RA Scanner doesn't even 'need' the chds in the directory to 'scan and recognize' the playlist entry.

So a ugly workaround is to move the subdirectories out of the directory, scan the rom directory and move them back in.

Then if you start a game that didn't scan earlier (carnevil for instance) it actually runs (probably because MAME core has its own chd implementation).

This is obviously going against the spirit of the Scanner whitelisting because the most important part of the game doesn't get scanned and could very well be outdated and fail at start... but that would be a much more involved fix.

Can't RA just recognize MAME chd somehow and bail out of scanning them as unneeded, since it can't actually fail the corresponding game? Unless you're willing to do both this ignoring and following mame 'roms' you find to find their corresponding chd if any, which i suppose it's a better idea to 'maintain' the whitelisting, if much much slower.

@legluondunet
Copy link

I have the same issue on Ubuntu 18.04 when I scan my Mame roms directory with Libretro (git from today).

If I start retroarch with --verbose I obtain:

[INFO] CHD '/home/legluondunet/Autres_applications/Jeux/Emulateurs/Mame/roms/kurucham/gdl-0034.chd' crc: bf716c3e
Erreur de segmentation (core dumped)

@i30817
Copy link
Contributor Author

i30817 commented Jul 1, 2018

You can do it by moving the chd subdirectories out of the mame rom folder then moving them back in once the scan is done. But you may also be hit by #6699 if you have a split set because of that bug and since libretro-database is not updating the split set checksums (afaict) and that bug will make much of the scanner useless for mame.

Since the alternative is the games not appearing at all, i'm not sure i should be chuffed about a bug that makes them appear with wrong metadata, but it does make it impossible to tell which game is which for a large amount of them.

@orbea
Copy link
Contributor

orbea commented Dec 27, 2018

I'm going to close this in favor of #6353 since both you and @retro-wertz agree its basically the same and that issue is slightly older with less noise from unrelated issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants