mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 01:25:33 -07:00
Clean up plat.h a bit
This commit is contained in:
32
src/86box.c
32
src/86box.c
@@ -91,7 +91,9 @@
|
||||
#include <86box/snd_speaker.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/version.h>
|
||||
#include <86box/gdbstub.h>
|
||||
|
||||
@@ -411,14 +413,14 @@ pc_init(int argc, char *argv[])
|
||||
|
||||
/* Grab the executable's full path. */
|
||||
plat_get_exe_name(exe_path, sizeof(exe_path)-1);
|
||||
p = plat_get_filename(exe_path);
|
||||
p = path_get_filename(exe_path);
|
||||
*p = '\0';
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
/* Grab the actual path if we are an AppImage. */
|
||||
appimage = getenv("APPIMAGE");
|
||||
if (appimage && (appimage[0] != '\0')) {
|
||||
plat_get_dirname(exe_path, appimage);
|
||||
path_get_dirname(exe_path, appimage);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -557,8 +559,8 @@ usage:
|
||||
|
||||
if (c != argc) goto usage;
|
||||
|
||||
plat_path_slash(usr_path);
|
||||
plat_path_slash(rom_path);
|
||||
path_slash(usr_path);
|
||||
path_slash(rom_path);
|
||||
|
||||
/*
|
||||
* If the user provided a path for files, use that
|
||||
@@ -567,7 +569,7 @@ usage:
|
||||
* make it absolute.
|
||||
*/
|
||||
if (ppath != NULL) {
|
||||
if (! plat_path_abs(ppath)) {
|
||||
if (! path_abs(ppath)) {
|
||||
/*
|
||||
* This looks like a relative path.
|
||||
*
|
||||
@@ -590,11 +592,11 @@ usage:
|
||||
}
|
||||
|
||||
// Add the VM-local ROM path.
|
||||
plat_append_filename(temp, usr_path, "roms");
|
||||
path_append_filename(temp, usr_path, "roms");
|
||||
rom_add_path(temp);
|
||||
|
||||
// Add the standard ROM path in the same directory as the executable.
|
||||
plat_append_filename(temp, exe_path, "roms");
|
||||
path_append_filename(temp, exe_path, "roms");
|
||||
rom_add_path(temp);
|
||||
|
||||
plat_init_rom_paths();
|
||||
@@ -606,7 +608,7 @@ usage:
|
||||
* make it absolute.
|
||||
*/
|
||||
if (rpath != NULL) {
|
||||
if (! plat_path_abs(rpath)) {
|
||||
if (! path_abs(rpath)) {
|
||||
/*
|
||||
* This looks like a relative path.
|
||||
*
|
||||
@@ -641,7 +643,7 @@ usage:
|
||||
* This can happen when people load a config
|
||||
* file using the UI, for example.
|
||||
*/
|
||||
p = plat_get_filename(cfg);
|
||||
p = path_get_filename(cfg);
|
||||
if (cfg != p) {
|
||||
/*
|
||||
* OK, the configuration file name has a
|
||||
@@ -656,19 +658,19 @@ usage:
|
||||
* Otherwise, assume the pathname given is
|
||||
* relative to whatever the usr_path is.
|
||||
*/
|
||||
if (plat_path_abs(cfg))
|
||||
if (path_abs(cfg))
|
||||
strcpy(usr_path, cfg);
|
||||
else
|
||||
strcat(usr_path, cfg);
|
||||
}
|
||||
|
||||
/* Make sure we have a trailing backslash. */
|
||||
plat_path_slash(usr_path);
|
||||
path_slash(usr_path);
|
||||
if (rom_path[0] != '\0')
|
||||
plat_path_slash(rom_path);
|
||||
path_slash(rom_path);
|
||||
|
||||
/* At this point, we can safely create the full path name. */
|
||||
plat_append_filename(cfg_path, usr_path, p);
|
||||
path_append_filename(cfg_path, usr_path, p);
|
||||
|
||||
/*
|
||||
* Get the current directory's name
|
||||
@@ -679,8 +681,8 @@ usage:
|
||||
*/
|
||||
if (strlen(vm_name) == 0) {
|
||||
char ltemp[1024] = { '\0'};
|
||||
plat_get_dirname(ltemp, usr_path);
|
||||
strcpy(vm_name, plat_get_filename(ltemp));
|
||||
path_get_dirname(ltemp, usr_path);
|
||||
strcpy(vm_name, path_get_filename(ltemp));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/scsi_device.h>
|
||||
#include <86box/cdrom_image_backend.h>
|
||||
@@ -286,7 +287,7 @@ cdrom_image_open(cdrom_t *dev, const char *fn)
|
||||
return image_open_abort(dev);
|
||||
|
||||
/* All good, reset state. */
|
||||
if (! strcasecmp(plat_get_extension((char *) fn), "ISO"))
|
||||
if (! strcasecmp(path_get_extension((char *) fn), "ISO"))
|
||||
dev->cd_status = CD_STATUS_DATA_ONLY;
|
||||
else
|
||||
dev->cd_status = CD_STATUS_STOPPED;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/cdrom_image_backend.h>
|
||||
|
||||
@@ -831,7 +832,7 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile)
|
||||
|
||||
/* Get a copy of the filename into pathname, we need it later. */
|
||||
memset(pathname, 0, MAX_FILENAME_LENGTH * sizeof(char));
|
||||
plat_get_dirname(pathname, cuefile);
|
||||
path_get_dirname(pathname, cuefile);
|
||||
|
||||
/* Open the file. */
|
||||
fp = plat_fopen(cuefile, "r");
|
||||
@@ -986,7 +987,7 @@ cdi_load_cue(cd_img_t *cdi, const char *cuefile)
|
||||
|
||||
if (!strcmp(type, "BINARY")) {
|
||||
memset(temp, 0, MAX_FILENAME_LENGTH * sizeof(char));
|
||||
plat_append_filename(filename, pathname, ansi);
|
||||
path_append_filename(filename, pathname, ansi);
|
||||
trk.file = track_file_init(filename, &error);
|
||||
}
|
||||
if (error) {
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <86box/midi.h>
|
||||
#include <86box/snd_mpu401.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dir.h>
|
||||
#include <86box/ui.h>
|
||||
@@ -1422,12 +1423,12 @@ load_hard_disks(void)
|
||||
wcsncpy(hdd[c].fn, &wp[wcslen(usr_path)], sizeof_w(hdd[c].fn));
|
||||
} else
|
||||
#endif
|
||||
if (plat_path_abs(p)) {
|
||||
if (path_abs(p)) {
|
||||
strncpy(hdd[c].fn, p, sizeof(hdd[c].fn) - 1);
|
||||
} else {
|
||||
plat_append_filename(hdd[c].fn, usr_path, p);
|
||||
path_append_filename(hdd[c].fn, usr_path, p);
|
||||
}
|
||||
plat_path_normalize(hdd[c].fn);
|
||||
path_normalize(hdd[c].fn);
|
||||
|
||||
/* If disk is empty or invalid, mark it for deletion. */
|
||||
if (! hdd_is_valid(c)) {
|
||||
@@ -2841,7 +2842,7 @@ save_hard_disks(void)
|
||||
|
||||
sprintf(temp, "hdd_%02i_fn", c+1);
|
||||
if (hdd_is_valid(c) && (strlen(hdd[c].fn) != 0)) {
|
||||
plat_path_normalize(hdd[c].fn);
|
||||
path_normalize(hdd[c].fn);
|
||||
if (!strnicmp(hdd[c].fn, usr_path, strlen(usr_path)))
|
||||
config_set_string(cat, temp, &hdd[c].fn[strlen(usr_path)]);
|
||||
else
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <errno.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/random.h>
|
||||
#include <86box/hdd.h>
|
||||
@@ -76,7 +77,7 @@ hdd_image_log(const char *fmt, ...)
|
||||
int
|
||||
image_is_hdi(const char *s)
|
||||
{
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "HDI"))
|
||||
if (! strcasecmp(path_get_extension((char *) s), "HDI"))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
@@ -90,7 +91,7 @@ image_is_hdx(const char *s, int check_signature)
|
||||
uint64_t filelen;
|
||||
uint64_t signature;
|
||||
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "HDX")) {
|
||||
if (! strcasecmp(path_get_extension((char *) s), "HDX")) {
|
||||
if (check_signature) {
|
||||
f = plat_fopen(s, "rb");
|
||||
if (!f)
|
||||
@@ -124,7 +125,7 @@ image_is_vhd(const char *s, int check_signature)
|
||||
{
|
||||
FILE* f;
|
||||
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "VHD")) {
|
||||
if (! strcasecmp(path_get_extension((char *) s), "VHD")) {
|
||||
if (check_signature) {
|
||||
f = plat_fopen(s, "rb");
|
||||
if (!f)
|
||||
@@ -251,7 +252,7 @@ hdd_image_load(int id)
|
||||
|
||||
memset(empty_sector, 0, sizeof(empty_sector));
|
||||
if (fn) {
|
||||
plat_path_normalize(fn);
|
||||
path_normalize(fn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/scsi_device.h>
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/hdc.h>
|
||||
@@ -332,7 +333,7 @@ mo_load_abort(mo_t *dev)
|
||||
int
|
||||
image_is_mdi(const char *s)
|
||||
{
|
||||
if (! strcasecmp(plat_get_extension((char *) s), "MDI"))
|
||||
if (! strcasecmp(path_get_extension((char *) s), "MDI"))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/fdd.h>
|
||||
@@ -485,7 +486,7 @@ fdd_load(int drive, char *fn)
|
||||
|
||||
if (!fn)
|
||||
return;
|
||||
p = plat_get_extension(fn);
|
||||
p = path_get_extension(fn);
|
||||
if (!p)
|
||||
return;
|
||||
f = plat_fopen(fn, "rb");
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/86box.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdd_86f.h>
|
||||
@@ -644,7 +645,7 @@ img_load(int drive, char *fn)
|
||||
int size;
|
||||
int i;
|
||||
|
||||
ext = plat_get_extension(fn);
|
||||
ext = path_get_extension(fn);
|
||||
|
||||
d86f_unregister(drive);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/gdbstub.h>
|
||||
|
||||
#define FAST_RESPONSE(s) \
|
||||
|
||||
7
src/include/86box/path.h
Normal file
7
src/include/86box/path.h
Normal file
@@ -0,0 +1,7 @@
|
||||
extern void path_get_dirname(char *dest, const char *path);
|
||||
extern char *path_get_filename(char *s);
|
||||
extern char *path_get_extension(char *s);
|
||||
extern void path_append_filename(char *dest, const char *s1, const char *s2);
|
||||
extern void path_slash(char *path);
|
||||
extern void path_normalize(char *path);
|
||||
extern int path_abs(char *path);
|
||||
@@ -105,15 +105,6 @@ extern int plat_chdir(char *path);
|
||||
extern void plat_tempfile(char *bufp, char *prefix, char *suffix);
|
||||
extern void plat_get_exe_name(char *s, int size);
|
||||
extern void plat_init_rom_paths();
|
||||
extern char *plat_get_basename(const char *path);
|
||||
extern void plat_get_dirname(char *dest, const char *path);
|
||||
extern char *plat_get_filename(char *s);
|
||||
extern char *plat_get_extension(char *s);
|
||||
extern void plat_append_filename(char *dest, const char *s1, const char *s2);
|
||||
extern void plat_put_backslash(char *s);
|
||||
extern void plat_path_slash(char *path);
|
||||
extern void plat_path_normalize(char *path);
|
||||
extern int plat_path_abs(char *path);
|
||||
extern int plat_dir_check(char *path);
|
||||
extern int plat_dir_create(char *path);
|
||||
extern void *plat_mmap(size_t size, uint8_t executable);
|
||||
@@ -169,47 +160,6 @@ extern int ioctl_open(uint8_t id, char d);
|
||||
extern void ioctl_reset(uint8_t id);
|
||||
extern void ioctl_close(uint8_t id);
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define thread_t plat_thread_t
|
||||
#define event_t plat_event_t
|
||||
#define mutex_t plat_mutex_t
|
||||
|
||||
#define thread_create plat_thread_create
|
||||
#define thread_wait plat_thread_wait
|
||||
#define thread_create_event plat_thread_create_event
|
||||
#define thread_set_event plat_thread_set_event
|
||||
#define thread_reset_event plat_thread_reset_event
|
||||
#define thread_wait_event plat_thread_wait_event
|
||||
#define thread_destroy_event plat_thread_destroy_event
|
||||
|
||||
#define thread_create_mutex plat_thread_create_mutex
|
||||
#define thread_create_mutex_with_spin_count plat_thread_create_mutex_with_spin_count
|
||||
#define thread_close_mutex plat_thread_close_mutex
|
||||
#define thread_wait_mutex plat_thread_wait_mutex
|
||||
#define thread_release_mutex plat_thread_release_mutex
|
||||
#endif
|
||||
|
||||
/* Thread support. */
|
||||
typedef void thread_t;
|
||||
typedef void event_t;
|
||||
typedef void mutex_t;
|
||||
|
||||
extern thread_t *thread_create(void (*thread_func)(void *param), void *param);
|
||||
extern int thread_wait(thread_t *arg);
|
||||
extern event_t *thread_create_event(void);
|
||||
extern void thread_set_event(event_t *arg);
|
||||
extern void thread_reset_event(event_t *arg);
|
||||
extern int thread_wait_event(event_t *arg, int timeout);
|
||||
extern void thread_destroy_event(event_t *arg);
|
||||
|
||||
#define MUTEX_DEFAULT_SPIN_COUNT 1024
|
||||
|
||||
extern mutex_t *thread_create_mutex(void);
|
||||
extern void thread_close_mutex(mutex_t *arg);
|
||||
extern int thread_test_mutex(mutex_t *arg);
|
||||
extern int thread_wait_mutex(mutex_t *arg);
|
||||
extern int thread_release_mutex(mutex_t *mutex);
|
||||
|
||||
/* Other stuff. */
|
||||
extern void startblit(void);
|
||||
extern void endblit(void);
|
||||
|
||||
46
src/include/86box/thread.h
Normal file
46
src/include/86box/thread.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define thread_t plat_thread_t
|
||||
#define event_t plat_event_t
|
||||
#define mutex_t plat_mutex_t
|
||||
|
||||
#define thread_create plat_thread_create
|
||||
#define thread_wait plat_thread_wait
|
||||
#define thread_create_event plat_thread_create_event
|
||||
#define thread_set_event plat_thread_set_event
|
||||
#define thread_reset_event plat_thread_reset_event
|
||||
#define thread_wait_event plat_thread_wait_event
|
||||
#define thread_destroy_event plat_thread_destroy_event
|
||||
|
||||
#define thread_create_mutex plat_thread_create_mutex
|
||||
#define thread_create_mutex_with_spin_count plat_thread_create_mutex_with_spin_count
|
||||
#define thread_close_mutex plat_thread_close_mutex
|
||||
#define thread_wait_mutex plat_thread_wait_mutex
|
||||
#define thread_release_mutex plat_thread_release_mutex
|
||||
#endif
|
||||
|
||||
/* Thread support. */
|
||||
typedef void thread_t;
|
||||
typedef void event_t;
|
||||
typedef void mutex_t;
|
||||
|
||||
extern thread_t *thread_create(void (*thread_func)(void *param), void *param);
|
||||
extern int thread_wait(thread_t *arg);
|
||||
extern event_t *thread_create_event(void);
|
||||
extern void thread_set_event(event_t *arg);
|
||||
extern void thread_reset_event(event_t *arg);
|
||||
extern int thread_wait_event(event_t *arg, int timeout);
|
||||
extern void thread_destroy_event(event_t *arg);
|
||||
|
||||
extern mutex_t *thread_create_mutex(void);
|
||||
extern void thread_close_mutex(mutex_t *arg);
|
||||
extern int thread_test_mutex(mutex_t *arg);
|
||||
extern int thread_wait_mutex(mutex_t *arg);
|
||||
extern int thread_release_mutex(mutex_t *mutex);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -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);
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/network.h>
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/timer.h>
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/net_3c503.h>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <86box/machine.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/nvr.h>
|
||||
|
||||
@@ -213,7 +214,7 @@ nvr_path(char *str)
|
||||
plat_dir_create(temp);
|
||||
|
||||
/* Now append the actual filename. */
|
||||
plat_path_slash(temp);
|
||||
path_slash(temp);
|
||||
strcat(temp, str);
|
||||
|
||||
return(temp);
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/pit.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/ui.h>
|
||||
@@ -596,7 +597,7 @@ update_font(escp_t *dev)
|
||||
|
||||
/* Create a full pathname for the ROM file. */
|
||||
strcpy(path, dev->fontpath);
|
||||
plat_path_slash(path);
|
||||
path_slash(path);
|
||||
strcat(path, fn);
|
||||
|
||||
escp_log("Temp file=%s\n", path);
|
||||
@@ -2062,14 +2063,14 @@ escp_init(void *lpt)
|
||||
}
|
||||
|
||||
strcpy(dev->fontpath, exe_path);
|
||||
plat_path_slash(dev->fontpath);
|
||||
path_slash(dev->fontpath);
|
||||
strcat(dev->fontpath, "roms/printer/fonts/");
|
||||
|
||||
/* Create the full path for the page images. */
|
||||
plat_append_filename(dev->pagepath, usr_path, "printer");
|
||||
path_append_filename(dev->pagepath, usr_path, "printer");
|
||||
if (! plat_dir_check(dev->pagepath))
|
||||
plat_dir_create(dev->pagepath);
|
||||
plat_path_slash(dev->pagepath);
|
||||
path_slash(dev->pagepath);
|
||||
|
||||
dev->page_width = PAGE_WIDTH;
|
||||
dev->page_height = PAGE_HEIGHT;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <86box/lpt.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/pit.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/ui.h>
|
||||
@@ -152,7 +153,7 @@ convert_to_pdf(ps_t *dev)
|
||||
char input_fn[1024], output_fn[1024], *gsargv[9];
|
||||
|
||||
strcpy(input_fn, dev->printer_path);
|
||||
plat_path_slash(input_fn);
|
||||
path_slash(input_fn);
|
||||
strcat(input_fn, dev->filename);
|
||||
|
||||
strcpy(output_fn, input_fn);
|
||||
@@ -206,7 +207,7 @@ write_buffer(ps_t *dev, bool finish)
|
||||
plat_tempfile(dev->filename, NULL, ".ps");
|
||||
|
||||
strcpy(path, dev->printer_path);
|
||||
plat_path_slash(path);
|
||||
path_slash(path);
|
||||
strcat(path, dev->filename);
|
||||
|
||||
fp = plat_fopen(path, "a");
|
||||
@@ -365,10 +366,10 @@ ps_init(void *lpt)
|
||||
|
||||
/* Cache print folder path. */
|
||||
memset(dev->printer_path, 0x00, sizeof(dev->printer_path));
|
||||
plat_append_filename(dev->printer_path, usr_path, "printer");
|
||||
path_append_filename(dev->printer_path, usr_path, "printer");
|
||||
if (!plat_dir_check(dev->printer_path))
|
||||
plat_dir_create(dev->printer_path);
|
||||
plat_path_slash(dev->printer_path);
|
||||
path_slash(dev->printer_path);
|
||||
|
||||
timer_add(&dev->pulse_timer, pulse_timer, dev, 0);
|
||||
timer_add(&dev->timeout_timer, timeout_timer, dev, 0);
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/pit.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/lpt.h>
|
||||
#include <86box/printer.h>
|
||||
@@ -150,10 +151,10 @@ dump_page(prnt_t *dev)
|
||||
|
||||
/* Create the full path for this file. */
|
||||
memset(path, 0x00, sizeof(path));
|
||||
plat_append_filename(path, usr_path, "printer");
|
||||
path_append_filename(path, usr_path, "printer");
|
||||
if (! plat_dir_check(path))
|
||||
plat_dir_create(path);
|
||||
plat_path_slash(path);
|
||||
path_slash(path);
|
||||
strcat(path, dev->filename);
|
||||
|
||||
/* Create the file. */
|
||||
|
||||
@@ -88,6 +88,7 @@ extern "C" {
|
||||
#include <86box/gameport.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
@@ -140,7 +141,7 @@ void plat_get_exe_name(char *s, int size)
|
||||
|
||||
memcpy(s, exepath_temp.data(), std::min((qsizetype)exepath_temp.size(),(qsizetype)size));
|
||||
|
||||
plat_path_slash(s);
|
||||
path_slash(s);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -188,14 +189,14 @@ plat_getcwd(char *bufp, int max)
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_dirname(char *dest, const char *path)
|
||||
path_get_dirname(char *dest, const char *path)
|
||||
{
|
||||
QFileInfo fi(path);
|
||||
CharPointer(dest, -1) = fi.dir().path().toUtf8();
|
||||
}
|
||||
|
||||
char *
|
||||
plat_get_extension(char *s)
|
||||
path_get_extension(char *s)
|
||||
{
|
||||
auto len = strlen(s);
|
||||
auto idx = QByteArray::fromRawData(s, len).lastIndexOf('.');
|
||||
@@ -206,7 +207,7 @@ plat_get_extension(char *s)
|
||||
}
|
||||
|
||||
char *
|
||||
plat_get_filename(char *s)
|
||||
path_get_filename(char *s)
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
int c = strlen(s) - 1;
|
||||
@@ -228,7 +229,7 @@ plat_get_filename(char *s)
|
||||
}
|
||||
|
||||
int
|
||||
plat_path_abs(char *path)
|
||||
path_abs(char *path)
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/'))
|
||||
@@ -241,7 +242,7 @@ plat_path_abs(char *path)
|
||||
}
|
||||
|
||||
void
|
||||
plat_path_normalize(char* path)
|
||||
path_normalize(char* path)
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
while (*path++ != 0)
|
||||
@@ -252,7 +253,7 @@ plat_path_normalize(char* path)
|
||||
}
|
||||
|
||||
void
|
||||
plat_path_slash(char *path)
|
||||
path_slash(char *path)
|
||||
{
|
||||
auto len = strlen(path);
|
||||
auto separator = '/';
|
||||
@@ -260,14 +261,14 @@ plat_path_slash(char *path)
|
||||
path[len] = separator;
|
||||
path[len+1] = 0;
|
||||
}
|
||||
plat_path_normalize(path);
|
||||
path_normalize(path);
|
||||
}
|
||||
|
||||
void
|
||||
plat_append_filename(char *dest, const char *s1, const char *s2)
|
||||
path_append_filename(char *dest, const char *s1, const char *s2)
|
||||
{
|
||||
strcpy(dest, s1);
|
||||
plat_path_slash(dest);
|
||||
path_slash(dest);
|
||||
strcat(dest, s2);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# include <86box/midi.h>
|
||||
# include <86box/plat.h>
|
||||
# include <86box/plat_dynld.h>
|
||||
# include <86box/thread.h>
|
||||
# include <86box/sound.h>
|
||||
# include <86box/ui.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/midi.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/ui.h>
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/machine.h>
|
||||
#include <86box/midi.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/snd_ac97.h>
|
||||
#include <86box/snd_azt2316a.h>
|
||||
#include <86box/timer.h>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <condition_variable>
|
||||
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
|
||||
struct event_cpp11_t
|
||||
{
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/mouse.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/gameport.h>
|
||||
#include <86box/unix_sdl.h>
|
||||
@@ -293,24 +295,24 @@ plat_fopen64(const char *path, const char *mode)
|
||||
}
|
||||
|
||||
int
|
||||
plat_path_abs(char *path)
|
||||
path_abs(char *path)
|
||||
{
|
||||
return path[0] == '/';
|
||||
}
|
||||
|
||||
void
|
||||
plat_path_normalize(char* path)
|
||||
path_normalize(char* path)
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
|
||||
void
|
||||
plat_path_slash(char *path)
|
||||
path_slash(char *path)
|
||||
{
|
||||
if ((path[strlen(path)-1] != '/')) {
|
||||
strcat(path, "/");
|
||||
}
|
||||
plat_path_normalize(path);
|
||||
path_normalize(path);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -337,7 +339,7 @@ plat_get_basename(const char *path)
|
||||
return((char *)path);
|
||||
}
|
||||
char *
|
||||
plat_get_filename(char *s)
|
||||
path_get_filename(char *s)
|
||||
{
|
||||
int c = strlen(s) - 1;
|
||||
|
||||
@@ -352,7 +354,7 @@ plat_get_filename(char *s)
|
||||
|
||||
|
||||
char *
|
||||
plat_get_extension(char *s)
|
||||
path_get_extension(char *s)
|
||||
{
|
||||
int c = strlen(s) - 1;
|
||||
|
||||
@@ -370,10 +372,10 @@ plat_get_extension(char *s)
|
||||
|
||||
|
||||
void
|
||||
plat_append_filename(char *dest, const char *s1, const char *s2)
|
||||
path_append_filename(char *dest, const char *s1, const char *s2)
|
||||
{
|
||||
strcpy(dest, s1);
|
||||
plat_path_slash(dest);
|
||||
path_slash(dest);
|
||||
strcat(dest, s2);
|
||||
}
|
||||
|
||||
@@ -485,7 +487,7 @@ ui_sb_update_text()
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_dirname(char *dest, const char *path)
|
||||
path_get_dirname(char *dest, const char *path)
|
||||
{
|
||||
int c = (int)strlen(path);
|
||||
char *ptr;
|
||||
@@ -758,7 +760,7 @@ plat_init_rom_paths()
|
||||
if (getenv("XDG_DATA_HOME")) {
|
||||
char xdg_rom_path[1024] = { 0 };
|
||||
strncpy(xdg_rom_path, getenv("XDG_DATA_HOME"), 1024);
|
||||
plat_path_slash(xdg_rom_path);
|
||||
path_slash(xdg_rom_path);
|
||||
strncat(xdg_rom_path, "86Box/", 1024);
|
||||
|
||||
if (!plat_dir_check(xdg_rom_path))
|
||||
@@ -791,7 +793,7 @@ plat_init_rom_paths()
|
||||
while ((cur_xdg_rom_path = local_strsep(&xdg_rom_paths, ";")) != NULL) {
|
||||
char real_xdg_rom_path[1024] = { '\0' };
|
||||
strcat(real_xdg_rom_path, cur_xdg_rom_path);
|
||||
plat_path_slash(real_xdg_rom_path);
|
||||
path_slash(real_xdg_rom_path);
|
||||
strcat(real_xdg_rom_path, "86Box/roms/");
|
||||
rom_add_path(real_xdg_rom_path);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
|
||||
|
||||
typedef struct event_pthread_t
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <86box/pci.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/vid_ddc.h>
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/pit.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_pgc.h>
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/dma.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/vid_ddc.h>
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/pit.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_cga.h>
|
||||
#include <86box/vid_pgc.h>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <86box/pci.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/vid_ddc.h>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <86box/rom.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/vid_ddc.h>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/vid_ddc.h>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
#include <86box/vid_voodoo_common.h>
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
#include <86box/rom.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_svga.h>
|
||||
|
||||
@@ -404,12 +406,12 @@ video_screenshot(uint32_t *buf, int start_x, int start_y, int row_len)
|
||||
memset(fn, 0, sizeof(fn));
|
||||
memset(path, 0, sizeof(path));
|
||||
|
||||
plat_append_filename(path, usr_path, SCREENSHOT_PATH);
|
||||
path_append_filename(path, usr_path, SCREENSHOT_PATH);
|
||||
|
||||
if (! plat_dir_check(path))
|
||||
plat_dir_create(path);
|
||||
|
||||
plat_path_slash(path);
|
||||
path_slash(path);
|
||||
|
||||
plat_tempfile(fn, NULL, ".png");
|
||||
strcat(path, fn);
|
||||
|
||||
@@ -47,8 +47,10 @@
|
||||
#include <86box/video.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/path.h>
|
||||
#define GLOBAL
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/ui.h>
|
||||
#ifdef USE_VNC
|
||||
# include <86box/vnc.h>
|
||||
@@ -736,14 +738,14 @@ plat_remove(char *path)
|
||||
}
|
||||
|
||||
void
|
||||
plat_path_normalize(char* path)
|
||||
path_normalize(char* path)
|
||||
{
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
/* Make sure a path ends with a trailing (back)slash. */
|
||||
void
|
||||
plat_path_slash(char *path)
|
||||
path_slash(char *path)
|
||||
{
|
||||
if ((path[strlen(path)-1] != '\\') &&
|
||||
(path[strlen(path)-1] != '/')) {
|
||||
@@ -754,7 +756,7 @@ plat_path_slash(char *path)
|
||||
|
||||
/* Check if the given path is absolute or not. */
|
||||
int
|
||||
plat_path_abs(char *path)
|
||||
path_abs(char *path)
|
||||
{
|
||||
if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/'))
|
||||
return(1);
|
||||
@@ -781,7 +783,7 @@ plat_get_basename(const char *path)
|
||||
|
||||
/* Return the 'directory' element of a pathname. */
|
||||
void
|
||||
plat_get_dirname(char *dest, const char *path)
|
||||
path_get_dirname(char *dest, const char *path)
|
||||
{
|
||||
int c = (int)strlen(path);
|
||||
char *ptr;
|
||||
@@ -804,7 +806,7 @@ plat_get_dirname(char *dest, const char *path)
|
||||
|
||||
|
||||
char *
|
||||
plat_get_filename(char *s)
|
||||
path_get_filename(char *s)
|
||||
{
|
||||
int c = strlen(s) - 1;
|
||||
|
||||
@@ -819,7 +821,7 @@ plat_get_filename(char *s)
|
||||
|
||||
|
||||
char *
|
||||
plat_get_extension(char *s)
|
||||
path_get_extension(char *s)
|
||||
{
|
||||
int c = strlen(s) - 1;
|
||||
|
||||
@@ -837,10 +839,10 @@ plat_get_extension(char *s)
|
||||
|
||||
|
||||
void
|
||||
plat_append_filename(char *dest, const char *s1, const char *s2)
|
||||
path_append_filename(char *dest, const char *s1, const char *s2)
|
||||
{
|
||||
strcpy(dest, s1);
|
||||
plat_path_slash(dest);
|
||||
path_slash(dest);
|
||||
strcat(dest, s2);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/path.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/win.h>
|
||||
@@ -116,10 +117,10 @@ void win_get_icons_path(char* path_root)
|
||||
if (rom_path[0])
|
||||
strcpy(roms_root, rom_path);
|
||||
else
|
||||
plat_append_filename(roms_root, exe_path, "roms");
|
||||
path_append_filename(roms_root, exe_path, "roms");
|
||||
|
||||
plat_append_filename(path_root, roms_root, "icons");
|
||||
plat_path_slash(path_root);
|
||||
path_append_filename(path_root, roms_root, "icons");
|
||||
path_slash(path_root);
|
||||
}
|
||||
|
||||
void win_load_icon_set()
|
||||
@@ -137,13 +138,13 @@ void win_load_icon_set()
|
||||
|
||||
win_get_icons_path(path_root);
|
||||
strcat(path_root, icon_set);
|
||||
plat_path_slash(path_root);
|
||||
path_slash(path_root);
|
||||
|
||||
int i, count = sizeof(icon_files) / sizeof(_ICON_DATA),
|
||||
x = win_get_system_metrics(SM_CXSMICON, dpi), y = win_get_system_metrics(SM_CYSMICON, dpi);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
plat_append_filename(temp, path_root, icon_files[i].filename);
|
||||
path_append_filename(temp, path_root, icon_files[i].filename);
|
||||
mbstoc16s(wtemp, temp, strlen(temp) + 1);
|
||||
|
||||
HICON ictemp;
|
||||
|
||||
@@ -54,6 +54,7 @@ typedef LONG atomic_flag;
|
||||
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/win.h>
|
||||
#include <86box/language.h>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/thread.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user