From 691154d54d168a78587f9176613a0ba5be88edc6 Mon Sep 17 00:00:00 2001 From: vamastah Date: Wed, 18 Nov 2020 02:39:13 +0100 Subject: [PATCH] Bittboy port update, readme update, supported music formats detected dynamically --- Makefile.bittboy | 2 +- README.md | 3 +++ src/sound.c | 36 +++++++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Makefile.bittboy b/Makefile.bittboy index ddb586b..6127c0b 100644 --- a/Makefile.bittboy +++ b/Makefile.bittboy @@ -8,7 +8,7 @@ SRC = src/main.c src/data_persistence.c src/video.c src/sound.c \ OBJ = $(SRC:.c=.o) DEP = $(SRC:.c=.d) CFLAGS = -Iinc -D_BITTBOY -Ofast -march=armv5te -mtune=arm926ej-s -LDFLAGS = -s $(shell $(BIN_BASE)pkg-config --libs sdl SDL_image SDL_ttf SDL_mixer) -ljpeg -logg -lfreetype -lpng -lz +LDFLAGS = -s $(shell $(BIN_BASE)pkg-config --libs sdl SDL_image SDL_ttf SDL_mixer) -ljpeg -logg -lfreetype -lpng -lz -lbz2 CC = arm-linux-gcc all: $(PROJECT) diff --git a/README.md b/README.md index 8f12049..6244eb4 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,9 @@ Feel free to report errors. For more, please refer to the source code. +### custom music support +The game supports custom music playback. In order to listen to your favourite songs, you need to copy them to $HOME/.yatka/music. If the folder does not exist, create it. Supported music formats depend on your platform, but usually MOD, MP3, OGG and WAV files are accepted. + ### ideas / plans - animated mascot (becchi?) evolving while playing or saying random things during gameplay - better score system (combos, T-spins) diff --git a/src/sound.c b/src/sound.c index abbd0c0..0ddf0a8 100644 --- a/src/sound.c +++ b/src/sound.c @@ -73,17 +73,31 @@ static void loadNextTrack(void) void initSound(void) { -#if defined(_RETROFW) - int mixflags = MIX_INIT_OGG | MIX_INIT_MOD; -#elif defined(_BITTBOY) - int mixflags = MIX_INIT_OGG; -#else - int mixflags = MIX_INIT_OGG | MIX_INIT_MOD | MIX_INIT_MP3; -#endif - if (Mix_Init(mixflags) != mixflags) - { - printf("Mix_Init failed.\n"); - exit(ERROR_MIXINIT); + int mixflags = -1; + int retflags = Mix_Init(mixflags); + if (retflags != mixflags) + { + retflags = Mix_Init(retflags); + } + if (retflags & MIX_INIT_FLAC) + { + printf("Mix_Init: FLAC supported.\n"); + } + if (retflags & MIX_INIT_MOD) + { + printf("Mix_Init: MOD supported.\n"); + } + if (retflags & MIX_INIT_MP3) + { + printf("Mix_Init: MP3 supported.\n"); + } + if (retflags & MIX_INIT_OGG) + { + printf("Mix_Init: OGG supported.\n"); + } + if (retflags & MIX_INIT_FLUIDSYNTH) + { + printf("Mix_Init: MIDI supported (FluidSynth?).\n"); } if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 1, 1024) < 0) {