Update to newest devkitPro and add hint about SD cheats

This commit is contained in:
BullyWiiPlaza 2017-09-10 21:58:22 +02:00
parent 34bca4fefe
commit cc39dec0df
9 changed files with 67 additions and 22 deletions

View File

@ -1,10 +1,10 @@
#pragma once
typedef unsigned char u8;
// typedef unsigned char u8;
// typedef unsigned int uint8_t;
typedef unsigned short u16;
// typedef unsigned short u16;
// typedef unsigned int uint16_t;
typedef unsigned int u32;
typedef unsigned int uint32_t;
// typedef unsigned int u32;
// typedef unsigned int uint32_t;
// typedef unsigned long uint64_t;
typedef unsigned long long u64;
// typedef unsigned long long u64;

View File

@ -151,7 +151,7 @@ int CFile::seek(long int offset, int origin) {
return ret;
}
int CFile::fwrite(const char *format, ...) {
/*int CFile::fwrite(const char *format, ...) {
int result = -1;
char *tmp = NULL;
@ -166,6 +166,5 @@ int CFile::fwrite(const char *format, ...) {
free(tmp);
return result;
}
}*/

View File

@ -4,9 +4,8 @@
#include <unistd.h>
#include <fcntl.h>
#include "common/fs_defs.h"
#include "../common/fs_defs.h"
#include "../dynamic_libs/fs_functions.h"
#include "../utils/logger.h"
int MountFS(void *pClient, void *pCmd, char **mount_path) {
int result = -1;

View File

@ -20,6 +20,7 @@
#include "patcher/function_patcher_gx2.h"
#include "patcher/function_patcher_coreinit.h"
#include "utils/sd_ip_reader.hpp"
#include "fs/sd_fat_devoptab.h"
bool isCodeHandlerInstalled;
@ -35,6 +36,18 @@ void applyFunctionPatches() {
patchIndividualMethodHooks(method_hooks_coreinit, method_hooks_size_coreinit, method_calls_coreinit);
}
bool isSDAccessEnabled() {
int result = mount_sd_fat("sd");
if (result < 0) {
return false;
}
unmount_sd_fat("sd");
return true;
}
/* Entry point */
int Menu_Main(void) {
//!*******************************************************************
@ -105,7 +118,7 @@ int Menu_Main(void) {
char messageBuffer[80];
int launchMethod;
int update_screen = 1;
int vpadError = -1;
s32 vpadError = -1;
VPADData vpad_data;
while (true) {
@ -125,6 +138,18 @@ int Menu_Main(void) {
PRINT_TEXT2(14, 1, "-- TCP Gecko Installer --")
PRINT_TEXT2(7, 2, ipAddressMessageBuffer)
PRINT_TEXT2(0, 5, "Press A to install TCP Gecko (with built-in code handler)...")
PRINT_TEXT2(0, 8, "Note:")
PRINT_TEXT2(0, 9, "* You can enable loading SD cheats with Mocha SD access")
PRINT_TEXT2(0, 10, "* Generate and store GCTUs to your SD card with JGecko U")
// testMount();
/*if (isSDAccessEnabled()) {
PRINT_TEXT2(0, 8, "SD card access: SD cheats will be applied automatically when titles are loaded!")
} else {
PRINT_TEXT2(0, 8, "No SD card access: Please run Mocha SD Access by maschell for SD cheat support...")
}*/
PRINT_TEXT2(0, 17, "Press Home to exit...")
OSScreenFlipBuffersEx(0);

View File

@ -6,6 +6,8 @@
#include "dynamic_libs/os_functions.h"
#include "tcp_gecko.h"
#include "kernel/syscalls.h"
#include <fat.h>
#include <iosuhax.h>
#define CODE_HANDLER_ENABLED_ADDRESS 0x10014CFC
#define CODE_LIST_START_ADDRESS 0x01133000
@ -38,9 +40,29 @@ void setCodeHandlerEnabled(bool enabled) {
log_printf("Code handler status: %i\n", enabled);
}
/*void testMount() {
int res = IOSUHAX_Open(NULL);
log_printf("Result: %i", res);
if (res < 0) {//
mount_sd_fat("sd"); // Fallback to normal OS implementation
} else {
fatInitDefault(); // using libfat
}
log_print("Unmounting...");
fatUnmount("sd");
fatUnmount("usb");
log_print("Closing...");
IOSUHAX_Close();
log_print("DONE");
}*/
void considerApplyingSDCheats() {
u64 currentTitleID = OSGetTitleID();
// testMount();
if (cachedTitleID == currentTitleID) {
// log_print("Title ID NOT changed\n");
} else {
@ -70,7 +92,7 @@ void considerApplyingSDCheats() {
log_printf("File Path: %s\n", filePath);
unsigned char *codes = NULL;
unsigned int codesSize = 0;
u32 codesSize = 0;
result = LoadFileToMem((const char *) filePath, &codes, &codesSize);
if (result < 0) {

View File

@ -50,7 +50,7 @@ int readKernelMemory(const void *address) {
#define KERNEL_COPY_SOURCE_ADDRESS 0x10100000
int kernelCopyService(int argc, void *argv) {
s32 kernelCopyService(s32 argc, void *argv) {
while (true) {
// Read the destination address from the source address
int destinationAddress = *(int *) KERNEL_COPY_SOURCE_ADDRESS;

View File

@ -14,7 +14,7 @@ unsigned long getConsoleStatePatchAddress() {
} else {
// Acquire the RPL and function
log_print("Acquiring...\n");
unsigned int avm_handle;
u32 avm_handle;
OSDynLoad_Acquire("avm.rpl", &avm_handle);
ASSERT_ALLOCATED(avm_handle, "avm.rpl")
OSDynLoad_FindExport((u32) avm_handle, 0, "AVMGetDRCScanMode", &AVMGetDRCScanMode);

View File

@ -81,9 +81,9 @@ struct pygecko_bss_t {
#define COMMAND_CLEAR_ASSEMBLY 0xE2
#define CHECK_ERROR(cond) if (cond) { bss->line = __LINE__; goto error; }
#define errno (*__gh_errno_ptr())
// #define errno (*__gh_errno_ptr())
#define MSG_DONT_WAIT 32
#define EWOULDBLOCK 6
// #define EWOULDBLOCK 6
// #define WRITE_SCREEN_MESSAGE_BUFFER_SIZE 100
#define SERVER_VERSION "06/03/2017"
#define ONLY_ZEROS_READ 0xB0
@ -1039,7 +1039,7 @@ static int processCommands(struct pygecko_bss_t *bss, int clientfd) {
}
case COMMAND_ACCOUNT_IDENTIFIER: {
// Acquire the RPL
unsigned int nn_act_handle;
u32 nn_act_handle;
OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle);
// Acquire the functions via their mangled file names
@ -1165,7 +1165,7 @@ static int processCommands(struct pygecko_bss_t *bss, int clientfd) {
char *symbolName = (char *) (&buffer[0] + ((int *) buffer)[1]);
/* Get the symbol and store it in the buffer */
unsigned int module_handle, function_address;
u32 module_handle, function_address;
OSDynLoad_Acquire(rplName, &module_handle);
char data = (char) recvbyte(bss, clientfd);
@ -1479,7 +1479,7 @@ static int runTCPGeckoServer(int argc, void *argv) {
return 0;
}
static int startTCPGeckoThread(int argc, void *argv) {
static s32 startTCPGeckoThread(s32 argc, void *argv) {
log_print("Starting TCP Gecko thread...\n");
// Run the TCP Gecko Installer server
@ -1539,10 +1539,10 @@ void startTCPGecko() {
void *thread = memalign(0x40, 0x1000);
ASSERT_ALLOCATED(thread, "TCP Gecko thread")
int status = OSCreateThread(thread, startTCPGeckoThread, 1,
NULL, (u32) stack + sizeof(stack),
int status = OSCreateThread(thread, startTCPGeckoThread, (s32) 1,
NULL, (s32) (stack + sizeof(stack)),
sizeof(stack), 0,
OS_THREAD_ATTR_AFFINITY_CORE1 | OS_THREAD_ATTR_PINNED_AFFINITY | OS_THREAD_ATTR_DETACH);
(OS_THREAD_ATTR_AFFINITY_CORE1 | OS_THREAD_ATTR_PINNED_AFFINITY | OS_THREAD_ATTR_DETACH));
ASSERT_INTEGER(status, 1, "Creating TCP Gecko thread")
// OSSetThreadName(thread, "TCP Gecko");
OSResumeThread(thread);

Binary file not shown.