1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-06 12:14:27 +00:00
oot/src/code/sys_cfb.c

71 lines
1.9 KiB
C
Raw Normal View History

#include "global.h"
2020-03-17 00:31:30 -04:00
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
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;
uintptr_t tmpFbEnd;
Fix/cleanup/rephrase miscellaneous stuff (#983) * Add parens around params usage in VEC_SET macro * Remove unnecessary space character in a xml * Use defines instead of magic values in head/tail magic comments * Use `OS_USEC_TO_CYCLES` to make a time look better in `Graph_TaskSet00` * `0x25800` -> `sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])` * `0x803DA800` -> `0x80400000 - frame buffer size` * Use `OS_VI_` defines instead of hex * Add empty line after some variable declarations * Remove unused `extern CutsceneData` in `z_bg_dy_yoseizo.c` * `Matrix_MtxFToYXZRotS` does not use `MTXMODE_` * Use `MTXMODE_` more * Remove `ASCII_TO_U32`, use `'IS64'` * Add explicit `!= NULL` in some ternaries * Use `INV_CONTENT`, `AMMO` macros more * Use `PLAYER_AP_` enum more to compare to `Player#heldItemActionParam` * Get rid of lowercase hex (outside libultra) * `gWindMill*` -> `gWindmill*` * Format and small fix enums in `z_boss_mo.h` * Use `CHECK_BTN_ANY` more * Fix xz/xy mistake in comment in tektite * Rephrase comments mentioning "the devs" in a more neutral way * Clean-up some objectively useless parens * Fix some negative values written as u16 instead of s16 in ichains * `SKJ_ACTON_` -> `SKJ_ACTION_` * Run formatter * Fix unk_ offset of `TransformUpdateIndex#unk_10` -> `unk_0E` * Remove comments using in-game text * Remove `U` suffix from integer literals * Revert "Remove `ASCII_TO_U32`, use `'IS64'`" This reverts commit c801337dde9fe5e8b7a7ecf85ad3629bf5b87aaf. * Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)` * Add empty line after decl x2 * Revert "Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)`" This reverts commit d80bdb32da449edc74e02b8ab3f5a2c532e74bdb. * Make `CUR_UPG_VALUE(UPG_STRENGTH)` compare to integers (eventually needs its own enum) * Only use `PLAYER_SHIELD_` enum with `Player#currentShield` * Only use `PLAYER_TUNIC_` enum with `Player#currentTunic`
2021-10-03 05:17:09 +02:00
if (osMemSize >= 0x800000) {
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) {
PRINTF(T("RAM 8M mode (N64DD対応)\n", "RAM 8M mode (N64DD compatible)\n"));
#if OOT_DEBUG
2020-03-17 00:31:30 -04:00
sSysCfbEnd = 0x805FB000;
#else
sSysCfbEnd = 0x80600000;
#endif
2020-03-22 22:19:43 +01:00
} else {
PRINTF(T("このバージョンのマージンは %dK バイトです\n", "The margin for this version is %dK bytes\n"),
(0x4BC00 / 1024));
#if OOT_DEBUG
2020-03-24 16:53:09 -04:00
sSysCfbEnd = tmpFbEnd;
#else
sSysCfbEnd = 0x80400000;
#endif
2020-03-17 00:31:30 -04:00
}
Fix/cleanup/rephrase miscellaneous stuff (#983) * Add parens around params usage in VEC_SET macro * Remove unnecessary space character in a xml * Use defines instead of magic values in head/tail magic comments * Use `OS_USEC_TO_CYCLES` to make a time look better in `Graph_TaskSet00` * `0x25800` -> `sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])` * `0x803DA800` -> `0x80400000 - frame buffer size` * Use `OS_VI_` defines instead of hex * Add empty line after some variable declarations * Remove unused `extern CutsceneData` in `z_bg_dy_yoseizo.c` * `Matrix_MtxFToYXZRotS` does not use `MTXMODE_` * Use `MTXMODE_` more * Remove `ASCII_TO_U32`, use `'IS64'` * Add explicit `!= NULL` in some ternaries * Use `INV_CONTENT`, `AMMO` macros more * Use `PLAYER_AP_` enum more to compare to `Player#heldItemActionParam` * Get rid of lowercase hex (outside libultra) * `gWindMill*` -> `gWindmill*` * Format and small fix enums in `z_boss_mo.h` * Use `CHECK_BTN_ANY` more * Fix xz/xy mistake in comment in tektite * Rephrase comments mentioning "the devs" in a more neutral way * Clean-up some objectively useless parens * Fix some negative values written as u16 instead of s16 in ichains * `SKJ_ACTON_` -> `SKJ_ACTION_` * Run formatter * Fix unk_ offset of `TransformUpdateIndex#unk_10` -> `unk_0E` * Remove comments using in-game text * Remove `U` suffix from integer literals * Revert "Remove `ASCII_TO_U32`, use `'IS64'`" This reverts commit c801337dde9fe5e8b7a7ecf85ad3629bf5b87aaf. * Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)` * Add empty line after decl x2 * Revert "Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)`" This reverts commit d80bdb32da449edc74e02b8ab3f5a2c532e74bdb. * Make `CUR_UPG_VALUE(UPG_STRENGTH)` compare to integers (eventually needs its own enum) * Only use `PLAYER_SHIELD_` enum with `Player#currentShield` * Only use `PLAYER_TUNIC_` enum with `Player#currentTunic`
2021-10-03 05:17:09 +02:00
} else if (osMemSize >= 0x400000) {
PRINTF("RAM4M mode\n");
2020-03-24 16:53:09 -04:00
sSysCfbEnd = 0x80400000;
2020-03-22 22:19:43 +01:00
} else {
#if PLATFORM_N64
LogUtils_HungupThread("../sys_cfb.c", 322);
#else
LogUtils_HungupThread("../sys_cfb.c", 354);
#endif
2020-03-17 00:31:30 -04:00
}
2020-03-24 16:53:09 -04:00
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
Fix/cleanup/rephrase miscellaneous stuff (#983) * Add parens around params usage in VEC_SET macro * Remove unnecessary space character in a xml * Use defines instead of magic values in head/tail magic comments * Use `OS_USEC_TO_CYCLES` to make a time look better in `Graph_TaskSet00` * `0x25800` -> `sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])` * `0x803DA800` -> `0x80400000 - frame buffer size` * Use `OS_VI_` defines instead of hex * Add empty line after some variable declarations * Remove unused `extern CutsceneData` in `z_bg_dy_yoseizo.c` * `Matrix_MtxFToYXZRotS` does not use `MTXMODE_` * Use `MTXMODE_` more * Remove `ASCII_TO_U32`, use `'IS64'` * Add explicit `!= NULL` in some ternaries * Use `INV_CONTENT`, `AMMO` macros more * Use `PLAYER_AP_` enum more to compare to `Player#heldItemActionParam` * Get rid of lowercase hex (outside libultra) * `gWindMill*` -> `gWindmill*` * Format and small fix enums in `z_boss_mo.h` * Use `CHECK_BTN_ANY` more * Fix xz/xy mistake in comment in tektite * Rephrase comments mentioning "the devs" in a more neutral way * Clean-up some objectively useless parens * Fix some negative values written as u16 instead of s16 in ichains * `SKJ_ACTON_` -> `SKJ_ACTION_` * Run formatter * Fix unk_ offset of `TransformUpdateIndex#unk_10` -> `unk_0E` * Remove comments using in-game text * Remove `U` suffix from integer literals * Revert "Remove `ASCII_TO_U32`, use `'IS64'`" This reverts commit c801337dde9fe5e8b7a7ecf85ad3629bf5b87aaf. * Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)` * Add empty line after decl x2 * Revert "Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)`" This reverts commit d80bdb32da449edc74e02b8ab3f5a2c532e74bdb. * Make `CUR_UPG_VALUE(UPG_STRENGTH)` compare to integers (eventually needs its own enum) * Only use `PLAYER_SHIELD_` enum with `Player#currentShield` * Only use `PLAYER_TUNIC_` enum with `Player#currentTunic`
2021-10-03 05:17:09 +02:00
sSysCfbEnd &= ~0x3F;
if (1) {}
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);
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
}
void SysCfb_Reset(void) {
2020-03-17 00:31:30 -04:00
sSysCfbFbPtr[0] = 0;
sSysCfbFbPtr[1] = 0;
sSysCfbEnd = 0;
}
void* SysCfb_GetFbPtr(s32 idx) {
2020-03-22 22:19:43 +01:00
if (idx < 2) {
return (void*)sSysCfbFbPtr[idx];
2020-03-22 22:19:43 +01:00
}
return NULL;
2020-03-17 00:31:30 -04:00
}
void* SysCfb_GetFbEnd(void) {
return (void*)sSysCfbEnd;
2020-03-22 22:19:43 +01:00
}