mirror of
https://github.com/holub/mame
synced 2025-04-21 16:01:56 +03:00
This updates makes the text displayed by the various UI sliders more intelligent. Basically, it will only print an index for an item if there are multiple of a given type
This commit is contained in:
parent
3f1caeac76
commit
13b727a2c3
@ -50,8 +50,8 @@ typedef struct _sndintrf_data sndintrf_data;
|
||||
struct _sndintrf_data
|
||||
{
|
||||
sound_interface intf; /* copy of the interface data */
|
||||
sound_type sndtype; /* type index of this sound chip */
|
||||
sound_type aliastype; /* aliased type index of this sound chip */
|
||||
sound_type sndtype; /* type index of this sound chip */
|
||||
sound_type aliastype; /* aliased type index of this sound chip */
|
||||
int index; /* index of this sound chip */
|
||||
int clock; /* clock for this sound chip */
|
||||
void * token; /* dynamically allocated token data */
|
||||
@ -185,7 +185,7 @@ static sound_interface sndintrf[SOUND_COUNT];
|
||||
static const struct
|
||||
{
|
||||
sound_type sndtype;
|
||||
void (*get_info)(void *token, UINT32 state, sndinfo *info);
|
||||
void (*get_info)(void *token, UINT32 state, sndinfo *info);
|
||||
} sndintrf_map[] =
|
||||
{
|
||||
{ SOUND_DUMMY, dummy_sound_get_info },
|
||||
@ -673,6 +673,24 @@ sound_type sndnum_to_sndti(int sndnum, int *index)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
sndtype_count - count the number of a
|
||||
given type
|
||||
-------------------------------------------------*/
|
||||
|
||||
int sndtype_count(sound_type sndtype)
|
||||
{
|
||||
int index;
|
||||
int count = 0;
|
||||
|
||||
for (index = 0; index < totalsnd; index++)
|
||||
if (sound[index].sndtype == sndtype)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CHIP INTERFACES BY INDEX
|
||||
|
@ -290,6 +290,7 @@ void sndintrf_register_token(void *token);
|
||||
int sndti_exists(sound_type sndtype, int sndindex);
|
||||
int sndti_to_sndnum(sound_type type, int index);
|
||||
sound_type sndnum_to_sndti(int sndnum, int *index);
|
||||
int sndtype_count(sound_type sndtype);
|
||||
|
||||
|
||||
#endif /* __SNDINTRF_H__ */
|
||||
|
@ -473,12 +473,33 @@ static void route_sound(void)
|
||||
char namebuf[256];
|
||||
int index;
|
||||
|
||||
sndnum_to_sndti(sndnum, &index);
|
||||
sound_type sndtype = sndnum_to_sndti(sndnum, &index);
|
||||
|
||||
/* built the display name */
|
||||
namebuf[0] = '\0';
|
||||
|
||||
/* speaker name, if more than one speaker */
|
||||
if (totalspeakers > 1)
|
||||
sprintf(namebuf, "%sSpeaker '%s': ", namebuf, speaker->speaker->tag);
|
||||
|
||||
/* device name */
|
||||
sprintf(namebuf, "%s%s ", namebuf, sndnum_name(sndnum));
|
||||
|
||||
/* device index, if more than one of this type */
|
||||
if (sndtype_count(sndtype) > 1)
|
||||
sprintf(namebuf, "%s#%d ", namebuf, index);
|
||||
|
||||
/* channel number, if more than channel for this device */
|
||||
if (info->outputs > 1)
|
||||
sprintf(namebuf, "%sCh.%d", namebuf, outputnum);
|
||||
|
||||
/* remove final space */
|
||||
if (namebuf[strlen(namebuf) - 1] == ' ')
|
||||
namebuf[strlen(namebuf) - 1] = '\0';
|
||||
|
||||
/* fill in the input data on this speaker */
|
||||
speaker->input[speaker->inputs].gain = mroute->gain;
|
||||
speaker->input[speaker->inputs].default_gain = mroute->gain;
|
||||
sprintf(namebuf, "%s:%s #%d.%d", speaker->speaker->tag, sndnum_name(sndnum), index, outputnum);
|
||||
speaker->input[speaker->inputs].name = auto_strdup(namebuf);
|
||||
|
||||
/* connect the output to the input */
|
||||
@ -502,7 +523,7 @@ static void route_sound(void)
|
||||
if (mroute->output == outputnum)
|
||||
stream_set_input(sound->output[0].stream, mroute->input, info->output[outputnum].stream, info->output[outputnum].output, mroute->gain);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
43
src/emu/ui.c
43
src/emu/ui.c
@ -154,6 +154,7 @@ static INT32 slider_xoffset(INT32 newval, char *buffer, int arg);
|
||||
static INT32 slider_yoffset(INT32 newval, char *buffer, int arg);
|
||||
static INT32 slider_flicker(INT32 newval, char *buffer, int arg);
|
||||
static INT32 slider_beam(INT32 newval, char *buffer, int arg);
|
||||
static char *slider_get_screen_desc(int arg);
|
||||
#ifdef MAME_DEBUG
|
||||
static INT32 slider_crossscale(INT32 newval, char *buffer, int arg);
|
||||
static INT32 slider_crossoffset(INT32 newval, char *buffer, int arg);
|
||||
@ -1655,7 +1656,7 @@ static INT32 slider_volume(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
sound_set_attenuation(newval);
|
||||
sprintf(buffer, "Volume %3ddB", sound_get_attenuation());
|
||||
sprintf(buffer, "Master Volume %3ddB", sound_get_attenuation());
|
||||
}
|
||||
return sound_get_attenuation();
|
||||
}
|
||||
@ -1723,7 +1724,7 @@ static INT32 slider_refresh(INT32 newval, char *buffer, int arg)
|
||||
{
|
||||
screen_state *state = &Machine->screen[arg];
|
||||
video_screen_configure(arg, state->width, state->height, &state->visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001));
|
||||
sprintf(buffer, "Screen %d Refresh rate %.3f", arg, ATTOSECONDS_TO_HZ(Machine->screen[arg].refresh));
|
||||
sprintf(buffer, "%s Refresh rate %.3f", slider_get_screen_desc(arg), ATTOSECONDS_TO_HZ(Machine->screen[arg].refresh));
|
||||
}
|
||||
refresh = ATTOSECONDS_TO_HZ(Machine->screen[arg].refresh);
|
||||
return floor((refresh - defrefresh) * 1000.0f + 0.5f);
|
||||
@ -1741,7 +1742,7 @@ static INT32 slider_brightness(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_brightness(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d Brightness %.3f", arg, render_container_get_brightness(container));
|
||||
sprintf(buffer, "%s Brightness %.3f", slider_get_screen_desc(arg), render_container_get_brightness(container));
|
||||
}
|
||||
return floor(render_container_get_brightness(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1758,7 +1759,7 @@ static INT32 slider_contrast(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_contrast(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d Contrast %.3f", arg, render_container_get_contrast(container));
|
||||
sprintf(buffer, "%s Contrast %.3f", slider_get_screen_desc(arg), render_container_get_contrast(container));
|
||||
}
|
||||
return floor(render_container_get_contrast(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1774,7 +1775,7 @@ static INT32 slider_gamma(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_gamma(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d Gamma %.3f", arg, render_container_get_gamma(container));
|
||||
sprintf(buffer, "%s Gamma %.3f", slider_get_screen_desc(arg), render_container_get_gamma(container));
|
||||
}
|
||||
return floor(render_container_get_gamma(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1791,7 +1792,7 @@ static INT32 slider_xscale(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_xscale(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d %s %.3f", arg, "Horiz stretch", render_container_get_xscale(container));
|
||||
sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(arg), "Horiz Stretch", render_container_get_xscale(container));
|
||||
}
|
||||
return floor(render_container_get_xscale(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1808,7 +1809,7 @@ static INT32 slider_yscale(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_yscale(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d %s %.3f", arg, "Vert stretch", render_container_get_yscale(container));
|
||||
sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(arg), "Vert Stretch", render_container_get_yscale(container));
|
||||
}
|
||||
return floor(render_container_get_yscale(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1825,7 +1826,7 @@ static INT32 slider_xoffset(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_xoffset(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d %s %.3f", arg, "Horiz position", render_container_get_xoffset(container));
|
||||
sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(arg), "Horiz Position", render_container_get_xoffset(container));
|
||||
}
|
||||
return floor(render_container_get_xoffset(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1842,7 +1843,7 @@ static INT32 slider_yoffset(INT32 newval, char *buffer, int arg)
|
||||
if (buffer != NULL)
|
||||
{
|
||||
render_container_set_yoffset(container, (float)newval * 0.001f);
|
||||
sprintf(buffer, "Screen %d %s %.3f", arg, "Vert position", render_container_get_yoffset(container));
|
||||
sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(arg), "Vert Position", render_container_get_yoffset(container));
|
||||
}
|
||||
return floor(render_container_get_yoffset(container) * 1000.0f + 0.5f);
|
||||
}
|
||||
@ -1880,6 +1881,30 @@ static INT32 slider_beam(INT32 newval, char *buffer, int arg)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
slider_get_screen_desc - returns the
|
||||
description for a given screen index
|
||||
-------------------------------------------------*/
|
||||
|
||||
static char *slider_get_screen_desc(int arg)
|
||||
{
|
||||
static char descbuf[256];
|
||||
int item;
|
||||
int screen_count = 0;
|
||||
|
||||
for (item = 0; item < MAX_SCREENS; item++)
|
||||
if (Machine->drv->screen[item].tag != NULL)
|
||||
screen_count++;
|
||||
|
||||
if (screen_count > 1)
|
||||
sprintf(descbuf, "Screen #%d", arg);
|
||||
else
|
||||
strcpy(descbuf, "Screen");
|
||||
|
||||
return descbuf;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
slider_crossscale - crosshair scale slider
|
||||
callback
|
||||
|
Loading…
Reference in New Issue
Block a user