mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-10-07 14:18:04 +03:00
Require SDL2_mixer on non-Emscripten platforms
This commit is contained in:
+9
-20
@@ -45,7 +45,6 @@ elseif (ANDROID)
|
||||
add_library(sdl2 ALIAS SDL2)
|
||||
add_library(sdl2_ttf ALIAS SDL2_ttf)
|
||||
add_library(sdl2_mixer ALIAS SDL2_mixer)
|
||||
set(SDL2MIXER_FOUND 1)
|
||||
find_library(ndk_log log)
|
||||
find_library(ndk_zlib z)
|
||||
add_library(zlib INTERFACE)
|
||||
@@ -66,22 +65,18 @@ else() # non-emscripten, non-android
|
||||
|
||||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
||||
pkg_check_modules(SDL2TTF REQUIRED IMPORTED_TARGET SDL2_ttf)
|
||||
optional_pkg_check_modules(SDL2MIXER IMPORTED_TARGET SDL2_mixer)
|
||||
pkg_check_modules(SDL2MIXER REQUIRED IMPORTED_TARGET SDL2_mixer)
|
||||
if (WIN32)
|
||||
add_static_library(sdl2 SDL2)
|
||||
add_static_library(sdl2_ttf SDL2TTF)
|
||||
# Workaround for linking error
|
||||
set_property(TARGET sdl2_ttf PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
$<LINK_GROUP:RESCAN,${SDL2TTF_STATIC_LIBRARIES} -lstdc++>)
|
||||
if (SDL2MIXER_FOUND)
|
||||
add_static_library(sdl2_mixer SDL2MIXER)
|
||||
endif()
|
||||
add_static_library(sdl2_mixer SDL2MIXER)
|
||||
else()
|
||||
add_library(sdl2 ALIAS PkgConfig::SDL2)
|
||||
add_library(sdl2_ttf ALIAS PkgConfig::SDL2TTF)
|
||||
if (SDL2MIXER_FOUND)
|
||||
add_library(sdl2_mixer ALIAS PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
add_library(sdl2_mixer ALIAS PkgConfig::SDL2MIXER)
|
||||
set(DEFAULT_FONT_PATH ${CMAKE_INSTALL_PREFIX}/share/xsystem35/fonts/)
|
||||
endif()
|
||||
|
||||
@@ -138,20 +133,16 @@ endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
list(APPEND SUMMARY_AUDIO "Emscripten")
|
||||
elseif (SDL2MIXER_FOUND)
|
||||
else()
|
||||
list(APPEND SUMMARY_AUDIO "SDL_mixer")
|
||||
set(ENABLE_SDLMIXER 1)
|
||||
endif()
|
||||
|
||||
# CDROM
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
||||
if (EMSCRIPTEN)
|
||||
list(APPEND SUMMARY_CDROM "Emscripten")
|
||||
set(ENABLE_CDROM_EMSCRIPTEN 1)
|
||||
endif()
|
||||
if (SDL2MIXER_FOUND)
|
||||
else()
|
||||
list(APPEND SUMMARY_CDROM "SDL_mixer (wav|mp3|ogg...)")
|
||||
set(ENABLE_CDROM_MP3 1)
|
||||
endif()
|
||||
set(CDROM_DEVICE "playlist.txt" CACHE STRING "CDROM Device Name")
|
||||
|
||||
@@ -162,6 +153,9 @@ if (EMSCRIPTEN)
|
||||
elseif (ANDROID)
|
||||
list(APPEND SUMMARY_MIDI "Android")
|
||||
else()
|
||||
list(APPEND SUMMARY_MIDI "SDL_mixer")
|
||||
set(ENABLE_MIDI_SDLMIXER 1)
|
||||
|
||||
if (HAVE_SIGACTION)
|
||||
list(APPEND SUMMARY_MIDI "raw")
|
||||
set(MIDI_DEVICE "/dev/midi" CACHE STRING "midi device")
|
||||
@@ -181,11 +175,6 @@ else()
|
||||
set(SEQ_DEVICE "/dev/sequencer" CACHE STRING "sequencer device")
|
||||
endif()
|
||||
|
||||
if (SDL2MIXER_FOUND)
|
||||
list(APPEND SUMMARY_MIDI "SDL_mixer")
|
||||
set(ENABLE_MIDI_SDLMIXER 1)
|
||||
endif()
|
||||
|
||||
if (HAVE_PORTMIDI)
|
||||
list(APPEND SUMMARY_MIDI "PortMidi")
|
||||
set(ENABLE_MIDI_PORTMIDI 1)
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
#cmakedefine CACHE_TOTALSIZE @CACHE_TOTALSIZE@
|
||||
|
||||
#cmakedefine ENABLE_CDROM_ANDROID @ENABLE_CDROM_ANDROID@
|
||||
#cmakedefine ENABLE_CDROM_EMSCRIPTEN @ENABLE_CDROM_EMSCRIPTEN@
|
||||
#cmakedefine ENABLE_CDROM_MP3 @ENABLE_CDROM_MP3@
|
||||
#cmakedefine ENABLE_DEBUGGER @ENABLE_DEBUGGER@
|
||||
#cmakedefine ENABLE_GTK @ENABLE_GTK@
|
||||
#cmakedefine ENABLE_MIDI_RAWMIDI @ENABLE_MIDI_RAWMIDI@
|
||||
@@ -13,7 +10,6 @@
|
||||
#cmakedefine ENABLE_MIDI_SEQMIDI @ENABLE_MIDI_SEQMIDI@
|
||||
#cmakedefine ENABLE_MIDI_PORTMIDI @ENABLE_MIDI_PORTMIDI@
|
||||
#cmakedefine ENABLE_NLS @ENABLE_NLS@
|
||||
#cmakedefine ENABLE_SDLMIXER @ENABLE_SDLMIXER@
|
||||
|
||||
#cmakedefine CDROM_DEVICE "@CDROM_DEVICE@"
|
||||
#cmakedefine JOY_DEVICE "@JOY_DEVICE@"
|
||||
|
||||
+5
-12
@@ -24,11 +24,11 @@ target_sources(xsystem35 PRIVATE
|
||||
ags.c
|
||||
ald_manager.c
|
||||
alpha_plane.c
|
||||
bgi.c
|
||||
bmp.c
|
||||
cache.c
|
||||
cali.c
|
||||
cdrom.bgm.c
|
||||
cdrom.c
|
||||
cg.c
|
||||
cmd2F.c
|
||||
cmd2F60.c
|
||||
@@ -95,19 +95,14 @@ target_sources(xsystem35 PRIVATE
|
||||
)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
target_sources(xsystem35 PRIVATE pcm.emscripten.c bgm.emscripten.c bgi.c)
|
||||
elseif (SDL2MIXER_FOUND)
|
||||
target_sources(xsystem35 PRIVATE pcm.sdlmixer.c bgm.sdlmixer.c bgi.c)
|
||||
target_sources(xsystem35 PRIVATE pcm.emscripten.c bgm.emscripten.c)
|
||||
else()
|
||||
target_sources(xsystem35 PRIVATE pcm.dummy.c bgm.dummy.c)
|
||||
target_sources(xsystem35 PRIVATE pcm.sdlmixer.c bgm.sdlmixer.c)
|
||||
endif()
|
||||
|
||||
if (ENABLE_CDROM_EMSCRIPTEN)
|
||||
if (EMSCRIPTEN)
|
||||
target_sources(xsystem35 PRIVATE cdrom.emscripten.c)
|
||||
else()
|
||||
target_sources(xsystem35 PRIVATE cdrom.empty.c)
|
||||
endif()
|
||||
if (ENABLE_CDROM_MP3)
|
||||
target_sources(xsystem35 PRIVATE cdrom.mp3.c)
|
||||
endif()
|
||||
|
||||
@@ -116,12 +111,10 @@ if (EMSCRIPTEN)
|
||||
elseif (ANDROID)
|
||||
target_sources(xsystem35 PRIVATE midi.android.c)
|
||||
else()
|
||||
target_sources(xsystem35 PRIVATE midi.sdlmixer.c)
|
||||
if (ENABLE_MIDI_RAWMIDI)
|
||||
target_sources(xsystem35 PRIVATE midi.rawmidi.c midifile.c)
|
||||
endif()
|
||||
if (ENABLE_MIDI_SDLMIXER)
|
||||
target_sources(xsystem35 PRIVATE midi.sdlmixer.c)
|
||||
endif()
|
||||
if (ENABLE_MIDI_PORTMIDI)
|
||||
target_sources(xsystem35 PRIVATE midi.portmidi.c)
|
||||
endif()
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* bgm.dummy.c BGM (*BA.ALD) dummy implementation
|
||||
*
|
||||
* Copyright (C) 2019 <KichikuouChrome@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "portab.h"
|
||||
#include "bgm.h"
|
||||
|
||||
int musbgm_init(DRIFILETYPE type, int base_no) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_exit(void) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_reset(void) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_play(int no, int time, int vol) {
|
||||
WARNING("not implemented");
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_stop(int no, int time) {
|
||||
WARNING("not implemented");
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_fade(int no, int time, int vol) {
|
||||
WARNING("not implemented");
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_getpos(int no) {
|
||||
WARNING("not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int musbgm_getlen(int no) {
|
||||
WARNING("not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int musbgm_isplaying(int no) {
|
||||
WARNING("not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int musbgm_stopall(int time) {
|
||||
WARNING("not implemented");
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_wait(int no, int timeout) {
|
||||
WARNING("not implemented");
|
||||
return NG;
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* cdrom.c CD-ROM control wrapper
|
||||
*
|
||||
* Copyright (C) 2000- Masaki Chikama (Wren) <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: cdrom.c,v 1.20 2002/08/18 09:35:29 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "cdrom.h"
|
||||
#include "system.h"
|
||||
|
||||
#if defined(ENABLE_CDROM_EMSCRIPTEN)
|
||||
extern cdromdevice_t cdrom_emscripten;
|
||||
#define NATIVE_CD_DEVICE &cdrom_emscripten
|
||||
|
||||
#else
|
||||
|
||||
extern cdromdevice_t cdrom_empty;
|
||||
#define NATIVE_CD_DEVICE &cdrom_empty
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CDROM_MP3
|
||||
extern cdromdevice_t cdrom_mp3;
|
||||
#endif
|
||||
|
||||
cdromdevice_t *cd_init(const char *dev) {
|
||||
#if defined(ENABLE_CDROM_EMSCRIPTEN)
|
||||
return NATIVE_CD_DEVICE;
|
||||
#else
|
||||
struct stat st;
|
||||
if (dev && stat(dev, &st) && (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)))
|
||||
return NATIVE_CD_DEVICE;
|
||||
|
||||
#ifdef ENABLE_CDROM_MP3
|
||||
return &cdrom_mp3;
|
||||
#else
|
||||
WARNING("no cdrom device available");
|
||||
return NULL;
|
||||
#endif
|
||||
#endif // ENABLE_CDROM_EMSCRIPTEN
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* cdrom.empty.c CD-ROMアクセス
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: cdrom.empty.c,v 1.8 2002/08/18 09:35:29 chikama Exp $ */
|
||||
|
||||
#include <unistd.h>
|
||||
#include "portab.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
static int cdrom_start(int, int);
|
||||
static int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
|
||||
#define cdrom cdrom_empty
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
int cdrom_init(char *name) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int cdrom_exit(void) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_reset(void) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_start(int trk, int loop) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_stop() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_getPlayingInfo (cd_time *info) {
|
||||
return NG;
|
||||
}
|
||||
@@ -51,8 +51,6 @@ typedef struct _cdromdevice cdromdevice_t;
|
||||
|
||||
extern cdromdevice_t cdrom_bgm;
|
||||
|
||||
extern cdromdevice_t *cd_init(const char *dev);
|
||||
|
||||
#define CD_FPS 75
|
||||
#define FRAMES_TO_MSF(f, M,S,F) { \
|
||||
int value = f; \
|
||||
|
||||
+9
-4
@@ -30,6 +30,14 @@
|
||||
#include "music_cdrom.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
extern cdromdevice_t cdrom_emscripten;
|
||||
#define NATIVE_CD_DEVICE &cdrom_emscripten
|
||||
#else
|
||||
extern cdromdevice_t cdrom_mp3;
|
||||
#define NATIVE_CD_DEVICE &cdrom_mp3
|
||||
#endif
|
||||
|
||||
static char *dev = CDROM_DEVICE;
|
||||
|
||||
void muscd_set_devicename(const char *name) {
|
||||
@@ -42,10 +50,7 @@ int muscd_init(void) {
|
||||
if (ald_get_maxno(DRIFILE_BGM) > 0) {
|
||||
prv.cddev = &cdrom_bgm;
|
||||
} else {
|
||||
prv.cddev = cd_init(dev);
|
||||
if (!prv.cddev) {
|
||||
return NG;
|
||||
}
|
||||
prv.cddev = NATIVE_CD_DEVICE;
|
||||
}
|
||||
prv.cddev->init(dev);
|
||||
prv.cd_current_track = 0;
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* pcm.dummy.c Dummy PCM implementation
|
||||
*
|
||||
* Copyright (C) 2019 <KichikuouChrome@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "portab.h"
|
||||
#include "music_pcm.h"
|
||||
|
||||
int muspcm_init(int audio_buffer_size) { return NG; }
|
||||
int muspcm_exit(void) { return NG; }
|
||||
int muspcm_reset(void) { return NG; }
|
||||
int muspcm_load_no(int slot, int no) { return NG; }
|
||||
int muspcm_load_mixlr(int slot, int noL, int noR) { return NG; }
|
||||
int muspcm_load_data(int slot, uint8_t *buf, uint32_t len) { return NG; }
|
||||
int muspcm_unload(int slot) { return NG; }
|
||||
int muspcm_start(int slot, int loop) { return NG; }
|
||||
int muspcm_stop(int slot) { return NG; }
|
||||
int muspcm_fadeout(int slot, int msec) { return NG; }
|
||||
int muspcm_pause(int slot) { return NG; }
|
||||
int muspcm_unpause(int slot) { return NG; }
|
||||
int muspcm_getpos(int slot) { return NG; }
|
||||
int muspcm_setvol(int dev, int slot, int lv) { return NG; }
|
||||
int muspcm_getwavelen(int slot) { return NG; }
|
||||
boolean muspcm_isplaying(int slot) { return FALSE; }
|
||||
int muspcm_waitend(int slot) { return NG; }
|
||||
Reference in New Issue
Block a user