1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-22 21:35:27 +00:00
oot/src/code/sys_cfb.c

56 lines
1.7 KiB
C
Raw Normal View History

2020-03-17 04:31:30 +00:00
#include <global.h>
2020-03-22 21:19:43 +00:00
volatile u32 sSysCfbFbPtr[2]; // may not be volatile but it currently gets SysCfb_Init closer from matching
2020-03-17 04:31:30 +00:00
u32 sSysCfbEnd;
2020-03-22 21:19:43 +00:00
// small reaordering
2020-03-17 04:31:30 +00:00
#ifdef NON_MATCHING
2020-03-22 21:19:43 +00:00
void SysCfb_Init(s32 n64dd) {
if (osMemSize >= 0x800000U) {
// 8MB or more memory is installed
2020-03-17 04:31:30 +00:00
osSyncPrintf("8Mバイト以上のメモリが搭載されています\n");
2020-03-22 21:19:43 +00:00
if (n64dd == 1) {
// RAM 8M mode (N64DD compatible)
2020-03-17 04:31:30 +00:00
osSyncPrintf("RAM 8M mode (N64DD対応)\n");
sSysCfbEnd = 0x805FB000;
2020-03-22 21:19:43 +00:00
} else {
// The margin for this version is% dK bytes
2020-03-17 04:31:30 +00:00
osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024));
sSysCfbEnd = 0x8044BE80;
}
2020-03-22 21:19:43 +00:00
} else if (osMemSize >= 0x400000U) {
2020-03-17 04:31:30 +00:00
sSysCfbEnd = 0x80400000;
osSyncPrintf("RAM4M mode\n");
2020-03-22 21:19:43 +00:00
} else {
2020-03-17 04:31:30 +00:00
LogUtils_HungupThread("../sys_cfb.c", 0x162);
}
sSysCfbEnd &= ~0x3f;
2020-03-22 21:19:43 +00:00
// The final address used by the system is% 08x
2020-03-17 04:31:30 +00:00
osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
2020-03-22 21:19:43 +00:00
sSysCfbFbPtr[0] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 4);
sSysCfbFbPtr[1] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 2);
// Frame buffer addresses are% 08x and% 08x
2020-03-17 04:31:30 +00:00
osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cfb/SysCfb_Init.s")
#endif
2020-03-22 21:19:43 +00:00
void SysCfb_Reset() {
2020-03-17 04:31:30 +00:00
sSysCfbFbPtr[0] = 0;
sSysCfbFbPtr[1] = 0;
sSysCfbEnd = 0;
}
2020-03-22 21:19:43 +00:00
u32 SysCfb_GetFbPtr(s32 idx) {
if (idx < 2) {
2020-03-17 04:31:30 +00:00
return sSysCfbFbPtr[idx];
2020-03-22 21:19:43 +00:00
}
2020-03-17 04:31:30 +00:00
return 0;
}
2020-03-22 21:19:43 +00:00
u32 SysCfb_GetFbEnd() {
2020-03-17 04:31:30 +00:00
return sSysCfbEnd;
2020-03-22 21:19:43 +00:00
}