mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Add files
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#ifndef JKRENUM_H
|
||||
#define JKRENUM_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum JKRExpandSwitch {
|
||||
EXPAND_SWITCH_DEFAULT, /* Do nothing? treated same as 2 */
|
||||
EXPAND_SWITCH_DECOMPRESS, /* Check for compression and decompress */
|
||||
EXPAND_SWITCH_NONE /* Do nothing */
|
||||
} JKRExpandSwitch;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#include "types.h"
|
||||
#include "MSL_C/w_math.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
#define F_PI ((f32)PI)
|
||||
|
||||
#define SQRTF(f) (__frsqrte(f))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef DOLPHIN_OSMODULE_H
|
||||
#define DOLPHIN_OSMODULE_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OSModuleInfo_s OSModuleInfo;
|
||||
|
||||
typedef struct OSModuleQueue_s {
|
||||
OSModuleInfo* head;
|
||||
OSModuleInfo* tail;
|
||||
} OSModuleQueue;
|
||||
|
||||
typedef struct OSModuleLink_s {
|
||||
OSModuleInfo* next;
|
||||
OSModuleInfo* prev;
|
||||
} OSModuleLink;
|
||||
|
||||
typedef struct OSModuleInfo_s {
|
||||
u32 id;
|
||||
OSModuleLink link;
|
||||
u32 numSections;
|
||||
u32 sectionInfoOfs;
|
||||
u32 nameOfs;
|
||||
u32 nameSize;
|
||||
u32 version;
|
||||
} OSModuleInfo;
|
||||
|
||||
typedef struct OSModuleHeader_s {
|
||||
OSModuleInfo info;
|
||||
u32 bssSize;
|
||||
u32 relOfs;
|
||||
u32 impOfs;
|
||||
u32 impSize;
|
||||
|
||||
u8 prologSection;
|
||||
u8 epilogSection;
|
||||
u8 unresolvedSection;
|
||||
u8 bssSection;
|
||||
|
||||
u32 prolog;
|
||||
u32 epilog;
|
||||
u32 unresolved;
|
||||
/* OS_MODULE_VERSION >= 2 */
|
||||
|
||||
u32 align;
|
||||
u32 bssAlign;
|
||||
} OSModuleHeader;
|
||||
|
||||
typedef struct OSSectionInfo_s {
|
||||
u32 offset;
|
||||
u32 size;
|
||||
} OSSectionInfo;
|
||||
|
||||
#define OSGetSectionInfo(module) \
|
||||
((OSSectionInfo*) (((OSModuleInfo*) (module))->sectionInfoOfs))
|
||||
|
||||
#define OS_SECTIONINFO_EXEC 1
|
||||
#define OS_SECTIONINFO_OFFSET(offset) ((offset) & ~OS_SECTIONINFO_EXEC)
|
||||
|
||||
void OSSetStringTable (const void* strTable);
|
||||
BOOL OSLink(OSModuleInfo* module, void* bss);
|
||||
BOOL OSUnlink(OSModuleInfo* module);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef OSRESET_H
|
||||
#define OSRESET_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OS_RESETCODE_RESTART 0x80000000
|
||||
|
||||
#define OS_RESET_RESTART 0
|
||||
#define OS_RESET_HOTRESET 1 /* Soft reset */
|
||||
#define OS_RESET_SHUTDOWN 2
|
||||
|
||||
u32 OSGetResetCode();
|
||||
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu);
|
||||
BOOL OSGetResetSwitchState();
|
||||
void OSGetSaveRegion(void** start, void** end);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef DOLPHIN_PAD_H
|
||||
#define DOLPHIN_PAD_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PAD_BUTTON_LEFT 0x0001
|
||||
#define PAD_BUTTON_RIGHT 0x0002
|
||||
#define PAD_BUTTON_DOWN 0x0004
|
||||
#define PAD_BUTTON_UP 0x0008
|
||||
#define PAD_TRIGGER_Z 0x0010
|
||||
#define PAD_TRIGGER_R 0x0020
|
||||
#define PAD_TRIGGER_L 0x0040
|
||||
#define PAD_BUTTON_A 0x0100
|
||||
#define PAD_BUTTON_B 0x0200
|
||||
#define PAD_BUTTON_X 0x0400
|
||||
#define PAD_BUTTON_Y 0x0800
|
||||
#define PAD_BUTTON_MENU 0x1000
|
||||
#define PAD_BUTTON_START 0x1000
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef GAME_H_H
|
||||
#define GAME_H_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct game_s GAME;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef INITIAL_MENU_H
|
||||
#define INITIAL_MENU_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void initial_menu_init();
|
||||
extern void initial_menu_cleanup();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef GAME64_H
|
||||
#define GAME64_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef CONTREADDATA_H
|
||||
#define CONTREADDATA_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern u8 __osResetSwitchPressed;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef INITIALIZE_H
|
||||
#define INITIALIZE_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void __osInitialize_common();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef SHUTDOWN_H
|
||||
#define SHUTDOWN_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void osShutdownStart(int shutdown_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef NINTENDO_HI_0_H
|
||||
#define NINTENDO_HI_0_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NINTENDO_HI_0_SIZE 0x9900
|
||||
#define NINTENDO_HI_0_AW_SIZE 0x66A0
|
||||
extern u8 nintendo_hi_0[NINTENDO_HI_0_SIZE]; // This should be nintendo_hi_0.aw
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef SYS_MATH_H
|
||||
#define SYS_MATH_H
|
||||
|
||||
#include "types.h"
|
||||
#include "MSL_C/math.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern s16 atans_table(f32 x, f32 y);
|
||||
extern f32 atanf_table(f32 x, f32 y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,157 @@
|
||||
#include "m_controller.h"
|
||||
#include "game.h"
|
||||
#include "m_lib.h"
|
||||
#include "m_event.h"
|
||||
#include "MSL_C/w_math.h"
|
||||
|
||||
/**
|
||||
* @brief Constructor for MCON.
|
||||
**/
|
||||
extern void mCon_ct() { }
|
||||
|
||||
/**
|
||||
* @brief Destructor for MCON.
|
||||
**/
|
||||
extern void mCon_dt() { }
|
||||
|
||||
/**
|
||||
* @brief Controller input processing function.
|
||||
* Only processes port 1 controller.
|
||||
*
|
||||
* @param mcon Pointer to MCON struct which will be updated
|
||||
* @param stick_x Joystick X position
|
||||
* @param stick_y Joystick Y position
|
||||
**/
|
||||
extern void mCon_calc(MCON* mcon, f32 stick_x, f32 stick_y) {
|
||||
f32 t;
|
||||
|
||||
mcon->last_move_pX = mcon->move_pX;
|
||||
mcon->last_move_pY = mcon->move_pY;
|
||||
mcon->last_move_pR = mcon->move_pR;
|
||||
mcon->last_move_angle = mcon->move_angle;
|
||||
|
||||
mcon->last_adjusted_pX = mcon->adjusted_pX;
|
||||
mcon->last_adjusted_pY = mcon->adjusted_pY;
|
||||
mcon->last_adjusted_pR = mcon->adjusted_pR;
|
||||
|
||||
t = sqrtf(stick_x * stick_x + stick_y * stick_y);
|
||||
|
||||
if (t <= STICK_MIN) {
|
||||
mcon->move_pX = 0.0f;
|
||||
mcon->move_pY = 0.0f;
|
||||
mcon->move_pR = 0.0f;
|
||||
|
||||
mcon->adjusted_pX = 0.0f;
|
||||
mcon->adjusted_pY = 0.0f;
|
||||
mcon->adjusted_pR = 0.0f;
|
||||
}
|
||||
else {
|
||||
s16 stick_angle = atans_table(stick_x, stick_y);
|
||||
if (t > STICK_MAX) {
|
||||
stick_x = cos_s(stick_angle) * STICK_MAX;
|
||||
stick_y = sin_s(stick_angle) * STICK_MAX;
|
||||
t = STICK_MAX;
|
||||
}
|
||||
|
||||
mcon->move_angle = stick_angle;
|
||||
mcon->move_pX = check_percent_abs(stick_x, STICK_MIN, STICK_MAX, STICK_UNCORRECTED_SCALE, 0);
|
||||
mcon->move_pY = check_percent_abs(stick_y, STICK_MIN, STICK_MAX, STICK_UNCORRECTED_SCALE, 0);
|
||||
mcon->move_pR = check_percent_abs( t, STICK_MIN, STICK_MAX, STICK_UNCORRECTED_SCALE, 0);
|
||||
|
||||
mcon->adjusted_pX = check_percent_abs(stick_x, STICK_MIN, STICK_MAX, STICK_CORRECTED_SCALE, 1);
|
||||
mcon->adjusted_pY = check_percent_abs(stick_y, STICK_MIN, STICK_MAX, STICK_CORRECTED_SCALE, 1);
|
||||
mcon->adjusted_pR = check_percent_abs( t, STICK_MIN, STICK_MAX, STICK_CORRECTED_SCALE, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Controller main process.
|
||||
*
|
||||
* @param game Pointer to current GAME structure
|
||||
**/
|
||||
extern void mCon_main(GAME* game) {
|
||||
f32 stick_x = getJoystick_X();
|
||||
f32 stick_y = getJoystick_Y();
|
||||
|
||||
mCon_calc(&game->mcon, stick_x, stick_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if a specific button combination currently pressed.
|
||||
*
|
||||
* @param mask Button combination to check
|
||||
* @return TRUE when the button combination is pressed, FALSE otherwise
|
||||
**/
|
||||
extern int chkButton(u16 mask) {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return (mask & (gamePT->pads[0].now.button)) == mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the currently pressed buttons.
|
||||
*
|
||||
* @return Pressed buttons
|
||||
**/
|
||||
extern u16 getButton() {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return BUTTON_NONE;
|
||||
}
|
||||
|
||||
return gamePT->pads[0].now.button;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if a specific button combination was pressed this frame.
|
||||
*
|
||||
* @param mask Button combination to check
|
||||
* @return TRUE when the button combination was pressed this frame, FALSE otherwise
|
||||
**/
|
||||
extern int chkTrigger(u16 mask) {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return (mask & (gamePT->pads[0].on.button)) == mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the buttons pressed on the current frame.
|
||||
*
|
||||
* @return Buttons pressed on the current frame
|
||||
**/
|
||||
extern u16 getTrigger() {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return BUTTON_NONE;
|
||||
}
|
||||
|
||||
return gamePT->pads[0].on.button;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current joystick X position.
|
||||
*
|
||||
* @return Joystick X position
|
||||
**/
|
||||
extern int getJoystick_X() {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return gamePT->pads[0].now.stick_x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current joystick Y position.
|
||||
*
|
||||
* @return Joystick Y position
|
||||
**/
|
||||
extern int getJoystick_Y() {
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return gamePT->pads[0].now.stick_y;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "contreaddata.h"
|
||||
|
||||
u8 __osResetSwitchPressed;
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "nintendo_hi_0.h"
|
||||
|
||||
u8 nintendo_hi_0[] ATTRIBUTE_ALIGN(32) = {
|
||||
#include "assets/nintendo_hi_0.inc"
|
||||
};
|
||||
Reference in New Issue
Block a user