mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 22:43:41 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3d862bbdb4
44
command.c
44
command.c
@ -93,6 +93,7 @@
|
||||
#include "retroarch.h"
|
||||
#include "configuration.h"
|
||||
#include "input/input_remapping.h"
|
||||
#include "version.h"
|
||||
|
||||
#define DEFAULT_NETWORK_CMD_PORT 55355
|
||||
#define STDIN_BUF_SIZE 4096
|
||||
@ -130,6 +131,8 @@ struct command
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool command_version(const char *arg);
|
||||
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
static bool command_read_ram(const char *arg);
|
||||
static bool command_write_ram(const char *arg);
|
||||
@ -137,6 +140,7 @@ static bool command_write_ram(const char *arg);
|
||||
|
||||
static const struct cmd_action_map action_map[] = {
|
||||
{ "SET_SHADER", command_set_shader, "<shader path>" },
|
||||
{ "VERSION", command_version, "No argument"},
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
|
||||
{ "WRITE_CORE_RAM", command_write_ram, "<address> <byte1> <byte2> ..." },
|
||||
@ -194,8 +198,7 @@ static struct sockaddr_storage lastcmd_net_source;
|
||||
static socklen_t lastcmd_net_source_len;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
static bool command_reply(const char * data, size_t len)
|
||||
{
|
||||
switch (lastcmd_source)
|
||||
@ -222,7 +225,6 @@ static bool command_reply(const char * data, size_t len)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool command_set_shader(const char *arg)
|
||||
{
|
||||
@ -245,29 +247,43 @@ bool command_set_shader(const char *arg)
|
||||
return menu_shader_manager_set_preset(shader, type, arg);
|
||||
}
|
||||
|
||||
static bool command_version(const char* arg)
|
||||
{
|
||||
char reply[256] = {0};
|
||||
|
||||
sprintf(reply, "%s\n", PACKAGE_VERSION);
|
||||
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||
command_reply(reply, strlen(reply));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||
#define SMY_CMD_STR "READ_CORE_RAM"
|
||||
static bool command_read_ram(const char *arg)
|
||||
{
|
||||
cheevos_var_t var;
|
||||
unsigned i;
|
||||
char reply[256] = {0};
|
||||
char *reply = NULL;
|
||||
const uint8_t * data = NULL;
|
||||
char *reply_at = NULL;
|
||||
unsigned int nbytes = 0;
|
||||
unsigned int alloc_size = 0;
|
||||
int addr = -1;
|
||||
|
||||
reply[0] = '\0';
|
||||
if (sscanf(arg, "%x %d", &addr, &nbytes) != 2)
|
||||
return true;
|
||||
alloc_size = 40 + nbytes * 3; //We alloc more than needed, saving 20 bytes is not really relevant
|
||||
reply = (char*) malloc(alloc_size);
|
||||
reply[0] = '\0';
|
||||
reply_at = reply + sprintf(reply, SMY_CMD_STR " %x", addr);
|
||||
|
||||
strlcpy(reply, "READ_CORE_RAM ", sizeof(reply));
|
||||
reply_at = reply + strlen("READ_CORE_RAM ");
|
||||
strlcpy(reply_at, arg, sizeof(reply)-strlen(reply));
|
||||
|
||||
var.value = strtoul(reply_at, (char**)&reply_at, 16);
|
||||
var.value = addr;
|
||||
cheevos_var_patch_addr(&var, cheevos_get_console());
|
||||
data = cheevos_var_get_memory(&var);
|
||||
|
||||
if (data)
|
||||
{
|
||||
unsigned nbytes = strtol(reply_at, NULL, 10);
|
||||
|
||||
for (i=0;i<nbytes;i++)
|
||||
sprintf(reply_at+3*i, " %.2X", data[i]);
|
||||
reply_at[3*nbytes] = '\n';
|
||||
@ -278,9 +294,11 @@ static bool command_read_ram(const char *arg)
|
||||
strlcpy(reply_at, " -1\n", sizeof(reply)-strlen(reply));
|
||||
command_reply(reply, reply_at+strlen(" -1\n") - reply);
|
||||
}
|
||||
free(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
#undef SMY_CMD_STR
|
||||
|
||||
static bool command_write_ram(const char *arg)
|
||||
{
|
||||
@ -332,7 +350,7 @@ static bool command_get_arg(const char *tok,
|
||||
if (str == tok)
|
||||
{
|
||||
const char *argument = str + strlen(action_map[i].str);
|
||||
if (*argument != ' ')
|
||||
if (*argument != ' ' && *argument != '\0')
|
||||
return false;
|
||||
|
||||
if (arg)
|
||||
|
@ -132,59 +132,60 @@ static void dinput_joypad_destroy(void)
|
||||
|
||||
static void dinput_create_rumble_effects(struct dinput_joypad *pad)
|
||||
{
|
||||
LONG direction = 0;
|
||||
DWORD axis = DIJOFS_X;
|
||||
DICONSTANTFORCE dicf;
|
||||
DIENVELOPE dienv;
|
||||
HRESULT hr;
|
||||
DICONSTANTFORCE dicf;
|
||||
LONG direction = 0;
|
||||
DWORD axis = DIJOFS_X;
|
||||
|
||||
dicf.lMagnitude = 0;
|
||||
dicf.lMagnitude = 0;
|
||||
|
||||
dienv.dwSize = sizeof(DIENVELOPE);
|
||||
dienv.dwAttackLevel = 5000;
|
||||
dienv.dwAttackTime = 250000;
|
||||
dienv.dwFadeLevel = 0;
|
||||
dienv.dwFadeTime = 250000;
|
||||
dienv.dwSize = sizeof(DIENVELOPE);
|
||||
dienv.dwAttackLevel = 5000;
|
||||
dienv.dwAttackTime = 250000;
|
||||
dienv.dwFadeLevel = 0;
|
||||
dienv.dwFadeTime = 250000;
|
||||
|
||||
pad->rumble_props.cAxes = 1;
|
||||
pad->rumble_props.dwTriggerButton = DIEB_NOTRIGGER;
|
||||
pad->rumble_props.cAxes = 1;
|
||||
pad->rumble_props.dwTriggerButton = DIEB_NOTRIGGER;
|
||||
pad->rumble_props.dwTriggerRepeatInterval = 0;
|
||||
pad->rumble_props.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
||||
pad->rumble_props.dwDuration = INFINITE;
|
||||
pad->rumble_props.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
|
||||
pad->rumble_props.dwGain = 0;
|
||||
pad->rumble_props.dwSize = sizeof(DIEFFECT);
|
||||
pad->rumble_props.dwStartDelay = 0;
|
||||
pad->rumble_props.lpEnvelope = &dienv;
|
||||
pad->rumble_props.lpvTypeSpecificParams = &dicf;
|
||||
pad->rumble_props.rgdwAxes = &axis;
|
||||
pad->rumble_props.rglDirection = &direction;
|
||||
pad->rumble_props.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
||||
pad->rumble_props.dwDuration = INFINITE;
|
||||
pad->rumble_props.dwFlags = DIEFF_CARTESIAN |
|
||||
DIEFF_OBJECTOFFSETS;
|
||||
pad->rumble_props.dwGain = 0;
|
||||
pad->rumble_props.dwSize = sizeof(DIEFFECT);
|
||||
pad->rumble_props.dwStartDelay = 0;
|
||||
pad->rumble_props.lpEnvelope = &dienv;
|
||||
pad->rumble_props.lpvTypeSpecificParams = &dicf;
|
||||
pad->rumble_props.rgdwAxes = &axis;
|
||||
pad->rumble_props.rglDirection = &direction;
|
||||
|
||||
hr = IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
||||
&pad->rumble_props, &pad->rumble_iface[0], NULL);
|
||||
if (hr != DI_OK)
|
||||
if (IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
||||
&pad->rumble_props, &pad->rumble_iface[0], NULL) != DI_OK)
|
||||
RARCH_WARN("[DINPUT]: Strong rumble unavailable.\n");
|
||||
|
||||
axis = DIJOFS_Y;
|
||||
|
||||
hr = IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
||||
&pad->rumble_props, &pad->rumble_iface[1], NULL);
|
||||
if (hr != DI_OK)
|
||||
if (IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
||||
&pad->rumble_props, &pad->rumble_iface[1], NULL) != DI_OK)
|
||||
RARCH_WARN("[DINPUT]: Weak rumble unavailable.\n");
|
||||
}
|
||||
|
||||
static BOOL CALLBACK enum_axes_cb(const DIDEVICEOBJECTINSTANCE *inst, void *p)
|
||||
static BOOL CALLBACK enum_axes_cb(
|
||||
const DIDEVICEOBJECTINSTANCE *inst, void *p)
|
||||
{
|
||||
DIPROPRANGE range;
|
||||
LPDIRECTINPUTDEVICE8 joypad = (LPDIRECTINPUTDEVICE8)p;
|
||||
|
||||
memset(&range, 0, sizeof(range));
|
||||
range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
|
||||
range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||
range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
range.diph.dwHow = DIPH_BYID;
|
||||
range.diph.dwObj = inst->dwType;
|
||||
range.lMin = -0x7fff;
|
||||
range.lMax = 0x7fff;
|
||||
range.diph.dwHow = DIPH_BYID;
|
||||
range.diph.dwObj = inst->dwType;
|
||||
range.lMin = -0x7fff;
|
||||
range.lMax = 0x7fff;
|
||||
|
||||
IDirectInputDevice8_SetProperty(joypad, DIPROP_RANGE, &range.diph);
|
||||
|
||||
return DIENUM_CONTINUE;
|
||||
@ -206,7 +207,8 @@ static bool guid_is_xinput_device(const GUID* product_guid)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(common_xinput_guids); ++i)
|
||||
{
|
||||
if (string_is_equal_fast(product_guid, &common_xinput_guids[i], sizeof(GUID)))
|
||||
if (string_is_equal_fast(product_guid,
|
||||
&common_xinput_guids[i], sizeof(GUID)))
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -241,8 +243,10 @@ static bool guid_is_xinput_device(const GUID* product_guid)
|
||||
rdi.cbSize = sizeof (rdi);
|
||||
|
||||
if ((raw_devs[i].dwType == RIM_TYPEHID) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
|
||||
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)product_guid->Data1)) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice,
|
||||
RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
|
||||
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId)
|
||||
== ((LONG)product_guid->Data1)) &&
|
||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
|
||||
(strstr(devName, "IG_") != NULL) )
|
||||
{
|
||||
@ -313,15 +317,26 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
/* there may be more useful info in the GUID so leave this here for a while */
|
||||
#if 0
|
||||
printf("Guid = {%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}\n",
|
||||
inst->guidProduct.Data1, inst->guidProduct.Data2, inst->guidProduct.Data3,
|
||||
inst->guidProduct.Data4[0], inst->guidProduct.Data4[1], inst->guidProduct.Data4[2], inst->guidProduct.Data4[3],
|
||||
inst->guidProduct.Data4[4], inst->guidProduct.Data4[5], inst->guidProduct.Data4[6], inst->guidProduct.Data4[7]);
|
||||
inst->guidProduct.Data1,
|
||||
inst->guidProduct.Data2,
|
||||
inst->guidProduct.Data3,
|
||||
inst->guidProduct.Data4[0],
|
||||
inst->guidProduct.Data4[1],
|
||||
inst->guidProduct.Data4[2],
|
||||
inst->guidProduct.Data4[3],
|
||||
inst->guidProduct.Data4[4],
|
||||
inst->guidProduct.Data4[5],
|
||||
inst->guidProduct.Data4[6],
|
||||
inst->guidProduct.Data4[7]);
|
||||
#endif
|
||||
|
||||
g_pads[g_joypad_cnt].vid = inst->guidProduct.Data1 % 0x10000;
|
||||
g_pads[g_joypad_cnt].pid = inst->guidProduct.Data1 / 0x10000;
|
||||
|
||||
RARCH_LOG("[DINPUT]: Device #%u PID: {%04lX} VID:{%04lX}\n", g_joypad_cnt, g_pads[g_joypad_cnt].pid, g_pads[g_joypad_cnt].vid);
|
||||
RARCH_LOG("[DINPUT]: Device #%u PID: {%04lX} VID:{%04lX}\n",
|
||||
g_joypad_cnt,
|
||||
g_pads[g_joypad_cnt].pid,
|
||||
g_pads[g_joypad_cnt].vid);
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
is_xinput_pad = g_xinput_block_pads
|
||||
@ -336,7 +351,8 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
#endif
|
||||
|
||||
IDirectInputDevice8_SetDataFormat(*pad, &c_dfDIJoystick2);
|
||||
IDirectInputDevice8_SetCooperativeLevel(*pad, (HWND)video_driver_window_get(),
|
||||
IDirectInputDevice8_SetCooperativeLevel(*pad,
|
||||
(HWND)video_driver_window_get(),
|
||||
DISCL_EXCLUSIVE | DISCL_BACKGROUND);
|
||||
|
||||
IDirectInputDevice8_EnumObjects(*pad, enum_axes_cb,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3666,3 +3666,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM,
|
||||
"「%1」というアイテムを削除しますか?")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
||||
"まずひとつのプレイリストを選択してください。")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DELETE,
|
||||
"削除")
|
||||
|
@ -4182,3 +4182,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CONFIRM_DELETE_PLAYLIST_ITEM,
|
||||
"Are you sure you want to delete the item \"%1\"?")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
||||
"Please choose a single playlist first.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DELETE,
|
||||
"Delete")
|
||||
|
@ -1317,8 +1317,8 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
unsigned char *prev = cheat_manager_state.prev_memory_buf ;
|
||||
unsigned int curr_match_idx = 0;
|
||||
|
||||
if ( target_match_idx < 0 || target_match_idx > cheat_manager_state.num_matches-1)
|
||||
return ;
|
||||
if ( target_match_idx > cheat_manager_state.num_matches-1)
|
||||
return;
|
||||
|
||||
cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits);
|
||||
|
||||
|
@ -2685,13 +2685,14 @@ static int action_ok_cheat_reload_cheats(const char *path,
|
||||
|
||||
for (i = cheat_manager_state.size-2 ; i >=0 ; i--)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i+1], &cheat_manager_state.cheats[i], sizeof(struct item_cheat )) ;
|
||||
memcpy(&cheat_manager_state.cheats[i+1],
|
||||
&cheat_manager_state.cheats[i], sizeof(struct item_cheat )) ;
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
}
|
||||
|
||||
memcpy(&cheat_manager_state.cheats[0], &tmp, sizeof(struct item_cheat )) ;
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_ADD_TOP_SUCCESS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_TOP_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
@ -2702,15 +2703,17 @@ static int action_ok_cheat_reload_cheats(const char *path,
|
||||
static int action_ok_cheat_add_bottom(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char msg[256] ;
|
||||
char msg[256];
|
||||
bool refresh = false ;
|
||||
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_ADD_BOTTOM_SUCCESS)) ;
|
||||
msg[0] = '\0';
|
||||
strlcpy(msg,
|
||||
msg_hash_to_str(MSG_CHEAT_ADD_BOTTOM_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
@ -2722,7 +2725,7 @@ static int action_ok_cheat_delete_all(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char msg[256] ;
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_DELETE_ALL_INSTRUCTIONS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_DELETE_ALL_INSTRUCTIONS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 240, true);
|
||||
@ -2754,7 +2757,7 @@ static int action_ok_cheat_add_new_after(const char *path,
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_ADD_AFTER_SUCCESS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_AFTER_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
@ -2782,13 +2785,15 @@ static int action_ok_cheat_add_new_before(const char *path,
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
}
|
||||
|
||||
memcpy(&cheat_manager_state.cheats[tmp.idx], &tmp, sizeof(struct item_cheat )) ;
|
||||
memcpy(&cheat_manager_state.working_cheat, &tmp, sizeof(struct item_cheat )) ;
|
||||
memcpy(&cheat_manager_state.cheats[tmp.idx],
|
||||
&tmp, sizeof(struct item_cheat )) ;
|
||||
memcpy(&cheat_manager_state.working_cheat,
|
||||
&tmp, sizeof(struct item_cheat )) ;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_ADD_BEFORE_SUCCESS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_BEFORE_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
@ -2821,7 +2826,7 @@ static int action_ok_cheat_copy_before(const char *path,
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_COPY_BEFORE_SUCCESS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_COPY_BEFORE_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
@ -2855,7 +2860,7 @@ static int action_ok_cheat_copy_after(const char *path,
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_COPY_AFTER_SUCCESS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_COPY_AFTER_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
@ -2883,7 +2888,7 @@ static int action_ok_cheat_delete(const char *path,
|
||||
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_DELETE_SUCCESS)) ;
|
||||
strlcpy(msg, msg_hash_to_str(MSG_CHEAT_DELETE_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
|
@ -276,16 +276,18 @@ static int action_right_cheat_delete_all(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
bool refresh = false ;
|
||||
char msg[256] ;
|
||||
char msg[256];
|
||||
|
||||
if ( ++cheat_manager_state.delete_state >= 5 )
|
||||
{
|
||||
msg[0] = '\0';
|
||||
cheat_manager_state.delete_state = 0 ;
|
||||
cheat_manager_realloc(0, CHEAT_HANDLER_TYPE_EMU) ;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
|
||||
snprintf(msg, sizeof(msg), msg_hash_to_str(MSG_CHEAT_DELETE_ALL_SUCCESS)) ;
|
||||
strlcpy(msg,
|
||||
msg_hash_to_str(MSG_CHEAT_DELETE_ALL_SUCCESS), sizeof(msg));
|
||||
msg[sizeof(msg) - 1] = 0;
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
|
@ -443,10 +443,8 @@ static void setting_get_string_representation_uint_cheat_exact(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL),
|
||||
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
||||
}
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_lt(void *data,
|
||||
@ -454,9 +452,7 @@ static void setting_get_string_representation_uint_cheat_lt(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL));
|
||||
}
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL), len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_gt(void *data,
|
||||
@ -464,9 +460,7 @@ static void setting_get_string_representation_uint_cheat_gt(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL));
|
||||
}
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL), len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_lte(void *data,
|
||||
@ -474,9 +468,7 @@ static void setting_get_string_representation_uint_cheat_lte(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL));
|
||||
}
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL), len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_gte(void *data,
|
||||
@ -484,9 +476,7 @@ static void setting_get_string_representation_uint_cheat_gte(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL));
|
||||
}
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL), len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_eq(void *data,
|
||||
@ -494,9 +484,7 @@ static void setting_get_string_representation_uint_cheat_eq(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL));
|
||||
}
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL), len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_neq(void *data,
|
||||
@ -504,9 +492,7 @@ static void setting_get_string_representation_uint_cheat_neq(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL));
|
||||
}
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL), len);
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_eqplus(void *data,
|
||||
@ -514,10 +500,8 @@ static void setting_get_string_representation_uint_cheat_eqplus(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL),
|
||||
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
||||
}
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_cheat_eqminus(void *data,
|
||||
@ -525,10 +509,8 @@ static void setting_get_string_representation_uint_cheat_eqminus(void *data,
|
||||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
{
|
||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL),
|
||||
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
||||
}
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_video_rotation(void *data,
|
||||
|
@ -1950,6 +1950,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_QT_PLAYLIST_ENTRY_DATABASE,
|
||||
MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS,
|
||||
MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
||||
MENU_ENUM_LABEL_VALUE_QT_DELETE,
|
||||
|
||||
MENU_LABEL(MIDI_INPUT),
|
||||
MENU_LABEL(MIDI_OUTPUT),
|
||||
|
@ -197,7 +197,9 @@ void setting_get_string_representation_uint_as_enum(void *data,
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (setting)
|
||||
snprintf(s, len, "%s",
|
||||
msg_hash_to_str(setting->index_offset+(*setting->value.target.unsigned_integer)));
|
||||
msg_hash_to_str((enum msg_hash_enums)(
|
||||
setting->index_offset+(
|
||||
*setting->value.target.unsigned_integer))));
|
||||
}
|
||||
|
||||
static float recalc_step_based_on_length_of_action(rarch_setting_t *setting)
|
||||
|
@ -63,6 +63,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
#define TIMER_MSEC 1000 /* periodic timer for gathering statistics */
|
||||
#define STATUS_MSG_THROTTLE_MSEC 250
|
||||
|
||||
#ifndef COLLECTION_SIZE
|
||||
#define COLLECTION_SIZE 99999
|
||||
@ -805,6 +806,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
,m_allPlaylistsListMaxCount(0)
|
||||
,m_allPlaylistsGridMaxCount(0)
|
||||
,m_playlistEntryDialog(NULL)
|
||||
,m_statusMessageElapsedTimer()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
@ -991,6 +993,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
m_dirTree->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_gridLayoutWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
connect(m_searchLineEdit, SIGNAL(returnPressed()), this, SLOT(onSearchEnterPressed()));
|
||||
connect(m_searchLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onSearchLineEditEdited(const QString&)));
|
||||
@ -1014,6 +1017,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(viewTypeIconsAction, SIGNAL(triggered()), this, SLOT(onIconViewClicked()));
|
||||
connect(viewTypeListAction, SIGNAL(triggered()), this, SLOT(onListViewClicked()));
|
||||
connect(m_gridLayoutWidget, SIGNAL(filesDropped(QStringList)), this, SLOT(onPlaylistFilesDropped(QStringList)));
|
||||
connect(m_gridLayoutWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));
|
||||
|
||||
/* make sure these use an auto connection so it will be queued if called from a different thread (some facilities in RA log messages from other threads) */
|
||||
connect(this, SIGNAL(gotLogMessage(const QString&)), this, SLOT(onGotLogMessage(const QString&)), Qt::AutoConnection);
|
||||
@ -1034,6 +1038,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
m_searchLineEdit->setFocus();
|
||||
m_loadCoreWindow->setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
m_statusMessageElapsedTimer.start();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
resizeDocks(QList<QDockWidget*>() << m_searchDock, QList<int>() << 1, Qt::Vertical);
|
||||
#endif
|
||||
@ -1444,6 +1450,30 @@ bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType, Qt::WindowM
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::onFileDropWidgetContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
QScopedPointer<QMenu> menu;
|
||||
QScopedPointer<QAction> deleteAction;
|
||||
QPointer<QAction> selectedAction;
|
||||
QPoint cursorPos = QCursor::pos();
|
||||
|
||||
menu.reset(new QMenu(this));
|
||||
|
||||
deleteAction.reset(new QAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_DELETE)), this));
|
||||
|
||||
menu->addAction(deleteAction.data());
|
||||
|
||||
selectedAction = menu->exec(cursorPos);
|
||||
|
||||
if (!selectedAction)
|
||||
return;
|
||||
|
||||
if (selectedAction == deleteAction.data())
|
||||
{
|
||||
deleteCurrentPlaylistItem();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -1758,7 +1788,14 @@ void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned dur
|
||||
msecDuration = 1000;
|
||||
|
||||
if (status->currentMessage().isEmpty() || flush)
|
||||
status->showMessage(msg, msecDuration);
|
||||
{
|
||||
if (m_statusMessageElapsedTimer.elapsed() >= STATUS_MSG_THROTTLE_MSEC)
|
||||
{
|
||||
qint64 msgDuration = qMax(msecDuration, STATUS_MSG_THROTTLE_MSEC);
|
||||
m_statusMessageElapsedTimer.restart();
|
||||
status->showMessage(msg, msgDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::deferReloadPlaylists()
|
||||
@ -2408,37 +2445,51 @@ void MainWindow::onTableWidgetDeletePressed()
|
||||
deleteCurrentPlaylistItem();
|
||||
}
|
||||
|
||||
void MainWindow::deleteCurrentPlaylistItem()
|
||||
QString MainWindow::getCurrentPlaylistPath()
|
||||
{
|
||||
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
||||
QHash<QString, QString> contentHash;
|
||||
QString playlistPath;
|
||||
|
||||
if (!playlistItem)
|
||||
return playlistPath;
|
||||
|
||||
playlistPath = playlistItem->data(Qt::UserRole).toString();
|
||||
|
||||
return playlistPath;
|
||||
}
|
||||
|
||||
QHash<QString, QString> MainWindow::getCurrentContentHash()
|
||||
{
|
||||
QTableWidgetItem *contentItem = m_tableWidget->currentItem();
|
||||
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
||||
QHash<QString, QString> contentHash;
|
||||
QString playlistPath;
|
||||
QByteArray playlistArray;
|
||||
ViewType viewType = getCurrentViewType();
|
||||
playlist_t *playlist = NULL;
|
||||
const char *playlistData = NULL;
|
||||
unsigned index = 0;
|
||||
bool ok = false;
|
||||
|
||||
if (!playlistItem)
|
||||
return;
|
||||
|
||||
playlistPath = playlistItem->data(Qt::UserRole).toString();
|
||||
|
||||
if (playlistPath.isEmpty())
|
||||
return;
|
||||
|
||||
if (viewType == VIEW_TYPE_LIST)
|
||||
{
|
||||
if (!contentItem)
|
||||
return;
|
||||
return contentHash;
|
||||
|
||||
contentHash = contentItem->data(Qt::UserRole).value<QHash<QString, QString> >();
|
||||
}
|
||||
else if (viewType == VIEW_TYPE_ICONS)
|
||||
contentHash = m_currentGridHash;
|
||||
else
|
||||
|
||||
return contentHash;
|
||||
}
|
||||
|
||||
void MainWindow::deleteCurrentPlaylistItem()
|
||||
{
|
||||
QString playlistPath = getCurrentPlaylistPath();
|
||||
QByteArray playlistArray;
|
||||
QHash<QString, QString> contentHash = getCurrentContentHash();
|
||||
playlist_t *playlist = NULL;
|
||||
const char *playlistData = NULL;
|
||||
unsigned index = 0;
|
||||
bool ok = false;
|
||||
|
||||
if (playlistPath.isEmpty())
|
||||
return;
|
||||
|
||||
if (contentHash.isEmpty())
|
||||
|
@ -277,9 +277,11 @@ static void* ui_companion_qt_init(void)
|
||||
|
||||
widget = new FileDropWidget(mainwindow);
|
||||
widget->setObjectName("tableWidget");
|
||||
widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
QObject::connect(widget, SIGNAL(filesDropped(QStringList)), mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
|
||||
QObject::connect(widget, SIGNAL(deletePressed()), mainwindow, SLOT(deleteCurrentPlaylistItem()));
|
||||
QObject::connect(widget, SIGNAL(customContextMenuRequested(const QPoint&)), mainwindow, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));
|
||||
|
||||
layout = new QVBoxLayout();
|
||||
layout->addWidget(mainwindow->contentTableWidget());
|
||||
@ -535,15 +537,12 @@ static void* ui_companion_qt_init(void)
|
||||
/* setting the last tab must come after setting the view type */
|
||||
if (qsettings->contains("save_last_tab"))
|
||||
{
|
||||
if (qsettings->contains("last_tab"))
|
||||
{
|
||||
int lastTabIndex = qsettings->value("last_tab", 0).toInt();
|
||||
int lastTabIndex = qsettings->value("last_tab", 0).toInt();
|
||||
|
||||
if (lastTabIndex >= 0 && browserAndPlaylistTabWidget->count() > lastTabIndex)
|
||||
{
|
||||
browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
|
||||
mainwindow->onTabWidgetIndexChanged(lastTabIndex);
|
||||
}
|
||||
if (lastTabIndex >= 0 && browserAndPlaylistTabWidget->count() > lastTabIndex)
|
||||
{
|
||||
browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
|
||||
mainwindow->onTabWidgetIndexChanged(lastTabIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QImage>
|
||||
#include <QPointer>
|
||||
#include <QProgressBar>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
extern "C" {
|
||||
#include <retro_assert.h>
|
||||
@ -339,6 +340,8 @@ public:
|
||||
void setAllPlaylistsGridMaxCount(int count);
|
||||
PlaylistEntryDialog* playlistEntryDialog();
|
||||
void addFilesToPlaylist(QStringList files);
|
||||
QString getCurrentPlaylistPath();
|
||||
QHash<QString, QString> getCurrentContentHash();
|
||||
|
||||
signals:
|
||||
void thumbnailChanged(const QPixmap &pixmap);
|
||||
@ -378,6 +381,7 @@ public slots:
|
||||
void onListViewClicked();
|
||||
void onTabWidgetIndexChanged(int index);
|
||||
void deleteCurrentPlaylistItem();
|
||||
void onFileDropWidgetContextMenuRequested(const QPoint &pos);
|
||||
|
||||
private slots:
|
||||
void onLoadCoreClicked(const QStringList &extensionFilters = QStringList());
|
||||
@ -477,6 +481,7 @@ private:
|
||||
int m_allPlaylistsListMaxCount;
|
||||
int m_allPlaylistsGridMaxCount;
|
||||
PlaylistEntryDialog *m_playlistEntryDialog;
|
||||
QElapsedTimer m_statusMessageElapsedTimer;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user