Skip to content

Commit 392d91b

Browse files
jbeichNekotekina
authored andcommitted
Improve portability for BSDs (RPCS3#2813)
* sys_net: don't use fds_bits from a system header on FreeBSD rpcs3/Emu/Cell/Modules/sys_net.cpp:137:14: error: no member named '__fds_bits' in 'sys_net::fd_set'; did you mean 'fds_bits'? if (src->fds_bits[i] & (1 << bit)) ^~~~~~~~ fds_bits /usr/include/sys/select.h:75:18: note: expanded from macro 'fds_bits' #define fds_bits __fds_bits ^ rpcs3/Emu/Cell/Modules/sys_net.h:114:13: note: 'fds_bits' declared here be_t<u32> fds_bits[32]; ^ * GUI: fallback to xdg-open on other Unices rpcs3/Gui/GameViewer.cpp:289:26: error: use of undeclared identifier 'command' wxExecute(fmt::FromUTF8(command)); ^ * File: FreeBSD never supported copyfile(3) but sendfile(2) works fine Utilities/File.cpp:114:10: fatal error: 'copyfile.h' file not found #include <copyfile.h> ^~~~~~~~~~~~ * Thread: add signal handling for BSDs Utilities/Thread.cpp:761:23: error: use of undeclared identifier 'REG_RAX' static const decltype(REG_RAX) reg_table[] = ^ Utilities/Thread.cpp:763:2: error: use of undeclared identifier 'REG_RAX' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:11: error: use of undeclared identifier 'REG_RCX' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:20: error: use of undeclared identifier 'REG_RDX' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:29: error: use of undeclared identifier 'REG_RBX' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:38: error: use of undeclared identifier 'REG_RSP' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:47: error: use of undeclared identifier 'REG_RBP' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:56: error: use of undeclared identifier 'REG_RSI' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:763:65: error: use of undeclared identifier 'REG_RDI' REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI, ^ Utilities/Thread.cpp:764:2: error: use of undeclared identifier 'REG_R8' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:10: error: use of undeclared identifier 'REG_R9' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:18: error: use of undeclared identifier 'REG_R10' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:27: error: use of undeclared identifier 'REG_R11' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:36: error: use of undeclared identifier 'REG_R12' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:45: error: use of undeclared identifier 'REG_R13' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:54: error: use of undeclared identifier 'REG_R14' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:63: error: use of undeclared identifier 'REG_R15' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:764:72: error: use of undeclared identifier 'REG_RIP' REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RIP ^ Utilities/Thread.cpp:792:26: error: no member named 'gregs' in '__mcontext' const u64 reg_value = *X64REG(context, reg - X64R_RAX); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:804:21: error: no member named 'gregs' in '__mcontext' out_value = (u8)(*X64REG(context, reg - X64R_AL)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:809:21: error: no member named 'gregs' in '__mcontext' out_value = (u8)(*X64REG(context, reg - X64R_AH) >> 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:815:31: error: no member named 'gregs' in '__mcontext' const s8 imm_value = *(s8*)(RIP(context) + i_size - 1); ^~~~~~~~~~~~ Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP' #define RIP(c) (*X64REG((c), 16)) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:827:33: error: no member named 'gregs' in '__mcontext' const s16 imm_value = *(s16*)(RIP(context) + i_size - 2); ^~~~~~~~~~~~ Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP' #define RIP(c) (*X64REG((c), 16)) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:836:33: error: no member named 'gregs' in '__mcontext' const s32 imm_value = *(s32*)(RIP(context) + i_size - 4); ^~~~~~~~~~~~ Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP' #define RIP(c) (*X64REG((c), 16)) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:846:20: error: no member named 'gregs' in '__mcontext' out_value = (u32)RCX(context); ^~~~~~~~~~~~ Utilities/Thread.cpp:779:18: note: expanded from macro 'RCX' #define RCX(c) (*X64REG((c), 1)) ^~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:851:19: error: no member named 'gregs' in '__mcontext' const u32 _cf = EFLAGS(context) & 0x1; ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:851:19: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:852:19: error: no member named 'gregs' in '__mcontext' const u32 _zf = EFLAGS(context) & 0x40; ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:852:19: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:853:19: error: no member named 'gregs' in '__mcontext' const u32 _sf = EFLAGS(context) & 0x80; ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:853:19: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:854:19: error: no member named 'gregs' in '__mcontext' const u32 _of = EFLAGS(context) & 0x800; ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:854:19: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:855:19: error: no member named 'gregs' in '__mcontext' const u32 _pf = EFLAGS(context) & 0x4; ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:855:19: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:885:12: error: no member named 'gregs' in '__mcontext' case 1: *X64REG(context, reg - X64R_RAX) = value & 0xff | *X64REG(context, re... ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:885:62: error: no member named 'gregs' in '__mcontext' ...*X64REG(context, reg - X64R_RAX) = value & 0xff | *X64REG(context, reg - X64R_RAX) & 0xffffff... ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:886:12: error: no member named 'gregs' in '__mcontext' case 2: *X64REG(context, reg - X64R_RAX) = value & 0xffff | *X64REG(context, ... ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:886:64: error: no member named 'gregs' in '__mcontext' ...reg - X64R_RAX) = value & 0xffff | *X64REG(context, reg - X64R_RAX) & 0xffff0000; return true; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:887:12: error: no member named 'gregs' in '__mcontext' case 4: *X64REG(context, reg - X64R_RAX) = value & 0xffffffff; return true; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:888:12: error: no member named 'gregs' in '__mcontext' case 8: *X64REG(context, reg - X64R_RAX) = value; return true; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:913:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) |= 0x1; // set CF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:913:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:917:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) &= ~0x1; // clear CF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:917:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:922:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) |= 0x40; // set ZF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:922:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:926:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) &= ~0x40; // clear ZF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:926:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:931:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) |= 0x80; // set SF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:931:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:935:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) &= ~0x80; // clear SF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:935:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:940:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) |= 0x800; // set OF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:940:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:944:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) &= ~0x800; // clear OF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:944:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:953:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) |= 0x4; // set PF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:953:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:957:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) &= ~0x4; // clear PF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:957:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:962:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) |= 0x10; // set AF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:962:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:966:3: error: no member named 'gregs' in '__mcontext' EFLAGS(context) &= ~0x10; // clear AF ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:966:3: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:976:7: error: no member named 'gregs' in '__mcontext' if (EFLAGS(context) & 0x400 /* direction flag */) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:769:49: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:976:7: error: use of undeclared identifier 'REG_EFL' Utilities/Thread.cpp:769:55: note: expanded from macro 'EFLAGS' #define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL]) ^ Utilities/Thread.cpp:1020:25: error: no member named 'gregs' in '__mcontext' auto code = (const u8*)RIP(context); ^~~~~~~~~~~~ Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP' #define RIP(c) (*X64REG((c), 16)) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:1146:3: error: no member named 'gregs' in '__mcontext' RIP(context) += i_size; ^~~~~~~~~~~~ Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP' #define RIP(c) (*X64REG((c), 16)) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:1368:47: error: no member named 'gregs' in '__mcontext' const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2; ~~~~~~~~~~~~~~~~~~~~ ^ Utilities/Thread.cpp:1368:53: error: use of undeclared identifier 'REG_ERR' const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2; ^ Utilities/Thread.cpp:1393:89: error: no member named 'gregs' in '__mcontext' ...%s location %p at %p.", cause, info->si_addr, RIP(context))); ^~~~~~~~~~~~ Utilities/Thread.cpp:784:18: note: expanded from macro 'RIP' #define RIP(c) (*X64REG((c), 16)) ^~~~~~~~~~~~~~~ Utilities/Thread.cpp:767:55: note: expanded from macro 'X64REG' #define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]]) ~~~~~~~~~~~~~~~~~~~~~~ ^ * Thread: add explict casts for incomplete pthread_t on some platforms Utilities/Thread.cpp:1467:17: error: no viable overloaded '=' ctrl->m_thread = thread; ~~~~~~~~~~~~~~ ^ ~~~~~~ Utilities/Atomic.h:776:12: note: candidate function not viable: cannot convert argument of incomplete type 'pthread_t' (aka 'pthread *') to 'const atomic_t<unsigned long>' for 1st argument atomic_t& operator =(const atomic_t&) = delete; ^ Utilities/Atomic.h:902:7: note: candidate function not viable: cannot convert argument of incomplete type 'pthread_t' (aka 'pthread *') to 'const type' (aka 'const unsigned long') for 1st argument type operator =(const type& rhs) ^ Utilities/Thread.cpp:1656:3: error: no matching function for call to 'pthread_detach' pthread_detach(m_thread.raw()); ^~~~~~~~~~~~~~ /usr/include/pthread.h:218:6: note: candidate function not viable: no known conversion from 'type' (aka 'unsigned long') to 'pthread_t' (aka 'pthread *') for 1st argument int pthread_detach(pthread_t); ^ * build: dlopen() maybe in libc /usr/bin/ld: cannot find -ldl c++: error: linker command failed with exit code 1 (use -v to see invocation) * build: iconv() maybe available on some BSDs in libc /usr/bin/ld: cannot find -liconv c++: error: linker command failed with exit code 1 (use -v to see invocation) * build: hidapi-hidraw is only built on Linux /usr/bin/ld: cannot find -lhidapi-hidraw c++: error: linker command failed with exit code 1 (use -v to see invocation) * Thread: use getrusage() on more POSIX-like systems * Qt: don't return NULL handle on other platforms rpcs3/rpcs3qt/gs_frame.cpp:120:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ * build: properly disable Vulkan on other platforms In file included from rpcs3/rpcs3_app.cpp:40: In file included from rpcs3/Emu/RSX/VK/VKGSRender.h:3: rpcs3/Emu/RSX/VK/VKHelpers.h:1209:42: error: unknown type name 'device_queues' std::vector<VkBool32> supportsPresent(device_queues); ^ rpcs3/Emu/RSX/VK/VKHelpers.h:1211:4: error: expected member name or ';' after declaration specifiers for (u32 index = 0; index < device_queues; index++) ^ rpcs3/Emu/RSX/VK/VKHelpers.h:1221:4: error: expected member name or ';' after declaration specifiers for (u32 i = 0; i < device_queues; i++) ^ rpcs3/Emu/RSX/VK/VKHelpers.h:1256:4: error: expected member name or ';' after declaration specifiers if (graphicsQueueNodeIndex != presentQueueNodeIndex) ^ rpcs3/Emu/RSX/VK/VKHelpers.h:1261:4: error: expected member name or ';' after declaration specifiers CHECK_RESULT(vkGetPhysicalDeviceSurfaceFormatsKHR(dev, surface, &formatCount, nullptr)); ^ [...] /usr/bin/ld: cannot find -lvulkan c++: error: linker command failed with exit code 1 (use -v to see invocation) * build: make install/strip work by moving commands * Qt: create surface for GL context if it wasn't ready #0 strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:100 RPCS3#1 0x000000000090f02e in std::__1::char_traits<char>::length (__s=0x0) at /usr/include/c++/v1/__string:215 RPCS3#2 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string (__s=0x0, this=<optimized out>) at /usr/include/c++/v1/string:1547 RPCS3#3 gl::capabilities::initialize (this=0x2ba32a0 <gl::g_driver_caps>) at rpcs3/Emu/RSX/GL/GLHelpers.h:133 RPCS3#4 0x000000000090d3dd in gl::get_driver_caps () at rpcs3/Emu/RSX/GL/GLHelpers.cpp:56 RPCS3#5 0x00000000008fa511 in GLGSRender::on_init_thread (this=0x838d30018) at rpcs3/Emu/RSX/GL/GLGSRender.cpp:484 RPCS3#6 0x0000000000938f9e in rsx::thread::on_task (this=0x838d30018) at rpcs3/Emu/RSX/RSXThread.cpp:334 RPCS3#7 0x0000000000abc329 in task_stack::task_type<named_thread::start_thread(std::__1::shared_ptr<void> const&)::$_10>::invoke() () RPCS3#8 0x0000000000abc114 in thread_ctrl::start(std::__1::shared_ptr<thread_ctrl> const&, task_stack)::$_7::__invoke(void*) () RPCS3#9 0x0000000801e60c35 in thread_start (curthread=0x843650a00) at /usr/src/lib/libthr/thread/thr_create.c:289 RPCS3#10 0x0000000000000000 in ?? () * build: don't abort without git metadata -- Found Git: /usr/local/bin/git (found version "2.13.1") fatal: Not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). CMake Warning at git-version.cmake:12 (message): git rev-list failed, unable to include version. * build: non-parallel needs git-version.h earlier rpcs3/rpcs3_version.cpp:3:10: fatal error: 'git-version.h' file not found #include "git-version.h" ^~~~~~~~~~~~~~~ 1 error generated.
1 parent ac12fc8 commit 392d91b

File tree

11 files changed

+153
-34
lines changed

11 files changed

+153
-34
lines changed

CMakeLists.txt

-16
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,3 @@ else()
5656
add_subdirectory(3rdparty/hidapi/libusb)
5757
#list(APPEND LIBS hidapi-libusb)
5858
endif()
59-
60-
# Linux installation
61-
62-
if(UNIX AND NOT APPLE)
63-
# Install the application icon and menu item
64-
install(FILES rpcs3/rpcs3.svg
65-
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
66-
install(FILES rpcs3/rpcs3.png
67-
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps)
68-
install(FILES rpcs3/rpcs3.desktop
69-
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
70-
# Install the binary
71-
install(FILES "${PROJECT_BINARY_DIR}/bin/rpcs3"
72-
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
73-
PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) # i.e. 755
74-
endif()

Utilities/File.cpp

+13-5
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ static fs::error to_error(DWORD e)
110110
#include <unistd.h>
111111
#include <utime.h>
112112

113-
#if defined(__APPLE__) || defined(__FreeBSD__)
113+
#if defined(__APPLE__)
114114
#include <copyfile.h>
115115
#include <mach-o/dyld.h>
116-
#else
116+
#elif defined(__DragonFly__) || defined(__FreeBSD__)
117+
#include <sys/socket.h> // sendfile
118+
#elif defined(__linux__) || defined(__sun)
117119
#include <sys/sendfile.h>
118120
#endif
119121

@@ -578,14 +580,20 @@ bool fs::copy_file(const std::string& from, const std::string& to, bool overwrit
578580
}
579581

580582
// Here we use kernel-space copying for performance reasons
581-
#if defined(__APPLE__) || defined(__FreeBSD__)
582-
// fcopyfile works on FreeBSD and OS X 10.5+
583+
#if defined(__APPLE__)
584+
// fcopyfile works on OS X 10.5+
583585
if (::fcopyfile(input, output, 0, COPYFILE_ALL))
584-
#else
586+
#elif defined(__DragonFly__) || defined(__FreeBSD__)
587+
if (::sendfile(input, output, 0, 0, NULL, NULL, 0))
588+
#elif defined(__linux__) || defined(__sun)
585589
// sendfile will work with non-socket output (i.e. regular file) on Linux 2.6.33+
586590
off_t bytes_copied = 0;
587591
struct ::stat fileinfo = { 0 };
588592
if (::fstat(input, &fileinfo) || ::sendfile(output, input, &bytes_copied, fileinfo.st_size))
593+
#else // NetBSD, OpenBSD, etc.
594+
fmt::throw_exception("fs::copy_file() isn't implemented for this platform.\nFrom: %s\nTo: %s", from, to);
595+
errno = 0;
596+
if (true)
589597
#endif
590598
{
591599
const int err = errno;

Utilities/Thread.cpp

+97-3
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,90 @@ uint64_t* darwin_x64reg(x64_context *context, int reg)
756756
}
757757
}
758758

759+
#elif defined(__DragonFly__) || defined(__FreeBSD__)
760+
761+
#define X64REG(context, reg) (freebsd_x64reg(context, reg))
762+
#ifdef __DragonFly__
763+
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((union savefpu*)(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg]))
764+
#else
765+
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((struct savefpu*)(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg]))
766+
#endif
767+
#define EFLAGS(context) ((context)->uc_mcontext.mc_rflags)
768+
769+
register_t* freebsd_x64reg(x64_context *context, int reg)
770+
{
771+
auto *state = &context->uc_mcontext;
772+
switch(reg)
773+
{
774+
case 0: return &state->mc_rax;
775+
case 1: return &state->mc_rcx;
776+
case 2: return &state->mc_rdx;
777+
case 3: return &state->mc_rbx;
778+
case 4: return &state->mc_rsp;
779+
case 5: return &state->mc_rbp;
780+
case 6: return &state->mc_rsi;
781+
case 7: return &state->mc_rdi;
782+
case 8: return &state->mc_r8;
783+
case 9: return &state->mc_r9;
784+
case 10: return &state->mc_r10;
785+
case 11: return &state->mc_r11;
786+
case 12: return &state->mc_r12;
787+
case 13: return &state->mc_r13;
788+
case 14: return &state->mc_r14;
789+
case 15: return &state->mc_r15;
790+
case 16: return &state->mc_rip;
791+
default:
792+
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
793+
return nullptr;
794+
}
795+
}
796+
797+
#elif defined(__OpenBSD__)
798+
799+
#define X64REG(context, reg) (openbsd_x64reg(context, reg))
800+
#define XMMREG(context, reg) (reinterpret_cast<v128*>((context)->sc_fpstate->fx_xmm[reg]))
801+
#define EFLAGS(context) ((context)->sc_rflags)
802+
803+
long* openbsd_x64reg(x64_context *context, int reg)
804+
{
805+
auto *state = &context->uc_mcontext;
806+
switch(reg)
807+
{
808+
case 0: return &state->sc_rax;
809+
case 1: return &state->sc_rcx;
810+
case 2: return &state->sc_rdx;
811+
case 3: return &state->sc_rbx;
812+
case 4: return &state->sc_rsp;
813+
case 5: return &state->sc_rbp;
814+
case 6: return &state->sc_rsi;
815+
case 7: return &state->sc_rdi;
816+
case 8: return &state->sc_r8;
817+
case 9: return &state->sc_r9;
818+
case 10: return &state->sc_r10;
819+
case 11: return &state->sc_r11;
820+
case 12: return &state->sc_r12;
821+
case 13: return &state->sc_r13;
822+
case 14: return &state->sc_r14;
823+
case 15: return &state->sc_r15;
824+
case 16: return &state->sc_rip;
825+
default:
826+
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
827+
return nullptr;
828+
}
829+
}
830+
831+
#elif defined(__NetBSD__)
832+
833+
static const decltype(_REG_RAX) reg_table[] =
834+
{
835+
_REG_RAX, _REG_RCX, _REG_RDX, _REG_RBX, _REG_RSP, _REG_RBP, _REG_RSI, _REG_RDI,
836+
_REG_R8, _REG_R9, _REG_R10, _REG_R11, _REG_R12, _REG_R13, _REG_R14, _REG_R15, _REG_RIP
837+
};
838+
839+
#define X64REG(context, reg) (&(context)->uc_mcontext.__gregs[reg_table[reg]])
840+
#define XMM_sig(context, reg) (reinterpret_cast<v128*>(((struct fxsave64*)(context)->uc_mcontext.__fpregs)->fx_xmm[reg]))
841+
#define EFLAGS(context) ((context)->uc_mcontext.__gregs[_REG_RFL])
842+
759843
#else
760844

761845
static const decltype(REG_RAX) reg_table[] =
@@ -765,7 +849,11 @@ static const decltype(REG_RAX) reg_table[] =
765849
};
766850

767851
#define X64REG(context, reg) (&(context)->uc_mcontext.gregs[reg_table[reg]])
852+
#ifdef __sun
853+
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.xmm[reg_table[reg]]))
854+
#else
768855
#define XMMREG(context, reg) (reinterpret_cast<v128*>(&(context)->uc_mcontext.fpregs->_xmm[reg]))
856+
#endif // __sun
769857
#define EFLAGS(context) ((context)->uc_mcontext.gregs[REG_EFL])
770858

771859
#endif // __APPLE__
@@ -1364,6 +1452,12 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
13641452

13651453
#ifdef __APPLE__
13661454
const bool is_writing = context->uc_mcontext->__es.__err & 0x2;
1455+
#elif defined(__DragonFly__) || defined(__FreeBSD__)
1456+
const bool is_writing = context->uc_mcontext.mc_err & 0x2;
1457+
#elif defined(__OpenBSD__)
1458+
const bool is_writing = context->sc_err & 0x2;
1459+
#elif defined(__NetBSD__)
1460+
const bool is_writing = context->uc_mcontext.__gregs[_REG_ERR] & 0x2;
13671461
#else
13681462
const bool is_writing = context->uc_mcontext.gregs[REG_ERR] & 0x2;
13691463
#endif
@@ -1464,7 +1558,7 @@ void thread_ctrl::start(const std::shared_ptr<thread_ctrl>& ctrl, task_stack tas
14641558
#endif
14651559

14661560
// TODO: this is unsafe and must be duplicated in thread_ctrl::initialize
1467-
ctrl->m_thread = thread;
1561+
ctrl->m_thread = (uintptr_t)thread;
14681562
}
14691563

14701564
void thread_ctrl::initialize()
@@ -1520,7 +1614,7 @@ void thread_ctrl::finalize(std::exception_ptr eptr) noexcept
15201614
FILETIME ctime, etime, ktime, utime;
15211615
GetThreadTimes(GetCurrentThread(), &ctime, &etime, &ktime, &utime);
15221616
const u64 time = ((ktime.dwLowDateTime | (u64)ktime.dwHighDateTime << 32) + (utime.dwLowDateTime | (u64)utime.dwHighDateTime << 32)) * 100ull;
1523-
#elif __linux__
1617+
#elif defined(RUSAGE_THREAD)
15241618
const u64 cycles = 0; // Not supported
15251619
struct ::rusage stats{};
15261620
::getrusage(RUSAGE_THREAD, &stats);
@@ -1653,7 +1747,7 @@ thread_ctrl::~thread_ctrl()
16531747
#ifdef _WIN32
16541748
CloseHandle((HANDLE)m_thread.raw());
16551749
#else
1656-
pthread_detach(m_thread.raw());
1750+
pthread_detach((pthread_t)m_thread.raw());
16571751
#endif
16581752
}
16591753
}

rpcs3/CMakeLists.txt

+23-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ endif()
106106
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
107107
#on some Linux distros shm_unlink and similar functions are in librt only
108108
set(ADDITIONAL_LIBS "rt" "X11" "asound")
109-
elseif(UNIX OR NOT MSVC)
109+
elseif(NOT MSVC AND NOT CMAKE_CXX_FLAGS MATCHES "LIBICONV_PLUG")
110110
#it seems like glibc includes the iconv functions we use but other libc
111111
#implementations like the one on OSX don't seem implement them
112112
set(ADDITIONAL_LIBS "iconv")
@@ -284,6 +284,8 @@ else()
284284
add_executable(rpcs3 ${RPCS3_SRC} ${RES_FILES} resources.qrc)
285285
endif()
286286

287+
add_dependencies(rpcs3 GitVersion)
288+
287289
if(WIN32)
288290
target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib VKstatic.1 glslang OSDependent OGLCompiler SPIRV HLSL setupapi.lib hidapi-hid Shlwapi.lib)
289291
if(NOT MSVC)
@@ -293,8 +295,13 @@ if(WIN32)
293295
endif()
294296
target_link_libraries(rpcs3 avformat.lib avcodec.lib avutil.lib swresample.lib swscale.lib png16_static ${OPENAL_LIBRARY} ${ADDITIONAL_LIBS})
295297
else()
296-
target_link_libraries(rpcs3 ${OPENAL_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES} hidapi-hidraw udev)
297-
target_link_libraries(rpcs3 -ldl -lpthread -lvulkan ${ZLIB_LIBRARIES} ${ADDITIONAL_LIBS})
298+
target_link_libraries(rpcs3 ${OPENAL_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})
299+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
300+
target_link_libraries(rpcs3 hidapi-hidraw udev vulkan)
301+
else()
302+
target_link_libraries(rpcs3 hidapi-libusb usb)
303+
endif()
304+
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS} -lpthread ${ZLIB_LIBRARIES} ${ADDITIONAL_LIBS})
298305
if (USE_SYSTEM_FFMPEG)
299306
link_libraries(${FFMPEG_LIBRARY_DIR})
300307
target_link_libraries(rpcs3 libavformat.so libavcodec.so libavutil.so libswresample.so libswscale.so)
@@ -322,3 +329,16 @@ target_link_libraries(rpcs3 ${RPCS3_QT_LIBS})
322329
set_target_properties(rpcs3 PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h")
323330

324331
cotire(rpcs3)
332+
333+
# Unix installation
334+
if(UNIX AND NOT APPLE)
335+
# Install the binary
336+
install(TARGETS rpcs3 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
337+
# Install the application icon and menu item
338+
install(FILES rpcs3.svg
339+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
340+
install(FILES rpcs3.png
341+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps)
342+
install(FILES rpcs3.desktop
343+
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
344+
endif()

rpcs3/Emu/Cell/Modules/sys_net.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#if defined(__FreeBSD__)
2+
#include <sys/select.h>
3+
#undef fds_bits
4+
#endif
5+
16
#pragma once
27

38
namespace vm { using namespace ps3; }

rpcs3/Gui/GameViewer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static void open_dir(const std::string& spath)
283283
std::replace(command.begin(), command.end(), '/', '\\');
284284
#elif __APPLE__
285285
std::string command = "open " + spath;
286-
#elif __linux__
286+
#else
287287
std::string command = "xdg-open " + spath;
288288
#endif
289289
wxExecute(fmt::FromUTF8(command));

rpcs3/git-version.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set(GIT_VERSION "unknown")
33
set(GIT_VERSION_UPDATE "1")
44

55
find_package(Git)
6-
if(GIT_FOUND)
6+
if(GIT_FOUND AND EXISTS "${SOURCE_DIR}/../.git/")
77
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count
88
WORKING_DIRECTORY ${SOURCE_DIR}
99
RESULT_VARIABLE exit_code

rpcs3/rpcs3_app.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
#ifdef _MSC_VER
3838
#include "Emu/RSX/D3D12/D3D12GSRender.h"
3939
#endif
40+
#if defined(_WIN32) || defined(__linux__)
4041
#include "Emu/RSX/VK/VKGSRender.h"
42+
#endif
4143
#ifdef _WIN32
4244
#include "Emu/Audio/XAudio2/XAudio2Thread.h"
4345
#endif
@@ -163,7 +165,9 @@ void rpcs3_app::InitializeCallbacks()
163165
{
164166
case video_renderer::null: return std::make_shared<NullGSRender>();
165167
case video_renderer::opengl: return std::make_shared<GLGSRender>();
168+
#if defined(_WIN32) || defined(__linux__)
166169
case video_renderer::vulkan: return std::make_shared<VKGSRender>();
170+
#endif
167171
#ifdef _MSC_VER
168172
case video_renderer::dx12: return std::make_shared<D3D12GSRender>();
169173
#endif

rpcs3/rpcs3qt/game_list_frame.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ static void open_dir(const std::string& spath)
480480
process->start("explorer", QStringList() << path);
481481
#elif __APPLE__
482482
process->start("open", QStringList() << path);
483-
#elif __linux__
483+
#else
484484
process->start("xdg-open", QStringList() << path);
485485
#endif
486486
}

rpcs3/rpcs3qt/gl_gs_frame.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ void* gl_gs_frame::make_context()
3333

3434
void gl_gs_frame::set_current(draw_context_t ctx)
3535
{
36-
((QOpenGLContext*)ctx.get())->makeCurrent(this);
36+
if (!((QOpenGLContext*)ctx.get())->makeCurrent(this))
37+
{
38+
create();
39+
((QOpenGLContext*)ctx.get())->makeCurrent(this);
40+
}
3741
}
3842

3943
void gl_gs_frame::delete_context(void* ctx)

rpcs3/rpcs3qt/gs_frame.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ void gs_frame::show()
111111

112112
void* gs_frame::handle() const
113113
{
114-
#ifdef __linux__
115-
return (void *)this->winId();
116-
#elif _WIN32
114+
#ifdef _WIN32
117115
return (HWND) this->winId();
116+
#else
117+
return (void *)this->winId();
118118
#endif
119119

120120
}

0 commit comments

Comments
 (0)