More General Cleanup (#1638)

* LINKER_FILES in makefile

* COLPOLY_GET_NORMAL

* math header

* libc

* M_PI for cosf and sinf files

* MAXFLOAT

* Revert "MAXFLOAT"

This reverts commit 96b75ffaa8.

* Remove SHT_MINV

* SHRT_MAX

* Add M_PI

* Angle macros

* f suffix

* Format
This commit is contained in:
Derek Hensley
2024-06-03 11:33:03 -07:00
committed by GitHub
parent 312b65d5e3
commit f26e77ba40
144 changed files with 372 additions and 369 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
#include "ultratypes.h"
#include "os_voice.h"
#include "os_message.h"
#include "libc/stddef.h"
#include "stddef.h"
typedef struct {
/* 0x0 */ u8 dummy;
+1 -1
View File
@@ -2,7 +2,7 @@
#define PR_OS_CACHE_H
#include "ultratypes.h"
#include "libc/stddef.h"
#include "stddef.h"
void osInvalDCache(void* vaddr, size_t nbytes);
void osInvalICache(void* vaddr, size_t nbytes);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef PR_CONVERT_H
#define PR_CONVERT_H
#include "libc/stdint.h"
#include "stdint.h"
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
+1 -1
View File
@@ -2,7 +2,7 @@
#define PR_OS_INTERNAL_SI_H
#include "ultratypes.h"
#include "libc/stdint.h"
#include "stdint.h"
s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef PR_OS_LIBC_H
#define PR_OS_LIBC_H
#include "libc/stdarg.h"
#include "stdarg.h"
void bcopy(void* __src, void* __dest, int __n);
+2 -2
View File
@@ -3,8 +3,8 @@
#include "ultratypes.h"
#include "os_message.h"
#include "libc/stddef.h"
#include "libc/stdint.h"
#include "stddef.h"
#include "stdint.h"
typedef struct {
+1 -1
View File
@@ -3,7 +3,7 @@
#include "ultratypes.h"
#include "os_pi.h"
#include "libc/stdint.h"
#include "stdint.h"
#define LEO_BASE_REG 0x05000000
+1 -1
View File
@@ -2,7 +2,7 @@
#define PR_XSTDIO_H
#include "ultratypes.h"
#include "libc/stdarg.h"
#include "stdarg.h"
typedef struct {
/* 0x0 */ union {
+1 -1
View File
@@ -2,7 +2,7 @@
#define AUDIO_HEAP_H
#include "PR/ultratypes.h"
#include "libc/stddef.h"
#include "stddef.h"
#include "unk.h"
typedef struct AudioHeapInitSizes {
+2 -2
View File
@@ -5,8 +5,8 @@
#include "PR/os.h"
#include "PR/os_message.h"
#include "PR/ultratypes.h"
#include "libc/stddef.h"
#include "libc/stdint.h"
#include "stddef.h"
#include "stdint.h"
#include "unk.h"
typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef BUFFERS_H
#define BUFFERS_H
#include "libc/assert.h"
#include "assert.h"
#include "gfx.h"
#include "macros.h"
#include "stack.h"
+2 -2
View File
@@ -3,8 +3,8 @@
#include "ultra64.h"
#include "libc/stdarg.h"
#include "libc/stdint.h"
#include "stdarg.h"
#include "stdint.h"
#include "PR/controller.h"
#include "padmgr.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef ICHAIN_H
#define ICHAIN_H
#include "libc/stddef.h"
#include "stddef.h"
typedef struct InitChainEntry {
u32 cont: 1;
+7 -6
View File
@@ -1,12 +1,13 @@
#ifndef LIBC_MATH_H
#define LIBC_MATH_H
#define M_PI 3.14159265358979323846f
#define M_SQRT2 1.41421356237309504880f
#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
#define FLT_MAX 340282346638528859811704183484516925440.0f
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)
#define M_PI 3.14159265358979323846
#define M_PIf 3.14159265358979323846f
#define M_SQRT2f 1.41421356237309504880f
#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */
#define FLT_MAX 3.40282347e+38f
#define SHRT_MAX 32767.0f
float fabsf(float f);
#pragma intrinsic(fabsf)
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef LIBC_STDLIB_H
#define LIBC_STDLIB_H
#include "libc/stddef.h"
#include "stddef.h"
typedef struct {
/* 0x0 */ int quot;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef LIBC_STRING_H
#define LIBC_STRING_H
#include "libc/stddef.h"
#include "stddef.h"
const char* strchr(const char* s, int c);
size_t strlen(const char* s);
+1 -1
View File
@@ -2,7 +2,7 @@
#define LIBC64_OS_MALLOC_H
#include "ultra64.h"
#include "libc/stddef.h"
#include "stddef.h"
typedef struct ArenaNode {
/* 0x0 */ s16 magic; // Should always be 0x7373
+2 -2
View File
@@ -2,8 +2,8 @@
#define LOADFRAGMENT_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
#include "libc/stddef.h"
#include "stdint.h"
#include "stddef.h"
extern s32 gOverlayLogSeverity;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef MACROS_H
#define MACROS_H
#include "libc/stdint.h"
#include "stdint.h"
#include "PR/os_convert.h"
#define SCREEN_WIDTH 320
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef PADMGR_H
#define PADMGR_H
#include "libc/stdbool.h"
#include "stdbool.h"
#include "ultra64.h"
#include "irqmgr.h"
#include "padutils.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#define ROMFILE_H
#include "ultra64.h"
#include "libc/stdint.h"
#include "stdint.h"
typedef struct {
/* 0x00 */ uintptr_t vromStart;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef SEGMENT_SYMBOLS_H
#define SEGMENT_SYMBOLS_H
#include "libc/stddef.h"
#include "stddef.h"
#include "PR/ultratypes.h"
#include "romfile.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#define SYS_CPMDMA_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
#include "stdint.h"
void CmpDma_LoadFile(uintptr_t segmentVrom, s32 id, void* dst, size_t size);
void CmpDma_LoadAllFiles(uintptr_t segmentVrom, void* dst, size_t size);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef SYSTEM_HEAP_H
#define SYSTEM_HEAP_H
#include "libc/stddef.h"
#include "stddef.h"
#include "PR/ultratypes.h"
void* SystemHeap_Malloc(size_t size);
+2 -2
View File
@@ -2,8 +2,8 @@
#define THA_H
#include "ultra64.h"
#include "libc/stdint.h"
#include "libc/stddef.h"
#include "stdint.h"
#include "stddef.h"
typedef struct TwoHeadArena {
/* 0x0 */ size_t size;
+6 -6
View File
@@ -3,12 +3,12 @@
#include "ultra64.h"
#include "libc/math.h"
#include "libc/stdarg.h"
#include "libc/stdbool.h"
#include "libc/stddef.h"
#include "libc/stdint.h"
#include "libc/stdlib.h"
#include "math.h"
#include "stdarg.h"
#include "stdbool.h"
#include "stddef.h"
#include "stdint.h"
#include "stdlib.h"
#include "libc64/qrand.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#define Z64ACTOR_DLFTBLS_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
#include "stdint.h"
#include "segment_symbols.h"
// This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD.
+1 -1
View File
@@ -4,7 +4,7 @@
#include "PR/ultratypes.h"
#include "PR/os_voice.h"
#include "audiothread_cmd.h"
#include "libc/stddef.h"
#include "stddef.h"
#include "unk.h"
#include "audio/heap.h"
+2 -2
View File
@@ -11,8 +11,8 @@ struct DynaPolyActor;
#define SS_NULL 0xFFFF
#define COLPOLY_NORMAL_FRAC (1.0f / SHT_MAX)
#define COLPOLY_SNORMAL(x) ((s16)((x) * SHT_MAX))
#define COLPOLY_NORMAL_FRAC (1.0f / SHRT_MAX)
#define COLPOLY_SNORMAL(x) ((s16)((x) * SHRT_MAX))
#define COLPOLY_GET_NORMAL(n) ((n)*COLPOLY_NORMAL_FRAC)
#define COLPOLY_VIA_FLAG_TEST(vIA, flags) ((vIA) & (((flags)&7) << 13))
#define COLPOLY_VTX_INDEX(vI) ((vI)&0x1FFF)
+1 -1
View File
@@ -2,7 +2,7 @@
#define Z64EFFECT_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
#include "stdint.h"
#include "color.h"
#include "z64light.h"
#include "z64math.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#define Z64FONT_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
#include "stdint.h"
struct PlayState;
+2 -2
View File
@@ -3,8 +3,8 @@
#include "ultra64.h"
#include "libc/stdbool.h"
#include "libc/stdint.h"
#include "stdbool.h"
#include "stdint.h"
#include "gamealloc.h"
#include "padmgr.h"
#include "padutils.h"
+9 -9
View File
@@ -2,7 +2,7 @@
#define Z64MATH_H
#include "ultra64.h"
#include "libc/math.h"
#include "math.h"
#include "libc64/math64.h"
@@ -168,21 +168,21 @@ typedef union {
#define TRUNCF_BINANG(f) (s16)(s32)(f)
// Angle conversion macros
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
#define DEG_TO_RAD(degrees) ((degrees) * (M_PIf / 180.0f))
#define DEG_TO_BINANG(degrees) TRUNCF_BINANG((degrees) * (0x8000 / 180.0f))
#define DEG_TO_BINANG_ALT(degrees) TRUNCF_BINANG(((degrees) / 180.0f) * 0x8000)
#define DEG_TO_BINANG_ALT2(degrees) TRUNCF_BINANG(((degrees) * 0x10000) / 360.0f)
#define DEG_TO_BINANG_ALT3(degrees) ((degrees) * (0x8000 / 180.0f))
#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PI))
#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PI))
#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PI) * 0x8000)
#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PI)
#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PIf))
#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PIf))
#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PIf) * 0x8000)
#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PIf)
#define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000))
#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000))
#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PI)
#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000)
#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PIf / 0x8000))
#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PIf)
#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PIf) / 0x8000)
// Angle arithmetic macros
#define BINANG_ROT180(angle) ((s16)(angle + 0x8000))
+1 -1
View File
@@ -2,7 +2,7 @@
#define Z64MESSAGE_H
#include "PR/ultratypes.h"
#include "libc/stdbool.h"
#include "stdbool.h"
#include "z64bombers_notebook.h"
#include "z64font.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef Z64OBJECT_H
#define Z64OBJECT_H
#include "libc/stdint.h"
#include "stdint.h"
#define DEFINE_OBJECT(_name, enumValue) enumValue,
#define DEFINE_OBJECT_UNSET(enumValue) enumValue,
+1 -1
View File
@@ -3,7 +3,7 @@
#include "ultra64.h"
#include "libc/stdint.h"
#include "stdint.h"
#include "unk.h"
#include "romfile.h"