From ad8213f35523cbb07f418ae275af448a47cc0288 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sun, 25 May 2025 22:37:57 -0300 Subject: linux Makefile + fix most compilation problems I wanted to see if the compiler had any problems with the code so far and added a few stub definitions so that each file would properly compile. We still fail when linking but we're able to to find and fix compile time errors. --- src/shm.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/shm.cc') diff --git a/src/shm.cc b/src/shm.cc index c26638f..c68ce1f 100644 --- a/src/shm.cc +++ b/src/shm.cc @@ -1,4 +1,11 @@ #include "common.hh" +#include "config.hh" +#include "enums.hh" +#include "thread.hh" + +#include "stubs.hh" + +#include // NOTE(fusion): This looks like an interface to external tools. Looking at the // `bin` directory this program was in, there are other programs that probably @@ -103,7 +110,7 @@ pid_t GetGameThreadPID(void){ return Pid; } -static void ErrorHandler(char *Text){ +static void ErrorHandler(const char *Text){ if(VerboseOutput){ printf("%s", Text); } @@ -119,7 +126,7 @@ static void ErrorHandler(char *Text){ } } -static void PrintHandler(int Level, char *Text){ +static void PrintHandler(int Level, const char *Text){ static Semaphore LogfileMutex(1); if(Level > DebugLevel){ @@ -249,7 +256,7 @@ void SetCommand(int Command, char *Text){ if(Text == NULL){ SHM->CommandBuffer[0] = 0; }else{ - strncpy(SHM->CommandBuffer, sizeof(SHM->CommandBuffer), Text); + strncpy(SHM->CommandBuffer, Text, sizeof(SHM->CommandBuffer)); SHM->CommandBuffer[sizeof(SHM->CommandBuffer) - 1] = 0; } } @@ -359,8 +366,9 @@ void InitSHM(bool Verbose){ // the decompiled version was also clearing SHM, probably just in case. memset(SHM, 0, sizeof(TSharedMemory)); - strncpy(SHM->PrintBuffer[0], sizeof(SHM->PrintBuffer[0]), - "SHM initialized. System printing is working!\n"); + strncpy(SHM->PrintBuffer[0], + "SHM initialized. System printing is working!\n", + sizeof(SHM->PrintBuffer[0])); SHM->PrintBuffer[0][sizeof(SHM->PrintBuffer[0]) - 1] = 0; SHM->PrintBufferPosition = 1; -- cgit v1.2.3