mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-28 04:54:30 +00:00
add HLE
This commit is contained in:
parent
74a3acdfa1
commit
3f99769345
@ -13,25 +13,20 @@ using namespace ImGui;
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
std::filesystem::path ModuleList::game_folder;
|
||||
|
||||
void ModuleList::Draw() {
|
||||
{
|
||||
std::scoped_lock lock(s_modules_mutex);
|
||||
modules.clear();
|
||||
for (const auto& entry : s_modules) {
|
||||
ModuleInfo info;
|
||||
info.name = entry.name;
|
||||
info.is_sys_module = IsSystemModule(entry.path);
|
||||
modules.push_back(info);
|
||||
}
|
||||
std::scoped_lock lock(modules_mutex);
|
||||
}
|
||||
|
||||
SetNextWindowSize({550.0f, 600.0f}, ImGuiCond_FirstUseEver);
|
||||
if (!Begin("LLE Module List", &open)) {
|
||||
if (!Begin("Module List", &open)) {
|
||||
End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (BeginTable("ModuleTable", 2,
|
||||
if (BeginTable("ModuleTable", 3,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable |
|
||||
ImGuiTableFlags_RowBg)) {
|
||||
TableSetupColumn("Modulname", ImGuiTableColumnFlags_WidthStretch);
|
||||
@ -45,9 +40,16 @@ void ModuleList::Draw() {
|
||||
|
||||
TableSetColumnIndex(1);
|
||||
if (module.is_sys_module) {
|
||||
TextColored({0.0f, 1.0f, 0.0f, 1.0f}, "System Module");
|
||||
TextColored({0.2f, 0.6f, 0.8f, 1.0f}, "System Module");
|
||||
} else {
|
||||
TextColored({1.0f, 0.0f, 0.0f, 1.0f}, "Game Module");
|
||||
TextColored({0.8f, 0.4f, 0.2f, 1.0f}, "Game Module");
|
||||
}
|
||||
|
||||
TableSetColumnIndex(2);
|
||||
if (module.is_lle) {
|
||||
TextColored({0.4f, 0.7f, 0.4f, 1.0f}, "LLE");
|
||||
} else {
|
||||
TextColored({0.7f, 0.4f, 0.5f, 1.0f}, "HLE");
|
||||
}
|
||||
}
|
||||
EndTable();
|
||||
|
@ -21,7 +21,13 @@ public:
|
||||
void Draw();
|
||||
bool open = false;
|
||||
|
||||
bool IsSystemModule(const std::filesystem::path& path) {
|
||||
static std::filesystem::path game_folder;
|
||||
|
||||
static void SetGameFolder(const std::filesystem::path& path) {
|
||||
game_folder = path;
|
||||
}
|
||||
|
||||
static bool IsSystemModule(const std::filesystem::path& path) {
|
||||
|
||||
const auto sys_modules_path = Common::FS::GetUserPath(Common::FS::PathType::SysModuleDir);
|
||||
|
||||
@ -34,29 +40,50 @@ public:
|
||||
return path_str.starts_with(sys_path_str);
|
||||
}
|
||||
|
||||
static bool IsSystemModule(const std::string& name) {
|
||||
const auto game_modules_path = game_folder / "sce_module";
|
||||
const auto prx_path = game_modules_path / name;
|
||||
|
||||
if (!std::filesystem::exists(prx_path)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void AddModule(const std::string& name, std::filesystem::path path) {
|
||||
if (name == "eboot.bin") {
|
||||
return;
|
||||
}
|
||||
std::scoped_lock lock(s_modules_mutex);
|
||||
s_modules.push_back({name, path});
|
||||
std::scoped_lock lock(modules_mutex);
|
||||
modules.push_back({name, IsSystemModule(path), true});
|
||||
}
|
||||
|
||||
static void AddModule(std::string& name) {
|
||||
name = name + ".prx";
|
||||
std::scoped_lock lock(modules_mutex);
|
||||
|
||||
bool is_sys_module = IsSystemModule(name);
|
||||
bool is_lle = false;
|
||||
auto it = std::find_if(modules.begin(), modules.end(),
|
||||
[&name, is_sys_module, is_lle](const ModuleInfo& entry) {
|
||||
return entry.name == name && entry.is_lle == false;
|
||||
});
|
||||
|
||||
if (it == modules.end()) {
|
||||
modules.push_back({name, is_sys_module, is_lle});
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
struct ModuleInfo {
|
||||
std::string name;
|
||||
bool is_sys_module;
|
||||
bool is_lle;
|
||||
};
|
||||
|
||||
struct ModuleListEntry {
|
||||
std::string name;
|
||||
std::filesystem::path path;
|
||||
};
|
||||
static inline std::mutex modules_mutex;
|
||||
|
||||
static inline std::vector<ModuleListEntry> s_modules;
|
||||
static inline std::mutex s_modules_mutex;
|
||||
|
||||
std::vector<ModuleInfo> modules;
|
||||
static inline std::vector<ModuleInfo> modules;
|
||||
};
|
||||
|
||||
} // namespace Core::Devtools::Widget
|
@ -329,6 +329,9 @@ bool Linker::Resolve(const std::string& name, Loader::SymbolType sym_type, Modul
|
||||
}
|
||||
if (record) {
|
||||
*return_info = *record;
|
||||
|
||||
Core::Devtools::Widget::ModuleList::AddModule(sr.library);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "common/polyfill_thread.h"
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/devtools/widget/module_list.h"
|
||||
#include "core/file_format/psf.h"
|
||||
#include "core/file_format/trp.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
@ -75,6 +76,8 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector<std::str
|
||||
}
|
||||
}
|
||||
|
||||
Core::Devtools::Widget::ModuleList::SetGameFolder(game_folder);
|
||||
|
||||
// Applications expect to be run from /app0 so mount the file's parent path as app0.
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
mnt->Mount(game_folder, "/app0", true);
|
||||
|
Loading…
Reference in New Issue
Block a user