Merge pull request #588 from libretro/master

Update from downstream
This commit is contained in:
bearoso 2019-10-17 11:12:05 -05:00 committed by GitHub
commit e1a5917d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 2597 additions and 269 deletions

View File

@ -198,6 +198,20 @@ else ifneq (,$(findstring ios,$(platform)))
CXXFLAGS += -miphoneos-version-min=5.0
endif
#tvOS
else ifeq ($(platform), tvos-arm64)
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro_tvos.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
endif
CXXFLAGS += -DIOS
CXXFLAGS += -DARM
# Theos
else ifeq ($(platform), theos_ios)
CFLAGS += $(LTO)
@ -303,22 +317,6 @@ else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
STATIC_LINKING = 1
# Genode
else ifeq ($(platform), genode)
TARGET := $(TARGET_NAME)_libretro.lib.so
PKG_CONFIG := genode-lib genode-stdcxx
CXXFLAGS += -D__GENODE__
CXXFLAGS += $(shell pkg-config --cflags $(PKG_CONFIG))
LDFLAGS += -shared --version-script=link.T
LDFLAGS += $(shell pkg-config --libs $(PKG_CONFIG))
CC = $(shell pkg-config genode-base --variable=cc)
CXX = $(shell pkg-config genode-base --variable=cxx)
LD = $(shell pkg-config genode-base --variable=ld)
AR = $(shell pkg-config genode-base --variable=ar) -rcs
LIBS =
# Windows MSVC 2003 Xbox 1
else ifeq ($(platform), xbox1_msvc2003)
CFLAGS += -D__WIN32__
@ -551,8 +549,8 @@ else
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
CXX = g++
CC ?= gcc
CXX ?= g++
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T
CXXFLAGS += -D__WIN32__
endif
@ -606,13 +604,13 @@ else ifneq (,$(findstring msvc,$(platform)))
WARNINGS_DEFINES =
CODE_DEFINES =
else
WARNINGS_DEFINES = -Wall -W -Wno-unused-parameter
WARNINGS_DEFINES = -Wall -W -Wno-unused-parameter -Wno-missing-field-initializers
CODE_DEFINES = -fomit-frame-pointer
endif
CXXFLAGS += $(CODE_DEFINES) $(WARNINGS_DEFINES) $(fpic)
CXXFLAGS += -DRIGHTSHIFT_IS_SAR -D__LIBRETRO__ -DALLOW_CPU_OVERCLOCK
CFLAGS = $(CXXFLAGS)
CFLAGS := $(CXXFLAGS)
CFLAGS += -DHAVE_STDINT_H
CXXFLAGS += -DHAVE_STDINT_H
ifeq (,$(findstring msvc,$(platform)))
@ -641,7 +639,7 @@ ifeq ($(STATIC_LINKING),1)
else
LD = link.exe
endif
else ifneq ($(platform),genode)
else
LD = $(CXX)
endif
@ -657,13 +655,11 @@ else
all: $(TARGET)
$(TARGET): $(OBJECTS)
@echo "** BUILDING $(TARGET) FOR PLATFORM $(platform) **"
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
+$(LD) $(fpic) $(SHARED) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
endif
@echo "** BUILD SUCCESSFUL **"
%.o: %.cpp
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $(OBJOUT)$@ $<

View File

@ -1,5 +1,8 @@
LIBRETRO_COMM_DIR = $(CORE_DIR)/libretro/libretro-common
INCFLAGS = -I$(CORE_DIR)/libretro -I$(CORE_DIR) -I$(CORE_DIR)/apu/ -I$(CORE_DIR)/apu/bapu
ifeq ($(LIBRETRO_COMM_DIR),)
LIBRETRO_COMM_DIR = $(CORE_DIR)/libretro/libretro-common
endif
INCFLAGS = -I$(CORE_DIR)/libretro -I$(LIBRETRO_COMM_DIR)/include -I$(CORE_DIR) -I$(CORE_DIR)/apu/ -I$(CORE_DIR)/apu/bapu
ifneq (,$(findstring msvc2003,$(platform)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc

3
libretro/Tupfile Normal file
View File

@ -0,0 +1,3 @@
TARGET_NAME=snes9x
CORE_DIR=$(TUP_CWD)/..
include_rules

View File

@ -1,2 +1,2 @@
APP_STL := stlport_static
APP_STL := c++_static
APP_ABI := all

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2010-2018 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_inline.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_INLINE_H
#define __LIBRETRO_SDK_INLINE_H
#ifndef INLINE
#if defined(_WIN32) || defined(__INTEL_COMPILER)
#define INLINE __inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
#define INLINE inline
#elif defined(__GNUC__)
#define INLINE __inline__
#else
#define INLINE
#endif
#endif
#endif

View File

@ -1,4 +1,5 @@
#include "libretro.h"
#include "libretro_core_options.h"
#include "snes9x.h"
#include "memmap.h"
@ -76,6 +77,9 @@ static uint16 *ntsc_screen_buffer, *snes_ntsc_buffer;
const int MAX_SNES_WIDTH_NTSC = ((SNES_NTSC_OUT_WIDTH(256) + 3) / 4) * 4;
static bool show_lightgun_settings = true;
static bool show_advanced_av_settings = true;
static void extract_basename(char *buf, const char *path, size_t size)
{
const char *base = strrchr(path, '/');
@ -152,6 +156,22 @@ static overscan_mode crop_overscan_mode = OVERSCAN_CROP_ON; // default to crop
static aspect_mode aspect_ratio_mode = ASPECT_RATIO_4_3; // default to 4:3
static bool rom_loaded = false;
enum lightgun_mode
{
SETTING_GUN_INPUT_LIGHTGUN,
SETTING_GUN_INPUT_POINTER
};
static lightgun_mode setting_gun_input = SETTING_GUN_INPUT_LIGHTGUN;
// Touchscreen sensitivity vars
static int pointer_pressed = 0;
static const int POINTER_PRESSED_CYCLES = 4;
static int pointer_cycles_after_released = 0;
static int pointer_pressed_last_x = 0;
static int pointer_pressed_last_y = 0;
static bool setting_superscope_reverse_buttons = false;
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
@ -176,52 +196,7 @@ void retro_set_environment(retro_environment_t cb)
cb(RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO, (void*)subsystems);
struct retro_variable variables[] = {
// These variable names and possible values constitute an ABI with ZMZ (ZSNES Libretro player).
// Changing "Show layer 1" is fine, but don't change "layer_1"/etc or the possible values ("Yes|No").
// Adding more variables and rearranging them is safe.
{ "snes9x_up_down_allowed", "Allow Opposing Directions; disabled|enabled" },
{ "snes9x_overclock_superfx", "SuperFX Overclocking; 100%|150%|200%|250%|300%|350%|400%|450%|500%|50%|60%|70%|80%|90%" },
{ "snes9x_overclock_cycles", "Reduce Slowdown (Hack, Unsafe); disabled|light|compatible|max" },
{ "snes9x_reduce_sprite_flicker", "Reduce Flickering (Hack, Unsafe); disabled|enabled" },
{ "snes9x_randomize_memory", "Randomize Memory (Unsafe); disabled|enabled" },
{ "snes9x_hires_blend", "Hires Blending; disabled|merge|blur" },
{ "snes9x_audio_interpolation", "Audio Interpolation; gaussian|cubic|sinc|none|linear" },
{ "snes9x_blargg", "Blargg NTSC filter; disabled|monochrome|rf|composite|s-video|rgb" },
{ "snes9x_layer_1", "Show layer 1; enabled|disabled" },
{ "snes9x_layer_2", "Show layer 2; enabled|disabled" },
{ "snes9x_layer_3", "Show layer 3; enabled|disabled" },
{ "snes9x_layer_4", "Show layer 4; enabled|disabled" },
{ "snes9x_layer_5", "Show sprite layer; enabled|disabled" },
{ "snes9x_gfx_clip", "Enable graphic clip windows; enabled|disabled" },
{ "snes9x_gfx_transp", "Enable transparency effects; enabled|disabled" },
{ "snes9x_gfx_hires", "Enable hires mode; enabled|disabled" },
{ "snes9x_sndchan_1", "Enable sound channel 1; enabled|disabled" },
{ "snes9x_sndchan_2", "Enable sound channel 2; enabled|disabled" },
{ "snes9x_sndchan_3", "Enable sound channel 3; enabled|disabled" },
{ "snes9x_sndchan_4", "Enable sound channel 4; enabled|disabled" },
{ "snes9x_sndchan_5", "Enable sound channel 5; enabled|disabled" },
{ "snes9x_sndchan_6", "Enable sound channel 6; enabled|disabled" },
{ "snes9x_sndchan_7", "Enable sound channel 7; enabled|disabled" },
{ "snes9x_sndchan_8", "Enable sound channel 8; enabled|disabled" },
{ "snes9x_overscan", "Crop overscan; enabled|disabled|auto" },
{ "snes9x_aspect", "Preferred aspect ratio; 4:3|uncorrected|auto|ntsc|pal" },
{ "snes9x_region", "Console region (Reload core); auto|ntsc|pal" },
{ "snes9x_superscope_crosshair", "Super Scope crosshair; 2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|0|1" },
{ "snes9x_superscope_color", "Super Scope color; White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)|Blue|Blue (blend)|Violet|Violet (blend)|Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Grey|25% Grey (blend)|50% Grey|50% Grey (blend)|75% Grey|75% Grey (blend)" },
{ "snes9x_justifier1_crosshair", "Justifier 1 crosshair; 4|5|6|7|8|9|10|11|12|13|14|15|16|0|1|2|3" },
{ "snes9x_justifier1_color", "Justifier 1 color; Blue|Blue (blend)|Violet|Violet (blend)|Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Grey|25% Grey (blend)|50% Grey|50% Grey (blend)|75% Grey|75% Grey (blend)|White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)" },
{ "snes9x_justifier2_crosshair", "Justifier 2 crosshair; 4|5|6|7|8|9|10|11|12|13|14|15|16|0|1|2|3" },
{ "snes9x_justifier2_color", "Justifier 2 color; Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Grey|25% Grey (blend)|50% Grey|50% Grey (blend)|75% Grey|75% Grey (blend)|White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)|Blue|Blue (blend)|Violet|Violet (blend)" },
{ "snes9x_rifle_crosshair", "M.A.C.S. rifle crosshair; 2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|0|1" },
{ "snes9x_rifle_color", "M.A.C.S. rifle color; White|White (blend)|Red|Red (blend)|Orange|Orange (blend)|Yellow|Yellow (blend)|Green|Green (blend)|Cyan|Cyan (blend)|Sky|Sky (blend)|Blue|Blue (blend)|Violet|Violet (blend)|Pink|Pink (blend)|Purple|Purple (blend)|Black|Black (blend)|25% Grey|25% Grey (blend)|50% Grey|50% Grey (blend)|75% Grey|75% Grey (blend)" },
{ "snes9x_block_invalid_vram_access", "Block Invalid VRAM Access; enabled|disabled" },
{ "snes9x_echo_buffer_hack", "Echo Buffer Hack (Unsafe, only enable for old addmusic hacks); disabled|enabled"},
{ NULL, NULL },
};
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
libretro_set_core_options(environ_cb);
static const struct retro_controller_description port_1[] = {
{ "None", RETRO_DEVICE_NONE },
@ -518,6 +493,22 @@ static void update_variables(void)
}
}
var.key="snes9x_lightgun_mode";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
if ( !strcmp(var.value, "Touchscreen") ) {
setting_gun_input = SETTING_GUN_INPUT_POINTER;
} else {
setting_gun_input = SETTING_GUN_INPUT_LIGHTGUN;
}
}
var.key="snes9x_superscope_reverse_buttons";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
setting_superscope_reverse_buttons = strcmp(var.value, "enabled") == 0;
}
var.key="snes9x_superscope_crosshair";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
@ -672,6 +663,89 @@ static void update_variables(void)
snes_ntsc_init( snes_ntsc, &setup );
}
}
/* Show/hide core options */
var.key = "snes9x_show_lightgun_settings";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
bool show_lightgun_settings_prev = show_lightgun_settings;
show_lightgun_settings = true;
if (strcmp(var.value, "disabled") == 0)
show_lightgun_settings = false;
if (show_lightgun_settings != show_lightgun_settings_prev)
{
size_t i;
struct retro_core_option_display option_display;
char lightgun_keys[10][64] = {
"snes9x_lightgun_mode",
"snes9x_superscope_reverse_buttons",
"snes9x_superscope_crosshair",
"snes9x_superscope_color",
"snes9x_justifier1_crosshair",
"snes9x_justifier1_color",
"snes9x_justifier2_crosshair",
"snes9x_justifier2_color",
"snes9x_rifle_crosshair",
"snes9x_rifle_color"
};
option_display.visible = show_lightgun_settings;
for (i = 0; i < 10; i++)
{
option_display.key = lightgun_keys[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
}
}
var.key = "snes9x_show_advanced_av_settings";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
bool show_advanced_av_settings_prev = show_advanced_av_settings;
show_advanced_av_settings = true;
if (strcmp(var.value, "disabled") == 0)
show_advanced_av_settings = false;
if (show_advanced_av_settings != show_advanced_av_settings_prev)
{
size_t i;
struct retro_core_option_display option_display;
char av_keys[15][32] = {
"snes9x_layer_1",
"snes9x_layer_2",
"snes9x_layer_3",
"snes9x_layer_4",
"snes9x_layer_5",
"snes9x_gfx_clip",
"snes9x_gfx_transp",
"snes9x_sndchan_1",
"snes9x_sndchan_2",
"snes9x_sndchan_3",
"snes9x_sndchan_4",
"snes9x_sndchan_5",
"snes9x_sndchan_6",
"snes9x_sndchan_7",
"snes9x_sndchan_8"
};
option_display.visible = show_advanced_av_settings;
for (i = 0; i < 15; i++)
{
option_display.key = av_keys[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
}
}
}
static void S9xAudioCallback(void*)
@ -1354,6 +1428,11 @@ static int scope_buttons[] =
};
static int scope_button_count = sizeof( scope_buttons ) / sizeof( int );
#define SUPER_SCOPE_TRIGGER 2
#define SUPER_SCOPE_CURSOR 3
#define SUPER_SCOPE_TURBO 4
#define SUPER_SCOPE_START 5
#define JUSTIFIER_TRIGGER 2
#define JUSTIFIER_START 3
#define JUSTIFIER_OFFSCREEN 4
@ -1442,8 +1521,8 @@ static void input_report_gun_position( unsigned port, int s9xinput )
{
int x, y;
x = input_state_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X);
y = input_state_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y);
x = input_state_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X);
y = input_state_cb(port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y);
/*scale & clamp*/
x = ( ( x + 0x7FFF ) * g_screen_gun_width ) / 0xFFFF;
@ -1462,6 +1541,144 @@ static void input_report_gun_position( unsigned port, int s9xinput )
S9xReportPointer(s9xinput, (int16_t)x, (int16_t)y);
}
static void input_handle_pointer_lightgun( unsigned port, unsigned gun_device, int s9xinput )
{
int x, y;
x = input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X);
y = input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y);
/*scale & clamp*/
x = ( ( x + 0x7FFF ) * g_screen_gun_width ) / 0xFFFF;
if ( x < 0 )
x = 0;
else if ( x >= g_screen_gun_width )
x = g_screen_gun_width - 1;
/*scale & clamp*/
y = ( ( y + 0x7FFF ) * g_screen_gun_height ) / 0xFFFF;
if ( y < 0 )
y = 0;
else if ( y >= g_screen_gun_height )
y = g_screen_gun_height - 1;
// Touch sensitivity: Keep the gun position held for a fixed number of cycles after touch is released
// because a very light touch can result in a misfire
if ( pointer_cycles_after_released > 0 && pointer_cycles_after_released < POINTER_PRESSED_CYCLES ) {
pointer_cycles_after_released++;
x = pointer_pressed_last_x;
y = pointer_pressed_last_y;
S9xReportPointer(s9xinput, (int16_t)x, (int16_t)y);
return;
}
if ( input_state_cb( port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED ) )
{
pointer_pressed = 1;
pointer_cycles_after_released = 0;
pointer_pressed_last_x = x;
pointer_pressed_last_y = y;
} else if ( pointer_pressed ) {
pointer_cycles_after_released++;
pointer_pressed = 0;
x = pointer_pressed_last_x;
y = pointer_pressed_last_y;
// unpress the primary trigger
switch (gun_device)
{
case RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE:
S9xReportButton(MAKE_BUTTON(PAD_2, setting_superscope_reverse_buttons ? SUPER_SCOPE_CURSOR : SUPER_SCOPE_TRIGGER), false);
break;
case RETRO_DEVICE_LIGHTGUN_JUSTIFIER:
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_TRIGGER), false);
break;
case RETRO_DEVICE_LIGHTGUN_MACS_RIFLE:
S9xReportButton(MAKE_BUTTON(PAD_2, MACS_RIFLE_TRIGGER), false);
break;
default:
break;
}
return;
}
S9xReportPointer(s9xinput, (int16_t)x, (int16_t)y);
// triggers
switch (gun_device)
{
case RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE:
{
bool start_pressed = false;
bool trigger_pressed = false;
bool turbo_pressed = false;
bool cursor_pressed = false;
if ( input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED) ) {
int touch_count = input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_COUNT);
if ( touch_count == 4 ) {
// start button
start_pressed = true;
} else if ( touch_count == 3 ) {
turbo_pressed = true;
} else if ( touch_count == 2 ) {
if ( setting_superscope_reverse_buttons )
{
trigger_pressed = true;
} else
{
cursor_pressed = true;
}
} else {
if ( setting_superscope_reverse_buttons )
{
cursor_pressed = true;
} else
{
trigger_pressed = true;
}
}
}
S9xReportButton(MAKE_BUTTON(PAD_2, SUPER_SCOPE_START), start_pressed);
S9xReportButton(MAKE_BUTTON(PAD_2, SUPER_SCOPE_TRIGGER), trigger_pressed);
S9xReportButton(MAKE_BUTTON(PAD_2, SUPER_SCOPE_CURSOR), cursor_pressed);
bool old_turbo = turbo_pressed;
turbo_pressed = turbo_pressed && !snes_superscope_turbo_latch;
snes_superscope_turbo_latch = old_turbo;
S9xReportButton(MAKE_BUTTON(PAD_2, SUPER_SCOPE_TURBO), turbo_pressed);
break;
}
case RETRO_DEVICE_LIGHTGUN_JUSTIFIER:
{
bool trigger_pressed = false;
bool start_pressed = false;
bool offscreen = false;
if ( input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED) ) {
int touch_count = input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_COUNT);
if ( touch_count == 3 ) {
start_pressed = true;
} else if ( touch_count == 2 ) {
offscreen = true;
} else {
trigger_pressed = true;
}
}
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_TRIGGER), trigger_pressed || offscreen);
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_START), start_pressed ? 1 : 0 );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_OFFSCREEN), offscreen);
break;
}
case RETRO_DEVICE_LIGHTGUN_MACS_RIFLE:
{
int pressed = input_state_cb(port, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
S9xReportButton(MAKE_BUTTON(PAD_2, MACS_RIFLE_TRIGGER),pressed);
break;
}
case RETRO_DEVICE_NONE:
break;
default:
if (log_cb)
log_cb(RETRO_LOG_ERROR, "Unknown device for touchscreen lightgun...\n");
}
}
static void report_buttons()
{
int offset = snes_devices[0] == RETRO_DEVICE_JOYPAD_MULTITAP ? 4 : 1;
@ -1494,81 +1711,101 @@ static void report_buttons()
case RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE:
input_report_gun_position( port, BTN_POINTER );
if ( setting_gun_input == SETTING_GUN_INPUT_POINTER ) {
input_handle_pointer_lightgun(port, RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE, BTN_POINTER);
} else {
// Lightgun is default
input_report_gun_position( port, BTN_POINTER );
for (int i = 0; i < scope_button_count; i++)
{
int id = scope_buttons[i];
bool btn = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, id )?true:false;
for (int i = 0; i < scope_button_count; i++)
{
int id = scope_buttons[i];
bool btn = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, id )?true:false;
/* RETRO_DEVICE_ID_LIGHTGUN_TURBO special case - core needs a rising-edge trigger */
if ( id == RETRO_DEVICE_ID_LIGHTGUN_TURBO )
{
bool old = btn;
btn = btn && !snes_superscope_turbo_latch;
snes_superscope_turbo_latch = old;
}
S9xReportButton(MAKE_BUTTON(PAD_2, i+2), btn);
}
/* RETRO_DEVICE_ID_LIGHTGUN_TURBO special case - core needs a rising-edge trigger */
if ( id == RETRO_DEVICE_ID_LIGHTGUN_TURBO )
{
bool old = btn;
btn = btn && !snes_superscope_turbo_latch;
snes_superscope_turbo_latch = old;
}
int super_scope_button_id = i+2;
if ( setting_superscope_reverse_buttons )
{
if ( super_scope_button_id == SUPER_SCOPE_TRIGGER ) {
super_scope_button_id = SUPER_SCOPE_CURSOR;
} else if ( super_scope_button_id == SUPER_SCOPE_CURSOR ) {
super_scope_button_id = SUPER_SCOPE_TRIGGER;
}
}
S9xReportButton(MAKE_BUTTON(PAD_2, super_scope_button_id), btn);
}
}
break;
case RETRO_DEVICE_LIGHTGUN_JUSTIFIER:
input_report_gun_position( port, BTN_POINTER );
if ( setting_gun_input == SETTING_GUN_INPUT_POINTER ) {
input_handle_pointer_lightgun(port, RETRO_DEVICE_LIGHTGUN_JUSTIFIER, BTN_POINTER);
} else {
// Lightgun is default
input_report_gun_position( port, BTN_POINTER );
{
/* Special Reload Button */
int btn_offscreen_shot = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_RELOAD );
{
/* Special Reload Button */
int btn_offscreen_shot = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_RELOAD );
/* Trigger ? */
int btn_trigger = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_TRIGGER), btn_trigger || btn_offscreen_shot);
/* Trigger ? */
int btn_trigger = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_TRIGGER), btn_trigger || btn_offscreen_shot);
/* Start Button ? */
int btn_start = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_START );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_START), btn_start ? 1 : 0 );
/* Start Button ? */
int btn_start = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_START );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_START), btn_start ? 1 : 0 );
/* Aiming off-screen ? */
int btn_offscreen = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_OFFSCREEN), btn_offscreen || btn_offscreen_shot);
}
/* Aiming off-screen ? */
int btn_offscreen = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN );
S9xReportButton(MAKE_BUTTON(PAD_2, JUSTIFIER_OFFSCREEN), btn_offscreen || btn_offscreen_shot);
}
/* Second Gun? */
if ( snes_devices[port+1] == RETRO_DEVICE_LIGHTGUN_JUSTIFIER_2 )
{
int second = port+1;
/* Second Gun? */
if ( snes_devices[port+1] == RETRO_DEVICE_LIGHTGUN_JUSTIFIER_2 )
{
int second = port+1;
input_report_gun_position( second, BTN_POINTER2 );
input_report_gun_position( second, BTN_POINTER2 );
/* Special Reload Button */
int btn_offscreen_shot = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_RELOAD );
/* Special Reload Button */
int btn_offscreen_shot = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_RELOAD );
/* Trigger ? */
int btn_trigger = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER );
S9xReportButton(MAKE_BUTTON(PAD_3, JUSTIFIER_TRIGGER), btn_trigger || btn_offscreen_shot);
/* Trigger ? */
int btn_trigger = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER );
S9xReportButton(MAKE_BUTTON(PAD_3, JUSTIFIER_TRIGGER), btn_trigger || btn_offscreen_shot);
/* Start Button ? */
int btn_start = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_START );
S9xReportButton(MAKE_BUTTON(PAD_3, JUSTIFIER_START), btn_start ? 1 : 0 );
/* Aiming off-screen ? */
int btn_offscreen = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN );
S9xReportButton(MAKE_BUTTON(PAD_3, JUSTIFIER_OFFSCREEN), btn_offscreen || btn_offscreen_shot);
}
/* Start Button ? */
int btn_start = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_START );
S9xReportButton(MAKE_BUTTON(PAD_3, JUSTIFIER_START), btn_start ? 1 : 0 );
/* Aiming off-screen ? */
int btn_offscreen = input_state_cb( second, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN );
S9xReportButton(MAKE_BUTTON(PAD_3, JUSTIFIER_OFFSCREEN), btn_offscreen || btn_offscreen_shot);
}
}
break;
case RETRO_DEVICE_LIGHTGUN_MACS_RIFLE:
input_report_gun_position( port, BTN_POINTER );
{
/* Trigger ? */
int btn_trigger = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER );
S9xReportButton(MAKE_BUTTON(PAD_2, MACS_RIFLE_TRIGGER), btn_trigger);
}
if ( setting_gun_input == SETTING_GUN_INPUT_POINTER ) {
input_handle_pointer_lightgun(port, RETRO_DEVICE_LIGHTGUN_MACS_RIFLE, BTN_POINTER);
} else {
input_report_gun_position( port, BTN_POINTER );
{
/* Trigger ? */
int btn_trigger = input_state_cb( port, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER );
S9xReportButton(MAKE_BUTTON(PAD_2, MACS_RIFLE_TRIGGER), btn_trigger);
}
}
break;
case RETRO_DEVICE_NONE:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2017 The RetroArch team
/* Copyright (C) 2010-2018 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this libretro API header (libretro.h).
@ -32,7 +32,7 @@ extern "C" {
#endif
#ifndef __cplusplus
#if defined(_MSC_VER) && !defined(SN_TARGET_PS3)
#if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3)
/* Hack applied for MSVC when compiling in C89 mode
* as it isn't C99-compliant. */
#define bool unsigned char
@ -128,7 +128,8 @@ extern "C" {
/* LIGHTGUN device is similar to Guncon-2 for PlayStation 2.
* It reports X/Y coordinates in screen space (similar to the pointer)
* in the range [-0x8000, 0x7fff] in both axes, with zero being center.
* in the range [-0x8000, 0x7fff] in both axes, with zero being center and
* -0x8000 being out of bounds.
* As well as reporting on/off screen state. It features a trigger,
* start/select buttons, auxiliary action buttons and a
* directional pad. A forced off-screen shot can be requested for
@ -139,7 +140,8 @@ extern "C" {
/* The ANALOG device is an extension to JOYPAD (RetroPad).
* Similar to DualShock2 it adds two analog sticks and all buttons can
* be analog. This is treated as a separate device type as it returns
* axis values in the full analog range of [-0x8000, 0x7fff].
* axis values in the full analog range of [-0x7fff, 0x7fff],
* although some devices may return -0x8000.
* Positive X axis is right. Positive Y axis is down.
* Buttons are returned in the range [0, 0x7fff].
* Only use ANALOG type when polling for analog values.
@ -200,6 +202,8 @@ extern "C" {
#define RETRO_DEVICE_ID_JOYPAD_L3 14
#define RETRO_DEVICE_ID_JOYPAD_R3 15
#define RETRO_DEVICE_ID_JOYPAD_MASK 256
/* Index / Id values for ANALOG device. */
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
@ -246,6 +250,7 @@ extern "C" {
#define RETRO_DEVICE_ID_POINTER_X 0
#define RETRO_DEVICE_ID_POINTER_Y 1
#define RETRO_DEVICE_ID_POINTER_PRESSED 2
#define RETRO_DEVICE_ID_POINTER_COUNT 3
/* Returned from retro_get_region(). */
#define RETRO_REGION_NTSC 0
@ -270,6 +275,9 @@ enum retro_language
RETRO_LANGUAGE_ESPERANTO = 13,
RETRO_LANGUAGE_POLISH = 14,
RETRO_LANGUAGE_VIETNAMESE = 15,
RETRO_LANGUAGE_ARABIC = 16,
RETRO_LANGUAGE_GREEK = 17,
RETRO_LANGUAGE_TURKISH = 18,
RETRO_LANGUAGE_LAST,
/* Ensure sizeof(enum) == sizeof(int) */
@ -375,6 +383,10 @@ enum retro_key
RETROK_x = 120,
RETROK_y = 121,
RETROK_z = 122,
RETROK_LEFTBRACE = 123,
RETROK_BAR = 124,
RETROK_RIGHTBRACE = 125,
RETROK_TILDE = 126,
RETROK_DELETE = 127,
RETROK_KP0 = 256,
@ -445,6 +457,7 @@ enum retro_key
RETROK_POWER = 320,
RETROK_EURO = 321,
RETROK_UNDO = 322,
RETROK_OEM_102 = 323,
RETROK_LAST,
@ -476,11 +489,13 @@ enum retro_mod
/* Environment commands. */
#define RETRO_ENVIRONMENT_SET_ROTATION 1 /* const unsigned * --
* Sets screen rotation of graphics.
* Is only implemented if rotation can be accelerated by hardware.
* Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180,
* 270 degrees counter-clockwise respectively.
*/
#define RETRO_ENVIRONMENT_GET_OVERSCAN 2 /* bool * --
* NOTE: As of 2019 this callback is considered deprecated in favor of
* using core options to manage overscan in a more nuanced, core-specific way.
*
* Boolean value whether or not the implementation should use overscan,
* or crop away overscan.
*/
@ -594,8 +609,11 @@ enum retro_mod
* GET_VARIABLE.
* This allows the frontend to present these variables to
* a user dynamically.
* This should be called as early as possible (ideally in
* retro_set_environment).
* This should be called the first time as early as
* possible (ideally in retro_set_environment).
* Afterward it may be called again for the core to communicate
* updated options to the frontend, but the number of core
* options must not change from the number in the initial call.
*
* 'data' points to an array of retro_variable structs
* terminated by a { NULL, NULL } element.
@ -649,6 +667,15 @@ enum retro_mod
/* 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 * --
* 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,
* slow-motion, frame stepping, etc.
* In this case the delta time will use the reference value
* in frame_time_callback..
*/
#define RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK 22
/* const struct retro_audio_callback * --
* Sets an interface which is used to notify a libretro core about audio
@ -675,15 +702,6 @@ enum retro_mod
* A libretro core using SET_AUDIO_CALLBACK should also make use of
* SET_FRAME_TIME_CALLBACK.
*/
#define RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK 21
/* 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,
* slow-motion, frame stepping, etc.
* In this case the delta time will use the reference value
* in frame_time_callback..
*/
#define RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE 23
/* struct retro_rumble_interface * --
* Gets an interface which is used by a libretro core to set
@ -770,17 +788,18 @@ enum retro_mod
*/
#define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
/* const char ** --
* Returns the "save" directory of the frontend.
* This directory can be used to store SRAM, memory cards,
* high scores, etc, if the libretro core
* 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
* cannot use the regular memory interface (retro_get_memory_data()).
*
* NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for
* similar things before.
* They should still check GET_SYSTEM_DIRECTORY if they want to
* be backwards compatible.
* The path here can be NULL. It should only be non-NULL if the
* frontend user has set a specific save path.
* If the frontend cannot designate a save directory, it will return
* NULL to indicate that the core should attempt to operate without a
* save directory set.
*
* NOTE: early libretro cores used the system directory for save
* files. Cores that need to be backwards-compatible can still check
* GET_SYSTEM_DIRECTORY.
*/
#define RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO 32
/* const struct retro_system_av_info * --
@ -848,26 +867,39 @@ enum retro_mod
#define RETRO_ENVIRONMENT_SET_CONTROLLER_INFO 35
/* const struct retro_controller_info * --
* This environment call lets a libretro core tell the frontend
* which controller types are recognized in calls to
* which controller subclasses are recognized in calls to
* retro_set_controller_port_device().
*
* Some emulators such as Super Nintendo
* support multiple lightgun types which must be specifically
* selected from.
* It is therefore sometimes necessary for a frontend to be able
* to tell the core about a special kind of input device which is
* not covered by the libretro input API.
* Some emulators such as Super Nintendo support multiple lightgun
* types which must be specifically selected from. It is therefore
* sometimes necessary for a frontend to be able to tell the core
* about a special kind of input device which is not specifcally
* provided by the Libretro API.
*
* In order for a frontend to understand the workings of an input device,
* it must be a specialized type
* of the generic device types already defined in the libretro API.
* In order for a frontend to understand the workings of those devices,
* they must be defined as a specialized subclass of the generic device
* types already defined in the libretro API.
*
* Which devices are supported can vary per input port.
* The core must pass an array of const struct retro_controller_info which
* is terminated with a blanked out struct. Each element of the struct
* corresponds to an ascending port index to
* retro_set_controller_port_device().
* Even if special device types are set in the libretro core,
* is terminated with a blanked out struct. Each element of the
* retro_controller_info struct corresponds to the ascending port index
* that is passed to retro_set_controller_port_device() when that function
* is called to indicate to the core that the frontend has changed the
* active device subclass. SEE ALSO: retro_set_controller_port_device()
*
* The ascending input port indexes provided by the core in the struct
* are generally presented by frontends as ascending User # or Player #,
* such as Player 1, Player 2, Player 3, etc. Which device subclasses are
* supported can vary per input port.
*
* The first inner element of each entry in the retro_controller_info array
* is a retro_controller_description struct that specifies the names and
* codes of all device subclasses that are available for the corresponding
* User or Player, beginning with the generic Libretro device that the
* subclasses are derived from. The second inner element of each entry is the
* total number of subclasses that are listed in the retro_controller_description.
*
* NOTE: Even if special device types are set in the libretro core,
* libretro should only poll input based on the base input device types.
*/
#define RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
@ -946,7 +978,37 @@ enum retro_mod
* A frontend must make sure that the pointer obtained from this function is
* writeable (and readable).
*/
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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
* being used. See the various headers like libretro_vulkan.h, etc.
*
* GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
* Similarly, after context_destroyed callback returns,
* the contents of the HW_RENDER_INTERFACE are invalidated.
*/
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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.
*
* 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 * --
* 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 * --
* 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) * --
* The frontend will try to use a 'shared' hardware context (mostly applicable
@ -958,61 +1020,236 @@ enum retro_mod
* This will do nothing on its own until SET_HW_RENDER env callbacks are
* being used.
*/
#define RETRO_ENVIRONMENT_GET_VFS_INTERFACE (45 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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
* core supports VFS before it starts handing out paths.
* It is recomended to do so in retro_set_environment */
* It is recomended to do so in retro_set_environment
*/
#define RETRO_ENVIRONMENT_GET_LED_INTERFACE (46 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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 * --
* 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.
* This is mainly used for increasing performance.
* Bit 0 (value 1): Enable Video
* Bit 1 (value 2): Enable Audio
* Bit 2 (value 4): Use Fast Savestates.
* Bit 3 (value 8): Hard Disable Audio
* Other bits are reserved for future use and will default to zero.
* If video is disabled:
* * The frontend wants the core to not generate any video,
* including presenting frames via hardware acceleration.
* * The frontend's video frame callback will do nothing.
* * After running the frame, the video output of the next frame should be
* no different than if video was enabled, and saving and loading state
* should have no issues.
* If audio is disabled:
* * The frontend wants the core to not generate any audio.
* * The frontend's audio callbacks will do nothing.
* * After running the frame, the audio output of the next frame should be
* no different than if audio was enabled, and saving and loading state
* should have no issues.
* Fast Savestates:
* * Guaranteed to be created by the same binary that will load them.
* * Will not be written to or read from the disk.
* * Suggest that the core assumes loading state will succeed.
* * Suggest that the core updates its memory buffers in-place if possible.
* * Suggest that the core skips clearing memory.
* * Suggest that the core skips resetting the system.
* * Suggest that the core may skip validation steps.
* Hard Disable Audio:
* * Used for a secondary core when running ahead.
* * Indicates that the frontend will never need audio from the core.
* * Suggests that the core may stop synthesizing audio, but this should not
* compromise emulation accuracy.
* * Audio output for the next frame does not matter, and the frontend will
* never need an accurate audio state in the future.
* * State will never be saved when using Hard Disable Audio.
*/
/* 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.
* This is mainly used for increasing performance.
* Bit 0 (value 1): Enable Video
* Bit 1 (value 2): Enable Audio
* Bit 2 (value 4): Use Fast Savestates.
* Bit 3 (value 8): Hard Disable Audio
* Other bits are reserved for future use and will default to zero.
* If video is disabled:
* * The frontend wants the core to not generate any video,
* including presenting frames via hardware acceleration.
* * The frontend's video frame callback will do nothing.
* * After running the frame, the video output of the next frame should be
* no different than if video was enabled, and saving and loading state
* should have no issues.
* If audio is disabled:
* * The frontend wants the core to not generate any audio.
* * The frontend's audio callbacks will do nothing.
* * After running the frame, the audio output of the next frame should be
* no different than if audio was enabled, and saving and loading state
* should have no issues.
* Fast Savestates:
* * Guaranteed to be created by the same binary that will load them.
* * Will not be written to or read from the disk.
* * Suggest that the core assumes loading state will succeed.
* * Suggest that the core updates its memory buffers in-place if possible.
* * Suggest that the core skips clearing memory.
* * Suggest that the core skips resetting the system.
* * Suggest that the core may skip validation steps.
* Hard Disable Audio:
* * Used for a secondary core when running ahead.
* * Indicates that the frontend will never need audio from the core.
* * Suggests that the core may stop synthesizing audio, but this should not
* compromise emulation accuracy.
* * Audio output for the next frame does not matter, and the frontend will
* never need an accurate audio state in the future.
* * State will never be saved when using Hard Disable Audio.
*/
#define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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.
*/
#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.
*/
#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.
*/
#define RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION 52
/* 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.
*
* In legacy code, core options are set by passing an array of
* retro_variable structs to RETRO_ENVIRONMENT_SET_VARIABLES.
* This may be still be done regardless of the core options
* interface version.
*
* If version is >= 1 however, core options may instead be set by
* passing an array of retro_core_option_definition structs to
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS, or a 2D array of
* retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
* This allows the core to additionally set option sublabel information
* and/or provide localisation support.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53
/* 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.
* This allows the frontend to present these variables to
* a user dynamically.
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
* returns an API version of >= 1.
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
* This should be called the first time as early as
* possible (ideally in retro_set_environment).
* Afterwards it may be called again for the core to communicate
* updated options to the frontend, but the number of core
* options must not change from the number in the initial call.
*
* 'data' points to an array of retro_core_option_definition structs
* terminated by a { NULL, NULL, NULL, {{0}}, NULL } element.
* retro_core_option_definition::key should be namespaced to not collide
* with other implementations' keys. e.g. A core called
* 'foo' should use keys named as 'foo_option'.
* retro_core_option_definition::desc should contain a human readable
* description of the key.
* retro_core_option_definition::info should contain any additional human
* readable information text that a typical user may need to
* understand the functionality of the option.
* retro_core_option_definition::values is an array of retro_core_option_value
* structs terminated by a { NULL, NULL } element.
* > retro_core_option_definition::values[index].value is an expected option
* value.
* > retro_core_option_definition::values[index].label is a human readable
* label used when displaying the value on screen. If NULL,
* the value itself is used.
* retro_core_option_definition::default_value is the default core option
* setting. It must match one of the expected option values in the
* retro_core_option_definition::values array. If it does not, or the
* default value is NULL, the first entry in the
* retro_core_option_definition::values array is treated as the default.
*
* The number of possible options should be very limited,
* and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX.
* i.e. it should be feasible to cycle through options
* without a keyboard.
*
* Example entry:
* {
* "foo_option",
* "Speed hack coprocessor X",
* "Provides increased performance at the expense of reduced accuracy",
* {
* { "false", NULL },
* { "true", NULL },
* { "unstable", "Turbo (Unstable)" },
* { NULL, NULL },
* },
* "false"
* }
*
* Only strings are operated on. The possible values will
* generally be displayed and stored as-is by the frontend.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL 54
/* 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.
* This allows the frontend to present these variables to
* a user dynamically.
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
* returns an API version of >= 1.
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
* This should be called the first time as early as
* possible (ideally in retro_set_environment).
* Afterwards it may be called again for the core to communicate
* updated options to the frontend, but the number of core
* options must not change from the number in the initial call.
*
* This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS,
* with the addition of localisation support. The description of the
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS callback should be consulted
* for further details.
*
* 'data' points to a retro_core_options_intl struct.
*
* retro_core_options_intl::us is a pointer to an array of
* retro_core_option_definition structs defining the US English
* core options implementation. It must point to a valid array.
*
* retro_core_options_intl::local is a pointer to an array of
* retro_core_option_definition structs defining core options for
* the current frontend language. It may be NULL (in which case
* retro_core_options_intl::us is used by the frontend). Any items
* missing from this array will be read from retro_core_options_intl::us
* instead.
*
* NOTE: Default core option values are always taken from the
* retro_core_options_intl::us array. Any default values in
* retro_core_options_intl::local array will be ignored.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY 55
/* struct retro_core_option_display * --
*
* Allows an implementation to signal the environment to show
* or hide a variable when displaying core options. This is
* considered a *suggestion*. The frontend is free to ignore
* this callback, and its implementation not considered mandatory.
*
* 'data' points to a retro_core_option_display struct
*
* retro_core_option_display::key is a variable identifier
* which has already been set by SET_VARIABLES/SET_CORE_OPTIONS.
*
* retro_core_option_display::visible is a boolean, specifying
* whether variable should be displayed
*
* Note that all core option variables will be set visible by
* default when calling SET_VARIABLES/SET_CORE_OPTIONS.
*/
/* VFS functionality */
/* File paths:
* File paths passed as parameters when using this api shall be well formed unix-style,
* File paths passed as parameters when using this API shall be well formed UNIX-style,
* using "/" (unquoted forward slash) as directory separator regardless of the platform's native separator.
* Paths shall also include at least one forward slash ("game.bin" is an invalid path, use "./game.bin" instead).
* Other than the directory separator, cores shall not make assumptions about path format:
@ -1030,6 +1267,10 @@ enum retro_mod
* Introduced in VFS API v1 */
struct retro_vfs_file_handle;
/* Opaque directory handle
* Introduced in VFS API v3 */
struct retro_vfs_dir_handle;
/* File open flags
* Introduced in VFS API v1 */
#define RETRO_VFS_FILE_ACCESS_READ (1 << 0) /* Read only mode */
@ -1049,6 +1290,12 @@ struct retro_vfs_file_handle;
#define RETRO_VFS_SEEK_POSITION_CURRENT 1
#define RETRO_VFS_SEEK_POSITION_END 2
/* stat() result flags
* Introduced in VFS API v3 */
#define RETRO_VFS_STAT_IS_VALID (1 << 0)
#define RETRO_VFS_STAT_IS_DIRECTORY (1 << 1)
#define RETRO_VFS_STAT_IS_CHARACTER_SPECIAL (1 << 2)
/* 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);
@ -1058,7 +1305,7 @@ typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file
* Introduced in VFS API v1 */
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 succes, -1 on failure.
/* 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);
@ -1067,7 +1314,11 @@ typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *st
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
/* Get the current read / write position for the file. Returns - 1 for error.
/* 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);
/* 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);
@ -1095,8 +1346,42 @@ typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
* Introduced in VFS API v1 */
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);
/* 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);
/* 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);
/* 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);
/* 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);
/* 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);
/* 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);
struct retro_vfs_interface
{
/* VFS API v1 */
retro_vfs_get_path_t get_path;
retro_vfs_open_t open;
retro_vfs_close_t close;
@ -1108,6 +1393,16 @@ struct retro_vfs_interface
retro_vfs_flush_t flush;
retro_vfs_remove_t remove;
retro_vfs_rename_t rename;
/* VFS API v2 */
retro_vfs_truncate_t truncate;
/* VFS API v3 */
retro_vfs_stat_t stat;
retro_vfs_mkdir_t mkdir;
retro_vfs_opendir_t opendir;
retro_vfs_readdir_t readdir;
retro_vfs_dirent_get_name_t dirent_get_name;
retro_vfs_dirent_is_dir_t dirent_is_dir;
retro_vfs_closedir_t closedir;
};
struct retro_vfs_interface_info
@ -1125,8 +1420,13 @@ struct retro_vfs_interface_info
enum retro_hw_render_interface_type
{
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
RETRO_HW_RENDER_INTERFACE_GSKIT_PS2 = 5,
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
};
/* Base struct. All retro_hw_render_interface_* types
@ -1136,26 +1436,42 @@ struct retro_hw_render_interface
enum retro_hw_render_interface_type interface_type;
unsigned interface_version;
};
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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
* being used. See the various headers like libretro_vulkan.h, etc.
*
* GET_HW_RENDER_INTERFACE cannot be called before context_reset has been called.
* Similarly, after context_destroyed callback returns,
* the contents of the HW_RENDER_INTERFACE are invalidated.
*/
#define RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS (42 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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.
*
* This must be called before the first call to retro_run.
*/
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;
};
/* Retrieves the current state of the MIDI input.
* Returns true if it's enabled, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_input_enabled_t)(void);
/* Retrieves the current state of the MIDI output.
* Returns true if it's enabled, false otherwise */
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);
/* Writes byte to the output stream.
* 'delta_time' is in microseconds and represent time elapsed since previous write.
* Returns true if byte is written, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_write_t)(uint8_t byte, uint32_t delta_time);
/* Flushes previously written data.
* Returns true if successful, false otherwise. */
typedef bool (RETRO_CALLCONV *retro_midi_flush_t)(void);
struct retro_midi_interface
{
retro_midi_input_enabled_t input_enabled;
retro_midi_output_enabled_t output_enabled;
retro_midi_read_t read;
retro_midi_write_t write;
retro_midi_flush_t flush;
};
enum retro_hw_render_context_negotiation_interface_type
{
@ -1170,13 +1486,6 @@ struct retro_hw_render_context_negotiation_interface
enum retro_hw_render_context_negotiation_interface_type interface_type;
unsigned interface_version;
};
#define RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE (43 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* 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.
*/
/* Serialized state is incomplete in some way. Set if serialization is
* usable in typical end-user cases but should not be relied upon to
@ -1202,20 +1511,17 @@ struct retro_hw_render_context_negotiation_interface
* dependence */
#define RETRO_SERIALIZATION_QUIRK_PLATFORM_DEPENDENT (1 << 6)
#define RETRO_ENVIRONMENT_SET_SERIALIZATION_QUIRKS 44
/* 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_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
#define RETRO_MEMDESC_ALIGN_4 (2 << 16)
#define RETRO_MEMDESC_ALIGN_8 (3 << 16)
#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)
#define RETRO_MEMDESC_CONST (1 << 0) /* The frontend will never change this memory area once retro_load_game has returned. */
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) /* The memory area contains big endian data. Default is little endian. */
#define RETRO_MEMDESC_SYSTEM_RAM (1 << 2) /* The memory area is system RAM. This is main RAM of the gaming system. */
#define RETRO_MEMDESC_SAVE_RAM (1 << 3) /* The memory area is save RAM. This RAM is usually found on a game cartridge, backed up by a battery. */
#define RETRO_MEMDESC_VIDEO_RAM (1 << 4) /* The memory area is video RAM (VRAM) */
#define RETRO_MEMDESC_ALIGN_2 (1 << 16) /* All memory access in this area is aligned to their own size, or 2, whichever is smaller. */
#define RETRO_MEMDESC_ALIGN_4 (2 << 16)
#define RETRO_MEMDESC_ALIGN_8 (3 << 16)
#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;
@ -1864,6 +2170,10 @@ enum retro_hw_context_type
/* Vulkan, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE. */
RETRO_HW_CONTEXT_VULKAN = 6,
/* Direct3D, set version_major to select the type of interface
* returned by RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
RETRO_HW_CONTEXT_DIRECT3D = 7,
RETRO_HW_CONTEXT_DUMMY = INT_MAX
};
@ -2111,17 +2421,26 @@ struct retro_system_info
* Typically used for a GUI to filter
* out extensions. */
/* If true, retro_load_game() is guaranteed to provide a valid pathname
* in retro_game_info::path.
* ::data and ::size are both invalid.
/* Libretro cores that need to have direct access to their content
* files, including cores which use the path of the content files to
* determine the paths of other files, should set need_fullpath to true.
*
* If false, ::data and ::size are guaranteed to be valid, but ::path
* might not be valid.
* Cores should strive for setting need_fullpath to false,
* as it allows the frontend to perform patching, etc.
*
* This is typically set to true for libretro implementations that must
* load from file.
* Implementations should strive for setting this to false, as it allows
* the frontend to perform patching, etc. */
* If need_fullpath is true and retro_load_game() is called:
* - retro_game_info::path is guaranteed to have a valid path
* - retro_game_info::data and retro_game_info::size are invalid
*
* If need_fullpath is false and retro_load_game() is called:
* - retro_game_info::path may be NULL
* - retro_game_info::data and retro_game_info::size are guaranteed
* to be valid
*
* See also:
* - RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY
* - RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY
*/
bool need_fullpath;
/* If true, the frontend is not allowed to extract any archives before
@ -2172,6 +2491,76 @@ struct retro_variable
const char *value;
};
struct retro_core_option_display
{
/* Variable to configure in RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY */
const char *key;
/* Specifies whether variable should be displayed
* when presenting core options to the user */
bool visible;
};
/* Maximum number of values permitted for a core option
* > Note: We have to set a maximum value due the limitations
* of the C language - i.e. it is not possible to create an
* array of structs each containing a variable sized array,
* so the retro_core_option_definition values array must
* have a fixed size. The size limit of 128 is a balancing
* act - it needs to be large enough to support all 'sane'
* core options, but setting it too large may impact low memory
* platforms. In practise, if a core option has more than
* 128 values then the implementation is likely flawed.
* To quote the above API reference:
* "The number of possible options should be very limited
* i.e. it should be feasible to cycle through options
* without a keyboard."
*/
#define RETRO_NUM_CORE_OPTION_VALUES_MAX 128
struct retro_core_option_value
{
/* Expected option value */
const char *value;
/* Human-readable value label. If NULL, value itself
* will be displayed by the frontend */
const char *label;
};
struct retro_core_option_definition
{
/* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE. */
const char *key;
/* Human-readable core option description (used as menu label) */
const char *desc;
/* Human-readable core option information (used as menu sublabel) */
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];
/* 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;
};
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;
/* 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_game_info
{
const char *path; /* Path to game, UTF-8 encoded.
@ -2306,7 +2695,13 @@ RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info);
* will only poll input based on that particular device type. It is only a
* hint to the libretro core when a core cannot automatically detect the
* appropriate input device type on its own. It is also relevant when a
* core can change its behavior depending on device type. */
* core can change its behavior depending on device type.
*
* As part of the core's implementation of retro_set_controller_port_device,
* the core should call RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS to notify the
* frontend if the descriptions for any controls have changed as a
* result of changing the device type.
*/
RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device);
/* Resets the current game. */
@ -2338,7 +2733,9 @@ 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);
/* Loads a game. */
/* 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);
/* Loads a "special" kind of game. Should not be used,
@ -2348,7 +2745,7 @@ RETRO_API bool retro_load_game_special(
const struct retro_game_info *info, size_t num_info
);
/* Unloads a currently loaded game. */
/* Unloads the currently loaded game. Called before retro_deinit(void). */
RETRO_API void retro_unload_game(void);
/* Gets region of game. */

View File

@ -0,0 +1,915 @@
#ifndef LIBRETRO_CORE_OPTIONS_H__
#define LIBRETRO_CORE_OPTIONS_H__
#include <stdlib.h>
#include <string.h>
#include <libretro.h>
#include <retro_inline.h>
#ifndef HAVE_NO_LANGEXTRA
#include "libretro_core_options_intl.h"
#endif
/*
********************************
* VERSION: 1.3
********************************
*
* - 1.3: Move translations to libretro_core_options_intl.h
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
* - Added HAVE_NO_LANGEXTRA flag to disable translations
* on platforms/compilers without BOM support
* - 1.2: Use core options v1 interface when
* RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
* (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
* - 1.1: Support generation of core options v0 retro_core_option_value
* arrays containing options with a single value
* - 1.0: First commit
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
********************************
* Core Option Definitions
********************************
*/
/* RETRO_LANGUAGE_ENGLISH */
/* Default language:
* - All other languages must include the same keys and values
* - Will be used as a fallback in the event that frontend language
* is not available
* - Will be used as a fallback for any missing entries in
* frontend language definition */
struct retro_core_option_definition option_defs_us[] = {
/* These variable names and possible values constitute an ABI with ZMZ (ZSNES Libretro player).
* Changing "Show layer 1" is fine, but don't change "layer_1"/etc or the possible values ("Yes|No").
* Adding more variables and rearranging them is safe. */
{
"snes9x_region",
"Console Region (Reload Core)",
"Specify which region the system is from. 'PAL' is 50hz, 'NTSC' is 60hz. Games will run faster or slower than normal if the incorrect region is selected.",
{
{ "auto", "Auto" },
{ "ntsc", "NTSC" },
{ "pal", "PAL" },
{ NULL, NULL},
},
"auto"
},
{
"snes9x_aspect",
"Preferred Aspect Ratio",
"Choose the preferred content aspect ratio. This will only apply when RetroArch's aspect ratio is set to 'Core provided' in the Video settings.",
{
{ "4:3", NULL },
{ "uncorrected", "Uncorrected" },
{ "auto", "Auto" },
{ "ntsc", "NTSC" },
{ "pal", "PAL" },
{ NULL, NULL},
},
"4:3"
},
{
"snes9x_overscan",
"Crop Overscan",
"Remove the ~8 pixel borders at the top and bottom of the screen, typically unused by games and hidden by the bezel of a standard-definition television. 'Auto' will attempt to detect and crop overscan based on the current content.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ "auto", "Auto" },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_gfx_hires",
"Enable Hi-Res Mode",
"Allow games to switch to hi-res mode (512x448) or force all content to output at 256x224 (with crushed pixels).",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_hires_blend",
"Hi-Res Blending",
"Blend adjacent pixels when game switches to hi-res mode (512x448). Required for certain games that use hi-res mode to produce transparency effects (Kirby's Dream Land, Jurassic Park...).",
{
{ "disabled", NULL },
{ "merge", "Merge" },
{ "blur", "Blur" },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_blargg",
"Blargg NTSC Filter",
"Apply a video filter to mimic various NTSC TV signals.",
{
{ "disabled", NULL },
{ "monochrome", "Monochrome" },
{ "rf", "RF" },
{ "composite", "Composite" },
{ "s-video", "S-Video" },
{ "rgb", "RGB" },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_audio_interpolation",
"Audio Interpolation",
"Apply an audio filter. 'Gaussian' reproduces the bass-heavy sound of the original hardware. 'Cubic' and 'Sinc' are less accurate, and preserve more of the high range.",
{
{ "gaussian", "Gaussian" },
{ "cubic", "Cubic" },
{ "sinc", "Sinc" },
{ "none", "None" },
{ "linear", "Linear" },
{ NULL, NULL},
},
"gaussian"
},
{
"snes9x_up_down_allowed",
"Allow Opposing Directions",
"Enabling this will allow pressing / quickly alternating / holding both left and right (or up and down) directions at the same time. This may cause movement-based glitches.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"snes9x_overclock_superfx",
"SuperFX Overclocking",
"SuperFX coprocessor frequency multiplier. Can improve frame rate or cause timing errors. Values under 100% can improve game performance on slow devices.",
{
{ "50%", NULL },
{ "60%", NULL },
{ "70%", NULL },
{ "80%", NULL },
{ "90%", NULL },
{ "100%", NULL },
{ "150%", NULL },
{ "200%", NULL },
{ "250%", NULL },
{ "300%", NULL },
{ "350%", NULL },
{ "400%", NULL },
{ "450%", NULL },
{ "500%", NULL },
{ NULL, NULL},
},
"100%"
},
{
"snes9x_overclock_cycles",
"Reduce Slowdown (Hack, Unsafe)",
"Overclock SNES CPU. May cause games to crash! Use 'Light' for shorter loading times, 'Compatible' for most games exhibiting slowdown and 'Max' only if absolutely required (Gradius 3, Super R-type...).",
{
{ "disabled", NULL },
{ "light", "Light" },
{ "compatible", "Compatible" },
{ "max", "Max" },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_reduce_sprite_flicker",
"Reduce Flickering (Hack, Unsafe)",
"Increases number of sprites that can be drawn simultaneously on screen.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_randomize_memory",
"Randomize Memory (Unsafe)",
"Randomizes system RAM upon start-up. Some games such as 'Super Off Road' use system RAM as a random number generator for item placement and AI behavior, to make gameplay more unpredictable.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_block_invalid_vram_access",
"Block Invalid VRAM Access",
"Some homebrew/ROM hacks require this option to be disabled for correct operation.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_echo_buffer_hack",
"Echo Buffer Hack (Unsafe, only enable for old addmusic hacks)",
"Some homebrew/ROM hacks require this option to be enabled for correct operation.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_show_lightgun_settings",
"Show Light Gun Settings",
"Enable configuration of Super Scope / Justifier / M.A.C.S. rifle input. NOTE: Quick Menu must be toggled for this setting to take effect.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_lightgun_mode",
"Light Gun Mode",
"Use a mouse-controlled 'Light Gun' or 'Touchscreen' input.",
{
{ "Lightgun", "Light Gun" },
{ "Touchscreen", NULL },
{ NULL, NULL},
},
"Lightgun"
},
{
"snes9x_superscope_reverse_buttons",
"Super Scope Reverse Trigger Buttons",
"Swap the positions of the Super Scope 'Fire' and 'Cursor' buttons.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_superscope_crosshair",
"Super Scope Crosshair",
"Change the crosshair size on screen.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"2"
},
{
"snes9x_superscope_color",
"Super Scope Color",
"Change the crosshair color on screen.",
{
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ NULL, NULL},
},
"White"
},
{
"snes9x_justifier1_crosshair",
"Justifier 1 Crosshair",
"Change the crosshair size on screen.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"4"
},
{
"snes9x_justifier1_color",
"Justifier 1 Color",
"Change the crosshair color on screen.",
{
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ NULL, NULL},
},
"Blue"
},
{
"snes9x_justifier2_crosshair",
"Justifier 2 Crosshair",
"Change the crosshair size on screen.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"4"
},
{
"snes9x_justifier2_color",
"Justifier 2 Color",
"Change the crosshair color on screen.",
{
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ NULL, NULL},
},
"Pink"
},
{
"snes9x_rifle_crosshair",
"M.A.C.S. Rifle Crosshair",
"Change the crosshair size on screen.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"2"
},
{
"snes9x_rifle_color",
"M.A.C.S. Rifle Color",
"Change the crosshair color on screen.",
{
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ NULL, NULL},
},
"White"
},
{
"snes9x_show_advanced_av_settings",
"Show Advanced Audio/Video Settings",
"Enable configuration of low-level video layer / GFX effect / audio channel parameters. NOTE: Quick Menu must be toggled for this setting to take effect.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_layer_1",
"Show Layer 1",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_2",
"Show Layer 2",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_3",
"Show Layer 3",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_4",
"Show Layer 4",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_5",
"Show Sprite Layer",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_gfx_clip",
"Enable Graphic Clip Windows",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_gfx_transp",
"Enable Transparency Effects",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_1",
"Enable Sound Channel 1",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_2",
"Enable Sound Channel 2",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_3",
"Enable Sound Channel 3",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_4",
"Enable Sound Channel 4",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_5",
"Enable Sound Channel 5",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_6",
"Enable Sound Channel 6",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_7",
"Enable Sound Channel 7",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_8",
"Enable Sound Channel 8",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{ NULL, NULL, NULL, {{0}}, NULL },
};
/*
********************************
* Language Mapping
********************************
*/
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
option_defs_us, /* RETRO_LANGUAGE_ENGLISH */
NULL, /* RETRO_LANGUAGE_JAPANESE */
NULL, /* RETRO_LANGUAGE_FRENCH */
NULL, /* RETRO_LANGUAGE_SPANISH */
NULL, /* RETRO_LANGUAGE_GERMAN */
NULL, /* RETRO_LANGUAGE_ITALIAN */
NULL, /* RETRO_LANGUAGE_DUTCH */
NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
NULL, /* RETRO_LANGUAGE_RUSSIAN */
NULL, /* RETRO_LANGUAGE_KOREAN */
NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
NULL, /* RETRO_LANGUAGE_ESPERANTO */
NULL, /* RETRO_LANGUAGE_POLISH */
NULL, /* RETRO_LANGUAGE_VIETNAMESE */
NULL, /* RETRO_LANGUAGE_ARABIC */
NULL, /* RETRO_LANGUAGE_GREEK */
option_defs_tr, /* RETRO_LANGUAGE_TURKISH */
};
#endif
/*
********************************
* Functions
********************************
*/
/* Handles configuration/setting of core options.
* Should be called as early as possible - ideally inside
* retro_set_environment(), and no later than retro_load_game()
* > We place the function body in the header to avoid the
* necessity of adding more .c files (i.e. want this to
* be as painless as possible for core devs)
*/
static INLINE void libretro_set_core_options(retro_environment_t environ_cb)
{
unsigned version = 0;
if (!environ_cb)
return;
if (environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version) && (version >= 1))
{
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_options_intl core_options_intl;
unsigned language = 0;
core_options_intl.us = option_defs_us;
core_options_intl.local = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
core_options_intl.local = option_defs_intl[language];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_intl);
#else
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, &option_defs_us);
#endif
}
else
{
size_t i;
size_t option_index = 0;
size_t num_options = 0;
struct retro_variable *variables = NULL;
char **values_buf = NULL;
/* Determine number of options
* > Note: We are going to skip a number of irrelevant
* core options when building the retro_variable array,
* but we'll allocate space for all of them. The difference
* in resource usage is negligible, and this allows us to
* keep the code 'cleaner' */
while (true)
{
if (option_defs_us[num_options].key)
num_options++;
else
break;
}
/* Allocate arrays */
variables = (struct retro_variable *)calloc(num_options + 1, sizeof(struct retro_variable));
values_buf = (char **)calloc(num_options, sizeof(char *));
if (!variables || !values_buf)
goto error;
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
const char *key = option_defs_us[i].key;
const char *desc = option_defs_us[i].desc;
const char *default_value = option_defs_us[i].default_value;
struct retro_core_option_value *values = option_defs_us[i].values;
size_t buf_len = 3;
size_t default_index = 0;
values_buf[i] = NULL;
/* Skip options that are irrelevant when using the
* old style core options interface */
if ((strcmp(key, "snes9x_show_lightgun_settings") == 0) ||
(strcmp(key, "snes9x_show_advanced_av_settings") == 0))
continue;
if (desc)
{
size_t num_values = 0;
/* Determine number of values */
while (true)
{
if (values[num_values].value)
{
/* Check if this is the default value */
if (default_value)
if (strcmp(values[num_values].value, default_value) == 0)
default_index = num_values;
buf_len += strlen(values[num_values].value);
num_values++;
}
else
break;
}
/* Build values string */
if (num_values > 0)
{
size_t j;
buf_len += num_values - 1;
buf_len += strlen(desc);
values_buf[i] = (char *)calloc(buf_len, sizeof(char));
if (!values_buf[i])
goto error;
strcpy(values_buf[i], desc);
strcat(values_buf[i], "; ");
/* Default value goes first */
strcat(values_buf[i], values[default_index].value);
/* Add remaining values */
for (j = 0; j < num_values; j++)
{
if (j != default_index)
{
strcat(values_buf[i], "|");
strcat(values_buf[i], values[j].value);
}
}
}
}
variables[option_index].key = key;
variables[option_index].value = values_buf[i];
option_index++;
}
/* Set variables */
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
error:
/* Clean up */
if (values_buf)
{
for (i = 0; i < num_options; i++)
{
if (values_buf[i])
{
free(values_buf[i]);
values_buf[i] = NULL;
}
}
free(values_buf);
values_buf = NULL;
}
if (variables)
{
free(variables);
variables = NULL;
}
}
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,738 @@
#ifndef LIBRETRO_CORE_OPTIONS_INTL_H__
#define LIBRETRO_CORE_OPTIONS_INTL_H__
#if defined(_MSC_VER) && (_MSC_VER >= 1500 && _MSC_VER < 1900)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#pragma warning(disable:4566)
#endif
#include <libretro.h>
/*
********************************
* VERSION: 1.3
********************************
*
* - 1.3: Move translations to libretro_core_options_intl.h
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
* - Added HAVE_NO_LANGEXTRA flag to disable translations
* on platforms/compilers without BOM support
* - 1.2: Use core options v1 interface when
* RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
* (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
* - 1.1: Support generation of core options v0 retro_core_option_value
* arrays containing options with a single value
* - 1.0: First commit
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
********************************
* Core Option Definitions
********************************
*/
/* RETRO_LANGUAGE_JAPANESE */
/* RETRO_LANGUAGE_FRENCH */
/* RETRO_LANGUAGE_SPANISH */
/* RETRO_LANGUAGE_GERMAN */
/* RETRO_LANGUAGE_ITALIAN */
/* RETRO_LANGUAGE_DUTCH */
/* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
/* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
/* RETRO_LANGUAGE_RUSSIAN */
/* RETRO_LANGUAGE_KOREAN */
/* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
/* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
/* RETRO_LANGUAGE_ESPERANTO */
/* RETRO_LANGUAGE_POLISH */
/* RETRO_LANGUAGE_VIETNAMESE */
/* RETRO_LANGUAGE_ARABIC */
/* RETRO_LANGUAGE_GREEK */
/* RETRO_LANGUAGE_TURKISH */
struct retro_core_option_definition option_defs_tr[] = {
/* These variable names and possible values constitute an ABI with ZMZ (ZSNES Libretro player).
* Changing "Show layer 1" is fine, but don't change "layer_1"/etc or the possible values ("Yes|No").
* Adding more variables and rearranging them is safe. */
{
"snes9x_region",
"Konsol Bölgesi (Core Yenilenir)",
"Sistemin hangi bölgeden olduğunu belirtir.. 'PAL' 50hz'dir, 'NTSC' ise 60hz. Yanlış bölge seçiliyse, oyunlar normalden daha hızlı veya daha yavaş çalışacaktır.",
{
{ "auto", "Otomatik" },
{ "ntsc", "NTSC" },
{ "pal", "PAL" },
{ NULL, NULL},
},
"auto"
},
{
"snes9x_aspect",
"Tercih Edilen En Boy Oranı",
"Tercih edilen içerik en boy oranını seçin. Bu, yalnızca RetroArchın en boy oranı Video ayarlarında 'Core tarafından' olarak ayarlandığında uygulanacaktır.",
{
{ "4:3", NULL },
{ "uncorrected", "Düzeltilmemiş" },
{ "auto", "Otomatik" },
{ "ntsc", "NTSC" },
{ "pal", "PAL" },
{ NULL, NULL},
},
"4:3"
},
{
"snes9x_overscan",
"ırı Taramayı Kırp",
"Ekranın üst ve alt kısmındaki ~8 piksel sınırlarını, tipik olarak standart çözünürlüklü bir televizyondakini kaldırır. 'Otomatik' ise geçerli içeriğe bağlı olarak aşırı taramayı algılamaya ve kırpmaya çalışacaktır.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ "auto", "Otomatik" },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_gfx_hires",
"Hi-Res Modunu Etkinleştir",
"Oyunların hi-res moduna (512x448) geçmesine izin verir veya tüm içeriği 256x224'te (ezilmiş piksellerle) çıkmaya zorlar.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_hires_blend",
"Hi-Res Karışımı",
"Oyun hi-res moduna geçtiğinde pikselleri karıştırır (512x448). Şeffaflık efektleri üretmek için hi-res modunu kullanan bazı oyunlar için gereklidir (Kirby's Dream Land, Jurassic Park ...).",
{
{ "disabled", NULL },
{ "merge", "Birlşetir" },
{ "blur", "Bulanıklaştır" },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_blargg",
"Blargg NTSC Filtresi",
"Çeşitli NTSC TV sinyallerini taklit etmek için bir video filtresi uygular.",
{
{ "disabled", NULL },
{ "monochrome", "Monochrome" },
{ "rf", "RF" },
{ "composite", "Composite" },
{ "s-video", "S-Video" },
{ "rgb", "RGB" },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_audio_interpolation",
"Ses Enterpolasyonu",
"Belirtilen ses filtresini uygular. 'Gaussian', orijinal donanımın bas ağırlıklı sesini üretir. 'Cubic' ve 'Sinc' daha az doğrudur ve daha fazla aralığı korur.",
{
{ "gaussian", "Gaussian" },
{ "cubic", "Cubic" },
{ "sinc", "Sinc" },
{ "none", "Hiçbiri" },
{ "linear", "Linear" },
{ NULL, NULL},
},
"gaussian"
},
{
"snes9x_up_down_allowed",
"Karşı Yönlere İzin Ver",
"Bunu etkinleştirmek aynı anda hem sola hem de sağa (veya yukarı ve aşağı) yönlere basma / hızlı değiştirme / tutma imkanı sağlar. Bu harekete dayalı hatalara neden olabilir.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"snes9x_overclock_superfx",
"SuperFX Hız Aşırtma",
"SuperFX işlemcisi frekans çarpanıdır. Kare hızını artırabilir veya zamanlama hatalarına neden olabilir. % 100'ün altındaki değerler yavaş cihazlarda oyun performansını artırabilir.",
{
{ "50%", NULL },
{ "60%", NULL },
{ "70%", NULL },
{ "80%", NULL },
{ "90%", NULL },
{ "100%", NULL },
{ "150%", NULL },
{ "200%", NULL },
{ "250%", NULL },
{ "300%", NULL },
{ "350%", NULL },
{ "400%", NULL },
{ "450%", NULL },
{ "500%", NULL },
{ NULL, NULL},
},
"100%"
},
{
"snes9x_overclock_cycles",
"Yavaşlamayı Azalt (Hack, Güvensiz)",
"SNES İşlemcisi için hız aşırtmadır. Oyunların çökmesine neden olabilir! Daha kısa yükleme süreleri için 'Hafif'i, yavaşlama gösteren oyunların çoğunda' Uyumlu 've yalnızca kesinlikle gerekliyse' Maks 'kullanın (Gradius 3, Süper R tipi ...).",
{
{ "disabled", NULL },
{ "light", "Hafif" },
{ "compatible", "Uyumlu" },
{ "max", "Maks" },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_reduce_sprite_flicker",
"Kırılmayı Azalt (Hack, Güvensiz)",
"Ekranda aynı anda çizilebilen sprite sayısını arttırır.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_randomize_memory",
"Belleği Rastgele Kıl (Güvensiz)",
"Başlatıldığında sistem RAM'ını rastgele ayarlar. 'Super Off Road' gibi bazı oyunlar, oyunu daha öngörülemeyen hale getirmek için öğe yerleştirme ve AI davranışı için rastgele sayı üreticisi olarak sistem RAM'ini kullanır.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_block_invalid_vram_access",
"Geçersiz VRAM Erişimini Engelle",
"Bazı Homebrew/ROM'lar, doğru işlem için bu seçeneğin devre dışı bırakılmasını gerektirir.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_echo_buffer_hack",
"Eko Tampon Hack (Güvenli değil, yalnızca eski addmusic için etkinleştirin)",
"Bazı Homebrew/ROM'lar, doğru işlem için bu seçeneğin devre dışı bırakılmasını gerektirir.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_show_lightgun_settings",
"Light Gun Ayarlarını Göster",
"Super Scope / Justifier / M.A.C.S. için tüfek girişi yapılandırmasını etkinleştir. NOT: Bu ayarın etkili olabilmesi için Hızlı Menünün açılması gerekir.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_lightgun_mode",
"Light Gun Modu",
"Fare kontrollü 'Light Gun' veya 'Dokunmatik Ekran' girişini kullanın.",
{
{ "Lightgun", "Light Gun" },
{ "Touchscreen", "Dokunmatik Ekran" },
{ NULL, NULL},
},
"Lightgun"
},
{
"snes9x_superscope_reverse_buttons",
"Super Scope Ters Tetik Düğmeleri",
"Süper Scope için 'Ateş' ve 'İmleç' butonlarının pozisyonlarını değiştir.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_superscope_crosshair",
"Super Scope İmkeç",
"Ekrandaki imleç işaretini değiştirin.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"2"
},
{
"snes9x_superscope_color",
"Super Scope Rengi",
"Ekrandaki imleç işaretinin rengini değiştirin.",
{
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ NULL, NULL},
},
"White"
},
{
"snes9x_justifier1_crosshair",
"Justifier 1 İmleci",
"Ekrandaki imleç işaretinin boyutunu değiştirin.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"4"
},
{
"snes9x_justifier1_color",
"Justifier 1 Rengi",
"Ekrandaki imleç işaretinin rengini değiştirin.",
{
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ NULL, NULL},
},
"Blue"
},
{
"snes9x_justifier2_crosshair",
"Justifier 2 İmleci",
"Ekrandaki imleç işaretinin boyutunu değiştirin.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"4"
},
{
"snes9x_justifier2_color",
"Justifier 2 REngi",
"Ekrandaki imleç işaretinin rengini değiştirin.",
{
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ NULL, NULL},
},
"Pink"
},
{
"snes9x_rifle_crosshair",
"M.A.C.S. Tüfek ",
"Ekrandaki imleç işaretinin rengini değiştirin..",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ "11", NULL },
{ "12", NULL },
{ "13", NULL },
{ "14", NULL },
{ "15", NULL },
{ "16", NULL },
{ NULL, NULL},
},
"2"
},
{
"snes9x_rifle_color",
"M.A.C.S. Tüfek Rengi",
"Ekrandaki imleç işaretinin rengini değiştirin.",
{
{ "White", NULL },
{ "White (blend)", NULL },
{ "Red", NULL },
{ "Red (blend)", NULL },
{ "Orange", NULL },
{ "Orange (blend)", NULL },
{ "Yellow", NULL },
{ "Yellow (blend)", NULL },
{ "Green", NULL },
{ "Green (blend)", NULL },
{ "Cyan", NULL },
{ "Cyan (blend)", NULL },
{ "Sky", NULL },
{ "Sky (blend)", NULL },
{ "Blue", NULL },
{ "Blue (blend)", NULL },
{ "Violet", NULL },
{ "Violet (blend)", NULL },
{ "Pink", NULL },
{ "Pink (blend)", NULL },
{ "Purple", NULL },
{ "Purple (blend)", NULL },
{ "Black", NULL },
{ "Black (blend)", NULL },
{ "25% Grey", NULL },
{ "25% Grey (blend)", NULL },
{ "50% Grey", NULL },
{ "50% Grey (blend)", NULL },
{ "75% Grey", NULL },
{ "75% Grey (blend)", NULL },
{ NULL, NULL},
},
"White"
},
{
"snes9x_show_advanced_av_settings",
"Gelişmiş Ses/Video Ayarlarını Göster",
"Düşük seviye video katmanı / GFX etkisi / ses kanalı parametrelerinin yapılandırılmasını etkinleştirir. NOT: Bu ayarın etkili olabilmesi için Hızlı Menünün açılması gerekir.",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"disabled"
},
{
"snes9x_layer_1",
"1. Katmanı Göster",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_2",
"2. Katmanı Göster",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_3",
"3. Katmanı Göster",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_4",
"4. Katmanı Göster",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_layer_5",
"Sprite Katmanını Göster",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_gfx_clip",
"Grafik Klibi Pencerelerini Etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_gfx_transp",
"Saydamlık Efektlerini Etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_1",
"Ses Kanalı 1'i etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_2",
"Ses Kanalı 2'yi etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_3",
"Ses Kanalı 3'ü etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_4",
"Ses Kanalı 4'ü etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_5",
"Ses Kanalı 5'i etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_6",
"Ses Kanalı 6'yı etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_7",
"Ses Kanalı 7'yi etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{
"snes9x_sndchan_8",
"Ses Kanalı 8'i etkinleştir",
NULL,
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL},
},
"enabled"
},
{ NULL, NULL, NULL, {{0}}, NULL },
};
#ifdef __cplusplus
}
#endif
#endif