This commit is contained in:
camila314 2022-06-07 16:15:45 -05:00
commit edd620c6e4
4 changed files with 75 additions and 25 deletions

View file

@ -34,12 +34,12 @@ class AchievementNotifier : cocos2d::CCNode {
AchievementBar* m_currentAchievement;
}
class AchievementsLayer {
void customSetup() = mac 0x1bdea0, win 0x0, ios 0x0;
class AchievementsLayer : GJDropDownLayer {
void customSetup() = mac 0x1bdea0, win 0x3c2f0, ios 0x0;
void loadPage(int) = mac 0x1be190, win 0x3c600, ios 0x0;
}
class AnimatedGameObject {
class AnimatedGameObject : GameObject, AnimatedSpriteDelegate, SpritePartDelegate {
void playAnimation(int) = mac 0xc93d0, win 0x0, ios 0x0;
void updateChildSpriteColor(cocos2d::_ccColor3B) = mac 0xc8450, win 0x0, ios 0x0;
}
@ -63,10 +63,14 @@ class AppDelegate : cocos2d::CCApplication {
virtual void applicationDidEnterBackground() = mac 0x3aabe0, win 0x3cf40, ios 0x0;
virtual void applicationWillEnterForeground() = mac 0x3aac80, win 0x3d130, ios 0x0;
virtual void applicationWillBecomeActive() = mac 0x3aab30, win 0x3ce90, ios 0x0;
virtual void applicationWillResignActive() = mac 0x3aab50, win 0x3d3e0, ios 0x0;
virtual void applicationWillResignActive() = mac 0x3aab50, win 0x3cf20, ios 0x0;
virtual void trySaveGame() = mac 0x3aaf10, win 0x3d5e0, ios 0x1a28f0;
virtual void willSwitchToScene(cocos2d::CCScene*) = mac 0x3aaf40, win 0x3d690, ios 0x0;
static AppDelegate* get() = mac 0x3aab10, win 0x0, ios 0x0;
bool musicTest() = mac 0x0, win 0x3d580, ios 0x0;
void pauseGame() = mac 0x0, win 0x3d3e0, ios 0x0;
void resumeSound() = mac 0x0, win 0x3d4d0, ios 0x0;
void setupGLView() = mac 0x0, win 0x3c950, ios 0x0;
cocos2d::CCScene* m_runningScene;
}
@ -74,7 +78,7 @@ class AppDelegate : cocos2d::CCApplication {
class ArtistCell : TableViewCell {
void draw() = mac 0x11c980, win 0x0, ios 0x0;
virtual bool init() = mac 0x11c7c0, win 0x0, ios 0x0;
void loadFromObject(SongInfoObject*) = mac 0x1118b0, win 0x0, ios 0x0;
void loadFromObject(SongInfoObject*) = mac 0x1118b0, win 0x5ede0, ios 0x0;
void onNewgrounds(cocos2d::CCObject*) = mac 0x11c7e0, win 0x0, ios 0x0;
void updateBGColor(int) = mac 0x110460, win 0x5c6b0, ios 0x0;
@ -570,7 +574,7 @@ class ChallengesPage {
}
class CheckpointObject : cocos2d::CCNode {
static CheckpointObject* create() = mac 0x7e7d0, win 0x0, ios 0x0;
static CheckpointObject* create() = mac 0x7e7d0, win 0x20DDD0, ios 0x0;
void getObject() = mac 0x7ef50, win 0x0, ios 0x0;
GameObject* m_gameObject;
@ -1252,9 +1256,13 @@ class EffectGameObject : GameObject {
}
static EffectGameObject* create(const char*) = mac 0xc9790, win 0x253c30, ios 0x0;
bool init(char const*) = win 0x253CD0;
void getTargetColorIndex() = mac 0xca1f0, win 0x0, ios 0x0;
virtual void triggerObject(GJBaseGameLayer*) = mac 0xc9870, win 0x253d60, ios 0x0;
gd::string getSaveString() = mac 0x0, win 0x257560, ios 0x0;
void updateSpecialColor() = win 0x254980;
void spawnXPosition() = win 0x254A00;
void triggerActivated(float) = win 0x254A30;
int targetGroup = mac 0x4F8, win 0x0, android 0x0;
bool activateGroup = mac 0x578, win 0x0, android 0x0;
@ -3115,7 +3123,7 @@ class GameSoundManager : cocos2d::CCNode {
void getMeteringValue() = mac 0x362db0, win 0x0, ios 0x0;
void playBackgroundMusic(gd::string, bool, bool) = mac 0x362070, win 0x0, ios 0x0;
void playEffect(gd::string, float, float, float) = mac 0x3623d0, win 0x25450, ios 0x0;
void stopBackgroundMusic() = mac 0x362130, win 0x0, ios 0x0;
void stopBackgroundMusic() = mac 0x362130, win 0x253A0, ios 0x0;
~GameSoundManager() = mac 0x362c00, win 0x0, ios 0x0;
static GameSoundManager* sharedManager() = mac 0x3610f0, win 0x24800, ios 0x0;
@ -3422,6 +3430,8 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate {
void objectMoved(GameObject*) = mac 0x999f0, win 0x0, ios 0x0;
void objectsInRect(cocos2d::CCRect, bool) = mac 0x95e60, win 0x0, ios 0x0;
void onPlaytest() = mac 0xa06b0, win 0x0, ios 0x0;
void onResumePlaytest() = mac 0xa15e0;
void onPausePlaytest() = mac 0xa1570;
void onStopPlaytest() = mac 0xa1780, win 0x0, ios 0x0;
void pasteAttributeState(GameObject* obj, cocos2d::CCArray* objs) = mac 0x0, win 0x16b740, ios 0x0;
void playMusic() = mac 0xa13c0, win 0x0, ios 0x0;
@ -3496,6 +3506,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate {
class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDelegate, RateLevelDelegate, LikeItemDelegate, FLAlertLayerProtocol, LevelDeleteDelegate, NumberInputDelegate, SetIDPopupDelegate {
static LevelInfoLayer* create(GJGameLevel* level) = mac 0x15f290, win 0x175d50, ios 0x0;
bool init(GJGameLevel* level) = mac 0x0, win 0x175DF0, ios 0x0;
void onGarage(cocos2d::CCObject* pSender) = mac 0x0, win 0x177c10, ios 0x0;
void onViewProfile(cocos2d::CCObject* pSender) = mac 0x0, win 0x17ac90, ios 0x0;
void onLevelInfo(cocos2d::CCObject* pSender) = mac 0x0, win 0x17acf0, ios 0x0;
@ -3698,8 +3709,10 @@ class MoreSearchLayer : FLAlertLayer {
class MoreOptionsLayer {
static MoreOptionsLayer* create() = mac 0x0, win 0x1de850, ios 0x0;
void addToggle(const char* name, const char* key, const char* info) = mac 0x0, win 0x1df6b0, ios 0x0;
void onKeybindings(cocos2d::CCObject* pSender) = mac 0x0, win 0x749d0, ios 0x0;
bool init() = mac 0x43f470;
void addToggle(const char* name, const char* key, const char* info) = mac 0x440430, win 0x1df6b0, ios 0x0;
void onKeybindings(cocos2d::CCObject* sender) = mac 0x0, win 0x749d0, ios 0x0;
void onToggle(cocos2d::CCObject* sender) = mac 0x441370;
}
class MoreVideoOptionsLayer : FLAlertLayer {
@ -3962,7 +3975,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, DialogDelegate {
void spawnParticle(char const*, int, cocos2d::tCCPositionType, cocos2d::CCPoint) = mac 0x76330, win 0x0, ios 0x0;
void spawnPlayer2() = mac 0x7d170, win 0x0, ios 0x0;
void startGame() = mac 0x726b0, win 0x0, ios 0x0;
void startMusic() = mac 0x72910, win 0x0, ios 0x0;
void startMusic() = mac 0x72910, win 0x20C8F0, ios 0x0;
void startRecording() = mac 0x7fec0, win 0x0, ios 0x0;
void startRecordingDelayed() = mac 0x7fed0, win 0x0, ios 0x0;
void stopCameraShake() = mac 0x75900, win 0x0, ios 0x0;
@ -4517,6 +4530,21 @@ class RetryLevelLayer {
static RetryLevelLayer* create() = mac 0x28dd60, win 0x0, ios 0x0;
}
class RingObject : EffectGameObject {
bool create(char const*) = mac 0x0, win 0x252220, ios 0x0;
bool init(char const*) = mac 0x0, win 0x2522E0, ios 0x0;
void spawnCircle() = win 0x2523A0;
virtual void setRotation(float) = win 0x252640;
virtual void setScale(float) = win 0x252580;
virtual void resetObject() = win 0x252560;
virtual void customObjectSetup(gd::map<gd::string, gd::string>&) = win 0x2526A0;
virtual void getSaveString() = win 0x2527F0;
virtual void powerOnObject() = win 0x252360;
virtual void powerOffObject();
virtual void setRScale(float) = win 0x2525D0;
virtual void triggerActivated(float) = win 0x252350;
}
class ScrollingLayer : cocos2d::CCLayerColor {
static ScrollingLayer* create(cocos2d::CCSize, cocos2d::CCPoint, float) = mac 0x41a900, win 0x0, ios 0x0;
}
@ -4816,6 +4844,8 @@ class SpawnTriggerAction : cocos2d::CCNode {
int m_uuid;
}
class SpritePartDelegate {}
class StartPosObject : EffectGameObject {
static StartPosObject* create() = mac 0xda7c0;

View file

@ -3,6 +3,8 @@ set(CMAKE_SYSTEM_NAME MacOS)
target_compile_options(${PROJECT_NAME} PUBLIC -fms-extensions -Wno-deprecated -Wno-ignored-attributes -Os -flto -fvisibility=internal)
set(CMAKE_OSX_ARCHITECTURES x86_64)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) # did i tell im lazy
include_directories(
${GEODE_SDK_PATH}/include/cocos/cocos2dx/platform/mac
@ -36,4 +38,4 @@ endmacro()
# TARGET ${PROJECT_NAME} POST_BUILD
# COMMAND strip -x $<TARGET_FILE:${PROJECT_NAME}>
# VERBATIM USES_TERMINAL
# )
# )

View file

@ -160,10 +160,11 @@ namespace geode {
DataStore(Mod* m, nlohmann::json& j) : m_mod(m), m_store(j) {}
friend class Mod;
public:
public:
~DataStore();
nlohmann::json& operator[](std::string const&);
DataStore& operator=(nlohmann::json&);
bool contains(std::string const&);
operator nlohmann::json();
};

View file

@ -1,5 +1,11 @@
#pragma once
#include "Traits.hpp"
#include "../platform/platform.hpp"
#ifdef GEODE_IS_WINDOWS
// for the manual virtualprotect
#include <memoryapi.h>
#endif
namespace geode::modifier {
template<typename T = void*>
@ -77,20 +83,25 @@ namespace geode::modifier {
return ret;
}
using DestructorType = void(GEODE_WINDOWS(__thiscall)*)(void* GEODE_WINDOWS(, bool));
template <typename T>
GEODE_NOINLINE inline auto& getOriginalDestructor() {
static void(*ret)(void*);
static DestructorType ret;
return ret;
}
template <typename T>
GEODE_NOINLINE inline void fieldCleanup(T* self) {{
for (auto& [mem, cont] : getAdditionalContainers<T>()[self]) {
delete cont;
}
getAdditionalContainers<T>().erase(self);
getOriginalDestructor<T>()(self);
}}
// this is beautiful
struct FieldCleanupHook {
template <typename T>
static GEODE_NOINLINE inline void GEODE_WINDOWS(__thiscall) fieldCleanup(T* self GEODE_WINDOWS(, bool arg)) {{
for (auto& [mem, cont] : getAdditionalContainers<T>()[self]) {
delete cont;
}
getAdditionalContainers<T>().erase(self);
getOriginalDestructor<T>()(self GEODE_WINDOWS(, arg));
}}
};
template <typename T, typename A>
GEODE_NOINLINE T& operator->*(A* self, field<T>& member) {
@ -102,10 +113,16 @@ namespace geode::modifier {
// on first use
if (destructor == nullptr) {
// takes the third element because all cocos classes have the destructor at third.
auto& vtableDestructor = 2[*(uintptr_t**)self]; // i love this
destructor = reinterpret_cast<void(*)(void*)>(vtableDestructor);
vtableDestructor = (uintptr_t)&fieldCleanup<A>;
// classes inheriting CCObject always have their destructor(s) as the 2nd (and 3rd on itanium) element in the vtable
// choose 3rd elemnt (the second destructor) on itanium platforms because the first one gets inlined often
static constexpr size_t index = GEODE_WINDOWS(1) GEODE_MACOS(2) GEODE_IOS(2) GEODE_ANDROID(2);
auto& vtableDestructor = index[*reinterpret_cast<uintptr_t**>(self)]; // i love this
destructor = reinterpret_cast<DestructorType>(vtableDestructor);
#ifdef GEODE_IS_WINDOWS
DWORD old;
VirtualProtect(reinterpret_cast<void*>(&vtableDestructor), sizeof(void*), PAGE_EXECUTE_READWRITE, &old);
#endif
vtableDestructor = reinterpret_cast<uintptr_t>(&FieldCleanupHook::fieldCleanup<A>);
}
if (containers[self].size() == 0) {
void* obj = new A();