aboutsummaryrefslogtreecommitdiff
path: root/main.h
blob: cf6025e54e0cee13c705ba18f688182cf0755e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef __MAIN_H__
#define __MAIN_H__

#include <stdbool.h>
#include <string.h>
#include "options.h"
#include "libretro.h"

#define MAX_PATH 512

typedef enum {
  EACTION_NONE = 0,
  EACTION_MENU,
  EACTION_TOGGLE_FPS,
  EACTION_TOGGLE_FF,
  EACTION_SAVE_STATE,
  EACTION_LOAD_STATE,
  EACTION_SCREENSHOT,
  EACTION_QUIT,
} emu_action;

extern bool should_quit;
extern unsigned current_audio_buffer_size;
extern char core_name[MAX_PATH];
extern char* content_path;
extern int config_override;

#ifdef MMENU
extern void* mmenu;
extern char save_template_path[MAX_PATH];
#endif


#define MAX(a, b) (a) > (b) ? (a) : (b)
#define MIN(a, b) (a) < (b) ? (a) : (b)

static inline bool has_suffix_i(const char *str, const char *suffix) {
	const char *p = strrchr(str, suffix[0]);
	if (!p) p = str;
	return !strcasecmp(p, suffix);
}

#define array_size(x) (sizeof(x) / sizeof(x[0]))

#ifdef DEBUG_LOGGING
#define PA_DEBUG(...) pa_log(RETRO_LOG_DEBUG, __VA_ARGS__)
#else
#define PA_DEBUG(...)
#endif

#define PA_INFO(...) pa_log(RETRO_LOG_INFO, __VA_ARGS__)
#define PA_WARN(...) pa_log(RETRO_LOG_WARN, __VA_ARGS__)
#define PA_ERROR(...) pa_log(RETRO_LOG_ERROR, __VA_ARGS__)
#define PA_FATAL(...) do { pa_log(RETRO_LOG_ERROR, __VA_ARGS__); quit(-1); } while(0)

int screenshot(void);

void set_defaults(void);
int save_config(int is_game);
void load_config(void);
int remove_config(int is_game);

void handle_emu_action(emu_action action);
void pa_log(enum retro_log_level level, const char *fmt, ...);
void pa_track_render(void);
int quit(int code);

#endif /* __MAIN_H__ */