Language detection for region lock

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Language detection for region lock

Post by oofwill » Thu Feb 16, 2012 7:24 pm

Hi,

Is there any way to detect my megadrive language setting ingame?

I've done a region lock by video mode (50 or 60Hz) but how can i detect the language so i can allow the game only boot on japanese system?

(i'm working with SGDK, not in asm)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Feb 16, 2012 9:08 pm

No such thing. The only thing the MD allows is:
Domestic NTSC (domestic as in Japan)
Domestic PAL
Foreign NTSC
Foreign PAL

That's it. Check bit 7 of the version register (byte at $A10001) to see if it's domestic (0) or foreign (1), and bit 6 to see if it's NTSC (0) or PAL (1).

SEGA required people to encode which "region" was allowed in the "country code" byte... instead of U or E or J or anything else, which had no chance of ever being validated, SEGA changed it to a hex digit from "0" to "F" where the bits of the hex digit stood for one of the qualifications I listed at the top.

b3 = Foreign PAL
b2 = Foreign NTSC
b1 = Domestic PAL
b0 = Domestic NTSC

So a "world" rom became "F", any PAL region became "A", and any NTSC region became "5". Of course, it's up to the game itself to check that the code matches the version register values - none of that is enforced via hardware.

If you want a better more secure way to verify a region, you have to build custom hardware into your cart.

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Thu Feb 16, 2012 9:42 pm

Thanks for this clear response.

I don't know how to check version register since i'm working with SGDK's basics commands. (I have just started programming on MD...)

I suppose i had to learn more about asm programming ^^

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Feb 17, 2012 1:23 am

Just use standard C pointer memory access. You see examples all through the sgdk code.

Code: Select all

    vers = *(u8 *)0xA10001;

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Fri Feb 17, 2012 9:52 am

Many thanks for this!

I can now detct what region is the MD used :)

Thanks again!

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Sat Feb 18, 2012 12:34 am

Or you could program a menu to let the users select the language they want that way if someone is using a Japaneses mega drive but speaks English they could view the game in English if they wanted to.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Feb 18, 2012 3:17 am

sega16 wrote:Or you could program a menu to let the users select the language they want that way if someone is using a Japaneses mega drive but speaks English they could view the game in English if they wanted to.
Yeah, you really want a screen with a few flags with the name of the language under the flag in the language associated with the flag; allow the user to change which one is high-lighted with the joystick to select the language the game uses. Just because the machine reports as Japanese doesn't mean the person using it is Japanese, or even in Japan. Lots of people from around the world buy Japanese consoles. Some do it so they can play Japanese games without needing to mod the console. Some do it just to say they have a Japanese console. Another reason to make it selectable is maybe the Japanese players will want to play it in another language than Japanese.

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Sat Feb 18, 2012 8:36 am

hum, this is independant from the console language :)

I mean, whatever the console version, language menu is a good idea for a game as rpg, or more generaly a game with on-screen texts (dialogs).

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Feb 18, 2012 6:48 pm

The console doesn't have a language. There's a region (foreign and domestic) and a video system (PAL or NTSC). There are no languages built into the console as there are no libraries... no OS. If you ASSUME that a Japanese console implies Japanese, it's just that - an assumption. ESPECIALLY today. Back when the console was brand new it would be okay to make that assumption, but not today.

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Sat Feb 18, 2012 6:56 pm

I'm ok with this.

I mean, a console jap will be domestic and ntsc, i assimile that to "jap & ntsc" but i know there is no language bult in ;)

It's a landmark (repère?) for me to tell

JAP = Japanese (domestic) + ntsc
USA = English (foreign) +ntsc
EUR = English (foreign) + pal
ASIA = Japanese (domestic) + pal

but it's wrong & i would tell Region + video system...

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Sat Feb 18, 2012 7:24 pm

If you want to make your software region locked for some reason, I should say that it is not a good idea - there are rather easy ways (very simple HW mods, Mega Key) to overcome this. So it would only make some discomfort for users.

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Sat Feb 18, 2012 7:31 pm

To tell the thruth, i'm coding some idiot program to training me at MD coding.

With this non-region locked démo, i can see if the console is set to jap, us, eur or even asia region (it's useless, but this is just training for me at this time ;))

Post Reply