saramibreak / DiscImageCreator

This is the disc (CD, GD, DVD, HD-DVD, BD, GC/Wii, XBOX, XBOX 360) and disk (Floppy, MO, USB etc) image creation tool
http://forum.redump.org/topic/10483/discimagecreator/
Apache License 2.0
530 stars 45 forks source link

GD-ROM dumping does not support some directory record sizes #149

Closed Sazpaimon closed 1 year ago

Sazpaimon commented 1 year ago

Version 20220909

Describe the bug When dumping a particular GD-ROM, DIC fails to process the directory record. It appears that it's attempting to allocate a size larger than the maximum buffer size

Screenshots

This drive supports [OpCode: 0xd8, SubCode: 0]
This drive supports [OpCode: 0xd8, SubCode: 1]
This drive supports [OpCode: 0xd8, SubCode: 2]
This drive supports [OpCode: 0xd8, SubCode: 8]
Checking SubQ adr (Track)  3/ 3
Checking SubRtoW (Track)  3/ 3
[F:ExecReadGD][L:118] GetLastError: 87, The parameter is incorrect.

Please wait for 25000 milliseconds until the device is returned
lpCmd: be, 04, 00, 00, af, dc, 00, 00, 1d, f8, 00, 00
dwBufSize: 68208
Retry 1/10 after 10000 milliseconds
[F:ExecReadGD][L:118] GetLastError: 87, The parameter is incorrect.

Please wait for 25000 milliseconds until the device is returned

Disc title Phantasy Star Online (Prototype GD-R, not public yet but I expect this will happen to the final as well)

Disc ringcode GD-R 8B10B2 JFAF A0B20GI1S

Log file logs.zip

Sazpaimon commented 1 year ago

I worked around the issue for now by just modifying this code to force DIC to process the directory size as larger than the buffer size

diff --git a/DiscImageCreator/execScsiCmdforFileSystem.cpp b/DiscImageCreator/execScsiCmdforFileSystem.cpp
index fd488ed..71749ef 100644
--- a/DiscImageCreator/execScsiCmdforFileSystem.cpp
+++ b/DiscImageCreator/execScsiCmdforFileSystem.cpp
@@ -460,7 +460,7 @@ BOOL ReadDirectoryRecord(
                        uiRootDataLen =
                                PadSizeForVolDesc(GetSizeOrUintForVolDesc(lpBuf + 10, (UINT)(pDisc->SCSI.nAllLength * DISC_MAIN_DATA_SIZE)));
                }
-               pPathTblRec[0].uiDirSize = uiRootDataLen;
+               pPathTblRec[0].uiDirSize = uiRootDataLen * 2;

                for (UINT uiPathTblIdx = 0; uiPathTblIdx < uiDirPosNum; uiPathTblIdx++) {
                        INT nLBA = (INT)pPathTblRec[uiPathTblIdx].uiPosOfDir;
saramibreak commented 1 year ago

Uploaded, but not test. DiscImageCreator_test.zip

Sazpaimon commented 1 year ago

Tested, but still doesn't work:

This drive supports [OpCode: 0xd8, SubCode: 0]
This drive supports [OpCode: 0xd8, SubCode: 1]
This drive supports [OpCode: 0xd8, SubCode: 2]
This drive supports [OpCode: 0xd8, SubCode: 8]
Checking SubQ adr (Track)  3/ 3
Checking SubRtoW (Track)  3/ 3
Reading DirectoryRecord    7/  12EndTime: 2022-10-02T02:34:38-0400

logs.zip

saramibreak commented 1 year ago

Some fixed. DiscImageCreator_test.zip

Sazpaimon commented 1 year ago

This time it doesn't exit, but voldesc.txt is missing entries. Here's the output from your test version and an output from version i modified using the hack at https://github.com/saramibreak/DiscImageCreator/issues/149#issuecomment-1242802456 test ver hack ver

saramibreak commented 1 year ago

Thanks logs. Uploaded but I can't test it. DiscImageCreator_test.zip

Sazpaimon commented 1 year ago

Some files are still missing from the VolDesc log. The specific files missing are:

/WS_DATA_ES.BIN
/WS_DATA_FR.BIN
/WS_DATA_JP.BIN
/WS_DATA_US.BIN
/ZARATHUSTRA.ADX
/ZENMETU.ADX

They are all in LBA 45047

Here is the volDesc.txt log for this test version PSO USA Region 11-2_volDesc.txt

saramibreak commented 1 year ago

More fixed. DiscImageCreator_test.zip

Sazpaimon commented 1 year ago

This looks good, I compared it to all the files on the disc and they all seem to be there. Thank you for the fix!

saramibreak commented 1 year ago

Thanks all testing.