From 407ea1ba018e9c41093e0c00cfedce54db150174 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Wed, 14 Dec 2022 00:05:10 +0200 Subject: [PATCH] fix mac build pt 2 --- loader/include/Geode/loader/Setting.hpp | 12 ++-------- loader/src/loader/Setting.cpp | 31 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/loader/include/Geode/loader/Setting.hpp b/loader/include/Geode/loader/Setting.hpp index 6b76968d..cc1915ba 100644 --- a/loader/include/Geode/loader/Setting.hpp +++ b/loader/include/Geode/loader/Setting.hpp @@ -214,16 +214,8 @@ namespace geode { ValueType getValue() const { return m_value; } - void setValue(ValueType const& value) { - m_value = this->toValid(value).first; - } - Result<> validate(ValueType const& value) const { - auto reason = this->toValid(value).second; - if (reason.has_value()) { - return Err(static_cast(reason.value())); - } - return Ok(); - } + GEODE_DLL void setValue(ValueType const& value); + GEODE_DLL Result<> validate(ValueType const& value) const; }; using BoolSettingValue = GeodeSettingValue; diff --git a/loader/src/loader/Setting.cpp b/loader/src/loader/Setting.cpp index bb7b9ce5..f100d7cd 100644 --- a/loader/src/loader/Setting.cpp +++ b/loader/src/loader/Setting.cpp @@ -223,6 +223,21 @@ std::string SettingValue::getKey() const { return type_##SettingNode::create(this, width); \ } \ template<> \ + void GeodeSettingValue< \ + type_##Setting \ + >::setValue(ValueType const& value) { \ + m_value = this->toValid(value).first; \ + } \ + Result<> GeodeSettingValue< \ + type_##Setting \ + >::validate(ValueType const& value) const { \ + auto reason = this->toValid(value).second; \ + if (reason.has_value()) { \ + return Err(static_cast(reason.value())); \ + } \ + return Ok(); \ + } \ + template<> \ typename type_##Setting::ValueType SettingValueSetter< \ typename type_##Setting::ValueType \ >::get(SettingValue* setting) { \ @@ -274,14 +289,6 @@ namespace geode { template class GeodeSettingValue; } -IMPL_NODE_AND_SETTERS(Bool); -IMPL_NODE_AND_SETTERS(Int); -IMPL_NODE_AND_SETTERS(Float); -IMPL_NODE_AND_SETTERS(String); -IMPL_NODE_AND_SETTERS(File); -IMPL_NODE_AND_SETTERS(Color); -IMPL_NODE_AND_SETTERS(ColorAlpha); - IMPL_TO_VALID(Bool) { return { value, std::nullopt }; } @@ -346,6 +353,14 @@ IMPL_TO_VALID(ColorAlpha) { return { value, std::nullopt }; } +IMPL_NODE_AND_SETTERS(Bool); +IMPL_NODE_AND_SETTERS(Int); +IMPL_NODE_AND_SETTERS(Float); +IMPL_NODE_AND_SETTERS(String); +IMPL_NODE_AND_SETTERS(File); +IMPL_NODE_AND_SETTERS(Color); +IMPL_NODE_AND_SETTERS(ColorAlpha); + // SettingChangedEvent SettingChangedEvent::SettingChangedEvent(Mod* mod, SettingValue* value)