Romhacking.net

Romhacking => Personal Projects => Topic started by: Tony H on May 31, 2022, 05:08:36 PM

Title: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on May 31, 2022, 05:08:36 PM
Been working on a new tool that will convert most region locked Genesis, Mega Drive, Sega CD, and 32x ROMs so that they will work in all regions, or specific regions if you prefer.

So far, I've tested it with 5 different ROMs, and it worked with all of them.  Would like to test some more ROMs, so...

If you have a ROM that is region locked and you want it to work with any region, post the name of it here (just the name, not the actual ROM).  I will run it through the tool and see if it works, and will post the results.  If I can find some ROMs that don't work with the tool, I will try to make it more compatible.

The GUI is just for testing and notes right now...

(https://codehut.gshi.org/GenesisRegionBeta.png)

Screenshot shows the Japanese game 'Pulseman' opened.  The game normally only works on a Japanese Mega Drive, and gives you region warnings and won't run if you try to play it on any other console besides a Japanese MD.  After patching it, it plays on any region without any region warnings.

Some ROMs can be easily fixed to run in any region you want just by changing the region letters in the ROM header, but that method doesn't work on many games.  This tool also checks to see if there are region checks in the ROM itself, and will patch those so the ROM is tricked into thinking the console is the same region as the ROM. 

When there is a region check within the ROM (not the region letters in ROM header), the ROM checks the console to see what region it is, and stores the region code of the console in a register (D0).  This tool changes it so that the programing that checks the region of the console is changed so that it stores it's own region code into that register (D0), and the ROM never actually checks the console for it's region.  If the ROM will only work if it sees the Japanese region code in register D0, forcing the Japanese region code into register D0 will make it always run, no matter what console you have.  There are other ways to do this, but this way seemed to be the easiest as far as using it with a simple program.  There also may be other ways that ROMs do region checks, but I haven't seen any so far.  If I find other methods, I may add it to the program for better compatibility.

Functional so far:

* It can open a ROM and tell what region(s) it's for.  Will work with the original style of region codes (JUE), as well as the new style (1, 4, A, F, etc).

* Will show what regions are in the ROM header, as well as ROM addresses of any region checks within the ROM.

* Can patch ROM to work with all regions, and possibly with a specific region (still need to do testing on specific region patches).

* Have the option to create a new ROM when patching (recommended).  If you do make a new ROM, it will automatically add the word "Patched" to the end of your ROM file, as well as the region that it was patched to.  Example, the Pulseman ROM in the screenshot was renamed to "Pulseman (Japan) Patched J.md"

* Tool can tell if the ROM has been patched by the tool before.  If the ROM was previously region patched by the tool, it will give you a warning message saying that you need to use a ROM that hasn't been patched by the tool, since it won't work correctly.  The message also tells you which region the ROM was patched to, in case you forgot.

* It lets you know if your ROM is using the new style of region codes. 

* If it can't figure out what region your ROM is, it may still be able to patch your ROM to work in any region.

Not working yet:

* Button to fix the checksum on Genesis, MD, and 32x ROMs.

* Get 32x and Sega CD check boxes working (since program does things differently with those two systems).  They will be checked automatically.

Still need to do a lot of testing.

All of the testing has only been done with an emulator, but I'm pretty sure it will work on real hardware as well.

Let me know if you have any ROMs you want tested.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on June 09, 2022, 01:11:00 PM
Update: Pretty sure everything (besides the Help/Info buttons) is working now.  Have made these changes/additions:

* Added more types of region checks to search for, which means better compatibility.

* Finished the checksum section, so you can have the program try to fix your ROM's checksum after patching it.  Many games don't use checksum checks, so this section may not be needed with some ROMs.

* Uses an improved check for Electronic Arts checksum issues, and should work on 100% of EA ROMs that use checksum checks.

* Displays the ROM address where EA ROMs start their checksum check routine.

* The checksum section can be used by itself if you'd like, in case you just want to try to fix the checksum of a ROM that you have patched.

* If you have a ROM that uses more than 3 types of the same region check in the ROM (eg. Thunder Force IV, Lightening Force, Sonic CD, etc), the program can only display the first 3, but it writes something in an unused part of the ROM header so the program knows if you've previously patched the ROM.  It will let you open the previously patched ROM again, so you can see the rest of the region checks that it didn't patch the first time.  If there were no region checks left to patch, it won't let you re-open the ROM, since there's nothing left to patch.  In this case, you would just open a new/unpatched ROM.

* The program writes which console/region the ROM was patched to in an unused part of the ROM header, and that region will be displayed in a message box when you open a previously patched ROM, in case you forgot which region you patched.


In most cases, the program actually changes which console the ROM will see when it does a region check. Example: If the ROM is for European Mega Drive consoles and it checks to see what console it's being played on, if that check always sees that it's a European console, it will always work.  This program will make it so that the ROM will always see the console as a European Mega Drive, which means it will always run, no matter which region the console is actually for.  In other words, the program usually doesn't change the region of the ROM, it changes which console the ROM thinks it is.

If the program doesn't find any region checks in the ROM, then it only changes the region letters in the ROM header.  Just changing the region letters in the ROM header works for lots of games.

There are lots of different ways to do region checks and checksum checks, so this program will certainly not work on every game, but it seems to have pretty good compatibility so far.

Still have to do some testing with Sega CD ROMs since I'm not sure how they do region checks, but the program does find region checks in some Sega CD ROMs.

Someone had made a post here on RHDN about a Korean ROM that needed a region bypass code.  I tried that ROM with my region bypass tool, but it didn't find the region check in the ROM.  I have added that type of region check to the tool, so any game that uses a similar type of region check will now work with the program.  The very first random ROM that I tried this new type on ended up using it (Alien Storm), so it appears to be a fairly common method for checking regions.

Jorpho had posted a link to a YouTube video in that post that showed a type of region check for Mickey Mania, so I added that type of check to the program as well.

Link to that post: https://www.romhacking.net/forum/index.php?topic=35060.0

Should have this ready to submit to RHDN in a few days.

(https://codehut.gshi.org/GenesisRegionTool.png)
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: T92 on June 09, 2022, 02:01:10 PM
Nice.  :thumbsup:

Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: KingMike on June 10, 2022, 09:59:51 AM
Quote from: Tony H on June 09, 2022, 01:11:00 PM
Jorpho had posted a link to a YouTube video in that post that showed a type of region check for Mickey Mania, so I added that type of check to the program as well.
WOW, YOUR CONSOLE HAS SOMEHOW BECOME AN NTSC MEGA DRIVE!
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on June 10, 2022, 07:56:39 PM
Quote from: KingMike on June 10, 2022, 09:59:51 AM
WOW, YOUR CONSOLE HAS SOMEHOW BECOME AN NTSC MEGA DRIVE!

I saw that in the ROM.  Someone had a good sense of humor.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: ryouga on June 11, 2022, 04:52:55 PM
I know SSF2 has region checks, I tried to adjust the header but that just broke my rom and I couldn't even change it back.

The Smurf games also have region checks.

I think Tintin in Tibet too.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on June 11, 2022, 09:38:31 PM
I tested those games with the program.  Results:

SSF2 (only tested the E version): Program was able to find and fix the region check in the ROM, however, it couldn't fix the checksum (or some other check?).  Would need to use a Game Genie master code to get it running, but should work in any region.

I've made a few Game Genie region codes, along with any master codes that are needed with them (including SSF2): https://codehut.gshi.org/RegionalBypassGG.txt

The program didn't work with the three other games (both Smurf games, and the Tintin in Tibet game).  Did some checking, and all 3 of those games were made by the same company, so there's a good chance that they all use the same type of region checking.  As you probably know, just changing the region letter codes in these ROM headers doesn't work.

I've already submitted the program to RHDN, so can't add any of this to the current version, but will see if I can get this type of region check for those 3 games figured out and possibly add it to a future update. 

As far as getting that checksum issue fixed (or whatever is causing it not to run after fixing the SSF2 region check), there are a ton of ways that Genesis games do checksum checks, and it's too big of a job getting all of them into a program.  I think I was able to get all Electronic Arts games working as far as fixing checksums (EA games use a different method), but not sure I'd be able to do the rest of them.  Lots of games use a checksum value in the ROM header (at 0x018E) to determine if the checksum is correct, and that's the main way that this program fixes checksum issues.  Once a ROM is patched, the program re-calculates the new checksum in the ROM, and patches that value to ROM address 0x018E.  Works with many games, but not all.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on June 19, 2022, 10:20:36 AM
Available here: https://www.romhacking.net/utilities/1687/

May add more types of region checks in the future for better compatibility.

Early on, someone had asked to make sure that the program would work on Robocop vs Terminator (USA).  After looking, found that it used a way of checking the region that I've never seen before.  Every game I've seen so far either uses the region letters in the ROM header, or they check the Genesis/Mega Drive region code at 00A10001.  Each region has it's own code, so it's very easy for the ROM to figure out what region the console is for.

In Robocop vs Terminator, instead of 00A10001, it uses 00C00004 to determine the region (NTSC or PAL).  After some checking, I found one small mention of how it's done.  At the very bottom of this page, it shows that bit zero of 00C00004 is used to determine if it's NTSC or PAL (0 = NTSC, 1 = PAL): https://segaretro.org/Sega_Mega_Drive/VDP_registers
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Felipefpl on June 19, 2022, 11:53:56 AM
Thank you for making this tool for us: i posted about it on ngemu, emutalk and neofighters.  :thumbsup:
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: T92 on June 19, 2022, 05:49:50 PM
Thanks.
Just added a review.  :thumbsup:
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: VideogameScrapbook on July 16, 2022, 01:28:10 PM
Tony H, could you add a new feature that patches a multi-region ROM to where it selects Japanese content when running on an American Genesis? For example, Bare Knuckle/Streets of Rage uses the same ROM for all regions. It has a different title screen depending on the region of the console. It would be cool to be able to hack such ROMs to easily see the differences without having to use a hardware region switch or temporarily modify emulator settings.

Perhaps your tool already handles this, but it doesn't work with Bare Knuckle. When I use your tool to force the Japanese region, Bare Knuckle boots with a red screen when trying to load with either Auto or NTSC-J using RetroArch Genesis Plus GX or RetroArch PicoDrive.

I browsed through all tools and yours seems to be the closest to this use case. Also there doesn't seem to currently be a patch to force Bare Knuckle title screen on an American console.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on July 16, 2022, 05:32:38 PM
I know exactly what you're talking about with games like Bare Knuckle, but the main purpose of this program was to make ROMs region free so that they will work in all regions.  I may look into your request in a future update.

As far as Bare Knuckle booting into a red screen, if you read the instructions, it tells you that you may need to fix the checksum after patching the ROM, and the program has a section just for doing that.  Any time that you get a blank red screen after making changes to a Genesis ROM, it almost always means that the checksum check has failed.

I just tested the program on Bare Knuckle, and clicking the "Fix checksum" button does fix the red screen, and the game boots fine.  Keep in mind that there are a ton of different ways to do checksum checks in Genesis games, so the Fix Checksum feature won't work on every game.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: VideogameScrapbook on July 16, 2022, 09:33:13 PM
Thanks for the tip about the Fix checksum button being needed. When the pop-up explained that, I looked at the values and noticed they were the same at that point in time, but didn't realize the checksum changed after closing the pop-up directions. To reduce human error and add convenience, you may want to default to an auto fix checksum feature that will do that operation automatically if the checksums don't match.

So after using Fix checksum, I was able to use the patched Bare Knuckle ROM as I desired in Japanese mode, using Auto for region options in RetroArch emulators and using the MegaKey region free feature of the Mega EverDrive Pro on a real NTSC Genesis. So for my particular use case, this tool works as I wanted, thanks again! :)

I'm going to add a positive review too.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on July 17, 2022, 10:20:00 PM
VideogameScrapbook, really glad to hear that it worked on Bare Knuckle to get the Japanese mode working.  Just tested it here with Gens emulator on a PC, and it worked as well.  Who knew. lol.

I think I'll take your suggestion about the checksum feature.  Maybe add a checkbox that is checked by default.  There isn't really a downside that I can think of to always having the checksum fixed, even if the game doesn't do a checksum check.

Also, thank you and T92 for the good reviews, I appreciate them.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on July 23, 2022, 05:40:59 PM
Started working on an update (version 1.1).

(https://codehut.gshi.org/GenesisRegionV11Beta.png)

New version will include:

* A new checkbox for automatically fixing the checksum after patching a ROM.  This will be checked by default, and will give a warning message if you uncheck the box.  There will also be a message if you patch your ROM with the box unchecked saying that your ROM will not have the checksum fixed after patching.  If you leave it checked, it will automatically check to see if the checksums are different after patching, and if they are different, it will automatically fix it for you and give you a message saying so.

* Adding 4 more types of region checks, for a total of 8.  Planning on adding some of the suggestions from above, including: Both Smurf games, Tintin in Tibet, and a couple more.  If you have any more suggestions, let me know.


Program will still allow you to only fix the checksum in a ROM, if that's all you want to do.  In other words, you can fix a checksum in a ROM without having to use any other part of the program.

So far, the auto checksum fix thing is finished/working, but still need to add the 4 new region checks.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 01, 2022, 10:37:12 AM
Update for ver 1.1:

(https://codehut.gshi.org/GenesisRegionBetaV11.png)

* Added a button that puts 32x ROMs into a kind of developers' mode, so it will skip the checksum process.  This will make 32x ROMs boot faster, and there's no need to fix the checksum after making changes to the ROM.

* Started working on improving the "Fix checksum" process.  In version 1.0, all that button does is recalculate the checksum of the newly patched ROM, and writes the new checksum value in the proper place in the ROM header.  Many games only use that checksum value in the ROM header to determine if the game will pass the checksum check, so just fixing that value often works.  However, there are still lots of games that don't use that value for the checksum routine, so started working on improving that to get better compatibility.

* Has better "new style" region code support.

* Changed the type 4 region check a little bit so that it now works on many more games, including both of the Smurf games.

* Added type 5 region check that works on games like TinTin in Tibet.

* As well as the games mentioned in the previous post, it now has support for games like Streets of Rage 2.  With Streets of Rage 2 (USA), you can make it so that it will work on any region with the text always in English, or you can get it to display Japanese text when you set your emulator to Japan.  With games like Streets of Rage 2, there are a ton of this type of region checks in the ROM to determine which language to display, etc.  These types of games use both type 6 and type 7 region checks.



A little bit of info on the new types of region checks...

Type 5: Similar to the type 4 region check (which uses 00C00004 to check if it's PAL or not), type 5 region check uses 00C00005.

Type 6: Tests bit #6 on 00A10001.

Type 7: Tests bit #7 on 00A10001.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 09, 2022, 10:31:33 AM
Ver 1.1 update.

Finished improving the "Fix checksum" section so it has better compatibility now.  The program looks for more checksum routines now, and will either make it so that the ROM always passes the checksum check, or bypasses them.  There are lots of different ways that games do checksum checks, so it won't find them all.  With Electronic Arts and Capcom games, the program will completely bypass the checksum routine, which will make the game start faster.  Normally, the checksum process has to add up every single byte in the ROM to get the checksum value.  This can take up to 3 or 4 seconds to complete.  With the checksum routine bypassed, that will be 3 or 4 seconds of extra time in your day. :-)

Added an option to have the checksum fixing process only fix the checksum in the ROM header (so it matches the actual checksum of the ROM).  Added this option for the off chance that the new version incorrectly bypasses a checksum routine.  After testing it on 30+ ROMs, it never caused any problems, but there are hundreds of games, so I added it just in case.

Partial list of the games that the program now works on with version 1.1:

Almost all Capcom games including: Street Fighter 2 CE, Super Street Fighter 2, Megaman Wily Wars, Great Circus Mystery Starring Mickey, Saturday Night Slam Masters, etc.  Thunder Force 4, Lightening Force, Streets of Rage 2, Contra Hard Corps, Golden Axe, TinHead, Smurfs 1, Smurfs 2, TinTin in Tibet, and many more.  It still won't work on 100% of the games, but seems to have pretty good compatibility.

Program is 99% finished except for testing and adding new information to the help/info buttons.

EDIT: The program now shows ROM addresses for any of the 3 different types of checksum routines it finds.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Felipefpl on August 09, 2022, 03:22:29 PM
Thank you for your work with this tool.  :thumbsup:

Btw, you forgot to update the tool here https://www.romhacking.net/utilities/1687/
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 10, 2022, 05:32:45 AM
This is an awesome tool Tony! I'm trying to patch some 32x roms and found that Tempo when patched to PAL still gives the NTSC only warning.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 10, 2022, 09:27:16 AM
Quote from: Felipefpl on August 09, 2022, 03:22:29 PMThank you for your work with this tool.  :thumbsup:

Btw, you forgot to update the tool here https://www.romhacking.net/utilities/1687/

It's not quite ready yet.  Since there were so many changes with the new version, I'll have to test it on a lot of games to make sure everything works. Will update it on RHDN as soon as it's ready.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 10, 2022, 10:35:53 AM
Quote from: Xhojn on August 10, 2022, 05:32:45 AMThis is an awesome tool Tony! I'm trying to patch some 32x roms and found that Tempo when patched to PAL still gives the NTSC only warning.

I just tried Tempo 32x on the new version (1.1), and it was able to bypass the region lockout so the game runs in any region.

Also tried it on the old version (the version that you have), and it was also able to bypass the region lockout.  I think the problem is that you only tried patching it to Europe/PAL.  If you patch it to USA/NTSC, it should work fine in all regions.

The new version is able to find more region checks in the Tempo 32x ROM than the old version.  Hard to tell for sure what these extra region checks are for without looking closer, but there are 14 of them.  You can try patching all 14 of them with the new version and see if it changes anything.  Just to be clear, there is no need to patch those 14 new region checks with the new version, since the game seems to run fine in all regions without patching them.  You only need to run the program once with that ROM, unless you want to try patching the rest of the 14 region checks.  The program can only patch 3 region checks at a time (of the same type).
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Felipefpl on August 10, 2022, 11:24:51 AM
Quote from: Tony H on August 10, 2022, 09:27:16 AMIt's not quite ready yet.  Since there were so many changes with the new version, I'll have to test it on a lot of games to make sure everything works. Will update it on RHDN as soon as it's ready.

I understand, thanks for the info.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 10, 2022, 01:00:39 PM
Awesome thank you so much Tony! I didn't think to try setting it to USA/NSTC as I assumed it was already set to that. I will give it a try but also looking forward to version 1.1 :)
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 11, 2022, 02:34:01 PM
Version 1.1 is finished:

https://www.romhacking.net/utilities/1687/

Everything seemed to work fine but since there were so may changes, I might have missed something.  Let me know if you find any bugs.

EDIT: The new screenshot isn't showing up.  May have to re-submit it.

This is the new screenshot (have re-submitted it to the site):

EDIT2: Had to clear my browser cache to be able to see the new screenshot in the link above.

(https://codehut.gshi.org/GenesisRegionToolV11.png)

Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 12, 2022, 07:24:19 AM
Hey Tony,

Thanks for the update! I've tried to patch Tempo and even though the tool now says it has patched all region checks (I loaded the rom several times) it still comes up as saying for NTSC only? I also tried patching it for USA and that still brought up the NSTC warning as well.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 12, 2022, 09:13:51 AM
Quote from: Xhojn on August 12, 2022, 07:24:19 AMHey Tony,

Thanks for the update! I've tried to patch Tempo and even though the tool now says it has patched all region checks (I loaded the rom several times) it still comes up as saying for NTSC only? I also tried patching it for USA and that still brought up the NSTC warning as well.

I just tried Tempo 32x again with ver 1.1 and it seems to work fine.  When I patch it using the USA/NTSC option, it plays fine when I have my emulator (Gens) set to Europe/PAL, or on any other region.  There are a lot of matches for the type 4 region check, but I found that I only had to patch the ROM once and it booted fine after that.  The program can only patch 3 region checks of the same type at a time.  The rest of those type 4 region checks that don't get patched on the first try, might cause region problems later on in the game, so you may have to patch the rest of them later if you encounter any problems later on.  Hard to tell what all of them are for without spending some time on it.

Try using a fresh ROM and setting the region to USA/NTSC and only patching it once.  Keep in mind that if you have the "Create new ROM" option checked, it will make a new ROM that will have the word "Patched U" added to it, so it will look like this: Tempo (Japan, USA) Patched U.32x.bin    If you're creating a new ROM, make sure that's the one you use.

If it still doesn't work, let me know what you're playing on (emulator, real hardware/EverDrive, etc).

EDIT: After looking at the name of the patched ROM I posted above for Tempo, I just realized that there is a bug in the program.  The program adds ".bin" to the end of the file name for 32x ROMs.  Will have to fix that.  If you created a new ROM, try removing the ".bin" at the end.  I don't think that's the problem, but won't hurt to try.  The new ROM name should be: Tempo (Japan, USA) Patched U.32x
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 12, 2022, 09:45:09 AM
Yep that's done the trick thanks! Or to be more exact I started with original rom, picked USA/NTSC only and then it worked. It just seems weird to me that picking USA/NTSC allows it to work in PAL but if I pick the European/PAL option it gives the NTSC only message when I boot it  :huh:

Also I threw Lunar Eternal Blue at it, my first attempt was the same that I did for Tempo before you replied and no luck. Now I tried setting to USA/NTSC and also no luck. It comes up with the music player screen.

I'm using Kega FYI and your tool has been a life saver, I only got myself a 32X last week and have been wanting to try the games we never got!
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 12, 2022, 11:17:05 AM
Xhojn, glad to hear that Tempo is working now.

I agree that at first, it may seem a bit unusual how the program works as far as picking a region to patch it to.  If you click on the "Region Info" button in the program, I try to explain how it works.  With some of the region types, it actually changes what type of console the ROM thinks it's running on.  Thinking of it like that might help.  Using Tempo 32x as an example, it's a USA/Japan only ROM.  If the ROM thinks it's running on a USA/NTSC console, it will always start, even if it's actually on a European/PAL console.

With some of the other region types, it does kind of change the region of the ROM (unlike the other region types mentioned above).  Because of the different types of region checks, it makes it difficult to know which region to pick.  If there is only one region, the program will automatically pick the correct one for you, but if there's more than one region (like with Tempo) you may have to experiment.  The Patching section mentions that you may have to experiment with the 3 different regions to see what works.

Generally, if the program doesn't automatically pick the region for you, picking one of the regions that the ROM is for will usually work.  So for Tempo, the ROM says it's for USA or Japan.  You can patch it to either USA or Japan, and it will work in any region.  However, depending on the game, selecting different regions might make the game run differently, so you'll need to experiment.  You might get different languages (eg. Japanese or English), different game/music speed, etc.  Just depends on the game.


Have figured out what caused the 32x ROM naming bug I mentioned in the previous post.  When you go to open or save a 32x ROM with the program, you have to click the little arrow and select "All files" in order to see "32x" ROMs.  When the program goes to rename the 32x ROM, it couldn't find the .32x file extension it was looking for, so it just used the first one it found (which was .bin).

I added "32x" to the list of ROM files that the program will look for, and that solved the problem.  You will no longer have to select "All files" to be able to see 32x ROMs when opening or saving a file.  I will wait a few days before submitting the bug fix to RHDN, since it's a minor bug and doesn't really break anything.  Also, I want to wait to see if there are anymore bugs.


EDIT:  I'll look into Lunar Eternal Blue later, but not making any guarantees.  I'm not completely familiar with how Sega CD games use the bios to determine regions, or if the bios is used at all for regions.  Sonic CD was the only Sega CD game I tested the program on, and the program seemed to work.  Sega CD was added more or less as an experiment.  Will read up on Sega CD and see if I can figure anything out.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 12, 2022, 12:14:23 PM
Hey Tony, thanks for the explanation! I think I didn't get my head around how the patching was meant to work. I thought I should pick the region I wanted it to work in and not the region it's designed for and it will do the rest  :)

I can't stress how awesome this tool is as it has opened the 32x library for me and the .bin hasn't stopped the roms from loading so I wasn't too worried.

Like I said before Lunar EB is something I have already patched manually to work in PAL (I can send what I changed if you're curious?) but wondered if it would work with the tool as I know I have already made it work in the past so I'm not needing it to be able to play  :)
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 13, 2022, 11:43:31 AM
Xhojn, really glad to hear that the program is useful.

When you said that you have already manually patched Lunar Eternal Blue (Sega CD) so it worked with PAL, I assume you mean you patched the BIOS?  If you mean you manually patched the ROM to get it working with PAL, please let me know how you did that.


I did some reading on how Sega CD handles regions and from what I can tell, it's the BIOS files that determine if a game will run or not in different regions.  Once the game is running, there may be more region checks within the ROM for other things.  If you open a BIOS file with this program, it will find at least one region check, but just patching that region check isn't enough to get it to work in different regions.  Luckily, there are region free BIOS files out there.  There will be specific info on where to find the region free BIOS files in the Readme, but in short, just Google something like "sega cd region free bios download".

If you open a Sega CD ROM with this program, it will often find region checks.  What these region checks do depends on the game.  With Sonic CD, they appear to change the speed of the game play and music (50/60hz) when patched with this program.  If you seem to have region problems after you get your game running with a region free BIOS, you can start patching the region checks (if the program finds any) in your Sega CD ROM to find out if that fixes anything.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 15, 2022, 07:46:49 AM
Hey Tony,

The process is fiddly but I'm using the guide from here - https://www.sega-16.com/forum/showthread.php?27751-Burning-Sega-Mega-CD-Games-for-EU-(-AUS-UK-NZ)-US-Japan-Regions but using Zyrobs comment on 07-05-2014, 03:00 AM specifically with using CDMage (version 1.2.1 specifically as I had issues with the more regularly available older version). As it's been a year and a half since I did this I forgot the actual process but you use CDMage to extract an image from the Sega CD game, convert it using ConvSCD and then extract the changed file and import back into the original image.

It's not a simple job which if your tool could get around this I thought would be great. If any of this has interested you and you want any files let me know.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 15, 2022, 05:19:38 PM
Thanks for the info, Xhojn!  Had never heard of ConvSCD that is mentioned in that link, so gave it a try.  It seemed to work fine on the very first try.  Just learned that a Sega CD ROM can be converted to work in different regions.  Neat stuff.  Since there are two different ways to get a Sega CD to run in different regions (ConvSCD or a region free bios), I probably won't add anything like that to my program right now.  Maybe later when I understand better how regions work with Sega CD.  Keep in mind that my Region Bypass program can still be useful after you get a Sega CD running in a different region, since it can find region checks further in the ROM.

While I was fixing the 32x patching/naming bug mentioned above, I realized that there were a couple Sega CD ROM file extensions that had the same problem (.img and .iso).  Have fixed all three, and all 3 are now included in the file search when you open or save a file (you no longer have to click the litte down arrow and select "All files"). 

Will submit the updated version shortly to RHDN that has the bug fix.  It will also include some Sega CD info mentioned above, as well as a little info on how to patch Streets of Rage 2 (US) to get the Bare Knuckle logo and Japanese text.
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on August 16, 2022, 08:47:34 AM
Version 1.1a:

https://www.romhacking.net/utilities/1687/
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Xhojn on August 16, 2022, 03:45:59 PM
Hey Tony, always happy to help and thank you for the update!
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Gilded_Falcon on October 06, 2022, 04:01:03 PM
Great tool.  I can now play Street Fighter 2 remaster.  It plays fine after converting to region locked us to PAL.  However, some of the levels colours are wrong, has anyone else seen anything similar on other games?  Is there a way to fix this?
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on October 07, 2022, 10:41:37 AM
Quote from: Gilded_Falcon on October 06, 2022, 04:01:03 PMGreat tool.  I can now play Street Fighter 2 remaster.  It plays fine after converting to region locked us to PAL.  However, some of the levels colours are wrong, has anyone else seen anything similar on other games?  Is there a way to fix this?

Do you think it's the region bypass tool that's causing the the color problem, or does the color problem occur even before using the region tool?
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Timfollery on October 29, 2022, 10:24:16 PM
Quote from: Tony H on August 11, 2022, 02:34:01 PMVersion 1.1 is finished:

https://www.romhacking.net/utilities/1687/

Hey, great tool! Thanks!
I'm taking my first steps in romhacking, focusing on the Mega Drive. This is a great debugging study tool, especially given the unsatisfying amount of proper programs and documentation for hacking purposes on the MD/GEN, when in comparison to the well-fed SNES, NES and GBA. I have a new favourite toy!

But...
After reading this topic, the program readme file and searching around the net, I'm still stuck with a question: you talked about "region check types"; the program even refers to them by number. But I couldn't find any list or description about how these types of region check actually work. Even if they are common/generic routines, I'm very interested on the kinds of checks each rom does, and which registers and values they read - especially after reading about the region detection features (not necessarily lockouts) on games like Bare Knuckle 2, Mystic Defender, Mickey Mania, OutRun and The Revenge of Shinobi.

Is there such a list?
Title: Re: Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool
Post by: Tony H on October 30, 2022, 11:45:47 AM
Quote from: Timfollery on October 29, 2022, 10:24:16 PMIs there such a list?

Hi, there isn't a list for the 7 different types of region checks that are used in the program, but I can put a quick one together.  Keep in mind that the numbers assigned to them were mostly arbitrary.  I started with the most popular region checks that I had run into.

The program uses pattern searches to find the different types of region checks.  I will list the 7 different patterns below so you can see what it is actually searching for in the ROM.  You can duplicate the same thing with a hex editor if you want to see how it works.  I'll also include my comments at the time for each one.  Glad I added those comments back then, because I had forgotten some of this. lol.

1) { 0x10, 0x39, 0x00, 0xA1, 0x00, 0x01 }; //loads console info/region into register D0 (very common method)

2) { 0x11, 0xF9, 0x00, 0xA1, 0x00, 0x01 }; //loads region into a RAM address (Alien Storm, Mystic Defender (Korean), etc)

3) { 0x41, 0xF9, 0x00, 0xA1, 0x00, 0x01, 0x10, 0x10 }; //puts 00A10001 into reg A0, then loads value from A0 into reg D0 (Mickey Mania)

4) { 0x30, 0x39, 0x00, 0xC0, 0x00, 0x04 }; //uses 00C00004 (bit zero) to check console region (changed with ver 1.1)... 
                                                           //bit zero: 0 = NTSC, 1 = PAL  (Robocop vs Terminator)(added Smurf1, Smurf2 w/ver 1.1)

5) { 0x08, 0x39, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x05 }; //00C00005, bit zero: 0 = NTSC, 1 = PAL  (TinTin au Tibet)

6) { 0x08, 0x39, 0x00, 0x06, 0x00, 0xA1, 0x00, 0x01 }; //BTST#6 00A10001 (Streets of Rage 2) check 66xx versus 67xx??
                                                                            //Bit #6 is for Europe?  Bit #7 is for USA?  Japan doesn't use either?

7) { 0x08, 0x39, 0x00, 0x07, 0x00, 0xA1, 0x00, 0x01 }; //BTST#7 00A10001 (Streets of Rage 2)
                                              //Bunch of BIT#7 matches are probably for English or Japanese text? (first match SoR2 is for region check)


As you can see, 6 out of the 7 use either 00A10001 or 00C00004/5 to do region checks.  If you Google those, there is some info out there.  00C00004/5 is pretty straight forward and uses bit 0 (mentioned above) to determine if it's NTSC or PAL.  00A10001 is a little more involved, but Google should help with that. 

The notes also list some of the games that the specific region checks work on.  These were just commented notes to myself, so let me know if you need more info on any of them.

EDIT: There is a little more info for region check number 2 here: https://www.romhacking.net/forum/index.php?msg=430624