geode/loader/src/load/cgeode.cpp

35 lines
892 B
C++
Raw Normal View History

2022-07-30 12:24:03 -04:00
#include <Geode/loader/Log.hpp>
2022-10-30 14:56:36 -04:00
#include <Geode/loader/Mod.hpp>
#include <Geode/loader/cgeode.h>
2022-07-30 12:24:03 -04:00
USE_GEODE_NAMESPACE();
std::string g_lastError = "";
2022-10-30 14:56:36 -04:00
void geode_mod_log(void* cmod, char const* message) {
auto mod = static_cast<Mod*>(cmod);
log::log(Severity::Debug, mod, "{}", message);
2022-07-30 12:24:03 -04:00
}
bool geode_mod_add_hook(void* cmod, void* address, void* detour) {
2022-10-30 14:56:36 -04:00
// auto mod = static_cast<Mod*>(cmod);
// auto res = mod->addHook(address, detour);
// if (!res) {
// g_lastError = res.error();
// return false;
// }
return true;
2022-07-30 12:24:03 -04:00
}
bool geode_get_last_error(char* buffer, size_t bufferSize) {
2022-10-30 14:56:36 -04:00
if (buffer && bufferSize >= g_lastError.size()) {
try {
std::copy(g_lastError.begin(), g_lastError.end(), buffer);
return true;
}
catch (...) {
}
}
return false;
2022-07-30 12:24:03 -04:00
}