From 32b41db26cf23b421ef8e722653358e19473b64f Mon Sep 17 00:00:00 2001 From: TobyAdd <66429886+TobyAdd@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:00:19 +0200 Subject: [PATCH] probably last fix --- src/flvc.hpp | 8 ++++---- src/gui_mobile.cpp | 3 ++- src/recorder.cpp | 4 +--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/flvc.hpp b/src/flvc.hpp index 12ab0ed..87063cc 100644 --- a/src/flvc.hpp +++ b/src/flvc.hpp @@ -5,7 +5,7 @@ class FLVCEncoder { public: - FLVCEncoder(uint16_t width, uint16_t height, uint16_t fps, const std::string& outputFilePath) + FLVCEncoder(uint16_t width, uint16_t height, uint16_t fps, const std::filesystem::path& outputFilePath) : width(width), height(height), fps(fps), frameSize(width * height * 3), frameCount(0), outputFilePath(outputFilePath) { outputFile.open(outputFilePath, std::ios::binary); if (!outputFile.is_open()) { @@ -60,7 +60,7 @@ class FLVCEncoder { uint16_t fps; size_t frameSize; size_t frameCount; - std::string outputFilePath; + std::filesystem::path outputFilePath; std::ofstream outputFile; void writeHeader() { @@ -80,7 +80,7 @@ class FLVCEncoder { class FLVCDecoder { public: - FLVCDecoder(const std::string& inputFilePath) : inputFilePath(inputFilePath) { + FLVCDecoder(const std::filesystem::path& inputFilePath) : inputFilePath(inputFilePath) { inputFile.open(inputFilePath, std::ios::binary); if (!inputFile.is_open()) { return; @@ -150,7 +150,7 @@ class FLVCDecoder { uint16_t fps; size_t frameSize; size_t frameCount; - std::string inputFilePath; + std::filesystem::path inputFilePath; std::ifstream inputFile; void readHeader() { diff --git a/src/gui_mobile.cpp b/src/gui_mobile.cpp index 5a2f8c7..68d5ea9 100644 --- a/src/gui_mobile.cpp +++ b/src/gui_mobile.cpp @@ -4,6 +4,7 @@ #include "labels.hpp" #include "replayEngine.hpp" #include "utils.hpp" +#include "recorder.hpp" using namespace geode::prelude; @@ -334,7 +335,7 @@ bool HacksLayer::setup() { auto justATestButton = ButtonSprite::create("Just a test", 80, true, "bigFont.fnt", "GJ_button_01.png", 30.f, 0.7f); auto justATestButtonClick = CCMenuItemExt::createSpriteExtra(justATestButton, [this, &engine, info_label](CCMenuItemSpriteExtra* sender) { - utilsH::getFolder(); + Recorder::get().start(""); }); justATestButtonClick->setPosition({270, 25}); engineTab->addChild(justATestButtonClick); diff --git a/src/recorder.cpp b/src/recorder.cpp index 3a41485..28bd2c9 100644 --- a/src/recorder.cpp +++ b/src/recorder.cpp @@ -95,7 +95,6 @@ void Recorder::restoreWinSize() { } void Recorder::start(std::string command) { - #ifdef GEODE_IS_WINDOWS need_remove_black = false; need_visible_lc = false; @@ -124,7 +123,7 @@ void Recorder::start(std::string command) { std::thread([&, command] { // auto process = subprocess::Popen(command); - FLVCEncoder encoder(width, height, fps, "output.flvc"); + FLVCEncoder encoder(width, height, fps, folderPath / "output.flvc"); while (is_recording || frame_has_data) { lock.lock(); if (frame_has_data) { @@ -141,7 +140,6 @@ void Recorder::start(std::string command) { // return; // } }).detach(); - #endif } void Recorder::stop() {