-
Notifications
You must be signed in to change notification settings - Fork 47
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
C2 file appears to never correlate to the log file or .scm file #154
Comments
Is there a same problem when plextor is used? |
Hey Sarami, thanks for getting back. There definitely seems to a problem even when a Plextor is used as well. See attached for a dump in a Plextor PX-W4012TA In comparison to Dump 8, LBA 7 has an error on ofs 92f which should be affecting the last byte in sector 7. This offset is not affected in Dump 7. However, when comparing the two .scms and .c2 files together, assuming my math is right... 7*2352 = $4050 There are no byte differences, despite there being a bad byte in Dump 8 at ofs 92f in lba 7 that isn't present in Dump 7 at the same offset for the same LBA. For the .c2 files... LBA 7's location in the .c2 file is determined as: Since each LBA in the .c2 file is represented with $126 bytes, ofs 92f should be located at the last byte for this lba, which should be at $92F in the .c2 file. However... In the picture above, the highlighted byte ($92F) is 00, indicating no error for both dumps. Even most of the bytes around this offset have no error. There should be a non-zero byte at this address for Dump 8, and a zero byte in Dump 7 at this address too. But both are set to $00, indicating no issues, which contradicts the .c2 log. Here's another set of scm only dumps where one is dumped with an ASUS drive and another with a W4012TA. I haven't had time to look at it, but I'm sure the same issue occurs there. I hope this help! Let me know if you need anything else. |
changed: .c2 file is not shifted by the combined offset. |
Hey Sarami, this looks fixed! I dumped some discs with my PX-760a and things look okay so far. It even fixed a bug I forgot to mention where the last sector's c2 error data was missing from the .c2 file. I'll do some more testing and see if anything comes up with other drives. Maybe this is good to commit? There remains one issue, though. Although the log is correlating to the c2 file now, the log file and .c2 file don't seem to correlate to the .scm. For example: In dump 1 & 2 of this Shaolin disc, LBA 191624 has errors in both dumps. Both dumps were done using a Plextor PX-W4012TA using a UGREEN adapter. However, the affected offsets in both dumps are different: Dump 1:
Dump 2:
When the .scm from both dumps are compared side by side with Beyond Compare, the differences become clear (Dump 1 left, Dump 2 right): Here are what the .c2 files look like compared side by side for this LBA (191624*$126=$35BA430, Dump 1 left Dump 2 right): As you can see in the C2 image, there is an error an error at $35BA493 for this LBA in Dump 1 with a value of $80 (1000 0000). The bit set to 1 in this byte for this LBA can be found at ofs $318, which confirms that the log and the .c2 file both correlate to each other (with the version you provided fixes with). Note, ofs $318 is not corrupt in Dump 2, and is completely fine. However, the problem becomes apparent when you use the location of ofs $318 to find the equivalent affected byte in the .scm file. In theory, because 1 bit in the c2 file = 1 byte in the .scm file, since the ofs in the c2 log are for the bits in the c2 file, simply adding the offsets to the physical address at the start of a given LBA will give you the exact physical address to the affected erroneous byte in the .scm file. So in this case, since LBA 191624 begins at $1ADD2180 in the .scm (because 191624*2352=$1ADD2180), if you add $318 to it, the affected byte for ofs $318 should be located at $1ADD2498. However, this is not correct. Look at the image of the .scm images closely, and you'll see that the corrupt byte is actually located at $1ADD2304. In other words, **the ofs should be $184, NOT $318. ** I think this is a bug, but I could be wrong. Can you look into/explain this? Aside from the issue above with the .c2 offsets and .scm not correlating with each other, there's one more bug I think I found: Sometimes DIC will return this message along with the offsets which looks very strange:
For some reason, instead of the bit size of the error, sometimes DIC will return "00 F0 F0 F0 00 00 00 0F 0F 0F 00", or something similar instead initially. Then it'll print the other affected offsets that I guess can be fixed. Then for the same LBA, it tell you the error size. However, what seems to be happening is DIC will print the byte values for the errors in the .c2 file that can't be fixed, and doesn't list them as "ofs" in the list of erroneous bit offsets. However, the C2 file will have the "00 F0 F0 F0 00 00 00 0F 0F 0F 00" sequence in the .c2 file anyway. It just doesn't seem to be logged properly. Is this a bug or intentional? I noticed this similar error popping up once in a while for some reason. Here's the dump this error came from if you want to take a look: Please let me know if you have any questions. Always willing to help out. :) |
I wonder if this makes all previously made dumps with c2 files corrupt? |
It's true.
It's not so. Because the ofs of the c2 error log contains the combined offset, while .scm is already shifted by the combined offset. In other words, The offset of the .scm is 0.
According to your log, the combined offset is 404 (194h). Then 318h - 194h = 184h |
The .c2 files I think were in this case. But the actual .scm dumps have always been fine. DIC doesn't seem to use the .c2 files for anything at the moment, so it's mostly for information about the dump at this point I think...
Thanks for the reply! The combined offset makes sense. Once the combined offset was determined, I was able to get the exact address for all the other errors just by applying it to the returned ofs for the c2. This also helps explain why sometimes you have return ofs of "0, 1, 2, 3, etc), but there aren't any bytes affected at those offsets within the current LBA. For instance, if you look at LBA 191680, there's an error at ofs 172. However, there is no erroneous byte at 191680 * 2352 + $172, but there is an erroneous byte at 191680 * 2352 + ($172 - $194), which actually puts you on an erroneous byte in the previous sector at $1ADF23DE. So now my next question is, does the combined offset value vary from drive to drive then? If a combined offset is determined for one drive, can it be used for every dump for different discs made with that drive with c2 errors? I think I remember determining the offset for another dump done by another drive, and got a different combined offset but never bothered to check if it could be used to find the locations of everything else. Can DIC determine the combined offset by itself? If not, would it be beneficial to start a database of combined offsets to help DIC provide offsets/address for each c2 error in the logs? If so, I can help contribute as I have many Plextor drives to work with. My other question which I just want to reaffirm is that I noticed that sometimes the erroneous bytes in the .scm sometimes have corrupt bytes in locations immediately around the affected byte. Is this because sometimes error bits can occur across more than one ofs, but the drive only reports it affecting one ofs sometimes? Like take for example 191680 * 2352 + ($172 - $194) = 1ADF23DE. There's an error at 1ADF23DE, but there's also an affected byte right next to it at 1ADF23DF which its offset isn't recorded by the c2 error log. Thanks once again. EDIT: It looks like the combined offset varies from disc to disc, not just drive to drive... |
Combined offset consists of drive offset and write offset of the disc. Drive offset is stored in driveOffset.txt (Original data is accuraterip.com). Write offset is different by discs (see redump.org database).
I'd understand it, but I don't know the reason. For this reason, I've coded val2 ... val4 in /c2 as app can reread all sector when c2 error reports only 1 bit.
As you know, superg says about another c2 offset of plextor DVD model http://forum.redump.org/post/99760/#p99760 , can you verify it if you have plextor DVD model? |
Thanks for getting back. :) Don't have time at the moment to look at these in depth, but if you're curious: So what I did was I dumped a disc I had that has consistent issues with a very small amount of sectors, mostly near the very end, twice in three separate drives - a PX-760A (combined offset 464, C2 offset 295), a PX-W4012TA (combined offset 736, C2 offset 294), and a ASUS BW-16D1HT 3.02 (combined offset 368, C2 offset is 0). Let me know if this helps with figuring out any further issues. If you're still not seeing something, let me know and I'll take a closer look when I have the time. For instance, this is what LBA 207067 looks like in the .c2 files for the PX-W4012TA (left) and PX-780A (right) when compared in Beyond Compare (pointer is at the start of the sector in each file): Likewise, here is the .scm file for both compared to side by side: Ideally, I would like some sort of c2 log or .c2 file (vairant?) that's offset to the .scm itself. That is, taking into consideration both the combined offset and possible c2 offsets too). This way, the C2 log/file is as 1:1 with the errors in the .scm as close as possible. Hope this helps. |
Hey @saramibreak , I'm done with my research on DVD Plextors. So keep in mind, ideally it'd be great to have a version of the .c2 file and the log file with offsets and addresses that correlate directly to the .scm file as much as possible. That's the goal in my opinion. So in a nutshell, I was able to confirm what superg has stated in that thread about DVD Plextors having an additional offset when trying to correlate the C2 ofs to the SCM file. Before your change (which I see you've merged), I think DIC was adding the combined offset already to the error bit locations in the .c2 file. This can work for most of the 'good' CD-ROM based Plextors, but DVD Plextors need an additional offset applied which I'm not sure where it comes from. The only thing that can be done is to compare a bad dump's scm file from a particular drive to a good dump that can be confirmed good. So what I did was took a disc that has a confirmed, good entry in redump.org. I dumped this disc three times in three separate drives to make sure I had a good dump on hand. Then, I purposely introduced a defect to the disc by putting a small piece of tape on the surface of the disc. This way, even though the C2 errors are still inconsistent between reads and different drives, I know that I can expect errors within a general area in the dump. Then I dumped this "defective" disc in as many relevent drives as I could, and came up with the following data: So as a recap, this is what I'm doing. First, I determine the combined offset from the disc log ("Combined Offset"). Then, I take the reported c2 ofs ("First Reported C2 Offset") and affected lba ("First LBA Error (Numerical)") for the first C2 error and plug it into the sheet, calculating the lba into a physical address ("First LBA Error (Physical Address)"). Then I took the .scm file from the bad dump from the respective drive, and compared it to the good dump of the same disc using Beyond Compare. I went to the very first byte difference in the file and input that into the sheet as well ("First Address of Difference (Error) in SCM"). With this information set in the sheet, I calculated the following: "Actual C2 Offset For First Error" - This is the actual offset (from the beginning of the reported sector) to the first actual byte difference in the .scm, for that given sector. This is calculated by "First Address of Difference (Error) in SCM" minus "First LBA Error (Physical Address)". "Correction" - This is the calculated offset to the affected byte in the affected sector if you only took the combined offset into consideration, this way you can see if there's a difference in the actual C2 offset as reported by the SCM file. If a drive requires no additional offset corrections, the value under "Correction" and the value under "Actual C2 Offset For First Error" will be exactly the same. This is calculated by "First Reported C2 Offset" minus "Combined Offset". "Additional Offset" - This is what you're after. Additional Offset is the necessary value that needs to be added to the combined offset in order for C2 ofs to point to locations in the SCM file directly. This is what you need to make DVD Plextors work with the C2 offset file. This is calculated by taking the difference between "Actual C2 Offset For First Error" and "Correction". If the Additional Offset is 0 or 1, the drive only needs the combined offset to be added to the C2 ofs in order for it correlate to the SCM file. If Additional Offset is 8 or 9, the drive needs the combined offset + 8 in order for it to correlate to the .scm file. The one thing you might have noticed is that sometimes a drive can report either 0 or 1, or 8 or 9 for it's "Additional Offset". With C2 there is always going to be some kind of margin of error with whatever the drive actually reports for some reason. But most of the time, even when it appears to be off by 1 byte, the additional offset is still either 0 or 8 for certain drives. That's just the nature of C2. Finally, after all is said and done, I can confirm these additional offset values for the following drives: - ASUS 16D1HT - 0 What I propose:So this is what I think DIC should do with this information. DIC should output versions of the .c2 and log files (_corrected.c2 and c2Error_corrected.txt, or something similar) that are corrected to correlate with the .scm as close as possible. Corrected .c2 and log files can only be generated for drives which have confirmed "c2 offsets" (from the table/list above). So for instance, if I dumped something with a Plextor Premium, it'll provide me the corrected .c2 and log files, as well as the original c2/log files without the combined offset. If I dumped something in a Plextor PX-40TSi, which isn't normally supported by DIC, since there is no record of it's C2 offset, it will only output the original c2/log files without the combined offset added. Unfortunately, since the c2 offset information isn't readily available in a database like accuraterip, we need to calculate it and curate our own database within DIC itself. So DIC would have to include the additional offsets from the table/list above into the program itself in the event the equivalent drives are used. Hope this helps, let me know if you have any questions or want me to test or look into anything else. :) |
Ok. Actually, DIC gets 294 bytes of .c2 from the next sector, that is, c2 offset is 294 ("additional offset 0 drive" you say). This is already supported. |
Uploaded. (Not test) "/s 2" is needed if 712A, 716A, 755A and 760A read the last byte of the c2. |
Hey Sarami, did some testing with this version. The c2 log does still correlate to the .c2 file. However, the c2 log for the DVD plextors seems broken. The "Detected C2 error # bit" line doesn't correctly total the amount of bits found. This only affects the DVD plextors, CD-ROM based plextors are fine (see mediafire link). I'm not sure why that is, but it makes most of the total bit sizes 0.
It does seem that the .c2 file includes the missing sector now. Ideally it would be great if DIC would output 'corrected' .c2/log files that reflect the locations in the scm. That means a version of the .c2 with combined offset, additional offset (if present for certain drives), and reported c2 ofs. Here are the dumps from this version (scm only): |
Fixed
It's ideal but It takes time and effort for "bit shifting". |
Confirmed, has been fixed. Everything looks good now. Do you need to use /s 2 every time in order to get the last byte for the DVD Plextors? Is there a way to have it on by default for these drives? |
Added. |
Works great. I did find one issue, if you use /s to overwrite the automatic set to /s 2 when using a DVD plextor it seems to always set it to /s 2. So if I manually set it to /s 1, it'll always use /s 2 according to the log. It should allow you to force it to use something else for these drives if you want to (especially for Dreamcast stuff, as we'll document someday). Unless you want to try some form of the corrected .c2/log, even if it wont be 100% exact due to bit shifting, I guess that's it for the issue? One small thing I was wondering if you wanted to add/change. Right now in the C2 log and verbose it prints [LBA, LBA number in hex] next to each c2 error bit size and retry. It might be useful to print [LBA, LBA translation to SCM address in hex (LBA * 2352), LBA in C2 file (LBA * 294)] instead. It's up to you, I could probably add it myself. |
Added. |
Works! Thank you for adding it. :) The only issue left is that DIC still uses /s 2 even if you manually enter /s 1 or /s 0 for DVD Plextors. User preference should take precedence over the default setting, imo. H:\Tools\DiscImageCreator>DiscImageCreator.exe cd E MEGAMAN-11-12-test.bin 12 /c2 4096 /q /nl /am /s 1 |
If /c2 is not set, /s 1 or /s 0 for DVD Plextors are enabled. |
Ah okay, no problem. Feel free to merge your changes and close the issue if you don't have any more changes in the pipeline. |
Hey @saramibreak, I think this change might break GD-ROM mode. If i run the latest code for GD discs, I get 4 bit C2 errors on every sector:
|
All logs are needed when bug is reported. |
Here you go, keep in mind i stopped the dump a few seconds in |
Uploaded. |
More changed. |
Better now, no more 4 bit errors every sector. I'm not able to check a GD disc that has actual C2 errors yet but this looks good to me. |
I forgot to mention, not sure if this is a bug or not, but I noticed that sometimes when there are c2 bit errors near the end of the current LBA that sometimes some additional bits are printed, like this: 8f5, 8f6, 8f7, 8f8, 8f9, 8fa, 8fb, 8fc, 8fd, 8fe, 8ff, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 90a, 90b, 90c, 90d, 90e, 90f, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 91a, 91b, 91c, 91d, 91e, 91f, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 92a, 92b, 92c, 92d, 92e, 92f, Is the ofs: 0, 1, 2, 3, 4, 5, 6, 7, line supposed to be there? This only affects DVD plextors it seems, but I'm not sure if this is intentional. I assume this is because its reading error bits that go into the next sector, but they're classified as being part of the current sector being read. See attached for logs. https://www.mediafire.com/file/9k6y03g325l0zro/c2+-+bug+(not+sure).7z/file EDIT: This looks like a bug for printing. The ofs 0-7 in the c2 log for lba 207067 are meant for 207068. This is correct for the old c2 log (the one without the date in the filename). |
If ofs is 7 for plextor dvd drive, it's 92f for plextor cd drive. |
Version
20220909
Describe the bug
(Note - this is a long description, so if you want to jump to the actual issue, go to where it says "Bug description starts here" in bold)
There are a number of weird discrepancies when you try to correlate the .c2 file, the .scm, and the C2 log file together that doesn't seem to make any sense. The c2 error log file that DiscImageCreator generates indicates offsets (for individual bits in the .c2 file for that given LBA, presumably) but those offsets never actually correlate to the location of the actual error bits in the .c2 file. Likewise, the error bits in the .c2 file never seem to correlate to the .scm file either.
I'm not exactly sure why this is, but it might have something to do with the possibility that some Plextor DVD drives have different C2 offsets which are not sector aligned (http://forum.redump.org/post/99760/#p99760). There might also be something else at play here that I'm unsure of.
Although, maybe there's something I'm missing as there's not a lot of documentation on the .c2 file or its logs, so my understanding of this issue is based on what I think I understand of how it works. Please forgive me if I'm mistaken.
This is how I expect the .c2 file and C2 log file to work:
According to the documentation, the C2 file contains a series of bytes where 1 = bit inside the .c2 file correlates to 1 byte in the .scm file. If any bit inside the .c2 file is set to 1, this means that the equivalent byte in the .scm file is marked as "erroneous". For instance, if the byte at $810 is set to $80 (1000 0000), then that means that $810 * 8 (bytes) = $4080 in the .scm file. Therefore, $4080 is the location of the equivalent erroneous byte in the .scm file for the bit at $810 in the .c2 file. However, the location doesn't point to the right spot it seems. (See example below)
The C2 log is a different story. When errors are detected by DiscImageCreator, the LBA of the location of the error is displayed (both in decimal and hexadecimal, for some reason), followed by a list of what I assume to be the offsets to the individual bits in the .c2 file that make up the erroneous bytes for that specific LBA, in hexadecimal. For instance, if DiscImageCreator detects an error at ofs $290 for LBA 6, I should be able to find the erroneous byte in the .scm file by finding the physical address of the LBA (6*2352=$D3EC), then multiply the offset of the bit offset to get the offset of the byte itself ($290 * 8 = $1480), then add the offset to the physical address of LBA 6 to find the location of the affected byte in the .scm file ($D3EC + $1480 = $E86C). DiscImageCreator will then print the number of bit-errors it finds in decimal (with a max value of 2532 bits, for the entire sector).
However, neither the .c2 file nor the C2 log file seem to be accurate at all. The issues can be made apparent by following this example (see the included files to follow along):
Bug description starts here
Inside the .7z, there are two Dumps made from the same CD-R, Dump 5 and Dump 7. Both were dumped using a drive that has the ASUS BW-16D1HT 3.02 firmware.
Consider the .c2 file in Dump 5:
$6E4 is the start of LBA 6, we know that the c2 is 294 bytes per sector ($126) - so $126 * 6 gives us $6E4
$732 is the location of the first non zero byte, indicating an error on the bits that are set to 1. In this case, the byte at $732 is set to $80 (1000 0000), therefore, the most significant bit (MSB) indicates an erroneous bit with "ofs" (offset) $4E.
However, the bug becomes apparent when you look at the C2 log file. According to the log file, it says that the first damaged byte for LBA 6 is located at bit $290 (I assume?). To translate this to the address of the byte inside the .c2 file, if you divide $290 / 8, you get $52, which is 4 bytes away from the original calculated offset - $4E. Is this right or wrong?
Accordng to superg, the author of redumper, the ASUS ASUS BW-16D1HT has a C2 offset of 0x0 (no offset), but a drive offset of +6. Could this be an indicator some implied offset?
https://github.com/superg/redumper/blob/f98fa8d4c9201ec3fc23d02c21ff5dd82c5738e2/drive.cc#L107
I included Dump 7 as well, as LBA 6 in that dump is free from any errors.
Screenshots
N/A
Disc title
Any CD title that will generate C2 errors that can't be corrected.
Log file
(Note: I had to upload the .scm file because it might be the only way to help illustrate the issue)
https://www.mediafire.com/file/nviicq1sg0ftg1e/DIC+C2+Issue.7z/file
The text was updated successfully, but these errors were encountered: