openhexagon: Init at 1.92b

This commit is contained in:
madmaurice 2021-01-06 23:55:24 +01:00
parent df3743fe58
commit 44db586e8c
13 changed files with 463 additions and 0 deletions

View file

@ -15,4 +15,6 @@ rec {
};
flatery-icon-theme = callPackage ./pkgs/icon-theme/flatery-icon-theme.nix {};
openhexagon = callPackage ./pkgs/openhexagon/default.nix {};
}

View file

@ -0,0 +1,10 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 916e49f..4674424 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,4 +43,4 @@ else()
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION lib LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
endif()
-install(DIRECTORY ${SRC_DIR} DESTINATION .)
+install(DIRECTORY ${INC_DIR} DESTINATION .)

View file

@ -0,0 +1,27 @@
diff --git a/cmake/modules/FindLUA.cmake b/cmake/modules/FindLUA.cmake
index afd8dbc..14205ec 100755
--- a/cmake/modules/FindLUA.cmake
+++ b/cmake/modules/FindLUA.cmake
@@ -1,4 +1,4 @@
-FIND_PATH(LUA_INCLUDE_DIR lua5.1/lua.hpp
+FIND_PATH(LUA_INCLUDE_DIR lua.hpp
PATHS "${PROJECT_SOURCE_DIR}/../lua/"
PATH_SUFFIXES include/ lua/ lua/include/ ./
"${PROJECT_SOURCE_DIR}/extlibs/lua/"
diff --git a/include/SSVLuaWrapper/LuaContext/LuaContext.h b/include/SSVLuaWrapper/LuaContext/LuaContext.h
index eed4f3c..bff3ef6 100755
--- a/include/SSVLuaWrapper/LuaContext/LuaContext.h
+++ b/include/SSVLuaWrapper/LuaContext/LuaContext.h
@@ -46,9 +46,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C"
{
-#include <lua5.1/lua.h>
-#include <lua5.1/lualib.h>
-#include <lua5.1/lauxlib.h>
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
}

View file

@ -0,0 +1,99 @@
diff --git a/src/SSVOpenHexagon/Core/main.cpp b/src/SSVOpenHexagon/Core/main.cpp
index 7e3448f4..0c3a3f1e 100755
--- a/src/SSVOpenHexagon/Core/main.cpp
+++ b/src/SSVOpenHexagon/Core/main.cpp
@@ -4,6 +4,9 @@
#include <vector>
#include <string>
+#include <cstring>
+#include <cstdlib>
+#include <iostream>
#include <SSVUtils/SSVUtils.h>
#include <SSVStart/SSVStart.h>
#include "SSVOpenHexagon/Online/Online.h"
@@ -18,12 +21,24 @@ using namespace ssvu;
using namespace ssvu::FileSystem;
using namespace hg;
+static
+const char* getProfileFolder() {
+ char* path = new char[256];
+ strcpy(path, std::getenv("HOME"));
+ strcat(path, "/.config/OpenHexagon/Profiles/");
+ return path;
+}
+
void createProfilesFolder()
{
- if(exists("Profiles/")) return;
+ const char* profileFolder = getProfileFolder();
+ std::cout << "Profile folder: " << profileFolder << std::endl;
+ if(exists(profileFolder)) return;
log("Profiles folder does not exist, creating", "CreateProfilesFolder");
- createFolder("Profiles/");
+ char command[512];
+ sprintf(command, "mkdir -p \"%s\"", profileFolder);
+ system(command);
}
int main(int argc, char* argv[])
diff --git a/src/SSVOpenHexagon/Global/Assets.cpp b/src/SSVOpenHexagon/Global/Assets.cpp
index e008024d..340c74fe 100755
--- a/src/SSVOpenHexagon/Global/Assets.cpp
+++ b/src/SSVOpenHexagon/Global/Assets.cpp
@@ -4,6 +4,8 @@
#include <iostream>
#include <fstream>
+#include <cstdlib>
+#include <cstring>
#include <map>
#include <SFML/Graphics.hpp>
#include <SSVJsonCpp/SSVJsonCpp.h>
@@ -24,9 +26,17 @@ using namespace ssvu;
using namespace ssvuj;
using namespace ssvu::FileSystem;
+static
+const char* getProfileFolder() {
+ char* path = new char[256];
+ strcpy(path, std::getenv("HOME"));
+ strcat(path, "/.config/OpenHexagon/Profiles/");
+ return path;
+}
+
namespace hg
{
- AssetManager assetManager;
+ AssetManager assetManager;
map<string, MusicData> musicDataMap;
map<string, StyleData> styleDataMap;
map<string, LevelData> levelDataMap;
@@ -130,9 +140,10 @@ namespace hg
}
void loadProfiles()
{
- for(auto filePath : getScan<Mode::Single, Type::File, Pick::ByExt>("Profiles/", ".json"))
+ const char* profileFolder = getProfileFolder();
+ for(auto filePath : getScan<Mode::Single, Type::File, Pick::ByExt>(profileFolder, ".json"))
{
- string fileName{getNameFromPath(filePath, "Profiles/", ".json")};
+ string fileName{getNameFromPath(filePath, profileFolder, ".json")};
ProfileData profileData{loadProfileFromJson(getRootFromFile(filePath))};
profileDataMap.insert(make_pair(profileData.getName(), profileData));
@@ -234,10 +245,10 @@ namespace hg
void setCurrentProfile(const string& mName) { currentProfilePtr = &profileDataMap.find(mName)->second; }
ProfileData& getCurrentProfile() { return *currentProfilePtr; }
- string getCurrentProfileFilePath() { return "Profiles/" + currentProfilePtr->getName() + ".json"; }
+ string getCurrentProfileFilePath() { return getProfileFolder() + currentProfilePtr->getName() + ".json"; }
void createProfile(const string& mName)
{
- ofstream o{"Profiles/" + mName + ".json"};
+ ofstream o{getProfileFolder() + mName + ".json"};
Json::Value root;
Json::StyledStreamWriter writer;

View file

@ -0,0 +1,17 @@
{ callPackage }:
callPackage ./openhexagon.nix rec {
ssvjsoncpp = callPackage ./ssvjsoncpp.nix {};
ssvutils = callPackage ./ssvutils.nix {};
ssvluawrapper = callPackage ./ssvluawrapper.nix {};
ssvmenusystem = callPackage ./ssvmenusystem.nix {};
ssvutilsjson = callPackage ./ssvutilsjson.nix {
inherit ssvutils ssvjsoncpp;
};
ssvstart = callPackage ./ssvstart.nix {
inherit ssvutils ssvjsoncpp ssvutilsjson;
};
ssventitysystem = callPackage ./ssventitysystem.nix {
inherit ssvutils;
};
}

View file

@ -0,0 +1,85 @@
{ stdenv, fetchgit, makeWrapper,
cmake,
lua5_1,
sfml,
sparsehash,
ssvjsoncpp,
ssvutils,
ssvluawrapper,
ssvmenusystem,
ssvutilsjson,
ssvstart,
ssventitysystem,
rsync,
}:
stdenv.mkDerivation rec {
pname = "OpenHexagon";
version = "1.92b";
src = fetchgit {
url = "https://github.com/SuperV1234/SSVOpenHexagon";
rev = "refs/tags/${version}";
deepClone = true;
sha256 = "0qg7zxjswplzxnp6pmimvyly68zk3pd8jbv6a1ywv8jrfrdfpah1";
};
binpkg = builtins.fetchTarball {
url = "https://vittorioromeo.info/Downloads/OpenHexagon/Linux/OpenHexagonV1.92.tar.gz";
sha256 = "08rv97kr4cix2zshmi9avs92x5cryhg9f18abhpqbrpcr0mrganh";
};
nativeBuildInputs = [
cmake
makeWrapper
];
buildInputs = [
lua5_1
sfml
sparsehash
ssvjsoncpp
ssvutils
ssvluawrapper
ssvmenusystem
ssvutilsjson
ssvstart
ssventitysystem
];
preConfigure = ''
rm -r ./extlibs/*
ln -s ${ssventitysystem}/share ./extlibs/${ssventitysystem.pname};
ln -s ${ssvjsoncpp}/share ./extlibs/${ssvjsoncpp.pname};
ln -s ${ssvmenusystem}/share ./extlibs/${ssvmenusystem.pname};
ln -s ${ssvstart}/share ./extlibs/${ssvstart.pname};
ln -s ${ssvutils}/share ./extlibs/${ssvutils.pname};
ln -s ${ssvutilsjson}/share ./extlibs/${ssvutilsjson.pname};
ln -s ${ssvluawrapper}/share ./extlibs/${ssvluawrapper.pname};
'';
patches = [
./SSVOpenHexagon-Profiles-in-home-dir.patch
];
cmakeFlags = [
"-DLUA_INCLUDE_DIR=${lua5_1}/include"
];
installPhase = ''
install -Dm755 SSVOpenHexagon $out/bin/openhexagon
mkdir -p $out/share/OpenHexagon
cp -r ${src}/_RELEASE/{config.json,ConfigOverrides} $out/share/OpenHexagon
cp -r ${binpkg}/{Assets,Packs} $out/share/OpenHexagon
'';
postFixup = ''
wrapProgram "$out/bin/openhexagon" --run "cd $out/share/OpenHexagon/"
'';
meta = with stdenv.lib; {
description = "C++14 FOSS clone of Super Hexagon";
homepage = "https://openhexagon.org/";
license = licenses.afl3;
};
}

View file

@ -0,0 +1,36 @@
{ stdenv, fetchFromGitHub, cmake, ssvutils, sparsehash }:
stdenv.mkDerivation rec {
pname = "SSVEntitySystem";
version = "2013.06.14";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "ebb1b5121910304f84a8270f1941bf0a68d5d5d3";
sha256 = "0ni424m31pys8gjvkhspdq437s4hvmhd4bh9qa6y7ql60wwjhyi5";
};
nativeBuildInputs = [
cmake
];
cmakeFlags = [
"-DSSVUTILS_INCLUDE_DIR=${ssvutils}/include"
];
preConfigure = ''
rm -r ./extlibs/*
ln -s ${ssvutils}/share ./extlibs/SSVUtils;
'';
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/FindSSVEntitySystem.cmake $out/share/cmake/modules
'';
buildInputs = [
ssvutils
sparsehash
];
}

View file

@ -0,0 +1,26 @@
{ stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
pname = "SSVJsonCpp";
version = "2013.06.14";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "cdae6add9a7181d29d44375909336079c549824e";
sha256 = "0csysjddp2ifi535n8h5gd8agf2jsvqkjkvvad7ihbp7hkq4ihsg";
};
patches = [
./SSVJsonCpp-install-include-not-src.patch
];
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/FindSSVJsonCpp.cmake $out/share/cmake/modules
'';
nativeBuildInputs = [
cmake
];
}

View file

@ -0,0 +1,33 @@
{ stdenv, fetchFromGitHub, cmake, lua5_1 }:
stdenv.mkDerivation rec {
pname = "SSVLuaWrapper";
version = "2013.06.14";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "decb0ee9971b0fd340386b7c95697e3eb3039ee5";
sha256 = "1444x0vks3rhmgsrkd0avxss8rv0izm2b5wq03nw5p3fipw03sdx";
};
nativeBuildInputs = [
cmake
];
patches = [
./SSVLuaWrapper-patch-include-paths.patch
];
cmakeFlags = [
"-DLUA_INCLUDE_DIR=${lua5_1}/include"
];
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/Find${pname}.cmake $out/share/cmake/modules
'';
buildInputs = [ lua5_1 ];
}

View file

@ -0,0 +1,22 @@
{ stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
pname = "SSVMenuSystem";
version = "2013.06.11";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "5a49ad194ccda672ffd77ee23c4ee16969da1b85";
sha256 = "1g2c6w44jmf0vlxc4592phw5a9z40xzrsg64x3wljqa9mxq40qdp";
};
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/Find${pname}.cmake $out/share/cmake/modules
'';
nativeBuildInputs = [
cmake
];
}

View file

@ -0,0 +1,46 @@
{ stdenv, fetchFromGitHub,
cmake,
ssvutils,
ssvjsoncpp,
ssvutilsjson,
sfml }:
stdenv.mkDerivation rec {
pname = "SSVStart";
version = "2013.06.14";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "40dcafc7ce35b05b3e72901201a92bfbc907a2f7";
sha256 = "00g8hqsa5lh0hdj7949fpi41rcy7bsnximknj59r3w338msvqkqg";
};
nativeBuildInputs = [
cmake
];
cmakeFlags = [
"-DSSVJSONCPP_INCLUDE_DIR=${ssvjsoncpp}/include"
"-DSSVUTILS_INCLUDE_DIR=${ssvutils}/include"
];
preConfigure = ''
rm -r ./extlibs/*
ln -s ${ssvjsoncpp}/share ./extlibs/SSVJsonCpp;
ln -s ${ssvutils}/share ./extlibs/SSVUtils;
ln -s ${ssvutilsjson}/share ./extlibs/SSVUtilsJson;
'';
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/Find${pname}.cmake $out/share/cmake/modules
'';
buildInputs = [
ssvjsoncpp
ssvutils
ssvutilsjson
sfml
];
}

View file

@ -0,0 +1,22 @@
{ stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
pname = "SSVUtils";
version = "2013.06.14";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "20b2f63488e8fea717db2e5e8e5a919d617ae32a";
sha256 = "1ai916x0g8d8x2q8hwgsb2r97h8xg3ym70g6xdwil8334wammcdv";
};
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/FindSSVUtils.cmake $out/share/cmake/modules
'';
nativeBuildInputs = [
cmake
];
}

View file

@ -0,0 +1,38 @@
{ stdenv, fetchFromGitHub, cmake, ssvutils, ssvjsoncpp }:
stdenv.mkDerivation rec {
pname = "SSVUtilsJson";
version = "2013.06.14";
src = fetchFromGitHub {
owner = "SuperV1234";
repo = pname;
rev = "57c7c45eb4e2cf8b114a153d690fb111ea520ceb";
sha256 = "10zn0alxk6g1zmm39l9mv8whamlljm1b6dckhlbwzl112falabgd";
};
nativeBuildInputs = [
cmake
];
cmakeFlags = [
"-DSSVJSONCPP_INCLUDE_DIR=${ssvjsoncpp}/include"
"-DSSVUTILS_INCLUDE_DIR=${ssvutils}/include"
];
preConfigure = ''
rm -r ./extlibs/*
ln -s ${ssvjsoncpp}/share ./extlibs/SSVJsonCpp;
ln -s ${ssvutils}/share ./extlibs/SSVUtils;
'';
postInstall = ''
mkdir -p $out/share/cmake/modules
cp ${src}/cmake/modules/FindSSVUtilsJson.cmake $out/share/cmake/modules
'';
buildInputs = [
ssvjsoncpp
ssvutils
];
}