Skip to content

Commit d51d92d

Browse files
committed
spd
1 parent 9ebfee3 commit d51d92d

File tree

1 file changed

+9
-73
lines changed

1 file changed

+9
-73
lines changed

src/Hacks/Speedhack.cpp

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,77 +6,7 @@ using namespace geode::prelude;
66

77
FMOD::ChannelGroup* masterGroup;
88

9-
bool stringToFloat(const std::string& str, float& result) {
10-
std::istringstream iss(str);
11-
iss >> std::noskipws; // Disable skipping whitespace
12-
char c;
13-
if (!(iss >> result) || (iss >> c && !std::isspace(c))) {
14-
// Conversion failed or there are extra characters
15-
return false;
16-
}
17-
return true;
18-
}
19-
20-
/*class $modify (CCScheduler)
21-
{
22-
void update(float dt)
23-
{
24-
if (!masterGroup)
25-
{
26-
FMODAudioEngine::sharedEngine()->m_system->getMasterChannelGroup(&masterGroup);
27-
}
28-
29-
// icon effects value
30-
ColourUtility::update(dt);
31-
32-
if (SpeedhackTop::instance)
33-
{
34-
if (SpeedhackEnabled::instance->enabled)
35-
{
36-
float v = 1.0f;
37-
38-
//if (!stringToFloat(SpeedhackTop::instance->text, v))
39-
//v = 1.0f;
40-
41-
try
42-
{
43-
v = std::stof(SpeedhackTop::instance->text);
44-
}
45-
catch(const std::exception& e)
46-
{
47-
//std::cerr << e.what() << '\n';
48-
v = 1.0f;
49-
}
50-
51-
52-
if (v < 0.01f)
53-
v = 0.01f;
54-
55-
if (v > 99999)
56-
v = 99999;
57-
58-
bool m = SpeedhackMus::instance->enabled;
59-
60-
if (SpeedhackGameplay::instance->enabled)
61-
if (!(PlayLayer::get() || GameManager::sharedState()->getEditorLayer())) { v = 1.0f; }
62-
63-
//FMOD::ChannelGroup* masterGroup;
64-
//0FMODAudioEngine::sharedEngine()->m_system->getMasterChannelGroup(&masterGroup);
65-
masterGroup->setPitch(m ? v : 1);
66-
67-
CCScheduler::update(dt * v);
68-
return;
69-
}
70-
}
71-
72-
masterGroup->setPitch(1);
73-
74-
CCScheduler::update(dt * 2);
75-
}
76-
}; // LINE 115 DOESN'T FUCKING EXIST???? HOW CRASH
77-
*/
78-
79-
void myUpdate(CCScheduler* ins, float dt)
9+
float speedhackLogic(float dt)
8010
{
8111
if (!masterGroup)
8212
FMODAudioEngine::sharedEngine()->m_system->getMasterChannelGroup(&masterGroup);
@@ -108,14 +38,20 @@ void myUpdate(CCScheduler* ins, float dt)
10838
if (!(PlayLayer::get() || GameManager::sharedState()->getEditorLayer())) { v = 1.0f; }
10939

11040
masterGroup->setPitch(SpeedhackMus::instance->enabled ? v : 1);
111-
ins->update(dt * v);
11241
ColourUtility::update(dt * v);
113-
return;
42+
return dt * v;
11443
}
11544
}
11645

11746
masterGroup->setPitch(1);
11847
ColourUtility::update(dt);
48+
return dt;
49+
}
50+
51+
void myUpdate(CCScheduler* ins, float dt)
52+
{
53+
dt = speedhackLogic(dt);
54+
11955
ins->update(dt);
12056
}
12157

0 commit comments

Comments
 (0)