Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
keyboard.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
34
35#ifndef __JO_KEYBOARD_H__
36# define __JO_KEYBOARD_H__
37
38#ifdef JO_COMPILE_WITH_KEYBOARD_SUPPORT
39
40/*
41** HOW TO USE YOUR KEYBOARD WITH MEDNAFEN
42**
43** 1) Edit \Emulators\mednafen\mednafen.cfg and search "ss.input.port1" and set the value to "keyboard" instead of "gamepad"
44** 2) When the emulator is running press [Ctrl]+[Shift]+[Menu] to toggle keyboard emulation in Mednafen.
45** 3) When your game runs press [Esc]+[Down] with your keyboard or [Start]+[Down] with your gamepad to display the console.
46**
47** Full documentation here: https://mednafen.github.io/documentation/ss.html
48*/
49
50/*
51** Internals
52*/
53
58
63
67# define __JO_KEYBOARD_MAPPING_SIZE (128)
68
69/*
70** Special Keys
71*/
101
103
104static __jo_force_inline unsigned char jo_keyboard_get_char(void)
105{
106 jo_peripheral_keyboard *keyboard;
107
109 if ((keyboard->condition & JO_PERIPHERAL_KEYBOARD_MAKE) == 0 || keyboard->code >= __JO_KEYBOARD_MAPPING_SIZE)
110 return (0);
113 return (__internal_keyboard_normal_mapping[keyboard->code]);
114}
115
116#endif /* !JO_COMPILE_WITH_KEYBOARD_SUPPORT */
117
118#endif /* !__JO_KEYBOARD_H__ */
119
120/*
121** END OF FILE
122*/
char __internal_keyboard_caps_lock_mapping[]
Keyboard mapping (internal engine usage).
char __internal_keyboard_normal_mapping[]
Keyboard mapping (internal engine usage).
static __jo_force_inline unsigned char jo_keyboard_get_char(void)
Definition keyboard.h:104
jo_keyboard_special_key jo_keyboard_get_special_key(void)
jo_keyboard_special_key
Keyboard special keys.
Definition keyboard.h:75
@ JO_KEYBOARD_RIGHT
Definition keyboard.h:77
@ JO_KEYBOARD_F10
Definition keyboard.h:97
@ JO_KEYBOARD_END
Definition keyboard.h:87
@ JO_KEYBOARD_F2
Definition keyboard.h:89
@ JO_KEYBOARD_F8
Definition keyboard.h:95
@ JO_KEYBOARD_F1
Definition keyboard.h:88
@ JO_KEYBOARD_ENTER
Definition keyboard.h:82
@ JO_KEYBOARD_LEFT
Definition keyboard.h:78
@ JO_KEYBOARD_TAB
Definition keyboard.h:84
@ JO_KEYBOARD_UP
Definition keyboard.h:80
@ JO_KEYBOARD_F12
Definition keyboard.h:99
@ JO_KEYBOARD_NO_SPECIAL_KEY
Definition keyboard.h:76
@ JO_KEYBOARD_F11
Definition keyboard.h:98
@ JO_KEYBOARD_F7
Definition keyboard.h:94
@ JO_KEYBOARD_HOME
Definition keyboard.h:86
@ JO_KEYBOARD_F3
Definition keyboard.h:90
@ JO_KEYBOARD_F9
Definition keyboard.h:96
@ JO_KEYBOARD_DOWN
Definition keyboard.h:79
@ JO_KEYBOARD_F6
Definition keyboard.h:93
@ JO_KEYBOARD_ESCAPE
Definition keyboard.h:81
@ JO_KEYBOARD_BACKSPACE
Definition keyboard.h:83
@ JO_KEYBOARD_DELETE
Definition keyboard.h:85
@ JO_KEYBOARD_F4
Definition keyboard.h:91
@ JO_KEYBOARD_F5
Definition keyboard.h:92
#define __JO_KEYBOARD_MAPPING_SIZE
Keyboard mapping size (internal engine usage).
Definition keyboard.h:67
unsigned char code
Definition smpc.h:249
jo_peripheral __jo_smpc_peripherals[(15) *2]
Peripherals (Internal usage): 15 entries for port 1 followed by 15 entries for port 2.
unsigned char condition
Definition smpc.h:248
#define JO_PERIPHERAL_KEYBOARD_MAKE
Keyboard condition: a key is pressed (make).
Definition smpc.h:189
#define JO_PERIPHERAL_KEYBOARD_CAPS_LOCK
Keyboard condition: caps lock is on.
Definition smpc.h:183
Keyboard data.
Definition smpc.h:242
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39