From 247a69ae2f3c15b576df80b80145e133683ec642 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Thu, 16 Dec 2021 07:58:19 -0500 Subject: [PATCH] Fix many warnings (#195) * Fix many warnings, mostly when using functions without including headers, and mostly in libultra files. Included a few warning ignores as well * Add another warning fix * Revert trailing comma for LogicUpdateRates --- Makefile | 7 +++- include/PR/os_libc.h | 1 - include/PR/os_pi.h | 2 + include/PR/os_vi.h | 1 + include/libc/assert.h | 54 ++++++++++++++++++++++++++ include/sched.h | 2 - include/viint.h | 2 + lib/src/mips1/os/osCreatePiManager.c | 2 +- lib/src/mips1/sc/sched.c | 7 +++- lib/src/os/__osSpRawStartDma.c | 1 + lib/src/os/__osViSwapContext.c | 4 +- lib/src/os/contreaddata.c | 1 + lib/src/os/controller.c | 1 + lib/src/os/devmgr.c | 1 + lib/src/os/osAiSetNextBuffer.c | 1 + lib/src/os/osEepromProbe.c | 1 + lib/src/os/osJamMesg.c | 1 + lib/src/os/osRecvMesg.c | 1 + lib/src/os/osSendMesg.c | 2 +- lib/src/os/osSetThreadPri.c | 1 + lib/src/os/osStartThread.c | 1 + lib/src/os/osStopThread.c | 1 + lib/src/os/osViGetCurrentFramebuffer.c | 2 +- lib/src/os/osViGetNextFramebuffer.c | 2 +- lib/src/os/osViMgr.c | 1 + lib/src/os/osVirtualToPhysical.c | 5 +-- lib/src/os/pfsreadwritefile.c | 3 +- lib/src/os/piacs.c | 32 +++++++-------- lib/src/os/sptask.c | 5 ++- src/screen_asset.c | 8 ++-- src/screen_asset.h | 2 +- src/unknown_05CEF0.c | 2 +- src/unknown_078050.c | 11 +++--- 33 files changed, 123 insertions(+), 45 deletions(-) create mode 100644 include/libc/assert.h diff --git a/Makefile b/Makefile index ea4e45b8..338d7afd 100755 --- a/Makefile +++ b/Makefile @@ -153,7 +153,7 @@ DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES) ASFLAGS = -mtune=vr4300 -march=vr4300 -mabi=32 $(foreach d,$(DEFINES),--defsym $(d)) INCLUDE_CFLAGS := -I include -I $(BUILD_DIR) -I src -I . -I include/libc -CFLAGS = -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(OPT_FLAGS) $(MIPSISET) $(INCLUDE_CFLAGS) $(DEF_INC_CFLAGS) +CFLAGS = -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed -DNDEBUG $(OPT_FLAGS) $(MIPSISET) $(INCLUDE_CFLAGS) $(DEF_INC_CFLAGS) LDFLAGS = undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/dkr.map ####################### Other Tools ######################### @@ -195,7 +195,10 @@ ifeq ($(shell getconf LONG_BIT), 64) # Ensure that gcc treats the code as 32-bit CC_CHECK_CFLAGS += -m32 endif -CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) $(DEF_INC_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB -D_LANGUAGE_C +CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) $(DEF_INC_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB -D_LANGUAGE_C -DNDEBUG + +#Warnings to ignore +CC_CHECK_CFLAGS += -Wno-builtin-declaration-mismatch -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast ####################### ASSETS ######################### diff --git a/include/PR/os_libc.h b/include/PR/os_libc.h index 94111c0b..ce5372fb 100644 --- a/include/PR/os_libc.h +++ b/include/PR/os_libc.h @@ -2,7 +2,6 @@ #define _OS_LIBC_H_ #include "ultratypes.h" - // Old deprecated functions from strings.h, replaced by memcpy/memset. extern void bcopy(const void *, void *, size_t); extern void bzero(void *, size_t); diff --git a/include/PR/os_pi.h b/include/PR/os_pi.h index 34015c8f..49ba94dd 100644 --- a/include/PR/os_pi.h +++ b/include/PR/os_pi.h @@ -94,4 +94,6 @@ s32 osPiRawReadIo(u32 devAddr, u32 *data); s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size); s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size); +s32 osEPiRawWriteIo(OSPiHandle *, u32 , u32); + #endif diff --git a/include/PR/os_vi.h b/include/PR/os_vi.h index 77d5e756..7a741959 100644 --- a/include/PR/os_vi.h +++ b/include/PR/os_vi.h @@ -87,6 +87,7 @@ void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount); void osViBlack(u8 active); void osViSetSpecialFeatures(u32 func); void osViSwapBuffer(void *vaddr); +void osYieldThread(void); #define OS_VI_NTSC_LPN1 0 /* NTSC */ diff --git a/include/libc/assert.h b/include/libc/assert.h new file mode 100644 index 00000000..a3736e37 --- /dev/null +++ b/include/libc/assert.h @@ -0,0 +1,54 @@ +#ifndef __ASSERT_H__ +#define __ASSERT_H__ +#ifdef __cplusplus +extern "C" { +#endif +/************************************************************************** + * * + * Copyright (C) 1984, Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs contain * + * unpublished proprietary information of Silicon Graphics, Inc., and * + * are protected by Federal copyright law. They may not be disclosed * + * to third parties or copied or duplicated in any form, in whole or * + * in part, without the prior written consent of Silicon Graphics, Inc. * + * * + **************************************************************************/ +/* Copyright (c) 1984 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "$Revision: 1.17 $" + +/* ANSI C Notes: + * + * - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS + * standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED + * IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's + * RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or + * _[A-Z]. For external objects, identifiers with the prefix _[a-z] + * are also reserved.) + */ + +#ifdef NDEBUG +#undef assert +#define assert(EX) ((void)0) + +#else + +extern void __assert(const char *, const char *, int); +#ifdef __ANSI_CPP__ +#define assert(EX) ((EX)?((void)0):__assert( # EX , __FILE__, __LINE__)) +#else +#define assert(EX) ((EX)?((void)0):__assert("EX", __FILE__, __LINE__)) +#endif +#endif /* NDEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* !__ASSERT_H__ */ diff --git a/include/sched.h b/include/sched.h index bf7903d2..202ab7a7 100644 --- a/include/sched.h +++ b/include/sched.h @@ -100,7 +100,6 @@ extern OSViMode osViModeTable[]; /*******************************/ void __scYield(OSSched *sc); -static void __scMain(void *arg); void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp); void osCreateScheduler(OSSched *sc, void *stack, OSPri priority, u8 mode, u8 numFields); void osScAddClient(OSSched *sc, OSScClient *c, OSMesgQueue *msgQ, u8 arg3); @@ -116,6 +115,5 @@ s32 __scTaskComplete(OSSched *sc, OSScTask *t); void __scAppendList(OSSched *sc, OSScTask *t); void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp); void __scHandleRetrace(OSSched *sc); -static s32 __scSchedule(OSSched *sc, OSScTask **sp, OSScTask **dp, s32 availRCP); #endif diff --git a/include/viint.h b/include/viint.h index 3578fb3e..e366b788 100644 --- a/include/viint.h +++ b/include/viint.h @@ -68,4 +68,6 @@ extern __OSViContext *__osViCurr; extern __OSViContext *__osViNext; __OSViContext *__osViGetCurrentContext(void); void __osViInit(void); +void *osViGetCurrentFramebuffer(void); +void *osViGetNextFramebuffer(void); #endif diff --git a/lib/src/mips1/os/osCreatePiManager.c b/lib/src/mips1/os/osCreatePiManager.c index 60f73842..c72bcecb 100644 --- a/lib/src/mips1/os/osCreatePiManager.c +++ b/lib/src/mips1/os/osCreatePiManager.c @@ -4,11 +4,11 @@ #include "types.h" #include "libultra_internal.h" #include "stacks.h" +#include "lib/src/os/piint.h" extern OSMesgQueue __osPiAccessQueue; extern u32 __osPiAccessQueueEnabled; extern OSDevMgr __osPiDevMgr; -void __osDevMgrMain(void); // bss variables OSThread piThread; diff --git a/lib/src/mips1/sc/sched.c b/lib/src/mips1/sc/sched.c index 7dd7d928..4d644169 100644 --- a/lib/src/mips1/sc/sched.c +++ b/lib/src/mips1/sc/sched.c @@ -1,11 +1,13 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x80079350 */ +#include #include "sched.h" #include "types.h" #include "macros.h" #include "f3ddkr.h" #include "libultra_internal.h" +#include "viint.h" /* * private typedefs and defines @@ -68,6 +70,9 @@ s32 D_80126128[18]; /*******************************/ +static void __scMain(void *arg); +static s32 __scSchedule(OSSched *sc, OSScTask **sp, OSScTask **dp, s32 availRCP); + void osCreateScheduler(OSSched *sc, void *stack, OSPri priority, u8 mode, u8 numFields) { sc->curRSPTask = 0; sc->curRDPTask = 0; @@ -542,7 +547,7 @@ static s32 __scSchedule(OSSched *sc, OSScTask **sp, OSScTask **dp, s32 availRCP) *dp = gfx; avail &= ~OS_SC_DP; - if (avail & OS_SC_DP == 0) + if ((avail & OS_SC_DP) == 0) assert(sc->curRDPTask == gfx); } diff --git a/lib/src/os/__osSpRawStartDma.c b/lib/src/os/__osSpRawStartDma.c index a887f301..0a3359fe 100644 --- a/lib/src/os/__osSpRawStartDma.c +++ b/lib/src/os/__osSpRawStartDma.c @@ -2,6 +2,7 @@ /* RAM_POS: 0x800D6440 */ #include "libultra_internal.h" +#include "osint.h" s32 __osSpRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) { if (__osSpDeviceBusy()) diff --git a/lib/src/os/__osViSwapContext.c b/lib/src/os/__osViSwapContext.c index cc2153af..38b8e1b4 100644 --- a/lib/src/os/__osViSwapContext.c +++ b/lib/src/os/__osViSwapContext.c @@ -16,8 +16,8 @@ struct __osThreadTail __osThreadTail = {0, -1}; OSThread *__osRunQueue = (OSThread *)&__osThreadTail; OSThread *__osActiveQueue = (OSThread *)&__osThreadTail; -extern OSThread *__osRunningThread = NULL; -extern OSThread *__osFaultedThread = NULL; +OSThread *__osRunningThread = NULL; +OSThread *__osFaultedThread = NULL; void __osViSwapContext() { register OSViMode *vm; diff --git a/lib/src/os/contreaddata.c b/lib/src/os/contreaddata.c index 4d7ced8e..175bfca8 100644 --- a/lib/src/os/contreaddata.c +++ b/lib/src/os/contreaddata.c @@ -5,6 +5,7 @@ #include "macros.h" #include "libultra_internal.h" #include "controller.h" +#include "siint.h" static void __osPackReadData(void); s32 osContStartReadData(OSMesgQueue *mq) { diff --git a/lib/src/os/controller.c b/lib/src/os/controller.c index 23108dec..43643f56 100644 --- a/lib/src/os/controller.c +++ b/lib/src/os/controller.c @@ -5,6 +5,7 @@ #include "macros.h" #include "libultra_internal.h" #include "controller.h" +#include "siint.h" #define HALF_MIL_CYLCES 500000U #define ONE_MIL_CYLCES 1000000U diff --git a/lib/src/os/devmgr.c b/lib/src/os/devmgr.c index 9cbfb466..5fa26c91 100644 --- a/lib/src/os/devmgr.c +++ b/lib/src/os/devmgr.c @@ -3,6 +3,7 @@ #include "libultra_internal.h" #include "piint.h" +#include "osint.h" void __osDevMgrMain(void *args) { OSIoMesg *mb; diff --git a/lib/src/os/osAiSetNextBuffer.c b/lib/src/os/osAiSetNextBuffer.c index 55b71eae..458a7a6b 100644 --- a/lib/src/os/osAiSetNextBuffer.c +++ b/lib/src/os/osAiSetNextBuffer.c @@ -3,6 +3,7 @@ #include "types.h" #include "libultra_internal.h" +#include "osint.h" u8 hdwrBugFlag = 0; diff --git a/lib/src/os/osEepromProbe.c b/lib/src/os/osEepromProbe.c index 20c176c0..351e8e7e 100644 --- a/lib/src/os/osEepromProbe.c +++ b/lib/src/os/osEepromProbe.c @@ -2,6 +2,7 @@ /* RAM_POS: 0x800CE210 */ #include "libultra_internal.h" +#include "siint.h" s32 __osEepStatus(OSMesgQueue *mq, OSContStatus *data); diff --git a/lib/src/os/osJamMesg.c b/lib/src/os/osJamMesg.c index bb142355..e033215f 100644 --- a/lib/src/os/osJamMesg.c +++ b/lib/src/os/osJamMesg.c @@ -3,6 +3,7 @@ /* RAM_POS: 0x800D36A0 */ #include "libultra_internal.h" +#include "osint.h" extern OSThread *__osRunningThread; diff --git a/lib/src/os/osRecvMesg.c b/lib/src/os/osRecvMesg.c index 9d817688..5f77c9fa 100644 --- a/lib/src/os/osRecvMesg.c +++ b/lib/src/os/osRecvMesg.c @@ -4,6 +4,7 @@ #include "types.h" #include "macros.h" #include "libultra_internal.h" +#include "osint.h" extern OSThread *__osRunningThread; diff --git a/lib/src/os/osSendMesg.c b/lib/src/os/osSendMesg.c index 5120f52a..2017a20f 100644 --- a/lib/src/os/osSendMesg.c +++ b/lib/src/os/osSendMesg.c @@ -1,7 +1,7 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x800C8E30 */ #include "libultra_internal.h" - +#include "osint.h" extern OSThread *__osRunningThread; s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags) { diff --git a/lib/src/os/osSetThreadPri.c b/lib/src/os/osSetThreadPri.c index 7c9a704a..041d8e1b 100644 --- a/lib/src/os/osSetThreadPri.c +++ b/lib/src/os/osSetThreadPri.c @@ -2,6 +2,7 @@ /* RAM_POS: 0x800CC840 */ #include "libultra_internal.h" +#include "osint.h" extern OSThread *__osRunningThread; extern OSThread *__osRunQueue; diff --git a/lib/src/os/osStartThread.c b/lib/src/os/osStartThread.c index 753e304b..ca2cbb1b 100644 --- a/lib/src/os/osStartThread.c +++ b/lib/src/os/osStartThread.c @@ -2,6 +2,7 @@ /* RAM_POS: 0x800C89A0 */ #include "libultra_internal.h" +#include "osint.h" extern OSThread *__osRunningThread; extern OSThread *__osRunQueue; diff --git a/lib/src/os/osStopThread.c b/lib/src/os/osStopThread.c index 5e163766..d1b4aa68 100644 --- a/lib/src/os/osStopThread.c +++ b/lib/src/os/osStopThread.c @@ -2,6 +2,7 @@ /* RAM_POS: 0x800C8AF0 */ #include "libultra_internal.h" +#include "osint.h" extern OSThread *__osRunningThread; diff --git a/lib/src/os/osViGetCurrentFramebuffer.c b/lib/src/os/osViGetCurrentFramebuffer.c index 9929a6d8..001a05a9 100644 --- a/lib/src/os/osViGetCurrentFramebuffer.c +++ b/lib/src/os/osViGetCurrentFramebuffer.c @@ -4,7 +4,7 @@ #include "libultra_internal.h" #include "viint.h" -void *osViGetCurrentFramebuffer(void){ +void *osViGetCurrentFramebuffer(void) { register u32 saveMask; void *framep; diff --git a/lib/src/os/osViGetNextFramebuffer.c b/lib/src/os/osViGetNextFramebuffer.c index a2419c6c..da39319f 100644 --- a/lib/src/os/osViGetNextFramebuffer.c +++ b/lib/src/os/osViGetNextFramebuffer.c @@ -4,7 +4,7 @@ #include "libultra_internal.h" #include "viint.h" -void *osViGetNextFramebuffer(void){ +void *osViGetNextFramebuffer(void) { register u32 saveMask; void *framep; diff --git a/lib/src/os/osViMgr.c b/lib/src/os/osViMgr.c index f12328f0..b518ab5f 100644 --- a/lib/src/os/osViMgr.c +++ b/lib/src/os/osViMgr.c @@ -5,6 +5,7 @@ #include "macros.h" #include "libultra_internal.h" #include "viint.h" +#include "osint.h" extern OSTime __osCurrentTime; extern u32 __osBaseCounter; diff --git a/lib/src/os/osVirtualToPhysical.c b/lib/src/os/osVirtualToPhysical.c index 24844b0b..c65c128f 100644 --- a/lib/src/os/osVirtualToPhysical.c +++ b/lib/src/os/osVirtualToPhysical.c @@ -1,9 +1,8 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x800C8CF0 */ -#include "types.h" -#include "macros.h" -#include "PR/R4300.h" +#include "libultra_internal.h" +#include "osint.h" u32 osVirtualToPhysical(void *addr) { if (IS_KSEG0(addr)) { diff --git a/lib/src/os/pfsreadwritefile.c b/lib/src/os/pfsreadwritefile.c index 122087a6..edd54dbb 100644 --- a/lib/src/os/pfsreadwritefile.c +++ b/lib/src/os/pfsreadwritefile.c @@ -64,8 +64,9 @@ s32 osPfsReadWriteFile(OSPfs *pfs, s32 file_no, u8 flag, int offset, int size_in return PFS_ERR_INCONSISTENT; } - if (flag == PFS_READ && (dir.status & DIR_STATUS_OCCUPIED) == 0) + if (flag == PFS_READ && (dir.status & DIR_STATUS_OCCUPIED) == 0) { return PFS_ERR_BAD_DATA; + } bank = -1; cur_block = offset / BLOCKSIZE; diff --git a/lib/src/os/piacs.c b/lib/src/os/piacs.c index 34b49c3a..cd163c65 100644 --- a/lib/src/os/piacs.c +++ b/lib/src/os/piacs.c @@ -36,21 +36,21 @@ void __osPiRelAccess(void) { const du P_cosf[] = { -{0x3ff00000, 0x00000000}, -{0xbfc55554, 0xbc83656d}, -{0x3f8110ed, 0x3804c2a0}, -{0xbf29f6ff, 0xeea56814}, -{0x3ec5dbdf, 0x0e314bfe}, +{{0x3ff00000, 0x00000000}}, +{{0xbfc55554, 0xbc83656d}}, +{{0x3f8110ed, 0x3804c2a0}}, +{{0xbf29f6ff, 0xeea56814}}, +{{0x3ec5dbdf, 0x0e314bfe}}, }; const du rpi_cosf = -{0x3fd45f30, 0x6dc9c883}; +{{0x3fd45f30, 0x6dc9c883}}; const du pihi_cosf = -{0x400921fb, 0x50000000}; +{{0x400921fb, 0x50000000}}; const du pilo_cosf = -{0x3e6110b4, 0x611a6263}; +{{0x3e6110b4, 0x611a6263}}; const fu zero_cosf = {0x00000000}; @@ -61,21 +61,21 @@ const int COSF_FILE_PADDING[3] = { 0 }; const du P_sinf[] = { -{0x3ff00000, 0x00000000}, -{0xbfc55554, 0xbc83656d}, -{0x3f8110ed, 0x3804c2a0}, -{0xbf29f6ff, 0xeea56814}, -{0x3ec5dbdf, 0x0e314bfe}, +{{0x3ff00000, 0x00000000}}, +{{0xbfc55554, 0xbc83656d}}, +{{0x3f8110ed, 0x3804c2a0}}, +{{0xbf29f6ff, 0xeea56814}}, +{{0x3ec5dbdf, 0x0e314bfe}}, }; const du rpi_sinf = -{0x3fd45f30, 0x6dc9c883}; +{{0x3fd45f30, 0x6dc9c883}}; const du pihi_sinf = -{0x400921fb, 0x50000000}; +{{0x400921fb, 0x50000000}}; const du pilo_sinf = -{0x3e6110b4, 0x611a6263}; +{{0x3e6110b4, 0x611a6263}}; const fu zero_sinf = {0x00000000}; diff --git a/lib/src/os/sptask.c b/lib/src/os/sptask.c index 61523176..0ef5a1d9 100644 --- a/lib/src/os/sptask.c +++ b/lib/src/os/sptask.c @@ -4,6 +4,7 @@ #include "libultra_internal.h" #include "viint.h" #include "PR/sptask.h" +#include "osint.h" #define _osVirtualToPhysical(ptr) \ if (ptr != NULL) { \ @@ -40,14 +41,14 @@ void osSpTaskLoad(OSTask *intp) { while (__osSpSetPc(SP_IMEM_START) == -1) ; - while (__osSpRawStartDma(1, (SP_IMEM_START - sizeof(*tp)), tp, + while (__osSpRawStartDma(OS_WRITE, (SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) ; while (__osSpDeviceBusy()) ; - while (__osSpRawStartDma(1, SP_IMEM_START, tp->t.ucode_boot, + while (__osSpRawStartDma(OS_WRITE, SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) ; } diff --git a/src/screen_asset.c b/src/screen_asset.c index baaeb7fd..f00c395a 100644 --- a/src/screen_asset.c +++ b/src/screen_asset.c @@ -15,12 +15,12 @@ Gfx gRdpSetModeScreenAsset[] = { * Returns the address of the screen asset, or 0x80100000 if no screen assets were found. * Unused. */ -UNUSED u8 *load_screen(s32 screenIndex) { - u8 *someAddr; +UNUSED void *load_screen(s32 screenIndex) { + s32 *someAddr; s32 screenTableCount, start, size; s32 *screenTable; - screenTable = (u8 *)load_asset_section_from_rom(ASSET_SCREENS_TABLE); + screenTable = load_asset_section_from_rom(ASSET_SCREENS_TABLE); screenTableCount = 0; while (screenTable[screenTableCount] != -1) { @@ -33,7 +33,7 @@ UNUSED u8 *load_screen(s32 screenIndex) { // since there are no screen assets in the ROM. if (screenTableCount == 0) { free_from_memory_pool(screenTable); - return 0x80100000; + return (void *)0x80100000; } else { if (screenIndex < 0 || screenIndex >= screenTableCount) { rmonPrintf("SCREEN: No out of range!!\n"); diff --git a/src/screen_asset.h b/src/screen_asset.h index f9ad7914..1d20476f 100644 --- a/src/screen_asset.h +++ b/src/screen_asset.h @@ -11,7 +11,7 @@ #define SCREEN_HEIGHT_PART 6 -UNUSED u8 *load_screen(s32 screenIndex); +UNUSED void *load_screen(s32 screenIndex); UNUSED void render_screen(Gfx **dlist, u8 *screenAddress); #endif diff --git a/src/unknown_05CEF0.c b/src/unknown_05CEF0.c index 60821ec1..d48113ad 100644 --- a/src/unknown_05CEF0.c +++ b/src/unknown_05CEF0.c @@ -39,7 +39,7 @@ void func_8005C2F0(Object *object, unk8005C2F0 *arg1) { arg1->unkC = 0.0f; D_8011D5C0 = object->y_position; if (arg1->unk118 != 0) { - func_80006AC8(); + func_80006AC8(object); } D_8011D5C4 = 0; } diff --git a/src/unknown_078050.c b/src/unknown_078050.c index 24d59a3f..06fc41a4 100644 --- a/src/unknown_078050.c +++ b/src/unknown_078050.c @@ -6,6 +6,7 @@ #include "structs.h" #include "macros.h" #include "video.h" +#include "camera.h" //#include "lib/src/unknown_0D24D0.h" /************ .data ************/ @@ -204,7 +205,7 @@ void set_background_prim_colour(u8 red, u8 green, u8 blue) { * Uses RGBA5551 */ void set_background_fill_colour(s32 red, s32 green, s32 blue) { - sBackgroundFillColour = ((red << 8) & 0xF800) | ((green * 8) & 0x7C0) | ((blue >> 2) & 0x3E) | 1; + sBackgroundFillColour = GPACK_RGBA5551(red, green, blue, 1); sBackgroundFillColour |= (sBackgroundFillColour << 16); } @@ -220,8 +221,8 @@ void render_background(Gfx **dlist, s32 *arg1, s32 arg2) { s32 rgba16Color; widthAndHeight = get_video_width_and_height_as_s32(); - w = widthAndHeight & 0xFFFF; - h = widthAndHeight >> 0x10; + w = GET_VIDEO_WIDTH(widthAndHeight); + h = GET_VIDEO_HEIGHT(widthAndHeight); gDPPipeSync((*dlist)++); gDPSetScissor((*dlist)++, 0, 0, 0, w - 1, h - 1); @@ -259,8 +260,8 @@ void render_background(Gfx **dlist, s32 *arg1, s32 arg2) { D_800DE4D0.function(dlist, arg1); } else { //Also has an issue here. - rgba16Color = ((sBackgroundPrimColourR << 8) & 0xF800) | ((sBackgroundPrimColourG * 8) & 0x7C0) | ((sBackgroundPrimColourB >> 2) & 0x3E) | 1; - rgba16Color |= rgba16Color << 0x10; + rgba16Color = GPACK_RGBA5551(sBackgroundPrimColourR, sBackgroundPrimColourG, sBackgroundPrimColourB, 1); + rgba16Color |= rgba16Color << 16; gDPSetFillColor((*dlist)++, rgba16Color); gDPFillRectangle((*dlist)++, 0, 0, w - 1, h - 1); }