Skip to content

Commit 66ebc82

Browse files
committed
semi fix broken export on game load
1 parent ea43218 commit 66ebc82

4 files changed

Lines changed: 22 additions & 18 deletions

File tree

include/horrible/Events.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ namespace horrible {
1313
using ThreadSafeGlobalEvent::ThreadSafeGlobalEvent;
1414
};
1515

16-
inline geode::ListenerHandle* listenForHorribleOptionChanges(std::string id, geode::CopyableFunction<void(HorribleOptionSave)> callback) {
16+
inline geode::ListenerHandle* listenForHorribleOptionChanges(std::string id, geode::CopyableFunction<void(HorribleOptionSave)>&& callback) {
1717
return OptionEvent(std::move(id)).listen(std::move(callback)).leak();
1818
};
1919

20-
inline geode::ListenerHandle* listenForAllHorribleOptionChanges(geode::CopyableFunction<void(std::string_view, HorribleOptionSave)> callback) {
20+
inline geode::ListenerHandle* listenForAllHorribleOptionChanges(geode::CopyableFunction<void(std::string_view, HorribleOptionSave)>&& callback) {
2121
return OptionEvent().listen(std::move(callback)).leak();
2222
};
2323
};

include/horrible/OptionalAPI.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ namespace horrible {
6969
static void registerOption(OptionV2 const& option)
7070
GEODE_EVENT_EXPORT_NORES(&OptionManagerV2::registerOption, (option));
7171

72+
/**
73+
* Set the toggle state of an option
74+
*
75+
* @param id The ID of the option to toggle
76+
* @param enable Boolean to toggle to
77+
*/
78+
static void toggleOption(geode::ZStringView id, bool enable)
79+
GEODE_EVENT_EXPORT_NORES(&OptionManagerV2::toggleOption, (id, enable));
80+
7281
/**
7382
* Quickly check the toggle state of an option
7483
*
@@ -78,14 +87,5 @@ namespace horrible {
7887
*/
7988
static geode::Result<bool> isEnabled(geode::ZStringView id)
8089
GEODE_EVENT_EXPORT(&OptionManagerV2::isEnabled, (id));
81-
82-
/**
83-
* Set the toggle state of an option
84-
*
85-
* @param id The ID of the option to toggle
86-
* @param enable Boolean to toggle to
87-
*/
88-
static void toggleOption(geode::ZStringView id, bool enable)
89-
GEODE_EVENT_EXPORT_NORES(&OptionManagerV2::toggleOption, (id, enable));
9090
};
9191
};

src/API.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,15 @@ void OptionManagerV2::registerOption(OptionV2 const& option) {
294294
->setSupportedPlatforms(option.platforms);
295295

296296
om->registerOption(opt);
297+
(void)OptionEvent(opt->getID()).send(om->getOption(opt->getID()));
297298
};
298299
};
299300

301+
void OptionManagerV2::toggleOption(ZStringView id, bool enable) {
302+
if (auto om = OptionManager::get()) om->toggleOption(id, enable);
303+
};
304+
300305
Result<bool> OptionManagerV2::isEnabled(ZStringView id) {
301306
if (auto om = OptionManager::get()) return Ok(om->isEnabled(id));
302307
return Err("Failed to get OptionManager");
303-
};
304-
305-
void OptionManagerV2::toggleOption(ZStringView id, bool enable) {
306-
if (auto om = OptionManager::get()) om->toggleOption(id, enable);
307308
};

src/ui/src/Menu.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,10 @@ bool Menu::init() {
356356
to4B(colors::black, 0),
357357
m_impl->categoryList->getScaledContentWidth(),
358358
17.5f,
359-
40.f);
359+
43.75f);
360360
sillyDropdown->setID("silly-filter-dropdown");
361361
sillyDropdown->setAnchorPoint({0.5, 1});
362-
sillyDropdown->setPosition({filterContainerLabel->getPositionX(), 87.5f});
362+
sillyDropdown->setPosition({filterContainerLabel->getPositionX(), 88.75f});
363363

364364
sillyDropdown->setCallback([this](auto, CCNode* node) {
365365
if (auto cell = typeinfo_cast<MenuSillyFilterCell*>(node)) {
@@ -392,7 +392,10 @@ bool Menu::init() {
392392

393393
m_mainLayer->addChild(m_impl->createFilterLabel("Silliness", "silly-filter-label", {m_impl->categoryList->getPositionX(), sillyDropdown->getPositionY() + 8.75f}), 1);
394394

395-
auto filterHint = CCLabelBMFont::create("Use different filters to search for options quicker. Press the pin icon on an option cell to pin it to the top.", "chatFont.fnt", m_impl->categoryList->getScaledContentWidth());
395+
auto filterHint = CCLabelBMFont::create(
396+
"Use different filters to search for certain options faster. Press the pin on an option to pin it to the top of the list.",
397+
"chatFont.fnt",
398+
m_impl->categoryList->getScaledContentWidth());
396399
filterHint->setID("filter-hint");
397400
filterHint->setScale(0.5f);
398401
filterHint->setAnchorPoint(anchor::center);

0 commit comments

Comments
 (0)