mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Merge pull request #13 from Cuyler36/graph
Implement GRAPH Engine Struct
This commit is contained in:
@@ -2,4 +2,5 @@ trim_ctors: true
|
||||
trim_dtors: true
|
||||
symbol_aligns:
|
||||
0x8064d500 : 0x20
|
||||
0x8125a7c0 : 0x20
|
||||
0x8125a7c0 : 0x20 # construct_skip
|
||||
0x81361820 : 0x20 # S_back_title_timer
|
||||
+10
-15
@@ -13,25 +13,20 @@ TwoHeadArena.c:
|
||||
.text: [0x80404B40, 0x80404C68]
|
||||
gfxalloc.c:
|
||||
.text: [0x804054b0, 0x80405518]
|
||||
#zurumode/zerucheck_init.c:
|
||||
# .text: [0x8040eb38, 0x8040EB50]
|
||||
#zurumode/zerucheck_key_check.c:
|
||||
# .text: [0x8040EB50, 0x8040EDA8]
|
||||
#zurumode/zurumode_cleanup.c:
|
||||
# .text: [0x8040efc4, 0x8040f008]
|
||||
# zurumode/zurumode_init.c:
|
||||
# .text: [0x8040ef58, 0x8040efc4]
|
||||
# .bss: [0x812f9670, 0x812f9680]
|
||||
#zurumode/zurumode_update.c:
|
||||
#.text: [0x8040EDA8, 0x8040ee74]
|
||||
# zurumode/zurumode.c:
|
||||
# .text: [0x8040eb38, 0x8040f008]
|
||||
# .bss: [0x812f9670, 0x812f9680]
|
||||
# .data: [0x8065F9F0, 0x8065FA20]
|
||||
graph.c:
|
||||
.text: [0x80405518, 0x80405EC8]
|
||||
.data: [0x8065ECA8, 0x8065ECB0]
|
||||
.bss: [0x812F31E8, 0x812F3560]
|
||||
zurumode.c:
|
||||
.text: [0x8040eb38, 0x8040f008]
|
||||
.bss: [0x812f9670, 0x812f9680]
|
||||
.data: [0x8065F9F0, 0x8065FA30]
|
||||
m_random_field/mRF_MakePerfectBit.c:
|
||||
.text: [0x8050B1AC, 0x8050B1D4]
|
||||
m_random_field/mRF_GetRandomStepMode.c:
|
||||
.text: [0x8050B284, 0x8050B2C0]
|
||||
sys_dynamic.c:
|
||||
.bss: [0x813413F8, 0x81361820]
|
||||
# ac_aprilfool_control/aPC_actor_dt.c: common_data is pure bs,
|
||||
# .text: [0x805153f0, 0x8051542C]
|
||||
|
||||
|
||||
@@ -52509,6 +52509,9 @@ global:
|
||||
0x812F31DC: game_GameFrame_2F
|
||||
0x812F31E0: game_GameFrame__1F
|
||||
0x812F31E4: game_class_p
|
||||
0x812F31E8: frame
|
||||
0x812F31EC: SoftResetEnable
|
||||
0x812F31F0: skip_frame
|
||||
0x812F31F8: graph_class
|
||||
0x812F3560: ResetStatus
|
||||
0x812F3568: ResetTime
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef AUDIO_H
|
||||
#define AUDIO_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void sAdo_GameFrame();
|
||||
extern void sAdo_SoftReset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef DOLPHIN_OS_ALARM_H
|
||||
#define DOLPHIN_OS_ALARM_H
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSTime.h"
|
||||
#include "dolphin/os/OSContext.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OSAlarm OSAlarm;
|
||||
typedef void (*OSAlarmHandler)(OSAlarm* alarm, OSContext* context);
|
||||
|
||||
struct OSAlarm
|
||||
{
|
||||
OSAlarmHandler handler;
|
||||
OSTime fire;
|
||||
OSAlarm *prev;
|
||||
OSAlarm *next;
|
||||
|
||||
// Periodic alarm
|
||||
OSTime period;
|
||||
OSTime start;
|
||||
};
|
||||
|
||||
void OSInitAlarm(void);
|
||||
void OSSetAlarm(OSAlarm *alarm, OSTime tick, OSAlarmHandler handler);
|
||||
void OSSetAbsAlarm(OSAlarm *alarm, OSTime time, OSAlarmHandler handler);
|
||||
void OSSetPeriodicAlarm(OSAlarm *alarm, OSTime start, OSTime period,
|
||||
OSAlarmHandler handler);
|
||||
void OSCreateAlarm(OSAlarm *alarm);
|
||||
void OSCancelAlarm(OSAlarm *alarm);
|
||||
|
||||
BOOL OSCheckAlarmQueue(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // DOLPHIN_OS_ALARM_H
|
||||
@@ -67,6 +67,9 @@ struct OSThread
|
||||
|
||||
u8 *stackBase; // the thread's designated stack (high address)
|
||||
u32 *stackEnd; // last word of stack (low address)
|
||||
|
||||
s32 error; // error state of thread
|
||||
void* specific[2]; // data specific to this thread (set by programmer)
|
||||
};
|
||||
|
||||
// Thread states
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/* TODO: not sure if this should live here or in libultra/OSTimer.h */
|
||||
|
||||
#ifndef DOLPHIN_OS_TIMER_H
|
||||
#define DOLPHIN_OS_TIMER_H
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSAlarm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OSTimer_s {
|
||||
OSAlarm alarm;
|
||||
struct OSTimer_s* next;
|
||||
struct OSTimer_s* prev;
|
||||
OSTime interval;
|
||||
OSTime value;
|
||||
OSMessageQueue* mq;
|
||||
OSMessage msg;
|
||||
} OSTimer;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef DVDERR_H
|
||||
#define DVDERR_H
|
||||
|
||||
/* dvderr lives in dol, so dvderr.c is at src/dvderr.c */
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern BOOL dvderr_draw();
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef FAMICOM_EMU_H
|
||||
#define FAMICOM_EMU_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_famicom_emu_s) == 0xE0 */
|
||||
typedef struct game_famicom_emu_s {
|
||||
/* 0x00 */ GAME game;
|
||||
} GAME_FAMICOM_EMU;
|
||||
|
||||
extern void famicom_emu_init(GAME_FAMICOM_EMU* famicom_emu);
|
||||
extern void famicom_emu_cleanup(GAME_FAMICOM_EMU* famicom_emu);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef FIRST_GAME_H
|
||||
#define FIRST_GAME_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_first_s) == 0xE0 */
|
||||
typedef struct game_first_s {
|
||||
/* 0x00 */ GAME game;
|
||||
} GAME_FIRST;
|
||||
|
||||
extern void first_game_cleanup(GAME_FIRST* first_game);
|
||||
extern void first_game_init(GAME_FIRST* first_game);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include "types.h"
|
||||
#include "TwoHeadArena.h"
|
||||
#include "graph.h"
|
||||
#include "gamealloc.h"
|
||||
#include "libu64/pad.h"
|
||||
#include "m_controller.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_s) == 0xE0 */
|
||||
typedef struct game_s {
|
||||
/* 0x0000 */ GRAPH* graph;
|
||||
/* 0x0004 */ void (*exec)(struct game_s* );
|
||||
/* 0x0008 */ void (*cleanup)(struct game_s*);
|
||||
/* 0x000C */ void (*next_game_init)(struct game_s*);
|
||||
/* 0x0010 */ size_t next_game_class_size;
|
||||
/* 0x0014 */ pad_t pads[MAXCONTROLLERS];
|
||||
/* 0x0074 */ int pad_initialized;
|
||||
/* 0x0078 */ THA tha;
|
||||
/* 0x0088 */ GameAlloc gamealloc;
|
||||
/* 0x009C */ u8 doing_point;
|
||||
/* 0x009D */ u8 doing_point_specific; /* game class specific? */
|
||||
/* 0x009E */ u8 disable_display;
|
||||
/* 0x009F */ u8 doing;
|
||||
/* 0x00A0 */ u32 frame_counter;
|
||||
/* 0x00A4 */ int disable_prenmi;
|
||||
/* 0x00A8 */ MCON mcon;
|
||||
} GAME;
|
||||
|
||||
extern void game_ct(GAME*, void (*)(GAME*), GRAPH*);
|
||||
extern void game_dt(GAME* game);
|
||||
extern void game_main(GAME* game);
|
||||
extern int game_is_doing(GAME* game);
|
||||
extern void (*game_get_next_game_init(GAME* game))(GAME*);
|
||||
|
||||
#define GAME_NEXT_GAME(game, init_name, class_name) \
|
||||
do { \
|
||||
GAME* g = (game); \
|
||||
g->next_game_init = (void (*)(struct game_s*))init_name##_init; \
|
||||
g->next_game_class_size = sizeof(GAME_##class_name); \
|
||||
} while (0)
|
||||
|
||||
#define GAME_GOTO_NEXT(game, init_name, class_name) \
|
||||
do { \
|
||||
GAME* t_game = (game); \
|
||||
t_game->doing = FALSE; \
|
||||
GAME_NEXT_GAME(t_game, init_name, class_name); \
|
||||
} while (0)
|
||||
|
||||
extern void game_get_controller(GAME* game);
|
||||
|
||||
extern GAME* game_class_p;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef GAMEALLOC_H
|
||||
#define GAMEALLOC_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct gameAllocList_s) == 0x10 */
|
||||
typedef struct gameAllocList_s {
|
||||
/* 0x00 */ struct gameAllocList_s* next;
|
||||
/* 0x04 */ struct gameAllocList_s* prev;
|
||||
/* 0x08 */ size_t alloc_size;
|
||||
/* 0x0C */ u32 pad;
|
||||
} GameAllocList;
|
||||
|
||||
/* sizeof(struct gameAlloc_s) == 0x14 */
|
||||
typedef struct gameAlloc_s {
|
||||
/* 0x00 */ GameAllocList head;
|
||||
/* 0x10 */ GameAllocList* tail;
|
||||
} GameAlloc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
#ifndef GRAPH_H
|
||||
#define GRAPH_H
|
||||
|
||||
#include "types.h"
|
||||
#include "PR/mbi.h"
|
||||
#include "THA_GA.h"
|
||||
#include "dolphin/os/OSMessage.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
GRAPH_DOING_ZERO = 0,
|
||||
GRAPH_DOING_CT,
|
||||
GRAPH_DOING_GAME_CT,
|
||||
GRAPH_DOING_GAME_CT_FINISHED,
|
||||
GRAPH_DOING_GAME_MAIN,
|
||||
GRAPH_DOING_GAME_TIME,
|
||||
GRAPH_DOING_GAME_TIME_FINISHED,
|
||||
GRAPH_DOING_GAME_EXEC,
|
||||
GRAPH_DOING_GAME_EXEC_FINISHED,
|
||||
GRAPH_DOING_GAME_BGM,
|
||||
GRAPH_DOING_GAME_BGM_FINISHED,
|
||||
GRAPH_DOING_GAME_MAIN_FINISHED,
|
||||
GRAPH_DOING_TASK_SET,
|
||||
GRAPH_DOING_WAIT_TASK,
|
||||
GRAPH_DOING_WAIT_TASK_FINISHED,
|
||||
GRAPH_DOING_TASK_SET_FINISHED,
|
||||
GRAPH_DOING_AUDIO,
|
||||
GRAPH_DOING_AUDIO_FINISHED,
|
||||
GRAPH_DOING_GAME_18, /* Not sure what this is, relevant code removed */
|
||||
GRAPH_DOING_GAME_DT,
|
||||
GRAPH_DOING_GAME_DT_FINISHED,
|
||||
GRAPH_DOING_DT,
|
||||
GRAPH_DOING_END
|
||||
} GRAPH_DOING_POINT;
|
||||
|
||||
#define GRAPH_MSG_BUF_COUNT 8
|
||||
|
||||
typedef struct graph_s {
|
||||
/* 0x0000 */ Gfx* Gfx_list00; /* line translucent */
|
||||
/* 0x0004 */ Gfx* Gfx_list01; /* overlay */
|
||||
/* 0x0008 */ void* DepthBuffer;
|
||||
/* 0x000C */ Gfx* Gfx_list03; /* unused */
|
||||
/* 0x0010 */ Gfx* Gfx_list04; /* line opaque */
|
||||
/* 0x0014 */ Gfx* Gfx_list07; /* polygon opaque */
|
||||
/* 0x0018 */ Gfx* Gfx_list08; /* polygon translucent */
|
||||
/* 0x001C */ Gfx* Gfx_list09; /* font */
|
||||
/* 0x0020 */ Gfx* gfxsave;
|
||||
/* 0x0024 */ u8 _unk24[32];
|
||||
/* 0x0044 */ OSMessage graphReplyMesgBuf[GRAPH_MSG_BUF_COUNT];
|
||||
/* 0x0064 */ OSMessageQueue* schedMesgQueue;
|
||||
/* 0x0068 */ OSMessageQueue graphReplyMesgQueue;
|
||||
/* 0x0088 */ u8 _unused_ossctask00p[0x50]; /* real type = OSScTask */
|
||||
/* 0x00D8 */ u8 _unused_ossctask01p[0x50]; /* real type = OSScTask */
|
||||
/* 0x0128 */ u8 _unused_ossctask02p[0x50]; /* real type = OSScTask */
|
||||
/* 0x0178 */ u8 _unk178[0x48]; /* If graphReplyMesgQueue is N64 type, this may be another OSScTask */
|
||||
/* 0x01C0 */ Gfx* Gfx_list05; /* work */
|
||||
/* 0x01C4 */ THA_GA work_thaga;
|
||||
/* 0x01D4 */ u8 _unk1D4[0xDC]; /* Maybe related to more OSScTask stuff? */
|
||||
/* 0x02B0 */ void* scheduler; /* Actually points to OSSched struct, only used in DnM? */
|
||||
/* 0x02B4 */ void* vimode; /* Actually points to OSViMode struct, not used in AC. */
|
||||
/* 0x02B8 */ THA_GA line_opaque_thaga;
|
||||
/* 0x02C8 */ THA_GA line_translucent_thaga;
|
||||
/* 0x02D8 */ THA_GA overlay_thaga;
|
||||
/* 0x02E8 */ THA_GA polygon_opaque_thaga;
|
||||
/* 0x02F8 */ THA_GA polygon_translucent_thaga;
|
||||
/* 0x0308 */ THA_GA font_thaga;
|
||||
/* 0x0318 */ THA_GA shadow_thaga;
|
||||
/* 0x0328 */ THA_GA light_thaga;
|
||||
/* 0x0338 */ int frame_counter;
|
||||
/* 0x033C */ u16* frameBuffer;
|
||||
/* 0x0340 */ u16* renderBuffer;
|
||||
/* 0x0344 */ u32 vispecial;
|
||||
/* 0x0348 */ u8 doing_point;
|
||||
/* 0x0349 */ u8 _unk349;
|
||||
/* 0x034A */ u8 need_viupdate;
|
||||
/* 0x034B */ u8 cfb_bank;
|
||||
/* 0x034C */ void (*taskEndCallback)(struct graph_s*, void*);
|
||||
/* 0x0350 */ void* taskEndData;
|
||||
/* 0x0354 */ f32 vixscale;
|
||||
/* 0x0358 */ f32 viyscale;
|
||||
/* 0x035C */ Gfx* last_dl;
|
||||
/* 0x0360 */ Gfx* Gfx_list10; /* shadow */
|
||||
/* 0x0364 */ Gfx* Gfx_list11; /* light */
|
||||
} GRAPH ATTRIBUTE_ALIGN(8); // one of the missing structs is likely aligned to 8 bytes.
|
||||
|
||||
extern void graph_proc(void* arg);
|
||||
extern void graph_ct(GRAPH* this);
|
||||
extern void graph_dt(GRAPH* this);
|
||||
|
||||
#define GRAPH_SET_DOING_POINT(g, point) ((g)->doing_point = GRAPH_DOING_##point)
|
||||
|
||||
/* Graph display list macros for style and correctness enforcement */
|
||||
|
||||
#define OPEN_DISP(graph) \
|
||||
{ \
|
||||
GRAPH* __graph = (graph); \
|
||||
int __gfx_opened = 0; \
|
||||
while (0)
|
||||
|
||||
#define CLOSE_DISP(graph) \
|
||||
(void)__gfx_opened; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define NEXT_DISP(thaga) ((thaga)->thaGfx.head_p++)
|
||||
#define NOW_DISP(thaga) ((thaga)->thaGfx.head_p)
|
||||
|
||||
#define NEXT_LINE_XLU_DISP NEXT_DISP(&__graph->line_translucent_thaga)
|
||||
#define NEXT_LINE_OPA_DISP NEXT_DISP(&__graph->line_opaque_thaga)
|
||||
#define NEXT_POLY_OPA_DISP NEXT_DISP(&__graph->polygon_opaque_thaga)
|
||||
#define NEXT_POLY_XLU_DISP NEXT_DISP(&__graph->polygon_translucent_thaga)
|
||||
#define NEXT_OVERLAY_DISP NEXT_DISP(&__graph->overlay_thaga)
|
||||
#define NEXT_WORK_DISP NEXT_DISP(&__graph->work_thaga)
|
||||
#define NEXT_FONT_DISP NEXT_DISP(&__graph->font_thaga)
|
||||
#define NEXT_SHADOW_DISP NEXT_DISP(&__graph->shadow_thaga)
|
||||
#define NEXT_LIGHT_DISP NEXT_DISP(&__graph->light_thaga)
|
||||
|
||||
#define NOW_LINE_XLU_DISP (Gfx*)NOW_DISP(&__graph->line_translucent_thaga)
|
||||
#define NOW_LINE_OPA_DISP (Gfx*)NOW_DISP(&__graph->line_opaque_thaga)
|
||||
#define NOW_POLY_OPA_DISP (Gfx*)NOW_DISP(&__graph->polygon_opaque_thaga)
|
||||
#define NOW_POLY_XLU_DISP (Gfx*)NOW_DISP(&__graph->polygon_translucent_thaga)
|
||||
#define NOW_OVERLAY_DISP (Gfx*)NOW_DISP(&__graph->overlay_thaga)
|
||||
#define NOW_WORK_DISP (Gfx*)NOW_DISP(&__graph->work_thaga)
|
||||
#define NOW_FONT_DISP (Gfx*)NOW_DISP(&__graph->font_thaga)
|
||||
#define NOW_SHADOW_DISP (Gfx*)NOW_DISP(&__graph->shadow_thaga)
|
||||
#define NOW_LIGHT_DISP (Gfx*)NOW_DISP(&__graph->light_thaga)
|
||||
|
||||
extern u8 SoftResetEnable;
|
||||
extern GRAPH graph_class;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef IRQMGR_H
|
||||
#define IRQMGR_H
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSTime.h"
|
||||
#include "dolphin/os/OSTimer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IRQ_RESET_NORMAL 0
|
||||
#define IRQ_RESET_PRENMI 1
|
||||
#define IRQ_RESET_DELAY 2
|
||||
|
||||
#define IRQMGR_MESSAGES_MAX 8
|
||||
|
||||
typedef struct {
|
||||
s16 type;
|
||||
s8 data[30];
|
||||
} irqmgr_mesg_t;
|
||||
|
||||
typedef struct irqmgr_client_s {
|
||||
struct irqmgr_client_s* next;
|
||||
OSMessageQueue* msgQueue;
|
||||
} irqmgr_client_t;
|
||||
|
||||
typedef struct {
|
||||
irqmgr_mesg_t msgRetrace;
|
||||
irqmgr_mesg_t msgPreNMI;
|
||||
irqmgr_mesg_t msgDelayPreNMI;
|
||||
OSMessageQueue _msgQueue;
|
||||
OSMessage _msgBuf[IRQMGR_MESSAGES_MAX];
|
||||
OSThread thread;
|
||||
irqmgr_client_t* clients;
|
||||
u8 prenmi;
|
||||
OSTime prenmi_time;
|
||||
OSTimer timer;
|
||||
OSTime retraceTime;
|
||||
} irqmgr_t;
|
||||
|
||||
extern volatile int ResetStatus;
|
||||
extern volatile OSTime ResetTime;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef JSYSWRAP_H
|
||||
#define JSYSWRAP_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void JW_JUTReport(int pos_x, int pos_y, int show_count, const char* fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef OS_MALLOC_H
|
||||
#define OS_MALLOC_H
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSTime.h"
|
||||
#include "libultra/osThread.h"
|
||||
#include "libultra/osMesg.h"
|
||||
#include "libultra/u64types.h"
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef OS_MALLOC_H
|
||||
#define OS_MALLOC_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void* malloc(size_t size);
|
||||
extern void free(void* ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef EMU64_WRAPPER_H
|
||||
#define EMU64_WRAPPER_H
|
||||
|
||||
#include "types.h"
|
||||
#include "sys_ucode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void emu64_set_ucode_info(int count, ucode_info* ucode_info);
|
||||
extern void emu64_set_first_ucode(void* ucode);
|
||||
extern void emu64_taskstart(Gfx* gfx);
|
||||
extern void emu64_init();
|
||||
extern void emu64_refresh();
|
||||
extern void emu64_cleanup();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -32,8 +32,4 @@ extern void OSDVDFatalError();
|
||||
#define OSChangeToRetail() (OSChangeBootMode(RETAIL_MODE))
|
||||
#define OSChangeToDebug() (OSChangeBootMode(DEBUG_MODE))
|
||||
|
||||
static BOOL __OSReport_disable;
|
||||
static OSThread* __OSReport_MonopolyThread;
|
||||
static u8 print_mutex_initialized;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef JSYSWRAPPER_H
|
||||
#define JSYSWRAPPER_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void JW_BeginFrame();
|
||||
extern void JW_EndFrame();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
void _dbg_hungup(const char*, s32);
|
||||
extern void _dbg_hungup(const char* file, int line);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef PAD_H
|
||||
#define PAD_H
|
||||
|
||||
#include "types.h"
|
||||
#include "libultra/osContPad.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
OSContPad now;
|
||||
OSContPad last;
|
||||
OSContPad on;
|
||||
OSContPad off;
|
||||
} pad_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef U64TYPES_H
|
||||
#define U64TYPES_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
typedef struct xyz_s {
|
||||
f32 x, y, z;
|
||||
} xyz_t;
|
||||
|
||||
#endif
|
||||
@@ -14,5 +14,6 @@ u32 osGetCount(void);
|
||||
OSTime osGetTime(void);
|
||||
|
||||
extern s32 osAppNMIBuffer[];
|
||||
extern int osShutdown;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/* This file is fabriacted. These structs are in a unified file in N64 SDK. */
|
||||
|
||||
#ifndef OS_CONT_PAD
|
||||
#define OS_CONT_PAD
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAXCONTROLLERS 4
|
||||
|
||||
typedef struct {
|
||||
u16 type;
|
||||
u8 status;
|
||||
u8 errno;
|
||||
} OSContStatus;
|
||||
|
||||
typedef struct {
|
||||
u16 button;
|
||||
s8 stick_x;
|
||||
s8 stick_y;
|
||||
u8 errno;
|
||||
} OSContPad;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef M_BGM_H
|
||||
#define M_BGM_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void mBGM_reset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef M_CONTROLLER_H
|
||||
#define M_CONTROLLER_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct controller_s) == 0x38 */
|
||||
typedef struct controller_s {
|
||||
/* 0x00 */ f32 move_pX;
|
||||
/* 0x04 */ f32 move_pY;
|
||||
/* 0x08 */ f32 move_pR;
|
||||
/* 0x0C */ s16 move_angle;
|
||||
|
||||
/* 0x10 */ f32 last_move_pX;
|
||||
/* 0x14 */ f32 last_move_pY;
|
||||
/* 0x18 */ f32 last_move_pR;
|
||||
/* 0x1C */ s16 last_move_angle;
|
||||
|
||||
/* 0x20 */ f32 adjusted_pX;
|
||||
/* 0x24 */ f32 adjusted_pY;
|
||||
/* 0x28 */ f32 adjusted_pR;
|
||||
|
||||
/* 0x2C */ f32 last_adjusted_pX;
|
||||
/* 0x30 */ f32 last_adjusted_pY;
|
||||
/* 0x34 */ f32 last_adjusted_pR;
|
||||
} MCON;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef M_DEBUG_H
|
||||
#define M_DEBUG_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
DEBUG_REG_START = 0,
|
||||
DEBUG_REG_REG = DEBUG_REG_START,
|
||||
DEBUG_REG_SREG,
|
||||
DEBUG_REG_OREG,
|
||||
DEBUG_REG_PREG,
|
||||
DEBUG_REG_QREG,
|
||||
DEBUG_REG_MREG,
|
||||
DEBUG_REG_SBREG,
|
||||
DEBUG_REG_DREG,
|
||||
DEBUG_REG_UREG,
|
||||
DEBUG_REG_IREG,
|
||||
DEBUG_REG_ZREG,
|
||||
DEBUG_REG_CRV,
|
||||
DEBUG_REG_NS1,
|
||||
DEBUG_REG_SND,
|
||||
DEBUG_REG_XREG,
|
||||
DEBUG_REG_CRV2,
|
||||
DEBUG_REG_DEMOREG,
|
||||
DEBUG_REG_TREG,
|
||||
DEBUG_REG_WREG,
|
||||
DEBUG_REG_AREG,
|
||||
DEBUG_REG_VREG,
|
||||
DEBUG_REG_HREG,
|
||||
DEBUG_REG_GREG,
|
||||
DEBUG_REG_mREG,
|
||||
DEBUG_REG_nREG,
|
||||
DEBUG_REG_BREG,
|
||||
DEBUG_REG_DORO,
|
||||
DEBUG_REG_kREG,
|
||||
DEBUG_REG_BAK,
|
||||
DEBUG_REG_PLAYERREG,
|
||||
DEBUG_REG_NMREG,
|
||||
|
||||
DEBUG_REG_NIIREG,
|
||||
DEBUG_REG_GENREG,
|
||||
DEBUG_REG_MYKREG,
|
||||
DEBUG_REG_CAMREG,
|
||||
DEBUG_REG_SAKREG,
|
||||
DEBUG_REG_TAKREG,
|
||||
DEBUG_REG_PL2REG,
|
||||
|
||||
DEBUG_REG_MAX
|
||||
} DEBUG_REG;
|
||||
|
||||
#define DEBUG_REG_SIZE 16
|
||||
#define DEBUG_REG_GROUP 6
|
||||
|
||||
typedef struct debug_mode_s {
|
||||
u8 mode;
|
||||
u8 type;
|
||||
s8 input_r;
|
||||
s8 key_wait;
|
||||
|
||||
int old_key;
|
||||
int __pad[3];
|
||||
|
||||
s16 r[DEBUG_REG_SIZE * DEBUG_REG_GROUP * DEBUG_REG_MAX];
|
||||
} Debug_mode;
|
||||
|
||||
extern Debug_mode* debug_mode;
|
||||
|
||||
#define REGADDR(reg, idx) (debug_mode->r[DEBUG_REG_SIZE * DEBUG_REG_GROUP * DEBUG_REG_##reg + (idx)])
|
||||
|
||||
#define GETREG(reg, idx) ((s16)(REGADDR(reg, idx)))
|
||||
#define SETREG(reg, idx, val) (REGADDR(reg, idx) = (val))
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef M_GAME_DLFTBLS_H
|
||||
#define M_GAME_DLFTBLS_H
|
||||
|
||||
/* Display List Function TaBLe */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "game.h"
|
||||
#include "types.h"
|
||||
|
||||
typedef void (*GAME_CT_PROC)(GAME* game);
|
||||
typedef void (*GAME_DT_PROC)(GAME* game);
|
||||
|
||||
/* TODO: Research the unknown function pointers & unknown value */
|
||||
typedef struct {
|
||||
void* loaded_address;
|
||||
u32 SegmentRomStart; /* _nameSegmentRomStart */
|
||||
u32 SegmentRomEnd; /* _nameSegmentRomEnd */
|
||||
char *SegmentStart; /* _nameSegmentStart */
|
||||
char *SegmentEnd; /* _nameSegmentEnd */
|
||||
void* unk_14;
|
||||
GAME_CT_PROC init;
|
||||
GAME_DT_PROC cleanup;
|
||||
void* unk_20;
|
||||
void* unk_24;
|
||||
void* unk_28;
|
||||
size_t alloc_size;
|
||||
} Game_dlftbl;
|
||||
typedef Game_dlftbl DLFTBL_GAME;
|
||||
|
||||
extern unsigned int game_dlftbls_num;
|
||||
extern DLFTBL_GAME game_dlftbls[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef M_NMIBUF_H
|
||||
#define M_NMIBUF_H
|
||||
|
||||
#include "types.h"
|
||||
#include "libultra/libultra.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define APPNMI_FLAGS_IDX 15
|
||||
|
||||
#define APPNMI_SET(v) (osAppNMIBuffer[APPNMI_FLAGS_IDX] |= v)
|
||||
#define APPNMI_CLR(v) (osAppNMIBuffer[APPNMI_FLAGS_IDX] &= ~v)
|
||||
#define APPNMI_GET(v) (osAppNMIBuffer[APPNMI_FLAGS_IDX] & v)
|
||||
#define APPNMI_FLP(v) (osAppNMIBuffer[APPNMI_FLAGS_IDX] ^= v)
|
||||
|
||||
/* ZURUMODE (Cheat mode) related values */
|
||||
#define APPNMI_ZURUMODE_SET() APPNMI_SET(1)
|
||||
#define APPNMI_ZURUMODE_CLR() APPNMI_CLR(1)
|
||||
#define APPNMI_ZURUMODE_GET() APPNMI_GET(1)
|
||||
#define APPNMI_ZURUMODE_FLP() APPNMI_FLP(1)
|
||||
#define APPNMI_ZURUMODE2_SET() APPNMI_SET(8)
|
||||
#define APPNMI_ZURUMODE2_CLR() APPNMI_CLR(8)
|
||||
#define APPNMI_ZURUMODE2_GET() APPNMI_GET(8)
|
||||
#define APPNMI_ZURUMODE2_FLP() APPNMI_FLP(8)
|
||||
#define APPNMI_ZURUMODE3_SET() APPNMI_SET(16)
|
||||
#define APPNMI_ZURUMODE3_CLR() APPNMI_CLR(16)
|
||||
#define APPNMI_ZURUMODE3_GET() APPNMI_GET(16)
|
||||
#define APPNMI_ZURUMODE3_FLP() APPNMI_FLP(16)
|
||||
|
||||
#define APPNMI_RESETEXEMPT_SET() APPNMI_SET(2)
|
||||
#define APPNMI_RESETEXEMPT_CLR() APPNMI_CLR(2)
|
||||
#define APPNMI_RESETEXEMPT_GET() APPNMI_GET(2)
|
||||
#define APPNMI_RESETEXEMPT_FLP() APPNMI_FLP(2)
|
||||
#define APPNMI_RESETEXEMPT2_SET() APPNMI_SET(4)
|
||||
#define APPNMI_RESETEXEMPT2_CLR() APPNMI_CLR(4)
|
||||
#define APPNMI_RESETEXEMPT2_GET() APPNMI_GET(4)
|
||||
#define APPNMI_RESETEXEMPT2_FLP() APPNMI_FLP(4)
|
||||
|
||||
#define APPNMI_DEBUGMODE_SET() APPNMI_SET(32)
|
||||
#define APPNMI_DEBUGMODE_CLR() APPNMI_CLR(32)
|
||||
#define APPNMI_DEBUGMODE_GET() APPNMI_GET(32)
|
||||
#define APPNMI_DEBUGMODE_FLP() APPNMI_FLP(32)
|
||||
|
||||
#define APPNMI_TESTMODE_SET() APPNMI_SET(64)
|
||||
#define APPNMI_TESTMODE_CLR() APPNMI_CLR(64)
|
||||
#define APPNMI_TESTMODE_GET() APPNMI_GET(64)
|
||||
#define APPNMI_TESTMODE_FLP() APPNMI_FLP(64)
|
||||
|
||||
/* Not fully sure this is the right name */
|
||||
#define APPNMI_HOTRESET_SET() (osAppNMIBuffer[APPNMI_FLAGS_IDX] |= 0x200)
|
||||
#define APPNMI_HOTRESET_CLR() (osAppNMIBuffer[APPNMI_FLAGS_IDX] &= ~0x200)
|
||||
#define APPNMI_HOTRESET_GET() (osAppNMIBuffer[APPNMI_FLAGS_IDX] & 0x200)
|
||||
#define APPNMI_HOTRESET_FLP() (osAppNMIBuffer[APPNMI_FLAGS_IDX] ^= 0x200)
|
||||
|
||||
#define APPNMI_
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef M_OLIB_H
|
||||
#define M_OLIB_H
|
||||
|
||||
#include "types.h"
|
||||
#include "libu64/u64types.h"
|
||||
|
||||
typedef struct rect_s {
|
||||
int top, bottom;
|
||||
int l, r;
|
||||
} rect;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef M_PLAY_H
|
||||
#define M_PLAY_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_play_s) == 0x2600 */
|
||||
typedef struct game_play_s {
|
||||
/* 0x0000 */ GAME game;
|
||||
// TODO: finish
|
||||
/* 0x00E0 */ u8 _temp[0x2520];
|
||||
} GAME_PLAY;
|
||||
|
||||
extern void play_init(GAME_PLAY* play);
|
||||
extern void play_cleanup(GAME_PLAY* play);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef M_PRENMI_H
|
||||
#define M_PRENMI_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_prenmi_s) == 0xE8 */
|
||||
typedef struct game_prenmi_s {
|
||||
GAME game;
|
||||
u32 timer;
|
||||
u32 pad;
|
||||
} GAME_PRENMI;
|
||||
|
||||
extern void prenmi_init(GAME_PRENMI* prenmi);
|
||||
extern void prenmi_cleanup(GAME_PRENMI* prenmi);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef M_SELECT_H
|
||||
#define M_SELECT_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
#include "m_view.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_select_s) == 0x0238 */
|
||||
typedef struct game_select_s {
|
||||
/* 0x0000 */ GAME game;
|
||||
/* 0x00E0 */ View view;
|
||||
/* 0x0200 */ int status;
|
||||
/* 0x0204 */ int cursor_x;
|
||||
/* 0x0208 */ int cursor_y;
|
||||
/* 0x020C */ int step;
|
||||
/* 0x0210 */ int step_add;
|
||||
/* 0x0214 */ int selected_course;
|
||||
/* 0x0218 */ int top_course; /* course at top of screen it seems */
|
||||
/* 0x021C */ u32 unk_21C;
|
||||
/* 0x0220 */ int button_step;
|
||||
/* 0x0224 */ u8 name[8];
|
||||
/* 0x0228 */ int unk_228[3];
|
||||
} GAME_SELECT;
|
||||
|
||||
extern void select_init(GAME_SELECT* select);
|
||||
extern void select_cleanup(GAME_SELECT* select);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef M_TRADEMARK_H
|
||||
#define M_TRADEMARK_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_trademark_s) == 0x25A70 */
|
||||
typedef struct game_trademark_s {
|
||||
/* 0x000000 */ GAME game;
|
||||
// TODO: finish
|
||||
/* 0x0000E0 */ u8 _temp[0x25990];
|
||||
} GAME_TRADEMARK;
|
||||
|
||||
extern void trademark_init(GAME_TRADEMARK* trademark);
|
||||
extern void trademark_cleanup(GAME_TRADEMARK* trademark);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef M_VIBCTL_H
|
||||
#define M_VIBCTL_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void mVibctl_reset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef M_VIEW_H
|
||||
#define M_VIEW_H
|
||||
|
||||
#include "types.h"
|
||||
#include "libu64/u64types.h"
|
||||
#include "m_olib.h"
|
||||
#include "graph.h"
|
||||
#include "PR/mbi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct view_s) == 0x120 */
|
||||
typedef struct view_s {
|
||||
GRAPH* graph;
|
||||
|
||||
rect screen;
|
||||
f32 fovY;
|
||||
f32 near, far;
|
||||
f32 scale;
|
||||
xyz_t eye;
|
||||
xyz_t center;
|
||||
xyz_t up;
|
||||
|
||||
Vp viewport;
|
||||
|
||||
Mtx mtx_projection;
|
||||
Mtx mtx_viewing;
|
||||
Mtx* p_projection;
|
||||
Mtx* p_viewing;
|
||||
|
||||
struct stretch_s {
|
||||
xyz_t target_rotate;
|
||||
xyz_t target_scale;
|
||||
f32 step; /* step speed between rotate/scale -> target_rotation/target_scale */
|
||||
xyz_t rotate;
|
||||
xyz_t scale;
|
||||
} stretch;
|
||||
|
||||
u16 normal;
|
||||
int flag;
|
||||
int _unused_pad0;
|
||||
} View;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,93 @@
|
||||
#ifndef PADMGR_H
|
||||
#define PADMGR_H
|
||||
|
||||
#include "types.h"
|
||||
#include "irqmgr.h"
|
||||
#include "libu64/pad.h"
|
||||
#include "dolphin/os/OSMessage.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PADMSGBUFCNT 8
|
||||
|
||||
typedef struct {
|
||||
u8 last_intensity;
|
||||
u8 now_intensity;
|
||||
u8 frames;
|
||||
u8 _pad;
|
||||
} Motor_t;
|
||||
|
||||
typedef struct {
|
||||
Motor_t motors[MAXCONTROLLERS];
|
||||
s16 cooldown_frames;
|
||||
u8 rumble_frames;
|
||||
u8 _pad0;
|
||||
u8 reset;
|
||||
} Rumble_t;
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8 pad_pattern;
|
||||
/* 0x0004 */ void (*callback)(void*);
|
||||
/* 0x0008 */ void* callback_param;
|
||||
/* 0x000C */ void (*callback2)(void*);
|
||||
/* 0x0010 */ void* callback2_param;
|
||||
|
||||
/* 0x0014 */ OSContStatus pad_status[MAXCONTROLLERS];
|
||||
/* 0x0024 */ OSMessage _msg24;
|
||||
/* 0x0028 */ OSMessage _msg28;
|
||||
/* 0x002C */ OSMessage _msgBuf2C[PADMSGBUFCNT];
|
||||
/* 0x004C */ OSMessageQueue _msgQueue4C;
|
||||
/* 0x006C */ OSMessageQueue _msgQueue6C;
|
||||
/* 0x008C */ OSMessageQueue _msgQueue8C;
|
||||
/* 0x00AC */ irqmgr_client_t irqclient;
|
||||
/* 0x00B4 */ u32 _unk0; /* maybe additional value in irqmgr_client_t? */
|
||||
/* 0x00B8 */ OSThread thread;
|
||||
/* 0x03D0 */ u8 _tmp[0x58]; //pad_t pads[MAXCONTROLLERS]; // TODO: figure out what's going on here.
|
||||
/* 0x0428 */ OSContPad n64_pads[MAXCONTROLLERS]; /* Converted from PADStatus via JUTGamePad */
|
||||
/* 0x0440 */ u8 num_controllers;
|
||||
/* 0x0441 */ u8 device_type[4];
|
||||
/* 0x0445 */ u8 pak_type[4];
|
||||
/* 0x044A */ Rumble_t rumble;
|
||||
} padmgr;
|
||||
|
||||
extern padmgr padmgr_class;
|
||||
|
||||
#define padmgr_setClient(callback, param) \
|
||||
do { \
|
||||
padmgr* mgr = &padmgr_class; \
|
||||
mgr->callback = callback; \
|
||||
mgr->callback_param = param; \
|
||||
} while (0)
|
||||
|
||||
#define padmgr_removeClient(callback, param) \
|
||||
do { \
|
||||
padmgr* mgr = &padmgr_class; \
|
||||
if (mgr->callback == (callback) && mgr->callback_param == (param)) { \
|
||||
mgr->callback = NULL; \
|
||||
mgr->callback_param = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define padmgr_setClient2(callback, param) \
|
||||
do { \
|
||||
padmgr* mgr = &padmgr_class; \
|
||||
mgr->callback2 = callback; \
|
||||
mgr->callback2_param = param; \
|
||||
} while (0)
|
||||
|
||||
#define padmgr_removeClient2(callback, param) \
|
||||
do { \
|
||||
padmgr* mgr = &padmgr_class; \
|
||||
if (mgr->callback2 == (callback) && mgr->callback2_param == (param)) { \
|
||||
mgr->callback2 = NULL; \
|
||||
mgr->callback2_param = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef PLAYER_SELECT_H
|
||||
#define PLAYER_SELECT_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
#include "m_view.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_player_select_s) == 0x0288 */
|
||||
typedef struct game_player_select_s {
|
||||
/* 0x0000 */ GAME game;
|
||||
/* 0x00E0 */ View view;
|
||||
// TODO: finish this
|
||||
/* 0x0200 */ u8 _temp[0x88];
|
||||
} GAME_PLAYER_SELECT;
|
||||
|
||||
extern void player_select_init(GAME_PLAYER_SELECT* player_select);
|
||||
extern void player_select_cleanup(GAME_PLAYER_SELECT* player_select);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef SAVE_MENU_H
|
||||
#define SAVE_MENU_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
#include "m_view.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct game_save_menu_s) == 0x0228 */
|
||||
typedef struct game_save_menu_s {
|
||||
/* 0x0000 */ GAME game;
|
||||
/* 0x00E0 */ View view;
|
||||
// TODO: finish this
|
||||
/* 0x0200 */ u8 _temp[0x28];
|
||||
} GAME_SAVE_MENU;
|
||||
|
||||
extern void save_menu_init(GAME_SAVE_MENU* save_menu);
|
||||
extern void save_menu_cleanup(GAME_SAVE_MENU* save_menu);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef SECOND_GAME_H
|
||||
#define SECOND_GAME_H
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* sizeof(struct second_game_s) == 0xE0 */
|
||||
typedef struct second_game_s {
|
||||
/* 0x00 */ GAME game;
|
||||
} GAME_SECOND;
|
||||
|
||||
extern void second_game_init(GAME_SECOND second);
|
||||
extern void second_game_cleanup(GAME_SECOND* second);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef SYS_DYNAMIC_H
|
||||
#define SYS_DYNAMIC_H
|
||||
|
||||
#include "types.h"
|
||||
#include "PR/mbi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SYSDYNAMIC_START_MAGIC 0x1234
|
||||
#define SYSDYNAMIC_END_MAGIC 0x5678
|
||||
|
||||
#define SHADOW_SIZE 512
|
||||
#define LIGHT_SIZE 256
|
||||
#define LINE_XLU_SIZE 9952
|
||||
#define OVERLAY_SIZE 2048
|
||||
#define LINE_OPA_SIZE 1024
|
||||
#define WORK_SIZE 128
|
||||
#define UNK_BUF0_SIZE 32
|
||||
#define POLY_OPA_SIZE 1792
|
||||
#define POLY_XLU_SIZE 512
|
||||
#define FONT_SIZE 256
|
||||
|
||||
typedef struct dynamic_s {
|
||||
u16 start_magic;
|
||||
|
||||
Gfx line_xlu[LINE_XLU_SIZE];
|
||||
Gfx overlay[OVERLAY_SIZE];
|
||||
Gfx line_opa[LINE_OPA_SIZE];
|
||||
Gfx work[WORK_SIZE];
|
||||
Gfx unused[UNK_BUF0_SIZE];
|
||||
Gfx poly_opa[POLY_OPA_SIZE];
|
||||
Gfx poly_xlu[POLY_XLU_SIZE];
|
||||
Gfx font[FONT_SIZE];
|
||||
Gfx shadow[SHADOW_SIZE];
|
||||
Gfx light[LIGHT_SIZE];
|
||||
u16 end_magic;
|
||||
|
||||
} dynamic_t;
|
||||
|
||||
extern dynamic_t sys_dynamic;
|
||||
|
||||
#define SYSDYNAMIC_OPEN() \
|
||||
do { \
|
||||
dynamic_t* __dyn = &sys_dynamic;\
|
||||
while (0)
|
||||
|
||||
#define SYSDYNAMIC_CLOSE() \
|
||||
(void)__dyn; \
|
||||
} while (0)
|
||||
|
||||
#define SYSDYNAMIC_CHECK_START() (__dyn->start_magic == SYSDYNAMIC_START_MAGIC)
|
||||
#define SYSDYNAMIC_CHECK_END() (__dyn->end_magic == SYSDYNAMIC_END_MAGIC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef SYS_UCODE_H
|
||||
#define SYS_UCODE_H
|
||||
|
||||
#include "types.h"
|
||||
#include "PR/mbi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ucode_info_s {
|
||||
int type;
|
||||
void* ucode_p;
|
||||
} ucode_info;
|
||||
|
||||
#define UCODE_TYPE_POLY_TEXT 1
|
||||
#define UCODE_TYPE_POLY_DATA 2
|
||||
#define UCODE_TYPE_SPRITE_TEXT 3
|
||||
#define UCODE_TYPE_SPRITE_DATA 4
|
||||
|
||||
extern long long int gspF3DZEX2_NoN_PosLight_fifoDataStart[];
|
||||
extern long long int gspF3DZEX2_Non_PosLight_fifoTextStart[];
|
||||
|
||||
extern long long int gspS2DEX2_fifoDataStart[];
|
||||
extern long long int gspS2DEX2_fifoTextStart[];
|
||||
|
||||
extern long long int* ucode_GetPolyTextStart();
|
||||
extern long long int* ucode_GetPolyDataStart();
|
||||
extern long long int* ucode_GetSpriteTextStart();
|
||||
extern long long int* ucode_GetSpriteDataStart();
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+12
-21
@@ -4,8 +4,10 @@
|
||||
#include "types.h"
|
||||
|
||||
#include "dolphin/os.h"
|
||||
//#include "JSystem/JUT/JUTAssertion.h"
|
||||
//#include "JSystem/JUT/JUTDbPrint.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct zuru_keycheck {
|
||||
u8 state;
|
||||
@@ -14,29 +16,14 @@ typedef struct zuru_keycheck {
|
||||
u8 zurumode_enabled;
|
||||
} zuru_keycheck;
|
||||
|
||||
typedef struct {
|
||||
u8 pad_pattern;
|
||||
void (*callback)(void*);
|
||||
void* callback_param;
|
||||
void (*callback2)(void*);
|
||||
void* callback2_param;
|
||||
} padmgr;
|
||||
|
||||
extern padmgr padmgr_class;
|
||||
|
||||
extern s32 zurumode_flag;
|
||||
void zurumode_cleanup(void);
|
||||
int zerucheck_init(zuru_keycheck* key_check);
|
||||
s32 zurumode_update(void);
|
||||
void zurumode_callback(void* padmgr);
|
||||
int zerucheck_key_check(zuru_keycheck* key_check, u32 controller);
|
||||
|
||||
extern void zurumode_cleanup(void);
|
||||
extern void zurumode_init(void);
|
||||
|
||||
#define ZURUMODE_RESET 0
|
||||
#define ZURUMODE_PROGRESSING 1
|
||||
|
||||
#define OS_APP_NMI_ZURUMODE_IDX 15
|
||||
|
||||
|
||||
#define BUTTON_NONE 0x0000
|
||||
#define BUTTON_CRIGHT 0x0001
|
||||
#define BUTTON_CLEFT 0x0002
|
||||
@@ -76,4 +63,8 @@ enum zurumode_stage {
|
||||
ZURUMODE_STAGE_FINAL_e = ZURUMODE_STAGE_11_e
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+288
@@ -0,0 +1,288 @@
|
||||
#include "graph.h"
|
||||
|
||||
#include "audio.h"
|
||||
#include "dvderr.h"
|
||||
#include "famicom_emu.h"
|
||||
#include "first_game.h"
|
||||
#include "game.h"
|
||||
#include "irqmgr.h"
|
||||
#include "libc64/malloc.h"
|
||||
#include "libforest/emu64/emu64_wrapper.h"
|
||||
#include "libjsys/jsyswrapper.h"
|
||||
#include "libu64/debug.h"
|
||||
#include "libultra/libultra.h"
|
||||
#include "m_bgm.h"
|
||||
#include "m_debug.h"
|
||||
#include "m_game_dlftbls.h"
|
||||
#include "m_play.h"
|
||||
#include "m_prenmi.h"
|
||||
#include "m_select.h"
|
||||
#include "m_trademark.h"
|
||||
#include "m_vibctl.h"
|
||||
#include "player_select.h"
|
||||
#include "save_menu.h"
|
||||
#include "second_game.h"
|
||||
#include "sys_dynamic.h"
|
||||
#include "sys_ucode.h"
|
||||
#include "zurumode.h"
|
||||
|
||||
GRAPH graph_class;
|
||||
|
||||
static int skip_frame; // TODO: this is actually declared in graph_main
|
||||
u8 SoftResetEnable;
|
||||
static int frame; // TODO: this is actually declared in graph_task_set00
|
||||
|
||||
#define CONSTRUCT_THA_GA(tha_ga, name, name2) \
|
||||
(THA_GA_ct((tha_ga), sys_dynamic.##name, ##name2##_SIZE * sizeof(Gfx)))
|
||||
|
||||
static void graph_setup_double_buffer(GRAPH* this) {
|
||||
bzero(&sys_dynamic, sizeof(dynamic_t));
|
||||
sys_dynamic.start_magic = SYSDYNAMIC_START_MAGIC;
|
||||
sys_dynamic.end_magic = SYSDYNAMIC_END_MAGIC;
|
||||
|
||||
CONSTRUCT_THA_GA(&this->shadow_thaga, shadow, SHADOW);
|
||||
CONSTRUCT_THA_GA(&this->light_thaga, light, LIGHT);
|
||||
CONSTRUCT_THA_GA(&this->line_translucent_thaga, line_xlu, LINE_XLU);
|
||||
CONSTRUCT_THA_GA(&this->overlay_thaga, overlay, OVERLAY);
|
||||
CONSTRUCT_THA_GA(&this->line_opaque_thaga, line_opa, LINE_OPA);
|
||||
CONSTRUCT_THA_GA(&this->work_thaga, work, WORK);
|
||||
CONSTRUCT_THA_GA(&this->polygon_opaque_thaga, poly_opa, POLY_OPA);
|
||||
CONSTRUCT_THA_GA(&this->polygon_translucent_thaga, poly_xlu, POLY_XLU);
|
||||
CONSTRUCT_THA_GA(&this->font_thaga, font, FONT);
|
||||
|
||||
this->Gfx_list10 = sys_dynamic.shadow;
|
||||
this->Gfx_list11 = sys_dynamic.light;
|
||||
this->Gfx_list00 = sys_dynamic.line_xlu;
|
||||
this->Gfx_list01 = sys_dynamic.overlay;
|
||||
this->Gfx_list04 = sys_dynamic.line_opa;
|
||||
this->Gfx_list05 = sys_dynamic.work;
|
||||
this->Gfx_list07 = sys_dynamic.poly_opa;
|
||||
this->Gfx_list08 = sys_dynamic.poly_xlu;
|
||||
this->Gfx_list09 = sys_dynamic.font;
|
||||
|
||||
this->gfxsave = NULL;
|
||||
}
|
||||
|
||||
#define ARE_INIT_PROCS_EQUAL(proc0, proc1) \
|
||||
(((void (*)(GAME*))proc0) == ((void (*)(GAME*))proc1))
|
||||
static DLFTBL_GAME* game_get_next_game_dlftbl(GAME* game) {
|
||||
void (*next_game_init_proc)(GAME*) = game_get_next_game_init(game);
|
||||
|
||||
if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, first_game_init)) {
|
||||
return &game_dlftbls[0];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, select_init)) {
|
||||
return &game_dlftbls[1];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, play_init)) {
|
||||
return &game_dlftbls[2];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, second_game_init)) {
|
||||
return &game_dlftbls[3];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, trademark_init)) {
|
||||
return &game_dlftbls[5];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, player_select_init)) {
|
||||
return &game_dlftbls[6];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, save_menu_init)) {
|
||||
return &game_dlftbls[7];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, famicom_emu_init)) {
|
||||
return &game_dlftbls[8];
|
||||
} else if (ARE_INIT_PROCS_EQUAL(next_game_init_proc, prenmi_init)) {
|
||||
return &game_dlftbls[9];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern void graph_ct(GRAPH* this) {
|
||||
bzero(this, sizeof(GRAPH));
|
||||
this->frame_counter = 0;
|
||||
this->cfb_bank = 0;
|
||||
SETREG(SREG, 33, GETREG(SREG, 33) & ~2);
|
||||
SETREG(SREG, 33, GETREG(SREG, 33) & ~1);
|
||||
zurumode_init();
|
||||
GRAPH_SET_DOING_POINT(this, CT);
|
||||
}
|
||||
|
||||
extern void graph_dt(GRAPH* this) {
|
||||
GRAPH_SET_DOING_POINT(this, DT);
|
||||
zurumode_cleanup();
|
||||
}
|
||||
|
||||
static void graph_task_set00(GRAPH* this) {
|
||||
ucode_info ucode[2];
|
||||
|
||||
GRAPH_SET_DOING_POINT(this, WAIT_TASK);
|
||||
GRAPH_SET_DOING_POINT(this, WAIT_TASK_FINISHED);
|
||||
if (ResetStatus < IRQ_RESET_DELAY) {
|
||||
this->last_dl = this->Gfx_list05;
|
||||
if (this->taskEndCallback != NULL) {
|
||||
this->taskEndCallback(this, this->taskEndData);
|
||||
}
|
||||
|
||||
if (ResetStatus < IRQ_RESET_DELAY) {
|
||||
ucode[0].type = UCODE_TYPE_POLY_TEXT;
|
||||
ucode[1].type = UCODE_TYPE_SPRITE_TEXT;
|
||||
ucode[0].ucode_p = ucode_GetPolyTextStart();
|
||||
ucode[1].ucode_p = ucode_GetSpriteTextStart();
|
||||
JW_BeginFrame();
|
||||
emu64_init();
|
||||
emu64_set_ucode_info(2, ucode);
|
||||
emu64_set_first_ucode(ucode[0].ucode_p);
|
||||
emu64_taskstart(this->Gfx_list05); /* work data */
|
||||
emu64_cleanup();
|
||||
JW_EndFrame();
|
||||
frame++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int graph_draw_finish(GRAPH* this) {
|
||||
int err;
|
||||
OPEN_DISP(this);
|
||||
|
||||
gSPBranchList(NOW_WORK_DISP++, this->Gfx_list10);
|
||||
gSPBranchList(NOW_SHADOW_DISP++, this->Gfx_list08);
|
||||
gSPBranchList(NOW_POLY_XLU_DISP++, this->Gfx_list11);
|
||||
gSPBranchList(NOW_LIGHT_DISP++, this->Gfx_list00);
|
||||
gSPBranchList(NOW_LINE_XLU_DISP++, this->Gfx_list01);
|
||||
gSPBranchList(NOW_OVERLAY_DISP++, this->Gfx_list09);
|
||||
gSPBranchList(NOW_FONT_DISP++, this->Gfx_list07);
|
||||
gSPBranchList(NOW_POLY_OPA_DISP++, this->Gfx_list04);
|
||||
gDPPipeSync(NOW_LINE_OPA_DISP++);
|
||||
gDPFullSync(NOW_LINE_OPA_DISP++);
|
||||
gSPEndDisplayList(NOW_LINE_OPA_DISP++);
|
||||
|
||||
CLOSE_DISP(this);
|
||||
err = FALSE;
|
||||
|
||||
SYSDYNAMIC_OPEN();
|
||||
if (!SYSDYNAMIC_CHECK_START()) {
|
||||
_dbg_hungup(__FILE__, 417);
|
||||
}
|
||||
|
||||
if (!SYSDYNAMIC_CHECK_END()) {
|
||||
err = TRUE;
|
||||
_dbg_hungup(__FILE__, 425);
|
||||
}
|
||||
SYSDYNAMIC_CLOSE();
|
||||
|
||||
if (THA_GA_isCrash(&this->line_translucent_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->overlay_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->line_opaque_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->polygon_opaque_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->polygon_translucent_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->font_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->shadow_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
if (THA_GA_isCrash(&this->light_thaga)) {
|
||||
err = TRUE;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void do_soft_reset(GAME* game) {
|
||||
SoftResetEnable = FALSE;
|
||||
mBGM_reset();
|
||||
mVibctl_reset();
|
||||
sAdo_SoftReset();
|
||||
ResetTime = osGetTime();
|
||||
ResetStatus = IRQ_RESET_PRENMI;
|
||||
}
|
||||
|
||||
static void reset_check(GRAPH* this, GAME* game) {
|
||||
if (SoftResetEnable && osShutdown) {
|
||||
do_soft_reset(game);
|
||||
}
|
||||
}
|
||||
|
||||
static void graph_main(GRAPH* this, GAME* game) {
|
||||
game->disable_prenmi = FALSE;
|
||||
graph_setup_double_buffer(this);
|
||||
game_get_controller(game);
|
||||
game->disable_display = FALSE;
|
||||
GRAPH_SET_DOING_POINT(this, GAME_MAIN);
|
||||
game_main(game);
|
||||
GRAPH_SET_DOING_POINT(this, GAME_MAIN_FINISHED);
|
||||
if (ResetStatus < IRQ_RESET_DELAY) {
|
||||
if (skip_frame < GETREG(SREG, 3)) {
|
||||
skip_frame++;
|
||||
this->frame_counter++;
|
||||
} else if (game->disable_display == FALSE) {
|
||||
skip_frame = 0;
|
||||
if (graph_draw_finish(this) == FALSE) {
|
||||
GRAPH_SET_DOING_POINT(this, TASK_SET);
|
||||
graph_task_set00(this);
|
||||
GRAPH_SET_DOING_POINT(this, TASK_SET_FINISHED);
|
||||
this->frame_counter++;
|
||||
|
||||
if ((GETREG(SREG, 33) & 1) != 0) {
|
||||
SETREG(SREG, 33, GETREG(SREG, 33) & ~1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GETREG(SREG, 20) < 2) {
|
||||
GRAPH_SET_DOING_POINT(this, AUDIO);
|
||||
sAdo_GameFrame();
|
||||
GRAPH_SET_DOING_POINT(this, AUDIO_FINISHED);
|
||||
}
|
||||
|
||||
reset_check(this, game);
|
||||
|
||||
if (ResetStatus == IRQ_RESET_PRENMI && game->disable_prenmi == FALSE) {
|
||||
GAME_GOTO_NEXT(game, prenmi, PRENMI);
|
||||
}
|
||||
}
|
||||
|
||||
extern void graph_proc(void* arg) {
|
||||
GRAPH* __graph = &graph_class;
|
||||
DLFTBL_GAME* dlftbl = &game_dlftbls[0];
|
||||
graph_ct(&graph_class);
|
||||
|
||||
while (dlftbl != NULL) {
|
||||
size_t size = dlftbl->alloc_size;
|
||||
GAME* game = (GAME*)malloc(size);
|
||||
game_class_p = game;
|
||||
bzero(game, size);
|
||||
GRAPH_SET_DOING_POINT(__graph, GAME_CT);
|
||||
game_ct(game, dlftbl->init, __graph);
|
||||
emu64_refresh();
|
||||
GRAPH_SET_DOING_POINT(__graph, GAME_CT_FINISHED);
|
||||
|
||||
while (game_is_doing(game)) {
|
||||
if (!dvderr_draw()) {
|
||||
graph_main(__graph, game);
|
||||
}
|
||||
}
|
||||
|
||||
dlftbl = game_get_next_game_dlftbl(game);
|
||||
GRAPH_SET_DOING_POINT(__graph, GAME_18);
|
||||
GRAPH_SET_DOING_POINT(__graph, GAME_DT);
|
||||
game_dt(game);
|
||||
GRAPH_SET_DOING_POINT(__graph, GAME_DT_FINISHED);
|
||||
free(game);
|
||||
game_class_p = NULL;
|
||||
}
|
||||
|
||||
graph_dt(__graph);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "m_debug.h"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "m_game_dlftbls.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "first_game.h"
|
||||
#include "m_select.h"
|
||||
#include "m_play.h"
|
||||
#include "second_game.h"
|
||||
#include "m_trademark.h"
|
||||
#include "player_select.h"
|
||||
#include "save_menu.h"
|
||||
#include "famicom_emu.h"
|
||||
#include "m_prenmi.h"
|
||||
|
||||
#define DLFTBL_MAKE(name, class) \
|
||||
{ NULL, 0, 0, NULL, NULL, NULL, name##_init, name##_cleanup, NULL, NULL, NULL, sizeof(GAME_##class) }
|
||||
#define DLFTBL_NULL() \
|
||||
{ NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 }
|
||||
|
||||
DLFTBL_GAME game_dlftbls[] = {
|
||||
DLFTBL_MAKE(first_game, FIRST),
|
||||
DLFTBL_MAKE(select, SELECT),
|
||||
DLFTBL_MAKE(play, PLAY),
|
||||
DLFTBL_MAKE(second_game, SECOND),
|
||||
DLFTBL_NULL(), /* removed & unused _GAME entry */
|
||||
DLFTBL_MAKE(trademark, TRADEMARK),
|
||||
DLFTBL_MAKE(player_select, PLAYER_SELECT),
|
||||
DLFTBL_MAKE(save_menu, SAVE_MENU),
|
||||
DLFTBL_MAKE(famicom_emu, FAMICOM_EMU),
|
||||
DLFTBL_MAKE(prenmi, PRENMI)
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "sys_dynamic.h"
|
||||
|
||||
dynamic_t sys_dynamic;
|
||||
@@ -1,172 +1,241 @@
|
||||
#include "zurumode.h"
|
||||
#include "libultra/libultra.h"
|
||||
|
||||
/**
|
||||
* @brief Checks that the current controller state is correct
|
||||
* and updates zurumode enable progress accordingly
|
||||
*
|
||||
* Zurumode code:
|
||||
* 1) L + R -> L + R + Z (Hold L & R, then press Z)
|
||||
* 2) D-Pad Up
|
||||
* 3) C-Stick Down
|
||||
* 4) C-Stick Up
|
||||
* 5) D-Pad Down
|
||||
* 6) D-Pad Left
|
||||
* 7) C-Stick Left
|
||||
* 8) C-Stick Right
|
||||
* 9) D-Pad Right
|
||||
* 10) A + B
|
||||
* 11) Start
|
||||
*
|
||||
* @param key_check zurumode keycheck struct
|
||||
* @param controller current controller state
|
||||
* @return int zurumodeEnabled
|
||||
*/
|
||||
int zerucheck_key_check(zuru_keycheck* key_check, u32 controller) {
|
||||
u32 controller_new; /* Buttons pressed on the current frame only */
|
||||
int state = key_check->state; /* Keycheck state */
|
||||
int progressing = key_check->progressing; /* Progressing through keycheck */
|
||||
|
||||
if (state != ZURUMODE_STAGE_FINAL_e) {
|
||||
u16 controller_now = controller;
|
||||
controller_new =
|
||||
controller_now & (key_check->last_controller ^ controller_now);
|
||||
key_check->last_controller = controller_now;
|
||||
|
||||
if (controller_now == BUTTON_NONE && progressing == ZURUMODE_PROGRESSING) {
|
||||
progressing = ZURUMODE_RESET;
|
||||
} else if (controller_new != BUTTON_NONE) {
|
||||
if (progressing == ZURUMODE_PROGRESSING) {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case ZURUMODE_STAGE_BEGIN_e:
|
||||
/* L & R must be held first, then Z */
|
||||
if (controller_now == (BUTTON_R | BUTTON_L | BUTTON_Z) &&
|
||||
controller_new == BUTTON_Z) {
|
||||
state = ZURUMODE_STAGE_1_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_1_e:
|
||||
if (controller_new == BUTTON_DUP) {
|
||||
state = ZURUMODE_STAGE_2_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_2_e:
|
||||
if (controller_new == BUTTON_CDOWN) {
|
||||
state = ZURUMODE_STAGE_3_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_3_e:
|
||||
if (controller_new == BUTTON_CUP) {
|
||||
state = ZURUMODE_STAGE_4_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_4_e:
|
||||
if (controller_new == BUTTON_DDOWN) {
|
||||
state = ZURUMODE_STAGE_5_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_5_e:
|
||||
if (controller_new == BUTTON_DLEFT) {
|
||||
state = ZURUMODE_STAGE_6_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_6_e:
|
||||
if (controller_new == BUTTON_CLEFT) {
|
||||
state = ZURUMODE_STAGE_7_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_7_e:
|
||||
if (controller_new == BUTTON_CRIGHT) {
|
||||
state = ZURUMODE_STAGE_8_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_8_e:
|
||||
if (controller_new == BUTTON_DRIGHT) {
|
||||
state = ZURUMODE_STAGE_9_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_9_e:
|
||||
if (controller_new == (BUTTON_B | BUTTON_A)) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else if (controller_new == BUTTON_A) {
|
||||
state = ZURUMODE_STAGE_91_e;
|
||||
} else if (controller_new == BUTTON_B) {
|
||||
state = ZURUMODE_STAGE_92_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_91_e:
|
||||
if (controller_new == BUTTON_B) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_92_e:
|
||||
if (controller_new == BUTTON_A) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_10_e:
|
||||
if (controller_new == BUTTON_START) {
|
||||
state = ZURUMODE_STAGE_FINAL_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == ZURUMODE_STAGE_FINAL_e) {
|
||||
/* Zurumode code has been correctly input */
|
||||
key_check->zurumode_enabled ^= TRUE;
|
||||
key_check->state = ZURUMODE_STAGE_BEGIN_e;
|
||||
key_check->progressing = ZURUMODE_RESET;
|
||||
} else {
|
||||
key_check->state = state;
|
||||
key_check->progressing = progressing;
|
||||
}
|
||||
|
||||
return key_check->zurumode_enabled;
|
||||
}
|
||||
|
||||
#include "zurumode.h"
|
||||
|
||||
#include "m_nmibuf.h"
|
||||
#include "padmgr.h"
|
||||
#include "jsyswrap.h"
|
||||
#include "types.h"
|
||||
|
||||
static zuru_keycheck zuruKeyCheck;
|
||||
s32 zurumode_flag;
|
||||
|
||||
static int zerucheck_init(zuru_keycheck* key_check) {
|
||||
key_check->zurumode_enabled = FALSE;
|
||||
key_check->state = ZURUMODE_STAGE_BEGIN_e;
|
||||
key_check->progressing = ZURUMODE_RESET;
|
||||
key_check->last_controller = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the current controller state is correct
|
||||
* and updates zurumode enable progress accordingly
|
||||
*
|
||||
* Zurumode code:
|
||||
* 1) L + R -> L + R + Z (Hold L & R, then press Z)
|
||||
* 2) D-Pad Up
|
||||
* 3) C-Stick Down
|
||||
* 4) C-Stick Up
|
||||
* 5) D-Pad Down
|
||||
* 6) D-Pad Left
|
||||
* 7) C-Stick Left
|
||||
* 8) C-Stick Right
|
||||
* 9) D-Pad Right
|
||||
* 10) A + B
|
||||
* 11) Start
|
||||
*
|
||||
* Params:
|
||||
* key_check zurumode keycheck struct
|
||||
* controller current controller state
|
||||
*
|
||||
* returns int zurumodeEnabled
|
||||
*/
|
||||
static int zerucheck_key_check(zuru_keycheck* key_check, u32 controller) {
|
||||
u32 controller_new; /* Buttons pressed on the current frame only */
|
||||
int state = key_check->state; /* Keycheck state */
|
||||
int progressing = key_check->progressing; /* Progressing through keycheck */
|
||||
|
||||
if (state != ZURUMODE_STAGE_FINAL_e) {
|
||||
u16 controller_now = controller;
|
||||
controller_new =
|
||||
controller_now & (key_check->last_controller ^ controller_now);
|
||||
key_check->last_controller = controller_now;
|
||||
|
||||
if (controller_now == BUTTON_NONE && progressing == ZURUMODE_PROGRESSING) {
|
||||
progressing = ZURUMODE_RESET;
|
||||
} else if (controller_new != BUTTON_NONE) {
|
||||
if (progressing == ZURUMODE_PROGRESSING) {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case ZURUMODE_STAGE_BEGIN_e:
|
||||
/* L & R must be held first, then Z */
|
||||
if (controller_now == (BUTTON_R | BUTTON_L | BUTTON_Z) &&
|
||||
controller_new == BUTTON_Z) {
|
||||
state = ZURUMODE_STAGE_1_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_1_e:
|
||||
if (controller_new == BUTTON_DUP) {
|
||||
state = ZURUMODE_STAGE_2_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_2_e:
|
||||
if (controller_new == BUTTON_CDOWN) {
|
||||
state = ZURUMODE_STAGE_3_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_3_e:
|
||||
if (controller_new == BUTTON_CUP) {
|
||||
state = ZURUMODE_STAGE_4_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_4_e:
|
||||
if (controller_new == BUTTON_DDOWN) {
|
||||
state = ZURUMODE_STAGE_5_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_5_e:
|
||||
if (controller_new == BUTTON_DLEFT) {
|
||||
state = ZURUMODE_STAGE_6_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_6_e:
|
||||
if (controller_new == BUTTON_CLEFT) {
|
||||
state = ZURUMODE_STAGE_7_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_7_e:
|
||||
if (controller_new == BUTTON_CRIGHT) {
|
||||
state = ZURUMODE_STAGE_8_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_8_e:
|
||||
if (controller_new == BUTTON_DRIGHT) {
|
||||
state = ZURUMODE_STAGE_9_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_9_e:
|
||||
if (controller_new == (BUTTON_B | BUTTON_A)) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else if (controller_new == BUTTON_A) {
|
||||
state = ZURUMODE_STAGE_91_e;
|
||||
} else if (controller_new == BUTTON_B) {
|
||||
state = ZURUMODE_STAGE_92_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_91_e:
|
||||
if (controller_new == BUTTON_B) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_92_e:
|
||||
if (controller_new == BUTTON_A) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_10_e:
|
||||
if (controller_new == BUTTON_START) {
|
||||
state = ZURUMODE_STAGE_FINAL_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == ZURUMODE_STAGE_FINAL_e) {
|
||||
/* Zurumode code has been correctly input */
|
||||
key_check->zurumode_enabled ^= TRUE;
|
||||
key_check->state = ZURUMODE_STAGE_BEGIN_e;
|
||||
key_check->progressing = ZURUMODE_RESET;
|
||||
} else {
|
||||
key_check->state = state;
|
||||
key_check->progressing = progressing;
|
||||
}
|
||||
|
||||
return key_check->zurumode_enabled;
|
||||
}
|
||||
|
||||
static s32 zurumode_update() {
|
||||
s32 flag_now;
|
||||
s32 zurumode_now;
|
||||
|
||||
flag_now = zurumode_flag;
|
||||
zurumode_flag = zurumode_now = (APPNMI_ZURUMODE_GET()) ? (APPNMI_ZURUMODE2_GET() ? 2 : 1) : 0;
|
||||
|
||||
if (flag_now != zurumode_now) {
|
||||
OSReport("zurumode_flag が %d から %d に変更されました\n", flag_now,
|
||||
zurumode_now);
|
||||
if (zurumode_flag != 0) {
|
||||
if (APPNMI_TESTMODE_GET() || APPNMI_ZURUMODE_GET()) {
|
||||
JC_JUTAssertion_changeDevice(3);
|
||||
JC_JUTDbPrint_setVisible(JC_JUTDbPrint_getManager(), 1);
|
||||
}
|
||||
} else {
|
||||
JC_JUTAssertion_changeDevice(2);
|
||||
JC_JUTDbPrint_setVisible(JC_JUTDbPrint_getManager(), 0);
|
||||
}
|
||||
}
|
||||
return zurumode_flag;
|
||||
}
|
||||
|
||||
static void zurumode_callback(void* param) {
|
||||
zerucheck_key_check(&zuruKeyCheck, (u32)(((padmgr*)param)->n64_pads[1].button));
|
||||
if (APPNMI_DEBUGMODE_GET() ||
|
||||
(APPNMI_TESTMODE_GET() && (padmgr_isConnectedController(1) != 0)) ||
|
||||
(zuruKeyCheck.zurumode_enabled != 0)) {
|
||||
APPNMI_ZURUMODE_SET();
|
||||
} else {
|
||||
APPNMI_ZURUMODE_CLR();
|
||||
}
|
||||
if (APPNMI_DEBUGMODE_GET() &&
|
||||
(zuruKeyCheck.state != 0) && (zuruKeyCheck.zurumode_enabled == 0)) {
|
||||
JW_JUTReport(60, 90, 1, "ZURU %d/%d", zuruKeyCheck.state,
|
||||
zuruKeyCheck.progressing);
|
||||
}
|
||||
|
||||
zurumode_update();
|
||||
}
|
||||
|
||||
extern void zurumode_init(void) {
|
||||
zurumode_flag = 0;
|
||||
zerucheck_init(&zuruKeyCheck);
|
||||
zuruKeyCheck.zurumode_enabled = APPNMI_ZURUMODE_GET();
|
||||
padmgr_setClient2(zurumode_callback, &padmgr_class);
|
||||
zurumode_update();
|
||||
}
|
||||
|
||||
extern void zurumode_cleanup(void) {
|
||||
padmgr_removeClient2(zurumode_callback, &padmgr_class);
|
||||
zurumode_flag = 0;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#include "zurumode.h"
|
||||
#include "libultra/libultra.h"
|
||||
int zerucheck_init(zuru_keycheck* key_check) {
|
||||
key_check->zurumode_enabled = FALSE;
|
||||
key_check->state = ZURUMODE_STAGE_BEGIN_e;
|
||||
key_check->progressing = ZURUMODE_RESET;
|
||||
key_check->last_controller = 0;
|
||||
}
|
||||
@@ -1,249 +0,0 @@
|
||||
#include "zurumode.h"
|
||||
|
||||
static zuru_keycheck zuruKeyCheck;
|
||||
static s32 zurumode_flag;
|
||||
|
||||
int zerucheck_init(zuru_keycheck* key_check) {
|
||||
key_check->zurumode_enabled = FALSE;
|
||||
key_check->state = ZURUMODE_STAGE_BEGIN_e;
|
||||
key_check->progressing = ZURUMODE_RESET;
|
||||
key_check->last_controller = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the current controller state is correct
|
||||
* and updates zurumode enable progress accordingly
|
||||
*
|
||||
* Zurumode code:
|
||||
* 1) L + R -> L + R + Z (Hold L & R, then press Z)
|
||||
* 2) D-Pad Up
|
||||
* 3) C-Stick Down
|
||||
* 4) C-Stick Up
|
||||
* 5) D-Pad Down
|
||||
* 6) D-Pad Left
|
||||
* 7) C-Stick Left
|
||||
* 8) C-Stick Right
|
||||
* 9) D-Pad Right
|
||||
* 10) A + B
|
||||
* 11) Start
|
||||
*
|
||||
* Params:
|
||||
* key_check zurumode keycheck struct
|
||||
* controller current controller state
|
||||
*
|
||||
* returns int zurumodeEnabled
|
||||
*/
|
||||
int zerucheck_key_check(zuru_keycheck* key_check, u32 controller) {
|
||||
u32 controller_new; /* Buttons pressed on the current frame only */
|
||||
int state = key_check->state; /* Keycheck state */
|
||||
int progressing = key_check->progressing; /* Progressing through keycheck */
|
||||
|
||||
if (state != ZURUMODE_STAGE_FINAL_e) {
|
||||
u16 controller_now = controller;
|
||||
controller_new =
|
||||
controller_now & (key_check->last_controller ^ controller_now);
|
||||
key_check->last_controller = controller_now;
|
||||
|
||||
if (controller_now == BUTTON_NONE && progressing == ZURUMODE_PROGRESSING) {
|
||||
progressing = ZURUMODE_RESET;
|
||||
} else if (controller_new != BUTTON_NONE) {
|
||||
if (progressing == ZURUMODE_PROGRESSING) {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case ZURUMODE_STAGE_BEGIN_e:
|
||||
/* L & R must be held first, then Z */
|
||||
if (controller_now == (BUTTON_R | BUTTON_L | BUTTON_Z) &&
|
||||
controller_new == BUTTON_Z) {
|
||||
state = ZURUMODE_STAGE_1_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_1_e:
|
||||
if (controller_new == BUTTON_DUP) {
|
||||
state = ZURUMODE_STAGE_2_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_2_e:
|
||||
if (controller_new == BUTTON_CDOWN) {
|
||||
state = ZURUMODE_STAGE_3_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_3_e:
|
||||
if (controller_new == BUTTON_CUP) {
|
||||
state = ZURUMODE_STAGE_4_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_4_e:
|
||||
if (controller_new == BUTTON_DDOWN) {
|
||||
state = ZURUMODE_STAGE_5_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_5_e:
|
||||
if (controller_new == BUTTON_DLEFT) {
|
||||
state = ZURUMODE_STAGE_6_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_6_e:
|
||||
if (controller_new == BUTTON_CLEFT) {
|
||||
state = ZURUMODE_STAGE_7_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_7_e:
|
||||
if (controller_new == BUTTON_CRIGHT) {
|
||||
state = ZURUMODE_STAGE_8_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_8_e:
|
||||
if (controller_new == BUTTON_DRIGHT) {
|
||||
state = ZURUMODE_STAGE_9_e;
|
||||
progressing = ZURUMODE_PROGRESSING;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_9_e:
|
||||
if (controller_new == (BUTTON_B | BUTTON_A)) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else if (controller_new == BUTTON_A) {
|
||||
state = ZURUMODE_STAGE_91_e;
|
||||
} else if (controller_new == BUTTON_B) {
|
||||
state = ZURUMODE_STAGE_92_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_91_e:
|
||||
if (controller_new == BUTTON_B) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_92_e:
|
||||
if (controller_new == BUTTON_A) {
|
||||
state = ZURUMODE_STAGE_10_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZURUMODE_STAGE_10_e:
|
||||
if (controller_new == BUTTON_START) {
|
||||
state = ZURUMODE_STAGE_FINAL_e;
|
||||
} else {
|
||||
state = ZURUMODE_STAGE_BEGIN_e;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state == ZURUMODE_STAGE_FINAL_e) {
|
||||
/* Zurumode code has been correctly input */
|
||||
key_check->zurumode_enabled ^= TRUE;
|
||||
key_check->state = ZURUMODE_STAGE_BEGIN_e;
|
||||
key_check->progressing = ZURUMODE_RESET;
|
||||
} else {
|
||||
key_check->state = state;
|
||||
key_check->progressing = progressing;
|
||||
}
|
||||
|
||||
return key_check->zurumode_enabled;
|
||||
}
|
||||
|
||||
s32 zurumode_update() {
|
||||
s32 flag_now;
|
||||
s32 zurumode_now;
|
||||
|
||||
flag_now = zurumode_flag;
|
||||
zurumode_now = osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX];
|
||||
|
||||
if (zurumode_now & 1) {
|
||||
zurumode_now = (zurumode_now >> 3) & 1;
|
||||
zurumode_now = (int)(zurumode_now + 1);
|
||||
}
|
||||
else {
|
||||
zurumode_now = 0;
|
||||
}
|
||||
zurumode_flag = zurumode_now;
|
||||
|
||||
if (flag_now != zurumode_now) {
|
||||
OSReport("zurumode_flag が %d から %d に変更されました\n", flag_now, zurumode_now);
|
||||
if (zurumode_flag != 0) {
|
||||
if ((osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] & 0x40) || (osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] & 1)) {
|
||||
JC_JUTAssertion_changeDevice(3);
|
||||
JC_JUTDbPrint_setVisible(JC_JUTDbPrint_getManager(), 1);
|
||||
}
|
||||
} else {
|
||||
JC_JUTAssertion_changeDevice(2);
|
||||
JC_JUTDbPrint_setVisible(JC_JUTDbPrint_getManager(), 0);
|
||||
}
|
||||
}
|
||||
return zurumode_flag;
|
||||
}
|
||||
|
||||
void zurumode_callback(padmgr* padmgr) {
|
||||
u32 val;
|
||||
zerucheck_key_check(&zuruKeyCheck, (u32)(padmgr->pad_pattern));
|
||||
val = osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX];
|
||||
if ((val & 0x20) || ((val & 0x40) && (padmgr_isConnectedController(1) != 0)) || (zuruKeyCheck.zurumode_enabled != 0)){
|
||||
osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] = (osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] | 1);
|
||||
} else {
|
||||
osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] = osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] & ~0x1;
|
||||
}
|
||||
if ((osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] & 0x20) && (zuruKeyCheck.state != 0) && (zuruKeyCheck.zurumode_enabled == 0)){
|
||||
JW_JUTReport(0x3c, 0x5a, 1, "ZURU %d %d", zuruKeyCheck.state, zuruKeyCheck.progressing);
|
||||
}
|
||||
zurumode_update();
|
||||
}
|
||||
|
||||
// Padmgr struct is unknown, anyway I think it's matched,
|
||||
//just that the struct that is declared here it's not that accurate
|
||||
//and pad_pattern is at 0x42E
|
||||
|
||||
void zurumode_init(void){
|
||||
zurumode_flag = 0;
|
||||
zerucheck_init(&zuruKeyCheck);
|
||||
zuruKeyCheck.zurumode_enabled = osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] & 1;
|
||||
padmgr_class.callback2 = zurumode_callback;
|
||||
padmgr_class.callback2_param = &padmgr_class;
|
||||
zurumode_update();
|
||||
}
|
||||
|
||||
void zurumode_cleanup(void) { // Hm, this looks like PADMGR_UNSET_RETRACE_CALLBACK macro
|
||||
if ((padmgr_class.callback2 == &zurumode_callback) && (padmgr_class.callback2_param == &padmgr_class)) {
|
||||
padmgr_class.callback2 = NULL;
|
||||
padmgr_class.callback2_param = NULL;
|
||||
}
|
||||
zurumode_flag = 0;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#include "zurumode.h"
|
||||
#include "libultra/libultra.h"
|
||||
void zurumode_cleanup(void) { // Hm, this looks like PADMGR_UNSET_RETRACE_CALLBACK macro lol
|
||||
if ((padmgr_class.callback2 == &zurumode_callback) && (padmgr_class.callback2_param == &padmgr_class)) {
|
||||
padmgr_class.callback2 = NULL;
|
||||
padmgr_class.callback2_param = NULL;
|
||||
}
|
||||
zurumode_flag = 0;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#include "zurumode.h"
|
||||
#include "libultra/libultra.h"
|
||||
void zurumode_init(void){
|
||||
zurumode_flag = 0;
|
||||
zerucheck_init(&zuruKeyCheck);
|
||||
zuruKeyCheck.zurumode_enabled = osAppNMIBuffer[OS_APP_NMI_ZURUMODE_IDX] & 1;
|
||||
padmgr_class.callback2 = zurumode_callback;
|
||||
padmgr_class.callback2_param = &padmgr_class;
|
||||
zurumode_update();
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#include "zurumode.h"
|
||||
#include "libultra/libultra.h"
|
||||
s32 zurumode_update() {
|
||||
s32 flag_now;
|
||||
s32 zurumode_now;
|
||||
|
||||
flag_now = zurumode_flag;
|
||||
zurumode_now = osAppNMIBuffer[15];
|
||||
|
||||
if (zurumode_now & 1) {
|
||||
zurumode_now = (zurumode_now >> 3) & 1;
|
||||
zurumode_now = (int)(zurumode_now + 1);
|
||||
}
|
||||
else {
|
||||
zurumode_now = 0;
|
||||
}
|
||||
zurumode_flag = zurumode_now;
|
||||
|
||||
if (flag_now != zurumode_now) {
|
||||
OSReport("zurumode_flag が %d から %d に変更されました\n", flag_now, zurumode_now);
|
||||
if (zurumode_flag != 0) {
|
||||
if ((osAppNMIBuffer[15] & 0x40) || (osAppNMIBuffer[15] & 1)) {
|
||||
JC_JUTAssertion_changeDevice(3);
|
||||
JC_JUTDbPrint_setVisible(JC_JUTDbPrint_getManager(), 1);
|
||||
}
|
||||
} else {
|
||||
JC_JUTAssertion_changeDevice(2);
|
||||
JC_JUTDbPrint_setVisible(JC_JUTDbPrint_getManager(), 0);
|
||||
}
|
||||
}
|
||||
return zurumode_flag;
|
||||
+13
-11
@@ -1,25 +1,27 @@
|
||||
#include "libc64/osmalloc.h"
|
||||
#include "libc64/__osMalloc.h"
|
||||
#include "libc64/malloc.h"
|
||||
|
||||
extern Arena malloc_arena;
|
||||
Arena malloc_arena;
|
||||
|
||||
void* malloc(size_t size) {
|
||||
return(__osMalloc(&malloc_arena, size));
|
||||
}
|
||||
void free(void* ptr){
|
||||
__osFree(&malloc_arena,ptr);
|
||||
extern void* malloc(size_t size) {
|
||||
return __osMalloc(&malloc_arena, size);
|
||||
}
|
||||
|
||||
void DisplayArena(void){
|
||||
extern void free(void* ptr) {
|
||||
__osFree(&malloc_arena, ptr);
|
||||
}
|
||||
|
||||
extern void DisplayArena(void) {
|
||||
__osDisplayArena(&malloc_arena);
|
||||
}
|
||||
|
||||
void GetFreeArena(u32* max, u32* free, u32* alloc){
|
||||
extern void GetFreeArena(u32* max, u32* free, u32* alloc) {
|
||||
__osGetFreeArena(&malloc_arena, max, free, alloc);
|
||||
}
|
||||
void MallocInit(void* start, u32 size){
|
||||
extern void MallocInit(void* start, u32 size) {
|
||||
__osMallocInit(&malloc_arena, start, size);
|
||||
}
|
||||
|
||||
void MallocCleanup(void){
|
||||
extern void MallocCleanup(void) {
|
||||
__osMallocCleanup(&malloc_arena);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
|
||||
#include "MSL_C/printf.h"
|
||||
|
||||
OSMutex print_mutex;
|
||||
static BOOL __OSReport_disable;
|
||||
static OSThread* __OSReport_MonopolyThread;
|
||||
static u8 print_mutex_initialized;
|
||||
static OSMutex print_mutex;
|
||||
|
||||
extern void OSReportDisable() {
|
||||
__OSReport_disable = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user