C89_BUILD fixes

This commit is contained in:
twinaphex 2018-08-01 01:27:30 +02:00
parent aec7ed40da
commit 5b9115c848
4 changed files with 30 additions and 26 deletions

View File

@ -264,23 +264,26 @@ static bool command_read_ram(const char *arg)
{
cheevos_var_t var;
unsigned i;
char *reply = NULL;
const uint8_t * data = NULL;
char *reply_at = NULL;
unsigned int nbytes = 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;
int addr = -1;
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);
var.value = addr;
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);
var.value = addr;
cheevos_var_patch_addr(&var, cheevos_get_console());
data = cheevos_var_get_memory(&var);
data = cheevos_var_get_memory(&var);
if (data)
{

View File

@ -922,7 +922,7 @@ void fill_pathname_join_delim(char *out_path, const char *dir,
const char *path, const char delim, size_t size)
{
size_t copied;
// behavior of strlcpy is undefined if dst and src overlap
/* behavior of strlcpy is undefined if dst and src overlap */
if (out_path == dir)
copied = strlen(dir);
else

View File

@ -52,7 +52,7 @@ enum cheat_search_type
CHEAT_SEARCH_TYPE_EQ,
CHEAT_SEARCH_TYPE_NEQ,
CHEAT_SEARCH_TYPE_EQPLUS,
CHEAT_SEARCH_TYPE_EQMINUS,
CHEAT_SEARCH_TYPE_EQMINUS
};
enum cheat_match_action_type
@ -113,19 +113,19 @@ struct item_cheat
* 1 : 11110000
*/
unsigned int address_mask ;
//Whether to apply the cheat based on big-endian console memory or not
/* Whether to apply the cheat based on big-endian console memory or not */
bool big_endian ;
unsigned int rumble_type ;
unsigned int rumble_value ;
unsigned int rumble_prev_value ;
unsigned int rumble_initialized ;
unsigned int rumble_port ; //0-15 for specific port, anything else means "all ports"
unsigned int rumble_primary_strength ; //0-65535
unsigned int rumble_primary_duration ; //in milliseconds
retro_time_t rumble_primary_end_time ; //clock value for when rumbling should stop
unsigned int rumble_secondary_strength ; //0-65535
unsigned int rumble_secondary_duration ; //in milliseconds
retro_time_t rumble_secondary_end_time ; //clock value for when rumbling should stop
unsigned int rumble_port ; /* 0-15 for specific port, anything else means "all ports" */
unsigned int rumble_primary_strength ; /* 0-65535 */
unsigned int rumble_primary_duration ; /* in milliseconds */
retro_time_t rumble_primary_end_time ; /* clock value for when rumbling should stop */
unsigned int rumble_secondary_strength ; /* 0-65535 */
unsigned int rumble_secondary_duration ; /* in milliseconds */
retro_time_t rumble_secondary_end_time ; /* clock value for when rumbling should stop */
};
struct cheat_manager

View File

@ -2713,16 +2713,17 @@ static enum runloop_state runloop_check_state(
}
else
{
if ( global->menu.prev_action == action && global->menu.noop_press_time < 200000) //250ms
if ( global->menu.prev_action == action &&
global->menu.noop_press_time < 200000) /* 250ms */
{
global->menu.action_start_time = global->menu.prev_start_time ;
global->menu.action_start_time = global->menu.prev_start_time ;
global->menu.action_press_time = cpu_features_get_time_usec() - global->menu.action_start_time;
}
else
{
global->menu.prev_start_time = cpu_features_get_time_usec() ;
global->menu.prev_action = action ;
global->menu.action_press_time = 0 ;
global->menu.prev_start_time = cpu_features_get_time_usec() ;
global->menu.prev_action = action;
global->menu.action_press_time = 0;
}
}
}