Merge branch 'master' into json_playlist

This commit is contained in:
Brad Parker 2019-01-11 09:02:11 -05:00
commit f0e2f7dcf4
57 changed files with 1035 additions and 606 deletions

View File

@ -392,9 +392,9 @@ static bool audio_driver_deinit_internal(void)
return true; return true;
} }
static void audio_driver_mixer_init(unsigned out_rate) static void audio_driver_mixer_init(unsigned audio_out_rate)
{ {
audio_mixer_init(out_rate); audio_mixer_init(audio_out_rate);
} }
static bool audio_driver_init_internal(bool audio_cb_inited) static bool audio_driver_init_internal(bool audio_cb_inited)

View File

@ -589,7 +589,6 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
unsigned u1, unsigned *u2) unsigned u1, unsigned *u2)
{ {
HRESULT hr; HRESULT hr;
bool com_initialized = false;
UINT32 frame_count = 0; UINT32 frame_count = 0;
REFERENCE_TIME dev_period = 0; REFERENCE_TIME dev_period = 0;
BYTE *dest = NULL; BYTE *dest = NULL;
@ -601,11 +600,6 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
WASAPI_CHECK(w, "Out of memory", return NULL); WASAPI_CHECK(w, "Out of memory", return NULL);
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
WASAPI_HR_CHECK(hr, "CoInitializeEx", goto error);
com_initialized = true;
w->device = wasapi_init_device(dev_id); w->device = wasapi_init_device(dev_id);
if (!w->device && dev_id) if (!w->device && dev_id)
w->device = wasapi_init_device(NULL); w->device = wasapi_init_device(NULL);
@ -685,8 +679,6 @@ error:
if (w->buffer) if (w->buffer)
fifo_free(w->buffer); fifo_free(w->buffer);
free(w); free(w);
if (com_initialized)
CoUninitialize();
return NULL; return NULL;
} }
@ -898,7 +890,6 @@ static void wasapi_free(void *wh)
_IAudioClient_Stop(w->client); _IAudioClient_Stop(w->client);
WASAPI_RELEASE(w->client); WASAPI_RELEASE(w->client);
WASAPI_RELEASE(w->device); WASAPI_RELEASE(w->device);
CoUninitialize();
if (w->buffer) if (w->buffer)
fifo_free(w->buffer); fifo_free(w->buffer);
free(w); free(w);

View File

@ -201,11 +201,6 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
{ {
xaudio2_t *handle = NULL; xaudio2_t *handle = NULL;
WAVEFORMATEX wfx = {0}; WAVEFORMATEX wfx = {0};
#if !defined(_XBOX) && !defined(__WINRT__)
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
return NULL;
#endif
#if defined(__cplusplus) && !defined(CINTERFACE) #if defined(__cplusplus) && !defined(CINTERFACE)
handle = new xaudio2; handle = new xaudio2;
@ -256,9 +251,6 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
error: error:
xaudio2_free(handle); xaudio2_free(handle);
#if !defined(_XBOX) && !defined(__WINRT__)
CoUninitialize();
#endif
return NULL; return NULL;
} }
@ -408,10 +400,6 @@ static void xa_free(void *data)
if (xa->xa) if (xa->xa)
xaudio2_free(xa->xa); xaudio2_free(xa->xa);
free(xa); free(xa);
#if !defined(_XBOX) && !defined(__WINRT__)
CoUninitialize();
#endif
} }
static size_t xa_write_avail(void *data) static size_t xa_write_avail(void *data)

View File

@ -2081,7 +2081,7 @@ void cheevos_populate_menu(void *data)
cheevo_t *cheevo = cheevos_locals.core.cheevos; cheevo_t *cheevo = cheevos_locals.core.cheevos;
end = cheevo + cheevos_locals.core.count; end = cheevo + cheevos_locals.core.count;
if(settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable if(settings->bools.cheevos_enable && settings->bools.cheevos_hardcore_mode_enable
&& cheevos_loaded) && cheevos_loaded)
{ {
if (!cheevos_hardcore_paused) if (!cheevos_hardcore_paused)
@ -2612,10 +2612,10 @@ static int cheevos_iterate(coro_t *coro)
static cheevos_finder_t finders[] = static cheevos_finder_t finders[] =
{ {
{SNES_MD5, "SNES (8Mb padding)", snes_exts}, {SNES_MD5, "SNES (discards header)", snes_exts},
{GENESIS_MD5, "Genesis (6Mb padding)", genesis_exts}, {GENESIS_MD5, "Genesis (6Mb padding)", genesis_exts},
{LYNX_MD5, "Atari Lynx (only first 512 bytes)", lynx_exts}, {LYNX_MD5, "Atari Lynx (only first 512 bytes)", lynx_exts},
{NES_MD5, "NES (discards VROM)", NULL}, {NES_MD5, "NES (discards header)", NULL},
{GENERIC_MD5, "Generic (plain content)", NULL}, {GENERIC_MD5, "Generic (plain content)", NULL},
{FILENAME_MD5, "Generic (filename)", NULL} {FILENAME_MD5, "Generic (filename)", NULL}
}; };
@ -2900,30 +2900,23 @@ found:
MD5_Init(&coro->md5); MD5_Init(&coro->md5);
coro->offset = 0; /* Checks for the existence of a headered SNES file.
Unheadered files fall back to GENERIC_MD5. */
const int SNES_HEADER_LEN = 0x200;
if (coro->len < 0x2000 || coro->len % 0x2000 != SNES_HEADER_LEN)
{
coro->gameid = 0;
CORO_RET();
}
coro->offset = 512;
coro->count = 0; coro->count = 0;
CORO_GOSUB(EVAL_MD5); CORO_GOSUB(EVAL_MD5);
if (coro->count == 0)
{
MD5_Final(coro->hash, &coro->md5);
coro->gameid = 0;
CORO_RET();
}
if (coro->count < size_in_megabytes(8))
{
/*
* Inputs: CHEEVOS_VAR_MD5, CHEEVOS_VAR_OFFSET, CHEEVOS_VAR_COUNT
* Outputs: CHEEVOS_VAR_MD5
*/
coro->offset = 0;
coro->count = size_in_megabytes(8) - coro->count;
CORO_GOSUB(FILL_MD5);
}
MD5_Final(coro->hash, &coro->md5); MD5_Final(coro->hash, &coro->md5);
CORO_GOTO(GET_GAMEID); CORO_GOTO(GET_GAMEID);
/************************************************************************** /**************************************************************************
@ -2985,12 +2978,8 @@ found:
*************************************************************************/ *************************************************************************/
CORO_SUB(NES_MD5) CORO_SUB(NES_MD5)
/* Note about the references to the FCEU emulator below. There is no /* Checks for the existence of a headered NES file.
* core-specific code in this function, it's rather Retro Achievements Unheadered files fall back to GENERIC_MD5. */
* specific code that must be followed to the letter so we compute
* the correct ROM hash. Retro Achievements does indeed use some
* FCEU related method to compute the hash, since its NES emulator
* is based on it. */
if (coro->len < sizeof(coro->header)) if (coro->len < sizeof(coro->header))
{ {
@ -3010,37 +2999,11 @@ found:
CORO_RET(); CORO_RET();
} }
{
size_t romsize = 256;
/* from FCEU core - compute size using the cart mapper */
int mapper = (coro->header.rom_type >> 4) | (coro->header.rom_type2 & 0xF0);
if (coro->header.rom_size)
romsize = next_pow2(coro->header.rom_size);
/* for games not to the power of 2, so we just read enough
* PRG rom from it, but we have to keep ROM_size to the power of 2
* since PRGCartMapping wants ROM_size to be to the power of 2
* so instead if not to power of 2, we just use head.ROM_size when
* we use FCEU_read. */
coro->round = mapper != 53 && mapper != 198 && mapper != 228;
coro->bytes = coro->round ? romsize : coro->header.rom_size;
}
/* from FCEU core - check if Trainer included in ROM data */
MD5_Init(&coro->md5); MD5_Init(&coro->md5);
coro->offset = sizeof(coro->header) + (coro->header.rom_type & 4 coro->offset = sizeof(coro->header);
? sizeof(coro->header) : 0); coro->count = coro->len - coro->offset;
coro->count = 0x4000 * coro->bytes;
CORO_GOSUB(EVAL_MD5); CORO_GOSUB(EVAL_MD5);
if (coro->count < 0x4000 * coro->bytes)
{
coro->offset = 0xff;
coro->count = 0x4000 * coro->bytes - coro->count;
CORO_GOSUB(FILL_MD5);
}
MD5_Final(coro->hash, &coro->md5); MD5_Final(coro->hash, &coro->md5);
CORO_GOTO(GET_GAMEID); CORO_GOTO(GET_GAMEID);

View File

@ -2020,9 +2020,6 @@ bool command_event(enum event_command cmd, void *data)
path_clear(RARCH_PATH_CORE); path_clear(RARCH_PATH_CORE);
rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL); rarch_ctl(RARCH_CTL_SYSTEM_INFO_FREE, NULL);
#endif #endif
core_unload_game();
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
core_unload();
#ifdef HAVE_DISCORD #ifdef HAVE_DISCORD
if (discord_is_inited) if (discord_is_inited)
{ {

View File

@ -1133,6 +1133,9 @@ static struct config_array_setting *populate_settings_array(settings_t *settings
unsigned count = 0; unsigned count = 0;
struct config_array_setting *tmp = (struct config_array_setting*)calloc(1, (*size + 1) * sizeof(struct config_array_setting)); struct config_array_setting *tmp = (struct config_array_setting*)calloc(1, (*size + 1) * sizeof(struct config_array_setting));
if (!tmp)
return NULL;
/* Arrays */ /* Arrays */
SETTING_ARRAY("playlist_names", settings->arrays.playlist_names, false, NULL, true); SETTING_ARRAY("playlist_names", settings->arrays.playlist_names, false, NULL, true);
SETTING_ARRAY("playlist_cores", settings->arrays.playlist_cores, false, NULL, true); SETTING_ARRAY("playlist_cores", settings->arrays.playlist_cores, false, NULL, true);
@ -1178,6 +1181,9 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
struct config_path_setting *tmp = (struct config_path_setting*)calloc(1, (*size + 1) * sizeof(struct config_path_setting)); struct config_path_setting *tmp = (struct config_path_setting*)calloc(1, (*size + 1) * sizeof(struct config_path_setting));
if (!tmp)
return NULL;
/* Paths */ /* Paths */
#ifdef HAVE_XMB #ifdef HAVE_XMB
SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true); SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true);
@ -1568,6 +1574,9 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
unsigned count = 0; unsigned count = 0;
struct config_float_setting *tmp = (struct config_float_setting*)calloc(1, (*size + 1) * sizeof(struct config_float_setting)); struct config_float_setting *tmp = (struct config_float_setting*)calloc(1, (*size + 1) * sizeof(struct config_float_setting));
if (!tmp)
return NULL;
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false); SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false);
SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false); SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false);
SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false); SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false);
@ -1604,6 +1613,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
unsigned count = 0; unsigned count = 0;
struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting)); struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting));
if (!tmp)
return NULL;
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false); SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false);
#endif #endif
@ -1729,6 +1741,9 @@ static struct config_size_setting *populate_settings_size(settings_t *settings,
unsigned count = 0; unsigned count = 0;
struct config_size_setting *tmp = (struct config_size_setting*)calloc((*size + 1), sizeof(struct config_size_setting)); struct config_size_setting *tmp = (struct config_size_setting*)calloc((*size + 1), sizeof(struct config_size_setting));
if (!tmp)
return NULL;
SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, rewind_buffer_size, false); SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, rewind_buffer_size, false);
*size = count; *size = count;
@ -1741,6 +1756,9 @@ static struct config_int_setting *populate_settings_int(settings_t *settings, in
unsigned count = 0; unsigned count = 0;
struct config_int_setting *tmp = (struct config_int_setting*)calloc((*size + 1), sizeof(struct config_int_setting)); struct config_int_setting *tmp = (struct config_int_setting*)calloc((*size + 1), sizeof(struct config_int_setting));
if (!tmp)
return NULL;
SETTING_INT("state_slot", &settings->ints.state_slot, false, 0 /* TODO */, false); SETTING_INT("state_slot", &settings->ints.state_slot, false, 0 /* TODO */, false);
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
SETTING_INT("netplay_check_frames", &settings->ints.netplay_check_frames, true, netplay_check_frames, false); SETTING_INT("netplay_check_frames", &settings->ints.netplay_check_frames, true, netplay_check_frames, false);
@ -2720,11 +2738,11 @@ static bool config_load_file(const char *path, bool set_defaults,
while (extra_path) while (extra_path)
{ {
bool ret = config_append_file(conf, extra_path); bool result = config_append_file(conf, extra_path);
RARCH_LOG("Config: appending config \"%s\"\n", extra_path); RARCH_LOG("Config: appending config \"%s\"\n", extra_path);
if (!ret) if (!result)
RARCH_ERR("Config: failed to append config \"%s\"\n", extra_path); RARCH_ERR("Config: failed to append config \"%s\"\n", extra_path);
extra_path = strtok_r(NULL, "|", &save); extra_path = strtok_r(NULL, "|", &save);
} }
@ -4736,7 +4754,7 @@ bool config_save_overrides(int override_type)
/* Replaces currently loaded configuration file with /* Replaces currently loaded configuration file with
* another one. Will load a dummy core to flush state * another one. Will load a dummy core to flush state
* properly. */ * properly. */
bool config_replace(bool config_save_on_exit, char *path) bool config_replace(bool config_replace_save_on_exit, char *path)
{ {
content_ctx_info_t content_info = {0}; content_ctx_info_t content_info = {0};
@ -4748,7 +4766,7 @@ bool config_replace(bool config_save_on_exit, char *path)
if (string_is_equal(path, path_get(RARCH_PATH_CONFIG))) if (string_is_equal(path, path_get(RARCH_PATH_CONFIG)))
return false; return false;
if (config_save_on_exit && !path_is_empty(RARCH_PATH_CONFIG)) if (config_replace_save_on_exit && !path_is_empty(RARCH_PATH_CONFIG))
config_save_file(path_get(RARCH_PATH_CONFIG)); config_save_file(path_get(RARCH_PATH_CONFIG));
path_set(RARCH_PATH_CONFIG, path); path_set(RARCH_PATH_CONFIG, path);

View File

@ -201,7 +201,7 @@ static bool core_info_list_iterate(
if (!current_path) if (!current_path)
return false; return false;
info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); info_path_base = (char*)malloc(info_path_base_size);
info_path_base[0] = '\0'; info_path_base[0] = '\0';
@ -230,17 +230,15 @@ static bool core_info_list_iterate(
static core_info_list_t *core_info_list_new(const char *path, static core_info_list_t *core_info_list_new(const char *path,
const char *libretro_info_dir, const char *libretro_info_dir,
const char *exts, const char *exts,
bool show_hidden_files) bool dir_show_hidden_files)
{ {
size_t i; size_t i;
core_info_t *core_info = NULL; core_info_t *core_info = NULL;
core_info_list_t *core_info_list = NULL; core_info_list_t *core_info_list = NULL;
const char *path_basedir = libretro_info_dir; const char *path_basedir = libretro_info_dir;
struct string_list *contents = string_list_new(); struct string_list *contents = string_list_new();
bool ok; bool ok = dir_list_append(contents, path, exts,
false, dir_show_hidden_files, false, false);
ok = dir_list_append(contents, path, exts,
false, show_hidden_files, false, false);
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
/* UWP: browse the optional packages for additional cores */ /* UWP: browse the optional packages for additional cores */
@ -249,7 +247,7 @@ static core_info_list_t *core_info_list_new(const char *path,
for (i = 0; i < core_packages->size; i++) for (i = 0; i < core_packages->size; i++)
{ {
dir_list_append(contents, core_packages->elems[i].data, exts, dir_list_append(contents, core_packages->elems[i].data, exts,
false, show_hidden_files, false, false); false, dir_show_hidden_files, false, false);
} }
string_list_free(core_packages); string_list_free(core_packages);
#else #else
@ -574,7 +572,11 @@ static bool core_info_list_update_missing_firmware_internal(
if (!info) if (!info)
return false; return false;
path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); path = (char*)malloc(path_size);
if (!path)
return false;
path[0] = '\0'; path[0] = '\0';
for (i = 0; i < info->firmware_count; i++) for (i = 0; i < info->firmware_count; i++)
@ -676,12 +678,12 @@ void core_info_deinit_list(void)
} }
bool core_info_init_list(const char *path_info, const char *dir_cores, bool core_info_init_list(const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files) const char *exts, bool dir_show_hidden_files)
{ {
if (!(core_info_curr_list = core_info_list_new(dir_cores, if (!(core_info_curr_list = core_info_list_new(dir_cores,
!string_is_empty(path_info) ? path_info : dir_cores, !string_is_empty(path_info) ? path_info : dir_cores,
exts, exts,
show_hidden_files))) dir_show_hidden_files)))
return false; return false;
return true; return true;
} }
@ -797,13 +799,13 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
void core_info_get_name(const char *path, char *s, size_t len, void core_info_get_name(const char *path, char *s, size_t len,
const char *path_info, const char *dir_cores, const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files) const char *exts, bool dir_show_hidden_files)
{ {
size_t i; size_t i;
const char *path_basedir = !string_is_empty(path_info) ? const char *path_basedir = !string_is_empty(path_info) ?
path_info : dir_cores; path_info : dir_cores;
struct string_list *contents = dir_list_new( struct string_list *contents = dir_list_new(
dir_cores, exts, false, show_hidden_files, false, false); dir_cores, exts, false, dir_show_hidden_files, false, false);
if (!contents) if (!contents)
return; return;

4
dirs.c
View File

@ -288,6 +288,10 @@ void dir_set(enum rarch_dir_type type, const char *path)
static void check_defaults_dir_create_dir(const char *path) static void check_defaults_dir_create_dir(const char *path)
{ {
char *new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); char *new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
if (!new_path)
return;
new_path[0] = '\0'; new_path[0] = '\0';
fill_pathname_expand_special(new_path, fill_pathname_expand_special(new_path,
path, path,

View File

@ -80,7 +80,8 @@ char* discord_get_own_avatar(void)
bool discord_avatar_is_ready(void) bool discord_avatar_is_ready(void)
{ {
return discord_avatar_ready; /*To-Do: fix-me, prevent lockups in ozone due to unfinished code*/
return false;
} }
void discord_avatar_set_ready(bool ready) void discord_avatar_set_ready(bool ready)

View File

@ -46,6 +46,11 @@
#ifndef HAVE_MAIN #ifndef HAVE_MAIN
#include "../retroarch.h" #include "../retroarch.h"
#include "../verbosity.h"
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
#include <objbase.h>
#endif
#endif #endif
/** /**
@ -109,6 +114,14 @@ int rarch_main(int argc, char *argv[], void *data)
const ui_application_t *ui_application = NULL; const ui_application_t *ui_application = NULL;
#endif #endif
#if !defined(HAVE_MAIN) && defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
if (FAILED(CoInitialize(NULL)))
{
RARCH_ERR("FATAL: Failed to initialize the COM interface\n");
return 1;
}
#endif
rarch_ctl(RARCH_CTL_PREINIT, NULL); rarch_ctl(RARCH_CTL_PREINIT, NULL);
frontend_driver_init_first(args); frontend_driver_init_first(args);
rarch_ctl(RARCH_CTL_INIT, NULL); rarch_ctl(RARCH_CTL_INIT, NULL);
@ -157,6 +170,10 @@ int rarch_main(int argc, char *argv[], void *data)
ui_application->run(args); ui_application->run(args);
#endif #endif
#if !defined(HAVE_MAIN) && defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
CoUninitialize();
#endif
return 0; return 0;
} }

View File

@ -422,18 +422,23 @@ void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id)
} }
} }
memset(mon, 0, sizeof(*mon)); if (hm_to_use)
mon->cbSize = sizeof(MONITORINFOEX); {
GetMonitorInfo(*hm_to_use, (LPMONITORINFO)mon); memset(mon, 0, sizeof(*mon));
mon->cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(*hm_to_use, (LPMONITORINFO)mon);
}
} }
bool win32_load_content_from_gui(const char *szFilename) bool win32_load_content_from_gui(const char *szFilename)
{ {
/* poll list of current cores */ /* poll list of current cores */
size_t list_size; size_t list_size;
content_ctx_info_t content_info = { 0 }; content_ctx_info_t content_info = { 0 };
core_info_list_t *core_info_list = NULL; core_info_list_t *core_info_list = NULL;
const core_info_t *core_info = NULL; const core_info_t *core_info = NULL;
core_info_get_list(&core_info_list); core_info_get_list(&core_info_list);
if (!core_info_list) if (!core_info_list)
@ -463,7 +468,6 @@ bool win32_load_content_from_gui(const char *szFilename)
if (string_is_equal(path_get(RARCH_PATH_CORE), info->path)) if (string_is_equal(path_get(RARCH_PATH_CORE), info->path))
{ {
/* Our previous core supports the current rom */ /* Our previous core supports the current rom */
content_ctx_info_t content_info = { 0 };
task_push_load_content_with_current_core_from_companion_ui( task_push_load_content_with_current_core_from_companion_ui(
NULL, NULL,
&content_info, &content_info,
@ -489,13 +493,12 @@ bool win32_load_content_from_gui(const char *szFilename)
} }
else else
{ {
bool okay = false; bool okay = false;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
/* Fullscreen: Show mouse cursor for dialog */ /* Fullscreen: Show mouse cursor for dialog */
if (settings->bools.video_fullscreen) if (settings->bools.video_fullscreen)
{
video_driver_show_mouse(); video_driver_show_mouse();
}
/* Pick one core that could be compatible, ew */ /* Pick one core that could be compatible, ew */
if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE), if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE),
@ -508,9 +511,7 @@ bool win32_load_content_from_gui(const char *szFilename)
/* Fullscreen: Hide mouse cursor after dialog */ /* Fullscreen: Hide mouse cursor after dialog */
if (settings->bools.video_fullscreen) if (settings->bools.video_fullscreen)
{
video_driver_hide_mouse(); video_driver_hide_mouse();
}
return okay; return okay;
} }
return false; return false;
@ -518,21 +519,19 @@ bool win32_load_content_from_gui(const char *szFilename)
static bool win32_drag_query_file(HWND hwnd, WPARAM wparam) static bool win32_drag_query_file(HWND hwnd, WPARAM wparam)
{ {
bool okay = false;
#ifdef LEGACY_WIN32
char szFilename[1024];
szFilename[0] = '\0';
#else
char *szFilename = NULL;
wchar_t wszFilename[1024];
wszFilename[0] = L'\0';
#endif
if (DragQueryFileR((HDROP)wparam, 0xFFFFFFFF, NULL, 0)) if (DragQueryFileR((HDROP)wparam, 0xFFFFFFFF, NULL, 0))
{ {
bool okay = false;
#ifdef LEGACY_WIN32 #ifdef LEGACY_WIN32
char szFilename[1024];
szFilename[0] = '\0';
DragQueryFileR((HDROP)wparam, 0, szFilename, sizeof(szFilename)); DragQueryFileR((HDROP)wparam, 0, szFilename, sizeof(szFilename));
#else #else
wchar_t wszFilename[4096];
char *szFilename = NULL;
wszFilename[0] = L'\0';
DragQueryFileR((HDROP)wparam, 0, wszFilename, sizeof(wszFilename)); DragQueryFileR((HDROP)wparam, 0, wszFilename, sizeof(wszFilename));
szFilename = utf16_to_utf8_string_alloc(wszFilename); szFilename = utf16_to_utf8_string_alloc(wszFilename);
#endif #endif
@ -541,9 +540,11 @@ static bool win32_drag_query_file(HWND hwnd, WPARAM wparam)
if (szFilename) if (szFilename)
free(szFilename); free(szFilename);
#endif #endif
return okay;
} }
return okay; return false;
} }
#ifndef _XBOX #ifndef _XBOX
@ -625,28 +626,33 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
static void win32_set_position_from_config(void) static void win32_set_position_from_config(void)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION); int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU); int menu_bar_height = GetSystemMetrics(SM_CYMENU);
if (!settings->bools.video_window_save_positions) if (!settings->bools.video_window_save_positions)
return; return;
g_win32_pos_x = settings->uints.window_position_x; g_win32_pos_x = settings->uints.window_position_x;
g_win32_pos_y = settings->uints.window_position_y; g_win32_pos_y = settings->uints.window_position_y;
g_win32_pos_width = settings->uints.window_position_width + border_thickness * 2; g_win32_pos_width = settings->uints.window_position_width
g_win32_pos_height= settings->uints.window_position_height + border_thickness * 2 + title_bar_height; + border_thickness * 2;
g_win32_pos_height = settings->uints.window_position_height
+ border_thickness * 2 + title_bar_height;
} }
static void win32_save_position(void) static void win32_save_position(void)
{ {
RECT rect; RECT rect;
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU);
WINDOWPLACEMENT placement; WINDOWPLACEMENT placement;
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU);
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
memset(&placement, 0, sizeof(placement)); memset(&placement, 0, sizeof(placement));
placement.length = sizeof(placement);
placement.length = sizeof(placement);
GetWindowPlacement(main_window.hwnd, &placement); GetWindowPlacement(main_window.hwnd, &placement);
@ -689,10 +695,8 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
} }
break; break;
case WM_DROPFILES: case WM_DROPFILES:
{ win32_drag_query_file(hwnd, wparam);
win32_drag_query_file(hwnd, wparam); DragFinish((HDROP)wparam);
DragFinish((HDROP)wparam);
}
break; break;
case WM_CHAR: case WM_CHAR:
case WM_KEYDOWN: case WM_KEYDOWN:
@ -1146,32 +1150,40 @@ bool win32_suppress_screensaver(void *data, bool enable)
{ {
#if _WIN32_WINNT >= 0x0601 #if _WIN32_WINNT >= 0x0601
/* Windows 7, 8, 10 codepath */ /* Windows 7, 8, 10 codepath */
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context); typedef HANDLE(WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest, typedef BOOL(WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
POWER_REQUEST_TYPE RequestType); POWER_REQUEST_TYPE RequestType);
PowerCreateRequestPtr powerCreateRequest;
PowerSetRequestPtr powerSetRequest;
HMODULE kernel32 = GetModuleHandle("kernel32.dll"); HMODULE kernel32 = GetModuleHandle("kernel32.dll");
PowerCreateRequestPtr powerCreateRequest =
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
PowerSetRequestPtr powerSetRequest =
(PowerSetRequestPtr)GetProcAddress(kernel32, "PowerSetRequest");
if (powerCreateRequest && powerSetRequest) if (kernel32)
{ {
POWER_REQUEST_CONTEXT RequestContext; powerCreateRequest =
HANDLE Request; (PowerCreateRequestPtr)GetProcAddress(
kernel32, "PowerCreateRequest");
powerSetRequest =
(PowerSetRequestPtr)GetProcAddress(
kernel32, "PowerSetRequest");
RequestContext.Version = if (powerCreateRequest && powerSetRequest)
POWER_REQUEST_CONTEXT_VERSION; {
RequestContext.Flags = POWER_REQUEST_CONTEXT RequestContext;
POWER_REQUEST_CONTEXT_SIMPLE_STRING; HANDLE Request;
RequestContext.Reason.SimpleReasonString = (LPWSTR)
L"RetroArch running";
Request = RequestContext.Version =
powerCreateRequest(&RequestContext); POWER_REQUEST_CONTEXT_VERSION;
RequestContext.Flags =
POWER_REQUEST_CONTEXT_SIMPLE_STRING;
RequestContext.Reason.SimpleReasonString = (LPWSTR)
L"RetroArch running";
powerSetRequest( Request, PowerRequestDisplayRequired); Request =
return true; powerCreateRequest(&RequestContext);
powerSetRequest( Request, PowerRequestDisplayRequired);
return true;
}
} }
#endif #endif
} }
@ -1512,10 +1524,8 @@ float win32_get_refresh_rate(void *data)
&TopologyID); &TopologyID);
if (result == ERROR_SUCCESS && NumPathArrayElements >= 1) if (result == ERROR_SUCCESS && NumPathArrayElements >= 1)
{
refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator / refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator /
PathInfoArray[0].targetInfo.refreshRate.Denominator; PathInfoArray[0].targetInfo.refreshRate.Denominator;
}
free(ModeInfoArray); free(ModeInfoArray);
free(PathInfoArray); free(PathInfoArray);

View File

@ -44,6 +44,7 @@ static ITaskbarList3 *g_taskbarList = NULL;
/* MSVC really doesn't want CINTERFACE to be used with shobjidl for some reason, but since we use C++ mode, /* MSVC really doesn't want CINTERFACE to be used with shobjidl for some reason, but since we use C++ mode,
* we need a workaround... so use the names of the COBJMACROS functions instead. */ * we need a workaround... so use the names of the COBJMACROS functions instead. */
#if defined(__cplusplus) && !defined(CINTERFACE) #if defined(__cplusplus) && !defined(CINTERFACE)
#define ITaskbarList3_HrInit(x) g_taskbarList->HrInit()
#define ITaskbarList3_Release(x) g_taskbarList->Release() #define ITaskbarList3_Release(x) g_taskbarList->Release()
#define ITaskbarList3_SetProgressState(a, b, c) g_taskbarList->SetProgressState(b, c) #define ITaskbarList3_SetProgressState(a, b, c) g_taskbarList->SetProgressState(b, c)
#define ITaskbarList3_SetProgressValue(a, b, c, d) g_taskbarList->SetProgressValue(b, c, d) #define ITaskbarList3_SetProgressValue(a, b, c, d) g_taskbarList->SetProgressValue(b, c, d)
@ -82,12 +83,6 @@ static void* win32_display_server_init(void)
return NULL; return NULL;
#ifdef HAS_TASKBAR_EXT #ifdef HAS_TASKBAR_EXT
if (FAILED(CoInitialize(NULL)))
{
RARCH_ERR("COM initialization failed, ITaskbarList3 disabled\n");
return dispserv;
}
#ifdef __cplusplus #ifdef __cplusplus
/* When compiling in C++ mode, GUIDs are references instead of pointers */ /* When compiling in C++ mode, GUIDs are references instead of pointers */
hr = CoCreateInstance(CLSID_TaskbarList, NULL, hr = CoCreateInstance(CLSID_TaskbarList, NULL,
@ -98,11 +93,17 @@ static void* win32_display_server_init(void)
CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (void**)&g_taskbarList); CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (void**)&g_taskbarList);
#endif #endif
if (!SUCCEEDED(hr)) if (SUCCEEDED(hr))
{
hr = ITaskbarList3_HrInit(g_taskbarList);
if (!SUCCEEDED(hr))
RARCH_ERR("[dispserv]: HrInit of ITaskbarList3 failed.\n");
}
else
{ {
g_taskbarList = NULL; g_taskbarList = NULL;
RARCH_ERR("[dispserv]: CoCreateInstance of ITaskbarList3 failed.\n"); RARCH_ERR("[dispserv]: CoCreateInstance of ITaskbarList3 failed.\n");
CoUninitialize();
} }
#endif #endif
@ -118,11 +119,10 @@ static void win32_display_server_destroy(void *data)
win32_orig_refresh, (float)win32_orig_refresh, crt_center ); win32_orig_refresh, (float)win32_orig_refresh, crt_center );
#ifdef HAS_TASKBAR_EXT #ifdef HAS_TASKBAR_EXT
if (g_taskbarList && win32_taskbar_is_created()) if (g_taskbarList)
{ {
ITaskbarList3_Release(g_taskbarList); ITaskbarList3_Release(g_taskbarList);
g_taskbarList = NULL; g_taskbarList = NULL;
CoUninitialize();
} }
#endif #endif

View File

@ -1202,8 +1202,6 @@ static bool d3d10_gfx_frame(
if (d3d10->shader_preset) if (d3d10->shader_preset)
{ {
unsigned i;
for (i = 0; i < d3d10->shader_preset->passes; i++) for (i = 0; i < d3d10->shader_preset->passes; i++)
{ {
if (d3d10->shader_preset->pass[i].feedback) if (d3d10->shader_preset->pass[i].feedback)
@ -1233,14 +1231,17 @@ static bool d3d10_gfx_frame(
if (buffer_sem->stage_mask && buffer_sem->uniforms) if (buffer_sem->stage_mask && buffer_sem->uniforms)
{ {
void* data; void* uniform_data = NULL;
uniform_sem_t* uniform = buffer_sem->uniforms; uniform_sem_t* uniform = buffer_sem->uniforms;
D3D10MapBuffer(buffer, D3D10_MAP_WRITE_DISCARD, 0, (void**)&data); D3D10MapBuffer(buffer, D3D10_MAP_WRITE_DISCARD,
0, (void**)&uniform_data);
while (uniform->size) while (uniform->size)
{ {
if (uniform->data) if (uniform->data)
memcpy((uint8_t*)data + uniform->offset, uniform->data, uniform->size); memcpy((uint8_t*)uniform_data + uniform->offset,
uniform->data, uniform->size);
uniform++; uniform++;
} }
D3D10UnmapBuffer(buffer); D3D10UnmapBuffer(buffer);

View File

@ -1824,12 +1824,14 @@ static void d3d9_set_menu_texture_frame(void *data,
(void)height; (void)height;
(void)alpha; (void)alpha;
if (!d3d || !d3d->menu)
return;
if ( !d3d->menu->tex || if ( !d3d->menu->tex ||
d3d->menu->tex_w != width || d3d->menu->tex_w != width ||
d3d->menu->tex_h != height) d3d->menu->tex_h != height)
{ {
if (d3d->menu) d3d9_texture_free((LPDIRECT3DTEXTURE9)d3d->menu->tex);
d3d9_texture_free((LPDIRECT3DTEXTURE9)d3d->menu->tex);
d3d->menu->tex = d3d9_texture_new(d3d->dev, NULL, d3d->menu->tex = d3d9_texture_new(d3d->dev, NULL,
width, height, 1, width, height, 1,

View File

@ -90,6 +90,9 @@ static void *gdi_gfx_init(const video_info_t *video,
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
gdi_t *gdi = (gdi_t*)calloc(1, sizeof(*gdi)); gdi_t *gdi = (gdi_t*)calloc(1, sizeof(*gdi));
if (!gdi)
return NULL;
*input = NULL; *input = NULL;
*input_data = NULL; *input_data = NULL;
@ -115,7 +118,8 @@ static void *gdi_gfx_init(const video_info_t *video,
if (ctx_data) if (ctx_data)
gdi->ctx_data = ctx_data; gdi->ctx_data = ctx_data;
gdi->ctx_driver = ctx_driver; gdi->ctx_driver = ctx_driver;
video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver);
RARCH_LOG("[GDI]: Found GDI context: %s\n", ctx_driver->ident); RARCH_LOG("[GDI]: Found GDI context: %s\n", ctx_driver->ident);
@ -189,6 +193,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t *video_info) unsigned pitch, const char *msg, video_frame_info_t *video_info)
{ {
BITMAPINFO *info;
gfx_ctx_mode_t mode; gfx_ctx_mode_t mode;
const void *frame_to_copy = frame; const void *frame_to_copy = frame;
unsigned width = 0; unsigned width = 0;
@ -197,10 +202,9 @@ static bool gdi_gfx_frame(void *data, const void *frame,
bool draw = true; bool draw = true;
gdi_t *gdi = (gdi_t*)data; gdi_t *gdi = (gdi_t*)data;
HWND hwnd = win32_get_window(); HWND hwnd = win32_get_window();
BITMAPINFO *info;
/* FIXME: Force these settings off as they interfere with the rendering */ /* FIXME: Force these settings off as they interfere with the rendering */
video_info->xmb_shadows_enable = false; video_info->xmb_shadows_enable = false;
video_info->menu_shader_pipeline = 0; video_info->menu_shader_pipeline = 0;
if (!frame || !frame_width || !frame_height) if (!frame || !frame_width || !frame_height)
@ -210,13 +214,15 @@ static bool gdi_gfx_frame(void *data, const void *frame,
menu_driver_frame(video_info); menu_driver_frame(video_info);
#endif #endif
if (gdi_video_width != frame_width || gdi_video_height != frame_height || gdi_video_pitch != pitch) if ( gdi_video_width != frame_width ||
gdi_video_height != frame_height ||
gdi_video_pitch != pitch)
{ {
if (frame_width > 4 && frame_height > 4) if (frame_width > 4 && frame_height > 4)
{ {
gdi_video_width = frame_width; gdi_video_width = frame_width;
gdi_video_height = frame_height; gdi_video_height = frame_height;
gdi_video_pitch = pitch; gdi_video_pitch = pitch;
} }
} }
@ -234,7 +240,10 @@ static bool gdi_gfx_frame(void *data, const void *frame,
height = gdi_video_height; height = gdi_video_height;
pitch = gdi_video_pitch; pitch = gdi_video_pitch;
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height)) if ( frame_width == 4 &&
frame_height == 4 &&
(frame_width < width && frame_height < height)
)
draw = false; draw = false;
if (video_info->menu_is_alive) if (video_info->menu_is_alive)
@ -243,11 +252,12 @@ static bool gdi_gfx_frame(void *data, const void *frame,
if (hwnd && !gdi->winDC) if (hwnd && !gdi->winDC)
{ {
gdi->winDC = GetDC(hwnd); gdi->winDC = GetDC(hwnd);
gdi->memDC = CreateCompatibleDC(gdi->winDC); gdi->memDC = CreateCompatibleDC(gdi->winDC);
gdi->video_width = width; gdi->video_width = width;
gdi->video_height = height; gdi->video_height = height;
gdi->bmp = CreateCompatibleBitmap(gdi->winDC, gdi->video_width, gdi->video_height); gdi->bmp = CreateCompatibleBitmap(
gdi->winDC, gdi->video_width, gdi->video_height);
} }
gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp); gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp);
@ -257,28 +267,34 @@ static bool gdi_gfx_frame(void *data, const void *frame,
SelectObject(gdi->memDC, gdi->bmp_old); SelectObject(gdi->memDC, gdi->bmp_old);
DeleteObject(gdi->bmp); DeleteObject(gdi->bmp);
gdi->video_width = width; gdi->video_width = width;
gdi->video_height = height; gdi->video_height = height;
gdi->bmp = CreateCompatibleBitmap(gdi->winDC, gdi->video_width, gdi->video_height); gdi->bmp = CreateCompatibleBitmap(
gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp); gdi->winDC, gdi->video_width, gdi->video_height);
gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp);
if (gdi_lte_win98) if (gdi_lte_win98)
{ {
if (gdi_temp_buf) unsigned short *tmp = NULL;
{
free(gdi_temp_buf);
}
gdi_temp_buf = (unsigned short*)malloc(width * height * sizeof(unsigned short)); if (gdi_temp_buf)
free(gdi_temp_buf);
tmp = (unsigned short*)malloc(width * height
* sizeof(unsigned short));
if (tmp)
gdi_temp_buf = tmp;
} }
} }
video_context_driver_get_video_size(&mode); video_context_driver_get_video_size(&mode);
gdi->screen_width = mode.width; gdi->screen_width = mode.width;
gdi->screen_height = mode.height; gdi->screen_height = mode.height;
info = (BITMAPINFO*)calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD))); info = (BITMAPINFO*)
calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD)));
info->bmiHeader.biBitCount = bits; info->bmiHeader.biBitCount = bits;
info->bmiHeader.biWidth = pitch / (bits / 8); info->bmiHeader.biWidth = pitch / (bits / 8);
@ -334,10 +350,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
info->bmiHeader.biCompression = BI_RGB; info->bmiHeader.biCompression = BI_RGB;
if (draw) if (draw)
{
StretchDIBits(gdi->memDC, 0, 0, width, height, 0, 0, width, height, StretchDIBits(gdi->memDC, 0, 0, width, height, 0, 0, width, height,
frame_to_copy, info, DIB_RGB_COLORS, SRCCOPY); frame_to_copy, info, DIB_RGB_COLORS, SRCCOPY);
}
SelectObject(gdi->memDC, gdi->bmp_old); SelectObject(gdi->memDC, gdi->bmp_old);
@ -495,9 +509,19 @@ static void gdi_set_texture_frame(void *data,
gdi_menu_frame = NULL; gdi_menu_frame = NULL;
} }
if (!gdi_menu_frame || gdi_menu_width != width || gdi_menu_height != height || gdi_menu_pitch != pitch) if ( !gdi_menu_frame ||
gdi_menu_width != width ||
gdi_menu_height != height ||
gdi_menu_pitch != pitch)
{
if (pitch && height) if (pitch && height)
gdi_menu_frame = (unsigned char*)malloc(pitch * height); {
unsigned char *tmp = (unsigned char*)malloc(pitch * height);
if (tmp)
gdi_menu_frame = tmp;
}
}
if (gdi_menu_frame && frame && pitch && height) if (gdi_menu_frame && frame && pitch && height)
{ {
@ -514,7 +538,8 @@ static void gdi_set_osd_msg(void *data,
const char *msg, const char *msg,
const void *params, void *font) const void *params, void *font)
{ {
font_driver_render_msg(video_info, font, msg, (const struct font_params *)params); font_driver_render_msg(video_info, font,
msg, (const struct font_params *)params);
} }
static void gdi_get_video_output_size(void *data, static void gdi_get_video_output_size(void *data,
@ -551,21 +576,27 @@ static void gdi_set_video_mode(void *data, unsigned width, unsigned height,
static uintptr_t gdi_load_texture(void *video_data, void *data, static uintptr_t gdi_load_texture(void *video_data, void *data,
bool threaded, enum texture_filter_type filter_type) bool threaded, enum texture_filter_type filter_type)
{ {
void *tmpdata = NULL;
gdi_texture_t *texture = NULL;
struct texture_image *image = (struct texture_image*)data; struct texture_image *image = (struct texture_image*)data;
int size = image->width * image->height * sizeof(uint32_t); int size = image->width *
gdi_texture_t *texture = NULL; image->height * sizeof(uint32_t);
void *tmpdata = NULL;
if (!image || image->width > 2048 || image->height > 2048) if (!image || image->width > 2048 || image->height > 2048)
return 0; return 0;
texture = calloc(1, sizeof(*texture)); texture = calloc(1, sizeof(*texture));
texture->width = image->width;
texture->height = image->height; if (!texture)
texture->active_width = image->width; return 0;
texture->active_height = image->height;
texture->data = calloc(1, texture->width * texture->height * sizeof(uint32_t)); texture->width = image->width;
texture->type = filter_type; texture->height = image->height;
texture->active_width = image->width;
texture->active_height = image->height;
texture->data = calloc(1,
texture->width * texture->height * sizeof(uint32_t));
texture->type = filter_type;
if (!texture->data) if (!texture->data)
{ {
@ -573,7 +604,8 @@ static uintptr_t gdi_load_texture(void *video_data, void *data,
return 0; return 0;
} }
memcpy(texture->data, image->pixels, texture->width * texture->height * sizeof(uint32_t)); memcpy(texture->data, image->pixels,
texture->width * texture->height * sizeof(uint32_t));
return (uintptr_t)texture; return (uintptr_t)texture;
} }

View File

@ -33,6 +33,7 @@ typedef struct ps2_video
GSGLOBAL *gsGlobal; GSGLOBAL *gsGlobal;
GSTEXTURE *menuTexture; GSTEXTURE *menuTexture;
GSTEXTURE *coreTexture; GSTEXTURE *coreTexture;
bool clearVRAM;
bool menuVisible; bool menuVisible;
bool fullscreen; bool fullscreen;
@ -44,7 +45,8 @@ typedef struct ps2_video
} ps2_video_t; } ps2_video_t;
// PRIVATE METHODS // PRIVATE METHODS
static GSGLOBAL *init_GSGlobal(void) { static GSGLOBAL *init_GSGlobal(void)
{
GSGLOBAL *gsGlobal = gsKit_init_global(); GSGLOBAL *gsGlobal = gsKit_init_global();
gsGlobal->Mode = GS_MODE_NTSC; gsGlobal->Mode = GS_MODE_NTSC;
@ -67,22 +69,26 @@ static GSGLOBAL *init_GSGlobal(void) {
gsKit_init_screen(gsGlobal); gsKit_init_screen(gsGlobal);
gsKit_mode_switch(gsGlobal, GS_ONESHOT); gsKit_mode_switch(gsGlobal, GS_ONESHOT);
gsKit_clear(gsGlobal, GS_BLACK);
return gsGlobal; return gsGlobal;
} }
static GSTEXTURE * prepare_new_texture(void) { static GSTEXTURE * prepare_new_texture(void)
{
GSTEXTURE *texture = calloc(1, sizeof(*texture)); GSTEXTURE *texture = calloc(1, sizeof(*texture));
return texture; return texture;
} }
static void init_ps2_video(ps2_video_t *ps2) { static void init_ps2_video(ps2_video_t *ps2)
{
ps2->gsGlobal = init_GSGlobal(); ps2->gsGlobal = init_GSGlobal();
ps2->menuTexture = prepare_new_texture(); ps2->menuTexture = prepare_new_texture();
ps2->coreTexture = prepare_new_texture(); ps2->coreTexture = prepare_new_texture();
} }
static void deinitTexture(GSTEXTURE *texture) { static void deinitTexture(GSTEXTURE *texture)
{
free(texture->Mem); free(texture->Mem);
free(texture->Clut); free(texture->Clut);
texture->Mem = NULL; texture->Mem = NULL;
@ -109,38 +115,40 @@ static void color_correction16(uint16_t *buffer, uint32_t dimensions)
} }
} }
static bool texture_need_prepare(GSTEXTURE *texture, int width, int height, int PSM, int filter)
{
return !texture->Mem || texture->Width != width || texture->Height != height || texture->PSM != PSM;
}
static void transfer_texture(GSTEXTURE *texture, const void *frame, static void transfer_texture(GSTEXTURE *texture, const void *frame,
int width, int height, bool rgb32, int filter, bool color_correction) { int width, int height, bool rgb32, int filter, bool color_correction)
{
int PSM = rgb32 ? GS_PSM_CT32 : GS_PSM_CT16; int PSM = rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
size_t size = gsKit_texture_size_ee(width, height, PSM); bool changed = texture_need_prepare(texture, width, height, rgb32, PSM);
if ( !texture->Mem ||
texture->Width != width || if (color_correction) {
texture->Height != height || int pixels = width * height;
texture->PSM != PSM ) { if (rgb32) {
uint32_t *buffer = (uint32_t *)frame;
color_correction32(buffer, pixels);
} else {
uint16_t *buffer = (uint16_t *)frame;
color_correction16(buffer, pixels);
}
}
if (changed) {
texture->Width = width; texture->Width = width;
texture->Height = height; texture->Height = height;
texture->PSM = PSM; texture->PSM = PSM;
texture->Filter = filter; texture->Filter = filter;
free(texture->Mem);
texture->Mem = memalign(128, size);
}
if (color_correction) {
int pixels = width * height;
if (rgb32) {
uint32_t *buffer = (uint32_t *)frame;
color_correction32(buffer, pixels);
} else {
uint16_t *buffer = (uint16_t *)frame;
color_correction16(buffer, pixels);
} }
texture->Mem = (void *)frame;
} }
memcpy(texture->Mem, frame, size); static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture)
} {
static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) {
uint32_t size = gsKit_texture_size(texture->Width, texture->Height, texture->PSM); uint32_t size = gsKit_texture_size(texture->Width, texture->Height, texture->PSM);
texture->Vram = gsKit_vram_alloc(gsGlobal, size, GSKIT_ALLOC_USERBUFFER); texture->Vram = gsKit_vram_alloc(gsGlobal, size, GSKIT_ALLOC_USERBUFFER);
if(texture->Vram == GSKIT_ALLOC_ERROR) { if(texture->Vram == GSKIT_ALLOC_ERROR) {
@ -148,7 +156,8 @@ static void vram_alloc(GSGLOBAL *gsGlobal, GSTEXTURE *texture) {
} }
} }
static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect) { static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition, bool force_aspect)
{
float x1, y1, x2, y2; float x1, y1, x2, y2;
if (force_aspect) { if (force_aspect) {
float width_proportion = (float)gsGlobal->Width / (float)texture->Width; float width_proportion = (float)gsGlobal->Width / (float)texture->Width;
@ -182,6 +191,24 @@ static void prim_texture(GSGLOBAL *gsGlobal, GSTEXTURE *texture, int zPosition,
GS_TEXT); GS_TEXT);
} }
static void clearVRAMIfNeeded(ps2_video_t *ps2, int width, int height)
{
int PSM = ps2->rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool coreVRAMClear = texture_need_prepare(ps2->coreTexture, width, height, PSM, ps2->core_filter);
ps2->clearVRAM = ps2->clearVRAM || coreVRAMClear;
if (ps2->clearVRAM) {
gsKit_clear(ps2->gsGlobal, GS_BLACK);
gsKit_vram_clear(ps2->gsGlobal);
}
}
static void refreshScreen(ps2_video_t *ps2)
{
gsKit_sync_flip(ps2->gsGlobal);
gsKit_queue_exec(ps2->gsGlobal);
ps2->clearVRAM = false;
}
static void *ps2_gfx_init(const video_info_t *video, static void *ps2_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data) const input_driver_t **input, void **input_data)
{ {
@ -217,12 +244,6 @@ static bool ps2_gfx_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count, unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t *video_info) unsigned pitch, const char *msg, video_frame_info_t *video_info)
{ {
#ifdef DISPLAY_FPS
uint32_t diff;
static uint64_t currentTick,lastTick;
static int frames;
static float fps = 0.0;
#endif
ps2_video_t *ps2 = (ps2_video_t*)data; ps2_video_t *ps2 = (ps2_video_t*)data;
if (!width || !height) if (!width || !height)
@ -231,12 +252,14 @@ static bool ps2_gfx_frame(void *data, const void *frame,
if (frame_count%120==0) { if (frame_count%120==0) {
printf("ps2_gfx_frame %lu\n", frame_count); printf("ps2_gfx_frame %lu\n", frame_count);
} }
gsKit_clear(ps2->gsGlobal, GS_BLACK);
gsKit_vram_clear(ps2->gsGlobal); clearVRAMIfNeeded(ps2, width, height);
if (frame) { if (frame) {
transfer_texture(ps2->coreTexture, frame, width, height, ps2->rgb32, ps2->core_filter, 1); transfer_texture(ps2->coreTexture, frame, width, height, ps2->rgb32, ps2->core_filter, 1);
vram_alloc(ps2->gsGlobal, ps2->coreTexture); if(ps2->clearVRAM) {
vram_alloc(ps2->gsGlobal, ps2->coreTexture);
}
gsKit_texture_upload(ps2->gsGlobal, ps2->coreTexture); gsKit_texture_upload(ps2->gsGlobal, ps2->coreTexture);
prim_texture(ps2->gsGlobal, ps2->coreTexture, 1, ps2->force_aspect); prim_texture(ps2->gsGlobal, ps2->coreTexture, 1, ps2->force_aspect);
} }
@ -244,7 +267,9 @@ static bool ps2_gfx_frame(void *data, const void *frame,
if (ps2->menuVisible) { if (ps2->menuVisible) {
bool texture_empty = !ps2->menuTexture->Width || !ps2->menuTexture->Height; bool texture_empty = !ps2->menuTexture->Width || !ps2->menuTexture->Height;
if (!texture_empty) { if (!texture_empty) {
vram_alloc(ps2->gsGlobal, ps2->menuTexture); if(ps2->clearVRAM) {
vram_alloc(ps2->gsGlobal, ps2->menuTexture);
}
gsKit_texture_upload(ps2->gsGlobal, ps2->menuTexture); gsKit_texture_upload(ps2->gsGlobal, ps2->menuTexture);
prim_texture(ps2->gsGlobal, ps2->menuTexture, 2, ps2->fullscreen); prim_texture(ps2->gsGlobal, ps2->menuTexture, 2, ps2->fullscreen);
} }
@ -262,8 +287,7 @@ static bool ps2_gfx_frame(void *data, const void *frame,
font_driver_render_msg(video_info, NULL, msg, NULL); font_driver_render_msg(video_info, NULL, msg, NULL);
} }
gsKit_sync_flip(ps2->gsGlobal); refreshScreen(ps2);
gsKit_queue_exec(ps2->gsGlobal);
return true; return true;
} }
@ -369,8 +393,13 @@ static void ps2_set_texture_frame(void *data, const void *frame, bool rgb32,
unsigned width, unsigned height, float alpha) unsigned width, unsigned height, float alpha)
{ {
ps2_video_t *ps2 = (ps2_video_t*)data; ps2_video_t *ps2 = (ps2_video_t*)data;
transfer_texture(ps2->menuTexture, frame, width, height, rgb32, ps2->menu_filter, 0); bool color_correction = false;
int PSM = rgb32 ? GS_PSM_CT32 : GS_PSM_CT16;
bool texture_changed = texture_need_prepare(ps2->menuTexture, width, height, rgb32, PSM);
transfer_texture(ps2->menuTexture, frame, width, height, rgb32, ps2->menu_filter, color_correction);
ps2->clearVRAM = texture_changed;
} }
static void ps2_set_texture_enable(void *data, bool enable, bool fullscreen) static void ps2_set_texture_enable(void *data, bool enable, bool fullscreen)

View File

@ -1001,12 +1001,14 @@ static void vulkan_set_image(void *handle,
if (num_semaphores > 0) if (num_semaphores > 0)
{ {
vk->hw.wait_dst_stages = (VkPipelineStageFlags*) VkPipelineStageFlags *stage_flags = (VkPipelineStageFlags*)
realloc(vk->hw.wait_dst_stages, realloc(vk->hw.wait_dst_stages,
sizeof(VkPipelineStageFlags) * vk->hw.num_semaphores); sizeof(VkPipelineStageFlags) * vk->hw.num_semaphores);
/* If this fails, we're screwed anyways. */ /* If this fails, we're screwed anyways. */
retro_assert(vk->hw.wait_dst_stages); retro_assert(stage_flags);
vk->hw.wait_dst_stages = stage_flags;
for (i = 0; i < vk->hw.num_semaphores; i++) for (i = 0; i < vk->hw.num_semaphores; i++)
vk->hw.wait_dst_stages[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; vk->hw.wait_dst_stages[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
@ -1030,11 +1032,14 @@ static void vulkan_set_command_buffers(void *handle, uint32_t num_cmd,
unsigned required_capacity = num_cmd + 1; unsigned required_capacity = num_cmd + 1;
if (required_capacity > vk->hw.capacity_cmd) if (required_capacity > vk->hw.capacity_cmd)
{ {
vk->hw.cmd = (VkCommandBuffer*)realloc(vk->hw.cmd, VkCommandBuffer *hw_cmd = (VkCommandBuffer*)
realloc(vk->hw.cmd,
sizeof(VkCommandBuffer) * required_capacity); sizeof(VkCommandBuffer) * required_capacity);
/* If this fails, we're just screwed. */ /* If this fails, we're just screwed. */
retro_assert(vk->hw.cmd); retro_assert(hw_cmd);
vk->hw.cmd = hw_cmd;
vk->hw.capacity_cmd = required_capacity; vk->hw.capacity_cmd = required_capacity;
} }

View File

@ -31,7 +31,7 @@
typedef struct ps2_font_info typedef struct ps2_font_info
{ {
GSGLOBAL *gsGlobal; ps2_video_t *ps2_video;
GSFONTM *gsFontM; GSFONTM *gsFontM;
} ps2_font_info_t; } ps2_font_info_t;
@ -43,7 +43,8 @@ static u32 gsKit_fontm_clut[16] = { 0x00000000, 0x11111111, 0x22222222, 0x333333
0x80888888, 0x80999999, 0x80AAAAAA, 0x80BBBBBB, \ 0x80888888, 0x80999999, 0x80AAAAAA, 0x80BBBBBB, \
0x80CCCCCC, 0x80DDDDDD, 0x80EEEEEE, 0x80FFFFFF }; 0x80CCCCCC, 0x80DDDDDD, 0x80EEEEEE, 0x80FFFFFF };
static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM) { static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM)
{
if(gsKit_fontm_unpack(gsFontM) == 0) { if(gsKit_fontm_unpack(gsFontM) == 0) {
gsFontM->Texture->Width = FONTM_TEXTURE_WIDTH; gsFontM->Texture->Width = FONTM_TEXTURE_WIDTH;
gsFontM->Texture->Height = FONTM_TEXTURE_HEIGHT; gsFontM->Texture->Height = FONTM_TEXTURE_HEIGHT;
@ -54,7 +55,8 @@ static void ps2_prepare_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM) {
} }
} }
static void ps2_upload_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM) { static void ps2_upload_font(GSGLOBAL *gsGlobal, GSFONTM *gsFontM)
{
int pgindx; int pgindx;
int TexSize = gsKit_texture_size(gsFontM->Texture->Width, gsFontM->Texture->Height, gsFontM->Texture->PSM); int TexSize = gsKit_texture_size(gsFontM->Texture->Width, gsFontM->Texture->Height, gsFontM->Texture->PSM);
@ -80,11 +82,11 @@ static void *ps2_font_init_font(void *gl_data, const char *font_path,
float font_size, bool is_threaded) float font_size, bool is_threaded)
{ {
ps2_font_info_t *ps2 = (ps2_font_info_t*)calloc(1, sizeof(ps2_font_info_t)); ps2_font_info_t *ps2 = (ps2_font_info_t*)calloc(1, sizeof(ps2_font_info_t));
ps2_video_t *ps2_video = (ps2_video_t *)gl_data; ps2->ps2_video = (ps2_video_t *)gl_data;
ps2->gsGlobal = ps2_video->gsGlobal;
ps2->gsFontM = gsKit_init_fontm(); ps2->gsFontM = gsKit_init_fontm();
ps2_prepare_font(ps2->gsGlobal, ps2->gsFontM); ps2_prepare_font(ps2->ps2_video->gsGlobal, ps2->gsFontM);
ps2_upload_font(ps2->ps2_video->gsGlobal, ps2->gsFontM);
return ps2; return ps2;
} }
@ -105,9 +107,11 @@ static void ps2_font_render_msg(
if (ps2) { if (ps2) {
int x = FONTM_TEXTURE_LEFT_MARGIN; int x = FONTM_TEXTURE_LEFT_MARGIN;
int y = ps2->gsGlobal->Height - FONTM_TEXTURE_BOTTOM_MARGIN; int y = ps2->ps2_video->gsGlobal->Height - FONTM_TEXTURE_BOTTOM_MARGIN;
ps2_upload_font(ps2->gsGlobal, ps2->gsFontM); if (ps2->ps2_video->clearVRAM) {
gsKit_fontm_print_scaled(ps2->gsGlobal, ps2->gsFontM, x, y, FONTM_TEXTURE_ZPOSITION, ps2_upload_font(ps2->ps2_video->gsGlobal, ps2->gsFontM);
}
gsKit_fontm_print_scaled(ps2->ps2_video->gsGlobal, ps2->gsFontM, x, y, FONTM_TEXTURE_ZPOSITION,
FONTM_TEXTURE_SCALED , FONTM_TEXTURE_COLOR, msg); FONTM_TEXTURE_SCALED , FONTM_TEXTURE_COLOR, msg);
} }
} }

View File

@ -67,7 +67,7 @@ typedef struct __GLsync *GLsync;
#endif #endif
#endif #endif
typedef struct gl2_renderchain typedef struct gl2_renderchain_data
{ {
bool egl_images; bool egl_images;
bool has_fp_fbo; bool has_fp_fbo;
@ -89,7 +89,7 @@ typedef struct gl2_renderchain
#endif #endif
struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS]; struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS];
} gl2_renderchain_t; } gl2_renderchain_data_t;
#if (!defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3)) #if (!defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3))
#ifdef GL_PIXEL_PACK_BUFFER #ifdef GL_PIXEL_PACK_BUFFER
@ -260,7 +260,7 @@ static void gl_check_fbo_dimension(gl_t *gl,
struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i]; struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i];
/* Check proactively since we might suddently /* Check proactively since we might suddently
* get sizes of tex_w width or tex_h height. */ * get sizes of tex_w width or tex_h height. */
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
unsigned img_width = fbo_rect->max_img_width; unsigned img_width = fbo_rect->max_img_width;
unsigned img_height = fbo_rect->max_img_height; unsigned img_height = fbo_rect->max_img_height;
unsigned max = img_width > img_height ? img_width : img_height; unsigned max = img_width > img_height ? img_width : img_height;
@ -296,7 +296,7 @@ static void gl2_renderchain_check_fbo_dimensions(
gl_t *gl, void *chain_data) gl_t *gl, void *chain_data)
{ {
int i; int i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
/* Check if we have to recreate our FBO textures. */ /* Check if we have to recreate our FBO textures. */
for (i = 0; i < chain->fbo_pass; i++) for (i = 0; i < chain->fbo_pass; i++)
@ -326,7 +326,7 @@ static void gl2_renderchain_render(
video_shader_ctx_coords_t coords; video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params; video_shader_ctx_params_t params;
video_shader_ctx_info_t shader_info; video_shader_ctx_info_t shader_info;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
static GLfloat fbo_tex_coords[8] = {0.0f}; static GLfloat fbo_tex_coords[8] = {0.0f};
struct video_tex_info fbo_tex_info[GFX_MAX_SHADERS]; struct video_tex_info fbo_tex_info[GFX_MAX_SHADERS];
struct video_tex_info *fbo_info = NULL; struct video_tex_info *fbo_info = NULL;
@ -345,8 +345,6 @@ static void gl2_renderchain_render(
* and render all passes from FBOs, to another FBO. */ * and render all passes from FBOs, to another FBO. */
for (i = 1; i < chain->fbo_pass; i++) for (i = 1; i < chain->fbo_pass; i++)
{ {
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
const struct video_fbo_rect *rect = &gl->fbo_rect[i]; const struct video_fbo_rect *rect = &gl->fbo_rect[i];
prev_rect = &gl->fbo_rect[i - 1]; prev_rect = &gl->fbo_rect[i - 1];
@ -495,7 +493,7 @@ static void gl2_renderchain_render(
static void gl2_renderchain_deinit_fbo(gl_t *gl, static void gl2_renderchain_deinit_fbo(gl_t *gl,
void *chain_data) void *chain_data)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (gl) if (gl)
{ {
@ -527,7 +525,7 @@ static void gl2_renderchain_deinit_hw_render(
gl_t *gl, gl_t *gl,
void *chain_data) void *chain_data)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!gl) if (!gl)
return; return;
@ -551,7 +549,7 @@ static void gl2_renderchain_free(gl_t *gl, void *chain_data)
static bool gl_create_fbo_targets(gl_t *gl, void *chain_data) static bool gl_create_fbo_targets(gl_t *gl, void *chain_data)
{ {
int i; int i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
gl2_gen_fb(chain->fbo_pass, chain->fbo); gl2_gen_fb(chain->fbo_pass, chain->fbo);
@ -604,20 +602,20 @@ static void gl_create_fbo_texture(gl_t *gl,
{ {
GLenum mag_filter, wrap_enum; GLenum mag_filter, wrap_enum;
video_shader_ctx_filter_t filter_type; video_shader_ctx_filter_t filter_type;
video_shader_ctx_wrap_t wrap = {0}; video_shader_ctx_wrap_t wrap = {0};
bool fp_fbo = false; bool fp_fbo = false;
bool smooth = false; bool smooth = false;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
GLuint base_filt = settings->bools.video_smooth ? GL_LINEAR : GL_NEAREST; GLuint base_filt = settings->bools.video_smooth ? GL_LINEAR : GL_NEAREST;
GLuint base_mip_filt = settings->bools.video_smooth ? GLuint base_mip_filt = settings->bools.video_smooth ?
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST; GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
unsigned mip_level = i + 2; unsigned mip_level = i + 2;
bool mipmapped = video_shader_driver_mipmap_input(&mip_level); bool mipmapped = video_shader_driver_mipmap_input(&mip_level);
GLenum min_filter = mipmapped ? base_mip_filt : base_filt; GLenum min_filter = mipmapped ? base_mip_filt : base_filt;
filter_type.index = i + 2; filter_type.index = i + 2;
filter_type.smooth = &smooth; filter_type.smooth = &smooth;
if (video_shader_driver_filter_type(&filter_type)) if (video_shader_driver_filter_type(&filter_type))
{ {
@ -704,7 +702,8 @@ static void gl_create_fbo_texture(gl_t *gl,
} }
} }
static void gl_create_fbo_textures(gl_t *gl, gl2_renderchain_t *chain) static void gl_create_fbo_textures(gl_t *gl,
gl2_renderchain_data_t *chain)
{ {
int i; int i;
@ -736,7 +735,8 @@ static void gl2_renderchain_recompute_pass_sizes(
unsigned vp_width, unsigned vp_height) unsigned vp_width, unsigned vp_height)
{ {
int i; int i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t
*chain = (gl2_renderchain_data_t*)chain_data;
bool size_modified = false; bool size_modified = false;
GLint max_size = 0; GLint max_size = 0;
unsigned last_width = width; unsigned last_width = width;
@ -807,7 +807,7 @@ static void gl2_renderchain_start_render(
0, 1, 0, 1,
1, 1 1, 1
}; };
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
gl2_bind_fb(chain->fbo[0]); gl2_bind_fb(chain->fbo[0]);
@ -838,7 +838,7 @@ void gl2_renderchain_init(
video_shader_ctx_scale_t scaler; video_shader_ctx_scale_t scaler;
video_shader_ctx_info_t shader_info; video_shader_ctx_info_t shader_info;
struct gfx_fbo_scale scale, scale_last; struct gfx_fbo_scale scale, scale_last;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!video_shader_driver_info(&shader_info)) if (!video_shader_driver_info(&shader_info))
return; return;
@ -951,7 +951,7 @@ static bool gl2_renderchain_init_hw_render(
GLint max_renderbuffer_size = 0; GLint max_renderbuffer_size = 0;
struct retro_hw_render_callback *hwr = struct retro_hw_render_callback *hwr =
video_driver_get_hw_context(); video_driver_get_hw_context();
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
/* We can only share texture objects through contexts. /* We can only share texture objects through contexts.
* FBOs are "abstract" objects and are not shared. */ * FBOs are "abstract" objects and are not shared. */
@ -1045,7 +1045,7 @@ static void gl2_renderchain_bind_prev_texture(
void *chain_data, void *chain_data,
const struct video_tex_info *tex_info) const struct video_tex_info *tex_info)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
memmove(gl->prev_info + 1, gl->prev_info, memmove(gl->prev_info + 1, gl->prev_info,
sizeof(*tex_info) * (gl->textures - 1)); sizeof(*tex_info) * (gl->textures - 1));
@ -1170,7 +1170,7 @@ error:
void gl2_renderchain_free_internal(void *data, void *chain_data) void gl2_renderchain_free_internal(void *data, void *chain_data)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain) if (!chain)
return; return;
@ -1180,7 +1180,8 @@ void gl2_renderchain_free_internal(void *data, void *chain_data)
static void *gl2_renderchain_new(void) static void *gl2_renderchain_new(void)
{ {
gl2_renderchain_t *renderchain = (gl2_renderchain_t*)calloc(1, sizeof(*renderchain)); gl2_renderchain_data_t *renderchain =
(gl2_renderchain_data_t*)calloc(1, sizeof(*renderchain));
if (!renderchain) if (!renderchain)
return NULL; return NULL;
@ -1191,7 +1192,7 @@ static void *gl2_renderchain_new(void)
static void gl2_renderchain_bind_vao(void *data, static void gl2_renderchain_bind_vao(void *data,
void *chain_data) void *chain_data)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain) if (!chain)
return; return;
glBindVertexArray(chain->vao); glBindVertexArray(chain->vao);
@ -1206,7 +1207,7 @@ static void gl2_renderchain_unbind_vao(void *data,
static void gl2_renderchain_new_vao(void *data, static void gl2_renderchain_new_vao(void *data,
void *chain_data) void *chain_data)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain) if (!chain)
return; return;
glGenVertexArrays(1, &chain->vao); glGenVertexArrays(1, &chain->vao);
@ -1215,7 +1216,7 @@ static void gl2_renderchain_new_vao(void *data,
static void gl2_renderchain_free_vao(void *data, static void gl2_renderchain_free_vao(void *data,
void *chain_data) void *chain_data)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain) if (!chain)
return; return;
glDeleteVertexArrays(1, &chain->vao); glDeleteVertexArrays(1, &chain->vao);
@ -1244,7 +1245,7 @@ static void gl2_renderchain_copy_frame(
const void *frame, const void *frame,
unsigned width, unsigned height, unsigned pitch) unsigned width, unsigned height, unsigned pitch)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
(void)chain; (void)chain;
@ -1424,7 +1425,7 @@ static void gl2_renderchain_fence_iterate(
unsigned hard_sync_frames) unsigned hard_sync_frames)
{ {
#ifdef HAVE_GL_SYNC #ifdef HAVE_GL_SYNC
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
chain->fences[chain->fence_count++] = chain->fences[chain->fence_count++] =
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
@ -1447,7 +1448,7 @@ static void gl2_renderchain_fence_free(void *data,
{ {
#ifdef HAVE_GL_SYNC #ifdef HAVE_GL_SYNC
unsigned i; unsigned i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
for (i = 0; i < chain->fence_count; i++) for (i = 0; i < chain->fence_count; i++)
{ {
@ -1465,7 +1466,7 @@ static void gl2_renderchain_init_textures_reference(
unsigned internal_fmt, unsigned texture_fmt, unsigned internal_fmt, unsigned texture_fmt,
unsigned texture_type) unsigned texture_type)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
(void)chain; (void)chain;
@ -1493,7 +1494,7 @@ static void gl2_renderchain_resolve_extensions(gl_t *gl,
void *chain_data, const char *context_ident, void *chain_data, const char *context_ident,
const video_info_t *video) const video_info_t *video)
{ {
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data; gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (!chain) if (!chain)

View File

@ -126,7 +126,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
char scale_type_y[64]; char scale_type_y[64];
char frame_count_mod[64]; char frame_count_mod[64];
size_t path_size = PATH_MAX_LENGTH * sizeof(char); size_t path_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); char *tmp_str = (char*)malloc(path_size);
char *tmp_path = NULL; char *tmp_path = NULL;
struct gfx_fbo_scale *scale = NULL; struct gfx_fbo_scale *scale = NULL;
bool tmp_bool = false; bool tmp_bool = false;
@ -443,7 +443,11 @@ bool video_shader_resolve_current_parameters(config_file_t *conf,
if (!conf) if (!conf)
return false; return false;
parameters = (char*)malloc(4096 * sizeof(char)); parameters = (char*)malloc(param_size);
if (!parameters)
return false;
parameters[0] = '\0'; parameters[0] = '\0';
/* Read in parameters which override the defaults. */ /* Read in parameters which override the defaults. */
@ -526,7 +530,7 @@ bool video_shader_resolve_parameters(config_file_t *conf,
if (!file) if (!file)
continue; continue;
line = (char*)malloc(4096 * sizeof(char)); line = (char*)malloc(line_size);
line[0] = '\0'; line[0] = '\0';
/* even though the pass is set in the loop too, not all passes have parameters */ /* even though the pass is set in the loop too, not all passes have parameters */
@ -690,6 +694,10 @@ static bool video_shader_parse_imports(config_file_t *conf,
} }
tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
if (!tmp_str)
goto error;
tmp_str[0] = '\0'; tmp_str[0] = '\0';
if (config_get_path(conf, "import_script", tmp_str, path_size)) if (config_get_path(conf, "import_script", tmp_str, path_size))
strlcpy(shader->script_path, tmp_str, sizeof(shader->script_path)); strlcpy(shader->script_path, tmp_str, sizeof(shader->script_path));
@ -961,112 +969,122 @@ void video_shader_write_conf_cgp(config_file_t *conf,
for (i = 0; i < shader->passes; i++) for (i = 0; i < shader->passes; i++)
{ {
char key[64]; char key[64];
size_t tmp_size = PATH_MAX_LENGTH * sizeof(char); size_t tmp_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); char *tmp = (char*)malloc(tmp_size);
const struct video_shader_pass *pass = &shader->pass[i]; const struct video_shader_pass *pass = &shader->pass[i];
key[0] = '\0'; if (tmp)
snprintf(key, sizeof(key), "shader%u", i);
strlcpy(tmp, pass->source.path, tmp_size);
if (!path_is_absolute(tmp))
path_resolve_realpath(tmp, tmp_size);
config_set_string(conf, key, tmp);
free(tmp);
if (pass->filter != RARCH_FILTER_UNSPEC)
{ {
snprintf(key, sizeof(key), "filter_linear%u", i); key[0] = '\0';
config_set_bool(conf, key, pass->filter == RARCH_FILTER_LINEAR);
snprintf(key, sizeof(key), "shader%u", i);
strlcpy(tmp, pass->source.path, tmp_size);
if (!path_is_absolute(tmp))
path_resolve_realpath(tmp, tmp_size);
config_set_string(conf, key, tmp);
free(tmp);
if (pass->filter != RARCH_FILTER_UNSPEC)
{
snprintf(key, sizeof(key), "filter_linear%u", i);
config_set_bool(conf, key, pass->filter == RARCH_FILTER_LINEAR);
}
snprintf(key, sizeof(key), "wrap_mode%u", i);
config_set_string(conf, key, wrap_mode_to_str(pass->wrap));
if (pass->frame_count_mod)
{
snprintf(key, sizeof(key), "frame_count_mod%u", i);
config_set_int(conf, key, pass->frame_count_mod);
}
snprintf(key, sizeof(key), "mipmap_input%u", i);
config_set_bool(conf, key, pass->mipmap);
snprintf(key, sizeof(key), "alias%u", i);
config_set_string(conf, key, pass->alias);
shader_write_fbo(conf, &pass->fbo, i);
} }
snprintf(key, sizeof(key), "wrap_mode%u", i);
config_set_string(conf, key, wrap_mode_to_str(pass->wrap));
if (pass->frame_count_mod)
{
snprintf(key, sizeof(key), "frame_count_mod%u", i);
config_set_int(conf, key, pass->frame_count_mod);
}
snprintf(key, sizeof(key), "mipmap_input%u", i);
config_set_bool(conf, key, pass->mipmap);
snprintf(key, sizeof(key), "alias%u", i);
config_set_string(conf, key, pass->alias);
shader_write_fbo(conf, &pass->fbo, i);
} }
if (shader->num_parameters) if (shader->num_parameters)
{ {
size_t param_size = 4096 * sizeof(char); size_t param_size = 4096 * sizeof(char);
char *parameters = (char*)malloc(4096 * sizeof(char)); char *parameters = (char*)malloc(param_size);
parameters[0] = '\0'; if (parameters)
strlcpy(parameters, shader->parameters[0].id, param_size);
for (i = 1; i < shader->num_parameters; i++)
{ {
/* O(n^2), but number of parameters is very limited. */ parameters[0] = '\0';
strlcat(parameters, ";", param_size);
strlcat(parameters, shader->parameters[i].id, param_size); strlcpy(parameters, shader->parameters[0].id, param_size);
for (i = 1; i < shader->num_parameters; i++)
{
/* O(n^2), but number of parameters is very limited. */
strlcat(parameters, ";", param_size);
strlcat(parameters, shader->parameters[i].id, param_size);
}
config_set_string(conf, "parameters", parameters);
for (i = 0; i < shader->num_parameters; i++)
config_set_float(conf, shader->parameters[i].id,
shader->parameters[i].current);
free(parameters);
} }
config_set_string(conf, "parameters", parameters);
for (i = 0; i < shader->num_parameters; i++)
config_set_float(conf, shader->parameters[i].id,
shader->parameters[i].current);
free(parameters);
} }
if (shader->luts) if (shader->luts)
{ {
size_t tex_size = 4096 * sizeof(char); size_t tex_size = 4096 * sizeof(char);
char *textures = (char*)malloc(4096 * sizeof(char)); char *textures = (char*)malloc(tex_size);
textures[0] = '\0'; if (textures)
strlcpy(textures, shader->lut[0].id, tex_size);
for (i = 1; i < shader->luts; i++)
{ {
/* O(n^2), but number of textures is very limited. */ textures[0] = '\0';
strlcat(textures, ";", tex_size);
strlcat(textures, shader->lut[i].id, tex_size);
}
config_set_string(conf, "textures", textures); strlcpy(textures, shader->lut[0].id, tex_size);
free(textures); for (i = 1; i < shader->luts; i++)
for (i = 0; i < shader->luts; i++)
{
char key[64];
key[0] = '\0';
config_set_string(conf, shader->lut[i].id, shader->lut[i].path);
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{ {
snprintf(key, sizeof(key), "%s_linear", shader->lut[i].id); /* O(n^2), but number of textures is very limited. */
config_set_bool(conf, key, strlcat(textures, ";", tex_size);
shader->lut[i].filter == RARCH_FILTER_LINEAR); strlcat(textures, shader->lut[i].id, tex_size);
} }
snprintf(key, sizeof(key), config_set_string(conf, "textures", textures);
"%s_wrap_mode", shader->lut[i].id);
config_set_string(conf, key,
wrap_mode_to_str(shader->lut[i].wrap));
snprintf(key, sizeof(key), free(textures);
"%s_mipmap", shader->lut[i].id);
config_set_bool(conf, key, for (i = 0; i < shader->luts; i++)
shader->lut[i].mipmap); {
char key[64];
key[0] = '\0';
config_set_string(conf, shader->lut[i].id, shader->lut[i].path);
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{
snprintf(key, sizeof(key), "%s_linear", shader->lut[i].id);
config_set_bool(conf, key,
shader->lut[i].filter == RARCH_FILTER_LINEAR);
}
snprintf(key, sizeof(key),
"%s_wrap_mode", shader->lut[i].id);
config_set_string(conf, key,
wrap_mode_to_str(shader->lut[i].wrap));
snprintf(key, sizeof(key),
"%s_mipmap", shader->lut[i].id);
config_set_bool(conf, key,
shader->lut[i].mipmap);
}
} }
} }
@ -1078,23 +1096,26 @@ void video_shader_write_conf_cgp(config_file_t *conf,
if (shader->variables) if (shader->variables)
{ {
size_t var_tmp = 4096 * sizeof(char); size_t var_tmp = 4096 * sizeof(char);
char *variables = (char*)malloc(4096 * sizeof(char)); char *variables = (char*)malloc(var_tmp);
variables[0] = '\0'; if (variables)
strlcpy(variables, shader->variable[0].id, var_tmp);
for (i = 1; i < shader->variables; i++)
{ {
strlcat(variables, ";", var_tmp); variables[0] = '\0';
strlcat(variables, shader->variable[i].id, var_tmp);
strlcpy(variables, shader->variable[0].id, var_tmp);
for (i = 1; i < shader->variables; i++)
{
strlcat(variables, ";", var_tmp);
strlcat(variables, shader->variable[i].id, var_tmp);
}
config_set_string(conf, "imports", variables);
for (i = 0; i < shader->variables; i++)
shader_write_variable(conf, &shader->variable[i]);
free(variables);
} }
config_set_string(conf, "imports", variables);
for (i = 0; i < shader->variables; i++)
shader_write_variable(conf, &shader->variable[i]);
free(variables);
} }
} }
@ -1309,7 +1330,10 @@ void video_shader_resolve_relative(struct video_shader *shader,
{ {
unsigned i; unsigned i;
size_t tmp_path_size = 4096 * sizeof(char); size_t tmp_path_size = 4096 * sizeof(char);
char *tmp_path = (char*)malloc(4096 * sizeof(char)); char *tmp_path = (char*)malloc(tmp_path_size);
if (!tmp_path)
return;
tmp_path[0] = '\0'; tmp_path[0] = '\0';

View File

@ -430,24 +430,28 @@ static bool video_thread_handle_packet(
break; break;
case CMD_OVERLAY_LOAD: case CMD_OVERLAY_LOAD:
if (thr->overlay && thr->overlay->load)
ret = thr->overlay->load(thr->driver_data,
pkt.data.image.data,
pkt.data.image.num);
pkt.data.b = ret;
thr->alpha_mods = pkt.data.image.num;
thr->alpha_mod = (float*)realloc(thr->alpha_mod,
thr->alpha_mods * sizeof(float));
for (i = 0; i < thr->alpha_mods; i++)
{ {
/* Avoid temporary garbage data. */ float *tmp_alpha_mod = NULL;
thr->alpha_mod[i] = 1.0f;
}
video_thread_reply(thr, &pkt); if (thr->overlay && thr->overlay->load)
ret = thr->overlay->load(thr->driver_data,
pkt.data.image.data,
pkt.data.image.num);
pkt.data.b = ret;
thr->alpha_mods = pkt.data.image.num;
tmp_alpha_mod = (float*)realloc(thr->alpha_mod,
thr->alpha_mods * sizeof(float));
if (tmp_alpha_mod)
thr->alpha_mod = tmp_alpha_mod;
/* Avoid temporary garbage data. */
for (i = 0; i < thr->alpha_mods; i++)
thr->alpha_mod[i] = 1.0f;
video_thread_reply(thr, &pkt);
}
break; break;
case CMD_OVERLAY_TEX_GEOM: case CMD_OVERLAY_TEX_GEOM:
@ -845,7 +849,7 @@ static bool video_thread_set_shader(void *data,
} }
static void video_thread_set_viewport(void *data, unsigned width, static void video_thread_set_viewport(void *data, unsigned width,
unsigned height, bool force_full, bool allow_rotate) unsigned height, bool force_full, bool video_allow_rotate)
{ {
thread_video_t *thr = (thread_video_t*)data; thread_video_t *thr = (thread_video_t*)data;
if (!thr) if (!thr)
@ -855,7 +859,7 @@ static void video_thread_set_viewport(void *data, unsigned width,
if (thr->driver && thr->driver->set_viewport) if (thr->driver && thr->driver->set_viewport)
thr->driver->set_viewport(thr->driver_data, width, height, thr->driver->set_viewport(thr->driver_data, width, height,
force_full, allow_rotate); force_full, video_allow_rotate);
slock_unlock(thr->lock); slock_unlock(thr->lock);
} }
@ -1052,7 +1056,7 @@ static void video_thread_get_overlay_interface(void *data,
#endif #endif
static void thread_set_video_mode(void *data, unsigned width, unsigned height, static void thread_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen) bool video_fullscreen)
{ {
thread_video_t *thr = (thread_video_t*)data; thread_video_t *thr = (thread_video_t*)data;
thread_packet_t pkt = { CMD_POKE_SET_VIDEO_MODE }; thread_packet_t pkt = { CMD_POKE_SET_VIDEO_MODE };
@ -1062,7 +1066,7 @@ static void thread_set_video_mode(void *data, unsigned width, unsigned height,
pkt.data.new_mode.width = width; pkt.data.new_mode.width = width;
pkt.data.new_mode.height = height; pkt.data.new_mode.height = height;
pkt.data.new_mode.fullscreen = fullscreen; pkt.data.new_mode.fullscreen = video_fullscreen;
video_thread_send_and_wait_user_to_thread(thr, &pkt); video_thread_send_and_wait_user_to_thread(thr, &pkt);
} }
@ -1131,12 +1135,11 @@ static void thread_set_aspect_ratio(void *data, unsigned aspectratio_idx)
static void thread_set_texture_frame(void *data, const void *frame, static void thread_set_texture_frame(void *data, const void *frame,
bool rgb32, unsigned width, unsigned height, float alpha) bool rgb32, unsigned width, unsigned height, float alpha)
{ {
size_t required;
thread_video_t *thr = (thread_video_t*)data; thread_video_t *thr = (thread_video_t*)data;
size_t required = width * height *
(rgb32 ? sizeof(uint32_t) : sizeof(uint16_t));
slock_lock(thr->frame.lock); slock_lock(thr->frame.lock);
required = width * height *
(rgb32 ? sizeof(uint32_t) : sizeof(uint16_t));
if (required > thr->texture.frame_cap) if (required > thr->texture.frame_cap)
{ {
@ -1163,7 +1166,7 @@ static void thread_set_texture_enable(void *data, bool state, bool full_screen)
return; return;
slock_lock(thr->frame.lock); slock_lock(thr->frame.lock);
thr->texture.enable = state; thr->texture.enable = state;
thr->texture.full_screen = full_screen; thr->texture.full_screen = full_screen;
slock_unlock(thr->frame.lock); slock_unlock(thr->frame.lock);
} }
@ -1400,7 +1403,7 @@ static void video_thread_send_and_wait(thread_video_t *thr,
} }
bool video_thread_font_init(const void **font_driver, void **font_handle, bool video_thread_font_init(const void **font_driver, void **font_handle,
void *data, const char *font_path, float font_size, void *data, const char *font_path, float video_font_size,
enum font_driver_render_api api, custom_font_command_method_t func, enum font_driver_render_api api, custom_font_command_method_t func,
bool is_threaded) bool is_threaded)
{ {
@ -1416,7 +1419,7 @@ bool video_thread_font_init(const void **font_driver, void **font_handle,
pkt.data.font_init.font_handle = font_handle; pkt.data.font_init.font_handle = font_handle;
pkt.data.font_init.video_data = data; pkt.data.font_init.video_data = data;
pkt.data.font_init.font_path = font_path; pkt.data.font_init.font_path = font_path;
pkt.data.font_init.font_size = font_size; pkt.data.font_init.font_size = video_font_size;
pkt.data.font_init.is_threaded = is_threaded; pkt.data.font_init.is_threaded = is_threaded;
pkt.data.font_init.api = api; pkt.data.font_init.api = api;

View File

@ -98,8 +98,6 @@ void dinput_destroy_context(void)
IDirectInput8_Release(g_dinput_ctx); IDirectInput8_Release(g_dinput_ctx);
g_dinput_ctx = NULL; g_dinput_ctx = NULL;
CoUninitialize();
} }
bool dinput_init_context(void) bool dinput_init_context(void)
@ -107,12 +105,6 @@ bool dinput_init_context(void)
if (g_dinput_ctx) if (g_dinput_ctx)
return true; return true;
if (FAILED(CoInitialize(NULL)))
{
RARCH_ERR("[DINPUT]: Failed to initialize the COM interface\n");
return false;
}
/* Who said we shouldn't have same call signature in a COM API? <_< */ /* Who said we shouldn't have same call signature in a COM API? <_< */
#ifdef __cplusplus #ifdef __cplusplus
if (!(SUCCEEDED(DirectInput8Create( if (!(SUCCEEDED(DirectInput8Create(
@ -131,7 +123,6 @@ bool dinput_init_context(void)
error: error:
RARCH_ERR("[DINPUT]: Failed to initialize DirectInput.\n"); RARCH_ERR("[DINPUT]: Failed to initialize DirectInput.\n");
CoUninitialize();
return false; return false;
} }
@ -761,9 +752,9 @@ static void dinput_clear_pointers(struct dinput_input *di)
} }
} }
bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam) bool dinput_handle_message(void *data, UINT message, WPARAM wParam, LPARAM lParam)
{ {
struct dinput_input *di = (struct dinput_input *)dinput; struct dinput_input *di = (struct dinput_input *)data;
/* WM_POINTERDOWN : Arrives for each new touch event /* WM_POINTERDOWN : Arrives for each new touch event
* with a new ID - add to list. * with a new ID - add to list.
* WM_POINTERUP : Arrives once the pointer is no * WM_POINTERUP : Arrives once the pointer is no

View File

@ -133,14 +133,16 @@ static bool winraw_set_keyboard_input(HWND window)
static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt) static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
{ {
UINT r;
unsigned i; unsigned i;
char name[256]; char name[256];
UINT name_size = sizeof(name); UINT name_size = sizeof(name);
name[0] = '\0';
for (i = 0; i < mouse_cnt; ++i) for (i = 0; i < mouse_cnt; ++i)
{ {
r = GetRawInputDeviceInfoA(mice[i].hnd, RIDI_DEVICENAME, name, &name_size); UINT r = GetRawInputDeviceInfoA(mice[i].hnd, RIDI_DEVICENAME,
name, &name_size);
if (r == (UINT)-1 || r == 0) if (r == (UINT)-1 || r == 0)
name[0] = '\0'; name[0] = '\0';
RARCH_LOG("[WINRAW]: Mouse #%u %s.\n", i, name); RARCH_LOG("[WINRAW]: Mouse #%u %s.\n", i, name);

View File

@ -36,7 +36,7 @@
#include "../../verbosity.h" #include "../../verbosity.h"
#include "dinput_joypad.h" #include "dinput_joypad.h"
struct dinput_joypad struct dinput_joypad_data
{ {
LPDIRECTINPUTDEVICE8 joypad; LPDIRECTINPUTDEVICE8 joypad;
DIJOYSTATE2 joy_state; DIJOYSTATE2 joy_state;
@ -48,7 +48,7 @@ struct dinput_joypad
DIEFFECT rumble_props; DIEFFECT rumble_props;
}; };
static struct dinput_joypad g_pads[MAX_USERS]; static struct dinput_joypad_data g_pads[MAX_USERS];
static unsigned g_joypad_cnt; static unsigned g_joypad_cnt;
static unsigned g_last_xinput_pad_idx; static unsigned g_last_xinput_pad_idx;
@ -130,7 +130,7 @@ static void dinput_joypad_destroy(void)
dinput_destroy_context(); dinput_destroy_context();
} }
static void dinput_create_rumble_effects(struct dinput_joypad *pad) static void dinput_create_rumble_effects(struct dinput_joypad_data *pad)
{ {
DIENVELOPE dienv; DIENVELOPE dienv;
DICONSTANTFORCE dicf; DICONSTANTFORCE dicf;
@ -408,8 +408,8 @@ static bool dinput_joypad_init(void *data)
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey) static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
{ {
unsigned hat_dir = 0; unsigned hat_dir = 0;
const struct dinput_joypad *pad = &g_pads[port_num]; const struct dinput_joypad_data *pad = &g_pads[port_num];
if (!pad || !pad->joypad) if (!pad || !pad->joypad)
return false; return false;
@ -461,11 +461,11 @@ static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
static int16_t dinput_joypad_axis(unsigned port_num, uint32_t joyaxis) static int16_t dinput_joypad_axis(unsigned port_num, uint32_t joyaxis)
{ {
const struct dinput_joypad *pad = NULL; const struct dinput_joypad_data *pad = NULL;
int val = 0; int val = 0;
int axis = -1; int axis = -1;
bool is_neg = false; bool is_neg = false;
bool is_pos = false; bool is_pos = false;
if (joyaxis == AXIS_NONE) if (joyaxis == AXIS_NONE)
return 0; return 0;
@ -526,8 +526,8 @@ static void dinput_joypad_poll(void)
unsigned i; unsigned i;
for (i = 0; i < MAX_USERS; i++) for (i = 0; i < MAX_USERS; i++)
{ {
struct dinput_joypad *pad = &g_pads[i]; struct dinput_joypad_data *pad = &g_pads[i];
bool polled = g_xinput_pad_indexes[i] < 0; bool polled = g_xinput_pad_indexes[i] < 0;
if (!pad || !pad->joypad || !polled) if (!pad || !pad->joypad || !polled)
continue; continue;

View File

@ -1387,15 +1387,15 @@ bool input_driver_owns_driver(void)
bool input_driver_init_command(void) bool input_driver_init_command(void)
{ {
#ifdef HAVE_COMMAND #ifdef HAVE_COMMAND
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool stdin_cmd_enable = settings->bools.stdin_cmd_enable; bool input_stdin_cmd_enable = settings->bools.stdin_cmd_enable;
bool network_cmd_enable = settings->bools.network_cmd_enable; bool input_network_cmd_enable = settings->bools.network_cmd_enable;
bool grab_stdin = input_driver_grab_stdin(); bool grab_stdin = input_driver_grab_stdin();
if (!stdin_cmd_enable && !network_cmd_enable) if (!input_stdin_cmd_enable && !input_network_cmd_enable)
return false; return false;
if (stdin_cmd_enable && grab_stdin) if (input_stdin_cmd_enable && grab_stdin)
{ {
RARCH_WARN("stdin command interface is desired, but input driver has already claimed stdin.\n" RARCH_WARN("stdin command interface is desired, but input driver has already claimed stdin.\n"
"Cannot use this command interface.\n"); "Cannot use this command interface.\n");
@ -1405,8 +1405,8 @@ bool input_driver_init_command(void)
if (command_network_new( if (command_network_new(
input_driver_command, input_driver_command,
stdin_cmd_enable && !grab_stdin, input_stdin_cmd_enable && !grab_stdin,
network_cmd_enable, input_network_cmd_enable,
settings->uints.network_cmd_port)) settings->uints.network_cmd_port))
return true; return true;

View File

@ -491,9 +491,9 @@ static INLINE bool input_joypad_pressed(
unsigned key) unsigned key)
{ {
/* Auto-binds are per joypad, not per user. */ /* Auto-binds are per joypad, not per user. */
uint64_t joykey = (binds[key].joykey != NO_BTN) const uint64_t joykey = (binds[key].joykey != NO_BTN)
? binds[key].joykey : joypad_info.auto_binds[key].joykey; ? binds[key].joykey : joypad_info.auto_binds[key].joykey;
uint32_t joyaxis = (binds[key].joyaxis != AXIS_NONE) const uint32_t joyaxis = (binds[key].joyaxis != AXIS_NONE)
? binds[key].joyaxis : joypad_info.auto_binds[key].joyaxis; ? binds[key].joyaxis : joypad_info.auto_binds[key].joyaxis;
if ((uint16_t)joykey != NO_BTN && drv->button(joypad_info.joy_idx, (uint16_t)joykey)) if ((uint16_t)joykey != NO_BTN && drv->button(joypad_info.joy_idx, (uint16_t)joykey))

View File

@ -7,7 +7,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE, MENU_ENUM_SUBLABEL_SWITCH_GPU_PROFILE,
"Faz um Overclock ou underclock na CPU do Switch" "Faz um Overclock ou underclock na CPU do Switch"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL, MENU_ENUM_LABEL_VALUE_SWITCH_BACKLIGHT_CONTROL,
"Brilho da tela" "Brilho da tela"
) )
@ -59,7 +59,11 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MSG_PUBLIC_ADDRESS, MSG_PUBLIC_ADDRESS,
"Endereço público" "Sucesso no Mapeamento de Portas"
)
MSG_HASH(
MSG_UPNP_FAILED,
"Falha no Mapeamento de Portas"
) )
MSG_HASH( MSG_HASH(
MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN, MSG_NO_ARGUMENTS_SUPPLIED_AND_NO_MENU_BUILTIN,
@ -129,6 +133,10 @@ MSG_HASH(
MSG_NETPLAY_ENTER_PASSWORD, MSG_NETPLAY_ENTER_PASSWORD,
"Digite a senha do servidor de jogo em rede:" "Digite a senha do servidor de jogo em rede:"
) )
MSG_HASH(
MSG_DISCORD_CONNECTION_REQUEST,
"Deseja permitir a conexão do usuário:"
)
MSG_HASH( MSG_HASH(
MSG_NETPLAY_INCORRECT_PASSWORD, MSG_NETPLAY_INCORRECT_PASSWORD,
"Senha incorreta" "Senha incorreta"
@ -175,7 +183,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION, MENU_ENUM_SUBLABEL_MENU_HORIZONTAL_ANIMATION,
"Enable horizontal animation for the menu. This will have a performance hit." "Habilitar a animação horizontal para o menu. Isso terá um impacto no desempenho."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SETTINGS, MENU_ENUM_SUBLABEL_MENU_SETTINGS,
@ -677,6 +685,18 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CORE_LIST, MENU_ENUM_LABEL_VALUE_CORE_LIST,
"Carregar Núcleo" "Carregar Núcleo"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_LIST,
"Instalar ou Restaurar um Núcleo"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_ERROR,
"Falha na instalação do núcleo"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_SUCCESS,
"Instalação do núcleo bem-sucedida"
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_CORE_OPTIONS, MENU_ENUM_LABEL_VALUE_CORE_OPTIONS,
"Opções" "Opções"
@ -849,6 +869,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_FPS_SHOW, MENU_ENUM_LABEL_VALUE_FPS_SHOW,
"Mostrar Taxa de Quadros" "Mostrar Taxa de Quadros"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MEMORY_SHOW,
"Incluir Detalhes da Memória"
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE, MENU_ENUM_LABEL_VALUE_FRAME_THROTTLE_ENABLE,
"Controlar Velocidade Máxima de Execução" "Controlar Velocidade Máxima de Execução"
@ -1301,10 +1325,17 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE,
"Alternar pausa" "Alternar pausa"
) )
#ifdef HAVE_LAKKA
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY,
"Reiniciar o RetroArch"
)
#else
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY,
"Sair do RetroArch" "Sair do RetroArch"
) )
#endif
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, MENU_ENUM_LABEL_VALUE_INPUT_META_RESET,
"Reiniciar jogo" "Reiniciar jogo"
@ -1939,11 +1970,11 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_ONLINE, MENU_ENUM_LABEL_VALUE_ONLINE,
"Online" "On-line"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER, MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER,
"Atualizador Online" "Atualizador On-line"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS, MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS,
@ -2053,10 +2084,17 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS, MENU_ENUM_LABEL_VALUE_MIDI_SETTINGS,
"MIDI" "MIDI"
) )
#ifdef HAVE_LAKKA
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH,
"Reiniciar o RetroArch"
)
#else
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH, MENU_ENUM_LABEL_VALUE_QUIT_RETROARCH,
"Sair do RetroArch" "Sair do RetroArch"
) )
#endif
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG, MENU_ENUM_LABEL_VALUE_RDB_ENTRY_ANALOG,
"Analógico suportado" "Analógico suportado"
@ -2958,7 +2996,159 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_TITLE_COLOR, MENU_ENUM_LABEL_VALUE_TITLE_COLOR,
"Cor do título do menu" "Cor de título do menu personalizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_BG_DARK_COLOR,
"Cor escura do fundo do menu personalizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_BG_LIGHT_COLOR,
"Cor clara do fundo do menu personalizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_BORDER_DARK_COLOR,
"Cor escura da borda do menu personalizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_BORDER_LIGHT_COLOR,
"Cor clara da borda do menu personalizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME,
"Tema da Cor do Menu"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CUSTOM,
"Personalizada"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_RED,
"Vermelho Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_ORANGE,
"Laranja Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_YELLOW,
"Amarelo Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_GREEN,
"Verde Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_BLUE,
"Azul Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_VIOLET,
"Violeta Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_GREY,
"Cinza Clássico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_LEGACY_RED,
"Vermelho Legado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_DARK_PURPLE,
"Roxo Escuro"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_MIDNIGHT_BLUE,
"Azul Meia Noite"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_GOLDEN,
"Dourado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_ELECTRIC_BLUE,
"Azul Elétrico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_APPLE_GREEN,
"Verde Maçã"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_VOLCANIC_RED,
"Vermelho Vulcânico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_LAGOON,
"Lagoa"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_BROGRAMMER,
"Brogrammer"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_DRACULA,
"Drácula"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_FAIRYFLOSS,
"Fio De Fada"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_FLATUI,
"IU Plana"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_GRUVBOX_DARK,
"Gruvbox Escuro"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_GRUVBOX_LIGHT,
"Gruvbox Claro"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_HACKING_THE_KERNEL,
"Hackeando o Kernel"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_NORD,
"Nord"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_NOVA,
"Nova"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_ONE_DARK,
"Escuro"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_PALENIGHT,
"Noite Pálida"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_SOLARIZED_DARK,
"Escuro Solarizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_SOLARIZED_LIGHT,
"Claro Solarizado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_TANGO_DARK,
"Escuro Tango"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_TANGO_LIGHT,
"Claro Tango"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_ZENBURN,
"Fogo Zen"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_ANTI_ZENBURN,
"Anti-Fogo Zen"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_TRUE, MENU_ENUM_LABEL_VALUE_TRUE,
@ -3212,6 +3402,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, MENU_ENUM_LABEL_VALUE_VIDEO_SCALE,
"Escala em Janela" "Escala em Janela"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_THREADS,
"Threads de Gravação"
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER, MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER,
"Escala em Inteiros" "Escala em Inteiros"
@ -3230,7 +3424,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS,
"Pré-visualizar Parâmetros de Shader" "Parâmetros de Shader"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET, MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET,
@ -3522,7 +3716,8 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE,
"Habilita ou desabilita Estado de Jogo, Trapaças, Rebobinamento, Avanço Rápido, Pausa e Câmera Lenta para todos os jogos." "Habilita ou desabilita Estado de Jogo, Trapaças, Rebobinamento, Avanço Rápido, Pausa e Câmera Lenta.\n"
"Alternar essa configuração em tempo de execução reinicia o seu jogo."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE,
@ -3632,6 +3827,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_FPS_SHOW, MENU_ENUM_SUBLABEL_FPS_SHOW,
"Exibe a taxa atual de quadros por segundo na tela." "Exibe a taxa atual de quadros por segundo na tela."
) )
MSG_HASH(
MENU_ENUM_SUBLABEL_FRAMECOUNT_SHOW,
"Exibe a contagem atual de quadros na tela."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MEMORY_SHOW,
"Inclui o uso de memória atual/total na tela com FPS/Quadros."
)
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS,
"Ajusta as configurações das teclas de atalho." "Ajusta as configurações das teclas de atalho."
@ -4874,6 +5077,18 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_CORE_LIST, MENU_ENUM_SUBLABEL_CORE_LIST,
"Selecione qual núcleo utilizar." "Selecione qual núcleo utilizar."
) )
MSG_HASH(
MENU_ENUM_SUBLABEL_START_CORE,
"Iniciar o núcleo sem conteúdo."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_DOWNLOAD_CORE,
"Instalar um núcleo do atualizador on-line."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SIDELOAD_CORE_LIST,
"Instalar ou restaurar um núcleo do diretório de downloads."
)
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST, MENU_ENUM_SUBLABEL_LOAD_CONTENT_LIST,
"Selecione qual conteúdo iniciar." "Selecione qual conteúdo iniciar."
@ -4886,17 +5101,28 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION, MENU_ENUM_SUBLABEL_SYSTEM_INFORMATION,
"Exibe informações específicas do dispositivo." "Exibe informações específicas do dispositivo."
) )
#ifdef HAVE_LAKKA
MSG_HASH(
MENU_ENUM_SUBLABEL_QUIT_RETROARCH,
"Rainicia o programa."
)
#else
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_QUIT_RETROARCH, MENU_ENUM_SUBLABEL_QUIT_RETROARCH,
"Sai do programa." "Sai do programa."
) )
#endif
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH,
"Define a largura personalizada para a janela de exibição. Deixado em 0 a janela irá dimensionar o mais largo possível." "Define a largura personalizada para a janela de exibição. Deixado em 0 a janela irá dimensionar o mais largo possível."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT,
"Define a altura personalizada para a janela de exibição. Deixado em 0 a janela irá dimensionar o mais alto possível." "Definir a altura personalizada para a janela de exibição."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SAVE_POSITION,
"Lembre-se do tamanho e posição da janela, permitindo que isso tenha precedência sobre a Escala em Janela."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X,
@ -5001,11 +5227,11 @@ MSG_HASH(
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE, MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE,
"Aplicar a trapaça imediatamente após alternância." "Aplicar a trapaça imediatamente após alternância."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD, MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD,
"Aplicar trapaças automaticamente quando o jogo for carregado." "Aplicar trapaças automaticamente quando o jogo for carregado."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT, MENU_ENUM_SUBLABEL_CHEAT_REPEAT_COUNT,
"O número de vezes que a trapaça será aplicada.\n" "O número de vezes que a trapaça será aplicada.\n"
@ -5014,7 +5240,7 @@ MSG_HASH(
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS, MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_ADDRESS,
"Após cada 'Número de Iterações', o Endereço de Memória será aumentado pelo número de vezes do 'Tamanho da Pesquisa da Memória'." "Após cada 'Número de Iterações', o Endereço de Memória será aumentado pelo número de vezes do 'Tamanho da Pesquisa da Memória'."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE, MENU_ENUM_SUBLABEL_CHEAT_REPEAT_ADD_TO_VALUE,
"Após cada Número de Iterações, o Valor será aumentado por esse valor." "Após cada Número de Iterações, o Valor será aumentado por esse valor."
@ -5907,11 +6133,11 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER,
"Exibir Atualizador Online" "Exibir Atualizador On-line"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER,
"Exibir/ocultar a opção 'Atualizador Online'." "Exibir/ocultar a opção 'Atualizador On-line'."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS,
@ -6073,14 +6299,25 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_HELP, MENU_ENUM_SUBLABEL_MENU_SHOW_HELP,
"Exibir/ocultar a opção 'Ajuda'." "Exibir/ocultar a opção 'Ajuda'."
) )
#ifdef HAVE_LAKKA
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH, MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH,
"Exibir Sair do RetroArch" "Exibir Sair do RetroArch"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH, MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH,
"Exibir/ocultar a opção 'Sair do RetroArch'." "Exibir/ocultar a opção 'Reiniciar o RetroArch'."
) )
#else
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH,
"Exibir Sair do RetroArch"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH,
"Exibir/ocultar a opção 'Saiir do RetroArch'."
)
#endif
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT, MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT,
"Exibir Reiniciar" "Exibir Reiniciar"
@ -6139,27 +6376,27 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_START_RECORDING, MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_START_RECORDING,
"Show Start Recording" "Exibir Iniciar Gravação"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_RECORDING, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_RECORDING,
"Show/hide the 'Start Recording' option." "Exibir/ocultar a opção 'Iniciar Gravação'."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_START_STREAMING, MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_START_STREAMING,
"Show Start Streaming" "Exibir Iniciar Transmissão"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_STREAMING, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_START_STREAMING,
"Show/hide the 'Start Streaming' option." "Exibir/ocultar a opção 'Iniciar Transmissão'."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION,
"Show Reset Core Association" "Exibir Redefinir Associação do Núcleo"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION, MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_RESET_CORE_ASSOCIATION,
"Show/hide the 'Reset Core Association' option." "Exibir/ocultar a opção 'Redefinir Associação do Núcleo'."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS, MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS,
@ -6619,8 +6856,8 @@ MSG_HASH(
"Verificação Terminada.<br><br>\n" "Verificação Terminada.<br><br>\n"
"Para que o conteúdo seja verificado corretamente, você deve em ordem:\n" "Para que o conteúdo seja verificado corretamente, você deve em ordem:\n"
"<ul><li>ter um núcleo compatível já baixado</li>\n" "<ul><li>ter um núcleo compatível já baixado</li>\n"
"<li>ter os \"Arquivos de Informação de Núcleo\" atualizados via Atualizador Online</li>\n" "<li>ter os \"Arquivos de Informação de Núcleo\" atualizados via Atualizador On-line</li>\n"
"<li>ter a \"Base de Dados\" atualizada via Atualizador Online</li>\n" "<li>ter a \"Base de Dados\" atualizada via Atualizador On-line</li>\n"
"<li>reiniciar o RetroArch caso alguma das situações acima tenha sido feita</li></ul>\n" "<li>reiniciar o RetroArch caso alguma das situações acima tenha sido feita</li></ul>\n"
"E finalmente, o conteúdo deve corresponder as bases de dados existentes <a href=\"https://docs.libretro.com/guides/roms-playlists-thumbnails/#sources\">aqui</a>. Se ainda não estiver funcionando, considere <a href=\"https://www.github.com/libretro/RetroArch/issues\">enviar um relatório de erro</a>." "E finalmente, o conteúdo deve corresponder as bases de dados existentes <a href=\"https://docs.libretro.com/guides/roms-playlists-thumbnails/#sources\">aqui</a>. Se ainda não estiver funcionando, considere <a href=\"https://www.github.com/libretro/RetroArch/issues\">enviar um relatório de erro</a>."
) )
@ -6695,7 +6932,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST, MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST,
"Sugerir Primeiro Núcleo Carregado" "Sugerir Primeiro Núcleo Carregado:"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_ZOOM, MENU_ENUM_LABEL_VALUE_QT_ZOOM,
@ -6820,7 +7057,7 @@ MSG_HASH(
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_DISCORD_ALLOW, MENU_ENUM_SUBLABEL_DISCORD_ALLOW,
"Habilitar ou desabilitar o suporte ao Discord.\n" "Habilitar ou desabilitar o suporte ao Discord.\n"
"Não funcionará com a versão do navegador, apenas o cliente nativo de desktop." "OBS: Não funcionará com a versão do navegador, apenas o cliente nativo de desktop."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MIDI_INPUT, MENU_ENUM_LABEL_VALUE_MIDI_INPUT,
@ -6953,15 +7190,15 @@ MSG_HASH(
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT, MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_COUNT,
"Número de Iterações" "Número de Iterações"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE, MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_VALUE,
"Aumento de Valor em Cada Iteração" "Aumento de Valor em Cada Iteração"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS, MENU_ENUM_LABEL_VALUE_CHEAT_REPEAT_ADD_TO_ADDRESS,
"Aumento de Endereço em Cada Iteração" "Aumento de Endereço em Cada Iteração"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER, MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_AFTER,
"Adicionar Nova Trapaça Depois Desta" "Adicionar Nova Trapaça Depois Desta"
@ -7448,7 +7685,7 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM, MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM,
"Tem certeza de que deseja excluir o item? \"%1\"?" "Tem certeza de que deseja excluir o item \"%1\"?"
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS, MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
@ -7574,6 +7811,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST, MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_STARTUP_PLAYLIST,
"Iniciar na lista de reprodução:" "Iniciar na lista de reprodução:"
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_TYPE,
"Tipo de visualização de miniatura de ícones:"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THUMBNAIL_CACHE_LIMIT,
"Limite de cache de miniaturas:"
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS, MENU_ENUM_LABEL_VALUE_QT_DOWNLOAD_ALL_THUMBNAILS,
"Baixar Todas as Miniaturas" "Baixar Todas as Miniaturas"
@ -7612,7 +7857,8 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC, MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC,
"O V-Sync é ativado até o desempenho ficar abaixo da taxa de atualização desejada. Pode minimizar as travadas quando o desempenho cai abaixo do tempo real e pode ser mais eficiente em termos energéticos." "O V-Sync é ativado até o desempenho ficar abaixo da taxa de atualização desejada.\n"
"Pode minimizar as travadas quando o desempenho cai abaixo do tempo real e pode ser mais eficiente em termos energéticos."
) )
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS, MENU_ENUM_LABEL_VALUE_CRT_SWITCHRES_SETTINGS,
@ -7808,7 +8054,13 @@ MSG_HASH(
) )
MSG_HASH( MSG_HASH(
MSG_MISSING_ASSETS, MSG_MISSING_ASSETS,
"Aviso: Recursos ausentes, use o Atualizador Online se disponível" "Aviso: Recursos ausentes, use o Atualizador On-line se disponível"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION,
"Lembrar Tamanho e Posição da Janela"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_HOLD_START,
"Segurar Start (2 segundos)"
) )
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION,
"Remember Window Position and Size")

View File

@ -31,10 +31,11 @@
#endif #endif
#endif #endif
#ifdef _WIN32
#undef fopen
void *fopen_utf8(const char * filename, const char * mode) void *fopen_utf8(const char * filename, const char * mode)
{ {
#if defined(_WIN32)
#undef fopen
#if defined(_XBOX) #if defined(_XBOX)
return fopen(filename, mode); return fopen(filename, mode);
#elif defined(LEGACY_WIN32) #elif defined(LEGACY_WIN32)
@ -55,7 +56,5 @@ void *fopen_utf8(const char * filename, const char * mode)
free(mode_w); free(mode_w);
return ret; return ret;
#endif #endif
#else
return fopen(filename, mode);
#endif
} }
#endif

View File

@ -219,7 +219,7 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size)
#endif #endif
case IS_CHARACTER_SPECIAL: case IS_CHARACTER_SPECIAL:
#if defined(VITA) || defined(PSP) || defined(PS2) || defined(__CELLOS_LV2__) || defined(_WIN32) #if defined(VITA) || defined(PSP) || defined(PS2) || defined(__CELLOS_LV2__) || defined(_WIN32)
break; return false;
#else #else
return S_ISCHR(buf.st_mode); return S_ISCHR(buf.st_mode);
#endif #endif

View File

@ -194,6 +194,7 @@ static bool nbio_stdio_iterate(void *data)
static void nbio_stdio_resize(void *data, size_t len) static void nbio_stdio_resize(void *data, size_t len)
{ {
void *new_data = NULL;
struct nbio_stdio_t *handle = (struct nbio_stdio_t*)data; struct nbio_stdio_t *handle = (struct nbio_stdio_t*)data;
if (!handle) if (!handle)
return; return;
@ -209,10 +210,14 @@ static void nbio_stdio_resize(void *data, size_t len)
abort(); abort();
} }
handle->len = len; handle->len = len;
handle->data = realloc(handle->data, handle->len); handle->progress = len;
handle->op = -1; handle->op = -1;
handle->progress = handle->len;
new_data = realloc(handle->data, handle->len);
if (new_data)
handle->data = new_data;
} }
static void *nbio_stdio_get_ptr(void *data, size_t* len) static void *nbio_stdio_get_ptr(void *data, size_t* len)

View File

@ -23,12 +23,12 @@
#ifndef __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H #ifndef __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H
#define __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H #define __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H
/* Defined to error rather than fopen_utf8, to make it #ifdef _WIN32
* clear to everyone reading the code that not worrying /* Defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */
* about UTF16 is fine. */
/* TODO: enable */ /* TODO: enable */
/* #define fopen (use fopen_utf8 instead) */ /* #define fopen (use fopen_utf8 instead) */
void *fopen_utf8(const char * filename, const char * mode); void *fopen_utf8(const char * filename, const char * mode);
#else
#define fopen_utf8 fopen
#endif
#endif #endif

View File

@ -82,6 +82,10 @@ char *string_replace_substring(const char *in,
outlen = strlen(in) - pattern_len*numhits + replacement_len*numhits; outlen = strlen(in) - pattern_len*numhits + replacement_len*numhits;
out = (char *)malloc(outlen+1); out = (char *)malloc(outlen+1);
if (!out)
return NULL;
outat = out; outat = out;
inat = in; inat = in;
inprev = in; inprev = in;
@ -105,18 +109,17 @@ char *string_trim_whitespace_left(char *const s)
{ {
if(s && *s) if(s && *s)
{ {
size_t len = strlen(s); size_t len = strlen(s);
char *cur = s; char *current = s;
while(*cur && isspace((unsigned char)*cur)) while(*current && isspace((unsigned char)*current))
{ {
++cur; ++current;
--len; --len;
} }
if(s != cur) if(s != current)
memmove(s, cur, len + 1); memmove(s, current, len + 1);
} }
return s; return s;
@ -127,16 +130,16 @@ char *string_trim_whitespace_right(char *const s)
{ {
if(s && *s) if(s && *s)
{ {
size_t len = strlen(s); size_t len = strlen(s);
char *cur = s + len - 1; char *current = s + len - 1;
while(cur != s && isspace((unsigned char)*cur)) while(current != s && isspace((unsigned char)*current))
{ {
--cur; --current;
--len; --len;
} }
cur[isspace((unsigned char)*cur) ? 0 : 1] = '\0'; current[isspace((unsigned char)*current) ? 0 : 1] = '\0';
} }
return s; return s;

View File

@ -460,7 +460,7 @@ error:
bool cheat_manager_realloc(unsigned new_size, unsigned default_handler) bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
{ {
unsigned i; unsigned i;
unsigned orig_size; unsigned orig_size = 0;
if (!cheat_manager_state.cheats) if (!cheat_manager_state.cheats)
{ {
@ -470,6 +470,7 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
} }
else else
{ {
struct item_cheat *val = NULL;
orig_size = cheat_manager_state.size; orig_size = cheat_manager_state.size;
/* if size is decreasing, free the items that will be lost */ /* if size is decreasing, free the items that will be lost */
@ -481,8 +482,12 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
free(cheat_manager_state.cheats[i].desc); free(cheat_manager_state.cheats[i].desc);
} }
cheat_manager_state.cheats = (struct item_cheat*) val = (struct item_cheat*)
realloc(cheat_manager_state.cheats, new_size * sizeof(struct item_cheat)); realloc(cheat_manager_state.cheats,
new_size * sizeof(struct item_cheat));
if (val)
cheat_manager_state.cheats = val;
} }
if (!cheat_manager_state.cheats) if (!cheat_manager_state.cheats)
@ -750,7 +755,15 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound)
if (!cheat_manager_state.memory_size_list) if (!cheat_manager_state.memory_size_list)
cheat_manager_state.memory_size_list = (unsigned*)calloc(1, sizeof(unsigned)); cheat_manager_state.memory_size_list = (unsigned*)calloc(1, sizeof(unsigned));
else else
cheat_manager_state.memory_size_list = (unsigned*)realloc(cheat_manager_state.memory_size_list, sizeof(unsigned) * cheat_manager_state.num_memory_buffers); {
unsigned *val = (unsigned*)realloc(
cheat_manager_state.memory_size_list,
sizeof(unsigned) *
cheat_manager_state.num_memory_buffers);
if (val)
cheat_manager_state.memory_size_list = val;
}
cheat_manager_state.memory_buf_list[cheat_manager_state.num_memory_buffers-1] = (uint8_t*)system->mmaps.descriptors[i].core.ptr; cheat_manager_state.memory_buf_list[cheat_manager_state.num_memory_buffers-1] = (uint8_t*)system->mmaps.descriptors[i].core.ptr;
cheat_manager_state.memory_size_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.len; cheat_manager_state.memory_size_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.len;

View File

@ -4174,12 +4174,13 @@ void netplay_refresh_rooms_menu(file_list_t *list)
static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err) static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err)
{ {
char *new_data = NULL;
const char *path = NULL; const char *path = NULL;
const char *label = NULL; const char *label = NULL;
unsigned menu_type = 0; unsigned menu_type = 0;
enum msg_hash_enums enum_idx = MSG_UNKNOWN; enum msg_hash_enums enum_idx = MSG_UNKNOWN;
http_transfer_data_t *data = (http_transfer_data_t*)task_data; http_transfer_data_t *data = (http_transfer_data_t*)task_data;
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL); menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
@ -4191,7 +4192,12 @@ static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const cha
if (!data || err) if (!data || err)
goto finish; goto finish;
data->data = (char*)realloc(data->data, data->len + 1); new_data = (char*)realloc(data->data, data->len + 1);
if (!new_data)
goto finish;
data->data = new_data;
data->data[data->len] = '\0'; data->data[data->len] = '\0';
if (!strstr(data->data, file_path_str(FILE_PATH_NETPLAY_ROOM_LIST_URL))) if (!strstr(data->data, file_path_str(FILE_PATH_NETPLAY_ROOM_LIST_URL)))

View File

@ -2090,7 +2090,6 @@ static int materialui_list_push(void *data, void *userdata,
menu_displaylist_setting(&entry); menu_displaylist_setting(&entry);
#else #else
{ {
settings_t *settings = config_get_ptr();
if (settings->bools.menu_show_online_updater) if (settings->bools.menu_show_online_updater)
{ {
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER; entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;

View File

@ -23,7 +23,7 @@
#include "ozone_texture.h" #include "ozone_texture.h"
#include "ozone_sidebar.h" #include "ozone_sidebar.h"
#ifdef HAVE_DISCORD #if 0
#include "discord/discord.h" #include "discord/discord.h"
#endif #endif
@ -352,8 +352,8 @@ static void ozone_context_reset(void *data, bool is_threaded)
for (i = 0; i < OZONE_TEXTURE_LAST; i++) for (i = 0; i < OZONE_TEXTURE_LAST; i++)
{ {
char filename[PATH_MAX_LENGTH]; char filename[PATH_MAX_LENGTH];
#ifdef HAVE_DISCORD #if 0
if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR) if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR && discord_avatar_is_ready())
strlcpy(filename, discord_get_own_avatar(), sizeof(filename)); strlcpy(filename, discord_get_own_avatar(), sizeof(filename));
else else
#endif #endif
@ -361,7 +361,7 @@ static void ozone_context_reset(void *data, bool is_threaded)
strlcat(filename, ".png", sizeof(filename)); strlcat(filename, ".png", sizeof(filename));
#ifdef HAVE_DISCORD #if 0
if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR && discord_avatar_is_ready()) if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR && discord_avatar_is_ready())
{ {
char buf[PATH_MAX_LENGTH]; char buf[PATH_MAX_LENGTH];
@ -379,7 +379,7 @@ static void ozone_context_reset(void *data, bool is_threaded)
ozone->has_all_assets = false; ozone->has_all_assets = false;
RARCH_WARN("[OZONE] Asset missing: %s%s%s\n", ozone->png_path, path_default_slash(), filename); RARCH_WARN("[OZONE] Asset missing: %s%s%s\n", ozone->png_path, path_default_slash(), filename);
} }
#ifdef HAVE_DISCORD #if 0
} }
#endif #endif
} }
@ -956,7 +956,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
/* Icon */ /* Icon */
menu_display_blend_begin(video_info); menu_display_blend_begin(video_info);
#ifdef HAVE_DISCORD #if 0
if (discord_avatar_is_ready()) if (discord_avatar_is_ready())
ozone_draw_icon(video_info, 60, 60, ozone->textures[OZONE_TEXTURE_DISCORD_OWN_AVATAR], 47, 14, video_info->width, video_info->height, 0, 1, ozone->theme->entries_icon); ozone_draw_icon(video_info, 60, 60, ozone->textures[OZONE_TEXTURE_DISCORD_OWN_AVATAR], 47, 14, video_info->width, video_info->height, 0, 1, ozone->theme->entries_icon);
else else
@ -1148,7 +1148,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
bool draw_osk = menu_input_dialog_get_display_kb(); bool draw_osk = menu_input_dialog_get_display_kb();
static bool draw_osk_old = false; static bool draw_osk_old = false;
#ifdef HAVE_DISCORD #if 0
static bool reset = false; static bool reset = false;
if (discord_avatar_is_ready() && !reset) if (discord_avatar_is_ready() && !reset)

View File

@ -28,7 +28,7 @@
enum OZONE_TEXTURE { enum OZONE_TEXTURE {
OZONE_TEXTURE_RETROARCH = 0, OZONE_TEXTURE_RETROARCH = 0,
OZONE_TEXTURE_CURSOR_BORDER, OZONE_TEXTURE_CURSOR_BORDER,
#ifdef HAVE_DISCORD #if 0
OZONE_TEXTURE_DISCORD_OWN_AVATAR, OZONE_TEXTURE_DISCORD_OWN_AVATAR,
#endif #endif
OZONE_TEXTURE_LAST OZONE_TEXTURE_LAST

View File

@ -451,11 +451,41 @@ static uint16_t argb32_to_abgr1555(uint32_t col)
static uint16_t argb32_to_rgb5a3(uint32_t col) static uint16_t argb32_to_rgb5a3(uint32_t col)
{ {
unsigned a = ((col >> 24) & 0xff) >> 5; /* Extract colour components */
unsigned r = ((col >> 16) & 0xff) >> 4; unsigned a = (col >> 24) & 0xff;
unsigned g = ((col >> 8) & 0xff) >> 4; unsigned r = (col >> 16) & 0xff;
unsigned b = ((col & 0xff) ) >> 4; unsigned g = (col >> 8) & 0xff;
return (a << 12) | (r << 8) | (g << 4) | b; unsigned b = col & 0xff;
/* Gekko platforms only have a 3 bit alpha channel, which
* is one bit less than all 'standard' target platforms.
* As a result, Gekko colours are effectively ~6-7% less
* transparent than expected, which causes backgrounds and
* borders to appear too bright. We therefore have to darken
* each RGB component according to the difference between Gekko
* alpha and normal 4 bit alpha values... */
unsigned a4 = a >> 4;
unsigned a3 = a >> 5;
float a_factor = 1.0;
if (a3 > 0)
{
/* Avoid divide by zero errors... */
a_factor = ((float)a4 * (1.0 / 15.0)) / ((float)a3 * (1.0 / 7.0));
}
r = (unsigned)(((float)r * a_factor) + 0.5);
g = (unsigned)(((float)g * a_factor) + 0.5);
b = (unsigned)(((float)b * a_factor) + 0.5);
/* a_factor can actually be greater than 1. This will never happen
* with the current preset theme colour values, but users can set
* any custom values they like, so we have to play it safe... */
r = (r <= 0xff) ? r : 0xff;
g = (g <= 0xff) ? g : 0xff;
b = (b <= 0xff) ? b : 0xff;
/* Convert RGB from 8 bit to 4 bit */
r = r >> 4;
g = g >> 4;
b = b >> 4;
/* Return final value */
return (a3 << 12) | (r << 8) | (g << 4) | b;
} }
#define argb32_to_pixel_platform_format(color) argb32_to_rgb5a3(color) #define argb32_to_pixel_platform_format(color) argb32_to_rgb5a3(color)
@ -1176,7 +1206,6 @@ static void rgui_render(void *data, bool is_idle)
if (rgui->mouse_show) if (rgui->mouse_show)
{ {
settings_t *settings = config_get_ptr();
bool cursor_visible = settings->bools.video_fullscreen || bool cursor_visible = settings->bools.video_fullscreen ||
!video_driver_has_windowed(); !video_driver_has_windowed();

View File

@ -495,9 +495,12 @@ static xmb_node_t *xmb_alloc_node(void)
{ {
xmb_node_t *node = (xmb_node_t*)malloc(sizeof(*node)); xmb_node_t *node = (xmb_node_t*)malloc(sizeof(*node));
node->alpha = node->label_alpha = 0; if (!node)
node->zoom = node->x = node->y = 0; return NULL;
node->icon = node->content_icon = 0;
node->alpha = node->label_alpha = 0;
node->zoom = node->x = node->y = 0;
node->icon = node->content_icon = 0;
node->fullpath = NULL; node->fullpath = NULL;
return node; return node;
@ -546,6 +549,9 @@ static xmb_node_t *xmb_copy_node(const xmb_node_t *old_node)
{ {
xmb_node_t *new_node = (xmb_node_t*)malloc(sizeof(*new_node)); xmb_node_t *new_node = (xmb_node_t*)malloc(sizeof(*new_node));
if (!new_node)
return NULL;
*new_node = *old_node; *new_node = *old_node;
new_node->fullpath = old_node->fullpath ? strdup(old_node->fullpath) : NULL; new_node->fullpath = old_node->fullpath ? strdup(old_node->fullpath) : NULL;

View File

@ -262,12 +262,12 @@ static bool menu_display_d3d10_font_init_first(
void** font_handle, void** font_handle,
void* video_data, void* video_data,
const char* font_path, const char* font_path,
float font_size, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t** handle = (font_data_t**)font_handle; font_data_t** handle = (font_data_t**)font_handle;
font_data_t* new_handle = font_driver_init_first( font_data_t* new_handle = font_driver_init_first(
video_data, font_path, font_size, true, video_data, font_path, menu_font_size, true,
is_threaded, FONT_DRIVER_RENDER_D3D10_API); is_threaded, FONT_DRIVER_RENDER_D3D10_API);
if (!new_handle) if (!new_handle)
return false; return false;

View File

@ -45,14 +45,14 @@ static void* menu_display_d3d11_get_default_mvp(video_frame_info_t *video_info)
static void menu_display_d3d11_blend_begin(video_frame_info_t *video_info) static void menu_display_d3d11_blend_begin(video_frame_info_t *video_info)
{ {
d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL; d3d11_video_t* d3d11 = (d3d11_video_t*)video_info->userdata;
D3D11SetBlendState(d3d11->context, D3D11SetBlendState(d3d11->context,
d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
} }
static void menu_display_d3d11_blend_end(video_frame_info_t *video_info) static void menu_display_d3d11_blend_end(video_frame_info_t *video_info)
{ {
d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL; d3d11_video_t* d3d11 = (d3d11_video_t*)video_info->userdata;
D3D11SetBlendState(d3d11->context, D3D11SetBlendState(d3d11->context,
d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
} }
@ -261,12 +261,12 @@ static bool menu_display_d3d11_font_init_first(
void** font_handle, void** font_handle,
void* video_data, void* video_data,
const char* font_path, const char* font_path,
float font_size, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t** handle = (font_data_t**)font_handle; font_data_t** handle = (font_data_t**)font_handle;
font_data_t* new_handle = font_driver_init_first( font_data_t* new_handle = font_driver_init_first(
video_data, font_path, font_size, true, video_data, font_path, menu_font_size, true,
is_threaded, FONT_DRIVER_RENDER_D3D11_API); is_threaded, FONT_DRIVER_RENDER_D3D11_API);
if (!new_handle) if (!new_handle)
return false; return false;

View File

@ -45,15 +45,15 @@ static void* menu_display_d3d12_get_default_mvp(video_frame_info_t *video_info)
static void menu_display_d3d12_blend_begin(video_frame_info_t *video_info) static void menu_display_d3d12_blend_begin(video_frame_info_t *video_info)
{ {
d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL; d3d12_video_t* d3d12 = (d3d12_video_t*)video_info->userdata;
d3d12->sprites.pipe = d3d12->sprites.pipe_blend; d3d12->sprites.pipe = d3d12->sprites.pipe_blend;
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);
} }
static void menu_display_d3d12_blend_end(video_frame_info_t *video_info) static void menu_display_d3d12_blend_end(video_frame_info_t *video_info)
{ {
d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL; d3d12_video_t* d3d12 = (d3d12_video_t*)video_info->userdata;
d3d12->sprites.pipe = d3d12->sprites.pipe_noblend; d3d12->sprites.pipe = d3d12->sprites.pipe_noblend;
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);
@ -283,12 +283,12 @@ static bool menu_display_d3d12_font_init_first(
void** font_handle, void** font_handle,
void* video_data, void* video_data,
const char* font_path, const char* font_path,
float font_size, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t** handle = (font_data_t**)font_handle; font_data_t** handle = (font_data_t**)font_handle;
font_data_t* new_handle = font_driver_init_first( font_data_t* new_handle = font_driver_init_first(
video_data, font_path, font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D12_API); video_data, font_path, menu_font_size, true, is_threaded, FONT_DRIVER_RENDER_D3D12_API);
if (!new_handle) if (!new_handle)
return false; return false;
*handle = new_handle; *handle = new_handle;

View File

@ -1,4 +1,4 @@
/* RetroArch - A frontend for libretro. /* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2011-2017 - Daniel De Matteis
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * RetroArch is free software: you can redistribute it and/or modify it under the terms
@ -297,12 +297,12 @@ static void menu_display_d3d9_clear_color(
static bool menu_display_d3d9_font_init_first( static bool menu_display_d3d9_font_init_first(
void **font_handle, void *video_data, void **font_handle, void *video_data,
const char *font_path, float font_size, const char *font_path, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t **handle = (font_data_t**)font_handle; font_data_t **handle = (font_data_t**)font_handle;
if (!(*handle = font_driver_init_first(video_data, if (!(*handle = font_driver_init_first(video_data,
font_path, font_size, true, font_path, menu_font_size, true,
is_threaded, is_threaded,
FONT_DRIVER_RENDER_D3D9_API))) FONT_DRIVER_RENDER_D3D9_API)))
return false; return false;

View File

@ -137,12 +137,12 @@ static void menu_display_gdi_clear_color(
static bool menu_display_gdi_font_init_first( static bool menu_display_gdi_font_init_first(
void **font_handle, void *video_data, void **font_handle, void *video_data,
const char *font_path, float font_size, const char *font_path, float gdi_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t **handle = (font_data_t**)font_handle; font_data_t **handle = (font_data_t**)font_handle;
if (!(*handle = font_driver_init_first(video_data, if (!(*handle = font_driver_init_first(video_data,
font_path, font_size, true, font_path, gdi_font_size, true,
is_threaded, is_threaded,
FONT_DRIVER_RENDER_GDI))) FONT_DRIVER_RENDER_GDI)))
return false; return false;

View File

@ -238,12 +238,12 @@ static void menu_display_gl_clear_color(
static bool menu_display_gl_font_init_first( static bool menu_display_gl_font_init_first(
void **font_handle, void *video_data, void **font_handle, void *video_data,
const char *font_path, float font_size, const char *font_path, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t **handle = (font_data_t**)font_handle; font_data_t **handle = (font_data_t**)font_handle;
if (!(*handle = font_driver_init_first(video_data, if (!(*handle = font_driver_init_first(video_data,
font_path, font_size, true, font_path, menu_font_size, true,
is_threaded, is_threaded,
FONT_DRIVER_RENDER_OPENGL_API))) FONT_DRIVER_RENDER_OPENGL_API)))
return false; return false;

View File

@ -64,7 +64,7 @@ static void menu_display_null_clear_color(
static bool menu_display_null_font_init_first( static bool menu_display_null_font_init_first(
void **font_handle, void *video_data, void **font_handle, void *video_data,
const char *font_path, float font_size, const char *font_path, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
return true; return true;

View File

@ -332,11 +332,11 @@ static void menu_display_vk_blend_end(video_frame_info_t *video_info)
static bool menu_display_vk_font_init_first( static bool menu_display_vk_font_init_first(
void **font_handle, void *video_data, const char *font_path, void **font_handle, void *video_data, const char *font_path,
float font_size, bool is_threaded) float menu_font_size, bool is_threaded)
{ {
font_data_t **handle = (font_data_t**)font_handle; font_data_t **handle = (font_data_t**)font_handle;
*handle = font_driver_init_first(video_data, *handle = font_driver_init_first(video_data,
font_path, font_size, true, font_path, menu_font_size, true,
is_threaded, is_threaded,
FONT_DRIVER_RENDER_VULKAN_API); FONT_DRIVER_RENDER_VULKAN_API);
@ -349,21 +349,21 @@ static bool menu_display_vk_font_init_first(
static void menu_display_vk_scissor_begin(video_frame_info_t *video_info, static void menu_display_vk_scissor_begin(video_frame_info_t *video_info,
int x, int y, unsigned width, unsigned height) int x, int y, unsigned width, unsigned height)
{ {
vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk_t *vk = (vk_t*)video_info->userdata;
vk->tracker.use_scissor = true; vk->tracker.use_scissor = true;
vk->tracker.scissor.offset.x = x; vk->tracker.scissor.offset.x = x;
vk->tracker.scissor.offset.y = y; vk->tracker.scissor.offset.y = y;
vk->tracker.scissor.extent.width = width; vk->tracker.scissor.extent.width = width;
vk->tracker.scissor.extent.height = height; vk->tracker.scissor.extent.height = height;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
} }
static void menu_display_vk_scissor_end(video_frame_info_t *video_info) static void menu_display_vk_scissor_end(video_frame_info_t *video_info)
{ {
vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk_t *vk = (vk_t*)video_info->userdata;
vk->tracker.use_scissor = false; vk->tracker.use_scissor = false;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
} }
menu_display_ctx_driver_t menu_display_ctx_vulkan = { menu_display_ctx_driver_t menu_display_ctx_vulkan = {

View File

@ -473,7 +473,7 @@ bool menu_animation_push(menu_animation_ctx_entry_t *entry)
return true; return true;
} }
bool menu_animation_update(float delta_time) bool menu_animation_update(float anim_delta_time)
{ {
unsigned i; unsigned i;
@ -482,8 +482,8 @@ bool menu_animation_update(float delta_time)
for(i = 0; i < da_count(anim.list); i++) for(i = 0; i < da_count(anim.list); i++)
{ {
struct tween *tween = da_getptr(anim.list, i); struct tween *tween = da_getptr(anim.list, i);
tween->running_since += delta_time; tween->running_since += anim_delta_time;
*tween->subject = tween->easing( *tween->subject = tween->easing(
tween->running_since, tween->running_since,
@ -523,7 +523,7 @@ bool menu_animation_update(float delta_time)
da_clear(anim.pending); da_clear(anim.pending);
} }
anim.in_update = false; anim.in_update = false;
animation_is_active = da_count(anim.list) > 0; animation_is_active = da_count(anim.list) > 0;
return animation_is_active; return animation_is_active;

View File

@ -451,7 +451,7 @@ void menu_display_font_free(font_data_t *font)
* to the menu driver */ * to the menu driver */
font_data_t *menu_display_font( font_data_t *menu_display_font(
enum application_special_type type, enum application_special_type type,
float font_size, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
char fontpath[PATH_MAX_LENGTH]; char fontpath[PATH_MAX_LENGTH];
@ -464,10 +464,10 @@ font_data_t *menu_display_font(
fill_pathname_application_special( fill_pathname_application_special(
fontpath, sizeof(fontpath), type); fontpath, sizeof(fontpath), type);
return menu_display_font_file(fontpath, font_size, is_threaded); return menu_display_font_file(fontpath, menu_font_size, is_threaded);
} }
font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded) font_data_t *menu_display_font_file(char* fontpath, float menu_font_size, bool is_threaded)
{ {
font_data_t *font_data = NULL; font_data_t *font_data = NULL;
if (!menu_disp) if (!menu_disp)
@ -475,7 +475,7 @@ font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_thr
if (!menu_disp->font_init_first((void**)&font_data, if (!menu_disp->font_init_first((void**)&font_data,
video_driver_get_ptr(false), video_driver_get_ptr(false),
fontpath, font_size, is_threaded)) fontpath, menu_font_size, is_threaded))
return NULL; return NULL;
return font_data; return font_data;

View File

@ -373,8 +373,8 @@ static void global_free(void)
{ {
if (!string_is_empty(global->name.remapfile)) if (!string_is_empty(global->name.remapfile))
free(global->name.remapfile); free(global->name.remapfile);
memset(global, 0, sizeof(struct global));
} }
memset(global, 0, sizeof(struct global));
retroarch_override_setting_free_state(); retroarch_override_setting_free_state();
} }
@ -1734,7 +1734,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
runloop_system.mmaps.descriptors = NULL; runloop_system.mmaps.descriptors = NULL;
runloop_system.mmaps.num_descriptors = 0; runloop_system.mmaps.num_descriptors = 0;
runloop_key_event = NULL; rarch_ctl(RARCH_CTL_UNSET_KEY_EVENT, NULL);
runloop_frontend_key_event = NULL; runloop_frontend_key_event = NULL;
audio_driver_unset_callback(); audio_driver_unset_callback();
@ -1914,6 +1914,9 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
case RARCH_CTL_SET_SHUTDOWN: case RARCH_CTL_SET_SHUTDOWN:
runloop_shutdown_initiated = true; runloop_shutdown_initiated = true;
break; break;
case RARCH_CTL_UNSET_SHUTDOWN:
runloop_shutdown_initiated = false;
break;
case RARCH_CTL_IS_SHUTDOWN: case RARCH_CTL_IS_SHUTDOWN:
return runloop_shutdown_initiated; return runloop_shutdown_initiated;
case RARCH_CTL_DATA_DEINIT: case RARCH_CTL_DATA_DEINIT:
@ -2029,6 +2032,9 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
*key_event = &runloop_key_event; *key_event = &runloop_key_event;
} }
break; break;
case RARCH_CTL_UNSET_KEY_EVENT:
runloop_key_event = NULL;
break;
case RARCH_CTL_FRONTEND_KEY_EVENT_GET: case RARCH_CTL_FRONTEND_KEY_EVENT_GET:
{ {
retro_keyboard_event_t **key_event = retro_keyboard_event_t **key_event =
@ -2396,7 +2402,7 @@ void retroarch_fail(int error_code, const char *error)
bool retroarch_main_quit(void) bool retroarch_main_quit(void)
{ {
if (!runloop_shutdown_initiated) if (!rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL))
{ {
command_event(CMD_EVENT_AUTOSAVE_STATE, NULL); command_event(CMD_EVENT_AUTOSAVE_STATE, NULL);
command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL); command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL);
@ -2404,7 +2410,7 @@ bool retroarch_main_quit(void)
command_event(CMD_EVENT_RESTORE_REMAPS, NULL); command_event(CMD_EVENT_RESTORE_REMAPS, NULL);
} }
runloop_shutdown_initiated = true; rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
rarch_menu_running_finished(); rarch_menu_running_finished();
#ifdef HAVE_DISCORD #ifdef HAVE_DISCORD
@ -2484,7 +2490,7 @@ bool runloop_msg_queue_pull(const char **ret)
* d) Video driver no longer alive. * d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better) * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/ */
#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || bsv_movie_is_end_of_file() || ((runloop_max_frames != 0) && (frame_count >= runloop_max_frames)) || runloop_exec) #define time_to_exit(quit_key_pressed) (rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL) || quit_key_pressed || !is_alive || bsv_movie_is_end_of_file() || ((runloop_max_frames != 0) && (frame_count >= runloop_max_frames)) || runloop_exec)
#define runloop_check_cheevos() (settings->bools.cheevos_enable && cheevos_loaded && (!cheats_are_enabled && !cheats_were_enabled)) #define runloop_check_cheevos() (settings->bools.cheevos_enable && cheevos_loaded && (!cheats_are_enabled && !cheats_were_enabled))
@ -2782,7 +2788,7 @@ static enum runloop_state runloop_check_state(
/* Loads dummy core instead of exiting RetroArch completely. /* Loads dummy core instead of exiting RetroArch completely.
* Aborts core shutdown if invoked. */ * Aborts core shutdown if invoked. */
runloop_shutdown_initiated = false; rarch_ctl(RARCH_CTL_UNSET_SHUTDOWN, NULL);
runloop_core_shutdown_initiated = false; runloop_core_shutdown_initiated = false;
} }
else else

View File

@ -145,6 +145,7 @@ enum rarch_ctl_state
RARCH_CTL_SET_CORE_SHUTDOWN, RARCH_CTL_SET_CORE_SHUTDOWN,
RARCH_CTL_SET_SHUTDOWN, RARCH_CTL_SET_SHUTDOWN,
RARCH_CTL_UNSET_SHUTDOWN,
RARCH_CTL_IS_SHUTDOWN, RARCH_CTL_IS_SHUTDOWN,
/* Runloop state */ /* Runloop state */
@ -158,6 +159,7 @@ enum rarch_ctl_state
/* Key event */ /* Key event */
RARCH_CTL_FRONTEND_KEY_EVENT_GET, RARCH_CTL_FRONTEND_KEY_EVENT_GET,
RARCH_CTL_UNSET_KEY_EVENT,
RARCH_CTL_KEY_EVENT_GET, RARCH_CTL_KEY_EVENT_GET,
RARCH_CTL_DATA_DEINIT, RARCH_CTL_DATA_DEINIT,

View File

@ -60,9 +60,9 @@ static void *runahead_save_state_alloc(void)
return savestate; return savestate;
} }
static void runahead_save_state_free(void *state) static void runahead_save_state_free(void *data)
{ {
retro_ctx_serialize_info_t *savestate = (retro_ctx_serialize_info_t*)state; retro_ctx_serialize_info_t *savestate = (retro_ctx_serialize_info_t*)data;
if (!savestate) if (!savestate)
return; return;
free(savestate->data); free(savestate->data);

View File

@ -52,17 +52,24 @@ void clear_controller_port_map(void);
static char *get_temp_directory_alloc(void) static char *get_temp_directory_alloc(void)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
char *path = NULL; char *path = NULL;
#ifdef _WIN32 #ifdef _WIN32
#ifdef LEGACY_WIN32 #ifdef LEGACY_WIN32
DWORD pathLength = GetTempPath(0, NULL) + 1; DWORD pathLength = GetTempPath(0, NULL) + 1;
path = (char*)malloc(pathLength * sizeof(char)); path = (char*)malloc(pathLength * sizeof(char));
path[pathLength - 1] = 0; if (!path)
return NULL;
path[pathLength - 1] = 0;
GetTempPath(pathLength, path); GetTempPath(pathLength, path);
#else #else
DWORD pathLength = GetTempPathW(0, NULL) + 1; DWORD pathLength = GetTempPathW(0, NULL) + 1;
wchar_t *wideStr = (wchar_t*)malloc(pathLength * sizeof(wchar_t)); wchar_t *wideStr = (wchar_t*)malloc(pathLength * sizeof(wchar_t));
if (!wideStr)
return NULL;
wideStr[pathLength - 1] = 0; wideStr[pathLength - 1] = 0;
GetTempPathW(pathLength, wideStr); GetTempPathW(pathLength, wideStr);

View File

@ -53,11 +53,15 @@ bool settings_list_append(rarch_setting_t **list,
if (list_info->index == list_info->size) if (list_info->index == list_info->size)
{ {
rarch_setting_t *list_settings = NULL;
list_info->size *= 2; list_info->size *= 2;
*list = (rarch_setting_t*) list_settings = (rarch_setting_t*)
realloc(*list, sizeof(rarch_setting_t) * list_info->size); realloc(*list, sizeof(rarch_setting_t) * list_info->size);
if (!*list)
if (!list_settings)
return false; return false;
*list = list_settings;
} }
return true; return true;

View File

@ -1310,7 +1310,7 @@ bool task_push_dbscan(
const char *content_database, const char *content_database,
const char *fullpath, const char *fullpath,
bool directory, bool directory,
bool show_hidden_files, bool db_dir_show_hidden_files,
retro_task_callback_t cb) retro_task_callback_t cb)
{ {
retro_task_t *t = (retro_task_t*)calloc(1, sizeof(*t)); retro_task_t *t = (retro_task_t*)calloc(1, sizeof(*t));
@ -1324,7 +1324,7 @@ bool task_push_dbscan(
t->callback = cb; t->callback = cb;
t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN)); t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN));
db->show_hidden_files = show_hidden_files; db->show_hidden_files = db_dir_show_hidden_files;
db->is_directory = directory; db->is_directory = directory;
db->playlist_directory = NULL; db->playlist_directory = NULL;
db->fullpath = strdup(fullpath); db->fullpath = strdup(fullpath);

View File

@ -66,8 +66,17 @@ static void task_powerstate_handler(retro_task_t *task)
void task_push_get_powerstate(void) void task_push_get_powerstate(void)
{ {
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task)); retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
powerstate_t *state = (powerstate_t*)calloc(1, sizeof(*state)); powerstate_t *state = NULL;
if (!task)
return;
state = (powerstate_t*)calloc(1, sizeof(*state));
if (!state)
{
free(task);
return;
}
task->type = TASK_TYPE_NONE; task->type = TASK_TYPE_NONE;
task->state = state; task->state = state;

View File

@ -762,6 +762,10 @@ static void task_load_handler_finished(retro_task_t *task,
task_set_error(task, strdup("Task canceled")); task_set_error(task, strdup("Task canceled"));
task_data = (load_task_data_t*)calloc(1, sizeof(*task_data)); task_data = (load_task_data_t*)calloc(1, sizeof(*task_data));
if (!task_data)
return;
memcpy(task_data, state, sizeof(*task_data)); memcpy(task_data, state, sizeof(*task_data));
task_set_data(task, task_data); task_set_data(task, task_data);