Skip to content

Commit 1d9e358

Browse files
committed
fix chest issue
1 parent 0e11a19 commit 1d9e358

File tree

4 files changed

+44
-29
lines changed

4 files changed

+44
-29
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
build-linux/
2-
build-android/
3-
build-armv8/
2+
build-android*/
43
test/build-linux
54
test/compile_commands.json
65
.cache/

changelog.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Changelog
2+
## <cj>v1.6.0-beta.2</c> <cb>(2026-03-08)</c>
3+
* <cy>Fixed</c> chests crashing upon opening for Android.
4+
25
## <cj>v1.6.0-beta.1</c> <cb>(2026-03-08)</c>
36
* <cp>GDUtils ported to Geode 5.0.0 (GD 2.2081)</c>
4-
* <cy>Changed</c> logic for chest notifications
7+
* <cy>Changed</c> logic for chest notifications.
8+
* <cy>Changed</c> locations for where GDUtils stores files.
59
* <cy>Temporarily removed</c> leaderboards due to not being rewritten yet.
610
* <cy>Fixed</c> Spotify feature not unmuting when playtesting in Editor.
7-
* <cy>Fixed</c> notification being clickable
11+
* <cy>Fixed</c> notification being clickable.
812

913
## <cj>v1.5.4</c> <cb>(2025-09-09)</c>
1014
* <cg>Added</c> coloured container animation when searching a friend on the friend list.

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "5.0.0",
3-
"version": "v1.6.0-beta.1",
3+
"version": "v1.6.0-beta.2",
44
"gd": {
55
"win": "2.2081",
66
"mac": "2.2081",

src/modules/events/DailyChest.cpp

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static GJRewardItem* time1 = nullptr;
4646
static GJRewardItem* time2 = nullptr;
4747
static std::optional<arc::mpsc::Sender<ChestMsg>> g_chestTx;
4848

49-
5049
void DailyChest::getRewards() {
5150
auto glm = GameLevelManager::sharedState();
5251
if (glm) {
@@ -121,8 +120,40 @@ void giveChestNotify(bool large) {
121120
});
122121
}
123122

123+
#include <Geode/modify/RewardUnlockLayer.hpp>
124+
class $modify(RULHook, RewardUnlockLayer) {
125+
void step2() {
126+
int tag = m_chestType;
127+
if (g_chestTx) {
128+
if (tag == 1) {
129+
(void)g_chestTx->trySend({
130+
.type = ChestMsg::Type::Opened,
131+
.opened = ChestKind::Small
132+
});
133+
} else if (tag == 2) {
134+
(void)g_chestTx->trySend({
135+
.type = ChestMsg::Type::Opened,
136+
.opened = ChestKind::Large
137+
});
138+
}
139+
}
140+
refreshRewards();
141+
RewardUnlockLayer::step2();
142+
}
143+
};
144+
145+
static void toggleHook(bool value) {
146+
for (auto& hook : geode::Mod::get()->getHooks()) {
147+
if (hook->getDisplayName() == "RewardUnlockLayer::step2") {
148+
(void)(value ? hook->enable() : hook->disable());
149+
}
150+
}
151+
}
124152
$on_game(Loaded) {
125-
if (!Mod::get()->getSettingValue<bool>("largeChest") && !Mod::get()->getSettingValue<bool>("smallChest")) return;
153+
if (!Mod::get()->getSettingValue<bool>("largeChest") && !Mod::get()->getSettingValue<bool>("smallChest")) {
154+
toggleHook(false);
155+
return;
156+
}
126157
auto [tx, rx] = arc::mpsc::channel<ChestMsg>();
127158
g_chestTx = std::move(tx);
128159
// wait 5 seconds before
@@ -233,38 +264,19 @@ void giveChestNotify(bool large) {
233264
});
234265
listenForSettingChanges<bool>("smallChest", [](bool value) {
235266
if (!value && !Mod::get()->getSettingValue<bool>("largeChest")) {
236-
if (g_chestTx) {
267+
if (g_chestTx) {
268+
toggleHook(false);
237269
(void)g_chestTx->trySend({ ChestMsg::Type::Stop });
238270
}
239271
}
240272
});
241273
listenForSettingChanges<bool>("largeChest", [](bool value) {
242274
if (!value && !Mod::get()->getSettingValue<bool>("smallChest")) {
243275
if (g_chestTx) {
276+
toggleHook(false);
244277
(void)g_chestTx->trySend({ ChestMsg::Type::Stop });
245278
}
246279
}
247280
});
248281
refreshRewards();
249282
}
250-
#include <Geode/modify/RewardUnlockLayer.hpp>
251-
class $modify(RULHook, RewardUnlockLayer) {
252-
void step3() {
253-
int tag = m_chestType;
254-
if (g_chestTx) {
255-
if (tag == 1) {
256-
(void)g_chestTx->trySend({
257-
.type = ChestMsg::Type::Opened,
258-
.opened = ChestKind::Small
259-
});
260-
} else if (tag == 2) {
261-
(void)g_chestTx->trySend({
262-
.type = ChestMsg::Type::Opened,
263-
.opened = ChestKind::Large
264-
});
265-
}
266-
}
267-
refreshRewards();
268-
RewardUnlockLayer::step3();
269-
}
270-
};

0 commit comments

Comments
 (0)