Pyrogenesis  trunk
Macros | Functions | Variables
GameSetup.cpp File Reference
#include "precompiled.h"
#include "ps/GameSetup/GameSetup.h"
#include "graphics/GameView.h"
#include "graphics/MapReader.h"
#include "graphics/TerrainTextureManager.h"
#include "gui/CGUI.h"
#include "gui/GUIManager.h"
#include "gui/Scripting/JSInterface_GUIManager.h"
#include "i18n/L10n.h"
#include "lib/app_hooks.h"
#include "lib/config2.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/file/common/file_stats.h"
#include "lib/input.h"
#include "lib/timer.h"
#include "lobby/IXmppClient.h"
#include "network/NetServer.h"
#include "network/NetClient.h"
#include "network/NetMessage.h"
#include "network/NetMessages.h"
#include "network/scripting/JSInterface_Network.h"
#include "ps/CConsole.h"
#include "ps/CLogger.h"
#include "ps/ConfigDB.h"
#include "ps/Filesystem.h"
#include "ps/Game.h"
#include "ps/GameSetup/Atlas.h"
#include "ps/GameSetup/Paths.h"
#include "ps/GameSetup/Config.h"
#include "ps/GameSetup/CmdLineArgs.h"
#include "ps/GameSetup/HWDetect.h"
#include "ps/Globals.h"
#include "ps/GUID.h"
#include "ps/Hotkey.h"
#include "ps/Joystick.h"
#include "ps/Loader.h"
#include "ps/Mod.h"
#include "ps/ModIo.h"
#include "ps/Profile.h"
#include "ps/ProfileViewer.h"
#include "ps/Profiler2.h"
#include "ps/Pyrogenesis.h"
#include "ps/scripting/JSInterface_Console.h"
#include "ps/scripting/JSInterface_Game.h"
#include "ps/scripting/JSInterface_Main.h"
#include "ps/scripting/JSInterface_VFS.h"
#include "ps/TouchInput.h"
#include "ps/UserReport.h"
#include "ps/Util.h"
#include "ps/VideoMode.h"
#include "ps/VisualReplay.h"
#include "ps/World.h"
#include "renderer/Renderer.h"
#include "renderer/SceneRenderer.h"
#include "renderer/VertexBufferManager.h"
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptStats.h"
#include "scriptinterface/ScriptContext.h"
#include "scriptinterface/ScriptConversions.h"
#include "simulation2/Simulation2.h"
#include "simulation2/scripting/JSInterface_Simulation.h"
#include "soundmanager/scripting/JSInterface_Sound.h"
#include "soundmanager/ISoundManager.h"
#include "tools/atlas/GameInterface/GameLoop.h"
#include <X11/Xlib.h>
#include <fstream>
#include <iostream>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/split.hpp>

Macros

#define MUST_INIT_X11   1
 

Functions

void RestartEngine ()
 
 ERROR_GROUP (System)
 
 ERROR_TYPE (System, SDLInitFailed)
 
 ERROR_TYPE (System, VmodeFailed)
 
 ERROR_TYPE (System, RequiredExtensionsMissing)
 
ErrorReactionInternal psDisplayError (const wchar_t *text, size_t flags)
 
void MountMods (const Paths &paths, const std::vector< CStr > &mods)
 Mounts all files of the given mods in the global VFS. More...
 
static void InitVfs (const CmdLineArgs &args, int flags)
 
static void InitPs (bool setup_gui, const CStrW &gui_page, ScriptInterface *srcScriptInterface, JS::HandleValue initData)
 
void InitInput ()
 
static void ShutdownPs ()
 
static void InitSDL ()
 
static void ShutdownSDL ()
 
void EndGame ()
 
void Shutdown (int flags)
 
static void FixLocales ()
 
void EarlyInit ()
 initialize global modules that are be needed before Init. More...
 
bool Autostart (const CmdLineArgs &args)
 
bool AutostartVisualReplay (const std::string &replayFile)
 Returns true if the user has intended to start a visual replay from command line. More...
 
bool Init (const CmdLineArgs &args, int flags)
 Returns true if successful, false if mods changed and restart_engine was called. More...
 
void InitGraphics (const CmdLineArgs &args, int flags, const std::vector< CStr > &installedMods)
 
bool InitNonVisual (const CmdLineArgs &args)
 
CStr8 LoadSettingsOfScenarioMap (const VfsPath &mapPath)
 Temporarily loads a scenario map and retrieves the "ScriptSettings" JSON data from it. More...
 
void AutostartLoadScript (const ScriptInterface &scriptInterface, const VfsPath &path)
 
CParamNode GetTemplate (const std::string &templateName)
 
void CancelLoad (const CStrW &message)
 
bool InDevelopmentCopy ()
 

Variables

thread_local std::shared_ptr< ScriptContextg_ScriptContext
 
bool g_InDevelopmentCopy
 
bool g_CheckedIfInDevelopmentCopy = false
 

Macro Definition Documentation

◆ MUST_INIT_X11

#define MUST_INIT_X11   1

Function Documentation

◆ Autostart()

bool Autostart ( const CmdLineArgs args)

◆ AutostartLoadScript()

void AutostartLoadScript ( const ScriptInterface scriptInterface,
const VfsPath path 
)

◆ AutostartVisualReplay()

bool AutostartVisualReplay ( const std::string &  replayFile)

Returns true if the user has intended to start a visual replay from command line.

◆ CancelLoad()

void CancelLoad ( const CStrW &  message)

◆ EarlyInit()

void EarlyInit ( )

initialize global modules that are be needed before Init.

must be called from the very beginning of main.

◆ EndGame()

void EndGame ( )

◆ ERROR_GROUP()

ERROR_GROUP ( System  )

◆ ERROR_TYPE() [1/3]

ERROR_TYPE ( System  ,
SDLInitFailed   
)

◆ ERROR_TYPE() [2/3]

ERROR_TYPE ( System  ,
VmodeFailed   
)

◆ ERROR_TYPE() [3/3]

ERROR_TYPE ( System  ,
RequiredExtensionsMissing   
)

◆ FixLocales()

static void FixLocales ( )
static

◆ GetTemplate()

CParamNode GetTemplate ( const std::string &  templateName)

◆ InDevelopmentCopy()

bool InDevelopmentCopy ( )

◆ Init()

bool Init ( const CmdLineArgs args,
int  flags 
)

Returns true if successful, false if mods changed and restart_engine was called.

In the latter case the caller should call Shutdown() with SHUTDOWN_FROM_CONFIG.

◆ InitGraphics()

void InitGraphics ( const CmdLineArgs args,
int  flags,
const std::vector< CStr > &  installedMods 
)

◆ InitInput()

void InitInput ( )

◆ InitNonVisual()

bool InitNonVisual ( const CmdLineArgs args)

◆ InitPs()

static void InitPs ( bool  setup_gui,
const CStrW &  gui_page,
ScriptInterface srcScriptInterface,
JS::HandleValue  initData 
)
static

◆ InitSDL()

static void InitSDL ( )
static

◆ InitVfs()

static void InitVfs ( const CmdLineArgs args,
int  flags 
)
static

◆ LoadSettingsOfScenarioMap()

CStr8 LoadSettingsOfScenarioMap ( const VfsPath mapPath)

Temporarily loads a scenario map and retrieves the "ScriptSettings" JSON data from it.

The scenario map format is used for scenario and skirmish map types (random games do not use a "map" (format) but a small JavaScript program which creates a map on the fly). It contains a section to initialize the game setup screen.

Parameters
mapPathAbsolute path (from VFS root) to the map file to peek in.
Returns
ScriptSettings in JSON format extracted from the map.

◆ MountMods()

void MountMods ( const Paths paths,
const std::vector< CStr > &  mods 
)

Mounts all files of the given mods in the global VFS.

Make sure to call CacheEnabledModVersions after every call to this.

◆ psDisplayError()

ErrorReactionInternal psDisplayError ( const wchar_t *  text,
size_t  flags 
)

◆ RestartEngine()

void RestartEngine ( )

◆ Shutdown()

void Shutdown ( int  flags)

◆ ShutdownPs()

static void ShutdownPs ( )
static

◆ ShutdownSDL()

static void ShutdownSDL ( )
static

Variable Documentation

◆ g_CheckedIfInDevelopmentCopy

bool g_CheckedIfInDevelopmentCopy = false

◆ g_InDevelopmentCopy

bool g_InDevelopmentCopy

◆ g_ScriptContext

thread_local std::shared_ptr<ScriptContext> g_ScriptContext