9#ifndef C_API_ADDONINSTANCE_GAME_H
10#define C_API_ADDONINSTANCE_GAME_H
12#include "../addon_base.h"
76 GAME_PCM_FORMAT_UNKNOWN,
201 GAME_PIXEL_FORMAT_UNKNOWN,
432 uintptr_t framebuffer;
442 uintptr_t framebuffer;
786#define ROOT_PORT_ADDRESS "/"
791#define DEFAULT_PORT_ID "1"
796#define KEYBOARD_PORT_ID "keyboard"
801#define MOUSE_PORT_ID "mouse"
806#define DEFAULT_PORT_ADDRESS "/1"
811#define KEYBOARD_PORT_ADDRESS "/keyboard"
816#define MOUSE_PORT_ADDRESS "/mouse"
914 char** digital_buttons;
915 unsigned int digital_button_count;
916 char** analog_buttons;
917 unsigned int analog_button_count;
918 char** analog_sticks;
919 unsigned int analog_stick_count;
920 char** accelerometers;
921 unsigned int accelerometer_count;
923 unsigned int key_count;
925 unsigned int rel_pointer_count;
927 unsigned int abs_pointer_count;
929 unsigned int motor_count;
1564 typedef void* KODI_GAME_STREAM_HANDLE;
1578 KODI_HANDLE kodiInstance;
1581 void (*CloseGame)(KODI_HANDLE kodiInstance);
1582 double (*GetPlaybackSpeed)(KODI_HANDLE kodiInstance);
1583 void (*SetGameTiming)(KODI_HANDLE kodiInstance,
const struct game_system_timing* timing_info);
1585 bool (*GetStreamBuffer)(KODI_HANDLE,
1586 KODI_GAME_STREAM_HANDLE,
1590 void (*AddStreamData)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE,
const struct game_stream_packet*);
1591 void (*ReleaseStreamBuffer)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE,
struct game_stream_buffer*);
1592 void (*CloseStream)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE);
1594 bool (*InputEvent)(KODI_HANDLE kodiInstance,
const struct game_input_event* event);
1596 void (*RCOnAchievementTriggered)(KODI_HANDLE kodiInstance,
1598 void (*RCOnGameCompleted)(KODI_HANDLE kodiInstance,
const char* title,
bool hardcore);
1599 void (*RCOnRichPresenceUpdated)(KODI_HANDLE kodiInstance,
const char* evaluation);
1602 void (*RCOnAchievementProgress)(KODI_HANDLE kodiInstance,
1604 unsigned int count);
1605 void (*RCOnServerError)(KODI_HANDLE kodiInstance,
const char* message,
const char* api);
1606 void (*RCOnConnectionChanged)(KODI_HANDLE kodiInstance,
bool connected);
1608 void (*RCOnChallengeIndicator)(KODI_HANDLE kodiInstance,
1611 void (*RCOnAchievementProgressShow)(KODI_HANDLE kodiInstance,
1613 void (*RCOnAchievementProgressUpdate)(
1615 void (*RCOnAchievementProgressHide)(KODI_HANDLE kodiInstance,
1617 void (*RCOnLeaderboardStarted)(KODI_HANDLE kodiInstance,
1619 void (*RCOnLeaderboardFailed)(KODI_HANDLE kodiInstance,
const struct game_rc_leaderboard* data);
1620 void (*RCOnLeaderboardSubmitted)(KODI_HANDLE kodiInstance,
1622 void (*RCOnLeaderboardTrackerShow)(KODI_HANDLE kodiInstance,
1624 void (*RCOnLeaderboardTrackerUpdate)(KODI_HANDLE kodiInstance,
1626 void (*RCOnLeaderboardTrackerHide)(KODI_HANDLE kodiInstance,
1628 void (*RCOnLeaderboardScoreboard)(KODI_HANDLE kodiInstance,
1630 void (*RCOnReset)(KODI_HANDLE kodiInstance);
1631 void (*RCOnSubsetCompleted)(KODI_HANDLE kodiInstance,
const char* title);
1667 KODI_HANDLE addonInstance;
1683 bool(__cdecl* HasFeature)(
const struct AddonInstance_Game*,
const char*,
const char*);
1715 GAME_ERROR(__cdecl* SetRetroAchievementsCredentials)
1722 void(__cdecl*)(
const void*,
const char*,
unsigned int),
const uint8_t * data
Pointer to the audio stream data given to Kodi.
Definition game.h:175
size_t size
Size of the data array.
Definition game.h:178
GAME_AUDIO_CHANNEL
Audio channel
Definition game.h:89
GAME_PCM_FORMAT
Stream Format
Definition game.h:75
@ GAME_CH_TFC
Channel top front center.
Definition game.h:133
@ GAME_CH_FL
Channel front left.
Definition game.h:94
@ GAME_CH_BL
Channel back left.
Definition game.h:106
@ GAME_CH_TBR
Channel top back right.
Definition game.h:142
@ GAME_CH_FC
Channel front center.
Definition game.h:100
@ GAME_CH_BLOC
Channel back left over center.
Definition game.h:148
@ GAME_CH_TFL
Channel top front left.
Definition game.h:127
@ GAME_CH_NULL
Channel list terminator.
Definition game.h:91
@ GAME_CH_TBC
Channel top back center.
Definition game.h:145
@ GAME_CH_SR
Channel surround/side right.
Definition game.h:124
@ GAME_CH_TFR
Channel top front right.
Definition game.h:130
@ GAME_CH_FR
Channel front right.
Definition game.h:97
@ GAME_CH_BC
Channel back center.
Definition game.h:118
@ GAME_CH_SL
Channel surround/side left.
Definition game.h:121
@ GAME_CH_LFE
Channel low frequency effects / subwoofer.
Definition game.h:103
@ GAME_CH_BROC
Channel back right over center.
Definition game.h:151
@ GAME_CH_TC
Channel top center.
Definition game.h:136
@ GAME_CH_FLOC
Channel front left over center.
Definition game.h:112
@ GAME_CH_FROC
Channel front right over center.
Definition game.h:115
@ GAME_CH_TBL
Channel top back left.
Definition game.h:139
@ GAME_CH_BR
Channel back right.
Definition game.h:109
@ GAME_PCM_FORMAT_S16NE
S16NE sample format.
Definition game.h:79
Audio stream packet
Definition game.h:173
Game audio stream properties
Definition game.h:161
double sample_rate
Sampling rate of audio.
Definition game.h:1186
double fps
FPS of video content.
Definition game.h:1183
Game system timing.
Definition game.h:1181
GAME_SIMD
ID values for SIMD CPU features
Definition game.h:709
GAME_REGION
Game region definition
Definition game.h:626
SPECIAL_GAME_TYPE
Special game types passed into game_load_game_special().
Definition game.h:644
GAME_MEMORY
Game Memory
Definition game.h:663
@ GAME_SIMD_VFPU
SIMD CPU VFPU.
Definition game.h:750
@ GAME_SIMD_VMX128
SIMD CPU VMX128.
Definition game.h:720
@ GAME_SIMD_SSE
SIMD CPU SSE.
Definition game.h:711
@ GAME_SIMD_SSE4
SIMD CPU SSE4.
Definition game.h:741
@ GAME_SIMD_NEON
SIMD CPU NEON.
Definition game.h:726
@ GAME_SIMD_AVX2
SIMD CPU AVX2.
Definition game.h:747
@ GAME_SIMD_SSE42
SIMD CPU SSE42.
Definition game.h:744
@ GAME_SIMD_SSSE3
SIMD CPU SSSE3.
Definition game.h:732
@ GAME_SIMD_SSE2
SIMD CPU SSE2.
Definition game.h:714
@ GAME_SIMD_SSE3
SIMD CPU SSE3.
Definition game.h:729
@ GAME_SIMD_AVX
SIMD CPU AVX.
Definition game.h:723
@ GAME_SIMD_MMXEXT
SIMD CPU MMXEXT.
Definition game.h:738
@ GAME_SIMD_MMX
SIMD CPU MMX.
Definition game.h:735
@ GAME_SIMD_VMX
SIMD CPU VMX.
Definition game.h:717
@ GAME_REGION_NTSC
Game region NTSC.
Definition game.h:631
@ GAME_REGION_PAL
Game region PAL.
Definition game.h:634
@ GAME_REGION_UNKNOWN
Game region unknown.
Definition game.h:628
@ SPECIAL_GAME_TYPE_SUPER_GAME_BOY
Game Type super game boy.
Definition game.h:655
@ SPECIAL_GAME_TYPE_BSX
Game Type BSX.
Definition game.h:646
@ SPECIAL_GAME_TYPE_BSX_SLOTTED
Game Type BSX slotted.
Definition game.h:649
@ SPECIAL_GAME_TYPE_SUFAMI_TURBO
Game Type sufami turbo.
Definition game.h:652
@ GAME_MEMORY_SNES_SUFAMI_TURBO_A_RAM
Special memory type.
Definition game.h:693
@ GAME_MEMORY_VIDEO_RAM
Video ram lets a frontend peek into a game systems video RAM (VRAM)
Definition game.h:684
@ GAME_MEMORY_SNES_SUFAMI_TURBO_B_RAM
Special memory type.
Definition game.h:696
@ GAME_MEMORY_SNES_GAME_BOY_RTC
Special memory type.
Definition game.h:702
@ GAME_MEMORY_SNES_BSX_PRAM
Special memory type.
Definition game.h:690
@ GAME_MEMORY_MASK
Passed to game_get_memory_data/size(). If the memory type doesn't apply to the implementation NULL/0 ...
Definition game.h:666
@ GAME_MEMORY_SAVE_RAM
Regular save ram.
Definition game.h:673
@ GAME_MEMORY_SYSTEM_RAM
System ram lets a frontend peek into a game systems main RAM.
Definition game.h:681
@ GAME_MEMORY_SNES_BSX_RAM
Special memory type.
Definition game.h:687
@ GAME_MEMORY_RTC
Some games have a built-in clock to keep track of time.
Definition game.h:678
@ GAME_MEMORY_SNES_GAME_BOY_RAM
Special memory type.
Definition game.h:699
bool cache_context
If true, the frontend will go to great lengths to avoid resetting the context in scenarios like toggl...
Definition game.h:386
unsigned int version_minor
Minor version number for the core GL context or GLES 3.1+.
Definition game.h:373
bool depth
Set to true if render buffers should have a depth component attached.
Definition game.h:350
float display_aspect_ratio
Display aspect ratio (DAR) to use when showing the video frame.
Definition game.h:456
unsigned int version_major
Major version number for the core GL context or GLES 3.1+.
Definition game.h:370
bool bottom_left_origin
Use the conventional bottom-left origin.
Definition game.h:367
GAME_HW_CONTEXT_TYPE context_type
The API to use.
Definition game.h:344
unsigned int max_height
The largest frame height the client will render, in pixels.
Definition game.h:415
GAME_VIDEO_ROTATION rotation
Video rotation angle defined by GAME_VIDEO_ROTATION.
Definition game.h:459
unsigned int max_width
The largest frame width the client will render, in pixels.
Definition game.h:412
unsigned int width
Size of the image the client just drew.
Definition game.h:449
float nominal_display_aspect_ratio
The nominal display aspect ratio (DAR) used to show the video frame.
Definition game.h:421
bool debug_context
Creates a debug context.
Definition game.h:389
bool stencil
Set to true if stencil buffers should be attached.
Definition game.h:359
void(* game_proc_address_t)(void)
Hardware framebuffer process function address
Definition game.h:466
GAME_HW_CONTEXT_TYPE
Hardware framebuffer type
Definition game.h:309
@ GAME_HW_CONTEXT_OPENGLES2
OpenGL ES 2.0.
Definition game.h:317
@ GAME_HW_CONTEXT_OPENGL_CORE
Modern desktop core GL context. Use the major and minor fields to set the GL version.
Definition game.h:320
@ GAME_HW_CONTEXT_VULKAN
Vulkan.
Definition game.h:329
@ GAME_HW_CONTEXT_OPENGLES_VERSION
OpenGL ES 3.1+. Set major/minor fields.
Definition game.h:326
@ GAME_HW_CONTEXT_OPENGLES3
OpenGL ES 3.0.
Definition game.h:323
@ GAME_HW_CONTEXT_NONE
No context.
Definition game.h:311
@ GAME_HW_CONTEXT_OPENGL
OpenGL 2.x. The driver can choose to use the latest compatibility context.
Definition game.h:314
Hardware rendering properties
Definition game.h:341
Hardware framebuffer buffer
Definition game.h:430
Hardware framebuffer packet
Definition game.h:440
Hardware framebuffer properties
Definition game.h:402
const game_rc_achievement * achievements
Achievements of the game, or NULL if achievement_count is 0.
Definition game.h:1281
const char * submitted_score
The value that was submitted, formatted for display, or NULL
Definition game.h:1407
unsigned int new_rank
The player's rank after the submission, counting from one.
Definition game.h:1416
unsigned int num_entries
How many entries the leaderboard holds.
Definition game.h:1419
bool hardcore
True if the achievement was earned in hardcore mode.
Definition game.h:1309
const char * icon_url
URL of the game's icon, or NULL
Definition game.h:1278
const char * display_name
Display name of the player, or NULL
Definition game.h:1325
float rarity
Percentage of players who earned this achievement, 0.0 if unknown.
Definition game.h:1256
float measured_percent
Progress towards the achievement, from 0.0 to 100.0.
Definition game.h:1363
const char * badge_locked_url
URL of the locked (greyscale) badge, or NULL
Definition game.h:1244
const char * description
Description of how the achievement is earned, or NULL
Definition game.h:1238
unsigned int points
Point value of the achievement.
Definition game.h:1247
bool success
True if the player was logged in.
Definition game.h:1319
const char * title
Title of the achievement, or NULL if unknown.
Definition game.h:1235
const char * value
The value as it stands, already formatted for display, or NULL
Definition game.h:1392
unsigned int id
Unique RetroAchievements ID of the achievement.
Definition game.h:1232
const char * username
Account name of the player, or NULL
Definition game.h:1322
int64_t unlock_time
Unix time the achievement was earned, or 0 if it was not.
Definition game.h:1253
GAME_RC_UNLOCK_STATE unlock_state
Whether and how the player has earned this achievement.
Definition game.h:1250
const char * display
The value as it stands, formatted for display, or NULL
Definition game.h:1436
unsigned int achievement_count
Number of elements in achievements.
Definition game.h:1284
unsigned int game_id
Unique RetroAchievements ID of the game.
Definition game.h:1272
bool credentials_rejected
True if the account or token was rejected, rather than the attempt failing for some other reason.
Definition game.h:1343
const char * badge_url
URL of the unlocked (full colour) badge, or NULL
Definition game.h:1241
const char * measured_progress
Human-readable progress such as "45/100", or NULL
Definition game.h:1366
const char * error_message
Reason the login failed, or NULL if it succeeded.
Definition game.h:1334
float rarity_hardcore
Percentage of players who earned this in hardcore, 0.0 if unknown.
Definition game.h:1259
const char * best_score
The player's best value on this leaderboard, or NULL
Definition game.h:1413
GAME_RC_UNLOCK_STATE
Unlock state of an achievement
Definition game.h:1214
@ GAME_RC_UNLOCK_STATE_SOFTCORE
The achievement was earned outside of hardcore mode.
Definition game.h:1219
@ GAME_RC_UNLOCK_STATE_HARDCORE
The achievement was earned in hardcore mode.
Definition game.h:1222
@ GAME_RC_UNLOCK_STATE_LOCKED
The achievement has not been earned by this player.
Definition game.h:1216
A single achievement belonging to the loaded game
Definition game.h:1230
**Payload of AddonToKodiFuncTable_Game::RCOnChallengeIndicator**
Definition game.h:1447
Progress towards a single measured achievement
Definition game.h:1358
Payload of the achievement progress indicator callbacks
Definition game.h:1469
**Payload of AddonToKodiFuncTable_Game::RCOnAchievementTriggered**
Definition game.h:1292
**Payload of AddonToKodiFuncTable_Game::RCOnGameLoaded**
Definition game.h:1270
Payload of the leaderboard attempt callbacks
Definition game.h:1377
**Payload of AddonToKodiFuncTable_Game::RCOnLeaderboardScoreboard**
Definition game.h:1402
Payload of the leaderboard tracker callbacks
Definition game.h:1428
**Payload of AddonToKodiFuncTable_Game::RCOnLoginResult**
Definition game.h:1317
game_stream_video_packet game_stream_sw_framebuffer_packet
Software framebuffer packet
Definition game.h:502
game_stream_video_properties game_stream_sw_framebuffer_properties
Game software framebuffer stream properties
Definition game.h:483
Software framebuffer type
Definition game.h:490
GAME_STREAM_TYPE type
The stream type.
Definition game.h:545
GAME_STREAM_TYPE
Game stream types
Definition game.h:518
@ GAME_STREAM_VIDEO
Video stream.
Definition game.h:526
@ GAME_STREAM_AUDIO
Audio stream.
Definition game.h:523
@ GAME_STREAM_HW_FRAMEBUFFER
Hardware framebuffer.
Definition game.h:529
@ GAME_STREAM_UNKNOWN
Unknown.
Definition game.h:520
@ GAME_STREAM_SW_FRAMEBUFFER
Software framebuffer.
Definition game.h:532
Stream buffers for hardware rendering and zero-copy support
Definition game.h:568
Stream packet and ephemeral metadata
Definition game.h:591
Immutable stream metadata
Definition game.h:543
float display_aspect_ratio
Display aspect ratio (DAR) to use when showing the video frame.
Definition game.h:283
const uint8_t * data
Pointer to the video stream data given to Kodi.
Definition game.h:289
size_t size
Size of the data array.
Definition game.h:292
unsigned int nominal_width
The nominal width, in pixels.
Definition game.h:247
unsigned int max_height
The maximum height, in pixels.
Definition game.h:262
GAME_VIDEO_ROTATION rotation
Video rotation angle defined by GAME_VIDEO_ROTATION.
Definition game.h:286
unsigned int height
Video height, in pixels.
Definition game.h:277
unsigned int max_width
The maximum width, in pixels.
Definition game.h:259
unsigned int width
Video width, in pixels.
Definition game.h:274
float nominal_display_aspect_ratio
The nominal display aspect ratio (DAR) used to show the video frame.
Definition game.h:256
GAME_PIXEL_FORMAT format
The stream's pixel format.
Definition game.h:244
unsigned int nominal_height
The nominal height, in pixels.
Definition game.h:250
GAME_PIXEL_FORMAT
Pixel format
Definition game.h:200
GAME_VIDEO_ROTATION
Video rotation orientation
Definition game.h:220
@ GAME_PIXEL_FORMAT_RGB565
RGB565 Format.
Definition game.h:207
@ GAME_PIXEL_FORMAT_0RGB1555
0RGB1555 Format
Definition game.h:210
@ GAME_PIXEL_FORMAT_0RGB8888
0RGB8888 Format
Definition game.h:204
@ GAME_VIDEO_ROTATION_180_CCW
Rotate 180° counterclockwise.
Definition game.h:228
@ GAME_VIDEO_ROTATION_0
0° without rotation
Definition game.h:222
@ GAME_VIDEO_ROTATION_90_CCW
Rotate 90° counterclockwise.
Definition game.h:225
@ GAME_VIDEO_ROTATION_270_CCW
Rotate 270° counterclockwise.
Definition game.h:231
Video stream packet
Definition game.h:272
Game video stream properties
Definition game.h:242
GAME_ERROR
Game add-on error codes
Definition game.h:29
@ GAME_ERROR_FAILED
The command failed.
Definition game.h:46
@ GAME_ERROR_REJECTED
The command was rejected by the game client.
Definition game.h:40
@ GAME_ERROR_INVALID_PARAMETERS
The parameters of the called method are invalid for this operation.
Definition game.h:43
@ GAME_ERROR_UNKNOWN
An unknown error occurred.
Definition game.h:34
@ GAME_ERROR_NO_ERROR
No error occurred.
Definition game.h:31
@ GAME_ERROR_RESTRICTED
Game requires restricted resources.
Definition game.h:52
@ GAME_ERROR_NOT_LOADED
No game is loaded.
Definition game.h:49
@ GAME_ERROR_MISSING_FILES
The game client couldn't find files it needs, such as BIOS files.
Definition game.h:55
@ GAME_ERROR_NOT_IMPLEMENTED
The method called by the frontend is not implemented.
Definition game.h:37
Game instance.
Definition game.h:1738
Game properties.
Definition game.h:1503
const char ** resource_directories
The "system" directories of the frontend.
Definition game.h:1525
unsigned int proxy_dll_count
Number of proxy DLL paths provided.
Definition game.h:1517
const char * profile_directory
The writable directory of the frontend.
Definition game.h:1538
const char * libretro_core
The <libretro_core> property from addon.xml, such as "fceumm_libretro", or empty if there is none.
Definition game.h:1561
const char * game_client_dll_path
The path of the game client being loaded.
Definition game.h:1507
unsigned int extension_count
Number of extensions provided.
Definition game.h:1553
bool supports_vfs
The value of the <supports_vfs> property from addon.xml.
Definition game.h:1543
const char ** proxy_dll_paths
Paths to proxy DLLs used to load the game client.
Definition game.h:1512
const char ** extensions
The extensions in the <extensions> property from addon.xml.
Definition game.h:1548
unsigned int resource_directory_count
Number of resource directories provided.
Definition game.h:1530
Game callbacks.
Definition game.h:1577
bool(* StartStream)(KODI_HANDLE, KODI_GAME_STREAM_HANDLE)
Reset a prepared hardware stream after installing its returned handle.
Definition game.h:1641
void(* SetFastForwarding)(KODI_HANDLE kodiInstance, bool fastForward, double ratio)
Ask Kodi to fast-forward, or to stop a fast-forward it asked for.
Definition game.h:1657
void(* ReportMissingFile)(KODI_HANDLE kodiInstance, const char *path)
Name a file the game client looked for and couldn't find.
Definition game.h:1649
Game function hooks.
Definition game.h:1666