Check FNID duplication

This commit is contained in:
Nekotekina 2017-08-12 13:52:59 +03:00
parent b671bb72dc
commit 24f9f06279

View File

@ -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)