Skip to content

Commit 6b494f5

Browse files
committed
2 parents b21a00f + 826b95b commit 6b494f5

File tree

10 files changed

+40
-52
lines changed

10 files changed

+40
-52
lines changed

loader/include/Geode/utils/general.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ namespace geode::utils::clipboard {
181181
}
182182

183183
namespace geode::utils::game {
184-
GEODE_DLL void exit();
185-
GEODE_DLL void restart();
184+
GEODE_DLL void exit(); // TODO: left for abi compat
185+
GEODE_DLL void exit(bool saveData /* = true */);
186+
GEODE_DLL void restart(); // TODO: left for abi compat
187+
GEODE_DLL void restart(bool saveData /* = true */);
186188
GEODE_DLL void launchLoaderUninstaller(bool deleteSaveData);
187189
}
188190

loader/src/loader/SettingNodeV3.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ class NumberSettingNodeV3 : public SettingValueNodeV3<S> {
222222
this->setValue(value, static_cast<CCNode*>(sender));
223223
}
224224
void onSlider(CCObject*) {
225-
this->setValue(this->valueFromSlider(m_slider->m_touchLogic->m_thumb->getValue()), m_slider);
225+
auto value = this->valueFromSlider(m_slider->m_touchLogic->m_thumb->getValue());
226+
227+
if (value != this->getValue()) {
228+
this->setValue(value, m_slider);
229+
}
226230
}
227231

228232
public:

loader/src/platform/windows/crashlogWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
195195
} else if (id == ID_BUTTON_COPY_CLIPBOARD) {
196196
geode::utils::clipboard::write(g_crashlogText);
197197
} else if (id == ID_BUTTON_RESTART_GAME) {
198-
geode::utils::game::restart();
198+
geode::utils::game::restart(false);
199199
}
200200
} break;
201201

loader/src/platform/windows/util.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ std::filesystem::path dirs::getModRuntimeDir() {
201201
return dirs::getGeodeDir() / "unzipped";
202202
}
203203

204-
void geode::utils::game::exit() {
204+
void geode::utils::game::exit(bool saveData) {
205205
// TODO: mat
206206
#if 0
207207
if (CCApplication::sharedApplication() &&
@@ -212,13 +212,20 @@ void geode::utils::game::exit() {
212212
#endif
213213

214214
// If this breaks down the read, uhhh blame Cvolton or something
215-
if (AppDelegate::get()) {
216-
AppDelegate::get()->trySaveGame(true);
215+
if (saveData) {
216+
if (AppDelegate::get()) {
217+
AppDelegate::get()->trySaveGame(true);
218+
}
217219
}
220+
218221
std::exit(0);
219222
}
220223

221-
void geode::utils::game::restart() {
224+
void geode::utils::game::exit() {
225+
exit(true);
226+
}
227+
228+
void geode::utils::game::restart(bool saveData) {
222229
// TODO: mat
223230
// TODO: be VERY careful before enabling this again, this function is called in platform/windows/main.cpp,
224231
// before we even check if we are in forward compatibility mode or not.
@@ -240,7 +247,11 @@ void geode::utils::game::restart() {
240247
const auto updaterPath = (workingDir / "GeodeUpdater.exe").string();
241248
ShellExecuteA(nullptr, "open", updaterPath.c_str(), gdName.c_str(), workingDir.string().c_str(), false);
242249

243-
exit();
250+
exit(saveData);
251+
}
252+
253+
void geode::utils::game::restart() {
254+
restart(true);
244255
}
245256

246257
void geode::utils::game::launchLoaderUninstaller(bool deleteSaveData) {

loader/src/ui/mods/ModsLayer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <Geode/ui/BasedButtonSprite.hpp>
55
#include <Geode/utils/file.hpp>
66
#include <Geode/cocos/cocoa/CCObject.h>
7+
#include <Geode/loader/Event.hpp>
78
#include "SwelvyBG.hpp"
89
#include <Geode/ui/TextInput.hpp>
910
#include <Geode/utils/ColorProvider.hpp>
@@ -91,6 +92,9 @@ bool ModsStatusNode::init() {
9192
m_downloadListener.bind([this](auto) { this->updateState(); });
9293

9394
m_settingNodeListener.bind([this](SettingNodeValueChangeEvent* ev) {
95+
if (!ev->isCommit()) {
96+
return ListenerResult::Propagate;
97+
}
9498
this->updateState();
9599
return ListenerResult::Propagate;
96100
});
@@ -503,7 +507,6 @@ bool ModsLayer::init() {
503507
{ "GJ_starsIcon_001.png", "Featured", ServerModListSource::get(ServerModListType::Featured), "featured-button", false },
504508
{ "globe.png"_spr, "Download", ServerModListSource::get(ServerModListType::Download), "download-button", false },
505509
{ "GJ_timeIcon_001.png", "Recent", ServerModListSource::get(ServerModListType::Recent), "recent-button", false },
506-
{ "d_artCloud_03_001.png", "Modtober", ServerModListSource::get(ServerModListType::Modtober24), "modtober-button", true },
507510
}) {
508511
auto btn = CCMenuItemSpriteExtra::create(
509512
GeodeTabSprite::create(std::get<0>(item), std::get<1>(item), 100, std::get<4>(item)),

loader/src/ui/mods/list/ModItem.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <Geode/ui/GeodeUI.hpp>
88
#include <Geode/utils/ColorProvider.hpp>
99
#include <Geode/binding/ButtonSprite.hpp>
10+
#include <Geode/loader/Event.hpp>
1011
#include <Geode/loader/Loader.hpp>
1112
#include "server/DownloadManager.hpp"
1213
#include "ui/mods/GeodeStyle.hpp"
@@ -243,7 +244,6 @@ bool ModItem::init(ModSource&& source) {
243244
if (metadata.tags.contains("joke")) {
244245
m_badgeContainer->addChild(CCSprite::createWithSpriteFrameName("tag-joke.png"_spr));
245246
}
246-
// todo: modtober winner tag
247247
if (metadata.tags.contains("modtober24winner") || m_source.getID() == "rainixgd.geome3dash") {
248248
auto shortVer = CCSprite::createWithSpriteFrameName("tag-modtober-winner.png"_spr);
249249
shortVer->setTag(1);
@@ -351,7 +351,10 @@ bool ModItem::init(ModSource&& source) {
351351
m_downloadListener.bind([this](auto) { this->updateState(); });
352352
m_downloadListener.setFilter(server::ModDownloadFilter(m_source.getID()));
353353

354-
m_settingNodeListener.bind([this](SettingNodeValueChangeEvent*) {
354+
m_settingNodeListener.bind([this](SettingNodeValueChangeEvent* ev) {
355+
if (!ev->isCommit()) {
356+
return ListenerResult::Propagate;
357+
}
355358
this->updateState();
356359
return ListenerResult::Propagate;
357360
});
@@ -516,7 +519,6 @@ void ModItem::updateState() {
516519
m_bg->setColor(ccc3(63, 91, 138));
517520
m_bg->setOpacity(85);
518521
}
519-
// todo: modtober winner tag
520522
if (metadata.tags.contains("modtober24winner") || m_source.getID() == "rainixgd.geome3dash") {
521523
m_bg->setColor(ccc3(104, 63, 138));
522524
m_bg->setOpacity(85);

loader/src/ui/mods/list/ModList.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -260,34 +260,6 @@ bool ModList::init(ModListSource* src, CCSize const& size) {
260260

261261
m_topContainer->addChild(m_searchMenu);
262262

263-
// Modtober banner; this can be removed after Modtober 2024 is over!
264-
if (
265-
auto src = typeinfo_cast<ServerModListSource*>(m_source);
266-
src && src->getType() == ServerModListType::Modtober24
267-
) {
268-
auto menu = CCMenu::create();
269-
menu->setID("modtober-banner");
270-
menu->ignoreAnchorPointForPosition(false);
271-
menu->setContentSize({ size.width, 30 });
272-
273-
auto banner = CCSprite::createWithSpriteFrameName("modtober24-banner.png"_spr);
274-
limitNodeWidth(banner, size.width, 1.f, .1f);
275-
menu->addChildAtPosition(banner, Anchor::Center);
276-
277-
auto label = CCLabelBMFont::create("Modtober 2024 Winner: Geome3Dash!", "bigFont.fnt");
278-
label->setScale(.35f);
279-
menu->addChildAtPosition(label, Anchor::Left, ccp(10, 0), ccp(0, .5f));
280-
281-
auto aboutSpr = createGeodeButton("View");
282-
aboutSpr->setScale(.5f);
283-
auto aboutBtn = CCMenuItemSpriteExtra::create(
284-
aboutSpr, this, menu_selector(ModList::onEventInfo)
285-
);
286-
menu->addChildAtPosition(aboutBtn, Anchor::Right, ccp(-30, 0));
287-
288-
m_topContainer->addChild(menu);
289-
}
290-
291263
m_topContainer->setLayout(
292264
ColumnLayout::create()
293265
->setGap(0)

loader/src/ui/mods/popups/ModPopup.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <Geode/ui/MDTextArea.hpp>
77
#include <Geode/ui/TextInput.hpp>
88
#include <Geode/utils/web.hpp>
9+
#include <Geode/loader/Event.hpp>
910
#include <Geode/loader/Loader.hpp>
1011
#include <Geode/loader/ModSettingsManager.hpp>
1112
#include <Geode/ui/GeodeUI.hpp>
@@ -646,7 +647,10 @@ bool ModPopup::setup(ModSource&& src) {
646647
m_downloadListener.bind([this](auto) { this->updateState(); });
647648
m_downloadListener.setFilter(m_source.getID());
648649

649-
m_settingNodeListener.bind([this](SettingNodeValueChangeEvent*) {
650+
m_settingNodeListener.bind([this](SettingNodeValueChangeEvent* ev) {
651+
if (!ev->isCommit()) {
652+
return ListenerResult::Propagate;
653+
}
650654
this->updateState();
651655
return ListenerResult::Propagate;
652656
});

loader/src/ui/mods/sources/ModListSource.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ enum class ServerModListType {
150150
Featured,
151151
Trending,
152152
Recent,
153-
Modtober24,
154153
};
155154

156155
class ServerModListSource : public ModListSource {

loader/src/ui/mods/sources/ServerModListSource.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ ServerModListSource* ServerModListSource::get(ServerModListType type) {
5454
static auto inst = new ServerModListSource(ServerModListType::Recent);
5555
return inst;
5656
} break;
57-
58-
case ServerModListType::Modtober24: {
59-
static auto inst = new ServerModListSource(ServerModListType::Modtober24);
60-
return inst;
61-
} break;
6257
}
6358
}
6459

@@ -105,10 +100,6 @@ server::ModsQuery ServerModListSource::createDefaultQuery() const {
105100
case ServerModListType::Recent: return server::ModsQuery {
106101
.sorting = server::ModsSort::RecentlyPublished,
107102
};
108-
109-
case ServerModListType::Modtober24: return server::ModsQuery {
110-
.tags = { "modtober24" },
111-
};
112103
}
113104
}
114105

0 commit comments

Comments
 (0)