Skip to content

Commit

Permalink
Fix some libultra struct types (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
AloXado320 authored Sep 6, 2024
1 parent c9b9c2d commit 3f353d7
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 350 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,20 @@ GLOBAL_ASM_RACING_O_FILES = $(foreach file,$(GLOBAL_ASM_RACING_C_FILES),$(BUILD_

# detect prefix for MIPS toolchain
ifneq ($(CROSS),)
else ifneq ($(call find-command,mips-linux-gnu-ld),)
CROSS := mips-linux-gnu-
else ifneq ($(call find-command,mips64-linux-gnu-ld),)
CROSS := mips64-linux-gnu-
else ifneq ($(call find-command,mips64-elf-ld),)
CROSS := mips64-elf-
CROSS := mips64-elf-
# else ifneq ($(call find-command,mips-n64-ld),)
# CROSS := mips-n64-
else ifneq ($(call find-command,mips64-ld),)
CROSS := mips64-
else ifneq ($(call find-command,mips-linux-gnu-ld),)
CROSS := mips-linux-gnu-
else ifneq ($(call find-command,mips64-linux-gnu-ld),)
CROSS := mips64-linux-gnu-
else ifneq ($(call find-command,mips-ld),)
CROSS := mips-
else
$(error Unable to detect a suitable MIPS toolchain installed)
$(error Unable to detect a suitable MIPS toolchain installed)
endif

AS := $(CROSS)as
Expand Down
2 changes: 1 addition & 1 deletion mk64.ld
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ SECTIONS
BUILD_DIR/src/os/osContInit.o(.bss*);
BUILD_DIR/src/os/osPfsIsPlug.o(.bss*);
BUILD_DIR/src/os/guRotateF.o(.bss*);
BUILD_DIR/src/os/leointerrupt.o(.bss*);
BUILD_DIR/src/os/__osLeoInterrupt.o(.bss*);
BUILD_DIR/src/os/osTimer.o(.bss*);
BUILD_DIR/src/os/__osPiCreateAccessQueue.o(.bss*);
BUILD_DIR/src/os/__osSiCreateAccessQueue.o(.bss*);
Expand Down
33 changes: 17 additions & 16 deletions src/os/__osDequeueThread.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#include "libultra_internal.h"

NO_REORDER OSThread* __osThreadTail = NULL;
NO_REORDER u32 __osTest = -1;
NO_REORDER OSThread* __osRunQueue = (OSThread*) &__osThreadTail;
NO_REORDER OSThread* __osActiveQueue = (OSThread*) &__osThreadTail;
OSThread* __osRunningThread = NULL;
OSThread* __osFaultedThread = NULL;
struct __osThreadTail __osThreadTail = { NULL, -1 };
OSThread *__osRunQueue = (OSThread *) &__osThreadTail;
OSThread *__osActiveQueue = (OSThread *) &__osThreadTail;
OSThread *__osRunningThread = { 0 };
OSThread *__osFaultedThread = { 0 };

void __osDequeueThread(OSThread** queue, OSThread* thread) {
register OSThread** a2;
register OSThread* a3;
a2 = queue;
a3 = *a2;
while (a3 != NULL) {
if (a3 == thread) {
*a2 = thread->next;
void __osDequeueThread(register OSThread **queue, register OSThread *t) {
register OSThread *pred;
register OSThread *succ;

pred = (OSThread *) queue;
succ = pred->next;

while (succ != NULL) {
if (succ == t) {
pred->next = t->next;
return;
}
a2 = &a3->next;
a3 = *a2;
pred = succ;
succ = pred->next;
}
}
4 changes: 2 additions & 2 deletions src/os/__osLeoInterrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

static void __osLeoResume(void);
static void __osLeoAbnormalResume(void);
extern u8 leoDiskStack[OS_PIM_STACKSIZE]; // technically should have a OS_LEO_STACKSIZE or something..

extern u32 D_800EA5F0;

u8 leoDiskStack[OS_PIM_STACKSIZE]; // technically should have a OS_LEO_STACKSIZE or something..

s32 __osLeoInterrupt() {
u32 stat;
volatile u32 pistat;
Expand Down
185 changes: 0 additions & 185 deletions src/os/leointerrupt.c

This file was deleted.

19 changes: 8 additions & 11 deletions src/os/libultra_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ typedef struct __OSEventState {
OSMesg message;
} __OSEventState;

typedef struct // __osThreadTail
extern struct __osThreadTail
{
/* 0x00 */ OSThread* next;
/* 0x04 */ OSPri priority;
/* 0x08 */ OSThread* queue;
/* 0x0c */ OSThread* tlnext;

} OSThreadTail;
OSThread *next;
OSPri priority;
} __osThreadTail;

/*
* This define is needed because the original definitions in __osDequeueThread.c are declared
Expand All @@ -34,10 +31,10 @@ typedef struct {
} OSThread_ListHead;

// Original OSThread_ListHead definitions
extern OSThread* __osThreadTail;
extern OSThread* __osActiveQueue;
extern OSThread* __osRunQueue;
extern OSThread* __osRunningThread;
extern OSThread *__osRunningThread;
extern OSThread *__osActiveQueue;
extern OSThread *__osFaultedThread;
extern OSThread *__osRunQueue;

// Original EEPROM definitions
extern u32 D_80365E00[15];
Expand Down
Loading

0 comments on commit 3f353d7

Please sign in to comment.