Fix all compilation errors when building for host

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-21 14:24:45 +03:00
parent f7964a3908
commit c473566160
No known key found for this signature in database
GPG Key ID: E224F951761145F8
8 changed files with 19 additions and 8 deletions

View File

@ -1127,7 +1127,7 @@ else:
n.newline() n.newline()
n.variable("host_cflags", "-I include/ -Wno-trigraphs") n.variable("host_cflags", "-I include/ -Wno-trigraphs")
n.variable("host_cppflags", 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 # Rules

View File

@ -18,7 +18,7 @@ public:
} }
uint GetIndexFromPtr(const void* ptr) const { 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); } long GetEntryValue(uint idx) const { return (long)*((uchar*)x4_bookKeeping + idx); }
uchar* GetPtrFromIndex(unsigned int idx) const { uchar* GetPtrFromIndex(unsigned int idx) const {

View File

@ -14,8 +14,8 @@ public:
virtual ~IElement(){}; virtual ~IElement(){};
// -> CFrameDelayedKiller // -> CFrameDelayedKiller
void* operator new(unsigned long sz, const char*, const char*); void* operator new(size_t sz, const char*, const char*);
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, size_t sz); void operator delete(void* ptr, size_t sz);
}; };

View File

@ -6,11 +6,11 @@
template < typename T > template < typename T >
class TOneStatic { class TOneStatic {
public: public:
void* operator new(unsigned long sz, const char*, const char*); /* { void* operator new(size_t sz, const char*, const char*); /* {
ReferenceCount()++; ReferenceCount()++;
return GetAllocSpace(); 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); void operator delete(void* ptr);
private: private:

View File

@ -1,7 +1,7 @@
#ifndef _DOLPHIN_OSCACHE #ifndef _DOLPHIN_OSCACHE
#define _DOLPHIN_OSCACHE #define _DOLPHIN_OSCACHE
#include "types.h" #include "dolphin/types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,7 +22,11 @@ void VISetWindowFullscreen(bool fullscreen);
bool VIGetWindowFullscreen(); bool VIGetWindowFullscreen();
#endif #endif
#ifdef __MWERKS__
vu16 __VIRegs[59] : 0xCC002000; vu16 __VIRegs[59] : 0xCC002000;
#else
vu16 __VIRegs[59];
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -5,7 +5,9 @@
#include "dolphin/os/OSMemory.h" #include "dolphin/os/OSMemory.h"
#include "dolphin/pad.h" #include "dolphin/pad.h"
#include "dolphin/vi.h" #include "dolphin/vi.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
static const char* buildTime = "Build v1.088 10/29/2002 2:21:25"; static const char* buildTime = "Build v1.088 10/29/2002 2:21:25";
static char rs_debugger_buffer[1024]; static char rs_debugger_buffer[1024];
@ -42,7 +44,7 @@ void ErrorHandler(OSError code, OSContext* context, int arg1, int arg2) {
local_60 = 0x2010408; local_60 = 0x2010408;
if ((pads[1].button & 0xc10) == 0xc10) { if ((pads[1].button & 0xc10) == 0xc10) {
if ((pads[1].button & 0xf) != 0) { 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) && if ((loopExitCriteria != 0) &&
pads[1].button == 0) { // TODO: wrong logic with pads[1].button pads[1].button == 0) { // TODO: wrong logic with pads[1].button
loopExitCriteria = 0; loopExitCriteria = 0;

View File

@ -6,6 +6,11 @@
#include <dolphin/mtx.h> #include <dolphin/mtx.h>
#ifndef __MWERKS__
void __memcpy(void*, const void*, int);
#endif
inline void CGX::SetAlphaCompare(GXCompare comp0, uchar ref0, GXAlphaOp op, GXCompare comp1, inline void CGX::SetAlphaCompare(GXCompare comp0, uchar ref0, GXAlphaOp op, GXCompare comp1,
uchar ref1) { uchar ref1) {
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) |