(Hi again folks, incoming Mega post here. This is mostly a walkthrough/tutorial on the method I've been using to fix level textures - I've tried (and probably failed) to keep it fairly simple to follow, even for newbies. I've also tried to put the more significant parts in bold and/or in colour to make them stand out some. Hopefully you won't find that too obnoxious. )
I'm not sure what Hex editor you've been using aterraformer, but
XVI32 let's you use scripts, more or less letting you automate simple changes, or changes you have to make often.
Here's a script I put together a while ago for Super Mario 74. You would apply this script to a normal Super Mario 74 rom (no other changes, in hex or using sm64compress, are needed). Most of the things this script does are things already taken care of by sm64compress and those two find and replace hex changes you made. The extra thing this script does, in a nutshell, is that it
un-breaks the custom levels which use fog.
Originally posted by MeStep by Step instructions:
1. Download
XVI32.
2. Extract it from the zip folder and run xvi32.exe. The main window of xvi32 opens.
3. Click File, then Open File. Choose the hack you want to try fixing (Super Mario 74) and click open.
4. Now click XVIscript, then Editor. This opens up the script interpreter window.
5. Copy and paste
this script into the text box, click execute and wait for the changes to be made (should take less than 2 minutes).
7. Once the script has finished executing, close the script interpreter window.
8. Now click File, then Save or Save As, to save the changes to the hack.
9. Try the hack out on your N64 console
Here's the results:
https://www.youtube.com/watch?v=aLNhGib0r_w
This script mostly fixes Super Mario 74, but water and lava still stretch and go weird, and you'll still encounter slowdown in some levels.
If mostly fixing Super Mario 74 is all you're interested in, you can stop reading right here - just follow the instructions above.
If, however, you're interested in learning how you can fix the textures in other hacks, get comfy and read on...
Texture Fixing Tutorial/Walkthrough
Part 1 - Background Info
Part 1.A - What are we trying to achieve?
Before we begin, let's just be clear about what we're dealing with here:
|
FC 12 7F FF FF FF F8 38: |
FC 12 18 24 FF 33 FF FF or FC 12 7E 24 FF FF F9 FC: |
No Fog: |
|
|
Fog: |
|
|
The column on the left is what you get if you make no attempt to fix the textures - most levels flicker between white/black, with occasional foggy levels displaying textures correctly.
The column on the right (most levels working, but broken foggy levels) is what you get if you do either of the following:
Code
Find All: FC 12 7F FF FF FF F8 38
Replace With: FC 12 18 24 FF 33 FF FF
Code
Find All: FC 12 7F FF FF FF F8 38
Replace With: FC 12 7E 24 FF FF F9 FC
So, what we want, is to have the top right and bottom left pictures.
What we want then, is this:
Levels with No Fog: FC 12 18 24 FF 33 FF FF or FC 12 7E 24 FF FF F9 FC
Levels with Fog: FC 12 7F FF FF FF F8 38
Got it?
Q. What's the deal with
FC 12 18 24 FF 33 FF FF and
FC 12 7E 24 FF FF F9 FC? Why are there two of them? Why not just one?
A. Kaze pointed
FC 12 7E 24 FF FF F9 FC out to me earlier in this thread. Here's what he said:
Originally posted by Kazelooking at how the FC commands in the original are set, it is weird that frauber chose FC 12 7F FF FF FF F8 38 out of all things. for instance, looking at bowser puzzle pieces or any other object that ive looked at, they use FC 12 7E 24 FF FF F9 FC...
As far as I can tell, you get the same results with either one of them - they seem interchangeable. There probably is a difference, but I don't know what it is. I don't know which of them, if any, is the "correct" one to use. (not a great answer, is it? :/)
Part 1.B - An explanation of the script I posted earlier
Ok. Now I'll walk you through the bits of my script I linked to earlier which deal with texture issues, and explain what each bit is doing.
Code
REM Black and White Textures fix (breaks foggy levels)
REM Starting at 1200000, so will only affect custom levels (leaves unchanged Bowser Battle levels alone)
ADR $1200000
REPLACEALL FC 12 7F FF FF FF F8 38 BY FC 12 7E 24 FF FF F9 FC
This is essentially just an alternative to the first
find and replace change aterraformer made (I'm using
FC 12 7E 24 FF FF F9 FC instead of
FC 12 18 24 FF 33 FF FF).
More importantly, the find and replace switch only happens from $120000 onwards. This is the area of the rom where imported levels are stored. Making the changes only from this point onwards leaves out the original SM64 levels, so any left over/recycled/reused levels, such as bowser battles, are unaffected by the change. In other words, no more bowser battles with bad textures.
Code
REM Snowman's land (Swamp) (Foggy Level Fix)
REM Level layout data starts at 01740000)
REM (Next level data WetDry starts at 01820000)
REM ---------
ADR $177DE90
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $1796EC0
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $1798470
OVERWRITE FC 12 7F FF FF FF F8 38
REM Vanish Cap (Foggy Level Fix)
REM Level layout data starts at 01E40000
REM (Next level data BowserCourse2 starts at 01F20000)
REM ---------
ADR $1E6E690
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $1E7E7E0
OVERWRITE FC 12 7F FF FF FF F8 38
REM Metal Cap (Foggy Level Fix)
REM Level Layout Data starts at 02700000)
REM (Next level data wingcap starts at 027E00000)
REM ---------
ADR $271FDE0
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $2727B40
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $27282C8
OVERWRITE FC 12 7F FF FF FF F8 38
This bit here may look worse than it actually is. For the levels which have fog, I'm
undoing the "Replace All" change we just made previously, putting these levels back the way they were. I'll go into much more detail on this part later on, so don't worry.
Part 1.C - The Level Location Table
The table below roughly lists the locations where, I believe, the custom levels are stored. Other people here have a much more detailed understanding of this than I do. My understanding of this is pretty rudimentary, but I
think I've just about got the basics down. I used the first few minutes of
this video from Kaze as a starting point, and then spent some time filling in the blanks. The table is pretty inaccurate and low in detail, but it's what I've been using and seems to work enough for the purpose of fixing the level textures.
Different locations are used depending on Rom size (Level Importer 1.6 and older produces Rom sizes of 48MB and stores levels at the locations in the left column, while Level Importer 1.7S and newer produces Rom sizes of 64MB and stores levels at the locations in the right column).
Course No. | Level | 48MB | 64MB |
| | |
5 | Haunted House | 1200000-12E0000 | 1200000-1360000 |
4 | Cool Cool Mountain | 12E0000-13C0000 | 1360000-14C0000 |
| Inside Castle | 13C0000-14A0000 | 14C0000-1620000 |
6 | Hazy Maze Cave | 14A0000-1580000 | 1620000-1780000 |
8 | Shifting Sand Land | 1580000-1660000 | 1780000-18E0000 |
1 | Bob-Omb's Battlefield | 1660000-1740000 | 18E0000-1A40000 |
10 | Snow Man's Land | 1740000-1820000 | 1A40000-1BA0000 |
11 | Wet Dry World | 1820000-1900000 | 1BA0000-1D00000 |
3 | Jolly Roger Bay | 1900000-19E0000 | 1D00000-1E60000 |
13 | Tiny Huge Island | 19E0000-1AC0000 | 1E60000-1FC0000 |
14 | Tick Tock Clock | 1AC0000-1BA0000 | 1FC0000-2120000 |
15 | Rainbow Ride | 1BA0000-1C80000 | 2120000-2280000 |
| Castle Grounds | 1C80000-1D60000 | 2280000-23E0000 |
| Bowser 1 Course | 1D60000-1E40000 | 23E0000-2540000 |
| Vanish Cap | 1E40000-1F20000 | 2540000-26A0000 |
| Bowser 2 Course | 1F20000-2000000 | 26A0000-2800000 |
| Secret Aquarium | 2000000-20E0000 | 2800000-2960000 |
| Bowser 3 Course | 20E0000-21C0000 | 2960000-2AC0000 |
7 | Lethal Lava Land | 21C0000-22A0000 | 2AC0000-2C20000 |
9 | Dire Dire Docks | 22A0000-2380000 | 2C20000-2D80000 |
2 | Whomp's Fortress | 2380000-2460000 | 2D80000-2EE0000 |
| End Cake Picture | 2460000-2540000 | 2EE0000-3040000 |
| Castle Courtyard | 2540000-2620000 | 3040000-31A0000 |
| Peach's Secret Slide | 2620000-2700000 | 31A0000-3300000 |
| Metal Cap | 2700000-27E0000 | 3300000-3460000 |
| Wing Cap | 27E0000-28C0000 | 3460000-35C0000 |
| Bowser 1 Battle | 28C0000-29A0000 | 35C0000-3720000 |
| Rainbow Clouds | 29A0000-2A80000 | 3720000-3880000 |
| Bowser 2 Battle | 2A80000-2B60000 | 3880000-39E0000 |
| Bowser 3 Battle | 2B60000-2C40000 | 39E0000-3B40000 |
12 | Tall Tall Mountain | 2C40000-2D20000 | 3B40000-3CA0000 |
Still with me? A table full of hex addresses might look a bit intimidating, but it's actually pretty straight forward to use. I'll show you how you can use this table to fix the level textures in Super Mario 74. The same process should also work on most other SM64 hacks. It's not so bad, you'll see.
Part 2 - Worked Example
Step 1 - Find the Foggy Levels
The first step is to find out which levels use fog (and will therefore be broken by the
Replace All fix). I actually find this to be the most time consuming and tedious part of the whole process. I really hope there's a better way to find out by just looking at data in the Rom, but so far, I've just been playing the hacks on console to find out. Sometimes I would place down a bunch of warp doors in the starting area (using Toads Tool) so I could more quickly check all the levels in the Rom. Not ideal at all, but it works.
So, not including reused bowser levels (which aren't a problem any more), you'll find there are three levels which use fog in Super Mario 74:
Swampy Spring
Toxic-Switch of Danger
Dust-Switch of Identity
aterraformer correctly identified these.
Step 2 - Find out which Original SM64 levels these foggy custom levels replace
Now we need to find which of the original SM64 levels these new levels with fog replace.* A lot of the time, it's pretty obvious with level is replaced; new metal cap and vanish cap stages probably replace the original ones. The main course levels, when you enter them, all show their course number on the star select screen, so you can work it out from there. For example, Swampy Spring in Super Mario 74 is course number 10, which we know is the course number of Snowman's Land, so Swampy Spring replaces Snowman's Land. (I've listed the level course numbers in the table above, to help you).
But it's not always so easy to tell. For example, would you know which level
this start area in the Year of the Plumber demo replaces? I wouldn't, without checking.
To check, simply open the hack in Toads Tool and try loading up different levels until you find one that looks like it matches (like this). Educated guesses help here - hub worlds will probably replace Inside Castle, Castle Grounds, or Castle Courtyard. "Misc" levels might replace Peach's Secret Slide, Secret Aquarium or Rainbow Clouds.
*The Original SM64 levels aren't actually overwritten when you import a new level into the rom to replace one of them. All the original SM64 levels remain in the rom. If you import a custom level into the rom, replacing, say, Whomp's Fortress, the new level will be placed in one of the two areas set out in the table above, depending on which Level Importer version you use (2380000-2460000 or 2D80000-2EE0000). The original Whomp's Fortress is still in the rom, but is cut off and not normally accessible. It's a bit like the lost Citadel level in Goldeneye, if you're familiar with that.
Step 3 - Find out the Rom size of the hack - 48MB or 64MB?
Now you know which custom levels have fog, and you know which original SM64 levels they replace. There's one more thing we need to check before we can open the Hex editor - the size of the rom. 48MB or 64MB. Simple, ish.
Step 4 - Find the addresses of instances of "FC 12 7F FF FF FF F8 38" within the ranges of the foggy levels
Hex editor time! Open up Super Mario 74 in your hex editor. We know that SM74 is a 48MB hack, so that's the column in the table we're going to be focusing on.
Reminder - the levels with fog we need to take a look at are:
Swampy Spring (replaces Snow Man's Land)
Toxic-Switch of Danger (replaces Metal Cap stage)
Dust-Switch of Identity (replaces Vanish Cap stage)
Let's begin with Swampy Spring. As we touched on before, Swampy Spring is course number 10 - so it replaces Snowman's Land.
So, look on the Snowman's Land row in the 48MB column, and you'll find 1740000-1820000. This is the area of the rom where the imported level Swampy Spring is stored.
Navigate to $1740000 in your hex editor. In this location, you should see 80 08 00 00...
Now, use the Hex editor to find the next case of "
FC 12 7F FF FF FF F8 38", after $1740000. You should find that the first case of
FC 12 7F FF FF FF F8 38, after the position of $1740000, is at offset $177DE90.
177DE90 falls within the range of where the Swampy Springs level is stored (it falls within 1740000-1820000), so take a note of this address, we'll need it later.
Now find the next instance of
FC 12 7F FF FF FF F8 38, after 177DE90. You should find it at $1796EC0. Does this address fall within our range (1740000-1820000)? Yes it does, so take a note.
Again, find the next instance. This time it's at $1798470. Within the range, so take a note.
And again, find the next case. This time, it's at address $1855360. Does this fall within our range? No, it doesn't, so we'll leave it.
Ok, so now we have taken a note of all the cases of FC 12 7F FF FF FF F8 38 within the area of the rom where Swampy Springs is stored.
Here's what we've got:
177DE90: FC 12 7F FF FF FF F8 38
1796EC0: FC 12 7F FF FF FF F8 38
1798470: FC 12 7F FF FF FF F8 38
The idea now, is that after doing the following Replace All change, which breaks all the custom levels which use fog...
Code
ADR $1200000
REPLACEALL FC 12 7F FF FF FF F8 38 BY FC 12 7E 24 FF FF F9 FC
...we can then do the following to put the Swampy Spring level back the way it was, to undo the previous change for just that level.
Code
ADR $177DE90
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $1796EC0
OVERWRITE FC 12 7F FF FF FF F8 38
ADR $1798470
OVERWRITE FC 12 7F FF FF FF F8 38
And that's the basic idea. This is how we get to have both the top right AND bottom left picture, to have both levels with and without fog to show textures properly. I'll go over the remaining two foggy levels in Super Mario 74 now in a bit less detail.
Toxic-Switch of Danger and Dust-Switch of Identity, we can safely assume, replace the metal cap and vanish cap stages, but you can make sure if you like by checking the rom in Toads Tool.
We'll take Toxic-Switch of Danger first. Looking at the Metal Cap row in the 48MB column, we find 2700000-27E0000. So go to $2700000 in your hex editor, and then find the next few cases of
FC 12 7F FF FF FF F8 38 which lie within the range of 2700000-27E0000. You should find them at:
271FDE0
2727B40
27282C8
And doing the same for the Dust-Switch of Danger level (looking at the Vanish Cap stage row in the table, using the range of 1E40000-1F20000), you should find the cases of
FC 12 7F FF FF FF F8 38 at these addresses:
1E6E690
1E7E7E0
1E7FA80
Step 5 - Make the Hex changes
Finally, we're ready to make the hex changes to fix the level textures in Super Mario 74!
Time to bring it all together.
First, go to address $1200000, then replace all cases of FC 12 7F FF FF FF F8 38 from then on, with either of the following:
FC 12 18 24 FF 33 FF FF
FC 12 7E 24 FF FF F9 FC
This will fix the textures of all the imported levels which don't use fog, without touching original SM64 levels that may have been reused, such as Bowser battles or the Castle overworld.
Next, we go back and fix those imported levels which did use fog, which we just now broke. Make the following changes:
177DE90:
FC 12 7F FF FF FF F8 38 (<- Swampy Spring)
1796EC0:
FC 12 7F FF FF FF F8 38 (<- Swampy Spring)
1798470:
FC 12 7F FF FF FF F8 38 (<- Swampy Spring)
271FDE0:
FC 12 7F FF FF FF F8 38 (<- Toxic-Switch of Danger)
2727B40:
FC 12 7F FF FF FF F8 38 (<- Toxic-Switch of Danger)
27282C8:
FC 12 7F FF FF FF F8 38 (<- Toxic-Switch of Danger)
1E6E690:
FC 12 7F FF FF FF F8 38 (<- Dust-Switch of Identity)
1E7E7E0:
FC 12 7F FF FF FF F8 38 (<- Dust-Switch of Identity)
1E7FA80:
FC 12 7F FF FF FF F8 38 (<- Dust-Switch of Identity)
Then you just need to save, and that's it - you've fixed the level textures!
If you're fixing a 64MB rom, such as the Year of the Plumber demo, remember to use the 64MB column in the table instead.