mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-27 01:45:35 -05:00
add DS_Dictionary addresses on mac
This commit is contained in:
parent
21ee6894cf
commit
7d744a9189
8 changed files with 27 additions and 16 deletions
|
@ -964,6 +964,7 @@ class cocos2d::CCTransitionFade {
|
|||
class cocos2d::ZipUtils {
|
||||
static auto compressString(gd::string, bool, int) = mac 0xe9a50;
|
||||
static auto decompressString(gd::string, bool, int) = mac 0xea380;
|
||||
static int ccDeflateMemory(unsigned char*, unsigned int, unsigned char**) = mac 0xe9cf0;
|
||||
}
|
||||
|
||||
class cocos2d::extension::CCControl {
|
||||
|
@ -1080,10 +1081,14 @@ class cocos2d {
|
|||
static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0;
|
||||
}
|
||||
|
||||
// class DS_Dictionary {
|
||||
// DS_Dictionary() = mac 0xbe9a0;
|
||||
// int getIntegerForKey(char const*) = mac 0xc1610;
|
||||
// void setIntegerForKey(char const*, int) = mac 0xc26b0;
|
||||
// }
|
||||
class DS_Dictionary {
|
||||
DS_Dictionary() = mac 0xbe9a0;
|
||||
~DS_Dictionary() = mac 0x393c30;
|
||||
bool saveRootSubDictToString() = mac 0xc09c0;
|
||||
bool loadRootSubDictFromString(gd::string) = mac 0xbfd80;
|
||||
bool stepIntoSubDictWithKey(char const*) = mac 0xc0cd0;
|
||||
int getIntegerForKey(char const*) = mac 0xc1610;
|
||||
void setIntegerForKey(char const*, int) = mac 0xc26b0;
|
||||
}
|
||||
|
||||
// clang-format on
|
|
@ -103,7 +103,7 @@ std::string generateAddressHeader(Root& root) {
|
|||
);
|
||||
}
|
||||
else if (codegen::getStatus(field) == BindStatus::NeedsBinding) {
|
||||
if (field.parent.rfind("cocos2d::", 0) == 0 && codegen::platform == Platform::Windows) {
|
||||
if (is_cocos_class(field.parent) && codegen::platform == Platform::Windows) {
|
||||
address_str = fmt::format("base::getCocos() + 0x{:x}", codegen::platformNumber(fn->binds));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -144,7 +144,7 @@ std::string generateBindingHeader(Root& root, ghc::filesystem::path const& singl
|
|||
std::string output;
|
||||
|
||||
for (auto& cls : root.classes) {
|
||||
if (can_find(cls.name, "cocos2d"))
|
||||
if (is_cocos_class(cls.name))
|
||||
continue;
|
||||
|
||||
std::string filename = (codegen::getUnqualifiedClassName(cls.name) + ".hpp");
|
||||
|
@ -180,7 +180,7 @@ std::string generateBindingHeader(Root& root, ghc::filesystem::path const& singl
|
|||
// what.
|
||||
if (!cls.superclasses.empty()) {
|
||||
single_output += fmt::format(
|
||||
can_find(cls.superclasses[0], "cocos2d")
|
||||
is_cocos_class(cls.superclasses[0])
|
||||
? format_strings::custom_constructor_cutoff
|
||||
: format_strings::custom_constructor,
|
||||
fmt::arg("class_name", cls.name),
|
||||
|
|
|
@ -25,7 +25,7 @@ int main(int argc, char** argv) try {
|
|||
|
||||
for (auto cls : root.classes) {
|
||||
for (auto dep : cls.depends) {
|
||||
if(!can_find(dep, "cocos2d::") && std::find(root.classes.begin(), root.classes.end(), dep) == root.classes.end()) {
|
||||
if(!is_cocos_class(dep) && std::find(root.classes.begin(), root.classes.end(), dep) == root.classes.end()) {
|
||||
throw codegen::error("Class {} depends on unknown class {}", cls.name, dep);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ std::string generateModifyHeader(Root& root, ghc::filesystem::path const& single
|
|||
if (c.name.find("cocos2d::extension") != std::string::npos) {
|
||||
class_include = "#include <cocos-ext.h>";
|
||||
}
|
||||
else if (c.name.find("cocos2d") != std::string::npos) {
|
||||
else if (is_cocos_class(c.name)) {
|
||||
class_include = "#include <cocos2d.h>";
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -10,7 +10,7 @@ std::string generatePredeclareHeader(Root& root) {
|
|||
std::string output("#pragma once\n");
|
||||
|
||||
for (auto& cls : root.classes) {
|
||||
if (can_find(cls.name, "cocos2d"))
|
||||
if (is_cocos_class(cls.name))
|
||||
continue;
|
||||
|
||||
output += fmt::format(::format_strings::class_predeclare,
|
||||
|
|
|
@ -51,6 +51,10 @@ inline bool can_find(std::string const& str, char const* text) {
|
|||
return str.find(text) != std::string::npos;
|
||||
}
|
||||
|
||||
inline bool is_cocos_class(std::string const& str) {
|
||||
return can_find(str, "cocos2d") || str == "DS_Dictionary";
|
||||
}
|
||||
|
||||
enum class BindStatus {
|
||||
Binded,
|
||||
NeedsBinding,
|
||||
|
@ -112,8 +116,10 @@ namespace codegen {
|
|||
|
||||
if (fb->type == FunctionType::Normal) {
|
||||
if (field.parent.rfind("fmod::", 0) == 0) return BindStatus::Binded;
|
||||
if (field.parent.rfind("cocos2d::", 0) == 0 && p == Platform::Windows)
|
||||
return BindStatus::Binded;
|
||||
if (
|
||||
(field.parent.rfind("cocos2d::", 0) == 0 || field.parent == "DS_Dictionary") &&
|
||||
p == Platform::Windows
|
||||
) return BindStatus::Binded;
|
||||
}
|
||||
|
||||
return BindStatus::Unbindable;
|
||||
|
|
|
@ -126,7 +126,7 @@ std::string generateBindingSource(Root& root) {
|
|||
for (auto& f : c.fields) {
|
||||
if (auto i = f.get_as<InlineField>()) {
|
||||
if (codegen::platform == Platform::Mac || codegen::platform == Platform::iOS) {
|
||||
if (can_find(c.name, "cocos2d"))
|
||||
if (is_cocos_class(c.name))
|
||||
output += i->inner + "\n";
|
||||
}
|
||||
} else if (auto fn = f.get_as<OutOfLineField>()) {
|
||||
|
@ -134,7 +134,7 @@ std::string generateBindingSource(Root& root) {
|
|||
continue;
|
||||
|
||||
// no cocos2d definitions on windows
|
||||
if (codegen::platform == Platform::Windows && f.parent.rfind("cocos2d::", 0) == 0) {
|
||||
if (codegen::platform == Platform::Windows && is_cocos_class(f.parent)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ std::string generateBindingSource(Root& root) {
|
|||
continue;
|
||||
|
||||
// no cocos2d definitions on windows
|
||||
if (codegen::platform == Platform::Windows && f.parent.rfind("cocos2d::", 0) == 0) {
|
||||
if (codegen::platform == Platform::Windows && is_cocos_class(f.parent)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue