2023-11-12 20:47:38 +01:00
|
|
|
#ifndef __PATCHES_H__
|
|
|
|
#define __PATCHES_H__
|
|
|
|
|
2024-07-26 04:17:00 +02:00
|
|
|
#define RECOMP_EXPORT __attribute__((section(".recomp_export")))
|
|
|
|
#define RECOMP_PATCH __attribute__((section(".recomp_patch")))
|
|
|
|
#define RECOMP_FORCE_PATCH __attribute__((section(".recomp_force_patch")))
|
2024-09-02 18:01:22 +02:00
|
|
|
#define RECOMP_DECLARE_EVENT(func) \
|
|
|
|
_Pragma("GCC diagnostic push") \
|
|
|
|
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
|
|
|
|
__attribute__((noinline, weak, used, section(".recomp_event"))) void func {} \
|
|
|
|
_Pragma("GCC diagnostic pop")
|
2024-07-26 04:17:00 +02:00
|
|
|
|
2024-01-13 07:39:08 +01:00
|
|
|
// TODO fix renaming symbols in patch recompilation
|
2024-03-21 07:46:08 +01:00
|
|
|
#define osCreateMesgQueue osCreateMesgQueue_recomp
|
2024-01-13 07:39:08 +01:00
|
|
|
#define osRecvMesg osRecvMesg_recomp
|
|
|
|
#define osSendMesg osSendMesg_recomp
|
2024-04-03 00:21:05 +02:00
|
|
|
#define osViGetCurrentFramebuffer osViGetCurrentFramebuffer_recomp
|
2024-04-03 04:16:31 +02:00
|
|
|
#define osFlashWriteArray osFlashWriteArray_recomp
|
|
|
|
#define osFlashWriteBuffer osFlashWriteBuffer_recomp
|
|
|
|
#define osWritebackDCache osWritebackDCache_recomp
|
2024-05-18 04:23:48 +02:00
|
|
|
#define osInvalICache osInvalICache_recomp
|
2024-05-01 10:06:53 +02:00
|
|
|
#define osGetTime osGetTime_recomp
|
2024-04-15 17:15:45 +02:00
|
|
|
|
|
|
|
#define osContStartReadData osContStartReadData_recomp
|
|
|
|
#define osContGetReadData osContGetReadData_recomp
|
|
|
|
#define osContStartQuery osContStartQuery_recomp
|
|
|
|
#define osContGetQuery osContGetQuery_recomp
|
|
|
|
|
2024-03-11 05:13:32 +01:00
|
|
|
#define sinf __sinf_recomp
|
|
|
|
#define cosf __cosf_recomp
|
2024-04-03 04:16:31 +02:00
|
|
|
#define bzero bzero_recomp
|
2024-03-12 23:01:58 +01:00
|
|
|
#define gRandFloat sRandFloat
|
2023-11-12 20:47:38 +01:00
|
|
|
#include "global.h"
|
2023-12-01 16:56:20 +01:00
|
|
|
#include "rt64_extended_gbi.h"
|
2023-11-12 20:47:38 +01:00
|
|
|
|
2024-05-02 08:38:17 +02:00
|
|
|
#ifndef gEXFillRectangle
|
|
|
|
#define gEXFillRectangle(cmd, lorigin, rorigin, ulx, uly, lrx, lry) \
|
|
|
|
G_EX_COMMAND2(cmd, \
|
|
|
|
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_FILLRECT_V1, 24, 0), \
|
|
|
|
PARAM(lorigin, 12, 0) | PARAM(rorigin, 12, 12), \
|
|
|
|
\
|
|
|
|
PARAM((ulx) * 4, 16, 16) | PARAM((uly) * 4, 16, 0), \
|
|
|
|
PARAM((lrx) * 4, 16, 16) | PARAM((lry) * 4, 16, 0) \
|
|
|
|
)
|
|
|
|
#endif
|
|
|
|
|
2024-04-16 02:05:31 +02:00
|
|
|
#define gEXMatrixGroupNoInterpolation(cmd, push, proj, edit) \
|
|
|
|
gEXMatrixGroup(cmd, G_EX_ID_IGNORE, G_EX_INTERPOLATE_SIMPLE, push, proj, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_ORDER_LINEAR, edit)
|
|
|
|
|
2024-03-29 01:36:16 +01:00
|
|
|
#define gEXMatrixGroupInterpolateOnlyTiles(cmd, push, proj, edit) \
|
|
|
|
gEXMatrixGroup(cmd, G_EX_ID_IGNORE, G_EX_INTERPOLATE_SIMPLE, push, proj, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, edit)
|
|
|
|
|
|
|
|
#define gEXMatrixGroupDecomposedNormal(cmd, id, push, proj, edit) \
|
|
|
|
gEXMatrixGroupDecomposed(cmd, id, push, proj, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, edit)
|
|
|
|
|
2024-04-01 09:40:54 +02:00
|
|
|
#define gEXMatrixGroupDecomposedSkipRot(cmd, id, push, proj, edit) \
|
|
|
|
gEXMatrixGroupDecomposed(cmd, id, push, proj, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, edit)
|
|
|
|
|
2024-04-01 05:12:22 +02:00
|
|
|
#define gEXMatrixGroupDecomposedSkipPosRot(cmd, id, push, proj, edit) \
|
|
|
|
gEXMatrixGroupDecomposed(cmd, id, push, proj, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, edit)
|
|
|
|
|
|
|
|
#define gEXMatrixGroupDecomposedSkipAll(cmd, id, push, proj, edit) \
|
2024-03-29 01:36:16 +01:00
|
|
|
gEXMatrixGroupDecomposed(cmd, id, push, proj, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, edit)
|
|
|
|
|
|
|
|
#define gEXMatrixGroupDecomposedVerts(cmd, id, push, proj, edit) \
|
|
|
|
gEXMatrixGroupDecomposed(cmd, id, push, proj, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, edit)
|
2024-03-02 19:33:09 +01:00
|
|
|
|
2024-04-04 08:11:48 +02:00
|
|
|
#define gEXMatrixGroupDecomposedVertsOrderAuto(cmd, id, push, proj, edit) \
|
|
|
|
gEXMatrixGroupDecomposed(cmd, id, push, proj, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_AUTO, edit)
|
|
|
|
|
2024-03-02 19:33:09 +01:00
|
|
|
|
2023-11-24 23:10:21 +01:00
|
|
|
int recomp_printf(const char* fmt, ...);
|
2024-03-03 08:36:14 +01:00
|
|
|
float recomp_powf(float, float);
|
2023-11-24 23:10:21 +01:00
|
|
|
|
2024-03-05 08:55:05 +01:00
|
|
|
typedef enum {
|
|
|
|
/* 0 */ PICTO_BOX_STATE_OFF, // Not using the pictograph
|
|
|
|
/* 1 */ PICTO_BOX_STATE_LENS, // Looking through the lens of the pictograph
|
|
|
|
/* 2 */ PICTO_BOX_STATE_SETUP_PHOTO, // Looking at the photo currently taken
|
|
|
|
/* 3 */ PICTO_BOX_STATE_PHOTO
|
|
|
|
} PictoBoxState;
|
|
|
|
|
|
|
|
|
|
|
|
#define INCBIN(identifier, filename) \
|
|
|
|
asm(".pushsection .rodata\n" \
|
|
|
|
"\t.local " #identifier "\n" \
|
|
|
|
"\t.type " #identifier ", @object\n" \
|
|
|
|
"\t.balign 8\n" \
|
|
|
|
#identifier ":\n" \
|
|
|
|
"\t.incbin \"" filename "\"\n\n" \
|
|
|
|
\
|
|
|
|
"\t.balign 8\n" \
|
|
|
|
"\t.popsection\n"); \
|
|
|
|
extern u8 identifier[]
|
|
|
|
|
|
|
|
void draw_dpad(PlayState* play);
|
|
|
|
void draw_dpad_icons(PlayState* play);
|
|
|
|
|
2024-03-12 23:01:58 +01:00
|
|
|
void View_ApplyInterpolate(View* view, s32 mask, bool reset_interpolation_state);
|
|
|
|
|
2024-03-27 23:47:15 +01:00
|
|
|
void set_camera_skipped(bool skipped);
|
|
|
|
void clear_camera_skipped();
|
2024-04-01 05:12:22 +02:00
|
|
|
void edit_billboard_groups(PlayState* play);
|
2024-03-27 23:47:15 +01:00
|
|
|
bool camera_was_skipped();
|
2024-03-28 05:35:10 +01:00
|
|
|
void room_load_hook(PlayState* play, Room* room);
|
2024-05-01 10:06:53 +02:00
|
|
|
void draw_autosave_icon(PlayState* play);
|
2024-03-27 23:47:15 +01:00
|
|
|
|
|
|
|
void recomp_crash(const char* err);
|
|
|
|
|
2023-11-12 20:47:38 +01:00
|
|
|
#endif
|