mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-15 22:44:42 -04:00
remove all deprecated functions
This commit is contained in:
parent
eda87da1a2
commit
17a5ac93ea
25 changed files with 8 additions and 812 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.2.1
|
||||
2.0.0
|
||||
|
|
|
@ -31,10 +31,4 @@ namespace geode {
|
|||
using namespace ::cocos2d;
|
||||
using namespace ::cocos2d::extension;
|
||||
}
|
||||
|
||||
namespace [[deprecated("Use `using namespace geode::prelude` instead!")]] old_prelude {
|
||||
using namespace ::geode::prelude;
|
||||
}
|
||||
}
|
||||
|
||||
#define USE_GEODE_NAMESPACE() using namespace geode::old_prelude;
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "ModInfo.hpp"
|
||||
#include "ModMetadata.hpp"
|
||||
#include "Event.hpp"
|
||||
#include "../utils/Result.hpp"
|
||||
|
@ -108,7 +107,6 @@ namespace geode {
|
|||
|
||||
public:
|
||||
ghc::filesystem::path getPath() const;
|
||||
[[deprecated("use getMetadata instead")]] ModInfo getModInfo() const;
|
||||
ModMetadata getMetadata() const;
|
||||
std::string getDownloadURL() const;
|
||||
std::string getPackageHash() const;
|
||||
|
@ -212,13 +210,6 @@ namespace geode {
|
|||
IndexItemHandle getMajorItem(
|
||||
std::string const& id
|
||||
) const;
|
||||
/**
|
||||
* Get an item from the index by its mod.json
|
||||
* @param info The mod's info
|
||||
* @returns The item, or nullptr if the item was not found
|
||||
* @deprecated Use the ModMetadata overload instead
|
||||
*/
|
||||
[[deprecated]] IndexItemHandle getItem(ModInfo const& info) const;
|
||||
/**
|
||||
* Get an item from the index by its mod.json
|
||||
* @param info The mod's metadata
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "../utils/MiniFunction.hpp"
|
||||
#include "Log.hpp"
|
||||
#include "ModEvent.hpp"
|
||||
#include "ModInfo.hpp"
|
||||
#include "ModMetadata.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
|
@ -54,11 +53,6 @@ namespace geode {
|
|||
void updateModResources(Mod* mod);
|
||||
void addSearchPaths();
|
||||
|
||||
void dispatchScheduledFunctions(Mod* mod);
|
||||
friend void GEODE_CALL ::geode_implicit_load(Mod*);
|
||||
|
||||
[[deprecated]] Result<Mod*> loadModFromInfo(ModInfo const& info);
|
||||
|
||||
Mod* takeNextMod();
|
||||
|
||||
public:
|
||||
|
@ -84,24 +78,17 @@ namespace geode {
|
|||
VersionInfo maxModVersion();
|
||||
bool isModVersionSupported(VersionInfo const& version);
|
||||
|
||||
[[deprecated]] Result<Mod*> loadModFromFile(ghc::filesystem::path const& file);
|
||||
[[deprecated]] void loadModsFromDirectory(ghc::filesystem::path const& dir, bool recursive = true);
|
||||
[[deprecated]] void refreshModsList();
|
||||
LoadingState getLoadingState();
|
||||
bool isModInstalled(std::string const& id) const;
|
||||
Mod* getInstalledMod(std::string const& id) const;
|
||||
bool isModLoaded(std::string const& id) const;
|
||||
Mod* getLoadedMod(std::string const& id) const;
|
||||
std::vector<Mod*> getAllMods();
|
||||
[[deprecated("use Mod::get instead")]] Mod* getModImpl();
|
||||
[[deprecated]] void updateAllDependencies();
|
||||
[[deprecated("use getProblems instead")]] std::vector<InvalidGeodeFile> getFailedMods() const;
|
||||
std::vector<LoadProblem> getProblems() const;
|
||||
|
||||
void updateResources();
|
||||
void updateResources(bool forceReload);
|
||||
|
||||
[[deprecated("use queueInMainThread instead")]] void queueInGDThread(ScheduledFunction func);
|
||||
void queueInMainThread(ScheduledFunction func);
|
||||
void waitForModsToBeLoaded();
|
||||
|
||||
|
|
|
@ -161,10 +161,7 @@ namespace geode {
|
|||
Mod* getSender() const;
|
||||
Severity getSeverity() const;
|
||||
|
||||
[[deprecated("Will be removed in next version")]]
|
||||
void addFormat(std::string_view formatStr, std::span<ComponentTrait*> comps);
|
||||
|
||||
Result<> addFormatNew(std::string_view formatStr, std::span<ComponentTrait*> comps);
|
||||
Result<> addFormat(std::string_view formatStr, std::span<ComponentTrait*> comps);
|
||||
};
|
||||
|
||||
class GEODE_DLL Logger {
|
||||
|
@ -198,7 +195,7 @@ namespace geode {
|
|||
Log l(m, sev);
|
||||
|
||||
std::array<ComponentTrait*, sizeof...(Args)> comps = { static_cast<ComponentTrait*>(new ComponentBase(args))... };
|
||||
auto res = l.addFormatNew(formatStr, comps);
|
||||
auto res = l.addFormat(formatStr, comps);
|
||||
|
||||
if (res.isErr()) {
|
||||
internalLog(Severity::Warning, getMod(), "Error parsing log format \"{}\": {}", formatStr, res.unwrapErr());
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "../utils/VersionInfo.hpp"
|
||||
#include "../utils/general.hpp"
|
||||
#include "Hook.hpp"
|
||||
#include "ModInfo.hpp"
|
||||
#include "ModMetadata.hpp"
|
||||
#include "Setting.hpp"
|
||||
#include "Types.hpp"
|
||||
|
@ -66,7 +65,6 @@ namespace geode {
|
|||
|
||||
// Protected constructor/destructor
|
||||
Mod() = delete;
|
||||
[[deprecated]] Mod(ModInfo const& info);
|
||||
Mod(ModMetadata const& metadata);
|
||||
~Mod();
|
||||
|
||||
|
@ -83,10 +81,7 @@ namespace geode {
|
|||
bool canDisable() const;
|
||||
bool canEnable() const;
|
||||
bool needsEarlyLoad() const;
|
||||
[[deprecated]] bool supportsUnloading() const;
|
||||
[[deprecated("use wasSuccessfullyLoaded instead")]] bool wasSuccesfullyLoaded() const;
|
||||
bool wasSuccessfullyLoaded() const;
|
||||
[[deprecated("use getMetadata instead")]] ModInfo getModInfo() const;
|
||||
ModMetadata getMetadata() const;
|
||||
ghc::filesystem::path getTempDir() const;
|
||||
/**
|
||||
|
@ -299,22 +294,6 @@ namespace geode {
|
|||
*/
|
||||
Result<> unpatch(Patch* patch);
|
||||
|
||||
/**
|
||||
* Load & enable this mod
|
||||
* @returns Successful result on success,
|
||||
* errorful result with info on error
|
||||
*/
|
||||
[[deprecated]] Result<> loadBinary();
|
||||
|
||||
/**
|
||||
* Disable & unload this mod
|
||||
* @warning May crash if the mod doesn't
|
||||
* properly handle unloading!
|
||||
* @returns Successful result on success,
|
||||
* errorful result with info on error
|
||||
*/
|
||||
[[deprecated]] Result<> unloadBinary();
|
||||
|
||||
/**
|
||||
* Enable this mod
|
||||
* @returns Successful result on success,
|
||||
|
@ -343,16 +322,6 @@ namespace geode {
|
|||
*/
|
||||
bool depends(std::string const& id) const;
|
||||
|
||||
/**
|
||||
* Update the state of each of the
|
||||
* dependencies. Depending on if the
|
||||
* mod has unresolved dependencies,
|
||||
* it will either be loaded or unloaded
|
||||
* @returns Error.
|
||||
* @deprecated No longer needed.
|
||||
*/
|
||||
[[deprecated("no longer needed")]] Result<> updateDependencies();
|
||||
|
||||
/**
|
||||
* Check whether all the required
|
||||
* dependencies for this mod have
|
||||
|
@ -368,14 +337,6 @@ namespace geode {
|
|||
* incompatibilities, false if not.
|
||||
*/
|
||||
bool hasUnresolvedIncompatibilities() const;
|
||||
/**
|
||||
* Get a list of all the unresolved
|
||||
* dependencies this mod has
|
||||
* @returns List of all the unresolved
|
||||
* dependencies
|
||||
* @deprecated Use Loader::getProblems instead.
|
||||
*/
|
||||
[[deprecated("use Loader::getProblems instead")]] std::vector<Dependency> getUnresolvedDependencies();
|
||||
|
||||
char const* expandSpriteName(char const* name);
|
||||
|
||||
|
|
|
@ -1,229 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "../utils/Result.hpp"
|
||||
#include "../utils/VersionInfo.hpp"
|
||||
#include "Setting.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
#include <json.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace geode {
|
||||
namespace utils::file {
|
||||
class Unzip;
|
||||
}
|
||||
|
||||
class ModMetadata;
|
||||
|
||||
struct GEODE_DLL [[deprecated("use ModMetadata::Dependency instead")]] Dependency {
|
||||
std::string id;
|
||||
ComparableVersionInfo version;
|
||||
bool required = false;
|
||||
Mod* mod = nullptr;
|
||||
bool isResolved() const;
|
||||
};
|
||||
|
||||
struct [[deprecated("use ModMetadata::IssuesInfo instead")]] IssuesInfo {
|
||||
std::string info;
|
||||
std::optional<std::string> url;
|
||||
};
|
||||
|
||||
class ModInfoImpl;
|
||||
|
||||
/**
|
||||
* Represents all the data gather-able
|
||||
* from mod.json
|
||||
*/
|
||||
class GEODE_DLL [[deprecated("use ModMetadata instead")]] ModInfo {
|
||||
class Impl;
|
||||
#pragma warning(suppress : 4996)
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
|
||||
public:
|
||||
ModInfo();
|
||||
ModInfo(ModInfo const& other);
|
||||
ModInfo(ModInfo&& other) noexcept;
|
||||
ModInfo& operator=(ModInfo const& other);
|
||||
ModInfo& operator=(ModInfo&& other) noexcept;
|
||||
~ModInfo();
|
||||
|
||||
/**
|
||||
* Path to the mod file
|
||||
*/
|
||||
ghc::filesystem::path& path();
|
||||
ghc::filesystem::path const& path() const;
|
||||
/**
|
||||
* Name of the platform binary within
|
||||
* the mod zip
|
||||
*/
|
||||
std::string& binaryName();
|
||||
std::string const& binaryName() const;
|
||||
/**
|
||||
* Mod Version. Should follow semver.
|
||||
*/
|
||||
VersionInfo& version();
|
||||
VersionInfo const& version() const;
|
||||
/**
|
||||
* Human-readable ID of the Mod.
|
||||
* Recommended to be in the format
|
||||
* "developer.mod". Not
|
||||
* guaranteed to be either case-
|
||||
* nor space-sensitive. Should
|
||||
* be restricted to the ASCII
|
||||
* character set.
|
||||
*/
|
||||
std::string& id();
|
||||
std::string const& id() const;
|
||||
/**
|
||||
* Name of the mod. May contain
|
||||
* spaces & punctuation, but should
|
||||
* be restricted to the ASCII
|
||||
* character set.
|
||||
*/
|
||||
std::string& name();
|
||||
std::string const& name() const;
|
||||
/**
|
||||
* The name of the head developer.
|
||||
* Should be a single name, like
|
||||
* "HJfod" or "Geode Team".
|
||||
* If the mod has multiple
|
||||
* developers, this field should
|
||||
* be one of their name or a team
|
||||
* name, and the rest of the credits
|
||||
* should be named in `m_credits`
|
||||
* instead.
|
||||
*/
|
||||
std::string& developer();
|
||||
std::string const& developer() const;
|
||||
/**
|
||||
* Short & concise description of the
|
||||
* mod.
|
||||
*/
|
||||
std::optional<std::string>& description();
|
||||
std::optional<std::string> const& description() const;
|
||||
/**
|
||||
* Detailed description of the mod, writtenin Markdown (see
|
||||
* <Geode/ui/MDTextArea.hpp>) for more info
|
||||
*/
|
||||
std::optional<std::string>& details();
|
||||
std::optional<std::string> const& details() const;
|
||||
/**
|
||||
* Changelog for the mod, written in Markdown (see
|
||||
* <Geode/ui/MDTextArea.hpp>) for more info
|
||||
*/
|
||||
std::optional<std::string>& changelog();
|
||||
std::optional<std::string> const& changelog() const;
|
||||
/**
|
||||
* Support info for the mod; this means anything to show ways to
|
||||
* support the mod's development, like donations. Written in Markdown
|
||||
* (see MDTextArea for more info)
|
||||
*/
|
||||
std::optional<std::string>& supportInfo();
|
||||
std::optional<std::string> const& supportInfo() const;
|
||||
/**
|
||||
* Git Repository of the mod
|
||||
*/
|
||||
std::optional<std::string>& repository();
|
||||
std::optional<std::string> const& repository() const;
|
||||
/**
|
||||
* Info about where users should report issues and request help
|
||||
*/
|
||||
std::optional<IssuesInfo>& issues();
|
||||
std::optional<IssuesInfo> const& issues() const;
|
||||
/**
|
||||
* Dependencies
|
||||
*/
|
||||
std::vector<Dependency>& dependencies();
|
||||
std::vector<Dependency> const& dependencies() const;
|
||||
/**
|
||||
* Mod spritesheet names
|
||||
*/
|
||||
std::vector<std::string>& spritesheets();
|
||||
std::vector<std::string> const& spritesheets() const;
|
||||
/**
|
||||
* Mod settings
|
||||
* @note Not a map because insertion order must be preserved
|
||||
*/
|
||||
std::vector<std::pair<std::string, Setting>>& settings();
|
||||
std::vector<std::pair<std::string, Setting>> const& settings() const;
|
||||
/**
|
||||
* Whether the mod can be disabled or not
|
||||
*/
|
||||
bool& supportsDisabling();
|
||||
bool const& supportsDisabling() const;
|
||||
/**
|
||||
* Whether the mod can be unloaded or not
|
||||
*/
|
||||
bool& supportsUnloading();
|
||||
bool const& supportsUnloading() const;
|
||||
/**
|
||||
* Whether this mod has to be loaded before the loading screen or not
|
||||
*/
|
||||
bool& needsEarlyLoad();
|
||||
bool const& needsEarlyLoad() const;
|
||||
/**
|
||||
* Whether this mod is an API or not
|
||||
*/
|
||||
bool& isAPI();
|
||||
bool const& isAPI() const;
|
||||
/**
|
||||
* Create ModInfo from an unzipped .geode package
|
||||
*/
|
||||
static Result<ModInfo> createFromGeodeZip(utils::file::Unzip& zip);
|
||||
/**
|
||||
* Create ModInfo from a .geode package
|
||||
*/
|
||||
static Result<ModInfo> createFromGeodeFile(ghc::filesystem::path const& path);
|
||||
/**
|
||||
* Create ModInfo from a mod.json file
|
||||
*/
|
||||
static Result<ModInfo> createFromFile(ghc::filesystem::path const& path);
|
||||
/**
|
||||
* Create ModInfo from a parsed json document
|
||||
*/
|
||||
static Result<ModInfo> create(ModJson const& json);
|
||||
|
||||
/**
|
||||
* Convert to JSON. Essentially same as getRawJSON except dynamically
|
||||
* adds runtime fields like path
|
||||
*/
|
||||
ModJson toJSON() const;
|
||||
/**
|
||||
* Get the raw JSON file
|
||||
*/
|
||||
ModJson getRawJSON() const;
|
||||
|
||||
bool operator==(ModInfo const& other) const;
|
||||
|
||||
static bool validateID(std::string const& id);
|
||||
|
||||
operator ModMetadata();
|
||||
operator ModMetadata() const;
|
||||
|
||||
private:
|
||||
ModJson& rawJSON();
|
||||
ModJson const& rawJSON() const;
|
||||
/**
|
||||
* Version is passed for backwards
|
||||
* compatibility if we update the mod.json
|
||||
* format
|
||||
*/
|
||||
static Result<ModInfo> createFromSchemaV010(ModJson const& json);
|
||||
|
||||
Result<> addSpecialFiles(ghc::filesystem::path const& dir);
|
||||
Result<> addSpecialFiles(utils::file::Unzip& zip);
|
||||
|
||||
std::vector<std::pair<std::string, std::optional<std::string>*>> getSpecialFiles();
|
||||
|
||||
friend class ModInfoImpl;
|
||||
|
||||
friend class ModMetadata;
|
||||
};
|
||||
}
|
||||
|
||||
template <>
|
||||
struct [[deprecated]] json::Serialize<geode::ModInfo> {
|
||||
static json::Value to_json(geode::ModInfo const& info) {
|
||||
return info.toJSON();
|
||||
}
|
||||
};
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "../utils/Result.hpp"
|
||||
#include "../utils/VersionInfo.hpp"
|
||||
#include "ModInfo.hpp"
|
||||
#include "Setting.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
|
@ -14,9 +13,6 @@ namespace geode {
|
|||
class Unzip;
|
||||
}
|
||||
|
||||
struct GEODE_DLL [[deprecated("use ModMetadata::Dependency instead")]] Dependency;
|
||||
struct [[deprecated("use ModMetadata::IssuesInfo instead")]] IssuesInfo;
|
||||
|
||||
class ModMetadataImpl;
|
||||
|
||||
/**
|
||||
|
@ -43,11 +39,6 @@ namespace geode {
|
|||
Importance importance = Importance::Required;
|
||||
Mod* mod = nullptr;
|
||||
[[nodiscard]] bool isResolved() const;
|
||||
|
||||
[[deprecated]] operator geode::Dependency();
|
||||
[[deprecated]] operator geode::Dependency() const;
|
||||
|
||||
[[deprecated]] static Dependency fromDeprecated(geode::Dependency const& value);
|
||||
};
|
||||
|
||||
struct GEODE_DLL Incompatibility {
|
||||
|
@ -65,11 +56,6 @@ namespace geode {
|
|||
struct IssuesInfo {
|
||||
std::string info;
|
||||
std::optional<std::string> url;
|
||||
|
||||
[[deprecated]] operator geode::IssuesInfo();
|
||||
[[deprecated]] operator geode::IssuesInfo() const;
|
||||
|
||||
[[deprecated]] static IssuesInfo fromDeprecated(geode::IssuesInfo const& value);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -221,9 +207,6 @@ namespace geode {
|
|||
|
||||
static bool validateID(std::string const& id);
|
||||
|
||||
[[deprecated]] operator ModInfo();
|
||||
[[deprecated]] operator ModInfo() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Version is passed for backwards
|
||||
|
|
|
@ -134,7 +134,6 @@ namespace geode {
|
|||
class Setting;
|
||||
class Loader;
|
||||
class Hook;
|
||||
struct ModInfo;
|
||||
class VersionInfo;
|
||||
|
||||
class Unknown;
|
||||
|
|
|
@ -49,8 +49,6 @@ namespace geode::modifier {
|
|||
}
|
||||
};
|
||||
|
||||
[[deprecated("Will be removed in 1.0.0")]]
|
||||
GEODE_DLL size_t getFieldIndexForClass(size_t hash);
|
||||
GEODE_DLL size_t getFieldIndexForClass(char const* name);
|
||||
|
||||
template <class Parent, class Base>
|
||||
|
|
|
@ -52,10 +52,6 @@ namespace geode::utils::file {
|
|||
|
||||
GEODE_DLL Result<> createDirectory(ghc::filesystem::path const& path);
|
||||
GEODE_DLL Result<> createDirectoryAll(ghc::filesystem::path const& path);
|
||||
[[deprecated("Use file::readDirectory")]]
|
||||
GEODE_DLL Result<std::vector<ghc::filesystem::path>> listFiles(
|
||||
ghc::filesystem::path const& path, bool recursive = false
|
||||
);
|
||||
GEODE_DLL Result<std::vector<ghc::filesystem::path>> readDirectory(
|
||||
ghc::filesystem::path const& path, bool recursive = false
|
||||
);
|
||||
|
|
|
@ -86,10 +86,6 @@ size_t modifier::getFieldIndexForClass(char const* name) {
|
|||
return s_nextIndex[name]++;
|
||||
}
|
||||
|
||||
size_t modifier::getFieldIndexForClass(size_t hash) {
|
||||
return s_nextIndex[std::to_string(hash)]++;
|
||||
}
|
||||
|
||||
// not const because might modify contents
|
||||
FieldContainer* CCNode::getFieldContainer() {
|
||||
return GeodeNodeMetadata::set(this)->getFieldContainer();
|
||||
|
|
|
@ -75,10 +75,6 @@ ghc::filesystem::path IndexItem::getPath() const {
|
|||
return m_impl->m_path;
|
||||
}
|
||||
|
||||
ModInfo IndexItem::getModInfo() const {
|
||||
return this->getMetadata();
|
||||
}
|
||||
|
||||
ModMetadata IndexItem::getMetadata() const {
|
||||
return m_impl->m_metadata;
|
||||
}
|
||||
|
@ -515,10 +511,6 @@ IndexItemHandle Index::getItem(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
IndexItemHandle Index::getItem(ModInfo const& info) const {
|
||||
return this->getItem(info.id(), info.version());
|
||||
}
|
||||
|
||||
IndexItemHandle Index::getItem(ModMetadata const& metadata) const {
|
||||
return this->getItem(metadata.getID(), metadata.getVersion());
|
||||
}
|
||||
|
|
|
@ -23,10 +23,6 @@ void Loader::addSearchPaths() {
|
|||
return m_impl->addSearchPaths();
|
||||
}
|
||||
|
||||
Result<Mod*> Loader::loadModFromInfo(ModInfo const& info) {
|
||||
return m_impl->loadModFromInfo(info);
|
||||
}
|
||||
|
||||
Result<> Loader::saveData() {
|
||||
return m_impl->saveData();
|
||||
}
|
||||
|
@ -51,18 +47,6 @@ bool Loader::isModVersionSupported(VersionInfo const& version) {
|
|||
return m_impl->isModVersionSupported(version);
|
||||
}
|
||||
|
||||
Result<Mod*> Loader::loadModFromFile(ghc::filesystem::path const& file) {
|
||||
return m_impl->loadModFromFile(file);
|
||||
}
|
||||
|
||||
void Loader::loadModsFromDirectory(ghc::filesystem::path const& dir, bool recursive) {
|
||||
return m_impl->loadModsFromDirectory(dir, recursive);
|
||||
}
|
||||
|
||||
void Loader::refreshModsList() {
|
||||
return m_impl->refreshModsList();
|
||||
}
|
||||
|
||||
Loader::LoadingState Loader::getLoadingState() {
|
||||
return m_impl->m_loadingState;
|
||||
}
|
||||
|
@ -87,18 +71,6 @@ std::vector<Mod*> Loader::getAllMods() {
|
|||
return m_impl->getAllMods();
|
||||
}
|
||||
|
||||
Mod* Loader::getModImpl() {
|
||||
return Mod::get();
|
||||
}
|
||||
|
||||
void Loader::updateAllDependencies() {
|
||||
return m_impl->updateAllDependencies();
|
||||
}
|
||||
|
||||
std::vector<InvalidGeodeFile> Loader::getFailedMods() const {
|
||||
return m_impl->getFailedMods();
|
||||
}
|
||||
|
||||
std::vector<LoadProblem> Loader::getProblems() const {
|
||||
return m_impl->getProblems();
|
||||
}
|
||||
|
@ -111,10 +83,6 @@ void Loader::updateResources(bool forceReload) {
|
|||
return m_impl->updateResources(forceReload);
|
||||
}
|
||||
|
||||
void Loader::queueInGDThread(ScheduledFunction func) {
|
||||
return m_impl->queueInMainThread(func);
|
||||
}
|
||||
|
||||
void Loader::queueInMainThread(ScheduledFunction func) {
|
||||
return m_impl->queueInMainThread(func);
|
||||
}
|
||||
|
|
|
@ -121,21 +121,6 @@ std::vector<Mod*> Loader::Impl::getAllMods() {
|
|||
return map::values(m_mods);
|
||||
}
|
||||
|
||||
std::vector<InvalidGeodeFile> Loader::Impl::getFailedMods() const {
|
||||
std::vector<InvalidGeodeFile> inv;
|
||||
for (auto const& item : this->getProblems()) {
|
||||
if (item.type != LoadProblem::Type::InvalidFile)
|
||||
continue;
|
||||
if (!holds_alternative<ghc::filesystem::path>(item.cause))
|
||||
continue;
|
||||
inv.push_back({
|
||||
std::get<ghc::filesystem::path>(item.cause),
|
||||
item.message
|
||||
});
|
||||
}
|
||||
return inv;
|
||||
}
|
||||
|
||||
// Version info
|
||||
|
||||
VersionInfo Loader::Impl::getVersion() {
|
||||
|
@ -246,26 +231,6 @@ void Loader::Impl::updateModResources(Mod* mod) {
|
|||
|
||||
// Dependencies and refreshing
|
||||
|
||||
Result<Mod*> Loader::Impl::loadModFromInfo(ModInfo const& info) {
|
||||
return Err("Loader::loadModFromInfo is deprecated");
|
||||
}
|
||||
|
||||
Result<Mod*> Loader::Impl::loadModFromFile(ghc::filesystem::path const& file) {
|
||||
return Err("Loader::loadModFromFile is deprecated");
|
||||
}
|
||||
|
||||
void Loader::Impl::loadModsFromDirectory(ghc::filesystem::path const& dir, bool recursive) {
|
||||
log::error("Called deprecated stub: Loader::loadModsFromDirectory");
|
||||
}
|
||||
|
||||
void Loader::Impl::refreshModsList() {
|
||||
log::error("Called deprecated stub: Loader::refreshModsList");
|
||||
}
|
||||
|
||||
void Loader::Impl::updateAllDependencies() {
|
||||
log::error("Called deprecated stub: Loader::updateAllDependencies");
|
||||
}
|
||||
|
||||
void Loader::Impl::queueMods(std::vector<ModMetadata>& modQueue) {
|
||||
for (auto const& dir : m_modSearchDirectories) {
|
||||
log::debug("Searching {}", dir);
|
||||
|
|
|
@ -113,10 +113,6 @@ namespace geode {
|
|||
void updateModResources(Mod* mod);
|
||||
void addSearchPaths();
|
||||
|
||||
friend void GEODE_CALL ::geode_implicit_load(Mod*);
|
||||
|
||||
[[deprecated]] Result<Mod*> loadModFromInfo(ModInfo const& info);
|
||||
|
||||
Result<> setup();
|
||||
void forceReset();
|
||||
|
||||
|
@ -128,9 +124,6 @@ namespace geode {
|
|||
VersionInfo maxModVersion();
|
||||
bool isModVersionSupported(VersionInfo const& version);
|
||||
|
||||
[[deprecated]] Result<Mod*> loadModFromFile(ghc::filesystem::path const& file);
|
||||
[[deprecated]] void loadModsFromDirectory(ghc::filesystem::path const& dir, bool recursive = true);
|
||||
[[deprecated]] void refreshModsList();
|
||||
void queueMods(std::vector<ModMetadata>& modQueue);
|
||||
void populateModList(std::vector<ModMetadata>& modQueue);
|
||||
void buildModGraph();
|
||||
|
@ -144,9 +137,6 @@ namespace geode {
|
|||
bool isModLoaded(std::string const& id) const;
|
||||
Mod* getLoadedMod(std::string const& id) const;
|
||||
std::vector<Mod*> getAllMods();
|
||||
[[deprecated]] Mod* getModImpl();
|
||||
[[deprecated]] void updateAllDependencies();
|
||||
[[deprecated]] std::vector<InvalidGeodeFile> getFailedMods() const;
|
||||
std::vector<LoadProblem> getProblems() const;
|
||||
|
||||
void updateResources();
|
||||
|
|
|
@ -142,14 +142,7 @@ Severity Log::getSeverity() const {
|
|||
return m_severity;
|
||||
}
|
||||
|
||||
void Log::addFormat(std::string_view formatStr, std::span<ComponentTrait*> components) {
|
||||
auto res = this->addFormatNew(formatStr, components);
|
||||
if (res.isErr()) {
|
||||
throw std::runtime_error(res.unwrapErr());
|
||||
}
|
||||
}
|
||||
|
||||
Result<> Log::addFormatNew(std::string_view formatStr, std::span<ComponentTrait*> components) {
|
||||
Result<> Log::addFormat(std::string_view formatStr, std::span<ComponentTrait*> components) {
|
||||
size_t compIndex = 0;
|
||||
std::string current;
|
||||
for (size_t i = 0; i < formatStr.size(); ++i) {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
#pragma warning(suppress : 4996)
|
||||
Mod::Mod(ModInfo const& info) : m_impl(std::make_unique<Impl>(this, info)) {}
|
||||
Mod::Mod(ModMetadata const& metadata) : m_impl(std::make_unique<Impl>(this, metadata)) {}
|
||||
|
||||
Mod::~Mod() {}
|
||||
|
@ -66,21 +64,10 @@ bool Mod::needsEarlyLoad() const {
|
|||
return m_impl->needsEarlyLoad();
|
||||
}
|
||||
|
||||
bool Mod::supportsUnloading() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Mod::wasSuccesfullyLoaded() const {
|
||||
return this->wasSuccessfullyLoaded();
|
||||
}
|
||||
bool Mod::wasSuccessfullyLoaded() const {
|
||||
return m_impl->wasSuccessfullyLoaded();
|
||||
}
|
||||
|
||||
ModInfo Mod::getModInfo() const {
|
||||
return this->getMetadata();
|
||||
}
|
||||
|
||||
ModMetadata Mod::getMetadata() const {
|
||||
return m_impl->getMetadata();
|
||||
}
|
||||
|
@ -174,14 +161,6 @@ Result<> Mod::unpatch(Patch* patch) {
|
|||
return m_impl->unpatch(patch);
|
||||
}
|
||||
|
||||
Result<> Mod::loadBinary() {
|
||||
return Err("Load mod binaries after startup is not supported");
|
||||
}
|
||||
|
||||
Result<> Mod::unloadBinary() {
|
||||
return Err("Unloading mod binaries is not supported");
|
||||
}
|
||||
|
||||
Result<> Mod::enable() {
|
||||
return m_impl->enable();
|
||||
}
|
||||
|
@ -202,10 +181,6 @@ bool Mod::depends(std::string const& id) const {
|
|||
return m_impl->depends(id);
|
||||
}
|
||||
|
||||
Result<> Mod::updateDependencies() {
|
||||
return m_impl->updateDependencies();
|
||||
}
|
||||
|
||||
bool Mod::hasUnresolvedDependencies() const {
|
||||
return m_impl->hasUnresolvedDependencies();
|
||||
}
|
||||
|
@ -214,11 +189,6 @@ bool Mod::hasUnresolvedIncompatibilities() const {
|
|||
return m_impl->hasUnresolvedIncompatibilities();
|
||||
}
|
||||
|
||||
#pragma warning(suppress : 4996)
|
||||
std::vector<Dependency> Mod::getUnresolvedDependencies() {
|
||||
return m_impl->getUnresolvedDependencies();
|
||||
}
|
||||
|
||||
char const* Mod::expandSpriteName(char const* name) {
|
||||
return m_impl->expandSpriteName(name);
|
||||
}
|
||||
|
|
|
@ -493,20 +493,6 @@ bool Mod::Impl::hasUnresolvedIncompatibilities() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
// msvc stop fucking screaming please i BEG YOU
|
||||
#pragma warning(suppress : 4996)
|
||||
std::vector<Dependency> Mod::Impl::getUnresolvedDependencies() {
|
||||
#pragma warning(suppress : 4996)
|
||||
std::vector<Dependency> unresolved;
|
||||
for (auto const& dep : m_metadata.getDependencies()) {
|
||||
if (!dep.isResolved()) {
|
||||
#pragma warning(suppress : 4996)
|
||||
unresolved.push_back(dep);
|
||||
}
|
||||
}
|
||||
return unresolved;
|
||||
}
|
||||
|
||||
bool Mod::Impl::depends(std::string const& id) const {
|
||||
return utils::ranges::contains(m_metadata.getDependencies(), [id](ModMetadata::Dependency const& t) {
|
||||
return t.id == id;
|
||||
|
@ -535,7 +521,7 @@ Result<Hook*> Mod::Impl::addHook(Hook* hook) {
|
|||
auto res = this->enableHook(hook);
|
||||
if (!res) {
|
||||
delete hook;
|
||||
return Err("Can't create hook: "+ res.unwrapErr());
|
||||
return Err("Can't create hook: " + res.unwrapErr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,6 @@ namespace geode {
|
|||
Result<> updateDependencies();
|
||||
bool hasUnresolvedDependencies() const;
|
||||
bool hasUnresolvedIncompatibilities() const;
|
||||
[[deprecated]] std::vector<Dependency> getUnresolvedDependencies();
|
||||
|
||||
Result<> loadBinary();
|
||||
|
||||
|
|
|
@ -1,244 +0,0 @@
|
|||
#include <Geode/loader/Loader.hpp>
|
||||
#include <Geode/utils/VersionInfo.hpp>
|
||||
#include <Geode/utils/file.hpp>
|
||||
#include <json.hpp>
|
||||
|
||||
#include "ModInfoImpl.hpp"
|
||||
|
||||
#pragma warning(disable : 4996) // deprecation
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
ModInfo::Impl& ModInfoImpl::getImpl(ModInfo& info) {
|
||||
return *info.m_impl;
|
||||
}
|
||||
|
||||
bool Dependency::isResolved() const {
|
||||
return !this->required ||
|
||||
(this->mod && this->mod->isLoaded() && this->mod->isEnabled() &&
|
||||
this->version.compare(this->mod->getVersion()));
|
||||
}
|
||||
|
||||
bool ModInfo::Impl::operator==(ModInfo::Impl const& other) const {
|
||||
return this->m_metadata.m_id == other.m_metadata.m_id;
|
||||
}
|
||||
|
||||
ghc::filesystem::path& ModInfo::path() {
|
||||
return m_impl->m_metadata.m_path;
|
||||
}
|
||||
ghc::filesystem::path const& ModInfo::path() const {
|
||||
return m_impl->m_metadata.m_path;
|
||||
}
|
||||
|
||||
std::string& ModInfo::binaryName() {
|
||||
return m_impl->m_metadata.m_binaryName;
|
||||
}
|
||||
std::string const& ModInfo::binaryName() const {
|
||||
return m_impl->m_metadata.m_binaryName;
|
||||
}
|
||||
|
||||
VersionInfo& ModInfo::version() {
|
||||
return m_impl->m_metadata.m_version;
|
||||
}
|
||||
VersionInfo const& ModInfo::version() const {
|
||||
return m_impl->m_metadata.m_version;
|
||||
}
|
||||
|
||||
std::string& ModInfo::id() {
|
||||
return m_impl->m_metadata.m_id;
|
||||
}
|
||||
std::string const& ModInfo::id() const {
|
||||
return m_impl->m_metadata.m_id;
|
||||
}
|
||||
|
||||
std::string& ModInfo::name() {
|
||||
return m_impl->m_metadata.m_name;
|
||||
}
|
||||
std::string const& ModInfo::name() const {
|
||||
return m_impl->m_metadata.m_name;
|
||||
}
|
||||
|
||||
std::string& ModInfo::developer() {
|
||||
return m_impl->m_metadata.m_developer;
|
||||
}
|
||||
std::string const& ModInfo::developer() const {
|
||||
return m_impl->m_metadata.m_developer;
|
||||
}
|
||||
|
||||
std::optional<std::string>& ModInfo::description() {
|
||||
return m_impl->m_metadata.m_description;
|
||||
}
|
||||
std::optional<std::string> const& ModInfo::description() const {
|
||||
return m_impl->m_metadata.m_description;
|
||||
}
|
||||
|
||||
std::optional<std::string>& ModInfo::details() {
|
||||
return m_impl->m_metadata.m_details;
|
||||
}
|
||||
std::optional<std::string> const& ModInfo::details() const {
|
||||
return m_impl->m_metadata.m_details;
|
||||
}
|
||||
|
||||
std::optional<std::string>& ModInfo::changelog() {
|
||||
return m_impl->m_metadata.m_changelog;
|
||||
}
|
||||
std::optional<std::string> const& ModInfo::changelog() const {
|
||||
return m_impl->m_metadata.m_changelog;
|
||||
}
|
||||
|
||||
std::optional<std::string>& ModInfo::supportInfo() {
|
||||
return m_impl->m_metadata.m_supportInfo;
|
||||
}
|
||||
std::optional<std::string> const& ModInfo::supportInfo() const {
|
||||
return m_impl->m_metadata.m_supportInfo;
|
||||
}
|
||||
|
||||
std::optional<std::string>& ModInfo::repository() {
|
||||
return m_impl->m_metadata.m_repository;
|
||||
}
|
||||
std::optional<std::string> const& ModInfo::repository() const {
|
||||
return m_impl->m_metadata.m_repository;
|
||||
}
|
||||
|
||||
std::optional<IssuesInfo>& ModInfo::issues() {
|
||||
return m_impl->m_issues;
|
||||
}
|
||||
std::optional<IssuesInfo> const& ModInfo::issues() const {
|
||||
return m_impl->m_issues;
|
||||
}
|
||||
|
||||
std::vector<Dependency>& ModInfo::dependencies() {
|
||||
return m_impl->m_dependencies;
|
||||
}
|
||||
std::vector<Dependency> const& ModInfo::dependencies() const {
|
||||
return m_impl->m_dependencies;
|
||||
}
|
||||
|
||||
std::vector<std::string>& ModInfo::spritesheets() {
|
||||
return m_impl->m_metadata.m_spritesheets;
|
||||
}
|
||||
std::vector<std::string> const& ModInfo::spritesheets() const {
|
||||
return m_impl->m_metadata.m_spritesheets;
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, Setting>>& ModInfo::settings() {
|
||||
return m_impl->m_metadata.m_settings;
|
||||
}
|
||||
std::vector<std::pair<std::string, Setting>> const& ModInfo::settings() const {
|
||||
return m_impl->m_metadata.m_settings;
|
||||
}
|
||||
|
||||
bool& ModInfo::supportsDisabling() {
|
||||
return m_impl->m_supportsDisabling;
|
||||
}
|
||||
bool const& ModInfo::supportsDisabling() const {
|
||||
return m_impl->m_supportsDisabling;
|
||||
}
|
||||
|
||||
bool& ModInfo::supportsUnloading() {
|
||||
return m_impl->m_supportsUnloading;
|
||||
}
|
||||
bool const& ModInfo::supportsUnloading() const {
|
||||
return m_impl->m_supportsUnloading;
|
||||
}
|
||||
|
||||
bool& ModInfo::needsEarlyLoad() {
|
||||
return m_impl->m_metadata.m_needsEarlyLoad;
|
||||
}
|
||||
bool const& ModInfo::needsEarlyLoad() const {
|
||||
return m_impl->m_metadata.m_needsEarlyLoad;
|
||||
}
|
||||
|
||||
bool& ModInfo::isAPI() {
|
||||
return m_impl->m_metadata.m_isAPI;
|
||||
}
|
||||
bool const& ModInfo::isAPI() const {
|
||||
return m_impl->m_metadata.m_isAPI;
|
||||
}
|
||||
|
||||
Result<ModInfo> ModInfo::createFromGeodeZip(utils::file::Unzip& zip) {
|
||||
return ModMetadataImpl::createFromGeodeZip(zip);
|
||||
}
|
||||
|
||||
Result<ModInfo> ModInfo::createFromGeodeFile(ghc::filesystem::path const& path) {
|
||||
return ModMetadataImpl::createFromGeodeFile(path);
|
||||
}
|
||||
|
||||
Result<ModInfo> ModInfo::createFromFile(ghc::filesystem::path const& path) {
|
||||
return ModMetadataImpl::createFromFile(path);
|
||||
}
|
||||
|
||||
Result<ModInfo> ModInfo::create(ModJson const& json) {
|
||||
return ModMetadataImpl::create(json);
|
||||
}
|
||||
|
||||
ModJson ModInfo::toJSON() const {
|
||||
return m_impl->m_metadata.m_rawJSON;
|
||||
}
|
||||
|
||||
ModJson ModInfo::getRawJSON() const {
|
||||
return m_impl->m_metadata.m_rawJSON;
|
||||
}
|
||||
|
||||
bool ModInfo::operator==(ModInfo const& other) const {
|
||||
return m_impl->operator==(*other.m_impl);
|
||||
}
|
||||
|
||||
#pragma warning(suppress : 4996)
|
||||
ModInfo::ModInfo() : m_impl(std::make_unique<Impl>()) {}
|
||||
|
||||
ModInfo::ModInfo(ModInfo const& other) : m_impl(std::make_unique<Impl>(*other.m_impl)) {}
|
||||
|
||||
ModInfo::ModInfo(ModInfo&& other) noexcept : m_impl(std::move(other.m_impl)) {}
|
||||
|
||||
ModInfo& ModInfo::operator=(ModInfo const& other) {
|
||||
m_impl = std::make_unique<Impl>(*other.m_impl);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ModInfo& ModInfo::operator=(ModInfo&& other) noexcept {
|
||||
m_impl = std::move(other.m_impl);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ModInfo::operator ModMetadata() {
|
||||
ModMetadata metadata;
|
||||
ModMetadataImpl::getImpl(metadata) = std::move(m_impl->m_metadata);
|
||||
auto& metadataImpl = ModMetadataImpl::getImpl(metadata);
|
||||
metadataImpl.m_issues = m_impl->m_issues ?
|
||||
ModMetadata::IssuesInfo::fromDeprecated(m_impl->m_issues.value()) :
|
||||
std::optional<ModMetadata::IssuesInfo>();
|
||||
for (auto& dep : m_impl->m_dependencies)
|
||||
metadataImpl.m_dependencies.push_back(ModMetadata::Dependency::fromDeprecated(dep));
|
||||
return metadata;
|
||||
}
|
||||
|
||||
ModInfo::operator ModMetadata() const {
|
||||
ModMetadata metadata;
|
||||
ModMetadataImpl::getImpl(metadata) = std::move(m_impl->m_metadata);
|
||||
return metadata;
|
||||
}
|
||||
|
||||
ModJson& ModInfo::rawJSON() {
|
||||
return m_impl->m_metadata.m_rawJSON;
|
||||
}
|
||||
ModJson const& ModInfo::rawJSON() const {
|
||||
return m_impl->m_metadata.m_rawJSON;
|
||||
}
|
||||
|
||||
Result<ModInfo> ModInfo::createFromSchemaV010(geode::ModJson const& json) {
|
||||
return ModMetadataImpl::createFromSchemaV010(json);
|
||||
}
|
||||
|
||||
Result<> ModInfo::addSpecialFiles(ghc::filesystem::path const& dir) {
|
||||
return m_impl->m_metadata.addSpecialFiles(dir);
|
||||
}
|
||||
Result<> ModInfo::addSpecialFiles(utils::file::Unzip& zip) {
|
||||
return m_impl->m_metadata.addSpecialFiles(zip);
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::optional<std::string>*>> ModInfo::getSpecialFiles() {
|
||||
return m_impl->m_metadata.getSpecialFiles();
|
||||
}
|
||||
|
||||
ModInfo::~ModInfo() = default;
|
|
@ -1,30 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "ModMetadataImpl.hpp"
|
||||
|
||||
#include <Geode/loader/Loader.hpp>
|
||||
#include <Geode/loader/Mod.hpp>
|
||||
#include <Geode/utils/JsonValidation.hpp>
|
||||
#include <Geode/utils/VersionInfo.hpp>
|
||||
|
||||
#pragma warning(disable : 4996) // deprecation
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
namespace geode {
|
||||
class [[deprecated]] ModInfo::Impl {
|
||||
public:
|
||||
ModMetadataImpl m_metadata;
|
||||
std::optional<IssuesInfo> m_issues;
|
||||
std::vector<Dependency> m_dependencies;
|
||||
bool m_supportsDisabling = true;
|
||||
bool m_supportsUnloading = false;
|
||||
|
||||
bool operator==(ModInfo::Impl const& other) const;
|
||||
};
|
||||
|
||||
class [[deprecated]] ModInfoImpl : public ModInfo::Impl {
|
||||
public:
|
||||
static ModInfo::Impl& getImpl(ModInfo& info);
|
||||
};
|
||||
}
|
|
@ -8,7 +8,6 @@
|
|||
#include <utility>
|
||||
|
||||
#include "ModMetadataImpl.hpp"
|
||||
#include "ModInfoImpl.hpp"
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
|
@ -26,33 +25,6 @@ bool ModMetadata::Incompatibility::isResolved() const {
|
|||
(!this->mod || !this->version.compare(this->mod->getVersion()));
|
||||
}
|
||||
|
||||
ModMetadata::Dependency::operator geode::Dependency() {
|
||||
return {id, version, importance == Importance::Required, mod};
|
||||
}
|
||||
ModMetadata::Dependency::operator geode::Dependency() const {
|
||||
return {id, version, importance == Importance::Required, mod};
|
||||
}
|
||||
ModMetadata::IssuesInfo::operator geode::IssuesInfo() {
|
||||
return {info, url};
|
||||
}
|
||||
ModMetadata::IssuesInfo::operator geode::IssuesInfo() const {
|
||||
return {info, url};
|
||||
}
|
||||
|
||||
ModMetadata::Dependency ModMetadata::Dependency::fromDeprecated(geode::Dependency const& value) {
|
||||
return {
|
||||
value.id,
|
||||
value.version,
|
||||
value.required ?
|
||||
ModMetadata::Dependency::Importance::Required :
|
||||
ModMetadata::Dependency::Importance::Suggested,
|
||||
value.mod
|
||||
};
|
||||
}
|
||||
ModMetadata::IssuesInfo ModMetadata::IssuesInfo::fromDeprecated(geode::IssuesInfo const& value) {
|
||||
return {value.info, value.url};
|
||||
}
|
||||
|
||||
static std::string sanitizeDetailsData(std::string const& str) {
|
||||
// delete CRLF
|
||||
return utils::string::replace(str, "\r", "");
|
||||
|
@ -546,25 +518,6 @@ ModMetadata& ModMetadata::operator=(ModMetadata&& other) noexcept {
|
|||
return *this;
|
||||
}
|
||||
|
||||
ModMetadata::operator ModInfo() {
|
||||
ModInfo info;
|
||||
auto infoImpl = ModInfoImpl::getImpl(info);
|
||||
infoImpl.m_metadata.Impl::operator=(*m_impl); // im gonna cry what is this hack why are you not using pointers
|
||||
infoImpl.m_issues = m_impl->m_issues;
|
||||
for (auto& dep : m_impl->m_dependencies)
|
||||
infoImpl.m_dependencies.push_back(dep);
|
||||
return info;
|
||||
}
|
||||
ModMetadata::operator ModInfo() const {
|
||||
ModInfo info;
|
||||
auto infoImpl = ModInfoImpl::getImpl(info);
|
||||
infoImpl.m_metadata.Impl::operator=(*m_impl);
|
||||
infoImpl.m_issues = m_impl->m_issues;
|
||||
for (auto& dep : m_impl->m_dependencies)
|
||||
infoImpl.m_dependencies.push_back(dep);
|
||||
return info;
|
||||
}
|
||||
|
||||
ModMetadata::~ModMetadata() = default;
|
||||
|
||||
template <>
|
||||
|
|
|
@ -16,7 +16,7 @@ T findSymbolOrMangled(HMODULE load, char const* name, char const* mangled) {
|
|||
return res;
|
||||
}
|
||||
|
||||
char const* getUsefulError(int code) {
|
||||
char const* getUsefulError(DWORD code) {
|
||||
switch (code) {
|
||||
case ERROR_MOD_NOT_FOUND:
|
||||
return "ERROR_MOD_NOT_FOUND; The mod is either missing the DLL "
|
||||
|
@ -51,24 +51,11 @@ std::string getLastWinError() {
|
|||
if (!err) return "None (0)";
|
||||
auto useful = getUsefulError(err);
|
||||
if (useful) return useful;
|
||||
char* text = nullptr;
|
||||
auto len = FormatMessageA(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), text, 0, nullptr
|
||||
nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), nullptr, 0, nullptr
|
||||
);
|
||||
std::string msg = "";
|
||||
if (len == 0) {
|
||||
msg = "Unknown";
|
||||
}
|
||||
else {
|
||||
if (text != nullptr) {
|
||||
msg = std::string(text, len);
|
||||
LocalFree(text);
|
||||
}
|
||||
else {
|
||||
msg = "Very Unknown";
|
||||
}
|
||||
}
|
||||
std::string msg = len == 0 ? "Unknown" : "Very Unknown";
|
||||
return msg + " (" + std::to_string(err) + ")";
|
||||
}
|
||||
|
||||
|
|
|
@ -127,12 +127,6 @@ Result<> utils::file::createDirectoryAll(ghc::filesystem::path const& path) {
|
|||
}
|
||||
}
|
||||
|
||||
Result<std::vector<ghc::filesystem::path>> utils::file::listFiles(
|
||||
ghc::filesystem::path const& path, bool recursive
|
||||
) {
|
||||
return file::readDirectory(path, recursive);
|
||||
}
|
||||
|
||||
Result<std::vector<ghc::filesystem::path>> utils::file::readDirectory(
|
||||
ghc::filesystem::path const& path, bool recursive
|
||||
) {
|
||||
|
|
Loading…
Add table
Reference in a new issue