forked from libretro/gpsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
114 lines (90 loc) · 2.54 KB
/
main.h
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
/* gameplaySP
*
* Copyright (C) 2006 Exophase <exophase@gmail.com>
*
* 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 02110-1301 USA
*/
#ifndef MAIN_H
#define MAIN_H
#include <stdio.h>
#define TIMER_INACTIVE 0
#define TIMER_PRESCALE 1
#define TIMER_CASCADE 2
#define TIMER_NO_IRQ 0
#define TIMER_TRIGGER_IRQ 1
#define TIMER_DS_CHANNEL_NONE 0
#define TIMER_DS_CHANNEL_A 1
#define TIMER_DS_CHANNEL_B 2
#define TIMER_DS_CHANNEL_BOTH 3
typedef struct
{
s32 count;
u32 reload;
u32 prescale;
fixed8_24 frequency_step;
u32 direct_sound_channels;
u32 irq;
u32 status;
} timer_type;
typedef enum
{
no_frameskip = 0,
auto_frameskip,
auto_threshold_frameskip,
fixed_interval_frameskip
} frameskip_type;
typedef enum
{
auto_detect = 0,
builtin_bios,
official_bios
} bios_type;
typedef enum
{
boot_game = 0,
boot_bios
} boot_mode;
extern u32 gbc_update_count;
extern u32 frame_counter;
extern u32 cpu_ticks;
extern u32 execute_cycles;
extern u32 skip_next_frame;
extern u32 flush_ram_count;
extern char main_path[512];
u16 rand_gen();
void rand_seed(u32 data);
#define cycles_to_run(c) ((c) & 0x7FFF)
#define completed_frame(c) ((c) & 0x80000000)
u32 function_cc update_gba(int remaining_cycles);
void reset_gba(void);
void init_main(void);
void game_name_ext(char *src, char *buffer, char *extension);
bool main_check_savestate(const u8 *src);
unsigned main_write_savestate(u8* ptr);
bool main_read_savestate(const u8 *src);
extern u32 num_skipped_frames;
extern int dynarec_enable;
extern boot_mode selected_boot_mode;
extern int sprite_limit;
#ifdef TRACE_REGISTERS
void print_regs(void);
#endif
#ifdef TRACE_EVENTS
#define trace_update_gba(remcyc) \
printf("update_gba: %d remaining cycles\n", (remcyc));
#else /* TRACE_EVENTS */
#define trace_update_gba(x)
#endif
#endif