Configuration simplified

This commit is contained in:
Nekotekina 2017-05-20 14:45:02 +03:00
parent d5107aab47
commit f010b5b235
46 changed files with 1018 additions and 904 deletions

View file

@ -1,5 +1,4 @@
#include "stdafx.h"
#include "Utilities/Config.h"
#include "Utilities/VirtualMemory.h"
#include "Crypto/sha1.h"
#include "Crypto/unself.h"
@ -19,28 +18,6 @@
namespace vm { using namespace ps3; }
enum class lib_loader_mode
{
automatic,
manual,
both,
liblv2only
};
cfg::map_entry<lib_loader_mode> g_cfg_lib_loader(cfg::root.core, "Lib Loader", 3,
{
{ "Automatically load required libraries", lib_loader_mode::automatic },
{ "Manually load selected libraries", lib_loader_mode::manual },
{ "Load automatic and manual selection", lib_loader_mode::both },
{ "Load liblv2.sprx only", lib_loader_mode::liblv2only },
});
cfg::bool_entry g_cfg_hook_ppu_funcs(cfg::root.core, "Hook static functions");
cfg::set_entry g_cfg_load_libs(cfg::root.core, "Load libraries");
extern cfg::map_entry<ppu_decoder_type> g_cfg_ppu_decoder;
extern void ppu_initialize_syscalls();
extern std::string ppu_get_function_name(const std::string& module, u32 fnid);
extern std::string ppu_get_variable_name(const std::string& module, u32 vnid);
@ -56,6 +33,23 @@ extern u32 g_ps3_sdk_version;
// HLE function name cache
std::vector<std::string> g_ppu_function_names;
template <>
void fmt_class_string<lib_loading_type>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](lib_loading_type value)
{
switch (value)
{
case lib_loading_type::automatic: return "Automatically load required libraries";
case lib_loading_type::manual: return "Manually load selected libraries";
case lib_loading_type::both: return "Load automatic and manual selection";
case lib_loading_type::liblv2only: return "Load liblv2.sprx only";
}
return unknown;
});
}
extern u32 ppu_generate_id(const char* name)
{
// Symbol name suffix
@ -627,7 +621,7 @@ static void ppu_load_imports(const std::shared_ptr<ppu_linkage_info>& link, u32
std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::string& name)
{
if (g_cfg_ppu_decoder.get() == ppu_decoder_type::llvm && name == "libfiber.sprx")
if (g_cfg.core.ppu_decoder == ppu_decoder_type::llvm && name == "libfiber.sprx")
{
LOG_FATAL(PPU, "libfiber.sprx is not compatible with PPU LLVM Recompiler. Use PPU Interpreter.");
Emu.Pause();
@ -833,7 +827,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
void ppu_load_exec(const ppu_exec_object& elf)
{
if (g_cfg_hook_ppu_funcs)
if (g_cfg.core.hook_functions)
{
LOG_TODO(LOADER, "'Hook static functions' option deactivated");
}
@ -1014,17 +1008,18 @@ void ppu_load_exec(const ppu_exec_object& elf)
// Get LLE module list
std::set<std::string> load_libs;
if (g_cfg_lib_loader.get() == lib_loader_mode::manual || g_cfg_lib_loader.get() == lib_loader_mode::both)
if (g_cfg.core.lib_loading == lib_loading_type::manual || g_cfg.core.lib_loading == lib_loading_type::both)
{
// Load required set of modules
load_libs = g_cfg_load_libs.get_set();
load_libs = g_cfg.core.load_libraries.get_set();
}
else if (g_cfg_lib_loader.get() == lib_loader_mode::liblv2only)
else if (g_cfg.core.lib_loading == lib_loading_type::liblv2only)
{
// Load only liblv2.sprx
load_libs.emplace("liblv2.sprx");
}
if (g_cfg_lib_loader.get() == lib_loader_mode::automatic || g_cfg_lib_loader.get() == lib_loader_mode::both)
if (g_cfg.core.lib_loading == lib_loading_type::automatic || g_cfg.core.lib_loading == lib_loading_type::both)
{
// Load recommended set of modules: Module name -> SPRX
std::unordered_multimap<std::string, std::string> sprx_map
@ -1228,7 +1223,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
// TODO: adjust for liblv2 loading option
u32 entry = static_cast<u32>(elf.header.e_entry);
if (g_cfg_lib_loader.get() != lib_loader_mode::liblv2only)
if (g_cfg.core.lib_loading != lib_loading_type::liblv2only)
{
// Set TLS args, call sys_initialize_tls
ppu->cmd_list