Skip to content

Commit

Permalink
re-enable page limit bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jan 20, 2024
1 parent 66e1cb1 commit 831aa98
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 49 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog
## <cg>4.0.0-alpha.2</c> (2024-01-19)
* Fixed most crashing issues
* Re-added page limit bypass

## <cg>4.0.0-alpha.1</c> (2024-01-19)
* Added 2.204 support
Expand Down
10 changes: 10 additions & 0 deletions src/hooks/LevelBrowserLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
using namespace geode::prelude;

class $modify(BILevelBrowserLayer, LevelBrowserLayer) {
static void onModify(auto& self) {
(void) self.setHookPriority("LevelBrowserLayer::onGoToPage", 99999);
}

/*
* Callbacks
*/
Expand Down Expand Up @@ -79,6 +83,12 @@ class $modify(BILevelBrowserLayer, LevelBrowserLayer) {
/**
* Hooks
*/
void onGoToPage(CCObject* sender) {
auto popup = SetIDPopup::create(m_searchObject->m_page + 1, 1, 999999, "Go to Page", "Go", true, 1, 60.f, false, false);
popup->m_delegate = this;
popup->show();
}

void setupPageInfo(gd::string a1, const char* a2) {
LevelBrowserLayer::setupPageInfo(a1, a2);

Expand Down
49 changes: 0 additions & 49 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,6 @@

using namespace geode::prelude;

void setupPageLimitBypassWindows() {
//This patches the maximum number for SetIDPopup to INT_MAX
// The relevant function is SetIDPopup::create (Windows) or SetIDPopup::init (Android)
//auto res = Mod::get()->patch(reinterpret_cast<void*>(base::get() + 0x1431F6), {0x68, 0xFF, 0xFF, 0xFF, 0x7F});


//This patches the amount of characters allowed in the text input in SetIDPopup to 6 characters
// The relevant function is SetIDPopup::init
//res = Mod::get()->patch(reinterpret_cast<void*>(base::get() + 0x14371C), {0x06});
}

void setupPageLimitBypassMac() {
//This patches the maximum number for SetIDPopup to INT_MAX
// The relevant function is SetIDPopup::create (Windows) or SetIDPopup::init (Android)
//auto res = Mod::get()->patch(reinterpret_cast<void*>(base::get() + 0x2529BA), {0xBA, 0xFF, 0xFF, 0xFF, 0x7F});


//This patches the amount of characters allowed in the text input in SetIDPopup to 6 characters
// The relevant function is SetIDPopup::init
//res = Mod::get()->patch(reinterpret_cast<void*>(base::get() + 0x154A3B), {0x06});
}

void setupPageLimitBypass() {
//TODO: update for 2.2
/*
* SetIDPopup is one of those hyperoptimized classes where the func signature
* differs based on which platform you're looking for
* - the max value is a member value, however it is hardcoded in
* create() on Windows and init() on Android. As such it is easier to deal with
* this by patching the needed variables directly.
*/

log::info("Setting up Page Limit Bypass");
#ifdef GEODE_IS_WINDOWS
log::info("Performing Windows specific loading steps");
setupPageLimitBypassWindows();
#endif

#ifdef GEODE_IS_MACOS
log::info("Performing Mac specific loading steps");
setupPageLimitBypassMac();
#endif

}

void loadManagers() {
BetterInfoStats::sharedState();

Expand All @@ -64,10 +19,6 @@ void loadManagers() {
}).detach();
}

$execute {
//setupPageLimitBypass();
}

class $modify(MenuLayer) {
bool init() {
if(!MenuLayer::init()) return false;
Expand Down

0 comments on commit 831aa98

Please sign in to comment.