mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-24 07:10:44 -04:00
Move the system heap and the framebuffers to their own segments (#1488)
* make segments for the systemheap and the framebuffers * define in the makefile * undefined syms * Make segments for the pre boot buffers too * Update spec Co-authored-by: Parker <20159000+jpburnett@users.noreply.github.com> * review * Update spec Co-authored-by: Parker <20159000+jpburnett@users.noreply.github.com> * Update Makefile Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * comments * comment * move comment about the hardcoded address to buffers.h * rewrite SYSTEM_HEAP_END_ADDR in terms of other symbols * Use `ALIGNED` on all the buffers * Rename SYSTEM_HEAP_END_ADDR to FRAMEBUFFERS_START_ADDR * Put ALIGNED at the right like the rest of the codebase * merge * gLoBuffer * gHiBuffer * Add a static assert to ensure the address of gHiBuffer haven't shifted without the user noticing * smol include cleanup --------- Co-authored-by: Parker <20159000+jpburnett@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -53,8 +53,8 @@ void Main(void* arg) {
|
||||
Check_RegionIsSupported();
|
||||
Check_ExpansionPak();
|
||||
|
||||
sysHeap = (intptr_t)gSystemHeap;
|
||||
fb = 0x80780000;
|
||||
sysHeap = (intptr_t)SEGMENT_START(system_heap);
|
||||
fb = FRAMEBUFFERS_START_ADDR;
|
||||
gSystemHeapSize = fb - sysHeap;
|
||||
SystemHeap_Init((void*)sysHeap, gSystemHeapSize);
|
||||
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z64.h"
|
||||
#include "buffers.h"
|
||||
#include "regs.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
@@ -41,9 +41,6 @@ u8 gSysCfbHiResEnabled;
|
||||
#include "system_malloc.h"
|
||||
#include "z64vimode.h"
|
||||
|
||||
extern u16 gFramebufferHiRes0[HIRES_BUFFER_WIDTH][HIRES_BUFFER_HEIGHT];
|
||||
extern u16 gFramebufferHiRes1[HIRES_BUFFER_WIDTH][HIRES_BUFFER_HEIGHT];
|
||||
|
||||
void SysCfb_SetLoResMode(void) {
|
||||
gFramebuffers[1] = sCfbLoRes1;
|
||||
gFramebuffers[0] = sCfbLoRes0;
|
||||
@@ -93,8 +90,8 @@ void SysCfb_SetHiResMode(void) {
|
||||
}
|
||||
|
||||
void SysCfb_Init(void) {
|
||||
sCfbLoRes1 = gFramebuffer1;
|
||||
sCfbLoRes0 = gFramebuffer0;
|
||||
sCfbLoRes1 = gLoBuffer.framebuffer;
|
||||
sCfbLoRes0 = gHiBuffer.framebuffer;
|
||||
sCfbHiRes1 = gFramebufferHiRes1;
|
||||
sCfbHiRes0 = gFramebufferHiRes0;
|
||||
SysCfb_SetLoResMode();
|
||||
|
||||
+5
-5
@@ -248,7 +248,7 @@ void Play_TriggerPictoPhoto(void) {
|
||||
|
||||
void Play_TakePictoPhoto(PreRender* prerender) {
|
||||
PreRender_ApplyFilters(prerender);
|
||||
Play_ConvertRgba16ToIntensityImage(gPictoPhotoI8, prerender->fbufSave, SCREEN_WIDTH, PICTO_PHOTO_TOPLEFT_X,
|
||||
Play_ConvertRgba16ToIntensityImage(gHiBuffer.pictoPhotoI8, prerender->fbufSave, SCREEN_WIDTH, PICTO_PHOTO_TOPLEFT_X,
|
||||
PICTO_PHOTO_TOPLEFT_Y, (PICTO_PHOTO_TOPLEFT_X + PICTO_PHOTO_WIDTH) - 1,
|
||||
(PICTO_PHOTO_TOPLEFT_Y + PICTO_PHOTO_HEIGHT) - 1, 8);
|
||||
}
|
||||
@@ -2262,10 +2262,10 @@ void Play_Init(GameState* thisx) {
|
||||
PreRender_SetValues(&this->pauseBgPreRender, gCfbWidth, gCfbHeight, NULL, NULL);
|
||||
|
||||
this->unk_18E64 = gWorkBuffer;
|
||||
this->pictoPhotoI8 = gPictoPhotoI8;
|
||||
this->unk_18E68 = D_80784600;
|
||||
this->unk_18E58 = D_80784600;
|
||||
this->unk_18E60 = D_80784600;
|
||||
this->pictoPhotoI8 = gHiBuffer.pictoPhotoI8;
|
||||
this->unk_18E68 = gHiBuffer.D_80784600;
|
||||
this->unk_18E58 = gHiBuffer.D_80784600;
|
||||
this->unk_18E60 = gHiBuffer.D_80784600;
|
||||
gTransitionTileState = TRANS_TILE_OFF;
|
||||
this->transitionMode = TRANS_MODE_OFF;
|
||||
D_801D0D54 = false;
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "buffers.h"
|
||||
|
||||
u32 D_801C5E30[] = { 0, 0x2000, 0x4000, 0x6000, 0x8000, 0xC000 };
|
||||
|
||||
@@ -193,7 +194,7 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId)
|
||||
switch (skyboxId) {
|
||||
case SKYBOX_NORMAL_SKY:
|
||||
// Send a DMA request for the cloudy sky texture
|
||||
skyboxCtx->staticSegments[0] = &D_80025D00;
|
||||
skyboxCtx->staticSegments[0] = gLoBuffer.skyboxBuffer;
|
||||
size = SEGMENT_ROM_SIZE(d2_cloud_static);
|
||||
segment = (void*)ALIGN8((uintptr_t)skyboxCtx->staticSegments[0] + size);
|
||||
DmaMgr_SendRequest0(skyboxCtx->staticSegments[0], SEGMENT_ROM_START(d2_cloud_static), size);
|
||||
|
||||
Reference in New Issue
Block a user