mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-15 03:25:01 -05:00
remove internal_log
This commit is contained in:
parent
75a98e1fff
commit
cb3a610407
5 changed files with 19 additions and 49 deletions
|
@ -1,30 +0,0 @@
|
|||
#include "Mod.hpp"
|
||||
#include "Loader.hpp"
|
||||
|
||||
#ifdef API_DECL
|
||||
#undef API_DECL
|
||||
#endif
|
||||
|
||||
|
||||
#if GEODE_CONCAT(EXPORT_, EXPORT_NAME)
|
||||
#define API_DECL(func, ...) ; static inline auto GEODE_CONCAT(_dummy, __LINE__) = (geode::Interface::get()->exportAPIFunction(GEODE_STR(func), func), 0);
|
||||
#else
|
||||
#define API_DECL(func, ...) \
|
||||
{\
|
||||
static geode::Mod* src = geode::Loader::get()->getLoadedMod(_source);\
|
||||
static auto ptr = geode::Mod::get()->importAPIFunction<decltype(func)>(GEODE_STR(func), src);\
|
||||
return std::invoke(ptr, __VA_ARGS__);\
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GEODE_API_HPP
|
||||
#define GEODE_API_HPP
|
||||
|
||||
#define API_INIT(name) static constexpr auto _source = name;
|
||||
|
||||
namespace geode {
|
||||
class GEODE_DLL ModAPI {};
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef EXPORT_NAME
|
|
@ -35,6 +35,9 @@ static CCEGLView* CCEGLView_CCEGLView(CCEGLView* self) {
|
|||
);
|
||||
return self;
|
||||
}
|
||||
static auto _ = Interface::get()->addHook<&CCEGLView_CCEGLView, Thiscall>("CCEGLView::CCEGLView", CCEGLVIEW_CON_ADDR);
|
||||
|
||||
$execute {
|
||||
Mod::get()->addHook<&CCEGLView_CCEGLView, Thiscall>("CCEGLView::CCEGLView", CCEGLVIEW_CON_ADDR);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,4 @@ class InternalMod : public Mod {
|
|||
|
||||
public:
|
||||
static InternalMod* get();
|
||||
};
|
||||
|
||||
template <typename ...Args>
|
||||
void internal_log(Severity sev, Args... args) { log::log(sev, InternalMod::get(), args...); }
|
||||
};
|
|
@ -84,7 +84,7 @@ void Loader::updateModResources(Mod* mod) {
|
|||
ccfu->fullPathForFilename(plist.c_str(), false)
|
||||
)
|
||||
) {
|
||||
internal_log(Severity::Warning,
|
||||
log::warn(
|
||||
"The resource dir of \"",
|
||||
mod->m_info.m_id,
|
||||
"\" is missing \"",
|
||||
|
@ -112,7 +112,7 @@ void Loader::updateResources() {
|
|||
size_t Loader::loadModsFromDirectory(
|
||||
ghc::filesystem::path const& dir, bool recursive
|
||||
) {
|
||||
internal_log(Severity::Debug, "Searching ", dir);
|
||||
log::debug("Searching ", dir);
|
||||
|
||||
size_t loadedCount = 0;
|
||||
for (auto const& entry : ghc::filesystem::directory_iterator(dir)) {
|
||||
|
@ -142,7 +142,7 @@ size_t Loader::loadModsFromDirectory(
|
|||
|
||||
// load mod
|
||||
|
||||
internal_log(Severity::Debug, "Loading ", entry.path().string());
|
||||
log::debug("Loading ", entry.path().string());
|
||||
|
||||
auto res = this->loadModFromFile(entry.path().string());
|
||||
if (res && res.value()) {
|
||||
|
@ -151,13 +151,13 @@ size_t Loader::loadModsFromDirectory(
|
|||
|
||||
// check for dependencies
|
||||
if (!res.value()->hasUnresolvedDependencies()) {
|
||||
internal_log(Severity::Debug, "Successfully loaded ", res.value());
|
||||
log::debug("Successfully loaded ", res.value());
|
||||
} else {
|
||||
internal_log(Severity::Error, res.value(), " has unresolved dependencies");
|
||||
log::error(res.value(), " has unresolved dependencies");
|
||||
}
|
||||
} else {
|
||||
// something went wrong
|
||||
internal_log(Severity::Error, res.error());
|
||||
log::error(res.error());
|
||||
m_erroredMods.push_back({ entry.path().string(), res.error() });
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ size_t Loader::loadModsFromDirectory(
|
|||
}
|
||||
|
||||
size_t Loader::refreshMods() {
|
||||
internal_log(Severity::Debug, "Loading mods...");
|
||||
log::debug("Loading mods...");
|
||||
|
||||
// clear errored mods since that list will be
|
||||
// reconstructed from scratch
|
||||
|
@ -182,7 +182,7 @@ size_t Loader::refreshMods() {
|
|||
loadedCount += loadModsFromDirectory(dir, true);
|
||||
}
|
||||
|
||||
internal_log(Severity::Debug, "Loaded ", loadedCount, " mods");
|
||||
log::debug("Loaded ", loadedCount, " mods");
|
||||
return loadedCount;
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ bool Loader::setup() {
|
|||
if (m_isSetup)
|
||||
return true;
|
||||
|
||||
internal_log(Severity::Debug, "Setting up Loader...");
|
||||
log::debug("Setting up Loader...");
|
||||
|
||||
this->createDirectories();
|
||||
this->loadSettings();
|
||||
|
@ -345,9 +345,9 @@ bool Loader::setup() {
|
|||
});
|
||||
|
||||
if (crashlog::setupPlatformHandler()) {
|
||||
internal_log(Severity::Debug, "Set up platform crash logger");
|
||||
log::debug("Set up platform crash logger");
|
||||
} else {
|
||||
internal_log(Severity::Debug, "Unable to set up platform crash logger");
|
||||
log::debug("Unable to set up platform crash logger");
|
||||
}
|
||||
|
||||
m_isSetup = true;
|
||||
|
|
|
@ -139,7 +139,7 @@ int geodeEntry(void* platformData) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
internal_log(Severity::Debug, "Loaded internal Geode class");
|
||||
log::debug("Loaded internal Geode class");
|
||||
|
||||
// set up loader, load mods, etc.
|
||||
if (!Loader::get()->setup()) {
|
||||
|
@ -152,13 +152,13 @@ int geodeEntry(void* platformData) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
internal_log(Severity::Debug, "Set up loader");
|
||||
log::debug("Set up loader");
|
||||
|
||||
if (InternalMod::get()->getSettingValue<bool>("show-platform-console")) {
|
||||
Loader::get()->openPlatformConsole();
|
||||
}
|
||||
|
||||
internal_log(Severity::Debug, "Entry done.");
|
||||
log::debug("Entry done.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue