void-packages/srcpkgs/blobby2/patches/08_config_loading.patch
2019-12-29 19:34:50 +01:00

170 lines
5 KiB
Diff

Description: Cherry-pick upstream commits 1528, 1530 and 1531.
Origin: upstream
Index: src/main.cpp
===================================================================
--- a/src/main.cpp (revision 1529)
+++ b/src/main.cpp (revision 1531)
@@ -26,16 +26,16 @@
#include <SDL2/SDL.h>
-#ifndef __APPLE__
-#ifndef __ANDROID__
-#include "config.h"
-#endif
-#endif
+#include "Global.h"
#ifdef __APPLE__
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#include <physfs.h>
- #else
+ #endif
+#endif
+
+#if __DESKTOP__
+ #ifndef WIN32
#include "config.h"
#endif
#endif
@@ -99,14 +99,6 @@
#if defined(WIN32)
// Just write in installation directory
fs.setWriteDir("data");
-
- // handle the case when it is installed
- fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby");
- fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/gfx.zip");
- fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/sounds.zip");
- fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/scripts.zip");
- fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/backgrounds.zip");
- fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/rules.zip");
#else
#ifndef __ANDROID__
// Create a search path in the home directory and ensure that
@@ -118,7 +110,16 @@
std::string userdir = fs.getUserDir();
#endif
#else
+ // Linux
std::string userdir = fs.getUserDir();
+
+ // handle the case when it is installed
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby");
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/gfx.zip");
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/sounds.zip");
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/scripts.zip");
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/backgrounds.zip");
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/rules.zip");
#endif
std::string userAppend = ".blobby";
std::string homedir = userdir + userAppend;
Index: src/server/servermain.cpp
===================================================================
--- a/src/server/servermain.cpp (revision 1529)
+++ b/src/server/servermain.cpp (revision 1531)
@@ -36,6 +36,7 @@
#include "SpeedController.h"
#include "FileSystem.h"
#include "UserConfig.h"
+#include "Global.h"
// platform specific
#ifndef WIN32
@@ -45,8 +46,14 @@
#include <cstdarg>
#endif
+#if __DESKTOP__
+#ifndef WIN32
+#include "config.h"
+#endif
+#endif
+
/* implementation */
#ifdef WIN32
@@ -60,7 +67,7 @@
static bool g_run_in_foreground = false;
static bool g_print_syslog_to_stderr = false;
static bool g_workaround_memleaks = false;
-static std::string g_config_file = "server/server.xml";
+static std::string g_config_file = "server.xml";
static std::string g_rules_file = "";
// ...
@@ -85,8 +92,7 @@
process_arguments(argc, argv);
FileSystem fileSys(argv[0]);
- fileSys.addToSearchPath("data" + fileSys.getDirSeparator() + "rules.zip");
-
+
if (!g_run_in_foreground)
{
fork_to_background();
@@ -312,7 +318,15 @@
void setup_physfs(char* argv0)
{
FileSystem& fs = FileSystem::getSingleton();
+
+ #if __DESKTOP__
+ #ifndef WIN32
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby");
+ fs.addToSearchPath(BLOBBY_INSTALL_PREFIX "/share/blobby/rules.zip");
+ #endif
+ #endif
fs.addToSearchPath("data");
+ fs.addToSearchPath("data" + fs.getDirSeparator() + "rules.zip");
}
Index: data/server/server.xml
===================================================================
--- a/data/server/server.xml (revision 1529)
+++ b/data/server/server.xml (revision 1531)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<userconfig>
- <var name="speed" value="75"/>
- <var name="port" value="1234"/>
- <var name="maximum_clients" value="100" />
- <var name="name" value="Blobby Volley 2 Server"/>
- <var name="description" value="replace this with a description of the server. To do this, edit data/server.xml"/>
- <var name="rules" value="default.lua"/>
-</userconfig>
Index: data/server.xml
===================================================================
--- a/data/server.xml (revision 0)
+++ b/data/server.xml (revision 1531)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<userconfig>
+ <var name="speed" value="75"/>
+ <var name="port" value="1234"/>
+ <var name="maximum_clients" value="100" />
+ <var name="name" value="Blobby Volley 2 Server"/>
+ <var name="description" value="replace this with a description of the server. To do this, edit data/server.xml"/>
+ <var name="rules" value="default.lua"/>
+</userconfig>
Index: data/CMakeLists.txt
===================================================================
--- a/data/CMakeLists.txt (revision 1527)
+++ b/data/CMakeLists.txt (revision 1531)
@@ -24,9 +24,10 @@
${CMAKE_CURRENT_BINARY_DIR}/scripts.zip
${CMAKE_CURRENT_BINARY_DIR}/backgrounds.zip
${CMAKE_CURRENT_BINARY_DIR}/rules.zip
+ Icon.bmp
config.xml
inputconfig.xml
- server/server.xml
+ server.xml
lang_de.xml
lang_en.xml
lang_fr.xml)