gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
770 stars 178 forks source link

Minor hires_texture issue in Mario Kart 64 main menu #1692

Closed Gagert closed 6 years ago

Gagert commented 6 years ago

I found a very minor hires_texture issue using the Kerber texture pack with Mario Kart 64. In the main menu in MK64 down to the left there are two menu options named Option and Data. Those are as now displayed with the proper high-res textures if I have a texture pack such as the Kerber one installed.

However, once I either enter the player selection screen and then go back to the main menu screen, or finish a cup in Mario GP, the proper high-res textures for the Option and Data menu is no longer displayed.

This issue also happens while using the good old rice plugin (I used Project64 1.6 to test the rice plugin). In my opinion this issue is very minor (I even had to make my mind if this issue was worth mentioning because of this), and since this issue can be traced back to the old rice video plugin, who knows; it might be an issue with the rice hires-texture implementation itself.

gonetz commented 6 years ago

HD texture matched by checksum of N64 texture data. It is possible that defined or calculated size of that data is a bit larger than the actual size of texture image. The problem you described is the case. Look at this picture: r-data

It is texture, used for menu option Data. On the left it is how it looks when you just enter the main menu. As you can see, it is defined and loaded as 16bit rgba texture of size 32x32. You may easily notice that only lower 2/3 of texture image contain useful information, and upper 1/3 contains some garbage. Checksum calculated for the whole texture data, including the garbage. You never see that garbage, because polygon's texture coordinates matches only useful part of the texture. The garbage is random data, which can differ. Right picture shows the same texture, but when I returned back from the player selection screen. Useful part of texture not changed, garbage part is different, checksum is different too. Since texture pack has texture only for the first checksum, proper high-res textures for the Option and Data menu is no longer displayed. I don't know, why game designers decided to load these textures as 32x32, when actual texture size is obviously different. May be it was easier to program.

Gagert commented 6 years ago

It seems that the core of this issue is the awkward way Mario Kart 64 handles it's textures in this case. Originally the Kerber hires_texture pack comes with either one or two identical *.png files with different naming for each of the halves of the Data and Option menu-textures. The included files in the Kerber hires_texture pack (hires_texture > MARIOKART64 > Menu) are as follows:

L Option - First half MARIOKART64#2E54990B#0#2_all.png

L Option - Second half MARIOKART64#FF1C51A6#0#2_all.png MARIOKART64#FF1CD976#0#2_all.png

R Data - First half MARIOKART64#D36E3963#0#2_all.png MARIOKART64#D074366B#0#2_all.png

R Data - Second half MARIOKART64#9ABF19BB#0#2_all.png MARIOKART64#9ABF20FB#0#2_all.png

Using your findings as a foundation to this issue, I started by dumping the menu textures in the texture_dump folder. Doing that I discovered that there are more filenames used for the very same split-textures than those listed above, hence the reason the highres-texture are not always shown is that the filenames of those textures varies depending on the setting. I then discovered those alternative filenames for the very same textures as included in the Kerber highres-texture pack for Mario Kart 64:

L Option - First half MARIOKART64#1BDE8695#0#2_all.png MARIOKART64#1D5A8811#0#2_all.png MARIOKART64#2EDC999D#0#2_all.png MARIOKART64#17D48695#0#2_all.png

L Option - Second half MARIOKART64#FF1CBD06#0#2_all.png MARIOKART64#FF1D44C6#0#2_all.png

R Data - First half MARIOKART64#D0F036E9#0#2_all.png MARIOKART64#D26C3865#0#2_all.png

R Data - Second half MARIOKART64#9ABF24EB#0#2_all.png MARIOKART64#9ABF31CB#0#2_all.png

After copy pasting the four split highres-textures for Data and Option again and giving the copies the names listed above, the Data and Option highres-texture gets shown every time (during my testing as of now) without suddenly one half of a texture or more getting replaced by an older vanilla-texture of Mario Kart 64.

I tested by entering and exiting the player selection screen; entering and exiting a cup and also finishing a cup. Without included all the filenames for the textures as listed above, the outcomes was that depending on the situation (finishing cup, exiting player select screen) some highres-textures did not load as expected.

Update:

Well, it seems that this game likes to generate different filenames/CRC for various main menu textures if you make a different selection in the main menu. Let's say you select a different track in time trial, and exit the track and return to the main menu again. Now the filename/CRC for various main menu textures are different yet again, in other words depending on condition some of the textures change name almost all the time. Even winning in battle mode creates different CRC values for many items (some textures keep their original CRC no matter what, while some other neighbor textures keeps changing addresses all the time).

theboy181 commented 6 years ago

Simply navigating the menus can create up to 4 different CRC’s for the same texture. It’s been broken for ages. :(

Gagert commented 6 years ago

In the case of the split-texture for the first half of the Option logo; it has 5 different filenames in total (in my findings as of now).

I originally found a total of 4 different filenames for all the split-textures in Mario Kart 64 by dumping the textures with the GlideN64 plugin. After finishing a cup however; the first half of the higher-res Option logo disappeared, leaving me puzzled by how so. I then applied a cheat in Mario Kart 64 that gives player 1 auto-win by merely starting a track, speeding up the tracking process of the missing texture. As soon as the winner ceremony started, I pressed D to dump textures (I did so to catch two flies at once; I didn't like the pixelated eyes of the red fish at the end of the ceremony, so I drew him some new ones afterwards).

The main menu were as expected missing the first higher-res split-texture of the first half of the Option logo again. As I had once again done a texture dump; all I had to do was to visit the texture dump folder once again and sort the files by date. There was the sinner; a previously missing filename for that very texture, and thereby it was a simple task of naming a new copy of that texture to that filename and the texture bug vanished.

I even registered an account on EmuTalk.net and posted in the Kerb's texture pack thread to write about these findings.

theboy181 commented 6 years ago

Please Try this pack, and let me know if the menus work as expected. https://discord.gg/mFaAPv

https://youtu.be/aBnUvePsdcA?t=2

theboy181 commented 6 years ago

Come Discuss here if you would like. https://discord.gg/mFaAPv

theboy181 commented 6 years ago

https://1drv.ms/u/s!AlHyj2CfwNtQiDx9DpgKUV6v8PKT

Gagert commented 6 years ago

I've updated one of my previous responses here in this thread, as starting a different track in either Mario GP, VS mode or Time Trial and returning to the main menu again creates different addresses for a lot of the textures (while some of the textures keep their original filename all the time). Even winning in a mode creates different textures for some of the main menu items.

I've tested the texture pack provided by theboy181, and that pack includes high-res graphics for most of the main menu items (all the main menu text and even the arrows). It took a whole lot of trial and error, in other words exiting and entering every single track in Mario Kart 64 while texture dumping. I even entered every track in the battle modes, and even the battle modes created different CRC values for the very same textures.

In the provided pack (provided above by theboy181) the affected textures was the green arrows, both halves of the Option-textures, both halves of the Data-textures and the first half of the OK symbol. I find it odd that the second half of the OK-symbol (the one that ends with a question-mark) did not change CRC-address once during my texture dumping.

I myself did a tedious task of copy pasting and renaming the copies all the different CRC-values, and it took a couple of hours (what started at 56 textures in the Misc Menu stuff folder ended up as 177 textures). I would not be surprised if I get even more different CRC-values on the main menu textures when I get a gold cup on all difficulties in Mario Kart 64, and thereby a different title screen. Who knows.