2023-09-14 08:49:24 -04:00
|
|
|
#include <Geode/c++stl/gdstdlib.hpp>
|
|
|
|
|
|
|
|
#ifdef GEODE_IS_ANDROID
|
|
|
|
|
2023-12-20 11:58:47 -05:00
|
|
|
// 2.2 addition
|
|
|
|
// zmx please fix this
|
|
|
|
|
2023-09-15 16:37:18 -04:00
|
|
|
namespace geode::base {
|
|
|
|
uintptr_t get() {
|
2023-12-21 12:44:22 -05:00
|
|
|
static uintptr_t base = (reinterpret_cast<uintptr_t>(&MenuLayer::scene) - (0x309068 - 0x10000)) & (~0x1);
|
2023-09-15 16:37:18 -04:00
|
|
|
// static uintptr_t base = reinterpret_cast<uintptr_t>(dlopen("libcocos2dcpp.so", RTLD_NOW));
|
|
|
|
return base;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-14 08:49:24 -04:00
|
|
|
namespace gd {
|
|
|
|
namespace {
|
|
|
|
static inline auto emptyInternalString() {
|
|
|
|
return reinterpret_cast<_internal_string*>(
|
2023-12-21 12:44:22 -05:00
|
|
|
geode::base::get() + (0xaa1c3c - 0x10000) + sizeof(_internal_string)
|
2023-09-14 08:49:24 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
string::string() : m_data(nullptr) {
|
|
|
|
m_data = emptyInternalString();
|
|
|
|
}
|
|
|
|
|
|
|
|
string::string(char const* ok) : m_data(nullptr) {
|
2023-12-21 12:44:22 -05:00
|
|
|
reinterpret_cast<void (*)(string*, char const*)>(geode::base::get() + (0x753a44 - 0x10000) + 1)(this, ok);
|
2023-09-14 08:49:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
string::string(string const& ok) : m_data(nullptr) {
|
|
|
|
if (*(string**)(&ok) == nullptr) return;
|
2023-12-21 12:44:22 -05:00
|
|
|
reinterpret_cast<void (*)(string*, string const&)>(geode::base::get() + (0x7530e0 - 0x10000) + 1)(this, ok);
|
2023-09-14 08:49:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
string& string::operator=(char const* ok) {
|
|
|
|
this->~string();
|
|
|
|
new (this) string(ok);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
string& string::operator=(string const& ok) {
|
|
|
|
this->~string();
|
|
|
|
new (this) string(ok);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
string::~string() {
|
|
|
|
if (m_data == nullptr) return;
|
2023-09-15 16:37:18 -04:00
|
|
|
|
2023-12-21 12:44:22 -05:00
|
|
|
reinterpret_cast<void (*)(string*)>(geode::base::get() + (0x7514c8 - 0x10000) + 1)(this);
|
2023-09-14 08:49:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool string::operator<(string const& other) const {
|
|
|
|
return std::string(*this) < std::string(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool string::operator==(string const& other) const {
|
|
|
|
return std::string(*this) == std::string(other);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|