116 lines
3.5 KiB
Diff
116 lines
3.5 KiB
Diff
--- a/src/common/Game.cpp 2020-02-26 21:09:52.337117184 +0800
|
|
+++ b/src/common/Game.cpp 2020-02-26 21:09:41.111411200 +0800
|
|
@@ -8,7 +8,7 @@
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
-#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
|
+#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__) || defined(__HAIKU__)
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
--- a/src/common/path.cpp 2020-02-26 21:08:47.775684096 +0800
|
|
+++ b/src/common/path.cpp 2020-02-26 21:08:50.727187456 +0800
|
|
@@ -11,6 +11,8 @@
|
|
#include <shlobj.h>
|
|
#include "SDL_platform.h"
|
|
#endif
|
|
+#elif __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
#else
|
|
#include <stdlib.h>
|
|
#endif
|
|
@@ -47,6 +49,12 @@
|
|
result += "/supermariowar/";
|
|
return result;
|
|
|
|
+#elif __HAIKU__
|
|
+ char path[B_PATH_NAME_LENGTH];
|
|
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
|
|
+ std::string result(std::string(path) + "/supermariowar/");
|
|
+ return result;
|
|
+
|
|
#else // catch-all for Linux-based systems
|
|
std::string result(".smw/");
|
|
char* folder = getenv("HOME");
|
|
--- a/src/leveleditor/leveleditor.cpp 2020-02-27 20:22:35.953679872 +0800
|
|
+++ b/src/leveleditor/leveleditor.cpp 2020-02-27 20:23:58.894173184 +0800
|
|
@@ -75,6 +75,10 @@
|
|
#include <emscripten.h>
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#endif
|
|
+
|
|
|
|
#define MAPTITLESTRING "SMW 2.0 Level Editor"
|
|
|
|
@@ -364,6 +368,13 @@
|
|
{
|
|
if (argc >= 2)
|
|
RootDataDirectory = argv[1];
|
|
+#ifdef __HAIKU__
|
|
+ else {
|
|
+ char path[B_PATH_NAME_LENGTH];
|
|
+ if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "supermariowar", path, B_PATH_NAME_LENGTH) == B_OK)
|
|
+ RootDataDirectory = std::string(path);
|
|
+ }
|
|
+#endif
|
|
|
|
smw = new CGame(RootDataDirectory.c_str());
|
|
rm = new CResourceManager();
|
|
--- a/src/smw/main.cpp 2020-02-27 20:22:35.963117056 +0800
|
|
+++ b/src/smw/main.cpp 2020-02-27 20:23:02.737935360 +0800
|
|
@@ -53,6 +53,9 @@
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#endif
|
|
|
|
//now it's really time for an "engine" (aka resource manager)
|
|
|
|
@@ -276,6 +279,13 @@
|
|
{
|
|
if (argc >= 2)
|
|
RootDataDirectory = argv[1];
|
|
+#ifdef __HAIKU__
|
|
+ else {
|
|
+ char path[B_PATH_NAME_LENGTH];
|
|
+ if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "supermariowar", path, B_PATH_NAME_LENGTH) == B_OK)
|
|
+ RootDataDirectory = std::string(path);
|
|
+ }
|
|
+#endif
|
|
|
|
|
|
create_globals();
|
|
--- a/src/worldeditor/worldeditor.cpp 2020-02-27 20:22:35.998506496 +0800
|
|
+++ b/src/worldeditor/worldeditor.cpp 2020-02-27 20:23:24.569376768 +0800
|
|
@@ -62,6 +62,10 @@
|
|
#define SDL_Delay(n) ;
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#endif
|
|
+
|
|
#define MAPTITLESTRING "SMW 2.0 World Editor"
|
|
|
|
enum {EDITOR_EDIT, EDITOR_WATER, EDITOR_BACKGROUND, EDITOR_STAGEFOREGROUND, EDITOR_STRUCTUREFOREGROUND, EDITOR_BRIDGES, EDITOR_PATHSPRITE, EDITOR_VEHICLES, EDITOR_QUIT, SAVE_AS, FIND, CLEAR_WORLD, NEW_WORLD, RESIZE_WORLD, SAVE, EDITOR_WARP, DISPLAY_HELP, EDITOR_PATH, EDITOR_TYPE, EDITOR_BOUNDARY, EDITOR_START_ITEMS, EDITOR_STAGE};
|
|
@@ -456,6 +460,13 @@
|
|
{
|
|
if (argc >= 2)
|
|
RootDataDirectory = argv[1];
|
|
+#ifdef __HAIKU__
|
|
+ else {
|
|
+ char path[B_PATH_NAME_LENGTH];
|
|
+ if (find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "supermariowar", path, B_PATH_NAME_LENGTH) == B_OK)
|
|
+ RootDataDirectory = std::string(path);
|
|
+ }
|
|
+#endif
|
|
|
|
smw = new CGame(RootDataDirectory.c_str());
|
|
rm = new CResourceManager();
|