made it work with new fpc

This commit is contained in:
2026-02-01 17:47:49 +02:00
parent fe1273e539
commit faae0bdcc7
199 changed files with 355 additions and 14541 deletions

View File

@@ -1,6 +1,5 @@
#include "string.h"
#include "stdio.h"
#include "tier0/platform.h"
#include "unistd.h"
#include "libgen.h"
@@ -9,9 +8,7 @@
#endif
#ifdef __WIN32__
#include "windows.h"
#endif
#ifdef __linux__
#else
#include "dlfcn.h"
#endif
@@ -41,10 +38,9 @@ void *pTier0Lib = NULL;
typedef void (*EngineMainFn)(int argc, char** argv);
EngineMainFn pEngineMain;
extern "C" void FunnyMain( int argc, char **argv );
//extern "C" void FunnyMain( int argc, char **argv );
int main( int argc, char **argv ) {
#ifndef STATIC_BUILD
#ifdef __linux__
readlink("/proc/self/exe",szLauncherPath, MAX_PATH);
dirname(szLauncherPath);
@@ -62,6 +58,7 @@ int main( int argc, char **argv ) {
snprintf(szEnginePath, MAX_PATH, "%s/libengine.dylib", szLauncherPath2);
snprintf(szTier0Path, MAX_PATH, "%s/libtier0.dylib", szLauncherPath2);
#endif
#ifndef __WIN32__
if ( !dlopen(szSteamPath, RTLD_NOW ))
printf("Failed to open steam\n");
pTier0Lib = dlopen(szTier0Path, RTLD_LAZY | RTLD_GLOBAL);
@@ -69,7 +66,7 @@ int main( int argc, char **argv ) {
printf("Failed to open libtier0\n");
printf("\t%s\n",dlerror());
}
pEngineLib = dlopen(szEnginePath, RTLD_LAZY | RTLD_GLOBAL);
pEngineLib = dlopen(szEnginePath, RTLD_NOW );
if ( !pEngineLib ) {
printf("Failed to open libengine\n");
printf("\t%s\n",dlerror());
@@ -86,12 +83,22 @@ int main( int argc, char **argv ) {
pEngineMain(argc, argv);
dlclose(pEngineLib);
#else
#endif
#ifdef __WIN32__
GetModuleFileNameA(NULL, szLauncherPath, MAX_PATH);
dirname(szLauncherPath);
snprintf(szEnginePath, MAX_PATH, "%s/engine.dll", szLauncherPath);
snprintf(szTier0Path, MAX_PATH, "%s/tier0.dll", szLauncherPath);
printf("%s\n", szEnginePath);
pEngineLib = LoadLibraryA(szEnginePath);
pEngineMain = (EngineMainFn)GetProcAddress((HMODULE)pEngineLib, "FunnyMain");
if ( !pEngineMain ) {
printf("Symbol not found: FunnyMain\n");
}
dirname(szLauncherPath);
SetCurrentDirectoryA(szLauncherPath);
pEngineMain(argc, argv);
#endif
FunnyMain(argc, argv);
#endif
//FunnyMain(argc, argv);
};