1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Use intptr in most remaining code files (#1438)

* Use intptr in most remaining code files

* Fix missing uintptr_t in actor

* Use u8* casts for texture pointer arithmetic

* Use bg + 1 instead of casting in Room_DrawBackground2D
This commit is contained in:
Roman971 2023-07-10 21:03:01 +02:00 committed by GitHub
parent d307a37233
commit 232fdb75d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 74 additions and 67 deletions

View file

@ -295,7 +295,7 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei
Room_DecodeJpeg(SEGMENTED_TO_VIRTUAL(tex));
bg = (uObjBg*)(gfx + 1);
gSPBranchList(gfx, (u32)bg + sizeof(uObjBg));
gSPBranchList(gfx, (Gfx*)(bg + 1));
bg->b.imageX = 0;
bg->b.imageW = width * (1 << 2);
@ -310,7 +310,7 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei
bg->b.imagePal = 0;
bg->b.imageFlip = 0;
gfx = (Gfx*)((u32)bg + sizeof(uObjBg));
gfx = (Gfx*)(bg + 1);
if (fmt == G_IM_FMT_CI) {
gDPLoadTLUT(gfx++, tlutCount, 256, tlut);
@ -574,7 +574,7 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
roomCtx->bufPtrs[0] = GameState_Alloc(&play->state, maxRoomSize, "../z_room.c", 946);
// "Room buffer initial pointer=%08x"
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
roomCtx->bufPtrs[1] = (void*)((s32)roomCtx->bufPtrs[0] + maxRoomSize);
roomCtx->bufPtrs[1] = (void*)((uintptr_t)roomCtx->bufPtrs[0] + maxRoomSize);
// "Room buffer end pointer=%08x"
osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]);
osSyncPrintf(VT_RST);
@ -600,7 +600,8 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
ASSERT(roomNum < play->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009);
size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart;
roomCtx->unk_34 = (void*)ALIGN16((u32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
roomCtx->unk_34 =
(void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
DmaMgr_RequestAsync(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0,