Add support for SD cheat codes
This commit is contained in:
parent
e165dcd1f4
commit
e599e9cf58
21
src/main.cpp
21
src/main.cpp
@ -5,6 +5,7 @@
|
||||
#include <malloc.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include "dynamic_libs/os_functions.h"
|
||||
#include "dynamic_libs/fs_functions.h"
|
||||
#include "dynamic_libs/sys_functions.h"
|
||||
@ -35,6 +36,22 @@ void applyFunctionPatches() {
|
||||
patchIndividualMethodHooks(method_hooks_coreinit, method_hooks_size_coreinit, method_calls_coreinit);
|
||||
}
|
||||
|
||||
void applyCheatCodes(){
|
||||
uint64_t titleIDNum = OSGetTitleID();
|
||||
char titleID[17];
|
||||
sprintf(titleID, "%" PRIu64, titleIDNum);
|
||||
char fileName[24];
|
||||
strncat(fileName, titleID, 16);
|
||||
strncat(fileName, ".gctu", 5);
|
||||
FILE * fPointer;
|
||||
fPointer = fopen(fileName, "r");
|
||||
char codes[8192];
|
||||
if (fPointer != NULL){
|
||||
fgets(codes, 8192, fPointer);
|
||||
memcpy((void*)0x10015000, (void*)codes, sizeof(codes));
|
||||
}
|
||||
}
|
||||
|
||||
/* Entry point */
|
||||
int Menu_Main(void) {
|
||||
//!*******************************************************************
|
||||
@ -149,6 +166,8 @@ int Menu_Main(void) {
|
||||
|
||||
isCodeHandlerInstalled = true;
|
||||
launchMethod = TCP_GECKO;
|
||||
|
||||
applyCheatCodes();
|
||||
|
||||
initializeUDPLog();
|
||||
log_print("Patching functions\n");
|
||||
@ -179,4 +198,4 @@ int Menu_Main(void) {
|
||||
}
|
||||
|
||||
return EXIT_RELAUNCH_ON_LOAD;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user