diff --git a/src/Managers/MusicDownloadManager.cpp b/src/Managers/MusicDownloadManager.cpp index d1b9d5c..03874d9 100644 --- a/src/Managers/MusicDownloadManager.cpp +++ b/src/Managers/MusicDownloadManager.cpp @@ -1,91 +1,87 @@ #include "includes.h" +#define FORMAT(STR, ...) cocos2d::CCString::createWithFormat(STR, VA_ARGS)->getCString(); -void MusicDownloadManager::ProcessHttpGetRequest(std::string p0, std::string p1, cocos2d::extension::SEL_HttpResponse p2, int p3, int p4) -{ - return; -} - - -void MusicDownloadManager::ProcessHttpRequest(std::string p0, std::string p1, std::string p2, GJHttpType p3) -{ - return; -} +PASS(void MusicDownloadManager::ProcessHttpGetRequest(std::string, std::string, cocos2d::extension::SEL_HttpResponse, int, int), "This one seems like a mess...."); +PASS(void MusicDownloadManager::ProcessHttpRequest(std::string, std::string, std::string, GJHttpType), "This one seems like a mess as well...."); void MusicDownloadManager::addDLToActive(char const* tag, cocos2d::CCObject* obj) { - return; + // TODO: maybe a false positive? + //std::basic_string::basic_string(&v6, a2, (int)v5); + m_activeDownloads->setObject(obj); } - void MusicDownloadManager::addDLToActive(char const* tag) { - return; + addDLToActive(tag, cocos2d::CCNode::create()); } - - /* Unknown Return: MusicDownloadManager::addMusicDownloadDelegate(MusicDownloadDelegate* p0){}; */ -void MusicDownloadManager::addSongObjectFromString(std::string p0) -{ - return; -} - +PASS(void MusicDownloadManager::addSongObjectFromString(std::string), "Not in the mood to do this one yet...."); void MusicDownloadManager::clearSong(int p0) { + const char* song = FORMAT("%i", p0); + std::string songStr = song; + m_songObjects->removeObjectForKey(songStr); return; } +PASS(void MusicDownloadManager::clearUnusedSongs(), "Not in the mood to do this one yet...."); -void MusicDownloadManager::clearUnusedSongs() -{ - return; -} +PASS(void MusicDownloadManager::createArtistsInfo(std::string), "Not in the mood to do this one yet...."); +PASS(void MusicDownloadManager::createSongsInfo(std::string, std::string), "Should decompile addSongObjectFromString() first before decompiling this one"): -void MusicDownloadManager::createArtistsInfo(std::string p0) -{ - return; -} +PASS(void MusicDownloadManager::dataLoaded(DS_Dictionary), "Decompile once MLDM values are documented"); -void MusicDownloadManager::createSongsInfo(std::string p0, std::string p1) -{ - return; -} +PASS(void MusicDownloadManager::deleteSFX(int), "Very confusing"); +PASS(void MusicDownloadManager::deleteSong(int), "Very confusing"); -void MusicDownloadManager::dataLoaded(DS_Dictionary* p0) +void MusicDownloadManager::downloadCustomSong(int id) { - return; -} - - -void MusicDownloadManager::deleteSFX(int p0) -{ - return; -} - - -void MusicDownloadManager::deleteSong(int p0) -{ - return; -} - - -void MusicDownloadManager::downloadCustomSong(int p0) -{ - return; + // TODO: Unknown field... + //if ( *(_DWORD *)(this[1].field_0 - 12) ) + //{ + const char* songDownKey = getSongDownloadKey(id); + if (!isDLActive(songDownKey)) + { + std::string str = GameToolbox::intToString(id); + std::string music = "/music/"; + music += ".ogg"; + // This is v9 btw, value unknown since generateCustomContentURL's return is unknown + std::string url = ""; + // Unknown return + //MusicDownloadManager::generateCustomContentURL(&v9, this, &v10); + ProcessHttpGetRequest(url, music, onDownloadSongCompleted, 0, 0); + addDLToActive(songDownKey); + } + //} } void MusicDownloadManager::downloadMusicLibrary() { - return; + // TODO: Unknown field... + //if ( *(_DWORD *)(this[1].field_0 - 12) ) + //{ + if (!isDLActive("dl_music_l")) + { + m_downloadingMusicLibrary = true; + std::string url = "/music/musiclibrary_02.dat"; + // Unknown return + //MusicDownloadManager::generateCustomContentURL(&v5, this, &v6); + std::string str = ""; + ProcessHttpGetRequest(url, str, onDownloadMusicLibraryCompleted, 0, 0); + addDLToActive("dl_music_l"); + } + //} } @@ -209,8 +205,11 @@ cocos2d::CCObject* MusicDownloadManager::getDLObject(char const* p0) /* Unknown Return: MusicDownloadManager::getSFXObject(int p0){}; */ - -/* Unknown Return: MusicDownloadManager::getSongDownloadKey(int p0){}; */ +// This one was obvious... +const char* MusicDownloadManager::getSongDownloadKey(int id) +{ + return FORMAT("d_%i", id); +} void MusicDownloadManager::getSongInfo(int p0, bool p1) { @@ -449,9 +448,37 @@ MusicDownloadManager* MusicDownloadManager::sharedState() } -void MusicDownloadManager::showTOS(FLAlertLayerProtocol* p0) +void MusicDownloadManager::showTOS(FLAlertLayerProtocol* delegate) { - return; + + std::string text = + "Important notification - Terms of use. RobTop Games provides a library of music and sound effects for creative use w" + "ithin Geometry Dash. You are free to use these assets for creating and sharing levels within the game. However, redi" + "stributing, selling, manipulating, or using these assets outside the game is prohibited. If you share game-related c" + "ontent on social media or upload videos featuring custom music, please give credit to the respective artist. Regardi" + "ng music from Newgrounds.com: Some custom songs are available via a third party website, Newgrounds.com. These songs" + ", created by artists using Newgrounds.com, are under Creative Commons licensing terms accessible on Newgrounds.com. " + "By downloading a song from Newgrounds, you accept these terms and any others designated by Newgrounds. RobTop Games " + "is not the provider of songs from Newgrounds.com, nor a party to the licensing agreements, and does not store any au" + "dio files downloaded from Newgrounds.com. You are responsible for the content you create using all music and sound e" + "ffects provided. Ensure your creations adhere to the game's community guidelines and do not infringe on any rights. " + "The availability of music and sound effects in Geometry Dash is subject to change. RobTop Games may add or remove co" + "ntent from both the custom library and the Newgrounds.com selection without prior notice. We do not guarantee the co" + "ntinuous availability or suitability of any music or sound effects in the game. We may update these terms at any tim" + "e, with your continued use of Geometry Dash signifying acceptance of any changes. By clicking the 'I Accept' button," + " you acknowledge and approve of the above-stated terms of use."; + FLAlertLayer layer = FLAlertLayer::create( + delegate, + "Terms of Use", + &text, + "Cancel", + "I Accept", + 400.0f, + true, + 280.0f + 1.0f); + layer->init(1); + layer->show(); } @@ -478,3 +505,6 @@ void MusicDownloadManager::songStateChanged() /* Unknown Return: MusicDownloadManager::tryUpdateSFXLibrary(){}; */ + + +