From bcb7dcf6d72fbfd8b41236817769159a54630a81 Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Sun, 18 Feb 2024 15:59:07 -0500 Subject: [PATCH] Copy the map data --- mm/src/code/z_map_disp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/src/code/z_map_disp.c b/mm/src/code/z_map_disp.c index a74fe1a6b..ad0809bb4 100644 --- a/mm/src/code/z_map_disp.c +++ b/mm/src/code/z_map_disp.c @@ -153,11 +153,13 @@ static const char* sMapGrandTextures[] = { map_grand_static_Blob_034BB0, map_grand_static_Blob_034F50, }; -void MapDisp_GetMapITexture(void** dst, s32 mapCompactId) { +// BENTODO, can we just set dest insetead of doing a memcpy? +void MapDisp_GetMapITexture(void* dst, s32 mapCompactId) { s32 mapSize = MapDisp_GetSizeOfMapITex(mapCompactId); if (mapSize != 0) { - *dst = ResourceMgr_LoadTexOrDListByName(sMapTextures[mapCompactId]); + void* data = ResourceMgr_LoadTexOrDListByName(sMapTextures[mapCompactId]); + memcpy(dst, data, mapSize); //CmpDma_LoadFile(SEGMENT_ROM_START(map_i_static), mapCompactId, dst, MapDisp_GetSizeOfMapITex(mapCompactId)); } } @@ -1262,8 +1264,7 @@ void* MapDisp_AllocDungeonMap(PlayState* play, void* heap) { s32 mapCompactId = sPauseDungeonMap.mapI_mapCompactId[dungeonMapRoomIter]; // 2S2H [Port] directly set the pointer to the texture instead of using memcpy - // BENTODO, can we avoid using any game made heap since the textures are loaded as a resource? - MapDisp_GetMapITexture(&sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter], mapCompactId); + MapDisp_GetMapITexture(sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter], mapCompactId); if (dungeonMapRoomIter + 1 < sPauseDungeonMap.textureCount) { sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter + 1] = ALIGN16((intptr_t)sPauseDungeonMap.mapI_roomTextures[dungeonMapRoomIter] +