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
// hello-rs-libretro - A minimal hello world libretro core in Rust
// Copyright (C) 2025 David Brinovec
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// The XRGB8888 pixel format — 32 bits per pixel, 8 bits per channel.
///
/// Passed to [`RETRO_ENVIRONMENT_SET_PIXEL_FORMAT`] in
/// [`retro_set_environment`] to declare the format of pixel buffers
/// submitted via [`VIDEO_REFRESH_CALLBACK`]. Each pixel is laid out in
/// memory as `0x00RRGGBB` with one ignored byte followed by 8 bits each
/// of red, green, and blue.
///
/// Note: despite being value `1` in the enum, this is the recommended
/// modern format. The legacy default `XRGB1555` is value `0` and `RGB565`
/// is value `2`.
pub const RETRO_PIXEL_FORMAT_XRGB8888: u32 = 1;
/// Environment command to set the pixel format used by this core.
///
/// Passed as the command argument to [`ENVIRONMENT_CALLBACK`] with a
/// pointer to a `u32` containing the desired pixel format constant
/// (e.g. [`RETRO_PIXEL_FORMAT_XRGB8888`]). Must be called before the
/// first video frame is submitted. If not called, RetroArch assumes the
/// legacy `XRGB1555` format and colors will be incorrect.
pub const RETRO_ENVIRONMENT_SET_PIXEL_FORMAT: u32 = 10;
/// Environment command to declare that this core can run without content.
///
/// Passed as the command argument to [`ENVIRONMENT_CALLBACK`] with a
/// pointer to a `bool` set to `true`. Allows the user to start the core
/// directly from RetroArch's Load Core menu without selecting a ROM file.
/// Without this declaration RetroArch will require content before allowing
/// the core to run.
pub const RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME: u32 = 18;
/// Corresponds to `retro_system_info` in `libretro.h`.
///
/// Filled in by [`retro_get_system_info`] to provide RetroArch with static
/// information about this core. All pointer fields must remain valid for
/// the lifetime of the core — this is satisfied by using `c""` string
/// literals which are stored in the binary's read-only data segment.
///
/// `#[repr(C)]` ensures the struct's memory layout matches what RetroArch
/// expects when it writes into the pointer passed to [`retro_get_system_info`].
/// Corresponds to `retro_game_geometry` in `libretro.h`.
///
/// Describes the video output dimensions and aspect ratio of this core.
/// Part of [`RetroSystemAvInfo`], filled in by [`retro_get_system_av_info`].
/// Corresponds to `retro_system_timing` in `libretro.h`.
///
/// Describes the timing characteristics of this core's audio and video
/// output. Part of [`RetroSystemAvInfo`], filled in by
/// [`retro_get_system_av_info`].
/// Corresponds to `retro_system_av_info` in `libretro.h`.
///
/// Filled in by [`retro_get_system_av_info`] to provide RetroArch with
/// the video geometry and audio/video timing parameters for this core.
/// Corresponds to `retro_game_info` in `libretro.h`.
///
/// Passed to [`retro_load_game`] by RetroArch to describe the content to
/// be loaded. When running in no-content mode the pointer to this struct
/// is null and none of its fields are valid.