diff --git a/binding/binding-mri.cpp b/binding/binding-mri.cpp
index 69f90bb92..064f95bf8 100644
--- a/binding/binding-mri.cpp
+++ b/binding/binding-mri.cpp
@@ -19,7 +19,9 @@
** along with mkxp. If not, see .
*/
+#ifndef MKXPZ_NO_OPENAL
#include "audio/audio.h"
+#endif
#include "filesystem/filesystem.h"
#include "display/graphics.h"
#include "display/font.h"
@@ -89,7 +91,9 @@ void windowVXBindingInit();
void tilemapVXBindingInit();
void inputBindingInit();
+#ifndef MKXPZ_NO_OPENAL
void audioBindingInit();
+#endif
void graphicsBindingInit();
void fileIntBindingInit();
@@ -113,7 +117,9 @@ void oneshotWallpaperBindingInit();
void oneshotWallpaperBindingTerminate();
#endif
+#ifndef MKXPZ_NO_OPENAL
void modshotAleffectBindingInit();
+#endif
void modshotwindowBindingInit();
void modshotSystemBindingInit();
@@ -187,7 +193,9 @@ static void mriBindingInit() {
}
inputBindingInit();
+#ifndef MKXPZ_NO_OPENAL
audioBindingInit();
+#endif
graphicsBindingInit();
fileIntBindingInit();
@@ -208,7 +216,9 @@ static void mriBindingInit() {
oneshotNikoBindingInit();
oneshotWallpaperBindingInit();
+#ifndef MKXPZ_NO_OPENAL
modshotAleffectBindingInit();
+#endif
modshotwindowBindingInit();
modshotSystemBindingInit();
@@ -793,7 +803,9 @@ static VALUE rgssMainRescue(VALUE arg, VALUE exc) {
static void processReset() {
shState->graphics().reset();
+#ifndef MKXPZ_NO_OPENAL
shState->audio().reset();
+#endif
shState->rtData().rqReset.clear();
shState->graphics().repaintWait(shState->rtData().rqResetFinish, false);
diff --git a/binding/meson.build b/binding/meson.build
index 6b311f1b6..170b3092d 100644
--- a/binding/meson.build
+++ b/binding/meson.build
@@ -28,7 +28,6 @@ binding_source = [files(
'plane-binding.cpp',
'window-binding.cpp',
'tilemap-binding.cpp',
- 'audio-binding.cpp',
'module_rpg.cpp',
'filesystem-binding.cpp',
'windowvx-binding.cpp',
@@ -39,11 +38,19 @@ binding_source = [files(
'oneshot-niko-binding.cpp',
'oneshot-journal-binding.cpp',
'oneshot-wallpaper-binding.cpp',
- 'modshot-aleffect-binding.cpp',
'modshot-window-binding.cpp',
'modshot-system-binding.cpp',
)]
+audio_binding_source = [files(
+ 'audio-binding.cpp',
+ 'modshot-aleffect-binding.cpp',
+)]
+
+if disable_openal == false
+ binding_source += audio_binding_source
+endif
+
if steamworks == true
binding_source += files('cusl-binding.cpp')
endif
diff --git a/binding/oneshot-niko-binding.cpp b/binding/oneshot-niko-binding.cpp
index 4159624e6..25f2ab397 100644
--- a/binding/oneshot-niko-binding.cpp
+++ b/binding/oneshot-niko-binding.cpp
@@ -8,7 +8,11 @@
#define NIKO_Y ((13 * 16) * 2)
#include
+#ifdef __WIN32__
#include
+#else
+#include
+#endif
RB_METHOD(nikoPrepare) {
RB_UNUSED_PARAM;
@@ -49,7 +53,14 @@ RB_METHOD(nikoStart) {
const_cast(dir.c_str()), const_cast(window_x.c_str()),
const_cast(window_y.c_str())};
+#ifdef __WIN32__
spawnv(_P_DETACH, dir.c_str(), args);
+#else
+ pid_t pid = fork();
+ if (pid == 0) {
+ execv(dir.c_str(), args);
+ }
+#endif
return Qnil;
}
diff --git a/meson.build b/meson.build
index 86d5c9be1..a17abc890 100644
--- a/meson.build
+++ b/meson.build
@@ -28,6 +28,11 @@ global_args += '-DMKXPZ_VERSION="@0@"'.format(meson.project_version())
global_args += '-DMKXPZ_GIT_HASH="@0@"'.format(git_hash)
global_args += '-DHAVE_NANOSLEEP'
+disable_openal = get_option('disable_openal')
+if disable_openal
+ global_args += '-DMKXPZ_NO_OPENAL'
+endif
+
global_args += '-DZMQ_STATIC'
# ====================
@@ -193,7 +198,8 @@ executable(exe_name,
objc_args: global_args,
objcpp_args: global_args,
win_subsystem: 'windows',
- install: (host_system != 'windows')
+ install: (host_system != 'windows'),
+ build_rpath: '$ORIGIN'
)
# Shim for Windows
diff --git a/meson_options.txt b/meson_options.txt
index c09f54783..017a249e5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -20,4 +20,6 @@ option('steamworks_path', type: 'string', value: '', description: 'Path to Steam
option('steam_appid', type: 'string', value: '', description: 'Steam AppID. Set this to use SteamAPI_RestartAppIfNecessary')
option('steamshim_debug', type: 'boolean', value: false, description: 'Whether to show Steamshim debug messages in the console')
-option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], description: 'Graphics rendering API to use.')
\ No newline at end of file
+option('gfx_backend', type: 'combo', value: 'gl', choices: ['gl', 'gles'], description: 'Graphics rendering API to use.')
+
+option('disable_openal', type: 'boolean', value: false, description: 'Disable OpenAL audio backend')
\ No newline at end of file
diff --git a/src/display/graphics.cpp b/src/display/graphics.cpp
index 4fc8dc454..f7379d627 100644
--- a/src/display/graphics.cpp
+++ b/src/display/graphics.cpp
@@ -21,8 +21,10 @@
#include "graphics.h"
+#ifndef MKXPZ_NO_OPENAL
#include "alstream.h"
#include "audio.h"
+#endif
#include "binding.h"
#include "bitmap.h"
#include "config.h"
@@ -102,24 +104,33 @@ static void closeMovie(THEORAPLAY_Io *io)
struct Movie
{
THEORAPLAY_Decoder *decoder;
- const THEORAPLAY_AudioPacket *audio;
const THEORAPLAY_VideoFrame *video;
bool hasVideo;
- bool hasAudio;
bool skippable;
Bitmap *videoBitmap;
SDL_RWops srcOps;
+ #ifndef MKXPZ_NO_OPENAL
+ bool hasAudio;
SDL_Thread *audioThread;
AtomicFlag audioThreadTermReq;
volatile AudioQueue *audioQueueHead;
volatile AudioQueue *audioQueueTail;
+ const THEORAPLAY_AudioPacket *audio;
ALuint audioSource;
ALuint alBuffers[STREAM_BUFS];
ALshort audioBuffer[MOVIE_AUDIO_BUFFER_SIZE];
+ #endif
SDL_mutex *audioMutex;
Movie(bool skippable_)
- : decoder(0), audio(0), video(0), skippable(skippable_), videoBitmap(0), audioThread(0)
+ : decoder(0),
+ video(0),
+ skippable(skippable_),
+ videoBitmap(0)
+ #ifndef MKXPZ_NO_OPENAL
+ , audioThread(0),
+ audio(0)
+ #endif
{
}
bool preparePlayback()
@@ -148,9 +159,10 @@ struct Movie
}
// Once we're initialized, we can tell if this file has audio and/or video.
- hasAudio = THEORAPLAY_hasAudioStream(decoder);
hasVideo = THEORAPLAY_hasVideoStream(decoder);
+ #ifndef MKXPZ_NO_OPENAL
+ hasAudio = THEORAPLAY_hasAudioStream(decoder);
// Queue up the audio
if (hasAudio) {
while ((audio = THEORAPLAY_getAudio(decoder)) == NULL) {
@@ -160,6 +172,7 @@ struct Movie
SDL_Delay(VIDEO_DELAY);
}
}
+ #endif
// No video, so no point in doing anything else
if (!hasVideo) {
@@ -172,6 +185,7 @@ struct Movie
SDL_Delay(VIDEO_DELAY);
}
+ #ifndef MKXPZ_NO_OPENAL
// Wait until we have audio, if applicable
audio = NULL;
if (hasAudio) {
@@ -179,15 +193,19 @@ struct Movie
SDL_Delay(VIDEO_DELAY);
}
}
+ #endif
+
// Create this Bitmap without a hires replacement, because we don't
// support hires replacement for Movies yet.
videoBitmap = new Bitmap(video->width, video->height, true);
+ #ifndef MKXPZ_NO_OPENAL
audioQueueHead = NULL;
audioQueueTail = NULL;
+ #endif
return true;
}
-
+#ifndef MKXPZ_NO_OPENAL
void queueAudioPacket(const THEORAPLAY_AudioPacket *audio) {
AudioQueue *item = NULL;
@@ -313,12 +331,14 @@ struct Movie
return true;
}
-
+#endif
void play(float volume)
{
Uint32 frameMs = 0;
Uint32 baseTicks = SDL_GetTicks();
+ #ifndef MKXPZ_NO_OPENAL
bool openedAudio = false;
+ #endif
while (THEORAPLAY_isDecoding(decoder)) {
// Check for reset/shutdown input
if(shState->graphics().updateMovieInput(this)) break;
@@ -335,6 +355,7 @@ struct Movie
video = THEORAPLAY_getVideo(decoder);
}
+ #ifndef MKXPZ_NO_OPENAL
if (hasAudio) {
if (!audio) {
audio = THEORAPLAY_getAudio(decoder);
@@ -349,6 +370,7 @@ struct Movie
}
}
+ #endif
if (video && (video->playms <= now)) {
frameMs = (video->fps == 0.0) ? 0 : ((Uint32) (1000.0 / video->fps));
@@ -385,14 +407,17 @@ struct Movie
SDL_Delay(VIDEO_DELAY);
}
+ #ifndef MKXPZ_NO_OPENAL
if (openedAudio) {
bufferMovieAudio(decoder, now);
}
+ #endif
}
}
~Movie()
{
+ #ifndef MKXPZ_NO_OPENAL
if (hasAudio) {
if (audioQueueTail) {
THEORAPLAY_freeAudio(audioQueueTail->audio);
@@ -413,8 +438,9 @@ struct Movie
alDeleteSources(1, &audioSource);
alDeleteBuffers(STREAM_BUFS, alBuffers);
}
- if (video) THEORAPLAY_freeVideo(video);
if (audio) THEORAPLAY_freeAudio(audio);
+ #endif
+ if (video) THEORAPLAY_freeVideo(video);
if (decoder) THEORAPLAY_stopDecode(decoder);
delete videoBitmap;
}
diff --git a/src/display/tilemap.cpp b/src/display/tilemap.cpp
index 6bb245d84..985f26490 100644
--- a/src/display/tilemap.cpp
+++ b/src/display/tilemap.cpp
@@ -744,13 +744,8 @@ struct TilemapPrivate
void handleTile(int x, int y, int z)
{
- int ox = x + viewpPos.x;
- int oy = y + viewpPos.y;
- if (!wrapping && (ox < 0 || oy < 0 || ox >= mapData->xSize() || oy >= mapData->ySize()))
- return;
-
int tileInd =
- tableGetWrapped(*mapData, ox, oy, z);
+ tableGetWrapped(*mapData, x + viewpPos.x, y + viewpPos.y, z);
/* Check for empty space */
if (tileInd < 48)
diff --git a/src/eventthread.cpp b/src/eventthread.cpp
index 5f023e40a..40de3c7d1 100644
--- a/src/eventthread.cpp
+++ b/src/eventthread.cpp
@@ -28,9 +28,11 @@
#include
#include
+#ifndef MKXPZ_NO_OPENAL
#include
#include
#include
+#endif
#include
#include "sharedstate.h"
@@ -45,7 +47,9 @@
#include "TouchBar.h"
#endif
+#ifndef MKXPZ_NO_OPENAL
#include "al-util.h"
+#endif
#include "debugwriter.h"
#ifndef __APPLE__
@@ -54,6 +58,7 @@
#include
+#ifndef MKXPZ_NO_OPENAL
typedef void (ALC_APIENTRY *LPALCDEVICEPAUSESOFT) (ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device);
@@ -82,6 +87,7 @@ initALCFunctions(ALCdevice *alcDev)
}
#define HAVE_ALC_DEVICE_PAUSE alc.DevicePause
+#endif
uint8_t EventThread::keyStates[];
EventThread::ControllerState EventThread::controllerState;
@@ -156,7 +162,9 @@ void EventThread::process(RGSSThreadData &rtData)
UnidirMessage &windowSizeMsg = rtData.windowSizeMsg;
UnidirMessage &drawableSizeMsg = rtData.drawableSizeMsg;
+ #ifndef MKXPZ_NO_OPENAL
initALCFunctions(rtData.alcDev);
+ #endif
// XXX this function breaks input focus on OSX
#ifndef __APPLE__
@@ -642,8 +650,10 @@ int EventThread::eventFilter(void *data, SDL_Event *event)
case SDL_APP_WILLENTERBACKGROUND :
Debug() << "SDL_APP_WILLENTERBACKGROUND";
+ #ifndef MKXPZ_NO_OPENAL
if (HAVE_ALC_DEVICE_PAUSE)
alc.DevicePause(rtData.alcDev);
+ #endif
rtData.syncPoint.haltThreads();
@@ -660,8 +670,10 @@ int EventThread::eventFilter(void *data, SDL_Event *event)
case SDL_APP_DIDENTERFOREGROUND :
Debug() << "SDL_APP_DIDENTERFOREGROUND";
+ #ifndef MKXPZ_NO_OPENAL
if (HAVE_ALC_DEVICE_PAUSE)
alc.DeviceResume(rtData.alcDev);
+ #endif
rtData.syncPoint.resumeThreads();
diff --git a/src/eventthread.h b/src/eventthread.h
index b8d868a05..8989b082b 100644
--- a/src/eventthread.h
+++ b/src/eventthread.h
@@ -38,7 +38,9 @@
#include "keybindings.h"
struct RGSSThreadData;
+#ifndef MKXPZ_NO_OPENAL
typedef struct MKXPZ_ALCDEVICE ALCdevice;
+#endif
struct SDL_Window;
union SDL_Event;
@@ -267,7 +269,9 @@ struct RGSSThreadData
const char *argv0;
SDL_Window *window;
+#ifndef MKXPZ_NO_OPENAL
ALCdevice *alcDev;
+#endif
SDL_GLContext glContext;
@@ -283,7 +287,9 @@ struct RGSSThreadData
RGSSThreadData(EventThread *ethread,
const char *argv0,
SDL_Window *window,
+#ifndef MKXPZ_NO_OPENAL
ALCdevice *alcDev,
+#endif
int refreshRate,
int scalingFactor,
const Config& newconf,
@@ -291,7 +297,9 @@ struct RGSSThreadData
: ethread(ethread),
argv0(argv0),
window(window),
+#ifndef MKXPZ_NO_OPENAL
alcDev(alcDev),
+#endif
sizeResoRatio(1, 1),
refreshRate(refreshRate),
scale(scalingFactor),
diff --git a/src/main.cpp b/src/main.cpp
index c3a041303..cc2e82837 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -23,11 +23,15 @@
#include "icon.png.xxd"
#endif
+#ifndef MKXPZ_NO_OPENAL
#include
+#endif
#include
#include
+#ifndef MKXPZ_NO_OPENAL
#include
+#endif
#include
#include
@@ -129,6 +133,7 @@ int rgssThreadFun(void *userdata) {
#endif
/* Setup AL context */
+ #ifndef MKXPZ_NO_OPENAL
ALCcontext *alcCtx = alcCreateContext(threadData->alcDev, 0);
if (!alcCtx) {
@@ -137,12 +142,15 @@ int rgssThreadFun(void *userdata) {
}
alcMakeContextCurrent(alcCtx);
+ #endif
try {
SharedState::initInstance(threadData);
} catch (const Exception &exc) {
rgssThreadError(threadData, exc.msg);
+ #ifndef MKXPZ_NO_OPENAL
alcDestroyContext(alcCtx);
+ #endif
return 0;
}
@@ -155,7 +163,9 @@ int rgssThreadFun(void *userdata) {
SharedState::finiInstance();
+ #ifndef MKXPZ_NO_OPENAL
alcDestroyContext(alcCtx);
+ #endif
return 0;
}
@@ -294,6 +304,7 @@ int main(int argc, char *argv[]) {
return 0;
}
+#ifndef MKXPZ_NO_OPENAL
if (Sound_Init() == 0) {
showInitError(std::string("Error initializing SDL_sound: ") +
Sound_GetError());
@@ -307,6 +318,7 @@ int main(int argc, char *argv[]) {
return 0;
}
+#endif
#if defined(__WIN32__)
WSAData wsadata = {0};
if (WSAStartup(0x101, &wsadata) || wsadata.wVersion != 0x101) {
@@ -392,6 +404,7 @@ int main(int argc, char *argv[]) {
(void)setupWindowIcon;
#endif
+ #ifndef MKXPZ_NO_OPENAL
ALCdevice *alcDev = alcOpenDevice(0);
if (!alcDev) {
@@ -406,6 +419,7 @@ int main(int argc, char *argv[]) {
#endif
return 0;
}
+ #endif
SDL_DisplayMode mode;
SDL_GetDisplayMode(0, 0, &mode);
@@ -422,8 +436,18 @@ int main(int argc, char *argv[]) {
SDL_GLContext glCtx = NULL;
#endif
- RGSSThreadData rtData(&eventThread, argv[0], win, alcDev, mode.refresh_rate,
- mkxp_sys::getScalingFactor(), conf, glCtx);
+ RGSSThreadData rtData(
+ &eventThread,
+ argv[0],
+ win,
+ #ifndef MKXPZ_NO_OPENAL
+ alcDev,
+ #endif
+ mode.refresh_rate,
+ mkxp_sys::getScalingFactor(),
+ conf,
+ glCtx
+ );
int winW, winH, drwW, drwH;
SDL_GetWindowSize(win, &winW, &winH);
@@ -485,7 +509,9 @@ int main(int argc, char *argv[]) {
Debug() << "Shutting down.";
+ #ifndef MKXPZ_NO_OPENAL
alcCloseDevice(alcDev);
+ #endif
SDL_DestroyWindow(win);
#if defined(__WIN32__)
@@ -496,7 +522,9 @@ int main(int argc, char *argv[]) {
#ifdef MKXPZ_STEAM
STEAMSHIM_deinit();
#endif
+#ifndef MKXPZ_NO_OPENAL
Sound_Quit();
+#endif
TTF_Quit();
IMG_Quit();
SDL_Quit();
diff --git a/src/meson.build b/src/meson.build
index 75c960c9f..8439795ef 100755
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,11 +1,7 @@
physfs = dependency('physfs', version: '>=2.1', static: build_static)
-openal = dependency('openal', static: build_static, method: 'pkg-config')
theora = dependency('theora', static: build_static)
-vorbisfile = dependency('vorbisfile', static: build_static)
vorbis = dependency('vorbis', static: build_static)
-ogg = dependency('ogg', static: build_static)
sdl2 = dependency('SDL2', static: build_static)
-sdl_sound = compilers['cpp'].find_library('SDL2_sound')
sdl2_ttf = dependency('SDL2_ttf', static: build_static)
freetype = dependency('freetype2', static: build_static)
pixman = dependency('pixman-1', static: build_static)
@@ -77,18 +73,36 @@ foreach l : explicit_libs.split(';')
endif
endforeach
-alcdev_struct = 'ALCdevice_struct'
-if openal.type_name() == 'pkgconfig'
- if openal.version().version_compare('>=1.20.1')
- alcdev_struct = 'ALCdevice'
+
+if disable_openal == false
+ vorbisfile = dependency('vorbisfile', static: build_static)
+ ogg = dependency('ogg', static: build_static)
+ openal = dependency('openal', static: build_static, method: 'pkg-config')
+ sdl_sound = compilers['cpp'].find_library('SDL2_sound')
+
+ global_dependencies += [vorbisfile, vorbis, ogg, openal, sdl_sound]
+
+ alcdev_struct = 'ALCdevice_struct'
+ if openal.type_name() == 'pkgconfig'
+ if openal.version().version_compare('>=1.20.1')
+ alcdev_struct = 'ALCdevice'
+ endif
endif
-endif
-global_args += '-DMKXPZ_ALCDEVICE=' + alcdev_struct
+ global_args += '-DMKXPZ_ALCDEVICE=' + alcdev_struct
+
+ if get_option('shared_fluid') == true
+ fluidsynth = dependency('fluidsynth', static: build_static)
+ add_project_arguments('-DSHARED_FLUID', language: 'cpp')
+ global_dependencies += fluidsynth
+ if host_system == 'windows'
+ global_dependencies += compilers['cpp'].find_library('dsound')
+ endif
+ endif
+endif
global_include_dirs += include_directories('.',
- 'audio',
'crypto',
'display', 'display/gl', 'display/libnsgif', 'display/libnsgif/utils',
'etc',
@@ -100,7 +114,11 @@ global_include_dirs += include_directories('.',
'util', 'util/sigslot', 'util/sigslot/adapter'
)
-global_dependencies += [openal, zlib, bz2, sdl2, sdl_sound, pixman, physfs, theora, vorbisfile, vorbis, ogg, sdl2_ttf, freetype, sdl2_image, png, iconv, uchardet, cppzmq]
+if disable_openal == false
+ global_include_dirs += include_directories('audio')
+endif
+
+global_dependencies += [zlib, bz2, sdl2, pixman, physfs, theora, sdl2_ttf, freetype, sdl2_image, png, iconv, uchardet, cppzmq, vorbis]
if host_system == 'windows'
global_dependencies += compilers['cpp'].find_library('wsock32')
global_dependencies += compilers['cpp'].find_library('winmm')
@@ -111,14 +129,6 @@ elif host_system == 'linux'
global_dependencies += [dependency('gtk+-3.0'), dependency('libxfconf-0')]
endif
-if get_option('shared_fluid') == true
- fluidsynth = dependency('fluidsynth', static: build_static)
- add_project_arguments('-DSHARED_FLUID', language: 'cpp')
- global_dependencies += fluidsynth
- if host_system == 'windows'
- global_dependencies += compilers['cpp'].find_library('dsound')
- endif
-endif
if get_option('cjk_fallback_font') == true
add_project_arguments('-DMKXPZ_CJK_FONT', language: 'cpp')
@@ -131,17 +141,6 @@ main_source = files(
'settingsmenu.cpp',
'sharedstate.cpp',
- 'audio/alstream.cpp',
- 'audio/audio.cpp',
- 'audio/audiostream.cpp',
- 'audio/audiochannels.cpp',
- 'audio/fluid-fun.cpp',
- 'audio/midisource.cpp',
- 'audio/sdlsoundsource.cpp',
- 'audio/soundemitter.cpp',
- 'audio/vorbissource.cpp',
- 'theoraplay/theoraplay.c',
-
'crypto/rgssad.cpp',
'display/autotiles.cpp',
@@ -191,10 +190,28 @@ main_source = files(
'oneshot/oneshot.cpp',
'oneshot/i18n.cpp',
+
+ 'theoraplay/theoraplay.c',
)
global_sources += main_source
+audio_source = [
+ 'audio/alstream.cpp',
+ 'audio/audio.cpp',
+ 'audio/audiostream.cpp',
+ 'audio/audiochannels.cpp',
+ 'audio/fluid-fun.cpp',
+ 'audio/midisource.cpp',
+ 'audio/sdlsoundsource.cpp',
+ 'audio/soundemitter.cpp',
+ 'audio/vorbissource.cpp',
+]
+
+if disable_openal == false
+ global_sources += audio_source
+endif
+
if host_system == 'linux'
global_sources += files('oneshot/xdg-user-dir-lookup.c')
endif
diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp
index bf394b1f7..088eae701 100644
--- a/src/sharedstate.cpp
+++ b/src/sharedstate.cpp
@@ -25,7 +25,9 @@
#include "filesystem.h"
#include "graphics.h"
#include "input.h"
+#ifndef MKXPZ_NO_OPENAL
#include "audio.h"
+#endif
#include "glstate.h"
#include "shader.h"
#include "texpool.h"
@@ -36,7 +38,9 @@
#include "quad.h"
#include "binding.h"
#include "exception.h"
+#ifndef MKXPZ_NO_OPENAL
#include "sharedmidistate.h"
+#endif
#include "oneshot.h"
@@ -74,11 +78,15 @@ struct SharedStatePrivate
RGSSThreadData &rtData;
Config &config;
+#ifndef MKXPZ_NO_OPENAL
SharedMidiState midiState;
+#endif
Graphics graphics;
Input input;
+ #ifndef MKXPZ_NO_OPENAL
Audio audio;
+ #endif
Oneshot oneshot;
@@ -112,10 +120,14 @@ struct SharedStatePrivate
eThread(*threadData->ethread),
rtData(*threadData),
config(threadData->config),
+#ifndef MKXPZ_NO_OPENAL
midiState(threadData->config),
+#endif
graphics(threadData),
input(*threadData),
+ #ifndef MKXPZ_NO_OPENAL
audio(*threadData),
+ #endif
oneshot(*threadData),
_glState(threadData->config),
fontState(threadData->config),
@@ -171,8 +183,10 @@ struct SharedStatePrivate
/* RGSS3 games will call setup_midi, so there's
* no need to do it on startup */
+ #ifndef MKXPZ_NO_OPENAL
if (rgssVer <= 2)
midiState.initIfNeeded(threadData->config);
+ #endif
}
~SharedStatePrivate()
@@ -244,14 +258,18 @@ GSATT(RGSSThreadData&, rtData)
GSATT(Config&, config)
GSATT(Graphics&, graphics)
GSATT(Input&, input)
+#ifndef MKXPZ_NO_OPENAL
GSATT(Audio&, audio)
+#endif
GSATT(Oneshot&, oneshot)
GSATT(GLState&, _glState)
GSATT(ShaderSet&, shaders)
GSATT(TexPool&, texPool)
GSATT(Quad&, gpQuad)
GSATT(SharedFontState&, fontState)
+#ifndef MKXPZ_NO_OPENAL
GSATT(SharedMidiState&, midiState)
+#endif
void SharedState::setBindingData(void *data)
{
diff --git a/src/sharedstate.h b/src/sharedstate.h
index 5434c78d2..a852c843d 100644
--- a/src/sharedstate.h
+++ b/src/sharedstate.h
@@ -42,7 +42,9 @@ class FileSystem;
class EventThread;
class Graphics;
class Input;
+#ifndef MKXPZ_NO_OPENAL
class Audio;
+#endif
class GLState;
class TexPool;
class Font;
@@ -50,7 +52,9 @@ class SharedFontState;
struct GlobalIBO;
struct Config;
struct Vec2i;
+#ifndef MKXPZ_NO_OPENAL
struct SharedMidiState;
+#endif
class Oneshot;
@@ -72,7 +76,9 @@ struct SharedState
Graphics &graphics() const;
Input &input() const;
+#ifndef MKXPZ_NO_OPENAL
Audio &audio() const;
+#endif
Oneshot &oneshot() const;
@@ -84,7 +90,9 @@ struct SharedState
SharedFontState &fontState() const;
Font &defaultFont() const;
+#ifndef MKXPZ_NO_OPENAL
SharedMidiState &midiState() const;
+#endif
sigslot::signal<> prepareDraw;