Skip to content

Commit

Permalink
2.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiLko committed Jan 14, 2025
1 parent 1d5ae22 commit 7c6be6f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v2.3.8

* Fixed some tps thing and some macro offset thing.

# v2.3.7

* Fixed macro death bug with other bot's macros.
Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"geode": "4.0.1",
"geode": "4.1.1",
"gd": {
"win": "2.2074",
"android": "2.2074"
},
"version": "2.3.7",
"version": "2.3.8",
"id": "zilko.xdbot",
"name": "xdBot",
"developer": "Zilko",
Expand Down
16 changes: 9 additions & 7 deletions src/gdr/gdr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cocos2d::CCPoint dataFromString(std::string dataString);

std::vector<std::string> splitByChar(std::string str, char splitChar);

const std::string xdBotVersion = "v2.3.7";
const std::string xdBotVersion = "v2.3.8";

namespace gdr {

Expand Down Expand Up @@ -166,10 +166,10 @@ namespace gdr {
bool rotation = ver.find("beta.") == std::string::npos && ver.find("alpha.") == std::string::npos;
if (replay.botInfo.name == "xdBot" && ver == "v2.0.0") rotation = true;

// bool addOffset = false;
bool addOffset = replay.botInfo.name == "xdBot";
// bool offset = false;
int offset = replay.botInfo.name == "xdBot" ? 1 : 0;

if (addOffset) {
if (offset == 1) {
if (ver.front() == 'v') ver = ver.substr(1);

std::vector<std::string> splitVer = splitByChar(ver, '.');
Expand All @@ -180,8 +180,10 @@ namespace gdr {
geode::prelude::VersionInfo macroVer = getVersion(splitVer);
geode::prelude::VersionInfo checkVer = getVersion(realVer);

if (macroVer >= checkVer) addOffset = false;
if (macroVer >= checkVer) offset = false;
}

if (ver == "2.0.0-alpha.1") offset--;
}

replay.parseExtension(replayJson.get<json::object_t>());
Expand All @@ -195,7 +197,7 @@ namespace gdr {
if (!inputJson.contains("frame")) continue;
if (inputJson["frame"].is_null()) continue;

input.frame = inputJson["frame"].get<int>() + (addOffset ? 1 : 0);
input.frame = inputJson["frame"].get<int>() + offset;
input.button = inputJson["btn"];
input.player2 = inputJson["2p"];
input.down = inputJson["down"];
Expand All @@ -212,7 +214,7 @@ namespace gdr {
if (!frameFixJson.contains("frame")) continue;
if (frameFixJson["frame"].is_null()) continue;

frameFix.frame = frameFixJson["frame"].get<int>() + (addOffset ? 1 : 0);
frameFix.frame = frameFixJson["frame"].get<int>() + offset;

if (frameFixJson.contains("player1")) {

Expand Down
14 changes: 11 additions & 3 deletions src/hacks/tps_bypass.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
#include "../includes.hpp"
#include <Geode/modify/GJBaseGameLayer.hpp>

float leftOver2 = 0.f;

class $modify(GJBaseGameLayer) {

void update(float dt) {
if (!Global::get().tpsEnabled) return GJBaseGameLayer::update(dt);
if (Global::getTPS() == 240.f) return GJBaseGameLayer::update(dt);
if (Global::get().frameStepper) return GJBaseGameLayer::update(dt);
if (!PlayLayer::get()) return GJBaseGameLayer::update(dt);

float newDt = 1.f / Global::getTPS();

if (Global::getTPS() == 240.f) return GJBaseGameLayer::update(newDt);

auto startTime = std::chrono::high_resolution_clock::now();
int mult = static_cast<int>((dt+ leftOver2) / newDt);

for (int i = 0; i < static_cast<int>(dt / newDt); ++i) {
for (int i = 0; i < mult; ++i) {
GJBaseGameLayer::update(newDt);
if (std::chrono::high_resolution_clock::now() - startTime > std::chrono::duration<double, std::milli>(16.666))
if (std::chrono::high_resolution_clock::now() - startTime > std::chrono::duration<double, std::milli>(16.666)) {
mult = i + 1;
break;
}
}

leftOver2 += (dt - newDt * mult);

}

Expand Down

0 comments on commit 7c6be6f

Please sign in to comment.