Sega Saturn Region Patcher for CDI Image

Discussion in 'Sega Saturn Programming and Development' started by SONIC3D, Jul 27, 2015.

  1. SONIC3D

    SONIC3D Spirited Member

    Joined:
    Oct 30, 2008
    Messages:
    150
    Likes Received:
    36
    I think most saturn users love Saturn Region Patcher from @Madroms.
    But recently I used CDI image more often becaused I got the Rhea ODE.It's a bit inconvenient to patch the ISO or BIN first then reconvert to CDI if one day you want to switch the region of the converted image.So I decided to make a cdi patcher myself.

    After reversed the cdi format for several days of spare time.I found it's a great container format especially for Saturn.And technically it's RAW image with all gap stored in either 2448 bytes per sector form if you checked the option "R-W(CD+G)" in advanced page of DiscJuggler.So things turn to be a bit easier.

    The whole progress can be described below:
    1.Determine if the image is 2448 bytes per secter CDI image by checking the CDI header.(CDI can be stay in other sector size format which I'm too lazy to support it right now.And the CDI header is stored in the end of cdi file.)
    2.Patch the region string in 1st logical sector.(Skip first 150 sectors as CDI file format defines it.)
    3.Patch the area init string in 2nd logical sector.
    4.Fix the EDC and ECC code for the modified 1st and 2nd sectors.

    So please check the attachment for the program(win32 platform only).
    And source code can be get from:
    https://github.com/SONIC3D/SaturnCDI

    Sorry the code are very ugly.I initially plan to write a full CDI parse class.But as I'm really really busy in real life.I dropped this idea in 30 minutes after I started coding this tool.I just want to make it work ASAP.So the code becomes messy.But as it's really simple.It won't be that hard to understand.And I just have not much time to polish it I think.Got 2 trip plans in this week.Any problem,you can left message here and I will try to fix critical bugs when I see it reported here but may not provide feature extending or improvements.As I said it's just a simple region patcher for cdi image user.

    =============
    Here is the usage tutorial:

    -Usage:
    SSCdiRP.exe <region string> <cdi image filename>
    SSCdiRP.exe JUE test.cdi

    -Image format limitation:
    CDI image file should be made with the option "R-W(CD+G)" checked in Advanced tab of DiscJuggler.
    Or technically says,the image should be 2448 bytes per sector.

    -Region string:
    Region string is used to represent the regions you want to patch your exist
    saturn image to.
    It can be any combination of characters in "JTUBKAEL" in any order.
    -J:Japan
    -T:Asia NTSC
    -U:USA
    -B:Central/South American NTSC
    -K:Korea
    -A:Asia PAL
    -E:Europe PAL
    -L:Central/South American PAL
    It's case sensitive and the order represent the priority in patching.
    Using JUE means you want to patch the image with Japan support in top
    priority and then USA and EUR support as the lowest priority.
    The max count of region that can be applied to the image depends on the
    original region support count.That means if the unpatched disc contains only
    1 region support.Then even more than 1 region supplied in your command line
    arguments.Only the first 1 will be accepted.
    If the region count provided in arguments is less than the original region
    count.Then region code in original region string will fill the rest place as
    much as possible.
     

    Attached Files:

    Last edited: Jul 27, 2015
  2. nonosto

    nonosto Intrepid Member

    Joined:
    Jan 5, 2012
    Messages:
    698
    Likes Received:
    54
    I have a Japanese Saturn, and I use .cdi from Sega Ages PAL on, and no need patch...I try with other PAL Games....
     
  3. SONIC3D

    SONIC3D Spirited Member

    Joined:
    Oct 30, 2008
    Messages:
    150
    Likes Received:
    36
    A game may contain multiple region support max to all 8 regions.
    For example:Rayman PAL release contains 3 different regions support and The Legend of Oasis contains 2 regions support.
    So it sound like your Sega Ages PAL contains Japan region support.But I cannot find any sega ages contains EUR and JAP region.Maybe it's prepatched image before you convert it to cdi.Additional disc id would be helpful to identify the game but anyway as it is executable on your saturn,just enjoy the game.
    =]
     
    Last edited: Jul 27, 2015
  4. Druidic teacher

    Druidic teacher Officer at Arms

    Joined:
    Jun 6, 2006
    Messages:
    3,643
    Likes Received:
    129
    x
     
    Last edited: Jun 22, 2017
  5. SONIC3D

    SONIC3D Spirited Member

    Joined:
    Oct 30, 2008
    Messages:
    150
    Likes Received:
    36
    Sorry,I did't make it clear.I just mean I use cdi more often after I got Rhea.So I plan to trash all my cue/bin format image to reduce redundant data storage.But considering I may back to use burning disc or sharing disc image to other guys for cross region play in future(who knows),I need to keep a tool to modify cdi region easily.

    And I shared this tool to my friends because personally I found teach them patching region is easier to explain the Rhea ini.
    =]
     

Share This Page