2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-10-02 15:38:09 +00:00
|
|
|
uintptr_t sSysCfbFbPtr[2];
|
|
|
|
uintptr_t sSysCfbEnd;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
void SysCfb_Init(s32 n64dd) {
|
2020-03-24 20:53:09 +00:00
|
|
|
u32 screenSize;
|
2022-10-02 15:38:09 +00:00
|
|
|
uintptr_t tmpFbEnd;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2021-10-03 03:17:09 +00:00
|
|
|
if (osMemSize >= 0x800000) {
|
2021-09-04 13:33:19 +00:00
|
|
|
// "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) {
|
2021-09-04 13:33:19 +00:00
|
|
|
osSyncPrintf("RAM 8M mode (N64DD対応)\n"); // "RAM 8M mode (N64DD compatible)"
|
2020-03-17 04:31:30 +00:00
|
|
|
sSysCfbEnd = 0x805FB000;
|
2020-03-22 21:19:43 +00:00
|
|
|
} else {
|
2021-09-04 13:33:19 +00:00
|
|
|
// "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
|
|
|
}
|
2021-10-03 03:17:09 +00:00
|
|
|
} else if (osMemSize >= 0x400000) {
|
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 {
|
2020-06-17 19:23:42 +00:00
|
|
|
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;
|
2021-10-03 03:17:09 +00:00
|
|
|
sSysCfbEnd &= ~0x3F;
|
2021-09-04 13:33:19 +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);
|
2021-09-04 13:33:19 +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]);
|
|
|
|
}
|
|
|
|
|
2022-06-12 23:24:45 +00:00
|
|
|
void SysCfb_Reset(void) {
|
2020-03-17 04:31:30 +00:00
|
|
|
sSysCfbFbPtr[0] = 0;
|
|
|
|
sSysCfbFbPtr[1] = 0;
|
|
|
|
sSysCfbEnd = 0;
|
|
|
|
}
|
|
|
|
|
2022-10-02 15:38:09 +00:00
|
|
|
void* SysCfb_GetFbPtr(s32 idx) {
|
2020-03-22 21:19:43 +00:00
|
|
|
if (idx < 2) {
|
2022-10-02 15:38:09 +00:00
|
|
|
return (void*)sSysCfbFbPtr[idx];
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|
2022-10-02 15:38:09 +00:00
|
|
|
return NULL;
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2022-10-02 15:38:09 +00:00
|
|
|
void* SysCfb_GetFbEnd(void) {
|
|
|
|
return (void*)sSysCfbEnd;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|