Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
GameSetup.h
Go to the documentation of this file.
1/* Copyright (C) 2024 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_GAMESETUP
19#define INCLUDED_GAMESETUP
20
21#include "ps/CStr.h"
22
23#include <vector>
24
25class CmdLineArgs;
26class Paths;
27class ScriptContext;
28class ScriptInterface;
29
30/**
31 * initialize global modules that are be needed before Init.
32 * must be called from the very beginning of main.
33 **/
34extern void EarlyInit();
35
36extern void EndGame();
37
39{
40 // avoid setting a video mode / initializing OpenGL; assume that has
41 // already been done and everything is ready for rendering.
42 // needed by map editor because it creates its own window.
44
45 // skip initializing the in-game GUI.
46 // needed by map editor because it uses its own GUI.
48
49 // initialize the mod folders from command line parameters
51
52 // mount the public mod
53 // needed by the map editor as "mod" does not provide everything it needs
55};
56
57extern const std::vector<CStr>& GetMods(const CmdLineArgs& args, int flags);
58
59/**
60 * Mounts all files of the given mods in the global VFS.
61 * Make sure to call CacheEnabledModVersions after every call to this.
62 */
63extern void MountMods(const Paths& paths, const std::vector<CStr>& mods);
64
65void InitVfs(const CmdLineArgs& args);
66
67/**
68 * Returns true if successful, false if Init is aborted early (for instance if
69 * mods changed, or if we are using -dumpSchema).
70 * `ShutdownConfigAndSubsequent` has to be called later.
71 */
72extern bool Init(const CmdLineArgs& args, int flags);
73extern void InitInput();
74
75/**
76 * `ShutdownNetworkAndUI` has to be called later.
77 */
78void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& installedMods,
79 ScriptContext& scriptContext, ScriptInterface& scriptInterface);
80
81/**
82 * `ShutdownNetworkAndUI` has to be called later.
83 */
84extern bool InitNonVisual(const CmdLineArgs& args);
85
86/**
87 * Has to be called before `ShutdownConfigAndSubsequent`.
88 */
91
92extern void CancelLoad(const CStrW& message);
93
94extern bool InDevelopmentCopy();
95
96#endif // INCLUDED_GAMESETUP
void MountMods(const Paths &paths, const std::vector< CStr > &mods)
Mounts all files of the given mods in the global VFS.
Definition: GameSetup.cpp:134
bool InitNonVisual(const CmdLineArgs &args)
ShutdownNetworkAndUI has to be called later.
Definition: GameSetup.cpp:694
void InitGraphics(const CmdLineArgs &args, int flags, const std::vector< CStr > &installedMods, ScriptContext &scriptContext, ScriptInterface &scriptInterface)
ShutdownNetworkAndUI has to be called later.
Definition: GameSetup.cpp:615
void EarlyInit()
initialize global modules that are be needed before Init.
Definition: GameSetup.cpp:477
void EndGame()
Definition: GameSetup.cpp:323
bool Init(const CmdLineArgs &args, int flags)
Returns true if successful, false if Init is aborted early (for instance if mods changed,...
Definition: GameSetup.cpp:519
bool InDevelopmentCopy()
Definition: GameSetup.cpp:1251
void CancelLoad(const CStrW &message)
Definition: GameSetup.cpp:1236
void ShutdownNetworkAndUI()
Has to be called before ShutdownConfigAndSubsequent.
Definition: GameSetup.cpp:336
void InitVfs(const CmdLineArgs &args)
Definition: GameSetup.cpp:158
void InitInput()
Definition: GameSetup.cpp:225
const std::vector< CStr > & GetMods(const CmdLineArgs &args, int flags)
InitFlags
Definition: GameSetup.h:39
@ INIT_MODS
Definition: GameSetup.h:50
@ INIT_MODS_PUBLIC
Definition: GameSetup.h:54
@ INIT_NO_GUI
Definition: GameSetup.h:47
@ INIT_HAVE_VMODE
Definition: GameSetup.h:43
void ShutdownConfigAndSubsequent()
Definition: GameSetup.cpp:376
Definition: CmdLineArgs.h:29
Wrapper class for OS paths used by the game.
Definition: Paths.h:28
Abstraction around a SpiderMonkey JSContext.
Definition: ScriptContext.h:46
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:72