[Misc] Fixed some issues during compilation process on Linux
This commit is contained in:
parent
57eeed86b7
commit
7437c020d6
|
@ -451,7 +451,7 @@ void AudioMediaPlayer::RemovePlaylist(uint32_t handle) {
|
||||||
X_STATUS AudioMediaPlayer::SetVolume(float volume) {
|
X_STATUS AudioMediaPlayer::SetVolume(float volume) {
|
||||||
volume_ = std::min(volume, 1.0f);
|
volume_ = std::min(volume, 1.0f);
|
||||||
|
|
||||||
std::unique_lock<xe::xe_fast_mutex> guard(driver_mutex_);
|
std::unique_lock<xe_mutex> guard(driver_mutex_);
|
||||||
if (!driver_) {
|
if (!driver_) {
|
||||||
return X_STATUS_UNSUCCESSFUL;
|
return X_STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ void AudioMediaPlayer::ProcessAudioBuffer(std::vector<float>* buffer) {
|
||||||
bool AudioMediaPlayer::SetupDriver(uint32_t sample_rate, uint32_t channels) {
|
bool AudioMediaPlayer::SetupDriver(uint32_t sample_rate, uint32_t channels) {
|
||||||
DeleteDriver();
|
DeleteDriver();
|
||||||
|
|
||||||
std::unique_lock<xe::xe_fast_mutex> guard(driver_mutex_);
|
std::unique_lock<xe_mutex> guard(driver_mutex_);
|
||||||
driver_semaphore_ = xe::threading::Semaphore::Create(
|
driver_semaphore_ = xe::threading::Semaphore::Create(
|
||||||
AudioSystem::kMaximumQueuedFrames, AudioSystem::kMaximumQueuedFrames);
|
AudioSystem::kMaximumQueuedFrames, AudioSystem::kMaximumQueuedFrames);
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ bool AudioMediaPlayer::SetupDriver(uint32_t sample_rate, uint32_t channels) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMediaPlayer::DeleteDriver() {
|
void AudioMediaPlayer::DeleteDriver() {
|
||||||
std::unique_lock<xe::xe_fast_mutex> guard(driver_mutex_);
|
std::unique_lock<xe_mutex> guard(driver_mutex_);
|
||||||
if (driver_) {
|
if (driver_) {
|
||||||
if (driver_semaphore_) {
|
if (driver_semaphore_) {
|
||||||
driver_semaphore_.reset();
|
driver_semaphore_.reset();
|
||||||
|
|
|
@ -130,7 +130,7 @@ class AudioMediaPlayer {
|
||||||
// really compatible with it.
|
// really compatible with it.
|
||||||
std::unique_ptr<AudioDriver> driver_ = nullptr;
|
std::unique_ptr<AudioDriver> driver_ = nullptr;
|
||||||
std::unique_ptr<xe::threading::Semaphore> driver_semaphore_ = {};
|
std::unique_ptr<xe::threading::Semaphore> driver_semaphore_ = {};
|
||||||
xe::xe_fast_mutex driver_mutex_ = {};
|
xe_mutex driver_mutex_ = {};
|
||||||
|
|
||||||
bool SetupDriver(uint32_t sample_rate, uint32_t channels);
|
bool SetupDriver(uint32_t sample_rate, uint32_t channels);
|
||||||
void DeleteDriver();
|
void DeleteDriver();
|
||||||
|
|
|
@ -407,7 +407,7 @@ TEST_CASE("Wait on Multiple Events", "[event]") {
|
||||||
std::array<char, 8> order = {0};
|
std::array<char, 8> order = {0};
|
||||||
std::atomic_uint index(0);
|
std::atomic_uint index(0);
|
||||||
auto sign_in = [&order, &index](uint32_t id) {
|
auto sign_in = [&order, &index](uint32_t id) {
|
||||||
auto i = index.fetch_add(1, std::memory_order::memory_order_relaxed);
|
auto i = index.fetch_add(1, std::memory_order_relaxed);
|
||||||
order[i] = static_cast<char>('0' + id);
|
order[i] = static_cast<char>('0' + id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1071,8 +1071,8 @@ TEST_CASE("Test Thread QueueUserCallback", "[thread]") {
|
||||||
int is_modified;
|
int is_modified;
|
||||||
int has_finished;
|
int has_finished;
|
||||||
auto callback = [&is_modified, &order] {
|
auto callback = [&is_modified, &order] {
|
||||||
is_modified = std::atomic_fetch_add_explicit(
|
is_modified =
|
||||||
&order, 1, std::memory_order::memory_order_relaxed);
|
std::atomic_fetch_add_explicit(&order, 1, std::memory_order_relaxed);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Without alertable
|
// Without alertable
|
||||||
|
@ -1084,8 +1084,8 @@ TEST_CASE("Test Thread QueueUserCallback", "[thread]") {
|
||||||
order++; // 1
|
order++; // 1
|
||||||
Sleep(90ms);
|
Sleep(90ms);
|
||||||
order++; // 2
|
order++; // 2
|
||||||
has_finished = std::atomic_fetch_add_explicit(
|
has_finished =
|
||||||
&order, 1, std::memory_order::memory_order_relaxed);
|
std::atomic_fetch_add_explicit(&order, 1, std::memory_order_relaxed);
|
||||||
});
|
});
|
||||||
REQUIRE(!spin_wait_for(50ms, [&] { return order == 2; }));
|
REQUIRE(!spin_wait_for(50ms, [&] { return order == 2; }));
|
||||||
REQUIRE(is_modified == -1);
|
REQUIRE(is_modified == -1);
|
||||||
|
@ -1104,8 +1104,8 @@ TEST_CASE("Test Thread QueueUserCallback", "[thread]") {
|
||||||
order++; // 1
|
order++; // 1
|
||||||
AlertableSleep(90ms);
|
AlertableSleep(90ms);
|
||||||
order++; // 3
|
order++; // 3
|
||||||
has_finished = std::atomic_fetch_add_explicit(
|
has_finished =
|
||||||
&order, 1, std::memory_order::memory_order_relaxed);
|
std::atomic_fetch_add_explicit(&order, 1, std::memory_order_relaxed);
|
||||||
});
|
});
|
||||||
REQUIRE(!spin_wait_for(50ms, [&] { return order == 2; }));
|
REQUIRE(!spin_wait_for(50ms, [&] { return order == 2; }));
|
||||||
REQUIRE(is_modified == -1);
|
REQUIRE(is_modified == -1);
|
||||||
|
@ -1120,8 +1120,8 @@ TEST_CASE("Test Thread QueueUserCallback", "[thread]") {
|
||||||
is_modified = -1;
|
is_modified = -1;
|
||||||
has_finished = -1;
|
has_finished = -1;
|
||||||
thread = Thread::Create(params, [&is_modified, &has_finished, &order] {
|
thread = Thread::Create(params, [&is_modified, &has_finished, &order] {
|
||||||
is_modified = std::atomic_fetch_add_explicit(
|
is_modified =
|
||||||
&order, 1, std::memory_order::memory_order_relaxed);
|
std::atomic_fetch_add_explicit(&order, 1, std::memory_order_relaxed);
|
||||||
// Using Alertable so callback is registered
|
// Using Alertable so callback is registered
|
||||||
order++; // 2
|
order++; // 2
|
||||||
AlertableSleep(1s);
|
AlertableSleep(1s);
|
||||||
|
|
|
@ -433,17 +433,14 @@ typedef struct alignas(64) PPCContext_s {
|
||||||
template <typename T = uint8_t*>
|
template <typename T = uint8_t*>
|
||||||
inline T TranslateVirtual(uint32_t guest_address) XE_RESTRICT const {
|
inline T TranslateVirtual(uint32_t guest_address) XE_RESTRICT const {
|
||||||
static_assert(std::is_pointer_v<T>);
|
static_assert(std::is_pointer_v<T>);
|
||||||
#if XE_PLATFORM_WIN32 == 1
|
|
||||||
uint8_t* host_address = virtual_membase + guest_address;
|
uint8_t* host_address = virtual_membase + guest_address;
|
||||||
|
#if XE_PLATFORM_WIN32 == 1
|
||||||
if (guest_address >=
|
if (guest_address >=
|
||||||
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this))) {
|
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this))) {
|
||||||
host_address += 0x1000;
|
host_address += 0x1000;
|
||||||
}
|
}
|
||||||
return reinterpret_cast<T>(host_address);
|
|
||||||
#else
|
|
||||||
return processor->memory()->TranslateVirtual<T>(guest_address);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
return reinterpret_cast<T>(host_address);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline xe::be<T>* TranslateVirtualBE(uint32_t guest_address)
|
inline xe::be<T>* TranslateVirtualBE(uint32_t guest_address)
|
||||||
|
@ -464,17 +461,14 @@ typedef struct alignas(64) PPCContext_s {
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline uint32_t HostToGuestVirtual(T* host_ptr) XE_RESTRICT const {
|
inline uint32_t HostToGuestVirtual(T* host_ptr) XE_RESTRICT const {
|
||||||
#if XE_PLATFORM_WIN32 == 1
|
|
||||||
uint32_t guest_tmp = static_cast<uint32_t>(
|
uint32_t guest_tmp = static_cast<uint32_t>(
|
||||||
reinterpret_cast<const uint8_t*>(host_ptr) - virtual_membase);
|
reinterpret_cast<const uint8_t*>(host_ptr) - virtual_membase);
|
||||||
|
#if XE_PLATFORM_WIN32 == 1
|
||||||
if (guest_tmp >= static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this))) {
|
if (guest_tmp >= static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this))) {
|
||||||
guest_tmp -= 0x1000;
|
guest_tmp -= 0x1000;
|
||||||
}
|
}
|
||||||
return guest_tmp;
|
|
||||||
#else
|
|
||||||
return processor->memory()->HostToGuestVirtual(
|
|
||||||
reinterpret_cast<void*>(host_ptr));
|
|
||||||
#endif
|
#endif
|
||||||
|
return guest_tmp;
|
||||||
}
|
}
|
||||||
static std::string GetRegisterName(PPCRegister reg);
|
static std::string GetRegisterName(PPCRegister reg);
|
||||||
std::string GetStringFromValue(PPCRegister reg) const;
|
std::string GetStringFromValue(PPCRegister reg) const;
|
||||||
|
|
|
@ -451,7 +451,7 @@ Emulator::FileSignatureType Emulator::GetFileSignature(
|
||||||
}
|
}
|
||||||
|
|
||||||
char file_magic[header_size];
|
char file_magic[header_size];
|
||||||
fread_s(file_magic, sizeof(file_magic), 1, header_size, file);
|
fread(file_magic, sizeof(file_magic), 1, file);
|
||||||
|
|
||||||
fourcc_t magic_value =
|
fourcc_t magic_value =
|
||||||
make_fourcc(file_magic[0], file_magic[1], file_magic[2], file_magic[3]);
|
make_fourcc(file_magic[0], file_magic[1], file_magic[2], file_magic[3]);
|
||||||
|
@ -485,7 +485,7 @@ Emulator::FileSignatureType Emulator::GetFileSignature(
|
||||||
|
|
||||||
file = xe::filesystem::OpenFile(path, "rb");
|
file = xe::filesystem::OpenFile(path, "rb");
|
||||||
xe::filesystem::Seek(file, -header_size, SEEK_END);
|
xe::filesystem::Seek(file, -header_size, SEEK_END);
|
||||||
fread_s(file_magic, sizeof(file_magic), 1, header_size, file);
|
fread(file_magic, 1, header_size, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
magic_value =
|
magic_value =
|
||||||
|
@ -937,8 +937,7 @@ X_STATUS Emulator::CreateZarchivePackage(
|
||||||
uint64_t total_bytes_read = 0;
|
uint64_t total_bytes_read = 0;
|
||||||
|
|
||||||
while (total_bytes_read < file_size) {
|
while (total_bytes_read < file_size) {
|
||||||
uint64_t bytes_read =
|
uint64_t bytes_read = fread(buffer.data(), 1, buffer.size(), file);
|
||||||
fread_s(buffer.data(), buffer.size(), 1, buffer.size(), file);
|
|
||||||
|
|
||||||
total_bytes_read += bytes_read;
|
total_bytes_read += bytes_read;
|
||||||
|
|
||||||
|
|
|
@ -95,14 +95,13 @@ void ImGuiGuestNotification::UpdateNotificationState() {
|
||||||
|
|
||||||
const ImVec2 ImGuiGuestNotification::CalculateNotificationSize(ImVec2 text_size,
|
const ImVec2 ImGuiGuestNotification::CalculateNotificationSize(ImVec2 text_size,
|
||||||
float scale) {
|
float scale) {
|
||||||
const ImVec2 result =
|
const ImVec2 result = ImVec2(floorf((default_notification_icon_size.x +
|
||||||
ImVec2(std::floorf((default_notification_icon_size.x +
|
default_notification_margin_size.x) *
|
||||||
default_notification_margin_size.x) *
|
scale) +
|
||||||
scale) +
|
text_size.x,
|
||||||
text_size.x,
|
floorf((default_notification_icon_size.y +
|
||||||
std::floorf((default_notification_icon_size.y +
|
default_notification_margin_size.y) *
|
||||||
default_notification_margin_size.y) *
|
scale));
|
||||||
scale));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -134,13 +133,14 @@ void AchievementNotificationWindow::OnDraw(ImGuiIO& io) {
|
||||||
const ImVec2 notification_position = CalculateNotificationScreenPosition(
|
const ImVec2 notification_position = CalculateNotificationScreenPosition(
|
||||||
screen_size, final_notification_size, GetPositionId());
|
screen_size, final_notification_size, GetPositionId());
|
||||||
|
|
||||||
if (isnan(notification_position.x) || isnan(notification_position.y)) {
|
if (std::isnan(notification_position.x) ||
|
||||||
|
std::isnan(notification_position.y)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 current_notification_size = final_notification_size;
|
ImVec2 current_notification_size = final_notification_size;
|
||||||
current_notification_size.x *= notification_draw_progress_;
|
current_notification_size.x *= notification_draw_progress_;
|
||||||
current_notification_size.x = std::floorf(current_notification_size.x);
|
current_notification_size.x = floorf(current_notification_size.x);
|
||||||
|
|
||||||
// Initialize position and window size
|
// Initialize position and window size
|
||||||
ImGui::SetNextWindowSize(current_notification_size);
|
ImGui::SetNextWindowSize(current_notification_size);
|
||||||
|
@ -207,13 +207,14 @@ void XNotifyWindow::OnDraw(ImGuiIO& io) {
|
||||||
const ImVec2 notification_position = CalculateNotificationScreenPosition(
|
const ImVec2 notification_position = CalculateNotificationScreenPosition(
|
||||||
screen_size, final_notification_size, GetPositionId());
|
screen_size, final_notification_size, GetPositionId());
|
||||||
|
|
||||||
if (isnan(notification_position.x) || isnan(notification_position.y)) {
|
if (std::isnan(notification_position.x) ||
|
||||||
|
std::isnan(notification_position.y)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 current_notification_size = final_notification_size;
|
ImVec2 current_notification_size = final_notification_size;
|
||||||
current_notification_size.x *= notification_draw_progress_;
|
current_notification_size.x *= notification_draw_progress_;
|
||||||
current_notification_size.x = std::floorf(current_notification_size.x);
|
current_notification_size.x = floorf(current_notification_size.x);
|
||||||
|
|
||||||
// Initialize position and window size
|
// Initialize position and window size
|
||||||
ImGui::SetNextWindowSize(current_notification_size);
|
ImGui::SetNextWindowSize(current_notification_size);
|
||||||
|
|
|
@ -68,7 +68,8 @@ void HostNotificationWindow::OnDraw(ImGuiIO& io) {
|
||||||
const ImVec2 notification_position = CalculateNotificationScreenPosition(
|
const ImVec2 notification_position = CalculateNotificationScreenPosition(
|
||||||
screen_size, notification_size, GetPositionId());
|
screen_size, notification_size, GetPositionId());
|
||||||
|
|
||||||
if (isnan(notification_position.x) || isnan(notification_position.y)) {
|
if (std::isnan(notification_position.x) ||
|
||||||
|
std::isnan(notification_position.y)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue