Skip to content

Commit b392093

Browse files
committed
prerelease
1 parent 6525f6d commit b392093

17 files changed

Lines changed: 137 additions & 141 deletions

include/horrible/API.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ namespace horrible {
5353
*
5454
* @param category Name of the category
5555
*/
56-
void registerCategory(std::string category) &;
56+
void registerCategory(std::string category);
5757

5858
/**
5959
* Register an external Geode mod as an integration if not already registered
6060
*
6161
* @param category Pointer to the mod
6262
*/
63-
void registerMod(const geode::Mod*) &;
63+
void registerMod(const geode::Mod*);
6464

6565
/**
6666
* Check if an option already exists
@@ -69,7 +69,7 @@ namespace horrible {
6969
*
7070
* @returns Whether this option already exists or not
7171
*/
72-
bool doesOptionExist(geode::ZStringView id) const& noexcept;
72+
bool doesOptionExist(geode::ZStringView id) const noexcept;
7373

7474
/**
7575
* Check if an external Geode mod has already been registered in the list of integrations
@@ -78,7 +78,7 @@ namespace horrible {
7878
*
7979
* @returns Whether this option already exists or not
8080
*/
81-
bool isModRegistered(geode::ZStringView id) const& noexcept;
81+
bool isModRegistered(geode::ZStringView id) const noexcept;
8282

8383
public:
8484
// Get option manager singleton
@@ -89,14 +89,14 @@ namespace horrible {
8989
*
9090
* @param option Constructed option object
9191
*/
92-
void registerOption(std::shared_ptr<Option> option) &;
92+
void registerOption(std::shared_ptr<Option> option);
9393

9494
/**
9595
* Returns a reference to the array of all registered options
9696
*
9797
* @returns An array of every registered option, main and external
9898
*/
99-
[[nodiscard]] std::vector<std::weak_ptr<Option>> getOptions() const&;
99+
[[nodiscard]] std::vector<std::weak_ptr<Option>> getOptions() const;
100100

101101
/**
102102
* Quickly check the toggle state of an option
@@ -105,7 +105,7 @@ namespace horrible {
105105
*
106106
* @returns Boolean of the current value
107107
*/
108-
[[nodiscard]] bool isEnabled(geode::ZStringView id) const&;
108+
[[nodiscard]] bool isEnabled(geode::ZStringView id) const;
109109

110110
/**
111111
* Quickly check the pin state of an option
@@ -114,7 +114,7 @@ namespace horrible {
114114
*
115115
* @returns Boolean of the current value
116116
*/
117-
[[nodiscard]] bool isPinned(geode::ZStringView id) const&;
117+
[[nodiscard]] bool isPinned(geode::ZStringView id) const;
118118

119119
/**
120120
* Quickly check the viewed state of an option
@@ -123,7 +123,7 @@ namespace horrible {
123123
*
124124
* @returns Boolean of the current value
125125
*/
126-
[[nodiscard]] bool isViewed(geode::ZStringView id) const&;
126+
[[nodiscard]] bool isViewed(geode::ZStringView id) const;
127127

128128
/**
129129
* Quickly check the default toggle state of an option
@@ -132,7 +132,7 @@ namespace horrible {
132132
*
133133
* @returns Boolean of the default value
134134
*/
135-
[[nodiscard]] bool getDefaultToggleState(geode::ZStringView id) const& noexcept;
135+
[[nodiscard]] bool getDefaultToggleState(geode::ZStringView id) const noexcept;
136136

137137
/**
138138
* Get the saved data of an option
@@ -141,7 +141,7 @@ namespace horrible {
141141
*
142142
* @returns The current save
143143
*/
144-
[[nodiscard]] HorribleOptionSave getOption(geode::ZStringView id) const&;
144+
[[nodiscard]] HorribleOptionSave getOption(geode::ZStringView id) const;
145145

146146
/**
147147
* Returns the data of an option
@@ -150,7 +150,7 @@ namespace horrible {
150150
*
151151
* @returns A result possibly containing the option object
152152
*/
153-
[[nodiscard]] std::weak_ptr<Option> getOptionInfo(geode::ZStringView id) const& noexcept;
153+
[[nodiscard]] std::weak_ptr<Option> getOptionInfo(geode::ZStringView id) const noexcept;
154154

155155
/**
156156
* Returns the amount of delegate callbacks registered for an option
@@ -159,15 +159,15 @@ namespace horrible {
159159
*
160160
* @returns The amount of callbacks registered for this option
161161
*/
162-
[[nodiscard]] size_t getDelegateCount(std::string_view id) const& noexcept;
162+
[[nodiscard]] size_t getDelegateCount(std::string_view id) const noexcept;
163163

164164
/**
165165
* Set the toggle state of an option
166166
*
167167
* @param id The ID of the option to toggle
168168
* @param enable Boolean to toggle to
169169
*/
170-
void toggleOption(geode::ZStringView id, bool enable) &;
170+
void toggleOption(geode::ZStringView id, bool enable);
171171

172172
/**
173173
* Set the state of an option
@@ -177,29 +177,29 @@ namespace horrible {
177177
* @param pin If this option is pinned by the user
178178
* @param viewed If this option was already viewed by the user
179179
*/
180-
void setOption(geode::ZStringView id, bool enable, bool pin = false, bool viewed = true) &;
180+
void setOption(geode::ZStringView id, bool enable, bool pin = false, bool viewed = true);
181181

182182
/**
183183
* Upsert a new hook delegate
184184
*
185185
* @param id The ID of the option to set the delegate for
186186
* @param callback The hook callback to register for this option's delegate
187187
*/
188-
void addDelegate(geode::ZStringView id, Callback&& callback) &;
188+
void addDelegate(geode::ZStringView id, Callback&& callback);
189189

190190
/**
191191
* Returns a reference to the array of all registered categories
192192
*
193193
* @returns An array of every category name
194194
*/
195-
[[nodiscard]] std::span<const std::string> getCategories() const& noexcept;
195+
[[nodiscard]] std::span<const std::string> getCategories() const noexcept;
196196

197197
/**
198198
* Returns an array of all registered Geode mod integrations
199199
*
200200
* @returns An array of every Geode mod integration
201201
*/
202-
[[nodiscard]] std::vector<const geode::Mod*> getMods() const&;
202+
[[nodiscard]] std::vector<const geode::Mod*> getMods() const;
203203
};
204204

205205
/**

include/horrible/Option.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ namespace horrible {
4646

4747
static std::shared_ptr<Option> create(std::string id, const geode::Mod* integration = geode::Mod::get());
4848

49-
std::shared_ptr<Option> setName(std::string name) &;
50-
std::shared_ptr<Option> setDescription(std::string description) &;
51-
std::shared_ptr<Option> setCategory(std::string category) &;
52-
std::shared_ptr<Option> setSillyTier(SillyTier tier) &;
53-
std::shared_ptr<Option> setDefaultToggleState(bool state) &;
54-
std::shared_ptr<Option> setOnline(bool online) &;
55-
std::shared_ptr<Option> setRequiresRestart(bool required) &;
56-
std::shared_ptr<Option> setSupportedPlatforms(std::vector<Platform> platforms) &;
49+
std::shared_ptr<Option> setName(std::string name);
50+
std::shared_ptr<Option> setDescription(std::string description);
51+
std::shared_ptr<Option> setCategory(std::string category);
52+
std::shared_ptr<Option> setSillyTier(SillyTier tier);
53+
std::shared_ptr<Option> setDefaultToggleState(bool state);
54+
std::shared_ptr<Option> setOnline(bool online);
55+
std::shared_ptr<Option> setRequiresRestart(bool required);
56+
std::shared_ptr<Option> setSupportedPlatforms(std::vector<Platform> platforms);
5757

58-
std::shared_ptr<Option> autoRegister() &;
58+
std::shared_ptr<Option> autoRegister();
5959

6060
[[nodiscard]] geode::ZStringView getID() const noexcept;
6161
[[nodiscard]] geode::ZStringView getName() const noexcept;

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"id": "cubicstudios.horriblemenu",
1010
"name": "Horrible Menu",
11-
"version": "1.0.0-beta.1",
11+
"version": "1.0.0-prerelease.1",
1212
"developers": [
1313
"Team Breakeode",
1414
"Cheeseworks",

src/API.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,42 @@ matjson::Value matjson::Serialize<HorribleOptionSave>::toJson(HorribleOptionSave
3030

3131
Option::Option(std::string id, const Mod* integration) : m_id(std::move(id)), m_integration(integration) {};
3232

33-
std::shared_ptr<Option> Option::setName(std::string name) & {
33+
std::shared_ptr<Option> Option::setName(std::string name) {
3434
m_name = std::move(name);
3535
return shared_from_this();
3636
};
3737

38-
std::shared_ptr<Option> Option::setDescription(std::string description) & {
38+
std::shared_ptr<Option> Option::setDescription(std::string description) {
3939
m_description = std::move(description);
4040
return shared_from_this();
4141
};
4242

43-
std::shared_ptr<Option> Option::setCategory(std::string category) & {
43+
std::shared_ptr<Option> Option::setCategory(std::string category) {
4444
m_category = std::move(category);
4545
return shared_from_this();
4646
};
4747

48-
std::shared_ptr<Option> Option::setSillyTier(SillyTier tier) & {
48+
std::shared_ptr<Option> Option::setSillyTier(SillyTier tier) {
4949
m_silly = tier;
5050
return shared_from_this();
5151
};
5252

53-
std::shared_ptr<Option> Option::setDefaultToggleState(bool state) & {
53+
std::shared_ptr<Option> Option::setDefaultToggleState(bool state) {
5454
m_default = state;
5555
return shared_from_this();
5656
};
5757

58-
std::shared_ptr<Option> Option::setOnline(bool online) & {
58+
std::shared_ptr<Option> Option::setOnline(bool online) {
5959
m_online = online;
6060
return shared_from_this();
6161
};
6262

63-
std::shared_ptr<Option> Option::setRequiresRestart(bool required) & {
63+
std::shared_ptr<Option> Option::setRequiresRestart(bool required) {
6464
m_restart = required;
6565
return shared_from_this();
6666
};
6767

68-
std::shared_ptr<Option> Option::setSupportedPlatforms(std::vector<Platform> platforms) & {
68+
std::shared_ptr<Option> Option::setSupportedPlatforms(std::vector<Platform> platforms) {
6969
m_platforms = std::move(platforms);
7070
return shared_from_this();
7171
};
@@ -128,7 +128,7 @@ void Option::disable() {
128128
if (auto om = OptionManager::get()) om->toggleOption(getID(), false);
129129
};
130130

131-
std::shared_ptr<Option> Option::autoRegister() & {
131+
std::shared_ptr<Option> Option::autoRegister() {
132132
if (auto om = OptionManager::get()) om->registerOption(shared_from_this());
133133
return shared_from_this();
134134
};
@@ -137,11 +137,11 @@ std::shared_ptr<Option> Option::create(std::string id, const Mod* integration) {
137137
return std::make_shared<Option>(std::move(id), integration);
138138
};
139139

140-
void OptionManager::registerCategory(std::string category) & {
140+
void OptionManager::registerCategory(std::string category) {
141141
if (!utils::string::containsAny(category, getCategories())) m_categories.push_back(std::move(category));
142142
};
143143

144-
void OptionManager::registerMod(const Mod* mod) & {
144+
void OptionManager::registerMod(const Mod* mod) {
145145
if (!isModRegistered(mod->getID())) {
146146
log::trace("Attempting to register integrated mod {}...", mod->getID());
147147
if (mod->getID() == GEODE_MOD_ID) return;
@@ -151,15 +151,15 @@ void OptionManager::registerMod(const Mod* mod) & {
151151
};
152152
};
153153

154-
bool OptionManager::doesOptionExist(ZStringView id) const& noexcept {
154+
bool OptionManager::doesOptionExist(ZStringView id) const noexcept {
155155
return m_options.find(id) != m_options.end();
156156
};
157157

158-
bool OptionManager::isModRegistered(ZStringView id) const& noexcept {
158+
bool OptionManager::isModRegistered(ZStringView id) const noexcept {
159159
return m_integrations.find(id) != m_integrations.end();
160160
};
161161

162-
void OptionManager::registerOption(std::shared_ptr<Option> option) & {
162+
void OptionManager::registerOption(std::shared_ptr<Option> option) {
163163
if (doesOptionExist(option->getID())) {
164164
log::error("Could not register option '{}' ({}) because it already exists!", option->getName(), option->getID());
165165
} else {
@@ -173,12 +173,12 @@ void OptionManager::registerOption(std::shared_ptr<Option> option) & {
173173
};
174174
};
175175

176-
void OptionManager::addDelegate(ZStringView id, Callback&& callback) & {
176+
void OptionManager::addDelegate(ZStringView id, Callback&& callback) {
177177
auto& thisDelegate = m_delegates[id];
178178
thisDelegate.push_back(std::move(callback));
179179
};
180180

181-
std::vector<std::weak_ptr<Option>> OptionManager::getOptions() const& {
181+
std::vector<std::weak_ptr<Option>> OptionManager::getOptions() const {
182182
std::vector<std::weak_ptr<Option>> out;
183183
out.reserve(m_options.size());
184184

@@ -187,11 +187,11 @@ std::vector<std::weak_ptr<Option>> OptionManager::getOptions() const& {
187187
return out;
188188
};
189189

190-
std::span<const std::string> OptionManager::getCategories() const& noexcept {
190+
std::span<const std::string> OptionManager::getCategories() const noexcept {
191191
return m_categories;
192192
};
193193

194-
std::vector<const Mod*> OptionManager::getMods() const& {
194+
std::vector<const Mod*> OptionManager::getMods() const {
195195
std::vector<const Mod*> out;
196196
out.reserve(m_integrations.size());
197197

@@ -200,42 +200,42 @@ std::vector<const Mod*> OptionManager::getMods() const& {
200200
return out;
201201
};
202202

203-
bool OptionManager::isEnabled(ZStringView id) const& {
203+
bool OptionManager::isEnabled(ZStringView id) const {
204204
return getOption(id).enabled;
205205
};
206206

207-
bool OptionManager::isPinned(ZStringView id) const& {
207+
bool OptionManager::isPinned(ZStringView id) const {
208208
return getOption(id).pin;
209209
};
210210

211-
bool OptionManager::isViewed(ZStringView id) const& {
211+
bool OptionManager::isViewed(ZStringView id) const {
212212
return getOption(id).viewed;
213213
};
214214

215-
bool OptionManager::getDefaultToggleState(ZStringView id) const& noexcept {
215+
bool OptionManager::getDefaultToggleState(ZStringView id) const noexcept {
216216
if (auto o = getOptionInfo(id).lock()) return o->getDefaultToggleState();
217217
return false;
218218
};
219219

220-
HorribleOptionSave OptionManager::getOption(ZStringView id) const& {
220+
HorribleOptionSave OptionManager::getOption(ZStringView id) const {
221221
return Mod::get()->getSavedValue<HorribleOptionSave>(id, HorribleOptionSave{getDefaultToggleState(id)});
222222
};
223223

224-
std::weak_ptr<Option> OptionManager::getOptionInfo(ZStringView id) const& noexcept {
224+
std::weak_ptr<Option> OptionManager::getOptionInfo(ZStringView id) const noexcept {
225225
if (auto it = m_options.find(id); it != m_options.end()) return it->second;
226226
return std::weak_ptr<Option>();
227227
};
228228

229-
size_t OptionManager::getDelegateCount(std::string_view id) const& noexcept {
229+
size_t OptionManager::getDelegateCount(std::string_view id) const noexcept {
230230
if (auto it = m_delegates.find(id); it != m_delegates.end()) return it->second.size();
231231
return 0;
232232
};
233233

234-
void OptionManager::toggleOption(ZStringView id, bool enable) & {
234+
void OptionManager::toggleOption(ZStringView id, bool enable) {
235235
setOption(id, enable, isPinned(id));
236236
};
237237

238-
void OptionManager::setOption(ZStringView id, bool enable, bool pin, bool viewed) & {
238+
void OptionManager::setOption(ZStringView id, bool enable, bool pin, bool viewed) {
239239
auto it = m_delegates.find(id);
240240
if (it != m_delegates.end()) {
241241
for (auto& cb : it->second) cb(enable);

src/hooks/Mock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static auto const o = Option::create(THIS_ID)
1818
->setSupportedPlatforms({Platform::Windows, Platform::Android})
1919
->autoRegister();
2020

21-
#if !defined(GEODE_IS_MACOS) && !defined(GEODE_IS_IOS) // not compat with these platforms
21+
#if !defined(GEODE_IS_MACOS) & !defined(GEODE_IS_IOS) // not compat with these platforms
2222
class $modify(MockMenuLayer, MenuLayer) {
2323
HORRIBLE_DELEGATE_HOOKS(THIS_ID);
2424

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class $modify(HIFloatBtnPlayLayer, PlayLayer) {
178178
void toggleButton(bool toggle = false) {
179179
log::trace("{} floating button", toggle ? "Showing" : "Hiding");
180180
if (auto fb = MenuButton::get()) {
181-
auto toggleTo = thisMod->getSettingValue<bool>(setting::FloatingBtn) && (fb->showInLevel() || toggle);
181+
auto toggleTo = thisMod->getSettingValue<bool>(setting::FloatingBtn) & (fb->showInLevel() || toggle);
182182

183183
fb->setVisible(toggleTo);
184184
fb->setTouchEnabled(toggleTo);

0 commit comments

Comments
 (0)