mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-09 13:45:23 -04:00
z64game.h (#1250)
* z64game.h * grrrrr * fix missing stuff * Update include/z64game.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update include/z64game.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * review * global.h to the top * reiew * fix --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
@@ -1874,25 +1874,6 @@ void AudioMgr_ThreadEntry(void* arg);
|
||||
void AudioMgr_Unlock(AudioMgr* audioMgr);
|
||||
void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr);
|
||||
|
||||
void Game_UpdateFramerateVariables(s32 divisor);
|
||||
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor);
|
||||
void GameState_SetFBFilter(Gfx** gfx, void* zbuffer);
|
||||
void Game_Nop80173534(GameState* gameState);
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx);
|
||||
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx);
|
||||
void func_801736DC(GraphicsContext* gfxCtx);
|
||||
void Game_UpdateInput(GameState* gameState);
|
||||
void Game_Update(GameState* gameState);
|
||||
void Game_IncrementFrameCount(GameState* gameState);
|
||||
void GameState_InitArena(GameState* gameState, size_t size);
|
||||
void GameState_Realloc(GameState* gameState, size_t size);
|
||||
void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx);
|
||||
void GameState_Destroy(GameState* gameState);
|
||||
GameStateFunc GameState_GetInit(GameState* gameState);
|
||||
size_t GameState_GetSize(GameState* gameState);
|
||||
u32 GameState_IsRunning(GameState* gameState);
|
||||
s32 GameState_GetArenaSize(GameState* gameState);
|
||||
s32 func_80173B48(GameState* gameState);
|
||||
void GameAlloc_Log(GameAlloc* this);
|
||||
void* GameAlloc_Malloc(GameAlloc* this, size_t size);
|
||||
void GameAlloc_Free(GameAlloc* this, void* data);
|
||||
|
||||
@@ -28,21 +28,6 @@
|
||||
|
||||
#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId])
|
||||
|
||||
#define STOP_GAMESTATE(curState) \
|
||||
do { \
|
||||
GameState* state = curState; \
|
||||
\
|
||||
state->running = false; \
|
||||
} while(0)
|
||||
|
||||
#define SET_NEXT_GAMESTATE(curState, nextInit, nextSize) \
|
||||
do { \
|
||||
GameState* state = curState; \
|
||||
\
|
||||
(state)->init = nextInit; \
|
||||
(state)->size = nextSize; \
|
||||
} while (0)
|
||||
|
||||
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].first)
|
||||
|
||||
#define GET_FIRST_ENEMY(play) ((Actor*)(play)->actorCtx.actorLists[ACTORCAT_ENEMY].first)
|
||||
|
||||
+1
-4
@@ -745,10 +745,7 @@ extern Input* D_801D0D60;
|
||||
// extern UNK_TYPE2 D_801D14E4;
|
||||
// extern UNK_TYPE2 D_801D14E8;
|
||||
// extern UNK_TYPE4 D_801D14F0;
|
||||
extern s32 gFramerateDivisor;
|
||||
extern f32 gFramerateDivisorF;
|
||||
extern f32 gFramerateDivisorHalf;
|
||||
extern f32 gFramerateDivisorThird;
|
||||
|
||||
extern u32 retryCount;
|
||||
extern u32 cfbIdx[3];
|
||||
extern s32 gScreenWidth;
|
||||
|
||||
+1
-48
@@ -44,6 +44,7 @@
|
||||
#include "z64effect.h"
|
||||
#include "z64frameadvance.h"
|
||||
#include "z64game_over.h"
|
||||
#include "z64game.h"
|
||||
#include "z64interface.h"
|
||||
#include "z64item.h"
|
||||
#include "z64light.h"
|
||||
@@ -407,54 +408,6 @@ typedef struct {
|
||||
/* 0x844 */ void* fb;
|
||||
} FaultThreadStruct; // size = 0x848
|
||||
|
||||
struct GameState;
|
||||
|
||||
typedef void (*GameStateFunc)(struct GameState* gameState);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* loadedRamAddr;
|
||||
/* 0x04 */ uintptr_t vromStart; // if applicable
|
||||
/* 0x08 */ uintptr_t vromEnd; // if applicable
|
||||
/* 0x0C */ void* vramStart; // if applicable
|
||||
/* 0x10 */ void* vramEnd; // if applicable
|
||||
/* 0x14 */ UNK_PTR unk_14;
|
||||
/* 0x18 */ GameStateFunc init; // initializes and executes the given context
|
||||
/* 0x1C */ GameStateFunc destroy; // deconstructs the context, and sets the next context to load
|
||||
/* 0x20 */ UNK_PTR unk_20;
|
||||
/* 0x24 */ UNK_PTR unk_24;
|
||||
/* 0x28 */ UNK_TYPE unk_28;
|
||||
/* 0x2C */ size_t instanceSize;
|
||||
} GameStateOverlay; // size = 0x30
|
||||
|
||||
typedef struct GameAllocEntry {
|
||||
/* 0x0 */ struct GameAllocEntry* next;
|
||||
/* 0x4 */ struct GameAllocEntry* prev;
|
||||
/* 0x8 */ size_t size;
|
||||
/* 0xC */ u32 unk_0C;
|
||||
} GameAllocEntry; // size = 0x10
|
||||
|
||||
typedef struct GameAlloc {
|
||||
/* 0x00 */ GameAllocEntry base;
|
||||
/* 0x10 */ GameAllocEntry* head;
|
||||
} GameAlloc; // size = 0x14
|
||||
|
||||
typedef struct GameState {
|
||||
/* 0x00 */ GraphicsContext* gfxCtx;
|
||||
/* 0x04 */ GameStateFunc main;
|
||||
/* 0x08 */ GameStateFunc destroy;
|
||||
/* 0x0C */ GameStateFunc init; // Usually the current game state's init, though after stopping, the graph thread will look here to determine the next game state to load.
|
||||
/* 0x10 */ size_t size;
|
||||
/* 0x14 */ Input input[MAXCONTROLLERS];
|
||||
/* 0x74 */ TwoHeadArena heap;
|
||||
/* 0x84 */ GameAlloc alloc;
|
||||
/* 0x98 */ UNK_TYPE1 pad98[0x3];
|
||||
/* 0x9B */ u8 running; // If 0, switch to next game state
|
||||
/* 0x9C */ u32 frames;
|
||||
/* 0xA0 */ u8 padA0[0x2];
|
||||
/* 0xA2 */ u8 framerateDivisor; // game speed?
|
||||
/* 0xA3 */ u8 unk_A3;
|
||||
} GameState; // size = 0xA4
|
||||
|
||||
struct PlayState;
|
||||
|
||||
typedef s32 (*ColChkResetFunc)(struct PlayState*, Collider*);
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
#ifndef Z64_GAME_H
|
||||
#define Z64_GAME_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "libc/stdbool.h"
|
||||
#include "libc/stdint.h"
|
||||
#include "io/controller.h"
|
||||
#include "tha.h"
|
||||
#include "padmgr.h"
|
||||
|
||||
struct GraphicsContext;
|
||||
struct GameState;
|
||||
|
||||
|
||||
typedef void (*GameStateFunc)(struct GameState* gameState);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* loadedRamAddr;
|
||||
/* 0x04 */ uintptr_t vromStart; // if applicable
|
||||
/* 0x08 */ uintptr_t vromEnd; // if applicable
|
||||
/* 0x0C */ void* vramStart; // if applicable
|
||||
/* 0x10 */ void* vramEnd; // if applicable
|
||||
/* 0x14 */ UNK_PTR unk_14;
|
||||
/* 0x18 */ GameStateFunc init; // initializes and executes the given context
|
||||
/* 0x1C */ GameStateFunc destroy; // deconstructs the context, and sets the next context to load
|
||||
/* 0x20 */ UNK_PTR unk_20;
|
||||
/* 0x24 */ UNK_PTR unk_24;
|
||||
/* 0x28 */ UNK_TYPE unk_28;
|
||||
/* 0x2C */ size_t instanceSize;
|
||||
} GameStateOverlay; // size = 0x30
|
||||
|
||||
typedef struct GameAllocEntry {
|
||||
/* 0x0 */ struct GameAllocEntry* next;
|
||||
/* 0x4 */ struct GameAllocEntry* prev;
|
||||
/* 0x8 */ size_t size;
|
||||
/* 0xC */ u32 unk_0C;
|
||||
} GameAllocEntry; // size = 0x10
|
||||
|
||||
typedef struct GameAlloc {
|
||||
/* 0x00 */ GameAllocEntry base;
|
||||
/* 0x10 */ GameAllocEntry* head;
|
||||
} GameAlloc; // size = 0x14
|
||||
|
||||
typedef struct GameState {
|
||||
/* 0x00 */ struct GraphicsContext* gfxCtx;
|
||||
/* 0x04 */ GameStateFunc main;
|
||||
/* 0x08 */ GameStateFunc destroy;
|
||||
/* 0x0C */ GameStateFunc init; // Usually the current game state's init, though after stopping, the graph thread will look here to determine the next game state to load.
|
||||
/* 0x10 */ size_t size;
|
||||
/* 0x14 */ Input input[MAXCONTROLLERS];
|
||||
/* 0x74 */ TwoHeadArena heap;
|
||||
/* 0x84 */ GameAlloc alloc;
|
||||
/* 0x98 */ UNK_TYPE1 pad98[0x3];
|
||||
/* 0x9B */ u8 running; // If 0, switch to next game state
|
||||
/* 0x9C */ u32 frames;
|
||||
/* 0xA0 */ u8 padA0[0x2];
|
||||
/* 0xA2 */ u8 framerateDivisor;
|
||||
/* 0xA3 */ u8 unk_A3;
|
||||
} GameState; // size = 0xA4
|
||||
|
||||
|
||||
void Game_UpdateFramerateVariables(s32 divisor);
|
||||
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor);
|
||||
void GameState_SetFBFilter(Gfx** gfx, void* zbuffer);
|
||||
void Game_Nop80173534(GameState* gameState);
|
||||
void GameState_Draw(GameState* gameState, struct GraphicsContext* gfxCtx);
|
||||
void GameState_SetFrameBuffer(struct GraphicsContext* gfxCtx);
|
||||
void func_801736DC(struct GraphicsContext* gfxCtx);
|
||||
void Game_UpdateInput(GameState* gameState);
|
||||
void Game_Update(GameState* gameState);
|
||||
void Game_IncrementFrameCount(GameState* gameState);
|
||||
void GameState_InitArena(GameState* gameState, size_t size);
|
||||
void GameState_Realloc(GameState* gameState, size_t size);
|
||||
void GameState_Init(GameState* gameState, GameStateFunc init, struct GraphicsContext* gfxCtx);
|
||||
void GameState_Destroy(GameState* gameState);
|
||||
GameStateFunc GameState_GetInit(GameState* gameState);
|
||||
size_t GameState_GetSize(GameState* gameState);
|
||||
u32 GameState_IsRunning(GameState* gameState);
|
||||
s32 GameState_GetArenaSize(GameState* gameState);
|
||||
s32 func_80173B48(GameState* gameState);
|
||||
|
||||
extern s32 gFramerateDivisor;
|
||||
extern f32 gFramerateDivisorF;
|
||||
extern f32 gFramerateDivisorHalf;
|
||||
extern f32 gFramerateDivisorThird;
|
||||
|
||||
|
||||
#define STOP_GAMESTATE(curState) \
|
||||
do { \
|
||||
GameState* state = curState; \
|
||||
\
|
||||
state->running = false; \
|
||||
} while(0)
|
||||
|
||||
#define SET_NEXT_GAMESTATE(curState, nextInit, nextSize) \
|
||||
do { \
|
||||
GameState* state = curState; \
|
||||
\
|
||||
(state)->init = nextInit; \
|
||||
(state)->size = nextSize; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#endif
|
||||
+5
-5
@@ -1,15 +1,15 @@
|
||||
#ifndef Z64PRENMI_H
|
||||
#define Z64PRENMI_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void PreNMI_Destroy(GameState* thisx);
|
||||
void PreNMI_Init(GameState* thisx);
|
||||
#include "z64game.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ GameState state;
|
||||
/* 0xA4 */ u32 timer;
|
||||
/* 0xA8 */ UNK_TYPE4 unkA8;
|
||||
/* 0xA8 */ s32 unk_A8;
|
||||
} PreNMIState; // size = 0xAC
|
||||
|
||||
void PreNMI_Destroy(GameState* thisx);
|
||||
void PreNMI_Init(GameState* thisx);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef Z64TITLE_SETUP_H
|
||||
#define Z64TITLE_SETUP_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void Setup_Destroy(GameState* gameState);
|
||||
void Setup_Init(GameState* thisx);
|
||||
#include "z64game.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ GameState state;
|
||||
} SetupState; // size = 0xA4
|
||||
|
||||
void Setup_Destroy(GameState* gameState);
|
||||
void Setup_Init(GameState* thisx);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user