Actually read the target process from the plugin while function patching

This commit is contained in:
Maschell 2020-06-19 17:04:39 +02:00
parent ce73ac48e0
commit c76edf09c4
3 changed files with 10 additions and 4 deletions

View File

@ -23,11 +23,12 @@
class FunctionData {
public:
FunctionData(void *paddress, void *vaddress, const std::string &name, function_replacement_library_type_t library, void *replaceAddr, void *replaceCall) {
FunctionData(void *paddress, void *vaddress, const std::string &name, function_replacement_library_type_t library, void *replaceAddr, void *replaceCall, FunctionPatcherTargetProcess targetProcess) {
this->paddress = paddress;
this->vaddress = vaddress;
this->name = name;
this->library = library;
this->targetProcess = targetProcess;
this->replaceAddr = replaceAddr;
this->replaceCall = replaceCall;
}
@ -60,11 +61,16 @@ public:
return replaceCall;
}
const FunctionPatcherTargetProcess getTargetProcess() const {
return targetProcess;
}
private:
void *paddress = NULL;
void *vaddress = NULL;
std::string name;
function_replacement_library_type_t library;
FunctionPatcherTargetProcess targetProcess;
void *replaceAddr = NULL;
void *replaceCall = NULL;
};

View File

@ -113,7 +113,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
function_data->replaceCall = (uint32_t) curFunction.getReplaceCall();
function_data->physicalAddr = (uint32_t) curFunction.getPhysicalAddress();
function_data->virtualAddr = (uint32_t) curFunction.getVirtualAddress();
function_data->targetProcess = FP_TARGET_PROCESS_GAME_AND_MENU;
function_data->targetProcess = curFunction.getTargetProcess();
plugin_data->info.number_used_functions++;
i++;
@ -250,7 +250,7 @@ std::vector<PluginContainer> PluginContainerPersistence::loadPlugins(plugin_info
for (uint32_t j = 0; j < functionReplaceCount; j++) {
function_replacement_data_t *entry = &(plugin_data->info.functions[j]);
FunctionData func((void *) entry->physicalAddr, (void *) entry->virtualAddr, entry->function_name, (function_replacement_library_type_t) entry->library, (void *) entry->replaceAddr, (void *) entry->replaceCall);
FunctionData func((void *) entry->physicalAddr, (void *) entry->virtualAddr, entry->function_name, (function_replacement_library_type_t) entry->library, (void *) entry->replaceAddr, (void *) entry->replaceCall, entry->targetProcess);
pluginInformation.addFunctionData(func);
}

View File

@ -198,7 +198,7 @@ std::optional<PluginInformation> PluginInformationFactory::load(const PluginData
DEBUG_FUNCTION_LINE("Saving function \"%s\" of plugin . PA:%08X VA:%08X Library: %08X, target: %08X, call_addr: %08X", cur_function->_function.name/*,pluginData.getPluginInformation()->getName().c_str()*/,
cur_function->_function.physical_address, cur_function->_function.virtual_address, cur_function->_function.library, cur_function->_function.target, (void *) cur_function->_function.call_addr);
FunctionData function_data((void *) cur_function->_function.physical_address, (void *) cur_function->_function.virtual_address, cur_function->_function.name, (function_replacement_library_type_t) cur_function->_function.library,
(void *) cur_function->_function.target, (void *) cur_function->_function.call_addr);
(void *) cur_function->_function.target, (void *) cur_function->_function.call_addr, (FunctionPatcherTargetProcess) cur_function->_function.targetProcess);
pluginInfo.addFunctionData(function_data);
}
}