Formatting, added bash script for installing/updating the dependencies (based on the travis script)

This commit is contained in:
Maschell 2018-03-11 17:12:46 +01:00
parent 0e60a9bb48
commit 6ca382bf6e
14 changed files with 483 additions and 465 deletions

2
.gitignore vendored
View File

@ -4,6 +4,7 @@ loader/*.elf
example_plugin/bin/*
example_plugin/build/*
example_plugin_pic/*
portlib_repos/*
plugins/*/bin/*
plugins/*/build/*
plugins/*/*.cbp
@ -17,3 +18,4 @@ release/*
*.nam
*.til
*.layout
wups.cbp

21
installupdateportlibs.sh Normal file
View File

@ -0,0 +1,21 @@
#! /bin/bash
#
7z x -y ./loader/libs/portlibs.zip -o${DEVKITPRO}
mkdir portlib_repos
cd portlib_repos
((git clone https://github.com/Maschell/dynamic_libs.git -b lib && (7z x -y ./dynamic_libs/libs/portlibs.zip -o${DEVKITPRO})) || (cd dynamic_libs && git pull))
(git clone https://github.com/dimok789/libiosuhax.git || (cd libiosuhax && git pull))
(git clone https://github.com/aliaspider/libfat.git || (cd libfat && git pull))
(git clone https://github.com/Maschell/libntfs-wiiu.git || (cd libntfs-wiiu && git pull))
(git clone https://github.com/Maschell/libutils.git || (cd libutils && git pull))
((git clone https://github.com/Maschell/libgui.git && (7z x -y ./libgui/libs/portlibs.zip -o${DEVKITPRO})) || (cd libgui && git pull))
(git clone https://github.com/Maschell/fs_wrapper.git || (cd fs_wrapper && git pull))
(git clone https://github.com/Maschell/controller_patcher.git || (cd controller_patcher && git pull))
(cd dynamic_libs && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make))
(cd libiosuhax && make -j8 && make install)
(cd libfat && make wiiu-release && make wiiu-install)
(cd libntfs-wiiu && make wiiu-install)
(cd libutils && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make))
(cd libgui && ((make -j8 | grep -c "built ... ") && make install) || echo "no need for make install")
(cd fs_wrapper && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make))
(cd controller_patcher && ((make -j8 | grep -c "built ... ") && make install && echo "installed" ) || (echo "no need for make install" && make))

View File

@ -22,21 +22,21 @@
#include <dynamic_libs/vpad_functions.h>
#include <dynamic_libs/padscore_functions.h>
#include <dynamic_libs/proc_ui_functions.h>
#include <utils/logger.h>
#include <fs/FSUtils.h>
#include <fs/sd_fat_devoptab.h>
#include <utils/logger.h>
#include <utils/utils.h>
#include <utils/function_patcher.h>
#include <system/exception_handler.h>
#include <system/memory.h>
#include <kernel/kernel_utils.h>
#include "common/retain_vars.h"
#include "common/common.h"
#include "plugin/PluginLoader.h"
#include "plugin/PluginInformation.h"
#include <utils/function_patcher.h>
#include <wups.h>
#include <iosuhax.h>

View File

@ -20,12 +20,4 @@
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
#define CONTENT_WIDTH (1280 - 260)
#define CONTENT_EXPANDABLE_FRAME_HEADER_HEIGHT 60
#define MENU_LIST_WIDTH 260
#define MENU_LIST_ELEMENT_HEIGHT 70
#endif

View File

@ -9,11 +9,9 @@
#include <gui/sigslot.h>
#include <gui/Gui.h>
class TcpReceiver : public CThread
{
class TcpReceiver : public CThread {
public:
enum eLoadResults
{
enum eLoadResults {
SUCCESS = 0,
INVALID_INPUT = -1,
FILE_OPEN_FAILURE = -2,

View File

@ -30,8 +30,7 @@ static int *pretend_root_hub = (int*)0xF5003ABC;
static int *ayylmao = (int*)0xF4500000;
//!-------------------------------------
typedef struct
{
typedef struct {
u32 size;
u8 data[0];
} payload_info_t;
@ -312,8 +311,7 @@ static const int second_chain[] = {
0x1012EA68, // 0xAC stack pivot
};
static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config)
{
static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config) {
ayylmao[5] = 1;
ayylmao[8] = 0x500000;
@ -375,8 +373,7 @@ static void uhs_exploit_init(int dev_uhs_0_handle, cfw_config_t * config)
DCStoreRange((void*)0xF4148000, ((u32)payloads) - 0xF4148000);
}
static int uhs_write32(int dev_uhs_0_handle, int arm_addr, int val)
{
static int uhs_write32(int dev_uhs_0_handle, int arm_addr, int val) {
ayylmao[520] = arm_addr - 24; //! The address to be overwritten, minus 24 bytes
DCStoreRange(ayylmao, 521 * 4); //! Make CPU fetch new data (with updated adress)
OSSleepTicks(0x200000); //! Improves stability
@ -385,10 +382,10 @@ static int uhs_write32(int dev_uhs_0_handle, int arm_addr, int val)
return IOS_Ioctl(dev_uhs_0_handle, 0x15, request_buffer, sizeof(request_buffer), output_buffer, sizeof(output_buffer));
}
int ExecuteIOSExploit(cfw_config_t * config){
int ExecuteIOSExploit(cfw_config_t * config) {
DEBUG_FUNCTION_LINE("Running ExecuteIOSExploit\n");
int iosuhaxFd = IOS_Open("/dev/iosuhax", 0);
if(iosuhaxFd >= 0){
if(iosuhaxFd >= 0) {
int dummy = 0;
IOS_Ioctl(iosuhaxFd, 0x03, &dummy, sizeof(dummy), &dummy, sizeof(dummy));
@ -401,7 +398,7 @@ int ExecuteIOSExploit(cfw_config_t * config){
//! execute exploit
int dev_uhs_0_handle = IOS_Open("/dev/uhs/0", 0);
if(dev_uhs_0_handle < 0){
if(dev_uhs_0_handle < 0) {
DEBUG_FUNCTION_LINE("Failed to open \"/dev/uhs/0\"\n");
return dev_uhs_0_handle;
}
@ -418,7 +415,7 @@ int ExecuteIOSExploit(cfw_config_t * config){
return 0;
}
void ExecuteIOSExploitWithDefaultConfig(){
void ExecuteIOSExploitWithDefaultConfig() {
cfw_config_t config;
config.viewMode = 0;
config.directLaunch = 0;

View File

@ -7,7 +7,7 @@ extern "C" {
#include <wups.h>
struct buffer_store{
struct buffer_store {
void * buffer;
s32 buffer_size;
s32 mode;

View File

@ -21,33 +21,33 @@
#include <wups.h>
#include <string>
class FunctionData{
class FunctionData {
public:
FunctionData(const char * name, wups_loader_library_type_t library, void * target, void * call_addr){
FunctionData(const char * name, wups_loader_library_type_t library, void * target, void * call_addr) {
this->name = name;
this->library = library;
this->replaceAddr = target;
this->replaceCall = call_addr;
}
~FunctionData(){
~FunctionData() {
}
std::string getName(){
std::string getName() {
return this->name;
}
wups_loader_library_type_t getLibrary(){
wups_loader_library_type_t getLibrary() {
return this->library;
}
void * getReplaceAddress(){
void * getReplaceAddress() {
return replaceAddr;
}
void * getReplaceCall(){
void * getReplaceCall() {
return replaceCall;
}

View File

@ -397,7 +397,7 @@ void PluginLoader::copyPluginDataIntoGlobalStruct(std::vector<PluginData *> plug
replacement_data_function_t * function_data = &plugin_data->functions[j];
FunctionData * cur_function = function_data_list[j];
if(strlen(cur_function->getName().c_str()) > MAXIMUM_FUNCTION_NAME_LENGTH-1){
if(strlen(cur_function->getName().c_str()) > MAXIMUM_FUNCTION_NAME_LENGTH-1) {
DEBUG_FUNCTION_LINE("Couldn not add function \"%s\" for plugin \"%s\" function name is too long.\n",cur_function->getName().c_str(),plugin_data->plugin_name);
continue;
}

View File

@ -20,9 +20,9 @@ static void * new_readdir_ptr __attribute__((section(".data"))) = NULL;
static void * new_mkdir_ptr __attribute__((section(".data"))) = NULL;
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
void WUPS_InitFS(wups_loader_init_fs_args_t args){
void WUPS_InitFS(wups_loader_init_fs_args_t args) {
new_open_ptr = (void*) args.open_repl;
new_close_ptr = (void*) args.close_repl;
new_write_ptr = (void*) args.write_repl;
@ -34,64 +34,64 @@ static void * new_mkdir_ptr __attribute__((section(".data"))) = NULL;
new_closedir_ptr = (void*) args.closedir_repl;
new_readdir_ptr = (void*) args.readdir_repl;
new_mkdir_ptr = (void*) args.mkdir_repl;
}
}
int __real_open(const char *pathname, int flags);
int __wrap_open(const char *pathname, int flags){
int __real_open(const char *pathname, int flags);
int __wrap_open(const char *pathname, int flags) {
if(new_open_ptr == NULL) return __real_open(pathname,flags);
return ( (int (*)(const char *,int))((unsigned int*)new_open_ptr) )(pathname,flags);
}
int __real_close(int fd);
int __wrap_close(int fd){
}
int __real_close(int fd);
int __wrap_close(int fd) {
if(new_close_ptr == NULL) return __real_close(fd);
return ( (int (*)(int))((unsigned int*)new_close_ptr) )(fd);
}
ssize_t __real_write(int fd, const void *buf, size_t count);
ssize_t __wrap_write(int fd, const void *buf, size_t count){
}
ssize_t __real_write(int fd, const void *buf, size_t count);
ssize_t __wrap_write(int fd, const void *buf, size_t count) {
if(new_write_ptr == NULL) return __real_write(fd,buf,count);
return ( (ssize_t (*)(int, const void *, size_t))((unsigned int*)new_write_ptr) )(fd,buf,count);
}
ssize_t __real_read(int fd, const void *buf, size_t count);
ssize_t __wrap_read(int fd, const void *buf, size_t count){
}
ssize_t __real_read(int fd, const void *buf, size_t count);
ssize_t __wrap_read(int fd, const void *buf, size_t count) {
if(new_read_ptr == NULL) return __real_read(fd,buf,count);
return ( (ssize_t (*)(int, const void *, size_t))((unsigned int*)new_read_ptr) )(fd,buf,count);
}
off_t __real_lseek(int fd, off_t offset, int whence);
off_t __wrap_lseek(int fd, off_t offset, int whence){
}
off_t __real_lseek(int fd, off_t offset, int whence);
off_t __wrap_lseek(int fd, off_t offset, int whence) {
if(new_lseek_ptr == NULL) return __real_lseek(fd, offset, whence);
return ( (off_t (*)(int, off_t, int))((unsigned int*)new_lseek_ptr) )(fd, offset, whence);
}
int __real_stat(const char *pathname, struct stat *statbuf);
int __wrap_stat(const char *pathname, struct stat *statbuf){
}
int __real_stat(const char *pathname, struct stat *statbuf);
int __wrap_stat(const char *pathname, struct stat *statbuf) {
if(new_stat_ptr == NULL) return __real_stat(pathname,statbuf);
return ( (int (*)(const char *, struct stat *))((unsigned int*)new_stat_ptr) )(pathname,statbuf);
}
int __real_fstat(int fd, struct stat *statbuf);
int __wrap_fstat(int fd, struct stat *statbuf){
}
int __real_fstat(int fd, struct stat *statbuf);
int __wrap_fstat(int fd, struct stat *statbuf) {
if(new_fstat_ptr == NULL) return __real_fstat(fd,statbuf);
return ( (int (*)(int, struct stat *))((unsigned int*)new_fstat_ptr) )(fd,statbuf);
}
DIR* __real_opendir(const char * arg);
DIR* __wrap_opendir(const char * arg){
}
DIR* __real_opendir(const char * arg);
DIR* __wrap_opendir(const char * arg) {
if(new_opendir_ptr == NULL) return __real_opendir(arg);
return ( (DIR* (*)(const char *))((unsigned int*)new_opendir_ptr) )(arg);
}
int __real_closedir(DIR *dirp);
int __wrap_closedir(DIR *dirp){
}
int __real_closedir(DIR *dirp);
int __wrap_closedir(DIR *dirp) {
if(new_closedir_ptr == NULL) return __real_closedir(dirp);
return ( (int (*)(DIR *))((unsigned int*)new_closedir_ptr) )(dirp);
}
struct dirent * __real_readdir(DIR *dirp);
struct dirent * __wrap_readdir(DIR *dirp){
}
struct dirent * __real_readdir(DIR *dirp);
struct dirent * __wrap_readdir(DIR *dirp) {
if(new_readdir_ptr == NULL) return __real_readdir(dirp);
return ( (struct dirent * (*)(DIR *))((unsigned int*)new_readdir_ptr) )(dirp);
}
int __real_mkdir(const char *path, mode_t mode);
int __wrap_mkdir(const char *path, mode_t mode){
}
int __real_mkdir(const char *path, mode_t mode);
int __wrap_mkdir(const char *path, mode_t mode) {
if(new_mkdir_ptr == NULL) return __real_mkdir(path, mode);
return ( (int (*)(const char *, mode_t))((unsigned int*) new_mkdir_ptr) )(path, mode);
}
}
#ifdef __cplusplus
}
}
#endif

View File

@ -15,61 +15,67 @@
static void * overlayfunction_ptr __attribute__((section(".data"))) = NULL;
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
void WUPS_InitOverlay(wups_loader_init_overlay_args_t args){
void WUPS_InitOverlay(wups_loader_init_overlay_args_t args) {
InitOSFunctionPointers();
overlayfunction_ptr = (void*) args.overlayfunction_ptr;
}
}
void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...){
if(screen == WUPS_OVERLAY_NONE){ return; }
void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...) {
if(screen == WUPS_OVERLAY_NONE) {
return;
}
char * tmp = NULL;
va_list va;
va_start(va, msg);
if((vasprintf(&tmp, msg, va) >= 0) && tmp){
if(screen != WUPS_OVERLAY_DRC_ONLY){ // Draw TV if it's not DRC exclusive.
if((vasprintf(&tmp, msg, va) >= 0) && tmp) {
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Draw TV if it's not DRC exclusive.
OSScreenPutFontEx(0, x, y, tmp);
}
if(screen != WUPS_OVERLAY_TV_ONLY){ // Draw DRC if it's not TV exclusive.
if(screen != WUPS_OVERLAY_TV_ONLY) { // Draw DRC if it's not TV exclusive.
OSScreenPutFontEx(1, x, y, tmp);
}
}
va_end(va);
if(tmp){
if(tmp) {
free(tmp);
}
}
}
void WUPS_Overlay_OSScreenClear(wups_overlay_options_type_t screen){
if(screen == WUPS_OVERLAY_NONE){ return; }
if(screen != WUPS_OVERLAY_DRC_ONLY){ // Clear TV if it's not DRC exclusive.
void WUPS_Overlay_OSScreenClear(wups_overlay_options_type_t screen) {
if(screen == WUPS_OVERLAY_NONE) {
return;
}
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Clear TV if it's not DRC exclusive.
OSScreenClearBufferEx(0, 0);
}
if(screen != WUPS_OVERLAY_TV_ONLY){ // Clear DRC if it's not TV exclusive.
if(screen != WUPS_OVERLAY_TV_ONLY) { // Clear DRC if it's not TV exclusive.
OSScreenClearBufferEx(1, 0);
}
}
}
void WUPS_Overlay_FlipBuffers(wups_overlay_options_type_t screen){
if(screen == WUPS_OVERLAY_NONE){ return; }
if(screen != WUPS_OVERLAY_DRC_ONLY){ // Flip TV buffer if it's not DRC exclusive.
void WUPS_Overlay_FlipBuffers(wups_overlay_options_type_t screen) {
if(screen == WUPS_OVERLAY_NONE) {
return;
}
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Flip TV buffer if it's not DRC exclusive.
OSScreenFlipBuffersEx(0);
}
if(screen != WUPS_OVERLAY_TV_ONLY){ // Flip DRC buffer if it's not TV exclusive.
if(screen != WUPS_OVERLAY_TV_ONLY) { // Flip DRC buffer if it's not TV exclusive.
OSScreenFlipBuffersEx(1);
}
}
}
void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callback){
if(overlayfunction_ptr != NULL){
void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callback) {
if(overlayfunction_ptr != NULL) {
( (void (*)(wups_overlay_options_type_t, overlay_callback))((unsigned int*)overlayfunction_ptr) )(screen,callback);
}
}
}
#ifdef __cplusplus
}
}
#endif

View File

@ -99,7 +99,8 @@ typedef enum wups_loader_library_type_t {
WUPS_LOADER_LIBRARY_VPAD,
WUPS_LOADER_LIBRARY_VPADBASE,
WUPS_LOADER_LIBRARY_ZLIB125,
} wups_loader_library_type_t;
}
wups_loader_library_type_t;
typedef enum wups_loader_entry_type_t {
WUPS_LOADER_ENTRY_FUNCTION,

View File

@ -30,7 +30,8 @@ typedef enum wups_overlay_options_type_t {
WUPS_OVERLAY_TV_ONLY, /* Tries to display only on tv screen */
WUPS_OVERLAY_DRC_AND_TV, /* Tries to display on both screens. Prioritizes the TV screen if memory is low. */
WUPS_OVERLAY_DRC_AND_TV_WITH_DRC_PRIO /* Tries to display on both screens. But if memory is low, prioritize the DRC screen.*/
} wups_overlay_options_type_t;
}
wups_overlay_options_type_t;
typedef void (*overlay_callback)(wups_overlay_options_type_t);