diff --git a/source/plugin/FunctionData.h b/source/plugin/FunctionData.h index b6cccd8..a5355d6 100644 --- a/source/plugin/FunctionData.h +++ b/source/plugin/FunctionData.h @@ -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; }; diff --git a/source/plugin/PluginContainerPersistence.cpp b/source/plugin/PluginContainerPersistence.cpp index 33557b3..1490ce8 100644 --- a/source/plugin/PluginContainerPersistence.cpp +++ b/source/plugin/PluginContainerPersistence.cpp @@ -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 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); } diff --git a/source/plugin/PluginInformationFactory.cpp b/source/plugin/PluginInformationFactory.cpp index dfa0416..60f9cdf 100644 --- a/source/plugin/PluginInformationFactory.cpp +++ b/source/plugin/PluginInformationFactory.cpp @@ -198,7 +198,7 @@ std::optional 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); } }