Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mario Kart 64 - 0.95 F3DEX - Wrong gsSPCullDisplayList binary #2774

Closed
DeadHamster35 opened this issue Apr 19, 2023 · 1 comment
Closed

Mario Kart 64 - 0.95 F3DEX - Wrong gsSPCullDisplayList binary #2774

DeadHamster35 opened this issue Apr 19, 2023 · 1 comment

Comments

@DeadHamster35
Copy link

Mario Kart 64's USA release uses an early version of F3DEX labelled 0.95. This is not identical to the more common 1.21 F3DEX on a binary level - one of the quirks of this version is the inclusion of the full gsSPQuadrangle command, which starting with 1.21 F3DEX is converted at compilation to a gsSPTriangle2. This is emulated correctly which is apparently handled via a special microcode -

{ F3DEX, false, false, true, 0x0ace4c3f }, // Mario Kart 64

Recently (today) it was discovered that another command has a difference in the binary layout; gsSPCullDisplayList appears to use the same binary from F3D and not the later 1.21 F3DEX versions.

To test a region of 8 vertices, the correct 0.95 F3DEX binary command and parameters should read -
BE 00 00 00 00 00 01 40

#define gsSPCullDisplayList(vstart,vend)				
{									
	_SHIFTL(G_CULLDL, 24, 8) | ((0x0f & (vstart))*40), 		
	((0x0f & ((vend)+1))*40)					
}

whereas GLideN64 currently (incorrectly) expects the 1.21 binary format -
BE 00 00 00 00 00 00 0E

#define gsSPCullDisplayList(vstart,vend)				
{									
	_SHIFTL(G_CULLDL, 24, 8) | _SHIFTL((vstart)*2, 0, 16),		
	_SHIFTL((vend)*2, 0, 16)					
}

Using the newer 1.21 F3DEX binary leads to a crash on original hardware as it checks for an invalid number of verts. This has gone unnoticed as the original game never uses the gsSPCullDisplayList command, however this leads to a discrepancy when attempting to design mods that are compatible with both modern emulators and console.

gonetz added a commit that referenced this issue Aug 10, 2024
@gonetz
Copy link
Owner

gonetz commented Aug 10, 2024

Thanks for the info!
I added separate init for 0.95 F3DEX: #2862

gonetz added a commit that referenced this issue Aug 10, 2024
@gonetz gonetz closed this as completed Aug 10, 2024
cheinr pushed a commit to cheinr/GLideN64 that referenced this issue Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants