C89_BUILD fixes

This commit is contained in:
twinaphex 2017-06-25 04:05:34 +02:00
parent aaa590c817
commit 5d1cfc47cc
4 changed files with 113 additions and 102 deletions

View File

@ -341,7 +341,7 @@ enum
{ {
SNDRV_PCM_TSTAMP_NONE = 0, SNDRV_PCM_TSTAMP_NONE = 0,
SNDRV_PCM_TSTAMP_ENABLE, SNDRV_PCM_TSTAMP_ENABLE,
SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE
}; };
/** Enumeration of a PCM's hardware parameters. /** Enumeration of a PCM's hardware parameters.
@ -374,7 +374,7 @@ enum pcm_param
PCM_PARAM_BUFFER_TIME, PCM_PARAM_BUFFER_TIME,
PCM_PARAM_BUFFER_SIZE, PCM_PARAM_BUFFER_SIZE,
PCM_PARAM_BUFFER_BYTES, PCM_PARAM_BUFFER_BYTES,
PCM_PARAM_TICK_TIME, PCM_PARAM_TICK_TIME
}; /* enum pcm_param */ }; /* enum pcm_param */
/* channel positions */ /* channel positions */
@ -420,22 +420,19 @@ enum
SNDRV_CHMAP_BC, /* bottom center */ SNDRV_CHMAP_BC, /* bottom center */
SNDRV_CHMAP_BLC, /* bottom left center */ SNDRV_CHMAP_BLC, /* bottom left center */
SNDRV_CHMAP_BRC, /* bottom right center */ SNDRV_CHMAP_BRC, /* bottom right center */
SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC, SNDRV_CHMAP_LAST = SNDRV_CHMAP_BRC
}; };
enum #define SNDRV_PCM_MMAP_OFFSET_DATA 0x00000000
{ #define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000
SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, #define SNDRV_PCM_MMAP_OFFSET_CONTROL 0x81000000
SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
};
enum enum
{ {
SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */
SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW
}; };
typedef unsigned long snd_pcm_uframes_t; typedef unsigned long snd_pcm_uframes_t;
@ -443,7 +440,6 @@ typedef signed long snd_pcm_sframes_t;
typedef int snd_pcm_hw_param_t; typedef int snd_pcm_hw_param_t;
typedef int __bitwise snd_pcm_access_t; typedef int __bitwise snd_pcm_access_t;
typedef int __bitwise snd_pcm_subformat_t; typedef int __bitwise snd_pcm_subformat_t;
typedef int __bitwise snd_pcm_subformat_t;
typedef int __bitwise snd_pcm_state_t; typedef int __bitwise snd_pcm_state_t;
typedef int __bitwise snd_pcm_format_t; typedef int __bitwise snd_pcm_format_t;
@ -1124,10 +1120,12 @@ static int pcm_sync_ptr(struct pcm *pcm, int flags)
static int pcm_hw_mmap_status(struct pcm *pcm) static int pcm_hw_mmap_status(struct pcm *pcm)
{ {
int page_size;
if (pcm->sync_ptr) if (pcm->sync_ptr)
return 0; return 0;
int page_size = sysconf(_SC_PAGE_SIZE); page_size = sysconf(_SC_PAGE_SIZE);
pcm->mmap_status = mmap(NULL, page_size, PROT_READ, MAP_FILE | MAP_SHARED, pcm->mmap_status = mmap(NULL, page_size, PROT_READ, MAP_FILE | MAP_SHARED,
pcm->fd, SNDRV_PCM_MMAP_OFFSET_STATUS); pcm->fd, SNDRV_PCM_MMAP_OFFSET_STATUS);
if (pcm->mmap_status == MAP_FAILED) if (pcm->mmap_status == MAP_FAILED)
@ -1541,7 +1539,7 @@ static int pcm_read(struct pcm *pcm, void *data, unsigned int count)
#endif #endif
static struct pcm bad_pcm = { static struct pcm bad_pcm = {
.fd = -1, -1 /* fd */
}; };
#if 0 #if 0

View File

@ -1965,7 +1965,7 @@ static config_file_t *open_default_config_file(void)
skeleton_conf[0] = '\0'; skeleton_conf[0] = '\0';
// Build a retroarch.cfg path from the global config directory (/etc). /* Build a retroarch.cfg path from the global config directory (/etc). */
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR, fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(skeleton_conf)); file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(skeleton_conf));

View File

@ -73,7 +73,7 @@ static int16_t hidpad_psxadapter_get_axis(void *data, unsigned axis)
struct hidpad_psxadapter_data *device = (struct hidpad_psxadapter_data*)data; struct hidpad_psxadapter_data *device = (struct hidpad_psxadapter_data*)data;
if (!device || axis >= 4 || if (!device || axis >= 4 ||
(device->data[2]==0x7F) )//digital mode detection (device->data[2]==0x7F) ) /* digital mode detection */
return 0; return 0;
switch (axis) switch (axis)
@ -94,7 +94,7 @@ static int16_t hidpad_psxadapter_get_axis(void *data, unsigned axis)
val = (val << 8) - 0x8000; val = (val << 8) - 0x8000;
return (abs(val) > 0x1000) ? val : 0;//hard coded deadzone return (abs(val) > 0x1000) ? val : 0; /* hard coded deadzone */
} }
#define PSX_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */ #define PSX_H_GET(a) (a & 0x0F) /*HAT MASK = 0x0F */
@ -143,7 +143,7 @@ static void hidpad_psxadapter_packet_handler(void *data, uint8_t *packet, uint16
if (button_mapping[i] != NO_BTN) if (button_mapping[i] != NO_BTN)
device->buttons |= (pressed_keys & (1 << i)) ? (UINT64_C(1) << button_mapping[i]) : 0; device->buttons |= (pressed_keys & (1 << i)) ? (UINT64_C(1) << button_mapping[i]) : 0;
if (device->data[2]==0x7F) //digital mode detection if (device->data[2]==0x7F) /* digital mode detection */
{ {
/* We're in digital mode, process the dpad values */ /* We're in digital mode, process the dpad values */
device->buttons |= (device->data[4]==0x00) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0; device->buttons |= (device->data[4]==0x00) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;

View File

@ -629,7 +629,8 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"Bem-vindo ao RetroArch \n" "Bem-vindo ao RetroArch \n"
); );
break; break;
case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: { case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC:
{
/* Work around C89 limitations */ /* Work around C89 limitations */
char u[501]; char u[501];
const char *t = const char *t =
@ -1151,7 +1152,9 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"implementações de núcleo Libretro."); "implementações de núcleo Libretro.");
break; break;
case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO:
snprintf(s, len, {
/* Work around C89 limitations */
const char *t =
"Taxa de Atualização Automática. \n" "Taxa de Atualização Automática. \n"
" \n" " \n"
"A taxa de atualização precisa da tela (Hz). \n" "A taxa de atualização precisa da tela (Hz). \n"
@ -1160,7 +1163,8 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
" \n" " \n"
"taxa de entrada de áudio = taxa de entrada do jogo * taxa \n" "taxa de entrada de áudio = taxa de entrada do jogo * taxa \n"
"de atualização da tela / taxa de atualização do jogo \n" "de atualização da tela / taxa de atualização do jogo \n"
" \n" " \n";
const char *u =
"Se a implementação não reportar nenhum \n" "Se a implementação não reportar nenhum \n"
"valor, os padrões NTSC serão usados para \n" "valor, os padrões NTSC serão usados para \n"
"garantir compatibilidade.\n" "garantir compatibilidade.\n"
@ -1168,7 +1172,10 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"Este valor deve ficar próximo de 60Hz para evitar \n" "Este valor deve ficar próximo de 60Hz para evitar \n"
"mudanças bruscas de timbre de som. Se seu monitor não \n" "mudanças bruscas de timbre de som. Se seu monitor não \n"
"roda a 60Hz, ou próximo disso, \n" "roda a 60Hz, ou próximo disso, \n"
"desative o VSync, e deixe este valor no padrão."); "desative o VSync, e deixe este valor no padrão.";
strlcpy(s, t, len);
strlcat(s, u, len);
}
break; break;
case MENU_ENUM_LABEL_VIDEO_ROTATION: case MENU_ENUM_LABEL_VIDEO_ROTATION:
snprintf(s, len, snprintf(s, len,
@ -1580,20 +1587,26 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"haverá oscilação no Netplay. \n"); "haverá oscilação no Netplay. \n");
break; break;
case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES: case MENU_ENUM_LABEL_NETPLAY_CHECK_FRAMES:
snprintf(s, len, {
/* Work around C89 limitations */
const char *t =
"A frequência em quadros na qual o Netplay \n" "A frequência em quadros na qual o Netplay \n"
"irá verificar se o hospedeiro e o cliente \n" "irá verificar se o hospedeiro e o cliente \n"
"estão sincronizados. \n" "estão sincronizados. \n"
" \n" " \n"
"Com a maioria dos núcleos, este valor não terá \n" "Com a maioria dos núcleos, este valor não terá \n"
"efeito perceptível e pode ser ignorado. Com \n" "efeito perceptível e pode ser ignorado. Com \n";
const char *u =
"núcleos não determinísticos, este valor define \n" "núcleos não determinísticos, este valor define \n"
"quão frequente os pares do Netplay serão colocados \n" "quão frequente os pares do Netplay serão colocados \n"
"em sincronia. Com núcleos defeituosos, definir para \n" "em sincronia. Com núcleos defeituosos, definir para \n"
"qualquer valor que não zero irá causar problemas \n" "qualquer valor que não zero irá causar problemas \n"
"de desempenho severos. Defina como zero para desativar \n" "de desempenho severos. Defina como zero para desativar \n"
"verificações. Este valor é usado somente no \n" "verificações. Este valor é usado somente no \n"
"hospedeiro de Netplay. \n"); "hospedeiro de Netplay. \n";
strlcpy(s, t, len);
strlcat(s, u, len);
}
break; break;
case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN: case MENU_ENUM_LABEL_NETPLAY_INPUT_LATENCY_FRAMES_MIN:
snprintf(s, len, snprintf(s, len,