Compare commits

...

12 Commits

Author SHA1 Message Date
Xavier Del Campo Romero 5464a50f96 README.md: reflect current status 2022-06-08 01:00:32 +02:00
Xavier Del Campo Romero 0517c897c5 win9x.cmake: remove unneeded dependencies 2022-06-08 00:36:26 +02:00
Xavier Del Campo Romero 99bb23e194 win9x.cmake: use target commands for SDL and SDL_mixer
Since libSDL.a and libSDL_mixer.a are compiled separately from this
project, some hacks had been used to get the build running. However,
this approach did not make proper use of target-level properties, which
are encouraged according to modern CMake standards over global-level
commands such as include_directories() or link_libraries().

OTOH, Win32 dependencies were being imported using link_libraries(), but
they in fact are SDL dependencies, so target_link_libraries() can be
used instead.
2022-06-08 00:36:26 +02:00
Xavier Del Campo Romero 706d299af4 pad/CMakeLists.txt: add missing call to target_link_libraries() 2022-06-08 00:36:23 +02:00
Xavier Del Campo Romero d57cd4ad82 CMakeLists.txt: assume native build by default
This has been decided to make the de-facto standard CMake build process
(shown below) possible.

$ mkdir build
$ cd build/
$ cmake ..
2022-06-08 00:25:17 +02:00
Xavier Del Campo Romero a5f2f1a4ba CMakeLists.txt: build host tools as ExternalProject 2022-06-08 00:21:18 +02:00
Xavier Del Campo Romero 787402efcf CMakeLists.txt: move target-specific logic away 2022-06-07 23:32:32 +02:00
Xavier Del Campo Romero 9073d82ea6 Split CMakeLists.txt into platform-specific *.cmake 2022-05-24 22:20:04 +02:00
Xavier Del Campo Romero 938ab93482 Make gfx_draw return int 2022-05-24 22:20:04 +02:00
Xavier Del Campo Romero 132d8c860e Use realloc(3) directly
It is simply not true realloc(3) cannot be used with NULL pointers.
2022-05-24 22:20:04 +02:00
Xavier Del Campo Romero 77d16c32cc font.c: avoid several va_list in favor of large buffer 2022-05-24 22:20:04 +02:00
Xavier Del Campo Romero dea345f412 Allow systems without sound support 2022-05-24 22:20:02 +02:00
19 changed files with 178 additions and 163 deletions

View File

@ -5,89 +5,38 @@ option(HOST_BUILD "Build for host platform using SDL-1.2" OFF)
option(WIN9X_BUILD "Build for Win9x using SDL-1.2" OFF)
if(NOT PS1_BUILD AND NOT HOST_BUILD AND NOT WIN9X_BUILD)
message(FATAL_ERROR "Please define target platform. Available options:
PS1_BUILD
HOST_BUILD
WIN9X_BUILD
Run CMake again using one of the available platforms e.g.: cmake .. -DPS1_BUILD=1")
message(STATUS "Assuming native build. "
"Please use one of the available options in CMakeLists.txt to "
"cross-compile for a specific target.")
set(HOST_BUILD ON)
endif()
if(PS1_BUILD)
if("$ENV{PSXSDK_PATH}" STREQUAL "")
message(FATAL_ERROR "Please set PSXSDK_PATH env variable first")
endif()
set(CMAKE_C_COMPILER psx-gcc)
set(CMAKE_AR mipsel-unknown-elf-ar)
include("cmake/ps1-toolchain.cmake")
elseif(WIN9X_BUILD)
set(CMAKE_C_COMPILER i386-mingw32-gcc)
include("cmake/win9x-toolchain.cmake")
endif()
set(TOOLS_PREFIX ${CMAKE_BINARY_DIR}/tools)
include(ExternalProject)
ExternalProject_Add(tools
SOURCE_DIR ${CMAKE_SOURCE_DIR}/tools
CMAKE_ARGS
-D CMAKE_INSTALL_PREFIX=${TOOLS_PREFIX})
project(rts)
add_executable(${PROJECT_NAME} "src/main.c")
set(cdroot ${CMAKE_BINARY_DIR}/cdimg)
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
set(cflags -Wall -g3 -ffunction-sections -fdata-sections -pedantic -std=c99)
if(PS1_BUILD)
file(MAKE_DIRECTORY ${cdroot})
target_link_directories(${PROJECT_NAME} PUBLIC $ENV{PSXSDK_PATH}/lib)
target_link_libraries(${PROJECT_NAME} PUBLIC -lpsx -lfixmath)
target_compile_definitions(${PROJECT_NAME} PUBLIC FIXMATH_FAST_SIN PSXSDK_DEBUG)
target_include_directories(${PROJECT_NAME} PRIVATE . $ENV{PSXSDK_PATH}/include)
add_custom_target(exe ALL elf2exe ${PROJECT_NAME}
${cdroot}/${PROJECT_NAME}.exe -mark="A homebrew game created with PSXSDK"
DEPENDS ${PROJECT_NAME})
add_custom_target(iso ALL mkisofs -o ${PROJECT_NAME}.iso -V ${PROJECT_NAME}
-sysid PLAYSTATION ${cdroot} DEPENDS exe)
set(license $ENV{PSXSDK_PATH}/share/licenses/infoeur.dat)
add_custom_target(bin_cue ALL mkpsxiso ${PROJECT_NAME}.iso ${PROJECT_NAME}.bin
${license} -s DEPENDS iso)
# add_custom_target(libpsx ALL DEPENDS $ENV{PSXSDK_PATH}/lib/libpsx.a)
# add_dependencies(${PROJECT_NAME} libpsx)
if(NOT EXISTS "${cdroot}/system.cnf")
file(COPY "src/system.cnf" DESTINATION "${cdroot}")
endif()
include("cmake/ps1.cmake")
elseif(WIN9X_BUILD)
file(MAKE_DIRECTORY ${cdroot})
if("$ENV{SDL_PATH}" STREQUAL "")
message(FATAL_ERROR "please define env variable SDL_PATH")
elseif("$ENV{SDL_TTF_PATH}" STREQUAL "")
message(FATAL_ERROR "please define env variable SDL_TTF_PATH")
elseif("$ENV{FREETYPE_PATH}" STREQUAL "")
message(FATAL_ERROR "please define env variable FREETYPE_PATH")
elseif("$ENV{SDL_MIXER_PATH}" STREQUAL "")
message(FATAL_ERROR "please define env variable SDL_MIXER_PATH")
endif()
add_custom_command(OUTPUT ${cdroot}/${PROJECT_NAME}
COMMAND i386-mingw32-strip ${PROJECT_NAME} -o ${cdroot}/${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS ${PROJECT_NAME}
VERBATIM)
add_custom_target(stripped-exe ALL DEPENDS ${cdroot}/${PROJECT_NAME})
target_link_directories(${PROJECT_NAME} PRIVATE $ENV{SDL_PATH}/lib
$ENV{SDL_TTF_PATH}/lib $ENV{FREETYPE_PATH}/lib
$ENV{SDL_MIXER_PATH}/lib)
include_directories($ENV{SDL_PATH}/include
$ENV{SDL_PATH}/include/SDL $ENV{SDL_TTF_PATH}/include
$ENV{FREETYPE_PATH}/include
$ENV{SDL_MIXER_PATH}/include)
add_compile_options(-march=i386)
link_libraries(gdi32 user32 winmm dxguid freetype)
set(SDL1_2_BUILD 1)
include("cmake/win9x.cmake")
elseif(HOST_BUILD)
file(MAKE_DIRECTORY ${cdroot})
find_package(SDL 1.2 REQUIRED)
find_package(SDL_mixer 1.2 REQUIRED)
set(SDL1_2_BUILD 1)
#find_package(SDL_ttf 2.0 REQUIRED)
endif()
# libfixmath is already bundled with PSXSDK.
if(NOT PS1_BUILD)
add_subdirectory(libfixmath)
include("cmake/host.cmake")
endif()
add_subdirectory("res")
@ -118,32 +67,6 @@ set(interfaces
tech
)
# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
set(cflags -Wall -g3 -ffunction-sections -fdata-sections -pedantic -std=c99)
if(WIN9X_BUILD)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# i386-mingw32-gcc 3.4.5 does not support -Og.
set(cflags ${cflags} -O0)
else()
set(cflags ${cflags} -O2)
endif()
elseif(PS1_BUILD)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(cflags ${cflags} -Og)
else()
set(cflags ${cflags} -Os)
endif()
set(cflags ${cflags} -fshort-enums)
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(cflags ${cflags} -Og)
else()
set(cflags ${cflags} -O3)
endif()
endif()
target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
foreach(c ${components})

View File

@ -14,13 +14,11 @@ in the likes of several other entries from the mid 90's.
The following platforms are either supported or support is expected in
the future:
- **(supported)** Sony PlayStation 1, using a forked version of
- Sony PlayStation 1, using a forked version of
[PSXSDK](https://git.disroot.org/xavi92/psxsdk).
- *(not supported yet)* Microsoft Win9x, using a `i386-mingw32`
cross-toolchain and SDL-1.2.
- *(not supported yet)* Modern Unix-like operating systems such as
GNU/Linux or *BSD, using SDL-1.2 (if available). Possibly modern
Microsoft Windows versions, too.
- Microsoft Win9x, using a `i386-mingw32` cross-toolchain and SDL-1.2.
- Modern Unix-like operating systems such as GNU/Linux or *BSD, using
SDL-1.2 (if available). Possibly modern Microsoft Windows versions, too.
## Design goals
@ -36,8 +34,16 @@ hardware.
## Building from source
**RTS** can be built using the typical CMake build process. The
following options can be defined:
A native version of **RTS** can be built using the typical CMake build
process:
```sh
mkdir build
cd build
cmake ..
```
The following options can be otherwise defined:
- `PS1_BUILD`: builds for Sony Playstation 1
- `HOST_BUILD`: builds for the host operating system using SDL-1.2
@ -46,9 +52,10 @@ SDL-1.2. A `i386-mingw32` cross-toolchain must be available.
For example, the Sony PlayStation 1 version can be built using:
```
mkdir build && cd $_
cmake .. -DPS1_BUILD=1 -DVIDEO_MODE=VMODE_PAL -DCMAKE_EXPORT_COMPILE_COMMANDS=1
```sh
mkdir build
cd build
cmake .. -DPS1_BUILD=1 -DVIDEO_MODE=VMODE_PAL
make -j$(nproc --all)
```

12
cmake/host.cmake Normal file
View File

@ -0,0 +1,12 @@
file(MAKE_DIRECTORY ${cdroot})
find_package(SDL 1.2 REQUIRED)
find_package(SDL_mixer 1.2 REQUIRED)
set(SDL1_2_BUILD 1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(cflags ${cflags} -Og)
else()
set(cflags ${cflags} -O3)
endif()
add_subdirectory(libfixmath)

View File

@ -0,0 +1,2 @@
set(CMAKE_C_COMPILER psx-gcc)
set(CMAKE_AR mipsel-unknown-elf-ar)

32
cmake/ps1.cmake Normal file
View File

@ -0,0 +1,32 @@
if("$ENV{PSXSDK_PATH}" STREQUAL "")
message(FATAL_ERROR "Please set PSXSDK_PATH env variable first")
endif()
file(MAKE_DIRECTORY ${cdroot})
target_link_directories(${PROJECT_NAME} PUBLIC $ENV{PSXSDK_PATH}/lib)
target_link_libraries(${PROJECT_NAME} PUBLIC -lpsx -lfixmath)
target_compile_definitions(${PROJECT_NAME} PUBLIC FIXMATH_FAST_SIN PSXSDK_DEBUG)
target_include_directories(${PROJECT_NAME} PRIVATE . $ENV{PSXSDK_PATH}/include)
add_custom_target(exe ALL elf2exe ${PROJECT_NAME}
${cdroot}/${PROJECT_NAME}.exe -mark="A homebrew game created with PSXSDK"
DEPENDS ${PROJECT_NAME})
add_custom_target(iso ALL mkisofs -o ${PROJECT_NAME}.iso -V ${PROJECT_NAME}
-sysid PLAYSTATION ${cdroot} DEPENDS exe)
set(license $ENV{PSXSDK_PATH}/share/licenses/infoeur.dat)
add_custom_target(bin_cue ALL mkpsxiso ${PROJECT_NAME}.iso ${PROJECT_NAME}.bin
${license} -s DEPENDS iso)
# add_custom_target(libpsx ALL DEPENDS $ENV{PSXSDK_PATH}/lib/libpsx.a)
# add_dependencies(${PROJECT_NAME} libpsx)
if(NOT EXISTS "${cdroot}/system.cnf")
file(COPY "src/system.cnf" DESTINATION "${cdroot}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(cflags ${cflags} -Og)
else()
set(cflags ${cflags} -Os)
endif()
set(cflags ${cflags} -fshort-enums)
# libfixmath is already bundled with PSXSDK.

View File

@ -0,0 +1 @@
set(CMAKE_C_COMPILER i386-mingw32-gcc)

37
cmake/win9x.cmake Normal file
View File

@ -0,0 +1,37 @@
file(MAKE_DIRECTORY ${cdroot})
if("$ENV{SDL_PATH}" STREQUAL "")
message(FATAL_ERROR "please define env variable SDL_PATH")
elseif("$ENV{SDL_MIXER_PATH}" STREQUAL "")
message(FATAL_ERROR "please define env variable SDL_MIXER_PATH")
endif()
add_custom_command(OUTPUT ${cdroot}/${PROJECT_NAME}
COMMAND i386-mingw32-strip ${PROJECT_NAME} -o ${cdroot}/${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS ${PROJECT_NAME}
VERBATIM)
add_custom_target(stripped-exe ALL DEPENDS ${cdroot}/${PROJECT_NAME})
add_library(SDL STATIC IMPORTED)
set_property(TARGET SDL PROPERTY IMPORTED_LOCATION $ENV{SDL_PATH}/lib/libSDL.a)
target_include_directories(SDL INTERFACE
$ENV{SDL_PATH}/include $ENV{SDL_PATH}/include/SDL)
target_link_libraries(SDL INTERFACE gdi32 user32 winmm dxguid)
add_library(SDL_mixer STATIC IMPORTED)
set_property(TARGET SDL_mixer PROPERTY IMPORTED_LOCATION
$ENV{SDL_MIXER_PATH}/lib/libSDL_mixer.a)
target_include_directories(SDL_mixer INTERFACE $ENV{SDL_MIXER_PATH}/include)
target_link_libraries(SDL_mixer INTERFACE SDL)
add_compile_options(-march=i386)
set(SDL1_2_BUILD 1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# i386-mingw32-gcc 3.4.5 does not support -Og.
set(cflags ${cflags} -O0)
else()
set(cflags ${cflags} -O2)
endif()
add_subdirectory(libfixmath)

View File

@ -29,12 +29,13 @@ function(sprite)
endif()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME}
COMMAND add-header ${trans} ${SPRITE_NAME}_24.bmp ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME}
COMMAND ${TOOLS_PREFIX}/bin/add-header ${trans} ${SPRITE_NAME}_24.bmp ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${SPRITE_NAME}_24.bmp
VERBATIM)
add_custom_target(${SPRITE_NAME}_img
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SPRITE_NAME})
add_dependencies(${SPRITE_NAME}_img tools)
endif()
endfunction()
@ -66,12 +67,13 @@ function(sound)
# Reference: https://gist.github.com/socantre/7ee63133a0a3a08f3990
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SOUND_NAME}
COMMAND add-header ${loop} ${SOUND_NAME}.wav ${CMAKE_CURRENT_BINARY_DIR}/${SOUND_NAME}
COMMAND ${TOOLS_PREFIX}/bin/add-header ${loop} ${SOUND_NAME}.wav ${CMAKE_CURRENT_BINARY_DIR}/${SOUND_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${SOUND_NAME}.wav
VERBATIM)
add_custom_target(${SOUND_NAME}_snd
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOUND_NAME})
add_dependencies(${SOUND_NAME}_snd tools)
endif()
endfunction()
@ -83,7 +85,7 @@ function(container)
"${multiValueArgs}" ${ARGN})
add_custom_command(OUTPUT ${cdroot}/${CONTAINER_NAME}.cnt
COMMAND container ${CONTAINER_SPRITES} ${CONTAINER_SOUNDS}
COMMAND ${TOOLS_PREFIX}/bin/container ${CONTAINER_SPRITES} ${CONTAINER_SOUNDS}
${cdroot}/${CONTAINER_NAME}.cnt
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM)
@ -91,6 +93,7 @@ function(container)
add_custom_target(${CONTAINER_NAME}_container
DEPENDS ${cdroot}/${CONTAINER_NAME}.cnt)
add_dependencies(${PROJECT_NAME} ${CONTAINER_NAME}_container)
add_dependencies(${CONTAINER_NAME}_container tools)
foreach(sprite ${CONTAINER_SPRITES})
add_dependencies(${CONTAINER_NAME}_container ${sprite}_img)

View File

@ -67,7 +67,7 @@ static int read_file_contents(const struct container *const el, FILE *const f,
break;
case CONTAINER_TYPE_SOUND:
if (sfx_sound_from_fp(el->data.sound, f))
if (sfx_sound_from_fp(el->data.sound, f, sz))
goto end;
break;

View File

@ -67,44 +67,18 @@ static int renderstr(const enum font f, const short x, short y, const char *str)
int font_printf(const enum font f, const short x, const short y,
const char *const fmt, ...)
{
va_list ap, aq, at;
va_list ap;
va_start(ap, fmt);
va_copy(aq, ap);
va_copy(at, ap);
/* Short string optimization. */
char defstr[64];
int sz = vsnprintf(defstr, sizeof defstr, fmt, ap);
char defstr[1024];
const int sz = vsnprintf(defstr, sizeof defstr, fmt, ap);
if (sz < 0)
goto end;
else if (sz >= sizeof defstr)
{
va_list at;
va_end(ap);
sz = vsnprintf(NULL, 0, fmt, ap);
if (sz < 0)
goto end;
/* VLAs are generally frowned upon, but using the heap
* might not be a good idea for a video game like this. */
char str[sz + 1];
sz = vsnprintf(str, sizeof str, fmt, ap);
va_end(at);
if (sz < 0)
goto end;
}
if (renderstr(f, x, y, defstr))
if (sz < 0 || sz >= sizeof defstr
|| renderstr(f, x, y, defstr))
return -1;
end:
va_end(at);
va_end(aq);
va_end(ap);
return sz;
}

View File

@ -94,7 +94,9 @@ int game(void)
}
instance_cyclic();
gfx_draw();
if (gfx_draw())
goto end;
}
ret = 0;

View File

@ -11,7 +11,7 @@ extern "C"
#endif
int gfx_init(void);
void gfx_draw(void);
int gfx_draw(void);
int gfx_toggle_fullscreen(void);
void sprite_sort(struct sprite *s);
int sprite_clone(const struct sprite *src, struct sprite *dst);

View File

@ -55,7 +55,7 @@ static void gfx_sync(void)
vblank_set = false;
}
void gfx_draw(void)
int gfx_draw(void)
{
static union gfx_sznext term = {.cmd_next = 0xffffff};
@ -71,4 +71,5 @@ void gfx_draw(void)
D2_BCR = 0;
D2_CHCR = (1 << 0xa) | 1 | (1 << 0x18);
first = NULL;
return 0;
}

View File

@ -27,13 +27,7 @@ static struct
void gfx_register_sprite(struct sprite *const s)
{
/* realloc(3) could had been used directly, but Win9x relies on
* a C89/C90 library implementation, where calling realloc(3)
* with a NULL pointer is undefined behaviour. */
if (!list)
list = malloc(sizeof *list);
else
list = realloc(list, (list_len + 1) * sizeof *list);
list = realloc(list, (list_len + 1) * sizeof *list);
if (list)
list[list_len++] = s;
@ -164,7 +158,7 @@ int gfx_toggle_fullscreen(void)
return 0;
}
void gfx_draw(void)
int gfx_draw(void)
{
enum {FPS = 50, REFRESH_MS = 1000 / FPS};
static Uint32 prev;
@ -176,7 +170,11 @@ void gfx_draw(void)
prev = SDL_GetTicks();
if (SDL_Flip(screen))
{
fprintf(stderr, "SDL_Flip: %s\n", SDL_GetError());
return -1;
}
get_resize_events();
return 0;
}

View File

@ -13,3 +13,4 @@ endif()
add_library(pad ${src})
target_include_directories(pad PUBLIC ${inc} PRIVATE ${privinc})
target_link_libraries(pad PUBLIC ${deps})

View File

@ -2,6 +2,7 @@
#define SFX_H
#include <sfx/port.h>
#include <stddef.h>
#include <stdio.h>
#ifdef __cplusplus
@ -10,7 +11,7 @@ extern "C"
#endif
int sfx_init(void);
int sfx_sound_from_fp(struct sound *s, FILE *f);
int sfx_sound_from_fp(struct sound *s, FILE *f, size_t sz);
int sfx_play(const struct sound *s);
void sfx_free(struct sound *s);
void sfx_deinit(void);

View File

@ -171,7 +171,7 @@ int sfx_play(const struct sound *const s)
return 0;
}
int sfx_sound_from_fp(struct sound *const s, FILE *const f)
int sfx_sound_from_fp(struct sound *const s, FILE *const f, const size_t sz)
{
struct vag_header h;

View File

@ -3,8 +3,12 @@
#include <header.h>
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
static bool subsystem_init, mixer_init;
void sfx_free(struct sound *const s)
{
if (s && s->chunk)
@ -13,7 +17,7 @@ void sfx_free(struct sound *const s)
int sfx_play(const struct sound *const s)
{
if (Mix_PlayChannel(-1, s->chunk, s->loop ? -1 : 0) < 0)
if (mixer_init && Mix_PlayChannel(-1, s->chunk, s->loop ? -1 : 0) < 0)
return -1;
return 0;
@ -50,39 +54,55 @@ static int load_header(struct sound *const s, FILE *const f)
return 0;
}
int sfx_sound_from_fp(struct sound *const s, FILE *const f)
int sfx_sound_from_fp(struct sound *const s, FILE *const f, const size_t sz)
{
if (load_header(s, f) || load_data(s, f))
return -1;
if (mixer_init)
{
if (load_header(s, f) || load_data(s, f))
return -1;
}
else
/* Skip the file. */
fseek(f, sz, SEEK_CUR);
return 0;
}
void sfx_deinit(void)
{
Mix_CloseAudio();
SDL_QuitSubSystem(SDL_INIT_AUDIO);
if (mixer_init)
Mix_CloseAudio();
if (subsystem_init)
SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
int sfx_init(void)
{
enum {CHUNK_SZ = 4096};
/* Some older systems might not support sound at all. */
if (SDL_InitSubSystem(SDL_INIT_AUDIO))
{
fprintf(stderr, "SDL_InitSubSystem: %s\n", SDL_GetError());
goto failure;
}
else if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY,
else
subsystem_init = true;
if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY,
MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, CHUNK_SZ))
{
fprintf(stderr, "Mix_OpenAudio: %s\n", SDL_GetError());
goto failure;
}
else
mixer_init = true;
return 0;
failure:
sfx_deinit();
return -1;
fprintf(stderr, "Running without audio support\n");
return 0;
}

View File

@ -5,3 +5,4 @@ add_executable(add-header "add-header.c")
set(cflags -Wall -g3)
target_compile_options(container PUBLIC ${cflags})
target_compile_options(add-header PUBLIC ${cflags})
install(TARGETS container add-header DESTINATION bin)