mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-24 05:14:40 -04:00
Merge branch 'main' into 2.0.0-dev
This commit is contained in:
commit
08763d9600
40 changed files with 305 additions and 2334 deletions
.gitignoreCMakeLists.txt
loader
include
Geode
Enums.hpp
cocos
actions
base_nodes
cocoa
layers_scenes_transitions_nodes
menu_nodes
particle_nodes
sprite_nodes
support/zip_support
touch_dispatcher
utils
link
src
hooks
ids
AddIDs.hppCCTextInputNode.cppCreatorLayer.cppCustomSongWidget.cppCustomizeObjectLayer.cppEditLevelLayer.cppEditorPauseLayer.cppEditorUI.cppGJGarageLayer.cppLevelBrowserLayer.cppLevelInfoLayer.cppLevelSearchLayer.cppLevelSettingsLayer.cppMenuLayer.cppPauseLayer.cppUILayer.cpp
platform
test/members
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -75,3 +75,7 @@ test-docs.bat
|
|||
|
||||
# Ignore clangd cache
|
||||
.cache
|
||||
|
||||
# Add bindings folder to ignore list, so people can clone a local copy of them there
|
||||
bindings
|
||||
bindings/**
|
|
@ -117,6 +117,10 @@ target_link_libraries(GeodeFilesystemImpl PUBLIC ghc_filesystem)
|
|||
|
||||
# Allow users to have their own copy of bindings that can be overwritten with a CMake option.
|
||||
# If the option is not provided, by default just clone bindings with CPM and use that
|
||||
if (DEFINED ENV{GEODE_BINDINGS_REPO_PATH})
|
||||
set(GEODE_BINDINGS_REPO_PATH $ENV{GEODE_BINDINGS_REPO_PATH})
|
||||
endif()
|
||||
|
||||
if (NOT GEODE_BINDINGS_REPO_PATH)
|
||||
if (DEFINED ENV{GEODE_BINDINGS_REPO_PATH})
|
||||
set(GEODE_BINDINGS_REPO_PATH $ENV{GEODE_BINDINGS_REPO_PATH})
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "DefaultInclude.hpp"
|
||||
|
||||
using TodoReturn = void;
|
||||
|
||||
// thanks pie
|
||||
enum class SearchType {
|
||||
Search = 0,
|
||||
|
@ -105,12 +107,57 @@ enum class LikeItemType {
|
|||
AccountComment = 3
|
||||
};
|
||||
|
||||
enum class GJStoreItem {
|
||||
};
|
||||
enum class CommentError {
|
||||
};
|
||||
enum class BackupAccountError {
|
||||
};
|
||||
enum class GJMusicAction {};
|
||||
enum class CellAction {};
|
||||
enum class GJActionCommand {};
|
||||
enum class DifficultyIconType {};
|
||||
enum class GauntletType {};
|
||||
enum class GJMPErrorCode {};
|
||||
enum class GJTimedLevelType {};
|
||||
enum class SongSelectType {};
|
||||
enum class AudioTargetType {};
|
||||
enum class FMODReverbPreset {};
|
||||
enum class DemonDifficultyType {};
|
||||
enum class PlayerCollisionDirection {};
|
||||
enum class ChestSpriteState {};
|
||||
enum class FormatterType {};
|
||||
enum class AudioModType {};
|
||||
enum class FMODQueuedMusic {};
|
||||
enum class GJAreaActionType {};
|
||||
enum class SFXTriggerState {};
|
||||
enum class SongTriggerState {};
|
||||
enum class GJGameEvent {};
|
||||
enum class GJSmartDirection {};
|
||||
enum class SmartBlockType {};
|
||||
enum class TouchTriggerControl {};
|
||||
enum class SmartPrefabResult {};
|
||||
enum class AudioSortType {};
|
||||
enum class spriteMode {};
|
||||
enum class GJAssetType {};
|
||||
enum class CommentKeyType {};
|
||||
enum class LevelLeaderboardMode {};
|
||||
enum class StatKey {};
|
||||
enum class TextStyleType {};
|
||||
enum class InputValueType {};
|
||||
enum class GJInputStyle {};
|
||||
enum class GJDifficultyName {};
|
||||
enum class GJFeatureState {};
|
||||
enum class GJKeyGroup {};
|
||||
enum class GJKeyCommand {};
|
||||
enum class SelectSettingType {};
|
||||
enum class gjParticleValue {};
|
||||
enum class ColorSelectType {};
|
||||
enum class AudioGuidelinesType {};
|
||||
enum class SmartBrowseFilter {};
|
||||
enum class GJUITouchEvent {};
|
||||
enum class ObjectScaleType {};
|
||||
enum class SavedActiveObjectState {};
|
||||
enum class SavedSpecialObjectState {};
|
||||
enum class SavedObjectStateRef {};
|
||||
|
||||
// Thanks cocoa!
|
||||
#ifdef GEODE_IS_MACOS
|
||||
|
|
|
@ -113,6 +113,9 @@ public:
|
|||
|
||||
RT_ADD(void setSpeedMod(float mod);)
|
||||
|
||||
// 2.2 addition
|
||||
float getSpeedMod();
|
||||
|
||||
public:
|
||||
/** Create an action */
|
||||
static CCAction* create();
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
void setAmplitudeRate(float amp);
|
||||
float getAmplitudeRate(void);
|
||||
|
||||
// 2.2 addition
|
||||
bool getM_bFirstTick(); // rob were you like high on something when you wrote this
|
||||
|
||||
protected:
|
||||
float m_elapsed;
|
||||
bool m_bFirstTick;
|
||||
|
@ -941,6 +944,12 @@ public:
|
|||
virtual void update(float t);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
// 2.2 addition
|
||||
bool getRecenterChildren() const;
|
||||
bool getRecenterFrames() const;
|
||||
void setRecenterChildren(bool recenter);
|
||||
void setRecenterFrames(bool recenter);
|
||||
|
||||
public:
|
||||
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
||||
static CCAnimate* create(CCAnimation *pAnimation);
|
||||
|
|
|
@ -77,6 +77,9 @@ public:
|
|||
void update(float dt);
|
||||
CCActionInterval* reverse();
|
||||
|
||||
// 2.2 addition
|
||||
void updateTargetValue(float);
|
||||
|
||||
gd::string m_strKey;
|
||||
float m_fFrom, m_fTo;
|
||||
float m_fDelta;
|
||||
|
|
22
loader/include/Geode/cocos/base_nodes/CCNode.h
vendored
22
loader/include/Geode/cocos/base_nodes/CCNode.h
vendored
|
@ -1443,6 +1443,9 @@ public:
|
|||
RT_REMOVE( virtual CCAffineTransform nodeToParentTransform(void); )
|
||||
RT_ADD( virtual const CCAffineTransform nodeToParentTransform(void); )
|
||||
|
||||
// 2.2 additions
|
||||
virtual const CCAffineTransform nodeToParentTransformFast();
|
||||
|
||||
/**
|
||||
* Returns the matrix that transform parent's space coordinates to the node's (local) space coordinates.
|
||||
* The matrix is in Pixels.
|
||||
|
@ -1455,6 +1458,9 @@ public:
|
|||
*/
|
||||
virtual CCAffineTransform nodeToWorldTransform(void);
|
||||
|
||||
// 2.2 additions
|
||||
virtual CCAffineTransform nodeToWorldTransformFast();
|
||||
|
||||
/**
|
||||
* Returns the inverse world affine transform matrix. The matrix is in Pixels.
|
||||
*/
|
||||
|
@ -1583,6 +1589,9 @@ public:
|
|||
CCNode& operator=(const CCNode&);
|
||||
)
|
||||
|
||||
// 2.2 additions
|
||||
virtual void updateTweenActionInt(float, int);
|
||||
|
||||
private:
|
||||
/// lazy allocs
|
||||
void childrenAlloc(void);
|
||||
|
@ -1627,7 +1636,8 @@ protected:
|
|||
|
||||
CCGridBase *m_pGrid; ///< a grid
|
||||
|
||||
int m_nZOrder; ///< z-order value that affects the draw order
|
||||
// 2.2 additions
|
||||
RT_REMOVE( int m_nZOrder; ) ///< z-order value that affects the draw order
|
||||
|
||||
CCArray *m_pChildren; ///< array of children nodes
|
||||
CCNode *m_pParent; ///< weak reference to parent node
|
||||
|
@ -1641,7 +1651,8 @@ protected:
|
|||
|
||||
ccGLServerState m_eGLServerState; ///< OpenGL servier side state
|
||||
|
||||
unsigned int m_uOrderOfArrival; ///< used to preserve sequence while sorting children with the same zOrder
|
||||
// 2.2 additions
|
||||
RT_REMOVE( unsigned int m_uOrderOfArrival; ) ///< used to preserve sequence while sorting children with the same zOrder
|
||||
|
||||
CCScheduler *m_pScheduler; ///< scheduler used to schedule timers and updates
|
||||
|
||||
|
@ -1652,6 +1663,10 @@ protected:
|
|||
bool m_bTransformDirty; ///< transform dirty flag
|
||||
bool m_bInverseDirty; ///< transform dirty flag
|
||||
bool m_bAdditionalTransformDirty; ///< The flag to check whether the additional transform is dirty
|
||||
|
||||
// 2.2 additions
|
||||
PAD(10); // i dont know if this is related to transform at all, but its here
|
||||
|
||||
bool m_bVisible; ///< is this node visible
|
||||
|
||||
bool m_bIgnoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the CCNode, false otherwise.
|
||||
|
@ -1665,6 +1680,9 @@ protected:
|
|||
|
||||
CCComponentContainer *m_pComponentContainer; ///< Dictionary of components
|
||||
|
||||
// 2.2 additions
|
||||
int m_unknown; // no idea
|
||||
|
||||
};
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
|
|
11
loader/include/Geode/cocos/cocoa/CCObject.h
vendored
11
loader/include/Geode/cocos/cocoa/CCObject.h
vendored
|
@ -107,7 +107,16 @@ protected:
|
|||
unsigned int m_uAutoReleaseCount;
|
||||
|
||||
CCObjectType m_eObjType;
|
||||
int m_nUnknown;
|
||||
|
||||
int m_uIndexInArray; // used in some ccarray stuff, I don't remember what it does rn
|
||||
|
||||
// 2.2 additions
|
||||
|
||||
int m_uUnknown; // -1 by default
|
||||
int m_nZOrder; // moved from CCNode, why rob
|
||||
int m_uOrderOfArrival; // moved from CCNode, why rob
|
||||
int m_unknown4;
|
||||
int m_unknown5;
|
||||
public:
|
||||
GEODE_CUSTOM_CONSTRUCTOR_BEGIN(CCObject)
|
||||
CCObject(void);
|
||||
|
|
|
@ -186,6 +186,10 @@ public:
|
|||
RT_ADD(
|
||||
void keyDown(enumKeyCodes);
|
||||
)
|
||||
|
||||
// 2.2 additions
|
||||
virtual void setPreviousPriority(int);
|
||||
virtual int getPreviousPriority();
|
||||
|
||||
inline CCTouchScriptHandlerEntry* getScriptTouchHandlerEntry() { return m_pScriptTouchHandlerEntry; };
|
||||
inline CCScriptHandlerEntry* getScriptKeypadHandlerEntry() { return m_pScriptKeypadHandlerEntry; };
|
||||
|
@ -207,6 +211,9 @@ private:
|
|||
|
||||
int m_nTouchPriority;
|
||||
ccTouchesMode m_eTouchMode;
|
||||
|
||||
// 2.2 additions
|
||||
int m_uPreviousPriority; // no idea
|
||||
|
||||
int excuteScriptTouchHandler(int nEventType, CCTouch *pTouch);
|
||||
int excuteScriptTouchHandler(int nEventType, CCSet *pTouches);
|
||||
|
|
|
@ -115,6 +115,9 @@ public:
|
|||
CCObject* m_pListener;
|
||||
SEL_MenuHandler m_pfnSelector;
|
||||
int m_nScriptTapHandler;
|
||||
|
||||
// 2.2 additions
|
||||
int m_unknown;
|
||||
};
|
||||
|
||||
/** @brief An abstract class for "label" CCMenuItemLabel items
|
||||
|
|
|
@ -33,6 +33,11 @@ NS_CC_BEGIN
|
|||
|
||||
class CCSpriteFrame;
|
||||
|
||||
// 2.2 additions
|
||||
struct ParticleStruct {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @addtogroup particle_nodes
|
||||
* @{
|
||||
|
|
|
@ -569,7 +569,8 @@ protected:
|
|||
CC_SYNTHESIZE_NV(float, m_fBrVertexMod, BrVertexMod);
|
||||
PAD(16);
|
||||
bool m_bUnknown;
|
||||
int m_nUnknown;
|
||||
// 2.2 additions
|
||||
// int m_nUnknown;
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -149,17 +149,17 @@ namespace cocos2d
|
|||
*/
|
||||
static void ccSetPvrEncryptionKey(unsigned int keyPart1, unsigned int keyPart2, unsigned int keyPart3, unsigned int keyPart4);
|
||||
|
||||
static gd::string base64DecodeEnc(gd::string, gd::string);
|
||||
static gd::string base64EncodeEnc(gd::string, gd::string);
|
||||
static gd::string base64URLDecode(gd::string);
|
||||
static gd::string base64URLEncode(gd::string);
|
||||
static gd::string base64DecodeEnc(gd::string const&, gd::string);
|
||||
static gd::string base64EncodeEnc(gd::string const&, gd::string);
|
||||
static gd::string base64URLDecode(gd::string const&);
|
||||
static gd::string base64URLEncode(gd::string const&);
|
||||
static int ccDeflateMemory(unsigned char*, unsigned int, unsigned char**);
|
||||
static int ccDeflateMemoryWithHint(unsigned char*, unsigned int, unsigned char**, unsigned int);
|
||||
static gd::string compressString(gd::string, bool, int);
|
||||
static gd::string decompressString(gd::string, bool, int);
|
||||
static gd::string compressString(gd::string const&, bool, int);
|
||||
static gd::string decompressString(gd::string const&, bool, int);
|
||||
static gd::string decompressString2(unsigned char*, bool, int, int);
|
||||
static gd::string encryptDecrypt(gd::string, int);
|
||||
static gd::string encryptDecryptWKey(gd::string, gd::string);
|
||||
static gd::string encryptDecrypt(gd::string const&, int);
|
||||
static gd::string encryptDecryptWKey(gd::string const&, gd::string);
|
||||
static unsigned char hexToChar(const gd::string&);
|
||||
static gd::string urlDecode(const gd::string&);
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ public:
|
|||
*/
|
||||
CCTouchHandler* findHandler(CCTouchDelegate *pDelegate);
|
||||
|
||||
private:
|
||||
RT_ADD(
|
||||
void incrementForcePrio(int priority);
|
||||
void decrementForcePrio(int priority);
|
||||
|
|
109
loader/include/Geode/utils/NodeIDs.hpp
Normal file
109
loader/include/Geode/utils/NodeIDs.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
#include "cocos.hpp"
|
||||
|
||||
namespace geode::node_ids {
|
||||
using namespace cocos2d;
|
||||
|
||||
static constexpr int32_t GEODE_ID_PRIORITY = 0x100000;
|
||||
|
||||
template <class T = CCNode>
|
||||
requires std::is_base_of_v<CCNode, T>
|
||||
T* setIDSafe(CCNode* node, int index, char const* id) {
|
||||
if constexpr (std::is_same_v<CCNode, T>) {
|
||||
if (auto child = cocos::getChild(node, index)) {
|
||||
child->setID(id);
|
||||
return child;
|
||||
}
|
||||
} else {
|
||||
if (auto child = cocos::getChildOfType<T>(node, index)) {
|
||||
child->setID(id);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename ...Args>
|
||||
void setIDs(CCNode* node, int startIndex, Args... args) {
|
||||
for (auto i : { args... }) {
|
||||
setIDSafe(node, startIndex, i);
|
||||
++startIndex;
|
||||
}
|
||||
}
|
||||
|
||||
static void switchToMenu(CCNode* node, CCNode* menu) {
|
||||
if (!node || !menu) return;
|
||||
|
||||
auto worldPos = node->getParent() ?
|
||||
node->getParent()->convertToWorldSpace(node->getPosition()) :
|
||||
node->getPosition();
|
||||
|
||||
node->retain();
|
||||
node->removeFromParent();
|
||||
node->setZOrder(0);
|
||||
|
||||
menu->addChild(node);
|
||||
node->setPosition(menu->convertToNodeSpace(worldPos));
|
||||
}
|
||||
|
||||
static void switchChildToMenu(CCNode* parent, int idx, CCNode* menu) {
|
||||
switchToMenu(static_cast<CCNode*>(parent->getChildren()->objectAtIndex(idx)), menu);
|
||||
}
|
||||
|
||||
template <typename ...Args>
|
||||
static void switchChildrenToMenu(CCNode* parent, CCNode* menu, Args... args) {
|
||||
for (auto i : { args... }) {
|
||||
switchChildToMenu(parent, i, menu);
|
||||
}
|
||||
}
|
||||
|
||||
template <class N, typename T, typename... Args>
|
||||
static N* detachAndCreateNode(
|
||||
CCNode* parent, char const* menuID, Layout* layout, T first, Args... args
|
||||
) {
|
||||
if (!first) {
|
||||
auto menu = N::create();
|
||||
menu->setID(menuID);
|
||||
menu->setLayout(layout);
|
||||
parent->addChild(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
auto oldMenu = first->getParent();
|
||||
|
||||
first->retain();
|
||||
first->removeFromParent();
|
||||
|
||||
auto newMenu = N::create();
|
||||
newMenu->setPosition(parent->convertToNodeSpace(oldMenu->convertToWorldSpace(first->getPosition())));
|
||||
newMenu->setID(menuID);
|
||||
newMenu->setZOrder(oldMenu->getZOrder());
|
||||
parent->addChild(newMenu);
|
||||
|
||||
first->setPosition(0, 0);
|
||||
first->setZOrder(0);
|
||||
newMenu->addChild(first);
|
||||
first->release();
|
||||
|
||||
(switchToMenu(args, newMenu), ...);
|
||||
|
||||
newMenu->setLayout(layout);
|
||||
|
||||
return newMenu;
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static CCMenu* detachAndCreateMenu(
|
||||
CCNode* parent, char const* menuID, Layout* layout, T first, Args... args
|
||||
) {
|
||||
return detachAndCreateNode<CCMenu>(parent, menuID, layout, first, args...);
|
||||
}
|
||||
|
||||
static CCSize getSizeSafe(CCNode* node) {
|
||||
if (node) {
|
||||
return node->getScaledContentSize();
|
||||
}
|
||||
else {
|
||||
return CCSizeZero;
|
||||
}
|
||||
}
|
||||
}
|
BIN
loader/include/link/android/libcocos2dcpp.so
Normal file → Executable file
BIN
loader/include/link/android/libcocos2dcpp.so
Normal file → Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,10 +1,11 @@
|
|||
|
||||
#include "../ids/AddIDs.hpp"
|
||||
#include "../ui/internal/list/ModListLayer.hpp"
|
||||
|
||||
#include <Geode/loader/Index.hpp>
|
||||
#include <Geode/modify/MenuLayer.hpp>
|
||||
#include <Geode/modify/Modify.hpp>
|
||||
#include <Geode/modify/IDManager.hpp>
|
||||
#include <Geode/utils/NodeIDs.hpp>
|
||||
#include <Geode/ui/BasedButtonSprite.hpp>
|
||||
#include <Geode/ui/GeodeUI.hpp>
|
||||
#include <Geode/ui/Notification.hpp>
|
||||
|
@ -45,7 +46,7 @@ $execute {
|
|||
|
||||
struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("MenuLayer::init", GEODE_ID_PRIORITY)) {
|
||||
if (!self.setHookPriority("MenuLayer::init", geode::node_ids::GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set MenuLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#include <Geode/modify/GJBaseGameLayer.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
struct PickupTriggerFix : Modify<PickupTriggerFix, GJBaseGameLayer> {
|
||||
void collectItem(int item, int count) {
|
||||
item = std::clamp(item, 0, 1099);
|
||||
GJBaseGameLayer::collectItem(item, count);
|
||||
}
|
||||
|
||||
void collectedObject(EffectGameObject* object) {
|
||||
object->m_itemBlockAID = std::clamp(object->m_itemBlockAID, 0, 1099);
|
||||
GJBaseGameLayer::collectedObject(object);
|
||||
}
|
||||
};
|
|
@ -1,110 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
static constexpr int32_t GEODE_ID_PRIORITY = 0x100000;
|
||||
|
||||
template <class T = CCNode>
|
||||
requires std::is_base_of_v<CCNode, T>
|
||||
T* setIDSafe(CCNode* node, int index, char const* id) {
|
||||
if constexpr (std::is_same_v<CCNode, T>) {
|
||||
if (auto child = getChild(node, index)) {
|
||||
child->setID(id);
|
||||
return child;
|
||||
}
|
||||
} else {
|
||||
if (auto child = getChildOfType<T>(node, index)) {
|
||||
child->setID(id);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename ...Args>
|
||||
void setIDs(CCNode* node, int startIndex, Args... args) {
|
||||
for (auto i : { args... }) {
|
||||
setIDSafe(node, startIndex, i);
|
||||
++startIndex;
|
||||
}
|
||||
}
|
||||
|
||||
static void switchToMenu(CCNode* node, CCNode* menu) {
|
||||
if (!node || !menu) return;
|
||||
|
||||
auto worldPos = node->getParent() ?
|
||||
node->getParent()->convertToWorldSpace(node->getPosition()) :
|
||||
node->getPosition();
|
||||
|
||||
node->retain();
|
||||
node->removeFromParent();
|
||||
node->setZOrder(0);
|
||||
|
||||
menu->addChild(node);
|
||||
node->setPosition(menu->convertToNodeSpace(worldPos));
|
||||
}
|
||||
|
||||
static void switchChildToMenu(CCNode* parent, int idx, CCNode* menu) {
|
||||
switchToMenu(static_cast<CCNode*>(parent->getChildren()->objectAtIndex(idx)), menu);
|
||||
}
|
||||
|
||||
template <typename ...Args>
|
||||
static void switchChildrenToMenu(CCNode* parent, CCNode* menu, Args... args) {
|
||||
for (auto i : { args... }) {
|
||||
switchChildToMenu(parent, i, menu);
|
||||
}
|
||||
}
|
||||
|
||||
template <class N, typename T, typename... Args>
|
||||
static N* detachAndCreateNode(
|
||||
CCNode* parent, char const* menuID, Layout* layout, T first, Args... args
|
||||
) {
|
||||
if (!first) {
|
||||
auto menu = N::create();
|
||||
menu->setID(menuID);
|
||||
menu->setLayout(layout);
|
||||
parent->addChild(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
auto oldMenu = first->getParent();
|
||||
|
||||
first->retain();
|
||||
first->removeFromParent();
|
||||
|
||||
auto newMenu = N::create();
|
||||
newMenu->setPosition(parent->convertToNodeSpace(oldMenu->convertToWorldSpace(first->getPosition())));
|
||||
newMenu->setID(menuID);
|
||||
newMenu->setZOrder(oldMenu->getZOrder());
|
||||
parent->addChild(newMenu);
|
||||
|
||||
first->setPosition(0, 0);
|
||||
first->setZOrder(0);
|
||||
newMenu->addChild(first);
|
||||
first->release();
|
||||
|
||||
(switchToMenu(args, newMenu), ...);
|
||||
|
||||
newMenu->setLayout(layout);
|
||||
|
||||
return newMenu;
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static CCMenu* detachAndCreateMenu(
|
||||
CCNode* parent, char const* menuID, Layout* layout, T first, Args... args
|
||||
) {
|
||||
return detachAndCreateNode<CCMenu>(parent, menuID, layout, first, args...);
|
||||
}
|
||||
|
||||
static CCSize getSizeSafe(CCNode* node) {
|
||||
if (node) {
|
||||
return node->getScaledContentSize();
|
||||
}
|
||||
else {
|
||||
return CCSizeZero;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
#include <Geode/modify/CCTextInputNode.hpp>
|
||||
|
||||
// This doesn't actually add any IDs since those aren't needed for
|
||||
// CCTextInputNode where everything is accessible through members.
|
||||
// This is to fix the effects of the epic mistake of Cocos2d inventing
|
||||
// ignoreAnchorPointForPosition which causes the content size of
|
||||
// text input nodes to be way off
|
||||
|
||||
struct $modify(CCTextInputNode) {
|
||||
bool init(float width, float height, const char* caption, const char* thonburi, int maxCharCount, const char* font) {
|
||||
if (!CCTextInputNode::init(width, height, caption, thonburi, maxCharCount, font))
|
||||
return false;
|
||||
|
||||
this->ignoreAnchorPointForPosition(false);
|
||||
this->fixPosition();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void fixPosition() {
|
||||
if (!m_bIgnoreAnchorPointForPosition && m_placeholderLabel) {
|
||||
this->setAnchorPoint(m_placeholderLabel->getAnchorPoint());
|
||||
m_placeholderLabel->setPosition(m_obContentSize * m_obAnchorPoint);
|
||||
}
|
||||
}
|
||||
|
||||
void updateLabel(gd::string text) {
|
||||
CCTextInputNode::updateLabel(text);
|
||||
this->fixPosition();
|
||||
}
|
||||
};
|
|
@ -1,137 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/CreatorLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
template<class... Args>
|
||||
static void reorderButtons(Args... args) {
|
||||
int ooa = 0;
|
||||
for (auto& arg : { args... }) {
|
||||
if (arg) {
|
||||
arg->setOrderOfArrival(ooa);
|
||||
ooa += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$register_ids(CreatorLayer) {
|
||||
setIDSafe<CCSprite>(this, 0, "background");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("creator-buttons-menu");
|
||||
|
||||
// move vault button to its own menu
|
||||
if (auto lockBtn = setIDSafe(menu, -2, "vault-button")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"top-right-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
lockBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 150.f / 2 +
|
||||
lockBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 150.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
|
||||
// move treasure room button to its own menu
|
||||
if (auto roomBtn = setIDSafe(menu, -1, "treasure-room-button")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"bottom-right-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
roomBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 125.f / 2 -
|
||||
roomBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
|
||||
// row order is inverted because of layout
|
||||
|
||||
reorderButtons(
|
||||
setIDSafe(menu, 6, "featured-button"),
|
||||
setIDSafe(menu, 7, "hall-of-fame-button"),
|
||||
setIDSafe(menu, 8, "map-packs-button"),
|
||||
|
||||
setIDSafe(menu, 9, "search-button"),
|
||||
setIDSafe(menu, 3, "quests-button"),
|
||||
setIDSafe(menu, 4, "daily-button"),
|
||||
setIDSafe(menu, 5, "weekly-button"),
|
||||
|
||||
setIDSafe(menu, 10, "gauntlets-button"),
|
||||
setIDSafe(menu, 0, "create-button"),
|
||||
setIDSafe(menu, 1, "saved-button"),
|
||||
setIDSafe(menu, 2, "scores-button")
|
||||
);
|
||||
|
||||
if (winSize.width / winSize.height <= 5.1f / 3.f) {
|
||||
menu->setContentSize({ winSize.width - 80.f, 310.f });
|
||||
}
|
||||
else {
|
||||
menu->setContentSize({ winSize.width - 120.f, 310.f });
|
||||
}
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setGap(12.f)
|
||||
->setCrossAxisReverse(true)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
);
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("exit-menu");
|
||||
auto exitBtn = setIDSafe(menu, 0, "exit-button");
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 125.f / 2 +
|
||||
getSizeSafe(exitBtn).height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
}
|
||||
|
||||
// add a menu to the bottom left corner that is empty but prolly a place mods
|
||||
// want to add stuff to
|
||||
auto menu = CCMenu::create();
|
||||
menu->setPosition(24.f, 0.f + 125.f / 2);
|
||||
menu->setID("bottom-left-menu");
|
||||
menu->setContentSize({ 60.f, 125.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
this->addChild(menu);
|
||||
}
|
||||
|
||||
struct CreatorLayerIDs : Modify<CreatorLayerIDs, CreatorLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("CreatorLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set CreatorLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init() {
|
||||
if (!CreatorLayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/CustomSongWidget.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(CustomSongWidget) {
|
||||
setIDSafe<CCScale9Sprite>(this, 0, "bg");
|
||||
setIDSafe<CCSprite>(this, 0, "loading-bar");
|
||||
setIDSafe<CCLabelBMFont>(this, 0, "song-name-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 1, "author-name-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 2, "id-and-size-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 3, "error-label");
|
||||
setIDSafe<CCMenu>(this, 0, "buttons-menu");
|
||||
auto customSongWidgetMenu = this->getChildByID("buttons-menu");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 0, "download-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 1, "cancel-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 2, "use-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 3, "refresh-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 4, "play-song-button");
|
||||
setIDSafe<CCMenuItemSpriteExtra>(customSongWidgetMenu, 5, "more-button");
|
||||
};
|
||||
|
||||
struct CustomSongWidgetIDs : Modify<CustomSongWidgetIDs, CustomSongWidget> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("CustomSongWidget::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set CustomSongWidget::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(SongInfoObject* s, LevelSettingsObject* l, bool b1, bool b2, bool b3, bool b4, bool hideBackground) {
|
||||
if (!CustomSongWidget::init(s, l, b1, b2, b3, b4, hideBackground)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,330 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/modify/CustomizeObjectLayer.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(CustomizeObjectLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
setIDs(
|
||||
m_mainLayer, 0,
|
||||
"alert-bg",
|
||||
"title-label",
|
||||
"button-menu",
|
||||
"selected-channel-label",
|
||||
"channel-input-bg",
|
||||
"channel-input",
|
||||
"text-input-bg",
|
||||
"text-input",
|
||||
"glow-label"
|
||||
);
|
||||
|
||||
m_buttonMenu->setID("ok-menu");
|
||||
|
||||
setIDs(
|
||||
m_buttonMenu,
|
||||
0,
|
||||
"ok-button",
|
||||
"info-button",
|
||||
// 2
|
||||
"base-tab-button",
|
||||
"detail-tab-button",
|
||||
"base-hsv-button",
|
||||
"detail-hsv-button",
|
||||
"text-tab-button",
|
||||
// 7
|
||||
"player-color-1-button",
|
||||
"player-color-2-button",
|
||||
"light-bg-button",
|
||||
"default-button",
|
||||
"channel-1-button",
|
||||
"channel-2-button",
|
||||
"channel-3-button",
|
||||
"channel-4-button",
|
||||
"channel-5-button",
|
||||
"channel-6-button",
|
||||
"channel-7-button",
|
||||
"channel-8-button",
|
||||
"channel-9-button",
|
||||
"channel-custom-button",
|
||||
// 21
|
||||
"select-channel-up-button",
|
||||
"select-channel-down-button",
|
||||
"select-channel-button",
|
||||
// 24
|
||||
"split-text-button",
|
||||
"clear-text-button",
|
||||
// 26
|
||||
"next-free-button"
|
||||
// 27
|
||||
);
|
||||
|
||||
if (m_targetObject) {
|
||||
setIDs(
|
||||
m_buttonMenu,
|
||||
27,
|
||||
"copy-button",
|
||||
"paste-button",
|
||||
|
||||
"browse-button",
|
||||
|
||||
"glow-toggle"
|
||||
);
|
||||
}
|
||||
else {
|
||||
setIDs(
|
||||
m_buttonMenu,
|
||||
27,
|
||||
"browse-button",
|
||||
|
||||
"glow-toggle"
|
||||
);
|
||||
}
|
||||
|
||||
auto tabsLayout = RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center);
|
||||
tabsLayout->ignoreInvisibleChildren(true);
|
||||
auto tabsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"tabs-menu",
|
||||
tabsLayout,
|
||||
m_buttonMenu->getChildByID("base-tab-button"),
|
||||
m_buttonMenu->getChildByID("detail-tab-button"),
|
||||
SpacerNode::create(),
|
||||
m_buttonMenu->getChildByID("text-tab-button")
|
||||
);
|
||||
tabsMenu->setContentSize({ 360.f, 50.f });
|
||||
tabsMenu->setPositionX(winSize.width / 2);
|
||||
tabsMenu->updateLayout();
|
||||
|
||||
auto specialChannelsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"special-channels-menu",
|
||||
RowLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center)
|
||||
->setGap(14.f),
|
||||
m_buttonMenu->getChildByID("player-color-1-button"),
|
||||
m_buttonMenu->getChildByID("player-color-2-button"),
|
||||
m_buttonMenu->getChildByID("light-bg-button"),
|
||||
m_buttonMenu->getChildByID("default-button")
|
||||
);
|
||||
specialChannelsMenu->setContentSize({ 350.f, 50.f });
|
||||
specialChannelsMenu->setPositionX(winSize.width / 2);
|
||||
specialChannelsMenu->updateLayout();
|
||||
|
||||
auto channelsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"channels-menu",
|
||||
RowLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center)
|
||||
->setGap(20.f),
|
||||
m_buttonMenu->getChildByID("channel-1-button"),
|
||||
m_buttonMenu->getChildByID("channel-2-button"),
|
||||
m_buttonMenu->getChildByID("channel-3-button"),
|
||||
m_buttonMenu->getChildByID("channel-4-button"),
|
||||
m_buttonMenu->getChildByID("channel-5-button"),
|
||||
m_buttonMenu->getChildByID("channel-6-button"),
|
||||
m_buttonMenu->getChildByID("channel-7-button"),
|
||||
m_buttonMenu->getChildByID("channel-8-button"),
|
||||
m_buttonMenu->getChildByID("channel-9-button"),
|
||||
m_buttonMenu->getChildByID("channel-custom-button")
|
||||
);
|
||||
channelsMenu->setContentSize({ 350.f, 100.f });
|
||||
channelsMenu->setPosition(winSize.width / 2, winSize.height / 2 - 25.f);
|
||||
channelsMenu->updateLayout();
|
||||
|
||||
auto selectedChannelMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"selected-channel-menu",
|
||||
nullptr,
|
||||
m_buttonMenu->getChildByID("select-channel-button"),
|
||||
m_mainLayer->getChildByID("selected-channel-label")
|
||||
);
|
||||
selectedChannelMenu->setContentSize({ 120.f, 40.f });
|
||||
selectedChannelMenu->setPosition(
|
||||
winSize.width / 2 + 110.f,
|
||||
winSize.height / 2 - 90.f
|
||||
);
|
||||
if (auto label = selectedChannelMenu->getChildByID("selected-channel-label")) {
|
||||
label->setPosition(75.f, 20.f);
|
||||
}
|
||||
if (auto button = selectedChannelMenu->getChildByID("select-channel-button")) {
|
||||
button->setPosition(100.f, 20.f);
|
||||
}
|
||||
|
||||
auto togglesMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"toggles-menu",
|
||||
nullptr,
|
||||
m_mainLayer->getChildByID("glow-label"),
|
||||
m_buttonMenu->getChildByID("glow-toggle")
|
||||
);
|
||||
togglesMenu->setContentSize({ 75.f, 120.f });
|
||||
togglesMenu->setPosition(55.f, 90.f);
|
||||
if (auto label = togglesMenu->getChildByID("glow-label")) {
|
||||
label->setPosition(57.f, 20.f);
|
||||
}
|
||||
if (auto toggle = togglesMenu->getChildByID("glow-toggle")) {
|
||||
toggle->setPosition(57.f, 5.f);
|
||||
}
|
||||
|
||||
auto baseHSVMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"base-hsv-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
m_buttonMenu->getChildByID("base-hsv-button")
|
||||
);
|
||||
baseHSVMenu->setContentSize({ 80.f, 60.f });
|
||||
baseHSVMenu->setPositionX(winSize.width / 2 - 132.5f);
|
||||
baseHSVMenu->updateLayout();
|
||||
|
||||
auto detailHSVMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"detail-hsv-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
m_buttonMenu->getChildByID("detail-hsv-button")
|
||||
);
|
||||
detailHSVMenu->setContentSize({ 80.f, 60.f });
|
||||
detailHSVMenu->setPositionX(baseHSVMenu->getPositionX());
|
||||
detailHSVMenu->updateLayout();
|
||||
|
||||
auto nextFreeMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"next-free-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
m_buttonMenu->getChildByID("next-free-button")
|
||||
);
|
||||
nextFreeMenu->setContentSize({ 120.f, 60.f });
|
||||
nextFreeMenu->setPositionX(winSize.width / 2 - 110.f);
|
||||
nextFreeMenu->updateLayout();
|
||||
|
||||
auto textActionsMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"text-actions-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("split-text-button")
|
||||
);
|
||||
textActionsMenu->setContentSize({ 120.f, 60.f });
|
||||
textActionsMenu->setPositionX(winSize.width / 2 + 110.f);
|
||||
textActionsMenu->updateLayout();
|
||||
|
||||
auto clearTextMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"clear-text-menu",
|
||||
nullptr,
|
||||
m_buttonMenu->getChildByID("clear-text-button")
|
||||
);
|
||||
|
||||
auto infoMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"info-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("info-button")
|
||||
);
|
||||
infoMenu->setContentSize({ 80.f, 60.f });
|
||||
infoMenu->setPosition(winSize.width / 2 + 132.5f, baseHSVMenu->getPositionY());
|
||||
infoMenu->updateLayout();
|
||||
|
||||
auto browseMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"browse-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("browse-button")
|
||||
);
|
||||
browseMenu->setContentSize({ 100.f, 140.f });
|
||||
browseMenu->setPositionY(winSize.height / 2 - 70.f);
|
||||
browseMenu->updateLayout();
|
||||
|
||||
auto copyPasteMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"copy-paste-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true),
|
||||
m_buttonMenu->getChildByID("copy-button"),
|
||||
m_buttonMenu->getChildByID("paste-button")
|
||||
);
|
||||
copyPasteMenu->setContentSize({ 100.f, 140.f });
|
||||
copyPasteMenu->setPositionY(winSize.height / 2 + 100.f);
|
||||
copyPasteMenu->updateLayout();
|
||||
|
||||
auto selectChannelMenu = detachAndCreateMenu(
|
||||
m_mainLayer,
|
||||
"select-channel-menu",
|
||||
nullptr,
|
||||
m_buttonMenu->getChildByID("select-channel-up-button"),
|
||||
m_buttonMenu->getChildByID("select-channel-down-button")
|
||||
);
|
||||
selectChannelMenu->setPosition(m_customColorInputBG->getPosition());
|
||||
selectChannelMenu->setContentSize({ 60.f, 140.f });
|
||||
if (auto btn = selectChannelMenu->getChildByID("select-channel-up-button")) {
|
||||
btn->setPosition({ 30.f, 110.f });
|
||||
}
|
||||
if (auto btn = selectChannelMenu->getChildByID("select-channel-down-button")) {
|
||||
btn->setPosition({ 30.f, 30.f });
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomizeObjectLayerIDs : Modify<CustomizeObjectLayerIDs, CustomizeObjectLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("CustomizeObjectLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set CustomizeObjectLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
void toggleMenuIf(const char* id, int mode) {
|
||||
if (auto menu = m_mainLayer->getChildByID(id)) {
|
||||
menu->setVisible(m_selectedMode == mode);
|
||||
}
|
||||
}
|
||||
|
||||
void toggleMenuIfNot(const char* id, int mode) {
|
||||
if (auto menu = m_mainLayer->getChildByID(id)) {
|
||||
menu->setVisible(m_selectedMode != mode);
|
||||
}
|
||||
}
|
||||
|
||||
void toggleVisible() {
|
||||
CustomizeObjectLayer::toggleVisible();
|
||||
// have to manually toggle menu visibility to allow touches being correctly passed
|
||||
this->toggleMenuIf("base-hsv-menu", 1);
|
||||
this->toggleMenuIf("detail-hsv-menu", 2);
|
||||
this->toggleMenuIf("text-actions-menu", 3);
|
||||
this->toggleMenuIf("clear-text-menu", 3);
|
||||
this->toggleMenuIfNot("next-free-menu", 3);
|
||||
this->toggleMenuIfNot("toggles-menu", 3);
|
||||
this->toggleMenuIfNot("channels-menu", 3);
|
||||
this->toggleMenuIfNot("special-channels-menu", 3);
|
||||
this->toggleMenuIfNot("selected-channel-menu", 3);
|
||||
this->toggleMenuIfNot("browse-menu", 3);
|
||||
this->toggleMenuIfNot("copy-paste-menu", 3);
|
||||
this->toggleMenuIfNot("select-channel-menu", 3);
|
||||
}
|
||||
|
||||
bool init(GameObject* obj, CCArray* objs) {
|
||||
if (!CustomizeObjectLayer::init(obj, objs))
|
||||
return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
this->toggleVisible();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,126 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/EditLevelLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
#include <Geode/ui/BasedButtonSprite.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(EditLevelLayer) {
|
||||
setIDs(
|
||||
this,
|
||||
0,
|
||||
"background",
|
||||
"bottom-left-art",
|
||||
"bottom-right-art",
|
||||
"level-name-background",
|
||||
"level-name-input",
|
||||
"description-background",
|
||||
"description-input",
|
||||
"description-text-area",
|
||||
"level-edit-menu",
|
||||
"level-length",
|
||||
"level-song",
|
||||
"level-verified",
|
||||
"version-label",
|
||||
"level-id-label",
|
||||
"level-actions-menu",
|
||||
"back-menu",
|
||||
"info-button-menu"
|
||||
);
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
auto descBG = this->getChildByID("description-background");
|
||||
|
||||
auto descMenu = CCMenu::create();
|
||||
descMenu->setID("description-menu");
|
||||
descMenu->setLayout(ColumnLayout::create());
|
||||
descMenu->setPosition(
|
||||
descBG->getPositionX() - descBG->getScaledContentSize().width / 2 - 35.f,
|
||||
descBG->getPositionY()
|
||||
);
|
||||
descMenu->setContentSize({ 40.f, 80.f });
|
||||
this->addChild(descMenu);
|
||||
|
||||
if (auto menu = this->getChildByID("level-edit-menu")) {
|
||||
setIDs(menu, 0, "edit-button", "play-button", "share-button");
|
||||
if (menu->getChildrenCount() == 4) {
|
||||
auto btn = static_cast<CCNode*>(menu->getChildren()->objectAtIndex(3));
|
||||
btn->setID("update-desc-button");
|
||||
btn->retain();
|
||||
btn->removeFromParent();
|
||||
descMenu->addChild(btn);
|
||||
btn->release();
|
||||
descMenu->updateLayout();
|
||||
}
|
||||
menu->setContentSize({ winSize.width - 160.f, 100.f });
|
||||
menu->setLayout(RowLayout::create()->setGap(25.f));
|
||||
}
|
||||
|
||||
if (auto menu = this->getChildByID("level-actions-menu")) {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"delete-button",
|
||||
"help-button",
|
||||
"duplicate-button",
|
||||
"move-to-top-button",
|
||||
"folder-button"
|
||||
);
|
||||
|
||||
auto folderMenu = detachAndCreateMenu(
|
||||
this, "folder-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("folder-button")
|
||||
);
|
||||
folderMenu->setContentSize({ 50.f, 215.f });
|
||||
folderMenu->updateLayout();
|
||||
|
||||
menu->setPosition(
|
||||
menu->getPositionX() + static_cast<CCNode*>(
|
||||
menu->getChildren()->firstObject()
|
||||
)->getPositionX(),
|
||||
winSize.height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, winSize.height - 15.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(7.f)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
menu->setZOrder(1);
|
||||
}
|
||||
|
||||
if (auto menu = this->getChildByID("back-menu")) {
|
||||
auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
|
||||
if (auto menu = this->getChildByID("info-button-menu")) setIDSafe(menu, 0, "info-button");
|
||||
}
|
||||
|
||||
struct EditLevelLayerIDs : Modify<EditLevelLayerIDs, EditLevelLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("EditLevelLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set EditLevelLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(GJGameLevel* l) {
|
||||
if (!EditLevelLayer::init(l)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,274 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/modify/EditorPauseLayer.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
// special class for this because making it a CCMenuItemToggler would be very UB
|
||||
// (not gonna reinterpret_cast that into the members)
|
||||
class GuidelinesButton : public CCMenuItemSpriteExtra {
|
||||
protected:
|
||||
bool init() override {
|
||||
if (!CCMenuItemSpriteExtra::init(
|
||||
CCSprite::createWithSpriteFrameName("GJ_audioOffBtn_001.png"),
|
||||
nullptr,
|
||||
this, nullptr
|
||||
)) return false;
|
||||
|
||||
this->updateSprite();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void updateSprite() {
|
||||
this->setNormalImage(CCSprite::createWithSpriteFrameName(
|
||||
GameManager::get()->m_showSongMarkers ?
|
||||
"GJ_audioOnBtn_001.png" :
|
||||
"GJ_audioOffBtn_001.png"
|
||||
));
|
||||
}
|
||||
|
||||
void activate() override {
|
||||
CCMenuItemSpriteExtra::activate();
|
||||
GameManager::get()->m_showSongMarkers ^= 1;
|
||||
this->updateSprite();
|
||||
}
|
||||
|
||||
public:
|
||||
static GuidelinesButton* create() {
|
||||
auto ret = new GuidelinesButton();
|
||||
if (ret && ret->init()) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_DELETE(ret);
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
$register_ids(EditorPauseLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("resume-menu");
|
||||
|
||||
setIDs(
|
||||
menu, 0,
|
||||
"resume-button",
|
||||
"save-and-play-button",
|
||||
"save-and-exit-button",
|
||||
"save-button",
|
||||
"exit-button"
|
||||
);
|
||||
|
||||
menu->setContentSize({ 100.f, 220.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(12.5f)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
}
|
||||
|
||||
setIDs(
|
||||
this, 2,
|
||||
"ignore-damage-label",
|
||||
"follow-player-label",
|
||||
"select-filter-label",
|
||||
"show-grid-label",
|
||||
"show-object-info-label",
|
||||
"show-ground-label",
|
||||
"preview-mode-label",
|
||||
|
||||
"object-count-label",
|
||||
"length-label",
|
||||
"length-name-label"
|
||||
);
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("bottom-menu");
|
||||
|
||||
setIDs(
|
||||
menu, 0,
|
||||
"guidelines-enable-button",
|
||||
"help-button",
|
||||
"guidelines-disable-button",
|
||||
|
||||
"uncheck-portals-button",
|
||||
"reset-unused-button",
|
||||
"create-edges-button",
|
||||
"create-outlines-button",
|
||||
"create-base-button",
|
||||
"build-helper-button",
|
||||
|
||||
"align-x-button",
|
||||
"align-y-button",
|
||||
"select-all-button",
|
||||
"select-all-left-button",
|
||||
"select-all-right-button",
|
||||
|
||||
"ignore-damage-toggle",
|
||||
"follow-player-toggle",
|
||||
"select-filter-toggle",
|
||||
"show-grid-toggle",
|
||||
"show-object-info-toggle",
|
||||
"show-ground-toggle",
|
||||
"preview-mode-toggle",
|
||||
|
||||
"keys-button",
|
||||
"settings-button"
|
||||
);
|
||||
|
||||
auto smallActionsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"small-actions-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("align-x-button"),
|
||||
menu->getChildByID("align-y-button"),
|
||||
menu->getChildByID("select-all-button"),
|
||||
menu->getChildByID("select-all-left-button"),
|
||||
menu->getChildByID("select-all-right-button")
|
||||
);
|
||||
smallActionsMenu->setContentSize({ 100.f, 240.f });
|
||||
smallActionsMenu->setPositionY(130.f);
|
||||
smallActionsMenu->updateLayout();
|
||||
|
||||
auto actionsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"actions-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("keys-button"),
|
||||
menu->getChildByID("build-helper-button"),
|
||||
menu->getChildByID("create-base-button"),
|
||||
menu->getChildByID("create-outlines-button"),
|
||||
menu->getChildByID("create-edges-button"),
|
||||
menu->getChildByID("reset-unused-button"),
|
||||
menu->getChildByID("uncheck-portals-button")
|
||||
);
|
||||
if (auto keysBtn = actionsMenu->getChildByID("keys-button")) {
|
||||
keysBtn->setLayoutOptions(AxisLayoutOptions::create()->setPrevGap(10.f));
|
||||
}
|
||||
actionsMenu->setContentSize({ 100.f, 240.f });
|
||||
actionsMenu->setPositionY(130.f);
|
||||
actionsMenu->updateLayout();
|
||||
|
||||
auto optionsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"options-menu",
|
||||
RowLayout::create()
|
||||
->setGap(0.f)
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
->setCrossAxisOverflow(false),
|
||||
menu->getChildByID("preview-mode-toggle"),
|
||||
this->getChildByID("preview-mode-label"),
|
||||
menu->getChildByID("show-ground-toggle"),
|
||||
this->getChildByID("show-ground-label"),
|
||||
menu->getChildByID("show-object-info-toggle"),
|
||||
this->getChildByID("show-object-info-label"),
|
||||
menu->getChildByID("show-grid-toggle"),
|
||||
this->getChildByID("show-grid-label"),
|
||||
menu->getChildByID("select-filter-toggle"),
|
||||
this->getChildByID("select-filter-label"),
|
||||
menu->getChildByID("follow-player-toggle"),
|
||||
this->getChildByID("follow-player-label"),
|
||||
menu->getChildByID("ignore-damage-toggle"),
|
||||
this->getChildByID("ignore-damage-label")
|
||||
);
|
||||
for (auto node : CCArrayExt<CCNode>(optionsMenu->getChildren())) {
|
||||
if (auto label = typeinfo_cast<CCLabelBMFont*>(node)) {
|
||||
label->setLayoutOptions(
|
||||
AxisLayoutOptions::create()
|
||||
->setSameLine(true)
|
||||
->setBreakLine(true)
|
||||
->setPrevGap(5.f)
|
||||
->setMinScale(.1f)
|
||||
->setMaxScale(.5f)
|
||||
->setScalePriority(1)
|
||||
);
|
||||
}
|
||||
}
|
||||
optionsMenu->setContentSize({ 120.f, winSize.height - 100.f });
|
||||
optionsMenu->setPosition(70.f, winSize.height / 2 - 50.f + 10.f);
|
||||
optionsMenu->updateLayout();
|
||||
|
||||
auto settingsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"settings-menu",
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("settings-button")
|
||||
);
|
||||
settingsMenu->setContentSize({ 95.f, 50.f });
|
||||
settingsMenu->updateLayout();
|
||||
|
||||
auto guidelinesMenu = menu;
|
||||
|
||||
// replace the two guidelines buttons with a single toggle
|
||||
guidelinesMenu->getChildByID("guidelines-enable-button")->removeFromParent();
|
||||
guidelinesMenu->getChildByID("guidelines-disable-button")->removeFromParent();
|
||||
|
||||
auto glToggle = GuidelinesButton::create();
|
||||
glToggle->setID("guidelines-enable-toggle");
|
||||
guidelinesMenu->insertBefore(glToggle, nullptr);
|
||||
m_guidelinesOffButton = m_guidelinesOnButton = nullptr;
|
||||
// this->updateSongButton();
|
||||
|
||||
guidelinesMenu->setID("guidelines-menu");
|
||||
guidelinesMenu->setContentSize({ winSize.width / 2, 50.f });
|
||||
guidelinesMenu->setLayout(RowLayout::create());
|
||||
|
||||
auto topMenu = CCMenu::create();
|
||||
topMenu->setContentSize({ winSize.width / 2, 50.f });
|
||||
topMenu->setPosition(winSize.width / 2, winSize.height - 30.f);
|
||||
topMenu->setID("top-menu");
|
||||
topMenu->setLayout(RowLayout::create());
|
||||
this->addChild(topMenu);
|
||||
}
|
||||
|
||||
if (auto menu = detachAndCreateMenu(
|
||||
this, "info-menu",
|
||||
ColumnLayout::create()
|
||||
->setGap(10.f)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
->setCrossAxisLineAlignment(AxisAlignment::Start),
|
||||
this->getChildByID("object-count-label"),
|
||||
this->getChildByID("length-label"),
|
||||
this->getChildByID("length-name-label")
|
||||
)) {
|
||||
for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
|
||||
child->setLayoutOptions(
|
||||
AxisLayoutOptions::create()
|
||||
->setMinScale(.1f)
|
||||
->setMaxScale(.5f)
|
||||
->setBreakLine(true)
|
||||
);
|
||||
}
|
||||
menu->setContentSize({ 180.f, 100.f });
|
||||
menu->setPosition(100.f, winSize.height - 55.f);
|
||||
menu->updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
struct EditorPauseLayerIDs : Modify<EditorPauseLayerIDs, EditorPauseLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("EditorPauseLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set EditorPauseLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(LevelEditorLayer* lel) {
|
||||
if (!EditorPauseLayer::init(lel)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,345 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/EditorUI.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(EditorUI) {
|
||||
setIDSafe(this, 0, "position-slider");
|
||||
setIDSafe(this, this->getChildrenCount() - 2, "layer-index-label");
|
||||
setIDSafe(this, this->getChildrenCount() - 1, "object-info-label");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("toolbar-categories-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"build-button",
|
||||
"edit-button",
|
||||
"delete-button",
|
||||
|
||||
"swipe-button",
|
||||
"free-move-button",
|
||||
"snap-button",
|
||||
"rotate-button",
|
||||
|
||||
"undo-button",
|
||||
"redo-button",
|
||||
"delete-trash-button",
|
||||
|
||||
"music-playback-button",
|
||||
|
||||
"playtest-button",
|
||||
"stop-playtest-button",
|
||||
|
||||
"zoom-in-button",
|
||||
"zoom-out-button",
|
||||
|
||||
"link-button",
|
||||
"unlink-button"
|
||||
);
|
||||
|
||||
auto toolbarTogglesMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"toolbar-toggles-menu",
|
||||
RowLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::Center)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center),
|
||||
menu->getChildByID("swipe-button"),
|
||||
menu->getChildByID("rotate-button"),
|
||||
menu->getChildByID("free-move-button"),
|
||||
menu->getChildByID("snap-button")
|
||||
);
|
||||
toolbarTogglesMenu->setPosition(
|
||||
winSize.width - 47.f,
|
||||
45.f
|
||||
);
|
||||
toolbarTogglesMenu->setContentSize({ 90.f, 90.f });
|
||||
toolbarTogglesMenu->updateLayout();
|
||||
|
||||
auto undoMenuWidth = winSize.width / 2 - 90.f;
|
||||
auto undoMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"undo-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGap(10.f),
|
||||
menu->getChildByID("undo-button"),
|
||||
menu->getChildByID("redo-button"),
|
||||
menu->getChildByID("delete-trash-button")
|
||||
);
|
||||
undoMenu->setContentSize({ undoMenuWidth, 50.f });
|
||||
undoMenu->setPositionX(
|
||||
undoMenu->getPositionX() + undoMenuWidth / 2 -
|
||||
getSizeSafe(undoMenu->getChildByID("undo-button")).width / 2
|
||||
);
|
||||
undoMenu->updateLayout();
|
||||
|
||||
auto playBackMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"playback-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("music-playback-button")
|
||||
);
|
||||
playBackMenu->setContentSize({ 100.f, 50.f });
|
||||
playBackMenu->setPositionX(
|
||||
playBackMenu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(playBackMenu->getChildByID("music-playback-button")).width / 2
|
||||
);
|
||||
playBackMenu->updateLayout();
|
||||
|
||||
auto playTestMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"playtest-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("playtest-button"),
|
||||
menu->getChildByID("stop-playtest-button")
|
||||
);
|
||||
playTestMenu->setContentSize({ 100.f, 50.f });
|
||||
playTestMenu->setPositionX(
|
||||
playTestMenu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(playTestMenu->getChildByID("playtest-button")).width / 2
|
||||
);
|
||||
playTestMenu->updateLayout();
|
||||
|
||||
auto zoomMenuHeight = winSize.height - 245.f;
|
||||
auto zoomMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"zoom-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("zoom-out-button"),
|
||||
menu->getChildByID("zoom-in-button")
|
||||
);
|
||||
zoomMenu->setPositionY(150.f * winSize.height / 320);
|
||||
zoomMenu->setContentSize({ 50.f, zoomMenuHeight });
|
||||
zoomMenu->updateLayout();
|
||||
|
||||
auto linkMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"link-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGrowCrossAxis(true),
|
||||
menu->getChildByID("unlink-button"),
|
||||
menu->getChildByID("link-button")
|
||||
);
|
||||
linkMenu->setPositionY(150.f * winSize.height / 320);
|
||||
linkMenu->setContentSize({ 125.f, zoomMenuHeight });
|
||||
linkMenu->updateLayout();
|
||||
|
||||
menu->setPosition(42.f, 45.f);
|
||||
menu->setContentSize({ 100.f, 90.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(4.f)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("delete-category-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"delete-button",
|
||||
"delete-startpos-button",
|
||||
"delete-all-of-button",
|
||||
|
||||
"delete-filter-none",
|
||||
"delete-filter-static",
|
||||
"delete-filter-detail",
|
||||
"delete-filter-custom",
|
||||
|
||||
"delete-help-icon"
|
||||
);
|
||||
|
||||
auto deleteButtonMenu = detachAndCreateMenu(
|
||||
menu,
|
||||
"delete-button-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setCrossAxisAlignment(AxisAlignment::Center),
|
||||
menu->getChildByID("delete-button"),
|
||||
menu->getChildByID("delete-all-of-button"),
|
||||
menu->getChildByID("delete-startpos-button")
|
||||
);
|
||||
deleteButtonMenu->setPosition(-88.5f, 0.f);
|
||||
deleteButtonMenu->setContentSize({ winSize.width / 2 - 120.f, 80.f });
|
||||
deleteButtonMenu->updateLayout();
|
||||
|
||||
auto filterMenuWidth = winSize.width / 2 - 150.f;
|
||||
auto deleteFilterMenu = detachAndCreateMenu(
|
||||
menu,
|
||||
"delete-filter-menu",
|
||||
ColumnLayout::create()
|
||||
->setCrossAxisOverflow(false)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("delete-filter-none"),
|
||||
menu->getChildByID("delete-filter-static"),
|
||||
menu->getChildByID("delete-filter-detail"),
|
||||
menu->getChildByID("delete-filter-custom")
|
||||
);
|
||||
deleteFilterMenu->setPosition(48.5f + filterMenuWidth / 2, 0.f);
|
||||
deleteFilterMenu->setContentSize({ filterMenuWidth, 80.f });
|
||||
deleteFilterMenu->updateLayout();
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("build-tabs-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"block-tab",
|
||||
"half-block-tab",
|
||||
"outline-tab",
|
||||
"slope-tab",
|
||||
"hazard-tab",
|
||||
"3d-tab",
|
||||
"portal-tab",
|
||||
"ground-deco-tab",
|
||||
"air-deco-tab",
|
||||
"pulse-deco-tab",
|
||||
"sawblade-tab",
|
||||
"trigger-tab",
|
||||
"custom-tab"
|
||||
);
|
||||
|
||||
menu->setPosition(winSize.width / 2, 100.f);
|
||||
menu->setContentSize({ winSize.width, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setGap(-4.f)
|
||||
);
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 3)) {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"pause-button",
|
||||
"settings-button",
|
||||
"copy-paste-button",
|
||||
"copy-button",
|
||||
"paste-button",
|
||||
"hsv-button",
|
||||
"edit-special-button",
|
||||
"edit-object-button",
|
||||
"deselect-button",
|
||||
"edit-group-button",
|
||||
"portal-check",
|
||||
"copy-values-button",
|
||||
"paste-state-button",
|
||||
"paste-color-button",
|
||||
"go-to-layer-button",
|
||||
"next-layer-button",
|
||||
"prev-layer-button",
|
||||
"all-layers-button"
|
||||
);
|
||||
|
||||
auto topRightMenuWidth = winSize.width / 2 - 140.f;
|
||||
auto topRightMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"settings-menu",
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
menu->getChildByID("pause-button"),
|
||||
menu->getChildByID("settings-button")
|
||||
);
|
||||
topRightMenu->setContentSize({ topRightMenuWidth, 60.f });
|
||||
topRightMenu->setPositionX(
|
||||
topRightMenu->getPositionX() - topRightMenuWidth / 2 +
|
||||
getSizeSafe(topRightMenu->getChildByID("pause-button")).width / 2
|
||||
);
|
||||
topRightMenu->updateLayout();
|
||||
|
||||
auto rightMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"editor-buttons-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setCrossAxisAlignment(AxisAlignment::End)
|
||||
->setGap(-3.5f)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setAxisReverse(true),
|
||||
menu->getChildByID("copy-paste-button"),
|
||||
menu->getChildByID("edit-object-button"),
|
||||
menu->getChildByID("paste-color-button"),
|
||||
menu->getChildByID("deselect-button"),
|
||||
menu->getChildByID("paste-button"),
|
||||
menu->getChildByID("edit-group-button"),
|
||||
menu->getChildByID("paste-state-button"),
|
||||
menu->getChildByID("go-to-layer-button"),
|
||||
menu->getChildByID("copy-button"),
|
||||
menu->getChildByID("edit-special-button"),
|
||||
menu->getChildByID("copy-values-button"),
|
||||
menu->getChildByID("hsv-button")
|
||||
);
|
||||
for (auto btn : CCArrayExt<CCNode>(rightMenu->getChildren())) {
|
||||
btn->setContentSize({ 40.f, 40.f });
|
||||
}
|
||||
rightMenu->setContentSize({ 210.f, 160.f });
|
||||
rightMenu->setPosition(
|
||||
winSize.width - 210.f / 2 - 5.f,
|
||||
winSize.height / 2 + 42.5f
|
||||
);
|
||||
rightMenu->updateLayout();
|
||||
|
||||
this->getChildByID("layer-index-label")->setLayoutOptions(
|
||||
AxisLayoutOptions::create()
|
||||
->setAutoScale(false)
|
||||
->setLength(25.f)
|
||||
);
|
||||
|
||||
auto layerMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"layer-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
menu->getChildByID("all-layers-button"),
|
||||
menu->getChildByID("prev-layer-button"),
|
||||
this->getChildByID("layer-index-label"),
|
||||
menu->getChildByID("next-layer-button")
|
||||
);
|
||||
layerMenu->setPositionX(winSize.width - 110.f / 2);
|
||||
layerMenu->setContentSize({ 110.f, 30.f });
|
||||
layerMenu->updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
struct EditorUIIDs : Modify<EditorUIIDs, EditorUI> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("EditorUI::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set EditorUI::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(LevelEditorLayer* lel) {
|
||||
if (!EditorUI::init(lel)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,177 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/GJGarageLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(GJGarageLayer) {
|
||||
// the lock does not exist for not logged in users
|
||||
auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0;
|
||||
if (loggedInOffset == -1 && !GameManager::get()->m_clickedName) {
|
||||
// adjusts for the sprite asking for your name
|
||||
loggedInOffset++;
|
||||
}
|
||||
|
||||
setIDSafe<CCTextInputNode>(this, 0, "username-label");
|
||||
setIDSafe<SimplePlayer>(this, 0, "player-icon");
|
||||
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("category-menu");
|
||||
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"cube-button",
|
||||
"ship-button",
|
||||
"ball-button",
|
||||
"ufo-button",
|
||||
"wave-button",
|
||||
"robot-button",
|
||||
"spider-button",
|
||||
"trail-button",
|
||||
"death-effect-button"
|
||||
);
|
||||
|
||||
menu->setContentSize({ 320.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
->setGap(-4.f)
|
||||
);
|
||||
}
|
||||
|
||||
setIDs(
|
||||
this,
|
||||
10 + loggedInOffset,
|
||||
"cube-selection-menu",
|
||||
"ship-selection-menu",
|
||||
"ball-selection-menu",
|
||||
"ufo-selection-menu",
|
||||
"wave-selection-menu",
|
||||
"robot-selection-menu",
|
||||
"spider-selection-menu",
|
||||
"trail-selection-menu",
|
||||
"death-effect-selection-menu",
|
||||
|
||||
"color-1-cursor",
|
||||
"color-2-cursor",
|
||||
|
||||
"color-selection-menu"
|
||||
);
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("top-left-menu");
|
||||
|
||||
setIDs(menu, 0, "back-button", "shop-button", "shards-button");
|
||||
|
||||
auto backBtn = menu->getChildByID("back-button");
|
||||
auto backMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"back-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
backBtn
|
||||
);
|
||||
backMenu->setContentSize({ 100.f, 50.f });
|
||||
backMenu->setPositionX(
|
||||
backMenu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
backMenu->updateLayout();
|
||||
|
||||
auto shardsBtn = menu->getChildByID("shards-button");
|
||||
auto shardsMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"shards-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
shardsBtn
|
||||
);
|
||||
shardsMenu->setContentSize({ 50.f, 100.f });
|
||||
shardsMenu->setPositionY(
|
||||
shardsMenu->getPositionY() - 100.f / 2 +
|
||||
getSizeSafe(shardsBtn).height / 2
|
||||
);
|
||||
shardsMenu->updateLayout();
|
||||
}
|
||||
|
||||
auto bottomLeftMenu = CCMenu::create();
|
||||
bottomLeftMenu->setID("bottom-left-menu");
|
||||
bottomLeftMenu->setContentSize({ 50.f, 70.f });
|
||||
bottomLeftMenu->setPosition(30.f, 115.f);
|
||||
bottomLeftMenu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
this->addChild(bottomLeftMenu);
|
||||
|
||||
auto bottomRightMenu = CCMenu::create();
|
||||
bottomRightMenu->setID("bottom-right-menu");
|
||||
bottomRightMenu->setContentSize({ 50.f, 110.f });
|
||||
bottomRightMenu->setPosition(winSize.width - 30.f, 135.f);
|
||||
bottomRightMenu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
this->addChild(bottomRightMenu);
|
||||
|
||||
// aspect ratio responsiveness
|
||||
if (winSize.width / winSize.height <= 5.1f / 3.f) {
|
||||
bottomLeftMenu->setPosition(15.f, 115.f);
|
||||
bottomRightMenu->setPosition(winSize.width - 15.f, 135.f);
|
||||
|
||||
if (auto shardsMenu = this->getChildByID("shards-menu")) {
|
||||
shardsMenu->setContentSize({ 110.f, 50.f });
|
||||
shardsMenu->setPosition(
|
||||
shardsMenu->getPosition() + ccp(50.f, 30.f)
|
||||
);
|
||||
shardsMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (winSize.width / winSize.height <= 4.1f / 3.f) {
|
||||
bottomLeftMenu->setContentSize({ 90.f, 50.f });
|
||||
bottomLeftMenu->setPosition(
|
||||
15.f + 110.f / 2,
|
||||
85.f
|
||||
);
|
||||
bottomLeftMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
|
||||
bottomRightMenu->setContentSize({ 90.f, 50.f });
|
||||
bottomRightMenu->setPosition(
|
||||
winSize.width - 15.f - 110.f / 2,
|
||||
85.f
|
||||
);
|
||||
bottomRightMenu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
struct GJGarageLayerIDs : Modify<GJGarageLayerIDs, GJGarageLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("GJGarageLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set GJGarageLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init() {
|
||||
if (!GJGarageLayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,173 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/LevelBrowserLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(LevelBrowserLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("back-menu");
|
||||
auto btn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(btn).width / 2
|
||||
);
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
|
||||
if (m_searchObject->m_searchType == SearchType::MyLevels) {
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("new-level-menu");
|
||||
auto newLvlBtn = setIDSafe(menu, 0, "new-level-button");
|
||||
|
||||
if (auto myLevelsBtn = setIDSafe(menu, 1, "my-levels-button")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"my-levels-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
myLevelsBtn
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 125.f / 2 -
|
||||
myLevelsBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 50.f, 125.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() + 130.f / 2 -
|
||||
getSizeSafe(newLvlBtn).height / 2
|
||||
);
|
||||
menu->setContentSize({ 50.f, 130.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
if (auto searchBtn = setIDSafe(menu, 5, "search-button")) {
|
||||
auto clearBtn = setIDSafe(menu, 6, "clear-search-button");
|
||||
// this is a hacky fix because for some reason adding children
|
||||
// before the clear button is made visible is inconsistent
|
||||
if (clearBtn) {
|
||||
searchBtn->setZOrder(-1);
|
||||
clearBtn->setZOrder(-1);
|
||||
}
|
||||
auto searchMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"search-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setCrossAxisReverse(true)
|
||||
->setGrowCrossAxis(true)
|
||||
->setCrossAxisOverflow(false)
|
||||
->setCrossAxisAlignment(AxisAlignment::Start)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
searchBtn,
|
||||
clearBtn
|
||||
);
|
||||
auto width = 45.f * winSize.aspect();
|
||||
searchMenu->setPosition(
|
||||
searchMenu->getPositionX() + width / 2 -
|
||||
searchBtn->getScaledContentSize().width / 2,
|
||||
searchMenu->getPositionY() - 80.f / 2 +
|
||||
searchBtn->getScaledContentSize().height / 2
|
||||
);
|
||||
searchMenu->setContentSize({ width, 80.f });
|
||||
searchMenu->updateLayout();
|
||||
}
|
||||
|
||||
if (auto pageBtn = setIDSafe(menu, 2, "page-button")) {
|
||||
auto folderBtn = setIDSafe(menu, 3, "folder-button");
|
||||
auto lastPageBtn = setIDSafe(menu, 4, "last-page-button");
|
||||
auto pageMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"page-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setGrowCrossAxis(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
pageBtn,
|
||||
folderBtn,
|
||||
lastPageBtn
|
||||
);
|
||||
pageMenu->setContentSize({ 40.f, 110.f });
|
||||
pageMenu->setAnchorPoint({ 1.f, .5f });
|
||||
pageMenu->setPosition(
|
||||
pageMenu->getPositionX() + 20.f,
|
||||
pageMenu->getPositionY() - 110.f / 2 + 12.5f
|
||||
);
|
||||
pageMenu->updateLayout();
|
||||
}
|
||||
|
||||
auto navMenuWidth = 50.f * winSize.aspect();
|
||||
|
||||
if (auto prevPageBtn = setIDSafe(menu, 0, "prev-page-button")) {
|
||||
auto navMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"prev-page-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start),
|
||||
prevPageBtn
|
||||
);
|
||||
prevPageBtn->setZOrder(-1);
|
||||
navMenu->setContentSize({ navMenuWidth, 40.f });
|
||||
navMenu->setPositionX(
|
||||
navMenu->getPositionX() + navMenuWidth / 2 -
|
||||
prevPageBtn->getScaledContentSize().width / 2
|
||||
);
|
||||
navMenu->updateLayout();
|
||||
}
|
||||
|
||||
auto nextPageBtn = setIDSafe(menu, 0, "next-page-button");
|
||||
|
||||
menu->setID("next-page-menu");
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
);
|
||||
menu->setContentSize({ navMenuWidth, 40.f });
|
||||
menu->setPositionX(
|
||||
winSize.width - navMenuWidth / 2 - 5.f
|
||||
);
|
||||
menu->updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
auto bottomMenu = CCMenu::create();
|
||||
bottomMenu->setID("bottom-menu");
|
||||
bottomMenu->setContentSize({ 325.f + 20.f * winSize.aspect(), 50.f });
|
||||
bottomMenu->setPosition(winSize.width / 2, 28.f);
|
||||
bottomMenu->setZOrder(15);
|
||||
bottomMenu->setLayout(RowLayout::create());
|
||||
this->addChild(bottomMenu);
|
||||
}
|
||||
|
||||
struct LevelBrowserLayerIDs : Modify<LevelBrowserLayerIDs, LevelBrowserLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelBrowserLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelBrowserLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(GJSearchObject* obj) {
|
||||
if (!LevelBrowserLayer::init(obj)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,137 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/binding/LevelInfoLayer.hpp>
|
||||
#include <Geode/modify/LevelInfoLayer.hpp>
|
||||
|
||||
$register_ids(LevelInfoLayer) {
|
||||
auto winSize = CCDirector::get()->getWinSize();
|
||||
|
||||
setIDSafe<CCSprite>(this, 0, "background");
|
||||
|
||||
size_t iconOffset = 0;
|
||||
|
||||
setIDSafe<CCSprite>(this, 1, "bottom-left-art");
|
||||
setIDSafe<CCSprite>(this, 2, "bottom-right-art");
|
||||
|
||||
if (m_level->m_highObjectsEnabled) {
|
||||
setIDSafe<CCSprite>(this, 4, "high-object-indicator");
|
||||
iconOffset++;
|
||||
}
|
||||
|
||||
setIDSafe<CCSprite>(this, 4 + iconOffset, "length-icon");
|
||||
setIDSafe<CCSprite>(this, 5 + iconOffset, "downloads-icon");
|
||||
setIDSafe<CCSprite>(this, 6 + iconOffset, "orbs-icon");
|
||||
setIDSafe<CCSprite>(this, 7 + iconOffset, "likes-icon");
|
||||
setIDSafe<CCLabelBMFont>(this, 1, "downloads-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 2, "length-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 3, "likes-label");
|
||||
setIDSafe<CCLabelBMFont>(this, 4, "orbs-label");
|
||||
|
||||
if (m_level->m_stars) {
|
||||
setIDSafe<CCSprite>(this, 8 + iconOffset, "stars-icon");
|
||||
setIDSafe<CCLabelBMFont>(this, 5, "stars-label");
|
||||
}
|
||||
|
||||
setIDSafe<CustomSongWidget>(this, 0, "custom-songs-widget");
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("play-menu");
|
||||
setIDSafe(menu, 0, "play-button");
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 2)) {
|
||||
menu->setID("back-menu");
|
||||
auto backBtn = setIDSafe(menu, 0, "back-button");
|
||||
menu->setPositionX(
|
||||
menu->getPositionX() + 100.f / 2 -
|
||||
getSizeSafe(backBtn).width / 2
|
||||
);
|
||||
menu->setContentSize({ 100.f, 50.f });
|
||||
menu->setLayout(
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::Start)
|
||||
);
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("right-side-menu");
|
||||
|
||||
if (auto name = setIDSafe(menu, 0, "creator-name")) {
|
||||
auto menu = detachAndCreateMenu(
|
||||
this,
|
||||
"creator-info-menu",
|
||||
ColumnLayout::create()
|
||||
->setAxisReverse(true)
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
name
|
||||
);
|
||||
menu->setPositionY(
|
||||
menu->getPositionY() - 40.f / 2 +
|
||||
name->getScaledContentSize().height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, 40.f });
|
||||
menu->updateLayout();
|
||||
}
|
||||
|
||||
auto leftSideMenu = CCMenu::create();
|
||||
leftSideMenu->setPosition(30.f, winSize.height / 2);
|
||||
leftSideMenu->setLayout(ColumnLayout::create());
|
||||
leftSideMenu->setID("left-side-menu");
|
||||
leftSideMenu->setContentSize({ 50.f, 225.f });
|
||||
this->addChild(leftSideMenu);
|
||||
|
||||
menu->setPosition(winSize.width - 30.f, winSize.height / 2);
|
||||
|
||||
for (auto child : CCArrayExt<CCNode>(menu->getChildren())) {
|
||||
if (child->getPositionX() < 0.f) {
|
||||
child->retain();
|
||||
child->removeFromParent();
|
||||
leftSideMenu->addChild(child);
|
||||
child->release();
|
||||
}
|
||||
child->setPositionX(0.f);
|
||||
}
|
||||
|
||||
setIDSafe(menu, 0, "delete-button");
|
||||
setIDSafe(menu, 1, "refresh-button");
|
||||
setIDSafe(menu, 2, "info-button");
|
||||
setIDSafe(menu, 3, "leaderboards-button");
|
||||
setIDSafe(menu, 4, "like-button");
|
||||
setIDSafe(menu, 5, "rate-button");
|
||||
|
||||
menu->setPosition(
|
||||
menu->getPositionX() + static_cast<CCNode*>(
|
||||
menu->getChildren()->firstObject()
|
||||
)->getPositionX(),
|
||||
winSize.height / 2
|
||||
);
|
||||
menu->setContentSize({ 60.f, winSize.height - 15.f });
|
||||
menu->setLayout(
|
||||
ColumnLayout::create()
|
||||
->setGap(3.f)
|
||||
->setAxisAlignment(AxisAlignment::End)
|
||||
->setAxisReverse(true)
|
||||
);
|
||||
|
||||
setIDSafe(leftSideMenu, 0, "copy-button");
|
||||
|
||||
menu->updateLayout();
|
||||
leftSideMenu->updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
struct LevelInfoLayerIDs : Modify<LevelInfoLayerIDs, LevelInfoLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelInfoLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelInfoLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(GJGameLevel* level) {
|
||||
if (!LevelInfoLayer::init(level)) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,82 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/modify/LevelSearchLayer.hpp>
|
||||
|
||||
$register_ids(LevelSearchLayer) {
|
||||
// set the funny ids
|
||||
setIDSafe(this, 0, "background");
|
||||
getChildOfType<CCTextInputNode>(this, 0)->setID("search-bar");
|
||||
getChildOfType<CCScale9Sprite>(this, 0)->setID("level-search-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 1)->setID("level-search-bar-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 2)->setID("quick-search-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 3)->setID("difficulty-filters-bg");
|
||||
getChildOfType<CCScale9Sprite>(this, 4)->setID("length-filters-bg");
|
||||
getChildOfType<CCLabelBMFont>(this, 0)->setID("quick-search-title");
|
||||
getChildOfType<CCLabelBMFont>(this, 1)->setID("filters-title");
|
||||
getChildOfType<CCSprite>(this, 1)->setID("left-corner");
|
||||
getChildOfType<CCSprite>(this, 2)->setID("right-corner");
|
||||
|
||||
if (auto filtermenu = getChildOfType<CCMenu>(this, 0)) {
|
||||
filtermenu->setID("other-filter-menu");
|
||||
setIDSafe(filtermenu, 0, "clear-filters-button");
|
||||
setIDSafe(filtermenu, 1, "advanced-filters-button");
|
||||
}
|
||||
if (auto searchmenu = getChildOfType<CCMenu>(this, 1)) {
|
||||
searchmenu->setID("search-button-menu");
|
||||
setIDSafe(searchmenu, 0, "search-level-button");
|
||||
setIDSafe(searchmenu, 1, "search-user-button");
|
||||
}
|
||||
if (auto quickmenu = getChildOfType<CCMenu>(this, 2)) {
|
||||
quickmenu->setID("quick-search-menu");
|
||||
setIDSafe(quickmenu, 0, "most-downloaded-button");
|
||||
setIDSafe(quickmenu, 1, "most-liked-button");
|
||||
setIDSafe(quickmenu, 2, "trending-button");
|
||||
setIDSafe(quickmenu, 3, "recent-button");
|
||||
setIDSafe(quickmenu, 4, "magic-button");
|
||||
setIDSafe(quickmenu, 5, "awarded-button");
|
||||
setIDSafe(quickmenu, 6, "followed-button");
|
||||
setIDSafe(quickmenu, 7, "friends-button");
|
||||
}
|
||||
if (auto filtersmenu = getChildOfType<CCMenu>(this, 3)) {
|
||||
filtersmenu->setID("difficulty-filter-menu");
|
||||
setIDSafe(filtersmenu, 0, "na-filter-button");
|
||||
setIDSafe(filtersmenu, 1, "easy-filter-button");
|
||||
setIDSafe(filtersmenu, 2, "normal-filter-button");
|
||||
setIDSafe(filtersmenu, 3, "hard-filter-button");
|
||||
setIDSafe(filtersmenu, 4, "harder-filter-button");
|
||||
setIDSafe(filtersmenu, 5, "insane-filter-button");
|
||||
setIDSafe(filtersmenu, 6, "demon-filter-button");
|
||||
setIDSafe(filtersmenu, 7, "auto-filter-button");
|
||||
setIDSafe(filtersmenu, 8, "demon-type-filter-button");
|
||||
}
|
||||
if (auto filtersmenu = getChildOfType<CCMenu>(this, 4)) {
|
||||
filtersmenu->setID("length-filter-menu");
|
||||
setIDSafe(filtersmenu, 0, "clock-icon");
|
||||
setIDSafe(filtersmenu, 1, "tiny-filter-button");
|
||||
setIDSafe(filtersmenu, 2, "short-filter-button");
|
||||
setIDSafe(filtersmenu, 3, "medium-filter-button");
|
||||
setIDSafe(filtersmenu, 4, "long-filter-button");
|
||||
setIDSafe(filtersmenu, 5, "xl-filter-button");
|
||||
setIDSafe(filtersmenu, 6, "star-filter-button");
|
||||
}
|
||||
if (auto backmenu = getChildOfType<CCMenu>(this, 5)) {
|
||||
backmenu->setID("exit-menu");
|
||||
setIDSafe(backmenu, 0, "exit-button");
|
||||
}
|
||||
}
|
||||
|
||||
struct LevelSearchLayerIDs : Modify<LevelSearchLayerIDs, LevelSearchLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelSearchLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelSearchLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init() {
|
||||
if (!LevelSearchLayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,216 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/LevelSettingsLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(LevelSettingsLayer) {
|
||||
bool startPos = m_mainLayer->getChildrenCount() < 10;
|
||||
|
||||
if (startPos) {
|
||||
setIDSafe(m_mainLayer, 0, "back-button");
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(m_mainLayer, 0)) {
|
||||
menu->setID("song-select-menu");
|
||||
|
||||
if (startPos) {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"cube-button",
|
||||
"ship-button",
|
||||
"ball-button",
|
||||
"ufo-button",
|
||||
"wave-button",
|
||||
"robot-button",
|
||||
"spider-button",
|
||||
"mini-toggle",
|
||||
"dual-toggle",
|
||||
"ok-button",
|
||||
"flip-gravity-toggle",
|
||||
"half-speed-button",
|
||||
"normal-speed-button",
|
||||
"2x-speed-button",
|
||||
"3x-speed-button",
|
||||
"4x-speed-button"
|
||||
);
|
||||
}
|
||||
else {
|
||||
setIDs(
|
||||
menu,
|
||||
0,
|
||||
"bg-color-button",
|
||||
"g-color-button",
|
||||
"g2-color-button",
|
||||
"line-color-button",
|
||||
"obj-color-button",
|
||||
"more-color-button",
|
||||
"3dl-color-button",
|
||||
"bg-quick-edit-button",
|
||||
"g-quick-edit-button",
|
||||
"g2-quick-edit-button",
|
||||
"line-quick-edit-button",
|
||||
"cube-button",
|
||||
"ship-button",
|
||||
"ball-button",
|
||||
"ufo-button",
|
||||
"wave-button",
|
||||
"robot-button",
|
||||
"spider-button",
|
||||
"background-select-button",
|
||||
"ground-select-button",
|
||||
"mini-toggle",
|
||||
"dual-toggle",
|
||||
"font-button",
|
||||
"ok-button",
|
||||
"2-player-toggle",
|
||||
"2-player-help-button",
|
||||
"prev-song-button",
|
||||
"next-song-button",
|
||||
"normal-song-button",
|
||||
"custom-song-button",
|
||||
"select-custom-song-button",
|
||||
"new-song-button",
|
||||
"half-speed-button",
|
||||
"normal-speed-button",
|
||||
"2x-speed-button",
|
||||
"3x-speed-button",
|
||||
"4x-speed-button"
|
||||
);
|
||||
}
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"vehicle-selection-menu",
|
||||
RowLayout::create(),
|
||||
menu->getChildByID("cube-button"),
|
||||
menu->getChildByID("ship-button"),
|
||||
menu->getChildByID("ball-button"),
|
||||
menu->getChildByID("ufo-button"),
|
||||
menu->getChildByID("wave-button"),
|
||||
menu->getChildByID("robot-button"),
|
||||
menu->getChildByID("spider-button")
|
||||
);
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"right-toggle-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("mini-toggle"),
|
||||
menu->getChildByID("dual-toggle")
|
||||
);
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"speed-selection-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("half-speed-button"),
|
||||
menu->getChildByID("normal-song-button"),
|
||||
menu->getChildByID("2x-speed-button"),
|
||||
menu->getChildByID("3x-speed-button"),
|
||||
menu->getChildByID("4x-speed-button")
|
||||
);
|
||||
|
||||
if (startPos) {
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"flip-gravity-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("flip-gravity-toggle")
|
||||
);
|
||||
}
|
||||
else {
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"color-button-menu",
|
||||
RowLayout::create(),
|
||||
menu->getChildByID("bg-color-button"),
|
||||
menu->getChildByID("g-color-button"),
|
||||
menu->getChildByID("g2-color-button"),
|
||||
menu->getChildByID("line-color-button"),
|
||||
menu->getChildByID("obj-color-button"),
|
||||
menu->getChildByID("3dl-color-button"),
|
||||
menu->getChildByID("more-color-button")
|
||||
);
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"color-quick-edit-menu",
|
||||
RowLayout::create(),
|
||||
menu->getChildByID("bg-quick-edit-button"),
|
||||
menu->getChildByID("g-quick-edit-button"),
|
||||
menu->getChildByID("g2-quick-edit-button"),
|
||||
menu->getChildByID("line-quick-edit-button")
|
||||
);
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"scenery-selection-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("background-select-button"),
|
||||
menu->getChildByID("ground-select-button")
|
||||
);
|
||||
|
||||
detachAndCreateMenu(
|
||||
this,
|
||||
"2-player-menu",
|
||||
ColumnLayout::create(),
|
||||
menu->getChildByID("2-player-help-button"),
|
||||
menu->getChildByID("2-player-toggle")
|
||||
);
|
||||
|
||||
auto fontButtonMenu = detachAndCreateMenu(
|
||||
this,
|
||||
"font-button-menu",
|
||||
RowLayout::create()
|
||||
->setAxisAlignment(AxisAlignment::End),
|
||||
menu->getChildByID("font-button")
|
||||
);
|
||||
fontButtonMenu->setPositionY(fontButtonMenu->getPositionY() - 100.f / 2);
|
||||
fontButtonMenu->setContentSize({ 50.f, 100.f });
|
||||
}
|
||||
}
|
||||
|
||||
setIDs(
|
||||
m_mainLayer,
|
||||
2,
|
||||
"select-color-label",
|
||||
"bg-color-label",
|
||||
"g-color-label",
|
||||
"g2-color-label",
|
||||
"3dl-color-label",
|
||||
"line-color-label",
|
||||
"obj-color-label",
|
||||
"more-color-label",
|
||||
"select-mode-label",
|
||||
"bg-selection-label",
|
||||
"g-selection-label",
|
||||
"mini-label",
|
||||
"dual-label",
|
||||
"2-player-label-1",
|
||||
"2-player-label-2",
|
||||
"select-song-label",
|
||||
"default-song-label",
|
||||
"custom-song-widget",
|
||||
"speed-label"
|
||||
);
|
||||
}
|
||||
|
||||
struct LevelSettingsLayerIDs : Modify<LevelSettingsLayerIDs, LevelSettingsLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("LevelSettingsLayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set LevelSettingsLayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init(LevelSettingsObject* levelSettings, LevelEditorLayer* editor) {
|
||||
if (!LevelSettingsLayer::init(levelSettings, editor)) return false;
|
||||
|
||||
// NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,10 +1,11 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/modify/IDManager.hpp>
|
||||
#include <Geode/modify/MenuLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
#include <Geode/utils/NodeIDs.hpp>
|
||||
#include <Geode/ui/BasedButtonSprite.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
using namespace geode::node_ids;
|
||||
|
||||
$register_ids(MenuLayer) {
|
||||
// set IDs to everything
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/PauseLayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(PauseLayer) {
|
||||
setIDs(
|
||||
this,
|
||||
0,
|
||||
"background",
|
||||
"level-name",
|
||||
|
||||
"normal-progress-bar",
|
||||
"practice-progress-bar",
|
||||
"normal-progress-label",
|
||||
"practice-progress-label",
|
||||
"normal-mode-label",
|
||||
"practice-mode-label",
|
||||
|
||||
"center-button-menu",
|
||||
|
||||
"auto-retry-label",
|
||||
"auto-checkpoints-label",
|
||||
"show-progress-bar-label"
|
||||
);
|
||||
|
||||
if (auto menu = this->getChildByID("center-button-menu")) {
|
||||
int start_idx = 0;
|
||||
|
||||
if (menu->getChildrenCount() == 5) {
|
||||
setIDSafe(menu, 0, "edit-button");
|
||||
start_idx = 1;
|
||||
}
|
||||
|
||||
setIDs(menu, start_idx, "practice-button", "play-button", "exit-button");
|
||||
|
||||
if (menu->getChildrenCount() == 4) setIDSafe(menu, start_idx + 3, "retry-button");
|
||||
}
|
||||
|
||||
// Record toggle on mobile
|
||||
if (auto label = typeinfo_cast<CCLabelBMFont*>(getChild(this, 12))) {
|
||||
setIDSafe(this, 12, "record-label");
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("toggle-menu");
|
||||
|
||||
setIDs(menu, 0, "auto-retry-toggle", "auto-checkpoints-toggle", "show-progress-bar-toggle");
|
||||
|
||||
if (menu->getChildrenCount() == 4) setIDSafe(menu, 3, "record-toggle");
|
||||
}
|
||||
|
||||
setIDs(
|
||||
this, this->getChildrenCount() - 4, "music-slider", "sfx-slider", "music-label", "sfx-label"
|
||||
);
|
||||
}
|
||||
|
||||
struct PauseLayerIDs : Modify<PauseLayerIDs, PauseLayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("PauseLayer::customSetup", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set PauseLayer::customSetup hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
void customSetup() {
|
||||
PauseLayer::customSetup();
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
}
|
||||
};
|
|
@ -1,37 +0,0 @@
|
|||
#include "AddIDs.hpp"
|
||||
|
||||
#include <Geode/Bindings.hpp>
|
||||
#include <Geode/modify/UILayer.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
$register_ids(UILayer) {
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 0)) {
|
||||
menu->setID("pause-button-menu");
|
||||
|
||||
setIDs(menu, 0, "pause-button");
|
||||
}
|
||||
|
||||
if (auto menu = getChildOfType<CCMenu>(this, 1)) {
|
||||
menu->setID("checkpoint-menu");
|
||||
|
||||
setIDs(menu, 0, "add-checkpoint-button", "remove-checkpoint-button");
|
||||
}
|
||||
}
|
||||
|
||||
struct UILayerIDs : Modify<UILayerIDs, UILayer> {
|
||||
static void onModify(auto& self) {
|
||||
if (!self.setHookPriority("UILayer::init", GEODE_ID_PRIORITY)) {
|
||||
log::warn("Failed to set UILayer::init hook priority, node IDs may not work properly");
|
||||
}
|
||||
}
|
||||
|
||||
bool init() {
|
||||
if (!UILayer::init()) return false;
|
||||
|
||||
NodeIDs::get()->provide(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -2,9 +2,12 @@
|
|||
|
||||
#ifdef GEODE_IS_ANDROID
|
||||
|
||||
// 2.2 addition
|
||||
// zmx please fix this
|
||||
|
||||
namespace geode::base {
|
||||
uintptr_t get() {
|
||||
static uintptr_t base = (reinterpret_cast<uintptr_t>(&UILayer::create) - 0x20f168) & (~0x1);
|
||||
static uintptr_t base = (reinterpret_cast<uintptr_t>(&MenuLayer::scene) - 0x2f9068) & (~0x1);
|
||||
// static uintptr_t base = reinterpret_cast<uintptr_t>(dlopen("libcocos2dcpp.so", RTLD_NOW));
|
||||
return base;
|
||||
}
|
||||
|
|
|
@ -27,37 +27,68 @@ void updateGeode() {
|
|||
utils::game::restart();
|
||||
}
|
||||
|
||||
void* mainTrampolineAddr;
|
||||
|
||||
int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
|
||||
MessageBoxA(NULL, "Hello from gdMainHook!", "Hi", 0);
|
||||
|
||||
updateGeode();
|
||||
|
||||
int exitCode = geodeEntry(hInstance);
|
||||
if (exitCode != 0)
|
||||
return exitCode;
|
||||
|
||||
return reinterpret_cast<decltype(&wWinMain)>(geode::base::get() + 0x260ff8)(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
||||
return reinterpret_cast<decltype(&wWinMain)>(mainTrampolineAddr)(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
||||
}
|
||||
|
||||
bool loadGeode() {
|
||||
// TODO: add version check or something
|
||||
|
||||
auto process = GetCurrentProcess();
|
||||
|
||||
auto patchAddr = reinterpret_cast<void*>(geode::base::get() + 0x260ff8);
|
||||
constexpr size_t patchLength = 13;
|
||||
auto detourAddr = reinterpret_cast<uintptr_t>(&gdMainHook) - geode::base::get() - 0x261005;
|
||||
auto detourAddrPtr = reinterpret_cast<uint8_t*>(&detourAddr);
|
||||
constexpr size_t trampolineSize = 12;
|
||||
mainTrampolineAddr = VirtualAlloc(
|
||||
nullptr, trampolineSize,
|
||||
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE
|
||||
);
|
||||
|
||||
uint8_t patchBytes[patchLength] = {
|
||||
static constexpr uintptr_t MAIN_OFFSET = 0x3ba7d0;
|
||||
auto patchAddr = geode::base::get() + MAIN_OFFSET;
|
||||
|
||||
constexpr size_t patchSize = 6;
|
||||
|
||||
#define JMP_ADDR(from, to) (std::bit_cast<uintptr_t>(to) - std::bit_cast<uintptr_t>(from) - 5)
|
||||
#define JMP_BYTES(from, to) \
|
||||
((JMP_ADDR(from, to) >> 0) & 0xFF), \
|
||||
((JMP_ADDR(from, to) >> 8) & 0xFF), \
|
||||
((JMP_ADDR(from, to) >> 16) & 0xFF), \
|
||||
((JMP_ADDR(from, to) >> 24) & 0xFF)
|
||||
|
||||
uint8_t trampolineBytes[trampolineSize] = {
|
||||
// push ebp
|
||||
0x55,
|
||||
// mov ebp, esp
|
||||
0x8b, 0xec,
|
||||
0x83, 0xe4, 0xf8,
|
||||
0xeb, 0x06,
|
||||
0xe9, detourAddrPtr[0], detourAddrPtr[1], detourAddrPtr[2], detourAddrPtr[3]
|
||||
// and esp, ...
|
||||
0x83, 0xe4, 0xf8,
|
||||
// jmp main + 6 (after our jmp detour)
|
||||
0xe9, JMP_BYTES(reinterpret_cast<uintptr_t>(mainTrampolineAddr) + 6, patchAddr + patchSize)
|
||||
};
|
||||
|
||||
std::memcpy(mainTrampolineAddr, trampolineBytes, trampolineSize);
|
||||
|
||||
uint8_t patchBytes[patchSize] = {
|
||||
// jmp gdMainHook
|
||||
0xe9, JMP_BYTES(patchAddr, &gdMainHook),
|
||||
// nop to pad it out, helps the asm to show up properly on debuggers
|
||||
0x90
|
||||
};
|
||||
|
||||
DWORD oldProtect;
|
||||
if (!VirtualProtectEx(process, patchAddr, patchLength, PAGE_EXECUTE_READWRITE, &oldProtect))
|
||||
if (!VirtualProtectEx(process, reinterpret_cast<void*>(patchAddr), patchSize, PAGE_EXECUTE_READWRITE, &oldProtect))
|
||||
return false;
|
||||
std::memcpy(patchAddr, patchBytes, patchLength);
|
||||
VirtualProtectEx(process, patchAddr, patchLength, oldProtect, &oldProtect);
|
||||
std::memcpy(reinterpret_cast<void*>(patchAddr), patchBytes, patchSize);
|
||||
VirtualProtectEx(process, reinterpret_cast<void*>(patchAddr), patchSize, oldProtect, &oldProtect);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,22 @@ using namespace geode::prelude;
|
|||
|
||||
// Add known android struct members here
|
||||
|
||||
GEODE_MEMBER_CHECK(CCMenuItemSprite, m_pfnSelector, 0x11c);
|
||||
|
||||
GEODE_SIZE_CHECK(CCObject, 0x34);
|
||||
GEODE_SIZE_CHECK(CCNode, 0x108);
|
||||
GEODE_SIZE_CHECK(CCNodeRGBA, 0x118);
|
||||
GEODE_SIZE_CHECK(CCLayer, 0x13c);
|
||||
GEODE_SIZE_CHECK(CCLayerRGBA, 0x14c);
|
||||
GEODE_SIZE_CHECK(CCLayerColor, 0x1b8);
|
||||
GEODE_SIZE_CHECK(CCSprite, 0x1fc);
|
||||
|
||||
GEODE_SIZE_CHECK(CCMenu, 0x154);
|
||||
GEODE_SIZE_CHECK(CCMenuItem, 0x12c);
|
||||
GEODE_SIZE_CHECK(CCMenuItemSprite, 0x138);
|
||||
|
||||
GEODE_SIZE_CHECK(CCScale9Sprite, 0x1a4);
|
||||
|
||||
|
||||
// needed classes are ones in the ids folder and some generic ones (i think they are already done though so only ids)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue