From 16716d8bb9f8c48e130b28e088ec96c59390a973 Mon Sep 17 00:00:00 2001
From: Cvolton <cvolton@cvolton.eu>
Date: Thu, 22 Jun 2023 01:13:49 +0200
Subject: [PATCH] add missing addresses and members needed for bi

---
 bindings/GeometryDash.bro      | 111 +++++++++++++++++++++++++++------
 loader/include/Geode/Enums.hpp |   6 ++
 2 files changed, 98 insertions(+), 19 deletions(-)

diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro
index 27545eb4..857128f6 100644
--- a/bindings/GeometryDash.bro
+++ b/bindings/GeometryDash.bro
@@ -883,14 +883,17 @@ class ColorSetupDelegate {
     virtual void colorSetupClosed(int channel) {}
 }
 
-class CommentCell : TableViewCell {
+class CommentCell : TableViewCell, LikeItemDelegate, FLAlertLayerProtocol {
     void loadFromComment(GJComment*) = mac 0x111c70, win 0x5f3d0;
+    void onConfirmDelete(cocos2d::CCObject* sender) = win 0x61140;
+    void onLike(cocos2d::CCObject* sender) = win 0x60F90;
+    virtual void FLAlert_Clicked(FLAlertLayer* layer, bool btn) = win 0x61260;
+    virtual void likedItem(LikeItemType type, int id, bool special) = win 0x61070;
 
-    PAD = win 0x4;
     cocos2d::CCSprite* m_iconSprite;
     cocos2d::CCLabelBMFont* m_likeLabel;
     GJComment* m_comment;
-    PAD = win 0x4;
+    bool m_accountComment;
 }
 
 class CommentUploadDelegate {
@@ -1061,7 +1064,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele
 class DailyLevelPage : FLAlertLayer {
     static DailyLevelPage* create(bool weekly) = win 0x6a860;
     bool init(bool weekly) = win 0x6a900;
-    void updateTimers(float) = win 0x6bef0;
+    virtual void updateTimers(float) = win 0x6bef0;
     virtual void show() = mac 0x10a4b0, win 0x3f360;
 
     PAD = win 0x21;
@@ -1673,6 +1676,7 @@ class FLAlertLayer : cocos2d::CCLayerColor {
     static FLAlertLayer* create(FLAlertLayerProtocol* protocol, char const* title, gd::string content, char const* btn1, char const* btn2, float width, bool scrollable, float height) = mac 0x25dec0, win 0x227e0;
     void onBtn1(cocos2d::CCObject*) = mac 0x25ec20, win 0x23340;
     void onBtn2(cocos2d::CCObject*) = mac 0x25ec80, win 0x23380;
+    void onClose(cocos2d::CCObject*) = win 0x49C60;
 
     cocos2d::CCMenu* m_buttonMenu;
     int m_controlConnected;
@@ -2578,6 +2582,9 @@ class GJSearchObject : cocos2d::CCNode {
 
     static GJSearchObject* create(SearchType nID) = win 0xc2b90;
     static GJSearchObject* create(SearchType nID, gd::string str) = win 0xc2c80;
+    static GJSearchObject* createFromKey(const char* key) = win 0xC2760;
+    const char* getKey() = win 0xC30A0;
+    const char* getNextPageKey() = win 0xC31F0;
 
     SearchType m_searchType;
     gd::string m_searchQuery;
@@ -2725,14 +2732,16 @@ class GJUserScore : cocos2d::CCNode {
 
 class GManager : cocos2d::CCNode {
     virtual void setup() {}
-    void encodeDataTo(DS_Dictionary* data) {}
-    void dataLoaded(DS_Dictionary* data) {}
-    void firstLoad() {}
+    virtual void encodeDataTo(DS_Dictionary* data) {}
+    virtual void dataLoaded(DS_Dictionary* data) {}
+    virtual void firstLoad() {}
 
     void save() = mac 0x26f300, win 0x29250;
     void saveData(DS_Dictionary*, gd::string) = mac 0x26f4b0;
     void saveGMTo(gd::string) = mac 0x26f3b0, win 0x29250;
 
+    inline GManager() {}
+
     gd::string m_fileName;
     bool m_setup;
     bool m_saved;
@@ -2753,7 +2762,7 @@ class GameLevelManager : cocos2d::CCNode {
     cocos2d::CCArray* createAndGetScores(gd::string, GJScoreType) = win 0xa2780;
     GJGameLevel* createNewLevel() = mac 0x2b8180, win 0xa0db0;
     static GameLevelManager* sharedState() = mac 0x2a8340, win 0x9f860;
-    void getCompletedLevels(bool newFilter) = win 0xa2d20;
+    cocos2d::CCArray* getCompletedLevels(bool newFilter) = win 0xa2d20;
     void getGJUserInfo(int) = win 0xb00b0;
     void getOnlineLevels(GJSearchObject*) = win 0xa7bc0;
     void getPageInfo(char const*) = mac 0x2c0050;
@@ -2763,11 +2772,12 @@ class GameLevelManager : cocos2d::CCNode {
     void getTopArtistsKey(int) = mac 0x2ce7a0;
     void makeTimeStamp(char const*) = mac 0x2bfd90, win 0xa3f00;
     GJGameLevel* getMainLevel(int id, bool unk) = win 0xa0940;
-    bool hasLikedItemFullCheck(LikeItemType type, int itemID, int commentSourceID) = mac 0x2d83d0;
+    bool hasLikedItemFullCheck(LikeItemType type, int itemID, int commentSourceID) = mac 0x2d83d0, win 0xB86B0;
     bool hasRatedLevelStars(int levelID) = mac 0x2ca3a0;
     callback void ProcessHttpRequest(gd::string, gd::string, gd::string, GJHttpType) = mac 0x2a8670, win 0x9f8e0;
     cocos2d::CCDictionary* responseToDict(gd::string response, bool comment) = win 0xbba50;
     void storeUserNames(gd::string) = win 0xa1840;
+    void storeUserName(int userID, int accountID, gd::string str) = win 0xa1a70;
     gd::string userNameForUserID(int id) = win 0xa1c20;
     void updateUserScore() = win 0xada60;
     void downloadLevel(int id, bool downloadData) = win 0xaa730;
@@ -2775,6 +2785,25 @@ class GameLevelManager : cocos2d::CCNode {
     GJGameLevel* getSavedLevel(int id) = win 0xa2ee0;
     void saveLevel(GJGameLevel* level) = win 0xa31c0;
     void deleteLevel(GJGameLevel* level) = mac 0x2b88d0, win 0xa1640;
+    void resetCommentTimersForLevelID(int id, bool commentHistory) = win 0xB3F10;
+    void resetStoredUserInfo(int id) {
+        m_storedUserInfo->removeObjectForKey(id);
+    }
+    void resetAccountComments(int id){
+        int i = 0;
+        while(true){
+            auto key = this->getAccountCommentKey(id, i++);
+            auto levels = getStoredOnlineLevels(key);
+            if(levels != nullptr){
+                m_storedLevels->removeObjectForKey(key);
+            }else{
+                break;
+            }
+        }
+    }
+    const char* getAccountCommentKey(int a2, int a3){
+        return cocos2d::CCString::createWithFormat("a_%i_%i", a2, a3)->getCString();
+    }
 
     inline static GameLevelManager* get() {
         return GameLevelManager::sharedState();
@@ -3607,8 +3636,8 @@ class InfoLayer : FLAlertLayer, LevelCommentDelegate, CommentUploadDelegate, FLA
     cocos2d::CCLabelBMFont* m_pageLabel;
     cocos2d::CCLabelBMFont* m_commentsGoldLabel;
     GJCommentListLayer* m_list;
-    CCMenuItemSpriteExtra* m_leftArrow;
     CCMenuItemSpriteExtra* m_rightArrow;
+    CCMenuItemSpriteExtra* m_leftArrow;
     CCMenuItemSpriteExtra* m_likeBtn;
     CCMenuItemSpriteExtra* m_timeBtn;
     CCMenuItemSpriteExtra* m_reportBtn;
@@ -3644,14 +3673,19 @@ class LabelGameObject : GameObject {
     void setObjectColor(cocos2d::_ccColor3B const&) = mac 0xdbca0;
 }
 
-class LeaderboardManagerDelegate {}
+class LeaderboardManagerDelegate {
+    virtual void updateUserScoreFinished() {}
+    virtual void updateUserScoreFailed() {}
+    virtual void loadLeaderboardFinished(cocos2d::CCArray*, const char*) {}
+    virtual void loadLeaderboardFailed(const char*) {}
+}
 
 class LeaderboardsLayer : cocos2d::CCLayer {
     static LeaderboardsLayer* create(LeaderboardState state) = win 0x158710;
     bool init(LeaderboardState state) = mac 0x29f6d0, win 0x1587b0;
 }
 
-class LevelBrowserLayer : cocos2d::CCLayer {
+class LevelBrowserLayer : cocos2d::CCLayer, LevelManagerDelegate, FLAlertLayerProtocol, SetIDPopupDelegate, SetTextPopupDelegate {
     static cocos2d::CCScene* scene(GJSearchObject* search) {
         auto scene = cocos2d::CCScene::create();
         scene->addChild(LevelBrowserLayer::create(search));
@@ -3666,13 +3700,22 @@ class LevelBrowserLayer : cocos2d::CCLayer {
     void updateLevelsLabel() = win 0x15c350;
     static LevelBrowserLayer* create(GJSearchObject* search) = mac 0x251210, win 0x159fa0, ios 0x2d0a00;
 
-    PAD = win 0x18;
+    PAD = win 0x4;
+    int m_unk0;
+    TextArea* m_noInternet;
     GJListLayer* m_list;
-    CCMenuItemSpriteExtra* m_leftArrow;
     CCMenuItemSpriteExtra* m_rightArrow;
-    PAD = win 0x10;
+    CCMenuItemSpriteExtra* m_leftArrow;
+    CCMenuItemSpriteExtra* m_lastBtn;
+    CCMenuItemSpriteExtra* m_cancelSearchBtn;
+    void* m_unk4;
+    cocos2d::CCArray* m_array;
     GJSearchObject* m_searchObject;
-    PAD = win 0x14;
+    cocos2d::CCLabelBMFont* m_countText;
+    cocos2d::CCLabelBMFont* m_pageText;
+    CCMenuItemSpriteExtra* m_pageBtn;
+    cocos2d::CCLabelBMFont* m_folderText;
+    CCMenuItemSpriteExtra* m_folderBtn;
     int m_itemCount;
     int m_pageStartIdx;
     int m_pageEndIdx;
@@ -3686,6 +3729,7 @@ class LevelCell : TableViewCell {
     void onViewProfile(cocos2d::CCObject*) = win 0x5c790;
     void loadCustomLevelCell() = mac 0x1183b0, win 0x5a020;
     void updateBGColor(int index) = win 0x5c6b0;
+    void loadFromLevel(GJGameLevel* level) = win 0x59FD0;
 }
 
 class LevelCommentDelegate {
@@ -3943,6 +3987,10 @@ class LevelLeaderboard : FLAlertLayer {
     void onUpdate(cocos2d::CCObject* sender) = win 0x17d1b0;
     bool init(GJGameLevel* level, LevelLeaderboardType type) = mac 0x20d710, win 0x17c4f0;
     static LevelLeaderboard* create(GJGameLevel* level, LevelLeaderboardType leaderboardType) = win 0x17c440;
+
+    PAD = win 0x4;
+    GJGameLevel* m_level;
+    LevelLeaderboardType m_type;
 }
 
 class LevelManagerDelegate {}
@@ -3950,6 +3998,8 @@ class LevelManagerDelegate {}
 class LevelPage {
     PAD = win 0x124;
     GJGameLevel* m_level;
+
+    void onInfo(cocos2d::CCObject* sender) = win 0x189070;
 }
 
 class LevelSearchLayer : cocos2d::CCLayer {
@@ -4076,7 +4126,7 @@ class LikeItemLayer : FLAlertLayer {
     int m_commentSourceID;
     LikeItemDelegate* m_likeDelegate;
 
-    static LikeItemLayer* create(LikeItemType type, int itemID, int commentSourceID) = mac 0x35f760;
+    static LikeItemLayer* create(LikeItemType type, int itemID, int commentSourceID) = mac 0x35f760, win 0x18B940;
     bool init(LikeItemType type, int itemID, int commentSourceID) = mac 0x35f900;
 }
 
@@ -5023,10 +5073,13 @@ class PointNode : cocos2d::CCObject {
 
 class ProfilePage : FLAlertLayer, FLAlertLayerProtocol, LevelCommentDelegate, CommentUploadDelegate, UserInfoDelegate, UploadActionDelegate, UploadPopupDelegate, LeaderboardManagerDelegate {
     static ProfilePage* create(int accountID, bool idk) = mac 0x45eed0, win 0x20ee50;
-    void getUserInfoFailed(int) = win 0x2133e0;
+    virtual void getUserInfoFailed(int) = win 0x2133e0;
+    virtual void getUserInfoChanged(GJUserScore*) = win 0x213430;
     bool init(int accountID, bool idk) = mac 0x45f170, win 0x20ef00;
     void onMyLevels(cocos2d::CCObject*) = win 0x211bb0;
     void onUpdate(cocos2d::CCObject*) = win 0x20fa20;
+    void onClose(cocos2d::CCObject*) = win 0x49C60;
+    virtual void keyBackClicked() = win 0x49C80;
     void loadPageFromUserInfo(GJUserScore* score) = win 0x210040;
 
     GJUserScore* m_score;
@@ -5168,6 +5221,10 @@ class SetTargetIDLayer {
     void updateTargetID() = mac 0x15b4a0;
 }
 
+class SetTextPopupDelegate {
+    virtual void setIDPopupClosed(void*, std::string) {}
+}
+
 class SetupAnimationPopup : FLAlertLayer {
     static SetupAnimationPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x208b70;
     void onTargetIDArrow(cocos2d::CCObject*) = mac 0x209fc0;
@@ -5495,6 +5552,18 @@ class TableViewCell : cocos2d::CCLayer {
         // = mac 0x383de0, win 0x32e70;
     }
 
+    static TableViewCell* create(const char* name, float width, float height) {
+        auto pRet = new TableViewCell(name, width, height);
+
+        if (pRet) {
+            pRet->autorelease();
+            return pRet;
+        }
+
+        CC_SAFE_DELETE(pRet);
+        return nullptr;
+    }
+
     bool m_unknown;
     TableView* m_tableView;
     CCIndexPath m_indexPath;
@@ -5637,7 +5706,11 @@ class UploadPopupDelegate {
     virtual void onClosePopup() {}
 }
 
-class UserInfoDelegate {}
+class UserInfoDelegate {
+    virtual void getUserInfoFinished(GJUserScore *) {}
+    virtual void getUserInfoFailed(int) {}
+    virtual void getUserInfoChanged(GJUserScore *) {}
+}
 
 class VideoOptionsLayer : FLAlertLayer {
     VideoOptionsLayer* create() = win 0x1e0d70;
diff --git a/loader/include/Geode/Enums.hpp b/loader/include/Geode/Enums.hpp
index fb429453..5665a7c5 100644
--- a/loader/include/Geode/Enums.hpp
+++ b/loader/include/Geode/Enums.hpp
@@ -21,6 +21,12 @@ enum class SearchType {
     HallOfFame = 16,
     FeaturedGDW = 17,
     Similar = 18,
+    ListsOnClick = 19,
+    Lists = 20,
+    DailyVault = 21,
+    WeeklyVault = 22,
+    EventVault = 23,
+    Reported = 24,
     MyLevels = 98,
     SavedLevels = 99,
     FavouriteLevels = 100