Skip to content

Commit

Permalink
Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuyler36 committed Apr 16, 2023
1 parent 1b5e0f8 commit 7336d51
Show file tree
Hide file tree
Showing 29 changed files with 3,165 additions and 119 deletions.
9 changes: 9 additions & 0 deletions include/MSL_C/w_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ inline float sqrtf(float x)
return x;
}

extern inline double fabs(double x)
{
return __fabs(x) ;
}

inline float fabsf(float x) {
return (float)fabs((double)x);
}

f64 atan2(f64, f64);
f64 acos(f32);

Expand Down
3 changes: 3 additions & 0 deletions include/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ extern "C" {
extern void sAdo_GameFrame();
extern void sAdo_SoftReset();

/* Not sure about the last param name */
extern void sAdo_VoiceSe(u8 num, u8 num2, u8 num3, s16 character_idx, u8 scale, u8 mode);

#ifdef __cplusplus
}
#endif
Expand Down
23 changes: 23 additions & 0 deletions include/dataobject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef DATAOBJECT_H
#define DATAOBJECT_H

#include "types.h"

#ifdef __cplusplus
extern "C" {
#endif

// TODO: This file should be autogenerated.

extern u8 FONT_nes_tex_font1[];
extern u8 FONT_nes_tex_jyouge[];
extern u8 FONT_nes_tex_sayuu[];
extern u8 FONT_nes_tex_cursor[];
extern u8 FONT_nes_tex_next[];
extern u8 FONT_nes_tex_choice[];

#ifdef __cplusplus
}
#endif

#endif
16 changes: 16 additions & 0 deletions include/dolphin/gx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef DOLPHIN_GX_H
#define DOLPHIN_GX_H

#include "types.h"

#ifdef __cplusplus
extern "C" {
#endif



#ifdef __cplusplus
}
#endif

#endif
69 changes: 42 additions & 27 deletions include/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,37 @@ typedef enum {
#define GRAPH_MSG_BUF_COUNT 8

typedef struct graph_s {
/* 0x0000 */ Gfx* Gfx_list00; /* line translucent */
/* 0x0004 */ Gfx* Gfx_list01; /* overlay */
/* 0x0000 */ Gfx* Gfx_list00; /* polygon opaque */
/* 0x0004 */ Gfx* Gfx_list01; /* polygon translucent */
/* 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 */
/* 0x0010 */ Gfx* Gfx_list04; /* overlay */
/* 0x0014 */ Gfx* Gfx_list07; /* font */
/* 0x0018 */ Gfx* Gfx_list08; /* shadow */
/* 0x001C */ Gfx* Gfx_list09; /* light */
/* 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 */
/* 0x0088 */ u8 _unused_ossctask00p[0x68]; /* real type = OSScTask */
/* 0x00F0 */ u8 _unused_ossctask01p[0x68]; /* real type = OSScTask */
/* 0x0158 */ u8 _unused_ossctask02p[0x68]; /* real type = 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;
/* 0x01D4 */ u8 _unk1D4[0xBC]; /* Maybe related to more OSScTask stuff? */
/* 0x0290 */ void* scheduler; /* Actually points to OSSched struct, only used in DnM? */
/* 0x0294 */ void* vimode; /* Actually points to OSViMode struct, not used in AC. */
/* 0x0298 */ THA_GA line_opaque_thaga;
/* 0x02A8 */ THA_GA line_translucent_thaga;
/* 0x02B8 */ THA_GA overlay_thaga;
/* 0x02C8 */ THA_GA polygon_opaque_thaga;
/* 0x02D8 */ THA_GA polygon_translucent_thaga;
/* 0x02E8 */ THA_GA font_thaga;
/* 0x02F8 */ THA_GA shadow_thaga;
/* 0x0308 */ THA_GA light_thaga;
/* 0x0318 */ THA_GA new0_thaga;
/* 0x0328 */ THA_GA new1_thaga;
/* 0x0338 */ int frame_counter;
/* 0x033C */ u16* frameBuffer;
/* 0x0340 */ u16* renderBuffer;
Expand All @@ -82,8 +83,8 @@ typedef struct graph_s {
/* 0x0354 */ f32 vixscale;
/* 0x0358 */ f32 viyscale;
/* 0x035C */ Gfx* last_dl;
/* 0x0360 */ Gfx* Gfx_list10; /* shadow */
/* 0x0364 */ Gfx* Gfx_list11; /* light */
/* 0x0360 */ Gfx* Gfx_list10; /* new0 (highlight/reflections?) */
/* 0x0364 */ Gfx* Gfx_list11; /* new1 (highlight/reflections?) */
} GRAPH ATTRIBUTE_ALIGN(8); // one of the missing structs is likely aligned to 8 bytes.

extern void graph_proc(void* arg);
Expand All @@ -107,26 +108,40 @@ extern void graph_dt(GRAPH* this);

#define NEXT_DISP(thaga) ((thaga)->thaGfx.head_p++)
#define NOW_DISP(thaga) ((thaga)->thaGfx.head_p)
#define SET_DISP(thaga, p) ((thaga)->tha.head_p = (char*)(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 NEXT_NEW0_DISP NEXT_DISP(&__graph->new0_thaga)
#define NEXT_NEW1_DISP NEXT_DISP(&__graph->new1_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)
#define NOW_NEW0_DISP (Gfx*)NOW_DISP(&__graph->new0_thaga)
#define NOW_NEW1_DISP (Gfx*)NOW_DISP(&__graph->new1_thaga)

#define SET_POLY_OPA_DISP(p) SET_DISP(&__graph->polygon_opaque_thaga, p)
#define SET_POLY_XLU_DISP(p) SET_DISP(&__graph->polygon_translucent_thaga, p)
#define SET_OVERLAY_DISP(p) SET_DISP(&__graph->overlay_thaga, p)
#define SET_WORK_DISP(p) SET_DISP(&__graph->work_thaga, p)
#define SET_FONT_DISP(p) SET_DISP(&__graph->font_thaga, p)
#define SET_SHADOW_DISP(p) SET_DISP(&__graph->shadow_thaga, p)
#define SET_LIGHT_DISP(p) SET_DISP(&__graph->light_thaga, p)
#define SET_NEW0_DISP(p) SET_DISP(&__graph->new0_thaga, p)
#define SET_NEW1_DISP(p) SET_DISP(&__graph->new1_thaga, p)

#define GRAPH_ALLOC(graph, size) ((void*)((graph)->polygon_opaque_thaga.tha.tail_p = (char*)((int)(graph)->polygon_opaque_thaga.tha.tail_p - (int)(size))))
#define GRAPH_ALLOC_TYPE(graph, type, num) (GRAPH_ALLOC(graph, sizeof(type) * (num)))

extern u8 SoftResetEnable;
extern GRAPH graph_class;
Expand Down
3 changes: 3 additions & 0 deletions include/libc/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#define MATH_H

#include "types.h"

#define SQRT_OF_2_F 1.41421356237309504880f

s16 sins(u16);

f32 fatan2(f32, f32);
Expand Down
2 changes: 1 addition & 1 deletion include/libc64/__osMalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "dolphin/os/OSTime.h"
#include "libultra/osThread.h"
#include "libultra/osMesg.h"
#include "libultra/u64types.h"
#include "libultra/ultratypes.h"

struct ArenaNode;

Expand Down
Loading

0 comments on commit 7336d51

Please sign in to comment.