1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Refactor some 'offending' code a bit (no effect)

It appears linkage errors were rare even in debug mode (GCC/clang).
This commit is contained in:
Nekotekina 2021-01-18 21:34:54 +03:00
parent 6cf0c5cd6d
commit f9bc682115
4 changed files with 34 additions and 19 deletions

View File

@ -1055,14 +1055,17 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
u64 seek(s64 offset, seek_mode whence) override
{
if (whence > seek_end)
{
fmt::throw_exception("Invalid whence (0x%x)", whence);
}
LARGE_INTEGER pos;
pos.QuadPart = offset;
const DWORD mode =
whence == seek_set ? FILE_BEGIN :
whence == seek_cur ? FILE_CURRENT :
whence == seek_end ? FILE_END :
(fmt::throw_exception("Invalid whence (0x%x)", whence), 0);
whence == seek_cur ? FILE_CURRENT : FILE_END;
if (!SetFilePointerEx(m_handle, pos, &pos, mode))
{
@ -1196,11 +1199,14 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
u64 seek(s64 offset, seek_mode whence) override
{
if (whence > seek_end)
{
fmt::throw_exception("Invalid whence (0x%x)", whence);
}
const int mode =
whence == seek_set ? SEEK_SET :
whence == seek_cur ? SEEK_CUR :
whence == seek_end ? SEEK_END :
(fmt::throw_exception("Invalid whence (0x%x)", whence), 0);
whence == seek_cur ? SEEK_CUR : SEEK_END;
const auto result = ::lseek(m_fd, offset, mode);

View File

@ -126,11 +126,16 @@ static u64& ppu_ref(u32 addr)
// Get interpreter cache value
static u64 ppu_cache(u32 addr)
{
if (g_cfg.core.ppu_decoder > ppu_decoder_type::fast)
{
fmt::throw_exception("Invalid PPU decoder");
}
// Select opcode table
const auto& table = *(
g_cfg.core.ppu_decoder == ppu_decoder_type::precise ? &g_ppu_interpreter_precise.get_table() :
g_cfg.core.ppu_decoder == ppu_decoder_type::fast ? &g_ppu_interpreter_fast.get_table() :
(fmt::throw_exception("Invalid PPU decoder"), nullptr));
g_cfg.core.ppu_decoder == ppu_decoder_type::precise
? &g_ppu_interpreter_precise.get_table()
: &g_ppu_interpreter_fast.get_table());
return reinterpret_cast<uptr>(table[ppu_decode(vm::read32(addr))]);
}

View File

@ -1188,11 +1188,15 @@ void spu_recompiler_base::branch(spu_thread& spu, void*, u8* rip)
void spu_recompiler_base::old_interpreter(spu_thread& spu, void* ls, u8* rip)
{
if (g_cfg.core.spu_decoder > spu_decoder_type::fast)
{
fmt::throw_exception("Invalid SPU decoder");
}
// Select opcode table
const auto& table = *(
g_cfg.core.spu_decoder == spu_decoder_type::precise ? &g_spu_interpreter_precise.get_table() :
g_cfg.core.spu_decoder == spu_decoder_type::fast ? &g_spu_interpreter_fast.get_table() :
(fmt::throw_exception("Invalid SPU decoder"), nullptr));
const auto& table = *(g_cfg.core.spu_decoder == spu_decoder_type::precise
? &g_spu_interpreter_precise.get_table()
: &g_spu_interpreter_fast.get_table());
// LS pointer
const auto base = static_cast<const u8*>(ls);

View File

@ -1,16 +1,16 @@
#pragma once
enum class ppu_decoder_type
enum class ppu_decoder_type : unsigned
{
precise,
fast,
precise = 0, // Don't change (0)
fast, // Don't change (1)
llvm,
};
enum class spu_decoder_type
enum class spu_decoder_type : unsigned
{
precise,
fast,
precise = 0, // Don't change (0)
fast, // Don't change (1)
asmjit,
llvm,
};