Merge branch 'main' of https://github.com/geode-sdk/sdk into main

This commit is contained in:
camila314 2022-06-04 09:57:24 -05:00
commit 9b6774a33c
10 changed files with 30 additions and 42 deletions

View file

@ -132,6 +132,7 @@ class cocos2d::CCDirector {
}
class cocos2d::CCDrawNode {
CCDrawNode() = mac 0x378b40;
auto clear() = mac 0x379e80;
static cocos2d::CCDrawNode* create() = mac 0x378d00;
auto drawPolygon(cocos2d::CCPoint*, unsigned int, cocos2d::_ccColor4F const&, float, cocos2d::_ccColor4F const&) = mac 0x3797f0;

View file

@ -2842,10 +2842,10 @@ class GameObject : CCSpritePlus {
virtual void triggerObject(GJBaseGameLayer*) = mac 0x2fa8f0, win 0x0, ios 0x0;
virtual void activateObject() = mac 0x2faf60, win 0xEF0E0, ios 0x0;
virtual void deactivateObject(bool) = mac 0x2fb8f0, win 0xd19b0, ios 0x0;
virtual cocos2d::CCRect* getObjectRect() = mac 0x3352b0, win 0xe4a40, ios 0x0;
virtual cocos2d::CCRect* getObjectRect(float, float) = mac 0x3352d0, win 0xe4a70, ios 0x0;
virtual cocos2d::CCRect* getObjectRect2(float, float) = mac 0x3354e0, win 0xe4b90, ios 0x0;
virtual cocos2d::CCRect* getObjectTextureRect() = mac 0x3355b0, win 0xe4c40, ios 0x0;
virtual cocos2d::CCRect const& getObjectRect() = mac 0x3352b0, win 0xe4a40, ios 0x0;
virtual cocos2d::CCRect getObjectRect(float, float) = mac 0x3352d0, win 0xe4a70, ios 0x0;
virtual cocos2d::CCRect getObjectRect2(float, float) = mac 0x3354e0, win 0xe4b90, ios 0x0;
virtual cocos2d::CCRect const& getObjectTextureRect() = mac 0x3355b0, win 0xe4c40, ios 0x0;
virtual cocos2d::CCPoint getRealPosition() = mac 0x335750, win 0xe4d90, ios 0x0;
virtual void setStartPos(cocos2d::CCPoint) = mac 0x2fa520, win 0xd1390, ios 0x0;
virtual void updateStartValues() = mac 0x2fa800, win 0xd1610, ios 0x0;
@ -4208,9 +4208,9 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
void bumpPlayer(float, int) = mac 0x22d890, win 0x0, ios 0x0;
void buttonDown(PlayerButton) = mac 0x22b7e0, win 0x0, ios 0x0;
void checkSnapJumpToObject(GameObject*) = mac 0x2217f0, win 0x0, ios 0x0;
void collidedWithObject(float, GameObject*) = mac 0x21d880, win 0x0, ios 0x0;
void collidedWithObject(float, GameObject*, cocos2d::CCRect) = mac 0x21f0b0, win 0x0, ios 0x0;
void collidedWithSlope(float, GameObject*, bool) = mac 0x21d8d0, win 0x0, ios 0x0;
bool collidedWithObject(float, GameObject*) = mac 0x21d880, win 0x0, ios 0x0;
bool collidedWithObject(float, GameObject*, cocos2d::CCRect) = mac 0x21f0b0, win 0x0, ios 0x0;
bool collidedWithSlope(float, GameObject*, bool) = mac 0x21d8d0, win 0x0, ios 0x0;
void convertToClosestRotation(float) = mac 0x21c860, win 0x0, ios 0x0;
void copyAttributes(PlayerObject*) = mac 0x22dc70, win 0x0, ios 0x0;
static PlayerObject* create(int, int, cocos2d::CCLayer*) = mac 0x217260, win 0x0, ios 0x0;

View file

@ -8,12 +8,12 @@ namespace { namespace format_strings {
char const* class_predeclare = "class {class_name};\n";
// requires: base_classes, class_name
char const* class_start = R"GEN(
class {class_name}{base_classes} {{
class GEODE_CODEGEN_DLL {class_name}{base_classes} {{
public:
)GEN";
char const* function_definition = R"GEN(
{docs}GEODE_CODEGEN_DLL {static}{virtual}{return_type} {function_name}({parameters}){const_whitespace}{const};
{docs}{static}{virtual}{return_type} {function_name}({parameters}){const_whitespace}{const};
)GEN";
char const* error_definition = R"GEN(
@ -24,7 +24,7 @@ public:
)GEN";
char const* structor_definition = R"GEN(
GEODE_CODEGEN_DLL {function_name}({parameters});)GEN";
{function_name}({parameters});)GEN";
// requires: type, member_name, array
char const* member_definition = R"GEN(

View file

@ -6,5 +6,6 @@
#include "syntax/InternalMacros.hpp"
#include "loader/GeodeLoader.hpp"
#include "loader/Dispatcher.hpp"
#include "loader/API.hpp"
using namespace geode::modifier;

View file

@ -498,4 +498,4 @@ namespace gd {
}
#else
namespace gd = std;
#endif
#endif

View file

@ -115,19 +115,6 @@ namespace geode {
#define GEODE_FRIEND_MODIFY GEODE_ADD(friend struct geode::modify; friend struct geode::modifier::addresses; friend struct geode::modifier::types; friend struct geode::temp_name_find_better;)
#define GEODE_ADD(...) __VA_ARGS__
/**
* For CCDestructor
*/
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#ifdef GEODE_EXPORTING
#define GEODE_CC_DLL __declspec(dllexport)
#else
#define GEODE_CC_DLL __declspec(dllimport)
#endif
#else
#define GEODE_CC_DLL __attribute__((visibility("default")))
#endif
#ifdef __cplusplus
#define NS_CC_BEGIN namespace cocos2d {
#define NS_CC_END }

View file

@ -31,7 +31,7 @@
#define CC_ZIP_DLL __declspec(dllimport)
#endif
#else
#define CC_ZIP_DLL
#define CC_ZIP_DLL __attribute__((visibility("default")))
#endif
#if (!defined(_WIN32)) && (!defined(WIN32))

View file

@ -13,7 +13,7 @@
#define CC_ZIP_DLL __declspec(dllimport)
#endif
#else
#define CC_ZIP_DLL
#define CC_ZIP_DLL __attribute__((visibility("default")))
#endif
#endif

View file

@ -1,7 +1,6 @@
#pragma once
#include "../codegen-base/Macros.hpp"
#include "../utils/include.hpp"
#include "Mod.hpp"
#include <functional>
#include <string>
@ -10,7 +9,7 @@
namespace geode {
class Dispatcher;
struct GEODE_DLL dispatch_handle {
struct dispatch_handle {
void* handle;
dispatch_handle() = delete;
@ -18,7 +17,7 @@ namespace geode {
template <typename T>
std::function<T> into() {
*reinterpret_cast<std::function<T>*>(this->handle);
return *reinterpret_cast<std::function<T>*>(this->handle);
}
template <typename R, typename ...Args>
@ -45,7 +44,7 @@ namespace geode {
};
class GEODE_DLL Dispatcher {
protected:
protected:
std::map<dispatch_handle, std::pair<std::string, Mod*>> m_dispatchMap;
std::map<std::string, std::vector<dispatch_handle>> m_selectorMap;
// 2 maps for lookup speed
@ -58,7 +57,7 @@ namespace geode {
Dispatcher() {}
public:
public:
static Dispatcher* get();
template <typename T>

View file

@ -129,19 +129,19 @@ namespace geode {
GEODE_DLL void scheduleOnLoad(loadfn_t fn);
protected:
GEODE_DLL void exportAPIFunctionInternal(std::string const& selector, unknownmemfn_t fn);
GEODE_DLL void exportAPIFunctionInternal(std::string const& selector, unknownfn_t fn);
// GEODE_DLL void exportAPIFunctionInternal(std::string const& selector, unknownmemfn_t fn);
// GEODE_DLL void exportAPIFunctionInternal(std::string const& selector, unknownfn_t fn);
public:
template <typename T>
inline void exportAPIFunction(std::string const& selector, T ptr) {
if constexpr (std::is_member_function_pointer_v<decltype(ptr)>) {
exportAPIFunctionInternal(selector, cast::reference_cast<unknownmemfn_t>(ptr));
}
else {
exportAPIFunctionInternal(selector, reinterpret_cast<unknownfn_t>(ptr));
}
}
// template <typename T>
// inline void exportAPIFunction(std::string const& selector, T ptr) {
// if constexpr (std::is_member_function_pointer_v<decltype(ptr)>) {
// exportAPIFunctionInternal(selector, cast::reference_cast<unknownmemfn_t>(ptr));
// }
// else {
// exportAPIFunctionInternal(selector, reinterpret_cast<unknownfn_t>(ptr));
// }
// }
friend Mod* Mod::get<void>();
};