From c4735661609debadf8e3b27c89d4598c49780359 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 21 Oct 2022 14:24:45 +0300 Subject: [PATCH] Fix all compilation errors when building for host --- configure.py | 2 +- include/Kyoto/Alloc/CSmallAllocPool.hpp | 2 +- include/Kyoto/Particles/IElement.hpp | 4 ++-- include/Kyoto/TOneStatic.hpp | 4 ++-- include/dolphin/os/OSCache.h | 2 +- include/dolphin/vi.h | 4 ++++ src/Kyoto/Basics/RAssertDolphin.cpp | 4 +++- src/Kyoto/Graphics/CCubeMaterial.cpp | 5 +++++ 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index 461992c1..efdeb6e3 100755 --- a/configure.py +++ b/configure.py @@ -1127,7 +1127,7 @@ else: n.newline() n.variable("host_cflags", "-I include/ -Wno-trigraphs") n.variable("host_cppflags", - "-std=c++98 -I include/ -fno-exceptions -fno-rtti -Wno-trigraphs") + "-std=c++98 -I include/ -fno-exceptions -fno-rtti -D_CRT_SECURE_NO_WARNINGS -Wno-trigraphs") ### # Rules diff --git a/include/Kyoto/Alloc/CSmallAllocPool.hpp b/include/Kyoto/Alloc/CSmallAllocPool.hpp index 1a4366db..bd497093 100644 --- a/include/Kyoto/Alloc/CSmallAllocPool.hpp +++ b/include/Kyoto/Alloc/CSmallAllocPool.hpp @@ -18,7 +18,7 @@ public: } uint GetIndexFromPtr(const void* ptr) const { - return ((const uchar*)ptr - x0_mainData) / kPointerSize; + return ((const uchar*)ptr - (const uchar*)x0_mainData) / kPointerSize; } long GetEntryValue(uint idx) const { return (long)*((uchar*)x4_bookKeeping + idx); } uchar* GetPtrFromIndex(unsigned int idx) const { diff --git a/include/Kyoto/Particles/IElement.hpp b/include/Kyoto/Particles/IElement.hpp index cd1b909f..17665319 100644 --- a/include/Kyoto/Particles/IElement.hpp +++ b/include/Kyoto/Particles/IElement.hpp @@ -14,8 +14,8 @@ public: virtual ~IElement(){}; // -> CFrameDelayedKiller - void* operator new(unsigned long sz, const char*, const char*); - void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); } + void* operator new(size_t sz, const char*, const char*); + void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } void operator delete(void* ptr, size_t sz); }; diff --git a/include/Kyoto/TOneStatic.hpp b/include/Kyoto/TOneStatic.hpp index 4d1d1b4d..f7e35127 100644 --- a/include/Kyoto/TOneStatic.hpp +++ b/include/Kyoto/TOneStatic.hpp @@ -6,11 +6,11 @@ template < typename T > class TOneStatic { public: - void* operator new(unsigned long sz, const char*, const char*); /* { + void* operator new(size_t sz, const char*, const char*); /* { ReferenceCount()++; return GetAllocSpace(); }*/ - void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); } + void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } void operator delete(void* ptr); private: diff --git a/include/dolphin/os/OSCache.h b/include/dolphin/os/OSCache.h index 29f99f39..97035925 100644 --- a/include/dolphin/os/OSCache.h +++ b/include/dolphin/os/OSCache.h @@ -1,7 +1,7 @@ #ifndef _DOLPHIN_OSCACHE #define _DOLPHIN_OSCACHE -#include "types.h" +#include "dolphin/types.h" #ifdef __cplusplus extern "C" { diff --git a/include/dolphin/vi.h b/include/dolphin/vi.h index b3170dc9..fdedc8c5 100644 --- a/include/dolphin/vi.h +++ b/include/dolphin/vi.h @@ -22,7 +22,11 @@ void VISetWindowFullscreen(bool fullscreen); bool VIGetWindowFullscreen(); #endif +#ifdef __MWERKS__ vu16 __VIRegs[59] : 0xCC002000; +#else +vu16 __VIRegs[59]; +#endif #ifdef __cplusplus } diff --git a/src/Kyoto/Basics/RAssertDolphin.cpp b/src/Kyoto/Basics/RAssertDolphin.cpp index 253d0d9d..8d7db8d9 100644 --- a/src/Kyoto/Basics/RAssertDolphin.cpp +++ b/src/Kyoto/Basics/RAssertDolphin.cpp @@ -5,7 +5,9 @@ #include "dolphin/os/OSMemory.h" #include "dolphin/pad.h" #include "dolphin/vi.h" + #include +#include static const char* buildTime = "Build v1.088 10/29/2002 2:21:25"; static char rs_debugger_buffer[1024]; @@ -42,7 +44,7 @@ void ErrorHandler(OSError code, OSContext* context, int arg1, int arg2) { local_60 = 0x2010408; if ((pads[1].button & 0xc10) == 0xc10) { if ((pads[1].button & 0xf) != 0) { - if (pads[1].button & loopExitCriteria == 0) { // TODO: wrong logic with loopExitCriteria + if ((pads[1].button & loopExitCriteria) == 0) { // TODO: wrong logic with loopExitCriteria if ((loopExitCriteria != 0) && pads[1].button == 0) { // TODO: wrong logic with pads[1].button loopExitCriteria = 0; diff --git a/src/Kyoto/Graphics/CCubeMaterial.cpp b/src/Kyoto/Graphics/CCubeMaterial.cpp index c4ffa0e7..55196dd9 100644 --- a/src/Kyoto/Graphics/CCubeMaterial.cpp +++ b/src/Kyoto/Graphics/CCubeMaterial.cpp @@ -6,6 +6,11 @@ #include +#ifndef __MWERKS__ +void __memcpy(void*, const void*, int); +#endif + + inline void CGX::SetAlphaCompare(GXCompare comp0, uchar ref0, GXAlphaOp op, GXCompare comp1, uchar ref1) { uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) |