[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-10 21:41:45 +01:00
committed by Radosław Gliński
parent cdd3f161fa
commit 09be7e874a
31 changed files with 117 additions and 76 deletions
+11 -2
View File
@@ -113,12 +113,18 @@ filter("platforms:Linux")
"rt",
})
filter({"platforms:Linux"})
vectorextensions("AVX2")
filter({"platforms:Linux", "kind:*App"})
linkgroups("On")
filter({"platforms:Linux", "language:C++", "toolset:gcc"})
disablewarnings({
"unused-result"
"unused-result",
"deprecated-volatile",
"switch",
"deprecated-enum-enum-conversion",
})
filter({"platforms:Linux", "toolset:gcc"})
@@ -135,7 +141,10 @@ filter({"platforms:Linux", "toolset:gcc"})
filter({"platforms:Linux", "language:C++", "toolset:clang"})
disablewarnings({
"deprecated-register"
"deprecated-register",
"deprecated-volatile",
"switch",
"deprecated-enum-enum-conversion",
})
filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"})
buildoptions({
-2
View File
@@ -13,8 +13,6 @@
#include "xenia/apu/xma_context.h"
#include "xenia/base/logging.h"
#include <XAudio2.h>
extern "C" {
#if XE_COMPILER_MSVC
#pragma warning(push)
+1 -1
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
XE_NOINLINE
static void _movbe_sequential_6_BE_to_interleaved_6_LE(
+9
View File
@@ -74,6 +74,15 @@ inline int32_t atomic_inc(volatile int32_t* value) {
inline int32_t atomic_dec(volatile int32_t* value) {
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) {
return __sync_val_compare_and_swap(value, *value, new_value);
+2 -2
View File
@@ -23,7 +23,7 @@ extern "C" int main(int argc, char** argv) {
}
// Initialize logging. Needs parsed cvars.
xe::InitializeLogging(entry_info.name);
// xe::InitializeLogging(entry_info.name);
std::vector<std::string> args;
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);
xe::ShutdownLogging();
// xe::ShutdownLogging();
return result;
}
+1 -1
View File
@@ -905,7 +905,7 @@ class PosixEvent : public PosixConditionHandle<Event> {
~PosixEvent() override = default;
void Set() override { handle_.Signal(); }
void Reset() override { handle_.Reset(); }
EventInfo Query() {
EventInfo Query() override {
EventInfo result{};
assert_always();
return result;
+4 -4
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
// value.
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);
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;
}
// Enters the global lock. Safe to recursion.
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);
global_mutex->lock();
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.
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 new_lock_count = xe::atomic_dec(global_lock_count);
assert_true(new_lock_count >= 0);
+4
View File
@@ -151,7 +151,11 @@ void PPCTranslator::DumpHIR(GuestFunction* function, PPCHIRBuilder* builder) {
{
wchar_t tmpbuf[64];
#ifdef XE_PLATFORM_WIN32
_snwprintf(tmpbuf, 64, L"%X", function->address());
#else
swprintf(tmpbuf, 64, L"%X", function->address());
#endif
folder_path.append(&tmpbuf[0]);
}
+2 -2
View File
@@ -447,7 +447,7 @@ bool Processor::Restore(ByteStream* stream) {
std::vector<uint32_t> to_delete;
for (auto& it : thread_debug_infos_) {
if (it.second->state == ThreadDebugInfo::State::kZombie) {
it.second->thread_handle = NULL;
it.second->thread_handle = 0;
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 it = thread_debug_infos_.find(thread_id);
assert_true(it != thread_debug_infos_.end());
it->second->thread_handle = NULL;
it->second->thread_handle = 0;
thread_debug_infos_.erase(it);
}
+5 -1
View File
@@ -1136,10 +1136,14 @@ void XexModule::Precompile() {
high_code);
final_image_sha_.finalize(image_sha_bytes_);
char fmtbuf[16];
char fmtbuf[20];
for (unsigned i = 0; i < 20; ++i) {
#ifdef XE_PLATFORM_WIN32
sprintf_s(fmtbuf, "%X", image_sha_bytes_[i]);
#else
snprintf(fmtbuf, sizeof(fmtbuf), "%X", image_sha_bytes_[i]);
#endif
image_sha_str_ += &fmtbuf[0];
}
+1 -1
View File
@@ -309,7 +309,7 @@ void DebugWindow::DrawToolbar() {
case cpu::ThreadDebugInfo::State::kAlive:
case cpu::ThreadDebugInfo::State::kExited:
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)");
} else {
thread_combo.Append(thread_info->thread->thread_name());
+7
View File
@@ -580,10 +580,17 @@ static inline void GetScissorTmpl(const RegisterFile& XE_RESTRICT regs,
__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_br_br_x, pa_sc_screen_scissor_br_br_y);
#if XE_PLATFORM_WIN32
__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_y_offset)
<< 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);
// chrispy: put this here to make it clear that the shift by 31 is extracting
// this field
+1 -1
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;
}
XE_FORCEINLINE
bool IsPrimitivePolygonal(const RegisterFile& regs) {
static bool IsPrimitivePolygonal(const RegisterFile& regs) {
return IsPrimitivePolygonal(
regs.Get<reg::VGT_OUTPUT_PATH_CNTL>().path_select ==
xenos::VGTOutputPath::kTessellationEnable,
+1 -1
View File
@@ -482,7 +482,7 @@ void SharedMemory::TryFindUploadRange(const uint32_t& block_first,
}
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) {
return false;
}
+1 -1
View File
@@ -89,7 +89,7 @@ void TracePlayer::PlayTrace(const uint8_t* trace_data, size_t trace_size,
TracePlaybackMode playback_mode,
bool clear_caches) {
playing_trace_ = true;
graphics_system_->command_processor()->CallInThread([=]() {
graphics_system_->command_processor()->CallInThread([=, this]() {
PlayTraceOnThread(trace_data, trace_size, playback_mode, clear_caches);
});
}
+12 -6
View File
@@ -899,9 +899,11 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
} break;
case xenos::VertexFormat::k_16_16_FLOAT: {
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::Text("%.2f", half_float::detail::uint16((e0 >> 0) & 0xFFFF));
ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e0 >> 0) & 0xFFFF)));
ImGui::NextColumn();
} break;
case xenos::VertexFormat::k_32_32:
@@ -972,13 +974,17 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
case xenos::VertexFormat::k_16_16_16_16_FLOAT: {
auto e0 = LOADEL(uint32_t, 0);
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::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::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::Text("%.2f", half_float::detail::uint16((e1 >> 0) & 0xFFFF));
ImGui::Text("%.2f", static_cast<float>(half_float::detail::uint16(
(e1 >> 0) & 0xFFFF)));
ImGui::NextColumn();
} break;
case xenos::VertexFormat::k_32_32_32_32_FLOAT:
+9 -6
View File
@@ -52,7 +52,7 @@ class NativeList {
};
template <typename VirtualTranslator>
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>
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++() {
current_entry =
vt->TranslateVirtual<X_LIST_ENTRY*>(current_entry)->flink_ptr;
vt->template TranslateVirtual<X_LIST_ENTRY*>(current_entry)
->flink_ptr;
return *this;
}
inline bool operator!=(uint32_t other_ptr) const {
@@ -202,7 +203,7 @@ struct X_TYPED_LIST : public X_LIST_ENTRY {
inline TObject& operator*() {
return *ListEntryObject(
vt->TranslateVirtual<X_LIST_ENTRY*>(current_entry));
vt->template TranslateVirtual<X_LIST_ENTRY*>(current_entry));
}
};
template <typename VirtualTranslator>
@@ -236,15 +237,17 @@ struct X_TYPED_LIST : public X_LIST_ENTRY {
}
template <typename VirtualTranslator>
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>
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>
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
@@ -77,4 +77,4 @@ class AttributeStringFormatter {
} // namespace kernel
} // namespace xe
#endif XENIA_KERNEL_UTIL_PRESENCE_STRING_BUILDER_H_
#endif // XENIA_KERNEL_UTIL_PRESENCE_STRING_BUILDER_H_
+1 -1
View File
@@ -707,7 +707,7 @@ dword_result_t XamContentLaunchImageInternal_entry(lpvoid_t content_data_ptr,
auto& loader_data = xam->loader_data();
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();
+20 -20
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/08/13/building-an-xbox-360-emulator-part-5-xex-files/
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
delay.QuadPart = dwMilliseconds == -1
? LLONG_MAX
: static_cast<LONGLONG>(-10000) * dwMilliseconds;
delay = dwMilliseconds == -1 ? LLONG_MAX
: static_cast<int64_t>(-10000) * dwMilliseconds;
X_STATUS result = xboxkrnl::KeDelayExecutionThread(
MODE::UserMode, bAlertable, (uint64_t*)&delay, nullptr);
X_STATUS result = xboxkrnl::KeDelayExecutionThread(MODE::UserMode, bAlertable,
&delay, nullptr);
// If the delay was interrupted by an APC, keep delaying the thread
while (bAlertable && result == X_STATUS_ALERTED) {
result = xboxkrnl::KeDelayExecutionThread(MODE::UserMode, bAlertable,
(uint64_t*)&delay, nullptr);
&delay, nullptr);
}
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
void Sleep_entry(dword_t dwMilliseconds) {
RtlSleep_entry(dwMilliseconds, FALSE);
RtlSleep_entry(dwMilliseconds, false);
}
DECLARE_XAM_EXPORT1(Sleep, kNone, kImplemented);
@@ -601,28 +600,29 @@ DECLARE_XAM_EXPORT1(GetCurrentThreadId, kNone, kImplemented);
qword_result_t XapiFormatTimeOut_entry(lpqword_t result,
dword_t dwMilliseconds) {
LARGE_INTEGER delay{};
if (dwMilliseconds == -1) {
return 0;
}
// Convert the delay time to 100-nanosecond intervals
delay.QuadPart =
dwMilliseconds == -1 ? 0 : static_cast<LONGLONG>(-10000) * dwMilliseconds;
return (uint64_t)&delay;
*result = static_cast<int64_t>(-10000) * dwMilliseconds;
return result.host_address();
}
DECLARE_XAM_EXPORT1(XapiFormatTimeOut, kNone, kImplemented);
dword_result_t WaitForSingleObjectEx_entry(dword_t hHandle,
dword_t dwMilliseconds,
dword_t bAlertable) {
uint64_t* timeout = nullptr;
uint64_t timeout_ptr = XapiFormatTimeOut_entry(timeout, dwMilliseconds);
// TODO(Gliniak): Figure it out to be less janky.
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(
hHandle, 1, bAlertable, &timeout_ptr);
X_STATUS result =
xboxkrnl::NtWaitForSingleObjectEx(hHandle, 1, bAlertable, timeout_ptr);
while (bAlertable && result == X_STATUS_ALERTED) {
result = xe::kernel::xboxkrnl::NtWaitForSingleObjectEx(
hHandle, 1, bAlertable, &timeout_ptr);
result =
xboxkrnl::NtWaitForSingleObjectEx(hHandle, 1, bAlertable, timeout_ptr);
}
RtlSetLastNTError_entry(result);

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