/
doomsdayapp.cpp
750 lines (627 loc) · 21.5 KB
/
doomsdayapp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
/** @file doomsdayapp.cpp Common application-level state and components.
*
* @authors Copyright (c) 2015 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* 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. This program is distributed in the hope that it
* will be useful, 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 along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/
#include "doomsday/doomsdayapp.h"
#include "doomsday/games.h"
#include "doomsday/gameprofiles.h"
#include "doomsday/console/exec.h"
#include "doomsday/filesys/sys_direc.h"
#include "doomsday/filesys/fs_util.h"
#include "doomsday/resource/resources.h"
#include "doomsday/resource/bundles.h"
#include "doomsday/filesys/fs_main.h"
#include "doomsday/filesys/datafile.h"
#include "doomsday/filesys/datafolder.h"
#include "doomsday/filesys/virtualmappings.h"
#include "doomsday/paths.h"
#include "doomsday/busymode.h"
#include "doomsday/world/world.h"
#include "doomsday/world/entitydef.h"
#include "doomsday/Session"
#include "doomsday/SavedSession"
#include <de/App>
#include <de/Config>
#include <de/CommandLine>
#include <de/DictionaryValue>
#include <de/DirectoryFeed>
#include <de/Folder>
#include <de/Loop>
#include <de/PackageLoader>
#include <de/ScriptSystem>
#include <de/c_wrapper.h>
#include <de/strutil.h>
#include <de/memoryzone.h>
#include <QDir>
#include <QSettings>
#include <QStandardPaths>
#include <QCoreApplication>
#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# define ENV_PATH_SEP_CHAR ';'
#else
# define ENV_PATH_SEP_CHAR ':'
#endif
using namespace de;
static String const PATH_LOCAL_WADS ("/local/wads");
static String const PATH_LOCAL_PACKS("/local/packs");
static DoomsdayApp *theDoomsdayApp = nullptr;
DENG2_PIMPL(DoomsdayApp)
{
std::string ddBasePath; // Doomsday root directory is at...?
bool initialized = false;
bool shuttingDown = false;
Plugins plugins;
Games games;
Game *currentGame = nullptr;
GameProfile const *currentProfile = nullptr;
StringList preGamePackages;
GameProfiles gameProfiles;
BusyMode busyMode;
Players players;
res::Bundles dataBundles;
#ifdef WIN32
HINSTANCE hInstance = NULL;
#endif
/**
* Delegates game change notifications to scripts.
*/
class GameChangeScriptAudience : DENG2_OBSERVES(DoomsdayApp, GameChange)
{
public:
void currentGameChanged(Game const &newGame)
{
ArrayValue args;
args << DictionaryValue() << TextValue(newGame.id());
App::scriptSystem().nativeModule("App")["audienceForGameChange"]
.array().callElements(args);
}
};
GameChangeScriptAudience scriptAudienceForGameChange;
Instance(Public *i, Players::Constructor playerConstructor)
: Base(i)
, players(playerConstructor)
{
Record &appModule = App::scriptSystem().nativeModule("App");
appModule.addArray("audienceForGameChange"); // game change observers
audienceForGameChange += scriptAudienceForGameChange;
gameProfiles.setGames(games);
#ifdef WIN32
hInstance = GetModuleHandle(NULL);
#endif
}
~Instance()
{
// Save any changes to the game profiles.
gameProfiles.serialize();
theDoomsdayApp = nullptr;
}
void attachWadFeed(String const &description, NativePath const &path)
{
if (!path.isEmpty())
{
if (path.exists())
{
LOG_RES_NOTE("Using %s WAD folder: %s") << description << path.pretty();
App::rootFolder().locate<Folder>(PATH_LOCAL_WADS).attach(
new DirectoryFeed(path, DirectoryFeed::OnlyThisFolder));
}
else
{
LOG_RES_NOTE("Ignoring non-existent %s WAD folder: %s")
<< description << path.pretty();
}
}
}
void attachPacksFeed(String const &description, NativePath const &path)
{
if (!path.isEmpty())
{
if (path.exists())
{
LOG_RES_NOTE("Using %s package folder (including subfolders): %s")
<< description << path.pretty();
App::rootFolder().locate<Folder>(PATH_LOCAL_PACKS).attach(new DirectoryFeed(path));
}
else
{
LOG_RES_NOTE("Ignoring non-existent %s package folder: %s")
<< description << path.pretty();
}
}
}
/**
* Doomsday can locate WAD files from various places. This method attaches
* a set of feeds to /local/wads/ so that all the native folders where the
* user keeps WAD files are available in the tree.
*/
void initWadFolders()
{
// "/local" is for various files on the local computer.
Folder &wads = App::fileSystem().makeFolder(PATH_LOCAL_WADS, FS::DontInheritFeeds);
wads.clear();
wads.clearFeeds();
CommandLine &cmdLine = App::commandLine();
NativePath const startupPath = cmdLine.startupPath();
// Feeds are added in ascending priority.
// Check for games installed using Steam.
NativePath const steamBase = steamBasePath();
if (steamBase.exists())
{
NativePath steamPath = steamBase / "SteamApps/common/";
LOG_RES_NOTE("Detected SteamApps path: %s") << steamPath.pretty();
static String const appDirs[] = {
"DOOM 2/base",
"Final DOOM/base",
"Heretic Shadow of the Serpent Riders/base",
"Hexen/base",
"Hexen Deathkings of the Dark Citadel/base",
"Ultimate Doom/base",
"DOOM 3 BFG Edition/base/wads"
};
for (auto const &appDir : appDirs)
{
NativePath const p = steamPath / appDir;
if (p.exists())
{
attachWadFeed("Steam", p);
}
}
}
#ifdef UNIX
NativePath const systemWads("/usr/share/games/doom");
if (systemWads.exists())
{
attachWadFeed("system", systemWads);
}
#endif
// Add all paths from the DOOMWADPATH environment variable.
if (getenv("DOOMWADPATH"))
{
// Interpreted similarly to the PATH variable.
QStringList paths = String(getenv("DOOMWADPATH"))
.split(ENV_PATH_SEP_CHAR, String::SkipEmptyParts);
while (!paths.isEmpty())
{
attachWadFeed(_E(m) "DOOMWADPATH" _E(.), startupPath / paths.takeLast());
}
}
// Add the path from the DOOMWADDIR environment variable.
if (getenv("DOOMWADDIR"))
{
attachWadFeed(_E(m) "DOOMWADDIR" _E(.), startupPath / getenv("DOOMWADDIR"));
}
#ifdef UNIX
// There may be an iwaddir specified in a system-level config file.
filename_t fn;
if (UnixInfo_GetConfigValue("paths", "iwaddir", fn, FILENAME_T_MAXLEN))
{
attachWadFeed("UnixInfo " _E(i) "paths.iwaddir" _E(.), startupPath / fn);
}
#endif
// Command line paths.
if (auto arg = cmdLine.check("-iwad", 1)) // has at least one parameter
{
for (dint p = arg.pos + 1; p < cmdLine.count(); ++p)
{
if (cmdLine.isOption(p)) break;
cmdLine.makeAbsolutePath(p);
attachWadFeed("command-line", cmdLine.at(p));
}
}
// Configured via GUI.
for (String path : App::config().getStringList("resource.iwadFolder"))
{
attachWadFeed("user-selected", path);
}
wads.populate();
}
void initPackageFolders()
{
Folder &packs = App::fileSystem().makeFolder(PATH_LOCAL_PACKS, FS::DontInheritFeeds);
packs.clear();
packs.clearFeeds();
auto &cmdLine = App::commandLine();
#ifdef UNIX
// There may be an iwaddir specified in a system-level config file.
filename_t fn;
if (UnixInfo_GetConfigValue("paths", "packsdir", fn, FILENAME_T_MAXLEN))
{
attachPacksFeed("UnixInfo " _E(i) "paths.packsdir" _E(.),
cmdLine.startupPath() / fn);
}
#endif
// Command line paths.
if (auto arg = cmdLine.check("-packs", 1))
{
for (dint p = arg.pos + 1; p < cmdLine.count(); ++p)
{
if (cmdLine.isOption(p)) break;
cmdLine.makeAbsolutePath(p);
attachPacksFeed("command-line", cmdLine.at(p));
}
}
packs.populate();
}
#ifdef UNIX
void determineGlobalPaths()
{
// By default, make sure the working path is the home folder.
App::setCurrentWorkPath(App::app().nativeHomePath());
// libcore has determined the native base path, so let FS1 know about it.
DD_SetBasePath(DENG2_APP->nativeBasePath().toUtf8());
}
#endif // UNIX
#ifdef WIN32
void determineGlobalPaths()
{
// Use a custom base directory?
if (CommandLine_CheckWith("-basedir", 1))
{
DD_SetBasePath(CommandLine_Next());
}
else
{
// The default base directory is one level up from the bin dir.
String binDir = App::executablePath().fileNamePath().withSeparators('/');
String baseDir = String(QDir::cleanPath(binDir / String(".."))) + '/';
DD_SetBasePath(baseDir.toUtf8().constData());
}
}
#endif // WIN32
DENG2_PIMPL_AUDIENCE(GameUnload)
DENG2_PIMPL_AUDIENCE(GameChange)
DENG2_PIMPL_AUDIENCE(ConsoleRegistration)
};
DENG2_AUDIENCE_METHOD(DoomsdayApp, GameUnload)
DENG2_AUDIENCE_METHOD(DoomsdayApp, GameChange)
DENG2_AUDIENCE_METHOD(DoomsdayApp, ConsoleRegistration)
DoomsdayApp::DoomsdayApp(Players::Constructor playerConstructor)
: d(new Instance(this, playerConstructor))
{
DENG2_ASSERT(!theDoomsdayApp);
theDoomsdayApp = this;
App::app().addInitPackage("net.dengine.base");
static SavedSession::Interpreter intrpSavedSession;
static DataBundle::Interpreter intrpDataBundle;
App::fileSystem().addInterpreter(intrpSavedSession);
App::fileSystem().addInterpreter(intrpDataBundle);
}
void DoomsdayApp::initialize()
{
d->initWadFolders();
d->initPackageFolders();
auto &fs = App::fileSystem();
// Folder for temporary native files.
NativePath tmpPath = NativePath(QStandardPaths::writableLocation(QStandardPaths::TempLocation))
/ ("doomsday-" + QString::number(qApp->applicationPid()));
Folder &tmpFolder = fs.makeFolder("/tmp");
tmpFolder.attach(new DirectoryFeed(tmpPath,
DirectoryFeed::AllowWrite |
DirectoryFeed::CreateIfMissing |
DirectoryFeed::OnlyThisFolder));
tmpFolder.populate(Folder::PopulateOnlyThisFolder);
// "/sys/bundles" has package-like symlinks to files that are not in
// Doomsday 2 format but can be loaded as packages.
fs.makeFolder("/sys/bundles", FS::DontInheritFeeds);
d->initialized = true;
d->dataBundles.identify();
d->gameProfiles.deserialize();
}
void DoomsdayApp::initWadFolders()
{
d->initWadFolders();
d->dataBundles.identify();
if (d->initialized)
{
games().checkReadiness();
}
}
void DoomsdayApp::determineGlobalPaths()
{
d->determineGlobalPaths();
}
DoomsdayApp &DoomsdayApp::app()
{
DENG2_ASSERT(theDoomsdayApp);
return *theDoomsdayApp;
}
res::Bundles &DoomsdayApp::bundles()
{
return DoomsdayApp::app().d->dataBundles;
}
Plugins &DoomsdayApp::plugins()
{
return DoomsdayApp::app().d->plugins;
}
Games &DoomsdayApp::games()
{
return DoomsdayApp::app().d->games;
}
GameProfiles &DoomsdayApp::gameProfiles()
{
return DoomsdayApp::app().d->gameProfiles;
}
Players &DoomsdayApp::players()
{
return DoomsdayApp::app().d->players;
}
BusyMode &DoomsdayApp::busyMode()
{
return DoomsdayApp::app().d->busyMode;
}
NativePath DoomsdayApp::steamBasePath()
{
#ifdef WIN32
// The path to Steam can be queried from the registry.
{
QSettings st("HKEY_CURRENT_USER\\Software\\Valve\\Steam\\", QSettings::NativeFormat);
String path = st.value("SteamPath").toString();
if (!path.isEmpty()) return path;
}
{
QSettings st("HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\", QSettings::NativeFormat);
String path = st.value("InstallPath").toString();
if (!path.isEmpty()) return path;
}
#elif MACOSX
return NativePath(QDir::homePath()) / "Library/Application Support/Steam/";
#endif
/// @todo Where are Steam apps located on Linux?
return "";
}
/*bool DoomsdayApp::isUsingUserDir() const
{
return d->usingUserDir;
}*/
bool DoomsdayApp::isShuttingDown() const
{
return d->shuttingDown;
}
void DoomsdayApp::setShuttingDown(bool shuttingDown)
{
d->shuttingDown = shuttingDown;
}
std::string const &DoomsdayApp::doomsdayBasePath() const
{
return d->ddBasePath;
}
void DoomsdayApp::setDoomsdayBasePath(NativePath const &path)
{
/// @todo Unfortunately Dir/fs_util assumes fixed-size strings, so we
/// can't take advantage of std::string. -jk
filename_t temp;
strncpy(temp, path.toUtf8(), FILENAME_T_MAXLEN);
Dir_CleanPath(temp, FILENAME_T_MAXLEN);
Dir_MakeAbsolutePath(temp, FILENAME_T_MAXLEN);
// Ensure it ends with a directory separator.
F_AppendMissingSlashCString(temp, FILENAME_T_MAXLEN);
d->ddBasePath = temp;
}
/*std::string const &DoomsdayApp::doomsdayRuntimePath() const
{
return d->ddRuntimePath;
}
void DoomsdayApp::setDoomsdayRuntimePath(NativePath const &path)
{
d->ddRuntimePath = path.toUtf8().constData();
}*/
#ifdef WIN32
void *DoomsdayApp::moduleHandle() const
{
return d->hInstance;
}
#endif
Game const &DoomsdayApp::game()
{
DENG2_ASSERT(app().d->currentGame != 0);
return *app().d->currentGame;
}
GameProfile const *DoomsdayApp::currentGameProfile()
{
return app().d->currentProfile;
}
bool DoomsdayApp::isGameLoaded()
{
return App::appExists() && !DoomsdayApp::game().isNull();
}
void DoomsdayApp::unloadGame(GameProfile const &/*upcomingGame*/)
{
auto &gx = plugins().gameExports();
if (App_GameLoaded())
{
LOG_MSG("Unloading game...");
if (gx.Shutdown)
{
gx.Shutdown();
}
// Tell the plugin it is being unloaded.
{
void *unloader = plugins().findEntryPoint(game().pluginId(), "DP_Unload");
LOGDEV_MSG("Calling DP_Unload %p") << unloader;
plugins().setActivePluginId(game().pluginId());
if (unloader) ((pluginfunc_t)unloader)();
plugins().setActivePluginId(0);
}
// Unload all packages that weren't loaded before the game was loaded.
for (String const &packageId : PackageLoader::get().loadedPackages().keys())
{
if (!d->preGamePackages.contains(packageId))
{
PackageLoader::get().unload(packageId);
}
}
// Clear application and subsystem state.
reset();
Resources::get().clear();
// We do not want to load session resources specified on the command line again.
Session::profile().resourceFiles.clear();
// The current game is now the special "null-game".
setGame(games().nullGame());
App_FileSystem().unloadAllNonStartupFiles();
// Reset file IDs so previously seen files can be processed again.
/// @todo this releases the IDs of startup files too but given the
/// only startup file is doomsday.pk3 which we never attempt to load
/// again post engine startup, this isn't an immediate problem.
App_FileSystem().resetFileIds();
// Update the dir/WAD translations.
FS_InitPathLumpMappings();
FS_InitVirtualPathMappings();
App_FileSystem().resetAllSchemes();
}
/// @todo The entire material collection should not be destroyed during a reload.
Resources::get().clearAllMaterialSchemes();
}
void DoomsdayApp::reset()
{
// Reset the world back to it's initial state (unload the map, reset players, etc...).
World::get().reset();
Z_FreeTags(PU_GAMESTATIC, PU_PURGELEVEL - 1);
P_ShutdownMapEntityDefs();
// Reinitialize the console.
Con_ClearDatabases();
Con_InitDatabases();
DENG2_FOR_AUDIENCE2(ConsoleRegistration, i)
{
i->consoleRegistration();
}
d->currentProfile = nullptr;
}
void DoomsdayApp::setGame(Game const &game)
{
app().d->currentGame = const_cast<Game *>(&game);
}
void DoomsdayApp::makeGameCurrent(GameProfile const &profile)
{
auto const &newGame = games()[profile.game()];
if (!newGame.isNull())
{
LOG_MSG("Loading game \"%s\"...") << profile.name();
}
Library_ReleaseGames();
if (!isShuttingDown())
{
// Re-initialize subsystems needed even when in Home.
if (!plugins().exchangeGameEntryPoints(newGame.pluginId()))
{
throw Plugins::EntryPointError("DoomsdayApp::makeGameCurrent",
"Failed to exchange entrypoints with plugin " +
QString::number(newGame.pluginId()));
}
}
// This is now the current game.
setGame(newGame);
d->currentProfile = &profile;
Session::profile().gameId = newGame.id();
if (!newGame.isNull())
{
// Remember what was loaded beforehand.
d->preGamePackages = PackageLoader::get().loadedPackagesInOrder();
}
profile.loadPackages();
}
// from game_init.cpp
extern int beginGameChangeBusyWorker(void *context);
extern int loadGameStartupResourcesBusyWorker(void *context);
extern int loadAddonResourcesBusyWorker(void *context);
bool DoomsdayApp::changeGame(GameProfile const &profile,
std::function<int (void *)> gameActivationFunc,
Behaviors behaviors)
{
auto const &newGame = games()[profile.game()];
// Ignore attempts to reload the current game?
if (game().id() == newGame.id())
{
// We are reloading.
if (!behaviors.testFlag(AllowReload))
{
if (isGameLoaded())
{
LOG_NOTE("%s (%s) is already loaded") << newGame.title() << newGame.id();
}
return true;
}
}
// The current game will now be unloaded.
DENG2_FOR_AUDIENCE2(GameUnload, i)
{
i->aboutToUnloadGame(game());
}
unloadGame(profile);
// Do the switch.
makeGameCurrent(profile);
/*
* If we aren't shutting down then we are either loading a game or switching
* to Home (the current game will have already been unloaded).
*/
if (!isShuttingDown())
{
/*
* The bulk of this we can do in busy mode unless we are already busy
* (which can happen if a fatal error occurs during game load and we must
* shutdown immediately; Sys_Shutdown will call back to load the special
* "null-game" game).
*/
dint const busyMode = BUSYF_PROGRESS_BAR; // | (verbose? BUSYF_CONSOLE_OUTPUT : 0);
GameChangeParameters p;
BusyTask gameChangeTasks[] =
{
// Phase 1: Initialization.
{ beginGameChangeBusyWorker, &p, busyMode, "Loading game...", 200, 0.0f, 0.1f },
// Phase 2: Loading "startup" resources.
{ loadGameStartupResourcesBusyWorker, &p, busyMode, nullptr, 200, 0.1f, 0.3f },
// Phase 3: Loading "add-on" resources.
{ loadAddonResourcesBusyWorker, &p, busyMode, "Loading add-ons...", 200, 0.3f, 0.7f },
// Phase 4: Game activation.
{ gameActivationFunc, &p, busyMode, "Starting game...", 200, 0.7f, 1.0f }
};
p.initiatedBusyMode = !BusyMode_Active();
if (isGameLoaded())
{
// Tell the plugin it is being loaded.
/// @todo Must this be done in the main thread?
void *loader = plugins().findEntryPoint(game().pluginId(), "DP_Load");
LOGDEV_MSG("Calling DP_Load %p") << loader;
plugins().setActivePluginId(game().pluginId());
if (loader) ((pluginfunc_t)loader)();
plugins().setActivePluginId(0);
}
/// @todo Kludge: Use more appropriate task names when unloading a game.
if (newGame.isNull())
{
gameChangeTasks[0].name = "Unloading game...";
gameChangeTasks[3].name = "Switching to Home...";
}
// kludge end
BusyMode_RunTasks(gameChangeTasks, sizeof(gameChangeTasks)/sizeof(gameChangeTasks[0]));
if (isGameLoaded())
{
Game::printBanner(game());
}
}
DENG_ASSERT(plugins().activePluginId() == 0);
// Game change is complete.
DENG2_FOR_AUDIENCE2(GameChange, i)
{
i->currentGameChanged(game());
}
return true;
}
bool App_GameLoaded()
{
return DoomsdayApp::isGameLoaded();
}