-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (47 loc) · 1.58 KB
/
Copy pathmain.cpp
File metadata and controls
67 lines (47 loc) · 1.58 KB
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
// #include <etl/string.h>
#include <etl/error_handler.h>
#include <tinyalloc.h>
#include "hook.hpp"
#include "macro_helpers.hpp"
#include "types.hpp"
#include "sly.hpp"
// using namespace etl;
constexpr u32 TEXT_BASE = 0x01e5e000;
// Injected functions
DECLARE_FUNC(injc_crti, TEXT_BASE + 0x8, void);
// 01E4E000 - 01F8A000 size 0013C000
void USED setup() {
injc_crti();
etl::error_handler::set_callback<etl_error_handler>();
const u32 heap_base = 0x01E4E000; // 0x97000;
const u32 heap_size = 0x2000;
const u32 heap_limit = heap_base + heap_size;
ta_init((void*)heap_base, (void*)heap_limit, 256, 16, 4);
hook((address)orig_Startup, (address)&replace_Startup);
hook((address)orig_DrawPlayerSuck, (address)&replace_DrawPlayerSuck);
orig_g_fShowPlayerSuck = 1;
hook((address)orig_OnCoinSmack, (address)&replace_OnCoinSmack);
// Setup epilogue
// Restore orig bytes
// TODO: Don't hardcode these, maybe they're different in other games?
*(u32*)((address)orig__start + 0) = 0x3C02002A; // lui v0,0x002A
*(u32*)((address)orig__start + 4) = 0x3C030068; // lui v1,0x0068
orig__start();
}
// void __start() {
// }
int main() {
// char c{};
// char d{};
// memcpy(&d, &c, 1);
}
// void startup() {}
// void update() {} // Done on each vsync
// void shutdown() {}
// int main() {
// // return test[1337];
// return func();
// }
// volatile extern OFFSET(0x42424242) u8 test[10000];
// volatile int myvar __attribute__((section(".mySection"))) = 0x9ABCDEF0;
// extern int func() __attribute__((section(".mySection")));