Clean up plat.h a bit

This commit is contained in:
David Hrdlička
2022-04-19 23:06:39 +02:00
parent 366b01fef6
commit e60af6c29d
49 changed files with 184 additions and 131 deletions

View File

@@ -33,6 +33,7 @@
#include "cpu.h"
#include <86box/mem.h>
#include <86box/rom.h>
#include <86box/path.h>
#include <86box/plat.h>
#include <86box/machine.h>
#include <86box/m_xt_xi8088.h>
@@ -76,16 +77,16 @@ rom_add_path(const char* path)
}
// Save the path, turning it into absolute if needed.
if (!plat_path_abs((char*) path)) {
if (!path_abs((char*) path)) {
plat_getcwd(cwd, sizeof(cwd));
plat_path_slash(cwd);
path_slash(cwd);
snprintf(rom_path->path, sizeof(rom_path->path), "%s%s", cwd, path);
} else {
snprintf(rom_path->path, sizeof(rom_path->path), "%s", path);
}
// Ensure the path ends with a separator.
plat_path_slash(rom_path->path);
path_slash(rom_path->path);
}
@@ -99,7 +100,7 @@ rom_fopen(char *fn, char *mode)
if (strstr(fn, "roms/") == fn) {
/* Relative path */
for (rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) {
plat_append_filename(temp, rom_path->path, fn + 5);
path_append_filename(temp, rom_path->path, fn + 5);
if ((fp = plat_fopen(temp, mode)) != NULL) {
return fp;
@@ -123,7 +124,7 @@ rom_getfile(char *fn, char *s, int size)
if (strstr(fn, "roms/") == fn) {
/* Relative path */
for (rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) {
plat_append_filename(temp, rom_path->path, fn + 5);
path_append_filename(temp, rom_path->path, fn + 5);
if (rom_present(temp)) {
strncpy(s, temp, size);