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

@@ -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);
}

View File

@@ -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;

View File

@@ -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>

View File

@@ -29,6 +29,7 @@
#include <wchar.h>
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/thread.h>
typedef struct {