Skip to content

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyAdd committed Dec 14, 2024
1 parent 6d38ea9 commit d6c8a15
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ void Gui::Render() {
}

if (ImGuiH::Button("Resources", {ImGui::GetContentRegionAvail().x/2, NULL})) {
auto path = cocos2d::CCFileUtils::get()->getWritablePath2();
std::string path = cocos2d::CCFileUtils::get()->getWritablePath2();
geode::utils::file::openFolder(path);
}
ImGui::SameLine();
Expand Down
34 changes: 23 additions & 11 deletions src/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,27 @@ class $modify(cocos2d::CCScheduler) {
auto start = std::chrono::high_resolution_clock::now();

for (unsigned i = 0; i < times; ++i) {
disable_render = recorderAudio.enabled ? true : recorder.is_recording ? false : (i != times - 1);
bool is_last_frame = (i == times - 1);
bool is_timeout = (std::chrono::high_resolution_clock::now() - start > std::chrono::milliseconds(33));

disable_render = !(recorderAudio.enabled || recorder.is_recording) && !is_last_frame && !is_timeout;

if (recorder.is_recording) recorder.applyWinSize();
CCScheduler::update(newdt);
if (recorder.is_recording) recorder.restoreWinSize();

if (std::chrono::high_resolution_clock::now() - start > std::chrono::milliseconds(33)) {
CCScheduler::update(newdt);

if (recorder.is_recording) recorder.restoreWinSize();

if (is_timeout) {
break;
}
}

disable_render = false;
}
};


class $modify(FMODAudioEngine) {
void update(float delta) {
auto &config = Config::get();
Expand Down Expand Up @@ -619,7 +626,7 @@ class $modify(GJBaseGameLayer) {
}

void handleButton(bool down, int button, bool isPlayer1) {
GJBaseGameLayer::handleButton(down, button, isPlayer1);
GJBaseGameLayer::handleButton(down, button, isPlayer1);
ReplayEngine::get().handle_button(down, button, isPlayer1);
if (down) CpsCounter::get().click();
}
Expand Down Expand Up @@ -669,8 +676,8 @@ class $modify(GJBaseGameLayer) {

GJBaseGameLayer::update(dt);

engine.handle_update(this);
StraightFly::get().handle_straightfly(this);
engine.handle_update(this);

if (config.get<bool>("rgb_icons", false)) {
color_dt += dt * config.get<float>("rgb_icons::speed", 0.25f);
Expand All @@ -684,13 +691,18 @@ class $modify(GJBaseGameLayer) {
bool wave_trail_p1 = config.get<bool>("rgb_icons::wave_trail_p1", true);
bool wave_trail_p2 = config.get<bool>("rgb_icons::wave_trail_p2", true);

if (player_p1 && m_player1) m_player1->setColor(color1);
if (player_p1 && m_player1) m_player1->setSecondColor(color2);
if (player_p1 && m_player1) {
m_player1->setColor(color1);
m_player1->setSecondColor(color2);
}
if (wave_trail_p1 && m_player1->m_waveTrail) m_player1->m_waveTrail->setColor(color1);

if (player_p2 && m_player2) m_player2->setColor(color2);
if (player_p2 && m_player2) m_player2->setSecondColor(color1);
if (wave_trail_p1 && m_player2->m_waveTrail) m_player2->m_waveTrail->setColor(color2);
if (player_p2 && m_player2) {
m_player2->setColor(color2);
m_player2->setSecondColor(color1);
}

if (wave_trail_p2 && m_player2->m_waveTrail) m_player2->m_waveTrail->setColor(color2);
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ void Recorder::start(std::string command) {
}

void Recorder::stop() {
texture.end();

ImGuiH::Popup::get().add_popup("Video recording stoped!");
texture.end();

is_recording = false;
enabled = false;
Expand All @@ -161,6 +159,10 @@ void Recorder::stop() {
if (pl && hide_level_complete) {
need_visible_lc = true;
}

restoreWinSize();

ImGuiH::Popup::get().add_popup("Video recording stoped!");

}

Expand Down

0 comments on commit d6c8a15

Please sign in to comment.