Skip to content

Commit

Permalink
android bruteforce fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed Mar 25, 2024
1 parent 23a9d88 commit a2959dc
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <fstream>
#include <algorithm>
#include <random>
#include <regex>

using namespace geode::prelude;

Expand All @@ -29,8 +30,7 @@ int fps = -1;
std::ifstream file(pathRogers);
std::string technoblade;
while (std::getline(file, technoblade)) {
std::string tThePig = fmt::format("\"{}\"", technoblade);
quotes.push_back(tThePig);
quotes.push_back(technoblade);
} // technically i can write two one-time use boolean variables to allow people to toggle these things on and off as they please without the quotes adding themselves multiple times into the vector, but i'd rather add the "restart required" barrier just to be extra safe
}

Expand Down Expand Up @@ -224,7 +224,9 @@ class $modify(MyEndLevelLayer, EndLevelLayer) {
if (m_fields->isCompactEndscreen) completeMessage->setPositionX(m_fields->compactEndscreenFallbackPosition);
return;
}

auto randomString = grabRandomQuote();

if (auto endText = getChildByIDRecursive("end-text")) {
auto endTextLabel = typeinfo_cast<CCLabelBMFont*>(endText);

Expand Down Expand Up @@ -257,19 +259,24 @@ class $modify(MyEndLevelLayer, EndLevelLayer) {
else { randomString = "Good luck on that stargrinding session!"; }
}
#endif

endTextLabel->setString(randomString, true); // set string
endTextLabel->setAlignment(CCTextAlignment::kCCTextAlignmentCenter); // center text

float scale = 0.36f * (228.f / strlen(randomString));

float scale = 0.36f * (228.f / strlen(randomString));
if (strcmp("BELIEVE", randomString) == 0) scale = 1.5f;
else if (strcmp("endTextLabel->setString(randomString.c_str(), true);", randomString) == 0) scale = 0.4f;
else if (scale > Mod::get()->getSettingValue<double>("maxScale")) scale = Mod::get()->getSettingValue<double>("maxScale");
#ifdef GEODE_IS_MOBILE
std::regex quotePattern("\".+\"");
if (std::regex_match(std::string(randomString), quotePattern)) { scale = scale * .85f; }
#endif

endTextLabel->setScale(scale);
endTextLabel->setWidth(336.f); // width of end screen minus 20px

endTextLabel->setString(randomString, true); // set string
endTextLabel->setAlignment(CCTextAlignment::kCCTextAlignmentCenter); // center text

if (m_fields->isCompactEndscreen) endTextLabel->setPositionX(m_fields->compactEndscreenFallbackPosition);
if (strcmp("", randomString) == 0) { endTextLabel->setString(fallbackString, true); } // fallback string
}
}
};
};

0 comments on commit a2959dc

Please sign in to comment.