mirror of
https://github.com/zeldaret/oot
synced 2026-06-22 00:46:38 -04:00
padmgr and related (#71)
* In process of moving changes over from old repo * Merged in changes * Finished import of padmgr changes from old repo * Adjusted some volatile * Improving padmgr volatile situation * Almost matched osReadMempak * Working on osMempakDataCRC * Explanations and equivalents but no matches for osMempakAddrCRC and osMempakDataCRC * OK after merge * Matched osMempakAddrCRC and osMempakDataCRC * Matched osReadMempak * Updated PadMgr function names to be less like original code * Changed variable names to make them further from original code * Changed names and it stopped matching * Undid clang-format steamrollering whitespace memes * Cleaned up Input names * More formatting changes * Moved padmgr to z64.h, deleted padmgr.h
This commit is contained in:
+20
-18
@@ -1561,19 +1561,21 @@ void ListAlloc_Free(ListAlloc* this, void* data);
|
||||
void ListAlloc_FreeAll(ListAlloc* this);
|
||||
void Main_LogSystemHeap();
|
||||
void Main(void*);
|
||||
// OSMesgQueue* PadMgr_LockGetControllerQueue(PadMgr* padmgr);
|
||||
// void PadMgr_UnlockReleaseControllerQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue);
|
||||
// void PadMgr_Lock2(PadMgr* padmgr);
|
||||
// void PadMgr_Unlock2(PadMgr* padmgr)
|
||||
// ? func_800C740C(?);
|
||||
// ? func_800C7818(?);
|
||||
// ? func_800C7928(?);
|
||||
// ? func_800C7948(?);
|
||||
// ? func_800C7974(?);
|
||||
// ? func_800C7C14(?);
|
||||
// ? func_800C7DD0(?);
|
||||
void func_800C7E08(Input*, u32);
|
||||
// void PadMgr_Init(PadMgr* padmgr, OSMesg mesg, UNK_TYPE arg2, OSId id, OSPri priority, void* stack);
|
||||
OSMesgQueue* PadMgr_LockSerialMesgQueue(PadMgr* padmgr);
|
||||
void PadMgr_UnlockSerialMesgQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue);
|
||||
void PadMgr_LockPadData(PadMgr* padmgr);
|
||||
void PadMgr_UnlockPadData(PadMgr* padmgr);
|
||||
void PadMgr_RumbleControl(PadMgr* padmgr);
|
||||
void PadMgr_RumbleStop(PadMgr* padmgr);
|
||||
void PadMgr_RumbleReset(PadMgr* padmgr);
|
||||
void PadMgr_RumbleSet(PadMgr* padmgr, u8* ctrlr_rumbles);
|
||||
void PadMgr_ProcessInputs(PadMgr* padmgr);
|
||||
void PadMgr_HandleRetraceMsg(PadMgr* padmgr);
|
||||
void PadMgr_HandlePreNMI(PadMgr* padmgr);
|
||||
// This function must remain commented out, because it is called incorrectly in
|
||||
// fault.c (actual bug in game), and the compiler notices and won't compile it
|
||||
// void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode);
|
||||
void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* siIntMsgQ, UNK_TYPE arg2, OSId id, OSPri priority, void* stack);
|
||||
// ? func_800C82A0(?);
|
||||
// ? func_800C84E4(?);
|
||||
// ? func_800C8534(?);
|
||||
@@ -2334,9 +2336,9 @@ s16 sins(u16);
|
||||
// ? func_801004C0(?);
|
||||
// ? func_801005CC(?);
|
||||
// ? func_80100734(?);
|
||||
// s32 osSetVibration(unk_controller_t *arg0, u32 vibrate);
|
||||
// s32 osSetRumble(unk_controller_t *arg0, u32 vibrate);
|
||||
// void osSetUpMempakWrite(s32 ctrlridx, pif_data_buffer_t* buf);
|
||||
// s32 osProbeVibrationPack(OSMesgQueue* ctrlrqueue, unk_controller_t *unk_controller, u32 ctrlridx);
|
||||
// s32 osProbeRumblePak(OSMesgQueue* ctrlrqueue, unk_controller_t *unk_controller, u32 ctrlridx);
|
||||
// void __osSiCreateAccessQueue();
|
||||
// void __osSiGetAccess();
|
||||
// void __osSiRelAccess();
|
||||
@@ -2410,9 +2412,9 @@ void func_80104D00(u8 a0);
|
||||
// ? osAiGetLength(?);
|
||||
// ? func_80105C20(?);
|
||||
// ? func_80105CF0(?);
|
||||
// ? func_80105F40(?);
|
||||
// ? func_80106170(?);
|
||||
// ? func_80106240(?);
|
||||
// s32 osReadMempak(OSMesgQueue* ctrlrqueue, u32 ctrlridx, s16 addr, PIF_mempak_data_t* data)
|
||||
u8 osMempakAddrCRC(u16 addr);
|
||||
u8 osMempakDataCRC(u8 *data);
|
||||
u32 __osSpGetStatus();
|
||||
void __osSpSetStatus(u32 status);
|
||||
// ? osWritebackDCacheAll(?);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef _PADMGR_H_
|
||||
#define _PADMGR_H_
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#include <ultra64/controller.h>
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ OSContStatus pad_status[4];
|
||||
/* 0x0010 */ OSMesg msgbuf1[1];
|
||||
/* 0x0014 */ OSMesg msgbuf2[1];
|
||||
/* 0x0018 */ OSMesg msgbuf3[4];
|
||||
/* 0x0028 */ OSMesgQueue queue1;
|
||||
/* 0x0040 */ OSMesgQueue queue2;
|
||||
/* 0x0058 */ OSMesgQueue queue3;
|
||||
/* 0x0070 */ UNK_TYPE unk_70;
|
||||
/* 0x0074 */ UNK_TYPE unk_74;
|
||||
/* 0x0078 */ UNK_TYPE unk_78;
|
||||
/* 0x007C */ UNK_TYPE unk_7C;
|
||||
/* 0x0080 */ OSThread thread;
|
||||
/* 0x0230 */ char unk_230[0x78];
|
||||
/* 0x02A8 */ u8 unk_2A8;
|
||||
/* 0x02A9 */ u8 unk_2A9;
|
||||
/* 0x02AA */ u8 unk_2AA[4];
|
||||
/* 0x02AA */ u8 unk_2AE[4]; // Looks like 1 if vibration pack, 2 if (maybe controller pack)?
|
||||
/* 0x02B2 */ u8 unk_2B2[4];
|
||||
/* 0x02B6 */ u8 unk_2B6[4];
|
||||
/* 0x02BA */ char unk_2BA[0x02]; // probably padding
|
||||
/* 0x02BC */ unk_controller_t unk_controller[4];
|
||||
/* 0x045C */ u8 unk_45C;
|
||||
/* 0x045D */ u8 unk_45D;
|
||||
/* 0x045E */ u8 unk_45E;
|
||||
/* 0x045F */ u8 unk_45F;
|
||||
/* 0x0460 */ void(*unk_460)(s32 a, s32 b);
|
||||
/* 0x0464 */ s32 unk_464;
|
||||
} PadMgr; // size = 0x468
|
||||
|
||||
|
||||
#endif
|
||||
@@ -2,11 +2,37 @@
|
||||
#define _ULTRA64_CONTROLLER_H_
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#include <PR/os_cont.h>
|
||||
#include <PR/os_message.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x00 */ union{
|
||||
u16 button;
|
||||
struct{
|
||||
u16 a : 1;
|
||||
u16 b : 1;
|
||||
u16 z : 1;
|
||||
u16 s : 1;
|
||||
u16 du : 1;
|
||||
u16 dd : 1;
|
||||
u16 dl : 1;
|
||||
u16 dr : 1;
|
||||
u16 illegal_h : 1;
|
||||
u16 illegal_l : 1;
|
||||
u16 l : 1;
|
||||
u16 r : 1;
|
||||
u16 cu : 1;
|
||||
u16 cd : 1;
|
||||
u16 cl : 1;
|
||||
u16 cr : 1;
|
||||
};
|
||||
};
|
||||
/* 0x02 */ s8 x;
|
||||
/* 0x03 */ s8 y;
|
||||
} PadInput; // size = 0x4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 slot_type; //0xFF for valid command, 0x00 for don't read this controller, 0xFE for end of commands
|
||||
@@ -19,11 +45,7 @@ typedef struct
|
||||
{
|
||||
PIF_header_t hdr;
|
||||
union{
|
||||
struct{
|
||||
u16 button;
|
||||
s8 rawStickX;
|
||||
s8 rawStickY;
|
||||
};
|
||||
PadInput input;
|
||||
struct{
|
||||
u8 ctl_type_lo;
|
||||
u8 ctl_type_hi;
|
||||
@@ -42,6 +64,10 @@ typedef union
|
||||
};
|
||||
} PIF_mempak_wr_t;
|
||||
|
||||
typedef struct {
|
||||
u8 data[0x20];
|
||||
} PIF_mempak_data_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
u8 bytes[0x40];
|
||||
@@ -75,9 +101,9 @@ extern u32 gOsContInitialized; // = 0
|
||||
extern OSMesgQueue _osContMesgQueue;
|
||||
extern OSMesg _osContMesgBuff[4];
|
||||
|
||||
extern s32 osSetVibration(unk_controller_t *arg0, u32 vibrate);
|
||||
extern s32 osSetRumble(unk_controller_t *arg0, u32 vibrate);
|
||||
extern void osSetUpMempakWrite(s32 ctrlridx, pif_data_buffer_t* buf);
|
||||
extern s32 osProbeVibrationPack(OSMesgQueue* ctrlrqueue, unk_controller_t *unk_controller, u32 ctrlridx);
|
||||
extern s32 osProbeRumblePak(OSMesgQueue* ctrlrqueue, unk_controller_t *unk_controller, u32 ctrlridx);
|
||||
extern void __osSiCreateAccessQueue();
|
||||
extern void __osSiGetAccess();
|
||||
extern void __osSiRelAccess();
|
||||
|
||||
+2
-2
@@ -847,7 +847,7 @@ extern s32 gSystemArenaLogSeverity;
|
||||
//extern u32 gOsContInitialized = 0;
|
||||
//extern ? D_80134CF0;
|
||||
//extern ? D_80134CF4;
|
||||
//extern ? D_80134D20;
|
||||
extern s32 D_80134D20;
|
||||
//extern ? D_80135130;
|
||||
//extern ? D_80135158;
|
||||
extern char D_80135180[];
|
||||
@@ -3807,7 +3807,7 @@ extern Arena gSystemArena;
|
||||
//extern OSMesgQueue _osContMesgQueue;
|
||||
//extern OSMesg _osContMesgBuff[4];
|
||||
//extern ? D_80175860;
|
||||
//extern ? D_80175960;
|
||||
extern pif_data_buffer_t pifMempakBuf;
|
||||
//extern ? D_801759A0;
|
||||
//extern ? D_801759A4;
|
||||
//extern ? D_801759A8;
|
||||
|
||||
+57
-34
@@ -4,6 +4,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <ultra64/gbi.h>
|
||||
#include <ultra64/gs2dex.h>
|
||||
#include <ultra64/controller.h>
|
||||
#include <z64light.h>
|
||||
#include <z64actor.h>
|
||||
#include <z64object.h>
|
||||
@@ -279,44 +280,66 @@ typedef struct GraphicsContext {
|
||||
} GraphicsContext; // size = 0x300
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ union {
|
||||
struct {
|
||||
u16 a : 1;
|
||||
u16 b : 1;
|
||||
u16 z : 1;
|
||||
u16 s : 1;
|
||||
u16 du : 1;
|
||||
u16 dd : 1;
|
||||
u16 dl : 1;
|
||||
u16 dr : 1;
|
||||
u16 : 2;
|
||||
u16 l : 1;
|
||||
u16 r : 1;
|
||||
u16 cu : 1;
|
||||
u16 cd : 1;
|
||||
u16 cl : 1;
|
||||
u16 cr : 1;
|
||||
PadInput in;
|
||||
union {
|
||||
u16 status;
|
||||
struct {
|
||||
u8 errno;
|
||||
u8 statusLo;
|
||||
};
|
||||
u16 pad;
|
||||
};
|
||||
/* 0x02 */ s8 x;
|
||||
/* 0x03 */ s8 y;
|
||||
} RawInput; // size = 0x4
|
||||
} PadState;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x00 */ PadState cur;
|
||||
/* 0x06 */ PadState prev;
|
||||
/* 0x0C */ PadState press; // X/Y store delta from last frame
|
||||
/* 0x12 */ PadState rel; // X/Y store adjusted
|
||||
/* The old version of this struct is:
|
||||
RawInput raw;
|
||||
u16 status;
|
||||
RawInput rawPrev;
|
||||
u16 statusPrev;
|
||||
u16 padPressed;
|
||||
s8 xDiff;
|
||||
s8 yDiff;
|
||||
char unk_10[0x02];
|
||||
u16 padReleased;
|
||||
s8 xAdjusted;
|
||||
s8 yAdjusted;
|
||||
char unk_16[0x02];
|
||||
*/
|
||||
} Input; // size = 0x18
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ RawInput raw;
|
||||
/* 0x04 */ u16 status;
|
||||
/* 0x06 */ RawInput rawPrev;
|
||||
/* 0x0A */ u16 statusPrev;
|
||||
/* 0x0C */ u16 padPressed;
|
||||
/* 0x0E */ s8 xDiff;
|
||||
/* 0x0F */ s8 yDiff;
|
||||
/* 0x10 */ char unk_10[0x02];
|
||||
/* 0x12 */ u16 padReleased;
|
||||
/* 0x14 */ s8 xAdjusted;
|
||||
/* 0x15 */ s8 yAdjusted;
|
||||
/* 0x16 */ char unk_16[0x02];
|
||||
} Input; // size = 0x18
|
||||
/* 0x0000 */ OSContStatus pad_status[4];
|
||||
/* 0x0010 */ OSMesg msgbuf1[1];
|
||||
/* 0x0014 */ OSMesg msgbuf2[1];
|
||||
/* 0x0018 */ OSMesg msgbuf3[4];
|
||||
/* 0x0028 */ OSMesgQueue queue1;
|
||||
/* 0x0040 */ OSMesgQueue queue2;
|
||||
/* 0x0058 */ OSMesgQueue queue3;
|
||||
/* 0x0070 */ UNK_TYPE unk_70;
|
||||
/* 0x0074 */ UNK_TYPE unk_74;
|
||||
/* 0x0078 */ UNK_TYPE unk_78;
|
||||
/* 0x007C */ UNK_TYPE unk_7C;
|
||||
/* 0x0080 */ OSThread thread;
|
||||
/* 0x0230 */ Input inputs[4]; // 0x18 each = 0x60 total
|
||||
/* 0x0290 */ PadState pads[4]; // 0x6 each = 0x18 total
|
||||
/* 0x02A8 */ volatile u8 validCtrlrsMask;
|
||||
/* 0x02A9 */ s8 ncontrollers;
|
||||
/* 0x02AA */ u8 ctrlrIsConnected[4]; // Key_switch in original code
|
||||
/* 0x02AE */ u8 pakType[4]; // 1 if rumble pack, 2 if mempak?
|
||||
/* 0x02B2 */ volatile u8 rumbleEnable[4];
|
||||
/* 0x02B6 */ u8 rumbleCounter[4]; // not clear exact meaning
|
||||
/* 0x02BC */ unk_controller_t unk_controller[4];
|
||||
/* 0x045C */ volatile u8 rumbleOffFrames;
|
||||
/* 0x045D */ volatile u8 rumbleOnFrames;
|
||||
/* 0x045E */ u8 preNMIShutdown;
|
||||
/* 0x0460 */ void (*retraceCallback)(void* padmgr, u32 unk464);
|
||||
/* 0x0464 */ u32 retraceCallbackValue;
|
||||
} PadMgr; // size = 0x468
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ s16 unk_0;
|
||||
|
||||
Reference in New Issue
Block a user