[All] Fixed multiple issues during build on Linux

- Added some fixes introduced by RodoMa92 in PR198

- Lack of AVX2 extension (should be done differently in the future)
- Disable deprecated-volatile warning
- Added missing override in posix EventInfo, ImGui notification class and XContent class
- Removed not used XAudio2.h include in XMP
- Fixed missing switch-case in XObject
- Added fugly template in native_list.h
- Fixed multiple smaller issues
This commit is contained in:
Gliniak 2025-01-08 22:27:51 +01:00 committed by Radosław Gliński
parent cdd3f161fa
commit 09be7e874a
31 changed files with 117 additions and 76 deletions

View File

@ -113,12 +113,18 @@ filter("platforms:Linux")
"rt", "rt",
}) })
filter({"platforms:Linux"})
vectorextensions("AVX2")
filter({"platforms:Linux", "kind:*App"}) filter({"platforms:Linux", "kind:*App"})
linkgroups("On") linkgroups("On")
filter({"platforms:Linux", "language:C++", "toolset:gcc"}) filter({"platforms:Linux", "language:C++", "toolset:gcc"})
disablewarnings({ disablewarnings({
"unused-result" "unused-result",
"deprecated-volatile",
"switch",
"deprecated-enum-enum-conversion",
}) })
filter({"platforms:Linux", "toolset:gcc"}) filter({"platforms:Linux", "toolset:gcc"})
@ -135,7 +141,10 @@ filter({"platforms:Linux", "toolset:gcc"})
filter({"platforms:Linux", "language:C++", "toolset:clang"}) filter({"platforms:Linux", "language:C++", "toolset:clang"})
disablewarnings({ disablewarnings({
"deprecated-register" "deprecated-register",
"deprecated-volatile",
"switch",
"deprecated-enum-enum-conversion",
}) })
filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"}) filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"})
buildoptions({ buildoptions({

View File

@ -13,8 +13,6 @@
#include "xenia/apu/xma_context.h" #include "xenia/apu/xma_context.h"
#include "xenia/base/logging.h" #include "xenia/base/logging.h"
#include <XAudio2.h>
extern "C" { extern "C" {
#if XE_COMPILER_MSVC #if XE_COMPILER_MSVC
#pragma warning(push) #pragma warning(push)

View File

@ -35,7 +35,7 @@ static void _generic_sequential_6_BE_to_interleaved_6_LE(
} }
} }
} }
#if XE_COMPILER_CLANG_CL != 1 #if XE_COMPILER_CLANG_CL != 1 && !XE_PLATFORM_LINUX
// load_be_u32 unavailable on clang-cl // load_be_u32 unavailable on clang-cl
XE_NOINLINE XE_NOINLINE
static void _movbe_sequential_6_BE_to_interleaved_6_LE( static void _movbe_sequential_6_BE_to_interleaved_6_LE(

View File

@ -74,6 +74,15 @@ inline int32_t atomic_inc(volatile int32_t* value) {
inline int32_t atomic_dec(volatile int32_t* value) { inline int32_t atomic_dec(volatile int32_t* value) {
return __sync_sub_and_fetch(value, 1); return __sync_sub_and_fetch(value, 1);
} }
inline int32_t atomic_or(volatile int32_t* value, int32_t nv) {
return __sync_or_and_fetch(value, nv);
}
inline int32_t atomic_and(volatile int32_t* value, int32_t nv) {
return __sync_and_and_fetch(value, nv);
}
inline int32_t atomic_xor(volatile int32_t* value, int32_t nv) {
return __sync_xor_and_fetch(value, nv);
}
inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) { inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) {
return __sync_val_compare_and_swap(value, *value, new_value); return __sync_val_compare_and_swap(value, *value, new_value);

View File

@ -23,7 +23,7 @@ extern "C" int main(int argc, char** argv) {
} }
// Initialize logging. Needs parsed cvars. // Initialize logging. Needs parsed cvars.
xe::InitializeLogging(entry_info.name); // xe::InitializeLogging(entry_info.name);
std::vector<std::string> args; std::vector<std::string> args;
for (int n = 0; n < argc; n++) { for (int n = 0; n < argc; n++) {
@ -32,7 +32,7 @@ extern "C" int main(int argc, char** argv) {
int result = entry_info.entry_point(args); int result = entry_info.entry_point(args);
xe::ShutdownLogging(); // xe::ShutdownLogging();
return result; return result;
} }

View File

@ -905,7 +905,7 @@ class PosixEvent : public PosixConditionHandle<Event> {
~PosixEvent() override = default; ~PosixEvent() override = default;
void Set() override { handle_.Signal(); } void Set() override { handle_.Signal(); }
void Reset() override { handle_.Reset(); } void Reset() override { handle_.Reset(); }
EventInfo Query() { EventInfo Query() override {
EventInfo result{}; EventInfo result{};
assert_always(); assert_always();
return result; return result;

View File

@ -57,15 +57,15 @@ Memory* PPCFrontend::memory() const { return processor_->memory(); }
// Checks the state of the global lock and sets scratch to the current MSR // Checks the state of the global lock and sets scratch to the current MSR
// value. // value.
void CheckGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) { void CheckGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) {
auto global_mutex = reinterpret_cast<xe_global_mutex*>(arg0); auto global_mutex = reinterpret_cast<global_mutex_type*>(arg0);
auto global_lock_count = reinterpret_cast<int32_t*>(arg1); auto global_lock_count = reinterpret_cast<int32_t*>(arg1);
std::lock_guard<xe_global_mutex> lock(*global_mutex); std::lock_guard<global_mutex_type> lock(*global_mutex);
ppc_context->scratch = *global_lock_count ? 0 : 0x8000; ppc_context->scratch = *global_lock_count ? 0 : 0x8000;
} }
// Enters the global lock. Safe to recursion. // Enters the global lock. Safe to recursion.
void EnterGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) { void EnterGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) {
auto global_mutex = reinterpret_cast<xe_global_mutex*>(arg0); auto global_mutex = reinterpret_cast<global_mutex_type*>(arg0);
auto global_lock_count = reinterpret_cast<int32_t*>(arg1); auto global_lock_count = reinterpret_cast<int32_t*>(arg1);
global_mutex->lock(); global_mutex->lock();
xe::atomic_inc(global_lock_count); xe::atomic_inc(global_lock_count);
@ -73,7 +73,7 @@ void EnterGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) {
// Leaves the global lock. Safe to recursion. // Leaves the global lock. Safe to recursion.
void LeaveGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) { void LeaveGlobalLock(PPCContext* ppc_context, void* arg0, void* arg1) {
auto global_mutex = reinterpret_cast<xe_global_mutex*>(arg0); auto global_mutex = reinterpret_cast<global_mutex_type*>(arg0);
auto global_lock_count = reinterpret_cast<int32_t*>(arg1); auto global_lock_count = reinterpret_cast<int32_t*>(arg1);
auto new_lock_count = xe::atomic_dec(global_lock_count); auto new_lock_count = xe::atomic_dec(global_lock_count);
assert_true(new_lock_count >= 0); assert_true(new_lock_count >= 0);

View File

@ -151,7 +151,11 @@ void PPCTranslator::DumpHIR(GuestFunction* function, PPCHIRBuilder* builder) {
{ {
wchar_t tmpbuf[64]; wchar_t tmpbuf[64];
#ifdef XE_PLATFORM_WIN32
_snwprintf(tmpbuf, 64, L"%X", function->address()); _snwprintf(tmpbuf, 64, L"%X", function->address());
#else
swprintf(tmpbuf, 64, L"%X", function->address());
#endif
folder_path.append(&tmpbuf[0]); folder_path.append(&tmpbuf[0]);
} }

View File

@ -447,7 +447,7 @@ bool Processor::Restore(ByteStream* stream) {
std::vector<uint32_t> to_delete; std::vector<uint32_t> to_delete;
for (auto& it : thread_debug_infos_) { for (auto& it : thread_debug_infos_) {
if (it.second->state == ThreadDebugInfo::State::kZombie) { if (it.second->state == ThreadDebugInfo::State::kZombie) {
it.second->thread_handle = NULL; it.second->thread_handle = 0;
to_delete.push_back(it.first); to_delete.push_back(it.first);
} }
} }
@ -502,7 +502,7 @@ void Processor::OnThreadDestroyed(uint32_t thread_id) {
auto global_lock = global_critical_region_.Acquire(); auto global_lock = global_critical_region_.Acquire();
auto it = thread_debug_infos_.find(thread_id); auto it = thread_debug_infos_.find(thread_id);
assert_true(it != thread_debug_infos_.end()); assert_true(it != thread_debug_infos_.end());
it->second->thread_handle = NULL; it->second->thread_handle = 0;
thread_debug_infos_.erase(it); thread_debug_infos_.erase(it);
} }

View File

@ -1136,10 +1136,14 @@ void XexModule::Precompile() {
high_code); high_code);
final_image_sha_.finalize(image_sha_bytes_); final_image_sha_.finalize(image_sha_bytes_);
char fmtbuf[16]; char fmtbuf[20];
for (unsigned i = 0; i < 20; ++i) { for (unsigned i = 0; i < 20; ++i) {
#ifdef XE_PLATFORM_WIN32
sprintf_s(fmtbuf, "%X", image_sha_bytes_[i]); sprintf_s(fmtbuf, "%X", image_sha_bytes_[i]);
#else
snprintf(fmtbuf, sizeof(fmtbuf), "%X", image_sha_bytes_[i]);
#endif
image_sha_str_ += &fmtbuf[0]; image_sha_str_ += &fmtbuf[0];
} }

View File

@ -309,7 +309,7 @@ void DebugWindow::DrawToolbar() {
case cpu::ThreadDebugInfo::State::kAlive: case cpu::ThreadDebugInfo::State::kAlive:
case cpu::ThreadDebugInfo::State::kExited: case cpu::ThreadDebugInfo::State::kExited:
case cpu::ThreadDebugInfo::State::kWaiting: case cpu::ThreadDebugInfo::State::kWaiting:
if (thread_info->thread_handle == NULL || thread_info->thread == NULL) { if (!thread_info->thread_handle || thread_info->thread == nullptr) {
thread_combo.Append("(invalid)"); thread_combo.Append("(invalid)");
} else { } else {
thread_combo.Append(thread_info->thread->thread_name()); thread_combo.Append(thread_info->thread->thread_name());

View File

@ -580,10 +580,17 @@ static inline void GetScissorTmpl(const RegisterFile& XE_RESTRICT regs,
__m128i pa_sc_scissor = _mm_setr_epi32( __m128i pa_sc_scissor = _mm_setr_epi32(
pa_sc_screen_scissor_tl_tl_x, pa_sc_screen_scissor_tl_tl_y, pa_sc_screen_scissor_tl_tl_x, pa_sc_screen_scissor_tl_tl_y,
pa_sc_screen_scissor_br_br_x, pa_sc_screen_scissor_br_br_y); pa_sc_screen_scissor_br_br_x, pa_sc_screen_scissor_br_br_y);
#if XE_PLATFORM_WIN32
__m128i xyoffsetadd = _mm_cvtsi64x_si128( __m128i xyoffsetadd = _mm_cvtsi64x_si128(
static_cast<unsigned long long>(pa_sc_window_offset_window_x_offset) | static_cast<unsigned long long>(pa_sc_window_offset_window_x_offset) |
(static_cast<unsigned long long>(pa_sc_window_offset_window_y_offset) (static_cast<unsigned long long>(pa_sc_window_offset_window_y_offset)
<< 32)); << 32));
#else
__m128i xyoffsetadd = _mm_cvtsi64_si128(
static_cast<unsigned long long>(pa_sc_window_offset_window_x_offset) |
(static_cast<unsigned long long>(pa_sc_window_offset_window_y_offset)
<< 32));
#endif
xyoffsetadd = _mm_unpacklo_epi64(xyoffsetadd, xyoffsetadd); xyoffsetadd = _mm_unpacklo_epi64(xyoffsetadd, xyoffsetadd);
// chrispy: put this here to make it clear that the shift by 31 is extracting // chrispy: put this here to make it clear that the shift by 31 is extracting
// this field // this field

View File

@ -100,7 +100,7 @@ constexpr bool IsPrimitivePolygonal(bool vgt_output_path_is_tessellation_enable,
return (primitive_polygonal_table & (1U << static_cast<uint32_t>(type))) != 0; return (primitive_polygonal_table & (1U << static_cast<uint32_t>(type))) != 0;
} }
XE_FORCEINLINE XE_FORCEINLINE
bool IsPrimitivePolygonal(const RegisterFile& regs) { static bool IsPrimitivePolygonal(const RegisterFile& regs) {
return IsPrimitivePolygonal( return IsPrimitivePolygonal(
regs.Get<reg::VGT_OUTPUT_PATH_CNTL>().path_select == regs.Get<reg::VGT_OUTPUT_PATH_CNTL>().path_select ==
xenos::VGTOutputPath::kTessellationEnable, xenos::VGTOutputPath::kTessellationEnable,

View File

@ -482,7 +482,7 @@ void SharedMemory::TryFindUploadRange(const uint32_t& block_first,
} }
static bool UploadRange_DoBestScanForward(uint64_t v, uint32_t* out) { static bool UploadRange_DoBestScanForward(uint64_t v, uint32_t* out) {
#if XE_ARCH_AMD64 == 1 #if XE_ARCH_AMD64 == 1 && XE_PLATFORM_WIN32
if (!v) { if (!v) {
return false; return false;
} }

View File

@ -89,7 +89,7 @@ void TracePlayer::PlayTrace(const uint8_t* trace_data, size_t trace_size,
TracePlaybackMode playback_mode, TracePlaybackMode playback_mode,
bool clear_caches) { bool clear_caches) {
playing_trace_ = true; playing_trace_ = true;
graphics_system_->command_processor()->CallInThread([=]() { graphics_system_->command_processor()->CallInThread([=, this]() {
PlayTraceOnThread(trace_data, trace_size, playback_mode, clear_caches); PlayTraceOnThread(trace_data, trace_size, playback_mode, clear_caches);
}); });
} }

View File

@ -899,9 +899,11 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
} break; } break;
case xenos::VertexFormat::k_16_16_FLOAT: { case xenos::VertexFormat::k_16_16_FLOAT: {
auto e0 = LOADEL(uint32_t, 0); auto e0 = LOADEL(uint32_t, 0);
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 16) & 0xFFFF)); ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e0 >> 16) & 0xFFFF)));
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 0) & 0xFFFF)); ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e0 >> 0) & 0xFFFF)));
ImGui::NextColumn(); ImGui::NextColumn();
} break; } break;
case xenos::VertexFormat::k_32_32: case xenos::VertexFormat::k_32_32:
@ -972,13 +974,17 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
case xenos::VertexFormat::k_16_16_16_16_FLOAT: { case xenos::VertexFormat::k_16_16_16_16_FLOAT: {
auto e0 = LOADEL(uint32_t, 0); auto e0 = LOADEL(uint32_t, 0);
auto e1 = LOADEL(uint32_t, 1); auto e1 = LOADEL(uint32_t, 1);
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 16) & 0xFFFF)); ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e0 >> 16) & 0xFFFF)));
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 0) & 0xFFFF)); ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e0 >> 0) & 0xFFFF)));
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text("%.2f", half_float::detail::uint16((e1 >> 16) & 0xFFFF)); ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e1 >> 16) & 0xFFFF)));
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text("%.2f", half_float::detail::uint16((e1 >> 0) & 0xFFFF)); ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e1 >> 0) & 0xFFFF)));
ImGui::NextColumn(); ImGui::NextColumn();
} break; } break;
case xenos::VertexFormat::k_32_32_32_32_FLOAT: case xenos::VertexFormat::k_32_32_32_32_FLOAT:

View File

@ -52,7 +52,7 @@ class NativeList {
}; };
template <typename VirtualTranslator> template <typename VirtualTranslator>
static X_LIST_ENTRY* XeHostList(uint32_t ptr, VirtualTranslator context) { static X_LIST_ENTRY* XeHostList(uint32_t ptr, VirtualTranslator context) {
return context->TranslateVirtual<X_LIST_ENTRY*>(ptr); return context->template TranslateVirtual<X_LIST_ENTRY*>(ptr);
} }
template <typename VirtualTranslator> template <typename VirtualTranslator>
static uint32_t XeGuestList(X_LIST_ENTRY* ptr, VirtualTranslator context) { static uint32_t XeGuestList(X_LIST_ENTRY* ptr, VirtualTranslator context) {
@ -193,7 +193,8 @@ struct X_TYPED_LIST : public X_LIST_ENTRY {
inline ForwardIterator& operator++() { inline ForwardIterator& operator++() {
current_entry = current_entry =
vt->TranslateVirtual<X_LIST_ENTRY*>(current_entry)->flink_ptr; vt->template TranslateVirtual<X_LIST_ENTRY*>(current_entry)
->flink_ptr;
return *this; return *this;
} }
inline bool operator!=(uint32_t other_ptr) const { inline bool operator!=(uint32_t other_ptr) const {
@ -202,7 +203,7 @@ struct X_TYPED_LIST : public X_LIST_ENTRY {
inline TObject& operator*() { inline TObject& operator*() {
return *ListEntryObject( return *ListEntryObject(
vt->TranslateVirtual<X_LIST_ENTRY*>(current_entry)); vt->template TranslateVirtual<X_LIST_ENTRY*>(current_entry));
} }
}; };
template <typename VirtualTranslator> template <typename VirtualTranslator>
@ -236,15 +237,17 @@ struct X_TYPED_LIST : public X_LIST_ENTRY {
} }
template <typename VirtualTranslator> template <typename VirtualTranslator>
bool empty(VirtualTranslator vt) const { bool empty(VirtualTranslator vt) const {
return vt->TranslateVirtual<X_LIST_ENTRY*>(flink_ptr) == this; return vt->template TranslateVirtual<X_LIST_ENTRY*>(flink_ptr) == this;
} }
template <typename VirtualTranslator> template <typename VirtualTranslator>
TObject* HeadObject(VirtualTranslator vt) { TObject* HeadObject(VirtualTranslator vt) {
return ListEntryObject(vt->TranslateVirtual<X_LIST_ENTRY*>(flink_ptr)); return ListEntryObject(
vt->template TranslateVirtual<X_LIST_ENTRY*>(flink_ptr));
} }
template <typename VirtualTranslator> template <typename VirtualTranslator>
TObject* TailObject(VirtualTranslator vt) { TObject* TailObject(VirtualTranslator vt) {
return ListEntryObject(vt->TranslateVirtual<X_LIST_ENTRY*>(blink_ptr)); return ListEntryObject(
vt->template TranslateVirtual<X_LIST_ENTRY*>(blink_ptr));
} }
}; };
} // namespace util } // namespace util

View File

@ -77,4 +77,4 @@ class AttributeStringFormatter {
} // namespace kernel } // namespace kernel
} // namespace xe } // namespace xe
#endif XENIA_KERNEL_UTIL_PRESENCE_STRING_BUILDER_H_ #endif // XENIA_KERNEL_UTIL_PRESENCE_STRING_BUILDER_H_

View File

@ -707,7 +707,7 @@ dword_result_t XamContentLaunchImageInternal_entry(lpvoid_t content_data_ptr,
auto& loader_data = xam->loader_data(); auto& loader_data = xam->loader_data();
loader_data.host_path = xe::path_to_utf8(host_path); loader_data.host_path = xe::path_to_utf8(host_path);
loader_data.launch_path = xex_path; loader_data.launch_path = xex_path.value();
xam->SaveLoaderData(); xam->SaveLoaderData();

View File

@ -459,20 +459,19 @@ DECLARE_XAM_EXPORT1(XamQueryLiveHiveW, kNone, kStub);
// http://www.noxa.org/blog/2011/02/28/building-an-xbox-360-emulator-part-3-feasibilityos/ // http://www.noxa.org/blog/2011/02/28/building-an-xbox-360-emulator-part-3-feasibilityos/
// http://www.noxa.org/blog/2011/08/13/building-an-xbox-360-emulator-part-5-xex-files/ // http://www.noxa.org/blog/2011/08/13/building-an-xbox-360-emulator-part-5-xex-files/
dword_result_t RtlSleep_entry(dword_t dwMilliseconds, dword_t bAlertable) { dword_result_t RtlSleep_entry(dword_t dwMilliseconds, dword_t bAlertable) {
LARGE_INTEGER delay{}; uint64_t delay{};
// Convert the delay time to 100-nanosecond intervals // Convert the delay time to 100-nanosecond intervals
delay.QuadPart = dwMilliseconds == -1 delay = dwMilliseconds == -1 ? LLONG_MAX
? LLONG_MAX : static_cast<int64_t>(-10000) * dwMilliseconds;
: static_cast<LONGLONG>(-10000) * dwMilliseconds;
X_STATUS result = xboxkrnl::KeDelayExecutionThread( X_STATUS result = xboxkrnl::KeDelayExecutionThread(MODE::UserMode, bAlertable,
MODE::UserMode, bAlertable, (uint64_t*)&delay, nullptr); &delay, nullptr);
// If the delay was interrupted by an APC, keep delaying the thread // If the delay was interrupted by an APC, keep delaying the thread
while (bAlertable && result == X_STATUS_ALERTED) { while (bAlertable && result == X_STATUS_ALERTED) {
result = xboxkrnl::KeDelayExecutionThread(MODE::UserMode, bAlertable, result = xboxkrnl::KeDelayExecutionThread(MODE::UserMode, bAlertable,
(uint64_t*)&delay, nullptr); &delay, nullptr);
} }
return result == X_STATUS_SUCCESS ? X_STATUS_SUCCESS : X_STATUS_USER_APC; return result == X_STATUS_SUCCESS ? X_STATUS_SUCCESS : X_STATUS_USER_APC;
@ -486,7 +485,7 @@ DECLARE_XAM_EXPORT1(SleepEx, kNone, kImplemented);
// https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleep // https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleep
void Sleep_entry(dword_t dwMilliseconds) { void Sleep_entry(dword_t dwMilliseconds) {
RtlSleep_entry(dwMilliseconds, FALSE); RtlSleep_entry(dwMilliseconds, false);
} }
DECLARE_XAM_EXPORT1(Sleep, kNone, kImplemented); DECLARE_XAM_EXPORT1(Sleep, kNone, kImplemented);
@ -601,28 +600,29 @@ DECLARE_XAM_EXPORT1(GetCurrentThreadId, kNone, kImplemented);
qword_result_t XapiFormatTimeOut_entry(lpqword_t result, qword_result_t XapiFormatTimeOut_entry(lpqword_t result,
dword_t dwMilliseconds) { dword_t dwMilliseconds) {
LARGE_INTEGER delay{}; if (dwMilliseconds == -1) {
return 0;
}
// Convert the delay time to 100-nanosecond intervals *result = static_cast<int64_t>(-10000) * dwMilliseconds;
delay.QuadPart = return result.host_address();
dwMilliseconds == -1 ? 0 : static_cast<LONGLONG>(-10000) * dwMilliseconds;
return (uint64_t)&delay;
} }
DECLARE_XAM_EXPORT1(XapiFormatTimeOut, kNone, kImplemented); DECLARE_XAM_EXPORT1(XapiFormatTimeOut, kNone, kImplemented);
dword_result_t WaitForSingleObjectEx_entry(dword_t hHandle, dword_result_t WaitForSingleObjectEx_entry(dword_t hHandle,
dword_t dwMilliseconds, dword_t dwMilliseconds,
dword_t bAlertable) { dword_t bAlertable) {
uint64_t* timeout = nullptr; // TODO(Gliniak): Figure it out to be less janky.
uint64_t timeout_ptr = XapiFormatTimeOut_entry(timeout, dwMilliseconds); uint64_t timeout;
uint64_t* timeout_ptr = reinterpret_cast<uint64_t*>(
static_cast<uint64_t>(XapiFormatTimeOut_entry(&timeout, dwMilliseconds)));
X_STATUS result = xe::kernel::xboxkrnl::NtWaitForSingleObjectEx( X_STATUS result =
hHandle, 1, bAlertable, &timeout_ptr); xboxkrnl::NtWaitForSingleObjectEx(hHandle, 1, bAlertable, timeout_ptr);
while (bAlertable && result == X_STATUS_ALERTED) { while (bAlertable && result == X_STATUS_ALERTED) {
result = xe::kernel::xboxkrnl::NtWaitForSingleObjectEx( result =
hHandle, 1, bAlertable, &timeout_ptr); xboxkrnl::NtWaitForSingleObjectEx(hHandle, 1, bAlertable, timeout_ptr);
} }
RtlSetLastNTError_entry(result); RtlSetLastNTError_entry(result);

View File

@ -722,7 +722,7 @@ dword_result_t NetDll_getsockopt_entry(dword_t caller, dword_t socket_handle,
return -1; return -1;
} }
int native_len = *optlen; uint32_t native_len = *optlen;
X_STATUS status = socket->GetOption(level, optname, optval_ptr, &native_len); X_STATUS status = socket->GetOption(level, optname, optval_ptr, &native_len);
return XSUCCEEDED(status) ? 0 : -1; return XSUCCEEDED(status) ? 0 : -1;
} }

View File

@ -385,7 +385,7 @@ class ProfilePasscodeDialog : public XamDialog {
if (ImGui::BeginPopupModal(title_.c_str(), nullptr, if (ImGui::BeginPopupModal(title_.c_str(), nullptr,
ImGuiWindowFlags_AlwaysAutoResize)) { ImGuiWindowFlags_AlwaysAutoResize)) {
if (description_.size()) { if (description_.size()) {
ImGui::Text(description_.c_str()); ImGui::Text("%s", description_.c_str());
} }
for (uint8_t i = 0; i < passcode_length; i++) { for (uint8_t i = 0; i < passcode_length; i++) {
@ -642,14 +642,12 @@ class GameAchievementsDialog final : public XamDialog {
ImGui::PushFont(imgui_drawer()->GetTitleFont()); ImGui::PushFont(imgui_drawer()->GetTitleFont());
const auto primary_line_height = ImGui::GetTextLineHeight(); const auto primary_line_height = ImGui::GetTextLineHeight();
ImGui::TextUnformatted( ImGui::Text("%s", GetAchievementTitle(achievement_entry).c_str());
fmt::format("{}", GetAchievementTitle(achievement_entry)).c_str());
ImGui::PopFont(); ImGui::PopFont();
ImGui::PushTextWrapPos(ImGui::GetMainViewport()->Size.x * 0.5f); ImGui::PushTextWrapPos(ImGui::GetMainViewport()->Size.x * 0.5f);
ImGui::TextWrapped( ImGui::TextWrapped("%s",
fmt::format("{}", GetAchievementDescription(achievement_entry)) GetAchievementDescription(achievement_entry).c_str());
.c_str());
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::SetCursorPosY(start_drawing_pos.y + default_image_icon_size.x - ImGui::SetCursorPosY(start_drawing_pos.y + default_image_icon_size.x -
@ -872,7 +870,7 @@ class GamesInfoDialog final : public ui::ImGuiDialog {
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + textOffsetX); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + textOffsetX);
} }
ImGui::Text(no_entries_message.c_str()); ImGui::Text("%s", no_entries_message.c_str());
ImGui::PopFont(); ImGui::PopFont();
} }

View File

@ -44,7 +44,7 @@ DEFINE_double(kernel_display_gamma_power, 2.22222233,
"Display gamma to use with kernel_display_gamma_type 3.", "Display gamma to use with kernel_display_gamma_type 3.",
"Kernel"); "Kernel");
inline constexpr static uint32_t GetVideoStandard() { inline const static uint32_t GetVideoStandard() {
if (cvars::video_standard < 1 || cvars::video_standard > 3) { if (cvars::video_standard < 1 || cvars::video_standard > 3) {
return 1; return 1;
} }
@ -52,11 +52,11 @@ inline constexpr static uint32_t GetVideoStandard() {
return cvars::video_standard; return cvars::video_standard;
} }
inline constexpr static float GetVideoRefreshRate() { inline const static float GetVideoRefreshRate() {
return cvars::use_50Hz_mode ? 50.0f : 60.0f; return cvars::use_50Hz_mode ? 50.0f : 60.0f;
} }
inline constexpr static std::pair<uint16_t, uint16_t> GetDisplayAspectRatio() { inline const static std::pair<uint16_t, uint16_t> GetDisplayAspectRatio() {
if (cvars::widescreen) { if (cvars::widescreen) {
return {16, 9}; return {16, 9};
} }

View File

@ -135,6 +135,8 @@ class XObject {
case Type::Thread: case Type::Thread:
case Type::Timer: case Type::Timer:
return true; return true;
default:
return false;
} }
return false; return false;
} }

View File

@ -74,9 +74,10 @@ X_STATUS XSocket::Close() {
} }
X_STATUS XSocket::GetOption(uint32_t level, uint32_t optname, void* optval_ptr, X_STATUS XSocket::GetOption(uint32_t level, uint32_t optname, void* optval_ptr,
int* optlen) { uint32_t* optlen) {
int ret = int ret =
getsockopt(native_handle_, level, optname, (char*)optval_ptr, optlen); getsockopt(native_handle_, level, optname, static_cast<char*>(optval_ptr),
reinterpret_cast<socklen_t*>(optlen));
if (ret < 0) { if (ret < 0) {
// TODO: WSAGetLastError() // TODO: WSAGetLastError()
return X_STATUS_UNSUCCESSFUL; return X_STATUS_UNSUCCESSFUL;

View File

@ -108,7 +108,7 @@ class XSocket : public XObject {
X_STATUS Close(); X_STATUS Close();
X_STATUS GetOption(uint32_t level, uint32_t optname, void* optval_ptr, X_STATUS GetOption(uint32_t level, uint32_t optname, void* optval_ptr,
int* optlen); uint32_t* optlen);
X_STATUS SetOption(uint32_t level, uint32_t optname, void* optval_ptr, X_STATUS SetOption(uint32_t level, uint32_t optname, void* optval_ptr,
uint32_t optlen); uint32_t optlen);
X_STATUS IOControl(uint32_t cmd, uint8_t* arg_ptr); X_STATUS IOControl(uint32_t cmd, uint8_t* arg_ptr);

View File

@ -170,7 +170,7 @@ void AchievementNotificationWindow::OnDraw(ImGuiIO& io) {
ImGui::SameLine(); ImGui::SameLine();
if (notification_draw_progress_ > 0.5f) { if (notification_draw_progress_ > 0.5f) {
ImGui::TextColored(white_color, GetNotificationText().c_str()); ImGui::TextColored(white_color, "%s", GetNotificationText().c_str());
} }
} }
// Restore previous style // Restore previous style
@ -248,7 +248,7 @@ void XNotifyWindow::OnDraw(ImGuiIO& io) {
ImGui::SameLine(); ImGui::SameLine();
if (notification_draw_progress_ > 0.5f) { if (notification_draw_progress_ > 0.5f) {
ImGui::TextColored(white_color, GetDescription().c_str()); ImGui::TextColored(white_color, "%s", GetDescription().c_str());
} }
} }
// Restore previous style // Restore previous style

View File

@ -57,7 +57,7 @@ class ImGuiGuestNotification : public ImGuiNotification {
const ImVec2 CalculateNotificationSize(ImVec2 text_size, const ImVec2 CalculateNotificationSize(ImVec2 text_size,
float scale) override; float scale) override;
virtual void OnDraw(ImGuiIO& io) {} virtual void OnDraw(ImGuiIO& io) override {}
float notification_draw_progress_; float notification_draw_progress_;

View File

@ -79,9 +79,9 @@ void HostNotificationWindow::OnDraw(ImGuiIO& io) {
{ {
ImGui::SetWindowFontScale(window_scale); ImGui::SetWindowFontScale(window_scale);
ImGui::Text(GetTitle().c_str()); ImGui::Text("%s", GetTitle().c_str());
ImGui::Separator(); ImGui::Separator();
ImGui::Text(GetDescription().c_str()); ImGui::Text("%s", GetDescription().c_str());
} }
ImGui::End(); ImGui::End();
} }

View File

@ -32,7 +32,7 @@ class ImGuiHostNotification : public ImGuiNotification {
const ImVec2 CalculateNotificationSize(ImVec2 text_size, const ImVec2 CalculateNotificationSize(ImVec2 text_size,
float scale) override; float scale) override;
virtual void OnDraw(ImGuiIO& io) {} virtual void OnDraw(ImGuiIO& io) override {}
}; };
class HostNotificationWindow final : ImGuiHostNotification { class HostNotificationWindow final : ImGuiHostNotification {

View File

@ -37,7 +37,7 @@ class XContentContainerDevice : public Device {
~XContentContainerDevice() override; ~XContentContainerDevice() override;
bool Initialize(); bool Initialize() override;
const std::string& name() const override { return name_; } const std::string& name() const override { return name_; }
uint32_t attributes() const override { return 0; } uint32_t attributes() const override { return 0; }
@ -93,9 +93,9 @@ class XContentContainerDevice : public Device {
// Initialize any container specific fields. // Initialize any container specific fields.
virtual void SetupContainer() {}; virtual void SetupContainer() {};
Entry* ResolvePath(const std::string_view path); Entry* ResolvePath(const std::string_view path) override;
void CloseFiles(); void CloseFiles();
void Dump(StringBuffer* string_buffer); void Dump(StringBuffer* string_buffer) override;
Result ReadHeaderAndVerify(FILE* header_file); Result ReadHeaderAndVerify(FILE* header_file);
void SetName(std::string name) { name_ = name; } void SetName(std::string name) { name_ = name; }