Reformat Libretro (Resharper)
This commit is contained in:
parent
f3f15a32fe
commit
a6e89dd132
6 changed files with 2244 additions and 2076 deletions
|
@ -10,18 +10,22 @@ private:
|
|||
shared_ptr<Console> _console;
|
||||
retro_input_state_t _getInputState = nullptr;
|
||||
retro_input_poll_t _pollInput = nullptr;
|
||||
bool _mouseButtons[3] = { false, false, false };
|
||||
bool _wasPushed[16] = { };
|
||||
bool _mouseButtons[3] = {false, false, false};
|
||||
bool _wasPushed[16] = {};
|
||||
|
||||
bool ProcessAction(uint32_t button)
|
||||
{
|
||||
if(_getInputState(0, RETRO_DEVICE_JOYPAD, 0, button)) {
|
||||
if(!_wasPushed[button]) {
|
||||
if (_getInputState(0, RETRO_DEVICE_JOYPAD, 0, button))
|
||||
{
|
||||
if (!_wasPushed[button])
|
||||
{
|
||||
//Newly pressed, process action
|
||||
_wasPushed[button] = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
_wasPushed[button] = false;
|
||||
}
|
||||
return false;
|
||||
|
@ -52,11 +56,13 @@ public:
|
|||
// Inherited via IKeyManager
|
||||
virtual void RefreshState() override
|
||||
{
|
||||
if(_pollInput) {
|
||||
if (_pollInput)
|
||||
{
|
||||
_pollInput();
|
||||
}
|
||||
|
||||
if(_getInputState) {
|
||||
if (_getInputState)
|
||||
{
|
||||
int32_t x = _getInputState(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X);
|
||||
int32_t y = _getInputState(0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y);
|
||||
|
||||
|
@ -69,17 +75,23 @@ public:
|
|||
int16_t dy = _getInputState(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
|
||||
KeyManager::SetMouseMovement(dx, dy);
|
||||
|
||||
_mouseButtons[(int)MouseButton::LeftButton] = _getInputState(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT) != 0;
|
||||
_mouseButtons[(int)MouseButton::RightButton] = _getInputState(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT) != 0;
|
||||
_mouseButtons[(int)MouseButton::MiddleButton] = _getInputState(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_MIDDLE) != 0;
|
||||
_mouseButtons[(int)MouseButton::LeftButton] = _getInputState(0, RETRO_DEVICE_MOUSE, 0,
|
||||
RETRO_DEVICE_ID_MOUSE_LEFT) != 0;
|
||||
_mouseButtons[(int)MouseButton::RightButton] = _getInputState(0, RETRO_DEVICE_MOUSE, 0,
|
||||
RETRO_DEVICE_ID_MOUSE_RIGHT) != 0;
|
||||
_mouseButtons[(int)MouseButton::MiddleButton] = _getInputState(0, RETRO_DEVICE_MOUSE, 0,
|
||||
RETRO_DEVICE_ID_MOUSE_MIDDLE) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool IsKeyPressed(uint32_t keyCode) override
|
||||
{
|
||||
if(keyCode > 0 && _getInputState) {
|
||||
if (keyCode > 0 && _getInputState)
|
||||
{
|
||||
return _getInputState(keyCode >> 8, RETRO_DEVICE_JOYPAD, 0, (keyCode - 1) & 0xFF) != 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,13 +25,17 @@ public:
|
|||
// Inherited via IMessageManager
|
||||
virtual void DisplayMessage(string title, string message) override
|
||||
{
|
||||
if(title.empty()) {
|
||||
if(_log) {
|
||||
if (title.empty())
|
||||
{
|
||||
if (_log)
|
||||
{
|
||||
_log(RETRO_LOG_INFO, message.c_str());
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
string osdMessage = "[" + title + "] " + message;
|
||||
retro_message msg = { osdMessage.c_str(), 180 };
|
||||
retro_message msg = {osdMessage.c_str(), 180};
|
||||
_retroEnv(RETRO_ENVIRONMENT_SET_MESSAGE, &msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,13 +30,15 @@ public:
|
|||
}
|
||||
|
||||
// Inherited via IRenderingDevice
|
||||
virtual void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height) override
|
||||
virtual void UpdateFrame(void* frameBuffer, uint32_t width, uint32_t height) override
|
||||
{
|
||||
if (!_skipMode && _sendFrame)
|
||||
{
|
||||
if(!_skipMode && _sendFrame) {
|
||||
//Use Blargg's NTSC filter's max size as a minimum resolution, to prevent changing resolution too often
|
||||
int32_t newWidth = std::max<int32_t>(width, SNES_NTSC_OUT_WIDTH(256));
|
||||
int32_t newHeight = std::max<int32_t>(height, 239 * 2);
|
||||
if(_retroEnv != nullptr && (_previousWidth != newWidth || _previousHeight != newHeight)) {
|
||||
if (_retroEnv != nullptr && (_previousWidth != newWidth || _previousHeight != newHeight))
|
||||
{
|
||||
//Resolution change is needed
|
||||
retro_system_av_info avInfo = {};
|
||||
GetSystemAudioVideoInfo(avInfo, newWidth, newHeight);
|
||||
|
@ -50,11 +52,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void GetSystemAudioVideoInfo(retro_system_av_info &info, int32_t maxWidth = 0, int32_t maxHeight = 0)
|
||||
void GetSystemAudioVideoInfo(retro_system_av_info& info, int32_t maxWidth = 0, int32_t maxHeight = 0)
|
||||
{
|
||||
AudioConfig audio = _console->GetSettings()->GetAudioConfig();
|
||||
|
||||
info.timing.fps = _console->GetRegion() == ConsoleRegion::Ntsc ? 60.098811862348404716732985230828 : 50.006977968268290848936010226333;
|
||||
info.timing.fps = _console->GetRegion() == ConsoleRegion::Ntsc
|
||||
? 60.098811862348404716732985230828
|
||||
: 50.006977968268290848936010226333;
|
||||
info.timing.sample_rate = audio.SampleRate;
|
||||
|
||||
OverscanDimensions overscan = _console->GetSettings()->GetOverscan();
|
||||
|
@ -62,15 +66,22 @@ public:
|
|||
int height = (239 - overscan.Top - overscan.Bottom);
|
||||
|
||||
double aspectRatio = _console->GetSettings()->GetAspectRatio(_console->GetRegion());
|
||||
if(aspectRatio != 0.0) {
|
||||
if (aspectRatio != 0.0)
|
||||
{
|
||||
VideoAspectRatio aspect = _console->GetSettings()->GetVideoConfig().AspectRatio;
|
||||
bool usePar = aspect == VideoAspectRatio::NTSC || aspect == VideoAspectRatio::PAL || aspect == VideoAspectRatio::Auto;
|
||||
if(usePar) {
|
||||
bool usePar = aspect == VideoAspectRatio::NTSC || aspect == VideoAspectRatio::PAL || aspect ==
|
||||
VideoAspectRatio::Auto;
|
||||
if (usePar)
|
||||
{
|
||||
info.geometry.aspect_ratio = (float)(width * aspectRatio / height);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
info.geometry.aspect_ratio = (float)aspectRatio;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
info.geometry.aspect_ratio = (float)width / height;
|
||||
}
|
||||
|
||||
|
@ -80,7 +91,8 @@ public:
|
|||
info.geometry.max_width = maxWidth;
|
||||
info.geometry.max_height = maxHeight;
|
||||
|
||||
if(maxHeight > 0 && maxWidth > 0) {
|
||||
if (maxHeight > 0 && maxWidth > 0)
|
||||
{
|
||||
_previousWidth = maxWidth;
|
||||
_previousHeight = maxHeight;
|
||||
}
|
||||
|
@ -104,7 +116,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void SetFullscreenMode(bool fullscreen, void *windowHandle, uint32_t monitorWidth, uint32_t monitorHeight) override
|
||||
virtual void SetFullscreenMode(bool fullscreen, void* windowHandle, uint32_t monitorWidth,
|
||||
uint32_t monitorHeight) override
|
||||
{
|
||||
}
|
||||
};
|
|
@ -23,11 +23,13 @@ public:
|
|||
}
|
||||
|
||||
// Inherited via IAudioDevice
|
||||
virtual void PlayBuffer(int16_t *soundBuffer, uint32_t sampleCount, uint32_t sampleRate, bool isStereo) override
|
||||
virtual void PlayBuffer(int16_t* soundBuffer, uint32_t sampleCount, uint32_t sampleRate, bool isStereo) override
|
||||
{
|
||||
if(!_skipMode && _sendAudioSample) {
|
||||
for(uint32_t total = 0; total < sampleCount; ) {
|
||||
total += (uint32_t)_sendAudioSample(soundBuffer + total*2, (size_t)(sampleCount - total));
|
||||
if (!_skipMode && _sendAudioSample)
|
||||
{
|
||||
for (uint32_t total = 0; total < sampleCount;)
|
||||
{
|
||||
total += (uint32_t)_sendAudioSample(soundBuffer + total * 2, (size_t)(sampleCount - total));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
static retro_log_printf_t logCallback = nullptr;
|
||||
static retro_environment_t retroEnv = nullptr;
|
||||
static unsigned _inputDevices[5] = { DEVICE_GAMEPAD, DEVICE_GAMEPAD, DEVICE_NONE, DEVICE_NONE, DEVICE_NONE };
|
||||
static unsigned _inputDevices[5] = {DEVICE_GAMEPAD, DEVICE_GAMEPAD, DEVICE_NONE, DEVICE_NONE, DEVICE_NONE};
|
||||
static string _mesenVersion = "";
|
||||
static int32_t _saveStateSize = -1;
|
||||
|
||||
|
@ -55,24 +55,28 @@ static constexpr const char* MesenGbModel = "mesen-s_gbmodel";
|
|||
static constexpr const char* MesenGbSgb2 = "mesen-s_sgb2";
|
||||
|
||||
extern "C" {
|
||||
void logMessage(retro_log_level level, const char* message)
|
||||
void logMessage(retro_log_level level, const char* message)
|
||||
{
|
||||
if (logCallback)
|
||||
{
|
||||
if(logCallback) {
|
||||
logCallback(level, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API unsigned retro_api_version()
|
||||
{
|
||||
RETRO_API unsigned retro_api_version()
|
||||
{
|
||||
return RETRO_API_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_init()
|
||||
{
|
||||
RETRO_API void retro_init()
|
||||
{
|
||||
struct retro_log_callback log;
|
||||
if(retroEnv(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) {
|
||||
if (retroEnv(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
|
||||
{
|
||||
logCallback = log.log;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
logCallback = nullptr;
|
||||
}
|
||||
|
||||
|
@ -94,10 +98,10 @@ extern "C" {
|
|||
preferences.DisableOsd = true;
|
||||
preferences.RewindBufferSize = 0;
|
||||
_console->GetSettings()->SetPreferences(preferences);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_deinit()
|
||||
{
|
||||
RETRO_API void retro_deinit()
|
||||
{
|
||||
_renderer.reset();
|
||||
_soundManager.reset();
|
||||
_keyManager.reset();
|
||||
|
@ -106,115 +110,116 @@ extern "C" {
|
|||
//_console->SaveBatteries();
|
||||
_console->Release();
|
||||
_console.reset();
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_environment(retro_environment_t env)
|
||||
{
|
||||
RETRO_API void retro_set_environment(retro_environment_t env)
|
||||
{
|
||||
retroEnv = env;
|
||||
|
||||
static constexpr struct retro_variable vars[] = {
|
||||
{ MesenNtscFilter, "NTSC filter; Disabled|Composite (Blargg)|S-Video (Blargg)|RGB (Blargg)|Monochrome (Blargg)" },
|
||||
{ MesenRegion, "Region; Auto|NTSC|PAL" },
|
||||
{ MesenGbModel, "Game Boy Model; Auto|Game Boy|Game Boy Color|Super Game Boy" },
|
||||
{ MesenGbSgb2, "Use SGB2; enabled|disabled" },
|
||||
{ MesenOverscanVertical, "Vertical Overscan; None|8px|16px" },
|
||||
{ MesenOverscanHorizontal, "Horizontal Overscan; None|8px|16px" },
|
||||
{ MesenAspectRatio, "Aspect Ratio; Auto|No Stretching|NTSC|PAL|4:3|16:9" },
|
||||
{ MesenBlendHighRes, "Blend Hi-Res Modes; disabled|enabled" },
|
||||
{ MesenCubicInterpolation, "Cubic Interpolation (Audio); disabled|enabled" },
|
||||
{ MesenOverclock, "Overclock; None|Low|Medium|High|Very High" },
|
||||
{ MesenOverclockType, "Overclock Type; Before NMI|After NMI" },
|
||||
{ MesenSuperFxOverclock, "Super FX Clock Speed; 100%|200%|300%|400%|500%|1000%" },
|
||||
{ MesenRamState, "Default power-on state for RAM; Random Values (Default)|All 0s|All 1s" },
|
||||
{ NULL, NULL },
|
||||
{MesenNtscFilter, "NTSC filter; Disabled|Composite (Blargg)|S-Video (Blargg)|RGB (Blargg)|Monochrome (Blargg)"},
|
||||
{MesenRegion, "Region; Auto|NTSC|PAL"},
|
||||
{MesenGbModel, "Game Boy Model; Auto|Game Boy|Game Boy Color|Super Game Boy"},
|
||||
{MesenGbSgb2, "Use SGB2; enabled|disabled"},
|
||||
{MesenOverscanVertical, "Vertical Overscan; None|8px|16px"},
|
||||
{MesenOverscanHorizontal, "Horizontal Overscan; None|8px|16px"},
|
||||
{MesenAspectRatio, "Aspect Ratio; Auto|No Stretching|NTSC|PAL|4:3|16:9"},
|
||||
{MesenBlendHighRes, "Blend Hi-Res Modes; disabled|enabled"},
|
||||
{MesenCubicInterpolation, "Cubic Interpolation (Audio); disabled|enabled"},
|
||||
{MesenOverclock, "Overclock; None|Low|Medium|High|Very High"},
|
||||
{MesenOverclockType, "Overclock Type; Before NMI|After NMI"},
|
||||
{MesenSuperFxOverclock, "Super FX Clock Speed; 100%|200%|300%|400%|500%|1000%"},
|
||||
{MesenRamState, "Default power-on state for RAM; Random Values (Default)|All 0s|All 1s"},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
static constexpr struct retro_controller_description pads1[] = {
|
||||
{ "None", DEVICE_NONE },
|
||||
{ "SNES Controller", DEVICE_GAMEPAD },
|
||||
{ "SNES Mouse", DEVICE_SNESMOUSE },
|
||||
{ NULL, 0 },
|
||||
{"None", DEVICE_NONE},
|
||||
{"SNES Controller", DEVICE_GAMEPAD},
|
||||
{"SNES Mouse", DEVICE_SNESMOUSE},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
static constexpr struct retro_controller_description pads2[] = {
|
||||
{ "None", DEVICE_NONE },
|
||||
{ "SNES Controller", DEVICE_GAMEPAD },
|
||||
{ "SNES Mouse", DEVICE_SNESMOUSE },
|
||||
{ "Super Scope", DEVICE_SUPERSCOPE },
|
||||
{ "Multitap", DEVICE_MULTITAP },
|
||||
{ NULL, 0 },
|
||||
{"None", DEVICE_NONE},
|
||||
{"SNES Controller", DEVICE_GAMEPAD},
|
||||
{"SNES Mouse", DEVICE_SNESMOUSE},
|
||||
{"Super Scope", DEVICE_SUPERSCOPE},
|
||||
{"Multitap", DEVICE_MULTITAP},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
static constexpr struct retro_controller_description pads3[] = {
|
||||
{ "SNES Controller", DEVICE_GAMEPAD },
|
||||
{ NULL, 0 },
|
||||
{"SNES Controller", DEVICE_GAMEPAD},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
static constexpr struct retro_controller_description pads4[] = {
|
||||
{ "SNES Controller", DEVICE_GAMEPAD },
|
||||
{ NULL, 0 },
|
||||
{"SNES Controller", DEVICE_GAMEPAD},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
static constexpr struct retro_controller_description pads5[] = {
|
||||
{ "SNES Controller", DEVICE_GAMEPAD },
|
||||
{ NULL, 0 },
|
||||
{"SNES Controller", DEVICE_GAMEPAD},
|
||||
{NULL, 0},
|
||||
};
|
||||
|
||||
static constexpr struct retro_controller_info ports[] = {
|
||||
{ pads1, 3 },
|
||||
{ pads2, 5 },
|
||||
{ pads3, 1 },
|
||||
{ pads4, 1 },
|
||||
{ pads5, 1 },
|
||||
{ 0 },
|
||||
{pads1, 3},
|
||||
{pads2, 5},
|
||||
{pads3, 1},
|
||||
{pads4, 1},
|
||||
{pads5, 1},
|
||||
{0},
|
||||
};
|
||||
|
||||
retroEnv(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
|
||||
retroEnv(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_video_refresh(retro_video_refresh_t sendFrame)
|
||||
{
|
||||
RETRO_API void retro_set_video_refresh(retro_video_refresh_t sendFrame)
|
||||
{
|
||||
_renderer->SetVideoCallback(sendFrame);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_audio_sample(retro_audio_sample_t sendAudioSample)
|
||||
{
|
||||
}
|
||||
RETRO_API void retro_set_audio_sample(retro_audio_sample_t sendAudioSample)
|
||||
{
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_audio_sample_batch(retro_audio_sample_batch_t audioSampleBatch)
|
||||
{
|
||||
RETRO_API void retro_set_audio_sample_batch(retro_audio_sample_batch_t audioSampleBatch)
|
||||
{
|
||||
_soundManager->SetSendAudioSample(audioSampleBatch);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_input_poll(retro_input_poll_t pollInput)
|
||||
{
|
||||
RETRO_API void retro_set_input_poll(retro_input_poll_t pollInput)
|
||||
{
|
||||
_keyManager->SetPollInput(pollInput);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_input_state(retro_input_state_t getInputState)
|
||||
{
|
||||
RETRO_API void retro_set_input_state(retro_input_state_t getInputState)
|
||||
{
|
||||
_keyManager->SetGetInputState(getInputState);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_reset()
|
||||
{
|
||||
RETRO_API void retro_reset()
|
||||
{
|
||||
_console->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
bool readVariable(const char* key, retro_variable &var)
|
||||
{
|
||||
bool readVariable(const char* key, retro_variable& var)
|
||||
{
|
||||
var.key = key;
|
||||
var.value = nullptr;
|
||||
if(retroEnv(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value != nullptr) {
|
||||
if (retroEnv(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value != nullptr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void update_settings()
|
||||
{
|
||||
struct retro_variable var = { };
|
||||
void update_settings()
|
||||
{
|
||||
struct retro_variable var = {};
|
||||
shared_ptr<EmuSettings> settings = _console->GetSettings();
|
||||
VideoConfig video = settings->GetVideoConfig();
|
||||
AudioConfig audio = settings->GetAudioConfig();
|
||||
|
@ -227,11 +232,15 @@ extern "C" {
|
|||
video.Saturation = 0;
|
||||
video.ScanlineIntensity = 0;
|
||||
|
||||
if(readVariable(MesenNtscFilter, var)) {
|
||||
if (readVariable(MesenNtscFilter, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "Disabled") {
|
||||
if (value == "Disabled")
|
||||
{
|
||||
video.VideoFilter = VideoFilterType::None;
|
||||
} else if(value == "Composite (Blargg)") {
|
||||
}
|
||||
else if (value == "Composite (Blargg)")
|
||||
{
|
||||
video.VideoFilter = VideoFilterType::NTSC;
|
||||
video.NtscArtifacts = 0;
|
||||
video.NtscBleed = 0;
|
||||
|
@ -240,7 +249,9 @@ extern "C" {
|
|||
video.NtscResolution = 0;
|
||||
video.NtscSharpness = 0;
|
||||
video.NtscMergeFields = false;
|
||||
} else if(value == "S-Video (Blargg)") {
|
||||
}
|
||||
else if (value == "S-Video (Blargg)")
|
||||
{
|
||||
video.VideoFilter = VideoFilterType::NTSC;
|
||||
video.NtscArtifacts = -1.0;
|
||||
video.NtscBleed = 0;
|
||||
|
@ -249,7 +260,9 @@ extern "C" {
|
|||
video.NtscResolution = 0.2;
|
||||
video.NtscSharpness = 0.2;
|
||||
video.NtscMergeFields = false;
|
||||
} else if(value == "RGB (Blargg)") {
|
||||
}
|
||||
else if (value == "RGB (Blargg)")
|
||||
{
|
||||
video.VideoFilter = VideoFilterType::NTSC;
|
||||
video.NtscArtifacts = -1.0;
|
||||
video.NtscBleed = -1.0;
|
||||
|
@ -258,7 +271,9 @@ extern "C" {
|
|||
video.NtscResolution = 0.7;
|
||||
video.NtscSharpness = 0.2;
|
||||
video.NtscMergeFields = false;
|
||||
} else if(value == "Monochrome (Blargg)") {
|
||||
}
|
||||
else if (value == "Monochrome (Blargg)")
|
||||
{
|
||||
video.VideoFilter = VideoFilterType::NTSC;
|
||||
video.Saturation = -1.0;
|
||||
video.NtscArtifacts = -0.2;
|
||||
|
@ -272,71 +287,106 @@ extern "C" {
|
|||
}
|
||||
|
||||
bool beforeNmi = true;
|
||||
if(readVariable(MesenOverclockType, var)) {
|
||||
if (readVariable(MesenOverclockType, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "After NMI") {
|
||||
if (value == "After NMI")
|
||||
{
|
||||
beforeNmi = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(readVariable(MesenOverclock, var)) {
|
||||
if (readVariable(MesenOverclock, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
int lineCount = 0;
|
||||
if(value == "None") {
|
||||
if (value == "None")
|
||||
{
|
||||
lineCount = 0;
|
||||
} else if(value == "Low") {
|
||||
}
|
||||
else if (value == "Low")
|
||||
{
|
||||
lineCount = 100;
|
||||
} else if(value == "Medium") {
|
||||
}
|
||||
else if (value == "Medium")
|
||||
{
|
||||
lineCount = 250;
|
||||
} else if(value == "High") {
|
||||
}
|
||||
else if (value == "High")
|
||||
{
|
||||
lineCount = 500;
|
||||
} else if(value == "Very High") {
|
||||
}
|
||||
else if (value == "Very High")
|
||||
{
|
||||
lineCount = 1000;
|
||||
}
|
||||
|
||||
if(beforeNmi) {
|
||||
if (beforeNmi)
|
||||
{
|
||||
emulation.PpuExtraScanlinesBeforeNmi = lineCount;
|
||||
emulation.PpuExtraScanlinesAfterNmi = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
emulation.PpuExtraScanlinesAfterNmi = lineCount;
|
||||
emulation.PpuExtraScanlinesBeforeNmi = 0;
|
||||
}
|
||||
}
|
||||
|
||||
emulation.GsuClockSpeed = 100;
|
||||
if(readVariable(MesenSuperFxOverclock, var)) {
|
||||
if (readVariable(MesenSuperFxOverclock, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "100%") {
|
||||
if (value == "100%")
|
||||
{
|
||||
emulation.GsuClockSpeed = 100;
|
||||
} else if(value == "200%") {
|
||||
}
|
||||
else if (value == "200%")
|
||||
{
|
||||
emulation.GsuClockSpeed = 200;
|
||||
} else if(value == "300%") {
|
||||
}
|
||||
else if (value == "300%")
|
||||
{
|
||||
emulation.GsuClockSpeed = 300;
|
||||
} else if(value == "400%") {
|
||||
}
|
||||
else if (value == "400%")
|
||||
{
|
||||
emulation.GsuClockSpeed = 400;
|
||||
} else if(value == "500%") {
|
||||
}
|
||||
else if (value == "500%")
|
||||
{
|
||||
emulation.GsuClockSpeed = 500;
|
||||
} else if(value == "1000%") {
|
||||
}
|
||||
else if (value == "1000%")
|
||||
{
|
||||
emulation.GsuClockSpeed = 1000;
|
||||
}
|
||||
}
|
||||
|
||||
int overscanHorizontal = 0;
|
||||
int overscanVertical = 0;
|
||||
if(readVariable(MesenOverscanHorizontal, var)) {
|
||||
if (readVariable(MesenOverscanHorizontal, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "8px") {
|
||||
if (value == "8px")
|
||||
{
|
||||
overscanHorizontal = 8;
|
||||
} else if(value == "16px") {
|
||||
}
|
||||
else if (value == "16px")
|
||||
{
|
||||
overscanHorizontal = 16;
|
||||
}
|
||||
}
|
||||
|
||||
if(readVariable(MesenOverscanVertical, var)) {
|
||||
if (readVariable(MesenOverscanVertical, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "8px") {
|
||||
if (value == "8px")
|
||||
{
|
||||
overscanVertical = 8;
|
||||
} else if(value == "16px") {
|
||||
}
|
||||
else if (value == "16px")
|
||||
{
|
||||
overscanVertical = 16;
|
||||
}
|
||||
}
|
||||
|
@ -346,78 +396,115 @@ extern "C" {
|
|||
video.OverscanTop = std::max(0, overscanVertical - 1);
|
||||
video.OverscanBottom = overscanVertical;
|
||||
|
||||
if(readVariable(MesenAspectRatio, var)) {
|
||||
if (readVariable(MesenAspectRatio, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "Auto") {
|
||||
if (value == "Auto")
|
||||
{
|
||||
video.AspectRatio = VideoAspectRatio::Auto;
|
||||
} else if(value == "No Stretching") {
|
||||
}
|
||||
else if (value == "No Stretching")
|
||||
{
|
||||
video.AspectRatio = VideoAspectRatio::NoStretching;
|
||||
} else if(value == "NTSC") {
|
||||
}
|
||||
else if (value == "NTSC")
|
||||
{
|
||||
video.AspectRatio = VideoAspectRatio::NTSC;
|
||||
} else if(value == "PAL") {
|
||||
}
|
||||
else if (value == "PAL")
|
||||
{
|
||||
video.AspectRatio = VideoAspectRatio::PAL;
|
||||
} else if(value == "4:3") {
|
||||
}
|
||||
else if (value == "4:3")
|
||||
{
|
||||
video.AspectRatio = VideoAspectRatio::Standard;
|
||||
} else if(value == "16:9") {
|
||||
}
|
||||
else if (value == "16:9")
|
||||
{
|
||||
video.AspectRatio = VideoAspectRatio::Widescreen;
|
||||
}
|
||||
}
|
||||
|
||||
if(readVariable(MesenRegion, var)) {
|
||||
if (readVariable(MesenRegion, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "Auto") {
|
||||
if (value == "Auto")
|
||||
{
|
||||
emulation.Region = ConsoleRegion::Auto;
|
||||
} else if(value == "NTSC") {
|
||||
}
|
||||
else if (value == "NTSC")
|
||||
{
|
||||
emulation.Region = ConsoleRegion::Ntsc;
|
||||
} else if(value == "PAL") {
|
||||
}
|
||||
else if (value == "PAL")
|
||||
{
|
||||
emulation.Region = ConsoleRegion::Pal;
|
||||
}
|
||||
}
|
||||
|
||||
if(readVariable(MesenRamState, var)) {
|
||||
if (readVariable(MesenRamState, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "Random Values (Default)") {
|
||||
if (value == "Random Values (Default)")
|
||||
{
|
||||
emulation.RamPowerOnState = RamState::Random;
|
||||
} else if(value == "All 0s") {
|
||||
}
|
||||
else if (value == "All 0s")
|
||||
{
|
||||
emulation.RamPowerOnState = RamState::AllZeros;
|
||||
} else if(value == "All 1s") {
|
||||
}
|
||||
else if (value == "All 1s")
|
||||
{
|
||||
emulation.RamPowerOnState = RamState::AllOnes;
|
||||
}
|
||||
}
|
||||
|
||||
if(readVariable(MesenBlendHighRes, var)) {
|
||||
if (readVariable(MesenBlendHighRes, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
video.BlendHighResolutionModes = (value == "enabled");
|
||||
}
|
||||
|
||||
if(readVariable(MesenCubicInterpolation, var)) {
|
||||
if (readVariable(MesenCubicInterpolation, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
audio.EnableCubicInterpolation = (value == "enabled");
|
||||
}
|
||||
|
||||
if(readVariable(MesenGbModel, var)) {
|
||||
if (readVariable(MesenGbModel, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
if(value == "Game Boy") {
|
||||
if (value == "Game Boy")
|
||||
{
|
||||
gbConfig.Model = GameboyModel::Gameboy;
|
||||
} else if(value == "Game Boy Color") {
|
||||
}
|
||||
else if (value == "Game Boy Color")
|
||||
{
|
||||
gbConfig.Model = GameboyModel::GameboyColor;
|
||||
} else if(value == "Super Game Boy") {
|
||||
}
|
||||
else if (value == "Super Game Boy")
|
||||
{
|
||||
gbConfig.Model = GameboyModel::SuperGameboy;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
gbConfig.Model = GameboyModel::Auto;
|
||||
}
|
||||
}
|
||||
|
||||
if(readVariable(MesenGbSgb2, var)) {
|
||||
if (readVariable(MesenGbSgb2, var))
|
||||
{
|
||||
string value = string(var.value);
|
||||
gbConfig.UseSgb2 = (value == "enabled");
|
||||
}
|
||||
|
||||
auto getKeyCode = [=](int port, int retroKey) {
|
||||
auto getKeyCode = [=](int port, int retroKey)
|
||||
{
|
||||
return (port << 8) | (retroKey + 1);
|
||||
};
|
||||
|
||||
auto getKeyBindings = [=](int port) {
|
||||
auto getKeyBindings = [=](int port)
|
||||
{
|
||||
KeyMappingSet keyMappings;
|
||||
keyMappings.TurboSpeed = 0;
|
||||
keyMappings.Mapping1.L = getKeyCode(port, RETRO_DEVICE_ID_JOYPAD_L);
|
||||
|
@ -452,42 +539,47 @@ extern "C" {
|
|||
retro_system_av_info avInfo = {};
|
||||
_renderer->GetSystemAudioVideoInfo(avInfo);
|
||||
retroEnv(RETRO_ENVIRONMENT_SET_GEOMETRY, &avInfo);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_run()
|
||||
{
|
||||
RETRO_API void retro_run()
|
||||
{
|
||||
bool updated = false;
|
||||
if(retroEnv(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) {
|
||||
if (retroEnv(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||
{
|
||||
update_settings();
|
||||
}
|
||||
|
||||
bool isFastForward = false;
|
||||
EmulationConfig cfg = _console->GetSettings()->GetEmulationConfig();
|
||||
if(retroEnv(RETRO_ENVIRONMENT_GET_FASTFORWARDING, &isFastForward) && isFastForward) {
|
||||
if (retroEnv(RETRO_ENVIRONMENT_GET_FASTFORWARDING, &isFastForward) && isFastForward)
|
||||
{
|
||||
//Allow core to skip frame rendering during fast forwarding
|
||||
cfg.EmulationSpeed = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg.EmulationSpeed = 100;
|
||||
}
|
||||
_console->GetSettings()->SetEmulationConfig(cfg);
|
||||
|
||||
_console->RunSingleFrame();
|
||||
|
||||
if(updated) {
|
||||
if (updated)
|
||||
{
|
||||
//Update geometry after running the frame, in case the console's region changed (affects "auto" aspect ratio)
|
||||
retro_system_av_info avInfo = {};
|
||||
_renderer->GetSystemAudioVideoInfo(avInfo);
|
||||
retroEnv(RETRO_ENVIRONMENT_SET_GEOMETRY, &avInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API size_t retro_serialize_size()
|
||||
{
|
||||
RETRO_API size_t retro_serialize_size()
|
||||
{
|
||||
return _saveStateSize;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API bool retro_serialize(void *data, size_t size)
|
||||
{
|
||||
RETRO_API bool retro_serialize(void* data, size_t size)
|
||||
{
|
||||
std::stringstream ss;
|
||||
_console->GetSaveStateManager()->SaveState(ss);
|
||||
|
||||
|
@ -496,52 +588,62 @@ extern "C" {
|
|||
memcpy(data, saveStateData.c_str(), std::min(size, saveStateData.size()));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API bool retro_unserialize(const void *data, size_t size)
|
||||
{
|
||||
RETRO_API bool retro_unserialize(const void* data, size_t size)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss.write((const char*)data, size);
|
||||
return _console->GetSaveStateManager()->LoadState(ss);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_cheat_reset()
|
||||
{
|
||||
RETRO_API void retro_cheat_reset()
|
||||
{
|
||||
_console->GetCheatManager()->ClearCheats();
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *codeStr)
|
||||
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char* codeStr)
|
||||
{
|
||||
if (codeStr)
|
||||
{
|
||||
if(codeStr) {
|
||||
_console->GetCheatManager()->AddStringCheat(codeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update_input_descriptors()
|
||||
{
|
||||
void update_input_descriptors()
|
||||
{
|
||||
vector<retro_input_descriptor> desc;
|
||||
|
||||
auto addDesc = [&desc](unsigned port, unsigned button, const char* name) {
|
||||
retro_input_descriptor d = { port, RETRO_DEVICE_JOYPAD, 0, button, name };
|
||||
auto addDesc = [&desc](unsigned port, unsigned button, const char* name)
|
||||
{
|
||||
retro_input_descriptor d = {port, RETRO_DEVICE_JOYPAD, 0, button, name};
|
||||
desc.push_back(d);
|
||||
};
|
||||
|
||||
auto setupPlayerButtons = [addDesc](int port) {
|
||||
auto setupPlayerButtons = [addDesc](int port)
|
||||
{
|
||||
unsigned device = _inputDevices[port];
|
||||
if(device == DEVICE_AUTO) {
|
||||
if(port <= 4) {
|
||||
switch(_console->GetSettings()->GetInputConfig().Controllers[port].Type) {
|
||||
if (device == DEVICE_AUTO)
|
||||
{
|
||||
if (port <= 4)
|
||||
{
|
||||
switch (_console->GetSettings()->GetInputConfig().Controllers[port].Type)
|
||||
{
|
||||
case ControllerType::Multitap:
|
||||
case ControllerType::SnesController: device = DEVICE_GAMEPAD; break;
|
||||
case ControllerType::SnesController: device = DEVICE_GAMEPAD;
|
||||
break;
|
||||
|
||||
case ControllerType::SuperScope: device = DEVICE_SUPERSCOPE; break;
|
||||
case ControllerType::SnesMouse: device = DEVICE_SNESMOUSE; break;
|
||||
case ControllerType::SuperScope: device = DEVICE_SUPERSCOPE;
|
||||
break;
|
||||
case ControllerType::SnesMouse: device = DEVICE_SNESMOUSE;
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(device == DEVICE_GAMEPAD) {
|
||||
if (device == DEVICE_GAMEPAD)
|
||||
{
|
||||
addDesc(port, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left");
|
||||
addDesc(port, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up");
|
||||
addDesc(port, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down");
|
||||
|
@ -559,54 +661,66 @@ extern "C" {
|
|||
|
||||
setupPlayerButtons(0);
|
||||
setupPlayerButtons(1);
|
||||
if(_console->GetSettings()->GetInputConfig().Controllers[1].Type == ControllerType::Multitap) {
|
||||
if (_console->GetSettings()->GetInputConfig().Controllers[1].Type == ControllerType::Multitap)
|
||||
{
|
||||
setupPlayerButtons(2);
|
||||
setupPlayerButtons(3);
|
||||
setupPlayerButtons(4);
|
||||
}
|
||||
|
||||
retro_input_descriptor end = { 0 };
|
||||
retro_input_descriptor end = {0};
|
||||
desc.push_back(end);
|
||||
|
||||
retroEnv(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc.data());
|
||||
}
|
||||
}
|
||||
|
||||
void update_core_controllers()
|
||||
{
|
||||
void update_core_controllers()
|
||||
{
|
||||
InputConfig input = _console->GetSettings()->GetInputConfig();
|
||||
for(int port = 0; port < 2; port++) {
|
||||
for (int port = 0; port < 2; port++)
|
||||
{
|
||||
ControllerType type = ControllerType::SnesController;
|
||||
switch(_inputDevices[port]) {
|
||||
case RETRO_DEVICE_NONE: type = ControllerType::None; break;
|
||||
case DEVICE_GAMEPAD: type = ControllerType::SnesController; break;
|
||||
case DEVICE_MULTITAP: type = ControllerType::Multitap; break;
|
||||
case DEVICE_SNESMOUSE: type = ControllerType::SnesMouse; break;
|
||||
case DEVICE_SUPERSCOPE: type = ControllerType::SuperScope; break;
|
||||
switch (_inputDevices[port])
|
||||
{
|
||||
case RETRO_DEVICE_NONE: type = ControllerType::None;
|
||||
break;
|
||||
case DEVICE_GAMEPAD: type = ControllerType::SnesController;
|
||||
break;
|
||||
case DEVICE_MULTITAP: type = ControllerType::Multitap;
|
||||
break;
|
||||
case DEVICE_SNESMOUSE: type = ControllerType::SnesMouse;
|
||||
break;
|
||||
case DEVICE_SUPERSCOPE: type = ControllerType::SuperScope;
|
||||
break;
|
||||
}
|
||||
input.Controllers[port].Type = type;
|
||||
}
|
||||
|
||||
_console->GetSettings()->SetInputConfig(input);
|
||||
}
|
||||
}
|
||||
|
||||
void retro_set_memory_maps()
|
||||
{
|
||||
void retro_set_memory_maps()
|
||||
{
|
||||
shared_ptr<BaseCartridge> cart = _console->GetCartridge();
|
||||
Gameboy* gb = cart->GetGameboy();
|
||||
if(gb) {
|
||||
if (gb)
|
||||
{
|
||||
retro_memory_descriptor descriptors[20] = {};
|
||||
uint32_t count = 0;
|
||||
|
||||
auto addDescriptor = [&count, &descriptors](uint8_t* ptr, uint32_t address, uint32_t length) {
|
||||
auto addDescriptor = [&count, &descriptors](uint8_t* ptr, uint32_t address, uint32_t length)
|
||||
{
|
||||
descriptors[count].ptr = ptr;
|
||||
descriptors[count].start = (size_t)address;
|
||||
descriptors[count].len = (size_t)length;
|
||||
count++;
|
||||
};
|
||||
|
||||
addDescriptor(gb->DebugGetMemory(SnesMemoryType::GbPrgRom), 0x0000, std::min(0x8000, (int)gb->DebugGetMemorySize(SnesMemoryType::GbPrgRom)));
|
||||
addDescriptor(gb->DebugGetMemory(SnesMemoryType::GbPrgRom), 0x0000,
|
||||
std::min(0x8000, (int)gb->DebugGetMemorySize(SnesMemoryType::GbPrgRom)));
|
||||
addDescriptor(gb->DebugGetMemory(SnesMemoryType::GbVideoRam), 0x8000, 0x2000);
|
||||
if(gb->DebugGetMemory(SnesMemoryType::GbCartRam)) {
|
||||
if (gb->DebugGetMemory(SnesMemoryType::GbCartRam))
|
||||
{
|
||||
uint32_t size = std::min(0x2000u, gb->DebugGetMemorySize(SnesMemoryType::GbCartRam));
|
||||
addDescriptor(gb->DebugGetMemory(SnesMemoryType::GbCartRam), 0xA000, size);
|
||||
}
|
||||
|
@ -616,7 +730,8 @@ extern "C" {
|
|||
|
||||
addDescriptor(gb->DebugGetMemory(SnesMemoryType::GbHighRam), 0xFF80, 0x80);
|
||||
|
||||
if(gb->DebugGetMemorySize(SnesMemoryType::GbWorkRam) == 0x8000) {
|
||||
if (gb->DebugGetMemorySize(SnesMemoryType::GbWorkRam) == 0x8000)
|
||||
{
|
||||
//GBC - map extra work ram at "fake" 0x10000-0x16000 range
|
||||
addDescriptor(gb->DebugGetMemory(SnesMemoryType::WorkRam) + 0x2000, 0x10000, 0x6000);
|
||||
}
|
||||
|
@ -626,31 +741,35 @@ extern "C" {
|
|||
memoryMap.num_descriptors = count;
|
||||
retroEnv(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &memoryMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
{
|
||||
if (port < 5 && _inputDevices[port] != device)
|
||||
{
|
||||
if(port < 5 && _inputDevices[port] != device) {
|
||||
_inputDevices[port] = device;
|
||||
update_core_controllers();
|
||||
update_input_descriptors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API bool retro_load_game(const struct retro_game_info *game)
|
||||
RETRO_API bool retro_load_game(const struct retro_game_info* game)
|
||||
{
|
||||
char* systemFolder;
|
||||
if (!retroEnv(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &systemFolder) || !systemFolder)
|
||||
{
|
||||
char *systemFolder;
|
||||
if(!retroEnv(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &systemFolder) || !systemFolder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *saveFolder;
|
||||
if(!retroEnv(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &saveFolder)) {
|
||||
char* saveFolder;
|
||||
if (!retroEnv(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &saveFolder))
|
||||
{
|
||||
logMessage(RETRO_LOG_ERROR, "Could not find save directory.\n");
|
||||
}
|
||||
|
||||
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
|
||||
if(!retroEnv(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) {
|
||||
if (!retroEnv(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
|
||||
{
|
||||
logMessage(RETRO_LOG_ERROR, "XRGB8888 is not supported.\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -673,7 +792,8 @@ extern "C" {
|
|||
VirtualFile patch;
|
||||
bool result = _console->LoadRom(romData, patch);
|
||||
|
||||
if(result) {
|
||||
if (result)
|
||||
{
|
||||
update_core_controllers();
|
||||
update_input_descriptors();
|
||||
|
||||
|
@ -689,27 +809,28 @@ extern "C" {
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info)
|
||||
{
|
||||
RETRO_API bool retro_load_game_special(unsigned game_type, const struct retro_game_info* info, size_t num_info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_unload_game()
|
||||
{
|
||||
RETRO_API void retro_unload_game()
|
||||
{
|
||||
_console->Stop(false);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API unsigned retro_get_region()
|
||||
{
|
||||
RETRO_API unsigned retro_get_region()
|
||||
{
|
||||
ConsoleRegion region = _console->GetRegion();
|
||||
return region == ConsoleRegion::Ntsc ? RETRO_REGION_NTSC : RETRO_REGION_PAL;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_get_system_info(struct retro_system_info *info)
|
||||
RETRO_API void retro_get_system_info(struct retro_system_info* info)
|
||||
{
|
||||
if (!_console)
|
||||
{
|
||||
if(!_console) {
|
||||
_console.reset(new Console());
|
||||
_console->Initialize();
|
||||
}
|
||||
|
@ -720,44 +841,55 @@ extern "C" {
|
|||
info->need_fullpath = false;
|
||||
info->valid_extensions = "sfc|smc|fig|swc|gb|gbc|bs";
|
||||
info->block_extract = false;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info)
|
||||
{
|
||||
RETRO_API void retro_get_system_av_info(struct retro_system_av_info* info)
|
||||
{
|
||||
_renderer->GetSystemAudioVideoInfo(*info, SNES_NTSC_OUT_WIDTH(256), 239 * 2);
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API void *retro_get_memory_data(unsigned id)
|
||||
{
|
||||
RETRO_API void* retro_get_memory_data(unsigned id)
|
||||
{
|
||||
shared_ptr<BaseCartridge> cart = _console->GetCartridge();
|
||||
if(cart->GetGameboy()) {
|
||||
switch(id) {
|
||||
if (cart->GetGameboy())
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SAVE_RAM: return cart->GetGameboy()->DebugGetMemory(SnesMemoryType::GbCartRam);
|
||||
case RETRO_MEMORY_SYSTEM_RAM: return cart->GetGameboy()->DebugGetMemory(SnesMemoryType::GbWorkRam);
|
||||
}
|
||||
} else {
|
||||
switch(id) {
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SAVE_RAM: return cart->DebugGetSaveRam();
|
||||
case RETRO_MEMORY_SYSTEM_RAM: return _console->GetMemoryManager()->DebugGetWorkRam();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RETRO_API size_t retro_get_memory_size(unsigned id)
|
||||
{
|
||||
RETRO_API size_t retro_get_memory_size(unsigned id)
|
||||
{
|
||||
shared_ptr<BaseCartridge> cart = _console->GetCartridge();
|
||||
if(cart->GetGameboy()) {
|
||||
switch(id) {
|
||||
if (cart->GetGameboy())
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SAVE_RAM: return cart->GetGameboy()->DebugGetMemorySize(SnesMemoryType::GbCartRam);
|
||||
case RETRO_MEMORY_SYSTEM_RAM: return cart->GetGameboy()->DebugGetMemorySize(SnesMemoryType::GbWorkRam);
|
||||
}
|
||||
} else {
|
||||
switch(id) {
|
||||
case RETRO_MEMORY_SAVE_RAM: return cart->DebugGetSaveRamSize(); break;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SAVE_RAM: return cart->DebugGetSaveRamSize();
|
||||
break;
|
||||
case RETRO_MEMORY_SYSTEM_RAM: return MemoryManager::WorkRamSize;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,7 +504,7 @@ enum retro_mod
|
|||
* passing NULL to video frame callback.
|
||||
*/
|
||||
|
||||
/* Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES),
|
||||
/* Environ 4, 5 are no longer supported (GET_VARIABLE / SET_VARIABLES),
|
||||
* and reserved to avoid possible ABI clash.
|
||||
*/
|
||||
|
||||
|
@ -521,7 +521,7 @@ enum retro_mod
|
|||
* way to shutdown the game from a menu item or similar.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL 8
|
||||
/* const unsigned * --
|
||||
/* const unsigned * --
|
||||
* Gives a hint to the frontend how demanding this implementation
|
||||
* is on a system. E.g. reporting a level of 2 means
|
||||
* this implementation should run decently on all frontends
|
||||
|
@ -538,7 +538,7 @@ enum retro_mod
|
|||
* If called, it should be called in retro_load_game().
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY 9
|
||||
/* const char ** --
|
||||
/* const char ** --
|
||||
* Returns the "system" directory of the frontend.
|
||||
* This directory can be used to store system specific
|
||||
* content such as BIOSes, configuration data, etc.
|
||||
|
@ -552,7 +552,7 @@ enum retro_mod
|
|||
* use the new GET_SAVE_DIRECTORY.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10
|
||||
/* const enum retro_pixel_format * --
|
||||
/* const enum retro_pixel_format * --
|
||||
* Sets the internal pixel format used by the implementation.
|
||||
* The default pixel format is RETRO_PIXEL_FORMAT_0RGB1555.
|
||||
* This pixel format however, is deprecated (see enum retro_pixel_format).
|
||||
|
@ -563,7 +563,7 @@ enum retro_mod
|
|||
* retro_get_system_av_info().
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS 11
|
||||
/* const struct retro_input_descriptor * --
|
||||
/* const struct retro_input_descriptor * --
|
||||
* Sets an array of retro_input_descriptors.
|
||||
* It is up to the frontend to present this in a usable way.
|
||||
* The array is terminated by retro_input_descriptor::description
|
||||
|
@ -572,18 +572,18 @@ enum retro_mod
|
|||
* to call it as early as possible.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK 12
|
||||
/* const struct retro_keyboard_callback * --
|
||||
/* const struct retro_keyboard_callback * --
|
||||
* Sets a callback function used to notify core about keyboard events.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE 13
|
||||
/* const struct retro_disk_control_callback * --
|
||||
/* const struct retro_disk_control_callback * --
|
||||
* Sets an interface which frontend can use to eject and insert
|
||||
* disk images.
|
||||
* This is used for games which consist of multiple images and
|
||||
* must be manually swapped out by the user (e.g. PSX).
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_HW_RENDER 14
|
||||
/* struct retro_hw_render_callback * --
|
||||
/* struct retro_hw_render_callback * --
|
||||
* Sets an interface to let a libretro core render with
|
||||
* hardware acceleration.
|
||||
* Should be called in retro_load_game().
|
||||
|
@ -595,7 +595,7 @@ enum retro_mod
|
|||
* NULL to retro_video_refresh_t.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_VARIABLE 15
|
||||
/* struct retro_variable * --
|
||||
/* struct retro_variable * --
|
||||
* Interface to acquire user-defined information from environment
|
||||
* that cannot feasibly be supported in a multi-system way.
|
||||
* 'key' should be set to a key which has already been set by
|
||||
|
@ -603,7 +603,7 @@ enum retro_mod
|
|||
* 'data' will be set to a value or NULL.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_VARIABLES 16
|
||||
/* const struct retro_variable * --
|
||||
/* const struct retro_variable * --
|
||||
* Allows an implementation to signal the environment
|
||||
* which variables it might want to check for later using
|
||||
* GET_VARIABLE.
|
||||
|
@ -641,20 +641,20 @@ enum retro_mod
|
|||
* generally be displayed and stored as-is by the frontend.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE 17
|
||||
/* bool * --
|
||||
/* bool * --
|
||||
* Result is set to true if some variables are updated by
|
||||
* frontend since last call to RETRO_ENVIRONMENT_GET_VARIABLE.
|
||||
* Variables should be queried with GET_VARIABLE.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME 18
|
||||
/* const bool * --
|
||||
/* const bool * --
|
||||
* If true, the libretro implementation supports calls to
|
||||
* retro_load_game() with NULL as argument.
|
||||
* Used by cores which can run without particular game data.
|
||||
* This should be called within retro_set_environment() only.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_LIBRETRO_PATH 19
|
||||
/* const char ** --
|
||||
/* const char ** --
|
||||
* Retrieves the absolute path from where this libretro
|
||||
* implementation was loaded.
|
||||
* NULL is returned if the libretro was loaded statically
|
||||
|
@ -664,11 +664,11 @@ enum retro_mod
|
|||
* be loaded without ugly hacks.
|
||||
*/
|
||||
|
||||
/* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK.
|
||||
/* Environment 20 was an obsolete version of SET_AUDIO_CALLBACK.
|
||||
* It was not used by any known core at the time,
|
||||
* and was removed from the API. */
|
||||
#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
|
||||
/* const struct retro_frame_time_callback * --
|
||||
/* const struct retro_frame_time_callback * --
|
||||
* Lets the core know how much time has passed since last
|
||||
* invocation of retro_run().
|
||||
* The frontend can tamper with the timing to fake fast-forward,
|
||||
|
@ -677,7 +677,7 @@ enum retro_mod
|
|||
* in frame_time_callback..
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22
|
||||
/* const struct retro_audio_callback * --
|
||||
/* const struct retro_audio_callback * --
|
||||
* Sets an interface which is used to notify a libretro core about audio
|
||||
* being available for writing.
|
||||
* The callback can be called from any thread, so a core using this must
|
||||
|
@ -703,14 +703,14 @@ enum retro_mod
|
|||
* SET_FRAME_TIME_CALLBACK.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23
|
||||
/* struct retro_rumble_interface * --
|
||||
/* struct retro_rumble_interface * --
|
||||
* Gets an interface which is used by a libretro core to set
|
||||
* state of rumble motors in controllers.
|
||||
* A strong and weak motor is supported, and they can be
|
||||
* controlled indepedently.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES 24
|
||||
/* uint64_t * --
|
||||
/* uint64_t * --
|
||||
* Gets a bitmask telling which device type are expected to be
|
||||
* handled properly in a call to retro_input_state_t.
|
||||
* Devices which are not handled or recognized always return
|
||||
|
@ -719,7 +719,7 @@ enum retro_mod
|
|||
* Should only be called in retro_run().
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE (25 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_sensor_interface * --
|
||||
/* struct retro_sensor_interface * --
|
||||
* Gets access to the sensor interface.
|
||||
* The purpose of this interface is to allow
|
||||
* setting state related to sensors such as polling rate,
|
||||
|
@ -728,7 +728,7 @@ enum retro_mod
|
|||
* input_state_callback API.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE (26 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_camera_callback * --
|
||||
/* struct retro_camera_callback * --
|
||||
* Gets an interface to a video camera driver.
|
||||
* A libretro core can use this interface to get access to a
|
||||
* video camera.
|
||||
|
@ -753,7 +753,7 @@ enum retro_mod
|
|||
* start and stop the camera driver.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_LOG_INTERFACE 27
|
||||
/* struct retro_log_callback * --
|
||||
/* struct retro_log_callback * --
|
||||
* Gets an interface for logging. This is useful for
|
||||
* logging in a cross-platform way
|
||||
* as certain platforms cannot use stderr for logging.
|
||||
|
@ -763,13 +763,13 @@ enum retro_mod
|
|||
* log to stderr as desired.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_PERF_INTERFACE 28
|
||||
/* struct retro_perf_callback * --
|
||||
/* struct retro_perf_callback * --
|
||||
* Gets an interface for performance counters. This is useful
|
||||
* for performance logging in a cross-platform way and for detecting
|
||||
* architecture-specific features, such as SIMD support.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE 29
|
||||
/* struct retro_location_callback * --
|
||||
/* struct retro_location_callback * --
|
||||
* Gets access to the location interface.
|
||||
* The purpose of this interface is to be able to retrieve
|
||||
* location-based information from the host device,
|
||||
|
@ -777,7 +777,7 @@ enum retro_mod
|
|||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY 30 /* Old name, kept for compatibility. */
|
||||
#define RETRO_ENVIRONMENT_GET_CORE_ASSETS_DIRECTORY 30
|
||||
/* const char ** --
|
||||
/* const char ** --
|
||||
* Returns the "core assets" directory of the frontend.
|
||||
* This directory can be used to store specific assets that the
|
||||
* core relies upon, such as art assets,
|
||||
|
@ -787,7 +787,7 @@ enum retro_mod
|
|||
* and it's up to the implementation to find a suitable directory.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
|
||||
/* const char ** --
|
||||
/* const char ** --
|
||||
* Returns the "save" directory of the frontend, unless there is no
|
||||
* save directory available. The save directory should be used to
|
||||
* store SRAM, memory cards, high scores, etc, if the libretro core
|
||||
|
@ -802,7 +802,7 @@ enum retro_mod
|
|||
* GET_SYSTEM_DIRECTORY.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32
|
||||
/* const struct retro_system_av_info * --
|
||||
/* const struct retro_system_av_info * --
|
||||
* Sets a new av_info structure. This can only be called from
|
||||
* within retro_run().
|
||||
* This should *only* be used if the core is completely altering the
|
||||
|
@ -835,7 +835,7 @@ enum retro_mod
|
|||
* changed av_info struct.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK 33
|
||||
/* const struct retro_get_proc_address_interface * --
|
||||
/* const struct retro_get_proc_address_interface * --
|
||||
* Allows a libretro core to announce support for the
|
||||
* get_proc_address() interface.
|
||||
* This interface allows for a standard way to extend libretro where
|
||||
|
@ -846,7 +846,7 @@ enum retro_mod
|
|||
* **MUST** be called from within retro_set_environment().
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO 34
|
||||
/* const struct retro_subsystem_info * --
|
||||
/* const struct retro_subsystem_info * --
|
||||
* This environment call introduces the concept of libretro "subsystems".
|
||||
* A subsystem is a variant of a libretro core which supports
|
||||
* different kinds of games.
|
||||
|
@ -865,7 +865,7 @@ enum retro_mod
|
|||
* **MUST** be called from within retro_set_environment().
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35
|
||||
/* const struct retro_controller_info * --
|
||||
/* const struct retro_controller_info * --
|
||||
* This environment call lets a libretro core tell the frontend
|
||||
* which controller subclasses are recognized in calls to
|
||||
* retro_set_controller_port_device().
|
||||
|
@ -903,7 +903,7 @@ enum retro_mod
|
|||
* libretro should only poll input based on the base input device types.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* const struct retro_memory_map * --
|
||||
/* const struct retro_memory_map * --
|
||||
* This environment call lets a libretro core tell the frontend
|
||||
* about the memory maps this core emulates.
|
||||
* This can be used to implement, for example, cheats in a core-agnostic way.
|
||||
|
@ -916,7 +916,7 @@ enum retro_mod
|
|||
* Can be called from retro_init and retro_load_game.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_GEOMETRY 37
|
||||
/* const struct retro_game_geometry * --
|
||||
/* const struct retro_game_geometry * --
|
||||
* This environment call is similar to SET_SYSTEM_AV_INFO for changing
|
||||
* video parameters, but provides a guarantee that drivers will not be
|
||||
* reinitialized.
|
||||
|
@ -935,7 +935,7 @@ enum retro_mod
|
|||
* constant time.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_USERNAME 38
|
||||
/* const char **
|
||||
/* const char **
|
||||
* Returns the specified username of the frontend, if specified by the user.
|
||||
* This username can be used as a nickname for a core that has online facilities
|
||||
* or any other mode where personalization of the user is desirable.
|
||||
|
@ -944,12 +944,12 @@ enum retro_mod
|
|||
* a default username should be specified by the core.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_LANGUAGE 39
|
||||
/* unsigned * --
|
||||
/* unsigned * --
|
||||
* Returns the specified language of the frontend, if specified by the user.
|
||||
* It can be used by the core for localization purposes.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER (40 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_framebuffer * --
|
||||
/* struct retro_framebuffer * --
|
||||
* Returns a preallocated framebuffer which the core can use for rendering
|
||||
* the frame into when not using SET_HW_RENDER.
|
||||
* The framebuffer returned from this call must not be used
|
||||
|
@ -979,7 +979,7 @@ enum retro_mod
|
|||
* writeable (and readable).
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* const struct retro_hw_render_interface ** --
|
||||
/* const struct retro_hw_render_interface ** --
|
||||
* Returns an API specific rendering interface for accessing API specific data.
|
||||
* Not all HW rendering APIs support or need this.
|
||||
* The contents of the returned pointer is specific to the rendering API
|
||||
|
@ -990,7 +990,7 @@ enum retro_mod
|
|||
* the contents of the HW_RENDER_INTERFACE are invalidated.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* const bool * --
|
||||
/* const bool * --
|
||||
* If true, the libretro implementation supports achievements
|
||||
* either via memory descriptors set with RETRO_ENVIRONMENT_SET_MEMORY_MAPS
|
||||
* or via retro_get_memory_data/retro_get_memory_size.
|
||||
|
@ -998,19 +998,19 @@ enum retro_mod
|
|||
* This must be called before the first call to retro_run.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* const struct retro_hw_render_context_negotiation_interface * --
|
||||
/* const struct retro_hw_render_context_negotiation_interface * --
|
||||
* Sets an interface which lets the libretro core negotiate with frontend how a context is created.
|
||||
* The semantics of this interface depends on which API is used in SET_HW_RENDER earlier.
|
||||
* This interface will be used when the frontend is trying to create a HW rendering context,
|
||||
* so it will be used after SET_HW_RENDER, but before the context_reset callback.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
|
||||
/* uint64_t * --
|
||||
/* uint64_t * --
|
||||
* Sets quirk flags associated with serialization. The frontend will zero any flags it doesn't
|
||||
* recognize or support. Should be set in either retro_init or retro_load_game, but not both.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT (44 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* N/A (null) * --
|
||||
/* N/A (null) * --
|
||||
* The frontend will try to use a 'shared' hardware context (mostly applicable
|
||||
* to OpenGL) when a hardware context is being set up.
|
||||
*
|
||||
|
@ -1021,7 +1021,7 @@ enum retro_mod
|
|||
* being used.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_vfs_interface_info * --
|
||||
/* struct retro_vfs_interface_info * --
|
||||
* Gets access to the VFS interface.
|
||||
* VFS presence needs to be queried prior to load_game or any
|
||||
* get_system/save/other_directory being called to let front end know
|
||||
|
@ -1029,12 +1029,12 @@ enum retro_mod
|
|||
* It is recomended to do so in retro_set_environment
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_LED_INTERFACE (46 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_led_interface * --
|
||||
/* struct retro_led_interface * --
|
||||
* Gets an interface which is used by a libretro core to set
|
||||
* state of LEDs.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* int * --
|
||||
/* int * --
|
||||
* Tells the core if the frontend wants audio or video.
|
||||
* If disabled, the frontend will discard the audio or video,
|
||||
* so the core may decide to skip generating a frame or generating audio.
|
||||
|
@ -1075,39 +1075,39 @@ enum retro_mod
|
|||
* * State will never be saved when using Hard Disable Audio.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_midi_interface ** --
|
||||
/* struct retro_midi_interface ** --
|
||||
* Returns a MIDI interface that can be used for raw data I/O.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_FASTFORWARDING (49 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend is in
|
||||
* fastforwarding mode.
|
||||
*/
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend is in
|
||||
* fastforwarding mode.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE (50 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* float * --
|
||||
* Float value that lets us know what target refresh rate
|
||||
* is curently in use by the frontend.
|
||||
*
|
||||
* The core can use the returned value to set an ideal
|
||||
* refresh rate/framerate.
|
||||
*/
|
||||
/* float * --
|
||||
* Float value that lets us know what target refresh rate
|
||||
* is curently in use by the frontend.
|
||||
*
|
||||
* The core can use the returned value to set an ideal
|
||||
* refresh rate/framerate.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_INPUT_BITMASKS (51 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend supports
|
||||
* input bitmasks being returned by retro_input_state_t. The advantage
|
||||
* of this is that retro_input_state_t has to be only called once to
|
||||
* grab all button states instead of multiple times.
|
||||
*
|
||||
* If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id'
|
||||
* to retro_input_state_t (make sure 'device' is set to RETRO_DEVICE_JOYPAD).
|
||||
* It will return a bitmask of all the digital buttons.
|
||||
*/
|
||||
/* bool * --
|
||||
* Boolean value that indicates whether or not the frontend supports
|
||||
* input bitmasks being returned by retro_input_state_t. The advantage
|
||||
* of this is that retro_input_state_t has to be only called once to
|
||||
* grab all button states instead of multiple times.
|
||||
*
|
||||
* If it returns true, you can pass RETRO_DEVICE_ID_JOYPAD_MASK as 'id'
|
||||
* to retro_input_state_t (make sure 'device' is set to RETRO_DEVICE_JOYPAD).
|
||||
* It will return a bitmask of all the digital buttons.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION 52
|
||||
/* unsigned * --
|
||||
/* unsigned * --
|
||||
* Unsigned value is the API version number of the core options
|
||||
* interface supported by the frontend. If callback return false,
|
||||
* API version is assumed to be 0.
|
||||
|
@ -1126,7 +1126,7 @@ enum retro_mod
|
|||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53
|
||||
/* const struct retro_core_option_definition ** --
|
||||
/* const struct retro_core_option_definition ** --
|
||||
* Allows an implementation to signal the environment
|
||||
* which variables it might want to check for later using
|
||||
* GET_VARIABLE.
|
||||
|
@ -1188,7 +1188,7 @@ enum retro_mod
|
|||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL 54
|
||||
/* const struct retro_core_options_intl * --
|
||||
/* const struct retro_core_options_intl * --
|
||||
* Allows an implementation to signal the environment
|
||||
* which variables it might want to check for later using
|
||||
* GET_VARIABLE.
|
||||
|
@ -1227,7 +1227,7 @@ enum retro_mod
|
|||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY 55
|
||||
/* struct retro_core_option_display * --
|
||||
/* struct retro_core_option_display * --
|
||||
*
|
||||
* Allows an implementation to signal the environment to show
|
||||
* or hide a variable when displaying core options. This is
|
||||
|
@ -1247,7 +1247,7 @@ enum retro_mod
|
|||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_PREFERRED_HW_RENDER 56
|
||||
/* unsigned * --
|
||||
/* unsigned * --
|
||||
*
|
||||
* Allows an implementation to ask frontend preferred hardware
|
||||
* context to use. Core should use this information to deal
|
||||
|
@ -1257,7 +1257,7 @@ enum retro_mod
|
|||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION 57
|
||||
/* unsigned * --
|
||||
/* unsigned * --
|
||||
* Unsigned value is the API version number of the disk control
|
||||
* interface supported by the frontend. If callback return false,
|
||||
* API version is assumed to be 0.
|
||||
|
@ -1278,7 +1278,7 @@ enum retro_mod
|
|||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE 58
|
||||
/* const struct retro_disk_control_ext_callback * --
|
||||
/* const struct retro_disk_control_ext_callback * --
|
||||
* Sets an interface which frontend can use to eject and insert
|
||||
* disk images, and also obtain information about individual
|
||||
* disk image files registered by the core.
|
||||
|
@ -1339,86 +1339,88 @@ struct retro_vfs_dir_handle;
|
|||
|
||||
/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
|
||||
* Introduced in VFS API v1 */
|
||||
typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
|
||||
typedef const char*(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle* stream);
|
||||
|
||||
/* Open a file for reading or writing. If path points to a directory, this will
|
||||
* fail. Returns the opaque file handle, or NULL for error.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
|
||||
typedef struct retro_vfs_file_handle*(RETRO_CALLCONV *retro_vfs_open_t
|
||||
)(const char* path, unsigned mode, unsigned hints);
|
||||
|
||||
/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on success, -1 on failure.
|
||||
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle* stream);
|
||||
|
||||
/* Return the size of the file in bytes, or -1 for error.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle* stream);
|
||||
|
||||
/* Truncate file to specified size. Returns 0 on success or -1 on error
|
||||
* Introduced in VFS API v2 */
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_truncate_t)(struct retro_vfs_file_handle *stream, int64_t length);
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_truncate_t)(struct retro_vfs_file_handle* stream, int64_t length);
|
||||
|
||||
/* Get the current read / write position for the file. Returns -1 for error.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle* stream);
|
||||
|
||||
/* Set the current read/write position for the file. Returns the new position, -1 for error.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int seek_position);
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle* stream, int64_t offset,
|
||||
int seek_position);
|
||||
|
||||
/* Read data from a file. Returns the number of bytes read, or -1 for error.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len);
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle* stream, void* s, uint64_t len);
|
||||
|
||||
/* Write data to a file. Returns the number of bytes written, or -1 for error.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len);
|
||||
typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle* stream, const void* s, uint64_t len);
|
||||
|
||||
/* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure.
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle *stream);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle* stream);
|
||||
|
||||
/* Delete the specified file. Returns 0 on success, -1 on failure
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char* path);
|
||||
|
||||
/* Rename the specified file. Returns 0 on success, -1 on failure
|
||||
* Introduced in VFS API v1 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char* old_path, const char* new_path);
|
||||
|
||||
/* Stat the specified file. Retruns a bitmask of RETRO_VFS_STAT_* flags, none are set if path was not valid.
|
||||
* Additionally stores file size in given variable, unless NULL is given.
|
||||
* Introduced in VFS API v3 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_stat_t)(const char *path, int32_t *size);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_stat_t)(const char* path, int32_t* size);
|
||||
|
||||
/* Create the specified directory. Returns 0 on success, -1 on unknown failure, -2 if already exists.
|
||||
* Introduced in VFS API v3 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_mkdir_t)(const char *dir);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_mkdir_t)(const char* dir);
|
||||
|
||||
/* Open the specified directory for listing. Returns the opaque dir handle, or NULL for error.
|
||||
* Support for the include_hidden argument may vary depending on the platform.
|
||||
* Introduced in VFS API v3 */
|
||||
typedef struct retro_vfs_dir_handle *(RETRO_CALLCONV *retro_vfs_opendir_t)(const char *dir, bool include_hidden);
|
||||
typedef struct retro_vfs_dir_handle*(RETRO_CALLCONV *retro_vfs_opendir_t)(const char* dir, bool include_hidden);
|
||||
|
||||
/* Read the directory entry at the current position, and move the read pointer to the next position.
|
||||
* Returns true on success, false if already on the last entry.
|
||||
* Introduced in VFS API v3 */
|
||||
typedef bool (RETRO_CALLCONV *retro_vfs_readdir_t)(struct retro_vfs_dir_handle *dirstream);
|
||||
typedef bool (RETRO_CALLCONV *retro_vfs_readdir_t)(struct retro_vfs_dir_handle* dirstream);
|
||||
|
||||
/* Get the name of the last entry read. Returns a string on success, or NULL for error.
|
||||
* The returned string pointer is valid until the next call to readdir or closedir.
|
||||
* Introduced in VFS API v3 */
|
||||
typedef const char *(RETRO_CALLCONV *retro_vfs_dirent_get_name_t)(struct retro_vfs_dir_handle *dirstream);
|
||||
typedef const char*(RETRO_CALLCONV *retro_vfs_dirent_get_name_t)(struct retro_vfs_dir_handle* dirstream);
|
||||
|
||||
/* Check if the last entry read was a directory. Returns true if it was, false otherwise (or on error).
|
||||
* Introduced in VFS API v3 */
|
||||
typedef bool (RETRO_CALLCONV *retro_vfs_dirent_is_dir_t)(struct retro_vfs_dir_handle *dirstream);
|
||||
typedef bool (RETRO_CALLCONV *retro_vfs_dirent_is_dir_t)(struct retro_vfs_dir_handle* dirstream);
|
||||
|
||||
/* Close the directory and release its resources. Must be called if opendir returns non-NULL. Returns 0 on success, -1 on failure.
|
||||
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
|
||||
* Introduced in VFS API v3 */
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_closedir_t)(struct retro_vfs_dir_handle *dirstream);
|
||||
typedef int (RETRO_CALLCONV *retro_vfs_closedir_t)(struct retro_vfs_dir_handle* dirstream);
|
||||
|
||||
struct retro_vfs_interface
|
||||
{
|
||||
|
@ -1456,7 +1458,7 @@ struct retro_vfs_interface_info
|
|||
/* Frontend writes interface pointer here. The frontend also sets the actual
|
||||
* version, must be at least required_interface_version.
|
||||
* Introduced in VFS API v1 */
|
||||
struct retro_vfs_interface *iface;
|
||||
struct retro_vfs_interface* iface;
|
||||
};
|
||||
|
||||
enum retro_hw_render_interface_type
|
||||
|
@ -1479,6 +1481,7 @@ struct retro_hw_render_interface
|
|||
};
|
||||
|
||||
typedef void (RETRO_CALLCONV *retro_set_led_state_t)(int led, int state);
|
||||
|
||||
struct retro_led_interface
|
||||
{
|
||||
retro_set_led_state_t set_led_state;
|
||||
|
@ -1494,7 +1497,7 @@ typedef bool (RETRO_CALLCONV *retro_midi_output_enabled_t)(void);
|
|||
|
||||
/* Reads next byte from the input stream.
|
||||
* Returns true if byte is read, false otherwise. */
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t *byte);
|
||||
typedef bool (RETRO_CALLCONV *retro_midi_read_t)(uint8_t* byte);
|
||||
|
||||
/* Writes byte to the output stream.
|
||||
* 'delta_time' is in microseconds and represent time elapsed since previous write.
|
||||
|
@ -1563,6 +1566,7 @@ struct retro_hw_render_context_negotiation_interface
|
|||
#define RETRO_MEMDESC_MINSIZE_2 (1 << 24) /* All memory in this region is accessed at least 2 bytes at the time. */
|
||||
#define RETRO_MEMDESC_MINSIZE_4 (2 << 24)
|
||||
#define RETRO_MEMDESC_MINSIZE_8 (3 << 24)
|
||||
|
||||
struct retro_memory_descriptor
|
||||
{
|
||||
uint64_t flags;
|
||||
|
@ -1580,7 +1584,7 @@ struct retro_memory_descriptor
|
|||
* open bus). No flags should be set if the pointer is NULL.
|
||||
* It's recommended to minimize the number of descriptors if possible,
|
||||
* but not mandatory. */
|
||||
void *ptr;
|
||||
void* ptr;
|
||||
size_t offset;
|
||||
|
||||
/* This is the location in the emulated address space
|
||||
|
@ -1637,7 +1641,7 @@ struct retro_memory_descriptor
|
|||
* would refer to.
|
||||
* The length can't be used for that purpose; the frontend may want
|
||||
* to append arbitrary data to an address, without a separator. */
|
||||
const char *addrspace;
|
||||
const char* addrspace;
|
||||
|
||||
/* TODO: When finalizing this one, add a description field, which should be
|
||||
* "WRAM" or something roughly equally long. */
|
||||
|
@ -1711,7 +1715,7 @@ struct retro_memory_descriptor
|
|||
|
||||
struct retro_memory_map
|
||||
{
|
||||
const struct retro_memory_descriptor *descriptors;
|
||||
const struct retro_memory_descriptor* descriptors;
|
||||
unsigned num_descriptors;
|
||||
};
|
||||
|
||||
|
@ -1720,7 +1724,7 @@ struct retro_controller_description
|
|||
/* Human-readable description of the controller. Even if using a generic
|
||||
* input device type, this can be set to the particular device type the
|
||||
* core uses. */
|
||||
const char *desc;
|
||||
const char* desc;
|
||||
|
||||
/* Device type passed to retro_set_controller_port_device(). If the device
|
||||
* type is a sub-class of a generic input device type, use the
|
||||
|
@ -1732,14 +1736,14 @@ struct retro_controller_description
|
|||
|
||||
struct retro_controller_info
|
||||
{
|
||||
const struct retro_controller_description *types;
|
||||
const struct retro_controller_description* types;
|
||||
unsigned num_types;
|
||||
};
|
||||
|
||||
struct retro_subsystem_memory_info
|
||||
{
|
||||
/* The extension associated with a memory type, e.g. "psram". */
|
||||
const char *extension;
|
||||
const char* extension;
|
||||
|
||||
/* The memory type for retro_get_memory(). This should be at
|
||||
* least 0x100 to avoid conflict with standardized
|
||||
|
@ -1750,10 +1754,10 @@ struct retro_subsystem_memory_info
|
|||
struct retro_subsystem_rom_info
|
||||
{
|
||||
/* Describes what the content is (SGB BIOS, GB ROM, etc). */
|
||||
const char *desc;
|
||||
const char* desc;
|
||||
|
||||
/* Same definition as retro_get_system_info(). */
|
||||
const char *valid_extensions;
|
||||
const char* valid_extensions;
|
||||
|
||||
/* Same definition as retro_get_system_info(). */
|
||||
bool need_fullpath;
|
||||
|
@ -1767,21 +1771,21 @@ struct retro_subsystem_rom_info
|
|||
|
||||
/* Content can have multiple associated persistent
|
||||
* memory types (retro_get_memory()). */
|
||||
const struct retro_subsystem_memory_info *memory;
|
||||
const struct retro_subsystem_memory_info* memory;
|
||||
unsigned num_memory;
|
||||
};
|
||||
|
||||
struct retro_subsystem_info
|
||||
{
|
||||
/* Human-readable string of the subsystem type, e.g. "Super GameBoy" */
|
||||
const char *desc;
|
||||
const char* desc;
|
||||
|
||||
/* A computer friendly short string identifier for the subsystem type.
|
||||
* This name must be [a-z].
|
||||
* E.g. if desc is "Super GameBoy", this can be "sgb".
|
||||
* This identifier can be used for command-line interfaces, etc.
|
||||
*/
|
||||
const char *ident;
|
||||
const char* ident;
|
||||
|
||||
/* Infos for each content file. The first entry is assumed to be the
|
||||
* "most significant" content for frontend purposes.
|
||||
|
@ -1789,7 +1793,7 @@ struct retro_subsystem_info
|
|||
* as it is the most "significant" content to a user.
|
||||
* If a frontend creates new file paths based on the content used
|
||||
* (e.g. savestates), it should use the path for the first ROM to do so. */
|
||||
const struct retro_subsystem_rom_info *roms;
|
||||
const struct retro_subsystem_rom_info* roms;
|
||||
|
||||
/* Number of content files associated with a subsystem. */
|
||||
unsigned num_roms;
|
||||
|
@ -1814,7 +1818,7 @@ typedef void (RETRO_CALLCONV *retro_proc_address_t)(void);
|
|||
* e.g. if void retro_foo(void); exists, the symbol must be called "retro_foo".
|
||||
* The returned function pointer must be cast to the corresponding type.
|
||||
*/
|
||||
typedef retro_proc_address_t (RETRO_CALLCONV *retro_get_proc_address_t)(const char *sym);
|
||||
typedef retro_proc_address_t (RETRO_CALLCONV *retro_get_proc_address_t)(const char* sym);
|
||||
|
||||
struct retro_get_proc_address_interface
|
||||
{
|
||||
|
@ -1833,7 +1837,7 @@ enum retro_log_level
|
|||
|
||||
/* Logging function. Takes log level argument as well. */
|
||||
typedef void (RETRO_CALLCONV *retro_log_printf_t)(enum retro_log_level level,
|
||||
const char *fmt, ...);
|
||||
const char* fmt, ...);
|
||||
|
||||
struct retro_log_callback
|
||||
{
|
||||
|
@ -1871,7 +1875,7 @@ typedef int64_t retro_time_t;
|
|||
|
||||
struct retro_perf_counter
|
||||
{
|
||||
const char *ident;
|
||||
const char* ident;
|
||||
retro_perf_tick_t start;
|
||||
retro_perf_tick_t total;
|
||||
retro_perf_tick_t call_cnt;
|
||||
|
@ -1903,13 +1907,13 @@ typedef void (RETRO_CALLCONV *retro_perf_log_t)(void);
|
|||
* retro_perf_counter must be 0.
|
||||
* Registering can be called multiple times. To avoid calling to
|
||||
* frontend redundantly, you can check registered field first. */
|
||||
typedef void (RETRO_CALLCONV *retro_perf_register_t)(struct retro_perf_counter *counter);
|
||||
typedef void (RETRO_CALLCONV *retro_perf_register_t)(struct retro_perf_counter* counter);
|
||||
|
||||
/* Starts a registered counter. */
|
||||
typedef void (RETRO_CALLCONV *retro_perf_start_t)(struct retro_perf_counter *counter);
|
||||
typedef void (RETRO_CALLCONV *retro_perf_start_t)(struct retro_perf_counter* counter);
|
||||
|
||||
/* Stops a registered counter. */
|
||||
typedef void (RETRO_CALLCONV *retro_perf_stop_t)(struct retro_perf_counter *counter);
|
||||
typedef void (RETRO_CALLCONV *retro_perf_stop_t)(struct retro_perf_counter* counter);
|
||||
|
||||
/* For convenience it can be useful to wrap register, start and stop in macros.
|
||||
* E.g.:
|
||||
|
@ -2015,7 +2019,7 @@ typedef void (RETRO_CALLCONV *retro_camera_lifetime_status_t)(void);
|
|||
* Width, height and pitch are similar to retro_video_refresh_t.
|
||||
* First pixel is top-left origin.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_camera_frame_raw_framebuffer_t)(const uint32_t *buffer,
|
||||
typedef void (RETRO_CALLCONV *retro_camera_frame_raw_framebuffer_t)(const uint32_t* buffer,
|
||||
unsigned width, unsigned height, size_t pitch);
|
||||
|
||||
/* A callback for when OpenGL textures are used.
|
||||
|
@ -2037,7 +2041,7 @@ typedef void (RETRO_CALLCONV *retro_camera_frame_raw_framebuffer_t)(const uint32
|
|||
* the API definition.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_camera_frame_opengl_texture_t)(unsigned texture_id,
|
||||
unsigned texture_target, const float *affine);
|
||||
unsigned texture_target, const float* affine);
|
||||
|
||||
struct retro_camera_callback
|
||||
{
|
||||
|
@ -2096,8 +2100,8 @@ typedef void (RETRO_CALLCONV *retro_location_stop_t)(void);
|
|||
|
||||
/* Get the position of the current location. Will set parameters to
|
||||
* 0 if no new location update has happened since the last time. */
|
||||
typedef bool (RETRO_CALLCONV *retro_location_get_position_t)(double *lat, double *lon,
|
||||
double *horiz_accuracy, double *vert_accuracy);
|
||||
typedef bool (RETRO_CALLCONV *retro_location_get_position_t)(double* lat, double* lon,
|
||||
double* horiz_accuracy, double* vert_accuracy);
|
||||
|
||||
/* Callback which signals when the location driver is initialized
|
||||
* and/or deinitialized.
|
||||
|
@ -2167,6 +2171,7 @@ struct retro_audio_callback
|
|||
* In those scenarios the reference frame time value will be used. */
|
||||
typedef int64_t retro_usec_t;
|
||||
typedef void (RETRO_CALLCONV *retro_frame_time_callback_t)(retro_usec_t usec);
|
||||
|
||||
struct retro_frame_time_callback
|
||||
{
|
||||
retro_frame_time_callback_t callback;
|
||||
|
@ -2198,7 +2203,7 @@ typedef void (RETRO_CALLCONV *retro_hw_context_reset_t)(void);
|
|||
typedef uintptr_t (RETRO_CALLCONV *retro_hw_get_current_framebuffer_t)(void);
|
||||
|
||||
/* Get a symbol from HW context. */
|
||||
typedef retro_proc_address_t (RETRO_CALLCONV *retro_hw_get_proc_address_t)(const char *sym);
|
||||
typedef retro_proc_address_t (RETRO_CALLCONV *retro_hw_get_proc_address_t)(const char* sym);
|
||||
|
||||
enum retro_hw_context_type
|
||||
{
|
||||
|
@ -2387,7 +2392,7 @@ struct retro_game_info;
|
|||
* Index 1 will be removed, and the new index is 3.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index,
|
||||
const struct retro_game_info *info);
|
||||
const struct retro_game_info* info);
|
||||
|
||||
/* Adds a new valid index (get_num_images()) to the internal disk list.
|
||||
* This will increment subsequent return values from get_num_images() by 1.
|
||||
|
@ -2419,13 +2424,13 @@ typedef bool (RETRO_CALLCONV *retro_add_image_index_t)(void);
|
|||
* Returns 'false' if index or 'path' are invalid, or core
|
||||
* does not support this functionality
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char *path);
|
||||
typedef bool (RETRO_CALLCONV *retro_set_initial_image_t)(unsigned index, const char* path);
|
||||
|
||||
/* Fetches the path of the specified disk image file.
|
||||
* Returns 'false' if index is invalid (index >= get_num_images())
|
||||
* or path is otherwise unavailable.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path, size_t len);
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char* path, size_t len);
|
||||
|
||||
/* Fetches a core-provided 'label' for the specified disk
|
||||
* image file. In the simplest case this may be a file name
|
||||
|
@ -2440,7 +2445,7 @@ typedef bool (RETRO_CALLCONV *retro_get_image_path_t)(unsigned index, char *path
|
|||
* Returns 'false' if index is invalid (index >= get_num_images())
|
||||
* or label is otherwise unavailable.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char *label, size_t len);
|
||||
typedef bool (RETRO_CALLCONV *retro_get_image_label_t)(unsigned index, char* label, size_t len);
|
||||
|
||||
struct retro_disk_control_callback
|
||||
{
|
||||
|
@ -2502,7 +2507,7 @@ enum retro_pixel_format
|
|||
|
||||
struct retro_message
|
||||
{
|
||||
const char *msg; /* Message to be displayed. */
|
||||
const char* msg; /* Message to be displayed. */
|
||||
unsigned frames; /* Duration in frames of message. */
|
||||
};
|
||||
|
||||
|
@ -2520,7 +2525,7 @@ struct retro_input_descriptor
|
|||
/* Human readable description for parameters.
|
||||
* The pointer must remain valid until
|
||||
* retro_unload_game() is called. */
|
||||
const char *description;
|
||||
const char* description;
|
||||
};
|
||||
|
||||
struct retro_system_info
|
||||
|
@ -2528,11 +2533,11 @@ struct retro_system_info
|
|||
/* All pointers are owned by libretro implementation, and pointers must
|
||||
* remain valid until retro_deinit() is called. */
|
||||
|
||||
const char *library_name; /* Descriptive name of library. Should not
|
||||
const char* library_name; /* Descriptive name of library. Should not
|
||||
* contain any version numbers, etc. */
|
||||
const char *library_version; /* Descriptive version of core. */
|
||||
const char* library_version; /* Descriptive version of core. */
|
||||
|
||||
const char *valid_extensions; /* A string listing probably content
|
||||
const char* valid_extensions; /* A string listing probably content
|
||||
* extensions the core will be able to
|
||||
* load, separated with pipe.
|
||||
* I.e. "bin|rom|iso".
|
||||
|
@ -2603,16 +2608,16 @@ struct retro_variable
|
|||
* delimited by semicolons as so:
|
||||
* "key1=value1;key2=value2;..."
|
||||
*/
|
||||
const char *key;
|
||||
const char* key;
|
||||
|
||||
/* Value to be obtained. If key does not exist, it is set to NULL. */
|
||||
const char *value;
|
||||
const char* value;
|
||||
};
|
||||
|
||||
struct retro_core_option_display
|
||||
{
|
||||
/* Variable to configure in RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY */
|
||||
const char *key;
|
||||
const char* key;
|
||||
|
||||
/* Specifies whether variable should be displayed
|
||||
* when presenting core options to the user */
|
||||
|
@ -2639,23 +2644,23 @@ struct retro_core_option_display
|
|||
struct retro_core_option_value
|
||||
{
|
||||
/* Expected option value */
|
||||
const char *value;
|
||||
const char* value;
|
||||
|
||||
/* Human-readable value label. If NULL, value itself
|
||||
* will be displayed by the frontend */
|
||||
const char *label;
|
||||
const char* label;
|
||||
};
|
||||
|
||||
struct retro_core_option_definition
|
||||
{
|
||||
/* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. */
|
||||
const char *key;
|
||||
const char* key;
|
||||
|
||||
/* Human-readable core option description (used as menu label) */
|
||||
const char *desc;
|
||||
const char* desc;
|
||||
|
||||
/* Human-readable core option information (used as menu sublabel) */
|
||||
const char *info;
|
||||
const char* info;
|
||||
|
||||
/* Array of retro_core_option_value structs, terminated by NULL */
|
||||
struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX];
|
||||
|
@ -2663,7 +2668,7 @@ struct retro_core_option_definition
|
|||
/* Default core option value. Must match one of the values
|
||||
* in the retro_core_option_value array, otherwise will be
|
||||
* ignored */
|
||||
const char *default_value;
|
||||
const char* default_value;
|
||||
};
|
||||
|
||||
struct retro_core_options_intl
|
||||
|
@ -2671,17 +2676,17 @@ struct retro_core_options_intl
|
|||
/* Pointer to an array of retro_core_option_definition structs
|
||||
* - US English implementation
|
||||
* - Must point to a valid array */
|
||||
struct retro_core_option_definition *us;
|
||||
struct retro_core_option_definition* us;
|
||||
|
||||
/* Pointer to an array of retro_core_option_definition structs
|
||||
* - Implementation for current frontend language
|
||||
* - May be NULL */
|
||||
struct retro_core_option_definition *local;
|
||||
struct retro_core_option_definition* local;
|
||||
};
|
||||
|
||||
struct retro_game_info
|
||||
{
|
||||
const char *path; /* Path to game, UTF-8 encoded.
|
||||
const char* path; /* Path to game, UTF-8 encoded.
|
||||
* Sometimes used as a reference for building other paths.
|
||||
* May be NULL if game was loaded from stdin or similar,
|
||||
* but in this case some cores will be unable to load `data`.
|
||||
|
@ -2689,22 +2694,22 @@ struct retro_game_info
|
|||
* of passing NULL, which will help more cores to succeed.
|
||||
* retro_system_info::need_fullpath requires
|
||||
* that this path is valid. */
|
||||
const void *data; /* Memory buffer of loaded game. Will be NULL
|
||||
const void* data; /* Memory buffer of loaded game. Will be NULL
|
||||
* if need_fullpath was set. */
|
||||
size_t size; /* Size of memory buffer. */
|
||||
const char *meta; /* String of implementation specific meta-data. */
|
||||
const char* meta; /* String of implementation specific meta-data. */
|
||||
};
|
||||
|
||||
#define RETRO_MEMORY_ACCESS_WRITE (1 << 0)
|
||||
/* The core will write to the buffer provided by retro_framebuffer::data. */
|
||||
/* The core will write to the buffer provided by retro_framebuffer::data. */
|
||||
#define RETRO_MEMORY_ACCESS_READ (1 << 1)
|
||||
/* The core will read from retro_framebuffer::data. */
|
||||
/* The core will read from retro_framebuffer::data. */
|
||||
#define RETRO_MEMORY_TYPE_CACHED (1 << 0)
|
||||
/* The memory in data is cached.
|
||||
/* The memory in data is cached.
|
||||
* If not cached, random writes and/or reading from the buffer is expected to be very slow. */
|
||||
struct retro_framebuffer
|
||||
{
|
||||
void *data; /* The framebuffer which the core can render into.
|
||||
void* data; /* The framebuffer which the core can render into.
|
||||
Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER.
|
||||
The initial contents of data are unspecified. */
|
||||
unsigned width; /* The framebuffer width used by the core. Set by core. */
|
||||
|
@ -2729,7 +2734,7 @@ struct retro_framebuffer
|
|||
|
||||
/* Environment callback. Gives implementations a way of performing
|
||||
* uncommon tasks. Extensible. */
|
||||
typedef bool (RETRO_CALLCONV *retro_environment_t)(unsigned cmd, void *data);
|
||||
typedef bool (RETRO_CALLCONV *retro_environment_t)(unsigned cmd, void* data);
|
||||
|
||||
/* Render a frame. Pixel format is 15-bit 0RGB1555 native endian
|
||||
* unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).
|
||||
|
@ -2742,7 +2747,7 @@ typedef bool (RETRO_CALLCONV *retro_environment_t)(unsigned cmd, void *data);
|
|||
* Certain graphic APIs, such as OpenGL ES, do not like textures
|
||||
* that are not packed in memory.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_video_refresh_t)(const void *data, unsigned width,
|
||||
typedef void (RETRO_CALLCONV *retro_video_refresh_t)(const void* data, unsigned width,
|
||||
unsigned height, size_t pitch);
|
||||
|
||||
/* Renders a single audio frame. Should only be used if implementation
|
||||
|
@ -2757,7 +2762,7 @@ typedef void (RETRO_CALLCONV *retro_audio_sample_t)(int16_t left, int16_t right)
|
|||
* I.e. int16_t buf[4] = { l, r, l, r }; would be 2 frames.
|
||||
* Only one of the audio callbacks must ever be used.
|
||||
*/
|
||||
typedef size_t (RETRO_CALLCONV *retro_audio_sample_batch_t)(const int16_t *data,
|
||||
typedef size_t (RETRO_CALLCONV *retro_audio_sample_batch_t)(const int16_t* data,
|
||||
size_t frames);
|
||||
|
||||
/* Polls input. */
|
||||
|
@ -2796,7 +2801,7 @@ RETRO_API unsigned retro_api_version(void);
|
|||
/* Gets statically known system info. Pointers provided in *info
|
||||
* must be statically allocated.
|
||||
* Can be called at any time, even before retro_init(). */
|
||||
RETRO_API void retro_get_system_info(struct retro_system_info *info);
|
||||
RETRO_API void retro_get_system_info(struct retro_system_info* info);
|
||||
|
||||
/* Gets information about system audio/video timings and geometry.
|
||||
* Can be called only after retro_load_game() has successfully completed.
|
||||
|
@ -2804,7 +2809,7 @@ RETRO_API void retro_get_system_info(struct retro_system_info *info);
|
|||
* variable if needed.
|
||||
* E.g. geom.aspect_ratio might not be initialized if core doesn't
|
||||
* desire a particular aspect ratio. */
|
||||
RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info);
|
||||
RETRO_API void retro_get_system_av_info(struct retro_system_av_info* info);
|
||||
|
||||
/* Sets device to be used for player 'port'.
|
||||
* By default, RETRO_DEVICE_JOYPAD is assumed to be plugged into all
|
||||
|
@ -2845,22 +2850,22 @@ RETRO_API size_t retro_serialize_size(void);
|
|||
|
||||
/* Serializes internal state. If failed, or size is lower than
|
||||
* retro_serialize_size(), it should return false, true otherwise. */
|
||||
RETRO_API bool retro_serialize(void *data, size_t size);
|
||||
RETRO_API bool retro_unserialize(const void *data, size_t size);
|
||||
RETRO_API bool retro_serialize(void* data, size_t size);
|
||||
RETRO_API bool retro_unserialize(const void* data, size_t size);
|
||||
|
||||
RETRO_API void retro_cheat_reset(void);
|
||||
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code);
|
||||
RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char* code);
|
||||
|
||||
/* Loads a game.
|
||||
* Return true to indicate successful loading and false to indicate load failure.
|
||||
*/
|
||||
RETRO_API bool retro_load_game(const struct retro_game_info *game);
|
||||
RETRO_API bool retro_load_game(const struct retro_game_info* game);
|
||||
|
||||
/* Loads a "special" kind of game. Should not be used,
|
||||
* except in extreme cases. */
|
||||
RETRO_API bool retro_load_game_special(
|
||||
unsigned game_type,
|
||||
const struct retro_game_info *info, size_t num_info
|
||||
const struct retro_game_info* info, size_t num_info
|
||||
);
|
||||
|
||||
/* Unloads the currently loaded game. Called before retro_deinit(void). */
|
||||
|
@ -2870,7 +2875,7 @@ RETRO_API void retro_unload_game(void);
|
|||
RETRO_API unsigned retro_get_region(void);
|
||||
|
||||
/* Gets region of memory. */
|
||||
RETRO_API void *retro_get_memory_data(unsigned id);
|
||||
RETRO_API void* retro_get_memory_data(unsigned id);
|
||||
RETRO_API size_t retro_get_memory_size(unsigned id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Add table
Reference in a new issue