Skip to content

Commit 8e6d88f

Browse files
committed
Merge branch 'rewrite'
2 parents 5e42a9f + 6429206 commit 8e6d88f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1948
-2641
lines changed

changelog.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## 2.0.0
2+
**NOTICE! Modifying nodes by ID is removed. You must now modify them by their class name instead.**
3+
- Code cleanup
4+
- Multi pack UI modding (packs can now modify other packs based on priority in Texture Loader)
5+
- Rewrite mod to be more efficient
6+
- Remove old ID based modding
7+
- Improve reliability
8+
- Scheduling Updates
9+
- Bug fixes
10+
- Pack IDs for custom nodes work once again
11+
- No longer double activates transitions
12+
- Hot reload fixes
13+
14+
## 1.9.10
15+
- Bug fixes
16+
117
## 1.9.9
218
- Fix sprite crash
319

@@ -19,7 +35,7 @@
1935
- Fix some load delay
2036

2137
## 1.9.3
22-
**NOTICE! Modifying nodes by ID will soon be depreciated. Once the next GD update comes out, I will be removing that feature in favor of modiifying nodes by their class name. This is the name BEFORE the one in quotes in DevTools. For example `ui/cvolton.betterinfo$ExtendedLevelInfo.json` will become `ui/ExtendedLevelInfo.json` and anything in the nodes folder will no longer work and should be placed in the UI folder.**
38+
**NOTICE! Modifying nodes by ID will soon be depreciated. Once the next GD update comes out, I will be removing that feature in favor of modifying nodes by their class name. This is the name BEFORE the one in quotes in DevTools. For example `ui/cvolton.betterinfo$ExtendedLevelInfo.json` will become `ui/ExtendedLevelInfo.json` and anything in the nodes folder will no longer work and should be placed in the UI folder.**
2339
- Fixed crash when pressing space on main menu for mac
2440

2541
## 1.9.2

logo.png

9.32 KB
Loading

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"geode": "4.4.0",
2+
"geode": "4.6.1",
33
"gd": {
44
"win": "2.2074",
55
"android": "2.2074",
66
"mac": "2.2074",
77
"ios": "2.2074"
88
},
9-
"version": "v1.9.9",
9+
"version": "v2.0.0",
1010
"id": "alphalaneous.happy_textures",
1111
"name": "Happy Textures :3",
1212
"developer": "Alphalaneous",
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
#include <Geode/modify/CCDirector.hpp>
55
#include <Geode/modify/LeaderboardsLayer.hpp>
66
#include <Geode/modify/LevelBrowserLayer.hpp>
7-
#include "UIModding.h"
8-
#include "Macros.h"
7+
#include "UIModding.hpp"
8+
#include "Macros.hpp"
9+
#include "Utils.hpp"
910

1011
using namespace geode::prelude;
1112

12-
void setBackground(CCNode* node) {
13+
inline void setBackground(CCNode* node) {
1314
if (UIModding::get()->doModify) {
1415
if (CCSprite* bg = typeinfo_cast<CCSprite*>(node->getChildByIDRecursive("background"))) {
1516
if (bg->getColor() == ccColor3B{0, 102, 255}) {

src/Callbacks.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
#include "Callbacks.h"
2-
#include "Macros.h"
1+
#include "Callbacks.hpp"
2+
#include "Macros.hpp"
3+
#include "UIModding.hpp"
34

45
Callbacks* Callbacks::instance = nullptr;
56

6-
//do cursed UB stuff, currently unused but may be useful in the future
7-
8-
template <typename T>
9-
FakeNodeLayer<T> Callbacks::createUBDummyLayer() {
10-
return FakeNodeLayer<T>();
11-
}
12-
137
void Callbacks::generateAll() {
148
if (m_generated) return;
15-
m_ignoreUICheck = true;
9+
UIModding::get()->skipCheck = true;
1610
generateMenuLayerCallbacks();
1711
generateCreatorLayerCallbacks();
1812
generateGarageCallbacks();
19-
m_ignoreUICheck = false;
13+
UIModding::get()->skipCheck = false;
2014
m_generated = true;
2115
}
2216

src/Callbacks.h renamed to src/Callbacks.hpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
#pragma once
22

33
#include <Geode/Geode.hpp>
4-
#include "Macros.h"
4+
#include "Macros.hpp"
55

66
using namespace geode::prelude;
77

8-
template <typename T>
9-
struct FakeNodeLayer final {
10-
char m_alloc[sizeof(T)];
11-
T* operator->() {
12-
return get();
13-
}
14-
T* get() {
15-
return reinterpret_cast<T*>(&m_alloc);
16-
}
17-
};
18-
198
class Callbacks {
209

2110
protected:
2211
static Callbacks* instance;
2312
bool m_generated = false;
2413
public:
25-
bool m_ignoreUICheck = false;
2614
std::map<std::string, std::map<std::string, std::pair<CCNode*, cocos2d::SEL_MenuHandler>>> m_callbacks;
2715
std::map<std::string, Ref<CCNode>> m_layers;
2816
Ref<CCMenuItemSpriteExtra> m_dummyButton;
2917

30-
template <typename T>
31-
FakeNodeLayer<T> createUBDummyLayer();
32-
3318
void generateAll();
3419
void generateMenuLayerCallbacks();
3520
void generateCreatorLayerCallbacks();

src/Config.h renamed to src/Config.hpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include <Geode/Geode.hpp>
4-
#include "Utils.h"
4+
#include "Utils.hpp"
55
#include <geode.texture-loader/include/TextureLoader.hpp>
66

77
class Config {
@@ -27,20 +27,18 @@ class Config {
2727

2828
Mod* textureLoader = Loader::get()->getLoadedMod("geode.texture-loader");
2929
if (textureLoader) {
30-
if (textureLoader->getVersion() >= VersionInfo{1, 7, 0}) {
31-
for (geode::texture_loader::Pack pack : geode::texture_loader::getAppliedPacks()) {
32-
std::optional<matjson::Value> json = loadIntoJson(pack);
33-
if (json.has_value()) {
34-
matjson::Value jsonRes = json.value();
35-
loadConfig(pack, jsonRes["happy-textures"]);
36-
}
30+
for (const geode::texture_loader::Pack& pack : geode::texture_loader::getAppliedPacks()) {
31+
std::optional<matjson::Value> json = loadIntoJson(pack);
32+
if (json.has_value()) {
33+
matjson::Value jsonRes = json.value();
34+
loadConfig(pack, jsonRes["happy-textures"]);
3735
}
38-
for (geode::texture_loader::Pack pack : geode::texture_loader::getAvailablePacks()) {
39-
std::optional<matjson::Value> json = loadIntoJson(pack);
40-
if (json.has_value()) {
41-
matjson::Value jsonRes = json.value();
42-
loadSettings(pack, jsonRes["happy-textures"]);
43-
}
36+
}
37+
for (const geode::texture_loader::Pack& pack : geode::texture_loader::getAvailablePacks()) {
38+
std::optional<matjson::Value> json = loadIntoJson(pack);
39+
if (json.has_value()) {
40+
matjson::Value jsonRes = json.value();
41+
loadSettings(pack, jsonRes["happy-textures"]);
4442
}
4543
}
4644
}

src/DataNode.h renamed to src/DataNode.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#include <Geode/Geode.hpp>
4-
#include "Macros.h"
4+
#include "Macros.hpp"
55

66
using namespace geode::prelude;
77

@@ -12,13 +12,13 @@ class DataNode : public CCNode {
1212
CCNode* m_data;
1313

1414
static DataNode* create(CCNode* data) {
15-
auto node = new DataNode;
16-
if (!node->init(data)) {
17-
CC_SAFE_DELETE(node);
18-
return nullptr;
15+
auto node = new DataNode();
16+
if (node->init(data)) {
17+
node->autorelease();
18+
return node;
1919
}
20-
node->autorelease();
21-
return node;
20+
delete node;
21+
return nullptr;
2222
}
2323

2424
virtual bool init(CCNode* data) {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
#include <chrono>
55
#include <thread>
66
#include <unordered_map>
7-
#include <string>
87
#include <functional>
98
#include <Geode/Geode.hpp>
10-
#include "Macros.h"
9+
#include "Macros.hpp"
1110

1211
using namespace geode::prelude;
1312
/**
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
#include <Geode/Geode.hpp>
44
#include <rift.hpp>
5-
#include "Macros.h"
5+
#include "Macros.hpp"
6+
#include "Utils.hpp"
67

78
using namespace geode::prelude;
89

0 commit comments

Comments
 (0)