mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 22:43:41 +00:00
C89 buildfixes
This commit is contained in:
parent
367d6e7480
commit
89083fd093
@ -31,9 +31,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "menu/menu_driver.h"
|
||||
#include "menu/widgets/menu_input_dialog.h"
|
||||
#include "menu/widgets/menu_input_bind_dialog.h"
|
||||
#include "../menu/menu_driver.h"
|
||||
#include "../menu/widgets/menu_input_dialog.h"
|
||||
#include "../menu/widgets/menu_input_bind_dialog.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
@ -159,27 +159,12 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw
|
||||
|
||||
for (i = 0; i < cheat_manager_state.size; i++)
|
||||
{
|
||||
unsigned j;
|
||||
char endian_key[100];
|
||||
char key[256];
|
||||
char desc_key[256];
|
||||
char code_key[256];
|
||||
char enable_key[256];
|
||||
|
||||
key[0] = endian_key[0] = desc_key[0] = code_key[0] = enable_key[0] = '\0';
|
||||
|
||||
snprintf(endian_key, sizeof(endian_key), "cheat%u_big_endian", i);
|
||||
snprintf(desc_key, sizeof(desc_key), "cheat%u_desc", i);
|
||||
snprintf(code_key, sizeof(code_key), "cheat%u_code", i);
|
||||
snprintf(enable_key, sizeof(enable_key), "cheat%u_enable", i);
|
||||
|
||||
if (!string_is_empty(cheat_manager_state.cheats[i].desc))
|
||||
config_set_string(conf, desc_key, cheat_manager_state.cheats[i].desc);
|
||||
else
|
||||
config_set_string(conf, desc_key, cheat_manager_state.cheats[i].code);
|
||||
config_set_string(conf, code_key, cheat_manager_state.cheats[i].code);
|
||||
config_set_bool(conf, enable_key, cheat_manager_state.cheats[i].state);
|
||||
config_set_bool(conf, endian_key, cheat_manager_state.cheats[i].big_endian);
|
||||
|
||||
char* keys[13] = {
|
||||
"cheat%u_handler",
|
||||
"cheat%u_memory_search_size",
|
||||
@ -196,7 +181,22 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw
|
||||
"cheat%u_rumble_secondary_duration",
|
||||
};
|
||||
|
||||
for ( int j = 0 ; j < 13 ; j++ )
|
||||
key[0] = endian_key[0] = desc_key[0] = code_key[0] = enable_key[0] = '\0';
|
||||
|
||||
snprintf(endian_key, sizeof(endian_key), "cheat%u_big_endian", i);
|
||||
snprintf(desc_key, sizeof(desc_key), "cheat%u_desc", i);
|
||||
snprintf(code_key, sizeof(code_key), "cheat%u_code", i);
|
||||
snprintf(enable_key, sizeof(enable_key), "cheat%u_enable", i);
|
||||
|
||||
if (!string_is_empty(cheat_manager_state.cheats[i].desc))
|
||||
config_set_string(conf, desc_key, cheat_manager_state.cheats[i].desc);
|
||||
else
|
||||
config_set_string(conf, desc_key, cheat_manager_state.cheats[i].code);
|
||||
config_set_string(conf, code_key, cheat_manager_state.cheats[i].code);
|
||||
config_set_bool(conf, enable_key, cheat_manager_state.cheats[i].state);
|
||||
config_set_bool(conf, endian_key, cheat_manager_state.cheats[i].big_endian);
|
||||
|
||||
for (j = 0; j < 13; j++)
|
||||
{
|
||||
unsigned int* data_ptrs[13] = {
|
||||
&cheat_manager_state.cheats[i].handler,
|
||||
@ -316,6 +316,7 @@ bool cheat_manager_load(const char *path, bool append)
|
||||
|
||||
for (i = orig_size; i < cheats; i++)
|
||||
{
|
||||
unsigned j;
|
||||
unsigned int* data_ptrs[13] = {
|
||||
&cheat_manager_state.cheats[i].handler,
|
||||
&cheat_manager_state.cheats[i].memory_search_size,
|
||||
@ -384,7 +385,8 @@ bool cheat_manager_load(const char *path, bool append)
|
||||
|
||||
cheat_manager_state.cheats[i].cheat_type = CHEAT_TYPE_SET_TO_VALUE ;
|
||||
cheat_manager_state.cheats[i].memory_search_size = 3;
|
||||
for ( int j = 0 ; j < 13 ; j++ ) {
|
||||
for (j = 0 ; j < 13 ; j++ )
|
||||
{
|
||||
char key[50] ;
|
||||
unsigned val = 0;
|
||||
snprintf(key, sizeof(key), keys[j], i-orig_size);
|
||||
@ -741,6 +743,8 @@ int cheat_manager_search(enum cheat_search_type search_type)
|
||||
//little endian FF000000 = 256
|
||||
for ( idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item)
|
||||
{
|
||||
unsigned byte_part;
|
||||
|
||||
switch ( bytes_per_item )
|
||||
{
|
||||
case 2 :
|
||||
@ -771,7 +775,8 @@ int cheat_manager_search(enum cheat_search_type search_type)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
for ( int byte_part = 0 ; byte_part < 8/bits ; byte_part++)
|
||||
|
||||
for (byte_part = 0 ; byte_part < 8/bits ; byte_part++)
|
||||
{
|
||||
unsigned int curr_subval = (curr_val >> (byte_part*bits) ) & mask ;
|
||||
unsigned int prev_subval = (prev_val >> (byte_part*bits) ) & mask ;
|
||||
@ -889,13 +894,15 @@ int cheat_manager_add_matches(const char *path,
|
||||
const char *label, unsigned type, size_t menuidx, size_t entry_idx)
|
||||
{
|
||||
char msg[100];
|
||||
bool refresh = false;
|
||||
unsigned int mask = 0 ;
|
||||
unsigned int bytes_per_item = 1 ;
|
||||
unsigned int bits = 8 ;
|
||||
unsigned int curr_val = 0 ;
|
||||
unsigned int num_added = 0 ;
|
||||
unsigned char *curr = cheat_manager_state.curr_memory_buf ;
|
||||
bool refresh = false;
|
||||
unsigned byte_part = 0;
|
||||
unsigned int idx = 0;
|
||||
unsigned int mask = 0;
|
||||
unsigned int bytes_per_item = 1;
|
||||
unsigned int bits = 8;
|
||||
unsigned int curr_val = 0;
|
||||
unsigned int num_added = 0;
|
||||
unsigned char *curr = cheat_manager_state.curr_memory_buf;
|
||||
|
||||
if ( cheat_manager_state.num_matches + cheat_manager_state.size > 100 )
|
||||
{
|
||||
@ -904,7 +911,7 @@ int cheat_manager_add_matches(const char *path,
|
||||
}
|
||||
cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ;
|
||||
|
||||
for ( unsigned int idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item)
|
||||
for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item)
|
||||
{
|
||||
switch ( bytes_per_item )
|
||||
{
|
||||
@ -929,9 +936,9 @@ int cheat_manager_add_matches(const char *path,
|
||||
break ;
|
||||
}
|
||||
}
|
||||
for ( int byte_part = 0 ; byte_part < 8/bits ; byte_part++)
|
||||
for (byte_part = 0 ; byte_part < 8/bits ; byte_part++)
|
||||
{
|
||||
unsigned int prev_match ;
|
||||
unsigned int prev_match;
|
||||
|
||||
if ( bits < 8 )
|
||||
{
|
||||
@ -1071,44 +1078,44 @@ void cheat_manager_apply_rumble(struct item_cheat *cheat, unsigned int curr_valu
|
||||
}
|
||||
}
|
||||
|
||||
void cheat_manager_apply_retro_cheats()
|
||||
void cheat_manager_apply_retro_cheats(void)
|
||||
{
|
||||
unsigned int mask = 0 ;
|
||||
unsigned int bytes_per_item = 1 ;
|
||||
unsigned int bits = 8 ;
|
||||
unsigned int curr_val = 0 ;
|
||||
unsigned int num_added = 0 ;
|
||||
bool run_cheat = true ;
|
||||
unsigned i;
|
||||
unsigned int mask = 0;
|
||||
unsigned int bytes_per_item = 1;
|
||||
unsigned int bits = 8;
|
||||
unsigned int curr_val = 0;
|
||||
unsigned int num_added = 0;
|
||||
bool run_cheat = true;
|
||||
|
||||
if ( (!cheat_manager_state.cheats) )
|
||||
if ((!cheat_manager_state.cheats))
|
||||
return;
|
||||
|
||||
for (i = 0 ; i < cheat_manager_state.size ; i++ )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
unsigned char *curr;
|
||||
unsigned int idx;
|
||||
bool set_value = false;
|
||||
unsigned int value_to_set = 0;
|
||||
|
||||
|
||||
for ( int i = 0 ; i < cheat_manager_state.size ; i++ )
|
||||
{
|
||||
if (cheat_manager_state.cheats[i].handler != CHEAT_HANDLER_TYPE_RETRO || !cheat_manager_state.cheats[i].state)
|
||||
{
|
||||
continue ;
|
||||
}
|
||||
if ( !cheat_manager_state.memory_initialized )
|
||||
{
|
||||
cheat_manager_initialize_search(NULL, false) ;
|
||||
}
|
||||
//If we're still not initialized, something must have gone wrong - just bail
|
||||
|
||||
/* If we're still not initialized, something must have gone wrong - just bail */
|
||||
if ( !cheat_manager_state.memory_initialized )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
return;
|
||||
|
||||
if ( !run_cheat )
|
||||
{
|
||||
run_cheat = true ;
|
||||
continue ;
|
||||
}
|
||||
cheat_manager_setup_search_meta(cheat_manager_state.cheats[i].memory_search_size, &bytes_per_item, &mask, &bits) ;
|
||||
unsigned char *curr = cheat_manager_state.curr_memory_buf ;
|
||||
unsigned int idx = cheat_manager_state.cheats[i].address ;
|
||||
|
||||
curr = cheat_manager_state.curr_memory_buf ;
|
||||
idx = cheat_manager_state.cheats[i].address ;
|
||||
|
||||
switch ( bytes_per_item )
|
||||
{
|
||||
@ -1136,9 +1143,6 @@ void cheat_manager_apply_retro_cheats()
|
||||
|
||||
cheat_manager_apply_rumble(&cheat_manager_state.cheats[i], curr_val) ;
|
||||
|
||||
bool set_value = false ;
|
||||
unsigned int value_to_set = 0 ;
|
||||
|
||||
switch ( cheat_manager_state.cheats[i].cheat_type )
|
||||
{
|
||||
case CHEAT_TYPE_SET_TO_VALUE :
|
||||
@ -1235,24 +1239,24 @@ void cheat_manager_apply_retro_cheats()
|
||||
{
|
||||
if ( bits < 8 )
|
||||
{
|
||||
unsigned char val = *(curr+idx) ;
|
||||
for ( int bitpos = 0 ; bitpos < 8 ; bitpos++)
|
||||
unsigned bitpos;
|
||||
unsigned char val = *(curr+idx);
|
||||
|
||||
for (bitpos = 0 ; bitpos < 8 ; bitpos++)
|
||||
{
|
||||
if ( (cheat_manager_state.cheats[i].address_mask>>bitpos)&0x01 )
|
||||
if ((cheat_manager_state.cheats[i].address_mask>>bitpos)&0x01 )
|
||||
{
|
||||
mask = (~(1<<bitpos)&0xFF) ;
|
||||
//clear current bit value
|
||||
/* Clear current bit value */
|
||||
val = val & mask ;
|
||||
//inject cheat bit value
|
||||
/* Inject cheat bit value */
|
||||
val = val | (((value_to_set>>bitpos)&0x01)<<bitpos) ;
|
||||
}
|
||||
}
|
||||
*(curr+idx) = val ;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(curr+idx) = value_to_set & 0xFF ;
|
||||
}
|
||||
*(curr+idx) = value_to_set & 0xFF;
|
||||
break ;
|
||||
}
|
||||
default :
|
||||
@ -1267,13 +1271,9 @@ void cheat_manager_apply_retro_cheats()
|
||||
void cheat_manager_match_action(enum cheat_match_action_type match_action, unsigned int target_match_idx, unsigned int *address, unsigned int *address_mask,
|
||||
unsigned int *prev_value, unsigned int *curr_value)
|
||||
{
|
||||
if ( target_match_idx < 0 || target_match_idx > cheat_manager_state.num_matches-1)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
char msg[100];
|
||||
bool refresh = false;
|
||||
unsigned int byte_part;
|
||||
unsigned int idx;
|
||||
unsigned int mask = 0 ;
|
||||
unsigned int bytes_per_item = 1 ;
|
||||
unsigned int bits = 8 ;
|
||||
@ -1283,8 +1283,12 @@ 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;
|
||||
|
||||
cheat_manager_setup_search_meta(cheat_manager_state.search_bit_size, &bytes_per_item, &mask, &bits) ;
|
||||
for ( unsigned int idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item)
|
||||
if ( target_match_idx < 0 || 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);
|
||||
|
||||
for (idx = 0 ; idx < cheat_manager_state.total_memory_size ; idx = idx + bytes_per_item)
|
||||
{
|
||||
switch ( bytes_per_item )
|
||||
{
|
||||
@ -1316,7 +1320,7 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
break ;
|
||||
}
|
||||
}
|
||||
for ( int byte_part = 0 ; byte_part < 8/bits ; byte_part++)
|
||||
for (byte_part = 0 ; byte_part < 8/bits ; byte_part++)
|
||||
{
|
||||
unsigned int prev_match ;
|
||||
|
||||
@ -1341,30 +1345,20 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
{
|
||||
if ( !cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, (mask << (byte_part*bits)),
|
||||
cheat_manager_state.big_endian, curr_val) )
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
case CHEAT_MATCH_ACTION_TYPE_DELETE :
|
||||
{
|
||||
if ( bits < 8 )
|
||||
{
|
||||
*(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) &
|
||||
(( ~(mask << (byte_part*bits))) & 0xFF );
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(cheat_manager_state.matches+idx,0,bytes_per_item) ;
|
||||
}
|
||||
if ( cheat_manager_state.num_matches > 0 )
|
||||
{
|
||||
cheat_manager_state.num_matches-- ;
|
||||
}
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true);
|
||||
return ;
|
||||
}
|
||||
@ -1395,30 +1389,20 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
{
|
||||
if ( !cheat_manager_add_new_code(cheat_manager_state.search_bit_size, idx, 0xFF,
|
||||
cheat_manager_state.big_endian, curr_val) )
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL), 1, 180, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS), 1, 180, true);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
case CHEAT_MATCH_ACTION_TYPE_DELETE :
|
||||
{
|
||||
if ( bits < 8 )
|
||||
{
|
||||
*(cheat_manager_state.matches+idx) = *(cheat_manager_state.matches+idx) &
|
||||
(( ~(mask << (byte_part*bits))) & 0xFF );
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(cheat_manager_state.matches+idx,0,bytes_per_item) ;
|
||||
}
|
||||
if ( cheat_manager_state.num_matches > 0 )
|
||||
{
|
||||
cheat_manager_state.num_matches-- ;
|
||||
}
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS), 1, 180, true);
|
||||
return ;
|
||||
}
|
||||
@ -1433,14 +1417,16 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
}
|
||||
int cheat_manager_copy_match(void *data, bool wraparound)
|
||||
{
|
||||
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_COPY, cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ;
|
||||
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_COPY,
|
||||
cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int cheat_manager_delete_match(void *data, bool wraparound)
|
||||
{
|
||||
bool refresh = false ;
|
||||
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_DELETE, cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ;
|
||||
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_DELETE,
|
||||
cheat_manager_state.match_idx, NULL, NULL, NULL, NULL) ;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
return 0 ;
|
||||
|
@ -830,21 +830,21 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
break;
|
||||
case ACTION_OK_DL_CHEAT_DETAILS_SETTINGS_LIST:
|
||||
{
|
||||
rarch_setting_t *setting = NULL;
|
||||
|
||||
cheat_manager_copy_idx_to_working(type-MENU_SETTINGS_CHEAT_BEGIN) ;
|
||||
rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_IDX));
|
||||
if ( setting ) {
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_IDX));
|
||||
if (setting)
|
||||
setting->max = cheat_manager_get_size()-1 ;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_VALUE));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE));
|
||||
if ( setting ) {
|
||||
if (setting)
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
int max_bit_position = cheat_manager_state.working_cheat.memory_search_size<3 ? 7 : 0 ;
|
||||
setting->max = max_bit_position ;
|
||||
}
|
||||
@ -854,20 +854,14 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
case ACTION_OK_DL_CHEAT_SEARCH_SETTINGS_LIST:
|
||||
{
|
||||
rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT));
|
||||
if ( setting ) {
|
||||
//*setting->value.target.unsigned_integer = 0 ;
|
||||
if ( setting)
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS));
|
||||
if ( setting ) {
|
||||
//*setting->value.target.unsigned_integer = 0 ;
|
||||
if ( setting )
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS));
|
||||
if ( setting ) {
|
||||
//*setting->value.target.unsigned_integer = 0 ;
|
||||
if ( setting )
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1;
|
||||
}
|
||||
action_ok_dl_lbl(action_ok_dl_to_enum(action_type), DISPLAYLIST_GENERIC);
|
||||
break ;
|
||||
}
|
||||
@ -2665,19 +2659,20 @@ static int action_ok_audio_run(const char *path,
|
||||
static int action_ok_cheat_add_top(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
int i;
|
||||
struct item_cheat tmp;
|
||||
char msg[256] ;
|
||||
bool refresh = false ;
|
||||
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);
|
||||
|
||||
struct item_cheat tmp ;
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat )) ;
|
||||
tmp.idx = 0 ;
|
||||
|
||||
for ( int 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 )) ;
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
@ -2726,17 +2721,18 @@ static int action_ok_cheat_delete_all(const char *path,
|
||||
static int action_ok_cheat_add_new_after(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char msg[256] ;
|
||||
bool refresh = false ;
|
||||
int i;
|
||||
char msg[256];
|
||||
struct item_cheat tmp;
|
||||
bool refresh = false;
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
struct item_cheat tmp ;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat )) ;
|
||||
tmp.idx = cheat_manager_state.working_cheat.idx+1 ;
|
||||
|
||||
for ( int i = cheat_manager_state.size-2 ; i >=cheat_manager_state.working_cheat.idx+1 ; i--)
|
||||
for (i = cheat_manager_state.size-2 ; i >= (int)(cheat_manager_state.working_cheat.idx+1); i--)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i+1], &cheat_manager_state.cheats[i], sizeof(struct item_cheat )) ;
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
@ -2758,17 +2754,18 @@ static int action_ok_cheat_add_new_after(const char *path,
|
||||
static int action_ok_cheat_add_new_before(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
int i;
|
||||
char msg[256] ;
|
||||
struct item_cheat tmp ;
|
||||
bool refresh = false ;
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
struct item_cheat tmp ;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat )) ;
|
||||
tmp.idx = cheat_manager_state.working_cheat.idx ;
|
||||
|
||||
for ( int i = cheat_manager_state.size-2 ; i >=(int)tmp.idx ; i--)
|
||||
for (i = cheat_manager_state.size-2 ; i >=(int)tmp.idx ; i--)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i+1], &cheat_manager_state.cheats[i], sizeof(struct item_cheat )) ;
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
@ -2791,17 +2788,17 @@ static int action_ok_cheat_add_new_before(const char *path,
|
||||
static int action_ok_cheat_copy_before(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
int i;
|
||||
struct item_cheat tmp ;
|
||||
char msg[256] ;
|
||||
bool refresh = false ;
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
struct item_cheat tmp ;
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx], sizeof(struct item_cheat )) ;
|
||||
tmp.idx = cheat_manager_state.working_cheat.idx ;
|
||||
|
||||
for ( int i = cheat_manager_state.size-2 ; i >=(int)tmp.idx ; i--)
|
||||
for (i = cheat_manager_state.size-2 ; i >=(int)tmp.idx ; i--)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i+1], &cheat_manager_state.cheats[i], sizeof(struct item_cheat )) ;
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
@ -2825,17 +2822,18 @@ static int action_ok_cheat_copy_before(const char *path,
|
||||
static int action_ok_cheat_copy_after(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char msg[256] ;
|
||||
bool refresh = false ;
|
||||
int i;
|
||||
struct item_cheat tmp;
|
||||
char msg[256];
|
||||
bool refresh = false ;
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
struct item_cheat tmp ;
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx], sizeof(struct item_cheat )) ;
|
||||
tmp.idx = cheat_manager_state.working_cheat.idx+1 ;
|
||||
|
||||
for ( int i = cheat_manager_state.size-2 ; i >=cheat_manager_state.working_cheat.idx+1 ; i--)
|
||||
for (i = cheat_manager_state.size-2 ; i >= (int)(cheat_manager_state.working_cheat.idx+1); i--)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i+1], &cheat_manager_state.cheats[i], sizeof(struct item_cheat )) ;
|
||||
cheat_manager_state.cheats[i+1].idx++ ;
|
||||
@ -2857,13 +2855,15 @@ static int action_ok_cheat_copy_after(const char *path,
|
||||
static int action_ok_cheat_delete(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
char msg[256] ;
|
||||
bool refresh = false ;
|
||||
size_t new_selection_ptr;
|
||||
char msg[256];
|
||||
bool refresh = false;
|
||||
unsigned int new_size = cheat_manager_get_size() - 1;
|
||||
|
||||
if( new_size >0 )
|
||||
{
|
||||
for ( int i = cheat_manager_state.working_cheat.idx ; i <cheat_manager_state.size-1 ; i++)
|
||||
unsigned i;
|
||||
for (i = cheat_manager_state.working_cheat.idx ; i <cheat_manager_state.size-1 ; i++)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i], &cheat_manager_state.cheats[i+1], sizeof(struct item_cheat )) ;
|
||||
cheat_manager_state.cheats[i].idx-- ;
|
||||
@ -2877,8 +2877,6 @@ static int action_ok_cheat_delete(const char *path,
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
|
||||
size_t new_selection_ptr;
|
||||
|
||||
new_selection_ptr = menu_navigation_get_selection();
|
||||
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
|
||||
menu_navigation_set_selection(new_selection_ptr);
|
||||
|
@ -5251,6 +5251,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_CHEAT_SEARCH_SETTINGS_LIST:
|
||||
{
|
||||
char cheat_label[64];
|
||||
rarch_setting_t *setting;
|
||||
unsigned int address = 0;
|
||||
unsigned int address_mask = 0;
|
||||
unsigned int prev_val = 0;
|
||||
unsigned int curr_val = 0 ;
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
|
||||
@ -5298,8 +5306,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS,
|
||||
PARSE_ONLY_UINT, false);
|
||||
|
||||
char cheat_label[64];
|
||||
|
||||
cheat_label[0] = '\0';
|
||||
snprintf(cheat_label, sizeof(cheat_label),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES), cheat_manager_state.num_matches);
|
||||
@ -5319,10 +5325,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
PARSE_ONLY_UINT, false);
|
||||
|
||||
cheat_label[0] = '\0';
|
||||
unsigned int address = 0;
|
||||
unsigned int address_mask = 0;
|
||||
unsigned int prev_val = 0;
|
||||
unsigned int curr_val = 0 ;
|
||||
|
||||
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_VIEW, cheat_manager_state.match_idx, &address, &address_mask, &prev_val, &curr_val) ;
|
||||
snprintf(cheat_label, sizeof(cheat_label),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_MATCH), address, address_mask);
|
||||
@ -5334,17 +5337,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
MENU_SETTINGS_CHEAT_MATCH, 0, 0);
|
||||
|
||||
|
||||
rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH));
|
||||
if ( setting ) {
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH));
|
||||
if ( setting )
|
||||
setting->max = cheat_manager_state.num_matches-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_COPY_MATCH));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
setting->max = cheat_manager_state.num_matches-1;
|
||||
}
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_ONSCREEN_DISPLAY_SETTINGS_LIST:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
@ -1747,20 +1747,24 @@ void general_write_handler(void *data)
|
||||
case MENU_ENUM_LABEL_CHEAT_MEMORY_SEARCH_SIZE:
|
||||
{
|
||||
rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_VALUE));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
*(setting->value.target.unsigned_integer) = 0 ;
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_RUMBLE_VALUE));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
*setting->value.target.unsigned_integer = 0 ;
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.working_cheat.memory_search_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
int max_bit_position;
|
||||
*setting->value.target.unsigned_integer = 0 ;
|
||||
int max_bit_position = cheat_manager_state.working_cheat.memory_search_size<3 ? 255 : 0 ;
|
||||
setting->max = max_bit_position ;
|
||||
max_bit_position = cheat_manager_state.working_cheat.memory_search_size<3 ? 255 : 0 ;
|
||||
setting->max = max_bit_position ;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1768,17 +1772,20 @@ void general_write_handler(void *data)
|
||||
case MENU_ENUM_LABEL_CHEAT_START_OR_RESTART:
|
||||
{
|
||||
rarch_setting_t *setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EXACT));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
*setting->value.target.unsigned_integer = 0 ;
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQPLUS));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
*setting->value.target.unsigned_integer = 0 ;
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1;
|
||||
}
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_EQMINUS));
|
||||
if ( setting ) {
|
||||
if ( setting )
|
||||
{
|
||||
*setting->value.target.unsigned_integer = 0 ;
|
||||
setting->max = (int) pow(2,pow((double) 2,cheat_manager_state.search_bit_size))-1;
|
||||
}
|
||||
@ -3307,10 +3314,11 @@ static bool setting_append_list(
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
break;
|
||||
case SETTINGS_LIST_CHEAT_DETAILS:
|
||||
{
|
||||
int max_bit_position;
|
||||
if ( ! cheat_manager_state.cheats )
|
||||
{
|
||||
break ;
|
||||
}
|
||||
|
||||
START_GROUP(list, list_info, &group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_DETAILS_SETTINGS), parent_group);
|
||||
|
||||
parent_group = msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_DETAILS_SETTINGS);
|
||||
@ -3389,7 +3397,7 @@ static bool setting_append_list(
|
||||
setting_uint_action_left_default,setting_uint_action_right_default,
|
||||
0,&setting_get_string_representation_hex_and_uint,0,cheat_manager_state.total_memory_size==0?0:cheat_manager_state.total_memory_size-1,1) ;
|
||||
|
||||
int max_bit_position = cheat_manager_state.working_cheat.memory_search_size<3 ? 255 : 0 ;
|
||||
max_bit_position = cheat_manager_state.working_cheat.memory_search_size<3 ? 255 : 0 ;
|
||||
config_uint_cbs(cheat_manager_state.working_cheat.address_mask, CHEAT_ADDRESS_BIT_POSITION,
|
||||
setting_uint_action_left_default,setting_uint_action_right_default,
|
||||
0,&setting_get_string_representation_hex_and_uint,0,max_bit_position,1) ;
|
||||
@ -3443,12 +3451,12 @@ static bool setting_append_list(
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
}
|
||||
break;
|
||||
case SETTINGS_LIST_CHEAT_SEARCH:
|
||||
if ( ! cheat_manager_state.cheats )
|
||||
{
|
||||
break ;
|
||||
}
|
||||
|
||||
START_GROUP(list, list_info, &group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_SEARCH_SETTINGS), parent_group);
|
||||
|
||||
parent_group = msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_SEARCH_SETTINGS);
|
||||
|
17
retroarch.c
17
retroarch.c
@ -2680,30 +2680,25 @@ static enum runloop_state runloop_check_state(
|
||||
enum menu_action action;
|
||||
bool focused = false;
|
||||
input_bits_t trigger_input = current_input;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
bits_clear_bits(trigger_input.data, old_input.data,
|
||||
ARRAY_SIZE(trigger_input.data));
|
||||
|
||||
action = (enum menu_action)menu_event(¤t_input, &trigger_input);
|
||||
focused = pause_nonactive ? is_focused : true;
|
||||
|
||||
action = (enum menu_action)menu_event(¤t_input, &trigger_input);
|
||||
focused = pause_nonactive ? is_focused : true;
|
||||
focused = focused && !ui_companion_is_on_foreground();
|
||||
|
||||
iter.action = action;
|
||||
|
||||
global_t *global = global_get_ptr();
|
||||
if ( global )
|
||||
{
|
||||
if ( action == old_action )
|
||||
{
|
||||
if ( action == MENU_ACTION_NOOP )
|
||||
{
|
||||
global->menu.noop_press_time = cpu_features_get_time_usec() - global->menu.noop_start_time ;
|
||||
}
|
||||
else
|
||||
{
|
||||
global->menu.action_press_time = cpu_features_get_time_usec() - global->menu.action_start_time ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2712,13 +2707,9 @@ static enum runloop_state runloop_check_state(
|
||||
global->menu.noop_start_time = cpu_features_get_time_usec() ;
|
||||
global->menu.noop_press_time = 0 ;
|
||||
if ( global->menu.prev_action == old_action )
|
||||
{
|
||||
global->menu.action_start_time = global->menu.prev_start_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
global->menu.action_start_time = cpu_features_get_time_usec() ;
|
||||
}
|
||||
global->menu.action_start_time = cpu_features_get_time_usec();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user