Skip to content

Commit 99be2de

Browse files
RodoMa92seven7000real
authored andcommitted
[compiler] Misc changes to make this emulator properly compile under Linux with Clang
1 parent d0400e9 commit 99be2de

File tree

8 files changed

+39
-27
lines changed

8 files changed

+39
-27
lines changed

premake5.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ filter({"platforms:Linux", "language:C++", "toolset:clang"})
145145
"deprecated-volatile",
146146
"switch",
147147
"deprecated-enum-enum-conversion",
148+
"attributes",
149+
})
150+
removeflags({
151+
"FatalWarnings"
148152
})
149153
filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"})
150154
buildoptions({

src/xenia/app/emulator_window.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,8 +1889,7 @@ void EmulatorWindow::DisplayHotKeysConfig() {
18891889

18901890
if (!guide_enabled) {
18911891
pretty_text = std::regex_replace(
1892-
pretty_text,
1893-
std::regex("Guide", std::regex_constants::syntax_option_type::icase),
1892+
pretty_text, std::regex("Guide", std::regex_constants::icase),
18941893
"Back");
18951894
}
18961895

src/xenia/apu/audio_media_player.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef XENIA_APU_AUDIO_MEDIA_PLAYER_H_
1111
#define XENIA_APU_AUDIO_MEDIA_PLAYER_H_
1212

13+
#include "xenia/apu/audio_driver.h"
1314
#include "xenia/apu/audio_system.h"
1415
#include "xenia/kernel/xam/apps/xmp_app.h"
1516

src/xenia/apu/xma_context.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,23 @@ static_assert_size(Xma2ExtraData, 34);
160160

161161
class XmaContext {
162162
public:
163-
static const uint32_t kBytesPerPacket = 2048;
164-
static const uint32_t kBitsPerPacket = kBytesPerPacket * 8;
165-
static const uint32_t kBitsPerHeader = 32;
166-
167-
static const uint32_t kBytesPerSample = 2;
168-
static const uint32_t kSamplesPerFrame = 512;
169-
static const uint32_t kSamplesPerSubframe = 128;
170-
static const uint32_t kBytesPerFrameChannel =
163+
static constexpr uint32_t kBytesPerPacket = 2048;
164+
static constexpr uint32_t kBitsPerPacket = kBytesPerPacket * 8;
165+
static constexpr uint32_t kBitsPerHeader = 32;
166+
167+
static constexpr uint32_t kBytesPerSample = 2;
168+
static constexpr uint32_t kSamplesPerFrame = 512;
169+
static constexpr uint32_t kSamplesPerSubframe = 128;
170+
static constexpr uint32_t kBytesPerFrameChannel =
171171
kSamplesPerFrame * kBytesPerSample;
172-
static const uint32_t kBytesPerSubframeChannel =
172+
static constexpr uint32_t kBytesPerSubframeChannel =
173173
kSamplesPerSubframe * kBytesPerSample;
174174

175175
// static const uint32_t kOutputBytesPerBlock = 256;
176176
// static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
177177

178178
explicit XmaContext();
179-
~XmaContext();
179+
virtual ~XmaContext();
180180

181181
virtual int Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) {
182182
return 0;

src/xenia/apu/xma_context_new.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,28 @@ static constexpr int kIdToSampleRate[4] = {24000, 32000, 44100, 48000};
4545

4646
class XmaContextNew : public XmaContext {
4747
public:
48-
static const uint32_t kBytesPerPacket = 2048;
49-
static const uint32_t kBytesPerPacketHeader = 4;
50-
static const uint32_t kBytesPerPacketData =
48+
static constexpr uint32_t kBytesPerPacket = 2048;
49+
static constexpr uint32_t kBytesPerPacketHeader = 4;
50+
static constexpr uint32_t kBytesPerPacketData =
5151
kBytesPerPacket - kBytesPerPacketHeader;
5252

53-
static const uint32_t kBitsPerPacket = kBytesPerPacket * 8;
54-
static const uint32_t kBitsPerPacketHeader = 32;
55-
static const uint32_t kBitsPerFrameHeader = 15;
53+
static constexpr uint32_t kBitsPerPacket = kBytesPerPacket * 8;
54+
static constexpr uint32_t kBitsPerPacketHeader = 32;
55+
static constexpr uint32_t kBitsPerFrameHeader = 15;
5656

57-
static const uint32_t kBytesPerSample = 2;
58-
static const uint32_t kSamplesPerFrame = 512;
59-
static const uint32_t kSamplesPerSubframe = 128;
60-
static const uint32_t kBytesPerFrameChannel =
57+
static constexpr uint32_t kBytesPerSample = 2;
58+
static constexpr uint32_t kSamplesPerFrame = 512;
59+
static constexpr uint32_t kSamplesPerSubframe = 128;
60+
static constexpr uint32_t kBytesPerFrameChannel =
6161
kSamplesPerFrame * kBytesPerSample;
62-
static const uint32_t kBytesPerSubframeChannel =
62+
static constexpr uint32_t kBytesPerSubframeChannel =
6363
kSamplesPerSubframe * kBytesPerSample;
6464

65-
static const uint32_t kOutputBytesPerBlock = 256;
66-
static const uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
65+
static constexpr uint32_t kOutputBytesPerBlock = 256;
66+
static constexpr uint32_t kOutputMaxSizeBytes = 31 * kOutputBytesPerBlock;
6767

68-
static const uint32_t kLastFrameMarker = 0x7FFF;
69-
static const uint32_t kMaxFrameSizeinBits = 0x4000 - kBitsPerPacketHeader;
68+
static constexpr uint32_t kLastFrameMarker = 0x7FFF;
69+
static constexpr uint32_t kMaxFrameSizeinBits = 0x4000 - kBitsPerPacketHeader;
7070

7171
explicit XmaContextNew();
7272
~XmaContextNew();

src/xenia/base/threading_posix.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ class PosixCondition<Thread> : public PosixConditionBase {
533533
}
534534

535535
virtual ~PosixCondition() {
536+
// FIXME(RodoMa92): This causes random crashes.
537+
// The proper way to handle them according to the webs is properly shutdown
538+
// instead on relying on killing them using pthread_cancel.
539+
/*
536540
if (thread_ && !signaled_) {
537541
#if XE_PLATFORM_ANDROID
538542
if (pthread_kill(thread_,
@@ -548,6 +552,7 @@ class PosixCondition<Thread> : public PosixConditionBase {
548552
assert_always();
549553
}
550554
}
555+
*/
551556
}
552557

553558
bool Signal() override { return true; }

third_party/zarchive.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project("zarchive")
44
kind("StaticLib")
55
language("C++")
66
links({
7+
"zstd",
78
})
89
defines({
910
"_LIB",

third_party/zstd.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ function project_zstd(dir, compression, decompression, deprecated, dictbuilder,
7575

7676
defines {
7777
'XXH_NAMESPACE=ZSTD_',
78+
-- See here on why: https://gitlab.kitware.com/cmake/cmake/-/issues/25744
79+
'ZSTD_DISABLE_ASM=1',
7880
'ZSTD_LEGACY_SUPPORT=' .. legacy
7981
}
8082
end

0 commit comments

Comments
 (0)