Skip to content

Commit cd2dc94

Browse files
committed
technicalities!
1 parent abbb423 commit cd2dc94

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

src/MenuLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class $modify(MenuLayerMLHook, MenuLayer) {
3737
if (Utils::getBool("enableFavoriteButton")) Utils::addButton("favorite", menu_selector(MenuLayerMLHook::onFavoriteButton), REST_OF_THE_OWL);
3838
if (Utils::getBool("enableHoldSongButton")) Utils::addButton("hold", menu_selector(MenuLayerMLHook::onHoldSongButton), REST_OF_THE_OWL);
3939
if (Utils::getBool("enablePreviousButton")) Utils::addButton("prev", menu_selector(MenuLayerMLHook::onPreviousButton), REST_OF_THE_OWL);
40-
if (Utils::getBool("enableAddToPlaylistButton")) Utils::addButton("add", menu_selector(MenuLayerMLHook::onAddToPlylstBtn), REST_OF_THE_OWL);
40+
if (Utils::getBool("enableAddToPlaylistButton") && (!Utils::getBool("loadPlaylistFile") || SongManager::get().getPlaylistIsEmpty())) Utils::addButton("add", menu_selector(MenuLayerMLHook::onAddToPlylstBtn), REST_OF_THE_OWL);
4141
if (Utils::getBool("enableViewSongListButton")) Utils::addButton("playlist", menu_selector(MenuLayerMLHook::onSongListButton), REST_OF_THE_OWL);
4242
return true;
4343
}

src/SongControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ namespace SongControl {
160160
if (songManager.isOriginalMenuLoop()) return SongControl::woahThereBuddy("There's nothing to add to your playlist! Double-check your config folder again.");
161161
if (songManager.isOverride()) return SongControl::woahThereBuddy("You're trying to add your own <cy>override</c> to your playlist. Double-check your settings again.");
162162

163-
if (geode::Mod::get()->getSettingValue<bool>("loadPlaylistFile") && !songManager.getPlaylistIsEmpty()) {
163+
if (Utils::getBool("loadPlaylistFile") && !songManager.getPlaylistIsEmpty()) {
164164
return geode::Notification::create(
165165
"You've already loaded an MLR playlist file!",
166166
geode::NotificationIcon::Error, 10.f

src/Utils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void Utils::constantShuffleModeNewSong(const bool fromGJBGL) {
102102

103103
// create notif card stuff
104104
void Utils::newNotification(const std::string& notifString, const bool checkSetting) {
105+
if (!GameManager::get() || !GameManager::get()->m_menuLayer) return;
105106
if (cocos2d::CCNode* oldCard = Utils::findCardRemotely()) oldCard->removeMeAndCleanup();
106107
if (checkSetting && !Utils::getBool("enableNotification")) return;
107108

src/ui/SongControlMenu.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bool SongControlMenu::setup(const std::string&) {
3131
Utils::addButton("favorite", menu_selector(SongControlMenu::onFavoriteButton), REST_OF_THE_OWL);
3232
Utils::addButton("hold", menu_selector(SongControlMenu::onHoldSongButton), REST_OF_THE_OWL);
3333
Utils::addButton("prev", menu_selector(SongControlMenu::onPreviousButton), REST_OF_THE_OWL);
34-
if (!geode::Mod::get()->getSettingValue<bool>("loadPlaylistFile") || SongManager::get().getPlaylistIsEmpty()) {
34+
if (!Utils::getBool("loadPlaylistFile") || SongManager::get().getPlaylistIsEmpty()) {
3535
Utils::addButton("add", menu_selector(SongControlMenu::onAddToPlylstBtn), REST_OF_THE_OWL);
3636
}
3737

@@ -148,8 +148,15 @@ void SongControlMenu::onPlaylistButton(CCObject*) {
148148
SongListLayer::create()->showLayer(true);
149149
}
150150
void SongControlMenu::onAddToPlylstBtn(CCObject*) {
151-
if (geode::Mod::get()->getSettingValue<bool>("loadPlaylistFile")) return geode::log::info("tried adding current song to a playlist file. BOOOOOOOOOOOOO");
152-
SongControl::addSongToPlaylist(SongManager::get().getCurrentSong());
151+
SongManager& songManager = SongManager::get();
152+
if (Utils::getBool("loadPlaylistFile") && !songManager.getPlaylistIsEmpty()) {
153+
geode::log::info("tried adding current song to a playlist file. BOOOOOOOOOOOOO");
154+
return geode::Notification::create(
155+
"You've already loaded an MLR playlist file!",
156+
geode::NotificationIcon::Error, 10.f
157+
)->show();
158+
}
159+
SongControl::addSongToPlaylist(songManager.getCurrentSong());
153160
SongControlMenu::updateCurrentLabel();
154161
}
155162
void SongControlMenu::onSettingsButton(CCObject*) {

0 commit comments

Comments
 (0)