Changeset View
Changeset View
Standalone View
Standalone View
source/main.cpp
Show All 38 Lines | |||||
#include "lib/ogl.h" | #include "lib/ogl.h" | ||||
#include "lib/timer.h" | #include "lib/timer.h" | ||||
#include "lib/external_libraries/libsdl.h" | #include "lib/external_libraries/libsdl.h" | ||||
#include "ps/ArchiveBuilder.h" | #include "ps/ArchiveBuilder.h" | ||||
#include "ps/CConsole.h" | #include "ps/CConsole.h" | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include "ps/DedicatedServer.h" | |||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/Game.h" | #include "ps/Game.h" | ||||
#include "ps/Globals.h" | #include "ps/Globals.h" | ||||
#include "ps/Hotkey.h" | #include "ps/Hotkey.h" | ||||
#include "ps/Loader.h" | #include "ps/Loader.h" | ||||
#include "ps/Mod.h" | #include "ps/Mod.h" | ||||
#include "ps/ModInstaller.h" | #include "ps/ModInstaller.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
▲ Show 20 Lines • Show All 466 Lines • ▼ Show 20 Lines | static void RunGameOrAtlas(int argc, const char* argv[]) | ||||
if (args.Has("unique-logs")) | if (args.Has("unique-logs")) | ||||
g_UniqueLogPostfix = L"_" + std::to_wstring(std::time(nullptr)) + L"_" + std::to_wstring(getpid()); | g_UniqueLogPostfix = L"_" + std::to_wstring(std::time(nullptr)) + L"_" + std::to_wstring(getpid()); | ||||
const bool isVisualReplay = args.Has("replay-visual"); | const bool isVisualReplay = args.Has("replay-visual"); | ||||
const bool isNonVisualReplay = args.Has("replay"); | const bool isNonVisualReplay = args.Has("replay"); | ||||
const bool isNonVisual = args.Has("autostart-nonvisual"); | const bool isNonVisual = args.Has("autostart-nonvisual"); | ||||
const bool isUsingRLInterface = args.Has("rl-interface"); | const bool isUsingRLInterface = args.Has("rl-interface"); | ||||
const bool isDedicated = args.Has("dedicated"); | |||||
const OsPath replayFile( | const OsPath replayFile( | ||||
isVisualReplay ? args.Get("replay-visual") : | isVisualReplay ? args.Get("replay-visual") : | ||||
isNonVisualReplay ? args.Get("replay") : ""); | isNonVisualReplay ? args.Get("replay") : ""); | ||||
if (isVisualReplay || isNonVisualReplay) | if (isVisualReplay || isNonVisualReplay) | ||||
{ | { | ||||
if (!FileExists(replayFile)) | if (!FileExists(replayFile)) | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | if (!modsToInstall.empty()) | ||||
} | } | ||||
installedMods = installer.GetInstalledMods(); | installedMods = installer.GetInstalledMods(); | ||||
ScriptInterface modInterface("Engine", "Mod", g_ScriptContext); | ScriptInterface modInterface("Engine", "Mod", g_ScriptContext); | ||||
g_Mods.UpdateAvailableMods(modInterface); | g_Mods.UpdateAvailableMods(modInterface); | ||||
} | } | ||||
if (isNonVisual) | if (isNonVisual || isDedicated) | ||||
{ | { | ||||
InitNonVisual(args); | InitNonVisual(args); | ||||
if (isUsingRLInterface) | if (isUsingRLInterface) | ||||
StartRLInterface(args); | StartRLInterface(args); | ||||
// This runs its own inner-loop. | |||||
if (isDedicated) | |||||
{ | |||||
RunDedicatedServer(args); | |||||
g_Shutdown = ShutdownType::Quit; | |||||
} | |||||
while (g_Shutdown == ShutdownType::None) | while (g_Shutdown == ShutdownType::None) | ||||
{ | { | ||||
if (isUsingRLInterface) | if (isUsingRLInterface) | ||||
g_RLInterface->TryApplyMessage(); | g_RLInterface->TryApplyMessage(); | ||||
else | else | ||||
NonVisualFrame(); | NonVisualFrame(); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator