alucryd / oxyromon

Rusty ROM OrgaNizer
Other
111 stars 13 forks source link

[Issue] Error when importing IRD #68

Closed TylerVigario closed 4 days ago

TylerVigario commented 1 year ago

Having trouble importing IRDs.

oxyromon import-irds BLUS30110-2E08BA66207D3EE1F4DA0FCBBACBAF87.ird
thread 'main' panicked at 'Mismatch between definition and access of `IRDS`. Could not downcast to TypeId { t: 5238906532529218491 }, need to downcast to TypeId { t: 13071160232378903960 }
', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-4.1.4/src/parser/error.rs:30:9

Looks like a Type Error, hopefully it's not upstream.

alucryd commented 1 year ago

Yeah, that's odd, sounds like a regression with the latest clap update. I was extracting arguments a little bit differently in import-irds compared to import-dats, please try: https://github.com/alucryd/oxyromon/commit/f07dad872a590075b8dcbfc89f1eed79bcf38242 Seems to work fine here.

TylerVigario commented 1 year ago

Unfortunately I get a new error.

oxyromon import-irds BLUS30110-2E08BA66207D3EE1F4DA0FCBBACBAF87.ird
IRD Version: 9
Game ID: BLUS30110
Game Name: DYNASTY WARRIORS 6
Update Version: 2.10
Game Version: 01.00
App Version: 01.00
Regions: 3
Files: 207
⠁                                                                                             Please select a game: Dynasty Warriors 6 (USA)
⠁                                                                                             thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/import_irds.rs:288:55
alucryd commented 1 year ago

Could you send me that file? That shouldn't happen, unless there's something missing in the file or it's a version I haven't encountered yet (there are multiple IRD revisions out there).

Edit: Well I got one for this game on https://ps3.aldostools.org/ird.html and I can import it fine, will see with yours.

./target/release/oxyromon import-irds ~/Downloads/BLUS30110-2E08BA66207D3EE1F4DA0FCBBACBAF87.ird
IRD Version: 9
Game ID: BLUS30110
Game Name: DYNASTY WARRIORS 6
Update Version: 2.10
Game Version: 01.00
App Version: 01.00
Regions: 3
Files: 207
⠁                                                                                                                                 
Please select a game: Dynasty Warriors 6 (USA)
TylerVigario commented 1 year ago

Strange, that's the same one. I was about to pass the direct link for Dynasty Warriors 6 (USA) - https://ps3.aldostools.org/ird/BLUS30110-2E08BA66207D3EE1F4DA0FCBBACBAF87.ird

How should I go about debugging this? My server is Fedora Linux 37 (Server Edition) and I develop on my Windows 11 machine (don't hate me).

alucryd commented 1 year ago

How should I go about debugging this? My server is Fedora Linux 37 (Server Edition) and I develop on my Windows 11 machine (don't hate me).

Too late :P

Can you try that binary? https://www.dropbox.com/s/4fmmnfji7n9a4z6/oxyromon.tar.xz?dl=0

Might be down to the rust version, using 1.67 here that came out a few days ago.

TylerVigario commented 1 year ago

Same error unfortunately.

Local Rust v1.66.1, but you compiled with the newer version right?

alucryd commented 1 year ago

Yeah, that binary is built using 1.67. Might be a pain to debug, but you can set up vscode to use CodeLLDB to debug rust, here's an excerpt from my debug configs:

{
            "type": "lldb",
            "request": "launch",
            "name": "Debug executable 'oxyromon::import-dats'",
            "cargo": {
                "args": [
                    "build",
                    "--bin=oxyromon",
                    "--package=oxyromon"
                ],
                "filter": {
                    "name": "oxyromon",
                    "kind": "bin"
                }
            },
            "args": [
                "import-dats",
                "-f",
                "-a",
                "/mnt/server/Emulation/Temp/FinalBurn Neo (ClrMame Pro XML, Neogeo only).dat"
            ],
            "cwd": "${workspaceFolder}"
        },

You can easily adapt that to import-irds and inspect the irdfile variable to understand what's going on.

alucryd commented 1 year ago

@TylerVigario I forgot to ask, did you import the redump ps3 dat first? Didn't think of it earlier because I had that written down in the documentation, sorry :/ IRDs need to be associated to a game from a ps3 system (in the context of oxyromon).

TylerVigario commented 1 year ago

@alucryd Sorry, I've been busy at work lately. Just double checked to make sure I have the PS3 DAT (using Oxyromon to download) imported. Hopefully, I get some time this weekend to attempt debugging.

TylerVigario commented 1 week ago

Getting a new error now-a-days

oxyromon import-irds 'BLUS30289_0FB1AF14_55F1FD74_603D0C92_CA57698D.ird'
thread 'main' panicked at src/import_irds.rs:193:43:
called `Result::unwrap()` on an `Err` value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
alucryd commented 5 days ago

Thanks for the heads up, I'll revisit this one before putting out a new release.

alucryd commented 5 days ago

@TylerVigario That was my bad, I recently commented a code block because clippy complained I didn't use it, except when you skip reading bytes in a binary file, it shifts everything... I was able to import this one, and the previous one you had issues with. The only minor issue with dynasty warriors 6 is that the IRD file is all caps, and redump is not so unrelated games are appearing first. I think I'll make the distance search case insensitive.

alucryd commented 5 days ago

Done, please let me know how that goes, I'll most likely be releasing 0.19.0 this evening.

TylerVigario commented 5 days ago

Getting this now

# oxyromon import-irds './BLUS30289_0FB1AF14_55F1FD74_603D0C92_CA57698D.ird'
IRD Version: 9
Game ID: BLUS30289
Game Name: James Bond 007: Blood Stone
Update Version: 3.50
Game Version: 01.01
App Version: 01.00
Regions: 5
Files: 202

Please select a game: 007 - Blood Stone (USA) (En,Fr)

thread 'main' panicked at src/import_irds.rs:286:55:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)
alucryd commented 5 days ago

That's better than your previous error! Might be an issue with isoinfo, what version do you have installed, and on what system? I can try to reproduce your environment and debug there.

alucryd commented 4 days ago

BTW, if isoinfo is indeed the issue, I might be able to replace it with a native rust crate, cdfs, in fact I think I'll just do that regardless, won't say no to less external dependencies.

TylerVigario commented 4 days ago

System

# cat /etc/os-release
NAME="Fedora Linux"
VERSION="40 (Server Edition)"
...
SUPPORT_END=2025-05-13
...

Oxyromon

# oxyromon info
Version: 0.19.0

Dependencies:
  7-zip: found (24.07)
  bchunk: found (1.2.2)
  chdman: found (0.266)
  ctrtool: found (1.2.0)
  dolphin: found (unknown)
  isoinfo: found (1.1)
  maxcso: found (1.13.0)
  nsz: found (unknown)
  wit: found (3.05a)

Systems: 49
Games: 21149
Roms: 43581

IsoInfo

# dnf provides /usr/bin/isoinfo
Last metadata expiration check: 0:00:40 ago on Thu 04 Jul 2024 07:22:43 AM PDT.
genisoimage-1.1.11-54.fc40.x86_64 : Creates an image of an ISO9660 file-system
Repo        : @System
Matched from:
Filename    : /usr/bin/isoinfo

genisoimage-1.1.11-54.fc40.x86_64 : Creates an image of an ISO9660 file-system
Repo        : fedora
Matched from:
Filename    : /usr/bin/isoinfo
# isoinfo -version
isoinfo 1.1.11 (Linux)

IRD

alucryd commented 4 days ago

Ah! That explains it :) This is not the right isoinfo, you need the one from cdrtools, should probably make that more obvious on the readme instead of just linking to the project.

Then again I think I'll change anyway as cdrtools is old and unmaintained, unfortunately cdfs won't cut it as it doesn't seem to provide start sector information which I need, so the next best thing would be to switch to iso-info from libcdio which is modern and maintained.

TylerVigario commented 4 days ago

@alucryd That explains it! The package comes by default in Fedora. However, I'll get switched over to the desired one.

EDIT: That fixed it! Thank you very much

alucryd commented 4 days ago

@TylerVigario I pushed a new ird branch which uses iso-info from libcdio instead of isoinfo from cdrtools. On Fedora it comes from the libcdio package.

I'll still investigate cdfs, as I don't think it's easy to get either program for windows users, and it feels wrong to use an external program to parse the venerable and well documented ISO9660 file format. If push comes to shove I'll just rewrite a parser myself, shouldn't be much harder than parsing IRD files.

alucryd commented 4 days ago

Oh well, managed to get cdfs to work, it does provide a way to get extent locations in an undocumented header structure. Will finalize and merge tomorrow.

alucryd commented 3 days ago

It's up in the develop branch, as a bonus it now has a dedicated unit test too, my coverage badge will be happy!

Thank you for the upgraded sponshorship, it's very kind of you :)