Skip to content

Commit

Permalink
update version number and some minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JaanDev committed Jul 3, 2023
1 parent 4ffe59e commit 8ff4842
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
17 changes: 7 additions & 10 deletions src/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,10 @@ namespace Hooks {
reinterpret_cast<void (*)(string*, int)>(
dlsym(dlopen("libcocos2dcpp.so", RTLD_LAZY), "_ZN12GauntletNode11nameForTypeE12GauntletType"))(&gauntletName, gauntletType);

if (shouldReverseGauntlet(gauntletType)) {
nameLabel->setString(string("Остров ").append(gauntletName).c_str());
shadowLabel->setString(string("Остров ").append(gauntletName).c_str());
} else {
nameLabel->setString(gauntletName.append(" Остров").c_str());
shadowLabel->setString(gauntletName.c_str());
}
auto newName = fmt::format(shouldReverseGauntlet(gauntletType) ? "Остров {}" : "{} Остров", gauntletName);

nameLabel->setString(newName.c_str());
shadowLabel->setString(newName.c_str());

return true;
}
Expand All @@ -191,7 +188,7 @@ namespace Hooks {
lbl = node;
}

lbl->setString(string("Таблица Лидеров для ").append(MBO(string, lvl, 252)).c_str());
lbl->setString(fmt::format("Таблица Лидеров для {}", MBO(string, lvl, 252)).c_str());

return true;
}
Expand All @@ -202,7 +199,7 @@ namespace Hooks {
auto spr = cocos2d::CCSprite::createWithSpriteFrameName("gdl_icon.png");
spr->setScale(1.25f);

auto btn = CCMenuItemSpriteExtra::create(spr, spr, self, (cocos2d::SEL_MenuHandler)&GDLMenu::openLayer);
auto btn = CCMenuItemSpriteExtra::create(spr, spr, self, menu_selector(GDLMenu::openLayer));
btn->setPosition({0, 0});

auto menu = CCMenu::create();
Expand Down Expand Up @@ -270,7 +267,7 @@ namespace Hooks {

auto winSize = CCDirector::sharedDirector()->getWinSize();

auto lbl = CCLabelBMFont::create("GDL 1.1.1", "goldFont.fnt");
auto lbl = CCLabelBMFont::create("GDL 1.1.2", "goldFont.fnt");
lbl->setPosition({winSize.width / 2.f, winSize.height - 15.f});
lbl->setScale(.8f);
self->addChild(lbl);
Expand Down
10 changes: 8 additions & 2 deletions src/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@
#include "fmt/format.h"
#include "android/log.h"

#ifndef MODNAME
#define MODNAME "GDL"
#endif

// #define GDL_DEBUG

template <typename... Args>
void logD(Args... args) {
#ifdef GDL_DEBUG
auto str = fmt::format(args...);
__android_log_print(ANDROID_LOG_DEBUG, MODNAME, "%s", str.c_str());
#endif
}

template <typename... Args>
void logW(Args... args) {
#ifdef GDL_DEBUG
auto str = fmt::format(args...);
__android_log_print(ANDROID_LOG_WARN, MODNAME, "%s", str.c_str());
#endif
}

template <typename... Args>
void logE(Args... args) {
#ifdef GDL_DEBUG
auto str = fmt::format(args...);
__android_log_print(ANDROID_LOG_ERROR, MODNAME, "%s", str.c_str());
#endif
}
2 changes: 0 additions & 2 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <dirent.h>
#include <regex>

#define GDL_DEBUG

#define HOOK_FUNC(retType, name, ...) \
retType (*name##_o)(__VA_ARGS__); \
retType name##_hk(__VA_ARGS__)
Expand Down

0 comments on commit 8ff4842

Please sign in to comment.