Skip to content

Commit

Permalink
add $override annotations + comment out the crashing func on android
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Feb 7, 2024
1 parent c048a5b commit b3ae720
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

# Ignore build folders
**/build
**/build-*

# Workspace files are user-specific
*.sublime-workspace
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ file(GLOB SOURCES

add_library(${PROJECT_NAME} SHARED ${SOURCES})

target_include_directories(${PROJECT_NAME} PUBLIC "src")

if (NOT DEFINED ENV{GEODE_SDK})
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
else()
Expand Down
19 changes: 14 additions & 5 deletions src/features/BetterColorSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
void updateSpritesInMenu(CCNode* menu) {
if (menu) {
for (auto child : CCArrayExt<CCMenuItemSpriteExtra*>(menu->getChildren())) {
if (auto spr = static_cast<ColorChannelSprite*>(
child->getChildByID("channel-sprite"_spr)
)) {
if (auto spr = static_cast<ColorChannelSprite*>(child->getChildByID("channel-sprite"_spr))) {
this->updateSprite(spr);
}
}
Expand All @@ -149,9 +147,10 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
void updateSprites() {
this->updateSpritesInMenu(m_mainLayer->getChildByID("channels-menu"));
this->updateSpritesInMenu(m_mainLayer->getChildByID("special-channels-menu"));
this->updateSpritesInMenu(m_mainLayer->getChildByID("recent-channels-menu"));
this->updateSpritesInMenu(m_mainLayer->getChildByID("recent-channels-menu"_spr));
}

$override
void onSelectColor(CCObject* sender) {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::onSelectColor(sender);
Expand All @@ -177,24 +176,30 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
}
}

$override
void highlightSelected(ButtonSprite* sprite) {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::highlightSelected(sprite);
}
auto selected = this->getActiveMode(true);
this->highlightSelectedInMenu(m_mainLayer->getChildByID("channels-menu"), selected);
this->highlightSelectedInMenu(m_mainLayer->getChildByID("special-channels-menu"), selected);
this->highlightSelectedInMenu(m_mainLayer->getChildByID("recent-channels-menu"), selected);
this->highlightSelectedInMenu(m_mainLayer->getChildByID("recent-channels-menu"_spr), selected);
}

// todo: hooking this virtual crashes on Android? probably a TulipHook or loader issue
#ifndef GEODE_IS_ANDROID
$override
void colorSelectClosed(CCNode* target) {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::colorSelectClosed(target);
}
CustomizeObjectLayer::colorSelectClosed(target);
this->updateSprites();
}
#endif

$override
void updateCustomColorLabels() {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::updateCustomColorLabels();
Expand All @@ -207,6 +212,7 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
m_customColorInput->m_textField->detachWithIME();
}

$override
void onUpdateCustomColor(CCObject* sender) {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::onUpdateCustomColor(sender);
Expand Down Expand Up @@ -290,6 +296,7 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
m_fields->modified = true;
}

$override
void textChanged(CCTextInputNode* input) {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::textChanged(input);
Expand All @@ -299,6 +306,7 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
m_fields->modified = true;
}

$override
void onClose(CCObject* sender) {
if (!Mod::get()->template getSettingValue<bool>("new-color-menu")) {
return CustomizeObjectLayer::onClose(sender);
Expand Down Expand Up @@ -359,6 +367,7 @@ class $modify(NewColorSelect, CustomizeObjectLayer) {
this->gotoPage(m_fields->page + sender->getTag());
}

$override
bool init(GameObject* obj, CCArray* objs) {
if (!CustomizeObjectLayer::init(obj, objs))
return false;
Expand Down
1 change: 1 addition & 0 deletions src/features/BetterFontSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class $modify(BetterSelectFontLayer, SelectFontLayer) {
}
}

$override
bool init(LevelEditorLayer* p0) {
if (!SelectFontLayer::init(p0))
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/features/FixMouseControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
using namespace geode::prelude;

class $modify(EditorUI) {
void scrollWheel(float y, float x) override {
$override
virtual void scrollWheel(float y, float x) {
// this is used a lot so store it in a variable
auto objLayer = m_editorLayer->m_objectLayer;

Expand Down
1 change: 1 addition & 0 deletions src/features/Keybinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using namespace geode::prelude;
using namespace keybinds;

struct $modify(EditorUI) {
$override
bool init(LevelEditorLayer* lel) {
if (!EditorUI::init(lel))
return false;
Expand Down
1 change: 1 addition & 0 deletions src/features/scaling/EditorPauseUIScaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using namespace geode::prelude;

class $modify(EditorPauseLayer) {
$override
bool init(LevelEditorLayer* p0) {
if (!EditorPauseLayer::init(p0))
return false;
Expand Down
1 change: 1 addition & 0 deletions src/features/scaling/EditorUIScaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using namespace geode::prelude;

class $modify(EditorUI) {
$override
bool init(LevelEditorLayer* p0) {
if (!EditorUI::init(p0))
return false;
Expand Down

0 comments on commit b3ae720

Please sign in to comment.