mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2026-09-30 05:48:24 -05:00
Code cleanup
This commit is contained in:
@@ -64,7 +64,7 @@ dyn_linking_import_t *DynamicLinkingHelper::getOrAddImport(dyn_linking_relocatio
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t *linking_data, dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, const RelocationData &relocationData) {
|
||||
bool DynamicLinkingHelper::addRelocationEntry(dyn_linking_relocation_data_t *linking_data, dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, const RelocationData &relocationData) {
|
||||
return addReloationEntry(linking_data, linking_entries, linking_entry_length, relocationData.getType(), relocationData.getOffset(), relocationData.getAddend(), relocationData.getDestination(), relocationData.getName(),
|
||||
relocationData.getImportRPLInformation());
|
||||
}
|
||||
@@ -83,11 +83,12 @@ bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t *link
|
||||
return false;
|
||||
}
|
||||
|
||||
return addReloationEntry(linking_entries, linking_entry_length, type, offset, addend, destination, functionInfo, importInfoGbl);
|
||||
return addRelocationEntry(linking_entries, linking_entry_length, type, offset, addend, destination, functionInfo,
|
||||
importInfoGbl);
|
||||
}
|
||||
|
||||
bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, dyn_linking_function_t *functionName,
|
||||
dyn_linking_import_t *importInfo) {
|
||||
bool DynamicLinkingHelper::addRelocationEntry(dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, dyn_linking_function_t *functionName,
|
||||
dyn_linking_import_t *importInfo) {
|
||||
for (uint32_t i = 0; i < linking_entry_length; i++) {
|
||||
dyn_linking_relocation_entry_t *curEntry = &(linking_entries[i]);
|
||||
if (curEntry->functionEntry != NULL) {
|
||||
|
||||
@@ -47,18 +47,16 @@ public:
|
||||
**/
|
||||
static dyn_linking_import_t *getOrAddImport(dyn_linking_relocation_data_t *data, const char *importName, bool isData);
|
||||
|
||||
static bool addReloationEntry(dyn_linking_relocation_data_t *linking_data, dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, const RelocationData &relocationData);
|
||||
static bool addRelocationEntry(dyn_linking_relocation_data_t *linking_data, dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, const RelocationData &relocationData);
|
||||
|
||||
static bool addReloationEntry(dyn_linking_relocation_data_t *linking_data, dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, std::string name,
|
||||
const ImportRPLInformation &rplInfo);
|
||||
|
||||
static bool
|
||||
addReloationEntry(dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, dyn_linking_function_t *functionName, dyn_linking_import_t *importInfo);
|
||||
addRelocationEntry(dyn_linking_relocation_entry_t *linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, dyn_linking_function_t *functionName, dyn_linking_import_t *importInfo);
|
||||
|
||||
private:
|
||||
DynamicLinkingHelper() {
|
||||
}
|
||||
DynamicLinkingHelper() = default;
|
||||
|
||||
~DynamicLinkingHelper() {
|
||||
}
|
||||
~DynamicLinkingHelper() = default;
|
||||
};
|
||||
|
||||
@@ -11,15 +11,15 @@ public:
|
||||
this->address = address;
|
||||
}
|
||||
|
||||
wums_entry_type_t getType() const {
|
||||
[[nodiscard]] wums_entry_type_t getType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
const void *getAddress() const {
|
||||
[[nodiscard]] const void *getAddress() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
const std::string getName() const {
|
||||
[[nodiscard]] const std::string getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ public:
|
||||
this->target = target;
|
||||
}
|
||||
|
||||
wums_hook_type_t getType() const {
|
||||
[[nodiscard]] wums_hook_type_t getType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
const void *getTarget() const {
|
||||
[[nodiscard]] const void *getTarget() const {
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,12 @@
|
||||
class ImportRPLInformation {
|
||||
|
||||
public:
|
||||
ImportRPLInformation(std::string name, bool isData = false) {
|
||||
explicit ImportRPLInformation(std::string name, bool isData = false) {
|
||||
this->name = name;
|
||||
this->_isData = isData;
|
||||
}
|
||||
|
||||
~ImportRPLInformation() {
|
||||
}
|
||||
~ImportRPLInformation() = default;
|
||||
|
||||
static std::optional<ImportRPLInformation> createImportRPLInformation(std::string rawSectionName) {
|
||||
std::string fimport = ".fimport_";
|
||||
@@ -38,7 +37,7 @@ public:
|
||||
|
||||
bool data = false;
|
||||
|
||||
std::string rplName = "";
|
||||
std::string rplName;
|
||||
|
||||
if (rawSectionName.size() < fimport.size()) {
|
||||
return std::nullopt;
|
||||
@@ -54,11 +53,11 @@ public:
|
||||
return ImportRPLInformation(rplName, data);
|
||||
}
|
||||
|
||||
std::string getName() const {
|
||||
[[nodiscard]] std::string getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
bool isData() const {
|
||||
[[nodiscard]] bool isData() const {
|
||||
return _isData;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformati
|
||||
// Relocation
|
||||
std::vector<RelocationData> relocationData = module.getRelocationDataList();
|
||||
for (auto const &reloc : relocationData) {
|
||||
if (!DynamicLinkingHelper::addReloationEntry(&(moduleInformation->linking_data), module_data->linking_entries, DYN_LINK_RELOCATION_LIST_LENGTH, reloc)) {
|
||||
if (!DynamicLinkingHelper::addRelocationEntry(&(moduleInformation->linking_data), module_data->linking_entries,
|
||||
DYN_LINK_RELOCATION_LIST_LENGTH, reloc)) {
|
||||
DEBUG_FUNCTION_LINE("Failed to add relocation entry\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,34 +31,33 @@ public:
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
~RelocationData() {
|
||||
}
|
||||
~RelocationData() = default;
|
||||
|
||||
char getType() const {
|
||||
[[nodiscard]] char getType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
size_t getOffset() const {
|
||||
[[nodiscard]] size_t getOffset() const {
|
||||
return offset;
|
||||
}
|
||||
|
||||
int32_t getAddend() const {
|
||||
[[nodiscard]] int32_t getAddend() const {
|
||||
return addend;
|
||||
}
|
||||
|
||||
void *getDestination() const {
|
||||
[[nodiscard]] void *getDestination() const {
|
||||
return destination;
|
||||
}
|
||||
|
||||
std::string getName() const {
|
||||
[[nodiscard]] std::string getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
ImportRPLInformation getImportRPLInformation() const {
|
||||
[[nodiscard]] ImportRPLInformation getImportRPLInformation() const {
|
||||
return rplInfo;
|
||||
}
|
||||
|
||||
std::string toString() const;
|
||||
[[nodiscard]] std::string toString() const;
|
||||
|
||||
private:
|
||||
char type;
|
||||
|
||||
@@ -18,18 +18,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class SectionInfo {
|
||||
|
||||
public:
|
||||
SectionInfo(std::string name, uint32_t address, uint32_t sectionSize) :
|
||||
name(name),
|
||||
name(std::move(name)),
|
||||
address(address),
|
||||
sectionSize(sectionSize) {
|
||||
}
|
||||
|
||||
SectionInfo() {
|
||||
}
|
||||
SectionInfo() = default;
|
||||
|
||||
SectionInfo(const SectionInfo &o2) :
|
||||
name(o2.name),
|
||||
@@ -40,24 +40,22 @@ public:
|
||||
SectionInfo& operator=(const SectionInfo& other) = default;
|
||||
|
||||
|
||||
virtual ~SectionInfo() {
|
||||
virtual ~SectionInfo() = default;
|
||||
|
||||
}
|
||||
|
||||
const std::string &getName() const {
|
||||
[[nodiscard]] const std::string &getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
uint32_t getAddress() const {
|
||||
[[nodiscard]] uint32_t getAddress() const {
|
||||
return address;
|
||||
}
|
||||
|
||||
uint32_t getSize() const {
|
||||
[[nodiscard]] uint32_t getSize() const {
|
||||
return sectionSize;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
uint32_t address;
|
||||
uint32_t sectionSize;
|
||||
uint32_t address{};
|
||||
uint32_t sectionSize{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user