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

55 lines
1.6 KiB
C
Raw Normal View History

2020-03-17 04:31:30 +00:00
#include <global.h>
2020-03-24 20:53:09 +00:00
u32 sSysCfbFbPtr[2];
2020-03-17 04:31:30 +00:00
u32 sSysCfbEnd;
2020-03-22 21:19:43 +00:00
void SysCfb_Init(s32 n64dd) {
2020-03-24 20:53:09 +00:00
u32 screenSize;
u32 tmpFbEnd;
2020-03-22 21:19:43 +00:00
if (osMemSize >= 0x800000U) {
// 8MB or more memory is installed
2020-03-17 04:31:30 +00:00
osSyncPrintf("8Mバイト以上のメモリが搭載されています\n");
2020-03-24 20:53:09 +00:00
tmpFbEnd = 0x8044BE80;
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));
2020-03-24 20:53:09 +00:00
sSysCfbEnd = tmpFbEnd;
2020-03-17 04:31:30 +00:00
}
2020-03-22 21:19:43 +00:00
} else if (osMemSize >= 0x400000U) {
2020-03-17 04:31:30 +00:00
osSyncPrintf("RAM4M mode\n");
2020-03-24 20:53:09 +00:00
sSysCfbEnd = 0x80400000;
2020-03-22 21:19:43 +00:00
} else {
LogUtils_HungupThread("../sys_cfb.c", 354);
2020-03-17 04:31:30 +00:00
}
2020-03-24 20:53:09 +00:00
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
2020-03-17 04:31:30 +00:00
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-24 20:53:09 +00:00
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2);
2020-03-22 21:19:43 +00:00
// Frame buffer addresses are% 08x and% 08x
2020-03-17 04:31:30 +00:00
osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]);
}
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
}