fdd_audio.c loads now samples from assets folder using assets infra function.

src/CMakeLists.txt rollbacked to original, no assets copying.
Fixed assets infra function to check for "assets/" - 7 characters, not 5 (as in "roms/"
This commit is contained in:
Toni Riikonen
2025-11-29 23:15:20 +02:00
parent 307855c912
commit 93b2a60db6
3 changed files with 10 additions and 18 deletions

View File

@@ -215,11 +215,9 @@ endif()
if(WIN32 OR (APPLE AND CMAKE_MACOSX_BUNDLE))
# Copy the binary to the root of the install prefix on Windows and macOS
install(TARGETS 86Box DESTINATION ".")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/assets DESTINATION ".")
else()
# On Linux we want to copy the binary to the `bin` folder.
install(TARGETS 86Box)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/assets)
endif()
@@ -290,10 +288,3 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
add_custom_command(TARGET 86Box POST_BUILD COMMAND paxctl ARGS +m $<TARGET_FILE:86Box> COMMENT "Disable PaX MPROTECT")
endif()
add_custom_command(TARGET 86Box POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets
$<TARGET_FILE_DIR:86Box>/assets
COMMENT "Copying assets directory to build output"
)

View File

@@ -26,6 +26,7 @@
#include <86box/fdd_audio.h>
#include <86box/fdc.h>
#include <86box/mem.h>
#include <86box/rom.h>
#include <86box/sound.h>
#include <86box/plat.h>
#include <86box/path.h>
@@ -668,7 +669,7 @@ load_wav(const char *filename, int *sample_count)
if (strstr(filename, "..") != NULL)
return NULL;
FILE *f = plat_fopen(filename, "rb");
FILE *f = asset_fopen(filename, "rb");
if (f == NULL) {
fdd_log("FDD Audio: Failed to open WAV file: %s\n", filename);
return NULL;

View File

@@ -166,10 +166,10 @@ asset_get_full_path(char *dest, const char *fn)
dest[0] = 0x00;
if (!strncmp(fn, "assets/", 5)) {
if (!strncmp(fn, "assets/", 7)) {
/* Relative path */
for (rom_path_t *asset_path = &asset_paths; asset_path != NULL; asset_path = asset_path->next) {
path_append_filename(temp, asset_path->path, fn + 5);
path_append_filename(temp, asset_path->path, fn + 7);
if (rom_check(temp)) {
strcpy(dest, temp);
@@ -218,10 +218,10 @@ asset_fopen(const char *fn, char *mode)
if ((fn == NULL) || (mode == NULL))
return NULL;
if (!strncmp(fn, "assets/", 5)) {
if (!strncmp(fn, "assets/", 7)) {
/* Relative path */
for (rom_path_t *asset_path = &asset_paths; asset_path != NULL; asset_path = asset_path->next) {
path_append_filename(temp, asset_path->path, fn + 5);
path_append_filename(temp, asset_path->path, fn + 7);
if ((fp = plat_fopen(temp, mode)) != NULL)
return fp;
@@ -267,10 +267,10 @@ asset_getfile(const char *fn, char *s, int size)
{
char temp[1024];
if (!strncmp(fn, "assets/", 5)) {
if (!strncmp(fn, "assets/", 7)) {
/* Relative path */
for (rom_path_t *asset_path = &asset_paths; asset_path != NULL; asset_path = asset_path->next) {
path_append_filename(temp, asset_path->path, fn + 5);
path_append_filename(temp, asset_path->path, fn + 7);
if (plat_file_check(temp)) {
strncpy(s, temp, size);
@@ -322,10 +322,10 @@ asset_present(const char *fn)
if (fn == NULL)
return 0;
if (!strncmp(fn, "assets/", 5)) {
if (!strncmp(fn, "assets/", 7)) {
/* Relative path */
for (rom_path_t *asset_path = &asset_paths; asset_path != NULL; asset_path = asset_path->next) {
path_append_filename(temp, asset_path->path, fn + 5);
path_append_filename(temp, asset_path->path, fn + 7);
if (plat_file_check(temp))
return 1;