mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
First build ( with linker errors )
This commit is contained in:
@@ -2,16 +2,7 @@
|
||||
|
||||
// these don't feel like they belong here
|
||||
// but it makes the most logical since there was printf data before
|
||||
#ifndef AVOID_UB
|
||||
OSThread *D_80334890 = NULL;
|
||||
u32 D_80334894 = -1;
|
||||
OSThread *D_80334898 = (OSThread *) &D_80334890;
|
||||
OSThread *D_8033489C = (OSThread *) &D_80334890;
|
||||
OSThread *D_803348A0 = NULL;
|
||||
u32 D_803348A4 = 0; // UNKNOWN
|
||||
#else
|
||||
OSThread_ListHead D_80334890_fix = {NULL, -1, (OSThread *) &D_80334890_fix, (OSThread *) &D_80334890_fix, NULL, 0};
|
||||
#endif
|
||||
|
||||
void __osDequeueThread(OSThread **queue, OSThread *thread) {
|
||||
register OSThread **a2;
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
**************************************************************************/
|
||||
|
||||
/* Minor modifications */
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <PR/gu.h>
|
||||
#include <math.h>
|
||||
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0)), 127.0) & 0xff)
|
||||
|
||||
void guLookAtReflectF(float mf[4][4], LookAt *l, float xEye, float yEye, float zEye, float xAt,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "libultra_internal.h"
|
||||
#include <math.h>
|
||||
|
||||
void guNormalize(f32 *x, f32 *y, f32 *z) {
|
||||
f32 tmp = 1.0f / sqrtf(*x * *x + *y * *y + *z * *z);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _LIBAUDIO_INTERNAL_H_
|
||||
#define _LIBAUDIO_INTERNAL_H_
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <PR/libaudio.h>
|
||||
#define AL_BANK_VERSION 0x4231 /* 'B1' */
|
||||
|
||||
typedef u8 ALPan;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _LIBULTRA_INTERNAL_H_
|
||||
#define _LIBULTRA_INTERNAL_H_
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <PR/gu.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* This define is needed because the original definitions in __osDequeueThread.c are declared
|
||||
@@ -8,7 +10,6 @@
|
||||
* assuming a unified structure. To fix this, we declare the full type here and then alias the
|
||||
* symbol names to the correct members in AVOID_UB.
|
||||
*/
|
||||
#ifdef AVOID_UB
|
||||
typedef struct OSThread_ListHead_s
|
||||
{
|
||||
/*0x00*/ struct OSThread_s *next;
|
||||
@@ -33,32 +34,6 @@ extern u32 D_80365E00[16];
|
||||
|
||||
// alias the last array element correctly
|
||||
#define D_80365E3C D_80365E00[15]
|
||||
#else
|
||||
// Original OSThread_ListHead definitions
|
||||
extern OSThread *D_80334890;
|
||||
extern u32 D_80334894;
|
||||
extern OSThread *D_80334898;
|
||||
extern OSThread *D_8033489C;
|
||||
extern OSThread *D_803348A0;
|
||||
|
||||
// Original EEPROM definitions
|
||||
extern u32 D_80365E00[15];
|
||||
extern u32 D_80365E3C;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
u32 initialized; // probably something like initialized?
|
||||
OSThread *mgrThread;
|
||||
OSMesgQueue *cmdQueue;
|
||||
OSMesgQueue *eventQueue;
|
||||
OSMesgQueue *accessQueue;
|
||||
s32 (*dma_func)(s32, u32, void *, size_t);
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s32 (*edma_func)(OSPiHandle*, s32, u32, void *, size_t);
|
||||
#else
|
||||
u64 force_align;
|
||||
#endif
|
||||
} OSMgrArgs;
|
||||
|
||||
s32 __osDisableInt(void);
|
||||
void __osRestoreInt(s32);
|
||||
|
||||
@@ -32,16 +32,10 @@ typedef union {
|
||||
u32 as_raw[2];
|
||||
} OSContPackedStruct;
|
||||
|
||||
#ifdef AVOID_UB
|
||||
// Fix the OSContPackedStruct array
|
||||
extern OSContPackedStruct _osContCmdBuf[8];
|
||||
|
||||
// And fix the last element
|
||||
#define _osContPifCtrl _osContCmdBuf[7].as_raw[1]
|
||||
#else
|
||||
// Original OSContPackedStruct definitions
|
||||
extern OSContPackedStruct _osContCmdBuf[7];
|
||||
extern u32 _osContPifCtrl;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,14 +2,8 @@
|
||||
#include "osContInternal.h"
|
||||
#include <macros.h>
|
||||
|
||||
#ifndef AVOID_UB
|
||||
ALIGNED8 OSContPackedStruct _osContCmdBuf[7];
|
||||
UNUSED static u32 unused; // padding between these two variables
|
||||
u32 _osContPifCtrl;
|
||||
#else
|
||||
// Reordered gcc vars above will disturb the aliasing done to access all 8 members of this array, hence AVOID_UB.
|
||||
ALIGNED8 OSContPackedStruct _osContCmdBuf[8];
|
||||
#endif
|
||||
|
||||
extern u8 _osLastSentSiCmd;
|
||||
extern u8 _osContNumControllers;
|
||||
|
||||
@@ -96,7 +96,5 @@ s32 __osPackEepReadData(u8 address) {
|
||||
*(unkStruct2 *) sp14 = sp8;
|
||||
sp14 += 0xc;
|
||||
*sp14 = 254;
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
#include "libultra_internal.h"
|
||||
#include "osContInternal.h"
|
||||
|
||||
#ifndef AVOID_UB
|
||||
ALIGNED8 u32 D_80365E00[15];
|
||||
u32 D_80365E3C;
|
||||
#else
|
||||
// Certain code accesses the 16th element (D_80365E3C) in this array, making a seperate
|
||||
// definition UB when gcc rearranges those.
|
||||
ALIGNED8 u32 D_80365E00[16];
|
||||
#endif
|
||||
extern u8 _osLastSentSiCmd;
|
||||
|
||||
typedef struct {
|
||||
@@ -108,9 +103,7 @@ s32 __osPackEepWriteData(u8 address, u8 *buffer) {
|
||||
*(unkStruct2 *) sp14 = sp8;
|
||||
sp14 += 0xc;
|
||||
*sp14 = 254;
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
s32 __osEepStatus(OSMesgQueue *a0, unkStruct *a1) {
|
||||
|
||||
@@ -26,14 +26,7 @@ extern void __osTimerInterrupt(void);
|
||||
extern u32 __osProbeTLB(void *);
|
||||
extern int __osSpDeviceBusy(void);
|
||||
|
||||
#ifdef AVOID_UB
|
||||
extern OSThread_ListHead D_80334890_fix;
|
||||
#else
|
||||
extern OSThread *__osRunningThread;
|
||||
extern OSThread *D_8033489C;
|
||||
extern OSThread *__osFaultedThread;
|
||||
extern OSThread *D_80334898;
|
||||
#endif
|
||||
|
||||
extern OSTimer *__osTimerList;
|
||||
extern OSTimer __osBaseTimer;
|
||||
|
||||
Reference in New Issue
Block a user