Add some asserts for g_fxo->init<>

This commit is contained in:
Elad 2024-11-27 13:09:56 +02:00
parent 68c58281e5
commit f3b9d64df7
3 changed files with 15 additions and 12 deletions

View File

@ -430,11 +430,11 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
if (ar)
{
g_fxo->init<hle_vars_save>(*ar);
ensure(g_fxo->init<hle_vars_save>(*ar));
}
else
{
g_fxo->init<hle_vars_save>();
ensure(g_fxo->init<hle_vars_save>());
}
for (auto& pair : ppu_module_manager::get())
@ -1090,7 +1090,7 @@ void init_ppu_functions(utils::serial* ar, bool full = false)
if (ar)
{
const u32 addr = g_fxo->init<ppu_function_manager>(*ar)->addr;
const u32 addr = ensure(g_fxo->init<ppu_function_manager>(*ar))->addr;
if (addr % 0x1000 || !vm::check_addr(addr))
{
@ -1098,7 +1098,7 @@ void init_ppu_functions(utils::serial* ar, bool full = false)
}
}
else
g_fxo->init<ppu_function_manager>();
ensure(g_fxo->init<ppu_function_manager>());
if (full)
{
@ -2279,7 +2279,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
// Static HLE patching
if (g_cfg.core.hook_functions && !virtual_load)
{
auto shle = g_fxo->init<statichle_handler>(0);
auto shle = ensure(g_fxo->init<statichle_handler>(0));
for (u32 i = _main.segs[0].addr; i < (_main.segs[0].addr + _main.segs[0].size); i += 4)
{
@ -2531,11 +2531,14 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
// Make init_mem_containers empty before call
const auto callback = std::move(Emu.init_mem_containers);
callback(mem_size);
ensure(g_fxo->is_init<id_manager::id_map<lv2_memory_container>>());
ensure(g_fxo->is_init<lv2_memory_container>());
}
else if (!ar)
{
g_fxo->init<id_manager::id_map<lv2_memory_container>>();
g_fxo->init<lv2_memory_container>(mem_size);
ensure(g_fxo->init<id_manager::id_map<lv2_memory_container>>());
ensure(g_fxo->init<lv2_memory_container>(mem_size));
}
void init_fxo_for_exec(utils::serial* ar, bool full);

View File

@ -1646,7 +1646,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
{
m_state = system_state::ready;
GetCallbacks().on_ready();
g_fxo->init<main_ppu_module>();
ensure(g_fxo->init<main_ppu_module>());
vm::init();
m_force_boot = false;
@ -2345,7 +2345,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
sys_log.error("Booting HG category outside of HDD0!");
}
const auto _main = g_fxo->init<main_ppu_module>();
const auto _main = ensure(g_fxo->init<main_ppu_module>());
if (ppu_load_exec(ppu_exec, false, m_path, DeserialManager()))
{

View File

@ -125,7 +125,7 @@ EmuCallbacks main_application::CreateCallbacks()
{
case keyboard_handler::null:
{
g_fxo->init<KeyboardHandlerBase, NullKeyboardHandler>(Emu.DeserialManager());
ensure(g_fxo->init<KeyboardHandlerBase, NullKeyboardHandler>(Emu.DeserialManager()));
break;
}
case keyboard_handler::basic:
@ -162,7 +162,7 @@ EmuCallbacks main_application::CreateCallbacks()
{
case mouse_handler::null:
{
g_fxo->init<MouseHandlerBase, NullMouseHandler>(Emu.DeserialManager());
ensure(g_fxo->init<MouseHandlerBase, NullMouseHandler>(Emu.DeserialManager()));
break;
}
case mouse_handler::basic:
@ -175,7 +175,7 @@ EmuCallbacks main_application::CreateCallbacks()
}
case mouse_handler::raw:
{
g_fxo->init<MouseHandlerBase, raw_mouse_handler>(Emu.DeserialManager());
ensure(g_fxo->init<MouseHandlerBase, raw_mouse_handler>(Emu.DeserialManager()));
break;
}
}