mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-02 08:09:57 -04:00
Merge branch 'main' of https://github.com/geode-sdk/geode
This commit is contained in:
commit
261851887c
2 changed files with 32 additions and 4 deletions
|
@ -4320,7 +4320,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate,
|
|||
void cameraMoveY(float, float, float) = mac 0x7cc60, win 0x207c80;
|
||||
void checkCollisions(PlayerObject*, float) = mac 0x78c90, win 0x203CD0;
|
||||
void circleWaveWillBeRemoved(CCCircleWave*) = mac 0x7e110, win 0x20aa90;
|
||||
void claimParticle(gd::string) = mac 0x76ba0, win 0x200fb0;
|
||||
cocos2d::CCParticleSystemQuad* claimParticle(gd::string) = mac 0x76ba0, win 0x200dd0;
|
||||
void clearPickedUpItems() = mac 0x7cfa0;
|
||||
void colorObject(int, cocos2d::_ccColor3B) = mac 0x77810;
|
||||
void commitJumps() = mac 0x737e0;
|
||||
|
@ -4445,7 +4445,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate,
|
|||
void togglePracticeMode(bool) = mac 0x7f9e0, win 0x20d0d0;
|
||||
void toggleProgressbar() = mac 0x6eeb0, win 0x208160;
|
||||
void tryStartRecord() = mac 0x7fe00;
|
||||
void unclaimParticle(char const*, cocos2d::CCParticleSystemQuad*) = mac 0x76e00, win 0x200dd0;
|
||||
void unclaimParticle(char const*, cocos2d::CCParticleSystemQuad*) = mac 0x76e00, win 0x200fb0;
|
||||
void unregisterActiveObject(GameObject*) = mac 0x77660;
|
||||
void unregisterStateObject(GameObject*) = mac 0x777f0;
|
||||
virtual void update(float) = mac 0x77900, win 0x2029C0, ios 0xb2f08;
|
||||
|
|
|
@ -17,9 +17,26 @@ void Loader::Impl::platformMessageBox(char const* title, std::string const& info
|
|||
MessageBoxA(nullptr, info.c_str(), title, MB_ICONERROR);
|
||||
}
|
||||
|
||||
bool hasAnsiColorSupport = false;
|
||||
|
||||
void Loader::Impl::logConsoleMessageWithSeverity(std::string const& msg, Severity severity) {
|
||||
if (m_platformConsoleOpen) {
|
||||
std::cout << msg << "\n" << std::flush;
|
||||
if (hasAnsiColorSupport) {
|
||||
int color = 0;
|
||||
switch (severity) {
|
||||
case Severity::Debug: color = 243; break;
|
||||
case Severity::Info: color = 33; break;
|
||||
case Severity::Warning: color = 229; break;
|
||||
case Severity::Error: color = 9; break;
|
||||
default: color = 7; break;
|
||||
}
|
||||
auto const colorStr = fmt::format("\x1b[38;5;{}m", color);
|
||||
auto const newMsg = fmt::format("{}{}\x1b[0m{}", colorStr, msg.substr(0, 8), msg.substr(8));
|
||||
|
||||
std::cout << newMsg << "\n" << std::flush;
|
||||
} else {
|
||||
std::cout << msg << "\n" << std::flush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,10 +48,21 @@ void Loader::Impl::openPlatformConsole() {
|
|||
freopen_s(reinterpret_cast<FILE**>(stdout), "CONOUT$", "w", stdout);
|
||||
freopen_s(reinterpret_cast<FILE**>(stdin), "CONIN$", "r", stdin);
|
||||
|
||||
// Set output mode to handle ansi color sequences
|
||||
auto handleStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
DWORD consoleMode = 0;
|
||||
if (GetConsoleMode(handleStdout, &consoleMode)) {
|
||||
consoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
if (SetConsoleMode(handleStdout, consoleMode)) {
|
||||
hasAnsiColorSupport = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_platformConsoleOpen = true;
|
||||
|
||||
for (auto const& log : log::Logger::list()) {
|
||||
std::cout << log->toString(true) << "\n";
|
||||
this->logConsoleMessageWithSeverity(log->toString(true), log->getSeverity());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue