Doenst like the paths, big surprise. I tipically build it like:
make platform=win32 CXX=x86_64-w64-mingw32-g++ \
WINDRES=x86_64-w64-mingw32-windres \
CC=x86_64-w64-mingw32-gcc
The StartHunk logic was flawed and while working with CHD files before v5 didn't work for v5 (and above).
The extraframes logic did work in some cases (read 3 track CHDv5) but didn't work in all cases and was merely a hack in retrospective.
Thanks to the comment of @flyinghead (see also b6c2508922 (diff-cb507bb17d74342aa45b6e4d10d607af)) the logic is now correct and works for v4 and v5 files.
If the frame count is not dividable by 4, there are extra frames added to keep a padding.
This is true for F355 (450 frames -> 2 extra frames) and others.
Also move CD_TRACK_PADDING to chd.cpp to work around problems with including from C and C++.
Now it actually says something about what exactly it tries to open, also on "cancel" it exits gracefully.
Proposal: instead of checking one thousand return codes, which are easily ignored, I suggest using an exceptions (this part of emulator doesn't require execution speed, so exceptions here would be just fine).
Pier Solar and the Great Architects CDI uses an unknown type 4 sector of
2448 bytes. This hack allows the CDI to be read. Not sure about the
correctness.
Same problem as https://github.com/libretro/reicast-emulator/pull/24
in unix that iteration would not work if the path of the original .gdi file (where we are finding the 'parent directory') was:
1. not existent, ie a gdi on the same directory as the current. It was iterating until the index 3 and stop there. Disaster strikes later ofc, if the first characters weren't C:\ or other thing like that.
2. in a relative subdirectory that is 'small enough' ie: a/crazy-taxi.gdi. In this case the last '/' wouldn't be found, the derived string would be 'crazy-taxi.gdi' and the file not found ofc.
Anyway, this can be solved simply by searching the whole string and using a signed integer. It will go up to -1, stop iteration and increase to 0 on the len++.
Dunno if using relative subdirectories for the tracks on *other* platforms works because of the path separator being different from what's inside the gdi but with this code fixed it works on linux with / at least.