mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-23 03:15:58 -04:00
stringcopy begone
This commit is contained in:
parent
16f66eb76c
commit
7aca59b20c
2 changed files with 5 additions and 10 deletions
loader
|
@ -8,14 +8,14 @@
|
|||
static constexpr ptrdiff_t MENULAYER_SCENE = 0x309068 - 0x10000;
|
||||
static constexpr ptrdiff_t STRING_EMPTY = 0xaa1c48 - 0x10000 - 0xc; // the internal struct size
|
||||
static constexpr ptrdiff_t STRING_DTOR = 0x7514c8 - 0x10000 + 1;
|
||||
static constexpr ptrdiff_t STRING_COPY = 0x753a44 - 0x10000 + 1;
|
||||
static constexpr ptrdiff_t OPERATOR_NEW = 0x721308 - 0x10000 + 1;
|
||||
|
||||
#elif defined(GEODE_IS_ANDROID64)
|
||||
|
||||
static constexpr ptrdiff_t MENULAYER_SCENE = 0x6a62ec - 0x100000;
|
||||
static constexpr ptrdiff_t STRING_EMPTY = 0x12d8568 - 0x100000 - 0x18; // the internal struct size
|
||||
static constexpr ptrdiff_t STRING_DTOR = 0xdb9778 - 0x100000; // it's inlined but it exists !!!!
|
||||
static constexpr ptrdiff_t STRING_COPY = 0xdb5fdc - 0x100000;
|
||||
static constexpr ptrdiff_t OPERATOR_NEW = 0xd6dfe8 - 0x100000;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -60,24 +60,18 @@ namespace geode::stl {
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: should be using (char*, size_t) at the very least, or yknow, just reimplement it :-)
|
||||
reinterpret_cast<void (*)(StringData*, char const*)>(geode::base::get() + STRING_COPY)(&data, str.data());
|
||||
return;
|
||||
|
||||
// TODO: this crashes because we need to use gd's operator new...
|
||||
#if 0
|
||||
StringData::Internal internal;
|
||||
internal.m_size = str.size();
|
||||
internal.m_capacity = str.size();
|
||||
internal.m_refcount = 0;
|
||||
|
||||
auto* buffer = static_cast<char*>(operator new(str.size() + 1 + sizeof(internal)));
|
||||
auto* buffer = reinterpret_cast<char*(*)(size_t)>(geode::base::get() + OPERATOR_NEW)(str.size() + 1 + sizeof(internal));
|
||||
// auto* buffer = static_cast<char*>(operator new(str.size() + 1 + sizeof(internal)));
|
||||
std::memcpy(buffer, &internal, sizeof(internal));
|
||||
std::memcpy(buffer + sizeof(internal), str.data(), str.size());
|
||||
buffer[sizeof(internal) + str.size()] = 0;
|
||||
|
||||
data.m_data = reinterpret_cast<StringData::Internal*>(buffer + sizeof(internal));
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t StringImpl::getSize() {
|
||||
|
|
|
@ -45,6 +45,7 @@ GEODE_MEMBER_CHECK(FLAlertLayer, m_buttonMenu, 0x1b8);
|
|||
GEODE_MEMBER_CHECK(FLAlertLayer, m_mainLayer, 0x1c8);
|
||||
GEODE_MEMBER_CHECK(TableView, m_cellArray, 0x1b0);
|
||||
GEODE_MEMBER_CHECK(TableViewCell, m_backgroundLayer, 0x190);
|
||||
GEODE_SIZE_CHECK(CCBlockLayer, 0x1bc);
|
||||
|
||||
|
||||
GEODE_SIZE_CHECK(GameObject, 0x488);
|
||||
|
|
Loading…
Reference in a new issue