Cen64 NTSC/PAL support.

Discuss topics related to development here.
Post Reply
User avatar
Ambient_Malice
Posts: 21
Joined: Mon Aug 25, 2014 9:04 am

Cen64 NTSC/PAL support.

Post by Ambient_Malice » Sun Jan 04, 2015 11:35 pm

The N64 PIF has PAL/NTSC hardcoded. US/JAP N64s can run each other's games, but PAL has a different PIF.

This presents a bit of a problem. Currently, if you want to run Cen64, you dump the PIF from an N64 or "acquire" the PIF. It just so happens that all the not-so-legal PIFs floating around seem to be NTSC.

There is some info floating around on what part of the PIF controls NTSC/PAL, but it doesn't seem as though anyone has actually made any serious attempt to modify the PIF to be region free. I guess it was never a concern until someone tried to make an accurate N64 emulator.

I see a number of solutions.

1: Find the PAL/NTSC flag and then create a tool to switch it. Perhaps even impliment this as a nice button in the corner of front ends. Press it and the symbol goes from PAL to NTSC, the pif being edited in the background. Or you could simply make the PIF region free. (This is apparently possible.) That is a SMIDGE dirty, though. Something goes wrong and you've got a borked PIF.
2 Same as 1, but feed the game PAL/NTSC/Region free flag some other way.
3: Reverse engineer the PIF because suffering is joy.
4: Ignore the problem because nobody cares about PAL plebs, the so-called "bug fixes" in their games, and their non-English language options. :b

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Cen64 NTSC/PAL support.

Post by MarathonMan » Sun Jan 04, 2015 11:50 pm

I documented a safe routine that Hacktarux posted about, here:
http://forums.cen64.com/viewtopic.php?f ... ARUX#p1416

It requires a bit of programming knowledge, though, and access to an actual PAL console/cart.

User avatar
Ambient_Malice
Posts: 21
Joined: Mon Aug 25, 2014 9:04 am

Re: Cen64 NTSC/PAL support.

Post by Ambient_Malice » Mon Jan 05, 2015 12:18 am

MarathonMan wrote:I documented a safe routine that Hacktarux posted about, here:
http://forums.cen64.com/viewtopic.php?f ... ARUX#p1416

It requires a bit of programming knowledge, though, and access to an actual PAL console/cart.
If someone dumped a PAL PIF, that would certainly allow people to check how much it differs to an NTSC one. But AFAIK, the only difference is the region setting. I could be very wrong, though.

https://code.google.com/p/mupen64plus/w ... ResetNotes

I guess from a pure accuracy standpoint, using clean PAL and NTSC PIF to boot games is ideal, but it has certain practical limits. I can't imagine most people have an N64 from a different region sitting about. Being able to switch PIF region would be ideal, but I suppose a PAL dump might be needed first.

edit:
I am probably completely wrong and the PAL PIF-ROM is probably significantly different. Hopefully somebody dumps it soon.

User avatar
Snowstorm64
Posts: 303
Joined: Sun Oct 20, 2013 8:22 pm

Re: Cen64 NTSC/PAL support.

Post by Snowstorm64 » Mon Jan 05, 2015 5:17 pm

I would like to dump the PIF ROM by myself (I own a PAL N64), but +200 $ for a flash cartridge is a big no for me :( I don't even do programming stuff... However, I think the PAL PIF is already dumped by someone, because I remember someone that had done a list of tested PAL ROMs on CEN64, in an other board.

EDIT: Ok, this is weird, some PAL ROMs indeed boot on CEN64 with the NTSC PIF, like Mario Party or Iggy's Reckin' Balls, but some other games refuse to do so like Super Smash Bros, with the infamous warning. I'm sure those ROMs are PAL, because they come with three languages (English, French and German) on the screen.
OS: Debian GNU/Linux Jessie (8.0)
CPU: Intel i7 4770K @ 3.5 GHz
Build: AVX (compiled from git)

User avatar
teres
Posts: 19
Joined: Fri Apr 11, 2014 9:44 am

Re: Cen64 NTSC/PAL support.

Post by teres » Fri Jan 09, 2015 5:58 am

Is there a ready-to-go rom available to dump the PIF? I wouldn't mind taking a shot at this, and have NTSC(-J, not that that matters) and PAL N64s (so there wouldn't be any legal issues with me comparing both PIFs) as well as a Z64 to run stuff off of.

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Cen64 NTSC/PAL support.

Post by MarathonMan » Fri Jan 09, 2015 10:05 am

teres wrote:Is there a ready-to-go rom available to dump the PIF? I wouldn't mind taking a shot at this, and have NTSC(-J, not that that matters) and PAL N64s (so there wouldn't be any legal issues with me comparing both PIFs) as well as a Z64 to run stuff off of.
I haven't used the Z64 system; how do you dump data from Z64 to the PC (or externally)?

User avatar
teres
Posts: 19
Joined: Fri Apr 11, 2014 9:44 am

Re: Cen64 NTSC/PAL support.

Post by teres » Fri Jan 09, 2015 11:02 am

If you're about to whip up some code, just pretend you have an EEPROM or SRAM and copy whatever's interesting there; and/or print to screen. Actually, maybe do both just to be on the safe side, I'll make sure to also take some photos then.

The Z64 uses a boot/host cart, which it reads the save data from afterwards and then writes that to a file on a CF card (used to be a Zip drive, but those suck, so... yeah.). Games using Flash don't work on this unit, at least without patches, so don't go that route. I could also do mempack dumps if necessary.

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Cen64 NTSC/PAL support.

Post by MarathonMan » Fri Jan 09, 2015 12:28 pm

teres wrote:If you're about to whip up some code, just pretend you have an EEPROM or SRAM and copy whatever's interesting there; and/or print to screen. Actually, maybe do both just to be on the safe side, I'll make sure to also take some photos then.

The Z64 uses a boot/host cart, which it reads the save data from afterwards and then writes that to a file on a CF card (used to be a Zip drive, but those suck, so... yeah.). Games using Flash don't work on this unit, at least without patches, so don't go that route. I could also do mempack dumps if necessary.
Ok, that's easy enough. I'll port my PIF dumper for 64drive to use SRAM for storage and let you know.

EDIT: Can Z64 boot a cart directly, or does it have to go through some menu first?

User avatar
teres
Posts: 19
Joined: Fri Apr 11, 2014 9:44 am

Re: Cen64 NTSC/PAL support.

Post by teres » Fri Jan 09, 2015 1:40 pm

MarathonMan wrote:Can Z64 boot a cart directly, or does it have to go through some menu first?
Both, but I guess the menu mode is of no interest - probably even counterproductive - in this case.

User avatar
Snowstorm64
Posts: 303
Joined: Sun Oct 20, 2013 8:22 pm

Re: Cen64 NTSC/PAL support.

Post by Snowstorm64 » Fri Jan 09, 2015 1:50 pm

When you're done with it, please share your results with us. Thanks ;)
OS: Debian GNU/Linux Jessie (8.0)
CPU: Intel i7 4770K @ 3.5 GHz
Build: AVX (compiled from git)

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Cen64 NTSC/PAL support.

Post by MarathonMan » Fri Jan 09, 2015 2:05 pm

teres wrote:
MarathonMan wrote:Can Z64 boot a cart directly, or does it have to go through some menu first?
Both, but I guess the menu mode is of no interest - probably even counterproductive - in this case.
Yes, that's why I asked. Basically, the dumper runs in two phases. In the first phase, it sets up an exploit to capture the PIF ROM. After the exploit is setup, you need to send a NMI (reset console) to "unlock" the PIF. The exploit stops the PIF at the very beginning of it's execution, copies the PIF ROM to temporary storage, and then silently steps out of way and makes it look like it was never present. When the ROM is re-loaded, it then copies the PIF from the temporary storage location to SRAM or something exportable. If you have menus or other doodads that happen before the game loads, you have to be more careful about what you use for temporary storage so the menu doesn't blow it out.

User avatar
teres
Posts: 19
Joined: Fri Apr 11, 2014 9:44 am

Re: Cen64 NTSC/PAL support.

Post by teres » Fri Jan 09, 2015 2:31 pm

Oh I see, so you'd just have to take care where to put things? I'd have though that the menu running first, then soft-resetting the CPU to switch to the game would've maybe left everything in an inconvenient state (PIF already inaccessible). Either way, not a problem - I'll keep in mind not to use the GUI.

User avatar
teres
Posts: 19
Joined: Fri Apr 11, 2014 9:44 am

Re: Cen64 NTSC/PAL support.

Post by teres » Thu Feb 12, 2015 4:06 pm

Been a month, so let's give this a little bump... I hope you'll eventually find a bit of time to cook something up, MM.

User avatar
Zoinkity
Posts: 5
Joined: Sun Oct 27, 2013 5:13 pm

Re: Cen64 NTSC/PAL support.

Post by Zoinkity » Fri Feb 13, 2015 11:15 am

The PAL PIFram dump differs in three ways:
  1. The order in which things are done, but not what is done.
  2. osVersion is OR'd with 6; this is kept in S7 and eventually set to 80000314.
  3. osTVType will be set to 0; this is kept in S4 and eventually set to 80000300.
Incidentally, the order of operations in PAL is the same as that in the Aleck64 PIFram. In all other ways an Aleck64 is generic NTSC.

One I haven't seen is an MPAL dump.

You don't have to use an official pifram. You can also use the one LaC created for his bootloader, provided you set the correct variables in it. This shouldn't cause a problem; it's not as though actual PIF emulation is possible at this point.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests