forked from OpenEmu/CrabEmu-Core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
console.h
93 lines (73 loc) · 3.1 KB
/
console.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
/*
This file is part of CrabEmu.
Copyright (C) 2014, 2015, 2016 Lawrence Sebald
CrabEmu is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
CrabEmu 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 CrabEmu; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CONSOLE_H
#define CONSOLE_H
#include "CrabEmu.h"
CLINKAGE
/* All of the consoles that are supported currently. These may eventually go
away if there is ever a push to abstract this even more... */
#define CONSOLE_NULL 0 /* No console */
#define CONSOLE_SMS 1 /* Sega Master System or Mark III */
#define CONSOLE_GG 2 /* Sega Game Gear */
#define CONSOLE_SG1000 3 /* Sega SG-1000 */
#define CONSOLE_SC3000 4 /* Sega SC-3000 */
#define CONSOLE_COLECOVISION 5 /* ColecoVision */
#define CONSOLE_NES 6 /* Nintendo Entertainment System */
/* 7 left blank for now... */
#define CONSOLE_CHIP8 8 /* Chip-8 "Console" */
/* Region codes. */
#define REGION_NONE 0x00
#define REGION_JAPAN 0x01
#define REGION_US 0x02
#define REGION_EUROPE 0x04
/* This structure is meant to provide an abstraction of a console, such that
there can be less console-specific code up at the GUI level. Rignt now, this
doesn't take care of everything, but that might eventually change... Each
console should create and initialize a "subclass" of one of these (provide
a structure such that a console_t is the first member thereof). */
typedef struct crabemu_console {
int console_family;
int console_type;
int initialized;
/* Initialization-related stuff */
int (*shutdown)(void);
int (*reset)(void);
int (*soft_reset)(void);
/* Run one frame of output. */
void (*frame)(int skip);
/* Save state management */
int (*load_state)(const char *fn);
int (*save_state)(const char *fn);
int (*save_sram)(const char *fn);
/* Input */
void (*button_pressed)(int player, int button);
void (*button_released)(int player, int button);
/* Video-related functionaity */
void *(*framebuffer)(void);
void (*frame_size)(uint32_t *x, uint32_t *y);
void (*active_size)(uint32_t *x, uint32_t *y, uint32_t *w, uint32_t *h);
/* Cheats */
int (*save_cheats)(const char *fn);
/* Debugging related functions. */
void (*scanline)(void);
void (*step)(void);
void (*finish_frame)(void);
void (*finish_line)(void);
int (*current_scanline)(void);
int (*current_cycles)(void);
void (*set_control)(int player, int control);
} console_t;
ENDCLINK
#endif /* !CONSOLE_H */