Implement & link second_game.c

This commit is contained in:
Cuyler36
2023-05-29 10:54:50 -04:00
parent 5ea32de601
commit 068d951791
9 changed files with 121 additions and 2 deletions
+3
View File
@@ -127,6 +127,9 @@ m_random_field/mRF_MakePerfectBit.c:
.text: [0x8050B1AC, 0x8050B1D4]
m_random_field/mRF_GetRandomStepMode.c:
.text: [0x8050B284, 0x8050B2C0]
second_game.c:
.text: [0x8062B630, 0x8062B848]
.bss: [0x8148DA60, 0x8148DA68]
m_trademark.c:
.text: [0x8062B848, 0x8062C048]
.rodata: [0x8064D1C0, 0x8064D1C8]
+3
View File
@@ -52674,6 +52674,9 @@ global:
0x81361828: fbdemo
0x81361920: gxbuf
0x81361A60: prbuf
0x8148DA60: sound_ok
0x8148DA61: contpad_ok
0x8148DA62: frame_count
0x8148DA68: famicom_done
0x8148DA6C: famicom_done_countdown
0x8148DA70: freeXfbBase
+1
View File
@@ -12,6 +12,7 @@ void VIWaitForRetrace();
void VIConfigurePan(u16 x_origin, u16 y_origin, u16 width, u16 height);
u32 VIGetRetraceCount();
u32 VIGetDTVStatus();
void VIFlush();
#ifdef __cplusplus
};
+3
View File
@@ -10,6 +10,9 @@ extern "C" {
extern void Na_InitAudio(void (*fatal_callback)(), u8* load_addr, size_t load_size, u8* bootsound, size_t bootsound_size, BOOL cut_flag);
extern void Na_GameFrame();
extern u8 Na_CheckNeosBoot();
extern void Na_RestartPrepare();
extern u8 Na_CheckRestartReady();
extern void Na_Restart();
#ifdef __cplusplus
}
+1
View File
@@ -9,6 +9,7 @@
#include "libultra/shutdown.h"
#include "libultra/os_timer.h"
#include "libultra/os_thread.h"
#include "libultra/initialize.h"
#define N64_SCREEN_HEIGHT 240
#define N64_SCREEN_WIDTH 320
+11
View File
@@ -12,6 +12,15 @@ extern "C" {
#define PADMSGBUFCNT 8
enum pads {
PAD0,
PAD1,
PAD2,
PAD3,
PAD_NUM
};
typedef struct {
u8 last_intensity;
u8 now_intensity;
@@ -54,6 +63,8 @@ typedef struct {
extern padmgr padmgr_class;
extern int padmgr_isConnectedController(int pad);
#define padmgr_setClient(callback, param) \
do { \
padmgr* mgr = &padmgr_class; \
+2 -2
View File
@@ -13,8 +13,8 @@ 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);
extern void second_game_init(GAME* game);
extern void second_game_cleanup(GAME* game);
#ifdef __cplusplus
}
+1
View File
@@ -10,6 +10,7 @@ extern "C" {
extern s16 atans_table(f32 x, f32 y);
extern f32 atanf_table(f32 x, f32 y);
extern void init_rnd();
#ifdef __cplusplus
}
+96
View File
@@ -0,0 +1,96 @@
#include "second_game.h"
#include "m_trademark.h"
#include "jaudio_NES/game64.h"
#include "padmgr.h"
#include "m_common_data.h"
#include "zurumode.h"
#include "libultra/libultra.h"
#include "dolphin/vi.h"
#include "dolphin/dvd.h"
#include "boot.h"
#include "sys_math.h"
#include "m_nmibuf.h"
#pragma pool_data on
static u8 sound_ok;
static u8 contpad_ok;
static u8 frame_count;
static void second_game_main(GAME* game) {
if (sound_ok == 0) {
sound_ok = 1;
Na_RestartPrepare();
}
if (Na_CheckRestartReady() == TRUE) {
sound_ok = 2;
}
if (sound_ok == 2) {
Na_Restart();
}
if (padmgr_isConnectedController(PAD0)) {
contpad_ok = TRUE;
}
if (sound_ok == 2 && (contpad_ok || frame_count > 3)) {
GAME_GOTO_NEXT(game, trademark, TRADEMARK);
}
frame_count++;
}
extern void second_game_cleanup(GAME* game) {
Common_Set(pad_connected, contpad_ok);
}
extern void second_game_init(GAME* game) {
if (zurumode_flag != 0 && osShutdown >= 3) {
VISetBlack(TRUE);
VIFlush();
VIWaitForRetrace();
switch (osShutdown) {
case 3:
{
osShutdownStart(OS_RESET_SHUTDOWN);
break;
}
case 4:
{
HotResetIplMenu();
break;
}
default:
{
osShutdownStart(OS_RESET_RESTART);
break;
}
}
}
if (osShutdown != 0) {
if (APPNMI_HOTRESET_GET()) {
osShutdownStart(OS_RESET_SHUTDOWN);
}
else {
if (DVDCheckDisk() == FALSE) {
osShutdownStart(OS_RESET_RESTART);
}
}
}
sound_ok = 0;
contpad_ok = TRUE;
frame_count = 0;
game->exec = &second_game_main;
game->cleanup = &second_game_cleanup;
init_rnd();
__osInitialize_common();
}
#pragma pool_data reset