aboutsummaryrefslogtreecommitdiff
path: root/src/shm.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-05-25 22:37:57 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-05-25 22:37:57 -0300
commitad8213f35523cbb07f418ae275af448a47cc0288 (patch)
tree4d77b8ff2b44461734b5a2cbaad5402b4a94736f /src/shm.cc
parent5f883a80175a4cc9abda9d647a6a0d73bda84878 (diff)
downloadgame-ad8213f35523cbb07f418ae275af448a47cc0288.tar.gz
game-ad8213f35523cbb07f418ae275af448a47cc0288.zip
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.
Diffstat (limited to 'src/shm.cc')
-rw-r--r--src/shm.cc18
1 files changed, 13 insertions, 5 deletions
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 <sys/shm.h>
// 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;