From 24f9f0627954edae05a645c3c778c17fc1136887 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 12 Aug 2017 13:52:59 +0300 Subject: [PATCH] Check FNID duplication --- rpcs3/Emu/Cell/PPUModule.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 76e895d512..9a76ec76b5 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -88,12 +88,26 @@ void ppu_module_manager::register_module(ppu_static_module* module) ppu_static_function& ppu_module_manager::access_static_function(const char* module, u32 fnid) { - return access().at(module)->functions[fnid]; + auto& res = access().at(module)->functions[fnid]; + + if (res.name) + { + fmt::throw_exception("PPU FNID duplication in module %s (%s, 0x%x)", module, res.name, fnid); + } + + return res; } ppu_static_variable& ppu_module_manager::access_static_variable(const char* module, u32 vnid) { - return access().at(module)->variables[vnid]; + auto& res = access().at(module)->variables[vnid]; + + if (res.name) + { + fmt::throw_exception("PPU VNID duplication in module %s (%s, 0x%x)", module, res.name, vnid); + } + + return res; } const ppu_static_module* ppu_module_manager::get_module(const std::string& name)