mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
Merge branch 'main' of https://github.com/geode-sdk/sdk
This commit is contained in:
commit
18f684cf26
5 changed files with 31 additions and 38 deletions
|
@ -14,7 +14,6 @@ namespace geode::helper {}
|
|||
namespace geode::node {}
|
||||
namespace geode::op {}
|
||||
namespace geode::stream {}
|
||||
namespace geode::log {}
|
||||
namespace geode::view {}
|
||||
namespace cocos2d {}
|
||||
namespace cocos2d::extension {}
|
||||
|
@ -29,7 +28,6 @@ namespace cocos2d::extension {}
|
|||
using namespace geode::node; \
|
||||
using namespace geode::op; \
|
||||
using namespace geode::stream; \
|
||||
using namespace geode::log; \
|
||||
using namespace geode::view; \
|
||||
using namespace cocos2d; \
|
||||
using namespace cocos2d::extension; \
|
||||
|
|
|
@ -11,11 +11,7 @@
|
|||
|
||||
namespace geode {
|
||||
class Hook;
|
||||
|
||||
|
||||
namespace log {
|
||||
class LogPtr;
|
||||
}
|
||||
class LogPtr;
|
||||
|
||||
/**
|
||||
* For developing your own mods, it is
|
||||
|
@ -85,7 +81,7 @@ namespace geode {
|
|||
}
|
||||
|
||||
[[deprecated("Use Log::get instead")]]
|
||||
static inline GEODE_HIDDEN log::Log log() {
|
||||
static inline GEODE_HIDDEN Log log() {
|
||||
return Interface::get()->m_mod->log();
|
||||
}
|
||||
|
||||
|
@ -148,7 +144,7 @@ namespace geode {
|
|||
return Interface::get()->m_mod;
|
||||
}
|
||||
|
||||
inline log::Log log::Log::get() {
|
||||
inline Log Log::get() {
|
||||
return Mod::get()->log();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,8 @@ namespace geode {
|
|||
class Mod;
|
||||
class Hook;
|
||||
struct ModInfo;
|
||||
|
||||
namespace log {
|
||||
class Log;
|
||||
class LogPtr;
|
||||
}
|
||||
class Log;
|
||||
class LogPtr;
|
||||
|
||||
class GEODE_DLL Loader {
|
||||
public:
|
||||
|
@ -49,7 +46,7 @@ namespace geode {
|
|||
};
|
||||
|
||||
std::unordered_map<std::string, Mod*> m_mods;
|
||||
std::vector<log::LogPtr*> m_logs;
|
||||
std::vector<LogPtr*> m_logs;
|
||||
std::ofstream m_logStream;
|
||||
std::vector<ghc::filesystem::path> m_modDirectories;
|
||||
std::vector<UnloadedModInfo> m_erroredMods;
|
||||
|
@ -160,10 +157,10 @@ namespace geode {
|
|||
*/
|
||||
static bool isUnloading();
|
||||
|
||||
void pushLog(log::LogPtr* log);
|
||||
void popLog(log::LogPtr* log);
|
||||
std::vector<log::LogPtr*> const& getLogs() const;
|
||||
std::vector<log::LogPtr*> getLogs(
|
||||
void pushLog(LogPtr* log);
|
||||
void popLog(LogPtr* log);
|
||||
std::vector<LogPtr*> const& getLogs() const;
|
||||
std::vector<LogPtr*> getLogs(
|
||||
std::initializer_list<Severity> severityFilter
|
||||
);
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@ namespace cocos2d {
|
|||
class CCArray;
|
||||
}
|
||||
|
||||
namespace geode {
|
||||
class Mod;
|
||||
}
|
||||
|
||||
GEODE_DLL std::ostream& operator<<(std::ostream& os, geode::Mod* mod);
|
||||
GEODE_DLL std::ostream& operator<<(std::ostream& os, cocos2d::CCObject* obj);
|
||||
GEODE_DLL std::ostream& operator<<(std::ostream& os, cocos2d::CCArray* obj);
|
||||
|
@ -27,7 +23,8 @@ GEODE_DLL std::ostream& operator<<(std::ostream& os, cocos2d::CCPoint const& pos
|
|||
GEODE_DLL std::ostream& operator<<(std::ostream& os, cocos2d::CCSize const& size);
|
||||
GEODE_DLL std::ostream& operator<<(std::ostream& os, cocos2d::CCRect const& rect);
|
||||
|
||||
namespace geode::log {
|
||||
namespace geode {
|
||||
class Mod;
|
||||
#pragma warning(disable: 4251)
|
||||
|
||||
using log_clock = std::chrono::system_clock;
|
||||
|
@ -37,7 +34,7 @@ namespace geode::log {
|
|||
LogMetadata(std::string const& r) : m_repr(r) {}
|
||||
LogMetadata() {}
|
||||
virtual ~LogMetadata() {}
|
||||
}; using NoMetadata = LogMetadata;
|
||||
};
|
||||
|
||||
std::string generateLogName();
|
||||
|
||||
|
@ -94,9 +91,9 @@ namespace geode::log {
|
|||
|
||||
template <typename U, typename T>
|
||||
Log& streamMeta(T t) {
|
||||
static_assert(std::is_base_of<NoMetadata, U>::value, "Metadata class must derive from geode::log::NoMetadata");
|
||||
static_assert(std::is_base_of<LogMetadata, U>::value, "Metadata class must derive from geode::LogMetadata");
|
||||
|
||||
auto md = new NoMetadata;
|
||||
auto md = new LogMetadata;
|
||||
md->m_repr = this->m_stream.str();
|
||||
this->m_logptr->m_data.push_back(md);
|
||||
m_stream.str("");
|
||||
|
@ -115,24 +112,31 @@ namespace geode::log {
|
|||
|
||||
// geode-defined metadata functions
|
||||
|
||||
struct ModMeta : public NoMetadata {
|
||||
struct ModMeta : public LogMetadata {
|
||||
Mod* m_mod;
|
||||
ModMeta(Mod* m) : m_mod(m) {}
|
||||
ModMeta(std::string const& r, Mod* m) : m_mod(m), NoMetadata(r) {}
|
||||
ModMeta(std::string const& r, Mod* m) : m_mod(m), LogMetadata(r) {}
|
||||
};
|
||||
struct GEODE_DLL CCObjectMeta : public NoMetadata {
|
||||
struct GEODE_DLL CCObjectMeta : public LogMetadata {
|
||||
cocos2d::CCObject* m_obj;
|
||||
CCObjectMeta(cocos2d::CCObject* obj);
|
||||
CCObjectMeta(std::string const& r, cocos2d::CCObject* obj);
|
||||
~CCObjectMeta();
|
||||
};
|
||||
struct GEODE_DLL CCArrayMeta : public NoMetadata {
|
||||
struct GEODE_DLL CCArrayMeta : public LogMetadata {
|
||||
cocos2d::CCArray* m_arr;
|
||||
CCArrayMeta(cocos2d::CCArray* arr);
|
||||
CCArrayMeta(std::string const& r, cocos2d::CCArray* arr);
|
||||
~CCArrayMeta();
|
||||
};
|
||||
|
||||
struct {
|
||||
template <typename T>
|
||||
geode::Log& operator<<(T& a) {
|
||||
return geode::Log::get() << a;
|
||||
}
|
||||
} log;
|
||||
}
|
||||
GEODE_DLL geode::log::Log& operator<<(geode::log::Log&, geode::Mod*);
|
||||
GEODE_DLL geode::log::Log& operator<<(geode::log::Log&, cocos2d::CCObject*);
|
||||
GEODE_DLL geode::log::Log& operator<<(geode::log::Log&, cocos2d::CCArray*);
|
||||
GEODE_DLL geode::Log& operator<<(geode::Log&, geode::Mod*);
|
||||
GEODE_DLL geode::Log& operator<<(geode::Log&, cocos2d::CCObject*);
|
||||
GEODE_DLL geode::Log& operator<<(geode::Log&, cocos2d::CCArray*);
|
||||
|
|
|
@ -21,9 +21,7 @@ namespace geode {
|
|||
class Hook;
|
||||
class Patch;
|
||||
class Loader;
|
||||
namespace log {
|
||||
class Log;
|
||||
}
|
||||
class Log;
|
||||
class Mod;
|
||||
|
||||
class Unknown;
|
||||
|
@ -308,7 +306,7 @@ namespace geode {
|
|||
* @returns Reference to log stream. Make sure
|
||||
* to end your logging with geode::endl.
|
||||
*/
|
||||
log::Log log();
|
||||
Log log();
|
||||
|
||||
/**
|
||||
* Log an information. Equivalent to
|
||||
|
|
Loading…
Reference in a new issue