mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-25 06:06:53 +01:00
Use definitions from WUMS if possible
This commit is contained in:
parent
42866ffbac
commit
506b8eaf9a
@ -1,61 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2018 Maschell
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DYN_LINK_FUNCTION_NAME_LENGTH 351
|
||||
#define DYN_LINK_IMPORT_NAME_LENGTH 50
|
||||
|
||||
#define DYN_LINK_FUNCTION_LIST_LENGTH 500
|
||||
#define DYN_LINK_IMPORT_LIST_LENGTH 50
|
||||
|
||||
#define DYN_LINK_TRAMPOLIN_LIST_LENGTH DYN_LINK_FUNCTION_LIST_LENGTH
|
||||
|
||||
typedef struct _dyn_linking_function_t {
|
||||
char functionName[DYN_LINK_FUNCTION_NAME_LENGTH + 1];
|
||||
void *address;
|
||||
} dyn_linking_function_t;
|
||||
|
||||
typedef struct _dyn_linking_import_t {
|
||||
char importName[DYN_LINK_IMPORT_NAME_LENGTH + 1];
|
||||
bool isData = false;
|
||||
} dyn_linking_import_t;
|
||||
|
||||
typedef struct _dyn_linking_relocation_entry_t {
|
||||
dyn_linking_function_t *functionEntry = NULL;
|
||||
dyn_linking_import_t *importEntry = NULL;
|
||||
void *destination = NULL;
|
||||
char type;
|
||||
size_t offset;
|
||||
int32_t addend;
|
||||
} dyn_linking_relocation_entry_t;
|
||||
|
||||
typedef struct _dyn_linking_relocation_data_t {
|
||||
dyn_linking_function_t functions[DYN_LINK_FUNCTION_LIST_LENGTH];
|
||||
dyn_linking_import_t imports[DYN_LINK_IMPORT_LIST_LENGTH];
|
||||
} dyn_linking_relocation_data_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#define EXPORT_MAXIMUM_NAME_LENGTH 50
|
||||
typedef struct export_data_t {
|
||||
uint32_t type;
|
||||
char name[EXPORT_MAXIMUM_NAME_LENGTH];
|
||||
uint32_t address = 0;
|
||||
} export_data_t;
|
@ -1,69 +0,0 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2018-2019 Maschell
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "dynamic_linking_defines.h"
|
||||
#include "relocation_defines.h"
|
||||
#include "export_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAXIMUM_MODULE_PATH_NAME_LENGTH 256
|
||||
#define MAXIMUM_EXPORT_MODULE_NAME_LENGTH 51
|
||||
|
||||
#define DYN_LINK_RELOCATION_LIST_LENGTH 500
|
||||
#define EXPORT_ENTRY_LIST_LENGTH 100
|
||||
#define HOOK_ENTRY_LIST_LENGTH 10
|
||||
|
||||
typedef struct hook_data_t {
|
||||
uint32_t type;
|
||||
uint32_t target = 0;
|
||||
} hook_data_t;
|
||||
|
||||
struct module_information_single_t {
|
||||
char path[MAXIMUM_MODULE_PATH_NAME_LENGTH] = ""; // Path where the module is stored
|
||||
dyn_linking_relocation_entry_t linking_entries[DYN_LINK_RELOCATION_LIST_LENGTH];
|
||||
char module_export_name[MAXIMUM_EXPORT_MODULE_NAME_LENGTH];
|
||||
export_data_t export_entries[EXPORT_ENTRY_LIST_LENGTH];
|
||||
hook_data_t hook_entries[HOOK_ENTRY_LIST_LENGTH];
|
||||
int32_t priority; // Priority of this module
|
||||
uint32_t bssAddr;
|
||||
uint32_t bssSize;
|
||||
uint32_t sbssAddr;
|
||||
uint32_t sbssSize;
|
||||
uint32_t entrypoint;
|
||||
uint32_t startAddress;
|
||||
uint32_t endAddress;
|
||||
};
|
||||
|
||||
#define MAXIMUM_MODULES 8
|
||||
|
||||
struct module_information_t {
|
||||
int32_t number_used_modules = 0; // Number of used function. Maximum is MAXIMUM_MODULES
|
||||
dyn_linking_relocation_data_t linking_data;
|
||||
relocation_trampolin_entry_t trampolines[DYN_LINK_TRAMPOLIN_LIST_LENGTH];
|
||||
module_information_single_t module_data[MAXIMUM_MODULES];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -19,9 +19,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "dynamic_linking_defines.h"
|
||||
#include "relocation_defines.h"
|
||||
#include <wums/defines/dynamic_linking_defines.h>
|
||||
#include "replacement_defines.h"
|
||||
#include <wums/defines/export_defines.h>
|
||||
#include <wums/defines/relocation_defines.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum RelocationTrampolinStatus{
|
||||
RELOC_TRAMP_FREE = 0,
|
||||
RELOC_TRAMP_FIXED = 1,
|
||||
RELOC_TRAMP_IMPORT_IN_PROGRESS = 2,
|
||||
RELOC_TRAMP_IMPORT_DONE = 3,
|
||||
} RelocationTrampolinStatus;
|
||||
|
||||
typedef enum RelocationType{
|
||||
RELOC_TYPE_FIXED = 0,
|
||||
RELOC_TYPE_IMPORT = 1
|
||||
} RelocationType;
|
||||
|
||||
typedef struct relocation_trampolin_entry_t {
|
||||
uint32_t id;
|
||||
uint32_t trampolin[4];
|
||||
RelocationTrampolinStatus status = RELOC_TRAMP_FREE;
|
||||
} relocation_trampolin_entry_t;
|
@ -9,12 +9,11 @@
|
||||
#include "plugin/PluginMetaInformationFactory.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
#include "common/module_defines.h"
|
||||
#include "PluginManagement.h"
|
||||
#include "globals.h"
|
||||
#include <whb/sdcard.h>
|
||||
#include <utils/exports.h>
|
||||
#include <wums.h>
|
||||
#include <wums/defines/module_defines.h>
|
||||
#include <plugin/PluginDataPersistence.h>
|
||||
|
||||
WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend");
|
||||
@ -46,7 +45,6 @@ WUMS_APPLICATION_STARTS() {
|
||||
}
|
||||
|
||||
memset((void *) &gLinkOnReload, 0, sizeof(gLinkOnReload));
|
||||
|
||||
// If this address is 0, make sure the header common match the one
|
||||
// in the SetupPayload repo. (I know that's a bad idea)
|
||||
endAddress = (endAddress + 0x100) & 0xFFFFFF00;
|
||||
|
@ -20,8 +20,8 @@
|
||||
#define _FUNCTION_PATCHER_HOOKS_H_
|
||||
|
||||
#include <coreinit/dynload.h>
|
||||
#include <common/replacement_defines.h>
|
||||
#include <common/plugin_defines.h>
|
||||
#include <common/replacement_defines.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/dynamic_linking_defines.h"
|
||||
#include <wums/defines/dynamic_linking_defines.h>
|
||||
#include "utils/logger.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <coreinit/memheap.h>
|
||||
#include "common/relocation_defines.h"
|
||||
#include <wums/defines/relocation_defines.h>
|
||||
#include "PluginInformation.h"
|
||||
#include "PluginContainer.h"
|
||||
#include "elfio/elfio.hpp"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common/relocation_defines.h"
|
||||
#include <wums/defines/relocation_defines.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
Loading…
Reference in New Issue
Block a user