1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-20 13:40:02 +00:00

Use intptr types in a few specific boot files (#1301)

* Add stdint.h with intptr_t and uinptr_t

* Use intptr types in dmamgr and yaz0

* Use intptr types in stackcheck

* Use intptr types in idle

* Run formatter

* Use pointers for StackEntry (+ minor type fix)
This commit is contained in:
Roman971 2022-07-12 18:47:25 +02:00 committed by GitHub
commit 7564502b0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 78 additions and 51 deletions

View file

@ -22,23 +22,23 @@ void Idle_ThreadEntry(void* arg);
void ViConfig_UpdateVi(u32 black);
void ViConfig_UpdateBlack(void);
s32 DmaMgr_CompareName(const char* name1, const char* name2);
s32 DmaMgr_DmaRomToRam(u32 rom, void* ram, u32 size);
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, u32 size);
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc);
const char* DmaMgr_GetFileNameImpl(u32 vrom);
const char* DmaMgr_GetFileName(u32 vrom);
const char* DmaMgr_GetFileNameImpl(uintptr_t vrom);
const char* DmaMgr_GetFileName(uintptr_t vrom);
void DmaMgr_ProcessMsg(DmaRequest* req);
void DmaMgr_ThreadEntry(void* arg);
s32 DmaMgr_SendRequestImpl(DmaRequest* req, void* ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg);
s32 DmaMgr_SendRequest0(void* ram, u32 vrom, u32 size);
s32 DmaMgr_SendRequestImpl(DmaRequest* req, void* ram, uintptr_t vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg);
s32 DmaMgr_SendRequest0(void* ram, uintptr_t vrom, u32 size);
void DmaMgr_Init(void);
s32 DmaMgr_SendRequest2(DmaRequest* req, void* ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg,
s32 DmaMgr_SendRequest2(DmaRequest* req, void* ram, uintptr_t vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg,
const char* file, s32 line);
s32 DmaMgr_SendRequest1(void* ram, u32 vrom, u32 size, const char* file, s32 line);
s32 DmaMgr_SendRequest1(void* ram, uintptr_t vrom, u32 size, const char* file, s32 line);
void* Yaz0_FirstDMA(void);
void* Yaz0_NextDMA(u8* curSrcPos);
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst);
void Yaz0_Decompress(u32 romStart, u8* dst, u32 size);
void Yaz0_Decompress(uintptr_t romStart, u8* dst, u32 size);
void Locale_Init(void);
void Locale_ResetRegion(void);
u32 func_80001F48(void);
@ -56,7 +56,7 @@ void Mio0_Decompress(Yaz0Header* hdr, u8* dst);
void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace,
const char* name);
void StackCheck_Cleanup(StackEntry* entry);
s32 StackCheck_GetState(StackEntry* entry);
u32 StackCheck_GetState(StackEntry* entry);
u32 StackCheck_CheckAll(void);
u32 StackCheck_Check(StackEntry* entry);
f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min,

View file

@ -5,8 +5,6 @@
typedef unsigned long size_t;
typedef unsigned int uintptr_t;
#ifdef __GNUC__
#define offsetof(structure, member) __builtin_offsetof (structure, member)
#else

26
include/libc/stdint.h Normal file
View file

@ -0,0 +1,26 @@
#ifndef STDINT_H
#define STDINT_H
typedef signed int intptr_t;
typedef unsigned int uintptr_t;
#define INT8_MIN (-0x80)
#define INT16_MIN (-0x8000)
#define INT32_MIN (-0x80000000)
#define INT64_MIN (-0x8000000000000000)
#define INT8_MAX 0x7F
#define INT16_MAX 0x7FFF
#define INT32_MAX 0x7FFFFFFF
#define INT64_MAX 0x7FFFFFFFFFFFFFFF
#define UINT8_MAX 0xFF
#define UINT16_MAX 0xFFFF
#define UINT32_MAX 0xFFFFFFFF
#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#endif

View file

@ -7,6 +7,7 @@
#include "libc/stdarg.h"
#include "libc/stdbool.h"
#include "libc/stddef.h"
#include "libc/stdint.h"
#include "libc/stdlib.h"
#include "libc/math.h"

View file

@ -1509,8 +1509,8 @@ typedef struct {
typedef struct StackEntry {
/* 0x00 */ struct StackEntry* next;
/* 0x04 */ struct StackEntry* prev;
/* 0x08 */ u32 head;
/* 0x0C */ u32 tail;
/* 0x08 */ u32* head;
/* 0x0C */ u32* tail;
/* 0x10 */ u32 initValue;
/* 0x14 */ s32 minSpace;
/* 0x18 */ const char* name;

View file

@ -4,21 +4,21 @@
#include "ultra64.h"
typedef struct {
/* 0x00 */ u32 vromAddr; // VROM address (source)
/* 0x04 */ void* dramAddr; // DRAM address (destination)
/* 0x08 */ u32 size; // File Transfer size
/* 0x0C */ const char* filename; // Filename for debugging
/* 0x10 */ s32 line; // Line for debugging
/* 0x14 */ s32 unk_14;
/* 0x00 */ uintptr_t vromAddr; // VROM address (source)
/* 0x04 */ void* dramAddr; // DRAM address (destination)
/* 0x08 */ u32 size; // File Transfer size
/* 0x0C */ const char* filename; // Filename for debugging
/* 0x10 */ s32 line; // Line for debugging
/* 0x14 */ s32 unk_14;
/* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
} DmaRequest; // size = 0x20
typedef struct {
/* 0x00 */ u32 vromStart;
/* 0x04 */ u32 vromEnd;
/* 0x08 */ u32 romStart;
/* 0x0C */ u32 romEnd;
/* 0x00 */ uintptr_t vromStart;
/* 0x04 */ uintptr_t vromEnd;
/* 0x08 */ uintptr_t romStart;
/* 0x0C */ uintptr_t romEnd;
} DmaEntry;
#endif