Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3a7a4ef
RatingsManager::getDemonTier uses cache now as it should
B1rtek Oct 8, 2025
3a8f987
Rating details are downloaded only after entering the advanced popup
B1rtek Oct 9, 2025
b77fe0c
Rating details in the old popup
B1rtek Oct 10, 2025
15071d1
More accurate rating loading descriptions
B1rtek Oct 10, 2025
6e116a8
Removed unnecessary logs
B1rtek Oct 10, 2025
7b1774e
Added the IRatingObserver interface
B1rtek Oct 10, 2025
00329d5
Added IRatingObserver to GDDLRobtopLevelsLayer
B1rtek Oct 10, 2025
40372c6
GDDLRobtopLevelsLayer subscribes and unsubscribes correctly
B1rtek Oct 12, 2025
7e449df
GDDLInfoLayer subscribes and unsubscribes correctly
B1rtek Oct 12, 2025
2cc6799
Removed old request listeners from GDDLRobtopLevelsLayer and LevelInf…
B1rtek Oct 12, 2025
1697c02
Removed no longer needed parts of rating listeners
B1rtek Oct 12, 2025
d2f83f9
this TODO is just wrong
B1rtek Oct 12, 2025
99276bd
removed beta debug logs
B1rtek Oct 12, 2025
e84ee51
Fixed cache not being updated/being overwritten by going to main menu
B1rtek Oct 12, 2025
55531b2
GDDLDemonSplitLayer crash fix after clicking on a tier and exiting
B1rtek Oct 12, 2025
9550873
Added missing request cancel logs to GDDLAdvancedLevelInfoPopup
B1rtek Oct 12, 2025
579f135
Fixed GDDLDemonSplitLayer opening level browser even after closing
B1rtek Oct 12, 2025
3a64820
Replaced warnings with Notifications instead of popups
B1rtek Oct 12, 2025
33218ab
Added a function that maps HTTP status codes to short descriptions
B1rtek Oct 12, 2025
1744420
Even mode request logs
B1rtek Oct 12, 2025
27f63c9
Merged #93 back into dev
B1rtek Oct 12, 2025
607612f
Updated about.md and changelog.md
B1rtek Oct 13, 2025
6a6c01e
v1.2.7
B1rtek Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If you encounter an <cy>issue</c> with the mod, [open an issue in the mod's GitH

## Special thanks

<cb>*Code contributions:*</c> <cy>**[Diver](https://github.com/B1rtek/Geode-GDDLIntegration/pull/3)[sion](https://github.com/B1rtek/Geode-GDDLIntegration/pull/88), [dankmeme01](https://github.com/dankmeme01) (<3)**</c>
<cb>*Code contributions:*</c> <cy>**[Diver](https://github.com/B1rtek/Geode-GDDLIntegration/pull/3)[sion](https://github.com/B1rtek/Geode-GDDLIntegration/pull/88), [dankmeme01](https://github.com/dankmeme01) (<3), [hiimjasmine00](https://github.com/B1rtek/Geode-GDDLIntegration/pull/93)**</c>
<cg>*Feature suggestions:*</c> <cy>[MasterGamerY](https://github.com/B1rtek/Geode-GDDLIntegration/issues/1), [Weebifying](https://github.com/B1rtek/Geode-GDDLIntegration/pull/2), [averiee_](https://github.com/B1rtek/Geode-GDDLIntegration/milestone/4), [TheSuperJepphyKiller](https://github.com/B1rtek/Geode-GDDLIntegration/issues/6), [hoshinekosanti](https://github.com/B1rtek/Geode-GDDLIntegration/issues/11), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/15), [Koble](https://github.com/B1rtek/Geode-GDDLIntegration/issues/21), [Diversion](https://github.com/B1rtek/Geode-GDDLIntegration/issues/25), [peteratomic](https://github.com/B1rtek/Geode-GDDLIntegration/issues/34), [ninXout](https://github.com/B1rtek/Geode-GDDLIntegration/pull/61), [itzgabrix](https://github.com/B1rtek/Geode-GDDLIntegration/issues/45), [FRBFStudios](https://github.com/B1rtek/Geode-GDDLIntegration/issues/74)</c>
<cy>*Problem solving:*</c> <cy>hiimjasmine00, thesillydoggo</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/20), [GlassesCatandsteve](https://github.com/B1rtek/Geode-GDDLIntegration/issues/27), [HotKentang, wangko5383, dshifter, Ev212](https://github.com/B1rtek/Geode-GDDLIntegration/issues/29), Cvolton, [pointedbowl](https://github.com/B1rtek/Geode-GDDLIntegration/issues/33), [Neonyx27, ItzGabrix](https://github.com/B1rtek/Geode-GDDLIntegration/issues/40), [Aktimoose](https://github.com/B1rtek/Geode-GDDLIntegration/issues/46), [MasterGamerY, Denyscrasav4ik, rynethegrynd](https://github.com/B1rtek/Geode-GDDLIntegration/issues/49), [ZorTik](https://github.com/B1rtek/Geode-GDDLIntegration/issues/50), [ZorTik, zHackro, powerz](https://github.com/B1rtek/Geode-GDDLIntegration/issues/58), 7w7y, [Cosmella-v](https://github.com/B1rtek/Geode-GDDLIntegration/issues/75), [calum12345](https://github.com/B1rtek/Geode-GDDLIntegration/issues/80), lyaten, just_dark_, supersquad33, [Aproxia-dev](https://github.com/B1rtek/Geode-GDDLIntegration/issues/87)</c>
<cy>*Problem solving:*</c> <cy>[hiimjasmine00](https://github.com/hiimjasmine00), thesillydoggo</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/20), [GlassesCatandsteve](https://github.com/B1rtek/Geode-GDDLIntegration/issues/27), [HotKentang, wangko5383, dshifter, Ev212](https://github.com/B1rtek/Geode-GDDLIntegration/issues/29), Cvolton, [pointedbowl](https://github.com/B1rtek/Geode-GDDLIntegration/issues/33), [Neonyx27, ItzGabrix](https://github.com/B1rtek/Geode-GDDLIntegration/issues/40), [Aktimoose](https://github.com/B1rtek/Geode-GDDLIntegration/issues/46), [MasterGamerY, Denyscrasav4ik, rynethegrynd](https://github.com/B1rtek/Geode-GDDLIntegration/issues/49), [ZorTik](https://github.com/B1rtek/Geode-GDDLIntegration/issues/50), [ZorTik, zHackro, powerz](https://github.com/B1rtek/Geode-GDDLIntegration/issues/58), 7w7y, [Cosmella-v](https://github.com/B1rtek/Geode-GDDLIntegration/issues/75), [calum12345](https://github.com/B1rtek/Geode-GDDLIntegration/issues/80), lyaten, just_dark_, supersquad33, [Aproxia-dev](https://github.com/B1rtek/Geode-GDDLIntegration/issues/87), gdexploits, _rfmx, robloxplayer0552, somewhatconsistent, kimichii_s</c>
6 changes: 3 additions & 3 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If you encounter an <cy>issue</c> with the mod, [open an issue in the mod's GitH

## Special thanks

<cb>*Code contributions:*</c> <cy>**[Diver](https://github.com/B1rtek/Geode-GDDLIntegration/pull/3)[sion](https://github.com/B1rtek/Geode-GDDLIntegration/pull/88), [dankmeme01](https://github.com/dankmeme01) (<3)**</c>
<cb>*Code contributions:*</c> <cy>**[Diver](https://github.com/B1rtek/Geode-GDDLIntegration/pull/3)[sion](https://github.com/B1rtek/Geode-GDDLIntegration/pull/88), [dankmeme01](https://github.com/dankmeme01) (<3), [hiimjasmine00](https://github.com/B1rtek/Geode-GDDLIntegration/pull/93)**</c>
<cg>*Feature suggestions:*</c> <cy>[MasterGamerY](https://github.com/B1rtek/Geode-GDDLIntegration/issues/1), [Weebifying](https://github.com/B1rtek/Geode-GDDLIntegration/pull/2), [averiee_](https://github.com/B1rtek/Geode-GDDLIntegration/milestone/4), [TheSuperJepphyKiller](https://github.com/B1rtek/Geode-GDDLIntegration/issues/6), [hoshinekosanti](https://github.com/B1rtek/Geode-GDDLIntegration/issues/11), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/15), [Koble](https://github.com/B1rtek/Geode-GDDLIntegration/issues/21), [Diversion](https://github.com/B1rtek/Geode-GDDLIntegration/issues/25), [peteratomic](https://github.com/B1rtek/Geode-GDDLIntegration/issues/34), [ninXout](https://github.com/B1rtek/Geode-GDDLIntegration/pull/61), [itzgabrix](https://github.com/B1rtek/Geode-GDDLIntegration/issues/45), [FRBFStudios](https://github.com/B1rtek/Geode-GDDLIntegration/issues/74)</c>
<cy>*Problem solving:*</c> <cy>hiimjasmine00, thesillydoggo</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/20), [GlassesCatandsteve](https://github.com/B1rtek/Geode-GDDLIntegration/issues/27), [HotKentang, wangko5383, dshifter, Ev212](https://github.com/B1rtek/Geode-GDDLIntegration/issues/29), Cvolton, [pointedbowl](https://github.com/B1rtek/Geode-GDDLIntegration/issues/33), [Neonyx27, ItzGabrix](https://github.com/B1rtek/Geode-GDDLIntegration/issues/40), [Aktimoose](https://github.com/B1rtek/Geode-GDDLIntegration/issues/46), [MasterGamerY, Denyscrasav4ik, rynethegrynd](https://github.com/B1rtek/Geode-GDDLIntegration/issues/49), [ZorTik](https://github.com/B1rtek/Geode-GDDLIntegration/issues/50), [ZorTik, zHackro, powerz](https://github.com/B1rtek/Geode-GDDLIntegration/issues/58), 7w7y, [Cosmella-v](https://github.com/B1rtek/Geode-GDDLIntegration/issues/75), [calum12345](https://github.com/B1rtek/Geode-GDDLIntegration/issues/80), lyaten, just_dark_, supersquad33, [Aproxia-dev](https://github.com/B1rtek/Geode-GDDLIntegration/issues/87)</c>
<cy>*Problem solving:*</c> <cy>[hiimjasmine00](https://github.com/hiimjasmine00), thesillydoggo</c>
<cr>*Bug reporters:*</c> <cy>croozington, bllue, [Fleeym](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780380), [matcool](https://github.com/geode-sdk/indexer/issues/557#issuecomment-1913780699), [Lexicon](https://github.com/B1rtek/Geode-GDDLIntegration/issues/7), [patrick61804](https://github.com/B1rtek/Geode-GDDLIntegration/issues/16), [epicmushroom.](https://github.com/B1rtek/Geode-GDDLIntegration/issues/20), [GlassesCatandsteve](https://github.com/B1rtek/Geode-GDDLIntegration/issues/27), [HotKentang, wangko5383, dshifter, Ev212](https://github.com/B1rtek/Geode-GDDLIntegration/issues/29), Cvolton, [pointedbowl](https://github.com/B1rtek/Geode-GDDLIntegration/issues/33), [Neonyx27, ItzGabrix](https://github.com/B1rtek/Geode-GDDLIntegration/issues/40), [Aktimoose](https://github.com/B1rtek/Geode-GDDLIntegration/issues/46), [MasterGamerY, Denyscrasav4ik, rynethegrynd](https://github.com/B1rtek/Geode-GDDLIntegration/issues/49), [ZorTik](https://github.com/B1rtek/Geode-GDDLIntegration/issues/50), [ZorTik, zHackro, powerz](https://github.com/B1rtek/Geode-GDDLIntegration/issues/58), 7w7y, [Cosmella-v](https://github.com/B1rtek/Geode-GDDLIntegration/issues/75), [calum12345](https://github.com/B1rtek/Geode-GDDLIntegration/issues/80), lyaten, just_dark_, supersquad33, [Aproxia-dev](https://github.com/B1rtek/Geode-GDDLIntegration/issues/87), gdexploits, _rfmx, robloxplayer0552, somewhatconsistent, kimichii_s</c>
10 changes: 9 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# v1.2.7
- (Fix by [hiimjasmine00](https://github.com/hiimjasmine00)) [Fixed LevelSelectLayer tower exit crash](https://github.com/B1rtek/Geode-GDDLIntegration/pull/93) (thank you!!)
- Fixed a bug which crashed the game after clicking on a tier and exiting the GDDL Demon Split (thank you robloxplayer0552 and gdexploits!)
- Fixed a bug which prevented the updates to internal cache from being saved
- Fixed a visual bug which stacked extra loading circles on top of each other in the GDDL Demon Split (thank you gdexploits!)
- Optimized the amount of ratings the mod performs (thank you gdexploits, _rfmx, robloxplayer0552, somewhatconsistent and kimichii_s for testing!)
- Added even more logging than last time and extra error messages

# v1.2.6
- [Fixed the login bug]() (thank you Aproxia-dev!)
- [Fixed the login bug](https://github.com/B1rtek/Geode-GDDLIntegration/issues/87) (thank you Aproxia-dev!)
- Fixed incorrect popup title for "Attempts" in the rating submission menu
- Added extra spacing for two player specific labels on medium and low graphics to prevent text overlapping
- Added a lot more logging
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "4.9.0",
"version": "v1.2.6",
"version": "v1.2.7",
"gd": {
"android": "2.2074",
"win": "2.2074",
Expand Down
35 changes: 23 additions & 12 deletions src/RatingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ void RatingsManager::cacheList(bool onQuit) {
}

// ReSharper disable once CppDFAConstantFunctionResult (it's not true!)
int RatingsManager::getDemonTier(const int id) { return !demonMap.contains(id) ? -1 : demonMap[id].roundedRating; }
int RatingsManager::getDemonTier(const int id) {
if (!demonMap.contains(id)) {
return getCachedTier(id);
}
return demonMap[id].roundedRating;
}

cocos2d::ccColor3B RatingsManager::getTierColor(const int tier) {
if (tier > tierColors.size() || tier < 0) {
Expand Down Expand Up @@ -148,6 +153,12 @@ bool RatingsManager::addRatingFromResponse(const int id, const std::string &resp
return false;
}
demonMap[id] = rating;
ratingsCache[id] = rating.roundedRating;
// the requests for ratings are being made inside the rating popups, so the rest of the interface has to "subscribe" to changes
// this is the place where we can notify them about the update that happened to the ratings list
for (const auto observer: ratingObservers) {
observer->updateRating();
}
return true;
}

Expand Down Expand Up @@ -215,18 +226,10 @@ std::map<int, int> RatingsManager::getTierStats() {
}

/**
* Populates the in-memory cache from file and then checks if that actually populated it
* Checks if cache is empty
*/
bool RatingsManager::alreadyCached() {
populateFromSave();
return !ratingsCache.empty();
}

/**
* Checks if cache is empty WIHTOUT trying to populate it
*/
bool RatingsManager::cacheNotEmpty() {
return !ratingsCache.empty();
bool RatingsManager::cacheEmpty() {
return ratingsCache.empty();
}

void RatingsManager::updateCacheFromSearch(const int levelID, const float rating) {
Expand Down Expand Up @@ -282,3 +285,11 @@ Submission RatingsManager::getSubmission(const int levelID) {
void RatingsManager::clearSubmissionCache() {
submissionsCache.clear();
}

void RatingsManager::subscribeToObservers(IRatingObserver* newSubscriber) {
ratingObservers.insert(newSubscriber);
}

void RatingsManager::unsubscribeFromObservers(IRatingObserver* unsubscribing) {
ratingObservers.erase(unsubscribing);
}
13 changes: 9 additions & 4 deletions src/RatingsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <map>
#include <Geode/Geode.hpp>
#include <objects/IRatingObserver.h>
#include <objects/RatingsSpread.h>
#include <objects/Skillsets.h>

Expand All @@ -19,11 +20,13 @@ class RatingsManager {
inline static std::map<int, Submission> submissionsCache{};
inline static int cacheTimestamp = 0;
inline static std::string cachedListPath = Mod::get()->getSaveDir().string() + "/gddlcache.json";
inline static std::set<IRatingObserver*> ratingObservers{};

static GDDLRating parseJson(const std::string& response);
public:
inline static std::string gddlSheetUrl = "https://docs.google.com/spreadsheets/d/1qKlWKpDkOpU1ZF6V6xGfutDY2NvcA8MNPnsv6GBkKPQ/gviz/tq?tqx=out:csv&sheet=GDDL";
inline static bool triedToCache = false;
inline static bool readCache = false;
inline static bool triedToDownloadCache = false;
static std::vector<int> tierColors;

static void populateFromSave();
Expand All @@ -42,9 +45,7 @@ class RatingsManager {

static std::map<int, int> getTierStats();

static bool alreadyCached();

static bool cacheNotEmpty();
static bool cacheEmpty();

static void updateCacheFromSearch(int levelID, const float rating);

Expand Down Expand Up @@ -73,6 +74,10 @@ class RatingsManager {
static Submission getSubmission(const int levelID);

static void clearSubmissionCache();

static void subscribeToObservers(IRatingObserver* newSubscriber);

static void unsubscribeFromObservers(IRatingObserver* unsubscribing);
};


Expand Down
88 changes: 77 additions & 11 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,25 @@ void Utils::bindCacheDownloadCallback(EventListener<web::WebTask>& cacheEventLis
Notification::create("GDDL Cache refresh failed - received empty response", NotificationIcon::Error, 3)->show();
log::error("Utils::bindCacheDownloadCallback: {}", errorMessage);
} else {
RatingsManager::cacheRatings(response);
if (!RatingsManager::cacheNotEmpty()) {
const std::string errorMessage = "GDDL Cache refresh failed - received no ratings";
Notification::create(errorMessage, NotificationIcon::Error, 3)->show();
log::error("Utils::bindCacheDownloadCallback: {}, raw response: {}", errorMessage, response);
// populate the cache from the save anyway, there could be something in there
RatingsManager::populateFromSave();
log::warn("Utils::bindCacheDownloadCallback: Reusing old cache...");
} else if (notifySuccess) {
Notification::create("GDDL Cache refresh succeded!", NotificationIcon::Success, 2)->show();
log::info("Utils::bindCacheDownloadCallback: GDDL Cache refresh succeded");
if (res->code() == 200) {
RatingsManager::cacheRatings(response);
if (RatingsManager::cacheEmpty()) {
const std::string errorMessage = "GDDL Cache refresh failed - received no ratings";
Notification::create(errorMessage, NotificationIcon::Error, 3)->show();
log::error("Utils::bindCacheDownloadCallback: {}, raw response: {}", errorMessage, response);
// populate the cache from the save anyway, there could be something in there
RatingsManager::populateFromSave();
log::warn("Utils::bindCacheDownloadCallback: Reusing old cache...");
} else {
if (notifySuccess) {
Notification::create("GDDL Cache refresh succeded!", NotificationIcon::Success, 2)->show();
}
log::info("Utils::bindCacheDownloadCallback: GDDL Cache refresh succeded");
}
} else {
const std::string errorMessage = "GDDL Cache refresh failed - " + getErrorMessageFromErrorCode(res->code()).value_or(res->string().unwrapOr("Response was not a valid string"));
Notification::create(errorMessage, NotificationIcon::Error, 2)->show();
log::error("Utils::bindCacheDownloadCallback: [{}] {}", res->code(), errorMessage);
}
}
} else if (e->isCancelled()) {
Expand Down Expand Up @@ -274,3 +282,61 @@ CCSprite* Utils::getGrayPopupCloseButton(const float scale) {
else if (bgSetting == "Purple") color = CircleBaseColor::DarkPurple;
return CircleButtonSprite::createWithSpriteFrameName("geode.loader/close.png", scale, color);
}

std::optional<std::string> Utils::getErrorMessageFromErrorCode(int errorCode) {
if (errorCode == 401) {
return "Unauthorized";
}
if (errorCode == 403) {
return "Forbidden";
}
if (errorCode == 408 || errorCode == 522) {
return "Timed out";
}
if (errorCode == 413) {
return "Payload too large";
}
if (errorCode == 414) {
return "Request URI too long";
}
if (errorCode == 418) {
return "I'm a teapot";
}
if (errorCode == 420) {
return "Enhance your calm";
}
if (errorCode == 429) {
return "Too many requests";
}
if (errorCode == 444) {
return "No response";
}
if (errorCode == 495 || errorCode == 496) {
return "SSL certificate error";
}
if (errorCode == 500) {
return "Internal server error";
}
if (errorCode == 502) {
return "Bad gateway";
}
if (errorCode == 503) {
return "Service unavailable";
}
if (errorCode == 504) {
return "Gateway timeout";
}
return std::nullopt;
}

std::string Utils::getErrorFromMessageAndResponse(matjson::Value jsonResponse, web::WebResponse* res) {
std::string errorMessage = getErrorMessageFromErrorCode(res->code()).value_or(res->string().unwrapOr(std::to_string(res->code())));
if (jsonResponse.contains("message")) {
if (jsonResponse["message"].isArray()) {
errorMessage = jsonResponse["message"].asArray().unwrap()[0].asString().unwrapOr("Response was not a valid string");
} else if (jsonResponse["message"].isString()) {
errorMessage = jsonResponse["message"].asString().unwrapOr("Response was not a valid string");
}
}
return errorMessage;
}
2 changes: 2 additions & 0 deletions src/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class Utils {
static std::string getUserAgent();
static std::string getGrayPopupBG();
static CCSprite* getGrayPopupCloseButton(float scale = .85f);
static std::optional<std::string> getErrorMessageFromErrorCode(int errorCode);
static std::string getErrorFromMessageAndResponse(matjson::Value jsonResponse, web::WebResponse* res);
};

template <typename T>
Expand Down
Loading