Skip to content

Commit adedf52

Browse files
committed
a few things
1 parent 2639a1d commit adedf52

10 files changed

+58
-71
lines changed

changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# 1.3.7
22

33
- Label Corners now save the corner
4-
- Fixed Crash Playing Levels
4+
- Fixed Crash Playing Levels on Windows
5+
- Fixed Attempt Count saying nullptr every attempt
6+
- Increased the amount of numbers you can input in tps bypass to 11
7+
- FPS Counter now only updates every half of a second instead of every frame
8+
- Added No Transition and Verify Hack On MacOS
59

610
# 1.3.6
711

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "2.0.0-beta.24",
3-
"version": "v1.3.6",
3+
"version": "v1.3.7",
44
"gd": {
55
"win": "2.204",
66
"mac": "2.200",

src/Client/ClientSetup.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class ClientUtils
169169
Client::instance->windows.push_back(bypass);
170170

171171
auto tps = new InputModule("Ticks:", "tps-bypass-value", "240");
172-
tps->maxSize = 6;
172+
tps->maxSize = 11;
173173
Client::GetModule("tps-bypass")->options.push_back(tps);
174174
}
175175

@@ -413,8 +413,6 @@ class ClientUtils
413413
"no-static",
414414
"show-trajectory",
415415
"show-layout",
416-
"no-trans",
417-
"verify-hack",
418416
"coin-tracers",
419417
"no-wave",
420418
"solid-wave",

src/Client/Module.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ void DropdownModule::onDropdownSelectionChanged(CCObject* sender)
143143
auto drop = as<Dropdown*>(as<CCNode*>(sender)->getParent());
144144

145145
mod->index = drop->getSelectedIndex();
146+
mod->save();
146147

147148
if (mod->delegate)
148149
mod->delegate->onModuleChanged(mod->enabled);

src/Hacks/SafeMode.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class HackModuleDelegate : public ModuleChangeDelegate
4747

4848
updateInd();
4949

50+
#ifdef STATUS_TEXTS
51+
5052
if (PlayLayer::get())
5153
{
5254
if (auto stn = StatusNode::get())
@@ -56,6 +58,8 @@ class HackModuleDelegate : public ModuleChangeDelegate
5658
stn->reorderPosition();
5759
}
5860
}
61+
62+
#endif
5963
}
6064
};
6165

src/Hacks/TPSBypass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void updateTPSPatches(bool tpsEnabled)
5252
#endif
5353

5454
#ifdef GEODE_IS_MACOS
55-
patches.push_back(Mod::get()->patch(reinterpret_cast<void*>(geode::base::get() + 0x7e9c60), getBytes<float>(1.0f / tps)).unwrap());
55+
patches.push_back(Mod::get()->patch(reinterpret_cast<void*>(geode::base::get() + 0x7e9c60), getBytes<double>(1.0f / tps)).unwrap());
5656
#endif
5757
}
5858
}

src/Hacks/TransitionTimeCustomiser.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#ifndef GEODE_IS_MACOS
2-
31
#include <Geode/Geode.hpp>
42
#include <Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h>
53
#include <Geode/modify/CCTransitionFade.hpp>
@@ -16,6 +14,7 @@ CCScene* getSceneForSel(int i, float f, CCScene* s)
1614

1715
if (i == 0)
1816
return CCTransitionFade::create(f, s);
17+
#ifndef GEODE_IS_MACOS
1918
else if (i == 1)
2019
return CCTransitionCrossFade::create(f, s);
2120
else if (i == 2)
@@ -66,6 +65,8 @@ CCScene* getSceneForSel(int i, float f, CCScene* s)
6665
return CCTransitionSplitCols::create(f, s);
6766
else if (i == 25)
6867
return CCTransitionTurnOffTiles::create(f, s);
68+
69+
#endif
6970

7071
return nullptr;
7172
}
@@ -115,6 +116,4 @@ class $modify (cocos2d::CCTransitionFade)
115116

116117
return as<CCTransitionFade*>(getSceneForSel(Mod::get()->getSavedValue<int>("transition", 0), duration * mod, scene));// /*base_cast<CCTransitionFade*>(CCTransitionFlipY::create(duration * mod, scene)); */CCTransitionFade::create(duration * mod, scene);
117118
}
118-
};
119-
120-
#endif
119+
};

src/Hacks/VerifyHack.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#ifndef GEODE_IS_MACOS
2-
31
#include <Geode/Geode.hpp>
42
#include <Geode/modify/ShareLevelLayer.hpp>
53
#include "../Client/Client.h"
@@ -32,6 +30,4 @@ class $modify(ShareLevelLayer)
3230

3331
ShareLevelLayer::onShare(sender);
3432
}
35-
};
36-
37-
#endif
33+
};

src/Labels/Labels.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ bool StatusNode::init()
66
{
77
if (!CCNode::init())
88
return false;
9+
10+
instance = this;
911

1012
this->setID("status-node"_spr);
1113
this->setZOrder(69);
@@ -225,6 +227,8 @@ void StatusNode::update(float dt)
225227
if (!session)
226228
session = Client::GetModule("status-session");
227229

230+
if (!attPL)
231+
attPL = static_cast<AttemptPlayLayer*>(PlayLayer::get());
228232

229233

230234
float v = 100 * (1 - (PlayLayer::get()->m_gameState.m_unk1f8 == 0 ? 0 : as<NoclipLayer*>(PlayLayer::get())->m_fields->t / static_cast<float>(PlayLayer::get()->m_gameState.m_unk1f8)));
@@ -242,10 +246,9 @@ void StatusNode::update(float dt)
242246
sLabels[7]->setVisible(session->enabled);
243247

244248

245-
sLabels[1]->setString((numToString(1 / (dt / CCScheduler::get()->getTimeScale()), 0) + std::string(" FPS")).c_str());
246249
sLabels[2]->setString((numToString(v, 2) + std::string("%")).c_str());
247250
sLabels[3]->setString((numToString(as<NoclipLayer*>(PlayLayer::get())->m_fields->d, 0) + (as<NoclipLayer*>(PlayLayer::get())->m_fields->d == 1 ? std::string(" Death") : std::string(" Deaths"))).c_str());
248-
sLabels[4]->setString(attemptText == nullptr ? "nullptr" : attemptText->getString());
251+
sLabels[4]->setString((std::string("Attempt ") + std::to_string(attPL->m_fields->attemptCount)).c_str());
249252

250253
std::stringstream ss;
251254
ss << "Frame: " << numToString(GJReplayManager::frame) << ", Delta: " << numToString(GJReplayManager::dt, 4);
@@ -274,6 +277,21 @@ void StatusNode::update(float dt)
274277
as<NoclipLayer*>(PlayLayer::get())->m_fields->isDead = false;
275278
}
276279

280+
_timeLeft -= dt;
281+
_accum += 1 / dt;
282+
_frames++;
283+
284+
if (_timeLeft <= 0) {
285+
float fps = _accum / _frames;
286+
287+
sLabels[1]->setString((std::to_string(as<int>(roundf(fps))) + std::string(" FPS")).c_str());
288+
//CCLOG("Average FPS: %.2f", fps);
289+
290+
_timeLeft = _updateInterval;
291+
_accum = 0;
292+
_frames = 0;
293+
}
294+
277295
updateVis();
278296
}
279297

src/Labels/Labels.h

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010

1111
using namespace geode::prelude;
1212

13+
class $modify (AttemptPlayLayer, PlayLayer)
14+
{
15+
int attemptCount = 0;
16+
17+
void resetLevel()
18+
{
19+
PlayLayer::resetLevel();
20+
21+
m_fields->attemptCount++;
22+
}
23+
};
24+
1325
class StatusNode : public CCNode
1426
{
1527
public:
@@ -31,7 +43,7 @@ class StatusNode : public CCNode
3143

3244
bool mods;
3345

34-
CCLabelBMFont* attemptText = nullptr;
46+
AttemptPlayLayer* attPL = nullptr;
3547

3648
static inline Module* fps = nullptr;
3749
static inline Module* cheat = nullptr;
@@ -55,6 +67,11 @@ class StatusNode : public CCNode
5567

5668
static inline bool hidden = false;
5769

70+
float _updateInterval = 0.5f;
71+
float _timeLeft = _updateInterval;
72+
float _accum;
73+
int _frames;
74+
5875
std::string formatTime(float time) {
5976
// Convert float time to milliseconds
6077
std::chrono::milliseconds duration(static_cast<long long>(time * 1000));
@@ -90,67 +107,17 @@ class StatusNode : public CCNode
90107

91108
class $modify (PlayLayer)
92109
{
93-
StatusNode* stn;
94-
95-
virtual void postUpdate(float p0)
96-
{
97-
PlayLayer::postUpdate(p0);
98-
99-
//m_fields->stn->attemptText = m_attemptLabel;
100-
101-
return;
102-
103-
if (m_fields->stn && !m_fields->stn->attemptText)
104-
{
105-
CCLayer* mainLayer = this->m_objectLayer;
106-
log::info("mainLayer: {}", mainLayer);
107-
auto lbl = getChildOfType<CCLabelBMFont>(mainLayer, 0);
108-
log::info("label: {}", lbl);
109-
110-
auto stn2 = this->m_fields->stn;
111-
log::info("status node: {}", stn2);
112-
stn2->attemptText = lbl;
113-
log::info("sex");
114-
}
115-
}
116-
117110
bool init(GJGameLevel* p0, bool p1, bool p2)
118111
{
119112
if (!PlayLayer::init(p0, p1, p2))
120113
return false;
121114

122-
if (this->getChildByID("status-text-menu"_spr))
115+
if (getChildByID("status-node"_spr))
123116
return true;
124117

125-
CCLayer* mainLayer = nullptr;
126-
127-
if (!mainLayer)
128-
{
129-
if (auto mainNode = getChildOfType<CCNode>(this, 1))
130-
{
131-
if (auto l = getChildOfType<CCLayer>(mainNode, 0))
132-
{
133-
mainLayer = l;
134-
}
135-
}
136-
}
137-
138118
auto stn = StatusNode::create();
139-
stn->attemptText = m_attemptLabel;
140-
log::info("attemptText: {}", stn->attemptText);
141-
142-
auto menu = CCMenu::create();
143-
menu->setID("status-text-menu"_spr);
144-
menu->setPosition(ccp(0, 0));
145-
menu->setContentSize(CCDirector::get()->getWinSize());
146-
menu->setAnchorPoint(ccp(0, 0));
147-
menu->ignoreAnchorPointForPosition(false);
148-
119+
stn->attPL = static_cast<AttemptPlayLayer*>(PlayLayer::get());
149120
this->addChild(stn);
150-
151-
this->addChild(menu, 69420);
152-
153-
m_fields->stn = stn;
154121

155122
return true;
156123
}

0 commit comments

Comments
 (0)