-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
859 additions
and
6,091 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,15 @@ | ||
{ | ||
"geode": "4.0.0-beta.1", | ||
"geode": "4.0.1", | ||
"gd": { | ||
"win": "2.2074" | ||
"win": "2.2074", | ||
"android": "2.2074", | ||
"mac": "2.2074", | ||
"ios": "2.2074" | ||
}, | ||
"id": "tobyadd.gdh", | ||
"name": "GDH", | ||
"version": "v4.9.0-beta.1", | ||
"version": "v5.0.0", | ||
"developer": "TobyAdd", | ||
"description": "GDH is an open-source Geometry Dash mod menu that aims to improve the game's performance and add new features", | ||
"early-load": true, | ||
"links": { | ||
"homepage": "https://tobyadd.github.io/GDH", | ||
"source": "https://github.com/TobyAdd/GDH", | ||
"community": "https://discord.gg/ahYEz4MAwP" | ||
}, | ||
"issues": { | ||
"info": "Report bugs on GitHub issues page", | ||
"url": "https://github.com/TobyAdd/GDH/issues" | ||
}, | ||
"tags": [ | ||
"universal", | ||
"interface", | ||
"utility", | ||
"offline", | ||
"enhancement", | ||
"cheat" | ||
], | ||
"resources": { | ||
"sprites": [ | ||
"res/screenshot.png" | ||
] | ||
} | ||
"description": "", | ||
"early-load": true | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#pragma once | ||
#include <map> | ||
#include <string> | ||
#include <matjson.hpp> | ||
#include <fstream> | ||
#include <filesystem> | ||
|
||
static const auto folderPath = geode::Mod::get()->getSaveDir(); | ||
static const auto folderMacroPath = folderPath / "Macros"; | ||
extern std::filesystem::path folderShowcasesPath; | ||
static const auto fileDataPath = folderPath / "config2.json"; | ||
|
||
class Config { | ||
public: | ||
static Config& get() { | ||
static Config instance; | ||
return instance; | ||
} | ||
|
||
Config(const Config&) = delete; | ||
Config& operator=(const Config&) = delete; | ||
|
||
void load(const std::filesystem::path& filepath) { | ||
std::ifstream inFile(filepath); | ||
if (inFile.is_open()) { | ||
std::string file_contents((std::istreambuf_iterator<char>(inFile)), std::istreambuf_iterator<char>()); | ||
|
||
auto result = matjson::parse(file_contents); | ||
if (!result.isErr()) { | ||
jsonData = result.unwrap(); | ||
} | ||
|
||
inFile.close(); | ||
} | ||
} | ||
|
||
void save(const std::filesystem::path& filepath) const { | ||
std::ofstream outFile(filepath); | ||
if (outFile.is_open()) { | ||
outFile << jsonData.dump(4); | ||
outFile.close(); | ||
} | ||
} | ||
|
||
template<typename T> | ||
T get(const std::string& key, const T& defaultValue) const { | ||
if (jsonData.contains(key)) { | ||
return jsonData[key].as<T>().unwrap(); | ||
} | ||
return defaultValue; | ||
} | ||
|
||
template<typename T> | ||
void set(const std::string& key, const T& value) { | ||
jsonData[key] = value; | ||
} | ||
|
||
private: | ||
Config() = default; | ||
matjson::Value jsonData; | ||
}; |
Oops, something went wrong.
1e9ed0f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v5????????