Use g_fxo for global ppu_module instance
Also fix autonomous PRX/SPU loading sequence.
This commit is contained in:
@@ -68,7 +68,7 @@ struct ppu_segment
|
|||||||
// PPU Module Information
|
// PPU Module Information
|
||||||
struct ppu_module
|
struct ppu_module
|
||||||
{
|
{
|
||||||
uchar sha1[20];
|
uchar sha1[20]{};
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string cache;
|
std::string cache;
|
||||||
|
|||||||
@@ -992,7 +992,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
|
|||||||
|
|
||||||
LOG_NOTICE(LOADER, "PRX library hash: %s (<- %u)", hash, applied);
|
LOG_NOTICE(LOADER, "PRX library hash: %s (<- %u)", hash, applied);
|
||||||
|
|
||||||
if (Emu.IsReady() && fxm::import<ppu_module>([&] { return prx; }))
|
if (Emu.IsReady() && g_fxo->get<ppu_module>()->segs.empty())
|
||||||
{
|
{
|
||||||
// Special loading mode
|
// Special loading mode
|
||||||
ppu_thread_params p{};
|
ppu_thread_params p{};
|
||||||
@@ -1043,7 +1043,7 @@ void ppu_unload_prx(const lv2_prx& prx)
|
|||||||
void ppu_load_exec(const ppu_exec_object& elf)
|
void ppu_load_exec(const ppu_exec_object& elf)
|
||||||
{
|
{
|
||||||
// Set for delayed initialization in ppu_initialize()
|
// Set for delayed initialization in ppu_initialize()
|
||||||
const auto _main = fxm::make<ppu_module>();
|
const auto _main = g_fxo->get<ppu_module>();
|
||||||
|
|
||||||
// Access linkage information object
|
// Access linkage information object
|
||||||
const auto link = g_fxo->init<ppu_linkage_info>();
|
const auto link = g_fxo->init<ppu_linkage_info>();
|
||||||
|
|||||||
@@ -1304,7 +1304,7 @@ extern bool ppu_stdcx(ppu_thread& ppu, u32 addr, u64 reg_value)
|
|||||||
|
|
||||||
extern void ppu_initialize()
|
extern void ppu_initialize()
|
||||||
{
|
{
|
||||||
const auto _main = fxm::get<ppu_module>();
|
const auto _main = g_fxo->get<ppu_module>();
|
||||||
|
|
||||||
if (!_main)
|
if (!_main)
|
||||||
{
|
{
|
||||||
@@ -1317,7 +1317,10 @@ extern void ppu_initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize main module
|
// Initialize main module
|
||||||
ppu_initialize(*_main);
|
if (!_main->segs.empty())
|
||||||
|
{
|
||||||
|
ppu_initialize(*_main);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<lv2_prx*> prx_list;
|
std::vector<lv2_prx*> prx_list;
|
||||||
|
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ const std::string Emulator::GetBackgroundPicturePath() const
|
|||||||
|
|
||||||
std::string Emulator::PPUCache() const
|
std::string Emulator::PPUCache() const
|
||||||
{
|
{
|
||||||
const auto _main = fxm::check_unlocked<ppu_module>();
|
const auto _main = g_fxo->get<ppu_module>();
|
||||||
|
|
||||||
if (!_main || _main->cache.empty())
|
if (!_main || _main->cache.empty())
|
||||||
{
|
{
|
||||||
@@ -1557,9 +1557,9 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
|||||||
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
|
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ppu_load_exec(ppu_exec);
|
const auto _main = g_fxo->init<ppu_module>();
|
||||||
|
|
||||||
const auto _main = fxm::get<ppu_module>();
|
ppu_load_exec(ppu_exec);
|
||||||
|
|
||||||
_main->cache = fs::get_cache_dir() + "cache/";
|
_main->cache = fs::get_cache_dir() + "cache/";
|
||||||
|
|
||||||
@@ -1594,6 +1594,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
|||||||
m_state = system_state::ready;
|
m_state = system_state::ready;
|
||||||
GetCallbacks().on_ready();
|
GetCallbacks().on_ready();
|
||||||
vm::init();
|
vm::init();
|
||||||
|
g_fxo->init();
|
||||||
ppu_load_prx(ppu_prx, m_path);
|
ppu_load_prx(ppu_prx, m_path);
|
||||||
}
|
}
|
||||||
else if (spu_exec.open(elf_file) == elf_error::ok)
|
else if (spu_exec.open(elf_file) == elf_error::ok)
|
||||||
@@ -1602,6 +1603,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
|||||||
m_state = system_state::ready;
|
m_state = system_state::ready;
|
||||||
GetCallbacks().on_ready();
|
GetCallbacks().on_ready();
|
||||||
vm::init();
|
vm::init();
|
||||||
|
g_fxo->init();
|
||||||
spu_load_exec(spu_exec);
|
spu_load_exec(spu_exec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user