c++ abi can go burn in gaseous tungsten

This commit is contained in:
altalk23 2023-10-01 17:36:44 +03:00
parent b0ab2f95f6
commit fc58ab79ef
9 changed files with 58 additions and 16 deletions

View file

@ -3611,7 +3611,7 @@ class GameObject : CCSpritePlus {
bool m_unk3D9; bool m_unk3D9;
bool m_isSelected; bool m_isSelected;
int m_globalClickCounter; int m_globalClickCounter;
PAD = mac 0x8, win 0x8; PAD = mac 0x8, win 0x8, android 0x8;
bool m_shouldUpdateColorSprite; bool m_shouldUpdateColorSprite;
float m_multiScaleMultiplier; float m_multiScaleMultiplier;
bool m_isGroupParent; bool m_isGroupParent;
@ -3624,20 +3624,20 @@ class GameObject : CCSpritePlus {
int m_editorLayer; int m_editorLayer;
int m_editorLayer2; int m_editorLayer2;
int m_unk414; int m_unk414;
PAD = mac 0xc, win 0xc; PAD = mac 0xc, win 0xc, android 0xc;
cocos2d::CCPoint m_firstPosition; cocos2d::CCPoint m_firstPosition;
bool m_unk42C; bool m_unk42C;
bool m_unk42D; bool m_unk42D;
PAD = mac 0x6, win 0x6; PAD = mac 0x6, win 0x6, android 0x6;
bool m_isAnimated; bool m_isAnimated;
PAD = mac 0x7, win 0x7; PAD = mac 0x7, win 0x7, android 0x7;
bool m_hasEffectLine; bool m_hasEffectLine;
bool m_specialUnk43d; bool m_specialUnk43d;
PAD = mac 0x1, win 0x1; PAD = mac 0x1, win 0x1, android 0x1;
bool m_hasDurationLine; bool m_hasDurationLine;
bool m_isTriggerable; bool m_isTriggerable;
bool m_triggeredInEditor; bool m_triggeredInEditor;
PAD = mac 0x6, win 0x6; PAD = mac 0x6, win 0x6, android 0x6;
bool m_highDetail; bool m_highDetail;
ColorActionSprite* m_colorActionSpriteBase; ColorActionSprite* m_colorActionSpriteBase;
ColorActionSprite* m_colorActionSpriteDetail; ColorActionSprite* m_colorActionSpriteDetail;
@ -3646,7 +3646,7 @@ class GameObject : CCSpritePlus {
bool m_unk459; bool m_unk459;
bool m_unk45A; bool m_unk45A;
bool m_wasForcedRotatedPositionUpdateIdk; bool m_wasForcedRotatedPositionUpdateIdk;
PAD = mac 0x8, win 0x8; PAD = mac 0x8, win 0x8, android 0x8;
bool m_orbMultiActivate; bool m_orbMultiActivate;
} }

View file

@ -7,9 +7,9 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
std::string mangleIdent(std::string_view str) { std::string mangleIdent(std::string_view str, bool ne = true) {
if (str.find("::") != -1) { if (str.find("::") != -1) {
std::string result = "N"; std::string result = ne ? "N" : "";
auto s = str; auto s = str;
do { do {
const auto i = s.find("::"); const auto i = s.find("::");
@ -19,7 +19,7 @@ std::string mangleIdent(std::string_view str) {
else else
s = s.substr(i + 2); s = s.substr(i + 2);
} while(s.size()); } while(s.size());
return result + "E"; return result + (ne ? "E" : "");
} else { } else {
return std::to_string(str.size()) + std::string(str); return std::to_string(str.size()) + std::string(str);
} }
@ -125,6 +125,18 @@ std::string mangleType(std::vector<std::string>& seen, std::string name, bool su
std::string generateAndroidSymbol(const Class& clazz, const FunctionBindField* fn) { std::string generateAndroidSymbol(const Class& clazz, const FunctionBindField* fn) {
auto& decl = fn->prototype; auto& decl = fn->prototype;
if (decl.type != FunctionType::Normal) {
// ctor and dtor
switch (decl.type) {
case FunctionType::Ctor:
return "_ZN" + mangleIdent(clazz.name, false) + "C2Ev";
case FunctionType::Dtor:
return "_ZN" + mangleIdent(clazz.name, false) + "D2Ev";
default:
throw std::runtime_error("Unknown function type");
}
}
std::string mangledSymbol = "_Z" + mangleIdent(clazz.name + "::" + decl.name); std::string mangledSymbol = "_Z" + mangleIdent(clazz.name + "::" + decl.name);
if (decl.args.empty()) { if (decl.args.empty()) {
mangledSymbol += "v"; mangledSymbol += "v";

View file

@ -136,6 +136,7 @@ namespace codegen {
inline bool shouldAndroidBind(const FunctionBindField* fn) { inline bool shouldAndroidBind(const FunctionBindField* fn) {
if (codegen::platform == Platform::Android) { if (codegen::platform == Platform::Android) {
if (fn->prototype.type != FunctionType::Normal) return true;
for (auto& [type, name] : fn->prototype.args) { for (auto& [type, name] : fn->prototype.args) {
if (can_find(type.name, "gd::")) return true; if (can_find(type.name, "gd::")) return true;
} }

View file

@ -81,8 +81,7 @@ namespace geode {
GEODE_IOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \ GEODE_IOS(GEODE_FILL_CONSTRUCTOR(Class_, 0){}) \
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {}) \ : Class_() {}) \
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_ANDROID(GEODE_FILL_CONSTRUCTOR(Class_, 0){})
: Class_() {})
#define GEODE_CUTOFF_CONSTRUCTOR_COCOS(Class_, Base_) \ #define GEODE_CUTOFF_CONSTRUCTOR_COCOS(Class_, Base_) \
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
@ -91,8 +90,8 @@ namespace geode {
: Base_(geode::CutoffConstructor, fill){}) \ : Base_(geode::CutoffConstructor, fill){}) \
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {}) \ : Class_() {}) \
GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
: Class_() {}) : Base_(geode::CutoffConstructor, fill){})
#define GEODE_CUTOFF_CONSTRUCTOR_GD(Class_, Base_) \ #define GEODE_CUTOFF_CONSTRUCTOR_GD(Class_, Base_) \
GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_WINDOWS(Class_(geode::CutoffConstructorType, size_t fill) \
@ -106,7 +105,8 @@ namespace geode {
#define GEODE_CUTOFF_CONSTRUCTOR_CUTOFF(Class_, Base_) \ #define GEODE_CUTOFF_CONSTRUCTOR_CUTOFF(Class_, Base_) \
GEODE_WINDOWS(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \ GEODE_WINDOWS(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \
GEODE_ANDROID(GEODE_FILL_CONSTRUCTOR(Class_, sizeof(Base_)) : Base_(){}) \ GEODE_ANDROID(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){}) \
GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_MACOS(Class_(geode::CutoffConstructorType, size_t fill) \
: Base_(geode::CutoffConstructor, fill){}) \ : Base_(geode::CutoffConstructor, fill){}) \
GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \ GEODE_IOS(Class_(geode::CutoffConstructorType, size_t fill) \

View file

@ -34,6 +34,8 @@ class CC_DLL CCEGLView : public CCEGLViewProtocol
{ {
GEODE_FRIEND_MODIFY GEODE_FRIEND_MODIFY
public: public:
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCEGLView, CCEGLViewProtocol)
CCEGLView(); CCEGLView();
virtual ~CCEGLView(); virtual ~CCEGLView();

View file

@ -58,7 +58,7 @@ namespace geode::modifier {
using Intermediate = Modify<Parent, Base>; using Intermediate = Modify<Parent, Base>;
// Padding used for guaranteeing any member of parents // Padding used for guaranteeing any member of parents
// will be in between sizeof(Intermediate) and sizeof(Parent) // will be in between sizeof(Intermediate) and sizeof(Parent)
uintptr_t m_padding; alignas(Base) uintptr_t m_padding;
public: public:
// the constructor that constructs the fields. // the constructor that constructs the fields.

View file

@ -157,3 +157,24 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
this->updateLoadingBar(); this->updateLoadingBar();
} }
}; };
#include <Geode/modify/PlayLayer.hpp>
struct FieldTest : Modify<FieldTest, PlayLayer> {
int field = 0x10101010;
bool init(GJGameLevel* level) {
if (!PlayLayer::init(level)) return false;
log::debug("GameManager 1 {}", GameManager::sharedState());
log::debug("PlayLayer 1 {}", PlayLayer::get());
m_fields->field += 0x20202020;
log::debug("GameManager 2 {}", GameManager::sharedState());
log::debug("PlayLayer 2 {}", PlayLayer::get());
return true;
}
void update(float dt) {
log::debug("GameManager {}", GameManager::sharedState());
log::debug("PlayLayer {}", PlayLayer::get());
PlayLayer::update(dt);
}
};

View file

@ -20,4 +20,8 @@ extern "C" [[gnu::visibility("default")]] jint JNI_OnLoad(JavaVM* vm, void* rese
return JNI_VERSION_1_1; return JNI_VERSION_1_1;
} }
extern "C" [[gnu::visibility("default")]] void emptyFunction(void*) {
// empty
}
#endif #endif

View file

@ -17,4 +17,6 @@ GEODE_MEMBER_CHECK(PlayLayer, m_bottomGround, 0x37c);
GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380); GEODE_MEMBER_CHECK(PlayLayer, m_topGround, 0x380);
GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470); GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x470);
static_assert(sizeof(GameObject) == 0x42c);
#endif #endif