|
5 | 5 | using namespace CTRPluginFramework; |
6 | 6 |
|
7 | 7 | namespace Misc { |
| 8 | + static int weatherLocation, weatherToggle; |
| 9 | + |
| 10 | + void WeatherKB(MenuEntry *entry) { |
| 11 | + static const vector<string> options = {"Route 113", "Route 119", "Route 120", "Jagged Pass", "East Hoenn"}; |
| 12 | + static const vector<string> conditions = {"Snow", "Rain", "Rain", "Snow", Helpers::PickGame("Extremely Harsh Sunlight", "Heavy Rain")}; |
| 13 | + KeyboardPlus keyboard; |
| 14 | + |
| 15 | + if (keyboard.SetKeyboard(entry->Name() + ":", true, options, weatherLocation) != -1) { |
| 16 | + if (keyboard.SetKeyboard(conditions[weatherLocation] + ":", true, {"On", "Off"}, weatherToggle) != -1) |
| 17 | + Message::Completed(); |
| 18 | + } |
| 19 | + } |
| 20 | + |
| 21 | + static const vector<int> weatherFlags = {1, 4, 1, 1, Helpers::PickGame(2, 4)}; |
| 22 | + |
| 23 | + void Weather(MenuEntry *entry) { |
| 24 | + static const vector<vector<u32>> address = {{Helpers::PickGame<u32>(0x3FE54C, 0x3FE544)}, {0x8C81B56, 0x8C81B5E, 0x8C81B58, 0x8C81F37, 0x8C81B5A}}; |
| 25 | + static u32 original; |
| 26 | + static bool saved = false; |
| 27 | + |
| 28 | + if (ProcessPlus::Write32(address[0][0], 0xE320F000, original, entry, saved)) { |
| 29 | + if (Bit::Read8(address[1][weatherLocation], data8, true) && data8 != (weatherToggle == 0 ? weatherFlags[weatherLocation] : 0)) |
| 30 | + if (!Bit::Write8(address[1][weatherLocation], (weatherToggle == 0 ? weatherFlags[weatherLocation] : 0), true)) |
| 31 | + return; |
| 32 | + } |
| 33 | + } |
| 34 | + |
8 | 35 | void IsRenamable(MenuEntry *entry) { |
9 | 36 | static const u32 address = Helpers::AutoRegion(Helpers::GetVersion(0x4B1680, Helpers::PickGame(0x4EA990, 0x4EA998)), Helpers::GetVersion(0x4AA2C0, 0x4C6F64)); |
10 | 37 | static u32 original; |
|
0 commit comments