diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index b925b16b..1e0ecfe5 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -939,6 +939,7 @@ class CustomSongLayer : FLAlertLayer, FLAlertLayerProtocol, TextInputDelegate, G } class CustomSongWidget : cocos2d::CCNode, MusicDownloadDelegate, FLAlertLayerProtocol { + bool init(SongInfoObject*, LevelSettingsObject*, bool, bool, bool, bool, bool hideBackground) = mac 0x37be20, win 0x685b0; void FLAlert_Clicked(FLAlertLayer*, bool) {} void loadSongInfoFinished(SongInfoObject*) {} diff --git a/loader/src/ids/CustomSongWidget.cpp b/loader/src/ids/CustomSongWidget.cpp new file mode 100644 index 00000000..1917cf3d --- /dev/null +++ b/loader/src/ids/CustomSongWidget.cpp @@ -0,0 +1,40 @@ +#include "AddIDs.hpp" + +#include +#include +#include + +using namespace geode::prelude; + +$register_ids(CustomSongWidget) { + setIDSafe(this, 0, "bg"); + setIDSafe(this, 0, "loading-bar"); + setIDSafe(this, 0, "song-name-label"); + setIDSafe(this, 1, "author-name-label"); + setIDSafe(this, 2, "id-and-size-label"); + setIDSafe(this, 3, "error-label"); + setIDSafe(this, 0, "buttons-menu"); + auto customSongWidgetMenu = this->getChildByID("buttons-menu"); + setIDSafe(customSongWidgetMenu, 0, "download-button"); + setIDSafe(customSongWidgetMenu, 1, "cancel-button"); + setIDSafe(customSongWidgetMenu, 2, "use-button"); + setIDSafe(customSongWidgetMenu, 3, "refresh-button"); + setIDSafe(customSongWidgetMenu, 4, "play-song-button"); + setIDSafe(customSongWidgetMenu, 5, "more-button"); +}; + +struct CustomSongWidgetIDs : Modify { + 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; + } +}; \ No newline at end of file