1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-17 13:24:45 +00:00

Merge branch 'main' into doc_pause_menu

This commit is contained in:
Dragorn421 2024-09-30 11:57:05 +02:00
commit 2a496cd56d
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
59 changed files with 1136 additions and 358 deletions

14
Jenkinsfile vendored
View file

@ -57,6 +57,13 @@ pipeline {
}
}
}
stage('Build pal-1.0') {
steps {
script {
build('pal-1.0', 'oot-pal-1.0.z64')
}
}
}
stage('Build gc-us') {
steps {
script {
@ -85,6 +92,13 @@ pipeline {
}
}
}
stage('Build pal-1.1') {
steps {
script {
build('pal-1.1', 'oot-pal-1.1.z64')
}
}
}
stage('Build gc-us-mq') {
steps {
script {

View file

@ -18,7 +18,9 @@ ORIG_COMPILER ?= 0
# If COMPILER is "gcc", compile with GCC instead of IDO.
COMPILER ?= ido
# Target game version. Currently the following versions are supported:
# pal-1.0 N64 PAL 1.0 (Europe)
# ntsc-1.2 N64 NTSC 1.2 (Japan/US depending on REGION)
# pal-1.1 N64 PAL 1.1 (Europe)
# gc-jp GameCube Japan
# gc-jp-mq GameCube Japan Master Quest
# gc-us GameCube US
@ -28,8 +30,7 @@ COMPILER ?= ido
# gc-eu-mq GameCube Europe/PAL Master Quest
# gc-jp-ce GameCube Japan (Collector's Edition disc)
# The following versions are work-in-progress and not yet matching:
# pal-1.0 N64 PAL 1.0 (Europe)
# pal-1.1 N64 PAL 1.1 (Europe)
# (none currently)
VERSION ?= gc-eu-mq-dbg
# Number of threads to extract and compress with
N_THREADS ?= $(shell nproc)
@ -53,7 +54,6 @@ ifeq ($(VERSION),pal-1.0)
REGION ?= EU
PLATFORM := N64
DEBUG := 0
COMPARE := 0
else ifeq ($(VERSION),ntsc-1.2)
REGIONAL_CHECKSUM := 1
REGION ?= JP
@ -63,7 +63,6 @@ else ifeq ($(VERSION),pal-1.1)
REGION ?= EU
PLATFORM := N64
DEBUG := 0
COMPARE := 0
else ifeq ($(VERSION),gc-jp)
REGION ?= JP
PLATFORM := GC

View file

@ -3,6 +3,18 @@
<Array Name="gNameEntryVtx" Count="24" Offset="0x0" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsMenuHeadersVtx" Count="24" Offset="0x180" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsMenuSettingsVtx" Count="32" Offset="0x300" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsMenuBrightnessVtx" Count="8" Offset="0x500" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsMenuLanguageVtx" Count="12" Offset="0x580" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerSoundVtx" Count="4" Offset="0x780" Static="Off">
<Vtx/>
</Array>
@ -12,6 +24,9 @@
<Array Name="gOptionsDividerBrightnessVtx" Count="4" Offset="0x800" Static="Off">
<Vtx/>
</Array>
<Array Name="gOptionsDividerLanguageVtx" Count="4" Offset="0x840" Static="Off">
<Vtx/>
</Array>
<Array Name="gCharPageEng" Count="65" Offset="0x880" Static="Off">
<Scalar Type="s16"/>
</Array>

View file

@ -39,6 +39,14 @@
<Texture Name="gFileSelCheckBrightnessGERTex" OutName="check_brightness_ger" Format="ia8" Width="128" Height="16" Offset="0x5380"/>
<Texture Name="gFileSelCheckBrightnessFRATex" OutName="check_brightness_fra" Format="ia8" Width="128" Height="16" Offset="0x5B80"/>
<Texture Name="gFileSelLanguageChoiceENGTex" OutName="language_choice_eng" Format="ia8" Width="48" Height="16" Offset="0x6380"/>
<Texture Name="gFileSelLanguageChoiceGERTex" OutName="language_choice_ger" Format="ia8" Width="48" Height="16" Offset="0x6680"/>
<Texture Name="gFileSelLanguageChoiceFRATex" OutName="language_choice_fra" Format="ia8" Width="48" Height="16" Offset="0x6980"/>
<Texture Name="gFileSelLanguageENGTex" OutName="language_eng" Format="ia8" Width="64" Height="16" Offset="0x6C80"/>
<Texture Name="gFileSelLanguageGERTex" OutName="language_ger" Format="ia8" Width="64" Height="16" Offset="0x7080"/>
<Texture Name="gFileSelLanguageFRATex" OutName="language_fra" Format="ia8" Width="64" Height="16" Offset="0x7480"/>
<Texture Name="gFileSelWindow1Tex" OutName="window_1" Format="ia16" Width="64" Height="32" Offset="0x7880"/>
<Texture Name="gFileSelWindow2Tex" OutName="window_2" Format="ia16" Width="64" Height="32" Offset="0x8880"/>
<Texture Name="gFileSelWindow3Tex" OutName="window_3" Format="ia16" Width="64" Height="32" Offset="0x9880"/>
@ -181,6 +189,14 @@
<Texture Name="gFileSelQuitButtonFRATex" OutName="quit_button_fra" Format="ia16" Width="64" Height="16" Offset="0x47B00"/>
<Texture Name="gFileSelInitialLanguageChoiceENGTex" OutName="initial_language_choice_eng" Format="ia8" Width="80" Height="32" Offset="0x48300"/>
<Texture Name="gFileSelInitialLanguageChoiceGERTex" OutName="initial_language_choice_ger" Format="ia8" Width="80" Height="32" Offset="0x48D00"/>
<Texture Name="gFileSelInitialLanguageChoiceFRATex" OutName="initial_language_choice_fra" Format="ia8" Width="80" Height="32" Offset="0x49700"/>
<Texture Name="gFileSelSelectYourLanguageTex" OutName="select_your_language" Format="ia8" Width="160" Height="60" Offset="0x4A100"/>
<Texture Name="gFileSelInitialLanguageCursorTex" OutName="initial_language_cursor" Format="i4" Width="48" Height="48" Offset="0x4C900"/>
<DList Name="gFileSelWindow1DL" Offset="0x4CD80"/>
<DList Name="gFileSelWindow2DL" Offset="0x4CF98"/>
<DList Name="gFileSelWindow3DL" Offset="0x4D1A8"/>

View file

@ -1,27 +0,0 @@
.include "macro.inc"
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .data
.balign 16
/* Unused */
glabel D_80009410
.word osStopThread
.word __osSetHWIntrRoutine
#if PLATFORM_N64
.word osEPiWriteIo
.word osEPiReadIo
#endif
.word __osSetFpcCsr
.word __osGetFpcCsr
.word __osGetHWIntrRoutine
.word __osSetHWIntrRoutine
.word osViGetNextFramebuffer
#if !PLATFORM_N64
.word bcmp
#endif

View file

@ -307,86 +307,13 @@ void OnePointCutscene_EnableAttention(void);
void OnePointCutscene_DisableAttention(void);
s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 actorCategory);
void OnePointCutscene_Noop(PlayState* play, s32 arg1);
void Map_SavePlayerInitialInfo(PlayState* play);
void Map_SetFloorPalettesData(PlayState* play, s16 floor);
void Map_InitData(PlayState* play, s16 room);
void Map_InitRoomData(PlayState* play, s16 room);
void Map_Destroy(PlayState* play);
void Map_Init(PlayState* play);
void Minimap_Draw(PlayState* play);
void Map_Update(PlayState* play);
Path* Path_GetByIndex(PlayState* play, s16 index, s16 max);
f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw);
void Path_CopyLastPoint(Path* path, Vec3f* dest);
void Player_SetBootData(PlayState* play, Player* this);
int Player_InBlockingCsMode(PlayState* play, Player* this);
int Player_InCsMode(PlayState* play);
s32 Player_CheckHostileLockOn(Player* this);
int Player_IsChildWithHylianShield(Player* this);
s32 Player_ActionToModelGroup(Player* this, s32 itemAction);
void Player_SetModelsForHoldingShield(Player* this);
void Player_SetModels(Player* this, s32 modelGroup);
void Player_SetModelGroup(Player* this, s32 modelGroup);
void func_8008EC70(Player* this);
void Player_SetEquipmentData(PlayState* play, Player* this);
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction);
void Player_ReleaseLockOn(Player* this);
void Player_ClearZTargeting(Player* this);
void Player_SetAutoLockOnActor(PlayState* play, Actor* actor);
s32 func_8008EF44(PlayState* play, s32 ammo);
int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange);
s32 Player_GetStrength(void);
u8 Player_GetMask(PlayState* play);
Player* Player_UnsetMask(PlayState* play);
s32 Player_HasMirrorShieldEquipped(PlayState* play);
int Player_HasMirrorShieldSetToDraw(PlayState* play);
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction);
int Player_HoldsHookshot(Player* this);
int func_8008F128(Player* this);
s32 Player_ActionToMeleeWeapon(s32 itemAction);
s32 Player_GetMeleeWeaponHeld(Player* this);
s32 Player_HoldsTwoHandedWeapon(Player* this);
int Player_HoldsBrokenKnife(Player* this);
s32 Player_ActionToBottle(Player* this, s32 itemAction);
s32 Player_GetBottleHeld(Player* this);
s32 Player_ActionToExplosive(Player* this, s32 itemAction);
s32 Player_GetExplosiveHeld(Player* this);
s32 func_8008F2BC(Player* this, s32 itemAction);
s32 Player_GetEnvironmentalHazard(PlayState* play);
void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
void* data);
s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase);
void Player_DrawGetItem(PlayState* play, Player* this);
void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime);
void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots);
void PreNMI_Init(GameState* thisx);
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height);
Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y);
Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height);
Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2,
u32 y2, s32 width2, s32 height2);
Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2,
u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a);
Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a);
void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b);
void func_80095974(GraphicsContext* gfxCtx);
void func_80095AA0(PlayState* play, Room* room, Input* input, s32 arg3);
void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode,
u16 tlutCount, f32 offsetX, f32 offsetY);
@ -440,34 +367,7 @@ void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8
u8 handlePulse, u32 handleSpeed);
void SsSram_Dma(void* dramAddr, size_t size, s32 direction);
void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction);
View* View_New(GraphicsContext* gfxCtx);
void View_Free(View* view);
void View_Init(View*, GraphicsContext*);
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_SetScale(View* view, f32 scale);
void View_GetScale(View* view, f32* scale);
void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar);
void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar);
void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetViewport(View* view, Viewport* viewport);
void View_GetViewport(View* view, Viewport* viewport);
void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ);
void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ);
s32 View_SetDistortionSpeed(View* view, f32 speed);
void View_InitDistortion(View* view);
void View_ClearDistortion(View* view);
void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed);
s32 View_StepDistortion(View* view, Mtx* projectionMtx);
s32 View_Apply(View* view, s32 mask);
s32 View_ApplyOrthoToOverlay(View* view);
s32 View_ApplyPerspectiveToOverlay(View* view);
s32 View_UpdateViewingMatrix(View* view);
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP);
#if OOT_DEBUG
s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ);
#endif
void ViMode_LogPrint(OSViMode* osViMode);
void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit,
s32 width, s32 height, s32 leftAdjust, s32 rightAdjust, s32 upperAdjust, s32 lowerAdjust);
@ -566,9 +466,6 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx);
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState);
void Graph_ThreadEntry(void*);
Gfx* Gfx_Open(Gfx* gfx);
Gfx* Gfx_Close(Gfx* gfx, Gfx* dst);
void* Gfx_Alloc(Gfx** gfxP, u32 size);
ListAlloc* ListAlloc_Init(ListAlloc* this);
void* ListAlloc_Alloc(ListAlloc* this, u32 size);
void ListAlloc_Free(ListAlloc* this, void* data);

View file

@ -5,6 +5,7 @@
#include "ultra64/gbi.h"
#include "sched.h"
#include "thga.h"
#include "versions.h"
// Texture memory size, 4 KiB
#define TMEM_SIZE 0x1000
@ -46,11 +47,28 @@ typedef struct GraphicsContext {
/* 0x02E8 */ s32 fbIdx;
/* 0x02EC */ void (*callback)(struct GraphicsContext*, void*);
/* 0x02F0 */ void* callbackParam;
#if OOT_VERSION >= PAL_1_0
/* 0x02F4 */ f32 xScale;
/* 0x02F8 */ f32 yScale;
#endif
/* 0x02FC */ char unk_2FC[0x04];
} GraphicsContext; // size = 0x300
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height);
Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y);
Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height);
Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2,
u32 y2, s32 width2, s32 height2);
Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2,
u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a);
Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a);
void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b);
void func_80095974(GraphicsContext* gfxCtx);
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size);
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size);

View file

@ -116,6 +116,7 @@ void Gfx_SetupDL_42Overlay(struct GraphicsContext* gfxCtx);
void Gfx_SetupDL_27Xlu(struct GraphicsContext* gfxCtx);
void Gfx_SetupDL_60NoCDXlu(struct GraphicsContext* gfxCtx);
void Gfx_SetupDL_61Xlu(struct GraphicsContext* gfxCtx);
void Gfx_SetupDL_56Opa(struct GraphicsContext* gfxCtx);
void Gfx_SetupDL_56Ptr(Gfx** gfxP);
#endif

10
include/gfxalloc.h Normal file
View file

@ -0,0 +1,10 @@
#ifndef GFXALLOC_H
#define GFXALLOC_H
#include "ultra64.h"
Gfx* Gfx_Open(Gfx* gfx);
Gfx* Gfx_Close(Gfx* gfx, Gfx* dst);
void* Gfx_Alloc(Gfx** gfxP, u32 size);
#endif

View file

@ -82,17 +82,6 @@
(state)->size = sizeof(newStruct); \
} while (0)
#define SET_FULLSCREEN_VIEWPORT(view) \
{ \
Viewport viewport; \
viewport.bottomY = SCREEN_HEIGHT; \
viewport.rightX = SCREEN_WIDTH; \
viewport.topY = 0; \
viewport.leftX = 0; \
View_SetViewport(view, &viewport); \
} \
(void)0
#if OOT_DEBUG
#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSyncDebug(ram, vrom, size, file, line)

79
include/map.h Normal file
View file

@ -0,0 +1,79 @@
#ifndef MAP_H
#define MAP_H
#include "ultra64.h"
struct PlayState;
typedef enum FloorID {
/* 1 */ F_8F = 1,
/* 2 */ F_7F,
/* 3 */ F_6F,
/* 4 */ F_5F,
/* 5 */ F_4F,
/* 6 */ F_3F,
/* 7 */ F_2F,
/* 8 */ F_1F,
/* 9 */ F_B1,
/* 10 */ F_B2,
/* 11 */ F_B3,
/* 12 */ F_B4,
/* 13 */ F_B5,
/* 14 */ F_B6,
/* 15 */ F_B7,
/* 16 */ F_B8
} FloorID;
// All arrays pointed in this struct are indexed by "map indices"
// In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc)
// In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc)
typedef struct MapData {
/* 0x00 */ s16 (*floorTexIndexOffset)[8]; // dungeon texture index offset by floor
/* 0x04 */ s16* bossFloor; // floor the boss is on
/* 0x08 */ s16 (*roomPalette)[32]; // map palette by room
/* 0x0C */ s16* maxPaletteCount; // max number of palettes in a same floor
/* 0x10 */ s16 (*paletteRoom)[8][14]; // room by palette by floor
/* 0x14 */ s16 (*roomCompassOffsetX)[44]; // dungeon compass icon X offset by room
/* 0x18 */ s16 (*roomCompassOffsetY)[44]; // dungeon compass icon Y offset by room
/* 0x1C */ u8* dgnMinimapCount; // number of room minimaps
/* 0x20 */ u16* dgnMinimapTexIndexOffset; // dungeon minimap texture index offset
/* 0x24 */ u16* owMinimapTexSize;
/* 0x28 */ u16* owMinimapTexOffset;
/* 0x2C */ s16* owMinimapPosX;
/* 0x30 */ s16* owMinimapPosY;
/* 0x34 */ s16 (*owCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset]
/* 0x38 */ s16* dgnTexIndexBase; // dungeon texture index base
/* 0x3C */ s16 (*dgnCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset]
/* 0x40 */ s16* owMinimapWidth;
/* 0x44 */ s16* owMinimapHeight;
/* 0x48 */ s16* owEntranceIconPosX; // "dungeon entrance" icon X pos
/* 0x4C */ s16* owEntranceIconPosY; // "dungeon entrance" icon Y pos
/* 0x50 */ u16* owEntranceFlag; // flag in inf_table[26] based on which entrance icons are shown (0xFFFF = always shown)
/* 0x54 */ f32 (*floorCoordY)[8]; // Y coordinate of each floor
/* 0x58 */ u16* switchEntryCount; // number of "room switch" entries, which correspond to the next 3 arrays
/* 0x5C */ u8 (*switchFromRoom)[51]; // room to come from
/* 0x60 */ u8 (*switchFromFloor)[51]; // floor to come from
/* 0x64 */ u8 (*switchToRoom)[51]; // room to go to
/* 0x68 */ u8 (*floorID)[8];
/* 0x6C */ s16* skullFloorIconY; // dungeon big skull icon Y pos
} MapData; // size = 0x70
// TODO get these properties from the textures themselves
#define MAP_I_TEX_WIDTH 96
#define MAP_I_TEX_HEIGHT 85
#define MAP_I_TEX_SIZE ((MAP_I_TEX_WIDTH * MAP_I_TEX_HEIGHT) / 2) // 96x85 I4 texture
#define MAP_48x85_TEX_WIDTH 48
#define MAP_48x85_TEX_HEIGHT 85
#define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture
void Map_SavePlayerInitialInfo(struct PlayState* play);
void Map_SetFloorPalettesData(struct PlayState* play, s16 floor);
void Map_InitData(struct PlayState* play, s16 room);
void Map_InitRoomData(struct PlayState* play, s16 room);
void Map_Destroy(struct PlayState* play);
void Map_Init(struct PlayState* play);
void Minimap_Draw(struct PlayState* play);
void Map_Update(struct PlayState* play);
#endif

View file

@ -3,6 +3,7 @@
#include "ultra64.h"
#include "irqmgr.h"
#include "versions.h"
#define OS_SC_NEEDS_RDP 0x0001 // Task uses the RDP
#define OS_SC_NEEDS_RSP 0x0002 // Task uses the RSP
@ -27,8 +28,10 @@ typedef struct CfbInfo {
/* 0x10 */ u8 unk_10; // set to 0, never read
/* 0x11 */ s8 updateRate; // how many VIs should elapse before next swap
/* 0x12 */ s8 updateTimer; // counts down (in VIs) from updateRate to 0, swaps the framebuffer at 0
#if OOT_VERSION >= PAL_1_0
/* 0x14 */ f32 xScale;
/* 0x18 */ f32 yScale;
#endif
} CfbInfo; // size = 0x1C
typedef struct OSScTask {

View file

@ -59,12 +59,14 @@
#include "padmgr.h"
#include "sched.h"
#include "rumble.h"
#include "map.h"
#include "mempak.h"
#include "tha.h"
#include "thga.h"
#include "speedmeter.h"
#include "gfx.h"
#include "gfx_setupdl.h"
#include "gfxalloc.h"
#include "jpeg.h"
#include "prerender.h"
#include "rand.h"
@ -206,7 +208,7 @@ typedef struct FileSelectState {
/* 0x000A8 */ u8* staticSegment;
/* 0x000AC */ u8* parameterSegment;
#if OOT_PAL
/* 0x000B0 */ char unk_B0[0x8];
/* 0x000B0 */ u8* objectMagSegment;
#endif
/* 0x000B8 */ View view;
/* 0x001E0 */ SramContext sramCtx;
@ -323,68 +325,6 @@ typedef struct PreNMIState {
/* 0xA8 */ UNK_TYPE4 unk_A8;
} PreNMIState; // size = 0xAC
typedef enum FloorID {
/* 1 */ F_8F = 1,
/* 2 */ F_7F,
/* 3 */ F_6F,
/* 4 */ F_5F,
/* 5 */ F_4F,
/* 6 */ F_3F,
/* 7 */ F_2F,
/* 8 */ F_1F,
/* 9 */ F_B1,
/* 10 */ F_B2,
/* 11 */ F_B3,
/* 12 */ F_B4,
/* 13 */ F_B5,
/* 14 */ F_B6,
/* 15 */ F_B7,
/* 16 */ F_B8
} FloorID;
// All arrays pointed in this struct are indexed by "map indices"
// In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc)
// In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc)
typedef struct MapData {
/* 0x00 */ s16 (*floorTexIndexOffset)[8]; // dungeon texture index offset by floor
/* 0x04 */ s16* bossFloor; // floor the boss is on
/* 0x08 */ s16 (*roomPalette)[32]; // map palette by room
/* 0x0C */ s16* maxPaletteCount; // max number of palettes in a same floor
/* 0x10 */ s16 (*paletteRoom)[8][14]; // room by palette by floor
/* 0x14 */ s16 (*roomCompassOffsetX)[44]; // dungeon compass icon X offset by room
/* 0x18 */ s16 (*roomCompassOffsetY)[44]; // dungeon compass icon Y offset by room
/* 0x1C */ u8* dgnMinimapCount; // number of room minimaps
/* 0x20 */ u16* dgnMinimapTexIndexOffset; // dungeon minimap texture index offset
/* 0x24 */ u16* owMinimapTexSize;
/* 0x28 */ u16* owMinimapTexOffset;
/* 0x2C */ s16* owMinimapPosX;
/* 0x30 */ s16* owMinimapPosY;
/* 0x34 */ s16 (*owCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset]
/* 0x38 */ s16* dgnTexIndexBase; // dungeon texture index base
/* 0x3C */ s16 (*dgnCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset]
/* 0x40 */ s16* owMinimapWidth;
/* 0x44 */ s16* owMinimapHeight;
/* 0x48 */ s16* owEntranceIconPosX; // "dungeon entrance" icon X pos
/* 0x4C */ s16* owEntranceIconPosY; // "dungeon entrance" icon Y pos
/* 0x50 */ u16* owEntranceFlag; // flag in inf_table[26] based on which entrance icons are shown (0xFFFF = always shown)
/* 0x54 */ f32 (*floorCoordY)[8]; // Y coordinate of each floor
/* 0x58 */ u16* switchEntryCount; // number of "room switch" entries, which correspond to the next 3 arrays
/* 0x5C */ u8 (*switchFromRoom)[51]; // room to come from
/* 0x60 */ u8 (*switchFromFloor)[51]; // floor to come from
/* 0x64 */ u8 (*switchToRoom)[51]; // room to go to
/* 0x68 */ u8 (*floorID)[8];
/* 0x6C */ s16* skullFloorIconY; // dungeon big skull icon Y pos
} MapData; // size = 0x70
// TODO get these properties from the textures themselves
#define MAP_I_TEX_WIDTH 96
#define MAP_I_TEX_HEIGHT 85
#define MAP_I_TEX_SIZE ((MAP_I_TEX_WIDTH * MAP_I_TEX_HEIGHT) / 2) // 96x85 I4 texture
#define MAP_48x85_TEX_WIDTH 48
#define MAP_48x85_TEX_HEIGHT 85
#define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture
typedef struct DebugDispObject {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3s rot;

View file

@ -908,8 +908,10 @@ void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDra
s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3);
void func_80034F54(struct PlayState* play, s16* arg1, s16* arg2, s32 arg3);
void Actor_Noop(Actor* actor, struct PlayState* play);
void Gfx_DrawDListOpa(struct PlayState* play, Gfx* dlist);
void Gfx_DrawDListXlu(struct PlayState* play, Gfx* dlist);
Actor* Actor_FindNearby(struct PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range);
s32 func_800354B4(struct PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5);
void func_8003555C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel);

View file

@ -930,4 +930,58 @@ typedef struct Player {
/* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position
} Player; // size = 0xA94
// z_player_lib public functions
void Player_SetBootData(struct PlayState* play, Player* this);
int Player_InBlockingCsMode(struct PlayState* play, Player* this);
int Player_InCsMode(struct PlayState* play);
s32 Player_CheckHostileLockOn(Player* this);
int Player_IsChildWithHylianShield(Player* this);
s32 Player_ActionToModelGroup(Player* this, s32 itemAction);
void Player_SetModelsForHoldingShield(Player* this);
void Player_SetModels(Player* this, s32 modelGroup);
void Player_SetModelGroup(Player* this, s32 modelGroup);
void func_8008EC70(Player* this);
void Player_SetEquipmentData(struct PlayState* play, Player* this);
void Player_UpdateBottleHeld(struct PlayState* play, Player* this, s32 item, s32 itemAction);
void Player_ReleaseLockOn(Player* this);
void Player_ClearZTargeting(Player* this);
void Player_SetAutoLockOnActor(struct PlayState* play, Actor* actor);
s32 func_8008EF44(struct PlayState* play, s32 ammo);
int Player_IsBurningStickInRange(struct PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange);
s32 Player_GetStrength(void);
u8 Player_GetMask(struct PlayState* play);
Player* Player_UnsetMask(struct PlayState* play);
s32 Player_HasMirrorShieldEquipped(struct PlayState* play);
int Player_HasMirrorShieldSetToDraw(struct PlayState* play);
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction);
int Player_HoldsHookshot(Player* this);
int func_8008F128(Player* this);
s32 Player_ActionToMeleeWeapon(s32 itemAction);
s32 Player_GetMeleeWeaponHeld(Player* this);
s32 Player_HoldsTwoHandedWeapon(Player* this);
int Player_HoldsBrokenKnife(Player* this);
s32 Player_ActionToBottle(Player* this, s32 itemAction);
s32 Player_GetBottleHeld(Player* this);
s32 Player_ActionToExplosive(Player* this, s32 itemAction);
s32 Player_GetExplosiveHeld(Player* this);
s32 func_8008F2BC(Player* this, s32 itemAction);
s32 Player_GetEnvironmentalHazard(struct PlayState* play);
void Player_DrawImpl(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
void* data);
s32 Player_OverrideLimbDrawGameplayCommon(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
s32 Player_OverrideLimbDrawGameplayDefault(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
s32 Player_OverrideLimbDrawGameplayFirstPerson(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos,
Vec3s* rot, void* thisx);
s32 Player_OverrideLimbDrawGameplayCrawling(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx);
u8 func_80090480(struct PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase);
void Player_DrawGetItem(struct PlayState* play, Player* this);
void Player_PostLimbDrawGameplay(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
u32 Player_InitPauseDrawData(struct PlayState* play, u8* segment, SkelAnime* skelAnime);
void Player_DrawPause(struct PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots);
#endif

View file

@ -12,6 +12,17 @@ typedef struct Viewport {
/* 0xC */ s32 rightX; // lrx (lower right x)
} Viewport; // size = 0x10
#define SET_FULLSCREEN_VIEWPORT(view) \
{ \
Viewport viewport; \
viewport.bottomY = SCREEN_HEIGHT; \
viewport.rightX = SCREEN_WIDTH; \
viewport.topY = 0; \
viewport.leftX = 0; \
View_SetViewport(view, &viewport); \
} \
(void)0
typedef struct View {
/* 0x000 */ s32 magic; // string literal "VIEW" / 0x56494557
/* 0x004 */ struct GraphicsContext* gfxCtx;
@ -55,4 +66,33 @@ typedef struct View {
#define VIEW_ERROR_CHECK_EYE_POS(x, y, z) (void)0
#endif
View* View_New(struct GraphicsContext* gfxCtx);
void View_Free(View* view);
void View_Init(View*, struct GraphicsContext*);
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_SetScale(View* view, f32 scale);
void View_GetScale(View* view, f32* scale);
void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar);
void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar);
void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetViewport(View* view, Viewport* viewport);
void View_GetViewport(View* view, Viewport* viewport);
void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ);
void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ);
s32 View_SetDistortionSpeed(View* view, f32 speed);
void View_InitDistortion(View* view);
void View_ClearDistortion(View* view);
void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed);
s32 View_StepDistortion(View* view, Mtx* projectionMtx);
s32 View_Apply(View* view, s32 mask);
s32 View_ApplyOrthoToOverlay(View* view);
s32 View_ApplyPerspectiveToOverlay(View* view);
s32 View_UpdateViewingMatrix(View* view);
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP);
#if OOT_DEBUG
s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ);
#endif
#endif

37
spec
View file

@ -15,9 +15,11 @@ beginseg
name "boot"
address 0x80000460
include "$(BUILD_DIR)/src/boot/boot_main.o"
include "$(BUILD_DIR)/data/unk_80009410.data.o"
include "$(BUILD_DIR)/src/boot/idle.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/boot/viconfig.o"
#endif
include "$(BUILD_DIR)/src/boot/carthandle.o"
include "$(BUILD_DIR)/src/boot/z_std_dma.o"
include "$(BUILD_DIR)/src/boot/yaz0.o"
include "$(BUILD_DIR)/src/boot/z_locale.o"
@ -41,8 +43,10 @@ beginseg
include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.o"
include "$(BUILD_DIR)/src/libultra/os/stopthread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/viextendvstart.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/recvmesg.o"
#if !PLATFORM_N64
include "$(BUILD_DIR)/src/libultra/os/initialize.o"
@ -92,7 +96,9 @@ beginseg
include "$(BUILD_DIR)/src/libultra/os/setthreadpri.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadpri.o"
include "$(BUILD_DIR)/src/libultra/io/epirawread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/viswapbuf.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/epirawdma.o"
#if !PLATFORM_N64
include "$(BUILD_DIR)/src/libultra/libc/bcmp.o"
@ -113,11 +119,16 @@ beginseg
#if OOT_PAL_N64
include "$(BUILD_DIR)/src/libultra/io/vimodentsclan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallan1.o"
#endif
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/vimodepallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/viswapcontext.o"
include "$(BUILD_DIR)/src/libultra/io/pigetcmdq.o"
include "$(BUILD_DIR)/src/libultra/io/epiread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/cartrominit.o"
#if OOT_PAL_N64 || OOT_DEBUG
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
@ -143,8 +154,10 @@ beginseg
include "$(BUILD_DIR)/src/libultra/io/vimgr.o"
include "$(BUILD_DIR)/src/libultra/io/vigetcurrcontext.o"
include "$(BUILD_DIR)/src/libultra/os/startthread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetyscale.o"
include "$(BUILD_DIR)/src/libultra/io/visetxscale.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/sethwintrroutine.o"
include "$(BUILD_DIR)/src/libultra/os/gethwintrroutine.o"
#if !PLATFORM_N64
@ -452,6 +465,15 @@ beginseg
number 7
endseg
#if OOT_NTSC && OOT_VERSION < NTSC_1_2
beginseg
name "jpn_message_data_static"
romalign 0x1000
include "$(BUILD_DIR)/assets/text/jpn_message_data_static.o"
number 8
endseg
#endif
beginseg
name "message_texture_static"
romalign 0x1000
@ -466,7 +488,7 @@ beginseg
number 10
endseg
#if OOT_NTSC
#if OOT_NTSC && OOT_VERSION >= NTSC_1_2
beginseg
name "jpn_message_data_static"
romalign 0x1000
@ -807,6 +829,9 @@ beginseg
include "$(BUILD_DIR)/src/libultra/libc/string.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/sp.o"
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/viswapbuf.o"
#endif
#if !PLATFORM_N64
include "$(BUILD_DIR)/src/libultra/mgu/mtxident.o"
#endif
@ -828,6 +853,9 @@ beginseg
include "$(BUILD_DIR)/src/libultra/gu/ortho.o"
include "$(BUILD_DIR)/src/libultra/gu/cosf.o"
include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o"
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/coss.o"
#if PLATFORM_N64
include "$(BUILD_DIR)/src/libultra/os/settime.o"
@ -851,7 +879,7 @@ beginseg
include "$(BUILD_DIR)/src/libultra/mgu/translate.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/contramwrite.o"
#if !OOT_PAL_N64 && !OOT_DEBUG
#if OOT_VERSION == NTSC_1_2 || (PLATFORM_GC && !OOT_DEBUG)
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
#endif
#if !OOT_DEBUG
@ -886,6 +914,9 @@ beginseg
include "$(BUILD_DIR)/src/libultra/mgu/mtxf2l.o"
#endif
include "$(BUILD_DIR)/src/libultra/libc/llcvt.o"
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetyscale.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/vigetcurrframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/spsetpc.o"
include "$(BUILD_DIR)/src/libc/sqrt.o"

3
src/boot/carthandle.c Normal file
View file

@ -0,0 +1,3 @@
#include "ultra64.h"
OSPiHandle* gCartHandle = NULL;

View file

@ -6,19 +6,33 @@
#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ntsc-1.2:64"
OSThread sMainThread;
#if OOT_VERSION < PAL_1_0
STACK(sMainStack, 0x800);
#else
STACK(sMainStack, 0x900);
#endif
StackEntry sMainStackInfo;
OSMesg sPiMgrCmdBuff[50];
OSMesgQueue gPiMgrCmdQueue;
OSViMode gViConfigMode;
u8 gViConfigModeType;
s8 D_80009430 = 1;
vu8 gViConfigBlack = true;
u8 gViConfigAdditionalScanLines = 0;
u32 gViConfigFeatures = OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF;
f32 gViConfigXScale = 1.0;
f32 gViConfigYScale = 1.0;
#if OOT_VERSION < PAL_1_0
u8 gViConfigModeType = OS_VI_NTSC_LPN1;
#else
u8 gViConfigModeType;
#endif
// Unused
void* D_80009410[] = {
osStopThread, __osSetHWIntrRoutine,
#if PLATFORM_N64
osEPiWriteIo, osEPiReadIo,
#endif
__osSetFpcCsr, __osGetFpcCsr, __osGetHWIntrRoutine, __osSetHWIntrRoutine, osViGetNextFramebuffer,
#if !PLATFORM_N64
bcmp,
#endif
};
void Main_ThreadEntry(void* arg) {
OSTime time;
@ -60,9 +74,11 @@ void Idle_ThreadEntry(void* arg) {
osCreateViManager(OS_PRIORITY_VIMGR);
#if OOT_VERSION >= PAL_1_0
gViConfigFeatures = OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON;
gViConfigXScale = 1.0f;
gViConfigYScale = 1.0f;
#endif
#if OOT_DEBUG
// Allow both 60 Hz and 50 Hz
@ -110,11 +126,17 @@ void Idle_ThreadEntry(void* arg) {
}
#endif
#if OOT_VERSION < PAL_1_0
osViSetMode(&gViConfigMode);
osViBlack(true);
#else
D_80009430 = 1;
osViSetMode(&gViConfigMode);
ViConfig_UpdateVi(true);
osViBlack(true);
osViSwapBuffer((void*)0x803DA80); //! @bug Invalid vram address (probably intended to be 0x803DA800)
#endif
osCreatePiManager(OS_PRIORITY_PIMGR, &gPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x400, "main");
osCreateThread(&sMainThread, THREAD_ID_MAIN, Main_ThreadEntry, arg, STACK_TOP(sMainStack), THREAD_PRI_MAIN_INIT);

View file

@ -1,8 +1,12 @@
#include "global.h"
#include "terminal.h"
// this should probably go elsewhere but right now viconfig.o is the only object between idle and z_std_dma
OSPiHandle* gCartHandle = NULL;
s8 D_80009430 = 1;
vu8 gViConfigBlack = true;
u8 gViConfigAdditionalScanLines = 0;
u32 gViConfigFeatures = OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF;
f32 gViConfigXScale = 1.0;
f32 gViConfigYScale = 1.0;
void ViConfig_UpdateVi(u32 black) {
if (black) {

View file

@ -1,7 +1,7 @@
#include "global.h"
#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" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.1:128"
ALIGNED(16) u8 sYaz0DataBuffer[0x400];
u8* sYaz0DataBufferEnd;

View file

@ -1,6 +1,7 @@
#include "global.h"
#include "region.h"
#include "terminal.h"
#include "versions.h"
s32 gCurrentRegion = 0;
@ -29,9 +30,11 @@ void Locale_Init(void) {
case 'E': // "NTSC-U (North America)"
gCurrentRegion = REGION_US;
break;
#if OOT_VERSION >= PAL_1_0
case 'P': // "PAL (Europe)"
gCurrentRegion = REGION_EU;
break;
#endif
default:
PRINTF(VT_COL(RED, WHITE));
PRINTF(T("z_locale_init: 日本用かアメリカ用か判別できません\n",

View file

@ -27,7 +27,7 @@
#endif
#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" \
"ntsc-1.2:98"
"ntsc-1.2:96 pal-1.0:94 pal-1.1:94"
StackEntry sDmaMgrStackInfo;
OSMesgQueue sDmaMgrMsgQueue;

View file

@ -1,6 +1,6 @@
#if PLATFORM_N64
#pragma increment_block_number "ntsc-1.2:128"
#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
#include "global.h"
#include "fault.h"
@ -8,7 +8,7 @@
#include "stack.h"
#include "terminal.h"
#pragma increment_block_number "ntsc-1.2:96"
#pragma increment_block_number "ntsc-1.2:96 pal-1.0:96 pal-1.1:96"
typedef struct FaultMgr {
OSThread thread;

View file

@ -2,6 +2,7 @@
#include "fault.h"
#include "libc64/os_malloc.h"
#include "terminal.h"
#include "versions.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
@ -281,6 +282,14 @@ void GameState_Update(GameState* gameState) {
func_800C4344(gameState);
#if OOT_VERSION < PAL_1_0
if (R_VI_MODE_EDIT_STATE != VI_MODE_EDIT_STATE_INACTIVE) {
ViMode_Update(&sViMode, &gameState->input[0]);
gfxCtx->viMode = &sViMode.customViMode;
gfxCtx->viFeatures = sViMode.viFeatures;
}
#endif
#if OOT_DEBUG
if (SREG(63) == 1u) {
if (R_VI_MODE_EDIT_STATE < VI_MODE_EDIT_STATE_INACTIVE) {

View file

@ -2,12 +2,13 @@
#include "fault.h"
#include "terminal.h"
#include "ucode_disas.h"
#include "versions.h"
#define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678
#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" \
"ntsc-1.2:192"
"ntsc-1.2:192 pal-1.0:192 pal-1.1:192"
/**
* The time at which the previous `Graph_Update` ended.
@ -140,10 +141,17 @@ void Graph_Init(GraphicsContext* gfxCtx) {
gfxCtx->gfxPoolIdx = 0;
gfxCtx->fbIdx = 0;
gfxCtx->viMode = NULL;
#if OOT_VERSION < PAL_1_0
gfxCtx->viFeatures = 0;
#else
gfxCtx->viFeatures = gViConfigFeatures;
gfxCtx->xScale = gViConfigXScale;
gfxCtx->yScale = gViConfigYScale;
#endif
osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff));
#if OOT_DEBUG
func_800D31F0();
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL);
@ -272,8 +280,10 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
cfb->viMode = gfxCtx->viMode;
cfb->viFeatures = gfxCtx->viFeatures;
#if OOT_VERSION >= PAL_1_0
cfb->xScale = gfxCtx->xScale;
cfb->yScale = gfxCtx->yScale;
#endif
cfb->unk_10 = 0;
cfb->updateRate = R_UPDATE_RATE;

View file

@ -4,7 +4,7 @@
extern uintptr_t gSegments[NUM_SEGMENTS];
#pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:252 gc-jp-ce:252 gc-jp-mq:252 gc-us:252 gc-us-mq:252" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
extern struct PreNmiBuff* gAppNmiBufferPtr;
extern struct Scheduler gScheduler;
@ -23,7 +23,7 @@ extern struct IrqMgr gIrqMgr;
#endif
#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \
"ntsc-1.2:158"
"ntsc-1.2:156 pal-1.0:154 pal-1.1:154"
extern u8 _buffersSegmentEnd[];

View file

@ -41,6 +41,7 @@
*/
#include "global.h"
#include "fault.h"
#include "versions.h"
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
@ -53,7 +54,7 @@ OSTime sRSPAudioTimeStart;
OSTime sRSPOtherTimeStart;
OSTime sRDPTimeStart;
#if OOT_DEBUG
#if OOT_VERSION < PAL_1_0 || OOT_DEBUG
vs32 sSchedDebugPrintfEnabled = false;
#define SCHED_DEBUG_PRINTF \
@ -115,10 +116,29 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) {
#endif
}
#if OOT_VERSION < PAL_1_0
if (cfbInfo->viMode != NULL) {
osViSetMode(cfbInfo->viMode);
osViSetSpecialFeatures(cfbInfo->viFeatures);
}
if (1) {}
if (1) {}
if (1) {}
if (1) {}
if (1) {}
#endif
cfbInfo->unk_10 = 0;
}
void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) {
#if OOT_VERSION < PAL_1_0
Sched_SwapFrameBufferImpl(cfbInfo);
if (sc->isFirstSwap) {
osViBlack(false);
sc->isFirstSwap = false;
}
#else
if (sc->isFirstSwap) {
sc->isFirstSwap = false;
@ -127,6 +147,7 @@ void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) {
}
}
Sched_SwapFrameBufferImpl(cfbInfo);
#endif
}
void Sched_HandlePreNMI(Scheduler* sc) {
@ -162,7 +183,12 @@ void Sched_HandlePreNMI(Scheduler* sc) {
void Sched_HandleNMI(Scheduler* sc) {
// black the screen and reset the VI y scale just in time for NMI reset
#if OOT_VERSION < PAL_1_0
osViSetYScale(1.0f);
osViBlack(true);
#else
ViConfig_UpdateVi(true);
#endif
}
/**
@ -424,6 +450,13 @@ void Sched_RunTask(Scheduler* sc, OSScTask* spTask, OSScTask* dpTask) {
// If the task also uses the RDP, set current running RDP task
if (spTask == dpTask && sc->curRDPTask == NULL) {
#if OOT_VERSION < PAL_1_0
// Unknown SCHED_DEBUG_PRINTF calls
if (sSchedDebugPrintfEnabled) {}
if (sSchedDebugPrintfEnabled) {}
if (sSchedDebugPrintfEnabled) {}
#endif
sc->curRDPTask = dpTask;
sRDPTimeStart = sRSPGfxTimeStart;
}
@ -467,7 +500,9 @@ void Sched_HandleNotification(Scheduler* sc) {
void Sched_HandleRetrace(Scheduler* sc) {
SCHED_DEBUG_PRINTF("%08d:scHandleRetrace %08x\n", (u32)OS_CYCLES_TO_USEC(osGetTime()), osViGetCurrentFramebuffer());
#if OOT_VERSION >= PAL_1_0
ViConfig_UpdateBlack();
#endif
sc->retraceCount++;
// Retrace handlers run after VI context swap. The last swap buffer may now be the current buffer.
@ -649,6 +684,12 @@ void Sched_Init(Scheduler* sc, void* stack, OSPri priority, u8 viModeType, UNK_T
// Create message queues for receiving interrupt events and tasks
osCreateMesgQueue(&sc->interruptQueue, sc->interruptMsgBuf, ARRAY_COUNT(sc->interruptMsgBuf));
osCreateMesgQueue(&sc->cmdQueue, sc->cmdMsgBuf, ARRAY_COUNT(sc->cmdMsgBuf));
#if OOT_VERSION < PAL_1_0
osViBlack(true);
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF);
#endif
osSetEventMesg(OS_EVENT_SP, &sc->interruptQueue, (OSMesg)RSP_DONE_MSG);
osSetEventMesg(OS_EVENT_DP, &sc->interruptQueue, (OSMesg)RDP_DONE_MSG);
IrqMgr_AddClient(irqMgr, &sc->irqClient, &sc->interruptQueue);

View file

@ -1,5 +1,5 @@
#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" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
#include "global.h"
#include "terminal.h"

View file

@ -1,6 +1,7 @@
#include "global.h"
#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"
#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"
uintptr_t sSysCfbFbPtr[2];
uintptr_t sSysCfbEnd;

View file

@ -6,7 +6,7 @@
#include "sys_math3d.h"
#pragma increment_block_number "gc-eu:104 gc-eu-mq:104 gc-jp:104 gc-jp-ce:104 gc-jp-mq:104 gc-us:104 gc-us-mq:104" \
"ntsc-1.2:79"
"ntsc-1.2:79 pal-1.0:80 pal-1.1:80"
s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
Vec3f* lineAClosestToB, Vec3f* lineBClosestToA);

View file

@ -19,7 +19,8 @@ MtxF gMtxFClear = {
};
// clang-format on
#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"
#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"
MtxF* sMatrixStack; // "Matrix_stack"
MtxF* sCurrentMatrix; // "Matrix_now"

View file

@ -12,7 +12,7 @@
#include "assets/objects/object_bdoor/object_bdoor.h"
#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" \
"ntsc-1.2:0"
"ntsc-1.2:0 pal-1.0:0 pal-1.1:0"
static CollisionPoly* sCurCeilingPoly;
static s32 sCurCeilingBgId;
@ -2071,7 +2071,8 @@ s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId,
return false;
}
#pragma increment_block_number "gc-eu:22 gc-eu-mq:22 gc-jp:22 gc-jp-ce:22 gc-jp-mq:22 gc-us:22 gc-us-mq:22 ntsc-1.2:22"
#pragma increment_block_number "gc-eu:22 gc-eu-mq:22 gc-jp:22 gc-jp-ce:22 gc-jp-mq:22 gc-us:22 gc-us-mq:22" \
"ntsc-1.2:22 pal-1.0:22 pal-1.1:22"
// Local data used for Farore's Wind light (stored in BSS)
LightInfo D_8015BC00;

View file

@ -5,7 +5,7 @@
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.2:192"
"ntsc-1.2:192 pal-1.0:192 pal-1.1:192"
s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags);
s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange);
@ -3638,7 +3638,7 @@ s32 Camera_KeepOn3(Camera* camera) {
}
#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" \
"ntsc-1.2:100"
"ntsc-1.2:98 pal-1.0:96 pal-1.1:96"
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;

View file

@ -5,7 +5,8 @@
#include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:216"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:208" \
"pal-1.0:208 pal-1.1:208"
typedef s32 (*ColChkResetFunc)(PlayState*, Collider*);
typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*);
@ -2201,7 +2202,7 @@ void CollisionCheck_ATTrisVsACCyl(PlayState* play, CollisionCheckContext* colChk
}
#pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:252 gc-jp-ce:252 gc-jp-mq:252 gc-us:252 gc-us-mq:252" \
"ntsc-1.2:252"
"ntsc-1.2:252 pal-1.0:252 pal-1.1:252"
void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChkCtx, Collider* atCol, Collider* acCol) {
static TriNorm tri1;

View file

@ -3,7 +3,7 @@
#include "versions.h"
#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" \
"ntsc-1.2:192"
"ntsc-1.2:192 pal-1.0:192 pal-1.1:192"
ALIGNED(16) SaveContext gSaveContext;
u32 D_8015FA88;

View file

@ -15,7 +15,7 @@ typedef struct InputCombo {
} InputCombo; // size = 0x4
#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" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
RegEditor* gRegEditor;

View file

@ -125,7 +125,7 @@ u16 gCamEyePointAppliedFrame;
u16 gCamAtPointAppliedFrame;
#pragma increment_block_number "gc-eu:192 gc-eu-mq:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:176 gc-us:192 gc-us-mq:176" \
"ntsc-1.2:80"
"ntsc-1.2:80 pal-1.0:80 pal-1.1:80"
// Cam ID to return to when a scripted cutscene is finished
s16 sReturnToCamId;

View file

@ -3,8 +3,8 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
#pragma increment_block_number \
"gc-eu:0 gc-eu-mq:0 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \
"gc-us-mq:128 ntsc-1.2:128"
#define FLAGS 0

View file

@ -1,4 +1,5 @@
#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0"
#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \
"ntsc-1.2:0"
#include "global.h"
#include "terminal.h"

View file

@ -1,5 +1,5 @@
#pragma increment_block_number "gc-eu:248 gc-eu-mq:248 gc-jp:240 gc-jp-ce:240 gc-jp-mq:240 gc-us:240 gc-us-mq:240" \
"ntsc-1.2:0"
"ntsc-1.2:0 pal-1.0:0 pal-1.1:0"
#include "global.h"
#include "ultra64.h"
@ -214,7 +214,7 @@ s16 sSunDepthTestX;
s16 sSunDepthTestY;
#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \
"ntsc-1.2:216"
"ntsc-1.2:216 pal-1.0:240 pal-1.1:240"
LightNode* sNGameOverLightNode;
LightInfo sNGameOverLightInfo;

View file

@ -4,7 +4,7 @@
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26)
#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" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.1:128"
void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play);

View file

@ -1,5 +1,6 @@
#include "global.h"
#include "terminal.h"
#include "versions.h"
void func_80092320(PreNMIState* this) {
this->state.running = false;
@ -17,7 +18,12 @@ void PreNMI_Update(PreNMIState* this) {
}
if (this->timer == 0) {
#if OOT_VERSION < PAL_1_0
osViSetYScale(1.0f);
osViBlack(true);
#else
ViConfig_UpdateVi(true);
#endif
func_80092320(this);
return;
}

View file

@ -1,6 +1,7 @@
#include "global.h"
#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"
#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"
MtxF gSkinLimbMatrices[60]; // holds matrices for each limb of the skeleton currently being drawn

View file

@ -919,13 +919,13 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
PRINTF(T("SRAM破壊!!!!!!\n", "SRAM destruction!!!!!!\n"));
#if OOT_PAL
#if PLATFORM_GC && OOT_PAL
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
#endif
MemCpy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
#if OOT_PAL
#if PLATFORM_GC && OOT_PAL
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
#endif
Sram_WriteSramHeader(sramCtx);

View file

@ -6,7 +6,7 @@
#include "stack.h"
#include "versions.h"
#pragma increment_block_number "ntsc-1.2:128"
#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
typedef struct struct_801D9C30 {
/* 0x000 */ s32 unk_000; // disk start

View file

@ -101,21 +101,22 @@ static ColliderCylinderInit sLightBallCylinderInit = {
static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 };
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" \
"pal-1.0:0 pal-1.1:0"
static EnGanonMant* sCape;
// TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving
// data around. It would be easier if we had more options for controlling BSS ordering in debug.
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
static s32 sSeed1;
static s32 sSeed2;
static s32 sSeed3;
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
static BossGanon* sGanondorf;

View file

@ -10,7 +10,8 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "terminal.h"
#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"
#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.0:128 pal-1.1:128"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5)

View file

@ -11,7 +11,8 @@
#include "overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
#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"
#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.0:128 pal-1.1:128"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10)

View file

@ -14,7 +14,8 @@
#include "assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.h"
#include "terminal.h"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" \
"pal-1.0:0 pal-1.1:0"
#define FLAGS ACTOR_FLAG_4
@ -1395,7 +1396,8 @@ void func_80B3F3D8(void) {
Sfx_PlaySfxCentered2(NA_SE_PL_SKIP);
}
#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ntsc-1.2:64"
#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" \
"ntsc-1.2:64 pal-1.0:64 pal-1.1:64"
void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) {
static Vec3f D_80B42DA0;

View file

@ -5,18 +5,38 @@
*/
#include "z_fishing.h"
#include "global.h"
#include "overlays/actors/ovl_En_Kanban/z_en_kanban.h"
#include "assets/objects/object_fish/object_fish.h"
#include "libc64/math64.h"
#include "attributes.h"
#include "controller.h"
#include "gfx.h"
#include "gfx_setupdl.h"
#include "ichain.h"
#include "letterbox.h"
#include "rand.h"
#include "regs.h"
#include "rumble.h"
#include "segmented_address.h"
#include "seqcmd.h"
#include "sequence.h"
#include "sfx.h"
#include "sys_math.h"
#include "sys_matrix.h"
#include "terminal.h"
#include "versions.h"
#include "z64audio.h"
#include "z64play.h"
#include "z64player.h"
#include "z64skin_matrix.h"
#include "z_lib.h"
#if PLATFORM_N64
#include "cic6105.h"
#endif
#pragma increment_block_number "gc-eu:121 gc-eu-mq:121 gc-jp:123 gc-jp-ce:123 gc-jp-mq:123 gc-us:123 gc-us-mq:123"
#pragma increment_block_number "gc-eu:199 gc-eu-mq:199 gc-jp:199 gc-jp-ce:199 gc-jp-mq:199 gc-us:199 gc-us-mq:199" \
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
#define FLAGS ACTOR_FLAG_4

View file

@ -357,21 +357,21 @@ void Player_Action_CsAction(Player* this, PlayState* play);
// .bss part 1
#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" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
static s32 D_80858AA0;
// TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving
// data around. It would be easier if we had more options for controlling BSS ordering in debug.
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.2:192"
"ntsc-1.2:192 pal-1.0:192 pal-1.1:192"
static s32 sSavedCurrentMask;
static Vec3f sInteractWallCheckResult;
static Input* sControlInput;
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.2:128"
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
// .data

View file

@ -4,6 +4,7 @@
#include "libc/stddef.h"
#include "ultra64.h"
#include "global.h"
#include "versions.h"
#define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + offsetof(SaveContext, save.info.playerData.newf[index])])
@ -16,7 +17,7 @@
(GET_NEWF(sramCtx, slotNum, 4) == 'A') || \
(GET_NEWF(sramCtx, slotNum, 5) == 'Z'))
// Init mode: Initial setup as the file select is starting up, fades and slides in various menu elements
// Init mode: Loads saves from SRAM, handles initial language selection in PAL N64 versions
// Config mode: Handles the bulk of the file select, various configuration tasks like picking a file, copy/erase, and the options menu
// Select mode: Displays the selected file with various details about it, and allows the player to confirm and open it
typedef enum MenuMode {
@ -144,7 +145,11 @@ typedef enum ActionButtonIndex {
typedef enum SettingIndex {
/* 0 */ FS_SETTING_AUDIO,
/* 1 */ FS_SETTING_TARGET
/* 1 */ FS_SETTING_TARGET,
#if OOT_PAL_N64
/* 2 */ FS_SETTING_LANGUAGE,
#endif
/* */ FS_SETTING_MAX
} SettingIndex;
typedef enum AudioOption {
@ -220,4 +225,8 @@ void FileSelect_DrawOptions(GameState* thisx);
void FileSelect_DrawNameEntry(GameState* thisx);
void FileSelect_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx);
#if OOT_VERSION == PAL_1_1
extern s16 D_808124C0[];
#endif
#endif

View file

@ -1,12 +1,54 @@
#include "file_select.h"
#include "terminal.h"
#include "versions.h"
#if OOT_PAL_N64
#include "assets/objects/object_mag/object_mag.h"
#endif
#include "assets/textures/title_static/title_static.h"
#include "assets/textures/parameter_static/parameter_static.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
#if OOT_PAL_N64
static s32 sInitialLanguageAlphaAsInt = 100;
static f32 sInitialLanguageAlphaStep = 8.0f;
static f32 sInitialLanguageAlpha = 100.0f;
static s16 sInitialLanguageStickAdjX;
static s16 sInitialLanguageStickXDir;
static s16 sInitialLanguageInputTimerX;
typedef struct InitialLanguageTextureInfo {
/* 0x00 */ void* texture;
/* 0x04 */ u16 width;
/* 0x06 */ u16 height;
/* 0x08 */ u32 x1;
/* 0x0C */ u32 y1;
/* 0x10 */ u32 x2;
/* 0x14 */ u32 y2;
} InitialLanguageTextureInfo; // size = 0x18
static InitialLanguageTextureInfo sInitialLanguageTextures[] = {
{ gFileSelInitialLanguageChoiceENGTex, 80, 32, 40, 70, 120, 102 },
{ gFileSelInitialLanguageChoiceGERTex, 80, 32, 120, 70, 200, 102 },
{ gFileSelInitialLanguageChoiceFRATex, 80, 32, 200, 70, 280, 102 },
};
typedef struct InitialLanguageCursorInfo {
/* 0x00 */ u32 x1;
/* 0x04 */ u32 y1;
/* 0x08 */ u32 x2;
/* 0x0C */ u32 y2;
} InitialLanguageCursorInfo; // size = 0x10
static InitialLanguageCursorInfo sInitialLanguageCursors[] = {
{ 48, 52, 120, 124 },
{ 128, 52, 200, 124 },
{ 208, 52, 280, 124 },
};
#endif
static s16 sUnused = 106;
static s16 sScreenFillAlpha = 255;
@ -29,6 +71,233 @@ static s16 sWindowContentColors[2][3] = {
{ 100, 100, 100 }, // gray
};
#if OOT_PAL_N64
void FileSelect_UpdateInitialLanguageMenu(FileSelectState* this) {
SramContext* sramCtx = &this->sramCtx;
Input* input = &this->state.input[0];
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = 0;
}
sInitialLanguageAlpha += sInitialLanguageAlphaStep;
if (sInitialLanguageAlphaStep < 0.0f) {
if (sInitialLanguageAlpha < 100.0f) {
sInitialLanguageAlpha = 100.0f;
sInitialLanguageAlphaStep *= -1.0f;
}
} else if (sInitialLanguageAlphaStep > 0.0f) {
if (sInitialLanguageAlpha > 255.0f) {
sInitialLanguageAlpha = 255.0f;
sInitialLanguageAlphaStep *= -1.0f;
}
}
sInitialLanguageAlphaAsInt = (s32)sInitialLanguageAlpha;
sInitialLanguageStickAdjX = (s16)input->rel.stick_x;
if (sInitialLanguageStickAdjX < -30) {
if (sInitialLanguageStickXDir == -1) {
sInitialLanguageInputTimerX -= 1;
if (sInitialLanguageInputTimerX < 0) {
sInitialLanguageInputTimerX = 2;
} else {
sInitialLanguageStickAdjX = 0;
}
} else {
sInitialLanguageInputTimerX = 10;
sInitialLanguageStickXDir = -1;
}
} else if (sInitialLanguageStickAdjX > 30) {
if (sInitialLanguageStickXDir == 1) {
sInitialLanguageInputTimerX -= 1;
if (sInitialLanguageInputTimerX < 0) {
sInitialLanguageInputTimerX = 2;
} else {
sInitialLanguageStickAdjX = 0;
}
} else {
sInitialLanguageInputTimerX = 10;
sInitialLanguageStickXDir = 1;
}
} else {
sInitialLanguageStickXDir = 0;
}
if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B) ||
CHECK_BTN_ALL(input->press.button, BTN_START)) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sramCtx->readBuff[2] = gSaveContext.language;
Sram_WriteSramHeader(sramCtx);
this->configMode++;
return;
}
if (sInitialLanguageStickAdjX < -30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
gSaveContext.language--;
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = LANGUAGE_MAX - 1;
}
} else if (sInitialLanguageStickAdjX > 30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
gSaveContext.language++;
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = 0;
}
}
}
void FileSelect_DrawImageRGBA32(GraphicsContext* gfxCtx, s16 centerX, s16 centerY, u8* source, u32 width, u32 height) {
u8* curTexture;
s32 textureCount;
s32 rectLeft;
s32 rectTop;
u32 textureHeight;
s32 remainingSize;
s32 textureSize;
s32 pad;
s32 i;
OPEN_DISPS(gfxCtx, "../z_file_choose.c", 0);
Gfx_SetupDL_56Opa(gfxCtx);
curTexture = source;
rectLeft = centerX - (width / 2);
rectTop = centerY - (height / 2);
remainingSize = (width * height) << 2;
textureHeight = 4096 / (width << 2);
textureSize = (width * textureHeight) << 2;
textureCount = remainingSize / textureSize;
if ((remainingSize % textureSize) != 0) {
textureCount++;
}
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
remainingSize -= textureSize;
for (i = 0; i < textureCount; i++) {
gDPSetTextureImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, curTexture);
gDPLoadSync(POLY_OPA_DISP++);
gDPLoadTile(POLY_OPA_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2);
gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2,
(rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
curTexture += textureSize;
rectTop += textureHeight;
if ((remainingSize - textureSize) < 0) {
if (remainingSize > 0) {
textureHeight = remainingSize / (s32)(width << 2);
remainingSize -= textureSize;
gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, width - 1, textureHeight - 1, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
}
} else {
remainingSize -= textureSize;
}
}
CLOSE_DISPS(gfxCtx, "../z_file_choose.c", 0);
}
void FileSelect_DrawInitialLanguageMenu(FileSelectState* this) {
u8* source;
s32 i;
s32 y1;
s32 y2;
OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 70 + WREG(0));
FileSelect_DrawImageRGBA32(this->state.gfxCtx, 160, 85 + WREG(1), (u8*)gTitleZeldaShieldLogoTex, 160, 160);
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetAlphaCompare(POLY_OPA_DISP++, G_AC_NONE);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
gDPLoadTextureBlock(POLY_OPA_DISP++, gTitleCopyright1998Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 128, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, 94 << 2, 198 << 2, 222 << 2, 214 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
1 << 10);
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 100, 255, sInitialLanguageAlphaAsInt);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, gFileSelInitialLanguageCursorTex, G_IM_FMT_I, 48, 48, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, (sInitialLanguageCursors[gSaveContext.language].x1 + GREG(1)) << 2,
(sInitialLanguageCursors[gSaveContext.language].y1 + GREG(2)) << 2,
(sInitialLanguageCursors[gSaveContext.language].x2 + GREG(1)) << 2,
(sInitialLanguageCursors[gSaveContext.language].y2 + GREG(2)) << 2, G_TX_RENDERTILE, 0, 0,
3 << 8, 3 << 8);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_BLENDPEDECALA, G_CC_BLENDPEDECALA);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 50, 255);
for (i = 0; i < LANGUAGE_MAX; i++) {
gDPPipeSync(POLY_OPA_DISP++);
if (i == gSaveContext.language) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 50, 50, 100, 255);
}
gDPLoadTextureBlock(POLY_OPA_DISP++, sInitialLanguageTextures[i].texture, G_IM_FMT_IA, G_IM_SIZ_8b,
sInitialLanguageTextures[i].width, sInitialLanguageTextures[i].height, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, (sInitialLanguageTextures[i].x1 + GREG(1)) << 2,
(sInitialLanguageTextures[i].y1 + GREG(2)) << 2,
(sInitialLanguageTextures[i].x2 + GREG(1)) << 2,
(sInitialLanguageTextures[i].y2 + GREG(2)) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 220, 180, 30, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 60, 20, 0, 255);
source = (u8*)gFileSelSelectYourLanguageTex;
y1 = 120 + GREG(3);
for (i = 0; i < 8; i++, source += 0x500) {
y2 = y1 + 8;
gDPLoadTextureBlock(POLY_OPA_DISP++, source, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 8, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, (80 + GREG(4)) << 2, y1 << 2, (240 + GREG(4)) << 2, y2 << 2,
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
y1 = y2;
}
CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", 0);
}
#endif
void FileSelect_SetView(FileSelectState* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
Vec3f eye;
Vec3f lookAt;
@ -58,18 +327,57 @@ Gfx* FileSelect_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s
void FileSelect_InitModeUpdate(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
SramContext* sramCtx = &this->sramCtx;
#if !OOT_PAL_N64
if (this->menuMode == FS_MENU_MODE_INIT) {
this->menuMode = FS_MENU_MODE_CONFIG;
this->configMode = CM_FADE_IN_START;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
PRINTF(" Start─Load 》》》》》 ");
Sram_VerifyAndLoadAllSaves(this, &this->sramCtx);
Sram_VerifyAndLoadAllSaves(this, sramCtx);
PRINTF("終了!!!\n");
}
#else
if (this->configMode == CM_FADE_IN_START) {
Sram_VerifyAndLoadAllSaves(this, sramCtx);
if (!SLOT_OCCUPIED(sramCtx, 0) && !SLOT_OCCUPIED(sramCtx, 1) && !SLOT_OCCUPIED(sramCtx, 2)) {
this->configMode++; // = CM_FADE_IN_END
} else {
this->menuMode = FS_MENU_MODE_CONFIG;
this->configMode = CM_FADE_IN_START;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
}
}
if (this->configMode == CM_FADE_IN_END) {
sScreenFillAlpha -= 40;
if (sScreenFillAlpha <= 0) {
sScreenFillAlpha = 0;
this->configMode++; // = CM_MAIN_MENU
}
} else if (this->configMode == CM_MAIN_MENU) {
FileSelect_UpdateInitialLanguageMenu(this);
} else {
sScreenFillAlpha += 40;
if (sScreenFillAlpha >= 255) {
sScreenFillAlpha = 255;
this->menuMode = FS_MENU_MODE_CONFIG;
this->configMode = CM_FADE_IN_START;
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
}
}
#endif
}
void FileSelect_InitModeDraw(GameState* thisx) {
#if OOT_PAL_N64
FileSelectState* this = (FileSelectState*)thisx;
Gfx_SetupDL_39Opa(this->state.gfxCtx);
FileSelect_DrawInitialLanguageMenu(this);
#endif
}
/**
@ -530,13 +838,16 @@ static s16 D_80812848[] = { 0x0274, 0x0278 };
void FileSelect_SetWindowContentVtx(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
SramContext* sramCtx = &this->sramCtx;
s16 phi_t2;
s16 phi_t0;
s16 phi_t5;
s16 phi_a1;
s16 phi_ra;
s16 temp_t1;
SramContext* sramCtx = &this->sramCtx;
#if OOT_PAL_N64
u8 fileNameChar;
#endif
this->windowContentVtx = GRAPH_ALLOC(this->state.gfxCtx, 0x288 * sizeof(Vtx));
@ -689,8 +1000,14 @@ void FileSelect_SetWindowContentVtx(GameState* thisx) {
temp_t1 += 2;
for (phi_a1 = 0; phi_a1 < 8; phi_a1++, phi_t2 += 4, phi_t0 += WREG(40)) {
#if OOT_VERSION == PAL_1_1
fileNameChar = this->fileNames[phi_t5][phi_a1];
this->windowContentVtx[phi_t2].v.ob[0] = this->windowContentVtx[phi_t2 + 2].v.ob[0] =
WREG(41) + phi_t0 + 0x40;
phi_t0 + 0x40 + WREG(41) + D_808124C0[fileNameChar];
#else
this->windowContentVtx[phi_t2].v.ob[0] = this->windowContentVtx[phi_t2 + 2].v.ob[0] =
phi_t0 + 0x40 + WREG(41);
#endif
this->windowContentVtx[phi_t2 + 1].v.ob[0] = this->windowContentVtx[phi_t2 + 3].v.ob[0] =
this->windowContentVtx[phi_t2].v.ob[0] + WREG(42);
this->windowContentVtx[phi_t2].v.ob[1] = this->windowContentVtx[phi_t2 + 1].v.ob[1] = temp_t1 - 3;
@ -828,18 +1145,33 @@ static void* sSaveXTextures[] = { gFileSelSaveXJPNTex, gFileSelSaveXENGTex };
#endif
static s16 sNamePrimColors[2][3] = { { 255, 255, 255 }, { 100, 100, 100 } };
#if !OOT_PAL_N64
static void* sHeartTextures[] = { gHeartFullTex, gDefenseHeartFullTex };
#else
static void* sHeartTextures[][5] = {
{ gHeartEmptyTex, gHeartQuarterTex, gHeartHalfTex, gHeartThreeQuarterTex, gHeartFullTex },
{ gDefenseHeartEmptyTex, gDefenseHeartQuarterTex, gDefenseHeartHalfTex, gDefenseHeartThreeQuarterTex,
gDefenseHeartFullTex },
};
static u8 sHeartTextureIndices[16] = { 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
#endif
static s16 sHeartPrimColors[2][3] = { { 255, 70, 50 }, { 200, 0, 0 } };
static s16 sHeartEnvColors[2][3] = { { 50, 40, 60 }, { 255, 255, 255 } };
void FileSelect_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
FileSelectState* this = (FileSelectState*)thisx;
Font* sp54 = &this->font;
s16 heartType;
s16 vtxOffset;
s16 i;
s16 j;
s16 k;
#if OOT_PAL_N64
s16 health;
s16 heartTextureIndex;
#endif
s16 heartType;
s16 vtxOffset;
s16 deathCountSplit[3];
OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", 1709);
@ -889,12 +1221,37 @@ void FileSelect_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
k = this->healthCapacities[fileIndex] / 0x10;
#if !OOT_PAL_N64
// draw hearts
for (vtxOffset = 0, j = 0; j < k; j++, vtxOffset += 4) {
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[D_8081284C[fileIndex] + vtxOffset] + 0x30, 4, 0);
POLY_OPA_DISP = FileSelect_QuadTextureIA8(POLY_OPA_DISP, sHeartTextures[heartType], 0x10, 0x10, 0);
}
#else
health = this->health[fileIndex];
if (health <= 48) { // 3 hearts
health = 48;
}
heartTextureIndex = 4;
// draw hearts
for (vtxOffset = 0, j = 0; j < k; j++, vtxOffset += 4) {
if (health < 16) {
if (health != 0) {
heartTextureIndex = sHeartTextureIndices[health];
health = 0;
} else {
heartTextureIndex = 0;
}
} else {
health -= 16;
}
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[D_8081284C[fileIndex] + vtxOffset] + 0x30, 4, 0);
POLY_OPA_DISP =
FileSelect_QuadTextureIA8(POLY_OPA_DISP, sHeartTextures[heartType][heartTextureIndex], 0x10, 0x10, 0);
}
#endif
gDPPipeSync(POLY_OPA_DISP++);
@ -1675,6 +2032,9 @@ void FileSelect_Main(GameState* thisx) {
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
gSPSegment(POLY_OPA_DISP++, 0x01, this->staticSegment);
gSPSegment(POLY_OPA_DISP++, 0x02, this->parameterSegment);
#if OOT_PAL_N64
gSPSegment(POLY_OPA_DISP++, 0x06, this->objectMagSegment);
#endif
Gfx_SetupFrame(this->state.gfxCtx, 0, 0, 0);
@ -1769,7 +2129,7 @@ void FileSelect_Main(GameState* thisx) {
void FileSelect_InitContext(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
EnvironmentContext* envCtx = &this->envCtx;
#if OOT_PAL
#if PLATFORM_GC && OOT_PAL
SramContext* sramCtx = &this->sramCtx;
#endif
@ -1930,7 +2290,7 @@ void FileSelect_InitContext(GameState* thisx) {
this->n64ddFlags[0] = this->n64ddFlags[1] = this->n64ddFlags[2] = this->defense[0] = this->defense[1] =
this->defense[2] = 0;
#if OOT_PAL
#if PLATFORM_GC && OOT_PAL
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
@ -1946,8 +2306,8 @@ void FileSelect_Destroy(GameState* thisx) {
void FileSelect_Init(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
u32 size = (uintptr_t)_title_staticSegmentRomEnd - (uintptr_t)_title_staticSegmentRomStart;
s32 pad;
u32 size = (uintptr_t)_title_staticSegmentRomEnd - (uintptr_t)_title_staticSegmentRomStart;
#if PLATFORM_N64
if (D_80121212 != 0) {
@ -1955,7 +2315,11 @@ void FileSelect_Init(GameState* thisx) {
}
#endif
#if !OOT_PAL_N64
SREG(30) = 1;
#else
SREG(30) = 2;
#endif
PRINTF("SIZE=%x\n", size);
this->staticSegment = GAME_STATE_ALLOC(&this->state, size, "../z_file_choose.c", 3392);
@ -1968,6 +2332,12 @@ void FileSelect_Init(GameState* thisx) {
DMA_REQUEST_SYNC(this->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, size, "../z_file_choose.c",
3400);
#if OOT_PAL_N64
size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart;
this->objectMagSegment = GAME_STATE_ALLOC(&this->state, size, "../z_file_choose.c", 0);
DMA_REQUEST_SYNC(this->objectMagSegment, gObjectTable[OBJECT_MAG].vromStart, size, "../z_file_choose.c", 0);
#endif
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);
this->state.main = FileSelect_Main;

View file

@ -29,21 +29,25 @@ void FileSelect_DrawCharacterTransition(GraphicsContext* gfxCtx, void* texture1,
#endif
#if OOT_PAL
static s16 D_808124C0[] = {
0x0002, 0x0003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0001, 0x0002, 0x0000, 0x0001,
0x0001, 0x0002, 0x0001, 0x0001, 0x0004, 0x0002, 0x0002, 0x0002, 0x0001, 0x0001, 0x0000, 0x0002, 0x0000, 0x0001,
0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0003,
0x0002, 0x0002, 0x0004, 0x0003, 0x0002, 0x0004, 0x0001, 0x0002, 0x0002, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
0x0002, 0x0002, 0x0000, 0x0002, 0x0002, 0x0002, 0x0000, 0x0003, 0x0001, 0x0000,
#if OOT_VERSION >= PAL_1_1
s16 D_808124C0[] = {
2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 0, 1, 1, 2, 1, 1, 4, 2, 2, 2, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 0,
1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 4, 3, 2, 4, 1, 2, 2, 1, 1, 2, 2, 3, 2, 2, 0, 2, 2, 2, 0, 3, 1, 0,
};
#endif
s16 D_80812544[] = {
#if OOT_VERSION < PAL_1_1
1, 2, 0, 1, 1, 2, 1, 2, 4, 2, 2, 2, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3,
2, 2, 4, 3, 2, 4, 1, 2, 2, 1, 1, 2, 2, 3, 2, 2, 0, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3,
#else
// Differs only at index 7
1, 2, 0, 1, 1, 2, 1, 1, 4, 2, 2, 2, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3,
2, 2, 4, 3, 2, 4, 1, 2, 2, 1, 1, 2, 2, 3, 2, 2, 0, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3,
#endif
};
static s16 D_80812544[] = {
0x0001, 0x0002, 0x0000, 0x0001, 0x0001, 0x0002, 0x0001, 0x0001, 0x0004, 0x0002, 0x0002, 0x0002, 0x0001,
0x0001, 0x0000, 0x0002, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0001, 0x0001, 0x0001,
0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0003, 0x0002, 0x0002, 0x0004, 0x0003, 0x0002, 0x0004, 0x0001,
0x0002, 0x0002, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0002, 0x0002, 0x0000, 0x0002, 0x0002, 0x0002,
0x0003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0001, 0x0003,
};
#endif
void FileSelect_SetKeyboardVtx(GameState* thisx) {
@ -245,10 +249,15 @@ void FileSelect_SetNameEntryVtx(GameState* thisx) {
this->nameEntryVtx[phi_t1].v.ob[0] + 0xA;
#else
if ((phi_s0 > 0) && (phi_s0 < 9)) {
#if OOT_VERSION >= PAL_1_1
temp = this->fileNames[this->buttonIndex][phi_s0 - 1];
this->nameEntryVtx[phi_t1].v.ob[0] = this->nameEntryVtx[phi_t1 + 2].v.ob[0] =
D_808125EC[phi_s0] + this->nameEntryBoxPosX + D_808124C0[temp];
#else
this->nameEntryVtx[phi_t1].v.ob[0] = this->nameEntryVtx[phi_t1 + 2].v.ob[0] =
D_808125EC[phi_s0] + this->nameEntryBoxPosX;
#endif
this->nameEntryVtx[phi_t1 + 1].v.ob[0] = this->nameEntryVtx[phi_t1 + 3].v.ob[0] =
this->nameEntryVtx[phi_t1].v.ob[0] + 0xA;
@ -985,11 +994,12 @@ void FileSelect_StartNameEntry(GameState* thisx) {
void FileSelect_UpdateKeyboardCursor(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
s16 prevKbdX;
#if OOT_NTSC
#if !(PLATFORM_GC && OOT_PAL)
Input* input = &this->state.input[0];
s32 pad;
#endif
#if OOT_NTSC
if (this->charPage <= FS_CHAR_PAGE_ENG) {
if (CHECK_BTN_ALL(input->press.button, BTN_R)) {
if (gSaveContext.language == LANGUAGE_JPN) {
@ -1332,6 +1342,9 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) {
this->configMode = CM_OPTIONS_TO_MAIN;
sramCtx->readBuff[0] = gSaveContext.audioSetting;
sramCtx->readBuff[1] = gSaveContext.zTargetSetting;
#if OOT_PAL_N64
sramCtx->readBuff[2] = gSaveContext.language;
#endif
PRINTF("");
Sram_WriteSramHeader(sramCtx);
PRINTF(VT_FGCOL(YELLOW));
@ -1358,7 +1371,18 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) {
gSaveContext.audioSetting = FS_AUDIO_SURROUND;
}
} else {
#if !OOT_PAL_N64
gSaveContext.zTargetSetting ^= 1;
#else
if (sSelectedSetting == FS_SETTING_TARGET) {
gSaveContext.zTargetSetting ^= 1;
} else {
gSaveContext.language--;
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = LANGUAGE_MAX - 1;
}
}
#endif
}
} else if (this->stickAdjX > 30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
@ -1371,10 +1395,22 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) {
gSaveContext.audioSetting = FS_AUDIO_STEREO;
}
} else {
#if !OOT_PAL_N64
gSaveContext.zTargetSetting ^= 1;
#else
if (sSelectedSetting == FS_SETTING_TARGET) {
gSaveContext.zTargetSetting ^= 1;
} else {
gSaveContext.language++;
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = 0;
}
}
#endif
}
}
#if !OOT_PAL_N64
if ((this->stickAdjY < -30) || (this->stickAdjY > 30)) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -1384,19 +1420,108 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sSelectedSetting ^= 1;
}
#else
if (this->stickAdjY < -30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sSelectedSetting++;
if (sSelectedSetting >= FS_SETTING_MAX) {
sSelectedSetting = 0;
}
} else if (this->stickAdjY > 30) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sSelectedSetting--;
if (sSelectedSetting >= FS_SETTING_MAX) {
sSelectedSetting = FS_SETTING_MAX - 1;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sSelectedSetting++;
if (sSelectedSetting >= FS_SETTING_MAX) {
sSelectedSetting = 0;
}
}
#endif
}
#if OOT_NTSC
typedef struct OptionsMenuTextureInfo {
/* 0x00 */ void* texture[2];
/* 0x08 */ u16 width;
/* 0x0A */ u16 height;
} OptionsMenuTextureInfo; // size = 0x0C
#define OPTIONS_MENU_TEXTURE_WIDTHS(jpn, eng, ger, fra) jpn
#define OPTIONS_MENU_TEXTURE_WIDTH(info) info.width
#define OPTIONS_MENU_TEXTURE_HEIGHT(info) info.height
static OptionsMenuTextureInfo sOptionsMenuHeaders[] = {
{ { gFileSelOptionsJPNTex, gFileSelOptionsENGTex }, 128, 16 },
{ { gFileSelSOUNDENGTex, gFileSelSOUNDENGTex }, 64, 16 },
{ { gFileSelZTargetingJPNTex, gFileSelZTargetingENGTex }, 64, 16 },
{ { gFileSelCheckBrightnessJPNTex, gFileSelCheckBrightnessENGTex }, 96, 16 },
};
static OptionsMenuTextureInfo sOptionsMenuSettings[] = {
{ { gFileSelStereoJPNTex, gFileSelStereoENGTex }, 48, 16 },
{ { gFileSelMonoJPNTex, gFileSelMonoENGTex }, 48, 16 },
{ { gFileSelHeadsetJPNTex, gFileSelHeadsetENGTex }, 48, 16 },
{ { gFileSelSurroundJPNTex, gFileSelSurroundENGTex }, 48, 16 },
{ { gFileSelSwitchJPNTex, gFileSelSwitchENGTex }, 48, 16 },
{ { gFileSelHoldJPNTex, gFileSelHoldENGTex }, 48, 16 },
};
#elif OOT_PAL_N64
static u16 sZTargetSettingWidths[2][3] = {
{ 48, 80, 48 },
{ 48, 80, 48 },
};
typedef struct LanguageChoiceTextureInfo {
/* 0x00 */ void* texture;
/* 0x04 */ u16 width;
/* 0x06 */ u16 height;
} LanguageChoiceTextureInfo; // size = 0x10
static LanguageChoiceTextureInfo sLanguageChoices[] = {
{ gFileSelLanguageChoiceENGTex, 48, 16 },
{ gFileSelLanguageChoiceGERTex, 48, 16 },
{ gFileSelLanguageChoiceFRATex, 48, 16 },
};
typedef struct OptionsMenuTextureInfo {
/* 0x00 */ void* texture[3];
/* 0x0C */ u16 width;
/* 0x0E */ u16 height;
} OptionsMenuTextureInfo; // size = 0x10
#define OPTIONS_MENU_TEXTURE_WIDTH(info) info.width
#define OPTIONS_MENU_TEXTURE_HEIGHT(info) info.height
static OptionsMenuTextureInfo sOptionsMenuHeaders[] = {
{ { gFileSelOptionsENGTex, gFileSelOptionsGERTex, gFileSelOptionsENGTex }, 128, 16 },
{ { gFileSelSOUNDENGTex, gFileSelSOUNDENGTex, gFileSelSOUNDFRATex }, 64, 16 },
{ { gFileSelZTargetingENGTex, gFileSelZTargetingGERTex, gFileSelZTargetingFRATex }, 64, 16 },
{ { gFileSelCheckBrightnessENGTex, gFileSelCheckBrightnessGERTex, gFileSelCheckBrightnessFRATex }, 128, 16 },
{ { gFileSelLanguageENGTex, gFileSelLanguageGERTex, gFileSelLanguageFRATex }, 64, 16 },
};
static OptionsMenuTextureInfo sOptionsMenuSettings[] = {
{ { gFileSelStereoENGTex, gFileSelStereoENGTex, gFileSelStereoFRATex }, 48, 16 },
{ { gFileSelMonoENGTex, gFileSelMonoENGTex, gFileSelMonoENGTex }, 48, 16 },
{ { gFileSelHeadsetENGTex, gFileSelHeadsetGERTex, gFileSelHeadsetFRATex }, 48, 16 },
{ { gFileSelSurroundENGTex, gFileSelSurroundENGTex, gFileSelSurroundENGTex }, 48, 16 },
{ { gFileSelSwitchENGTex, gFileSelSwitchGERTex, gFileSelSwitchFRATex }, 48, 16 },
{ { gFileSelHoldENGTex, gFileSelHoldGERTex, gFileSelHoldFRATex }, 48, 16 },
{ { gFileSelSwitchENGTex, gFileSelSwitchGERTex, gFileSelSwitchFRATex }, 48, 16 },
{ { gFileSelHoldENGTex, gFileSelHoldGERTex, gFileSelHoldFRATex }, 48, 16 },
};
#else
typedef struct OptionsMenuTextureInfo {
/* 0x00 */ void* texture[3];
/* 0x0C */ u16 width[3];
@ -1407,66 +1532,27 @@ typedef struct OptionsMenuTextureInfo {
{ eng, ger, fra }
#define OPTIONS_MENU_TEXTURE_WIDTH(info) info.width[gSaveContext.language]
#define OPTIONS_MENU_TEXTURE_HEIGHT(info) info.height
#endif
static OptionsMenuTextureInfo sOptionsMenuHeaders[] = {
{
LANGUAGE_ARRAY(gFileSelOptionsJPNTex, gFileSelOptionsENGTex, gFileSelOptionsGERTex, gFileSelOptionsENGTex),
OPTIONS_MENU_TEXTURE_WIDTHS(128, 128, 128, 128),
16,
},
{
LANGUAGE_ARRAY(gFileSelSOUNDENGTex, gFileSelSOUNDENGTex, gFileSelSOUNDENGTex, gFileSelSOUNDFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(64, 64, 64, 64),
16,
},
{
LANGUAGE_ARRAY(gFileSelZTargetingJPNTex, gFileSelZTargetingENGTex, gFileSelZTargetingGERTex,
gFileSelZTargetingFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(64, 64, 144, 64),
16,
},
{
LANGUAGE_ARRAY(gFileSelCheckBrightnessJPNTex, gFileSelCheckBrightnessENGTex, gFileSelCheckBrightnessGERTex,
gFileSelCheckBrightnessFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(96, 128, 128, 128),
16,
},
{ { gFileSelOptionsENGTex, gFileSelOptionsGERTex, gFileSelOptionsENGTex }, { 128, 128, 128 }, 16 },
{ { gFileSelSOUNDENGTex, gFileSelSOUNDENGTex, gFileSelSOUNDFRATex }, { 64, 64, 64 }, 16 },
{ { gFileSelZTargetingENGTex, gFileSelZTargetingGERTex, gFileSelZTargetingFRATex }, { 64, 144, 64 }, 16 },
{ { gFileSelCheckBrightnessENGTex, gFileSelCheckBrightnessGERTex, gFileSelCheckBrightnessFRATex },
{ 128, 128, 128 },
16 },
};
static OptionsMenuTextureInfo sOptionsMenuSettings[] = {
{
LANGUAGE_ARRAY(gFileSelStereoJPNTex, gFileSelStereoENGTex, gFileSelStereoENGTex, gFileSelStereoFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(48, 48, 48, 48),
16,
},
{
LANGUAGE_ARRAY(gFileSelMonoJPNTex, gFileSelMonoENGTex, gFileSelMonoENGTex, gFileSelMonoENGTex),
OPTIONS_MENU_TEXTURE_WIDTHS(48, 48, 48, 48),
16,
},
{
LANGUAGE_ARRAY(gFileSelHeadsetJPNTex, gFileSelHeadsetENGTex, gFileSelHeadsetGERTex, gFileSelHeadsetFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(48, 48, 48, 48),
16,
},
{
LANGUAGE_ARRAY(gFileSelSurroundJPNTex, gFileSelSurroundENGTex, gFileSelSurroundENGTex, gFileSelSurroundENGTex),
OPTIONS_MENU_TEXTURE_WIDTHS(48, 48, 48, 48),
16,
},
{
LANGUAGE_ARRAY(gFileSelSwitchJPNTex, gFileSelSwitchENGTex, gFileSelSwitchGERTex, gFileSelSwitchFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(48, 48, 80, 48),
16,
},
{
LANGUAGE_ARRAY(gFileSelHoldJPNTex, gFileSelHoldENGTex, gFileSelHoldGERTex, gFileSelHoldFRATex),
OPTIONS_MENU_TEXTURE_WIDTHS(48, 48, 80, 48),
16,
},
{ { gFileSelStereoENGTex, gFileSelStereoENGTex, gFileSelStereoFRATex }, { 48, 48, 48 }, 16 },
{ { gFileSelMonoENGTex, gFileSelMonoENGTex, gFileSelMonoENGTex }, { 48, 48, 48 }, 16 },
{ { gFileSelHeadsetENGTex, gFileSelHeadsetGERTex, gFileSelHeadsetFRATex }, { 48, 48, 48 }, 16 },
{ { gFileSelSurroundENGTex, gFileSelSurroundENGTex, gFileSelSurroundENGTex }, { 48, 48, 48 }, 16 },
{ { gFileSelSwitchENGTex, gFileSelSwitchGERTex, gFileSelSwitchFRATex }, { 48, 80, 48 }, 16 },
{ { gFileSelHoldENGTex, gFileSelHoldGERTex, gFileSelHoldFRATex }, { 48, 80, 48 }, 16 },
};
#endif
void FileSelect_DrawOptionsImpl(GameState* thisx) {
static s16 cursorPrimRed = 255;
static s16 cursorPrimGreen = 255;
@ -1488,9 +1574,17 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
s16 cursorRed;
s16 cursorGreen;
s16 cursorBlue;
#if !OOT_PAL_N64
s16 i;
s16 j;
s16 vtx;
#else
s16 startIndex;
s32 endIndex;
s32 i;
s32 vtx;
s32 pad;
#endif
OPEN_DISPS(this->state.gfxCtx, "../z_file_nameset_PAL.c", 848);
@ -1557,7 +1651,7 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
#if OOT_NTSC
gSPVertex(POLY_OPA_DISP++, gOptionsMenuHeadersVtx, 32, 0);
#elif OOT_PAL_N64
// TODO: implement PAL N64 version
gSPVertex(POLY_OPA_DISP++, gOptionsMenuHeadersVtx, 24, 0);
#else
if (gSaveContext.language == LANGUAGE_GER) {
gSPVertex(POLY_OPA_DISP++, gOptionsMenuHeadersGERVtx, 32, 0);
@ -1572,6 +1666,7 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
#if !OOT_PAL_N64
for (i = 0, vtx = 0; i < 4; i++, vtx += 4) {
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA,
G_IM_SIZ_8b, OPTIONS_MENU_TEXTURE_WIDTH(sOptionsMenuHeaders[i]),
@ -1579,11 +1674,28 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
#else
for (i = 0, vtx = 0; i < 5; i++, vtx += 4) {
if (i == 2 && gSaveContext.language == LANGUAGE_GER) {
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA,
G_IM_SIZ_8b, 144, OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx + 12, vtx + 14, vtx + 15, vtx + 13, 0);
} else {
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA,
G_IM_SIZ_8b, OPTIONS_MENU_TEXTURE_WIDTH(sOptionsMenuHeaders[i]),
OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
}
#endif
#if OOT_NTSC
gSPVertex(POLY_OPA_DISP++, gOptionsMenuSettingsVtx, 32, 0);
#elif OOT_PAL_N64
// TODO: implement PAL N64 version
gSPVertex(POLY_OPA_DISP++, gOptionsMenuSettingsVtx, 32, 0);
#else
if (gSaveContext.language == LANGUAGE_GER) {
gSPVertex(POLY_OPA_DISP++, gOptionsMenuSettingsGERVtx, 32, 0);
@ -1617,6 +1729,7 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
#if !OOT_PAL_N64
for (; i < 6; i++, vtx += 4) {
gDPPipeSync(POLY_OPA_DISP++);
@ -1643,6 +1756,46 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
#else
if (gSaveContext.language == LANGUAGE_GER) {
endIndex = 8;
startIndex = 6;
i += 2;
vtx += 8;
} else {
endIndex = 6;
startIndex = 4;
}
for (; i < endIndex; i++, vtx += 4) {
s32 j = i - startIndex;
gDPPipeSync(POLY_OPA_DISP++);
if (j == gSaveContext.zTargetSetting) {
if (sSelectedSetting == FS_SETTING_TARGET) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, cursorPrimRed, cursorPrimGreen, cursorPrimBlue,
this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, cursorEnvRed, cursorEnvGreen, cursorEnvBlue, 0xFF);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 120, 120, 120, this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
G_IM_SIZ_8b, sZTargetSettingWidths[j][gSaveContext.language],
OPTIONS_MENU_TEXTURE_HEIGHT(sOptionsMenuHeaders[i]), 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
gSPVertex(POLY_OPA_DISP++, gOptionsMenuBrightnessVtx, 8, 0);
vtx = 0;
#endif
gDPPipeSync(POLY_OPA_DISP++);
@ -1663,6 +1816,33 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
vtx += 4;
#if OOT_PAL_N64
gSPVertex(POLY_OPA_DISP++, gOptionsMenuLanguageVtx, 12, 0);
for (i = 0, vtx = 0; i != LANGUAGE_MAX; i++, vtx += 4) {
gDPPipeSync(POLY_OPA_DISP++);
if (i == gSaveContext.language) {
if (sSelectedSetting == FS_SETTING_LANGUAGE) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, cursorPrimRed, cursorPrimGreen, cursorPrimBlue,
this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, cursorEnvRed, cursorEnvGreen, cursorEnvBlue, 0xFF);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 120, 120, 120, this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
gDPLoadTextureBlock(POLY_OPA_DISP++, sLanguageChoices[i].texture, G_IM_FMT_IA, G_IM_SIZ_8b,
sLanguageChoices[i].width, sLanguageChoices[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
#endif
// blue divider lines
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 255, 255, this->titleAlpha[0]);
@ -1694,6 +1874,15 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
Matrix_Pop();
#if OOT_PAL_N64
Matrix_Push();
Matrix_Translate(0.0f, 0.8f, 0.0f, MTXMODE_APPLY);
MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, this->state.gfxCtx, "../z_file_nameset_PAL.c", 0);
gSPVertex(POLY_OPA_DISP++, gOptionsDividerLanguageVtx, 4, 0);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
Matrix_Pop();
#endif
CLOSE_DISPS(this->state.gfxCtx, "../z_file_nameset_PAL.c", 1040);
}

View file

@ -650,6 +650,12 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
gDPPipeSync(POLY_OPA_DISP++);
#if PLATFORM_N64 && OOT_VERSION != NTSC_1_2
if (0) {
s32 pad[3];
}
#endif
#if OOT_DEBUG
if (HREG(15) == 0) {
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT);
@ -743,12 +749,6 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
#endif
#if PLATFORM_N64 && OOT_VERSION != NTSC_1_2
if (0) {
s32 pad[3];
}
#endif
if (ZREG(38) == 0) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);

View file

@ -16,7 +16,7 @@
#include "terminal.h"
#include "versions.h"
#pragma increment_block_number "ntsc-1.2:128"
#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
#if !PLATFORM_GC
#define KALEIDO_PROMPT_CURSOR_R 100
@ -2999,7 +2999,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->itemVtx = GRAPH_ALLOC(gfxCtx, (ITEM_QUAD_MAX * 4) * sizeof(Vtx));
// ITEM_QUAD_GRID_FIRST..ITEM_QUAD_GRID_LAST
// ITEM_QUAD_GRID_FIRST to ITEM_QUAD_GRID_LAST
for (k = 0, i = 0, y = (ITEM_GRID_ROWS * ITEM_GRID_CELL_HEIGHT) / 2 - 6; k < ITEM_GRID_ROWS;
k++, y -= ITEM_GRID_CELL_HEIGHT) {
@ -3111,7 +3111,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->itemVtx[i + 2].v.ob[1] = pauseCtx->itemVtx[i + 3].v.ob[1] =
pauseCtx->itemVtx[i + 0].v.ob[1] - ITEM_AMMO_DIGIT_QUAD_HEIGHT;
// units
// ones
pauseCtx->itemVtx[i + 4].v.ob[0] = pauseCtx->itemVtx[i + 6].v.ob[0] =
pauseCtx->itemVtx[i + 0].v.ob[0] + ITEM_AMMO_ONES_QUAD_OFFSET_X;
@ -3125,7 +3125,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->itemVtx[i + 6].v.ob[1] = pauseCtx->itemVtx[i + 7].v.ob[1] =
pauseCtx->itemVtx[i + 4].v.ob[1] - ITEM_AMMO_DIGIT_QUAD_HEIGHT;
// tens, units
// tens, ones
for (k = 0; k < 2; k++, i += 4) {
pauseCtx->itemVtx[i + 0].v.ob[2] = pauseCtx->itemVtx[i + 1].v.ob[2] = pauseCtx->itemVtx[i + 2].v.ob[2] =

View file

@ -187,7 +187,7 @@ typedef enum PromptQuad {
#define ITEM_AMMO_ONES_QUAD_OFFSET_Y 0
typedef enum ItemQuad {
// 0..23 are the ITEM_GRID_ROWS*ITEM_GRID_COLS item grid
// 0 to 23 are the ITEM_GRID_ROWS*ITEM_GRID_COLS item grid
// The values follow the `InventorySlot` enum
/* 0 */ ITEM_QUAD_GRID_FIRST,
/* 23 */ ITEM_QUAD_GRID_LAST = ITEM_GRID_ROWS * ITEM_GRID_COLS - 1,

View file

@ -611,7 +611,7 @@ def format_pragma(amounts: dict[str, int], max_line_length: int) -> list[str]:
first = True
for version, amount in sorted(amounts.items()):
part = f"{version}:{amount}"
if len(current_line) + len(part) + len('" \\') > max_line_length:
if len(current_line) + len(" ") + len(part) + len('" \\') > max_line_length:
lines.append(current_line + '" ')
current_line = " " * len(pragma_start) + '"'
first = True