From 2e3cb7b5f96a9b875334f2ec1aa9239e48a8dfee Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 12 May 2023 00:02:41 +1000 Subject: [PATCH] Use uncached memory for room matrices --- src/game/room.c | 5 +++-- src/game/roomreset.c | 1 + src/include/bss.h | 1 + src/include/types.h | 1 - 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/room.c b/src/game/room.c index 255d46212..8f7d12b44 100644 --- a/src/game/room.c +++ b/src/game/room.c @@ -7,6 +7,7 @@ #include "types.h" struct roommtx *g_RoomMtxes; +Mtx *g_RoomMtxMtxes; s32 var80082050 = 0; s32 g_NextRoomMtx = 0; @@ -80,7 +81,7 @@ static struct roommtx *roomTouchMtx(s32 roomnum) roommtx->somefloat = var8005ef10[0]; roomPopulateMtx(&mtx, roomnum); - mtx00016054(&mtx, &roommtx->mtx); + mtx00016054(&mtx, (void *) &g_RoomMtxMtxes[roommtx->index]); return roommtx; } @@ -89,7 +90,7 @@ Gfx *roomApplyMtx(Gfx *gdl, s32 roomnum) { struct roommtx *roommtx = roomTouchMtx(roomnum); - gSPMatrix(gdl++, &roommtx->mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gdl++, &g_RoomMtxMtxes[roommtx->index], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); return gdl; } diff --git a/src/game/roomreset.c b/src/game/roomreset.c index fa6839f14..9959f4565 100644 --- a/src/game/roomreset.c +++ b/src/game/roomreset.c @@ -15,6 +15,7 @@ void roomsReset(void) var80082050 = PLAYERCOUNT() >= 2 ? 200 : 120; g_RoomMtxes = mempAlloc(ALIGN16(var80082050 * sizeof(struct roommtx)), MEMPOOL_STAGE); + g_RoomMtxMtxes = UNCACHED(mempAlloc(ALIGN16(var80082050 * sizeof(Mtx)), MEMPOOL_STAGE)); g_NextRoomMtx = 0; for (i = 0; i < PLAYERCOUNT(); i++) { diff --git a/src/include/bss.h b/src/include/bss.h index c2ccb3589..f2e4036f7 100644 --- a/src/include/bss.h +++ b/src/include/bss.h @@ -283,6 +283,7 @@ extern s32 g_LasersightsActive; extern bool g_StarsActive; extern u8 g_HudmsgsActive; extern struct roommtx *g_RoomMtxes; +extern Mtx *g_RoomMtxMtxes; extern s32 g_NextRoomMtx; extern s32 g_BgAlwaysRoom; extern struct stagetableentry *g_CurrentStage; diff --git a/src/include/types.h b/src/include/types.h index 6031ac2bc..8f554db09 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6366,7 +6366,6 @@ struct xz { }; struct roommtx { - Mtxf mtx; u8 index; s8 playernum; s32 lvframe;