2020-10-03 17:22:44 +02:00
|
|
|
#include "global.h"
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2024-09-28 17:52:45 -07:00
|
|
|
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
|
|
|
|
"pal-1.1:128"
|
2024-08-25 16:00:10 +02:00
|
|
|
|
2022-10-02 17:38:09 +02:00
|
|
|
uintptr_t sSysCfbFbPtr[2];
|
|
|
|
uintptr_t sSysCfbEnd;
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2020-03-22 22:19:43 +01:00
|
|
|
void SysCfb_Init(s32 n64dd) {
|
2020-03-24 16:53:09 -04:00
|
|
|
u32 screenSize;
|
2022-10-02 17:38:09 +02:00
|
|
|
uintptr_t tmpFbEnd;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2021-10-03 05:17:09 +02:00
|
|
|
if (osMemSize >= 0x800000) {
|
2024-08-22 22:33:50 +02:00
|
|
|
PRINTF(T("8Mバイト以上のメモリが搭載されています\n", "8MB or more memory is installed\n"));
|
2020-03-24 16:53:09 -04:00
|
|
|
tmpFbEnd = 0x8044BE80;
|
2020-03-22 22:19:43 +01:00
|
|
|
if (n64dd == 1) {
|
2024-08-22 22:33:50 +02:00
|
|
|
PRINTF(T("RAM 8M mode (N64DD対応)\n", "RAM 8M mode (N64DD compatible)\n"));
|
2024-11-17 17:02:07 -05:00
|
|
|
#if DEBUG_FEATURES
|
2020-03-17 00:31:30 -04:00
|
|
|
sSysCfbEnd = 0x805FB000;
|
2024-02-02 03:15:53 +11:00
|
|
|
#else
|
|
|
|
sSysCfbEnd = 0x80600000;
|
|
|
|
#endif
|
2020-03-22 22:19:43 +01:00
|
|
|
} else {
|
2024-08-22 22:33:50 +02:00
|
|
|
PRINTF(T("このバージョンのマージンは %dK バイトです\n", "The margin for this version is %dK bytes\n"),
|
|
|
|
(0x4BC00 / 1024));
|
2024-11-17 17:02:07 -05:00
|
|
|
#if DEBUG_FEATURES
|
2020-03-24 16:53:09 -04:00
|
|
|
sSysCfbEnd = tmpFbEnd;
|
2024-02-02 03:15:53 +11:00
|
|
|
#else
|
|
|
|
sSysCfbEnd = 0x80400000;
|
|
|
|
#endif
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
2021-10-03 05:17:09 +02:00
|
|
|
} else if (osMemSize >= 0x400000) {
|
2024-01-12 07:38:13 -08:00
|
|
|
PRINTF("RAM4M mode\n");
|
2020-03-24 16:53:09 -04:00
|
|
|
sSysCfbEnd = 0x80400000;
|
2020-03-22 22:19:43 +01:00
|
|
|
} else {
|
2024-10-09 04:41:16 -07:00
|
|
|
#if OOT_VERSION < NTSC_1_1
|
|
|
|
LogUtils_HungupThread("../sys_cfb.c", 305);
|
|
|
|
#elif OOT_VERSION < PAL_1_0
|
|
|
|
LogUtils_HungupThread("../sys_cfb.c", 308);
|
|
|
|
#elif OOT_VERSION < GC_JP
|
2024-09-03 19:10:00 -07:00
|
|
|
LogUtils_HungupThread("../sys_cfb.c", 322);
|
|
|
|
#else
|
2020-06-17 21:23:42 +02:00
|
|
|
LogUtils_HungupThread("../sys_cfb.c", 354);
|
2024-09-03 19:10:00 -07:00
|
|
|
#endif
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
|
|
|
|
2020-03-24 16:53:09 -04:00
|
|
|
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
|
2021-10-03 05:17:09 +02:00
|
|
|
sSysCfbEnd &= ~0x3F;
|
2024-02-02 03:15:53 +11:00
|
|
|
|
|
|
|
if (1) {}
|
|
|
|
|
2024-08-22 22:33:50 +02:00
|
|
|
PRINTF(T("システムが使用する最終アドレスは %08x です\n", "The final address used by the system is %08x\n"),
|
|
|
|
sSysCfbEnd);
|
2020-03-24 16:53:09 -04:00
|
|
|
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
|
|
|
|
sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2);
|
2024-08-22 22:33:50 +02:00
|
|
|
PRINTF(T("フレームバッファのアドレスは %08x と %08x です\n", "Frame buffer addresses are %08x and %08x\n"),
|
|
|
|
sSysCfbFbPtr[0], sSysCfbFbPtr[1]);
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
|
|
|
|
2022-06-13 01:24:45 +02:00
|
|
|
void SysCfb_Reset(void) {
|
2020-03-17 00:31:30 -04:00
|
|
|
sSysCfbFbPtr[0] = 0;
|
|
|
|
sSysCfbFbPtr[1] = 0;
|
|
|
|
sSysCfbEnd = 0;
|
|
|
|
}
|
|
|
|
|
2022-10-02 17:38:09 +02:00
|
|
|
void* SysCfb_GetFbPtr(s32 idx) {
|
2020-03-22 22:19:43 +01:00
|
|
|
if (idx < 2) {
|
2022-10-02 17:38:09 +02:00
|
|
|
return (void*)sSysCfbFbPtr[idx];
|
2020-03-22 22:19:43 +01:00
|
|
|
}
|
2022-10-02 17:38:09 +02:00
|
|
|
return NULL;
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
|
|
|
|
2022-10-02 17:38:09 +02:00
|
|
|
void* SysCfb_GetFbEnd(void) {
|
|
|
|
return (void*)sSysCfbEnd;
|
2020-03-22 22:19:43 +01:00
|
|
|
}
|