mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +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 "retroarch.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "input/input_remapping.h"
|
#include "input/input_remapping.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define DEFAULT_NETWORK_CMD_PORT 55355
|
#define DEFAULT_NETWORK_CMD_PORT 55355
|
||||||
#define STDIN_BUF_SIZE 4096
|
#define STDIN_BUF_SIZE 4096
|
||||||
@ -130,6 +131,8 @@ struct command
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool command_version(const char *arg);
|
||||||
|
|
||||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||||
static bool command_read_ram(const char *arg);
|
static bool command_read_ram(const char *arg);
|
||||||
static bool command_write_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[] = {
|
static const struct cmd_action_map action_map[] = {
|
||||||
{ "SET_SHADER", command_set_shader, "<shader path>" },
|
{ "SET_SHADER", command_set_shader, "<shader path>" },
|
||||||
|
{ "VERSION", command_version, "No argument"},
|
||||||
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||||
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
|
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
|
||||||
{ "WRITE_CORE_RAM", command_write_ram, "<address> <byte1> <byte2> ..." },
|
{ "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;
|
static socklen_t lastcmd_net_source_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CHEEVOS
|
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
|
||||||
#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING)
|
|
||||||
static bool command_reply(const char * data, size_t len)
|
static bool command_reply(const char * data, size_t len)
|
||||||
{
|
{
|
||||||
switch (lastcmd_source)
|
switch (lastcmd_source)
|
||||||
@ -222,7 +225,6 @@ static bool command_reply(const char * data, size_t len)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
bool command_set_shader(const char *arg)
|
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);
|
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)
|
#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS)
|
||||||
|
#define SMY_CMD_STR "READ_CORE_RAM"
|
||||||
static bool command_read_ram(const char *arg)
|
static bool command_read_ram(const char *arg)
|
||||||
{
|
{
|
||||||
cheevos_var_t var;
|
cheevos_var_t var;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char reply[256] = {0};
|
char *reply = NULL;
|
||||||
const uint8_t * data = NULL;
|
const uint8_t * data = NULL;
|
||||||
char *reply_at = 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));
|
var.value = addr;
|
||||||
reply_at = reply + strlen("READ_CORE_RAM ");
|
|
||||||
strlcpy(reply_at, arg, sizeof(reply)-strlen(reply));
|
|
||||||
|
|
||||||
var.value = strtoul(reply_at, (char**)&reply_at, 16);
|
|
||||||
cheevos_var_patch_addr(&var, cheevos_get_console());
|
cheevos_var_patch_addr(&var, cheevos_get_console());
|
||||||
data = cheevos_var_get_memory(&var);
|
data = cheevos_var_get_memory(&var);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
unsigned nbytes = strtol(reply_at, NULL, 10);
|
|
||||||
|
|
||||||
for (i=0;i<nbytes;i++)
|
for (i=0;i<nbytes;i++)
|
||||||
sprintf(reply_at+3*i, " %.2X", data[i]);
|
sprintf(reply_at+3*i, " %.2X", data[i]);
|
||||||
reply_at[3*nbytes] = '\n';
|
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));
|
strlcpy(reply_at, " -1\n", sizeof(reply)-strlen(reply));
|
||||||
command_reply(reply, reply_at+strlen(" -1\n") - reply);
|
command_reply(reply, reply_at+strlen(" -1\n") - reply);
|
||||||
}
|
}
|
||||||
|
free(reply);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#undef SMY_CMD_STR
|
||||||
|
|
||||||
static bool command_write_ram(const char *arg)
|
static bool command_write_ram(const char *arg)
|
||||||
{
|
{
|
||||||
@ -332,7 +350,7 @@ static bool command_get_arg(const char *tok,
|
|||||||
if (str == tok)
|
if (str == tok)
|
||||||
{
|
{
|
||||||
const char *argument = str + strlen(action_map[i].str);
|
const char *argument = str + strlen(action_map[i].str);
|
||||||
if (*argument != ' ')
|
if (*argument != ' ' && *argument != '\0')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (arg)
|
if (arg)
|
||||||
|
@ -132,59 +132,60 @@ static void dinput_joypad_destroy(void)
|
|||||||
|
|
||||||
static void dinput_create_rumble_effects(struct dinput_joypad *pad)
|
static void dinput_create_rumble_effects(struct dinput_joypad *pad)
|
||||||
{
|
{
|
||||||
LONG direction = 0;
|
|
||||||
DWORD axis = DIJOFS_X;
|
|
||||||
DICONSTANTFORCE dicf;
|
|
||||||
DIENVELOPE dienv;
|
DIENVELOPE dienv;
|
||||||
HRESULT hr;
|
DICONSTANTFORCE dicf;
|
||||||
|
LONG direction = 0;
|
||||||
|
DWORD axis = DIJOFS_X;
|
||||||
|
|
||||||
dicf.lMagnitude = 0;
|
dicf.lMagnitude = 0;
|
||||||
|
|
||||||
dienv.dwSize = sizeof(DIENVELOPE);
|
dienv.dwSize = sizeof(DIENVELOPE);
|
||||||
dienv.dwAttackLevel = 5000;
|
dienv.dwAttackLevel = 5000;
|
||||||
dienv.dwAttackTime = 250000;
|
dienv.dwAttackTime = 250000;
|
||||||
dienv.dwFadeLevel = 0;
|
dienv.dwFadeLevel = 0;
|
||||||
dienv.dwFadeTime = 250000;
|
dienv.dwFadeTime = 250000;
|
||||||
|
|
||||||
pad->rumble_props.cAxes = 1;
|
pad->rumble_props.cAxes = 1;
|
||||||
pad->rumble_props.dwTriggerButton = DIEB_NOTRIGGER;
|
pad->rumble_props.dwTriggerButton = DIEB_NOTRIGGER;
|
||||||
pad->rumble_props.dwTriggerRepeatInterval = 0;
|
pad->rumble_props.dwTriggerRepeatInterval = 0;
|
||||||
pad->rumble_props.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
pad->rumble_props.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
|
||||||
pad->rumble_props.dwDuration = INFINITE;
|
pad->rumble_props.dwDuration = INFINITE;
|
||||||
pad->rumble_props.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
|
pad->rumble_props.dwFlags = DIEFF_CARTESIAN |
|
||||||
pad->rumble_props.dwGain = 0;
|
DIEFF_OBJECTOFFSETS;
|
||||||
pad->rumble_props.dwSize = sizeof(DIEFFECT);
|
pad->rumble_props.dwGain = 0;
|
||||||
pad->rumble_props.dwStartDelay = 0;
|
pad->rumble_props.dwSize = sizeof(DIEFFECT);
|
||||||
pad->rumble_props.lpEnvelope = &dienv;
|
pad->rumble_props.dwStartDelay = 0;
|
||||||
pad->rumble_props.lpvTypeSpecificParams = &dicf;
|
pad->rumble_props.lpEnvelope = &dienv;
|
||||||
pad->rumble_props.rgdwAxes = &axis;
|
pad->rumble_props.lpvTypeSpecificParams = &dicf;
|
||||||
pad->rumble_props.rglDirection = &direction;
|
pad->rumble_props.rgdwAxes = &axis;
|
||||||
|
pad->rumble_props.rglDirection = &direction;
|
||||||
|
|
||||||
hr = IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
if (IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
||||||
&pad->rumble_props, &pad->rumble_iface[0], NULL);
|
&pad->rumble_props, &pad->rumble_iface[0], NULL) != DI_OK)
|
||||||
if (hr != DI_OK)
|
|
||||||
RARCH_WARN("[DINPUT]: Strong rumble unavailable.\n");
|
RARCH_WARN("[DINPUT]: Strong rumble unavailable.\n");
|
||||||
|
|
||||||
axis = DIJOFS_Y;
|
axis = DIJOFS_Y;
|
||||||
|
|
||||||
hr = IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
if (IDirectInputDevice8_CreateEffect(pad->joypad, &GUID_ConstantForce,
|
||||||
&pad->rumble_props, &pad->rumble_iface[1], NULL);
|
&pad->rumble_props, &pad->rumble_iface[1], NULL) != DI_OK)
|
||||||
if (hr != DI_OK)
|
|
||||||
RARCH_WARN("[DINPUT]: Weak rumble unavailable.\n");
|
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;
|
DIPROPRANGE range;
|
||||||
LPDIRECTINPUTDEVICE8 joypad = (LPDIRECTINPUTDEVICE8)p;
|
LPDIRECTINPUTDEVICE8 joypad = (LPDIRECTINPUTDEVICE8)p;
|
||||||
|
|
||||||
memset(&range, 0, sizeof(range));
|
memset(&range, 0, sizeof(range));
|
||||||
range.diph.dwSize = sizeof(DIPROPRANGE);
|
|
||||||
|
range.diph.dwSize = sizeof(DIPROPRANGE);
|
||||||
range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||||
range.diph.dwHow = DIPH_BYID;
|
range.diph.dwHow = DIPH_BYID;
|
||||||
range.diph.dwObj = inst->dwType;
|
range.diph.dwObj = inst->dwType;
|
||||||
range.lMin = -0x7fff;
|
range.lMin = -0x7fff;
|
||||||
range.lMax = 0x7fff;
|
range.lMax = 0x7fff;
|
||||||
|
|
||||||
IDirectInputDevice8_SetProperty(joypad, DIPROP_RANGE, &range.diph);
|
IDirectInputDevice8_SetProperty(joypad, DIPROP_RANGE, &range.diph);
|
||||||
|
|
||||||
return DIENUM_CONTINUE;
|
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)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,8 +243,10 @@ static bool guid_is_xinput_device(const GUID* product_guid)
|
|||||||
rdi.cbSize = sizeof (rdi);
|
rdi.cbSize = sizeof (rdi);
|
||||||
|
|
||||||
if ((raw_devs[i].dwType == RIM_TYPEHID) &&
|
if ((raw_devs[i].dwType == RIM_TYPEHID) &&
|
||||||
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
|
(GetRawInputDeviceInfoA(raw_devs[i].hDevice,
|
||||||
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)product_guid->Data1)) &&
|
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)) &&
|
(GetRawInputDeviceInfoA(raw_devs[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
|
||||||
(strstr(devName, "IG_") != NULL) )
|
(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 */
|
/* there may be more useful info in the GUID so leave this here for a while */
|
||||||
#if 0
|
#if 0
|
||||||
printf("Guid = {%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}\n",
|
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.Data1,
|
||||||
inst->guidProduct.Data4[0], inst->guidProduct.Data4[1], inst->guidProduct.Data4[2], inst->guidProduct.Data4[3],
|
inst->guidProduct.Data2,
|
||||||
inst->guidProduct.Data4[4], inst->guidProduct.Data4[5], inst->guidProduct.Data4[6], inst->guidProduct.Data4[7]);
|
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
|
#endif
|
||||||
|
|
||||||
g_pads[g_joypad_cnt].vid = inst->guidProduct.Data1 % 0x10000;
|
g_pads[g_joypad_cnt].vid = inst->guidProduct.Data1 % 0x10000;
|
||||||
g_pads[g_joypad_cnt].pid = 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
|
#ifdef HAVE_XINPUT
|
||||||
is_xinput_pad = g_xinput_block_pads
|
is_xinput_pad = g_xinput_block_pads
|
||||||
@ -336,7 +351,8 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
IDirectInputDevice8_SetDataFormat(*pad, &c_dfDIJoystick2);
|
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);
|
DISCL_EXCLUSIVE | DISCL_BACKGROUND);
|
||||||
|
|
||||||
IDirectInputDevice8_EnumObjects(*pad, enum_axes_cb,
|
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」というアイテムを削除しますか?")
|
"「%1」というアイテムを削除しますか?")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
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\"?")
|
"Are you sure you want to delete the item \"%1\"?")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
||||||
"Please choose a single playlist first.")
|
"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 char *prev = cheat_manager_state.prev_memory_buf ;
|
||||||
unsigned int curr_match_idx = 0;
|
unsigned int curr_match_idx = 0;
|
||||||
|
|
||||||
if ( target_match_idx < 0 || target_match_idx > cheat_manager_state.num_matches-1)
|
if ( target_match_idx > cheat_manager_state.num_matches-1)
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits);
|
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--)
|
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++ ;
|
cheat_manager_state.cheats[i+1].idx++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&cheat_manager_state.cheats[0], &tmp, sizeof(struct item_cheat )) ;
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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,
|
static int action_ok_cheat_add_bottom(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
char msg[256] ;
|
char msg[256];
|
||||||
bool refresh = false ;
|
bool refresh = false ;
|
||||||
|
|
||||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||||
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
char msg[256] ;
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 240, true);
|
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_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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++ ;
|
cheat_manager_state.cheats[i+1].idx++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&cheat_manager_state.cheats[tmp.idx], &tmp, sizeof(struct item_cheat )) ;
|
memcpy(&cheat_manager_state.cheats[tmp.idx],
|
||||||
memcpy(&cheat_manager_state.working_cheat, &tmp, sizeof(struct item_cheat )) ;
|
&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_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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 wraparound)
|
||||||
{
|
{
|
||||||
bool refresh = false ;
|
bool refresh = false ;
|
||||||
char msg[256] ;
|
char msg[256];
|
||||||
|
|
||||||
if ( ++cheat_manager_state.delete_state >= 5 )
|
if ( ++cheat_manager_state.delete_state >= 5 )
|
||||||
{
|
{
|
||||||
|
msg[0] = '\0';
|
||||||
cheat_manager_state.delete_state = 0 ;
|
cheat_manager_state.delete_state = 0 ;
|
||||||
cheat_manager_realloc(0, CHEAT_HANDLER_TYPE_EMU) ;
|
cheat_manager_realloc(0, CHEAT_HANDLER_TYPE_EMU) ;
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
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;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL),
|
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT_VAL),
|
||||||
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_lt(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL), len);
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LT_VAL));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_gt(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL), len);
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GT_VAL));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_lte(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL), len);
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_LTE_VAL));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_gte(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL), len);
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_GTE_VAL));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_eq(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL), len);
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQ_VAL));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_neq(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL), len);
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_NEQ_VAL));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_eqplus(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL),
|
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS_VAL),
|
||||||
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_cheat_eqminus(void *data,
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
{
|
|
||||||
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL),
|
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS_VAL),
|
||||||
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
*setting->value.target.unsigned_integer, *setting->value.target.unsigned_integer);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setting_get_string_representation_uint_video_rotation(void *data,
|
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_PLAYLIST_ENTRY_DATABASE,
|
||||||
MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS,
|
MENU_ENUM_LABEL_VALUE_QT_FOR_THUMBNAILS,
|
||||||
MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
MENU_ENUM_LABEL_VALUE_QT_CANNOT_ADD_TO_ALL_PLAYLISTS,
|
||||||
|
MENU_ENUM_LABEL_VALUE_QT_DELETE,
|
||||||
|
|
||||||
MENU_LABEL(MIDI_INPUT),
|
MENU_LABEL(MIDI_INPUT),
|
||||||
MENU_LABEL(MIDI_OUTPUT),
|
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;
|
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||||
if (setting)
|
if (setting)
|
||||||
snprintf(s, len, "%s",
|
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)
|
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 TIMER_MSEC 1000 /* periodic timer for gathering statistics */
|
||||||
|
#define STATUS_MSG_THROTTLE_MSEC 250
|
||||||
|
|
||||||
#ifndef COLLECTION_SIZE
|
#ifndef COLLECTION_SIZE
|
||||||
#define COLLECTION_SIZE 99999
|
#define COLLECTION_SIZE 99999
|
||||||
@ -805,6 +806,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
,m_allPlaylistsListMaxCount(0)
|
,m_allPlaylistsListMaxCount(0)
|
||||||
,m_allPlaylistsGridMaxCount(0)
|
,m_allPlaylistsGridMaxCount(0)
|
||||||
,m_playlistEntryDialog(NULL)
|
,m_playlistEntryDialog(NULL)
|
||||||
|
,m_statusMessageElapsedTimer()
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
QDir playlistDir(settings->paths.directory_playlist);
|
QDir playlistDir(settings->paths.directory_playlist);
|
||||||
@ -991,6 +993,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
m_dirTree->setContextMenuPolicy(Qt::CustomContextMenu);
|
m_dirTree->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
m_listWidget->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(returnPressed()), this, SLOT(onSearchEnterPressed()));
|
||||||
connect(m_searchLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onSearchLineEditEdited(const QString&)));
|
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(viewTypeIconsAction, SIGNAL(triggered()), this, SLOT(onIconViewClicked()));
|
||||||
connect(viewTypeListAction, SIGNAL(triggered()), this, SLOT(onListViewClicked()));
|
connect(viewTypeListAction, SIGNAL(triggered()), this, SLOT(onListViewClicked()));
|
||||||
connect(m_gridLayoutWidget, SIGNAL(filesDropped(QStringList)), this, SLOT(onPlaylistFilesDropped(QStringList)));
|
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) */
|
/* 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);
|
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_searchLineEdit->setFocus();
|
||||||
m_loadCoreWindow->setWindowModality(Qt::ApplicationModal);
|
m_loadCoreWindow->setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
|
m_statusMessageElapsedTimer.start();
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||||
resizeDocks(QList<QDockWidget*>() << m_searchDock, QList<int>() << 1, Qt::Vertical);
|
resizeDocks(QList<QDockWidget*>() << m_searchDock, QList<int>() << 1, Qt::Vertical);
|
||||||
#endif
|
#endif
|
||||||
@ -1444,6 +1450,30 @@ bool MainWindow::showMessageBox(QString msg, MessageBoxType msgType, Qt::WindowM
|
|||||||
return true;
|
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&)
|
void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -1758,7 +1788,14 @@ void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned dur
|
|||||||
msecDuration = 1000;
|
msecDuration = 1000;
|
||||||
|
|
||||||
if (status->currentMessage().isEmpty() || flush)
|
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()
|
void MainWindow::deferReloadPlaylists()
|
||||||
@ -2408,37 +2445,51 @@ void MainWindow::onTableWidgetDeletePressed()
|
|||||||
deleteCurrentPlaylistItem();
|
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();
|
QTableWidgetItem *contentItem = m_tableWidget->currentItem();
|
||||||
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
QListWidgetItem *playlistItem = m_listWidget->currentItem();
|
||||||
QHash<QString, QString> contentHash;
|
QHash<QString, QString> contentHash;
|
||||||
QString playlistPath;
|
|
||||||
QByteArray playlistArray;
|
|
||||||
ViewType viewType = getCurrentViewType();
|
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 (viewType == VIEW_TYPE_LIST)
|
||||||
{
|
{
|
||||||
if (!contentItem)
|
if (!contentItem)
|
||||||
return;
|
return contentHash;
|
||||||
|
|
||||||
contentHash = contentItem->data(Qt::UserRole).value<QHash<QString, QString> >();
|
contentHash = contentItem->data(Qt::UserRole).value<QHash<QString, QString> >();
|
||||||
}
|
}
|
||||||
else if (viewType == VIEW_TYPE_ICONS)
|
else if (viewType == VIEW_TYPE_ICONS)
|
||||||
contentHash = m_currentGridHash;
|
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;
|
return;
|
||||||
|
|
||||||
if (contentHash.isEmpty())
|
if (contentHash.isEmpty())
|
||||||
|
@ -277,9 +277,11 @@ static void* ui_companion_qt_init(void)
|
|||||||
|
|
||||||
widget = new FileDropWidget(mainwindow);
|
widget = new FileDropWidget(mainwindow);
|
||||||
widget->setObjectName("tableWidget");
|
widget->setObjectName("tableWidget");
|
||||||
|
widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
QObject::connect(widget, SIGNAL(filesDropped(QStringList)), mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
|
QObject::connect(widget, SIGNAL(filesDropped(QStringList)), mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
|
||||||
QObject::connect(widget, SIGNAL(deletePressed()), mainwindow, SLOT(deleteCurrentPlaylistItem()));
|
QObject::connect(widget, SIGNAL(deletePressed()), mainwindow, SLOT(deleteCurrentPlaylistItem()));
|
||||||
|
QObject::connect(widget, SIGNAL(customContextMenuRequested(const QPoint&)), mainwindow, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));
|
||||||
|
|
||||||
layout = new QVBoxLayout();
|
layout = new QVBoxLayout();
|
||||||
layout->addWidget(mainwindow->contentTableWidget());
|
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 */
|
/* setting the last tab must come after setting the view type */
|
||||||
if (qsettings->contains("save_last_tab"))
|
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)
|
if (lastTabIndex >= 0 && browserAndPlaylistTabWidget->count() > lastTabIndex)
|
||||||
{
|
{
|
||||||
browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
|
browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
|
||||||
mainwindow->onTabWidgetIndexChanged(lastTabIndex);
|
mainwindow->onTabWidgetIndexChanged(lastTabIndex);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <retro_assert.h>
|
#include <retro_assert.h>
|
||||||
@ -339,6 +340,8 @@ public:
|
|||||||
void setAllPlaylistsGridMaxCount(int count);
|
void setAllPlaylistsGridMaxCount(int count);
|
||||||
PlaylistEntryDialog* playlistEntryDialog();
|
PlaylistEntryDialog* playlistEntryDialog();
|
||||||
void addFilesToPlaylist(QStringList files);
|
void addFilesToPlaylist(QStringList files);
|
||||||
|
QString getCurrentPlaylistPath();
|
||||||
|
QHash<QString, QString> getCurrentContentHash();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void thumbnailChanged(const QPixmap &pixmap);
|
void thumbnailChanged(const QPixmap &pixmap);
|
||||||
@ -378,6 +381,7 @@ public slots:
|
|||||||
void onListViewClicked();
|
void onListViewClicked();
|
||||||
void onTabWidgetIndexChanged(int index);
|
void onTabWidgetIndexChanged(int index);
|
||||||
void deleteCurrentPlaylistItem();
|
void deleteCurrentPlaylistItem();
|
||||||
|
void onFileDropWidgetContextMenuRequested(const QPoint &pos);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLoadCoreClicked(const QStringList &extensionFilters = QStringList());
|
void onLoadCoreClicked(const QStringList &extensionFilters = QStringList());
|
||||||
@ -477,6 +481,7 @@ private:
|
|||||||
int m_allPlaylistsListMaxCount;
|
int m_allPlaylistsListMaxCount;
|
||||||
int m_allPlaylistsGridMaxCount;
|
int m_allPlaylistsGridMaxCount;
|
||||||
PlaylistEntryDialog *m_playlistEntryDialog;
|
PlaylistEntryDialog *m_playlistEntryDialog;
|
||||||
|
QElapsedTimer m_statusMessageElapsedTimer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user