[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

@@ -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

View File

@@ -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_

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();

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);

View File

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

View File

@@ -385,7 +385,7 @@ class ProfilePasscodeDialog : public XamDialog {
if (ImGui::BeginPopupModal(title_.c_str(), nullptr,
ImGuiWindowFlags_AlwaysAutoResize)) {
if (description_.size()) {
ImGui::Text(description_.c_str());
ImGui::Text("%s", description_.c_str());
}
for (uint8_t i = 0; i < passcode_length; i++) {
@@ -642,14 +642,12 @@ class GameAchievementsDialog final : public XamDialog {
ImGui::PushFont(imgui_drawer()->GetTitleFont());
const auto primary_line_height = ImGui::GetTextLineHeight();
ImGui::TextUnformatted(
fmt::format("{}", GetAchievementTitle(achievement_entry)).c_str());
ImGui::Text("%s", GetAchievementTitle(achievement_entry).c_str());
ImGui::PopFont();
ImGui::PushTextWrapPos(ImGui::GetMainViewport()->Size.x * 0.5f);
ImGui::TextWrapped(
fmt::format("{}", GetAchievementDescription(achievement_entry))
.c_str());
ImGui::TextWrapped("%s",
GetAchievementDescription(achievement_entry).c_str());
ImGui::PopTextWrapPos();
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::Text(no_entries_message.c_str());
ImGui::Text("%s", no_entries_message.c_str());
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.",
"Kernel");
inline constexpr static uint32_t GetVideoStandard() {
inline const static uint32_t GetVideoStandard() {
if (cvars::video_standard < 1 || cvars::video_standard > 3) {
return 1;
}
@@ -52,11 +52,11 @@ inline constexpr static uint32_t GetVideoStandard() {
return cvars::video_standard;
}
inline constexpr static float GetVideoRefreshRate() {
inline const static float GetVideoRefreshRate() {
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) {
return {16, 9};
}

View File

@@ -135,6 +135,8 @@ class XObject {
case Type::Thread:
case Type::Timer:
return true;
default:
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,
int* optlen) {
uint32_t* optlen) {
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) {
// TODO: WSAGetLastError()
return X_STATUS_UNSUCCESSFUL;

View File

@@ -108,7 +108,7 @@ class XSocket : public XObject {
X_STATUS Close();
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,
uint32_t optlen);
X_STATUS IOControl(uint32_t cmd, uint8_t* arg_ptr);