Merge pull request #167 from Ryan-Myers/master

controller_pak and fade_transition function signatures to headers
This commit is contained in:
David Benepe
2021-09-10 23:38:58 -05:00
committed by GitHub
7 changed files with 110 additions and 82 deletions
+15 -41
View File
@@ -2,17 +2,10 @@
/* RAM_POS: 0x80072250 */
#include "controller_pak.h"
#include "memory.h"
#include "PR/pfs.h"
#include "PR/os_cont.h"
#include "types.h"
#include "macros.h"
#include "structs.h"
/************ .data ************/
s32 D_800DE440 = 0;
s32 *D_800DE440 = 0;
u8 gN64FontCodes[68] = "\0 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#'*+,-./:=?@";
@@ -79,8 +72,6 @@ s32 D_801241F4;
/*******************************/
u8 func_8006A4F8(s32 arg0);
u8 func_80072250(s32 arg0) {
if ((arg0 == 0 || arg0 == 1) && func_8000E158()) {
arg0 = 1 - arg0;
@@ -88,7 +79,6 @@ u8 func_80072250(s32 arg0) {
return func_8006A4F8(arg0);
}
void func_80072708(void);
void func_80072298(u8 arg0) {
D_801241E4 = arg0;
if (arg0 != 0) {
@@ -140,18 +130,18 @@ GLOBAL_ASM("asm/non_matchings/controller_pak/func_80073E1C.s")
s32 func_80073F5C(s32 arg0, s32 arg1) {
s32 temp_v0;
s32 sp30;
s32 sp30; //Possible epcInfo struct
u8 *sp2C;
s32 phi_v1;
s32 sp24;
s32 size;
sp24 = func_80073C4C(); // 256 bytes
sp2C = allocate_from_main_pool_safe(sp24, COLOR_TAG_WHITE);
*((s32*)sp2C) = 0x47414D44; // GAMD
size = func_80073C4C(); // 256 bytes
sp2C = allocate_from_main_pool_safe(size, COLOR_TAG_WHITE);
*((s32*)sp2C) = 'GAMD';
func_800732E8(arg1, sp2C + 4);
phi_v1 = func_80073C5C(arg0, 3, &sp30);
if (phi_v1 == 0) {
phi_v1 = func_800766D4(arg0, -1, &D_800E7680, &sp30, sp2C, sp24);
phi_v1 = func_800766D4(arg0, -1, &D_800E7680, &sp30, sp2C, size);
}
free_from_memory_pool(sp2C);
if (phi_v1 != 0) {
@@ -167,7 +157,7 @@ s32 func_80074148(s32 arg0, Settings *arg1) {
s32 phi_v1;
s32 sp24;
s32 temp_v0;
s32 sp30;
s32 sp30; //Possible epcInfo struct
sp24 = func_80073C54(); // 512 bytes
sp2C = allocate_from_main_pool_safe(sp24, COLOR_TAG_WHITE);
@@ -213,25 +203,9 @@ s32 func_8007497C(u64 *arg0) {
GLOBAL_ASM("asm/non_matchings/controller_pak/func_8007497C.s")
#endif
// Ghost data follows directly after the header
/* Size: 8 bytes */
typedef struct GhostHeader {
s16 checksum;
s8 unk2;
s8 unk3;
s16 unk4;
s16 numberFrames;
} GhostHeader;
/* Size: 12 bytes */
typedef struct GhostDataFrame {
u8 pad0[12];
} GhostDataFrame;
#ifdef NON_MATCHING
// regalloc issues
s32 func_80074A4C(GhostHeader *ghostHeader) {
s16 func_80074A4C(GhostHeader *ghostHeader) {
s16 i;
s16 len;
s16 sum;
@@ -248,11 +222,11 @@ s32 func_80074A4C(GhostHeader *ghostHeader) {
GLOBAL_ASM("asm/non_matchings/controller_pak/func_80074A4C.s")
#endif
void func_80074AA8(GhostHeader *ghostHeader, s16 arg1, s16 arg2, s16 numberFrames, u8 *dest) {
void func_80074AA8(GhostHeader *ghostHeader, s16 characterID, s16 time, s16 numberFrames, u8 *dest) {
ghostHeader->checksum = 0;
ghostHeader->unk2 = arg1;
ghostHeader->characterID = characterID;
ghostHeader->unk3 = 0;
ghostHeader->unk4 = arg2;
ghostHeader->time = time;
ghostHeader->numberFrames = numberFrames;
bcopy(dest, (u8*)ghostHeader + 8, numberFrames * sizeof(GhostDataFrame));
ghostHeader->checksum = func_80074A4C(ghostHeader);
@@ -451,13 +425,13 @@ s32 func_80076AF4(s32 controllerIndex, s32 fileNum) {
data = allocate_from_main_pool_safe(0x100, COLOR_TAG_BLACK);
if (read_data_from_controller_pak(controllerIndex, fileNum, (u8 *)data, 0x100) == 0) {
switch(*data) {
case 0x47414D44: // GAMD, Game Data?
case 'GAMD': // Game Data?
ret = 3;
break;
case 0x54494D44: // TIMD, Time Data?
case 'TIMD': // Time Data?
ret = 4;
break;
case 0x47485353: // GHSS, Ghosts?
case 'GHSS': // Ghosts?
ret = 5;
break;
default:
+50 -1
View File
@@ -2,11 +2,60 @@
#define _UNKNOWN_072E50_H_
#include "types.h"
#include "memory.h"
#include "PR/pfs.h"
#include "PR/os_cont.h"
#include "macros.h"
#include "structs.h"
#include "camera.h"
extern s32 D_800DE440;
typedef struct GhostHeaderChecksum {
u8 levelID;
u8 vehicleID; // 0 = Car, 1 = Hovercraft, 2 = Plane
} GhostHeaderChecksum;
typedef struct GhostHeader {
//GhostHeaderChecksum checksum;
s16 checksum;
u8 characterID; // 9 = T.T.
u8 unk3; // Might just be padding?
s16 time; // In frames, where 60 frames = 1 second.
s16 numberFrames;
} GhostHeader;
/* Size: 12 bytes */
typedef struct GhostDataFrame {
u8 pad0[12];
} GhostDataFrame;
extern s32 *D_800DE440;
extern u8 gN64FontCodes[68];
extern s32 D_800DE488;
extern s32 D_800DE48C;
u8 func_80072250(s32 arg0);
void func_80072298(u8 arg0);
void func_80072708(void);
s32 func_80073C4C(void);
s32 func_80073C54(void);
s32 func_80073F5C(s32 arg0, s32 arg1);
s32 func_80074148(s32 arg0, Settings *arg1);
void func_80074AA8(GhostHeader *ghostHeader, s16 characterID, s16 time, s16 numberFrames, u8 *dest);
s32 func_80075AEC(s32 controllerIndex);
s32 func_80075D38(s32 controllerIndex);
s32 func_80075DC4(s32 controllerIndex);
void func_80076164(void);
s32 func_80076194(s32 controllerIndex, s32 *arg1, s32 *arg2);
s32 read_data_from_controller_pak(s32 controllerIndex, s32 fileNum, u8 *data, s32 dataLength);
s32 func_80076AF4(s32 controllerIndex, s32 fileNum);
s32 func_800722E8(s16 arg0); //Non matching
s32 func_800738A4(Settings *arg0, void *arg1); //Non matching
s64 func_8007480C(u64 arg0); //Non matching
s32 func_8007497C(u64 *arg0); //Non matching
s32 func_80074B1C(void); //Non matching
s32 func_800762C8(s32 controllerIndex, s32 fileNum); //Non matching
s32 func_80076924(s32 controllerIndex, s32 arg1, s32 *arg2); //Non matching
s16 func_80074A4C(GhostHeader *ghostHeader); //Non matching
#endif
+17 -38
View File
@@ -42,56 +42,56 @@ s16 D_800E3230[28] = {
0xFE20, 0x0078, 0xFEC0, 0x0078, 0xFF60, 0x0078, 0x0000, 0x0078,
0x00A0, 0x0078, 0x0140, 0x0078, 0x01E0, 0x0078, 0xFE20, 0xFF88,
0xFEC0, 0xFF88, 0xFF60, 0xFF88, 0x0000, 0xFF88, 0x00A0, 0xFF88,
0x0140, 0xFF88, 0x01E0, 0xFF88
0x0140, 0xFF88, 0x01E0, 0xFF88,
};
s16 D_800E3268[28] = {
0xFF60, 0x0168, 0xFF60, 0x00F0, 0xFF60, 0x0078, 0xFF60, 0x0000,
0xFF60, 0xFF88, 0xFF60, 0xFF10, 0xFF60, 0xFF10, 0x00A0, 0x0168,
0x00A0, 0x00F0, 0x00A0, 0x0078, 0x00A0, 0x0000, 0x00A0, 0xFF88,
0x00A0, 0xFF10, 0x00A0, 0xFF10
0x00A0, 0xFF10, 0x00A0, 0xFF10,
};
s8 D_800E32A0[12] = {
0x00, 0x02, 0x04, 0x0E, 0x10, 0x12, 0x08, 0x0A,
0x0C, 0x16, 0x18, 0x1A
0x0C, 0x16, 0x18, 0x1A,
};
s8 D_800E32AC[12] = {
0x04, 0x06, 0x08, 0x12, 0x14, 0x16, 0x04, 0x06,
0x08, 0x12, 0x14, 0x16
0x08, 0x12, 0x14, 0x16,
};
s8 D_800E32B8[24] = {
0, 3, 1, 1, 3, 4, 1, 4,
2, 2, 4, 5, 6, 9, 7, 7,
9, 10, 7, 10, 8, 8, 10, 11
9, 10, 7, 10, 8, 8, 10, 11,
};
s8 D_800E32D0[12] = {
-1, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, -1
-1, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, -1,
};
s16 D_800E32DC[24] = {
0xFCE0, 0x0078, 0xFE20, 0x0078, 0xFF60, 0x0078, 0x00A0, 0x0078,
0x01E0, 0x0078, 0x0320, 0x0078, 0xFCE0, 0xFF88, 0xFE20, 0xFF88,
0xFF60, 0xFF88, 0x00A0, 0xFF88, 0x01E0, 0xFF88, 0x0320, 0xFF88
0xFF60, 0xFF88, 0x00A0, 0xFF88, 0x01E0, 0xFF88, 0x0320, 0xFF88,
};
s8 D_800E330C[12] = {
0, 2, 4, 12, 14, 8, 10, 18, 20, 22, 0, 0
0, 2, 4, 12, 14, 8, 10, 18, 20, 22, 0, 0,
};
s8 D_800E3318[12] = {
4, 6, 8, 16, 18, 4, 6, 14, 16, 18, 0, 0
4, 6, 8, 16, 18, 4, 6, 14, 16, 18, 0, 0,
};
s8 D_800E3324[20] = {
0, 1, 3, 1, 3, 4, 1, 4, 2, 5, 7, 8, 5, 8, 6, 6, 8, 9, 0, 0
0, 1, 3, 1, 3, 4, 1, 4, 2, 5, 7, 8, 5, 8, 6, 6, 8, 9, 0, 0,
};
s8 D_800E3338[12] = {
-1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0
-1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0,
};
s16 D_800E3344[126] = {
@@ -110,7 +110,7 @@ s16 D_800E3344[126] = {
0xFFC0, 0xFEE8, 0xFFD0, 0xFEE8, 0xFFE0, 0xFEE8, 0xFFF0, 0xFEE8,
0x0000, 0xFEE8, 0x0010, 0xFEE8, 0x0020, 0xFEE8, 0x0030, 0xFEE8,
0x0040, 0xFEE8, 0x0050, 0xFEE8, 0x0060, 0xFEE8, 0x0070, 0xFEE8,
0x0080, 0xFEE8, 0x0090, 0xFEE8, 0x00A0, 0xFEE8
0x0080, 0xFEE8, 0x0090, 0xFEE8, 0x00A0, 0xFEE8,
};
s8 D_800E3440[92] = {
@@ -125,7 +125,7 @@ s8 D_800E3440[92] = {
0x12, 0x14, 0x16, 0x18, 0x1A, 0x62, 0x64, 0x66,
0x68, 0x6A, 0x6C, 0x6E, 0x1A, 0x1C, 0x1E, 0x20,
0x22, 0x24, 0x26, 0x28, 0x6E, 0x70, 0x72, 0x74,
0x76, 0x78, 0x7A, 0x7C
0x76, 0x78, 0x7A, 0x7C,
};
s8 D_800E349C[92] = {
@@ -140,7 +140,7 @@ s8 D_800E349C[92] = {
0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x62, 0x64, 0x66,
0x68, 0x6A, 0x6C, 0x6E, 0x6E, 0x70, 0x72, 0x74,
0x76, 0x78, 0x7A, 0x7C, 0x6E, 0x70, 0x72, 0x74,
0x76, 0x78, 0x7A, 0x7C
0x76, 0x78, 0x7A, 0x7C,
};
s8 D_800E34F8[92] = {
@@ -149,7 +149,7 @@ s8 D_800E34F8[92] = {
0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
s8 D_800E3554[244] = {
@@ -168,7 +168,7 @@ s8 D_800E3554[244] = {
5, 12, 13, 5, 13, 6, 0, 8, 9, 0, 9, 1, 1, 9, 10, 1,
10, 2, 2, 10, 11, 2, 11, 3, 3, 11, 12, 3, 12, 4, 4, 12,
13, 4, 13, 5, 5, 13, 14, 5, 14, 6, 6, 14, 15, 6, 15, 7,
0, 0, 0, 0
0, 0, 0, 0,
};
Gfx D_800E3648[] = {
@@ -209,27 +209,6 @@ s32 D_8012A77C;
/*****************************/
extern u32 osTvType;
void func_80067F20(f32 arg0);
void func_800C0724(void);
void func_800C0834(s32);
void render_fade_fullscreen(Gfx **dlist, s32 arg1, s32 arg2);
void func_800C1130(s32);
void render_fade_barndoor_horizontal(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_barndoor_vertical(Gfx **dlist, s32 arg1, s32 arg2);
void func_800C1EE8(s32);
void render_fade_circle(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_waves(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_barndoor_diagonal(Gfx **dlist, s32 arg1, s32 arg2);
void func_800C27A0(s32);
void render_fade_disabled(Gfx **dlist, s32 arg1, s32 arg2);
void func_800C0780(FadeTransition *transition);
void func_800C0B00(FadeTransition *transition, s32, s32, s16*, s8*, s8*, s8*, s8*, s8*);
void func_800C15D4(FadeTransition *transition);
void func_800C2640(FadeTransition *transition);
void func_800C0724(void);
void func_800C0170(void) {
D_800E31A0 = 1;
}
@@ -359,7 +338,7 @@ void render_fade_transition(s32 dlist, s32 arg1, s32 arg2) {
} else {
func_80067F20(1.2f);
}
func_80067F2C(dlist, arg1, arg2);
func_80067F2C(dlist, arg1);
func_80067F20(1.0f);
switch (gCurFaceTransition) {
case FADE_FULLSCREEN:
+27
View File
@@ -2,6 +2,7 @@
#define _FADE_TRANSITION_H_
#include "types.h"
#include "camera.h"
#define FADE_FULLSCREEN 0
#define FADE_BARNDOOR_HORIZONTAL 1
@@ -27,4 +28,30 @@ typedef struct FadeTransition {
u16 unk6;
} FadeTransition;
extern u32 osTvType;
void func_800C0170(void);
void func_800C0180(void);
void func_800C0724(void);
s32 func_800C0494(s32 arg0);
void render_fade_transition(s32 dlist, s32 arg1, s32 arg2);
void render_fade_fullscreen(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_barndoor_horizontal(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_barndoor_vertical(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_barndoor_diagonal(Gfx **dlist, s32 arg1, s32 arg2);
void render_fade_disabled(Gfx **dlist, s32 arg1, s32 arg2);
void func_800C0780(FadeTransition *transition);
void render_fade_circle(Gfx **dlist, s32 arg1, s32 arg2); //Non Matching
void render_fade_waves(Gfx **dlist, s32 arg1, s32 arg2); //Non Matching
void func_800C0834(s32); //Non Matching
void func_800C1130(s32); //Non Matching
void func_800C1EE8(s32); //Non Matching
void func_800C27A0(s32 arg0); //Non Matching
void func_800C0B00(FadeTransition *transition, s32, s32, s16*, s8*, s8*, s8*, s8*, s8*); //Non Matching
void func_800C15D4(FadeTransition *transition); //Non Matching
void func_800C2640(FadeTransition *transition); //Non Matching
s32 func_800C018C(void); //Non Matching
s32 func_800C01D8(FadeTransition *transition); //Non Matching
#endif
+1
View File
@@ -25,6 +25,7 @@
#define COLOR_TAG_BLACK 0x000000FF
void *allocate_from_main_pool_safe(s32 size, u32 colorTag);
void free_from_memory_pool(void *data);
s32 func_80071478(u8 *address);
#endif
-1
View File
@@ -1550,7 +1550,6 @@ void func_8009C508(s32 arg0);
void *allocate_from_main_pool_safe(s32, u32);
void func_800C4170(s32 arg0);
void play_music(s32 arg0);
void func_800C01D8(FadeTransition*);
void render_textured_rectangle(Gfx **dlist, DrawTexture *arg1, s32 arg2, s32 arg3, u8 red, u8 green, u8 blue, u8 alpha);
void func_8007B3D0(Gfx **dlist);
void func_8009BD5C(void);
-1
View File
@@ -208,7 +208,6 @@ Settings *get_settings(void);
s32 is_in_tracks_mode(void);
s32 *load_asset_section_from_rom(s32);
void load_asset_to_address(u32, s32*, s32, s32);
void free_from_memory_pool(s32*);
void func_8006C1AC(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void func_8006C2E4(void);
s16 func_8006C2F0(void);