[compiler] Misc changes to make this emulator properly compile under Linux with Clang

This commit is contained in:
Marco Rodolfi 2025-01-19 19:13:57 +01:00 committed by Radosław Gliński
parent 0dc0f18abb
commit f58fab1d2c
8 changed files with 38 additions and 26 deletions

View File

@ -145,6 +145,10 @@ filter({"platforms:Linux", "language:C++", "toolset:clang"})
"deprecated-volatile", "deprecated-volatile",
"switch", "switch",
"deprecated-enum-enum-conversion", "deprecated-enum-enum-conversion",
"attributes",
})
removeflags({
"FatalWarnings"
}) })
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

@ -1889,8 +1889,7 @@ void EmulatorWindow::DisplayHotKeysConfig() {
if (!guide_enabled) { if (!guide_enabled) {
pretty_text = std::regex_replace( pretty_text = std::regex_replace(
pretty_text, pretty_text, std::regex("Guide", std::regex_constants::icase),
std::regex("Guide", std::regex_constants::syntax_option_type::icase),
"Back"); "Back");
} }

View File

@ -10,6 +10,7 @@
#ifndef XENIA_APU_AUDIO_MEDIA_PLAYER_H_ #ifndef XENIA_APU_AUDIO_MEDIA_PLAYER_H_
#define XENIA_APU_AUDIO_MEDIA_PLAYER_H_ #define XENIA_APU_AUDIO_MEDIA_PLAYER_H_
#include "xenia/apu/audio_driver.h"
#include "xenia/apu/audio_system.h" #include "xenia/apu/audio_system.h"
#include "xenia/kernel/xam/apps/xmp_app.h" #include "xenia/kernel/xam/apps/xmp_app.h"

View File

@ -160,23 +160,23 @@ static_assert_size(Xma2ExtraData, 34);
class XmaContext { class XmaContext {
public: public:
static const uint32_t kBytesPerPacket = 2048; static constexpr uint32_t kBytesPerPacket = 2048;
static const uint32_t kBitsPerPacket = kBytesPerPacket * 8; static constexpr uint32_t kBitsPerPacket = kBytesPerPacket * 8;
static const uint32_t kBitsPerHeader = 32; static constexpr uint32_t kBitsPerHeader = 32;
static const uint32_t kBytesPerSample = 2; static constexpr uint32_t kBytesPerSample = 2;
static const uint32_t kSamplesPerFrame = 512; static constexpr uint32_t kSamplesPerFrame = 512;
static const uint32_t kSamplesPerSubframe = 128; static constexpr uint32_t kSamplesPerSubframe = 128;
static const uint32_t kBytesPerFrameChannel = static constexpr uint32_t kBytesPerFrameChannel =
kSamplesPerFrame * kBytesPerSample; kSamplesPerFrame * kBytesPerSample;
static const uint32_t kBytesPerSubframeChannel = static constexpr uint32_t kBytesPerSubframeChannel =
kSamplesPerSubframe * kBytesPerSample; kSamplesPerSubframe * kBytesPerSample;
// static const uint32_t kOutputBytesPerBlock = 256; // static const uint32_t kOutputBytesPerBlock = 256;
// static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock; // static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
explicit XmaContext(); explicit XmaContext();
~XmaContext(); virtual ~XmaContext();
virtual int Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) { virtual int Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) {
return 0; return 0;

View File

@ -45,28 +45,28 @@ static constexpr int kIdToSampleRate[4] = {24000, 32000, 44100, 48000};
class XmaContextNew : public XmaContext { class XmaContextNew : public XmaContext {
public: public:
static const uint32_t kBytesPerPacket = 2048; static constexpr uint32_t kBytesPerPacket = 2048;
static const uint32_t kBytesPerPacketHeader = 4; static constexpr uint32_t kBytesPerPacketHeader = 4;
static const uint32_t kBytesPerPacketData = static constexpr uint32_t kBytesPerPacketData =
kBytesPerPacket - kBytesPerPacketHeader; kBytesPerPacket - kBytesPerPacketHeader;
static const uint32_t kBitsPerPacket = kBytesPerPacket * 8; static constexpr uint32_t kBitsPerPacket = kBytesPerPacket * 8;
static const uint32_t kBitsPerPacketHeader = 32; static constexpr uint32_t kBitsPerPacketHeader = 32;
static const uint32_t kBitsPerFrameHeader = 15; static constexpr uint32_t kBitsPerFrameHeader = 15;
static const uint32_t kBytesPerSample = 2; static constexpr uint32_t kBytesPerSample = 2;
static const uint32_t kSamplesPerFrame = 512; static constexpr uint32_t kSamplesPerFrame = 512;
static const uint32_t kSamplesPerSubframe = 128; static constexpr uint32_t kSamplesPerSubframe = 128;
static const uint32_t kBytesPerFrameChannel = static constexpr uint32_t kBytesPerFrameChannel =
kSamplesPerFrame * kBytesPerSample; kSamplesPerFrame * kBytesPerSample;
static const uint32_t kBytesPerSubframeChannel = static constexpr uint32_t kBytesPerSubframeChannel =
kSamplesPerSubframe * kBytesPerSample; kSamplesPerSubframe * kBytesPerSample;
static const uint32_t kOutputBytesPerBlock = 256; static constexpr uint32_t kOutputBytesPerBlock = 256;
static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock; static constexpr uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
static const uint32_t kLastFrameMarker = 0x7FFF; static constexpr uint32_t kLastFrameMarker = 0x7FFF;
static const uint32_t kMaxFrameSizeinBits = 0x4000 - kBitsPerPacketHeader; static constexpr uint32_t kMaxFrameSizeinBits = 0x4000 - kBitsPerPacketHeader;
explicit XmaContextNew(); explicit XmaContextNew();
~XmaContextNew(); ~XmaContextNew();

View File

@ -533,6 +533,10 @@ class PosixCondition<Thread> : public PosixConditionBase {
} }
virtual ~PosixCondition() { virtual ~PosixCondition() {
// FIXME(RodoMa92): This causes random crashes.
// The proper way to handle them according to the webs is properly shutdown
// instead on relying on killing them using pthread_cancel.
/*
if (thread_ && !signaled_) { if (thread_ && !signaled_) {
#if XE_PLATFORM_ANDROID #if XE_PLATFORM_ANDROID
if (pthread_kill(thread_, if (pthread_kill(thread_,
@ -548,6 +552,7 @@ class PosixCondition<Thread> : public PosixConditionBase {
assert_always(); assert_always();
} }
} }
*/
} }
bool Signal() override { return true; } bool Signal() override { return true; }

View File

@ -4,6 +4,7 @@ project("zarchive")
kind("StaticLib") kind("StaticLib")
language("C++") language("C++")
links({ links({
"zstd",
}) })
defines({ defines({
"_LIB", "_LIB",

View File

@ -75,6 +75,8 @@ function project_zstd(dir, compression, decompression, deprecated, dictbuilder,
defines { defines {
'XXH_NAMESPACE=ZSTD_', 'XXH_NAMESPACE=ZSTD_',
-- See here on why: https://gitlab.kitware.com/cmake/cmake/-/issues/25744
'ZSTD_DISABLE_ASM=1',
'ZSTD_LEGACY_SUPPORT=' .. legacy 'ZSTD_LEGACY_SUPPORT=' .. legacy
} }
end end