Skip to content

Commit 06af750

Browse files
committed
Allow for change of text color in-game
1 parent 0fa05f7 commit 06af750

File tree

4 files changed

+89
-6
lines changed

4 files changed

+89
-6
lines changed

Includes/Helpers/Helpers.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ namespace CTRPluginFramework {
2121
void Settings(MenuEntry *entry);
2222

2323
namespace Helpers {
24+
struct ColoredText {
25+
const char *name;
26+
int val;
27+
};
28+
29+
extern ColoredText textColors[7];
30+
extern bool TextColorizer(u32 address);
31+
2432
namespace Battle {
2533
extern vector<u32> offset;
2634
}

Sources/Folders/PlayerSearchSystem.cpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,20 @@ namespace PSS {
273273
static string messageVal;
274274

275275
void Message(MenuEntry *entry) {
276-
static const u32 address = Helpers::GetVersion(0x8C79CB8, 0x8C813BC);
276+
static u32 address = Helpers::GetVersion(0x8C79CB8, 0x8C813BC);
277+
static int length;
277278

278-
if (KB<string>(entry->Name() + ":", true, false, 16, messageVal, "")) {
279+
if (Helpers::TextColorizer(Helpers::GetVersion(0x8C79CB8, 0x8C813BC))) {
280+
length = 12;
281+
address = Helpers::GetVersion(0x8C79CB8, 0x8C813BC) + 0x8;
282+
}
283+
284+
else {
285+
length = 16;
286+
address = Helpers::GetVersion(0x8C79CB8, 0x8C813BC);
287+
}
288+
289+
if (KB<string>(entry->Name() + ":", true, false, length, messageVal, "")) {
279290
if (Process::WriteString(address, messageVal, StringFormat::Utf16))
280291
Message::Completed();
281292
}
@@ -452,9 +463,20 @@ namespace PSS {
452463
static string shoutOutVal;
453464

454465
void ShoutOut(MenuEntry *entry) {
455-
static const u32 address = Helpers::GetVersion(0x8C79D62, 0x8C81466);
466+
static u32 address = Helpers::GetVersion(0x8C79D62, 0x8C81466);
467+
static int length;
468+
469+
if (Helpers::TextColorizer(Helpers::GetVersion(0x8C79D62, 0x8C81466))) {
470+
length = 12;
471+
address = Helpers::GetVersion(0x8C79D62, 0x8C81466) + 0x8;
472+
}
473+
474+
else {
475+
length = 16;
476+
address = Helpers::GetVersion(0x8C79D62, 0x8C81466);
477+
}
456478

457-
if (KB<string>(entry->Name() + ":", true, false, 16, shoutOutVal, "")) {
479+
if (KB<string>(entry->Name() + ":", true, false, length, shoutOutVal, "")) {
458480
if (Process::WriteString(address, shoutOutVal, StringFormat::Utf16))
459481
Message::Completed();
460482
}

Sources/Folders/Trainer.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,22 @@ namespace Trainer {
4242
string nameVal;
4343

4444
void Name(MenuEntry *entry) {
45-
static const u32 address = Helpers::AutoRegion(Helpers::GetVersion(0x8C79C84, 0x8C81388), Helpers::GetVersion(0x330D6808, 0x33012850));
45+
static u32 address = Helpers::AutoRegion(Helpers::GetVersion(0x8C79C84, 0x8C81388), Helpers::GetVersion(0x330D6808, 0x33012850));
46+
static int length;
4647

47-
if (KB<string>(entry->Name() + ":", true, false, 16, nameVal, "")) {
48+
if (group == Group::XY || group == Group::ORAS) {
49+
if (Helpers::TextColorizer(Helpers::GetVersion(0x8C79C84, 0x8C81388))) {
50+
length = 12;
51+
address = Helpers::GetVersion(0x8C79C84, 0x8C81388) + 0x8;
52+
}
53+
54+
else {
55+
length = 16;
56+
address = Helpers::GetVersion(0x8C79C84, 0x8C81388);
57+
}
58+
}
59+
60+
if (KB<string>(entry->Name() + ":", true, false, length, nameVal, "")) {
4861
if (Process::WriteString(address, nameVal, StringFormat::Utf16))
4962
Message::Completed();
5063
}

Sources/Helpers/Helpers.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,46 @@ namespace CTRPluginFramework {
7373
}
7474

7575
namespace Helpers {
76+
ColoredText textColors[7] = {
77+
{"Red", 0},
78+
{"Green", 1},
79+
{"Blue", 2},
80+
{"Orange", 3},
81+
{"Pink", 4},
82+
{"Purple", 5},
83+
{"Light Blue", 6}
84+
};
85+
86+
static int isColored = false, chosenColor;
87+
88+
bool TextColorizer(u32 address) {
89+
static const vector<string> options = {"No", "Yes"};
90+
KeyboardPlus keyboard;
91+
92+
if (keyboard.SetKeyboard("Colored?", true, options, isColored) != -1) {
93+
if (isColored == 1) {
94+
static vector<string> colors;
95+
96+
if (colors.empty()) {
97+
for (const ColoredText &nickname : textColors)
98+
colors.push_back(nickname.name);
99+
}
100+
101+
if (keyboard.SetKeyboard("Color:", true, colors, chosenColor) != -1) {
102+
Process::Write32(address, 0x20010);
103+
Process::Write16(address + 0x6, textColors[chosenColor].val);
104+
Process::Write16(address + 0x4, 0xBD00);
105+
}
106+
107+
return true;
108+
}
109+
110+
else return false;
111+
}
112+
113+
else return false;
114+
}
115+
76116
namespace Battle {
77117
vector<u32> offset(2);
78118
}

0 commit comments

Comments
 (0)