Convert GDI to ISO

Discussion in 'Sega Dreamcast Development and Research' started by gorgyrip, Dec 5, 2016.

  1. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    It may be an emulator bug then? Try turning off dynarec, it'll be slow but might help on corner cases.
    It could also be a weird image? DC only reads the big endian TOC.

    But yeah it's weird.

    Found my proof of concept: https://pastebin.com/kqMNEwXg

    It works on track03 of a 5+ track game. You should use dummy track01 and 02, convert the last track to iso yourself, and edit the .gdi file manually so the data tracks are in 2048 mode.

    It might help you until I finish adding gdishrink to GDItools.
     
  2. Korn16ftl3

    Korn16ftl3 Robust Member

    Joined:
    Jun 26, 2017
    Messages:
    200
    Likes Received:
    19
    Holy crap what did I get into dealing with these gdi files.....it seems to be a very intricate job making a game from a gdi that fits on a gr that is not completely ruined......is there a specific tutorial or a for dummies guide on this? Lol just wow all the tools listed above to get a game to work on a cd-r because they are on a special dead disc format that dosent play dvd format......just wow
     
  3. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    Well using what's basically an oversized CD-Rom was part of the copy protection. So I guess they did that part of their job right!

    Most games can be made more than playable even with downsampling though. yzb even managed to fit Skies of Arcadia properly using custom compression/caching techniques.
     
  4. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    520
    Likes Received:
    624
    FamilyGuy said it first but he's correct. Most games will fit easily! The rest will maybe need a little movie re-encoding, maybe some audio trimming, maybe some file relinking.Then you get to the tricky games that require "extra" and "special" work.

    What game are you working with?
     
  5. Korn16ftl3

    Korn16ftl3 Robust Member

    Joined:
    Jun 26, 2017
    Messages:
    200
    Likes Received:
    19
    Any/all in all honesty, I obtainted a complete redump set which of course are all in gdi format not cdi like I'm used to dealing with for the DC, I'm just trying to get educated what exactly to do with said files because as mentioned they are redump and all file sizes are larger than a cd-r (for obvious and already mentioned reasons)
     
  6. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    520
    Likes Received:
    624
    Pick one.

    We can go through it together. Find one that only has 3 or 5 tracks
     
  7. Korn16ftl3

    Korn16ftl3 Robust Member

    Joined:
    Jun 26, 2017
    Messages:
    200
    Likes Received:
    19
    Giga wing 2 fits the bill well
    Screenshot_2017-10-17-04-59-25.png

    I suppose my first question here would be why specifically 3 or 5 tracks?
    Giga wing 1 has like 12 (that's why I didn't select that one to begin with)

    Screenshot_2017-10-17-05-06-02.png
     
    Last edited: Oct 17, 2017
  8. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    Track 4 of a 5 tracks GD-ROM is usually a dummy track, so you can ignore cdda altogether, which is simpler.

    Only tracks 3+ are actually used by the Dreamcast for game data. If there are no cdda tracks (called gdda on a GD-ROM, the same PCM/wave studio than on music cd), then there's only a single data track, track03, except the aforementioned exception. If the game has cdda audio tracks, the TOC for the data stays in track03, but before the actual files are written to disc audio tracks 4 to N-1 are inserted. The last track, trackN, contains the actual files; track03 points to them directly.

    So basically, a 5+ tracks GD-ROM is like a book, but the first few chapters have been whited-out in the TOC and cut out and replaced by an audio CD in the text. The remaining in the TOC still references later chapters though.

    It's then more obvious why there are no retail 4-tracks GDI, although that would work and we use this when shrinking GDIs.
     
    Last edited: Oct 17, 2017
  9. Korn16ftl3

    Korn16ftl3 Robust Member

    Joined:
    Jun 26, 2017
    Messages:
    200
    Likes Received:
    19
    Wow....ok I'm gonna come back to this post and get a bit more in depth when I'm out of work....I think I need a better understanding of a few things and to re-describe what you said to make sure I understand it....I'll get back with yall in a bit

    I think I need a better understanding of the order the dreamcast games need to be in and what a cdda is (I know toc is table of contents) I'm aware dc games need to have a certain order for which the data is burned.....if I'm following correctly tho in an image that contains 3 audio tracks.....track 1 and track 2 are just blank/dummy tracks and track 3 is the only track with actual data content
     
    Last edited: Oct 17, 2017
  10. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    A GD-ROM as two main sections: a low density area and a high density area.

    The low density area is at the beginning of the disc and is exactly like a cd, except it's small, under 10minutes of equivalent audio time, in order to fit the high density area afterward on the remaining of the disc. This area always has two tracks, a data one and an audio one. It can contain boring data about the game and a warning audio track ("this disc is fur use only on a Serge Dreamcast") or bonus art/funny audio (e.g. Sonic adventure IIRC).

    The high density address is hidden for a normal cd-drive and starts at 10min of equivalent audio time. It is cake high density because the pits on the C disc are closer together than on regular CD so it can hold more data, around 1GB in the HD area. This area contains tracks03+.


    CDDA (compact disc digital audio I think) is the standard way to write audio data to a cd so that it can be played in an audio player. It's basically 16bits PCM 44.1kHz IIRC with some error detection/correction on disc.
     
    Last edited: Oct 17, 2017
  11. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    So you made me think about my GDIshrink approach and I realized the coding structure I had used so far, OOP, wasn't really fit for this task.
    So I put aside all that I had written in about a year or so and coded a procedural function that seems to work well. It's under 200 lines long, with some code borrowed from my previous approach.

    It took me two evenings, and a preliminary version is available right now.

    Teaser (ipython shell):
    Code:
    In [1]: from gditools import gdishrink
    
    In [2]: %time gdishrink('/home/user/folder/small/disc.gdi', '/home/user/folder/small_shrinked')
    
    GDIshrink results on /home/user/folder/small/disc.gdi:
        Input:    1187.718 MB
        Output:     28.931 MB
    Saved 1158.787 MB, or 97.56% at 2.44% compression ratio!
    
    CPU times: user 296 ms, sys: 28 ms, total: 324 ms
    Wall time: 325 ms
    
    In [3]: %time gdishrink('/home/user/folder/big/disc.gdi', '/home/user/folder/big_shrinked')
    
    GDIshrink results on /home/user/folder/big/disc.gdi:
        Input:    1226.476 MB
        Output:   1032.859 MB
    Saved 193.618 MB, or 15.79% at 84.21% compression ratio!
    
    CPU times: user 1.33 s, sys: 560 ms, total: 1.89 s
    Wall time: 1.9 s
    
    First disc is a random beta I had laying around, a 5tracks GDI with very few actual data. Space is mostly saved by removing padding data.

    Second disc is Sonic Adventure, which is a pretty tight fit for a GD-Rom. Space is mostly saved by the bin2iso conversion and dummy low-density tracks.

    The mostly untested code is available, as-is, right now on sourceforge: https://sourceforge.net/projects/dcisotools/

    If you or someone else want to test it on Windows/macOS/Linux with both 3tracks and 5+tracks games, I'd appreciate it. You can either specify a different output folder than the input one or use the same one, please test for both.

    I am not responsible for lost data ;), back it up!


    Once it's tested properly on Linux and Windows, I'll add the gdishrink option to the main gditools function and code a function to do it on a folder recursively for those with GDEMU/USB-GDRom.


    Please note that such "compression" is not a good candidate for archival purpose even if it saves space. Data from the first two tracks IS LOST as well as anything that might be put in the padding, there are fun stuff there on some betas at least.
     
    Last edited: Oct 18, 2017
    SiZiOUS and fafadou like this.
  12. Korn16ftl3

    Korn16ftl3 Robust Member

    Joined:
    Jun 26, 2017
    Messages:
    200
    Likes Received:
    19
    Not sure about how to use your program exactly but indo appreciate your patience and taking the time to help me understand what exactly is going on with a gdrom, I truly am fascinated by how this particular console works and it's methods of copyright protection and things of that nature....it's probably the only system I have ever had issues understanding because of its obscure gdrom it's layout and how it works.

    Any ways....is that tool you would like tested cd line from winows 10 or is it a guide style? What should I know to operate it. I'm not concerned about lost data my set is safely rared up I'll jist extract something and work within a folder for all the testing purposes
     
    Last edited: Oct 18, 2017
  13. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    You will need Python 2.7, which you can install tons of different ways on Windows, I suggest Python XY but there are others.

    Then just do as I did in the code snippet, but adapt the function arguments to point to a GDI file and an output folder on your system.
     
    Last edited: Oct 18, 2017
  14. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    520
    Likes Received:
    624
    Do you have time for me to pick your brain about something?

     
  15. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    The python install is needed for gditools, not my selfboot pack.

    I checked on my XP vm and I'm using daemon tools 4.30.4.0027 and it works, so maybe try to use this one? Does older programs still work under Win10? I never really used it.
    If you're testing on emulators, try to test the mounted CDI after conversion instead of the mounted vanilla NRG.

    If you can find an old XP CD laying around, a WinXP virtual machine has low overhead and works wonder for my selfboot pack.

    You can try quote the output of the console when you run the pack, so I can see if there's an issue.
     
    Last edited: Oct 18, 2017
  16. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    520
    Likes Received:
    624
    win10 wont let run that version (i previously used 4.48.1 and it was perfect) nothing else has changed. i could do it in a vm but disk access is mucho slow. Ill keep chipping at it and see if i can get it back working. Everything works in windows 8.1
     
  17. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    Maybe you can try thinapp.
     
    Mrneo240 likes this.
  18. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    520
    Likes Received:
    624
    I got it.... everything was working well but i got screwed by some folder permissions. Got it sorted and now everything is back to working on Win10. thanks for the help and replies!
     
    -=FamilyGuy=- likes this.
  19. SiZiOUS

    SiZiOUS Spirited Member

    Joined:
    Mar 27, 2009
    Messages:
    121
    Likes Received:
    169
    Hi there,

    I've tested several GDI images, with various tracks count.
    Here is my test protocol:
    1. Choose relevant GDI to test.
    2. Shrink the GDI.
    3. Extract both unshrinked and shrinked GDIs.
    4. Compare extracted files CRC from both versions.
    5. If extracted files are identical between versions, then I consider the shrink algorithm OK.

    Name: Segakara for Dreamcast v1.002 (2001)(Sega Music Networks)(NTSC)(JP)[!][Dreamcast Karaoke, HKT-4301]
    Type: 3 tracks
    Result: OK!
    Code:
    GDIshrink results on disc.gdi:
        Input:      1188.202 MB
        Output:      697.439 MB
    Saved 490.763 MB, or 41.30% at 58.70% compression ratio!
    Name: Demolition Racer - No Exit Demo Disc v0.800 (2000)(Infogrames)(NTSC)(US)[!]
    Type: 5 tracks
    Result: FAIL! (WARNING.DA different) - I should retest the process on this GDI image
    Code:
    GDIshrink results on disc.gdi:
        Input:      1187.718 MB
        Output:       28.503 MB
    Saved 1159.215 MB, or 97.60% at 2.40% compression ratio!
    Name: Dorimaga GD Vol. 5 v2.000 (2000)(Softbank)(NTSC)(JP)[!]
    Type: 13 tracks
    Result: OK!
    Code:
    GDIshrink results on disc.gdi:
        Input:      1187.850 MB
        Output:      501.046 MB
    Saved 686.804 MB, or 57.82% at 42.18% compression ratio!
    Name: Dream Passport v1.013 (1998)(Sega)(NTSC)(JP)[!][610-7055-0001A 2MB7]
    Type: 5 tracks
    Result: OK!
    Code:
    GDIshrink results on disc.gdi:
        Input:      1187.906 MB
        Output:       46.459 MB
    Saved 1141.447 MB, or 96.09% at 3.91% compression ratio!
    Name: Dreamcast Express Extra v1.001 (1999)(Sega)(NTSC)(JP)[!]
    Type: 18 tracks
    Result: OK!
    Code:
    GDIshrink results on disc.gdi:
        Input:      1187.850 MB
        Output:      797.061 MB
    Saved 390.789 MB, or 32.90% at 67.10% compression ratio!
    Name: Dreamkey Version 2.0 v1.000 (2000)(Sega)(PAL)(M5)[!]
    Type: 5 tracks
    Result: OK!
    Code:
    GDIshrink results on disc.gdi:
        Input:      1200.470 MB
        Output:      115.343 MB
    Saved 1085.128 MB, or 90.39% at 9.61% compression ratio!
    Everything is almost fine, I should just test Demolition Racer - No Exit Demo Disc v0.800 (2000)(Infogrames)(NTSC)(US)[!] again, because I suspect an error from my side when extracting the files from the GDI images. More info to come :)
     
  20. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,097
    Likes Received:
    1,046
    Thanks for testing! What OS did you use?

    For the failed test:
    It actually should be fine! My function has a sanity check, albeit one simpler than yours, to ensure the relevant data is properly copied: it extracts the last file of the GDI, both before and after shrinking and ensures it's the same.

    Warning.da is probably simply a file pointing to the track04.raw, "this disc is for use only on Sega Dreamcast". You can check this by listing its lba using GDItools. It's unused by every game I've seen.
     

Share This Page