2020-05-25 06:17:10 +02:00
|
|
|
#ifndef _SM64_PLATFORM_H_
|
|
|
|
#define _SM64_PLATFORM_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2020-05-25 23:54:51 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2020-05-25 06:17:10 +02:00
|
|
|
|
|
|
|
/* Platform-specific functions and whatnot */
|
|
|
|
|
|
|
|
#define DATADIR "res"
|
|
|
|
#define SYS_MAX_PATH 1024 // FIXME: define this on different platforms
|
|
|
|
|
2020-05-25 23:54:51 +02:00
|
|
|
// crossplatform impls of misc stuff
|
|
|
|
char *sys_strdup(const char *src);
|
|
|
|
char *sys_strlwr(char *src);
|
|
|
|
int sys_strcasecmp(const char *s1, const char *s2);
|
|
|
|
|
|
|
|
// filesystem stuff
|
2020-05-25 06:17:10 +02:00
|
|
|
bool sys_mkdir(const char *name); // creates with 0777 by default
|
2020-05-25 23:54:51 +02:00
|
|
|
bool sys_file_exists(const char *name);
|
|
|
|
bool sys_dir_exists(const char *name);
|
2020-06-01 11:13:05 +02:00
|
|
|
void *sys_load_res(const char *name);
|
2020-05-25 23:54:51 +02:00
|
|
|
|
|
|
|
// receives the full path
|
|
|
|
// should return `true` if traversal should continue
|
|
|
|
typedef bool (*walk_fn_t)(const char *);
|
|
|
|
// returns `true` if the directory was successfully opened and walk() didn't ever return false
|
|
|
|
bool sys_dir_walk(const char *base, walk_fn_t walk, const bool recur);
|
|
|
|
|
|
|
|
// path stuff
|
2020-05-25 06:17:10 +02:00
|
|
|
const char *sys_data_path(void);
|
|
|
|
const char *sys_save_path(void);
|
|
|
|
const char *sys_exe_path(void);
|
|
|
|
|
|
|
|
#endif // _SM64_PLATFORM_H_
|