1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00

Remove HERE macro

Some cleanup.
Add location to some functions.
This commit is contained in:
Nekotekina 2020-12-09 18:04:52 +03:00
parent d25c401aec
commit 36c8654fb8
130 changed files with 969 additions and 889 deletions

View File

@ -7,8 +7,6 @@
#include <typeinfo>
#include <charconv>
[[noreturn]] void report_fatal_error(const std::string&);
LOG_CHANNEL(cfg_log, "CFG");
namespace cfg
@ -18,7 +16,7 @@ namespace cfg
{
if (_type != type::node)
{
cfg_log.fatal("Invalid root node" HERE);
cfg_log.fatal("Invalid root node");
}
}
@ -29,7 +27,7 @@ namespace cfg
{
if (pair.first == name)
{
cfg_log.fatal("Node already exists: %s" HERE, name);
cfg_log.fatal("Node already exists: %s", name);
}
}
@ -38,12 +36,12 @@ namespace cfg
bool _base::from_string(const std::string&, bool)
{
report_fatal_error("from_string() purecall" HERE);
fmt::throw_exception("from_string() purecall");
}
bool _base::from_list(std::vector<std::string>&&)
{
report_fatal_error("from_list() purecall" HERE);
fmt::throw_exception("from_list() purecall");
}
// Emit YAML

View File

@ -900,14 +900,19 @@ bool fs::utime(const std::string& path, s64 atime, s64 mtime)
#endif
}
void fs::file::xnull() const
[[noreturn]] void fs::xnull(const src_loc& loc)
{
fmt::throw_exception("fs::file is null");
fmt::throw_exception("Null object.%s", loc);
}
void fs::file::xfail() const
[[noreturn]] void fs::xfail(const src_loc& loc)
{
fmt::throw_exception("Unexpected fs::error %s", g_tls_error);
fmt::throw_exception("Unexpected fs::error %s%s", g_tls_error, loc);
}
[[noreturn]] void fs::xovfl()
{
fmt::throw_exception("Stream overflow.");
}
fs::file::file(const std::string& path, bs_t<open_mode> mode)
@ -1056,7 +1061,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
whence == seek_set ? FILE_BEGIN :
whence == seek_cur ? FILE_CURRENT :
whence == seek_end ? FILE_END :
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
(fmt::throw_exception("Invalid whence (0x%x)", whence), 0);
if (!SetFilePointerEx(m_handle, pos, &pos, mode))
{
@ -1194,7 +1199,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
whence == seek_set ? SEEK_SET :
whence == seek_cur ? SEEK_CUR :
whence == seek_end ? SEEK_END :
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
(fmt::throw_exception("Invalid whence (0x%x)", whence), 0);
const auto result = ::lseek(m_fd, offset, mode);
@ -1318,11 +1323,6 @@ fs::native_handle fs::file::get_handle() const
#endif
}
void fs::dir::xnull() const
{
fmt::throw_exception("fs::dir is null");
}
bool fs::dir::open(const std::string& path)
{
if (path.empty())

View File

@ -134,6 +134,12 @@ namespace fs
virtual std::unique_ptr<dir_base> open_dir(const std::string& path) = 0;
};
[[noreturn]] void xnull(const src_loc&);
[[noreturn]] void xfail(const src_loc&);
[[noreturn]] void xovfl();
constexpr struct pod_tag_t{} pod_tag;
// Get virtual device for specified path (nullptr for real path)
std::shared_ptr<device_base> get_virtual_device(const std::string& path);
@ -186,9 +192,6 @@ namespace fs
{
std::unique_ptr<file_base> m_file;
[[noreturn]] void xnull() const;
[[noreturn]] void xfail() const;
public:
// Default constructor
file() = default;
@ -230,144 +233,226 @@ namespace fs
}
// Change file size (possibly appending zero bytes)
bool trunc(u64 length) const
bool trunc(u64 length,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->trunc(length);
}
// Get file information
stat_t stat() const
stat_t stat(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->stat();
}
// Sync file buffers
void sync() const
void sync(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->sync();
}
// Read the data from the file and return the amount of data written in buffer
u64 read(void* buffer, u64 count) const
u64 read(void* buffer, u64 count,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(), ...) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->read(buffer, count);
}
// Write the data to the file and return the amount of data actually written
u64 write(const void* buffer, u64 count) const
u64 write(const void* buffer, u64 count,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(), ...) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->write(buffer, count);
}
// Change current position, returns resulting position
u64 seek(s64 offset, seek_mode whence = seek_set) const
u64 seek(s64 offset, seek_mode whence = seek_set,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->seek(offset, whence);
}
// Get file size
u64 size() const
u64 size(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->size();
}
// Get current position
u64 pos() const
u64 pos(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->seek(0, seek_cur);
}
// Write std::string unconditionally
const file& write(const std::string& str) const
// Write std::basic_string unconditionally
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, const file&> write(const std::basic_string<T>& str,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (write(str.data(), str.size()) != str.size()) xfail();
if (write(str.data(), str.size() * sizeof(T), line, col, file, func) != str.size() * sizeof(T)) xfail({line, col, file, func});
return *this;
}
// Write POD unconditionally
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, const file&> write(const T& data) const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, const file&> write(const T& data,
pod_tag_t = pod_tag,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (write(std::addressof(data), sizeof(T)) != sizeof(T)) xfail();
if (write(std::addressof(data), sizeof(T), line, col, file, func) != sizeof(T)) xfail({line, col, file, func});
return *this;
}
// Write POD std::vector unconditionally
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, const file&> write(const std::vector<T>& vec) const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, const file&> write(const std::vector<T>& vec,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (write(vec.data(), vec.size() * sizeof(T)) != vec.size() * sizeof(T)) xfail();
if (write(vec.data(), vec.size() * sizeof(T), line, col, file, func) != vec.size() * sizeof(T)) xfail({line, col, file, func});
return *this;
}
// Read std::string, size must be set by resize() method
bool read(std::string& str) const
// Read std::basic_string, size must be set by resize() method
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(std::basic_string<T>& str,
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(),
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN()) const
{
return read(&str[0], str.size()) == str.size();
return read(&str[0], str.size() * sizeof(T), line, col, file, func) == str.size() * sizeof(T);
}
// Read std::string
bool read(std::string& str, std::size_t size) const
// Read std::basic_string
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(std::basic_string<T>& str, std::size_t size,
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(),
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN()) const
{
str.resize(size);
return read(&str[0], size) == size;
return read(&str[0], size * sizeof(T), line, col, file, func) == size * sizeof(T);
}
// Read POD, sizeof(T) is used
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(T& data) const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(T& data,
pod_tag_t = pod_tag,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
return read(&data, sizeof(T)) == sizeof(T);
return read(&data, sizeof(T), line, col, file, func) == sizeof(T);
}
// Read POD std::vector, size must be set by resize() method
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(std::vector<T>& vec) const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(std::vector<T>& vec,
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(),
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN()) const
{
return read(vec.data(), sizeof(T) * vec.size()) == sizeof(T) * vec.size();
return read(vec.data(), sizeof(T) * vec.size(), line, col, file, func) == sizeof(T) * vec.size();
}
// Read POD std::vector
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(std::vector<T>& vec, std::size_t size) const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, bool> read(std::vector<T>& vec, std::size_t size,
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION(),
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN()) const
{
vec.resize(size);
return read(vec.data(), sizeof(T) * size) == sizeof(T) * size;
return read(vec.data(), sizeof(T) * size, line, col, file, func) == sizeof(T) * size;
}
// Read POD (experimental)
template <typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, T> read() const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, T> read(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
T result;
if (!read(result)) xfail();
if (!read(result, pod_tag, line, col, file, func)) xfail({line, col, file, func});
return result;
}
// Read full file to std::string
std::string to_string() const
// Read full file to std::basic_string
template <typename T = char>
std::basic_string<T> to_string(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
std::string result;
result.resize(size());
if (seek(0), !read(result)) xfail();
std::basic_string<T> result;
result.resize(size() / sizeof(T));
if (seek(0), !read(result, file, func, line, col)) xfail({line, col, file, func});
return result;
}
// Read full file to std::vector
template<typename T>
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, std::vector<T>> to_vector() const
std::enable_if_t<std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>, std::vector<T>> to_vector(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
std::vector<T> result;
result.resize(size() / sizeof(T));
if (seek(0), !read(result)) xfail();
if (seek(0), !read(result, file, func, line, col)) xfail({line, col, file, func});
return result;
}
@ -375,9 +460,13 @@ namespace fs
native_handle get_handle() const;
// Gathered write
u64 write_gather(const iovec_clone* buffers, u64 buf_count) const
u64 write_gather(const iovec_clone* buffers, u64 buf_count,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_file) xnull();
if (!m_file) xnull({line, col, file, func});
return m_file->write_gather(buffers, buf_count);
}
};
@ -386,8 +475,6 @@ namespace fs
{
std::unique_ptr<dir_base> m_dir;
[[noreturn]] void xnull() const;
public:
dir() = default;
@ -423,16 +510,24 @@ namespace fs
}
// Get next directory entry
bool read(dir_entry& out) const
bool read(dir_entry& out,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_dir) xnull();
if (!m_dir) xnull({line, col, file, func});
return m_dir->read(out);
}
// Reset to the beginning
void rewind() const
void rewind(
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION()) const
{
if (!m_dir) xnull();
if (!m_dir) xnull({line, col, file, func});
return m_dir->rewind();
}
@ -578,7 +673,7 @@ namespace fs
if (old_size + size < old_size)
{
fmt::raw_error("fs::container_stream<>::write(): overflow");
xovfl();
}
if (pos > old_size)

View File

@ -328,7 +328,7 @@ struct MemoryManager1 : llvm::RTDyldMemoryManager
[[noreturn]] static void null()
{
fmt::throw_exception("Null function" HERE);
fmt::throw_exception("Null function");
}
llvm::JITSymbol findSymbol(const std::string& name) override

View File

@ -148,7 +148,7 @@ inline FT build_function_asm(F&& builder)
X86Assembler compiler(&code);
builder(std::ref(compiler), args);
ASSERT(compiler.getLastError() == 0);
ensure(compiler.getLastError() == 0);
FT result;

View File

@ -242,13 +242,32 @@ void fmt_class_string<v128>::format(std::string& out, u64 arg)
fmt::append(out, "0x%016llx%016llx", vec._u64[1], vec._u64[0]);
}
namespace fmt
template <>
void fmt_class_string<src_loc>::format(std::string& out, u64 arg)
{
void raw_error(const char* msg)
const src_loc& loc = get_object(arg);
if (loc.col != umax)
{
thread_ctrl::emergency_exit(msg);
fmt::append(out, "\n(in file %s:%s[:%s]", loc.file, loc.line, loc.col);
}
else
{
fmt::append(out, "\n(in file %s:%s", loc.file, loc.line);
}
if (loc.func && *loc.func)
{
fmt::append(out, ", in function %s)", loc.func);
}
else
{
out += ')';
}
}
namespace fmt
{
void raw_verify_error(const src_loc& loc)
{
std::string out{"Verification failed"};
@ -266,24 +285,7 @@ namespace fmt
}
#endif
if (loc.col != umax)
{
fmt::append(out, "\n(in file %s:%s[:%s]", loc.file, loc.line, loc.col);
}
else
{
fmt::append(out, "\n(in file %s:%s", loc.file, loc.line);
}
if (loc.func && *loc.func)
{
fmt::append(out, ", in function %s)", loc.func);
}
else
{
out += ')';
}
fmt::append(out, "%s", loc);
thread_ctrl::emergency_exit(out);
}
@ -298,31 +300,15 @@ namespace fmt
out += ")";
}
if (loc.col != umax)
{
fmt::append(out, "\n(in file %s:%s[:%s]", loc.file, loc.line, loc.col);
}
else
{
fmt::append(out, "\n(in file %s:%s", loc.file, loc.line);
}
if (loc.func && *loc.func)
{
fmt::append(out, ", in function %s)", loc.func);
}
else
{
out += ')';
}
fmt::append(out, "%s", loc);
thread_ctrl::emergency_exit(out);
}
void raw_throw_exception(const char* fmt, const fmt_type_info* sup, const u64* args)
void raw_throw_exception(const src_loc& loc, const char* fmt, const fmt_type_info* sup, const u64* args)
{
std::string out;
raw_append(out, fmt, sup, args);
fmt::append(out, "%s", loc);
thread_ctrl::emergency_exit(out);
}

View File

@ -289,13 +289,23 @@ namespace fmt
}
// Internal exception message formatting template, must be explicitly specialized or instantiated in cpp to minimize code bloat
[[noreturn]] void raw_throw_exception(const char*, const fmt_type_info*, const u64*);
[[noreturn]] void raw_throw_exception(const src_loc&, const char*, const fmt_type_info*, const u64*);
// Throw exception with formatting
template <typename... Args>
[[noreturn]] SAFE_BUFFERS FORCE_INLINE void throw_exception(const char* fmt, const Args&... args)
template <typename CharT, std::size_t N, typename... Args>
struct throw_exception
{
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
raw_throw_exception(fmt, type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
}
[[noreturn]] SAFE_BUFFERS FORCE_INLINE throw_exception(const CharT(&fmt)[N], const Args&... args,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION())
{
static constexpr fmt_type_info type_list[sizeof...(Args) + 1]{fmt_type_info::make<fmt_unveil_t<Args>>()...};
raw_throw_exception({line, col, file, func}, reinterpret_cast<const char*>(fmt), type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
}
};
template <typename CharT, std::size_t N, typename... Args>
throw_exception(const CharT(&)[N], const Args&...) -> throw_exception<CharT, N, Args...>;
}

View File

@ -91,6 +91,9 @@ thread_local u64 g_tls_wait_fail = 0;
thread_local bool g_tls_access_violation_recovered = false;
extern thread_local std::string(*g_tls_log_prefix)();
// Report error and call std::abort(), defined in main.cpp
[[noreturn]] void report_fatal_error(const std::string&);
template <>
void fmt_class_string<std::thread::id>::format(std::string& out, u64 arg)
{

View File

@ -11,9 +11,6 @@
#include "mutex.h"
#include "lockless.h"
// Report error and call std::abort(), defined in main.cpp
[[noreturn]] void report_fatal_error(const std::string&);
// Hardware core layout
enum class native_core_arrangement : u32
{

View File

@ -92,7 +92,7 @@ namespace utils
void set_length(const u32 new_length)
{
end = start + new_length - 1;
ASSERT(valid());
ensure(valid());
}
u32 next_address() const

View File

@ -524,7 +524,7 @@ bool patch_engine::read_patch_node(patch_info& info, YAML::Node node, const YAML
if (!node)
{
append_log_message(log_messages, fmt::format("Skipping invalid patch node %s. (key: %s)", info.description, info.hash));
patch_log.error("Skipping invalid patch node %s. (key: %s)" HERE, info.description, info.hash);
patch_log.error("Skipping invalid patch node %s. (key: %s)", info.description, info.hash);
return false;
}
@ -600,7 +600,7 @@ static std::size_t apply_modification(const patch_engine::patch_info& patch, u8*
// This patch is out of range for this segment
continue;
}
offset -= ls_addr;
}

View File

@ -34,7 +34,6 @@
#define SAFE_BUFFERS __declspec(safebuffers)
#define NEVER_INLINE __declspec(noinline)
#define FORCE_INLINE __forceinline
#define RESTRICT __restrict
#else // not _MSC_VER
@ -51,7 +50,6 @@
#define SAFE_BUFFERS __attribute__((no_stack_protector))
#define NEVER_INLINE __attribute__((noinline)) inline
#define FORCE_INLINE __attribute__((always_inline)) inline
#define RESTRICT __restrict__
#endif // _MSC_VER
@ -63,25 +61,14 @@
// Variant pattern matching helper
#define MATCH(arg, ...) constexpr(std::is_same_v<std::decay_t<decltype(arg)>, __VA_ARGS__>)
#define CONCATENATE_DETAIL(x, y) x ## y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)
#define STRINGIZE_DETAIL(x) #x ""
#define STRINGIZE(x) STRINGIZE_DETAIL(x)
#define HERE "\n(in file " __FILE__ ":" STRINGIZE(__LINE__) ")"
#define DECLARE(...) decltype(__VA_ARGS__) __VA_ARGS__
#define STR_CASE(...) case __VA_ARGS__: return #__VA_ARGS__
#define ASSERT(...) ((__VA_ARGS__) ? void() : fmt::raw_error("Assertion failed: " STRINGIZE(__VA_ARGS__) HERE))
#if defined(_DEBUG) || defined(_AUDIT)
#define AUDIT(...) ASSERT(__VA_ARGS__)
#define AUDIT(...) (static_cast<void>(ensure(__VA_ARGS__)))
#else
#define AUDIT(...) ((void)0)
#define AUDIT(...) (static_cast<void>(0))
#endif
#if __cpp_lib_bit_cast >= 201806L
@ -777,7 +764,6 @@ struct src_loc
namespace fmt
{
[[noreturn]] void raw_error(const char* msg);
[[noreturn]] void raw_verify_error(const src_loc& loc);
[[noreturn]] void raw_narrow_error(const src_loc& loc, const fmt_type_info* sup, u64 arg);
}

View File

@ -502,7 +502,7 @@ package_error package_reader::check_target_app_version()
const std::string name{ reinterpret_cast<char*>(buf.get()), entry.name_size };
// We're looking for the PARAM.SFO file, if there is any
// We're looking for the PARAM.SFO file, if there is any
if (name != "PARAM.SFO")
{
continue;
@ -872,7 +872,7 @@ void package_reader::archive_seek(const s64 new_offset, const fs::seek_mode damo
u64 package_reader::archive_read(void* data_ptr, const u64 num_bytes)
{
ASSERT(filelist.size() > cur_file && filelist[cur_file]);
ensure(filelist.size() > cur_file && filelist[cur_file]);
const u64 num_bytes_left = filelist[cur_file].size() - cur_file_offset;

View File

@ -339,7 +339,7 @@ namespace cpu_counter
if (slot >= std::size(s_cpu_list))
{
sys_log.fatal("Index out of bounds (%u)." HERE, slot);
sys_log.fatal("Index out of bounds (%u).", slot);
return;
}
@ -771,7 +771,7 @@ void cpu_thread::notify()
}
else
{
fmt::throw_exception("Invalid cpu_thread type" HERE);
fmt::throw_exception("Invalid cpu_thread type");
}
}
@ -788,7 +788,7 @@ void cpu_thread::abort()
}
else
{
fmt::throw_exception("Invalid cpu_thread type" HERE);
fmt::throw_exception("Invalid cpu_thread type");
}
}
@ -805,7 +805,7 @@ std::string cpu_thread::get_name() const
}
else
{
fmt::throw_exception("Invalid cpu_thread type" HERE);
fmt::throw_exception("Invalid cpu_thread type");
}
}
@ -1057,7 +1057,7 @@ void cpu_thread::flush_profilers() noexcept
{
if (!g_fxo->get<cpu_profiler>())
{
profiler.fatal("cpu_thread::flush_profilers() has been called incorrectly." HERE);
profiler.fatal("cpu_thread::flush_profilers() has been called incorrectly.");
return;
}

View File

@ -117,12 +117,12 @@ std::pair<bool, v128> cpu_translator::get_const_vector<v128>(llvm::Value* c, u32
return {true, result};
}
fmt::throw_exception("[0x%x, %u] Not a vector" HERE, a, b);
fmt::throw_exception("[0x%x, %u] Not a vector", a, b);
}
if (auto v = llvm::cast<llvm::VectorType>(t); v->getScalarSizeInBits() * v->getNumElements() != 128)
{
fmt::throw_exception("[0x%x, %u] Bad vector size: i%ux%u" HERE, a, b, v->getScalarSizeInBits(), v->getNumElements());
fmt::throw_exception("[0x%x, %u] Bad vector size: i%ux%u", a, b, v->getScalarSizeInBits(), v->getNumElements());
}
const auto cv = llvm::dyn_cast<llvm::ConstantDataVector>(c);
@ -137,10 +137,10 @@ std::pair<bool, v128> cpu_translator::get_const_vector<v128>(llvm::Value* c, u32
if (llvm::isa<llvm::ConstantExpr>(c))
{
// Sorry, if we cannot evaluate it we cannot use it
fmt::throw_exception("[0x%x, %u] Constant Expression!" HERE, a, b);
fmt::throw_exception("[0x%x, %u] Constant Expression!", a, b);
}
fmt::throw_exception("[0x%x, %u] Unexpected constant type" HERE, a, b);
fmt::throw_exception("[0x%x, %u] Unexpected constant type", a, b);
}
const auto sct = t->getScalarType();
@ -189,7 +189,7 @@ std::pair<bool, v128> cpu_translator::get_const_vector<v128>(llvm::Value* c, u32
}
else
{
fmt::throw_exception("[0x%x, %u] Unexpected vector element type" HERE, a, b);
fmt::throw_exception("[0x%x, %u] Unexpected vector element type", a, b);
}
return {true, result};
@ -233,7 +233,7 @@ llvm::Constant* cpu_translator::make_const_vector<v128>(v128 v, llvm::Type* t)
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const f64*>(v._bytes), 2));
}
fmt::raw_error("No supported constant type" HERE);
fmt::throw_exception("No supported constant type");
}
#endif

View File

@ -338,28 +338,28 @@ public:
}
default:
{
fmt::throw_exception("Unknown type (0x%x)" HERE, type);
fmt::throw_exception("Unknown type (0x%x)", type);
}
}
if (!codec)
{
fmt::throw_exception("avcodec_find_decoder() failed" HERE);
fmt::throw_exception("avcodec_find_decoder() failed");
}
if (!input_format)
{
fmt::throw_exception("av_find_input_format() failed" HERE);
fmt::throw_exception("av_find_input_format() failed");
}
fmt = avformat_alloc_context();
if (!fmt)
{
fmt::throw_exception("avformat_alloc_context() failed" HERE);
fmt::throw_exception("avformat_alloc_context() failed");
}
io_buf = static_cast<u8*>(av_malloc(4096));
fmt->pb = avio_alloc_context(io_buf, 256, 0, this, adecRead, NULL, NULL);
if (!fmt->pb)
{
fmt::throw_exception("avio_alloc_context() failed" HERE);
fmt::throw_exception("avio_alloc_context() failed");
}
}
@ -493,7 +493,7 @@ public:
err = avformat_open_input(&fmt, NULL, input_format, &opts);
if (err || opts)
{
fmt::throw_exception("avformat_open_input() failed (err=0x%x, opts=%d)" HERE, err, opts ? 1 : 0);
fmt::throw_exception("avformat_open_input() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
}
//err = avformat_find_stream_info(fmt, NULL);
//if (err || !fmt->nb_streams)
@ -502,7 +502,7 @@ public:
//}
if (!avformat_new_stream(fmt, codec))
{
fmt::throw_exception("avformat_new_stream() failed" HERE);
fmt::throw_exception("avformat_new_stream() failed");
}
//ctx = fmt->streams[0]->codec; // TODO: check data
@ -515,7 +515,7 @@ public:
}
if (err || opts)
{
fmt::throw_exception("avcodec_open2() failed (err=0x%x, opts=%d)" HERE, err, opts ? 1 : 0);
fmt::throw_exception("avcodec_open2() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
}
just_started = false;
}
@ -559,7 +559,7 @@ public:
if (!frame.data)
{
fmt::throw_exception("av_frame_alloc() failed" HERE);
fmt::throw_exception("av_frame_alloc() failed");
}
int got_frame = 0;
@ -593,7 +593,7 @@ public:
case AV_SAMPLE_FMT_S16P: break;
default:
{
fmt::throw_exception("Unsupported frame format(%d)" HERE, frame.data->format);
fmt::throw_exception("Unsupported frame format(%d)", frame.data->format);
}
}
frame.auAddr = task.au.addr;
@ -625,7 +625,7 @@ public:
default:
{
fmt::throw_exception("Unknown task(%d)" HERE, +task.type);
fmt::throw_exception("Unknown task(%d)", +task.type);
}
}
}
@ -1045,7 +1045,7 @@ error_code cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
}
else
{
fmt::throw_exception("Unsupported frame format (channels=%d, format=%d)" HERE, frame->channels, frame->format);
fmt::throw_exception("Unsupported frame format (channels=%d, format=%d)", frame->channels, frame->format);
}
}

View File

@ -124,7 +124,7 @@ audio_ringbuffer::audio_ringbuffer(cell_audio_config& _cfg)
backend->Open(cfg.num_allocated_buffers);
backend_open = true;
ASSERT(!get_backend_playing());
ensure(!get_backend_playing());
}
audio_ringbuffer::~audio_ringbuffer()
@ -146,7 +146,7 @@ f32 audio_ringbuffer::set_frequency_ratio(f32 new_ratio)
{
if (!has_capability(AudioBackend::SET_FREQUENCY_RATIO))
{
ASSERT(new_ratio == 1.0f);
ensure(new_ratio == 1.0f);
frequency_ratio = 1.0f;
}
else
@ -229,7 +229,7 @@ void audio_ringbuffer::play()
playing = true;
ASSERT(enqueued_samples > 0);
ensure(enqueued_samples > 0);
play_timestamp = get_timestamp();
backend->Play();
@ -1053,7 +1053,7 @@ void cell_audio_thread::mix(float *out_buffer, s32 offset)
}
else
{
fmt::throw_exception("Unknown channel count (port=%u, channel=%d)" HERE, port.number, port.num_channels);
fmt::throw_exception("Unknown channel count (port=%u, channel=%d)", port.number, port.num_channels);
}
}

View File

@ -272,7 +272,7 @@ public:
{
if (!stream.check(14))
{
fmt::throw_exception("End of stream (PACK_START_CODE)" HERE);
fmt::throw_exception("End of stream (PACK_START_CODE)");
}
stream.skip(14);
break;
@ -282,7 +282,7 @@ public:
{
if (!stream.check(18))
{
fmt::throw_exception("End of stream (SYSTEM_HEADER_START_CODE)" HERE);
fmt::throw_exception("End of stream (SYSTEM_HEADER_START_CODE)");
}
stream.skip(18);
break;
@ -292,14 +292,14 @@ public:
{
if (!stream.check(6))
{
fmt::throw_exception("End of stream (PADDING_STREAM)" HERE);
fmt::throw_exception("End of stream (PADDING_STREAM)");
}
stream.skip(4);
stream.get(len);
if (!stream.check(len))
{
fmt::throw_exception("End of stream (PADDING_STREAM, len=%d)" HERE, len);
fmt::throw_exception("End of stream (PADDING_STREAM, len=%d)", len);
}
stream.skip(len);
break;
@ -309,7 +309,7 @@ public:
{
if (!stream.check(6))
{
fmt::throw_exception("End of stream (PRIVATE_STREAM_2)" HERE);
fmt::throw_exception("End of stream (PRIVATE_STREAM_2)");
}
stream.skip(4);
stream.get(len);
@ -318,7 +318,7 @@ public:
if (!stream.check(len))
{
fmt::throw_exception("End of stream (PRIVATE_STREAM_2, len=%d)" HERE, len);
fmt::throw_exception("End of stream (PRIVATE_STREAM_2, len=%d)", len);
}
stream.skip(len);
break;
@ -331,32 +331,32 @@ public:
if (!stream.check(6))
{
fmt::throw_exception("End of stream (PRIVATE_STREAM_1)" HERE);
fmt::throw_exception("End of stream (PRIVATE_STREAM_1)");
}
stream.skip(4);
stream.get(len);
if (!stream.check(len))
{
fmt::throw_exception("End of stream (PRIVATE_STREAM_1, len=%d)" HERE, len);
fmt::throw_exception("End of stream (PRIVATE_STREAM_1, len=%d)", len);
}
const PesHeader pes(stream);
if (!pes.is_ok)
{
fmt::throw_exception("PesHeader error (PRIVATE_STREAM_1, len=%d)" HERE, len);
fmt::throw_exception("PesHeader error (PRIVATE_STREAM_1, len=%d)", len);
}
if (len < pes.size + 4)
{
fmt::throw_exception("End of block (PRIVATE_STREAM_1, PesHeader + fid_minor, len=%d)" HERE, len);
fmt::throw_exception("End of block (PRIVATE_STREAM_1, PesHeader + fid_minor, len=%d)", len);
}
len -= pes.size + 4;
u8 fid_minor;
if (!stream.get(fid_minor))
{
fmt::throw_exception("End of stream (PRIVATE_STREAM1, fid_minor)" HERE);
fmt::throw_exception("End of stream (PRIVATE_STREAM1, fid_minor)");
}
const u32 ch = fid_minor % 16;
@ -372,7 +372,7 @@ public:
if (len < 3 || !stream.check(3))
{
fmt::throw_exception("End of block (ATX, unknown header, len=%d)" HERE, len);
fmt::throw_exception("End of block (ATX, unknown header, len=%d)", len);
}
len -= 3;
stream.skip(3);
@ -394,7 +394,7 @@ public:
if (data[0] != 0x0f || data[1] != 0xd0)
{
fmt::throw_exception("ATX: 0x0fd0 header not found (ats=0x%llx)" HERE, *reinterpret_cast<be_t<u64>*>(data));
fmt::throw_exception("ATX: 0x0fd0 header not found (ats=0x%llx)", *reinterpret_cast<be_t<u64>*>(data));
}
u32 frame_size = (((u32{data[2]} & 0x3) << 8) | u32{data[3]}) * 8 + 8;
@ -432,25 +432,25 @@ public:
if (!stream.check(6))
{
fmt::throw_exception("End of stream (video, code=0x%x)" HERE, code);
fmt::throw_exception("End of stream (video, code=0x%x)", code);
}
stream.skip(4);
stream.get(len);
if (!stream.check(len))
{
fmt::throw_exception("End of stream (video, code=0x%x, len=%d)" HERE, code, len);
fmt::throw_exception("End of stream (video, code=0x%x, len=%d)", code, len);
}
const PesHeader pes(stream);
if (!pes.is_ok)
{
fmt::throw_exception("PesHeader error (video, code=0x%x, len=%d)" HERE, code, len);
fmt::throw_exception("PesHeader error (video, code=0x%x, len=%d)", code, len);
}
if (len < pes.size + 3)
{
fmt::throw_exception("End of block (video, code=0x%x, PesHeader)" HERE, code);
fmt::throw_exception("End of block (video, code=0x%x, PesHeader)", code);
}
len -= pes.size + 3;
@ -504,7 +504,7 @@ public:
{
if ((code & PACKET_START_CODE_MASK) == PACKET_START_CODE_PREFIX)
{
fmt::throw_exception("Unknown code found (0x%x)" HERE, code);
fmt::throw_exception("Unknown code found (0x%x)", code);
}
// search
@ -595,7 +595,7 @@ public:
//}
//else
{
fmt::throw_exception("dmuxEnableEs: unknown filter (0x%x, 0x%x, 0x%x, 0x%x)" HERE, es.fidMajor, es.fidMinor, es.sup1, es.sup2);
fmt::throw_exception("dmuxEnableEs: unknown filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2);
}
es.dmux = this;
break;
@ -606,7 +606,7 @@ public:
ElementaryStream& es = *task.es.es_ptr;
if (es.dmux != this)
{
fmt::throw_exception("dmuxDisableEs: invalid elementary stream" HERE);
fmt::throw_exception("dmuxDisableEs: invalid elementary stream");
}
for (u32 i = 0; i < std::size(esALL); i++)
@ -673,7 +673,7 @@ public:
default:
{
fmt::throw_exception("Demuxer thread error: unknown task (0x%x)" HERE, +task.type);
fmt::throw_exception("Demuxer thread error: unknown task (0x%x)", +task.type);
}
}
}
@ -693,15 +693,15 @@ PesHeader::PesHeader(DemuxerStream& stream)
u16 header;
if (!stream.get(header))
{
fmt::throw_exception("End of stream (header)" HERE);
fmt::throw_exception("End of stream (header)");
}
if (!stream.get(size))
{
fmt::throw_exception("End of stream (size)" HERE);
fmt::throw_exception("End of stream (size)");
}
if (!stream.check(size))
{
fmt::throw_exception("End of stream (size=%d)" HERE, size);
fmt::throw_exception("End of stream (size=%d)", size);
}
u8 pos = 0;
@ -779,7 +779,7 @@ bool ElementaryStream::is_full(u32 space)
u32 first = 0;
if (!entries.peek(first, 0, &dmux->is_closed) || !first)
{
fmt::throw_exception("entries.peek() failed" HERE);
fmt::throw_exception("entries.peek() failed");
}
else if (first >= put)
{

View File

@ -757,7 +757,7 @@ error_code cellGcmGetCurrentDisplayBufferId(vm::ptr<u8> id)
if ((*id = rsx::get_current_renderer()->current_display_buffer) > UINT8_MAX)
{
fmt::throw_exception("Unexpected" HERE);
fmt::throw_exception("Unexpected");
}
return CELL_OK;

View File

@ -203,7 +203,7 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
case microphone_handler::singstar:
case microphone_handler::real_singstar:
// SingStar mic has always 2 channels, each channel represent a physical microphone
ASSERT(num_channels >= 2);
ensure(num_channels >= 2);
if (num_channels > 2)
{
cellMic.error("Tried to open a SingStar-type device with num_channels = %d", num_channels);
@ -211,7 +211,7 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
}
break;
case microphone_handler::rocksmith: num_channels = 1; break;
default: ASSERT(false); break;
default: ensure(false); break;
}
ALCenum num_al_channels;
@ -437,7 +437,7 @@ void microphone_device::get_raw(const u32 num_samples)
}
break;
default: ASSERT(false); break;
default: ensure(false); break;
}
rbuf_raw.write_bytes(tmp_ptr, num_samples * sample_size);
@ -491,7 +491,7 @@ void microphone_device::get_dsp(const u32 num_samples)
}
break;
default: ASSERT(false); break;
default: ensure(false); break;
}
rbuf_dsp.write_bytes(tmp_ptr, num_samples * sample_size);
@ -1009,7 +1009,7 @@ error_code cellMicGetStatus(s32 dev_num, vm::ptr<CellMicStatus> status)
error_code cellMicStopEx()
{
fmt::throw_exception("Unexpected function" HERE);
fmt::throw_exception("Unexpected function");
}
error_code cellMicSysShareClose()

View File

@ -226,7 +226,7 @@ public:
void write_bytes(const u8* buf, const u32 size)
{
ASSERT(size <= S);
ensure(size <= S);
if (u32 over_size = m_used + size; over_size > S)
{

View File

@ -174,7 +174,7 @@ void pngDecError(png_structp png_ptr, png_const_charp error_message)
{
cellPngDec.error("%s", error_message);
// we can't return here or libpng blows up
report_fatal_error("Fatal Error in libpng");
fmt::throw_exception("Fatal Error in libpng: %s", error_message);
}
// Custom warning handler for libpng
@ -337,7 +337,7 @@ error_code pngDecCreate(ppu_thread& ppu, PPHandle png_handle, PThreadInParam thr
// Check if partial image decoding is used
if (extra_thread_out_param)
{
fmt::throw_exception("Partial image decoding is not supported." HERE);
fmt::throw_exception("Partial image decoding is not supported.");
}
// Allocate memory for the decoder handle
@ -411,7 +411,7 @@ error_code pngDecOpen(ppu_thread& ppu, PHandle handle, PPStream png_stream, PSrc
// Check for if the buffer structure allocation failed
if (!buffer)
{
fmt::throw_exception("Memory allocation for the PNG buffer structure failed." HERE);
fmt::throw_exception("Memory allocation for the PNG buffer structure failed.");
}
// We might not be reading from a file stream
@ -426,7 +426,7 @@ error_code pngDecOpen(ppu_thread& ppu, PHandle handle, PPStream png_stream, PSrc
// Need to test it somewhere
if (stream->source.fileOffset != 0)
{
fmt::throw_exception("Non-0 file offset not supported." HERE);
fmt::throw_exception("Non-0 file offset not supported.");
}
// Depending on the source type, get the first 8 bytes
@ -486,7 +486,7 @@ error_code pngDecOpen(ppu_thread& ppu, PHandle handle, PPStream png_stream, PSrc
// Check if the creation of the structure failed
if (!stream->info_ptr)
{
fmt::throw_exception("Creation of png_infop failed." HERE);
fmt::throw_exception("Creation of png_infop failed.");
}
// We must indicate, that we allocated more memory
@ -570,7 +570,7 @@ error_code pngDecSetParameter(PStream stream, PInParam in_param, POutParam out_p
{
if (in_param->outputPackFlag == CELL_PNGDEC_1BYTE_PER_NPIXEL)
{
fmt::throw_exception("Packing not supported! (%d)" HERE, in_param->outputPackFlag);
fmt::throw_exception("Packing not supported! (%d)", in_param->outputPackFlag);
}
// flag to keep unknown chunks
@ -703,7 +703,7 @@ error_code pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::pt
// Log this for now
if (bytes_per_line < stream->out_param.outputWidthByte)
{
fmt::throw_exception("Bytes per line less than expected output! Got: %d, expected: %d" HERE, bytes_per_line, stream->out_param.outputWidthByte);
fmt::throw_exception("Bytes per line less than expected output! Got: %d, expected: %d", bytes_per_line, stream->out_param.outputWidthByte);
}
// partial decoding

View File

@ -325,7 +325,7 @@ static s32 getPngDecColourType(u8 type)
case PNG_COLOR_TYPE_PALETTE: return CELL_PNGDEC_PALETTE;
case PNG_COLOR_TYPE_GRAY: return CELL_PNGDEC_GRAYSCALE;
case PNG_COLOR_TYPE_GRAY_ALPHA: return CELL_PNGDEC_GRAYSCALE_ALPHA;
default: fmt::throw_exception("Unknown colour type: %d" HERE, type);
default: fmt::throw_exception("Unknown colour type: %d", type);
}
}

View File

@ -95,7 +95,7 @@ error_code cellRudpInit(vm::ptr<CellRudpAllocator> allocator)
{
if (!vm::dealloc(ptr.addr(), vm::main))
{
fmt::throw_exception("Memory deallocation failed (ptr=0x%x)" HERE, ptr);
fmt::throw_exception("Memory deallocation failed (ptr=0x%x)", ptr);
}
};
}

View File

@ -489,22 +489,22 @@ error_code cellSailSourceNotifyMediaStateChanged()
error_code cellSailSourceNotifyOpenCompleted()
{
fmt::throw_exception("Unexpected function" HERE);
fmt::throw_exception("Unexpected function");
}
error_code cellSailSourceNotifyStartCompleted()
{
fmt::throw_exception("Unexpected function" HERE);
fmt::throw_exception("Unexpected function");
}
error_code cellSailSourceNotifyStopCompleted()
{
fmt::throw_exception("Unexpected function" HERE);
fmt::throw_exception("Unexpected function");
}
error_code cellSailSourceNotifyReadCompleted()
{
fmt::throw_exception("Unexpected function" HERE);
fmt::throw_exception("Unexpected function");
}
error_code cellSailSourceSetDiagHandler()
@ -515,7 +515,7 @@ error_code cellSailSourceSetDiagHandler()
error_code cellSailSourceNotifyCloseCompleted()
{
fmt::throw_exception("Unexpected function" HERE);
fmt::throw_exception("Unexpected function");
}
error_code cellSailMp4MovieGetBrand()

View File

@ -1220,7 +1220,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
}
else
{
fmt::throw_exception("Invalid savedata selected" HERE);
fmt::throw_exception("Invalid savedata selected");
}
}
}

View File

@ -613,13 +613,13 @@ s32 _spurs::detach_lv2_eq(vm::ptr<CellSpurs> spurs, u8 spuPort, bool spursCreate
void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
{
ASSERT(ppu_execute<&sys_lwmutex_lock>(ppu, spurs.ptr(&CellSpurs::mutex), 0) == 0);
ensure(ppu_execute<&sys_lwmutex_lock>(ppu, spurs.ptr(&CellSpurs::mutex), 0) == 0);
while (true)
{
if (spurs->handlerExiting)
{
ASSERT(ppu_execute<&sys_lwmutex_unlock>(ppu, spurs.ptr(&CellSpurs::mutex)) == 0);
ensure(ppu_execute<&sys_lwmutex_unlock>(ppu, spurs.ptr(&CellSpurs::mutex)) == 0);
return sys_ppu_thread_exit(ppu, 0);
}
@ -676,14 +676,14 @@ void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
spurs->handlerWaiting = 1;
if (spurs->handlerDirty == 0)
{
ASSERT(ppu_execute<&sys_lwcond_wait>(ppu, spurs.ptr(&CellSpurs::cond), 0) == 0);
ensure(ppu_execute<&sys_lwcond_wait>(ppu, spurs.ptr(&CellSpurs::cond), 0) == 0);
}
spurs->handlerWaiting = 0;
}
// If we reach here then a runnable workload was found
ASSERT(ppu_execute<&sys_lwmutex_unlock>(ppu, spurs.ptr(&CellSpurs::mutex)) == 0);
ensure(ppu_execute<&sys_lwmutex_unlock>(ppu, spurs.ptr(&CellSpurs::mutex)) == 0);
}
void _spurs::handler_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
@ -700,7 +700,7 @@ void _spurs::handler_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
_spurs::handler_wait_ready(ppu, spurs);
}
ASSERT(sys_spu_thread_group_start(ppu, spurs->spuTG) == 0);
ensure(sys_spu_thread_group_start(ppu, spurs->spuTG) == 0);
if (s32 rc = sys_spu_thread_group_join(ppu, spurs->spuTG, vm::null, vm::null); rc + 0u != CELL_EFAULT)
{
@ -709,7 +709,7 @@ void _spurs::handler_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
return sys_ppu_thread_exit(ppu, 0);
}
ASSERT(rc + 0u == CELL_EFAULT);
ensure(rc + 0u == CELL_EFAULT);
}
if ((spurs->flags1 & SF1_EXIT_IF_NO_WORK) == 0)
@ -813,7 +813,7 @@ void _spurs::event_helper_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
while (true)
{
ASSERT(sys_event_queue_receive(ppu, spurs->eventQueue, vm::null, 0) == 0);
ensure(sys_event_queue_receive(ppu, spurs->eventQueue, vm::null, 0) == 0);
const u64 event_src = ppu.gpr[4];
const u64 event_data1 = ppu.gpr[5];
@ -862,26 +862,26 @@ void _spurs::event_helper_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
{
if (shutdownMask & (0x80000000u >> wid))
{
ASSERT(_spurs::wakeup_shutdown_completion_waiter(ppu, spurs, wid) == 0);
ensure(_spurs::wakeup_shutdown_completion_waiter(ppu, spurs, wid) == 0);
}
if ((spurs->flags1 & SF1_32_WORKLOADS) && (shutdownMask & (0x8000 >> wid)))
{
ASSERT(_spurs::wakeup_shutdown_completion_waiter(ppu, spurs, wid + 0x10) == 0);
ensure(_spurs::wakeup_shutdown_completion_waiter(ppu, spurs, wid + 0x10) == 0);
}
}
}
else if (data0 == 2)
{
ASSERT(sys_semaphore_post(ppu, static_cast<u32>(spurs->semPrv), 1) == 0);
ensure(sys_semaphore_post(ppu, static_cast<u32>(spurs->semPrv), 1) == 0);
}
else if (data0 == 3)
{
ASSERT(_spurs::invoke_event_handlers(ppu, spurs.ptr(&CellSpurs::eventPortMux)) == 0);
ensure(_spurs::invoke_event_handlers(ppu, spurs.ptr(&CellSpurs::eventPortMux)) == 0);
}
else
{
fmt::throw_exception("data0=0x%x" HERE, data0);
fmt::throw_exception("data0=0x%x", data0);
}
}
}
@ -971,7 +971,7 @@ s32 _spurs::finalize_spu(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
{
while (true)
{
ASSERT(sys_spu_thread_group_join(ppu, spurs->spuTG, vm::null, vm::null) + 0u == CELL_EFAULT);
ensure(sys_spu_thread_group_join(ppu, spurs->spuTG, vm::null, vm::null) + 0u == CELL_EFAULT);
if (s32 rc = sys_spu_thread_group_destroy(ppu, spurs->spuTG))
{
@ -980,7 +980,7 @@ s32 _spurs::finalize_spu(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
continue;
}
ASSERT(rc == CELL_OK);
ensure(rc == CELL_OK);
}
break;
@ -994,7 +994,7 @@ s32 _spurs::finalize_spu(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
}
}
ASSERT(ppu_execute<&sys_spu_image_close>(ppu, spurs.ptr(&CellSpurs::spuImg)) == 0);
ensure(ppu_execute<&sys_spu_image_close>(ppu, spurs.ptr(&CellSpurs::spuImg)) == 0);
return CELL_OK;
}
@ -1018,19 +1018,19 @@ s32 _spurs::stop_event_helper(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
spurs->ppu1 = 0xFFFFFFFF;
ASSERT(sys_event_port_disconnect(ppu, spurs->eventPort) == 0);
ASSERT(sys_event_port_destroy(ppu, spurs->eventPort) == 0);
ASSERT(_spurs::detach_lv2_eq(spurs, spurs->spuPort, true) == 0);
ASSERT(sys_event_queue_destroy(ppu, spurs->eventQueue, SYS_EVENT_QUEUE_DESTROY_FORCE) == 0);
ensure(sys_event_port_disconnect(ppu, spurs->eventPort) == 0);
ensure(sys_event_port_destroy(ppu, spurs->eventPort) == 0);
ensure(_spurs::detach_lv2_eq(spurs, spurs->spuPort, true) == 0);
ensure(sys_event_queue_destroy(ppu, spurs->eventQueue, SYS_EVENT_QUEUE_DESTROY_FORCE) == 0);
return CELL_OK;
}
s32 _spurs::signal_to_handler_thread(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
{
ASSERT(ppu_execute<&sys_lwmutex_lock>(ppu, spurs.ptr(&CellSpurs::mutex), 0) == 0);
ASSERT(ppu_execute<&sys_lwcond_signal>(ppu, spurs.ptr(&CellSpurs::cond)) == 0);
ASSERT(ppu_execute<&sys_lwmutex_unlock>(ppu, spurs.ptr(&CellSpurs::mutex)) == 0);
ensure(ppu_execute<&sys_lwmutex_lock>(ppu, spurs.ptr(&CellSpurs::mutex), 0) == 0);
ensure(ppu_execute<&sys_lwcond_signal>(ppu, spurs.ptr(&CellSpurs::cond)) == 0);
ensure(ppu_execute<&sys_lwmutex_unlock>(ppu, spurs.ptr(&CellSpurs::mutex)) == 0);
return CELL_OK;
}
@ -1042,7 +1042,7 @@ s32 _spurs::join_handler_thread(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
return CELL_SPURS_CORE_ERROR_STAT;
}
ASSERT(sys_ppu_thread_join(ppu, static_cast<u32>(spurs->ppu0), vm::var<u64>{}) == 0);
ensure(sys_ppu_thread_join(ppu, static_cast<u32>(spurs->ppu0), vm::var<u64>{}) == 0);
spurs->ppu0 = 0xFFFFFFFF;
return CELL_OK;
@ -1328,7 +1328,7 @@ s32 _spurs::initialize(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 revision,
// Enable the default system workload if required
if (flags & SAF_SYSTEM_WORKLOAD_ENABLED)
{
ASSERT(_spurs::add_default_syswkl(spurs, swlPriority, swlMaxSpu, swlIsPreem) == 0);
ensure(_spurs::add_default_syswkl(spurs, swlPriority, swlMaxSpu, swlIsPreem) == 0);
return CELL_OK;
}
else if (flags & SAF_EXIT_IF_NO_WORK)
@ -1965,7 +1965,7 @@ s32 cellSpursGetInfo(vm::ptr<CellSpurs> spurs, vm::ptr<CellSpursInfo> info)
info->spursHandlerThread1 = spurs->ppu1;
info->traceBufferSize = spurs->traceDataSize;
const auto trace_addr = vm::cast(spurs->traceBuffer.addr(), HERE);
const auto trace_addr = vm::cast(spurs->traceBuffer.addr());
info->traceBuffer = vm::addr_t{trace_addr & ~3};
info->traceMode = trace_addr & 3;
@ -2018,7 +2018,7 @@ void _spurs::trace_status_update(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
if (init)
{
spurs->sysSrvMessage = 0xff;
ASSERT(sys_semaphore_wait(ppu, static_cast<u32>(spurs->semPrv), 0) == 0);
ensure(sys_semaphore_wait(ppu, static_cast<u32>(spurs->semPrv), 0) == 0);
}
}
@ -3257,7 +3257,7 @@ s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr<CellSpursEventFlag> eventFlag
// Signal the PPU thread to be woken up
eventFlag->pendingRecvTaskEvents[ppuWaitSlot] = ppuEvents;
ASSERT(sys_event_port_send(eventFlag->eventPortId, 0, 0, 0) == 0);
ensure(sys_event_port_send(eventFlag->eventPortId, 0, 0, 0) == 0);
}
if (pendingRecv)
@ -3271,11 +3271,11 @@ s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr<CellSpursEventFlag> eventFlag
vm::var<vm::ptr<CellSpursTaskset>> taskset;
if (eventFlag->isIwl)
{
cellSpursLookUpTasksetAddress(ppu, vm::cast(eventFlag->addr, HERE), taskset, eventFlag->waitingTaskWklId[i]);
cellSpursLookUpTasksetAddress(ppu, vm::cast(eventFlag->addr), taskset, eventFlag->waitingTaskWklId[i]);
}
else
{
*taskset = vm::cast(eventFlag->addr, HERE);
*taskset = vm::cast(eventFlag->addr);
}
auto rc = _cellSpursSendSignal(ppu, *taskset, eventFlag->waitingTaskId[i]);
@ -3284,7 +3284,7 @@ s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr<CellSpursEventFlag> eventFlag
return CELL_SPURS_TASK_ERROR_FATAL;
}
ASSERT(rc == CELL_OK);
ensure(rc == CELL_OK);
}
}
}
@ -3430,7 +3430,7 @@ s32 _spurs::event_flag_wait(ppu_thread& ppu, vm::ptr<CellSpursEventFlag> eventFl
if (recv)
{
// Block till something happens
ASSERT(sys_event_queue_receive(ppu, eventFlag->eventQueueId, vm::null, 0) == 0);
ensure(sys_event_queue_receive(ppu, eventFlag->eventQueueId, vm::null, 0) == 0);
s32 i = 0;
if (eventFlag->direction == CELL_SPURS_EVENT_FLAG_ANY2ANY)
@ -3490,11 +3490,11 @@ s32 cellSpursEventFlagAttachLv2EventQueue(ppu_thread& ppu, vm::ptr<CellSpursEven
vm::ptr<CellSpurs> spurs;
if (eventFlag->isIwl == 1)
{
spurs = vm::cast(eventFlag->addr, HERE);
spurs = vm::cast(eventFlag->addr);
}
else
{
auto taskset = vm::ptr<CellSpursTaskset>::make(vm::cast(eventFlag->addr, HERE));
auto taskset = vm::ptr<CellSpursTaskset>::make(vm::cast(eventFlag->addr));
spurs = taskset->spurs;
}
@ -3583,11 +3583,11 @@ s32 cellSpursEventFlagDetachLv2EventQueue(ppu_thread& ppu, vm::ptr<CellSpursEven
vm::ptr<CellSpurs> spurs;
if (eventFlag->isIwl == 1)
{
spurs = vm::cast(eventFlag->addr, HERE);
spurs = vm::cast(eventFlag->addr);
}
else
{
auto taskset = vm::ptr<CellSpursTaskset>::make(vm::cast(eventFlag->addr, HERE));
auto taskset = vm::ptr<CellSpursTaskset>::make(vm::cast(eventFlag->addr));
spurs = taskset->spurs;
}
@ -3660,7 +3660,7 @@ s32 cellSpursEventFlagGetTasksetAddress(vm::ptr<CellSpursEventFlag> eventFlag, v
return CELL_SPURS_TASK_ERROR_ALIGN;
}
taskset->set(eventFlag->isIwl ? 0u : vm::cast(eventFlag->addr, HERE));
taskset->set(eventFlag->isIwl ? 0u : vm::cast(eventFlag->addr));
return CELL_OK;
}
@ -4022,7 +4022,7 @@ s32 _spurs::task_start(ppu_thread& ppu, vm::ptr<CellSpursTaskset> taskset, u32 t
}
else
{
ASSERT(rc == CELL_OK);
ensure(rc == CELL_OK);
}
}
@ -4411,7 +4411,7 @@ s32 cellSpursLookUpTasksetAddress(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, vm:
return rc ^ 0x100;
}
*taskset = vm::cast(*data, HERE);
*taskset = vm::cast(*data);
return CELL_OK;
}
@ -4434,7 +4434,7 @@ s32 cellSpursTasksetGetSpursAddress(vm::cptr<CellSpursTaskset> taskset, vm::ptr<
return CELL_SPURS_TASK_ERROR_INVAL;
}
*spurs = vm::cast(taskset->spurs.addr(), HERE);
*spurs = vm::cast(taskset->spurs.addr());
return CELL_OK;
}

View File

@ -268,7 +268,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu)
u32 wklSelectedId;
u32 pollStatus;
//vm::reservation_op(vm::cast(ctxt->spurs.addr(), HERE), 128, [&]()
//vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]()
{
// lock the first 0x80 bytes of spurs
auto spurs = ctxt->spurs.get_ptr();
@ -452,7 +452,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu)
u32 wklSelectedId;
u32 pollStatus;
//vm::reservation_op(vm::cast(ctxt->spurs.addr(), HERE), 128, [&]()
//vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]()
{
// lock the first 0x80 bytes of spurs
auto spurs = ctxt->spurs.get_ptr();
@ -767,7 +767,7 @@ void spursSysServiceIdleHandler(spu_thread& spu, SpursKernelContext* ctxt)
while (true)
{
const auto spurs = spu._ptr<CellSpurs>(0x100);
//vm::reservation_acquire(spurs, vm::cast(ctxt->spurs.addr(), HERE), 128);
//vm::reservation_acquire(spurs, vm::cast(ctxt->spurs.addr()), 128);
// Find the number of SPUs that are idling in this SPURS instance
u32 nIdlingSpus = 0;
@ -855,7 +855,7 @@ void spursSysServiceIdleHandler(spu_thread& spu, SpursKernelContext* ctxt)
continue;
}
//if (vm::reservation_update(vm::cast(ctxt->spurs.addr(), HERE), spu._ptr<void>(0x100), 128) && (shouldExit || foundReadyWorkload))
//if (vm::reservation_update(vm::cast(ctxt->spurs.addr()), spu._ptr<void>(0x100), 128) && (shouldExit || foundReadyWorkload))
{
break;
}
@ -883,7 +883,7 @@ void spursSysServiceMain(spu_thread& spu, u32 pollStatus)
{
ctxt->sysSrvInitialised = 1;
//vm::reservation_acquire(ctxt, vm::cast(ctxt->spurs.addr(), HERE), 128);
//vm::reservation_acquire(ctxt, vm::cast(ctxt->spurs.addr()), 128);
//vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]()
{
@ -975,7 +975,7 @@ void spursSysServiceProcessRequests(spu_thread& spu, SpursKernelContext* ctxt)
bool updateWorkload = false;
bool terminate = false;
//vm::reservation_op(vm::cast(ctxt->spurs.addr() + OFFSET_32(CellSpurs, wklState1), HERE), 128, [&]()
//vm::reservation_op(vm::cast(ctxt->spurs.addr() + OFFSET_32(CellSpurs, wklState1)), 128, [&]()
{
auto spurs = ctxt->spurs.get_ptr();
@ -1217,7 +1217,7 @@ void spursSysServiceTraceUpdate(spu_thread& spu, SpursKernelContext* ctxt, u32 a
else
{
const auto traceBuffer = spu._ptr<CellSpursTraceInfo>(0x2C00);
std::memcpy(traceBuffer, vm::base(vm::cast(spurs->traceBuffer.addr(), HERE) & -0x4), 0x80);
std::memcpy(traceBuffer, vm::base(vm::cast(spurs->traceBuffer.addr()) & -0x4), 0x80);
ctxt->traceMsgCount = traceBuffer->count[ctxt->spuNum];
}
@ -1263,7 +1263,7 @@ void spursSysServiceCleanupAfterSystemWorkload(spu_thread& spu, SpursKernelConte
spursSysServiceActivateWorkload(spu, ctxt);
//vm::reservation_op(vm::cast(ctxt->spurs.addr(), HERE), 128, [&]()
//vm::reservation_op(vm::cast(ctxt->spurs.addr()), 128, [&]()
{
auto spurs = ctxt->spurs.get_ptr();
@ -1364,7 +1364,7 @@ bool spursTasksetSyscallEntry(spu_thread& spu)
spu.gpr[3]._u32[3] = spursTasksetProcessSyscall(spu, spu.gpr[3]._u32[3], spu.gpr[4]._u32[3]);
// Resume the previously executing task if the syscall did not cause a context switch
fmt::throw_exception("Broken (TODO)" HERE);
fmt::throw_exception("Broken (TODO)");
//if (spu.m_is_branch == false) {
// spursTasksetResumeTask(spu);
//}
@ -1416,7 +1416,7 @@ s32 spursTasksetProcessRequest(spu_thread& spu, s32 request, u32* taskId, u32* i
s32 rc = CELL_OK;
s32 numNewlyReadyTasks = 0;
//vm::reservation_op(vm::cast(ctxt->taskset.addr(), HERE), 128, [&]()
//vm::reservation_op(vm::cast(ctxt->taskset.addr()), 128, [&]()
{
auto taskset = ctxt->taskset;
v128 waiting = vm::_ref<v128>(ctxt->taskset.addr() + ::offset32(&CellSpursTaskset::waiting));
@ -1720,7 +1720,7 @@ s32 spursTasketSaveTaskContext(spu_thread& spu)
ctxt->savedWriteTagGroupQueryMask = static_cast<u32>(spu.get_ch_value(MFC_RdTagMask));
// Store the processor context
const u32 contextSaveStorage = vm::cast(taskInfo->context_save_storage_and_alloc_ls_blocks & -0x80, HERE);
const u32 contextSaveStorage = vm::cast(taskInfo->context_save_storage_and_alloc_ls_blocks & -0x80);
std::memcpy(vm::base(contextSaveStorage), spu._ptr<void>(0x2C80), 0x380);
// Save LS context
@ -1830,7 +1830,7 @@ void spursTasksetDispatch(spu_thread& spu)
}
// Load saved context from main memory to LS
const u32 contextSaveStorage = vm::cast(taskInfo->context_save_storage_and_alloc_ls_blocks & -0x80, HERE);
const u32 contextSaveStorage = vm::cast(taskInfo->context_save_storage_and_alloc_ls_blocks & -0x80);
std::memcpy(spu._ptr<void>(0x2C80), vm::base(contextSaveStorage), 0x380);
for (auto i = 6; i < 128; i++)
{
@ -2002,7 +2002,7 @@ s32 spursTasksetLoadElf(spu_thread& spu, u32* entryPoint, u32* lowestLoadAddr, u
return CELL_SPURS_TASK_ERROR_INVAL;
}
const spu_exec_object obj(fs::file(vm::base(vm::cast(elfAddr, HERE)), u32(0 - elfAddr)));
const spu_exec_object obj(fs::file(vm::base(vm::cast(elfAddr)), u32(0 - elfAddr)));
if (obj != elf_error::ok)
{

View File

@ -1088,7 +1088,7 @@ error_code _cellSyncLFQueueCompletePushPointer(ppu_thread& ppu, vm::ptr<CellSync
{
ensure((queue->push3.compare_and_swap_test(old2, push3)));
ensure((fpSendSignal));
return not_an_error(fpSendSignal(ppu, vm::cast(queue->m_eaSignal.addr(), HERE), var6));
return not_an_error(fpSendSignal(ppu, vm::cast(queue->m_eaSignal.addr()), var6));
}
else
{
@ -1159,7 +1159,7 @@ error_code _cellSyncLFQueuePushBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> qu
const s32 depth = queue->m_depth;
const s32 size = queue->m_size;
const s32 pos = *position;
const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1ull) + size * (pos >= depth ? pos - depth : pos), HERE);
const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1ull) + size * (pos >= depth ? pos - depth : pos));
std::memcpy(vm::base(addr), buffer.get_ptr(), size);
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
@ -1388,7 +1388,7 @@ error_code _cellSyncLFQueueCompletePopPointer(ppu_thread& ppu, vm::ptr<CellSyncL
{
ensure((queue->pop3.compare_and_swap_test(old2, pop3)));
ensure((fpSendSignal));
return not_an_error(fpSendSignal(ppu, vm::cast(queue->m_eaSignal.addr(), HERE), var6));
return not_an_error(fpSendSignal(ppu, vm::cast(queue->m_eaSignal.addr()), var6));
}
else
{
@ -1459,7 +1459,7 @@ error_code _cellSyncLFQueuePopBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> que
const s32 depth = queue->m_depth;
const s32 size = queue->m_size;
const s32 pos = *position;
const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1) + size * (pos >= depth ? pos - depth : pos), HERE);
const u32 addr = vm::cast<u64>((queue->m_buffer.addr() & ~1) + size * (pos >= depth ? pos - depth : pos));
std::memcpy(buffer.get_ptr(), vm::base(addr), size);
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)

View File

@ -194,7 +194,7 @@ struct alignas(32) CellSyncQueue
if (data.next > depth || data.count > depth)
{
fmt::throw_exception("Invalid queue pointers" HERE);
fmt::throw_exception("Invalid queue pointers");
}
return depth;

View File

@ -164,20 +164,20 @@ struct vdec_context final
}
default:
{
fmt::throw_exception("Unknown video decoder type (0x%x)" HERE, type);
fmt::throw_exception("Unknown video decoder type (0x%x)", type);
}
}
if (!codec)
{
fmt::throw_exception("avcodec_find_decoder() failed (type=0x%x)" HERE, type);
fmt::throw_exception("avcodec_find_decoder() failed (type=0x%x)", type);
}
ctx = avcodec_alloc_context3(codec);
if (!ctx)
{
fmt::throw_exception("avcodec_alloc_context3() failed (type=0x%x)" HERE, type);
fmt::throw_exception("avcodec_alloc_context3() failed (type=0x%x)", type);
}
AVDictionary* opts{};
@ -189,7 +189,7 @@ struct vdec_context final
if (err || opts)
{
avcodec_free_context(&ctx);
fmt::throw_exception("avcodec_open2() failed (err=0x%x, opts=%d)" HERE, err, opts ? 1 : 0);
fmt::throw_exception("avcodec_open2() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
}
}
@ -275,7 +275,7 @@ struct vdec_context final
{
char av_error[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret);
fmt::throw_exception("AU queuing error(0x%x): %s" HERE, ret, av_error);
fmt::throw_exception("AU queuing error(0x%x): %s", ret, av_error);
}
while (true)
@ -286,7 +286,7 @@ struct vdec_context final
if (!frame.avf)
{
fmt::throw_exception("av_frame_alloc() failed" HERE);
fmt::throw_exception("av_frame_alloc() failed");
}
if (int ret = avcodec_receive_frame(ctx, frame.avf.get()); ret < 0)
@ -299,7 +299,7 @@ struct vdec_context final
{
char av_error[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret);
fmt::throw_exception("AU decoding error(0x%x): %s" HERE, ret, av_error);
fmt::throw_exception("AU decoding error(0x%x): %s", ret, av_error);
}
}
@ -344,7 +344,7 @@ struct vdec_context final
case CELL_VDEC_FRC_60: amend = 90000 / 60; break;
default:
{
fmt::throw_exception("Invalid frame rate code set (0x%x)" HERE, frc_set);
fmt::throw_exception("Invalid frame rate code set (0x%x)", frc_set);
}
}
@ -834,7 +834,7 @@ error_code cellVdecGetPicture(u32 handle, vm::cptr<CellVdecPicFormat> format, vm
default:
{
fmt::throw_exception("Unknown formatType (%d)" HERE, type);
fmt::throw_exception("Unknown formatType (%d)", type);
}
}
@ -857,7 +857,7 @@ error_code cellVdecGetPicture(u32 handle, vm::cptr<CellVdecPicFormat> format, vm
break;
default:
{
fmt::throw_exception("Unknown format (%d)" HERE, frame->format);
fmt::throw_exception("Unknown format (%d)", frame->format);
}
}
@ -899,7 +899,7 @@ error_code cellVdecGetPictureExt(u32 handle, vm::cptr<CellVdecPicFormat2> format
if (arg4 || format2->unk0 || format2->unk1)
{
fmt::throw_exception("Unknown arguments (arg4=*0x%x, unk0=0x%x, unk1=0x%x)" HERE, arg4, format2->unk0, format2->unk1);
fmt::throw_exception("Unknown arguments (arg4=*0x%x, unk0=0x%x, unk1=0x%x)", arg4, format2->unk0, format2->unk1);
}
vm::var<CellVdecPicFormat> format;

View File

@ -183,7 +183,7 @@ error_code cellVoiceCreatePort(vm::ptr<u32> portId, vm::cptr<CellVoicePortParam>
}
}
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
error_code cellVoiceDeletePort(u32 portId)

View File

@ -536,7 +536,7 @@ s32 cellSurMixerSetNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction> fu
if (g_surmx.cb)
{
fmt::throw_exception("Callback already set" HERE);
fmt::throw_exception("Callback already set");
}
g_surmx.cb = func;
@ -551,7 +551,7 @@ s32 cellSurMixerRemoveNotifyCallback(vm::ptr<CellSurMixerNotifyCallbackFunction>
if (g_surmx.cb != func)
{
fmt::throw_exception("Callback not set" HERE);
fmt::throw_exception("Callback not set");
}
g_surmx.cb = vm::null;
@ -670,19 +670,19 @@ void cellSurMixerBeep(u32 arg)
f32 cellSurMixerUtilGetLevelFromDB(f32 dB)
{
libmixer.todo("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB);
fmt::throw_exception("TODO" HERE);
fmt::throw_exception("TODO");
}
f32 cellSurMixerUtilGetLevelFromDBIndex(s32 index)
{
libmixer.todo("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index);
fmt::throw_exception("TODO" HERE);
fmt::throw_exception("TODO");
}
f32 cellSurMixerUtilNoteToRatio(u8 refNote, u8 note)
{
libmixer.todo("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note);
fmt::throw_exception("TODO" HERE);
fmt::throw_exception("TODO");
}
DECLARE(ppu_module_manager::libmixer)("libmixer", []()

View File

@ -141,7 +141,7 @@ error_code cellSysconfPs1emu_EFDDAF6C()
error_code sys_lv2coredump_D725F320()
{
fmt::raw_error(__func__);
fmt::throw_exception("Unknown, unimplemented.");
}
error_code sys_crash_dump_get_user_log_area(u8 index, vm::ptr<sys_crash_dump_log_area_info_t> entry)

View File

@ -329,7 +329,7 @@ error_code sys_lwcond_wait(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u64 ti
if (old == lwmutex_free || old == lwmutex_dead)
{
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)" HERE, lwmutex, old);
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old);
}
return res;
@ -361,13 +361,13 @@ error_code sys_lwcond_wait(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u64 ti
if (old == lwmutex_free || old == lwmutex_dead)
{
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)" HERE, lwmutex, old);
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old);
}
return not_an_error(CELL_ETIMEDOUT);
}
fmt::throw_exception("Unexpected syscall result (lwcond=*0x%x, result=0x%x)" HERE, lwcond, +res);
fmt::throw_exception("Unexpected syscall result (lwcond=*0x%x, result=0x%x)", lwcond, +res);
}
void sysPrxForUser_sys_lwcond_init()

View File

@ -179,7 +179,7 @@ error_code sys_lwmutex_lock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex, u64
if (old != lwmutex_reserved)
{
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)" HERE, lwmutex, old);
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old);
}
return CELL_OK;
@ -309,7 +309,7 @@ error_code sys_lwmutex_trylock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex)
if (old != lwmutex_reserved)
{
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)" HERE, lwmutex, old);
fmt::throw_exception("Locking failed (lwmutex=*0x%x, owner=0x%x)", lwmutex, old);
}
}

View File

@ -185,7 +185,7 @@ void sys_ppu_thread_exit(ppu_thread& ppu, u64 val)
ensure(!sys_lwmutex_unlock(ppu, g_ppu_atexit_lwm));
// Deallocate TLS
ppu_free_tls(vm::cast(ppu.gpr[13], HERE) - 0x7030);
ppu_free_tls(vm::cast(ppu.gpr[13]) - 0x7030);
// Call the syscall
_sys_ppu_thread_exit(ppu, val);
@ -265,7 +265,7 @@ error_code sys_interrupt_thread_disestablish(ppu_thread& ppu, u32 ih)
}
// Deallocate TLS
ppu_free_tls(vm::cast(*r13, HERE) - 0x7030);
ppu_free_tls(vm::cast(*r13) - 0x7030);
return CELL_OK;
}

View File

@ -1530,7 +1530,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
void ppu_acontext::UNK(ppu_opcode_t op)
{
std::fill_n(gpr, 32, spec_gpr{});
ppu_log.error("Unknown/Illegal opcode: 0x%08x at 0x%x" HERE, op.opcode, cia);
ppu_log.error("Unknown/Illegal opcode: 0x%08x at 0x%x", op.opcode, cia);
}
void ppu_acontext::MFVSCR(ppu_opcode_t op)

View File

@ -181,7 +181,7 @@ namespace vm
template<typename AT, typename RT, typename... T>
FORCE_INLINE RT _ptr_base<RT(T...), AT>::operator()(ppu_thread& CPU, T... args) const
{
const auto data = vm::_ptr<ppu_func_opd_t>(vm::cast(m_addr, HERE));
const auto data = vm::_ptr<ppu_func_opd_t>(vm::cast(m_addr));
const u32 pc = data->addr;
const u32 rtoc = data->rtoc;
@ -191,7 +191,7 @@ namespace vm
template<typename AT, typename RT, typename... T>
FORCE_INLINE const ppu_func_opd_t& _ptr_base<RT(T...), AT>::opd() const
{
return vm::_ref<ppu_func_opd_t>(vm::cast(m_addr, HERE));
return vm::_ref<ppu_func_opd_t>(vm::cast(m_addr));
}
}

View File

@ -87,7 +87,7 @@ FORCE_INLINE auto ppu_feed_data(ppu_thread& ppu, u64 addr)
{
static_assert(sizeof(T) <= 128, "Incompatible type-size, break down into smaller loads");
auto value = vm::_ref<T>(vm::cast(addr, HERE));
auto value = vm::_ref<T>(vm::cast(addr));
if (!ppu.use_full_rdata)
{
@ -3421,7 +3421,7 @@ bool ppu_interpreter::MFOCRF(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::LWARX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
ppu.gpr[op.rd] = ppu_lwarx(ppu, vm::cast(addr, HERE));
ppu.gpr[op.rd] = ppu_lwarx(ppu, vm::cast(addr));
return true;
}
@ -3580,7 +3580,7 @@ bool ppu_interpreter::MULHW(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::LDARX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
ppu.gpr[op.rd] = ppu_ldarx(ppu, vm::cast(addr, HERE));
ppu.gpr[op.rd] = ppu_ldarx(ppu, vm::cast(addr));
return true;
}
@ -3631,7 +3631,7 @@ bool ppu_interpreter::STVEBX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
const u8 eb = addr & 0xf;
vm::write8(vm::cast(addr, HERE), ppu.vr[op.vs]._u8[15 - eb]);
vm::write8(vm::cast(addr), ppu.vr[op.vs]._u8[15 - eb]);
return true;
}
@ -3710,21 +3710,21 @@ bool ppu_interpreter::MTOCRF(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STDX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::write64(vm::cast(addr, HERE), ppu.gpr[op.rs]);
vm::write64(vm::cast(addr), ppu.gpr[op.rs]);
return true;
}
bool ppu_interpreter::STWCX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
ppu_cr_set(ppu, 0, false, false, ppu_stwcx(ppu, vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[op.rs])), ppu.xer.so);
ppu_cr_set(ppu, 0, false, false, ppu_stwcx(ppu, vm::cast(addr), static_cast<u32>(ppu.gpr[op.rs])), ppu.xer.so);
return true;
}
bool ppu_interpreter::STWX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::write32(vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[op.rs]));
vm::write32(vm::cast(addr), static_cast<u32>(ppu.gpr[op.rs]));
return true;
}
@ -3732,14 +3732,14 @@ bool ppu_interpreter::STVEHX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~1ULL;
const u8 eb = (addr & 0xf) >> 1;
vm::write16(vm::cast(addr, HERE), ppu.vr[op.vs]._u16[7 - eb]);
vm::write16(vm::cast(addr), ppu.vr[op.vs]._u16[7 - eb]);
return true;
}
bool ppu_interpreter::STDUX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb];
vm::write64(vm::cast(addr, HERE), ppu.gpr[op.rs]);
vm::write64(vm::cast(addr), ppu.gpr[op.rs]);
ppu.gpr[op.ra] = addr;
return true;
}
@ -3747,7 +3747,7 @@ bool ppu_interpreter::STDUX(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STWUX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb];
vm::write32(vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[op.rs]));
vm::write32(vm::cast(addr), static_cast<u32>(ppu.gpr[op.rs]));
ppu.gpr[op.ra] = addr;
return true;
}
@ -3756,7 +3756,7 @@ bool ppu_interpreter::STVEWX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~3ULL;
const u8 eb = (addr & 0xf) >> 2;
vm::write32(vm::cast(addr, HERE), ppu.vr[op.vs]._u32[3 - eb]);
vm::write32(vm::cast(addr), ppu.vr[op.vs]._u32[3 - eb]);
return true;
}
@ -3785,21 +3785,21 @@ bool ppu_interpreter::ADDZE(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STDCX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
ppu_cr_set(ppu, 0, false, false, ppu_stdcx(ppu, vm::cast(addr, HERE), ppu.gpr[op.rs]), ppu.xer.so);
ppu_cr_set(ppu, 0, false, false, ppu_stdcx(ppu, vm::cast(addr), ppu.gpr[op.rs]), ppu.xer.so);
return true;
}
bool ppu_interpreter::STBX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::write8(vm::cast(addr, HERE), static_cast<u8>(ppu.gpr[op.rs]));
vm::write8(vm::cast(addr), static_cast<u8>(ppu.gpr[op.rs]));
return true;
}
bool ppu_interpreter::STVX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull;
vm::_ref<v128>(vm::cast(addr, HERE)) = ppu.vr[op.vs];
vm::_ref<v128>(vm::cast(addr)) = ppu.vr[op.vs];
return true;
}
@ -3855,7 +3855,7 @@ bool ppu_interpreter::DCBTST(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STBUX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb];
vm::write8(vm::cast(addr, HERE), static_cast<u8>(ppu.gpr[op.rs]));
vm::write8(vm::cast(addr), static_cast<u8>(ppu.gpr[op.rs]));
ppu.gpr[op.ra] = addr;
return true;
}
@ -3891,7 +3891,7 @@ bool ppu_interpreter::EQV(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::ECIWX(ppu_thread& ppu, ppu_opcode_t op)
{
fmt::throw_exception("ECIWX" HERE);
fmt::throw_exception("ECIWX");
}
bool ppu_interpreter::LHZUX(ppu_thread& ppu, ppu_opcode_t op)
@ -3922,7 +3922,7 @@ bool ppu_interpreter::MFSPR(ppu_thread& ppu, ppu_opcode_t op)
case 0x10C: ppu.gpr[op.rd] = get_timebased_time(); break;
case 0x10D: ppu.gpr[op.rd] = get_timebased_time() >> 32; break;
default: fmt::throw_exception("MFSPR 0x%x" HERE, n);
default: fmt::throw_exception("MFSPR 0x%x", n);
}
return true;
@ -3962,7 +3962,7 @@ bool ppu_interpreter::MFTB(ppu_thread& ppu, ppu_opcode_t op)
{
case 0x10C: ppu.gpr[op.rd] = get_timebased_time(); break;
case 0x10D: ppu.gpr[op.rd] = get_timebased_time() >> 32; break;
default: fmt::throw_exception("MFTB 0x%x" HERE, n);
default: fmt::throw_exception("MFTB 0x%x", n);
}
return true;
@ -3992,7 +3992,7 @@ bool ppu_interpreter::LHAUX(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STHX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::write16(vm::cast(addr, HERE), static_cast<u16>(ppu.gpr[op.rs]));
vm::write16(vm::cast(addr), static_cast<u16>(ppu.gpr[op.rs]));
return true;
}
@ -4005,13 +4005,13 @@ bool ppu_interpreter::ORC(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::ECOWX(ppu_thread& ppu, ppu_opcode_t op)
{
fmt::throw_exception("ECOWX" HERE);
fmt::throw_exception("ECOWX");
}
bool ppu_interpreter::STHUX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb];
vm::write16(vm::cast(addr, HERE), static_cast<u16>(ppu.gpr[op.rs]));
vm::write16(vm::cast(addr), static_cast<u16>(ppu.gpr[op.rs]));
ppu.gpr[op.ra] = addr;
return true;
}
@ -4061,7 +4061,7 @@ bool ppu_interpreter::MTSPR(ppu_thread& ppu, ppu_opcode_t op)
case 0x008: ppu.lr = ppu.gpr[op.rs]; break;
case 0x009: ppu.ctr = ppu.gpr[op.rs]; break;
case 0x100: ppu.vrsave = static_cast<u32>(ppu.gpr[op.rs]); break;
default: fmt::throw_exception("MTSPR 0x%x" HERE, n);
default: fmt::throw_exception("MTSPR 0x%x", n);
}
return true;
@ -4082,7 +4082,7 @@ bool ppu_interpreter::NAND(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STVXL(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = (op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb]) & ~0xfull;
vm::_ref<v128>(vm::cast(addr, HERE)) = ppu.vr[op.vs];
vm::_ref<v128>(vm::cast(addr)) = ppu.vr[op.vs];
return true;
}
@ -4250,7 +4250,7 @@ bool ppu_interpreter::STVLX(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STDBRX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::_ref<le_t<u64>>(vm::cast(addr, HERE)) = ppu.gpr[op.rs];
vm::_ref<le_t<u64>>(vm::cast(addr)) = ppu.gpr[op.rs];
return true;
}
@ -4260,7 +4260,7 @@ bool ppu_interpreter::STSWX(ppu_thread& ppu, ppu_opcode_t op)
u32 count = ppu.xer.cnt & 0x7F;
for (; count >= 4; count -= 4, addr += 4, op.rs = (op.rs + 1) & 31)
{
vm::write32(vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[op.rs]));
vm::write32(vm::cast(addr), static_cast<u32>(ppu.gpr[op.rs]));
}
if (count)
{
@ -4268,7 +4268,7 @@ bool ppu_interpreter::STSWX(ppu_thread& ppu, ppu_opcode_t op)
for (u32 byte = 0; byte < count; byte++)
{
u8 byte_value = static_cast<u8>(value >> ((3 ^ byte) * 8));
vm::write8(vm::cast(addr + byte, HERE), byte_value);
vm::write8(vm::cast(addr + byte), byte_value);
}
}
return true;
@ -4277,14 +4277,14 @@ bool ppu_interpreter::STSWX(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STWBRX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::_ref<le_t<u32>>(vm::cast(addr, HERE)) = static_cast<u32>(ppu.gpr[op.rs]);
vm::_ref<le_t<u32>>(vm::cast(addr)) = static_cast<u32>(ppu.gpr[op.rs]);
return true;
}
bool ppu_interpreter::STFSX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::_ref<f32>(vm::cast(addr, HERE)) = static_cast<float>(ppu.fpr[op.frs]);
vm::_ref<f32>(vm::cast(addr)) = static_cast<float>(ppu.fpr[op.frs]);
return true;
}
@ -4298,7 +4298,7 @@ bool ppu_interpreter::STVRX(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STFSUX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb];
vm::_ref<f32>(vm::cast(addr, HERE)) = static_cast<float>(ppu.fpr[op.frs]);
vm::_ref<f32>(vm::cast(addr)) = static_cast<float>(ppu.fpr[op.frs]);
ppu.gpr[op.ra] = addr;
return true;
}
@ -4313,7 +4313,7 @@ bool ppu_interpreter::STSWI(ppu_thread& ppu, ppu_opcode_t op)
{
if (N > 3)
{
vm::write32(vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[reg]));
vm::write32(vm::cast(addr), static_cast<u32>(ppu.gpr[reg]));
addr += 4;
N -= 4;
}
@ -4323,7 +4323,7 @@ bool ppu_interpreter::STSWI(ppu_thread& ppu, ppu_opcode_t op)
while (N > 0)
{
N = N - 1;
vm::write8(vm::cast(addr, HERE), (0xFF000000 & buf) >> 24);
vm::write8(vm::cast(addr), (0xFF000000 & buf) >> 24);
buf <<= 8;
addr++;
}
@ -4336,14 +4336,14 @@ bool ppu_interpreter::STSWI(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STFDX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::_ref<f64>(vm::cast(addr, HERE)) = ppu.fpr[op.frs];
vm::_ref<f64>(vm::cast(addr)) = ppu.fpr[op.frs];
return true;
}
bool ppu_interpreter::STFDUX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + ppu.gpr[op.rb];
vm::_ref<f64>(vm::cast(addr, HERE)) = ppu.fpr[op.frs];
vm::_ref<f64>(vm::cast(addr)) = ppu.fpr[op.frs];
ppu.gpr[op.ra] = addr;
return true;
}
@ -4443,7 +4443,7 @@ bool ppu_interpreter::STVLXL(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STHBRX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::_ref<le_t<u16>>(vm::cast(addr, HERE)) = static_cast<u16>(ppu.gpr[op.rs]);
vm::_ref<le_t<u16>>(vm::cast(addr)) = static_cast<u16>(ppu.gpr[op.rs]);
return true;
}
@ -4469,7 +4469,7 @@ bool ppu_interpreter::EXTSB(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STFIWX(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
vm::write32(vm::cast(addr, HERE), static_cast<u32>(std::bit_cast<u64>(ppu.fpr[op.frs])));
vm::write32(vm::cast(addr), static_cast<u32>(std::bit_cast<u64>(ppu.fpr[op.frs])));
return true;
}
@ -4488,7 +4488,7 @@ bool ppu_interpreter::ICBI(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::DCBZ(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + ppu.gpr[op.rb] : ppu.gpr[op.rb];
const u32 addr0 = vm::cast(addr, HERE) & ~127;
const u32 addr0 = vm::cast(addr) & ~127;
if (g_cfg.core.accurate_cache_line_stores)
{
@ -4535,12 +4535,12 @@ bool ppu_interpreter::STW(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
const u32 value = static_cast<u32>(ppu.gpr[op.rs]);
vm::write32(vm::cast(addr, HERE), value);
vm::write32(vm::cast(addr), value);
//Insomniac engine v3 & v4 (newer R&C, Fuse, Resitance 3)
if (value == 0xAAAAAAAA) [[unlikely]]
{
vm::reservation_update(vm::cast(addr, HERE));
vm::reservation_update(vm::cast(addr));
}
return true;
@ -4549,7 +4549,7 @@ bool ppu_interpreter::STW(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STWU(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + op.simm16;
vm::write32(vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[op.rs]));
vm::write32(vm::cast(addr), static_cast<u32>(ppu.gpr[op.rs]));
ppu.gpr[op.ra] = addr;
return true;
}
@ -4557,14 +4557,14 @@ bool ppu_interpreter::STWU(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STB(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
vm::write8(vm::cast(addr, HERE), static_cast<u8>(ppu.gpr[op.rs]));
vm::write8(vm::cast(addr), static_cast<u8>(ppu.gpr[op.rs]));
return true;
}
bool ppu_interpreter::STBU(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + op.simm16;
vm::write8(vm::cast(addr, HERE), static_cast<u8>(ppu.gpr[op.rs]));
vm::write8(vm::cast(addr), static_cast<u8>(ppu.gpr[op.rs]));
ppu.gpr[op.ra] = addr;
return true;
}
@ -4602,14 +4602,14 @@ bool ppu_interpreter::LHAU(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STH(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
vm::write16(vm::cast(addr, HERE), static_cast<u16>(ppu.gpr[op.rs]));
vm::write16(vm::cast(addr), static_cast<u16>(ppu.gpr[op.rs]));
return true;
}
bool ppu_interpreter::STHU(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + op.simm16;
vm::write16(vm::cast(addr, HERE), static_cast<u16>(ppu.gpr[op.rs]));
vm::write16(vm::cast(addr), static_cast<u16>(ppu.gpr[op.rs]));
ppu.gpr[op.ra] = addr;
return true;
}
@ -4629,7 +4629,7 @@ bool ppu_interpreter::STMW(ppu_thread& ppu, ppu_opcode_t op)
u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
for (u32 i = op.rs; i<32; ++i, addr += 4)
{
vm::write32(vm::cast(addr, HERE), static_cast<u32>(ppu.gpr[i]));
vm::write32(vm::cast(addr), static_cast<u32>(ppu.gpr[i]));
}
return true;
}
@ -4667,14 +4667,14 @@ bool ppu_interpreter::LFDU(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STFS(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
vm::_ref<f32>(vm::cast(addr, HERE)) = static_cast<float>(ppu.fpr[op.frs]);
vm::_ref<f32>(vm::cast(addr)) = static_cast<float>(ppu.fpr[op.frs]);
return true;
}
bool ppu_interpreter::STFSU(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + op.simm16;
vm::_ref<f32>(vm::cast(addr, HERE)) = static_cast<float>(ppu.fpr[op.frs]);
vm::_ref<f32>(vm::cast(addr)) = static_cast<float>(ppu.fpr[op.frs]);
ppu.gpr[op.ra] = addr;
return true;
}
@ -4682,14 +4682,14 @@ bool ppu_interpreter::STFSU(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STFD(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = op.ra ? ppu.gpr[op.ra] + op.simm16 : op.simm16;
vm::_ref<f64>(vm::cast(addr, HERE)) = ppu.fpr[op.frs];
vm::_ref<f64>(vm::cast(addr)) = ppu.fpr[op.frs];
return true;
}
bool ppu_interpreter::STFDU(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + op.simm16;
vm::_ref<f64>(vm::cast(addr, HERE)) = ppu.fpr[op.frs];
vm::_ref<f64>(vm::cast(addr)) = ppu.fpr[op.frs];
ppu.gpr[op.ra] = addr;
return true;
}
@ -4719,14 +4719,14 @@ bool ppu_interpreter::LWA(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::STD(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = (op.simm16 & ~3) + (op.ra ? ppu.gpr[op.ra] : 0);
vm::write64(vm::cast(addr, HERE), ppu.gpr[op.rs]);
vm::write64(vm::cast(addr), ppu.gpr[op.rs]);
return true;
}
bool ppu_interpreter::STDU(ppu_thread& ppu, ppu_opcode_t op)
{
const u64 addr = ppu.gpr[op.ra] + (op.simm16 & ~3);
vm::write64(vm::cast(addr, HERE), ppu.gpr[op.rs]);
vm::write64(vm::cast(addr), ppu.gpr[op.rs]);
ppu.gpr[op.ra] = addr;
return true;
}
@ -5172,5 +5172,5 @@ bool ppu_interpreter::FCFID(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter::UNK(ppu_thread& ppu, ppu_opcode_t op)
{
fmt::throw_exception("Unknown/Illegal opcode: 0x%08x at 0x%x" HERE, op.opcode, ppu.cia);
fmt::throw_exception("Unknown/Illegal opcode: 0x%08x at 0x%x", op.opcode, ppu.cia);
}

View File

@ -909,7 +909,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
const auto& rel = reinterpret_cast<const ppu_prx_relocation_info&>(prog.bin[i]);
ppu_reloc _rel;
const u32 raddr = _rel.addr = vm::cast(prx->segs.at(rel.index_addr).addr + rel.offset, HERE);
const u32 raddr = _rel.addr = vm::cast(prx->segs.at(rel.index_addr).addr + rel.offset);
const u32 rtype = _rel.type = rel.type;
const u64 rdata = _rel.data = rel.index_value == 0xFF ? rel.ptr.addr().value() : prx->segs.at(rel.index_value).addr + rel.ptr.addr();
prx->relocs.emplace_back(_rel);
@ -1008,7 +1008,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
};
// Access library information (TODO)
const vm::cptr<ppu_prx_library_info> lib_info = vm::cast(prx->segs[0].addr + elf.progs[0].p_paddr - elf.progs[0].p_offset, HERE);
const vm::cptr<ppu_prx_library_info> lib_info = vm::cast(prx->segs[0].addr + elf.progs[0].p_paddr - elf.progs[0].p_offset);
const std::string lib_name = lib_info->name;
strcpy_trunc(prx->module_info_name, lib_name);
@ -1164,7 +1164,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
if (!vm::falloc(addr, size))
{
fmt::throw_exception("vm::falloc() failed (addr=0x%x, memsz=0x%x)" HERE, addr, size);
fmt::throw_exception("vm::falloc() failed (addr=0x%x, memsz=0x%x)", addr, size);
}
}
@ -1279,7 +1279,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
case 0x00000007: // TLS
{
tls_vaddr = vm::cast(prog.p_vaddr, HERE);
tls_vaddr = vm::cast(prog.p_vaddr);
tls_fsize = ::narrow<u32>(prog.p_filesz);
tls_vsize = ::narrow<u32>(prog.p_memsz);
@ -1304,7 +1304,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
//be_t<u32> crash_dump_param_addr;
};
const auto& info = vm::_ref<process_param_t>(vm::cast(prog.p_vaddr, HERE));
const auto& info = vm::_ref<process_param_t>(vm::cast(prog.p_vaddr));
if (info.size < sizeof(process_param_t))
{
@ -1359,7 +1359,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
be_t<u32> unk2;
};
const auto& proc_prx_param = vm::_ref<const ppu_proc_prx_param_t>(vm::cast(prog.p_vaddr, HERE));
const auto& proc_prx_param = vm::_ref<const ppu_proc_prx_param_t>(vm::cast(prog.p_vaddr));
ppu_loader.notice("* libent_start = *0x%x", proc_prx_param.libent_start);
ppu_loader.notice("* libstub_start = *0x%x", proc_prx_param.libstub_start);
@ -1478,7 +1478,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
// Additional segment for fixed allocations
if (!vm::map(0x30000000, 0x10000000, 0x200))
{
fmt::throw_exception("Failed to map ppc_seg's segment!" HERE);
fmt::throw_exception("Failed to map ppc_seg's segment!");
}
}
@ -1646,7 +1646,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
ppu_loader.notice("** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
ppu_segment _seg;
const u32 addr = _seg.addr = vm::cast(prog.p_vaddr, HERE);
const u32 addr = _seg.addr = vm::cast(prog.p_vaddr);
const u32 size = _seg.size = ::narrow<u32>(prog.p_memsz);
const u32 type = _seg.type = prog.p_type;
const u32 flag = _seg.flags = prog.p_flags;
@ -1748,7 +1748,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
//and a lot of zeros.
};
const auto& info = vm::_ref<process_param_t>(vm::cast(prog.p_vaddr, HERE));
const auto& info = vm::_ref<process_param_t>(vm::cast(prog.p_vaddr));
if (info.size < sizeof(process_param_t))
{
@ -1786,7 +1786,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
be_t<u32> unk2;
};
const auto& proc_prx_param = vm::_ref<const ppu_proc_prx_param_t>(vm::cast(prog.p_vaddr, HERE));
const auto& proc_prx_param = vm::_ref<const ppu_proc_prx_param_t>(vm::cast(prog.p_vaddr));
ppu_loader.notice("* libent_start = *0x%x", proc_prx_param.libent_start);
ppu_loader.notice("* libstub_start = *0x%x", proc_prx_param.libstub_start);

View File

@ -752,7 +752,7 @@ void ppu_thread::cpu_task()
{
if (arg >= 32)
{
fmt::throw_exception("Invalid ppu_cmd::set_gpr arg (0x%x)" HERE, arg);
fmt::throw_exception("Invalid ppu_cmd::set_gpr arg (0x%x)", arg);
}
gpr[arg % 32] = cmd_get(1).as<u64>();
@ -763,7 +763,7 @@ void ppu_thread::cpu_task()
{
if (arg > 8)
{
fmt::throw_exception("Unsupported ppu_cmd::set_args size (0x%x)" HERE, arg);
fmt::throw_exception("Unsupported ppu_cmd::set_args size (0x%x)", arg);
}
for (u32 i = 0; i < arg; i++)
@ -814,7 +814,7 @@ void ppu_thread::cpu_task()
}
default:
{
fmt::throw_exception("Unknown ppu_cmd(0x%x)" HERE, static_cast<u32>(type));
fmt::throw_exception("Unknown ppu_cmd(0x%x)", static_cast<u32>(type));
}
}
}
@ -1024,8 +1024,8 @@ cmd64 ppu_thread::cmd_wait()
be_t<u64>* ppu_thread::get_stack_arg(s32 i, u64 align)
{
if (align != 1 && align != 2 && align != 4 && align != 8 && align != 16) fmt::throw_exception("Unsupported alignment: 0x%llx" HERE, align);
return vm::_ptr<u64>(vm::cast((gpr[1] + 0x30 + 0x8 * (i - 1)) & (0 - align), HERE));
if (align != 1 && align != 2 && align != 4 && align != 8 && align != 16) fmt::throw_exception("Unsupported alignment: 0x%llx", align);
return vm::_ptr<u64>(vm::cast((gpr[1] + 0x30 + 0x8 * (i - 1)) & (0 - align)));
}
void ppu_thread::fast_call(u32 addr, u32 rtoc)
@ -1107,13 +1107,13 @@ u32 ppu_thread::stack_push(u32 size, u32 align_v)
{
ppu_thread& context = static_cast<ppu_thread&>(*cpu);
const u32 old_pos = vm::cast(context.gpr[1], HERE);
const u32 old_pos = vm::cast(context.gpr[1]);
context.gpr[1] -= align(size + 4, 8); // room minimal possible size
context.gpr[1] &= ~(u64{align_v} - 1); // fix stack alignment
if (old_pos >= context.stack_addr && old_pos < context.stack_addr + context.stack_size && context.gpr[1] < context.stack_addr)
{
fmt::throw_exception("Stack overflow (size=0x%x, align=0x%x, SP=0x%llx, stack=*0x%x)" HERE, size, align_v, old_pos, context.stack_addr);
fmt::throw_exception("Stack overflow (size=0x%x, align=0x%x, SP=0x%llx, stack=*0x%x)", size, align_v, old_pos, context.stack_addr);
}
else
{
@ -1124,7 +1124,7 @@ u32 ppu_thread::stack_push(u32 size, u32 align_v)
}
}
fmt::throw_exception("Invalid thread" HERE);
fmt::throw_exception("Invalid thread");
}
void ppu_thread::stack_pop_verbose(u32 addr, u32 size) noexcept
@ -1143,7 +1143,7 @@ void ppu_thread::stack_pop_verbose(u32 addr, u32 size) noexcept
return;
}
ppu_log.error("Invalid thread" HERE);
ppu_log.error("Invalid thread");
}
extern u64 get_timebased_time();
@ -1174,7 +1174,7 @@ void ppu_trap(ppu_thread& ppu, u64 addr)
// If stubbing is enabled, check current instruction and the following
if (!add || !vm::check_addr(ppu.cia, vm::page_executable) || !vm::check_addr(ppu.cia + add, vm::page_executable))
{
fmt::throw_exception("PPU Trap!" HERE);
fmt::throw_exception("PPU Trap!");
}
ppu_log.error("PPU Trap: Stubbing %d instructions %s.", std::abs(static_cast<s32>(add) / 4), add >> 31 ? "backwards" : "forwards");
@ -1212,7 +1212,7 @@ static T ppu_load_acquire_reservation(ppu_thread& ppu, u32 addr)
if (addr % sizeof(T))
{
fmt::throw_exception("PPU %s: Unaligned address: 0x%08x" HERE, sizeof(T) == 4 ? "LWARX" : "LDARX", addr);
fmt::throw_exception("PPU %s: Unaligned address: 0x%08x", sizeof(T) == 4 ? "LWARX" : "LDARX", addr);
}
// Always load aligned 64-bit value
@ -1688,7 +1688,7 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
if (addr % sizeof(T))
{
fmt::throw_exception("PPU %s: Unaligned address: 0x%08x" HERE, sizeof(T) == 4 ? "STWCX" : "STDCX", addr);
fmt::throw_exception("PPU %s: Unaligned address: 0x%08x", sizeof(T) == 4 ? "STWCX" : "STDCX", addr);
}
auto& data = vm::_ref<atomic_be_t<u64>>(addr & -8);

View File

@ -4629,7 +4629,7 @@ Value* PPUTranslator::GetVr(u32 vr, VrType type)
case VrType::vi16: _type = GetType<u16[8]>(); break;
case VrType::vf : _type = GetType<f32[4]>(); break;
case VrType::i128: _type = GetType<u128>(); break;
default: report_fatal_error("GetVr(): invalid type");
default: ensure(false);
}
return bitcast(value, _type);
@ -4709,8 +4709,7 @@ void PPUTranslator::SetFPRF(Value* value, bool set_cr)
{
const bool is32 =
value->getType()->isFloatTy() ? true :
value->getType()->isDoubleTy() ? false :
(report_fatal_error("SetFPRF(): invalid value type"), false);
value->getType()->isDoubleTy() ? false : ensure(false);
//const auto zero = ConstantFP::get(value->getType(), 0.0);
//const auto is_nan = m_ir->CreateFCmpUNO(value, zero);

View File

@ -940,7 +940,7 @@ spu_recompiler::XmmLink spu_recompiler::XmmAlloc() // get empty xmm register
if (v) return{ v };
}
fmt::throw_exception("Out of Xmm Vars" HERE);
fmt::throw_exception("Out of Xmm Vars");
}
spu_recompiler::XmmLink spu_recompiler::XmmGet(s8 reg, XmmType type) // get xmm register with specific SPU reg
@ -952,7 +952,7 @@ spu_recompiler::XmmLink spu_recompiler::XmmGet(s8 reg, XmmType type) // get xmm
case XmmType::Int: c->movdqa(result, SPU_OFF_128(gpr, reg)); break;
case XmmType::Float: c->movaps(result, SPU_OFF_128(gpr, reg)); break;
case XmmType::Double: c->movapd(result, SPU_OFF_128(gpr, reg)); break;
default: fmt::throw_exception("Invalid XmmType" HERE);
default: fmt::throw_exception("Invalid XmmType");
}
return result;
@ -1252,7 +1252,7 @@ void spu_recompiler::UNK(spu_opcode_t op)
auto gate = [](spu_thread* _spu, u32 op)
{
_spu->state += cpu_flag::dbg_pause;
spu_log.fatal("Unknown/Illegal instruction (0x%08x)" HERE, op);
spu_log.fatal("Unknown/Illegal instruction (0x%08x)", op);
spu_runtime::g_escape(_spu);
};

View File

@ -93,7 +93,7 @@ namespace asmjit
bool spu_interpreter::UNK(spu_thread& spu, spu_opcode_t op)
{
fmt::throw_exception("Unknown/Illegal instruction (0x%08x)" HERE, op.opcode);
fmt::throw_exception("Unknown/Illegal instruction (0x%08x)", op.opcode);
}
@ -103,7 +103,7 @@ void spu_interpreter::set_interrupt_status(spu_thread& spu, spu_opcode_t op)
{
if (op.d)
{
fmt::throw_exception("Undefined behaviour" HERE);
fmt::throw_exception("Undefined behaviour");
}
spu.set_interrupt_status(true);
@ -630,7 +630,7 @@ bool spu_interpreter::CBX(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = ~(spu.gpr[op.rb]._u32[3] + spu.gpr[op.ra]._u32[3]) & 0xf;
@ -643,7 +643,7 @@ bool spu_interpreter::CHX(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = (~(spu.gpr[op.rb]._u32[3] + spu.gpr[op.ra]._u32[3]) & 0xe) >> 1;
@ -656,7 +656,7 @@ bool spu_interpreter::CWX(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = (~(spu.gpr[op.rb]._u32[3] + spu.gpr[op.ra]._u32[3]) & 0xc) >> 2;
@ -669,7 +669,7 @@ bool spu_interpreter::CDX(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = (~(spu.gpr[op.rb]._u32[3] + spu.gpr[op.ra]._u32[3]) & 0x8) >> 3;
@ -736,7 +736,7 @@ bool spu_interpreter::CBD(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = ~(op.i7 + spu.gpr[op.ra]._u32[3]) & 0xf;
@ -749,7 +749,7 @@ bool spu_interpreter::CHD(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = (~(op.i7 + spu.gpr[op.ra]._u32[3]) & 0xe) >> 1;
@ -762,7 +762,7 @@ bool spu_interpreter::CWD(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = (~(op.i7 + spu.gpr[op.ra]._u32[3]) & 0xc) >> 2;
@ -775,7 +775,7 @@ bool spu_interpreter::CDD(spu_thread& spu, spu_opcode_t op)
{
if (op.ra == 1 && (spu.gpr[1]._u32[3] & 0xF))
{
fmt::throw_exception("Unexpected SP value: LS:0x%05x" HERE, spu.gpr[1]._u32[3]);
fmt::throw_exception("Unexpected SP value: LS:0x%05x", spu.gpr[1]._u32[3]);
}
const s32 t = (~(op.i7 + spu.gpr[op.ra]._u32[3]) & 0x8) >> 3;
@ -990,7 +990,7 @@ bool spu_interpreter_fast::FCGT(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCGT(spu_thread& spu, spu_opcode_t op)
{
fmt::throw_exception("Unexpected instruction" HERE);
fmt::throw_exception("Unexpected instruction");
return true;
}
@ -1077,7 +1077,7 @@ bool spu_interpreter_fast::FCMGT(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCMGT(spu_thread& spu, spu_opcode_t op)
{
fmt::throw_exception("Unexpected Instruction" HERE);
fmt::throw_exception("Unexpected Instruction");
return true;
}
@ -1225,7 +1225,7 @@ bool spu_interpreter_fast::FSCRWR(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFTSV(spu_thread& spu, spu_opcode_t op)
{
fmt::throw_exception("Unexpected instruction" HERE);
fmt::throw_exception("Unexpected instruction");
return true;
}
@ -1237,7 +1237,7 @@ bool spu_interpreter_fast::FCEQ(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCEQ(spu_thread& spu, spu_opcode_t op)
{
fmt::throw_exception("Unexpected instruction" HERE);
fmt::throw_exception("Unexpected instruction");
return true;
}
@ -1281,7 +1281,7 @@ bool spu_interpreter_fast::FCMEQ(spu_thread& spu, spu_opcode_t op)
bool spu_interpreter::DFCMEQ(spu_thread& spu, spu_opcode_t op)
{
fmt::throw_exception("Unexpected instruction" HERE);
fmt::throw_exception("Unexpected instruction");
return true;
}

View File

@ -3713,7 +3713,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
case s_reg_mfc_size:
return get_type<u16>();
default:
fmt::throw_exception("get_reg_type(%u): invalid register index" HERE, index);
fmt::throw_exception("get_reg_type(%u): invalid register index", index);
}
}
@ -3731,7 +3731,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
case s_reg_mfc_tag: return ::offset32(&spu_thread::ch_mfc_cmd, &spu_mfc_cmd::tag);
case s_reg_mfc_size: return ::offset32(&spu_thread::ch_mfc_cmd, &spu_mfc_cmd::size);
default:
fmt::throw_exception("get_reg_offset(%u): invalid register index" HERE, index);
fmt::throw_exception("get_reg_offset(%u): invalid register index", index);
}
}
@ -4781,7 +4781,7 @@ public:
fs::file(m_spurt->get_cache_path() + "spu-ir.log", fs::write + fs::append).write(log);
}
fmt::raw_error("Compilation failed");
fmt::throw_exception("Compilation failed");
}
if (g_cfg.core.spu_debug)
@ -4836,7 +4836,7 @@ public:
// Execute interpreter instruction
const u32 op = *reinterpret_cast<const be_t<u32>*>(_spu->_ptr<u8>(0) + _spu->pc);
if (!g_spu_interpreter_fast.decode(op)(*_spu, {op}))
spu_log.fatal("Bad instruction" HERE);
spu_log.fatal("Bad instruction");
// Swap state
for (u32 i = 0; i < s_gpr.size(); ++i)
@ -5211,7 +5211,7 @@ public:
fs::file(m_spurt->get_cache_path() + "spu-ir.log", fs::write + fs::append).write(log);
}
fmt::raw_error("Compilation failed");
fmt::throw_exception("Compilation failed");
}
if (g_cfg.core.spu_debug)
@ -5280,7 +5280,7 @@ public:
static void exec_unk(spu_thread* _spu, u32 op)
{
fmt::throw_exception("Unknown/Illegal instruction (0x%08x)" HERE, op);
fmt::throw_exception("Unknown/Illegal instruction (0x%08x)", op);
}
void UNK(spu_opcode_t op_unk)

View File

@ -1652,7 +1652,7 @@ void spu_thread::cpu_task()
}
else
{
ASSERT(spu_runtime::g_interpreter);
ensure(spu_runtime::g_interpreter);
while (true)
{
@ -1901,7 +1901,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8*
}
else
{
fmt::throw_exception("Invalid RawSPU MMIO offset (cmd=[%s])" HERE, args);
fmt::throw_exception("Invalid RawSPU MMIO offset (cmd=[%s])", args);
}
}
else if (_this->get_type() >= spu_type::raw)
@ -1927,7 +1927,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8*
}
else
{
fmt::throw_exception("Invalid MMIO offset (cmd=[%s])" HERE, args);
fmt::throw_exception("Invalid MMIO offset (cmd=[%s])", args);
}
}
else
@ -3368,7 +3368,7 @@ bool spu_thread::process_mfc_cmd()
}
}
fmt::throw_exception("Unknown command (cmd=%s, lsa=0x%x, ea=0x%llx, tag=0x%x, size=0x%x)" HERE,
fmt::throw_exception("Unknown command (cmd=%s, lsa=0x%x, ea=0x%llx, tag=0x%x, size=0x%x)",
ch_mfc_cmd.cmd, ch_mfc_cmd.lsa, ch_mfc_cmd.eal, ch_mfc_cmd.tag, ch_mfc_cmd.size);
}
@ -3462,7 +3462,7 @@ spu_thread::ch_events_t spu_thread::get_events(u32 mask_hint, bool waiting, bool
{
if (auto mask1 = ch_events.load().mask; mask1 & ~SPU_EVENT_IMPLEMENTED)
{
fmt::throw_exception("SPU Events not implemented (mask=0x%x)" HERE, mask1);
fmt::throw_exception("SPU Events not implemented (mask=0x%x)", mask1);
}
retry:
@ -3543,7 +3543,7 @@ void spu_thread::set_interrupt_status(bool enable)
// Detect enabling interrupts with events masked
if (auto mask = ch_events.load().mask; mask & ~SPU_EVENT_INTR_IMPLEMENTED)
{
fmt::throw_exception("SPU Interrupts not implemented (mask=0x%x)" HERE, mask);
fmt::throw_exception("SPU Interrupts not implemented (mask=0x%x)", mask);
}
}
@ -3747,7 +3747,7 @@ s64 spu_thread::get_ch_value(u32 ch)
if (mask1 != SPU_EVENT_LR && mask1 != SPU_EVENT_LR + SPU_EVENT_TM)
{
// Combining LR with other flags needs another solution
fmt::throw_exception("Not supported: event mask 0x%x" HERE, mask1);
fmt::throw_exception("Not supported: event mask 0x%x", mask1);
}
for (; !events.count; events = get_events(mask1, false, true))
@ -3789,7 +3789,7 @@ s64 spu_thread::get_ch_value(u32 ch)
}
}
fmt::throw_exception("Unknown/illegal channel in RDCH (ch=%d [%s])" HERE, ch, ch < 128 ? spu_ch_name[ch] : "???");
fmt::throw_exception("Unknown/illegal channel in RDCH (ch=%d [%s])", ch, ch < 128 ? spu_ch_name[ch] : "???");
}
bool spu_thread::set_ch_value(u32 ch, u32 value)
@ -3836,7 +3836,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
if (!ch_out_mbox.try_pop(data))
{
fmt::throw_exception("sys_spu_thread_send_event(value=0x%x, spup=%d): Out_MBox is empty" HERE, value, spup);
fmt::throw_exception("sys_spu_thread_send_event(value=0x%x, spup=%d): Out_MBox is empty", value, spup);
}
spu_log.trace("sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x)", spup, value & 0x00ffffff, data);
@ -3870,7 +3870,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
if (!ch_out_mbox.try_pop(data))
{
fmt::throw_exception("sys_spu_thread_throw_event(value=0x%x, spup=%d): Out_MBox is empty" HERE, value, spup);
fmt::throw_exception("sys_spu_thread_throw_event(value=0x%x, spup=%d): Out_MBox is empty", value, spup);
}
spu_log.trace("sys_spu_thread_throw_event(spup=%d, data0=0x%x, data1=0x%x)", spup, value & 0x00ffffff, data);
@ -3894,7 +3894,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
if (!ch_out_mbox.try_pop(data))
{
fmt::throw_exception("sys_event_flag_set_bit(value=0x%x (flag=%d)): Out_MBox is empty" HERE, value, flag);
fmt::throw_exception("sys_event_flag_set_bit(value=0x%x (flag=%d)): Out_MBox is empty", value, flag);
}
spu_log.trace("sys_event_flag_set_bit(id=%d, value=0x%x (flag=%d))", data, value, flag);
@ -3921,7 +3921,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
if (!ch_out_mbox.try_pop(data))
{
fmt::throw_exception("sys_event_flag_set_bit_impatient(value=0x%x (flag=%d)): Out_MBox is empty" HERE, value, flag);
fmt::throw_exception("sys_event_flag_set_bit_impatient(value=0x%x (flag=%d)): Out_MBox is empty", value, flag);
}
spu_log.trace("sys_event_flag_set_bit_impatient(id=%d, value=0x%x (flag=%d))", data, value, flag);
@ -3932,7 +3932,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
}
else
{
fmt::throw_exception("SPU_WrOutIntrMbox: unknown data (value=0x%x, Out_MBox=%s)" HERE, value, ch_out_mbox);
fmt::throw_exception("SPU_WrOutIntrMbox: unknown data (value=0x%x, Out_MBox=%s)", value, ch_out_mbox);
}
}
}
@ -4141,7 +4141,7 @@ bool spu_thread::set_ch_value(u32 ch, u32 value)
}
}
fmt::throw_exception("Unknown/illegal channel in WRCH (ch=%d [%s], value=0x%x)" HERE, ch, ch < 128 ? spu_ch_name[ch] : "???", value);
fmt::throw_exception("Unknown/illegal channel in WRCH (ch=%d [%s], value=0x%x)", ch, ch < 128 ? spu_ch_name[ch] : "???", value);
}
bool spu_thread::stop_and_signal(u32 code)
@ -4196,7 +4196,7 @@ bool spu_thread::stop_and_signal(u32 code)
if (!ch_out_mbox.try_pop(spuq))
{
fmt::throw_exception("sys_spu_thread_receive_event(): Out_MBox is empty" HERE);
fmt::throw_exception("sys_spu_thread_receive_event(): Out_MBox is empty");
}
if (u32 count = ch_in_mbox.get_count())
@ -4359,7 +4359,7 @@ bool spu_thread::stop_and_signal(u32 code)
if (!ch_out_mbox.try_pop(spuq))
{
fmt::throw_exception("sys_spu_thread_tryreceive_event(): Out_MBox is empty" HERE);
fmt::throw_exception("sys_spu_thread_tryreceive_event(): Out_MBox is empty");
}
if (u32 count = ch_in_mbox.get_count())
@ -4416,7 +4416,7 @@ bool spu_thread::stop_and_signal(u32 code)
// SPU thread group yield (TODO)
if (ch_out_mbox.get_count())
{
fmt::throw_exception("STOP code 0x100: Out_MBox is not empty" HERE);
fmt::throw_exception("STOP code 0x100: Out_MBox is not empty");
}
atomic_fence_seq_cst();
@ -4433,7 +4433,7 @@ bool spu_thread::stop_and_signal(u32 code)
if (!ch_out_mbox.try_pop(value))
{
fmt::throw_exception("sys_spu_thread_group_exit(): Out_MBox is empty" HERE);
fmt::throw_exception("sys_spu_thread_group_exit(): Out_MBox is empty");
}
spu_log.trace("sys_spu_thread_group_exit(status=0x%x)", value);
@ -4512,7 +4512,7 @@ bool spu_thread::stop_and_signal(u32 code)
if (!ch_out_mbox.try_pop(value))
{
fmt::throw_exception("sys_spu_thread_exit(): Out_MBox is empty" HERE);
fmt::throw_exception("sys_spu_thread_exit(): Out_MBox is empty");
}
spu_log.trace("sys_spu_thread_exit(status=0x%x)", value);
@ -4524,7 +4524,7 @@ bool spu_thread::stop_and_signal(u32 code)
}
}
fmt::throw_exception("Unknown STOP code: 0x%x (op=0x%x, Out_MBox=%s)" HERE, code, _ref<u32>(pc), ch_out_mbox);
fmt::throw_exception("Unknown STOP code: 0x%x (op=0x%x, Out_MBox=%s)", code, _ref<u32>(pc), ch_out_mbox);
}
void spu_thread::halt()
@ -4549,7 +4549,7 @@ void spu_thread::halt()
spu_runtime::g_escape(this);
}
fmt::throw_exception("Halt" HERE);
fmt::throw_exception("Halt");
}
void spu_thread::fast_call(u32 ls_addr)

View File

@ -568,7 +568,7 @@ public:
return this->_u32[3] >> 10 & 0x3;
default:
fmt::throw_exception("Unexpected slice value (%d)" HERE, slice);
fmt::throw_exception("Unexpected slice value (%d)", slice);
}
}

View File

@ -357,7 +357,7 @@ lv2_file::open_raw_result_t lv2_file::open_raw(const std::string& local_path, s3
if (!open_mode)
{
fmt::throw_exception("lv2_file::open_raw(): Invalid or unimplemented flags: %#o" HERE, flags);
fmt::throw_exception("lv2_file::open_raw(): Invalid or unimplemented flags: %#o", flags);
}
std::lock_guard lock(mp->mutex);

View File

@ -82,7 +82,7 @@ error_code _sys_lwcond_signal(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id, u6
if (mode < 1 || mode > 3)
{
fmt::throw_exception("Unknown mode (%d)" HERE, mode);
fmt::throw_exception("Unknown mode (%d)", mode);
}
const auto cond = idm::check<lv2_obj, lv2_lwcond>(lwcond_id, [&](lv2_lwcond& cond) -> int
@ -193,7 +193,7 @@ error_code _sys_lwcond_signal_all(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
if (mode < 1 || mode > 2)
{
fmt::throw_exception("Unknown mode (%d)" HERE, mode);
fmt::throw_exception("Unknown mode (%d)", mode);
}
bool need_awake = false;

View File

@ -538,7 +538,7 @@ struct nt_p2p_port
static std::vector<u8> generate_u2s_packet(const lv2_socket::p2ps_i::encapsulated_tcp& header, const u8 *data, const u32 datasize)
{
const u32 packet_size = (sizeof(u16) + sizeof(lv2_socket::p2ps_i::encapsulated_tcp) + datasize);
ASSERT(packet_size < 65535); // packet size shouldn't be bigger than possible UDP payload
ensure(packet_size < 65535); // packet size shouldn't be bigger than possible UDP payload
std::vector<u8> packet(packet_size);
u8 *packet_data = packet.data();
@ -856,7 +856,7 @@ struct nt_p2p_port
const auto sock = idm::check<lv2_socket>(bound_p2p_vports.at(dst_vport), [&](lv2_socket& sock)
{
std::lock_guard lock(sock.mutex);
ASSERT(sock.type == SYS_NET_SOCK_DGRAM_P2P);
ensure(sock.type == SYS_NET_SOCK_DGRAM_P2P);
sock.p2p.data.push(std::make_pair(std::move(p2p_addr), std::move(p2p_data)));
sys_net.trace("Received a P2P packet for vport %d and saved it", dst_vport);
@ -1471,7 +1471,7 @@ error_code sys_net_bnet_bind(ppu_thread& ppu, s32 s, vm::cptr<sys_net_sockaddr>
{
sys_net.warning("[P2P] Attempting to bind a socket to a port != 3658");
}
ASSERT(p2p_vport != 0);
ensure(p2p_vport != 0);
lv2_socket::socket_type real_socket{};
@ -1821,7 +1821,7 @@ error_code sys_net_bnet_getpeername(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sock
{
std::lock_guard lock(sock.mutex);
ASSERT(sock.type != SYS_NET_SOCK_DGRAM_P2P);
ensure(sock.type != SYS_NET_SOCK_DGRAM_P2P);
if (::getpeername(sock.socket, reinterpret_cast<struct sockaddr*>(&native_addr), &native_addrlen) == 0)
{
@ -2175,7 +2175,7 @@ error_code sys_net_bnet_listen(ppu_thread& ppu, s32 s, s32 backlog)
{
std::lock_guard lock(sock.mutex);
ASSERT(sock.type == SYS_NET_SOCK_STREAM_P2P || sock.type == SYS_NET_SOCK_STREAM);
ensure(sock.type == SYS_NET_SOCK_STREAM_P2P || sock.type == SYS_NET_SOCK_STREAM);
if (sock.type == SYS_NET_SOCK_STREAM_P2P)
{
@ -2251,7 +2251,7 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
if (nph->is_dns(s) && nph->is_dns_queue(s))
{
const auto packet = nph->get_dns_packet(s);
ASSERT(packet.size() < len);
ensure(packet.size() < len);
memcpy(buf.get_ptr(), packet.data(), packet.size());
native_result = ::narrow<int>(packet.size());
@ -2598,9 +2598,9 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
if (type == SYS_NET_SOCK_DGRAM_P2P)
{
ASSERT(addr);
ASSERT(sock.socket); // ensures it has been bound
ASSERT(len <= (65535 - sizeof(u16))); // catch games using full payload for future fragmentation implementation if necessary
ensure(addr);
ensure(sock.socket); // ensures it has been bound
ensure(len <= (65535 - sizeof(u16))); // catch games using full payload for future fragmentation implementation if necessary
const u16 p2p_port = reinterpret_cast<const sys_net_sockaddr_in*>(addr.get_ptr())->sin_port;
const u16 p2p_vport = reinterpret_cast<const sys_net_sockaddr_in_p2p*>(addr.get_ptr())->sin_vport;
@ -3208,7 +3208,7 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr<sys_net_pollfd> fds, s32 n
if (sock->type == SYS_NET_SOCK_DGRAM_P2P)
{
std::lock_guard lock(sock->mutex);
ASSERT(sock->p2p.vport);
ensure(sock->p2p.vport);
sys_net.trace("[P2P] poll checking for 0x%X", fds[i].events);
// Check if it's a bound P2P socket
if ((fds[i].events & SYS_NET_POLLIN) && !sock->p2p.data.empty())

View File

@ -133,7 +133,7 @@ static error_code process_get_id(u32 object, vm::ptr<u32> buffer, u32 size, vm::
case SYS_INTR_SERVICE_HANDLE_OBJECT: idm_get_set<lv2_obj, lv2_int_serv>(objects); break;
case SYS_EVENT_QUEUE_OBJECT: idm_get_set<lv2_obj, lv2_event_queue>(objects); break;
case SYS_EVENT_PORT_OBJECT: idm_get_set<lv2_obj, lv2_event_port>(objects); break;
case SYS_TRACE_OBJECT: fmt::throw_exception("SYS_TRACE_OBJECT" HERE);
case SYS_TRACE_OBJECT: fmt::throw_exception("SYS_TRACE_OBJECT");
case SYS_SPUIMAGE_OBJECT: idm_get_set<lv2_obj, lv2_spu_image>(objects); break;
case SYS_PRX_OBJECT: idm_get_set<lv2_obj, lv2_prx>(objects); break;
case SYS_OVERLAY_OBJECT: idm_get_set<lv2_obj, lv2_overlay>(objects); break;
@ -143,7 +143,7 @@ static error_code process_get_id(u32 object, vm::ptr<u32> buffer, u32 size, vm::
case SYS_FS_FD_OBJECT: idm_get_set<lv2_fs_object, lv2_fs_object>(objects); break;
case SYS_LWCOND_OBJECT: idm_get_set<lv2_obj, lv2_lwcond>(objects); break;
case SYS_EVENT_FLAG_OBJECT: idm_get_set<lv2_obj, lv2_event_flag>(objects); break;
case SYS_SPUPORT_OBJECT: fmt::throw_exception("SYS_SPUPORT_OBJECT" HERE);
case SYS_SPUPORT_OBJECT: fmt::throw_exception("SYS_SPUPORT_OBJECT");
default:
{
return CELL_EINVAL;
@ -223,7 +223,7 @@ CellError process_is_spu_lock_line_reservation_address(u32 addr, u64 flags)
{
if (auto vm0 = idm::get<sys_vm_t>(sys_vm_t::find_id(addr & -0x1000'0000)))
{
// sys_vm area was not covering the address specified but made a reservation on the entire 256mb region
// sys_vm area was not covering the address specified but made a reservation on the entire 256mb region
if (vm0->addr + vm0->size - 1 < addr)
{
return CELL_EINVAL;

View File

@ -181,7 +181,7 @@ static error_code prx_load_module(const std::string& vpath, u64 flags, vm::ptr<s
return CELL_ENOSYS;
}
fmt::throw_exception("sys_prx: Unimplemented fixed address allocations" HERE);
fmt::throw_exception("sys_prx: Unimplemented fixed address allocations");
}
std::string vpath0;
@ -328,7 +328,7 @@ static error_code prx_load_module_list(ppu_thread& ppu, s32 count, vm::cpptr<cha
return CELL_ENOSYS;
}
fmt::throw_exception("sys_prx: Unimplemented fixed address allocations" HERE);
fmt::throw_exception("sys_prx: Unimplemented fixed address allocations");
}
for (s32 i = 0; i < count; ++i)
@ -492,7 +492,7 @@ error_code _sys_prx_stop_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr<sys_
case PRX_STATE_STARTING: return CELL_PRX_ERROR_ERROR; // Internal error
case PRX_STATE_STARTED: break;
default:
fmt::throw_exception("Invalid prx state (%d)" HERE, old);
fmt::throw_exception("Invalid prx state (%d)", old);
}
pOpt->entry.set(prx->stop ? prx->stop.addr() : ~0ull);
@ -529,7 +529,7 @@ error_code _sys_prx_stop_module(ppu_thread& ppu, u32 id, u64 flags, vm::ptr<sys_
case PRX_STATE_STARTING: return CELL_PRX_ERROR_ERROR; // Internal error
case PRX_STATE_STARTED: break;
default:
fmt::throw_exception("Invalid prx state (%d)" HERE, old);
fmt::throw_exception("Invalid prx state (%d)", old);
}
if (pOpt->cmd == 4u)

View File

@ -84,7 +84,7 @@ void lv2_rsx_config::send_event(u64 data1, u64 event_flags, u64 data3) const
if (error && error + 0u != CELL_ENOTCONN)
{
fmt::throw_exception("lv2_rsx_config::send_event() Failed to send event! (error=%x)" HERE, +error);
fmt::throw_exception("lv2_rsx_config::send_event() Failed to send event! (error=%x)", +error);
}
}
@ -150,7 +150,7 @@ error_code sys_rsx_memory_free(cpu_thread& cpu, u32 mem_handle)
if (g_fxo->get<lv2_rsx_config>()->context_base)
{
fmt::throw_exception("Attempting to dealloc rsx memory when the context is still being used" HERE);
fmt::throw_exception("Attempting to dealloc rsx memory when the context is still being used");
}
if (!vm::dealloc(rsx::constants::local_mem_base))
@ -189,7 +189,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
if (rsx_cfg->context_base)
{
// We currently do not support multiple contexts
fmt::throw_exception("sys_rsx_context_allocate was called twice" HERE);
fmt::throw_exception("sys_rsx_context_allocate was called twice");
}
const auto area = vm::reserve_map(vm::rsx_context, 0, 0x10000000, 0x403);
@ -204,7 +204,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
*lpar_driver_info = context_base + 0x100000;
*lpar_reports = context_base + 0x200000;
auto &reports = vm::_ref<RsxReports>(vm::cast(*lpar_reports, HERE));
auto &reports = vm::_ref<RsxReports>(vm::cast(*lpar_reports));
std::memset(&reports, 0, sizeof(RsxReports));
for (size_t i = 0; i < std::size(reports.notify); ++i)
@ -225,7 +225,7 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
reports.report[i].pad = -1;
}
auto &driverInfo = vm::_ref<RsxDriverInfo>(vm::cast(*lpar_driver_info, HERE));
auto &driverInfo = vm::_ref<RsxDriverInfo>(vm::cast(*lpar_driver_info));
std::memset(&driverInfo, 0, sizeof(RsxDriverInfo));
@ -240,9 +240,9 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
driverInfo.systemModeFlags = static_cast<u32>(system_mode);
driverInfo.hardware_channel = 1; // * i think* this 1 for games, 0 for vsh
rsx_cfg->driver_info = vm::cast(*lpar_driver_info, HERE);
rsx_cfg->driver_info = vm::cast(*lpar_driver_info);
auto &dmaControl = vm::_ref<RsxDmaControl>(vm::cast(*lpar_dma_control, HERE));
auto &dmaControl = vm::_ref<RsxDmaControl>(vm::cast(*lpar_dma_control));
dmaControl.get = 0;
dmaControl.put = 0;
dmaControl.ref = 0; // Set later to -1 by cellGcmSys
@ -263,15 +263,15 @@ error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm
sys_event_queue_create(cpu, vm::get_addr(&driverInfo.handler_queue), attr, 0, 0x20);
sys_event_port_connect_local(cpu, rsx_cfg->rsx_event_port, driverInfo.handler_queue);
rsx_cfg->dma_address = vm::cast(*lpar_dma_control, HERE);
rsx_cfg->dma_address = vm::cast(*lpar_dma_control);
const auto render = rsx::get_current_renderer();
render->display_buffers_count = 0;
render->current_display_buffer = 0;
render->label_addr = vm::cast(*lpar_reports, HERE);
render->label_addr = vm::cast(*lpar_reports);
render->device_addr = rsx_cfg->device_addr;
render->local_mem_size = rsx_cfg->memory_size;
render->init(vm::cast(*lpar_dma_control, HERE));
render->init(vm::cast(*lpar_dma_control));
rsx_cfg->context_base = context_base;
*context_id = 0x55555555;
@ -617,7 +617,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
{
case CELL_GCM_LOCATION_MAIN: limit = render->main_mem_size; break;
case CELL_GCM_LOCATION_LOCAL: limit = render->local_mem_size; break;
default: fmt::throw_exception("sys_rsx_context_attribute(): Unexpected location value (location=0x%x)" HERE, location);
default: fmt::throw_exception("sys_rsx_context_attribute(): Unexpected location value (location=0x%x)", location);
}
if (!range.valid() || range.end >= limit)

View File

@ -54,7 +54,7 @@ void sys_spu_image::load(const fs::file& stream)
if (obj != elf_error::ok)
{
fmt::throw_exception("Failed to load SPU image: %s" HERE, obj.get_error());
fmt::throw_exception("Failed to load SPU image: %s", obj.get_error());
}
for (const auto& shdr : obj.shdrs)
@ -87,7 +87,7 @@ void sys_spu_image::load(const fs::file& stream)
if (nsegs <= 0 || nsegs > 0x20 || sys_spu_image::fill(segs, nsegs, obj.progs, src) != nsegs)
{
fmt::throw_exception("Failed to load SPU segments (%d)" HERE, nsegs);
fmt::throw_exception("Failed to load SPU segments (%d)", nsegs);
}
// Write ID and save entry
@ -2244,7 +2244,7 @@ error_code raw_spu_set_spu_cfg(u32 id, u32 value)
{
if (value > 3)
{
fmt::throw_exception("Unexpected value (0x%x)" HERE, value);
fmt::throw_exception("Unexpected value (0x%x)", value);
}
const auto thread = idm::get<named_thread<spu_thread>>(spu_thread::find_raw_spu(id));

View File

@ -61,14 +61,14 @@ error_code sys_ss_random_number_generator(u64 pkg_id, vm::ptr<void> buf, u64 siz
#ifdef _WIN32
if (auto ret = BCryptGenRandom(nullptr, temp.get(), static_cast<ULONG>(size), BCRYPT_USE_SYSTEM_PREFERRED_RNG))
{
fmt::throw_exception("sys_ss_random_number_generator(): BCryptGenRandom failed (0x%08x)" HERE, ret);
fmt::throw_exception("sys_ss_random_number_generator(): BCryptGenRandom failed (0x%08x)", ret);
}
#else
fs::file rnd{"/dev/urandom"};
if (!rnd || rnd.read(temp.get(), size) != size)
{
fmt::throw_exception("sys_ss_random_number_generator(): Failed to generate pseudo-random numbers" HERE);
fmt::throw_exception("sys_ss_random_number_generator(): Failed to generate pseudo-random numbers");
}
#endif

View File

@ -266,7 +266,7 @@ void usb_handler_thread::operator()()
{
auto transfer = *it;
ASSERT(transfer->busy && transfer->fake);
ensure(transfer->busy && transfer->fake);
if (transfer->expected_time > timestamp)
{

View File

@ -220,7 +220,7 @@ int gdb_thread::read(void* buf, int cnt)
}
GDB.error("Error during socket read.");
fmt::throw_exception("Error during socket read" HERE);
fmt::throw_exception("Error during socket read");
}
return result;
}
@ -232,7 +232,7 @@ char gdb_thread::read_char()
char result;
int cnt = read(&result, 1);
if (!cnt) {
fmt::throw_exception("Tried to read char, but no data was available" HERE);
fmt::throw_exception("Tried to read char, but no data was available");
}
return result;
}
@ -261,7 +261,7 @@ bool gdb_thread::try_read_cmd(gdb_cmd& out_cmd)
c = read_char();
}
if (c != '$') {
fmt::throw_exception("Expected start of packet character '$', got '%c' instead" HERE, c);
fmt::throw_exception("Expected start of packet character '$', got '%c' instead", c);
}
}
//clear packet data
@ -516,7 +516,7 @@ void gdb_thread::wait_with_interrupts()
}
GDB.error("Error during socket read.");
fmt::throw_exception("Error during socket read" HERE);
fmt::throw_exception("Error during socket read");
} else if (c == 0x03) {
paused = true;
}

View File

@ -242,7 +242,7 @@ namespace vm
{
if (range_lock < g_range_lock_set || range_lock >= std::end(g_range_lock_set))
{
fmt::throw_exception("Invalid range lock" HERE);
fmt::throw_exception("Invalid range lock");
}
range_lock->release(0);
@ -284,7 +284,7 @@ namespace vm
// Shouldn't really happen
if (size == 0)
{
vm_log.warning("Tried to lock empty range (flags=0x%x, addr=0x%x)" HERE, flags >> 32, addr);
vm_log.warning("Tried to lock empty range (flags=0x%x, addr=0x%x)", flags >> 32, addr);
g_range_lock.release(0);
return;
}
@ -292,7 +292,7 @@ namespace vm
// Limit to <512 MiB at once; make sure if it operates on big amount of data, it's page-aligned
if (size >= 512 * 1024 * 1024 || (size > 65536 && size % 4096))
{
fmt::throw_exception("Failed to lock range (flags=0x%x, addr=0x%x, size=0x%x)" HERE, flags >> 32, addr, size);
fmt::throw_exception("Failed to lock range (flags=0x%x, addr=0x%x, size=0x%x)", flags >> 32, addr, size);
}
// Block or signal new range locks
@ -660,14 +660,14 @@ namespace vm
if (!size || (size | addr) % 4096 || flags & page_allocated)
{
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)", addr, size);
}
for (u32 i = addr / 4096; i < addr / 4096 + size / 4096; i++)
{
if (g_pages[i])
{
fmt::throw_exception("Memory already mapped (addr=0x%x, size=0x%x, flags=0x%x, current_addr=0x%x)" HERE, addr, size, flags, i * 4096);
fmt::throw_exception("Memory already mapped (addr=0x%x, size=0x%x, flags=0x%x, current_addr=0x%x)", addr, size, flags, i * 4096);
}
}
@ -763,7 +763,7 @@ namespace vm
{
if (g_pages[i].exchange(flags | page_allocated))
{
fmt::throw_exception("Concurrent access (addr=0x%x, size=0x%x, flags=0x%x, current_addr=0x%x)" HERE, addr, size, flags, i * 4096);
fmt::throw_exception("Concurrent access (addr=0x%x, size=0x%x, flags=0x%x, current_addr=0x%x)", addr, size, flags, i * 4096);
}
}
@ -779,7 +779,7 @@ namespace vm
if (!size || (size | addr) % 4096)
{
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)", addr, size);
}
const u8 flags_both = flags_set & flags_clear;
@ -863,7 +863,7 @@ namespace vm
if (!max_size || (max_size | addr) % 4096)
{
fmt::throw_exception("Invalid arguments (addr=0x%x, max_size=0x%x)" HERE, addr, max_size);
fmt::throw_exception("Invalid arguments (addr=0x%x, max_size=0x%x)", addr, max_size);
}
// Determine deallocation size
@ -907,7 +907,7 @@ namespace vm
{
if (!(g_pages[i] & page_allocated))
{
fmt::throw_exception("Concurrent access (addr=0x%x, size=0x%x, current_addr=0x%x)" HERE, addr, size, i * 4096);
fmt::throw_exception("Concurrent access (addr=0x%x, size=0x%x, current_addr=0x%x)", addr, size, i * 4096);
}
g_pages[i].release(0);
@ -998,7 +998,7 @@ namespace vm
if (!block)
{
fmt::throw_exception("Invalid memory location (%u)" HERE, +location);
fmt::throw_exception("Invalid memory location (%u)", +location);
}
return block->alloc(size, nullptr, align);
@ -1010,7 +1010,7 @@ namespace vm
if (!block)
{
fmt::throw_exception("Invalid memory location (%u, addr=0x%x)" HERE, +location, addr);
fmt::throw_exception("Invalid memory location (%u, addr=0x%x)", +location, addr);
}
return block->falloc(addr, size);
@ -1022,7 +1022,7 @@ namespace vm
if (!block)
{
fmt::throw_exception("Invalid memory location (%u, addr=0x%x)" HERE, +location, addr);
fmt::throw_exception("Invalid memory location (%u, addr=0x%x)", +location, addr);
}
return block->dealloc(addr);
@ -1184,7 +1184,7 @@ namespace vm
// Check alignment (it's page allocation, so passing small values there is just silly)
if (align < min_page_size || align != (0x80000000u >> std::countl_zero(align)))
{
fmt::throw_exception("Invalid alignment (size=0x%x, align=0x%x)" HERE, size, align);
fmt::throw_exception("Invalid alignment (size=0x%x, align=0x%x)", size, align);
}
// Return if size is invalid
@ -1427,7 +1427,7 @@ namespace vm
{
if (!size || (size | addr) % 4096)
{
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)", addr, size);
}
if (!_test_map(addr, size))
@ -1439,7 +1439,7 @@ namespace vm
{
if (g_pages[i])
{
fmt::throw_exception("Unexpected pages allocated (current_addr=0x%x)" HERE, i * 4096);
fmt::throw_exception("Unexpected pages allocated (current_addr=0x%x)", i * 4096);
}
}
@ -1492,7 +1492,7 @@ namespace vm
// Check alignment
if (align < 0x10000 || align != (0x80000000u >> std::countl_zero(align)))
{
fmt::throw_exception("Invalid alignment (size=0x%x, align=0x%x)" HERE, size, align);
fmt::throw_exception("Invalid alignment (size=0x%x, align=0x%x)", size, align);
}
// Return if size is invalid

View File

@ -173,12 +173,11 @@ namespace vm
template<>
struct cast_impl<u32>
{
static vm::addr_t cast(u32 addr, const char* /*loc*/)
{
return static_cast<vm::addr_t>(addr);
}
static vm::addr_t cast(u32 addr)
static vm::addr_t cast(u32 addr,
u32 line,
u32 col,
const char* file,
const char* func)
{
return static_cast<vm::addr_t>(addr);
}
@ -187,12 +186,11 @@ namespace vm
template<>
struct cast_impl<u64>
{
static vm::addr_t cast(u64 addr, const char* /*loc*/)
{
return static_cast<vm::addr_t>(static_cast<u32>(addr));
}
static vm::addr_t cast(u64 addr)
static vm::addr_t cast(u64 addr,
u32 line,
u32 col,
const char* file,
const char* func)
{
return static_cast<vm::addr_t>(static_cast<u32>(addr));
}
@ -201,27 +199,24 @@ namespace vm
template<typename T, bool Se>
struct cast_impl<se_t<T, Se>>
{
static vm::addr_t cast(const se_t<T, Se>& addr, const char* loc)
static vm::addr_t cast(const se_t<T, Se>& addr,
u32 line,
u32 col,
const char* file,
const char* func)
{
return cast_impl<T>::cast(addr, loc);
}
static vm::addr_t cast(const se_t<T, Se>& addr)
{
return cast_impl<T>::cast(addr);
return cast_impl<T>::cast(addr, line, col, file, func);
}
};
template<typename T>
vm::addr_t cast(const T& addr, const char* loc)
vm::addr_t cast(const T& addr,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION())
{
return cast_impl<T>::cast(addr, loc);
}
template<typename T>
vm::addr_t cast(const T& addr)
{
return cast_impl<T>::cast(addr);
return cast_impl<T>::cast(addr, line, col, file, func);
}
// Convert specified PS3/PSV virtual memory address to a pointer for common access

View File

@ -56,7 +56,7 @@ namespace vm
template<typename T2, typename AT2, typename = std::enable_if_t<std::is_convertible<T*, T2*>::value>>
operator _ptr_base<T2, AT2>() const
{
return vm::cast(m_addr, HERE);
return vm::cast(m_addr);
}
explicit operator bool() const
@ -68,39 +68,39 @@ namespace vm
template <typename MT, typename T2, typename = if_comparable_t<T, T2>>
_ptr_base<MT, u32> ptr(MT T2::*const mptr) const
{
return vm::cast(vm::cast(m_addr, HERE) + offset32(mptr));
return vm::cast(vm::cast(m_addr) + offset32(mptr));
}
// Get vm pointer to a struct member with array subscription
template <typename MT, typename T2, typename ET = std::remove_extent_t<MT>, typename = if_comparable_t<T, T2>>
_ptr_base<ET, u32> ptr(MT T2::*const mptr, u32 index) const
{
return vm::cast(vm::cast(m_addr, HERE) + offset32(mptr) + u32{sizeof(ET)} * index);
return vm::cast(vm::cast(m_addr) + offset32(mptr) + u32{sizeof(ET)} * index);
}
// Get vm reference to a struct member
template <typename MT, typename T2, typename = if_comparable_t<T, T2>>
_ref_base<MT, u32> ref(MT T2::*const mptr) const
{
return vm::cast(vm::cast(m_addr, HERE) + offset32(mptr));
return vm::cast(vm::cast(m_addr) + offset32(mptr));
}
// Get vm reference to a struct member with array subscription
template <typename MT, typename T2, typename ET = std::remove_extent_t<MT>, typename = if_comparable_t<T, T2>>
_ref_base<ET, u32> ref(MT T2::*const mptr, u32 index) const
{
return vm::cast(vm::cast(m_addr, HERE) + offset32(mptr) + u32{sizeof(ET)} * index);
return vm::cast(vm::cast(m_addr) + offset32(mptr) + u32{sizeof(ET)} * index);
}
// Get vm reference
_ref_base<T, u32> ref() const
{
return vm::cast(m_addr, HERE);
return vm::cast(m_addr);
}
T* get_ptr() const
{
return static_cast<T*>(vm::base(vm::cast(m_addr, HERE)));
return static_cast<T*>(vm::base(vm::cast(m_addr)));
}
T* operator ->() const
@ -110,12 +110,12 @@ namespace vm
std::add_lvalue_reference_t<T> operator *() const
{
return *static_cast<T*>(vm::base(vm::cast(m_addr, HERE)));
return *static_cast<T*>(vm::base(vm::cast(m_addr)));
}
std::add_lvalue_reference_t<T> operator [](u32 index) const
{
return *static_cast<T*>(vm::base(vm::cast(m_addr, HERE) + u32{sizeof(T)} * index));
return *static_cast<T*>(vm::base(vm::cast(m_addr) + u32{sizeof(T)} * index));
}
// Test address for arbitrary alignment: (addr & (align - 1)) == 0
@ -138,77 +138,77 @@ namespace vm
_ptr_base<T, u32> operator +() const
{
return vm::cast(m_addr, HERE);
return vm::cast(m_addr);
}
_ptr_base<T, u32> operator +(u32 count) const
{
return vm::cast(vm::cast(m_addr, HERE) + count * size());
return vm::cast(vm::cast(m_addr) + count * size());
}
_ptr_base<T, u32> operator -(u32 count) const
{
return vm::cast(vm::cast(m_addr, HERE) - count * size());
return vm::cast(vm::cast(m_addr) - count * size());
}
friend _ptr_base<T, u32> operator +(u32 count, const _ptr_base& ptr)
{
return vm::cast(vm::cast(ptr.m_addr, HERE) + count * size());
return vm::cast(vm::cast(ptr.m_addr) + count * size());
}
// Pointer difference operator
template<typename T2, typename AT2>
std::enable_if_t<std::is_object<T2>::value && std::is_same<std::decay_t<T>, std::decay_t<T2>>::value, s32> operator -(const _ptr_base<T2, AT2>& right) const
{
return static_cast<s32>(vm::cast(m_addr, HERE) - vm::cast(right.m_addr, HERE)) / size();
return static_cast<s32>(vm::cast(m_addr) - vm::cast(right.m_addr)) / size();
}
_ptr_base operator ++(int)
{
_ptr_base result = *this;
m_addr = vm::cast(m_addr, HERE) + size();
m_addr = vm::cast(m_addr) + size();
return result;
}
_ptr_base& operator ++()
{
m_addr = vm::cast(m_addr, HERE) + size();
m_addr = vm::cast(m_addr) + size();
return *this;
}
_ptr_base operator --(int)
{
_ptr_base result = *this;
m_addr = vm::cast(m_addr, HERE) - size();
m_addr = vm::cast(m_addr) - size();
return result;
}
_ptr_base& operator --()
{
m_addr = vm::cast(m_addr, HERE) - size();
m_addr = vm::cast(m_addr) - size();
return *this;
}
_ptr_base& operator +=(s32 count)
{
m_addr = vm::cast(m_addr, HERE) + count * size();
m_addr = vm::cast(m_addr) + count * size();
return *this;
}
_ptr_base& operator -=(s32 count)
{
m_addr = vm::cast(m_addr, HERE) - count * size();
m_addr = vm::cast(m_addr) - count * size();
return *this;
}
bool try_read(std::conditional_t<std::is_void_v<T>, char&, std::add_lvalue_reference_t<std::remove_const_t<T>>> out) const
{
return vm::try_access(vm::cast(m_addr, HERE), &out, sizeof(T), false);
return vm::try_access(vm::cast(m_addr), &out, sizeof(T), false);
}
bool try_write(std::conditional_t<std::is_void_v<T>, const char&, std::add_lvalue_reference_t<const T>> _in) const
{
return vm::try_access(vm::cast(m_addr, HERE), const_cast<T*>(&_in), sizeof(T), true);
return vm::try_access(vm::cast(m_addr), const_cast<T*>(&_in), sizeof(T), true);
}
};
@ -248,7 +248,7 @@ namespace vm
template<typename AT2>
operator _ptr_base<RT(T...), AT2>() const
{
return vm::cast(m_addr, HERE);
return vm::cast(m_addr);
}
explicit operator bool() const
@ -258,7 +258,7 @@ namespace vm
_ptr_base<RT(T...), u32> operator +() const
{
return vm::cast(m_addr, HERE);
return vm::cast(m_addr);
}
// Callback; defined in PPUCallback.h, passing context is mandatory
@ -314,21 +314,21 @@ namespace vm
template<typename CT, typename T, typename AT, typename = decltype(static_cast<to_be_t<CT>*>(std::declval<T*>()))>
inline _ptr_base<to_be_t<CT>, u32> static_ptr_cast(const _ptr_base<T, AT>& other)
{
return vm::cast(other.addr(), HERE);
return vm::cast(other.addr());
}
// Perform const_cast (for example, vm::cptr<char> to vm::ptr<char>)
template<typename CT, typename T, typename AT, typename = decltype(const_cast<to_be_t<CT>*>(std::declval<T*>()))>
inline _ptr_base<to_be_t<CT>, u32> const_ptr_cast(const _ptr_base<T, AT>& other)
{
return vm::cast(other.addr(), HERE);
return vm::cast(other.addr());
}
// Perform reinterpret cast
template <typename CT, typename T, typename AT, typename = decltype(reinterpret_cast<to_be_t<CT>*>(std::declval<T*>()))>
inline _ptr_base<to_be_t<CT>, u32> unsafe_ptr_cast(const _ptr_base<T, AT>& other)
{
return vm::cast(other.addr(), HERE);
return vm::cast(other.addr());
}
}

View File

@ -39,13 +39,13 @@ namespace vm
T& get_ref() const
{
return *static_cast<T*>(vm::base(vm::cast(m_addr, HERE)));
return *static_cast<T*>(vm::base(vm::cast(m_addr)));
}
// convert to vm pointer
vm::_ptr_base<T, u32> ptr() const
{
return vm::cast(m_addr, HERE);
return vm::cast(m_addr);
}
operator simple_t<T>() const

View File

@ -199,7 +199,7 @@ u16 np_handler::RoomDataInternal_to_SceNpMatching2RoomDataInternal(const RoomDat
found = true;
}
}
ASSERT(found);
ensure(found);
}
member_info->natType = member->natType();
@ -377,7 +377,7 @@ void np_handler::RoomMessageInfo_to_SceNpMatching2RoomMessageInfo(const RoomMess
break;
}
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST_TEAM: sce_mi->dst->multicastTargetTeamId = mi->dst()->Get(0); break;
default: ASSERT(false);
default: ensure(false);
}
if (auto src_member = mi->srcMember())

View File

@ -5,7 +5,7 @@
score_ctx::score_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
{
ASSERT(!communicationId->term && strlen(communicationId->data) == 9);
ensure(!communicationId->term && strlen(communicationId->data) == 9);
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
}
@ -33,7 +33,7 @@ bool destroy_score_transaction_context(s32 ctx_id)
match2_ctx::match2_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
{
ASSERT(!communicationId->term && strlen(communicationId->data) == 9);
ensure(!communicationId->term && strlen(communicationId->data) == 9);
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
}
@ -55,8 +55,8 @@ std::shared_ptr<match2_ctx> get_match2_context(u16 ctx_id)
}
lookup_title_ctx::lookup_title_ctx(vm::cptr<SceNpCommunicationId> communicationId)
{
ASSERT(!communicationId->term && strlen(communicationId->data) == 9);
{
ensure(!communicationId->term && strlen(communicationId->data) == 9);
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
}
s32 create_lookup_title_context(vm::cptr<SceNpCommunicationId> communicationId)

View File

@ -21,7 +21,7 @@
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
@ -102,13 +102,13 @@ np_handler::np_handler()
bool np_handler::discover_ip_address()
{
std::array<char, 1024> hostname;
if (gethostname(hostname.data(), hostname.size()) == -1)
{
nph_log.error("gethostname failed in IP discovery!");
return false;
}
hostent *host = gethostbyname(hostname.data());
if (!host)
{
@ -315,7 +315,7 @@ void np_handler::init_NP(u32 poolsize, vm::ptr<void> poolptr)
if (g_cfg.net.psn_status >= np_psn_status::fake)
{
std::string s_npid = g_cfg_rpcn.get_npid();
ASSERT(!s_npid.empty()); // It should have been generated before this
ensure(!s_npid.empty()); // It should have been generated before this
np_handler::string_to_npid(s_npid.c_str(), &npid);
const auto sigh = g_fxo->get<named_thread<signaling_handler>>();
@ -336,7 +336,7 @@ void np_handler::init_NP(u32 poolsize, vm::ptr<void> poolptr)
{
if (!is_psn_active)
break;
// Connect RPCN client
if (!rpcn.connect(g_cfg_rpcn.get_host()))
{
@ -1014,7 +1014,7 @@ bool np_handler::reply_req_sign_infos(u32 req_id, std::vector<u8>& reply_data)
{
if (!pending_sign_infos_requests.count(req_id))
return error_and_disconnect("Unexpected reply ID to req RequestSignalingInfos");
u32 conn_id = pending_sign_infos_requests.at(req_id);
pending_sign_infos_requests.erase(req_id);
@ -1024,7 +1024,7 @@ bool np_handler::reply_req_sign_infos(u32 req_id, std::vector<u8>& reply_data)
if (reply.is_error())
return error_and_disconnect("Malformed reply to RequestSignalingInfos command");
const auto sigh = g_fxo->get<named_thread<signaling_handler>>();
sigh->start_sig(conn_id, addr, port);
@ -1038,7 +1038,7 @@ bool np_handler::reply_req_ticket(u32 req_id, std::vector<u8>& reply_data)
if (reply.is_error())
return error_and_disconnect("Malformed reply to RequestTicket command");
current_ticket = std::move(ticket_raw);
auto ticket_size = static_cast<s32>(current_ticket.size());
@ -1328,7 +1328,7 @@ u32 np_handler::generate_callback_info(SceNpMatching2ContextId ctx_id, vm::cptr<
callback_info ret;
const auto ctx = get_match2_context(ctx_id);
ASSERT(ctx);
ensure(ctx);
const u32 req_id = get_req_id(optParam ? optParam->appReqId : ctx->default_match2_optparam.appReqId);

View File

@ -1044,7 +1044,7 @@ bool rpcn_client::send_room_message(u32 req_id, const SceNpCommunicationId& comm
dst.push_back(req->dst.multicastTargetTeamId);
break;
default:
ASSERT(false);
ensure(false);
break;
}
@ -1154,6 +1154,6 @@ bool rpcn_client::is_abort()
void rpcn_client::abort()
{
ASSERT(in_config);
ensure(in_config);
abort_config = true;
}

View File

@ -377,7 +377,7 @@ void signaling_handler::wake_up()
void signaling_handler::update_si_addr(std::shared_ptr<signaling_info>& si, u32 new_addr, u16 new_port)
{
ASSERT(si);
ensure(si);
if (si->addr != new_addr || si->port != new_port)
{
@ -399,7 +399,7 @@ void signaling_handler::update_si_status(std::shared_ptr<signaling_info>& si, s3
if (si->connStatus == SCE_NP_SIGNALING_CONN_STATUS_PENDING && new_status == SCE_NP_SIGNALING_CONN_STATUS_ACTIVE)
{
si->connStatus = SCE_NP_SIGNALING_CONN_STATUS_ACTIVE;
ASSERT(si->version == 1u || si->version == 2u);
ensure(si->version == 1u || si->version == 2u);
if (si->version == 1u)
signal_sig_callback(si->conn_id, SCE_NP_SIGNALING_EVENT_ESTABLISHED);
else
@ -411,7 +411,7 @@ void signaling_handler::update_si_status(std::shared_ptr<signaling_info>& si, s3
if ((si->connStatus == SCE_NP_SIGNALING_CONN_STATUS_PENDING || si->connStatus == SCE_NP_SIGNALING_CONN_STATUS_ACTIVE) && new_status == SCE_NP_SIGNALING_CONN_STATUS_INACTIVE)
{
si->connStatus = SCE_NP_SIGNALING_CONN_STATUS_INACTIVE;
ASSERT(si->version == 1u || si->version == 2u);
ensure(si->version == 1u || si->version == 2u);
if (si->version == 1u)
signal_sig_callback(si->conn_id, SCE_NP_SIGNALING_EVENT_DEAD);
else
@ -557,7 +557,7 @@ void signaling_handler::disconnect_sig2_users(u64 room_id)
u32 signaling_handler::create_sig_infos(const SceNpId* npid)
{
ASSERT(npid->handle.term == 0);
ensure(npid->handle.term == 0);
std::string npid_str(reinterpret_cast<const char*>(npid->handle.data));
if (npid_to_conn_id.count(npid_str))

View File

@ -53,7 +53,7 @@ namespace rsx
// capture fragment shader mem
const auto [program_offset, program_location] = method_registers.shader_program_address();
const u32 addr = get_address(program_offset, program_location, HERE);
const u32 addr = get_address(program_offset, program_location);
const auto program_info = program_hash_util::fragment_program_utils::analyse_fragment_program(vm::base(addr));
const u32 program_start = program_info.program_start_offset;
const u32 ucode_size = program_info.program_ucode_length;
@ -74,7 +74,7 @@ namespace rsx
if (!tex.enabled())
continue;
const u32 texaddr = get_address(tex.offset(), tex.location(), HERE);
const u32 texaddr = get_address(tex.offset(), tex.location());
auto layout = get_subresources_layout(tex);
// todo: dont use this function and just get size somehow
@ -100,7 +100,7 @@ namespace rsx
if (!tex.enabled())
continue;
const u32 texaddr = get_address(tex.offset(), tex.location(), HERE);
const u32 texaddr = get_address(tex.offset(), tex.location());
auto layout = get_subresources_layout(tex);
// todo: dont use this function and just get size somehow
@ -138,7 +138,7 @@ namespace rsx
const u32 base_address = get_vertex_offset_from_base(method_registers.vertex_data_base_offset(), info.offset() & 0x7fffffff);
const u32 memory_location = info.offset() >> 31;
const u32 addr = get_address(base_address, memory_location, HERE);
const u32 addr = get_address(base_address, memory_location);
const u32 vertSize = get_vertex_type_size_on_host(info.type(), info.size());
const u32 vertStride = info.stride();
@ -170,7 +170,7 @@ namespace rsx
const auto index_type = method_registers.index_type();
const u32 type_size = get_index_type_size(index_type);
const u32 base_addr = get_address(base_address, memory_location, HERE) & (0 - type_size);
const u32 base_addr = get_address(base_address, memory_location) & (0 - type_size);
// manually parse index buffer and copy vertex buffer
u32 min_index = 0xFFFFFFFF, max_index = 0;
@ -247,7 +247,7 @@ namespace rsx
const u32 base_address = get_vertex_offset_from_base(method_registers.vertex_data_base_offset(), (info.offset() & 0x7fffffff));
const u32 memory_location = info.offset() >> 31;
const u32 addr = get_address(base_address, memory_location, HERE);
const u32 addr = get_address(base_address, memory_location);
const u32 vertSize = get_vertex_type_size_on_host(info.type(), info.size());
const u32 bufferSize = vertStride * (max_index - min_index + 1) + vertSize;
@ -300,7 +300,7 @@ namespace rsx
block.offset = src_offset + in_offset;
block.location = src_dma & 0xf;
const auto src_address = rsx::get_address(block.offset, block.location, HERE);
const auto src_address = rsx::get_address(block.offset, block.location);
u8* pixels_src = vm::_ptr<u8>(src_address);
const u32 src_size = in_pitch * (in_h - 1) + (in_w * in_bpp);
@ -323,7 +323,7 @@ namespace rsx
u32 src_offset = method_registers.nv0039_input_offset();
u32 src_dma = method_registers.nv0039_input_location();
u32 src_addr = get_address(src_offset, src_dma, HERE);
u32 src_addr = get_address(src_offset, src_dma);
rsx->read_barrier(src_addr, in_pitch * (line_count - 1) + line_length, true);

View File

@ -113,7 +113,7 @@ namespace rsx
fmt::throw_exception("requested memory data state for command not found in memory_data_map");
const auto& data_block = it_data->second;
std::memcpy(vm::base(get_address(memblock.offset, memblock.location, HERE)), data_block.data.data(), data_block.data.size());
std::memcpy(vm::base(get_address(memblock.offset, memblock.location)), data_block.data.data(), data_block.data.size());
}
if (replay_cmd.display_buffer_state != 0 && replay_cmd.display_buffer_state != cs.display_buffer_hash)

View File

@ -798,7 +798,7 @@ namespace
}
else
{
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
remaining -= written;
@ -986,7 +986,7 @@ namespace
}
else
{
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}
@ -1150,7 +1150,7 @@ bool is_primitive_native(rsx::primitive_type draw_mode)
break;
}
fmt::throw_exception("Wrong primitive type" HERE);
fmt::throw_exception("Wrong primitive type");
}
bool is_primitive_disjointed(rsx::primitive_type draw_mode)
@ -1196,7 +1196,7 @@ u32 get_index_type_size(rsx::index_array_type type)
case rsx::index_array_type::u16: return sizeof(u16);
case rsx::index_array_type::u32: return sizeof(u32);
}
fmt::throw_exception("Wrong index type" HERE);
fmt::throw_exception("Wrong index type");
}
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, rsx::primitive_type draw_mode, unsigned count)
@ -1237,12 +1237,12 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst,
case rsx::primitive_type::line_strip:
case rsx::primitive_type::triangles:
case rsx::primitive_type::triangle_strip:
fmt::throw_exception("Native primitive type doesn't require expansion" HERE);
fmt::throw_exception("Native primitive type doesn't require expansion");
case rsx::primitive_type::invalid:
break;
}
fmt::throw_exception("Tried to load invalid primitive type" HERE);
fmt::throw_exception("Tried to load invalid primitive type");
}
@ -1288,7 +1288,7 @@ namespace
return expand_indexed_quads<T>(src, dst, restart_index_enabled, restart_index);
}
default:
fmt::throw_exception("Unknown draw mode (0x%x)" HERE, static_cast<u8>(draw_mode));
fmt::throw_exception("Unknown draw mode (0x%x)", static_cast<u8>(draw_mode));
}
}
}
@ -1311,7 +1311,7 @@ std::tuple<u32, u32, u32> write_index_array_data_to_buffer(gsl::span<std::byte>
as_const_span<const be_t<u32>>(src_ptr), draw_mode, restart_index_enabled, restart_index, expands);
}
default:
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}

View File

@ -208,7 +208,7 @@ namespace glsl
}
}
fmt::throw_exception("Unknown compare function" HERE);
fmt::throw_exception("Unknown compare function");
}
static void insert_vertex_input_fetch(std::stringstream& OS, glsl_rules rules, bool glsl4_compliant=true)

View File

@ -302,7 +302,7 @@ public:
case 3:
return other_var + ".xyz";
default:
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}
else
@ -366,7 +366,7 @@ struct vertex_reg_info
case xall:
return (val && val != check_mask_value);
default:
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}

View File

@ -425,7 +425,7 @@ std::tuple<u16, u16, u8> get_height_depth_layer(const RsxTextureType &tex)
case rsx::texture_dimension_extended::texture_dimension_cubemap: return std::make_tuple(tex.height(), 1, 6);
case rsx::texture_dimension_extended::texture_dimension_3d: return std::make_tuple(tex.height(), tex.depth(), 1);
}
fmt::throw_exception("Unsupported texture dimension" HERE);
fmt::throw_exception("Unsupported texture dimension");
}
}
@ -442,7 +442,7 @@ std::vector<rsx::subresource_layout> get_subresources_layout_impl(const RsxTextu
const auto format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
const auto pitch = texture.pitch();
const u32 texaddr = rsx::get_address(texture.offset(), texture.location(), HERE);
const u32 texaddr = rsx::get_address(texture.offset(), texture.location());
auto pixels = vm::_ptr<const std::byte>(texaddr);
const bool is_swizzled = !(texture.format() & CELL_GCM_TEXTURE_LN);
@ -501,7 +501,7 @@ std::vector<rsx::subresource_layout> get_subresources_layout_impl(const RsxTextu
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
return get_subresources_layout_impl<4, u128>(pixels, w, h, depth, layer, texture.get_exact_mipmap_count(), pitch, !is_swizzled, false);
}
fmt::throw_exception("Wrong format 0x%x" HERE, format);
fmt::throw_exception("Wrong format 0x%x", format);
}
namespace rsx
@ -667,7 +667,7 @@ namespace rsx
}
default:
fmt::throw_exception("Wrong format 0x%x" HERE, format);
fmt::throw_exception("Wrong format 0x%x", format);
}
if (word_size)
@ -834,7 +834,7 @@ namespace rsx
case rsx::surface_color_format::w32z32y32x32:
return 16;
default:
fmt::throw_exception("Invalid color format 0x%x" HERE, static_cast<u32>(format));
fmt::throw_exception("Invalid color format 0x%x", static_cast<u32>(format));
}
}

View File

@ -88,7 +88,7 @@ public:
if (!can_alloc<Alignment>(size) && !grow(aligned_put_pos + alloc_size))
{
fmt::throw_exception("[%s] Working buffer not big enough, buffer_length=%d allocated=%d requested=%d guard=%d largest_pool=%d" HERE,
fmt::throw_exception("[%s] Working buffer not big enough, buffer_length=%d allocated=%d requested=%d guard=%d largest_pool=%d",
m_name, m_size, m_current_allocated_size, size, m_min_guard_size, m_largest_allocated_pool);
}
@ -139,7 +139,7 @@ public:
else if (m_get_pos > m_put_pos)
m_current_allocated_size = (m_put_pos + (m_size - m_get_pos - 1));
else
fmt::throw_exception("m_put_pos == m_get_pos!" HERE);
fmt::throw_exception("m_put_pos == m_get_pos!");
}
size_t size() const

View File

@ -16,7 +16,7 @@ namespace rsx
case surface_target::surfaces_a_b_c: return{ 0, 1, 2 };
case surface_target::surfaces_a_b_c_d: return{ 0, 1, 2, 3 };
}
fmt::throw_exception("Wrong color_target" HERE);
fmt::throw_exception("Wrong color_target");
}
size_t get_aligned_pitch(surface_color_format format, u32 width)
@ -38,7 +38,7 @@ namespace rsx
case surface_color_format::w16z16y16x16: return align(width * 8, 256);
case surface_color_format::w32z32y32x32: return align(width * 16, 256);
}
fmt::throw_exception("Unknown color surface format" HERE);
fmt::throw_exception("Unknown color surface format");
}
size_t get_packed_pitch(surface_color_format format, u32 width)
@ -60,7 +60,7 @@ namespace rsx
case surface_color_format::w16z16y16x16: return width * 8;
case surface_color_format::w32z32y32x32: return width * 16;
}
fmt::throw_exception("Unknown color surface format" HERE);
fmt::throw_exception("Unknown color surface format");
}
}
}

View File

@ -757,7 +757,7 @@ namespace rsx
if (_It != m_depth_stencil_storage.end())
return Traits::get(_It->second);
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
surface_type get_color_surface_at(u32 address)

View File

@ -86,12 +86,12 @@ namespace rsx
//-------------------------
// It is illegal to have only exclusions except when reading from a range with only RO sections
ASSERT(flush_and_unprotect_count > 0 || exclude_count == 0 || cause.is_read());
ensure(flush_and_unprotect_count > 0 || exclude_count == 0 || cause.is_read());
if (flush_and_unprotect_count == 0 && exclude_count > 0)
{
// double-check that only RO sections exists
for (auto *tex : sections_to_exclude)
ASSERT(tex->get_protection() == utils::protection::ro);
ensure(tex->get_protection() == utils::protection::ro);
}
//-------------------------
@ -106,10 +106,10 @@ namespace rsx
const u16 min_flush_or_unprotect = min_overlap_fault;
// we must flush or unprotect *all* sections that partially overlap the fault range
ASSERT(flush_and_unprotect_count >= min_flush_or_unprotect);
ensure(flush_and_unprotect_count >= min_flush_or_unprotect);
// result must contain *all* sections that overlap (completely or partially) the invalidation range
ASSERT(flush_and_unprotect_count + exclude_count >= min_overlap_invalidate);
ensure(flush_and_unprotect_count + exclude_count >= min_overlap_invalidate);
}
void check_post_sanity() const
@ -572,7 +572,7 @@ namespace rsx
}
else
{
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}
@ -857,7 +857,7 @@ namespace rsx
continue;
}
fmt::throw_exception("Unreachable " HERE);
fmt::throw_exception("Unreachable");
}
@ -1005,7 +1005,7 @@ namespace rsx
#ifndef TEXTURE_CACHE_DEBUG
return &tex;
#else
ASSERT(res == nullptr);
ensure(res == nullptr);
res = &tex;
#endif
}
@ -1119,9 +1119,9 @@ namespace rsx
else
{
// Re-using clean fbo region
ASSERT(region.matches(rsx_range));
ASSERT(region.get_context() == texture_upload_context::framebuffer_storage);
ASSERT(region.get_image_type() == rsx::texture_dimension_extended::texture_dimension_2d);
ensure(region.matches(rsx_range));
ensure(region.get_context() == texture_upload_context::framebuffer_storage);
ensure(region.get_image_type() == rsx::texture_dimension_extended::texture_dimension_2d);
}
region.create(width, height, 1, 1, image, pitch, false, std::forward<Args>(extras)...);
@ -1451,7 +1451,7 @@ namespace rsx
default:
{
//Throw
fmt::throw_exception("Invalid deferred command op 0x%X" HERE, static_cast<u32>(desc.op));
fmt::throw_exception("Invalid deferred command op 0x%X", static_cast<u32>(desc.op));
}
}
@ -1747,7 +1747,7 @@ namespace rsx
{
image_section_attributes_t attributes{};
texture_cache_search_options options{};
attributes.address = rsx::get_address(tex.offset(), tex.location(), HERE);
attributes.address = rsx::get_address(tex.offset(), tex.location());
attributes.gcm_format = tex.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
attributes.bpp = get_format_block_size_in_bytes(attributes.gcm_format);
attributes.width = tex.width();

View File

@ -106,7 +106,7 @@ namespace rsx {
case utils::protection::no: return "NA";
case utils::protection::ro: return "RO";
case utils::protection::rw: return "RW";
default: fmt::throw_exception("Unreachable " HERE);
default: fmt::throw_exception("Unreachable");
}
}

View File

@ -194,7 +194,7 @@ namespace rsx
continue;
}
const auto buffer_range = address_range::start_length(rsx::get_address(buffer.offset, CELL_GCM_LOCATION_LOCAL, HERE), pitch * (buffer.height - 1) + (buffer.width * bpp));
const auto buffer_range = address_range::start_length(rsx::get_address(buffer.offset, CELL_GCM_LOCATION_LOCAL), pitch * (buffer.height - 1) + (buffer.width * bpp));
if (dst_range.inside(buffer_range))
{
// Match found

View File

@ -103,7 +103,7 @@ namespace rsx
else if (cause == deferred_write)
return write;
else
fmt::throw_exception("Unreachable " HERE);
fmt::throw_exception("Unreachable");
}
constexpr invalidation_cause defer() const
@ -114,7 +114,7 @@ namespace rsx
else if (cause == write)
return deferred_write;
else
fmt::throw_exception("Unreachable " HERE);
fmt::throw_exception("Unreachable");
}
constexpr invalidation_cause() : cause(invalid) {}
@ -282,7 +282,7 @@ namespace rsx
next_array();
}
ASSERT(m_capacity > 0 && m_array_idx < array_size && m_data_it != m_data.end());
ensure(m_capacity > 0 && m_array_idx < array_size && m_data_it != m_data.end());
value_type *dest = &((*m_data_it)[m_array_idx++]);
new (dest) value_type(std::forward<Args>(args)...);
@ -457,7 +457,7 @@ namespace rsx
(void)section; // silence unused warning without _AUDIT
AUDIT(!section.is_locked());
u32 prev_locked = locked_count--;
ASSERT(prev_locked > 0);
ensure(prev_locked > 0);
}
inline void on_section_range_valid(section_storage_type &section)
@ -493,7 +493,7 @@ namespace rsx
AUDIT(!section.exists());
u32 prev_exists = exists_count--;
ASSERT(prev_exists > 0);
ensure(prev_exists > 0);
if (prev_exists == 1)
{
@ -504,7 +504,7 @@ namespace rsx
void on_section_released(const section_storage_type &/*section*/)
{
u32 prev_unreleased = unreleased_count--;
ASSERT(prev_unreleased > 0);
ensure(prev_unreleased > 0);
}
void on_section_unreleased(const section_storage_type &/*section*/)
@ -660,7 +660,7 @@ namespace rsx
if (!tex.is_unreleased())
continue;
ASSERT(!tex.is_locked());
ensure(!tex.is_locked());
tex.destroy();
}
@ -699,7 +699,7 @@ namespace rsx
continue;
}
ASSERT(!tex.is_locked() && tex.exists());
ensure(!tex.is_locked() && tex.exists());
tex.destroy();
any_released = true;
}
@ -725,7 +725,7 @@ namespace rsx
void on_section_released(const section_storage_type &/*section*/)
{
u32 prev_unreleased = m_unreleased_texture_objects--;
ASSERT(prev_unreleased > 0);
ensure(prev_unreleased > 0);
}
void on_section_unreleased(const section_storage_type &/*section*/)
@ -742,7 +742,7 @@ namespace rsx
{
u64 size = section.get_section_size();
u64 prev_size = m_texture_memory_in_use.fetch_sub(size);
ASSERT(prev_size >= size);
ensure(prev_size >= size);
}
void on_ranged_block_first_section_created(block_type& block)
@ -1140,8 +1140,8 @@ namespace rsx
triggered_exists_callbacks = false;
AUDIT(valid_range());
ASSERT(!is_locked());
ASSERT(is_managed());
ensure(!is_locked());
ensure(is_managed());
// Set dirty
set_dirty(true);
@ -1445,7 +1445,7 @@ namespace rsx
{
AUDIT(synchronized);
ASSERT(real_pitch > 0);
ensure(real_pitch > 0);
// Calculate valid range
const auto valid_range = get_confirmed_range();
@ -1481,7 +1481,7 @@ namespace rsx
// Obtain pointers to the source and destination memory regions
u8 *src = static_cast<u8*>(derived()->map_synchronized(mapped_offset, mapped_length));
u32 dst = valid_range.start;
ASSERT(src != nullptr);
ensure(src != nullptr);
// Copy from src to dst
if (real_pitch >= rsx_pitch || valid_length <= rsx_pitch)
@ -1516,7 +1516,7 @@ namespace rsx
if (flushed) return;
// Sanity checks
ASSERT(exists());
ensure(exists());
AUDIT(is_locked());
// If we are fully inside the flush exclusions regions, we just mark ourselves as flushed and return
@ -1529,7 +1529,7 @@ namespace rsx
}
// NOTE: Hard faults should have been pre-processed beforehand
ASSERT(synchronized);
ensure(synchronized);
// Copy flush result to guest memory
imp_flush();

View File

@ -33,6 +33,6 @@ namespace gl
}
}
fmt::throw_exception("Unknown register name: %s" HERE, varying_register_name);
fmt::throw_exception("Unknown register name: %s", varying_register_name);
}
}

View File

@ -17,7 +17,7 @@ namespace gl
case rsx::comparison_function::greater_or_equal: return GL_GEQUAL;
case rsx::comparison_function::always: return GL_ALWAYS;
}
fmt::throw_exception("Unsupported comparison op 0x%X" HERE, static_cast<u32>(op));
fmt::throw_exception("Unsupported comparison op 0x%X", static_cast<u32>(op));
}
GLenum stencil_op(rsx::stencil_op op)
@ -33,7 +33,7 @@ namespace gl
case rsx::stencil_op::incr_wrap: return GL_INCR_WRAP;
case rsx::stencil_op::decr_wrap: return GL_DECR_WRAP;
}
fmt::throw_exception("Unsupported stencil op 0x%X" HERE, static_cast<u32>(op));
fmt::throw_exception("Unsupported stencil op 0x%X", static_cast<u32>(op));
}
GLenum blend_equation(rsx::blend_equation op)
@ -79,7 +79,7 @@ namespace gl
case rsx::blend_factor::constant_alpha: return GL_CONSTANT_ALPHA;
case rsx::blend_factor::one_minus_constant_alpha: return GL_ONE_MINUS_CONSTANT_ALPHA;
}
fmt::throw_exception("Unsupported blend factor 0x%X" HERE, static_cast<u32>(op));
fmt::throw_exception("Unsupported blend factor 0x%X", static_cast<u32>(op));
}
GLenum logic_op(rsx::logic_op op)
@ -103,7 +103,7 @@ namespace gl
case rsx::logic_op::logic_nand: return GL_NAND;
case rsx::logic_op::logic_set: return GL_SET;
}
fmt::throw_exception("Unsupported logic op 0x%X" HERE, static_cast<u32>(op));
fmt::throw_exception("Unsupported logic op 0x%X", static_cast<u32>(op));
}
GLenum front_face(rsx::front_face op)
@ -117,7 +117,7 @@ namespace gl
case rsx::front_face::cw: return GL_CCW;
case rsx::front_face::ccw: return GL_CW;
}
fmt::throw_exception("Unsupported front face 0x%X" HERE, static_cast<u32>(op));
fmt::throw_exception("Unsupported front face 0x%X", static_cast<u32>(op));
}
GLenum cull_face(rsx::cull_face op)
@ -128,7 +128,7 @@ namespace gl
case rsx::cull_face::back: return GL_BACK;
case rsx::cull_face::front_and_back: return GL_FRONT_AND_BACK;
}
fmt::throw_exception("Unsupported cull face 0x%X" HERE, static_cast<u32>(op));
fmt::throw_exception("Unsupported cull face 0x%X", static_cast<u32>(op));
}
}
@ -459,7 +459,7 @@ void GLGSRender::emit_geometry(u32 sub_index)
for (auto &info : m_vertex_layout.interleaved_blocks)
{
const auto vertex_base_offset = rsx::method_registers.vertex_data_base_offset();
info.real_offset_address = rsx::get_address(rsx::get_vertex_offset_from_base(vertex_base_offset, info.base_offset), info.memory_location, HERE);
info.real_offset_address = rsx::get_address(rsx::get_vertex_offset_from_base(vertex_base_offset, info.base_offset), info.memory_location);
}
}
}

View File

@ -728,7 +728,7 @@ void GLGSRender::load_program_env()
{
if (!m_program)
{
fmt::throw_exception("Unreachable right now" HERE);
fmt::throw_exception("Unreachable right now");
}
const u32 fragment_constants_size = current_fp_metadata.program_constants_buffer_length;
@ -1042,7 +1042,7 @@ void GLGSRender::notify_tile_unbound(u32 tile)
// TODO: Handle texture writeback
if (false)
{
u32 addr = rsx::get_address(tiles[tile].offset, tiles[tile].location, HERE);
u32 addr = rsx::get_address(tiles[tile].offset, tiles[tile].location);
on_notify_memory_unmapped(addr, tiles[tile].size);
m_rtts.invalidate_surface_address(addr, false);
}

View File

@ -43,7 +43,7 @@ namespace gl
case rsx::primitive_type::quad_strip: return GL_TRIANGLE_STRIP;
case rsx::primitive_type::polygon: return GL_TRIANGLES;
default:
fmt::throw_exception("unknown primitive type" HERE);
fmt::throw_exception("unknown primitive type");
}
}
@ -471,7 +471,7 @@ namespace gl
case rsx::primitive_type::polygon:
return false;
default:
fmt::throw_exception("unknown primitive type" HERE);
fmt::throw_exception("unknown primitive type");
}
}

View File

@ -1410,7 +1410,7 @@ namespace gl
switch (target)
{
default:
fmt::throw_exception("Invalid image target 0x%X" HERE, target);
fmt::throw_exception("Invalid image target 0x%X", target);
case GL_TEXTURE_1D:
glTexStorage1D(target, mipmaps, sized_format, width);
height = depth = 1;
@ -1495,7 +1495,7 @@ namespace gl
if (!m_pitch)
{
fmt::throw_exception("Unhandled GL format 0x%X" HERE, sized_format);
fmt::throw_exception("Unhandled GL format 0x%X", sized_format);
}
if (format_class == RSX_FORMAT_CLASS_UNDEFINED)
@ -1677,7 +1677,7 @@ namespace gl
void copy_from(buffer &buf, u32 gl_format_type, u32 offset, u32 length)
{
if (get_target() != target::textureBuffer)
fmt::throw_exception("OpenGL error: texture cannot copy from buffer" HERE);
fmt::throw_exception("OpenGL error: texture cannot copy from buffer");
DSA_CALL(TextureBufferRange, m_id, GL_TEXTURE_BUFFER, gl_format_type, buf.id(), offset, length);
}
@ -2253,7 +2253,7 @@ public:
break;
}
fs::file(fs::get_cache_dir() + base_name + std::to_string(m_id) + ".glsl", fs::rewrite).write(str);
fs::file(fs::get_cache_dir() + base_name + std::to_string(m_id) + ".glsl", fs::rewrite).write(str, length);
}
glShaderSource(m_id, 1, &str, &length);

View File

@ -544,7 +544,7 @@ namespace gl
primitives = GL_LINE_STRIP;
break;
default:
fmt::throw_exception("Unexpected primitive type %d" HERE, static_cast<s32>(type));
fmt::throw_exception("Unexpected primitive type %d", static_cast<s32>(type));
}
}

View File

@ -148,7 +148,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
present_info.height = buffer_height;
present_info.pitch = buffer_pitch;
present_info.format = av_format;
present_info.address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL, HERE);
present_info.address = rsx::get_address(display_buffers[info.buffer].offset, CELL_GCM_LOCATION_LOCAL);
const auto image_to_flip_ = get_present_source(&present_info, avconfig);
image_to_flip = image_to_flip_->id();
@ -162,7 +162,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
const u32 image_offset = (buffer_height + 30) * buffer_pitch + display_buffers[info.buffer].offset;
present_info.width = buffer_width;
present_info.height = buffer_height;
present_info.address = rsx::get_address(image_offset, CELL_GCM_LOCATION_LOCAL, HERE);
present_info.address = rsx::get_address(image_offset, CELL_GCM_LOCATION_LOCAL);
image_to_flip2 = get_present_source(&present_info, avconfig)->id();
}

View File

@ -62,7 +62,7 @@ color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_forma
{ ::gl::texture::channel::a, ::gl::texture::channel::b, ::gl::texture::channel::g, ::gl::texture::channel::r } };
default:
fmt::throw_exception("Unsupported surface color format 0x%x" HERE, static_cast<u32>(color_format));
fmt::throw_exception("Unsupported surface color format 0x%x", static_cast<u32>(color_format));
}
}
@ -84,7 +84,7 @@ depth_format rsx::internals::surface_depth_format_to_gl(rsx::surface_depth_forma
return{ ::gl::texture::type::float32_uint8, ::gl::texture::format::depth_stencil, ::gl::texture::internal_format::depth32f_stencil8 };
default:
fmt::throw_exception("Unsupported depth format 0x%x" HERE, static_cast<u32>(depth_format));
fmt::throw_exception("Unsupported depth format 0x%x", static_cast<u32>(depth_format));
}
}
@ -95,7 +95,7 @@ u8 rsx::internals::get_pixel_size(rsx::surface_depth_format format)
case rsx::surface_depth_format::z16: return 2;
case rsx::surface_depth_format::z24s8: return 4;
}
fmt::throw_exception("Unknown depth format" HERE);
fmt::throw_exception("Unknown depth format");
}
namespace

View File

@ -19,7 +19,7 @@ namespace gl
case rsx::texture_dimension_extended::texture_dimension_cubemap: return GL_TEXTURE_CUBE_MAP;
case rsx::texture_dimension_extended::texture_dimension_3d: return GL_TEXTURE_3D;
}
fmt::throw_exception("Unknown texture target" HERE);
fmt::throw_exception("Unknown texture target");
}
GLenum get_sized_internal_format(u32 texture_format)
@ -54,7 +54,7 @@ namespace gl
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: return GL_RGBA8;
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return GL_RGBA8;
}
fmt::throw_exception("Unknown texture format 0x%x" HERE, texture_format);
fmt::throw_exception("Unknown texture format 0x%x", texture_format);
}
std::tuple<GLenum, GLenum> get_format_type(u32 texture_format)
@ -89,7 +89,7 @@ namespace gl
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: return std::make_tuple(GL_BGRA, GL_UNSIGNED_BYTE);
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return std::make_tuple(GL_BGRA, GL_UNSIGNED_BYTE);
}
fmt::throw_exception("Compressed or unknown texture format 0x%x" HERE, texture_format);
fmt::throw_exception("Compressed or unknown texture format 0x%x", texture_format);
}
pixel_buffer_layout get_format_type(texture::internal_format format)
@ -132,7 +132,7 @@ namespace gl
case texture::internal_format::depth32f_stencil8:
return { GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4, true };
default:
fmt::throw_exception("Unexpected internal format 0x%X" HERE, static_cast<u32>(format));
fmt::throw_exception("Unexpected internal format 0x%X", static_cast<u32>(format));
}
}
@ -231,7 +231,7 @@ namespace gl
case rsx::texture_minify_filter::linear_linear: return GL_LINEAR_MIPMAP_LINEAR;
case rsx::texture_minify_filter::convolution_min: return GL_LINEAR_MIPMAP_LINEAR;
}
fmt::throw_exception("Unknown min filter" HERE);
fmt::throw_exception("Unknown min filter");
}
int tex_mag_filter(rsx::texture_magnify_filter mag_filter)
@ -242,7 +242,7 @@ namespace gl
case rsx::texture_magnify_filter::linear: return GL_LINEAR;
case rsx::texture_magnify_filter::convolution_mag: return GL_LINEAR;
}
fmt::throw_exception("Unknown mag filter" HERE);
fmt::throw_exception("Unknown mag filter");
}
// Apply sampler state settings
@ -392,7 +392,7 @@ namespace gl
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
return true;
}
fmt::throw_exception("Unknown format 0x%x" HERE, texture_format);
fmt::throw_exception("Unknown format 0x%x", texture_format);
}
std::array<GLenum, 4> get_swizzle_remap(u32 texture_format)
@ -451,7 +451,7 @@ namespace gl
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
return{ GL_RED, GL_GREEN, GL_RED, GL_GREEN };
}
fmt::throw_exception("Unknown format 0x%x" HERE, texture_format);
fmt::throw_exception("Unknown format 0x%x", texture_format);
}
cs_shuffle_base* get_trivial_transform_job(const pixel_buffer_layout& pack_info)
@ -523,7 +523,7 @@ namespace gl
}
else
{
fmt::throw_exception("Invalid depth/stencil type 0x%x" HERE, pack_info.type);
fmt::throw_exception("Invalid depth/stencil type 0x%x", pack_info.type);
}
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT | GL_PIXEL_BUFFER_BARRIER_BIT);
@ -590,7 +590,7 @@ namespace gl
}
else
{
fmt::throw_exception("Invalid depth/stencil type 0x%x" HERE, unpack_info.type);
fmt::throw_exception("Invalid depth/stencil type 0x%x", unpack_info.type);
}
if (!skip_barrier)
@ -695,7 +695,7 @@ namespace gl
default:
{
ASSUME(0);
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}
}
@ -875,7 +875,7 @@ namespace gl
case GL_DEPTH32F_STENCIL8:
return 4;
default:
fmt::throw_exception("Unexpected internal format 0x%X" HERE, static_cast<u32>(format));
fmt::throw_exception("Unexpected internal format 0x%X", static_cast<u32>(format));
}
}
@ -906,7 +906,7 @@ namespace gl
case GL_DEPTH32F_STENCIL8:
return { true, 4 };
default:
fmt::throw_exception("Unexpected internal format 0x%X" HERE, static_cast<u32>(format));
fmt::throw_exception("Unexpected internal format 0x%X", static_cast<u32>(format));
}
}

View File

@ -83,7 +83,7 @@ namespace gl
gl::texture::format gl_format = gl::texture::format::rgba, gl::texture::type gl_type = gl::texture::type::ubyte, bool swap_bytes = false)
{
auto new_texture = static_cast<gl::viewable_image*>(image);
ASSERT(!exists() || !is_managed() || vram_texture == new_texture);
ensure(!exists() || !is_managed() || vram_texture == new_texture);
vram_texture = new_texture;
if (read_only)
@ -92,7 +92,7 @@ namespace gl
}
else
{
ASSERT(!managed_texture);
ensure(!managed_texture);
}
if (auto rtt = dynamic_cast<gl::render_target*>(image))
@ -252,7 +252,7 @@ namespace gl
void copy_texture(gl::command_context& cmd, bool miss)
{
ASSERT(exists());
ensure(exists());
if (!miss) [[likely]]
{
@ -633,7 +633,7 @@ namespace gl
return{ GL_BLUE, GL_ALPHA, GL_RED, GL_GREEN };
}
default:
fmt::throw_exception("Unknown texture create flags" HERE);
fmt::throw_exception("Unknown texture create flags");
}
}
@ -865,7 +865,7 @@ namespace gl
image->set_native_component_layout(swizzle);
auto& cached = *find_cached_texture(rsx_range, gcm_format, true, true, width, height, depth, mipmaps);
ASSERT(!cached.is_locked());
ensure(!cached.is_locked());
// Prepare section
cached.reset(rsx_range);
@ -911,7 +911,7 @@ namespace gl
break;
}
default:
fmt::throw_exception("Unexpected gcm format 0x%X" HERE, gcm_format);
fmt::throw_exception("Unexpected gcm format 0x%X", gcm_format);
}
//NOTE: Protection is handled by the caller
@ -926,7 +926,7 @@ namespace gl
cached_texture_section* create_nul_section(gl::command_context& /*cmd*/, const utils::address_range& rsx_range, bool /*memory_load*/) override
{
auto& cached = *find_cached_texture(rsx_range, RSX_GCM_FORMAT_IGNORED, true, false);
ASSERT(!cached.is_locked());
ensure(!cached.is_locked());
// Prepare section
cached.reset(rsx_range);

View File

@ -75,7 +75,7 @@ namespace rsx
void osk_dialog::update_panel()
{
ASSERT(m_panel_index < m_panels.size());
ensure(m_panel_index < m_panels.size());
const auto& panel = m_panels[m_panel_index];

View File

@ -100,7 +100,7 @@ void process_multibyte(const std::string s, F&& func)
u_code = (u32(code & 0x7) << 18) | (u32(s[index + 1] & 0x3F) << 12) | (u32(s[index + 2] & 0x3F) << 6) | u32(s[index + 3] & 0x3F);
break;
default:
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
index += extra_bytes;

View File

@ -496,7 +496,7 @@ namespace rsx
}
// If we reached here, this is likely an error
fmt::throw_exception("Unexpected command 0x%x" HERE, cmd);
fmt::throw_exception("Unexpected command 0x%x", cmd);
}
if (const auto state = performance_counters.state;
@ -603,7 +603,7 @@ namespace rsx
}
default:
{
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}

View File

@ -61,7 +61,7 @@ namespace rsx
rsx::get_current_renderer()->renderctl(job.aux_param0, job.src);
break;
}
default: ASSUME(0); fmt::throw_exception("Unreachable" HERE);
default: ASSUME(0); fmt::throw_exception("Unreachable");
}
m_processed_count.release(m_processed_count + 1);
@ -225,7 +225,7 @@ namespace rsx
break;
default:
ASSUME(0);
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
const uintptr_t addr = uintptr_t(address);

View File

@ -42,7 +42,7 @@ namespace rsx
{
std::function<bool(u32 addr, bool is_writing)> g_access_violation_handler;
u32 get_address(u32 offset, u32 location, const char* from)
u32 get_address(u32 offset, u32 location, u32 line, u32 col, const char* file, const char* func)
{
const auto render = get_current_renderer();
std::string_view msg;
@ -135,8 +135,7 @@ namespace rsx
}
}
// Assume 'from' contains new line at start
fmt::throw_exception("rsx::get_address(offset=0x%x, location=0x%x): %s%s", offset, location, msg, from);
fmt::throw_exception("rsx::get_address(offset=0x%x, location=0x%x): %s%s", offset, location, msg, src_loc{line, col, file, func});
}
u32 get_vertex_type_size_on_host(vertex_base_type type, u32 size)
@ -156,7 +155,7 @@ namespace rsx
default:
break;
}
fmt::throw_exception("Wrong vector size" HERE);
fmt::throw_exception("Wrong vector size");
case vertex_base_type::f: return sizeof(f32) * size;
case vertex_base_type::sf:
switch (size)
@ -170,7 +169,7 @@ namespace rsx
default:
break;
}
fmt::throw_exception("Wrong vector size" HERE);
fmt::throw_exception("Wrong vector size");
case vertex_base_type::ub:
switch (size)
{
@ -183,13 +182,13 @@ namespace rsx
default:
break;
}
fmt::throw_exception("Wrong vector size" HERE);
fmt::throw_exception("Wrong vector size");
case vertex_base_type::cmp: return 4;
case vertex_base_type::ub256: ensure(size == 4); return sizeof(u8) * 4;
default:
break;
}
fmt::throw_exception("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!" HERE, static_cast<u8>(type));
fmt::throw_exception("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!", static_cast<u8>(type));
}
void tiled_region::write(const void *src, u32 width, u32 height, u32 pitch)
@ -851,7 +850,7 @@ namespace rsx
const u32 type_size = get_index_type_size(type);
// Force aligned indices as realhw
const u32 address = (0 - type_size) & get_address(rsx::method_registers.index_array_address(), rsx::method_registers.index_array_location(), HERE);
const u32 address = (0 - type_size) & get_address(rsx::method_registers.index_array_address(), rsx::method_registers.index_array_location());
const bool is_primitive_restart_enabled = rsx::method_registers.restart_index_enabled();
const u32 primitive_restart_index = rsx::method_registers.restart_index();
@ -884,7 +883,7 @@ namespace rsx
return draw_inlined_array{};
}
fmt::throw_exception("ill-formed draw command" HERE);
fmt::throw_exception("ill-formed draw command");
}
void thread::do_local_task(FIFO_state state)
@ -943,10 +942,10 @@ namespace rsx
};
return
{
rsx::get_address(offset_color[0], context_dma_color[0], HERE),
rsx::get_address(offset_color[1], context_dma_color[1], HERE),
rsx::get_address(offset_color[2], context_dma_color[2], HERE),
rsx::get_address(offset_color[3], context_dma_color[3], HERE),
rsx::get_address(offset_color[0], context_dma_color[0]),
rsx::get_address(offset_color[1], context_dma_color[1]),
rsx::get_address(offset_color[2], context_dma_color[2]),
rsx::get_address(offset_color[3], context_dma_color[3]),
};
}
@ -954,7 +953,7 @@ namespace rsx
{
u32 m_context_dma_z = rsx::method_registers.surface_z_dma();
u32 offset_zeta = rsx::method_registers.surface_z_offset();
return rsx::get_address(offset_zeta, m_context_dma_z, HERE);
return rsx::get_address(offset_zeta, m_context_dma_z);
}
void thread::get_framebuffer_layout(rsx::framebuffer_creation_context context, framebuffer_layout &layout)
@ -1090,7 +1089,7 @@ namespace rsx
m_framebuffer_state_contested = color_buffer_unused || depth_buffer_unused;
break;
default:
fmt::throw_exception("Unknown framebuffer context 0x%x" HERE, static_cast<u32>(context));
fmt::throw_exception("Unknown framebuffer context 0x%x", static_cast<u32>(context));
}
// Swizzled render does tight packing of bytes
@ -1225,7 +1224,7 @@ namespace rsx
// Tested with Turbo: Super stunt squad that only changes the window offset to declare new framebuffers
// Sampling behavior clearly indicates the addresses are expected to have changed
if (auto clip_type = rsx::method_registers.window_clip_type())
rsx_log.error("Unknown window clip type 0x%X" HERE, clip_type);
rsx_log.error("Unknown window clip type 0x%X", clip_type);
for (const auto &index : rsx::utility::get_rtt_indexes(layout.target))
{
@ -1513,7 +1512,7 @@ namespace rsx
m_graphics_state &= ~rsx::pipeline_state::fragment_program_ucode_dirty;
const auto [program_offset, program_location] = method_registers.shader_program_address();
auto data_ptr = vm::base(rsx::get_address(program_offset, program_location, HERE));
auto data_ptr = vm::base(rsx::get_address(program_offset, program_location));
current_fp_metadata = program_hash_util::fragment_program_utils::analyse_fragment_program(data_ptr);
current_fragment_program.data = (static_cast<u8*>(data_ptr) + current_fp_metadata.program_start_offset);
@ -1758,7 +1757,7 @@ namespace rsx
for (auto &info : result.interleaved_blocks)
{
//Calculate real data address to be used during upload
info.real_offset_address = rsx::get_address(rsx::get_vertex_offset_from_base(state.vertex_data_base_offset(), info.base_offset), info.memory_location, HERE);
info.real_offset_address = rsx::get_address(rsx::get_vertex_offset_from_base(state.vertex_data_base_offset(), info.base_offset), info.memory_location);
}
}
@ -1810,7 +1809,7 @@ namespace rsx
texture_control |= (1 << 4);
}
const u32 texaddr = rsx::get_address(tex.offset(), tex.location(), HERE);
const u32 texaddr = rsx::get_address(tex.offset(), tex.location());
const u32 raw_format = tex.format();
const u32 format = raw_format & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
@ -1993,7 +1992,7 @@ namespace rsx
tiled_region thread::get_tiled_address(u32 offset, u32 location)
{
u32 address = get_address(offset, location, HERE);
u32 address = get_address(offset, location);
GcmTileInfo *tile = find_tile(offset, location);
u32 base = 0;
@ -2001,7 +2000,7 @@ namespace rsx
if (tile)
{
base = offset - tile->offset;
address = get_address(tile->offset, location, HERE);
address = get_address(tile->offset, location);
}
return{ address, base, tile, vm::_ptr<u8>(address) };
@ -2343,7 +2342,7 @@ namespace rsx
rsx::to_surface_depth_format(zcull.zFormat) == m_depth_surface_info.depth_format &&
rsx::to_surface_antialiasing(zcull.aaFormat) == rsx::method_registers.surface_antialias())
{
const u32 rsx_address = rsx::get_address(zcull.offset, CELL_GCM_LOCATION_LOCAL, HERE);
const u32 rsx_address = rsx::get_address(zcull.offset, CELL_GCM_LOCATION_LOCAL);
if (rsx_address == zeta_address)
{
zcull_surface_active = true;
@ -2488,7 +2487,7 @@ namespace rsx
if (current_time - cmd_info.timestamp < 2'000'000u)
{
// Probably hopeless
fmt::throw_exception("Dead FIFO commands queue state has been detected!\nTry increasing \"Driver Wake-Up Delay\" setting in Advanced settings." HERE);
fmt::throw_exception("Dead FIFO commands queue state has been detected!\nTry increasing \"Driver Wake-Up Delay\" setting in Advanced settings.");
}
// Erase the last command from history, keep the size of the queue the same

View File

@ -82,7 +82,7 @@ namespace rsx
template<bool IsFullLock>
void unlock(u32 addr, u32 len) noexcept
{
ASSERT(len >= 1);
ensure(len >= 1);
const u32 end = addr + len - 1;
for (u32 block = (addr >> 20); block <= (end >> 20); ++block)
@ -172,8 +172,11 @@ namespace rsx
u32 get_vertex_type_size_on_host(vertex_base_type type, u32 size);
// TODO: Replace with std::source_location in c++20
u32 get_address(u32 offset, u32 location, const char* from);
u32 get_address(u32 offset, u32 location,
u32 line = __builtin_LINE(),
u32 col = __builtin_COLUMN(),
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION());
struct tiled_region
{
@ -352,7 +355,7 @@ namespace rsx
}
default:
{
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}
}

View File

@ -150,7 +150,7 @@ namespace vk
}
}
fmt::throw_exception("Unknown register name: %s" HERE, varying_register_name);
fmt::throw_exception("Unknown register name: %s", varying_register_name);
}
bool compile_glsl_to_spv(std::string& shader, program_domain domain, std::vector<u32>& spv)

View File

@ -899,7 +899,7 @@ namespace vk
}
else
{
fmt::throw_exception("Unreachable" HERE);
fmt::throw_exception("Unreachable");
}
}

View File

@ -33,7 +33,7 @@ namespace vk
case rsx::comparison_function::not_equal: return VK_COMPARE_OP_NOT_EQUAL;
case rsx::comparison_function::always: return VK_COMPARE_OP_ALWAYS;
default:
fmt::throw_exception("Unknown compare op: 0x%x" HERE, static_cast<u32>(op));
fmt::throw_exception("Unknown compare op: 0x%x", static_cast<u32>(op));
}
}
}
@ -722,7 +722,7 @@ void VKGSRender::emit_geometry(u32 sub_index)
for (auto &info : m_vertex_layout.interleaved_blocks)
{
const auto vertex_base_offset = rsx::method_registers.vertex_data_base_offset();
info.real_offset_address = rsx::get_address(rsx::get_vertex_offset_from_base(vertex_base_offset, info.base_offset), info.memory_location, HERE);
info.real_offset_address = rsx::get_address(rsx::get_vertex_offset_from_base(vertex_base_offset, info.base_offset), info.memory_location);
}
}

View File

@ -54,17 +54,17 @@ namespace vk
{
if (support.d24_unorm_s8) return VK_FORMAT_D24_UNORM_S8_UINT;
if (support.d32_sfloat_s8) return VK_FORMAT_D32_SFLOAT_S8_UINT;
fmt::throw_exception("No hardware support for z24s8" HERE);
fmt::throw_exception("No hardware support for z24s8");
}
case rsx::surface_depth_format2::z24s8_float:
{
if (support.d32_sfloat_s8) return VK_FORMAT_D32_SFLOAT_S8_UINT;
fmt::throw_exception("No hardware support for z24s8_float" HERE);
fmt::throw_exception("No hardware support for z24s8_float");
}
default:
break;
}
fmt::throw_exception("Invalid format (0x%x)" HERE, static_cast<u32>(format));
fmt::throw_exception("Invalid format (0x%x)", static_cast<u32>(format));
}
minification_filter get_min_filter(rsx::texture_minify_filter min_filter)
@ -82,7 +82,7 @@ namespace vk
ASSUME(0);
break;
}
fmt::throw_exception("Invalid min filter" HERE);
fmt::throw_exception("Invalid min filter");
}
VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter)
@ -96,7 +96,7 @@ namespace vk
ASSUME(0);
break;
}
fmt::throw_exception("Invalid mag filter (0x%x)" HERE, static_cast<u32>(mag_filter));
fmt::throw_exception("Invalid mag filter (0x%x)", static_cast<u32>(mag_filter));
}
VkBorderColor get_border_color(u32 color)
@ -150,7 +150,7 @@ namespace vk
ASSUME(0);
break;
}
fmt::throw_exception("unhandled texture clamp mode" HERE);
fmt::throw_exception("unhandled texture clamp mode");
}
float max_aniso(rsx::texture_max_anisotropy gcm_aniso)
@ -170,7 +170,7 @@ namespace vk
break;
}
fmt::throw_exception("Texture anisotropy error: bad max aniso (%d)" HERE, static_cast<u32>(gcm_aniso));
fmt::throw_exception("Texture anisotropy error: bad max aniso (%d)", static_cast<u32>(gcm_aniso));
}
@ -239,7 +239,7 @@ namespace vk
mapping = { VK_COMPONENT_SWIZZLE_A, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B }; break;
default:
fmt::throw_exception("Invalid or unsupported component mapping for texture format (0x%x)" HERE, format);
fmt::throw_exception("Invalid or unsupported component mapping for texture format (0x%x)", format);
}
return mapping;
@ -279,7 +279,7 @@ namespace vk
default:
break;
}
fmt::throw_exception("Invalid or unsupported sampler format for texture format (0x%x)" HERE, format);
fmt::throw_exception("Invalid or unsupported sampler format for texture format (0x%x)", format);
}
VkFormat get_compatible_srgb_format(VkFormat rgb_format)
@ -460,7 +460,7 @@ namespace vk
break;
}
fmt::throw_exception("Unknown vkFormat 0x%x" HERE, static_cast<u32>(format));
fmt::throw_exception("Unknown vkFormat 0x%x", static_cast<u32>(format));
}
bool formats_are_bitcast_compatible(VkFormat format1, VkFormat format2)

Some files were not shown because too many files have changed in this diff Show More