Skip to content

Commit

Permalink
Fixed|Windows: Registering GameKit extensions
Browse files Browse the repository at this point in the history
Added some actual code to libgamekit so the library gets initialized
correctly.

Replacing a few static Strings in GameRules with `const char *` so that
they require no initialization (order not guaranteed; may be used before
constructors called).
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent f2265bc commit 253fdd7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 21 deletions.
3 changes: 3 additions & 0 deletions doomsday/apps/client/src/main_client.cpp
Expand Up @@ -60,12 +60,15 @@ DE_IMPORT_LIBRARY(audio_fmod)

using namespace de;

DE_EXTERN_C void GameKit_Init();

/**
* Application entry point.
*/
int main(int argc, char **argv)
{
init_Foundation();
GameKit_Init();
int exitCode = 0;
{
ClientApp clientApp(makeList(argc, argv));
Expand Down
1 change: 1 addition & 0 deletions doomsday/apps/client/src/resource/image.cpp
Expand Up @@ -419,6 +419,7 @@ Source GL_LoadExtImage(image_t &image, char const *_searchPath, gfxmode_t mode)
{
String foundPath = App_FileSystem().findPath(res::Uri(RC_GRAPHIC, _searchPath),
RLF_DEFAULT, App_ResourceClass(RC_GRAPHIC));

// Ensure the found path is absolute.
foundPath = App_BasePath() / foundPath;

Expand Down
3 changes: 3 additions & 0 deletions doomsday/apps/server/src/main_server.cpp
Expand Up @@ -24,13 +24,16 @@

using namespace de;

DE_EXTERN_C void GameKit_Init();

/**
* Server application entry point.
*/
int main(int argc, char** argv)
{
int exitCode;
init_Foundation();
GameKit_Init();
ServerApp serverApp(makeList(argc, argv));
try
{
Expand Down
9 changes: 1 addition & 8 deletions doomsday/build/scripts/mingw_deps.py
Expand Up @@ -28,12 +28,5 @@
if os.path.exists(dll_path) and not os.path.exists(dest_path):
# Copy this dependency.
print(dll_path)
shutil.copy(dll_path, dest_path)
shutil.copy(dll_path, dest_path)
binaries.add(dest_path)







14 changes: 7 additions & 7 deletions doomsday/libs/gamekit/libs/common/include/gamerules.h
Expand Up @@ -54,19 +54,19 @@ class GameRules
};
Values const values{};

static de::String const VAR_skill;
static de::String const VAR_fast;
static de::String const VAR_deathmatch;
static de::String const VAR_noMonsters;
static de::String const VAR_respawnMonsters;
static de::String const VAR_randomClasses;
static const char *VAR_skill;
static const char *VAR_fast;
static const char *VAR_deathmatch;
static const char *VAR_noMonsters;
static const char *VAR_respawnMonsters;
static const char *VAR_randomClasses;

public:
GameRules();
GameRules(GameRules const &other);

//static GameRules *fromReader(Reader1 *reader);
static GameRules *fromRecord(de::Record const &rec, GameRules const *defaults = 0);
static GameRules *fromRecord(de::Record const &rec, GameRules const *defaults = nullptr);

GameRules &operator = (GameRules const &other);

Expand Down
12 changes: 6 additions & 6 deletions doomsday/libs/gamekit/libs/common/src/game/gamerules.cpp
Expand Up @@ -28,12 +28,12 @@ using namespace de;
* These keys are used for serialization, so if changed, the only keys still need to be changed
* when reading data.
*/
String const GameRules::VAR_skill = "skill";
String const GameRules::VAR_fast = "fast";
String const GameRules::VAR_deathmatch = "deathmatch";
String const GameRules::VAR_noMonsters = "noMonsters";
String const GameRules::VAR_respawnMonsters = "respawnMonsters";
String const GameRules::VAR_randomClasses = "randomClasses";
const char *GameRules::VAR_skill = "skill";
const char *GameRules::VAR_fast = "fast";
const char *GameRules::VAR_deathmatch = "deathmatch";
const char *GameRules::VAR_noMonsters = "noMonsters";
const char *GameRules::VAR_respawnMonsters = "respawnMonsters";
const char *GameRules::VAR_randomClasses = "randomClasses";

DE_PIMPL_NOREF(GameRules)
{
Expand Down
7 changes: 7 additions & 0 deletions doomsday/libs/gamekit/src/libgamekit.cpp
Expand Up @@ -18,8 +18,15 @@

//#include "gamekit/libgamekit.h"
#include <de/Extension>
#include <de/Log>

DE_EXTENSION(doom);
DE_EXTENSION(doom64);
DE_EXTENSION(heretic);
DE_EXTENSION(hexen);

DE_EXTERN_C void GameKit_Init()
{
LOG_AS("GameKit");
LOG_MSG("Initializing...");
}

0 comments on commit 253fdd7

Please sign in to comment.