1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

Silly macro removed-2

This commit is contained in:
Nekotekina 2016-08-14 03:22:19 +03:00
parent 5e0489dcc0
commit 0f87c4485d
38 changed files with 346 additions and 445 deletions

View File

@ -1,7 +1,6 @@
#pragma once
#include "types.h"
#include "Platform.h"
// Helper class, provides access to compiler-specific atomic intrinsics
template<typename T, std::size_t Size>

View File

@ -1,7 +1,6 @@
#pragma once
#include "types.h"
#include "Platform.h"
// 128-bit vector type and also se_storage<> storage type
union alignas(16) v128
@ -353,7 +352,10 @@ struct se_storage
static type copy(const type& src)
{
type result;
std::memcpy(&result, &src, Size);
for (std::size_t i = 0; i < Size; i++)
{
reinterpret_cast<u8*>(&result)[i] = reinterpret_cast<const u8*>(&src)[i];
}
return result;
}
};

View File

@ -9,7 +9,7 @@ struct bf_base
using vtype = simple_t<type>;
// Datatype bitsize
static constexpr uint bitmax = sizeof(T) * CHAR_BIT; static_assert(N - 1 < bitmax, "bf_base<> error: N out of bounds");
static constexpr uint bitmax = sizeof(T) * 8; static_assert(N - 1 < bitmax, "bf_base<> error: N out of bounds");
// Field bitsize
static constexpr uint bitsize = N;

View File

@ -1,6 +1,5 @@
#include "File.h"
#include "StrFmt.h"
#include "Macro.h"
#include "SharedMutex.h"
#include "BEType.h"
#include "Crypto/sha1.h"
@ -22,10 +21,7 @@ static std::unique_ptr<wchar_t[]> to_wchar(const std::string& source)
std::unique_ptr<wchar_t[]> buffer(new wchar_t[buf_size]); // allocate buffer assuming that length is the max possible size
if (!MultiByteToWideChar(CP_UTF8, 0, source.c_str(), size, buffer.get(), size))
{
fmt::throw_exception("to_wchar(): MultiByteToWideChar() failed: error %u.", GetLastError());
}
verify("to_wchar" HERE), MultiByteToWideChar(CP_UTF8, 0, source.c_str(), size, buffer.get(), size);
return buffer;
}
@ -38,14 +34,10 @@ static void to_utf8(std::string& result, const wchar_t* source)
result.resize(buf_size); // set max possible length for utf-8 + null terminator
if (const int nwritten = WideCharToMultiByte(CP_UTF8, 0, source, static_cast<int>(length) + 1, &result.front(), buf_size, NULL, NULL))
{
result.resize(nwritten - 1); // fix the size, remove null terminator
}
else
{
fmt::throw_exception("to_utf8(): WideCharToMultiByte() failed: error %u.", GetLastError());
}
const int nwritten = verify(WideCharToMultiByte(CP_UTF8, 0, source, static_cast<int>(length) + 1, &result.front(), buf_size, NULL, NULL), "to_utf8" HERE);
// fix the size, remove null terminator
result.resize(nwritten - 1);
}
static time_t to_time(const ULARGE_INTEGER& ft)
@ -692,10 +684,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
stat_t stat() override
{
FILE_BASIC_INFO basic_info;
if (!GetFileInformationByHandleEx(m_handle, FileBasicInfo, &basic_info, sizeof(FILE_BASIC_INFO)))
{
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
}
verify("file::stat" HERE), GetFileInformationByHandleEx(m_handle, FileBasicInfo, &basic_info, sizeof(FILE_BASIC_INFO));
stat_t info;
info.is_directory = (basic_info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
@ -726,14 +715,8 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
return false;
}
const BOOL result = SetEndOfFile(m_handle); // change file size
if (!result || !SetFilePointerEx(m_handle, old, NULL, FILE_BEGIN)) // restore position
{
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
}
return result != FALSE;
verify("file::trunc" HERE), SetEndOfFile(m_handle), SetFilePointerEx(m_handle, old, NULL, FILE_BEGIN);
return true;
}
u64 read(void* buffer, u64 count) override
@ -743,10 +726,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
EXPECTS(size >= 0);
DWORD nread;
if (!ReadFile(m_handle, buffer, size, &nread, NULL))
{
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
}
verify("file::read" HERE), ReadFile(m_handle, buffer, size, &nread, NULL);
return nread;
}
@ -758,10 +738,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
EXPECTS(size >= 0);
DWORD nwritten;
if (!WriteFile(m_handle, buffer, size, &nwritten, NULL))
{
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
}
verify("file::write" HERE), WriteFile(m_handle, buffer, size, &nwritten, NULL);
return nwritten;
}
@ -777,10 +754,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
whence == seek_end ? FILE_END :
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
if (!SetFilePointerEx(m_handle, pos, &pos, mode))
{
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
}
verify("file::seek" HERE), SetFilePointerEx(m_handle, pos, &pos, mode);
return pos.QuadPart;
}
@ -788,10 +762,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
u64 size() override
{
LARGE_INTEGER size;
if (!GetFileSizeEx(m_handle, &size))
{
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
}
verify("file::size" HERE), GetFileSizeEx(m_handle, &size);
return size.QuadPart;
}
@ -836,10 +807,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
stat_t stat() override
{
struct ::stat file_info;
if (::fstat(m_fd, &file_info) != 0)
{
fmt::throw_exception("System error: %d." HERE, errno);
}
verify("file::stat" HERE), ::fstat(m_fd, &file_info) == 0;
stat_t info;
info.is_directory = S_ISDIR(file_info.st_mode);
@ -866,10 +834,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
u64 read(void* buffer, u64 count) override
{
const auto result = ::read(m_fd, buffer, count);
if (result == -1)
{
fmt::throw_exception("System error: %d." HERE, errno);
}
verify("file::read" HERE), result != -1;
return result;
}
@ -877,10 +842,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
u64 write(const void* buffer, u64 count) override
{
const auto result = ::write(m_fd, buffer, count);
if (result == -1)
{
fmt::throw_exception("System error: %d." HERE, errno);
}
verify("file::write" HERE), result != -1;
return result;
}
@ -894,10 +856,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
const auto result = ::lseek(m_fd, offset, mode);
if (result == -1)
{
fmt::throw_exception("System error: %d." HERE, errno);
}
verify("file::seek" HERE), result != -1;
return result;
}
@ -905,10 +864,7 @@ bool fs::file::open(const std::string& path, bs_t<open_mode> mode)
u64 size() override
{
struct ::stat file_info;
if (::fstat(m_fd, &file_info) != 0)
{
fmt::throw_exception("System error: %d." HERE, errno);
}
verify("file::size" HERE), ::fstat(m_fd, &file_info) == 0;
return file_info.st_size;
}
@ -1048,12 +1004,8 @@ bool fs::dir::open(const std::string& path)
WIN32_FIND_DATAW found;
if (!FindNextFileW(m_handle, &found))
{
if (ERROR_NO_MORE_FILES == GetLastError())
{
return false;
}
fmt::throw_exception("Win32 error: %u." HERE, GetLastError());
verify("dir::read" HERE), ERROR_NO_MORE_FILES == GetLastError();
return false;
}
add_entry(found);
@ -1103,10 +1055,7 @@ bool fs::dir::open(const std::string& path)
}
struct ::stat file_info;
if (::fstatat(::dirfd(m_dd), found->d_name, &file_info, 0) != 0)
{
fmt::throw_exception("System error: %d." HERE, errno);
}
verify("dir::read" HERE), ::fstatat(::dirfd(m_dd), found->d_name, &file_info, 0) == 0;
info.name = found->d_name;
info.is_directory = S_ISDIR(file_info.st_mode);

View File

@ -1,12 +1,11 @@
#pragma once
#include "types.h"
#include "bit_set.h"
#include <memory>
#include <string>
#include <vector>
#include <type_traits>
#include "types.h"
#include "bit_set.h"
namespace fs
{

View File

@ -7,7 +7,6 @@
#include <array>
#include "types.h"
#include "Macro.h"
#include "StrFmt.h"
#include "File.h"
#include "Log.h"

View File

@ -1,7 +1,6 @@
#pragma once
#include "types.h"
#include "Platform.h"
#include "Atomic.h"
#include "StrFmt.h"

View File

@ -1,43 +0,0 @@
#pragma once
#include "types.h"
#define CHECK_SIZE(type, size) static_assert(sizeof(type) == size, "Invalid " #type " type size")
#define CHECK_ALIGN(type, align) static_assert(alignof(type) == align, "Invalid " #type " type alignment")
#define CHECK_MAX_SIZE(type, size) static_assert(sizeof(type) <= size, #type " type size is too big")
#define CHECK_SIZE_ALIGN(type, size, align) CHECK_SIZE(type, size); CHECK_ALIGN(type, align)
#define CHECK_STORAGE(type, storage) static_assert(sizeof(type) <= sizeof(storage) && alignof(type) <= alignof(decltype(storage)), #type " is too small")
// Return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
#define SIZE_32(type) static_cast<std::uint32_t>(sizeof(type))
// Return 32 bit alignof() to avoid widening/narrowing conversions with size_t
#define ALIGN_32(type) static_cast<std::uint32_t>(alignof(type))
// Return 32 bit custom offsetof()
#define OFFSET_32(type, x) static_cast<std::uint32_t>(reinterpret_cast<std::uintptr_t>(&reinterpret_cast<const volatile char&>(reinterpret_cast<type*>(0ull)->x)))
#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)
// Macro set, wraps an expression into lambda
#define WRAP_EXPR(expr, ...) [&](__VA_ARGS__) { return expr; }
#define COPY_EXPR(expr, ...) [=](__VA_ARGS__) { return expr; }
#define PURE_EXPR(expr, ...) [] (__VA_ARGS__) { return expr; }
#define HERE "\n(in file " __FILE__ ":" STRINGIZE(__LINE__) ")"
// Ensure that the expression is evaluated to true. Always evaluated and allowed to have side effects (unlike assert() macro).
#define VERIFY(expr) do { if (!(expr)) fmt::raw_error("Verification failed: " #expr HERE); } while (0)
// EXPECTS() and ENSURES() are intended to check function arguments and results.
// Expressions are not guaranteed to evaluate.
#define EXPECTS(expr) do { if (!(expr)) fmt::raw_error("Precondition failed: " #expr HERE); } while (0)
#define ENSURES(expr) do { if (!(expr)) fmt::raw_error("Postcondition failed: " #expr HERE); } while (0)
#define DECLARE(...) decltype(__VA_ARGS__) __VA_ARGS__
#define STR_CASE(value) case value: return #value

View File

@ -1,51 +0,0 @@
#include "Platform.h"
#ifdef __APPLE__
#include <sys/types.h>
#include <sys/_types/_timespec.h>
#include <mach/mach.h>
#include <mach/clock.h>
#include <mach/mach_time.h>
#undef CPU_STATE_MAX
#define MT_NANO (+1.0E-9)
#define MT_GIGA UINT64_C(1000000000)
// TODO create a list of timers,
static double mt_timebase = 0.0;
static uint64_t mt_timestart = 0;
// TODO be more careful in a multithreaded environement
int clock_gettime(clockid_t clk_id, struct timespec *tp)
{
kern_return_t retval = KERN_SUCCESS;
if( clk_id == TIMER_ABSTIME)
{
if (!mt_timestart) { // only one timer, initilized on the first call to the TIMER
mach_timebase_info_data_t tb = { 0 };
mach_timebase_info(&tb);
mt_timebase = tb.numer;
mt_timebase /= tb.denom;
mt_timestart = mach_absolute_time();
}
double diff = (mach_absolute_time() - mt_timestart) * mt_timebase;
tp->tv_sec = diff * MT_NANO;
tp->tv_nsec = diff - (tp->tv_sec * MT_GIGA);
}
else // other clk_ids are mapped to the coresponding mach clock_service
{
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), clk_id, &cclock);
retval = clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
tp->tv_sec = mts.tv_sec;
tp->tv_nsec = mts.tv_nsec;
}
return retval;
}
#endif /* __APPLE__ */

View File

@ -1,128 +0,0 @@
#pragma once
#include <cstdint>
#include <immintrin.h>
#include <emmintrin.h>
#define IS_LE_MACHINE 1
#define IS_BE_MACHINE 0
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#ifdef _MSC_VER
#define ASSUME(cond) __assume(cond)
#define LIKELY(cond) (cond)
#define UNLIKELY(cond) (cond)
#else
#define ASSUME(cond) do { if (!(cond)) __builtin_unreachable(); } while (0)
#define LIKELY(cond) __builtin_expect(!!(cond), 1)
#define UNLIKELY(cond) __builtin_expect(!!(cond), 0)
#endif
// Some platforms don't support thread_local well yet.
#ifndef _MSC_VER
#define thread_local __thread
#endif
#ifdef _MSC_VER
#define SAFE_BUFFERS __declspec(safebuffers)
#else
#define SAFE_BUFFERS
#endif
#ifdef _MSC_VER
#define NEVER_INLINE __declspec(noinline)
#else
#define NEVER_INLINE __attribute__((noinline))
#endif
#ifdef _MSC_VER
#define FORCE_INLINE __forceinline
#else
#define FORCE_INLINE __attribute__((always_inline)) inline
#endif
#if defined(__GNUG__)
#include <stdlib.h>
#define _fpclass(x) std::fpclassify(x)
#define INFINITE 0xFFFFFFFF
#ifdef __APPLE__
// XXX only supports a single timer
#define TIMER_ABSTIME -1
/* The opengroup spec isn't clear on the mapping from REALTIME to CALENDAR
being appropriate or not.
http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html */
#define CLOCK_REALTIME 1 // #define CALENDAR_CLOCK 1 from mach/clock_types.h
#define CLOCK_MONOTONIC 0 // #define SYSTEM_CLOCK 0
typedef int clockid_t;
/* the mach kernel uses struct mach_timespec, so struct timespec
is loaded from <sys/_types/_timespec.h> for compatability */
// struct timespec { time_t tv_sec; long tv_nsec; };
int clock_gettime(clockid_t clk_id, struct timespec *tp);
#endif /* __APPLE__ */
#endif /* __GNUG__ */
inline std::uint32_t cntlz32(std::uint32_t arg)
{
#if defined(_MSC_VER)
unsigned long res;
return _BitScanReverse(&res, arg) ? res ^ 31 : 32;
#else
return arg ? __builtin_clzll(arg) - 32 : 32;
#endif
}
inline std::uint64_t cntlz64(std::uint64_t arg)
{
#if defined(_MSC_VER)
unsigned long res;
return _BitScanReverse64(&res, arg) ? res ^ 63 : 64;
#else
return arg ? __builtin_clzll(arg) : 64;
#endif
}
// Helper function, used by ""_u16, ""_u32, ""_u64
constexpr std::uint8_t to_u8(char c)
{
return static_cast<std::uint8_t>(c);
}
// Convert 2-byte string to u16 value like reinterpret_cast does
constexpr std::uint16_t operator""_u16(const char* s, std::size_t length)
{
return length != 2 ? throw s :
#if IS_LE_MACHINE == 1
to_u8(s[1]) << 8 | to_u8(s[0]);
#endif
}
// Convert 4-byte string to u32 value like reinterpret_cast does
constexpr std::uint32_t operator""_u32(const char* s, std::size_t length)
{
return length != 4 ? throw s :
#if IS_LE_MACHINE == 1
to_u8(s[3]) << 24 | to_u8(s[2]) << 16 | to_u8(s[1]) << 8 | to_u8(s[0]);
#endif
}
// Convert 8-byte string to u64 value like reinterpret_cast does
constexpr std::uint64_t operator""_u64(const char* s, std::size_t length)
{
return length != 8 ? throw s :
#if IS_LE_MACHINE == 1
static_cast<std::uint64_t>(to_u8(s[7]) << 24 | to_u8(s[6]) << 16 | to_u8(s[5]) << 8 | to_u8(s[4])) << 32 | to_u8(s[3]) << 24 | to_u8(s[2]) << 16 | to_u8(s[1]) << 8 | to_u8(s[0]);
#endif
}

View File

@ -2,7 +2,6 @@
#include "types.h"
#include "Atomic.h"
#include "Platform.h"
// Binary semaphore
class benaphore

View File

@ -2,7 +2,6 @@
#include "types.h"
#include "Atomic.h"
#include "Platform.h"
//! An attempt to create effective implementation of "shared mutex", lock-free in optimistic case.
//! All locking and unlocking may be done by a single LOCK XADD or LOCK CMPXCHG instruction.

View File

@ -1,11 +1,16 @@
#include "StrFmt.h"
#include "BEType.h"
#include "StrUtil.h"
#include "Macro.h"
#include "cfmt.h"
#include <algorithm>
#ifdef _WIN32
#include <Windows.h>
#else
#include <errno.h>
#endif
void fmt_class_string<const void*>::format(std::string& out, u64 arg)
{
fmt::append(out, "%p", reinterpret_cast<const void*>(static_cast<std::uintptr_t>(arg)));
@ -124,18 +129,26 @@ namespace fmt
{
void raw_error(const char* msg)
{
std::string out{"Error"};
out += ": ";
out += msg;
throw std::runtime_error{out};
throw std::runtime_error{msg};
}
void raw_verify_error(const char* msg, uint position)
{
std::string out{"Verification failed"};
// Print error code (may be irrelevant)
#ifdef _WIN32
if (DWORD error = GetLastError())
{
fmt::append(out, " (e%#x)", error);
}
#else
if (int error = errno)
{
fmt::append(out, " (e%d)", error);
}
#endif
if (position)
{
out += " (+";

View File

@ -1,11 +1,11 @@
#pragma once
#include <exception>
#include <string>
#include "Platform.h"
#include "types.h"
#include <exception>
#include <stdexcept>
#include <string>
namespace fmt
{
template <typename... Args>

View File

@ -1,12 +1,12 @@
#pragma once
#include "types.h"
#include "Atomic.h"
#include <exception>
#include <string>
#include <memory>
#include "Platform.h"
#include "Atomic.h"
// Will report exception and call std::abort() if put in catch(...)
[[noreturn]] void catch_all_exceptions();

View File

@ -59,7 +59,7 @@ struct bs_base
__bitset_set_type = 0 // SFINAE marker
};
static constexpr std::size_t bitmax = sizeof(T) * CHAR_BIT;
static constexpr std::size_t bitmax = sizeof(T) * 8;
static constexpr std::size_t bitsize = static_cast<under>(T::__bitset_enum_max);
static_assert(std::is_enum<T>::value, "bs_t<> error: invalid type (must be enum)");

View File

@ -1,6 +1,7 @@
#pragma once
#include "types.h"
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
@ -55,7 +56,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
const auto write_octal = [&](u64 value, u64 min_num)
{
out.resize(out.size() + std::max<u64>(min_num, 66 / 3 - (cntlz64(value | 1) + 2) / 3), '0');
out.resize(out.size() + std::max<u64>(min_num, 66 / 3 - (cntlz64(value | 1, true) + 2) / 3), '0');
// Write in reversed order
for (auto i = out.rbegin(); value; i++, value /= 8)
@ -66,7 +67,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
const auto write_hex = [&](u64 value, bool upper, u64 min_num)
{
out.resize(out.size() + std::max<u64>(min_num, 64 / 4 - cntlz64(value | 1) / 4), '0');
out.resize(out.size() + std::max<u64>(min_num, 64 / 4 - cntlz64(value | 1, true) / 4), '0');
// Write in reversed order
for (auto i = out.rbegin(); value; i++, value /= 16)

View File

@ -2,7 +2,6 @@
#include "types.h"
#include "Atomic.h"
#include "Platform.h"
//! Simple sizeless array base for concurrent access. Cannot shrink, only growths automatically.
//! There is no way to know the current size. The smaller index is, the faster it's accessed.

View File

@ -3,7 +3,6 @@
/* For internal use. Don't include. */
#include "types.h"
#include "Macro.h"
#include "Atomic.h"
#ifdef _WIN32

View File

@ -1,8 +1,77 @@
#pragma once
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
#include <immintrin.h>
#include <emmintrin.h>
#include <cstdint>
#include <climits>
#include <type_traits>
#include <utility>
// Assume little-endian
#define IS_LE_MACHINE 1
#define IS_BE_MACHINE 0
#ifdef _MSC_VER
#define ASSUME(cond) __assume(cond)
#define LIKELY(cond) (cond)
#define UNLIKELY(cond) (cond)
#define SAFE_BUFFERS __declspec(safebuffers)
#define NEVER_INLINE __declspec(noinline)
#define FORCE_INLINE __forceinline
#else
#define ASSUME(cond) do { if (!(cond)) __builtin_unreachable(); } while (0)
#define LIKELY(cond) __builtin_expect(!!(cond), 1)
#define UNLIKELY(cond) __builtin_expect(!!(cond), 0)
#define SAFE_BUFFERS
#define NEVER_INLINE __attribute__((noinline))
#define FORCE_INLINE __attribute__((always_inline)) inline
// Some platforms don't support thread_local well yet.
#define thread_local __thread
#endif
#define CHECK_SIZE(type, size) static_assert(sizeof(type) == size, "Invalid " #type " type size")
#define CHECK_ALIGN(type, align) static_assert(alignof(type) == align, "Invalid " #type " type alignment")
#define CHECK_MAX_SIZE(type, size) static_assert(sizeof(type) <= size, #type " type size is too big")
#define CHECK_SIZE_ALIGN(type, size, align) CHECK_SIZE(type, size); CHECK_ALIGN(type, align)
#define CHECK_STORAGE(type, storage) static_assert(sizeof(type) <= sizeof(storage) && alignof(type) <= alignof(decltype(storage)), #type " is too small")
// Return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
#define SIZE_32(...) static_cast<u32>(sizeof(__VA_ARGS__))
// Return 32 bit alignof() to avoid widening/narrowing conversions with size_t
#define ALIGN_32(...) static_cast<u32>(alignof(__VA_ARGS__))
// Return 32 bit offsetof()
#define OFFSET_32(type, x) static_cast<u32>(reinterpret_cast<std::uintptr_t>(&reinterpret_cast<const volatile char&>(reinterpret_cast<type*>(0ull)->x)))
#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__) ")"
// Wrap an expression into lambda
#define WRAP_EXPR(...) [&] { return __VA_ARGS__; }
// Ensure that the expression is evaluated to true. Always evaluated and allowed to have side effects (unlike assert() macro).
#define VERIFY(...) do { if (!(__VA_ARGS__)) fmt::raw_error("Verification failed: " #__VA_ARGS__ HERE); } while (0)
// EXPECTS() and ENSURES() are intended to check function arguments and results.
// Expressions are not guaranteed to evaluate.
#define EXPECTS(...) do { if (!(__VA_ARGS__)) fmt::raw_error("Precondition failed: " #__VA_ARGS__ HERE); } while (0)
#define ENSURES(...) do { if (!(__VA_ARGS__)) fmt::raw_error("Postcondition failed: " #__VA_ARGS__ HERE); } while (0)
#define DECLARE(...) decltype(__VA_ARGS__) __VA_ARGS__
#define STR_CASE(...) case __VA_ARGS__: return #__VA_ARGS__
using schar = signed char;
using uchar = unsigned char;
@ -159,8 +228,6 @@ using u128 = __uint128_t;
using s128 = __int128_t;
#else
#include "intrin.h"
// Unsigned 128-bit integer implementation (TODO)
struct alignas(16) u128
{
@ -342,8 +409,8 @@ struct alignas(16) s128
};
#endif
static_assert(alignof(u128) == 16 && sizeof(u128) == 16, "Wrong u128 implementation");
static_assert(alignof(s128) == 16 && sizeof(s128) == 16, "Wrong s128 implementation");
CHECK_SIZE_ALIGN(u128, 16, 16);
CHECK_SIZE_ALIGN(s128, 16, 16);
union alignas(2) f16
{
@ -366,6 +433,8 @@ union alignas(2) f16
}
};
CHECK_SIZE_ALIGN(f16, 2, 2);
using f32 = float;
using f64 = double;
@ -383,6 +452,59 @@ constexpr T align(const T& value, std::uint64_t align)
return static_cast<T>((value + (align - 1)) & ~(align - 1));
}
inline std::uint32_t cntlz32(std::uint32_t arg, bool nonzero = false)
{
#if defined(_MSC_VER)
unsigned long res;
return _BitScanReverse(&res, arg) || nonzero ? res ^ 31 : 32;
#else
return arg || nonzero ? __builtin_clzll(arg) - 32 : 32;
#endif
}
inline std::uint64_t cntlz64(std::uint64_t arg, bool nonzero = false)
{
#if defined(_MSC_VER)
unsigned long res;
return _BitScanReverse64(&res, arg) || nonzero ? res ^ 63 : 64;
#else
return arg || nonzero ? __builtin_clzll(arg) : 64;
#endif
}
// Helper function, used by ""_u16, ""_u32, ""_u64
constexpr std::uint8_t to_u8(char c)
{
return static_cast<std::uint8_t>(c);
}
// Convert 2-byte string to u16 value like reinterpret_cast does
constexpr std::uint16_t operator""_u16(const char* s, std::size_t length)
{
return length != 2 ? throw s :
#if IS_LE_MACHINE == 1
to_u8(s[1]) << 8 | to_u8(s[0]);
#endif
}
// Convert 4-byte string to u32 value like reinterpret_cast does
constexpr std::uint32_t operator""_u32(const char* s, std::size_t length)
{
return length != 4 ? throw s :
#if IS_LE_MACHINE == 1
to_u8(s[3]) << 24 | to_u8(s[2]) << 16 | to_u8(s[1]) << 8 | to_u8(s[0]);
#endif
}
// Convert 8-byte string to u64 value like reinterpret_cast does
constexpr std::uint64_t operator""_u64(const char* s, std::size_t length)
{
return length != 8 ? throw s :
#if IS_LE_MACHINE == 1
static_cast<std::uint64_t>(to_u8(s[7]) << 24 | to_u8(s[6]) << 16 | to_u8(s[5]) << 8 | to_u8(s[4])) << 32 | to_u8(s[3]) << 24 | to_u8(s[2]) << 16 | to_u8(s[1]) << 8 | to_u8(s[0]);
#endif
}
namespace fmt
{
[[noreturn]] void raw_error(const char* msg);

View File

@ -15,7 +15,7 @@ s32 cellKbInit(u32 max_connect)
if (max_connect > 7)
return CELL_KB_ERROR_INVALID_PARAMETER;
const auto handler = fxm::import<KeyboardHandlerBase>(PURE_EXPR(Emu.GetCallbacks().get_kb_handler()));
const auto handler = fxm::import<KeyboardHandlerBase>(Emu.GetCallbacks().get_kb_handler);
if (!handler)
return CELL_KB_ERROR_ALREADY_INITIALIZED;

View File

@ -17,7 +17,7 @@ s32 cellMouseInit(u32 max_connect)
return CELL_MOUSE_ERROR_INVALID_PARAMETER;
}
const auto handler = fxm::import<MouseHandlerBase>(PURE_EXPR(Emu.GetCallbacks().get_mouse_handler()));
const auto handler = fxm::import<MouseHandlerBase>(Emu.GetCallbacks().get_mouse_handler);
if (!handler)
{

View File

@ -61,7 +61,7 @@ s32 cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialog
default: return CELL_MSGDIALOG_ERROR_PARAM;
}
const auto dlg = fxm::import<MsgDialogBase>(PURE_EXPR(Emu.GetCallbacks().get_msg_dialog()));
const auto dlg = fxm::import<MsgDialogBase>(Emu.GetCallbacks().get_msg_dialog);
if (!dlg)
{
@ -294,7 +294,10 @@ s32 cellMsgDialogProgressBarReset(u32 progressBarIndex)
return CELL_MSGDIALOG_ERROR_PARAM;
}
Emu.CallAfter(COPY_EXPR(dlg->ProgressBarReset(progressBarIndex)));
Emu.CallAfter([=]
{
dlg->ProgressBarReset(progressBarIndex);
});
return CELL_OK;
}
@ -315,7 +318,10 @@ s32 cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
return CELL_MSGDIALOG_ERROR_PARAM;
}
Emu.CallAfter(COPY_EXPR(dlg->ProgressBarInc(progressBarIndex, delta)));
Emu.CallAfter([=]
{
dlg->ProgressBarInc(progressBarIndex, delta);
});
return CELL_OK;
}

View File

@ -15,7 +15,7 @@ s32 cellPadInit(u32 max_connect)
if (max_connect > CELL_PAD_MAX_PORT_NUM)
return CELL_PAD_ERROR_INVALID_PARAMETER;
const auto handler = fxm::import<PadHandlerBase>(PURE_EXPR(Emu.GetCallbacks().get_pad_handler()));
const auto handler = fxm::import<PadHandlerBase>(Emu.GetCallbacks().get_pad_handler);
if (!handler)
return CELL_PAD_ERROR_ALREADY_INITIALIZED;

View File

@ -23,7 +23,6 @@
#include "../Utilities/types.h"
#include "../Utilities/StrFmt.h"
#include "../Utilities/Macro.h"
#include "../Utilities/BEType.h"
template<typename T, typename = void>

View File

@ -1359,7 +1359,7 @@ inline float ldexpf_extended(float x, int exp) // ldexpf() for extended values,
inline bool isdenormal(float x)
{
const int fpc = _fpclass(x);
const int fpc = std::fpclassify(x);
#ifdef __GNUG__
return fpc == FP_SUBNORMAL;
#else
@ -1369,7 +1369,7 @@ inline bool isdenormal(float x)
inline bool isdenormal(double x)
{
const int fpc = _fpclass(x);
const int fpc = std::fpclassify(x);
#ifdef __GNUG__
return fpc == FP_SUBNORMAL;
#else

View File

@ -14,14 +14,16 @@ struct time_aux_info_t
u64 perf_freq;
u64 start_time;
u64 start_ftime; // time in 100ns units since Epoch
}
const g_time_aux_info = []() -> time_aux_info_t // initialize time-related values (Windows-only)
};
// Initialize time-related values
const auto s_time_aux_info = []() -> time_aux_info_t
{
LARGE_INTEGER freq;
if (!QueryPerformanceFrequency(&freq))
{
MessageBox(0, L"Your hardware doesn't support a high-resolution performance counter", L"Error", MB_OK | MB_ICONERROR);
return{};
return {};
}
LARGE_INTEGER start;
@ -31,16 +33,75 @@ const g_time_aux_info = []() -> time_aux_info_t // initialize time-related value
GetSystemTimeAsFileTime(&ftime); // get time in 100ns units since January 1, 1601 (UTC)
time_aux_info_t result;
result.perf_freq = freq.QuadPart;
result.start_time = start.QuadPart;
result.perf_freq = freq.QuadPart;
result.start_time = start.QuadPart;
result.start_ftime = (ftime.dwLowDateTime | (u64)ftime.dwHighDateTime << 32) - 116444736000000000;
return result;
}();
#else
#elif __APPLE__
#include "errno.h"
// XXX only supports a single timer
#define TIMER_ABSTIME -1
// The opengroup spec isn't clear on the mapping from REALTIME to CALENDAR being appropriate or not.
// http://pubs.opengroup.org/onlinepubs/009695299/basedefs/time.h.html
#define CLOCK_REALTIME 1 // #define CALENDAR_CLOCK 1 from mach/clock_types.h
#define CLOCK_MONOTONIC 0 // #define SYSTEM_CLOCK 0
typedef int clockid_t;
// the mach kernel uses struct mach_timespec, so struct timespec is loaded from <sys/_types/_timespec.h> for compatability
// struct timespec { time_t tv_sec; long tv_nsec; };
#include <sys/types.h>
#include <sys/_types/_timespec.h>
#include <mach/mach.h>
#include <mach/clock.h>
#include <mach/mach_time.h>
#undef CPU_STATE_MAX
#define MT_NANO (+1.0E-9)
#define MT_GIGA UINT64_C(1000000000)
// TODO create a list of timers,
static double mt_timebase = 0.0;
static uint64_t mt_timestart = 0;
static int clock_gettime(clockid_t clk_id, struct timespec* tp)
{
kern_return_t retval = KERN_SUCCESS;
if (clk_id == TIMER_ABSTIME)
{
if (!mt_timestart)
{
// only one timer, initilized on the first call to the TIMER
mach_timebase_info_data_t tb = {0};
mach_timebase_info(&tb);
mt_timebase = tb.numer;
mt_timebase /= tb.denom;
mt_timestart = mach_absolute_time();
}
double diff = (mach_absolute_time() - mt_timestart) * mt_timebase;
tp->tv_sec = diff * MT_NANO;
tp->tv_nsec = diff - (tp->tv_sec * MT_GIGA);
}
else // other clk_ids are mapped to the coresponding mach clock_service
{
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), clk_id, &cclock);
retval = clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
tp->tv_sec = mts.tv_sec;
tp->tv_nsec = mts.tv_nsec;
}
return retval;
}
#endif
@ -53,22 +114,16 @@ u64 get_timebased_time()
{
#ifdef _WIN32
LARGE_INTEGER count;
if (!QueryPerformanceCounter(&count))
{
fmt::throw_exception("Unexpected" HERE);
}
verify(HERE), QueryPerformanceCounter(&count);
const u64 time = count.QuadPart;
const u64 freq = g_time_aux_info.perf_freq;
const u64 freq = s_time_aux_info.perf_freq;
return time / freq * g_timebase_freq + time % freq * g_timebase_freq / freq;
#else
struct timespec ts;
if (::clock_gettime(CLOCK_MONOTONIC, &ts))
{
fmt::throw_exception("System error %d" HERE, errno);
}
verify(HERE), ::clock_gettime(CLOCK_MONOTONIC, &ts) == 0;
return static_cast<u64>(ts.tv_sec) * g_timebase_freq + static_cast<u64>(ts.tv_nsec) * g_timebase_freq / 1000000000u;
#endif
}
@ -80,21 +135,15 @@ u64 get_system_time()
{
#ifdef _WIN32
LARGE_INTEGER count;
if (!QueryPerformanceCounter(&count))
{
fmt::throw_exception("Unexpected" HERE);
}
verify(HERE), QueryPerformanceCounter(&count);
const u64 time = count.QuadPart;
const u64 freq = g_time_aux_info.perf_freq;
const u64 freq = s_time_aux_info.perf_freq;
const u64 result = time / freq * 1000000u + (time % freq) * 1000000u / freq;
#else
struct timespec ts;
if (::clock_gettime(CLOCK_MONOTONIC, &ts))
{
fmt::throw_exception("System error %d" HERE, errno);
}
verify(HERE), ::clock_gettime(CLOCK_MONOTONIC, &ts) == 0;
const u64 result = static_cast<u64>(ts.tv_sec) * 1000000u + static_cast<u64>(ts.tv_nsec) / 1000u;
#endif
@ -108,7 +157,7 @@ s32 sys_time_get_timezone(vm::ptr<s32> timezone, vm::ptr<s32> summertime)
{
sys_time.warning("sys_time_get_timezone(timezone=*0x%x, summertime=*0x%x)", timezone, summertime);
*timezone = 180;
*timezone = 180;
*summertime = 0;
return CELL_OK;
@ -120,27 +169,21 @@ s32 sys_time_get_current_time(vm::ptr<s64> sec, vm::ptr<s64> nsec)
#ifdef _WIN32
LARGE_INTEGER count;
if (!QueryPerformanceCounter(&count))
{
fmt::throw_exception("Unexpected" HERE);
}
verify(HERE), QueryPerformanceCounter(&count);
// get time difference in nanoseconds
const u64 diff = (count.QuadPart - g_time_aux_info.start_time) * 1000000000u / g_time_aux_info.perf_freq;
const u64 diff = (count.QuadPart - s_time_aux_info.start_time) * 1000000000u / s_time_aux_info.perf_freq;
// get time since Epoch in nanoseconds
const u64 time = g_time_aux_info.start_ftime * 100u + diff;
const u64 time = s_time_aux_info.start_ftime * 100u + diff;
*sec = time / 1000000000u;
*sec = time / 1000000000u;
*nsec = time % 1000000000u;
#else
struct timespec ts;
if (::clock_gettime(CLOCK_REALTIME, &ts))
{
fmt::throw_exception("System error %d" HERE, errno);
}
verify(HERE), ::clock_gettime(CLOCK_REALTIME, &ts) == 0;
*sec = ts.tv_sec;
*sec = ts.tv_sec;
*nsec = ts.tv_nsec;
#endif

View File

@ -1,8 +1,6 @@
#pragma once
#include "Utilities/types.h"
#include "Utilities/Macro.h"
#include "Utilities/Platform.h"
#include "Utilities/SharedMutex.h"
#include <memory>

View File

@ -162,7 +162,7 @@ namespace vm
{
std::lock_guard<reservation_mutex_t> lock(g_reservation_mutex);
const u64 align = 0x80000000ull >> cntlz32(size);
const u64 align = 0x80000000ull >> cntlz32(size, true);
if (!size || !addr || size > 4096 || size != align || addr & (align - 1))
{
@ -198,7 +198,7 @@ namespace vm
{
std::unique_lock<reservation_mutex_t> lock(g_reservation_mutex);
const u64 align = 0x80000000ull >> cntlz32(size);
const u64 align = 0x80000000ull >> cntlz32(size, true);
if (!size || !addr || size > 4096 || size != align || addr & (align - 1))
{
@ -285,7 +285,7 @@ namespace vm
{
std::unique_lock<reservation_mutex_t> lock(g_reservation_mutex);
const u64 align = 0x80000000ull >> cntlz32(size);
const u64 align = 0x80000000ull >> cntlz32(size, true);
if (!size || !addr || size > 4096 || size != align || addr & (align - 1))
{
@ -582,7 +582,7 @@ namespace vm
size = ::align(size, 4096);
// Check alignment (it's page allocation, so passing small values there is just silly)
if (align < 4096 || align != (0x80000000u >> cntlz32(align)))
if (align < 4096 || align != (0x80000000u >> cntlz32(align, true)))
{
fmt::throw_exception("Invalid alignment (size=0x%x, align=0x%x)" HERE, size, align);
}

View File

@ -1,7 +1,6 @@
#pragma once
#include "Utilities/types.h"
#include "Utilities/Macro.h"
class thread_ctrl;

View File

@ -3,34 +3,44 @@
namespace vk
{
context *g_current_vulkan_ctx = nullptr;
context* g_current_vulkan_ctx = nullptr;
render_device g_current_renderer;
texture g_null_texture;
VkSampler g_null_sampler = nullptr;
VkSampler g_null_sampler = nullptr;
VkImageView g_null_image_view = nullptr;
VKAPI_ATTR void *VKAPI_CALL mem_realloc(void *pUserData, void *pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope)
VKAPI_ATTR void* VKAPI_CALL mem_realloc(void* pUserData, void* pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope)
{
return realloc(pOriginal, size);
}
VKAPI_ATTR void *VKAPI_CALL mem_alloc(void *pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope)
{
#ifdef _WIN32
return _aligned_malloc(size, alignment);
#ifdef _MSC_VER
return _aligned_realloc(pOriginal, size, alignment);
#elif _WIN32
return __mingw_aligned_realloc(pOriginal, size, alignment);
#else
return malloc(size);
std::abort();
#endif
}
VKAPI_ATTR void VKAPI_CALL mem_free(void *pUserData, void *pMemory)
VKAPI_ATTR void* VKAPI_CALL mem_alloc(void* pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope)
{
#ifdef _WIN32
_aligned_free(pMemory);
#ifdef _MSC_VER
return _aligned_malloc(size, alignment);
#elif _WIN32
return __mingw_aligned_malloc(size, alignment);
#else
free(pMemory);
std::abort();
#endif
}
VKAPI_ATTR void VKAPI_CALL mem_free(void* pUserData, void* pMemory)
{
#ifdef _MSC_VER
_aligned_free(pMemory);
#elif _WIN32
__mingw_aligned_free(pMemory);
#else
std::abort();
#endif
}

View File

@ -1,6 +1,5 @@
#include "gcm_enums.h"
#include "Utilities/StrFmt.h"
#include "Utilities/Macro.h"
rsx::vertex_base_type rsx::to_vertex_base_type(u8 in)
{

View File

@ -27,7 +27,7 @@ namespace rsx
//
static inline u32 ceil_log2(u32 value)
{
return value <= 1 ? 0 : ::cntlz32((value - 1) << 1) ^ 31;
return value <= 1 ? 0 : ::cntlz32((value - 1) << 1, true) ^ 31;
}
/* Note: What the ps3 calls swizzling in this case is actually z-ordering / morton ordering of pixels

View File

@ -274,7 +274,7 @@ void Emulator::Load()
ppu_load_exec(ppu_exec);
fxm::import<GSRender>(PURE_EXPR(Emu.GetCallbacks().get_gs_render())); // TODO: must be created in appropriate sys_rsx syscall
fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render); // TODO: must be created in appropriate sys_rsx syscall
}
else if (ppu_prx.open(elf_file) == elf_error::ok)
{

View File

@ -396,10 +396,8 @@
<ClInclude Include="..\Utilities\lockless.h" />
<ClInclude Include="..\Utilities\SleepQueue.h" />
<ClInclude Include="..\Utilities\sync.h" />
<ClInclude Include="..\Utilities\Platform.h" />
<ClInclude Include="..\Utilities\Log.h" />
<ClInclude Include="..\Utilities\File.h" />
<ClInclude Include="..\Utilities\Macro.h" />
<ClInclude Include="..\Utilities\Config.h" />
<ClInclude Include="..\Utilities\rXml.h" />
<ClInclude Include="..\Utilities\Semaphore.h" />

View File

@ -1141,12 +1141,6 @@
<ClInclude Include="Emu\RSX\Common\ring_buffer_helper.h">
<Filter>Emu\GPU\RSX\Common</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\Macro.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="..\Utilities\Platform.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="Loader\ELF.h">
<Filter>Loader</Filter>
</ClInclude>

View File

@ -71,44 +71,44 @@ Rpcs3App* TheApp;
cfg::map_entry<std::function<std::shared_ptr<KeyboardHandlerBase>()>> g_cfg_kb_handler(cfg::root.io, "Keyboard",
{
{ "Null", PURE_EXPR(std::make_shared<NullKeyboardHandler>()) },
{ "Basic", PURE_EXPR(std::make_shared<BasicKeyboardHandler>()) },
{ "Null", &std::make_shared<NullKeyboardHandler> },
{ "Basic", &std::make_shared<BasicKeyboardHandler> },
});
cfg::map_entry<std::function<std::shared_ptr<MouseHandlerBase>()>> g_cfg_mouse_handler(cfg::root.io, "Mouse",
{
{ "Null", PURE_EXPR(std::make_shared<NullMouseHandler>()) },
{ "Basic", PURE_EXPR(std::make_shared<BasicMouseHandler>()) },
{ "Null", &std::make_shared<NullMouseHandler> },
{ "Basic", &std::make_shared<BasicMouseHandler> },
});
cfg::map_entry<std::function<std::shared_ptr<PadHandlerBase>()>> g_cfg_pad_handler(cfg::root.io, "Pad", "Keyboard",
{
{ "Null", PURE_EXPR(std::make_shared<NullPadHandler>()) },
{ "Keyboard", PURE_EXPR(std::make_shared<KeyboardPadHandler>()) },
{ "Null", &std::make_shared<NullPadHandler> },
{ "Keyboard", &std::make_shared<KeyboardPadHandler> },
#ifdef _MSC_VER
{ "XInput", PURE_EXPR(std::make_shared<XInputPadHandler>()) },
{ "XInput", &std::make_shared<XInputPadHandler> },
#endif
});
cfg::map_entry<std::function<std::shared_ptr<GSRender>()>> g_cfg_gs_render(cfg::root.video, "Renderer", "OpenGL",
{
{ "Null", PURE_EXPR(std::make_shared<NullGSRender>()) },
{ "OpenGL", PURE_EXPR(std::make_shared<GLGSRender>()) },
{ "Null", &std::make_shared<NullGSRender> },
{ "OpenGL", &std::make_shared<GLGSRender> },
#ifdef _MSC_VER
{ "D3D12", PURE_EXPR(std::make_shared<D3D12GSRender>()) },
{ "D3D12", &std::make_shared<D3D12GSRender> },
#endif
#ifdef _WIN32
{ "Vulkan", PURE_EXPR(std::make_shared<VKGSRender>()) },
{ "Vulkan", &std::make_shared<VKGSRender> },
#endif
});
cfg::map_entry<std::function<std::shared_ptr<AudioThread>()>> g_cfg_audio_render(cfg::root.audio, "Renderer", 1,
{
{ "Null", PURE_EXPR(std::make_shared<NullAudioThread>()) },
{ "Null", &std::make_shared<NullAudioThread> },
#ifdef _WIN32
{ "XAudio2", PURE_EXPR(std::make_shared<XAudio2Thread>()) },
{ "XAudio2", &std::make_shared<XAudio2Thread> },
#endif
{ "OpenAL", PURE_EXPR(std::make_shared<OpenALThread>()) },
{ "OpenAL", &std::make_shared<OpenALThread> },
});
extern cfg::bool_entry g_cfg_autostart;
@ -159,11 +159,11 @@ bool Rpcs3App::OnInit()
wxGetApp().SendDbgCommand(id, t);
};
callbacks.get_kb_handler = PURE_EXPR(g_cfg_kb_handler.get()());
callbacks.get_kb_handler = []{ return g_cfg_kb_handler.get()(); };
callbacks.get_mouse_handler = PURE_EXPR(g_cfg_mouse_handler.get()());
callbacks.get_mouse_handler = []{ return g_cfg_mouse_handler.get()(); };
callbacks.get_pad_handler = PURE_EXPR(g_cfg_pad_handler.get()());
callbacks.get_pad_handler = []{ return g_cfg_pad_handler.get()(); };
callbacks.get_gs_frame = [](frame_type type, int w, int h) -> std::unique_ptr<GSFrameBase>
{
@ -178,9 +178,9 @@ bool Rpcs3App::OnInit()
fmt::throw_exception("Invalid frame type (0x%x)" HERE, (int)type);
};
callbacks.get_gs_render = PURE_EXPR(g_cfg_gs_render.get()());
callbacks.get_gs_render = []{ return g_cfg_gs_render.get()(); };
callbacks.get_audio = PURE_EXPR(g_cfg_audio_render.get()());
callbacks.get_audio = []{ return g_cfg_audio_render.get()(); };
callbacks.get_msg_dialog = []() -> std::shared_ptr<MsgDialogBase>
{

View File

@ -19,11 +19,23 @@
#pragma warning( disable : 4351 )
// MSVC bug workaround
#ifdef _MSC_VER
namespace std { inline namespace literals { inline namespace chrono_literals {}}}
#endif
#include "Utilities/types.h"
#include "Utilities/BEType.h"
#include "Utilities/Atomic.h"
#include "Utilities/StrFmt.h"
#include "Utilities/File.h"
#include "Utilities/Log.h"
#include <cstdlib>
#include <cstdint>
#include <climits>
#include <cstring>
#include <climits>
#include <exception>
#include <stdexcept>
#include <string>
#include <memory>
#include <vector>
@ -31,18 +43,4 @@
#include <functional>
#include <unordered_map>
// MSVC bug workaround
#ifdef _MSC_VER
namespace std { inline namespace literals { inline namespace chrono_literals {}}}
#endif
using namespace std::literals;
#include "Utilities/types.h"
#include "Utilities/Macro.h"
#include "Utilities/Platform.h"
#include "Utilities/BEType.h"
#include "Utilities/Atomic.h"
#include "Utilities/StrFmt.h"
#include "Utilities/File.h"
#include "Utilities/Log.h"