move sys_sleep to platform.c

This commit is contained in:
fgsfds 2021-11-26 03:29:37 +03:00
parent b5f50dd975
commit 2a312a8f68
3 changed files with 9 additions and 5 deletions

View File

@ -112,11 +112,6 @@ const SDL_Scancode scancode_rmapping_nonextended[][2] = {
#define IS_FULLSCREEN() ((SDL_GetWindowFlags(wnd) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0)
static inline void sys_sleep(const uint64_t us) {
// TODO: not everything has usleep()
usleep(us);
}
static void gfx_sdl_set_fullscreen(void) {
if (configWindow.reset)
configWindow.fullscreen = false;

View File

@ -4,10 +4,12 @@
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include "cliopts.h"
#include "fs/fs.h"
#include "configfile.h"
#include "platform.h"
/* NULL terminated list of platform specific read-only data paths */
/* priority is top first */
@ -66,6 +68,11 @@ const char *sys_file_name(const char *fpath) {
return sep + 1;
}
void sys_sleep(const uint64_t us) {
// TODO: figure out which of the platforms we want to support DOESN'T have usleep()
usleep(us);
}
/* this calls a platform-specific impl function after forming the error message */
static void sys_fatal_impl(const char *msg) __attribute__ ((noreturn));

View File

@ -2,6 +2,7 @@
#define _SM64_PLATFORM_H_
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@ -16,6 +17,7 @@ extern const char *sys_ropaths[];
char *sys_strdup(const char *src);
char *sys_strlwr(char *src);
int sys_strcasecmp(const char *s1, const char *s2);
void sys_sleep(const uint64_t us);
// path stuff
const char *sys_user_path(void);