Add android gd string and comment out addresses for now

This commit is contained in:
altalk23 2023-09-14 15:49:24 +03:00
parent 4e8f7866bf
commit 0e324c444c
2 changed files with 62 additions and 1 deletions

View file

@ -122,7 +122,7 @@ std::string generateAddressHeader(Root const& root) {
}
else if (codegen::getStatus(field) == BindStatus::Binded && fn->prototype.type == FunctionType::Normal) {
address_str = fmt::format(
"addresser::get{}Virtual(Resolve<{}>::func(&{}::{}))",
"0/*addresser::get{}Virtual(Resolve<{}>::func(&{}::{}))*/",
str_if("Non", !fn->prototype.is_virtual),
codegen::getParameterTypes(fn->prototype),
field.parent,

View file

@ -0,0 +1,61 @@
#include <Geode/c++stl/gdstdlib.hpp>
#ifdef GEODE_IS_ANDROID
namespace gd {
namespace {
static inline auto emptyInternalString() {
return reinterpret_cast<_internal_string*>(
*reinterpret_cast<uintptr_t*>(geode::base::get() + 0x75fb24) + sizeof(_internal_string)
);
}
}
string::string() : m_data(nullptr) {
m_data = emptyInternalString();
}
string::string(char const* ok) : m_data(nullptr) {
reinterpret_cast<void (*)(string*, char const*)>(geode::base::get() + 0x506c08)(this, ok);
}
string::string(string const& ok) : m_data(nullptr) {
if (*(string**)(&ok) == nullptr) return;
reinterpret_cast<void (*)(string*, string const&)>(geode::base::get() + 0x506634)(this, ok);
}
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;
reinterpret_cast<void (*)(_internal_string*)>(geode::base::get() + 0x5054bc)(
&m_data[-1]
);
}
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);
}
// TODO: these need to stay for old mods linking against geode <1.2.0, remove in 2.0.0
template class map<int, int>;
template class map<gd::string, gd::string>;
template class map<gd::string, bool>;
template class map<short, bool>;
}
#endif