mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Sync files
This commit is contained in:
@@ -24,10 +24,10 @@ gfxalloc.c:
|
||||
# .bss: [0x812f9670, 0x812f9680]
|
||||
#zurumode/zurumode_update.c:
|
||||
#.text: [0x8040EDA8, 0x8040ee74]
|
||||
# zurumode/zurumode.c:
|
||||
# .text: [0x8040eb38, 0x8040f008]
|
||||
# .bss: [0x812f9670, 0x812f9680]
|
||||
# .data: [0x8065F9F0, 0x8065FA20]
|
||||
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:
|
||||
|
||||
@@ -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,26 @@
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct game_s {
|
||||
/* 0x009E */ u8 disable_display;
|
||||
/* 0x00A4 */ u8 disable_prenmi;
|
||||
} GAME;
|
||||
|
||||
extern void game_ct(GAME* game);
|
||||
extern void game_dt(GAME* game);
|
||||
extern void game_main(GAME* game);
|
||||
extern u8 game_is_doing(GAME*);
|
||||
|
||||
extern GAME* game_class_p;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
#ifndef GRAPH_H
|
||||
#define GRAPH_H
|
||||
|
||||
#include "types.h"
|
||||
#include "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_18, /* This is unused? Can't find it anywhere. Perhaps only used in DnM. */
|
||||
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)(GRAPH*, 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;
|
||||
|
||||
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 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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -14,5 +14,6 @@ u32 osGetCount(void);
|
||||
OSTime osGetTime(void);
|
||||
|
||||
extern s32 osAppNMIBuffer[];
|
||||
extern int osShutdown;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/* 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
|
||||
|
||||
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,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,93 @@
|
||||
#ifndef PADMGR_H
|
||||
#define PADMGR_H
|
||||
|
||||
#include "types.h"
|
||||
#include "irqmgr.h"
|
||||
#include "libu64/pad.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAXCONTROLLERS 4
|
||||
#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,55 @@
|
||||
#ifndef SYS_DYNAMIC_H
|
||||
#define SYS_DYNAMIC_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SYSDYNAMIC_START_MAGIC 0x1234
|
||||
#define SYSDYNAMIC_END_MAGIC 0x5678
|
||||
|
||||
#define DYNAMIC_HEADER_SIZE 8
|
||||
#define DYNAMIC_EPILOG_SIZE 8
|
||||
|
||||
#define SHADOW_SIZE 0x1000
|
||||
#define LIGHT_SIZE 0x800
|
||||
#define LINE_XLU_SIZE 0x13700
|
||||
#define OVERLAY_SIZE 0x4000
|
||||
#define LINE_OPA_SIZE 0x2000
|
||||
#define WORK_SIZE 0x400
|
||||
#define UNK_BUF0_SIZE 0x100
|
||||
#define POLY_OPA_SIZE 0x3800
|
||||
#define POLY_XLU_SIZE 0x1000
|
||||
#define FONT_SIZE 0x800
|
||||
|
||||
#define SYSDYNAMIC_START (0)
|
||||
#define SYSDYNAMIC_HEADER_OFS (SYSDYNAMIC_START)
|
||||
#define LINE_XLU_OFS (SYSDYNAMIC_HEADER_OFS + DYNAMIC_HEADER_SIZE)
|
||||
#define OVERLAY_OFS (LINE_XLU_OFS + LINE_XLU_SIZE)
|
||||
#define LINE_OPA_OFS (OVERLAY_OFS + OVERLAY_SIZE)
|
||||
#define WORK_OFS (LINE_OPA_OFS + LINE_OPA_SIZE)
|
||||
#define UNUSED_OFS (WORK_OFS + WORK_SIZE)
|
||||
#define POLY_OPA_OFS (UNUSED_OFS + UNK_BUF0_SIZE)
|
||||
#define POLY_XLU_OFS (POLY_OPA_OFS + POLY_OPA_SIZE)
|
||||
#define FONT_OFS (POLY_XLU_OFS + POLY_XLU_SIZE)
|
||||
#define SHADOW_OFS (FONT_OFS + FONT_SIZE)
|
||||
#define LIGHT_OFS (SHADOW_OFS + SHADOW_SIZE)
|
||||
#define SYSDYNAMIC_EPILOG_OFS (LIGHT_OFS + LIGHT_SIZE)
|
||||
#define SYSDYNAMIC_END (SYSDYNAMIC_EPILOG_OFS + DYNAMIC_EPILOG_SIZE)
|
||||
|
||||
/* 0x20410 bytes */
|
||||
#define DYNAMIC_SIZE \
|
||||
(DYNAMIC_HEADER_SIZE + SHADOW_SIZE + LIGHT_SIZE + LINE_XLU_SIZE + OVERLAY_SIZE + LINE_OPA_SIZE + \
|
||||
WORK_SIZE + UNK_BUF0_SIZE + POLY_OPA_SIZE + POLY_XLU_SIZE + FONT_SIZE + DYNAMIC_EPILOG_SIZE)
|
||||
|
||||
static u8 sys_dynamic[DYNAMIC_SIZE];
|
||||
|
||||
#define GET_DYNAMIC_OFS(ofs) (&sys_dynamic[(ofs)])
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef SYS_UCODE_H
|
||||
#define SYS_UCODE_H
|
||||
|
||||
#include "types.h"
|
||||
#include "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
|
||||
+11
-20
@@ -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
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
#include "graph.h"
|
||||
#include "libc64/malloc.h"
|
||||
#include "libultra/libultra.h"
|
||||
#include "libu64/debug.h"
|
||||
#include "irqmgr.h"
|
||||
#include "game.h"
|
||||
#include "m_game_dlftbls.h"
|
||||
#include "sys_dynamic.h"
|
||||
#include "sys_ucode.h"
|
||||
#include "m_debug.h"
|
||||
#include "dvderr.h"
|
||||
#include "zurumode.h"
|
||||
|
||||
static int frame;
|
||||
static BOOL SoftResetEnable;
|
||||
static int skip_frame;
|
||||
|
||||
#define CONSTRUCT_THA_GA(tha_ga, name) (THA_GA_ct((tha_ga), (Gfx*)GET_DYNAMIC_OFS(##name##_OFS), ##name##_SIZE))
|
||||
|
||||
static void graph_setup_double_buffer(GRAPH* this) {
|
||||
bzero(sys_dynamic, DYNAMIC_SIZE);
|
||||
*(u16*)GET_DYNAMIC_OFS(SYSDYNAMIC_HEADER_OFS) = SYSDYNAMIC_START_MAGIC;
|
||||
*(u16*)GET_DYNAMIC_OFS(SYSDYNAMIC_EPILOG_OFS) = SYSDYNAMIC_END_MAGIC;
|
||||
|
||||
CONSTRUCT_THA_GA(&this->shadow_thaga, SHADOW);
|
||||
CONSTRUCT_THA_GA(&this->light_thaga, LIGHT);
|
||||
CONSTRUCT_THA_GA(&this->line_translucent_thaga, LINE_XLU);
|
||||
CONSTRUCT_THA_GA(&this->overlay_thaga, OVERLAY);
|
||||
CONSTRUCT_THA_GA(&this->line_opaque_thaga, LINE_OPA);
|
||||
CONSTRUCT_THA_GA(&this->work_thaga, WORK);
|
||||
CONSTRUCT_THA_GA(&this->polygon_opaque_thaga, POLY_OPA);
|
||||
CONSTRUCT_THA_GA(&this->polygon_translucent_thaga, POLY_XLU);
|
||||
CONSTRUCT_THA_GA(&this->font_thaga, FONT);
|
||||
|
||||
this->Gfx_list10 = (Gfx*)GET_DYNAMIC_OFS(SHADOW_OFS);
|
||||
this->Gfx_list11 = (Gfx*)GET_DYNAMIC_OFS(LIGHT_OFS);
|
||||
this->Gfx_list00 = (Gfx*)GET_DYNAMIC_OFS(LINE_XLU_OFS);
|
||||
this->Gfx_list01 = (Gfx*)GET_DYNAMIC_OFS(OVERLAY_OFS);
|
||||
this->Gfx_list04 = (Gfx*)GET_DYNAMIC_OFS(LINE_OPA_OFS);
|
||||
this->Gfx_list05 = (Gfx*)GET_DYNAMIC_OFS(WORK_OFS);
|
||||
this->Gfx_list07 = (Gfx*)GET_DYNAMIC_OFS(POLY_OPA_OFS);
|
||||
this->Gfx_list08 = (Gfx*)GET_DYNAMIC_OFS(POLY_XLU_OFS);
|
||||
this->Gfx_list09 = (Gfx*)GET_DYNAMIC_OFS(FONT_OFS);
|
||||
|
||||
this->gfxsave = NULL;
|
||||
}
|
||||
|
||||
/* TODO: This requires multiple GAME classes to be implemented before it will be matching */
|
||||
static DLFTBL_GAME* game_get_next_game_dlftbl(GAME* game) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern void graph_ct(GRAPH* this) {
|
||||
bzero(this, sizeof(GRAPH));
|
||||
this->frame_counter = 0;
|
||||
this->cfb_bank = 0;
|
||||
zurumode_init();
|
||||
SETREG(SREG, 33, GETREG(SREG, 33) & ~2);
|
||||
SETREG(SREG, 33, GETREG(SREG, 33) & ~1);
|
||||
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) {
|
||||
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 = 0;
|
||||
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_OPA_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);
|
||||
|
||||
if (*(u16*)GET_DYNAMIC_OFS(SYSDYNAMIC_HEADER_OFS) != SYSDYNAMIC_START_MAGIC) {
|
||||
_dbg_hungup(__FILE__, 417);
|
||||
}
|
||||
|
||||
if (*(u16*)GET_DYNAMIC_OFS(SYSDYNAMIC_EPILOG_OFS) != SYSDYNAMIC_END_MAGIC) {
|
||||
_dbg_hungup(__FILE__, 425);
|
||||
err = 1;
|
||||
}
|
||||
|
||||
err = THA_GA_isCrash(&this->line_translucent_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->overlay_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->line_opaque_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->polygon_opaque_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->polygon_translucent_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->font_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->shadow_thaga) != 0;
|
||||
err = THA_GA_isCrash(&this->light_thaga) != 0;
|
||||
|
||||
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->running = FALSE;
|
||||
//game->next_game_init = prenmi_init;
|
||||
//game->next_game_size = sizeof(PRENMI_GAME); /* sizeof(PRENIM_GAME) == 0xE8 */
|
||||
}
|
||||
}
|
||||
|
||||
extern void graph_proc(void* arg) {
|
||||
int i;
|
||||
|
||||
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_class, GAME_CT);
|
||||
game_ct(game);
|
||||
//emu64_refresh();
|
||||
GRAPH_SET_DOING_POINT(&graph_class, GAME_CT_FINISHED);
|
||||
|
||||
for (i; i = game_is_doing(game); i != 0) {
|
||||
if (!dvderr_draw()) {
|
||||
graph_main(&graph_class, game);
|
||||
}
|
||||
}
|
||||
|
||||
dlftbl = game_get_next_game_dlftbl(game);
|
||||
GRAPH_SET_DOING_POINT(&graph_class, GAME_DT);
|
||||
game_dt(game);
|
||||
GRAPH_SET_DOING_POINT(&graph_class, GAME_DT_FINISHED);
|
||||
free(game);
|
||||
game_class_p = NULL;
|
||||
}
|
||||
|
||||
graph_dt(&graph_class);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "m_debug.h"
|
||||
|
||||
@@ -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