Skip to content

Commit 4fee99e

Browse files
authored
Merge branch 'master' into openal_handling_upd
2 parents 2c0dab7 + 0f2db9e commit 4fee99e

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ flatpak install flathub jp.yvt.OpenSpades
3737

3838
Once installed, you'll be able to launch OpenSpades from inside the desktop menu or from your terminal with `flatpak run jp.yvt.OpenSpades`
3939

40-
### On Linux (from source)
40+
### On Unixes (from source)
4141

4242
#### Building
4343
1. Install dependencies:
@@ -58,6 +58,14 @@ Once installed, you'll be able to launch OpenSpades from inside the desktop menu
5858
freealut-devel xdg-utils freetype-devel opus-devel opusfile-devel \
5959
libjpeg-devel libXinerama-devel libXft-devel cmake ImageMagick
6060
```
61+
62+
*On FreeBSD*:
63+
```
64+
sudo pkg install gmake automake pkgconf glew openssl curl sdl2 sdl2-image \
65+
freealut xdg-utils freetype2 opus opusfile jpeg-turbo libXinerama libXft \
66+
cmake ImageMagick7
67+
```
68+
6169
*On other distributions*:
6270
Install corresponding packages from your repository (or compile from source).
6371

Sources/Audio/ALDevice.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ namespace spades {
438438
dev = NULL;
439439
alDevice = al::qalcOpenDevice(dev);
440440

441-
if (!alDevice) {
441+
if (UNLIKELY(!alDevice)) {
442442
if ((ext = al::qalcGetString(NULL, ALC_EXTENSIONS))) {
443443
std::vector<std::string> strs = Split(ext, " ");
444444
SPLog("OpenAL ALC Extensions (NULL):");
@@ -463,7 +463,7 @@ namespace spades {
463463
}
464464

465465
alContext = al::qalcCreateContext(alDevice, NULL);
466-
if (!alContext) {
466+
if (UNLIKELY(!alContext)) {
467467
al::qalcCloseDevice(alDevice);
468468
SPRaise("Failed to create OpenAL context.");
469469
}
@@ -562,7 +562,7 @@ namespace spades {
562562
SPADES_MARK_FUNCTION();
563563

564564
ALSrc *src = AllocChunk();
565-
if (!src)
565+
if (UNLIKELY(!src))
566566
return;
567567

568568
src->stereo = chunk->GetFormat() == AL_FORMAT_STEREO16;

Sources/Core/Debug.h

+7
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,16 @@ namespace spades {
132132

133133
#ifdef __GNUC__
134134
#define DEPRECATED(func) func __attribute__((deprecated))
135+
#define LIKELY(cond) __builtin_expect(!!(cond), true)
136+
#define UNLIKELY(cond) __builtin_expect(!!(cond), false)
135137
#elif defined(_MSC_VER)
136138
#define DEPRECATED(func) __declspec(deprecated) func
139+
#define LIKELY(cond) (cond)
140+
#define UNLIKELY(cond) (cond)
137141
#else
138142
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
139143
#define DEPRECATED(func) func
144+
#pragma message("WARNING: You need to implement LIKELY/UNLIKELY for this compiler")
145+
#define LIKELY(cond) (cond)
146+
#define UNLIKELY(cond) (cond)
140147
#endif

0 commit comments

Comments
 (0)