mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
Empty kill and init callback before calling them
This commit is contained in:
parent
554b27a82a
commit
a03dd44924
@ -1803,6 +1803,8 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
||||
error_handler.errored = false;
|
||||
}
|
||||
|
||||
const auto old_process_info = g_ps3_process_info;
|
||||
|
||||
// Allocate memory at fixed positions
|
||||
for (const auto& prog : elf.progs)
|
||||
{
|
||||
@ -2199,30 +2201,33 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
||||
_main.seg0_code_end = end;
|
||||
_main.applied_pathes = applied;
|
||||
|
||||
// Set SDK version
|
||||
g_ps3_process_info.sdk_ver = sdk_version;
|
||||
|
||||
// Set ppc fixed allocations segment permission
|
||||
g_ps3_process_info.ppc_seg = ppc_seg;
|
||||
|
||||
if (Emu.init_mem_containers)
|
||||
{
|
||||
// Refer to sys_process_exit2 for explanation
|
||||
Emu.init_mem_containers(mem_size);
|
||||
}
|
||||
else if (!ar)
|
||||
{
|
||||
g_fxo->init<id_manager::id_map<lv2_memory_container>>();
|
||||
g_fxo->init<lv2_memory_container>(mem_size);
|
||||
}
|
||||
|
||||
if (!virtual_load)
|
||||
{
|
||||
// Set SDK version
|
||||
g_ps3_process_info.sdk_ver = sdk_version;
|
||||
|
||||
// Set ppc fixed allocations segment permission
|
||||
g_ps3_process_info.ppc_seg = ppc_seg;
|
||||
|
||||
if (Emu.init_mem_containers)
|
||||
{
|
||||
// Refer to sys_process_exit2 for explanation
|
||||
// Make init_mem_containers empty before call
|
||||
const auto callback = std::move(Emu.init_mem_containers);
|
||||
callback(mem_size);
|
||||
}
|
||||
else if (!ar)
|
||||
{
|
||||
g_fxo->init<id_manager::id_map<lv2_memory_container>>();
|
||||
g_fxo->init<lv2_memory_container>(mem_size);
|
||||
}
|
||||
|
||||
void init_fxo_for_exec(utils::serial* ar, bool full);
|
||||
init_fxo_for_exec(ar, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ps3_process_info = old_process_info;
|
||||
Emu.ConfigurePPUCache();
|
||||
}
|
||||
|
||||
|
@ -3084,7 +3084,7 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
||||
}
|
||||
|
||||
// Check .self filename
|
||||
if (upper.ends_with(".SELF"))
|
||||
if (upper.ends_with(".SELF") && Emu.GetBoot() != dir_queue[i] + entry.name)
|
||||
{
|
||||
// Get full path
|
||||
file_queue.emplace_back(dir_queue[i] + entry.name, 0);
|
||||
@ -3302,6 +3302,9 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
||||
{
|
||||
while (exec_err == elf_error::ok)
|
||||
{
|
||||
main_ppu_module& _main = g_fxo->get<main_ppu_module>();
|
||||
_main = {};
|
||||
|
||||
if (!ppu_load_exec(obj, true, path))
|
||||
{
|
||||
// Abort
|
||||
@ -3309,8 +3312,6 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
|
||||
break;
|
||||
}
|
||||
|
||||
main_ppu_module& _main = g_fxo->get<main_ppu_module>();
|
||||
|
||||
if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_pathes, [](){ return Emu.IsStopped(); }))
|
||||
{
|
||||
break;
|
||||
@ -3457,7 +3458,7 @@ extern void ppu_initialize()
|
||||
}
|
||||
|
||||
// Avoid compilation if main's cache exists or it is a standalone SELF with no PARAM.SFO
|
||||
if (compile_main && g_cfg.core.ppu_llvm_precompilation && !Emu.GetTitleID().empty())
|
||||
if (compile_main && g_cfg.core.ppu_llvm_precompilation && !Emu.GetTitleID().empty() && !Emu.IsChildProcess())
|
||||
{
|
||||
// Try to add all related directories
|
||||
const std::set<std::string> dirs = Emu.GetGameDirs();
|
||||
|
@ -439,7 +439,7 @@ void lv2_exitspawn(ppu_thread& ppu, std::vector<std::string>& argv, std::vector<
|
||||
}
|
||||
|
||||
// Save LV2 memory containers
|
||||
g_fxo->init<id_map<lv2_memory_container>>()->vec = std::move(vec);
|
||||
ensure(g_fxo->init<id_map<lv2_memory_container>>())->vec = std::move(vec);
|
||||
|
||||
// Empty the containers, accumulate their total size
|
||||
u32 total_size = 0;
|
||||
@ -453,7 +453,7 @@ void lv2_exitspawn(ppu_thread& ppu, std::vector<std::string>& argv, std::vector<
|
||||
// 1. If newer SDK version suggests higher memory capacity - it is ignored
|
||||
// 2. If newer SDK version suggests lower memory capacity - it is lowered
|
||||
// And if 2. happens while user memory containers exist, the left space can be spent on user memory containers
|
||||
g_fxo->init<lv2_memory_container>(std::min(old_size - total_size, sdk_suggested_mem) + total_size);
|
||||
ensure(g_fxo->init<lv2_memory_container>(std::min(old_size - total_size, sdk_suggested_mem) + total_size));
|
||||
};
|
||||
|
||||
Emu.after_kill_callback = [func = std::move(func), argv = std::move(argv), envp = std::move(envp), data = std::move(data),
|
||||
|
@ -2893,8 +2893,9 @@ void Emulator::Kill(bool allow_autoexit, bool savestate)
|
||||
|
||||
if (after_kill_callback)
|
||||
{
|
||||
after_kill_callback();
|
||||
after_kill_callback = nullptr;
|
||||
// Make after_kill_callback empty before call
|
||||
const auto callback = std::move(after_kill_callback);
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
@ -312,6 +312,11 @@ public:
|
||||
return m_config_path;
|
||||
}
|
||||
|
||||
bool IsChildProcess() const
|
||||
{
|
||||
return m_config_mode == cfg_mode::continuous;
|
||||
}
|
||||
|
||||
game_boot_result BootGame(const std::string& path, const std::string& title_id = "", bool direct = false, cfg_mode config_mode = cfg_mode::custom, const std::string& config_path = "");
|
||||
bool BootRsxCapture(const std::string& path);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user