9 #ifndef C_API_ADDONINSTANCE_GAME_H 10 #define C_API_ADDONINSTANCE_GAME_H 12 #include "../addon_base.h" 19 #define DEFAULT_PORT_ID "1" 33 typedef enum GAME_ERROR
42 GAME_ERROR_NOT_IMPLEMENTED,
48 GAME_ERROR_INVALID_PARAMETERS,
54 GAME_ERROR_NOT_LOADED,
57 GAME_ERROR_RESTRICTED,
78 GAME_PCM_FORMAT_UNKNOWN,
164 GAME_PCM_FORMAT format;
165 const GAME_AUDIO_CHANNEL* channel_map;
203 GAME_PIXEL_FORMAT_UNKNOWN,
389 uintptr_t framebuffer;
399 uintptr_t framebuffer;
431 GAME_PIXEL_FORMAT format;
485 GAME_STREAM_TYPE type;
489 game_stream_audio_properties audio;
492 game_stream_video_properties video;
495 game_stream_hw_framebuffer_properties hw_framebuffer;
498 game_stream_sw_framebuffer_properties sw_framebuffer;
509 GAME_STREAM_TYPE type;
513 game_stream_hw_framebuffer_buffer hw_framebuffer;
516 game_stream_sw_framebuffer_buffer sw_framebuffer;
531 GAME_STREAM_TYPE type;
535 game_stream_audio_packet audio;
538 game_stream_video_packet video;
541 game_stream_hw_framebuffer_packet hw_framebuffer;
544 game_stream_sw_framebuffer_packet sw_framebuffer;
702 typedef enum GAME_INPUT_EVENT_SOURCE
705 GAME_INPUT_EVENT_DIGITAL_BUTTON,
708 GAME_INPUT_EVENT_ANALOG_BUTTON,
711 GAME_INPUT_EVENT_AXIS,
714 GAME_INPUT_EVENT_ANALOG_STICK,
717 GAME_INPUT_EVENT_ACCELEROMETER,
720 GAME_INPUT_EVENT_KEY,
723 GAME_INPUT_EVENT_RELATIVE_POINTER,
726 GAME_INPUT_EVENT_ABSOLUTE_POINTER,
729 GAME_INPUT_EVENT_MOTOR,
730 } GAME_INPUT_EVENT_SOURCE;
735 typedef enum GAME_KEY_MOD
738 GAME_KEY_MOD_NONE = 0x0000,
741 GAME_KEY_MOD_SHIFT = 0x0001,
744 GAME_KEY_MOD_CTRL = 0x0002,
747 GAME_KEY_MOD_ALT = 0x0004,
750 GAME_KEY_MOD_META = 0x0008,
753 GAME_KEY_MOD_SUPER = 0x0010,
756 GAME_KEY_MOD_NUMLOCK = 0x0100,
759 GAME_KEY_MOD_CAPSLOCK = 0x0200,
762 GAME_KEY_MOD_SCROLLOCK = 0x0400,
792 typedef struct game_controller_layout
796 char** digital_buttons;
797 unsigned int digital_button_count;
798 char** analog_buttons;
799 unsigned int analog_button_count;
800 char** analog_sticks;
801 unsigned int analog_stick_count;
802 char** accelerometers;
803 unsigned int accelerometer_count;
805 unsigned int key_count;
807 unsigned int rel_pointer_count;
809 unsigned int abs_pointer_count;
811 unsigned int motor_count;
812 } ATTR_PACKED game_controller_layout;
825 const char* port_address;
831 unsigned int port_count;
858 game_input_device* accepted_devices;
861 unsigned int device_count;
954 GAME_KEY_MOD modifiers;
999 GAME_INPUT_EVENT_SOURCE type;
1002 const char* controller_id;
1005 GAME_PORT_TYPE port_type;
1008 const char* port_address;
1011 const char* feature_name;
1015 struct game_digital_button_event digital_button;
1018 struct game_analog_button_event analog_button;
1021 struct game_axis_event axis;
1024 struct game_analog_stick_event analog_stick;
1027 struct game_accelerometer_event accelerometer;
1030 struct game_key_event key;
1033 struct game_rel_pointer_event rel_pointer;
1036 struct game_abs_pointer_event abs_pointer;
1039 struct game_motor_event motor;
1126 typedef void* KODI_GAME_STREAM_HANDLE;
1139 KODI_HANDLE kodiInstance;
1141 void (*CloseGame)(KODI_HANDLE kodiInstance);
1142 KODI_GAME_STREAM_HANDLE (*OpenStream)(KODI_HANDLE,
const struct game_stream_properties*);
1143 bool (*GetStreamBuffer)(KODI_HANDLE,
1144 KODI_GAME_STREAM_HANDLE,
1147 struct game_stream_buffer*);
1148 void (*AddStreamData)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE,
const struct game_stream_packet*);
1149 void (*ReleaseStreamBuffer)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE,
struct game_stream_buffer*);
1150 void (*CloseStream)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE);
1152 bool (*InputEvent)(KODI_HANDLE kodiInstance,
const struct game_input_event* event);
1162 KODI_HANDLE addonInstance;
1165 GAME_ERROR(__cdecl* LoadGameSpecial)
1169 GAME_ERROR(__cdecl* GetGameTiming)
1177 bool(__cdecl* HasFeature)(
const struct AddonInstance_Game*,
const char*,
const char*);
1179 void(__cdecl* FreeTopology)(
const struct AddonInstance_Game*,
struct game_input_topology*);
1181 const struct game_controller_layout*,
1189 bool(__cdecl* InputEvent)(
const struct AddonInstance_Game*,
const struct game_input_event*);
1192 GAME_ERROR(__cdecl* Deserialize)(
const struct AddonInstance_Game*,
const uint8_t*, size_t);
1194 GAME_ERROR(__cdecl* GetMemory)
1196 GAME_ERROR(__cdecl* SetCheat)
1198 GAME_ERROR(__cdecl* RCGenerateHashFromFile)
1201 GAME_ERROR(__cdecl* RCGetPatchFileUrl)
1203 GAME_ERROR(__cdecl* SetRetroAchievementsCredentials)
1205 GAME_ERROR(__cdecl* RCPostRichPresenceUrl)
1214 GAME_ERROR(__cdecl* RCGetRichPresenceEvaluation)
1216 GAME_ERROR(__cdecl* ActivateAchievement)(
const AddonInstance_Game*,
unsigned int,
const char*);
1217 GAME_ERROR(__cdecl* GetCheevo_URL_ID)
Hardware framebuffer packet
Definition: game.h:396
struct game_stream_video_properties game_stream_video_properties
Game video stream properties
Channel back right over center.
Definition: game.h:153
unsigned int height
Video width.
Definition: game.h:277
struct game_stream_packet game_stream_packet
Stream packet and ephemeral metadata
unsigned int version_major
Major version number for core GL context or GLES 3.1+.
Definition: game.h:360
Video ram lets a frontend peek into a game systems video RAM (VRAM)
Definition: game.h:621
Game callbacks.
Definition: game.h:1137
0RGB8888 Format
Definition: game.h:206
double fps
FPS of video content.
Definition: game.h:1059
unsigned int max_width
The maximal used width.
Definition: game.h:254
Unknown.
Definition: game.h:460
Game properties.
Definition: game.h:1075
GAME_AUDIO_CHANNEL
Audio channel
Definition: game.h:90
Channel bacl left over center.
Definition: game.h:150
Regular save ram.
Definition: game.h:610
Hardware framebuffer properties
Definition: game.h:330
SIMD CPU AVX.
Definition: game.h:660
Special memory type.
Definition: game.h:630
GAME_VIDEO_ROTATION
Video rotation position
Definition: game.h:221
rotate 270° counterclockwise
Definition: game.h:233
unsigned int nominal_width
The nominal used width.
Definition: game.h:248
Hardware framebuffer.
Definition: game.h:469
Channel Low Frequency Effects / Subwoofer.
Definition: game.h:105
Vulkan.
Definition: game.h:323
Channel top center.
Definition: game.h:138
Channel front center.
Definition: game.h:102
Channel surround/side right.
Definition: game.h:126
OpenGL ES 3.1+. Set major/minor fields.
Definition: game.h:320
game_stream_video_properties game_stream_sw_framebuffer_properties
Game software framebuffer stream properties
Definition: game.h:423
struct game_stream_hw_framebuffer_buffer game_stream_hw_framebuffer_buffer
Hardware framebuffer buffer
SPECIAL_GAME_TYPE
**Special game types passed into game_load_game_special().
Definition: game.h:580
Some games have a built-in clock to keep track of time.
Definition: game.h:615
const uint8_t * data
Pointer for video stream data given to Kodi.
Definition: game.h:283
SIMD CPU SSSE3.
Definition: game.h:669
bool supports_vfs
Definition: game.h:1113
GAME_PCM_FORMAT
Stream Format
Definition: game.h:76
struct game_stream_sw_framebuffer_buffer game_stream_sw_framebuffer_buffer
Software framebuffer type
OpenGL ES 3.0.
Definition: game.h:317
Channel top front center.
Definition: game.h:135
Special memory type.
Definition: game.h:627
unsigned int extension_count
Definition: game.h:1123
SIMD CPU VFPU.
Definition: game.h:687
Channel front right over center.
Definition: game.h:117
Channel back left.
Definition: game.h:108
SIMD CPU MMX.
Definition: game.h:672
Channel top back right.
Definition: game.h:144
GAME_VIDEO_ROTATION rotation
Width GAME_VIDEO_ROTATION defined rotation angle.
Definition: game.h:280
rotate 180° counterclockwise
Definition: game.h:230
Channel front left over center.
Definition: game.h:114
Game video stream properties
Definition: game.h:242
Audio stream.
Definition: game.h:463
unsigned int width
Video height.
Definition: game.h:274
Game Type super game boy.
Definition: game.h:592
void(* game_proc_address_t)(void)
Hardware framebuffer process function address
Definition: game.h:406
Channel top back center.
Definition: game.h:147
Channel surround/side left.
Definition: game.h:123
OpenGL ES 2.0.
Definition: game.h:311
Channel top front left.
Definition: game.h:129
struct game_stream_hw_framebuffer_properties game_stream_hw_framebuffer_properties
Hardware framebuffer properties
Stream packet and ephemeral metadata
Definition: game.h:528
const uint8_t * data
Pointer for audio stream data given to Kodi.
Definition: game.h:177
Special memory type.
Definition: game.h:633
uint32_t unicode
If the keypress generates a printing character.
Definition: game.h:951
GAME_HW_CONTEXT_TYPE context_type
The API to use.
Definition: game.h:334
size_t size
Size of data array.
Definition: game.h:286
None context.
Definition: game.h:305
Channel top front right.
Definition: game.h:132
const char ** resource_directories
Definition: game.h:1096
Special memory type.
Definition: game.h:639
bool stencil
Set if stencil buffers should be attached.
Definition: game.h:349
GAME_HW_CONTEXT_TYPE
Hardware framebuffer type
Definition: game.h:302
const char * profile_directory
Definition: game.h:1108
unsigned int max_height
The maximal used height.
Definition: game.h:257
S16NE sample format.
Definition: game.h:81
Game Type BSX.
Definition: game.h:583
Game region NTSC.
Definition: game.h:568
Game function hooks.
Definition: game.h:1160
const char ** proxy_dll_paths
Definition: game.h:1085
SIMD CPU AVX2.
Definition: game.h:684
bool cache_context
If this is true, the frontend will go very far to avoid resetting context in scenarios like toggling ...
Definition: game.h:376
OpenGL 2.x. Driver can choose to use latest compatibility context.
Definition: game.h:308
GAME_MEMORY
Game Memory
Definition: game.h:599
struct game_stream_video_packet game_stream_video_packet
Video stream packet
Channel top back left.
Definition: game.h:141
0RGB1555 Format
Definition: game.h:212
game_stream_video_packet game_stream_sw_framebuffer_packet
Software framebuffer packet
Definition: game.h:442
struct game_stream_hw_framebuffer_packet game_stream_hw_framebuffer_packet
Hardware framebuffer packet
Software framebuffer.
Definition: game.h:472
bool bottom_left_origin
Use conventional bottom-left origin convention.
Definition: game.h:357
Software framebuffer type
Definition: game.h:429
const char * game_client_dll_path
Definition: game.h:1080
Stream buffers for hardware rendering and zero-copy support
Definition: game.h:506
RGB565 Format.
Definition: game.h:209
unsigned int version_minor
Minor version number for core GL context or GLES 3.1+.
Definition: game.h:363
SIMD CPU VMX128.
Definition: game.h:657
Channel back right.
Definition: game.h:111
GAME_PIXEL_FORMAT
Pixel format
Definition: game.h:201
struct game_stream_properties game_stream_properties
Immutable stream metadata
Game Type BSX slotted.
Definition: game.h:586
GAME_SIMD
ID values for SIMD CPU features
Definition: game.h:645
struct game_stream_buffer game_stream_buffer
Stream buffers for hardware rendering and zero-copy support
SIMD CPU SSE2.
Definition: game.h:651
rotate 90° counterclockwise
Definition: game.h:227
SIMD CPU SSE4.
Definition: game.h:678
Hardware framebuffer buffer
Definition: game.h:386
SIMD CPU SSE3.
Definition: game.h:666
GAME_REGION
Game region definition
Definition: game.h:562
const char ** extensions
Definition: game.h:1118
struct game_stream_audio_packet game_stream_audio_packet
Audio stream packet
Channel front left.
Definition: game.h:96
SIMD CPU MMXEXT.
Definition: game.h:675
Passed to game_get_memory_data/size().
Definition: game.h:603
Modern desktop core GL context. Use major/minor fields to set GL version.
Definition: game.h:314
unsigned int proxy_dll_count
Definition: game.h:1090
GAME_PIXEL_FORMAT format
The stream's pixel format.
Definition: game.h:245
SIMD CPU SSE42.
Definition: game.h:681
Game instance.
Definition: game.h:1228
struct game_stream_audio_properties game_stream_audio_properties
Game audio stream properties
Channel back center.
Definition: game.h:120
Game Type sufami turbo.
Definition: game.h:589
System ram lets a frontend peek into a game systems main RAM.
Definition: game.h:618
Channel front right.
Definition: game.h:99
Video stream.
Definition: game.h:466
bool depth
Set if render buffers should have depth component attached.
Definition: game.h:340
float aspect_ratio
On video stream used aspect ration.
Definition: game.h:262
Audio stream packet
Definition: game.h:174
Immutable stream metadata
Definition: game.h:482
unsigned int resource_directory_count
Definition: game.h:1101
Special memory type.
Definition: game.h:636
SIMD CPU SSE.
Definition: game.h:648
double sample_rate
Sampling rate of audio.
Definition: game.h:1062
Channel list terminator.
Definition: game.h:93
SIMD CPU VMX.
Definition: game.h:654
Game region unknown.
Definition: game.h:565
Game region PAL.
Definition: game.h:571
bool debug_context
Creates a debug context.
Definition: game.h:379
Game system timing.
Definition: game.h:1056
Game audio stream properties
Definition: game.h:162
SIMD CPU NEON.
Definition: game.h:663
GAME_STREAM_TYPE
Game stream types
Definition: game.h:457
Video stream packet
Definition: game.h:271
0° and Without rotation
Definition: game.h:224
unsigned int nominal_height
The nominal used height.
Definition: game.h:251
size_t size
Size of data array.
Definition: game.h:180
Special memory type.
Definition: game.h:624