Merge pull request #8 from HackingNewbie/master

SD Code Support
This commit is contained in:
BullyWiiPlaza 2017-08-26 23:09:29 +02:00 committed by GitHub
commit 611b7011bc
2 changed files with 20 additions and 1 deletions

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;
} }

Binary file not shown.