Skip to content

Commit

Permalink
initial padcon release
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Aug 16, 2016
1 parent 025751b commit 7c705d4
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 218 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export OBJCOPY := $(PREFIX)objcopy
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := functionpatcherexample
TARGET := padcon
BUILD := build
BUILD_DBG := $(TARGET)_dbg
SOURCES := src \
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#function patcher example#
This repo contains a example for patching/hooking functions on the WiiU.
#Padcon#
Press the right Stick down to disable the Gamepad screen, press it again to enable it again.

- It requires kernel access.
- Static and dynamic functions are supported. It will try to guess the type, keep an eye on the [udp log](https://github.com/dimok789/loadiine_gx2/tree/master/udp_debug_reader)!
- Aquire the rpl before patching a function.

This version has splitted the actual patcher and the functions that will be patched in different files.
The actual function patcher can be splitted into mutiple files. Check out the "patcher" folder for an example.

If you have any question, feel free to open an issue.
If you have any questions, feel free to open an issue.

#Building#
In order to build this application, you need the custom liboGC and portlibs modified/created by dimok. You can find them on the loadiine_gx2 repo (https://github.com/dimok789/loadiine_gx2/releases/tag/v0.2). Simply put the files in your devkit folder and run the Makefile.

#Credits#
padcon: initial version in loadiine by dibas
functionpatcher:
Chadderz - made the first tools including the first version of the "function patcher". Still using his "magic" defines ;)
A big thanks goes out to <b>dimok</b> for creating the HBL, the dynamic libs, kernel stuff and every other stuff he made. He helped me a lot when I tried to patch dynamic functions. Many parts of the code are based on his code.

38 changes: 0 additions & 38 deletions function-patcher-example.cbp

This file was deleted.

127 changes: 127 additions & 0 deletions padcon.cbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="padcon" />
<Option makefile_is_custom="1" />
<Option pch_mode="2" />
<Option compiler="ppc-gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/padcon" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="ppc-gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="build">
<Option output="bin/Release/padcon" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="ppc-gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="src/common/common.h" />
<Unit filename="src/common/kernel_defs.h" />
<Unit filename="src/common/loader_defs.h" />
<Unit filename="src/common/os_defs.h" />
<Unit filename="src/common/types.h" />
<Unit filename="src/dynamic_libs/acp_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/acp_functions.h" />
<Unit filename="src/dynamic_libs/aoc_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/aoc_functions.h" />
<Unit filename="src/dynamic_libs/ax_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/ax_functions.h" />
<Unit filename="src/dynamic_libs/curl_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/curl_functions.h" />
<Unit filename="src/dynamic_libs/fs_defs.h" />
<Unit filename="src/dynamic_libs/fs_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/fs_functions.h" />
<Unit filename="src/dynamic_libs/gx2_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/gx2_functions.h" />
<Unit filename="src/dynamic_libs/gx2_types.h" />
<Unit filename="src/dynamic_libs/os_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/os_functions.h" />
<Unit filename="src/dynamic_libs/padscore_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/padscore_functions.h" />
<Unit filename="src/dynamic_libs/socket_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/socket_functions.h" />
<Unit filename="src/dynamic_libs/sys_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/sys_functions.h" />
<Unit filename="src/dynamic_libs/syshid_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/syshid_functions.h" />
<Unit filename="src/dynamic_libs/vpad_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/vpad_functions.h" />
<Unit filename="src/entry.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/kernel/kernel_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/kernel/kernel_functions.h" />
<Unit filename="src/kernel/kernel_hooks.S" />
<Unit filename="src/kernel/syscalls.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/kernel/syscalls.h" />
<Unit filename="src/kernel/syscalls_asm.S" />
<Unit filename="src/main.cpp" />
<Unit filename="src/main.h" />
<Unit filename="src/patcher/coreinit_function_patcher.h" />
<Unit filename="src/patcher/fs_function_patcher.h" />
<Unit filename="src/patcher/pad_function_patcher.cpp" />
<Unit filename="src/patcher/pad_function_patcher.h" />
<Unit filename="src/system/exception_handler.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/system/exception_handler.h" />
<Unit filename="src/system/memory.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/system/memory.h" />
<Unit filename="src/utils/function_patcher.cpp" />
<Unit filename="src/utils/function_patcher.h" />
<Unit filename="src/utils/logger.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/utils/logger.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>
5 changes: 5 additions & 0 deletions padcon.layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="build" />
</CodeBlocks_layout_file>
2 changes: 1 addition & 1 deletion src/link.ld
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OUTPUT(functionpatcherexample.elf);
OUTPUT(padcon.elf);

/* Tell linker where our application entry is so the garbage collect can work correct */
ENTRY(__entry_menu);
Expand Down
7 changes: 0 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "dynamic_libs/vpad_functions.h"
#include "dynamic_libs/socket_functions.h"
#include "dynamic_libs/sys_functions.h"
#include "patcher/coreinit_function_patcher.h"
#include "patcher/fs_function_patcher.h"
#include "patcher/pad_function_patcher.h"
#include "utils/function_patcher.h"
#include "kernel/kernel_functions.h"
Expand All @@ -33,7 +31,6 @@ extern "C" int Menu_Main(void)

//For patching
InitVPadFunctionPointers();
InitPadScoreFunctionPointers();

SetupKernelCallback();

Expand Down Expand Up @@ -72,17 +69,13 @@ extern "C" int Menu_Main(void)
Patching all the functions!!!
*/
void ApplyPatches(){
PatchInvidualMethodHooks(method_hooks_coreinit, method_hooks_size_coreinit, method_calls_coreinit);
PatchInvidualMethodHooks(method_hooks_fs, method_hooks_size_fs, method_calls_fs);
PatchInvidualMethodHooks(method_hooks_pad, method_hooks_size_pad, method_calls_pad);
}

/*
Restoring everything!!
*/
void deInit(){
RestoreInvidualInstructions(method_hooks_coreinit, method_hooks_size_coreinit);
RestoreInvidualInstructions(method_hooks_fs, method_hooks_size_fs);
RestoreInvidualInstructions(method_hooks_pad, method_hooks_size_pad);
log_deinit();
}
35 changes: 0 additions & 35 deletions src/patcher/coreinit_function_patcher.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions src/patcher/coreinit_function_patcher.h

This file was deleted.

42 changes: 0 additions & 42 deletions src/patcher/fs_function_patcher.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions src/patcher/fs_function_patcher.h

This file was deleted.

Loading

0 comments on commit 7c705d4

Please sign in to comment.