Add support for SD cheat codes

This commit is contained in:
HackingNewbie 2017-08-26 17:48:37 +01:00 committed by GitHub
parent e165dcd1f4
commit e599e9cf58

View File

@ -5,6 +5,7 @@
#include <malloc.h> #include <malloc.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h>
#include "dynamic_libs/os_functions.h" #include "dynamic_libs/os_functions.h"
#include "dynamic_libs/fs_functions.h" #include "dynamic_libs/fs_functions.h"
#include "dynamic_libs/sys_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); 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 */ /* Entry point */
int Menu_Main(void) { int Menu_Main(void) {
//!******************************************************************* //!*******************************************************************
@ -149,6 +166,8 @@ int Menu_Main(void) {
isCodeHandlerInstalled = true; isCodeHandlerInstalled = true;
launchMethod = TCP_GECKO; launchMethod = TCP_GECKO;
applyCheatCodes();
initializeUDPLog(); initializeUDPLog();
log_print("Patching functions\n"); log_print("Patching functions\n");
@ -179,4 +198,4 @@ int Menu_Main(void) {
} }
return EXIT_RELAUNCH_ON_LOAD; return EXIT_RELAUNCH_ON_LOAD;
} }