forked from AnalogMan151/sumoCheatMenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exp_multipliers.c
126 lines (102 loc) · 2.92 KB
/
exp_multipliers.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Filename: exp_multipliers.c
#include "cheats.h"
#include "hid.h"
/********************************
* *
* EXP Multipliers *
* *
********************************/
static char currentEXP[40] = "Undefined";
u8 exp_rate = 1;
u32 o_exp1 = 0x00595800,
o_exp2 = 0x0048F1EC;
// EXP menu entry
void expMenu(void) {
switch(gameVer) {
case 10:
break;
case 11:
o_exp1 += 0x1F00;
o_exp2 += 0x1C60;
break;
}
updateEXP();
new_spoiler("EXP Multiplier");
new_unselectable_entry(currentEXP);
new_separator();
new_entry_managed("Increase 1's", increaseEXP1, INCREASEEXP1, AUTO_DISABLE);
new_entry_managed("Increase 10's", increaseEXP10, INCREASEEXP10, AUTO_DISABLE);
new_entry_managed("Increase 100's", increaseEXP100, INCREASEEXP100, AUTO_DISABLE);
new_line();
exit_spoiler();
}
// Reads current EXP modifier and prints it to the menu
void updateEXP(void) {
static const u8 buffer[] =
{
0xB2, 0x02, 0xD0, 0xE1,
0x02, 0x40, 0x2D, 0xE9,
0x01, 0x10, 0xA0, 0xE3,
0x90, 0x01, 0x00, 0xE0,
0x02, 0x80, 0xBD, 0xE8
};
memcpy((void *)(o_exp1), buffer, 0x14);
WRITEU8(o_exp1 + 0x08, exp_rate);
switch(gameVer) {
case 10:
WRITEU32(o_exp2, 0xEB041983);
break;
case 11:
WRITEU32(o_exp2, 0xEB041A2B);
break;
}
xsprintf(currentEXP, "Current EXP rate: %3dx", exp_rate);
}
// Increases EXP modifier by 1 each time it's called, updates menu and then deactivates
void increaseEXP1(void) {
// Extracts ones place
int ones = exp_rate % 10;
exp_rate -= ones;
// Prevent going over 255
if (exp_rate + ones + 1 > 255)
ones = 0;
else if (ones < 9)
ones++;
else
ones = 0;
// Adds ones place back in
exp_rate += ones;
updateEXP();
}
// Increases EXP modifier by 10 each time it's called, updates menu and then deactivates
void increaseEXP10(void) {
// Extracts tens place
int tens = (exp_rate / 10) % 10;
exp_rate -= (tens * 10);
// Prevents going over 255
if (exp_rate + (tens * 10) + 10 > 255)
tens = 0;
else if (tens < 9)
tens++;
else
tens = 0;
// Adds tens place back in
exp_rate += (tens * 10);
updateEXP();
}
// Increases EXP modifier by 100 each time it's called, updates menu and then deactivates
void increaseEXP100(void) {
// Extracts hundreds place
int hundreds = (exp_rate / 100);
exp_rate -= (hundreds * 100);
// Prevents going over 255
if (exp_rate + (hundreds * 100) + 100 > 255)
hundreds = 0;
else if (hundreds < 2)
hundreds++;
else
hundreds = 0;
// Adds hundreds place back in
exp_rate += (hundreds * 100);
updateEXP();
}