diff --git a/.github/workflows/android copy.yml b/.github/workflows/android copy.yml index d058d5b..3534994 100644 --- a/.github/workflows/android copy.yml +++ b/.github/workflows/android copy.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: branches: - - "main" + - "xD" jobs: build: diff --git a/.github/workflows/multi-platform.yml b/.github/workflows/multi-platform.yml index ef1ed6b..ef3d080 100644 --- a/.github/workflows/multi-platform.yml +++ b/.github/workflows/multi-platform.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: branches: - - "NO!" + - "main" jobs: build: diff --git a/changelog.md b/changelog.md index ae5c81e..b78d730 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,10 @@ # v2.3.10 +* Added restore button for clickbot click settings. * Fixed seed again cus i forgot sometinhg. * Fixed android render trying to record audio even though it cant add it to the video. * Fixed buttons scale JUST for viper. +* Fixed tps bypass speedups maybe. * R # v2.3.9 diff --git a/src/hacks/clickbot.cpp b/src/hacks/clickbot.cpp index a515130..e28998b 100644 --- a/src/hacks/clickbot.cpp +++ b/src/hacks/clickbot.cpp @@ -91,71 +91,71 @@ void Clickbot::setSound(std::string id, FMOD::Sound* sound) { } void Clickbot::playSound(std::string id) { - // auto& c = get(); - // if (!c.system) return updateSounds(); + auto& c = get(); + if (!c.system) return updateSounds(); - // auto& g = Global::get(); - // matjson::Value data = g.mod->getSavedValue(id); - // ClickSetting settings = matjson::Serialize::from_json(data); + auto& g = Global::get(); + matjson::Value data = g.mod->getSavedValue(id); + ClickSetting settings = matjson::Serialize::from_json(data); - // if (settings.disabled) return; + if (settings.disabled) return; - // FMOD::Sound* sound = getSound(id); + FMOD::Sound* sound = getSound(id); - // if (!sound) return; + if (!sound) return; - // int masterVol = g.mod->getSavedValue("clickbot_volume"); - // if (settings.volume == 0 || masterVol == 0) return; + int masterVol = g.mod->getSavedValue("clickbot_volume"); + if (settings.volume == 0 || masterVol == 0) return; - // FMOD_RESULT result; + FMOD_RESULT result; - // result = c.system->playSound(sound, nullptr, false, &c.channel); - // if (result != FMOD_OK) return log::debug("Click sound errored. ID: 2"); + result = c.system->playSound(sound, nullptr, false, &c.channel); + if (result != FMOD_OK) return log::debug("Click sound errored. ID: 2"); - // result = c.channel->setVolume((settings.volume / 100.f) * (masterVol / 100.f)); - // if (result != FMOD_OK) return log::debug("Click sound errored. ID: 3"); + result = c.channel->setVolume((settings.volume / 100.f) * (masterVol / 100.f)); + if (result != FMOD_OK) return log::debug("Click sound errored. ID: 3"); - // result = c.channel->setPitch(g.currentPitch); - // if (result != FMOD_OK) return log::debug("Click sound errored. ID: 4"); + result = c.channel->setPitch(g.currentPitch); + if (result != FMOD_OK) return log::debug("Click sound errored. ID: 4"); - // FMOD::DSP* pitchShifter = c.pitchShifter; - // if (!pitchShifter) return updateSounds(); + FMOD::DSP* pitchShifter = c.pitchShifter; + if (!pitchShifter) return updateSounds(); - // result = pitchShifter->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, settings.pitch * g.mod->getSavedValue("clickbot_pitch")); - // if (result != FMOD_OK) return log::debug("Click sound errored. ID: 6"); + result = pitchShifter->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, settings.pitch * g.mod->getSavedValue("clickbot_pitch")); + if (result != FMOD_OK) return log::debug("Click sound errored. ID: 6"); - // result = c.channel->addDSP(0, pitchShifter); - // if (result != FMOD_OK) return log::debug("Click sound errored. ID: 7"); + result = c.channel->addDSP(0, pitchShifter); + if (result != FMOD_OK) return log::debug("Click sound errored. ID: 7"); } void Clickbot::updateSounds() { - // auto& c = get(); - // FMOD_RESULT result; - - // if (!c.system) { - // FMODAudioEngine* fmod = FMODAudioEngine::sharedEngine(); - // c.system = fmod->m_system; - // } - - // if (!c.system) return; - - // for (std::string name : buttonNames) { - // matjson::Value data = Global::get().mod->getSavedValue(name); - // ClickSetting settings = matjson::Serialize::from_json(data); - // if (!std::filesystem::exists(settings.path)) continue; - - // FMOD::Sound* sound = getSound(name); - // result = c.system->createSound(settings.path.string().c_str(), FMOD_DEFAULT, nullptr, &sound); - // if (result != FMOD_OK) { - // log::debug("Click sound errored. ID: 1"); - // continue; - // } - - // setSound(name, sound); - // } - - // if (!c.pitchShifter) { - // result = c.system->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &c.pitchShifter); - // if (result != FMOD_OK) return log::debug("Click sound errored. ID: 5"); - // } + auto& c = get(); + FMOD_RESULT result; + + if (!c.system) { + FMODAudioEngine* fmod = FMODAudioEngine::sharedEngine(); + c.system = fmod->m_system; + } + + if (!c.system) return; + + for (std::string name : buttonNames) { + matjson::Value data = Global::get().mod->getSavedValue(name); + ClickSetting settings = matjson::Serialize::from_json(data); + if (!std::filesystem::exists(settings.path)) continue; + + FMOD::Sound* sound = getSound(name); + result = c.system->createSound(settings.path.string().c_str(), FMOD_DEFAULT, nullptr, &sound); + if (result != FMOD_OK) { + log::debug("Click sound errored. ID: 1"); + continue; + } + + setSound(name, sound); + } + + if (!c.pitchShifter) { + result = c.system->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &c.pitchShifter); + if (result != FMOD_OK) return log::debug("Click sound errored. ID: 5"); + } } \ No newline at end of file diff --git a/src/ui/clickbot_layer.cpp b/src/ui/clickbot_layer.cpp index 9c5e329..eed0425 100644 --- a/src/ui/clickbot_layer.cpp +++ b/src/ui/clickbot_layer.cpp @@ -307,8 +307,8 @@ bool ClickSettingsLayer::setup(std::string button, geode::Popup<>* layer) { CCMenu* menu = CCMenu::create(); m_mainLayer->addChild(menu); - this->button = button; - this->clickbotLayer = layer; + button = button; + clickbotLayer = layer; matjson::Value data = Mod::get()->getSavedValue(button); settings = matjson::Serialize::from_json(data); @@ -386,6 +386,12 @@ bool ClickSettingsLayer::setup(std::string button, geode::Popup<>* layer) { lbl->setScale(0.45f); menu->addChild(lbl); + spr = ButtonSprite::create("Restore"); + spr->setScale(0.425f); + btn = CCMenuItemSpriteExtra::create(spr, this, menu_selector(ClickSettingsLayer::onRestore)); + btn->setPosition({89, -69}); + menu->addChild(btn); + return true; } @@ -400,12 +406,29 @@ void ClickSettingsLayer::onSelectFile(CCObject*) { if (res->isOk()) { std::filesystem::path path = res->unwrapOrDefault(); - this->filenameLabel->setString(path.filename().string().c_str()); + filenameLabel->setString(path.filename().string().c_str()); - this->settings.path = path; - this->saveSettings(); + settings.path = path; + saveSettings(); - static_cast(this->clickbotLayer)->updateLabels(); + static_cast(clickbotLayer)->updateLabels(); } }); +} + +void ClickSettingsLayer::onRestore(CCObject*) { + pitchSlider->setValue(0.33333333f); + volumeSlider->setValue(0.33333333f); + + updatePitch(nullptr); + updateVolume(nullptr); + + std::filesystem::path path = Mod::get()->getResourcesDir() / fmt::format("default_{}.mp3", button); + + filenameLabel->setString(path.filename().string().c_str()); + + settings.path = path; + saveSettings(); + + static_cast(clickbotLayer)->updateLabels(); } \ No newline at end of file diff --git a/src/ui/clickbot_layer.hpp b/src/ui/clickbot_layer.hpp index adeb9e6..0c26e9e 100644 --- a/src/ui/clickbot_layer.hpp +++ b/src/ui/clickbot_layer.hpp @@ -67,6 +67,8 @@ class ClickSettingsLayer : public geode::Popup*> { saveSettings(); } + void onRestore(CCObject*); + };