Skip to content

Commit 462f45c

Browse files
committed
Event and mod changes
1 parent 15c0459 commit 462f45c

3 files changed

Lines changed: 15 additions & 27 deletions

File tree

include/API.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ namespace devtools {
2727
template <typename T>
2828
concept UnderlyingIntegral = std::is_integral_v<T> || std::is_integral_v<std::underlying_type_t<T>>;
2929

30-
struct RegisterNodeEvent final : geode::SimpleEvent<RegisterNodeEvent, geode::Function<void(cocos2d::CCNode*)>> {
31-
using SimpleEvent::SimpleEvent;
30+
struct RegisterNodeEvent final : geode::Event<RegisterNodeEvent, bool(geode::Function<void(cocos2d::CCNode*)>)> {
31+
using Event::Event;
3232
};
3333

3434
template <typename T>
35-
struct PropertyFnEvent final : geode::SimpleEvent<PropertyFnEvent<T>, bool(*&)(const char* name, T&)> {
35+
struct PropertyFnEvent final : geode::Event<PropertyFnEvent<T>, bool(bool(*&)(const char* name, T&))> {
3636
using Fn = bool(const char* name, T&);
37-
using geode::SimpleEvent<PropertyFnEvent, Fn*&>::SimpleEvent;
37+
using geode::Event<PropertyFnEvent, bool(Fn*&)>::Event;
3838
};
3939

40-
struct DrawLabelFnEvent final : geode::SimpleEvent<DrawLabelFnEvent, void(*&)(const char* text)> {
40+
struct DrawLabelFnEvent final : geode::Event<DrawLabelFnEvent, bool(void(*&)(const char* text))> {
4141
using Fn = void(const char* text);
42-
using SimpleEvent::SimpleEvent;
42+
using Event::Event;
4343
};
4444

4545
template <typename T>
46-
struct EnumerableFnEvent final : geode::SimpleEvent<EnumerableFnEvent<T>, bool(*&)(const char* label, T* value, std::span<std::pair<T, const char*> const>)> {
46+
struct EnumerableFnEvent final : geode::Event<EnumerableFnEvent<T>, bool(bool(*&)(const char* label, T* value, std::span<std::pair<T, const char*> const>))> {
4747
using Fn = bool(const char* label, T* value, std::span<std::pair<T, const char*> const>);
48-
using geode::SimpleEvent<EnumerableFnEvent, Fn*&>::SimpleEvent;
48+
using geode::Event<EnumerableFnEvent, bool(Fn*&)>::Event;
4949
};
5050

51-
struct ButtonFnEvent final : geode::SimpleEvent<ButtonFnEvent, bool(*&)(const char* label)> {
51+
struct ButtonFnEvent final : geode::Event<ButtonFnEvent, bool(bool(*&)(const char* label))> {
5252
using Fn = bool(const char* label);
53-
using SimpleEvent::SimpleEvent;
53+
using Event::Event;
5454
};
5555

5656
/// @brief Checks if DevTools is currently loaded.

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ class $modify(CCEGLView) {
153153
};
154154

155155
// For the one eclipse shortcut
156-
struct ToggleDevToolsEvent : SimpleEvent<ToggleDevToolsEvent> {
157-
using SimpleEvent::SimpleEvent;
156+
struct ToggleDevToolsEvent : Event<ToggleDevToolsEvent, bool()> {
157+
using Event::Event;
158158
};
159159

160160
$execute {

src/pages/Advanced.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,7 @@ ModMetadata DevTools::inputMetadata(void* treePtr, ModMetadata metadata) {
9494
continue;
9595
}
9696
ImGui::Text("version: %s", item.getVersion().toString().c_str());
97-
const char* importance = "";
98-
switch (item.getImportance()) {
99-
case geode::ModMetadata::Dependency::Importance::Required: importance = "required"; break;
100-
case geode::ModMetadata::Dependency::Importance::Recommended: importance = "recommended"; break;
101-
case geode::ModMetadata::Dependency::Importance::Suggested: importance = "suggested"; break;
102-
}
103-
ImGui::Text("importance: %s", importance);
97+
ImGui::Text("required: %s", item.isRequired() ? "true" : "false");
10498
ImGui::Text("isResolved: %s", item.isResolved() ? "true" : "false");
10599
if (item.getMod())
106100
drawModGraphNode(item.getMod());
@@ -120,13 +114,7 @@ ModMetadata DevTools::inputMetadata(void* treePtr, ModMetadata metadata) {
120114
continue;
121115
}
122116
ImGui::Text("version: %s", item.getVersion().toString().c_str());
123-
const char* importance = "";
124-
switch (item.getImportance()) {
125-
case geode::ModMetadata::Incompatibility::Importance::Breaking: importance = "breaking"; break;
126-
case geode::ModMetadata::Incompatibility::Importance::Conflicting: importance = "conflicting"; break;
127-
case geode::ModMetadata::Incompatibility::Importance::Superseded: importance = "superseded"; break;
128-
}
129-
ImGui::Text("importance: %s", importance);
117+
ImGui::Text("breaking: %s", item.isBreaking() ? "true" : "false");
130118
ImGui::Text("isResolved: %s", item.isResolved() ? "true" : "false");
131119
if (item.getMod())
132120
drawModGraphNode(item.getMod());
@@ -165,7 +153,7 @@ void DevTools::drawModGraphNode(Mod* node) {
165153
ImColor color = ImColor(1.f, 1.f, 1.f);
166154
if (node->isUninstalled())
167155
color = ImColor(0.1f, 0.1f, 0.1f);
168-
else if (!node->isEnabled())
156+
else if (!node->isLoaded())
169157
color = ImColor(0.7f, 0.7f, 0.7f);
170158

171159
ImGui::PushStyleColor(ImGuiCol_Text, (ImU32)color);

0 commit comments

Comments
 (0)