Genesis, MD, Sega CD, 32x Region Bypass/Patching Tool

Started by Tony H, May 31, 2022, 05:08:36 PM

Previous topic - Next topic

Tony H

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...



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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Tony H

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.

The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides


KingMike

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!
"My watch says 30 chickens" Google, 2018

Tony H

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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

ryouga

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.

Tony H

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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Tony H

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
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Felipefpl

Thank you for making this tool for us: i posted about it on ngemu, emutalk and neofighters.  :thumbsup:
Core i7 Celeron Sandy Bridge G460 1.8 Ghz - 4 GB RAM - Win7 x64 - Intel HD Graphics 2000


T92


VideogameScrapbook

#10
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.

Tony H

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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

VideogameScrapbook

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.

Tony H

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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Tony H

Started working on an update (version 1.1).



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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Tony H

Update for ver 1.1:



* 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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Tony H

#16
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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides

Felipefpl

Thank you for your work with this tool.  :thumbsup:

Btw, you forgot to update the tool here https://www.romhacking.net/utilities/1687/
Core i7 Celeron Sandy Bridge G460 1.8 Ghz - 4 GB RAM - Win7 x64 - Intel HD Graphics 2000


Xhojn

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.

Tony H

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.
The Code Hut: http://codehut.gshi.org/

Game Genie codes and ROM hacking guides