aboutsummaryrefslogtreecommitdiff
path: root/frontend/main.h
blob: 56f555cb7cd05d92abd3f14c6e5d6ec8c3e38ca6 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*  Pcsx - Pc Psx Emulator
 *  Copyright (C) 1999-2002  Pcsx Team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA
 */

#ifndef __FRONTEND_MAIN_H__
#define __FRONTEND_MAIN_H__

#include "config.h"

#define MEMCARD_DIR "memcards/"
#define PLUGINS_DIR "plugins/"
#define PLUGINS_CFG_DIR "plugins/cfg/"
#define STATES_DIR "sstates/"
#define CHEATS_DIR "cheats/"
#define PATCHES_DIR "patches/"

extern char cfgfile_basename[MAXPATHLEN];

extern int state_slot;

/* emu_core_preinit - must be the very first call
 * emu_core_init - to be called after platform-specific setup */
int emu_core_preinit(void);
int emu_core_init(void);

void emu_core_ask_exit(void);

void emu_set_default_config(void);
void emu_on_new_cd(int show_hud_msg);

int get_state_filename(char *buf, int size, int i);
int emu_check_state(int slot);
int emu_save_state(int slot);
int emu_load_state(int slot);

void set_cd_image(const char *fname);
void make_path(char *buf, size_t size, const char *dir, const char *fname);

#define MAKE_PATH(buf, dir, fname) \
	make_path(buf, sizeof(buf), dir, fname)

extern unsigned long gpuDisp;
extern int ready_to_go, g_emu_want_quit, g_emu_resetting;

extern char hud_msg[64];
extern int hud_new_msg;

enum sched_action {
	SACTION_NONE,
	SACTION_ENTER_MENU,
	SACTION_LOAD_STATE,
	SACTION_SAVE_STATE,
	SACTION_NEXT_SSLOT,
	SACTION_PREV_SSLOT,
	SACTION_TOGGLE_FSKIP,
	SACTION_SWITCH_DISPMODE,
	SACTION_FAST_FORWARD,
	SACTION_SCREENSHOT,
	SACTION_VOLUME_UP,	// 10
	SACTION_VOLUME_DOWN,
	SACTION_MINIMIZE,
	SACTION_TOGGLE_FPS,
	SACTION_TOGGLE_FULLSCREEN,
	SACTION_GUN_TRIGGER = 16,
	SACTION_GUN_A,
	SACTION_GUN_B,
	SACTION_GUN_TRIGGER2,
};

#define SACTION_GUN_MASK (0x0f << SACTION_GUN_TRIGGER)

#ifdef MENU_SHOULDER_COMBO
int emu_menu_press;
int emu_menu_cancel;
#endif

static inline void emu_set_action(enum sched_action action_)
{
	extern enum sched_action emu_action, emu_action_old;
	extern int stop;

#ifdef MENU_SHOULDER_COMBO
	if (action_ == SACTION_NONE) {
		if (emu_menu_press && !emu_menu_cancel)
			action_ = SACTION_ENTER_MENU;
		emu_menu_press = 0;
		emu_menu_cancel = 0;
	} else if (action_ == SACTION_ENTER_MENU) {
		emu_menu_press = 1;
		action_ = SACTION_NONE;
	}
#endif
	if (action_ == SACTION_NONE)
		emu_action_old = 0;
	else if (action_ != emu_action_old)
		stop = 1;
	emu_action = action_;
}

#endif /* __FRONTEND_MAIN_H__ */