Skip to content

Commit

Permalink
i hate song ID 584131.
Browse files Browse the repository at this point in the history
Signed-off-by: Erymanthus[#5074] | (u/)RayDeeUx <[email protected]>
  • Loading branch information
RayDeeUx committed Sep 28, 2024
1 parent 7eb0eb1 commit c0c88cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# v1.5.1
- Added "Copy Song ID" button (suggested by [Akashnil](https://discord.com/users/1068096599701590056)). <cy>This button only appears when using songs you've downloaded from Newgrounds or the Music Library. NONGs will not return a song ID.</c>
- Added "Blacklist Song" button (suggested by [AlphaQuata](https://discord.com/users/766876726566846505)). <cy>This button works regardless of your custom songs or Playlist Mode choices.</c>
- Added "Copy Song ID" button (suggested by [Akashnil](https://discord.com/users/1068096599701590056)). <cy>Custom songs and NONGs will not return a song ID. They will fall back to its song name instead.</c> <cy>Button sprite adapted from [hiimjustin000](https://github.com/hiimjustin000) with permission.</c>
- Added "Blacklist Song" button (suggested by [AlphaQuata](https://discord.com/users/766876726566846505)). <cy>This button works regardless of your custom songs or Playlist Mode choices.</c> <cy>To manually un-blacklist a song, open `blacklist.txt` in the mod's config directory and edit it accordingly.</c>
- Fix a bug where Playlist Mode would ignore the in-game "Menu Music" toggle if that was disabled.
# v1.5.0
- Added "Playlist Mode" (suggested by [TheKevineer](https://discord.com/users/633040761256017963)). <cy>This feature is incredibly unstable, especially outside of Windows. I have done everything I could to keep its behavior consistent between Windows, macOS, and Android, but any crashes/issues from this feature are either beyond my control or have been acknowledged during beta testing without an obvious/more immediate fix.</c>
Expand Down
1 change: 1 addition & 0 deletions src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void SongManager::setCurrentSong(std::string song) {
}

void SongManager::setCurrentSongToSavedSong() {
if (m_isMenuLoop) return;
m_currentSong = geode::Mod::get()->getSavedValue<std::string>("lastMenuLoop");
}

Expand Down
9 changes: 6 additions & 3 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void Utils::generateNotification() {
// fmt::format("{} by {} ({})", songInfo->m_songName, songInfo->m_artistName, songInfo->m_songID);
std::string resultString = "";
auto formatSetting = geode::Mod::get()->getSettingValue<std::string>("songFormatNGML");
bool isMenuLoopFromNG = songInfo->m_songID == 584131;
if (formatSetting == "Song Name, Artist, Song ID") {
resultString = fmt::format("{} by {} ({})", songInfo->m_songName, songInfo->m_artistName, songInfo->m_songID);
} else if (formatSetting == "Song Name + Artist") {
Expand All @@ -163,6 +164,7 @@ void Utils::generateNotification() {
} else {
resultString = fmt::format("{}", songInfo->m_songName);
}
if (isMenuLoopFromNG) resultString = resultString.append(" [OOF!]");
return Utils::makeNewCard(notifString.append(resultString));
}
return Utils::makeNewCard(notifString.append(songFileName.string()));
Expand Down Expand Up @@ -243,7 +245,7 @@ void Utils::populateVector(bool customSongs) {

bool isInTextBlacklist = false;

for (std::string string : blacklist) {
for (const std::string& string : blacklist) {
if (string.starts_with(filePathString)) {
isInTextBlacklist = true;
break;
Expand All @@ -270,21 +272,22 @@ void Utils::populateVector(bool customSongs) {
--raydeeux
*/
geode::cocos::CCArrayExt<SongInfoObject*> songs = downloadManager->getDownloadedSongs();
bool qualifiedForOGMenuBlacklist = geode::Mod::get()->getSavedValue<bool>("isEry");
for (auto song : songs) {
if (!song) continue;

std::string songPath = downloadManager->pathForSong(song->m_songID);

bool isInTextBlacklist = false;

for (std::string string : blacklist) {
for (const std::string& string : blacklist) {
if (string.starts_with(songPath)) {
isInTextBlacklist = true;
break;
}
}

if (!Utils::isSupportedExtension(songPath) || std::ranges::find(otherBlacklist, songPath) != otherBlacklist.end() || isInTextBlacklist) continue;
if (!Utils::isSupportedExtension(songPath) || std::ranges::find(otherBlacklist, songPath) != otherBlacklist.end() || isInTextBlacklist || (qualifiedForOGMenuBlacklist && song->m_songID == 584131)) continue; // apply hardcode blacklist 584131 onto self in light of BS edge case caught by hiimjustin001: https://discord.com/channels/911701438269386882/911702535373475870/1289021323279990795

geode::log::debug("Adding Newgrounds/Music Library song: {}", songPath);
SongManager::get().addSong(songPath);
Expand Down

0 comments on commit c0c88cf

Please sign in to comment.