From 52a8a12beac018e52c89d00e3c41f8f887311f65 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Wed, 7 Feb 2024 16:06:55 -0300 Subject: [PATCH] Match osCreateMesgQueue --- Makefile | 1 + src/libultra/os/createmesgqueue.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e296fe85..f7076323 100644 --- a/Makefile +++ b/Makefile @@ -273,6 +273,7 @@ build/src/libultra/libc/xlitob.o: OPTFLAGS := -O2 -g0 build/src/libultra/libc/ll.o: OPTFLAGS := -O1 -g0 build/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32 +build/src/libultra/os/createmesgqueue.o: OPTFLAGS := -O1 -g0 build/src/libultra/os/getactivequeue.o: OPTFLAGS := -O1 -g0 build/src/libultra/os/stopthread.o: OPTFLAGS := -O1 -g0 diff --git a/src/libultra/os/createmesgqueue.c b/src/libultra/os/createmesgqueue.c index 0c11e0c2..bc931e5a 100644 --- a/src/libultra/os/createmesgqueue.c +++ b/src/libultra/os/createmesgqueue.c @@ -1,3 +1,18 @@ -#include "common.h" +#include "PR/os_internal.h" +#include "PR/ultraerror.h" +#include "osint.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/os/createmesgqueue/osCreateMesgQueue.s") +void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 msgCount) { +#ifdef _DEBUG + if (msgCount <= 0) { + __osError(ERR_OSCREATEMESGQUEUE, 1, msgCount); + return; + } +#endif + mq->mtqueue = (OSThread*) &__osThreadTail.next; + mq->fullqueue = (OSThread*) &__osThreadTail.next; + mq->validCount = 0; + mq->first = 0; + mq->msgCount = msgCount; + mq->msg = msg; +}