1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-02 07:46:01 +00:00
oot/src/code/sys_cfb.c
Roman971 f5a7c5612b
Use intptr types in more code files (#1385)
* Use intptr types for segments and a few system files

* Use intptr types for more dma rom addresses

* Use intptr types in data referring to rom files

* Update and cleanup a few message casts

* Change sys_cfb functions and debugHeapStart to use pointers

* Update graph.c for the sys_cfb return type change
2022-10-02 11:38:09 -04:00

54 lines
1.7 KiB
C

#include "global.h"
uintptr_t sSysCfbFbPtr[2];
uintptr_t sSysCfbEnd;
void SysCfb_Init(s32 n64dd) {
u32 screenSize;
uintptr_t tmpFbEnd;
if (osMemSize >= 0x800000) {
// "8MB or more memory is installed"
osSyncPrintf("8Mバイト以上のメモリが搭載されています\n");
tmpFbEnd = 0x8044BE80;
if (n64dd == 1) {
osSyncPrintf("RAM 8M mode (N64DD対応)\n"); // "RAM 8M mode (N64DD compatible)"
sSysCfbEnd = 0x805FB000;
} else {
// "The margin for this version is %dK bytes"
osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024));
sSysCfbEnd = tmpFbEnd;
}
} else if (osMemSize >= 0x400000) {
osSyncPrintf("RAM4M mode\n");
sSysCfbEnd = 0x80400000;
} else {
LogUtils_HungupThread("../sys_cfb.c", 354);
}
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
sSysCfbEnd &= ~0x3F;
// "The final address used by the system is %08x"
osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
sSysCfbFbPtr[1] = sSysCfbEnd - (screenSize * 2);
// "Frame buffer addresses are %08x and %08x"
osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]);
}
void SysCfb_Reset(void) {
sSysCfbFbPtr[0] = 0;
sSysCfbFbPtr[1] = 0;
sSysCfbEnd = 0;
}
void* SysCfb_GetFbPtr(s32 idx) {
if (idx < 2) {
return (void*)sSysCfbFbPtr[idx];
}
return NULL;
}
void* SysCfb_GetFbEnd(void) {
return (void*)sSysCfbEnd;
}