Skip to content

Commit ed15b21

Browse files
authored
Hotfix/2.0.1 (#207)
* Renamed output 3gx and elf to be the same name as the release 3gx file * Fixed Address OrigValue Reading (Read32 probably was called too early?) * Fixed Move Furniture Freezing Game, also improved IsIndoors Boolean * Improved Move Furniture so Villagers appear in their house * Removed Custom Seed Item Icons * Set new version number * Oops, forgot this * Fixed Seed Items not appearing when picking up * Fixed CI job - wrong 3gx name
1 parent 53e8a63 commit ed15b21

File tree

23 files changed

+511
-448
lines changed

23 files changed

+511
-448
lines changed

.github/workflows/c-cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
4848
for folder in 0004000000198e00 0004000000198d00 00040000004C5700 0004000000199000 0004000000086500 0004000000086400 0004000000086300 0004000000086200 0004000000198f00; do
4949
mkdir -p package/luma/plugins/$folder/snd
50-
cp Vapecord-ACNL-Plugin.3gx package/luma/plugins/$folder/Vapecord_Public.3gx
50+
cp Vapecord_Public.3gx package/luma/plugins/$folder/Vapecord_Public.3gx
5151
cp -r Files/snd/* package/luma/plugins/$folder/snd/
5252
done
5353

Includes/Address/Addresses.hpp

Lines changed: 386 additions & 380 deletions
Large diffs are not rendered by default.

Includes/Config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#define majorV 2
66
#define minorV 0
7-
#define revisV 0
7+
#define revisV 1
88

99
namespace CTRPluginFramework {
1010
bool WriteLanguage(const std::string& langCode);

Includes/RuntimeContext.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace CTRPluginFramework {
99
bool v_isTurbo = false;
1010
bool v_isFov = false;
1111
bool v_isSaveMenuDisabled = false;
12-
bool v_isIndoors = false;
1312

1413
RuntimeContext() = default;
1514
static RuntimeContext* instance;
@@ -22,7 +21,5 @@ namespace CTRPluginFramework {
2221
void setFov(bool value);
2322
bool isSaveMenuDisabled() const;
2423
void setSaveMenuDisabled(bool value);
25-
bool isIndoors() const;
26-
void setIndoors(bool value);
2724
};
2825
}

Includes/cheats.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ namespace CTRPluginFramework {
233233
void DisableAllChecks(void);
234234
void DisableAllPatches(void);
235235

236+
void SeedItemLegitimacyEntry(MenuEntry *entry);
236237
void OnlineDropLagRemoverEntry(MenuEntry *entry);
237238
void ChangeRockbreakParticleEntry(MenuEntry *entry);
238239
void DropItemsEverywhereEntry(MenuEntry *entry);
@@ -258,7 +259,7 @@ namespace CTRPluginFramework {
258259
void SetDropRules(MenuEntry *entry);
259260
void SetPlantRules(MenuEntry *entry);
260261
void FixParticlesInPuzzleLeague(MenuEntry *entry);
261-
void SetCustomSpritesForSeedItemsAndProDesigns(MenuEntry *entry);
262+
void SetCustomSpritesForProDesigns(MenuEntry *entry);
262263
void FruitStackingCheck(MenuEntry *entry);
263264

264265
void SetLanguageEntry(MenuEntry *entry);

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include $(DEVKITARM)/3ds_rules
1111

1212
CTRPFLIB ?= $(DEVKITPRO)/libctrpf
1313

14-
TARGET := $(notdir $(CURDIR))
14+
TARGET := Vapecord_Public
1515

1616
BUILD := Build
1717
INCLUDES := Includes \

Sources/Folders/DefaultCodes/DefaultChecks.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ namespace CTRPluginFramework {
326326
}
327327
}
328328

329-
void SetCustomSpritesForSeedItemsAndProDesigns(MenuEntry *entry) {
329+
/*Not SeedItems*/
330+
void SetCustomSpritesForProDesigns(MenuEntry *entry) {
330331
int res = OptionKeyboard();
331332
if(res < 0) {
332333
return;

Sources/Folders/DefaultCodes/DefaultPatches.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ namespace CTRPluginFramework {
2020
fn(res == 0); // 0 = enable, 1 = disable
2121
}
2222

23+
void SeedItemLegitimacy(bool enable) {
24+
static Address skipSeedItemCheck(0x6BAC8C);
25+
static Address allItemsLegit = skipSeedItemCheck.MoveOffset(0x14C);
26+
27+
if(enable) {
28+
skipSeedItemCheck.Patch(0xEA000006);
29+
allItemsLegit.Patch(0xE3A00001);
30+
}
31+
else {
32+
skipSeedItemCheck.Unpatch();
33+
allItemsLegit.Unpatch();
34+
}
35+
}
36+
2337
void OnlineDropLagRemover(bool enable) {
2438
static Address host1(0x5A1454);
2539
static Address host2(0x5A12F4);
@@ -189,6 +203,7 @@ namespace CTRPluginFramework {
189203
}
190204

191205
void EnableAllPatches() {
206+
SeedItemLegitimacy(true);
192207
OnlineDropLagRemover(true);
193208
ChangeRockbreakParticle(true);
194209
DropItemsEverywhere(true);
@@ -202,6 +217,7 @@ namespace CTRPluginFramework {
202217
}
203218

204219
void DisableAllPatches() {
220+
SeedItemLegitimacy(false);
205221
OnlineDropLagRemover(false);
206222
ChangeRockbreakParticle(false);
207223
DropItemsEverywhere(false);
@@ -214,6 +230,10 @@ namespace CTRPluginFramework {
214230
PatchDropFunction(false);
215231
}
216232

233+
void SeedItemLegitimacyEntry(MenuEntry *entry) {
234+
ToggleWithOptionKeyboard(SeedItemLegitimacy);
235+
}
236+
217237
void OnlineDropLagRemoverEntry(MenuEntry *entry) {
218238
ToggleWithOptionKeyboard(OnlineDropLagRemover);
219239
}

Sources/Folders/FunCodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ namespace CTRPluginFramework {
263263

264264
if(Camera::GetInstance() != 0) {
265265
//check if you're outside
266-
if(!RuntimeContext::getInstance()->isIndoors()) {
266+
if(!Player::IsIndoors()) {
267267
if(Game::IsGameInRoom(1)) {
268268
rotationAsm.Unpatch();
269269
rotationAsm2.Unpatch();

Sources/Folders/MiscCodes.cpp

Lines changed: 68 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,15 @@
88
#include "Helpers/Dropper.hpp"
99
#include "Helpers/Inventory.hpp"
1010
#include "Helpers/GameKeyboard.hpp"
11+
#include "Helpers/Player.hpp"
1112
#include "RuntimeContext.hpp"
1213
#include "Color.h"
1314

14-
extern "C" void MoveFurn(void);
1515
extern "C" void PATCH_MoveFurnButton(void);
1616
extern "C" void PATCH_ToolAnim(void);
1717

18-
extern "C" bool __IsIndoors(void) {
19-
return CTRPluginFramework::RuntimeContext::getInstance()->isIndoors();
20-
}
21-
2218
u8 toolTypeAnimID = 6;
2319

24-
extern "C" bool __IsAnimID(u8 toolAnimID) {
25-
static const u8 toolAnimIDArr[18] = { 0xB0, 0x49, 0x55, 0x6C, 0xA0, 0x98, 0x8F, 0x91, 0xC3, 0xCE, 0xCF, 0x8D, 0x8E, 0x91, 0xB1, 0xB1, 0x70, 0x9A };
26-
return std::find(std::begin(toolAnimIDArr), std::end(toolAnimIDArr), toolAnimID) != std::end(toolAnimIDArr);
27-
}
28-
2920
namespace CTRPluginFramework {
3021
//Change Tool Animation
3122
void tooltype(MenuEntry *entry) {
@@ -224,32 +215,82 @@ namespace CTRPluginFramework {
224215
fovlargeMod.Unpatch();
225216
}
226217
}
218+
219+
u32 MoveFurniturePatch(void) {
220+
const HookContext &curr = HookContext::GetCurrent();
221+
static Address func = Address::decodeARMBranch(curr.targetAddress, curr.overwrittenInstr);
222+
func.Call<u32>();
223+
224+
return Player::IsIndoors();
225+
}
226+
227+
u32 LightSwitchPatch(void) {
228+
return Player::IsIndoors();
229+
}
230+
227231
//Move Furniture
228232
void roomSeeder(MenuEntry *entry) {
229-
static const Address movefurn(0x5B531C);
230-
static const Address lightswitch(0x5B7558);
231-
static const Address MoveFurnPatch(0x326B98);
232-
233-
static Hook hook1, hook2, hook3;
233+
static const Address movingFurniture(0x4E1720);
234+
static const Address pickingUpFurniture(0x678AC0);
235+
static const Address placingFurniture1(0x76B880);
236+
static const Address placingFurniture2(0x26FED8);
237+
static const Address placingFurniture3(0x4E78A8);
238+
static const Address lightswitchVisible(0x3279CC);
239+
static const Address lightswitchFunction(0x3277E8);
240+
static const Address moveFurnButton(0x326B98);
241+
242+
static Hook movingFurnitureHook;
243+
static Hook pickingUpFurnitureHook;
244+
static Hook placingFurnitureHook1;
245+
static Hook placingFurnitureHook2;
246+
static Hook placingFurnitureHook3;
247+
static Hook lightSwitchVisibleHook;
248+
static Hook lightSwitchFunctionHook;
249+
static Hook moveFurnButtonHook;
234250

235251
if(entry->WasJustActivated()) {
236-
hook1.Initialize(movefurn.addr, (u32)MoveFurn);
237-
hook1.SetFlags(USE_LR_TO_RETURN);
238-
hook1.Enable();
252+
movingFurnitureHook.Initialize(movingFurniture.addr, (u32)MoveFurniturePatch);
253+
movingFurnitureHook.SetFlags(USE_LR_TO_RETURN);
254+
movingFurnitureHook.Enable();
255+
256+
pickingUpFurnitureHook.Initialize(pickingUpFurniture.addr, (u32)MoveFurniturePatch);
257+
pickingUpFurnitureHook.SetFlags(USE_LR_TO_RETURN);
258+
pickingUpFurnitureHook.Enable();
259+
260+
placingFurnitureHook1.Initialize(placingFurniture1.addr, (u32)MoveFurniturePatch);
261+
placingFurnitureHook1.SetFlags(USE_LR_TO_RETURN);
262+
placingFurnitureHook1.Enable();
263+
264+
placingFurnitureHook2.Initialize(placingFurniture2.addr, (u32)MoveFurniturePatch);
265+
placingFurnitureHook2.SetFlags(USE_LR_TO_RETURN);
266+
placingFurnitureHook2.Enable();
267+
268+
placingFurnitureHook3.Initialize(placingFurniture3.addr, (u32)MoveFurniturePatch);
269+
placingFurnitureHook3.SetFlags(USE_LR_TO_RETURN);
270+
placingFurnitureHook3.Enable();
271+
272+
lightSwitchVisibleHook.Initialize(lightswitchVisible.addr, (u32)LightSwitchPatch);
273+
lightSwitchVisibleHook.SetFlags(USE_LR_TO_RETURN);
274+
lightSwitchVisibleHook.Enable();
239275

240-
hook2.Initialize(lightswitch.addr, (u32)MoveFurn);
241-
hook2.SetFlags(USE_LR_TO_RETURN);
242-
hook2.Enable();
276+
lightSwitchFunctionHook.Initialize(lightswitchFunction.addr, (u32)LightSwitchPatch);
277+
lightSwitchFunctionHook.SetFlags(USE_LR_TO_RETURN);
278+
lightSwitchFunctionHook.Enable();
243279

244-
hook3.Initialize(MoveFurnPatch.addr, (u32)PATCH_MoveFurnButton);
245-
hook3.SetFlags(USE_LR_TO_RETURN);
246-
hook3.Enable();
280+
moveFurnButtonHook.Initialize(moveFurnButton.addr, (u32)PATCH_MoveFurnButton);
281+
moveFurnButtonHook.SetFlags(USE_LR_TO_RETURN);
282+
moveFurnButtonHook.Enable();
247283
}
248284

249285
else if(!entry->IsActivated()) {
250-
hook1.Disable();
251-
hook2.Disable();
252-
hook3.Disable();
286+
movingFurnitureHook.Disable();
287+
pickingUpFurnitureHook.Disable();
288+
placingFurnitureHook1.Disable();
289+
placingFurnitureHook2.Disable();
290+
placingFurnitureHook3.Disable();
291+
lightSwitchVisibleHook.Disable();
292+
lightSwitchFunctionHook.Disable();
293+
moveFurnButtonHook.Disable();
253294
}
254295
}
255296
//Can Walk When Talk /*Made by Jay*/

0 commit comments

Comments
 (0)