mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2026-08-11 12:16:06 -05:00
Remove the elfio reader from the PluginData class, use it when it's needed
This commit is contained in:
@@ -6,7 +6,6 @@ PluginData::PluginData(const PluginData &obj) {
|
||||
this->heapHandle = obj.heapHandle;
|
||||
this->memoryType = obj.memoryType;
|
||||
this->length = obj.length;
|
||||
loadReader();
|
||||
}
|
||||
|
||||
void PluginData::freeMemory() {
|
||||
@@ -30,26 +29,6 @@ void PluginData::freeMemory() {
|
||||
PluginData::PluginData(std::vector<uint8_t> buffer) : PluginData(buffer, 0, eMemTypeMEM2) {
|
||||
}
|
||||
|
||||
void PluginData::loadReader() {
|
||||
if (this->buffer == NULL) {
|
||||
this->reader = std::nullopt;
|
||||
} else {
|
||||
elfio *nReader = new elfio;
|
||||
if (nReader != NULL && nReader->load((char *) this->buffer, length)) {
|
||||
DEBUG_FUNCTION_LINE("Loading was okay");
|
||||
this->reader = nReader;
|
||||
} else {
|
||||
if (nReader) {
|
||||
delete nReader;
|
||||
nReader = NULL;
|
||||
}
|
||||
DEBUG_FUNCTION_LINE("Loading failed");
|
||||
this->reader = std::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PluginData::PluginData(std::vector<uint8_t> input, MEMHeapHandle heapHandle, eMemoryTypes memoryType) :
|
||||
heapHandle(heapHandle),
|
||||
memoryType(memoryType),
|
||||
@@ -78,7 +57,6 @@ PluginData::PluginData(std::vector<uint8_t> input, MEMHeapHandle heapHandle, eMe
|
||||
this->buffer = data_copy;
|
||||
break;
|
||||
}
|
||||
loadReader();
|
||||
}
|
||||
|
||||
std::optional<PluginData> PluginData::createFromExistingData(const void *buffer, MEMHeapHandle heapHandle, eMemoryTypes memoryType, const size_t length) {
|
||||
|
||||
Reference in New Issue
Block a user