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

This commit is contained in:
HJfod 2023-01-21 14:17:45 +02:00
commit 8d08ca07a0
6 changed files with 95 additions and 23 deletions
bindings
loader
include/Geode
c++stl
cocos/layers_scenes_transitions_nodes
utils
src/platform/mac
test/members

View file

@ -78,7 +78,7 @@ class AnimatedSpriteDelegate {
virtual void animationFinished(const char*) {}
}
class AppDelegate : cocos2d::CCApplication {
class AppDelegate : cocos2d::CCApplication, cocos2d::CCSceneDelegate {
void bgScale() = mac 0x3aaab0;
virtual bool applicationDidFinishLaunching() = mac 0x3aa900, win 0x3cbb0;
virtual void applicationDidEnterBackground() = mac 0x3aabe0, win 0x3cf40;
@ -4282,7 +4282,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate,
bool m_shouldSmoothCamera;
float unused_4e0;
PAD = mac 0x4, win 0x4;
cocos2d::CCObject* unknown4e8;
cocos2d::CCDrawNode* unknown4e8;
float m_camera4f0;
int unused4f4;
float m_somegroup4f8;
@ -4359,7 +4359,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate,
cocos2d::CCSprite* m_sliderGrooveSprite;
cocos2d::CCSprite* m_sliderBarSprite;
cocos2d::CCSize m_sliderSize;
void* unknown680;
int unknown680;
int m_activeGravityEffects;
int m_gravityEffectStatus; // ??
PAD = mac 0x4, win 0x4;
@ -4376,7 +4376,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate,
int unknown6b8;
int unknown6bc;
bool unk460;
bool unk461;
bool m_isAudioMeteringSupported;
cocos2d::CCDictionary* unk464;
gd::map<short, bool> unk468;
bool m_collisionDisabled;
@ -4620,7 +4620,7 @@ class PlayerObject : GameObject, AnimatedSpriteDelegate {
bool m_isHidden;
int m_hasGhostTrail;
GhostTrailEffect* m_ghostTrail;
void* m_unknown;
cocos2d::CCSprite* m_unknownSprite;
cocos2d::CCSprite* m_iconSprite;
cocos2d::CCSprite* m_iconSpriteSecondary;
cocos2d::CCSprite* m_iconSpriteWhitener;

View file

@ -1,6 +1,7 @@
#pragma once
#include <Geode/binding/GDString.hpp>
#include <cstring>
#include <string>
#include <stdexcept>
#include <utility>
@ -33,22 +34,50 @@ namespace gd {
}
public:
template <class... Params>
string(Params&&... params) {
m_data.m_pointer = 0;
string() {
m_data.m_storage[0] = 0;
m_data.m_length = 0;
m_data.m_capacity = 15;
auto val = std::string(std::forward<Params>(params)...);
(void)this->winAssign(val.c_str(), val.size());
}
string(string const& param) : string() {
(void)this->winAssign(param.c_str(), param.size());
}
string(string&& param) : string() {
(void)this->winAssign(param.c_str(), param.size());
}
string(char const* param) : string() {
(void)this->winAssign(param, std::strlen(param));
}
string(std::string const& param) : string() {
(void)this->winAssign(param.c_str(), param.size());
}
string& operator=(string const& param) {
(void)this->winAssign(param.c_str(), param.size());
return *this;
}
string& operator=(string&& param) {
(void)this->winAssign(param.c_str(), param.size());
return *this;
}
string& operator=(char const* param) {
(void)this->winAssign(param, std::strlen(param));
return *this;
}
string& operator=(std::string const& param) {
(void)this->winAssign(param.c_str(), param.size());
return *this;
}
template <class Param>
string& operator=(Param&& param) {
std::string val;
val = std::forward<Param>(param);
(void)this->winAssign(val.c_str(), val.size());
return *this;
void clear() {
(void)this->winDtor();
}
~string() {

View file

@ -36,6 +36,15 @@ NS_CC_BEGIN
* @{
*/
// geode should use the cocos2d-x-gd imo
class CCScene;
class CC_DLL CCSceneDelegate {
public:
virtual void willSwitchToScene(CCScene* scene) {}
};
/** @brief CCScene is a subclass of CCNode that is used only as an abstract concept.
CCScene an CCNode are almost identical with the difference that CCScene has it's
@ -71,8 +80,7 @@ public:
int getHighestChildZ(void);
protected:
void* m_pIDK;
CCSceneDelegate* m_pDelegate;
)
};

View file

@ -31,6 +31,11 @@ namespace geode::utils {
return new MiniFunctionState(*this);
}
};
template <class Callable, class Ret, class... Args>
concept MiniFunctionCallable = requires(Callable&& func, Args... args) {
{ func(args...) } -> std::same_as<Ret>;
};
template <class Ret, class... Args>
class MiniFunction<Ret(Args...)> {
@ -56,9 +61,7 @@ namespace geode::utils {
}
template <class Callable>
requires requires(Callable&& func, Args... args) {
{ func(args...) } -> std::same_as<Ret>;
}
requires(MiniFunctionCallable<Callable, Ret, Args...> && !std::is_same_v<std::decay_t<Callable>, MiniFunction<FunctionType>>)
MiniFunction(Callable&& func) :
m_state(new MiniFunctionState<std::decay_t<Callable>, Ret, Args...>(std::forward<Callable>(func))) {}
@ -83,4 +86,4 @@ namespace geode::utils {
return m_state;
}
};
}
}

View file

@ -2,6 +2,7 @@
#ifdef GEODE_IS_MACOS
#include <array>
#include <ghc/filesystem.hpp>
#include <Foundation/Foundation.h>

View file

@ -17,9 +17,40 @@ GEODE_MEMBER_CHECK(EditorUI, m_selectedObject, 0x440);
GEODE_MEMBER_CHECK(LevelEditorLayer, m_editorUI, 0x5d8);
GEODE_MEMBER_CHECK(LevelEditorLayer, m_level, 0x618);
// PlayLayer
GEODE_MEMBER_CHECK(PlayLayer, unknown518, 0x518);
GEODE_MEMBER_CHECK(PlayLayer, unknown5f4, 0x5f4);
GEODE_MEMBER_CHECK(PlayLayer, unknown680, 0x680);
GEODE_MEMBER_CHECK(PlayLayer, unknown6a8, 0x6a8);
GEODE_MEMBER_CHECK(PlayLayer, m_level, 0x728);
GEODE_MEMBER_CHECK(PlayLayer, m_shouldTryToKick, 0x7a8);
// GameManager
GEODE_MEMBER_CHECK(GameManager, m_playLayer, 0x180);
GEODE_MEMBER_CHECK(GameManager, m_levelEditorLayer, 0x188);
// GEODE_MEMBER_CHECK(GameManager, m_clickedGarage, 0x2a2); // todo: find why this is not 0x2a2
// GameObject
GEODE_MEMBER_CHECK(GameObject, m_baseColorID, 0x27c);
GEODE_MEMBER_CHECK(GameObject, m_detailColorID, 0x280);
GEODE_MEMBER_CHECK(GameObject, m_active, 0x2e5);
GEODE_MEMBER_CHECK(GameObject, m_baseSprite, 0x348);
GEODE_MEMBER_CHECK(GameObject, m_startPosition, 0x37c);
GEODE_MEMBER_CHECK(GameObject, m_baseColor, 0x410);
GEODE_MEMBER_CHECK(GameObject, m_groups, 0x458);
GEODE_MEMBER_CHECK(GameObject, m_effectManager, 0x4d8);
// EffectGameObject
GEODE_MEMBER_CHECK(EffectGameObject, m_duration, 0x4f0);
GEODE_MEMBER_CHECK(EffectGameObject, m_followMod, 0x530);
GEODE_MEMBER_CHECK(EffectGameObject, m_hsvValue, 0x560);
GEODE_MEMBER_CHECK(EffectGameObject, m_spawnDelay, 0x588);
GEODE_MEMBER_CHECK(EffectGameObject, m_itemBlockAID, 0x5b0);
// TeleportPortalObject
GEODE_MEMBER_CHECK(TeleportPortalObject, m_orangePortal, 0x4f8);
// StartPosObject
GEODE_MEMBER_CHECK(StartPosObject, m_levelSettings, 0x5e0);
#endif