Header script fix for Mesen v0.98 compatibility

TakuikaNinja

Active member
IMPORTANT EDIT: It's been brought to my attention on facebook that Mesen incorrectly read the mirroring bit.
Please, DO NOT apply the "fix"! If you have, follow the same steps below but just revert your edits.
Please re-download Mesen v0.98 as it now fixes the issue: https://github.com/SourMesen/Mesen/releases


[Original Post]
In case you weren't aware, Mesen recently got updated to v0.98 which fixed some bugs with UNROM512/Mapper 30.
However, this seems to have broken some NESMaker games due to a change in the mirroring type.
There are 2 ways to fix this:

Method 1: Fixing exported game roms (.nes files)

1. Open the rom with issues in Mesen 0.98.

2. Click on "Debug" and head to "Edit iNES Header".
kUSPw1U.png


3. Change the "Mirroring" from "Vertical"
unknown.png


to "Horizontal".
unknown.png


4. Click "Save As" and save the fixed rom file in a place you can find it.

5. Done!

Method 2: Fixing the Header script
DISCLAIMER: Always back up your scripts before editing anything!

1. Open your NESMaker project.

2. Click on "Project Settings" and head to "Script settings". Highlight the one starting with "ROOT" and click "Edit".
This will open up the file explorer at that location.
ZwCQzuq.png


3. In the file explorer, go into "System" and look for a file called "Header.asm". Right-click and choose "edit".
PQ2jnTE.png


4. In the editor, change this line:
Code:
	;;0 chr rom blocks, using chr ram
	.db %11100011

to this:
Code:
	;;0 chr rom blocks, using chr ram
	.db %11100010

5. Save the changes to the asm file and close all windows except for NESMaker itself. Save your project just in case.

6. Export the game and check if it works.

7. Done!

I tested a few games just to be sure, but let me know if you're stuck on something. I'll be happy to help :)
 

Mugi

Member
I was just looking into this myself too, and yeah it seems that the mirroring bit is just set wrong.
maybe we'll get this sorted out for 5.0 but in the meantime, the above works.

here's hoping that the header spec doesnt change anymore :p
 

RadJunk

Administrator
Staff member
I'm going to look into this today everyone. I'm going to double check with Paul from Infinite NES Lives - this is news to me, and I want to make sure that this is universally true. Thanks for bringing it to our attention! :)
 

Mugi

Member
TheNew8bitHeroes said:
I'm going to look into this today everyone. I'm going to double check with Paul from Infinite NES Lives - this is news to me, and I want to make sure that this is universally true. Thanks for bringing it to our attention! :)

the catch with this is that this fix sets the mirroring mode to vertical in the iNES header, and im assuming that is what mesen is reading to deal with it.
however, your original code for the header sets bits % . . . . 0 . . 1 for the mirroing mode (according to the new spec this is horizontal mirroring)

in your header code, while the comment is on the wrong row for the matter, you also indicate that you wished to set horizontal mirroring

Code:
	.db "NES",$1a       ;iNES identifier
	
	.db $20         ;number of PRG-ROM blocks
	;;32 prg rom blocks
	.db $00         ;number of CHR-ROM blocks
	;;0 chr rom blocks, using chr ram
	.db %11100011 ; <---- mirroing bits are actually here, you are setting horizontal, as your below comment suggest
	;;   ||||
	    ;MAP 3 2 1 0
	
	.db %00010000    ;ROM control bytes: Horizontal mirroring, no SRAM or trainer, Mapper #0
	;;   ||||
	   ; MAP - 7 6 5 4
	;;mapper 30
	
	.db $00,$00,$00,$00,$00,$00,$00,$00   ;filler

now the thing with this is that by the old behavior of mesen, and by behavior of hardware, the mirroring was vertical.
As the person who propably most dealt with scrolling on the entire community so far (you aside) i can assure you that dimensionshift worked on old mesen, and hardware, and the mirroring mode of DS has always been vertical, so this has to have something to do with the cartridges and how they set the mirroring mode to begin with.

I still dont have a mapper 30 cartridge to test this (i ordered one from INL today), but im suspecting that the cartridges are "hard set" to vertical mirroring regardless, because othervise this would just not work on hardware.

and a picture for the sake of completeness..
this is the byte off demo running on mesen 0.9.6, as seen, the mirroring is vertical
ds_mesen096.png
 
Top Bottom