Update to newest devkitPro and add hint about SD cheats
This commit is contained in:
parent
34bca4fefe
commit
cc39dec0df
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
typedef unsigned char u8;
|
// typedef unsigned char u8;
|
||||||
// typedef unsigned int uint8_t;
|
// typedef unsigned int uint8_t;
|
||||||
typedef unsigned short u16;
|
// typedef unsigned short u16;
|
||||||
// typedef unsigned int uint16_t;
|
// typedef unsigned int uint16_t;
|
||||||
typedef unsigned int u32;
|
// typedef unsigned int u32;
|
||||||
typedef unsigned int uint32_t;
|
// typedef unsigned int uint32_t;
|
||||||
// typedef unsigned long uint64_t;
|
// typedef unsigned long uint64_t;
|
||||||
typedef unsigned long long u64;
|
// typedef unsigned long long u64;
|
@ -151,7 +151,7 @@ int CFile::seek(long int offset, int origin) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CFile::fwrite(const char *format, ...) {
|
/*int CFile::fwrite(const char *format, ...) {
|
||||||
int result = -1;
|
int result = -1;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
|
|
||||||
@ -166,6 +166,5 @@ int CFile::fwrite(const char *format, ...) {
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "common/fs_defs.h"
|
#include "common/fs_defs.h"
|
||||||
|
#include "../common/fs_defs.h"
|
||||||
#include "../dynamic_libs/fs_functions.h"
|
#include "../dynamic_libs/fs_functions.h"
|
||||||
#include "../utils/logger.h"
|
|
||||||
|
|
||||||
|
|
||||||
int MountFS(void *pClient, void *pCmd, char **mount_path) {
|
int MountFS(void *pClient, void *pCmd, char **mount_path) {
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
27
src/main.cpp
27
src/main.cpp
@ -20,6 +20,7 @@
|
|||||||
#include "patcher/function_patcher_gx2.h"
|
#include "patcher/function_patcher_gx2.h"
|
||||||
#include "patcher/function_patcher_coreinit.h"
|
#include "patcher/function_patcher_coreinit.h"
|
||||||
#include "utils/sd_ip_reader.hpp"
|
#include "utils/sd_ip_reader.hpp"
|
||||||
|
#include "fs/sd_fat_devoptab.h"
|
||||||
|
|
||||||
bool isCodeHandlerInstalled;
|
bool isCodeHandlerInstalled;
|
||||||
|
|
||||||
@ -35,6 +36,18 @@ void applyFunctionPatches() {
|
|||||||
patchIndividualMethodHooks(method_hooks_coreinit, method_hooks_size_coreinit, method_calls_coreinit);
|
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 */
|
/* Entry point */
|
||||||
int Menu_Main(void) {
|
int Menu_Main(void) {
|
||||||
//!*******************************************************************
|
//!*******************************************************************
|
||||||
@ -105,7 +118,7 @@ int Menu_Main(void) {
|
|||||||
char messageBuffer[80];
|
char messageBuffer[80];
|
||||||
int launchMethod;
|
int launchMethod;
|
||||||
int update_screen = 1;
|
int update_screen = 1;
|
||||||
int vpadError = -1;
|
s32 vpadError = -1;
|
||||||
VPADData vpad_data;
|
VPADData vpad_data;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -125,6 +138,18 @@ int Menu_Main(void) {
|
|||||||
PRINT_TEXT2(14, 1, "-- TCP Gecko Installer --")
|
PRINT_TEXT2(14, 1, "-- TCP Gecko Installer --")
|
||||||
PRINT_TEXT2(7, 2, ipAddressMessageBuffer)
|
PRINT_TEXT2(7, 2, ipAddressMessageBuffer)
|
||||||
PRINT_TEXT2(0, 5, "Press A to install TCP Gecko (with built-in code handler)...")
|
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...")
|
PRINT_TEXT2(0, 17, "Press Home to exit...")
|
||||||
|
|
||||||
OSScreenFlipBuffersEx(0);
|
OSScreenFlipBuffersEx(0);
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "dynamic_libs/os_functions.h"
|
#include "dynamic_libs/os_functions.h"
|
||||||
#include "tcp_gecko.h"
|
#include "tcp_gecko.h"
|
||||||
#include "kernel/syscalls.h"
|
#include "kernel/syscalls.h"
|
||||||
|
#include <fat.h>
|
||||||
|
#include <iosuhax.h>
|
||||||
|
|
||||||
#define CODE_HANDLER_ENABLED_ADDRESS 0x10014CFC
|
#define CODE_HANDLER_ENABLED_ADDRESS 0x10014CFC
|
||||||
#define CODE_LIST_START_ADDRESS 0x01133000
|
#define CODE_LIST_START_ADDRESS 0x01133000
|
||||||
@ -38,9 +40,29 @@ void setCodeHandlerEnabled(bool enabled) {
|
|||||||
log_printf("Code handler status: %i\n", 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() {
|
void considerApplyingSDCheats() {
|
||||||
u64 currentTitleID = OSGetTitleID();
|
u64 currentTitleID = OSGetTitleID();
|
||||||
|
|
||||||
|
// testMount();
|
||||||
|
|
||||||
if (cachedTitleID == currentTitleID) {
|
if (cachedTitleID == currentTitleID) {
|
||||||
// log_print("Title ID NOT changed\n");
|
// log_print("Title ID NOT changed\n");
|
||||||
} else {
|
} else {
|
||||||
@ -70,7 +92,7 @@ void considerApplyingSDCheats() {
|
|||||||
log_printf("File Path: %s\n", filePath);
|
log_printf("File Path: %s\n", filePath);
|
||||||
|
|
||||||
unsigned char *codes = NULL;
|
unsigned char *codes = NULL;
|
||||||
unsigned int codesSize = 0;
|
u32 codesSize = 0;
|
||||||
result = LoadFileToMem((const char *) filePath, &codes, &codesSize);
|
result = LoadFileToMem((const char *) filePath, &codes, &codesSize);
|
||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
@ -50,7 +50,7 @@ int readKernelMemory(const void *address) {
|
|||||||
|
|
||||||
#define KERNEL_COPY_SOURCE_ADDRESS 0x10100000
|
#define KERNEL_COPY_SOURCE_ADDRESS 0x10100000
|
||||||
|
|
||||||
int kernelCopyService(int argc, void *argv) {
|
s32 kernelCopyService(s32 argc, void *argv) {
|
||||||
while (true) {
|
while (true) {
|
||||||
// Read the destination address from the source address
|
// Read the destination address from the source address
|
||||||
int destinationAddress = *(int *) KERNEL_COPY_SOURCE_ADDRESS;
|
int destinationAddress = *(int *) KERNEL_COPY_SOURCE_ADDRESS;
|
||||||
|
@ -14,7 +14,7 @@ unsigned long getConsoleStatePatchAddress() {
|
|||||||
} else {
|
} else {
|
||||||
// Acquire the RPL and function
|
// Acquire the RPL and function
|
||||||
log_print("Acquiring...\n");
|
log_print("Acquiring...\n");
|
||||||
unsigned int avm_handle;
|
u32 avm_handle;
|
||||||
OSDynLoad_Acquire("avm.rpl", &avm_handle);
|
OSDynLoad_Acquire("avm.rpl", &avm_handle);
|
||||||
ASSERT_ALLOCATED(avm_handle, "avm.rpl")
|
ASSERT_ALLOCATED(avm_handle, "avm.rpl")
|
||||||
OSDynLoad_FindExport((u32) avm_handle, 0, "AVMGetDRCScanMode", &AVMGetDRCScanMode);
|
OSDynLoad_FindExport((u32) avm_handle, 0, "AVMGetDRCScanMode", &AVMGetDRCScanMode);
|
||||||
|
@ -81,9 +81,9 @@ struct pygecko_bss_t {
|
|||||||
#define COMMAND_CLEAR_ASSEMBLY 0xE2
|
#define COMMAND_CLEAR_ASSEMBLY 0xE2
|
||||||
|
|
||||||
#define CHECK_ERROR(cond) if (cond) { bss->line = __LINE__; goto error; }
|
#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 MSG_DONT_WAIT 32
|
||||||
#define EWOULDBLOCK 6
|
// #define EWOULDBLOCK 6
|
||||||
// #define WRITE_SCREEN_MESSAGE_BUFFER_SIZE 100
|
// #define WRITE_SCREEN_MESSAGE_BUFFER_SIZE 100
|
||||||
#define SERVER_VERSION "06/03/2017"
|
#define SERVER_VERSION "06/03/2017"
|
||||||
#define ONLY_ZEROS_READ 0xB0
|
#define ONLY_ZEROS_READ 0xB0
|
||||||
@ -1039,7 +1039,7 @@ static int processCommands(struct pygecko_bss_t *bss, int clientfd) {
|
|||||||
}
|
}
|
||||||
case COMMAND_ACCOUNT_IDENTIFIER: {
|
case COMMAND_ACCOUNT_IDENTIFIER: {
|
||||||
// Acquire the RPL
|
// Acquire the RPL
|
||||||
unsigned int nn_act_handle;
|
u32 nn_act_handle;
|
||||||
OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle);
|
OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle);
|
||||||
|
|
||||||
// Acquire the functions via their mangled file names
|
// 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]);
|
char *symbolName = (char *) (&buffer[0] + ((int *) buffer)[1]);
|
||||||
|
|
||||||
/* Get the symbol and store it in the buffer */
|
/* 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);
|
OSDynLoad_Acquire(rplName, &module_handle);
|
||||||
|
|
||||||
char data = (char) recvbyte(bss, clientfd);
|
char data = (char) recvbyte(bss, clientfd);
|
||||||
@ -1479,7 +1479,7 @@ static int runTCPGeckoServer(int argc, void *argv) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int startTCPGeckoThread(int argc, void *argv) {
|
static s32 startTCPGeckoThread(s32 argc, void *argv) {
|
||||||
log_print("Starting TCP Gecko thread...\n");
|
log_print("Starting TCP Gecko thread...\n");
|
||||||
|
|
||||||
// Run the TCP Gecko Installer server
|
// Run the TCP Gecko Installer server
|
||||||
@ -1539,10 +1539,10 @@ void startTCPGecko() {
|
|||||||
void *thread = memalign(0x40, 0x1000);
|
void *thread = memalign(0x40, 0x1000);
|
||||||
ASSERT_ALLOCATED(thread, "TCP Gecko thread")
|
ASSERT_ALLOCATED(thread, "TCP Gecko thread")
|
||||||
|
|
||||||
int status = OSCreateThread(thread, startTCPGeckoThread, 1,
|
int status = OSCreateThread(thread, startTCPGeckoThread, (s32) 1,
|
||||||
NULL, (u32) stack + sizeof(stack),
|
NULL, (s32) (stack + sizeof(stack)),
|
||||||
sizeof(stack), 0,
|
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")
|
ASSERT_INTEGER(status, 1, "Creating TCP Gecko thread")
|
||||||
// OSSetThreadName(thread, "TCP Gecko");
|
// OSSetThreadName(thread, "TCP Gecko");
|
||||||
OSResumeThread(thread);
|
OSResumeThread(thread);
|
||||||
|
BIN
tcpgecko.elf
BIN
tcpgecko.elf
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user