File: actions.h

package info (click to toggle)
snes9x 1.39-7
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 3,380 kB
  • ctags: 10,759
  • sloc: cpp: 46,954; asm: 30,662; ansic: 10,178; makefile: 324
file content (180 lines) | stat: -rw-r--r-- 5,654 bytes parent folder | download
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
 * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
 *
 * This file (c) Copyright 2001 Brad Jorsch (anomie@users.sourceforge.net)
 *
 * This file 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.
 *
 * As a specific exemption, this code may be distributed with and compiled with
 * that of the Super Nintendo emulator snes9x. The resulting binaries may be
 * also be redistributed as long as the corresponding source is available for
 * noncommercial use.
 * 
 * This file 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.
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

#ifndef ACTIONS_H
#define ACTIONS_H

#include "port.h"

/* There is a list of these structures for each keycode 0-255, since each
 * keycode can have multiple actions depending on the active modifier keys.
 *
 * mask and mods define which modifier keys must be active for the particular
 * action. Basically, if state&mask==mods then it matches.
 * 
 * action is divided into sections. (action & S9x_FunctionMask) determines the
 * function. If it's a joypad function, (action & S9x_JoyFuncMask) determines
 * the operation, (action & S9x_JoyPadMask) determines the pad number (false =
 * 0, true = 1), and (action & S9x_ButtonMask) is the mask of buttons to be
 * operated. If it's a SNES9x function, (action & S9x_SubFuncMask) tells which
 * subfunction it is.
 */

typedef struct {
    uint8 mask;
    uint8 mods;
    uint16 action;
} S9xKey;

#define S9x_FunctionMask	0xF000

/* Joypad functions */
#define S9x_JoyFuncMask 	0xE000
#define S9x_JoyPadMask	        0x1000
#define S9x_ButtonMask		0x0FFF

#define S9x_F_Joypad		0x0000
#define S9x_F_Turbo		0x2000
#define S9x_F_Sticky		0x4000
#define S9x_F_StickyTurbo	0x6000
#define S9x_F_ToggleTurbo	0x8000
#define S9x_F_ToggleSticky	0xA000

/* Button masks */
/* These are arranged such that this code fragment will put the buttons in the
 * proper position for return from S9xReadJoypad
 * 
 * uint16 byte=((action & 0x0F00) >> 4) | ((action & 0x00FF) << 8);
 */
#define S9x_Right	1<<0
#define S9x_Left	1<<1
#define S9x_Down	1<<2
#define S9x_Up		1<<3
#define S9x_Start	1<<4
#define S9x_Select	1<<5
#define S9x_Y		1<<6
#define S9x_B		1<<7
#define S9x_R		1<<8
#define S9x_L		1<<9
#define S9x_X		1<<10
#define S9x_A		1<<11


/* Snes9x Functions */
#define S9x_SubFuncMask		  0x0FFF

#define S9x_F_SNES9x		  0xF000

/* Subfunctions */
#define S9x_DoNothing              0
#define S9x_EmuTurbo		   1
#define S9x_ToggleEmuTurbo 	   2
#define S9x_Exit		   3
#define S9x_Reset		   4
#define S9x_FullscreenOn	   5
#define S9x_FullscreenOff	   6
#define S9x_FullscreenToggle	   7
#define S9x_ToggleHDMA		   8
#define S9x_ToggleBG0		   9
#define S9x_ToggleBG1		  10
#define S9x_ToggleBG2		  11
#define S9x_ToggleBG3		  12
#define S9x_ToggleSprites	  13
#define S9x_SwapJoypads		  14
#define S9x_NextController	  15
#define S9x_BGLayeringHack	  16
#define S9x_Mode7Interpolate	  17
#define S9x_Transparency	  18
#define S9x_IncFrameRate	  19
#define S9x_DecFrameRate	  20
#define S9x_IncFrameTime	  21
#define S9x_DecFrameTime	  22
#define S9x_ClipWindows		  23
#define S9x_InterpolateSound	  24
#define S9x_SynchronizeSound	  25
#define S9x_Pause		  26
#define S9x_SuperscopePause	  27
#define S9x_ToggleSuperscopeTurbo 28
#define S9x_DumpControls	  29
#define S9x_SaveSPC		  30
#define S9x_LoadFreezeFile	  31
#define S9x_SaveFreezeFile	  32
#define S9x_QuickLoad000	  33
#define S9x_QuickLoad001	  34
#define S9x_QuickLoad002	  35
#define S9x_QuickLoad003	  36
#define S9x_QuickLoad004	  37
#define S9x_QuickLoad005	  38
#define S9x_QuickLoad006	  39
#define S9x_QuickLoad007	  40
#define S9x_QuickLoad008	  41
#define S9x_QuickLoad009	  42
#define S9x_QuickLoad010	  43
#define S9x_QuickSave000	  44
#define S9x_QuickSave001	  45
#define S9x_QuickSave002	  46
#define S9x_QuickSave003	  47
#define S9x_QuickSave004	  48
#define S9x_QuickSave005	  49
#define S9x_QuickSave006	  50
#define S9x_QuickSave007	  51
#define S9x_QuickSave008	  52
#define S9x_QuickSave009	  53
#define S9x_QuickSave010	  54
#define S9x_SoundChannel0	  55
#define S9x_SoundChannel1	  56
#define S9x_SoundChannel2	  57
#define S9x_SoundChannel3	  58
#define S9x_SoundChannel4	  59
#define S9x_SoundChannel5	  60
#define S9x_SoundChannel6	  61
#define S9x_SoundChannel7	  62
#define S9x_SoundChannelsOn	  63
#define S9x_IncTurboSpeed         64
#define S9x_DecTurboSpeed         65
#define S9x_DumpKeymap            66
#define S9x_OpenGLCube            67
#define S9x_Screenshot            68
#define S9x_LoadOopsFile          69
#define S9x_LowpassSound          70
#define S9x_ReverseStereoSound    71
#define S9x_NoEchoSound           72
#define S9x_Debugger              73
#define S9x_ToggleRangeTimeOver   74

/* If you add more functions, be sure to update controls.cpp as well */

/* S9x_LastFunction is important, make it equal to the highest subfunction
 * number (besides XXXX).
 */
#define S9x_LastFunction	  74

/* This subfunction should not be enterable by the user, it is used to mark the
 * end of a data structure. It should do nothing.
 */
#define S9x_XXXX                4095

#endif