2024-03-24 05:45:27 -07:00
|
|
|
/* Copyright (C) 2024 Wildfire Games.
|
2023-12-02 16:30:12 -08:00
|
|
|
* This file is part of 0 A.D.
|
2009-04-18 10:00:33 -07:00
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2009-04-18 10:00:33 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2009-04-18 10:00:33 -07:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-12-02 16:30:12 -08:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2009-04-18 10:00:33 -07:00
|
|
|
*/
|
|
|
|
|
|
2010-02-17 15:21:49 -08:00
|
|
|
#ifndef INCLUDED_GAMESETUP
|
|
|
|
|
#define INCLUDED_GAMESETUP
|
|
|
|
|
|
2021-12-27 02:11:26 -08:00
|
|
|
#include "ps/CStr.h"
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
class CmdLineArgs;
|
|
|
|
|
class Paths;
|
2024-06-27 12:09:30 -07:00
|
|
|
class ScriptContext;
|
|
|
|
|
class ScriptInterface;
|
2021-12-27 02:11:26 -08:00
|
|
|
|
2007-05-26 16:29:20 -07:00
|
|
|
/**
|
|
|
|
|
* initialize global modules that are be needed before Init.
|
|
|
|
|
* must be called from the very beginning of main.
|
|
|
|
|
**/
|
|
|
|
|
extern void EarlyInit();
|
|
|
|
|
|
2021-01-15 08:30:05 -08:00
|
|
|
extern void EndGame();
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
enum InitFlags
|
|
|
|
|
{
|
|
|
|
|
// avoid setting a video mode / initializing OpenGL; assume that has
|
|
|
|
|
// already been done and everything is ready for rendering.
|
|
|
|
|
// needed by map editor because it creates its own window.
|
|
|
|
|
INIT_HAVE_VMODE = 1,
|
|
|
|
|
|
|
|
|
|
// skip initializing the in-game GUI.
|
|
|
|
|
// needed by map editor because it uses its own GUI.
|
2013-08-20 14:07:42 -07:00
|
|
|
INIT_NO_GUI = 2,
|
|
|
|
|
|
2014-08-25 09:02:40 -07:00
|
|
|
// initialize the mod folders from command line parameters
|
2014-08-25 09:38:54 -07:00
|
|
|
INIT_MODS = 8,
|
|
|
|
|
|
|
|
|
|
// mount the public mod
|
|
|
|
|
// needed by the map editor as "mod" does not provide everything it needs
|
|
|
|
|
INIT_MODS_PUBLIC = 16
|
2014-08-25 09:02:40 -07:00
|
|
|
};
|
|
|
|
|
|
2017-08-23 16:52:32 -07:00
|
|
|
extern const std::vector<CStr>& GetMods(const CmdLineArgs& args, int flags);
|
2018-05-24 11:08:56 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mounts all files of the given mods in the global VFS.
|
|
|
|
|
* Make sure to call CacheEnabledModVersions after every call to this.
|
|
|
|
|
*/
|
2014-08-25 09:02:40 -07:00
|
|
|
extern void MountMods(const Paths& paths, const std::vector<CStr>& mods);
|
2021-05-20 07:36:42 -07:00
|
|
|
|
2023-11-23 12:42:18 -08:00
|
|
|
void InitVfs(const CmdLineArgs& args);
|
|
|
|
|
|
2014-08-25 09:02:40 -07:00
|
|
|
/**
|
2023-01-19 14:34:46 -08:00
|
|
|
* Returns true if successful, false if Init is aborted early (for instance if
|
|
|
|
|
* mods changed, or if we are using -dumpSchema).
|
2024-03-24 05:45:27 -07:00
|
|
|
* `ShutdownConfigAndSubsequent` has to be called later.
|
2014-08-25 09:02:40 -07:00
|
|
|
*/
|
|
|
|
|
extern bool Init(const CmdLineArgs& args, int flags);
|
2019-09-15 05:16:28 -07:00
|
|
|
extern void InitInput();
|
2024-03-24 05:45:27 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* `ShutdownNetworkAndUI` has to be called later.
|
|
|
|
|
*/
|
2024-06-27 12:09:30 -07:00
|
|
|
void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& installedMods,
|
|
|
|
|
ScriptContext& scriptContext, ScriptInterface& scriptInterface);
|
2024-03-24 05:45:27 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* `ShutdownNetworkAndUI` has to be called later.
|
|
|
|
|
*/
|
2022-05-14 23:34:17 -07:00
|
|
|
extern bool InitNonVisual(const CmdLineArgs& args);
|
2024-03-24 05:45:27 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Has to be called before `ShutdownConfigAndSubsequent`.
|
|
|
|
|
*/
|
|
|
|
|
void ShutdownNetworkAndUI();
|
|
|
|
|
void ShutdownConfigAndSubsequent();
|
|
|
|
|
|
2011-04-06 19:32:16 -07:00
|
|
|
extern void CancelLoad(const CStrW& message);
|
2010-02-17 15:21:49 -08:00
|
|
|
|
2014-04-20 13:03:57 -07:00
|
|
|
extern bool InDevelopmentCopy();
|
|
|
|
|
|
2010-02-17 15:21:49 -08:00
|
|
|
#endif // INCLUDED_GAMESETUP
|