mirror of
https://github.com/ApfelTeeSaft/ps4-fortniteserver.git
synced 2026-08-26 19:33:25 +00:00
63 lines
2.0 KiB
C++
63 lines
2.0 KiB
C++
#include "platform/platform.h"
|
||
#include "hooks/native.h"
|
||
#include "hooks/hooks.h"
|
||
#include "hooks/ufunc_hooks.h"
|
||
#include "logic/game.h"
|
||
|
||
#include "orbis_hookah.h"
|
||
|
||
static constexpr unsigned int kStartupDelaySecs = 120;
|
||
|
||
extern "C" int module_start(size_t /*argc*/, const void* /*argv*/) {
|
||
Platform::Log("[PS4GS] PRX loaded - waiting %u seconds for engine init...\n",
|
||
kStartupDelaySecs);
|
||
|
||
Platform::Sleep(kStartupDelaySecs);
|
||
|
||
Platform::Log("[PS4GS] Starting Fortnite 3.5 listen server\n");
|
||
Platform::Log("[PS4GS] Image base: 0x%llx\n",
|
||
(unsigned long long)Platform::GetImageBase());
|
||
|
||
if (!Hookah::Initialize()) {
|
||
Platform::Log("[PS4GS][FATAL] Hookah::Initialize() failed: %s\n",
|
||
Hookah::GetLastError());
|
||
return 1;
|
||
}
|
||
Platform::Log("[PS4GS] Hookah initialized - base 0x%llx size 0x%zx\n",
|
||
(unsigned long long)Hookah::GetBase(),
|
||
Hookah::GetModuleSize());
|
||
|
||
if (!Native::InitializeAll()) {
|
||
Platform::Log("[PS4GS][FATAL] Native::InitializeAll() failed\n");
|
||
Hookah::Uninitialize();
|
||
return 1;
|
||
}
|
||
|
||
UFunctionHooks::Initialize();
|
||
|
||
if (!Hooks::RegisterAll()) {
|
||
Platform::Log("[PS4GS][WARN] Some hooks failed to register; "
|
||
"check patterns in offsets.h\n");
|
||
}
|
||
|
||
if (!Hookah::EnableAllHooks()) {
|
||
Platform::Log("[PS4GS][WARN] EnableAllHooks() partial failure: %s\n",
|
||
Hookah::GetLastError());
|
||
}
|
||
|
||
{
|
||
Hookah::HookStats s = Hookah::GetStats();
|
||
Platform::Log("[PS4GS] Hook stats - total:%d active:%d failed:%d\n",
|
||
s.totalHooks, s.activeHooks, s.failedHooks);
|
||
}
|
||
|
||
Platform::Log("[PS4GS] Server ready. Waiting for play button...\n");
|
||
return 0; // success: module stays resident
|
||
}
|
||
|
||
extern "C" int module_stop(size_t /*argc*/, const void* /*argv*/) {
|
||
Platform::Log("[PS4GS] module_stop – uninstalling hooks\n");
|
||
Hookah::Uninitialize();
|
||
return 0;
|
||
}
|