Skip to content

Commit

Permalink
Merge pull request #378 from lucie-sharpe/PrePoketchDisplay
Browse files Browse the repository at this point in the history
Pre poketch display
  • Loading branch information
lhearachel authored Feb 14, 2025
2 parents 7145113 + 84d8f10 commit 7b2b89d
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 85 deletions.
1 change: 1 addition & 0 deletions include/constants/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum HeapSize {
HEAP_SIZE_DEBUG = 0x10,
HEAP_SIZE_APPLICATION = 0x10D800,

HEAP_SIZE_PRE_POKETCH_SUBSCREEN = 0x18000,
HEAP_SIZE_POKETCH_MAIN = 0xC000,
HEAP_SIZE_POKETCH_APP = 0xC000,

Expand Down
10 changes: 0 additions & 10 deletions include/overlay024/ov24_02253CE0.h

This file was deleted.

10 changes: 10 additions & 0 deletions include/pre_poketch_subscreen/pre_poketch_subscreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef POKEPLATINUM_PRE_POKETCH_SUBSCREEN_H
#define POKEPLATINUM_PRE_POKETCH_SUBSCREEN_H

#include "bg_window.h"

void PrePoketchSubscreen_Init(BgConfig *bgConfig);
void PrePoketchSubscreen_Exit(BgConfig *bgConfig);
BOOL PrePoketchSubscreen_IsDone(BgConfig *bgConfig);

#endif // POKEPLATINUM_PRE_POKETCH_SUBSCREEN_H
2 changes: 1 addition & 1 deletion platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ Overlay overlay23
Overlay overlay24
{
After overlay9
Object main.nef.p/src_overlay024_ov24_02253CE0.c.o
Object main.nef.p/src_pre_poketch_subscreen_pre_poketch_subscreen.c.o
}

Overlay overlay25
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ pokeplatinum_c = files(
'overlay023/ov23_0225429C.c',
'overlay023/ov23_022542CC.c',
'overlay023/ov23_02254A14.c',
'overlay024/ov24_02253CE0.c',
'pre_poketch_subscreen/pre_poketch_subscreen.c',
'overlay025/poketch_system.c',
'overlay025/ov25_02254560.c',
'overlay025/ov25_02255090.c',
Expand Down
6 changes: 3 additions & 3 deletions src/overlay005/ov5_021DDAE4.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include "field/field_system.h"
#include "field/field_system_sub2_t.h"
#include "overlay024/ov24_02253CE0.h"
#include "overlay025/poketch_system.h"
#include "pre_poketch_subscreen/pre_poketch_subscreen.h"

#include "brightness_controller.h"
#include "field_task.h"
Expand Down Expand Up @@ -34,12 +34,12 @@ static BOOL ov5_021DDAE4(FieldTask *param0)
break;
case 1:
if (BrightnessController_IsTransitionComplete(BRIGHTNESS_SUB_SCREEN)) {
ov24_02253DA4(fieldSystem->bgConfig);
PrePoketchSubscreen_Exit(fieldSystem->bgConfig);
v1->unk_00++;
}
break;
case 2:
if (ov24_02253DB4(fieldSystem->bgConfig)) {
if (PrePoketchSubscreen_IsDone(fieldSystem->bgConfig)) {
Poketch *poketch = SaveData_PoketchData(fieldSystem->saveData);

Overlay_UnloadByID(FS_OVERLAY_ID(overlay24));
Expand Down
14 changes: 7 additions & 7 deletions src/overlay005/ov5_021EA714.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "field/field_system.h"
#include "field/field_system_sub2_t.h"
#include "overlay024/ov24_02253CE0.h"
#include "pre_poketch_subscreen/pre_poketch_subscreen.h"

#include "game_overlay.h"
#include "poketch.h"
Expand Down Expand Up @@ -34,7 +34,7 @@ void ov5_021EA728(FieldSystem *fieldSystem)
PoketchSystem_Create(fieldSystem, &fieldSystem->unk_04->poketchSys, fieldSystem->saveData, fieldSystem->bgConfig, RenderOam_GetScreenOam(1));
} else {
Overlay_LoadByID(FS_OVERLAY_ID(overlay24), 2);
ov24_02253CE0(fieldSystem->bgConfig);
PrePoketchSubscreen_Init(fieldSystem->bgConfig);
}
}

Expand All @@ -47,7 +47,7 @@ void ov5_021EA790(FieldSystem *fieldSystem)
&& (SystemFlag_CheckPoketchHidden(varsFlags) == 0)) {
PoketchSystem_StartShutdown(fieldSystem->unk_04->poketchSys);
} else {
ov24_02253DA4(fieldSystem->bgConfig);
PrePoketchSubscreen_Exit(fieldSystem->bgConfig);
}
}

Expand All @@ -64,7 +64,7 @@ u8 ov5_021EA7CC(FieldSystem *fieldSystem)
return 1;
}
} else {
if (ov24_02253DB4(fieldSystem->bgConfig)) {
if (PrePoketchSubscreen_IsDone(fieldSystem->bgConfig)) {
Overlay_UnloadByID(FS_OVERLAY_ID(overlay24));
return 1;
}
Expand All @@ -76,17 +76,17 @@ u8 ov5_021EA7CC(FieldSystem *fieldSystem)
void ov5_021EA830(FieldSystem *fieldSystem)
{
Overlay_LoadByID(FS_OVERLAY_ID(overlay24), 2);
ov24_02253CE0(fieldSystem->bgConfig);
PrePoketchSubscreen_Init(fieldSystem->bgConfig);
}

void ov5_021EA848(FieldSystem *fieldSystem)
{
ov24_02253DA4(fieldSystem->bgConfig);
PrePoketchSubscreen_Exit(fieldSystem->bgConfig);
}

BOOL ov5_021EA854(FieldSystem *fieldSystem)
{
if (ov24_02253DB4(fieldSystem->bgConfig)) {
if (PrePoketchSubscreen_IsDone(fieldSystem->bgConfig)) {
Overlay_UnloadByID(FS_OVERLAY_ID(overlay24));
return 1;
}
Expand Down
63 changes: 0 additions & 63 deletions src/overlay024/ov24_02253CE0.c

This file was deleted.

60 changes: 60 additions & 0 deletions src/pre_poketch_subscreen/pre_poketch_subscreen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "pre_poketch_subscreen/pre_poketch_subscreen.h"

#include "constants/heap.h"

#include "bg_window.h"
#include "graphics.h"
#include "heap.h"
#include "narc.h"

#define PRE_POKETCH_DISPLAY_NARC_TILES_IDX 10
#define PRE_POKETCH_DISPLAY_NARC_TILEMAP_IDX 11
#define PRE_POKETCH_DISPLAY_NARC_PALETTE_IDX 12

void PrePoketchSubscreen_Init(BgConfig *bgConfig)
{
static const BgTemplate template = {
.x = 0,
.y = 0,
.bufferSize = 0x800,
.baseTile = 0,
.screenSize = BG_SCREEN_SIZE_256x256,
.colorMode = GX_BG_COLORMODE_16,
.screenBase = GX_BG_SCRBASE_0x6000,
.charBase = GX_BG_CHARBASE_0x00000,
.bgExtPltt = GX_BG_EXTPLTT_01,
.priority = 0,
.areaOver = 0,
.mosaic = FALSE,
};

Heap_Create(HEAP_ID_APPLICATION, HEAP_ID_POKETCH_APP, HEAP_SIZE_PRE_POKETCH_SUBSCREEN);

GXS_SetGraphicsMode(GX_BGMODE_0);
GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H);
GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_16_I);
GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K);

Bg_InitFromTemplate(bgConfig, BG_LAYER_SUB_0, &template, BG_TYPE_STATIC);

NARC *narc = NARC_ctor(NARC_INDEX_GRAPHIC__POKETCH, HEAP_ID_POKETCH_APP);

Graphics_LoadTilesToBgLayerFromOpenNARC(narc, PRE_POKETCH_DISPLAY_NARC_TILES_IDX, bgConfig, BG_LAYER_SUB_0, 0, 0, TRUE, HEAP_ID_POKETCH_APP);
Graphics_LoadTilemapToBgLayerFromOpenNARC(narc, PRE_POKETCH_DISPLAY_NARC_TILEMAP_IDX, bgConfig, BG_LAYER_SUB_0, 0, 0, TRUE, HEAP_ID_POKETCH_APP);
Graphics_LoadPaletteFromOpenNARC(narc, PRE_POKETCH_DISPLAY_NARC_PALETTE_IDX, PAL_LOAD_SUB_BG, 0, 0x20, HEAP_ID_POKETCH_APP);
NARC_dtor(narc);

GXS_SetVisibleWnd(GX_WNDMASK_NONE);
GXS_SetVisiblePlane(GX_PLANEMASK_BG0);
}

void PrePoketchSubscreen_Exit(BgConfig *bgConfig)
{
Bg_FreeTilemapBuffer(bgConfig, BG_LAYER_SUB_0);
Heap_Destroy(HEAP_ID_POKETCH_APP);
}

BOOL PrePoketchSubscreen_IsDone(BgConfig *bgConfig)
{
return TRUE;
}

0 comments on commit 7b2b89d

Please sign in to comment.