Fix big-endian incompatibility in float-related CPU code

This would cause all 3D to break in games like Ocarina of Time and Mario Kart 64, being reduced to a few unmoving triangles in the middle of the screen.
This commit is contained in:
Clownacy 2024-01-10 17:39:55 +00:00 committed by GitHub
parent f500eb58f7
commit c4591b7f20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,12 @@
#define FCR31_FS_BIT UINT32_C(0x1000000)
#ifdef M64P_BIG_ENDIAN
#define DOUBLE_HALF_XOR 1
#else
#define DOUBLE_HALF_XOR 0
#endif
void init_cp1(struct cp1* cp1, struct new_dynarec_hot_state* new_dynarec_hot_state)
{
#ifdef NEW_DYNAREC
@ -104,7 +110,7 @@ void set_fpr_pointers(struct cp1* cp1, uint32_t newStatus)
{
for (i = 0; i < 32; i++)
{
(r4300_cp1_regs_simple(cp1))[i] = &cp1->regs[i & ~1].float32[i & 1];
(r4300_cp1_regs_simple(cp1))[i] = &cp1->regs[i & ~1].float32[i & 1 ^ DOUBLE_HALF_XOR];
(r4300_cp1_regs_double(cp1))[i] = &cp1->regs[i & ~1].float64;
}
}