(inspired by Firewave)

Removed ui_popup(). Drivers should always be using popmessage() instead (has been this way for a while).
Augmented popmessage() so that you can pass NULL to immediately dismiss any messages.
This commit is contained in:
Aaron Giles 2008-01-03 05:33:59 +00:00
parent 75ba20112c
commit 25eee632f6
8 changed files with 39 additions and 53 deletions

View File

@ -3126,7 +3126,7 @@ static void docop2( int gteop )
}
break;
}
ui_popup_time( 1, "unknown GTE op %08x", gteop );
popmessage( "unknown GTE op %08x", gteop );
logerror( "%08x: unknown GTE op %08x\n", mipscpu.pc, gteop );
mips_stop();
}

View File

@ -1153,18 +1153,26 @@ void CLIB_DECL fatalerror_exitcode(int exitcode, const char *text, ...)
popmessage - pop up a user-visible message
-------------------------------------------------*/
void CLIB_DECL popmessage(const char *text, ...)
void CLIB_DECL popmessage(const char *format, ...)
{
extern void CLIB_DECL ui_popup(const char *text, ...) ATTR_PRINTF(1,2);
va_list arg;
/* if the format is NULL, it is a signal to clear the popmessage */
if (format == NULL)
ui_popup_time(0, " ");
/* otherwise, generate the buffer and call the UI to display the message */
else
{
extern void CLIB_DECL ui_popup(const char *format, ...) ATTR_PRINTF(1,2);
va_list arg;
/* dump to the buffer */
va_start(arg, format);
vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, format, arg);
va_end(arg);
/* dump to the buffer */
va_start(arg, text);
vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, text, arg);
va_end(arg);
/* pop it in the UI */
ui_popup("%s", giant_string_buffer);
/* pop it in the UI */
ui_popup_time((int)strlen(giant_string_buffer) / 40 + 2, "%s", giant_string_buffer);
}
}
@ -1173,7 +1181,7 @@ void CLIB_DECL popmessage(const char *text, ...)
OSD-defined output streams
-------------------------------------------------*/
void CLIB_DECL logerror(const char *text, ...)
void CLIB_DECL logerror(const char *format, ...)
{
running_machine *machine = Machine;
@ -1191,8 +1199,8 @@ void CLIB_DECL logerror(const char *text, ...)
profiler_mark(PROFILER_LOGERROR);
/* dump to the buffer */
va_start(arg, text);
vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, text, arg);
va_start(arg, format);
vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, format, arg);
va_end(arg);
/* log to all callbacks */

View File

@ -369,10 +369,10 @@ void mame_printf_debug(const char *format, ...) ATTR_PRINTF(1,2);
/* ----- miscellaneous bits & pieces ----- */
/* pop-up a user visible message */
void CLIB_DECL popmessage(const char *text,...) ATTR_PRINTF(1,2);
void CLIB_DECL popmessage(const char *format,...) ATTR_PRINTF(1,2);
/* log to the standard error.log file */
void CLIB_DECL logerror(const char *text,...) ATTR_PRINTF(1,2);
void CLIB_DECL logerror(const char *format,...) ATTR_PRINTF(1,2);
/* adds a callback to be called on logerror() */
void add_logerror_callback(running_machine *machine, void (*callback)(running_machine *, const char *));

View File

@ -377,7 +377,7 @@ else
if (input_code_pressed_once(KEYCODE_DEL_PAD))
{
gc_active ^= 1;
if (!gc_active) ui_popup_time(0, " ");
if (!gc_active) popmessage(NULL);
}
if (gc_active)

View File

@ -806,28 +806,6 @@ void ui_draw_text_box(const char *text, int justify, float xpos, float ypos, rgb
}
/*-------------------------------------------------
ui_popup - popup a message for a standard
amount of time
-------------------------------------------------*/
void CLIB_DECL ui_popup(const char *text, ...)
{
int seconds;
va_list arg;
/* extract the text */
va_start(arg,text);
vsprintf(messagebox_text, text, arg);
messagebox_backcolor = UI_FILLCOLOR;
va_end(arg);
/* set a timer */
seconds = (int)strlen(messagebox_text) / 40 + 2;
popup_text_end = osd_ticks() + osd_ticks_per_second() * seconds;
}
/*-------------------------------------------------
ui_popup_time - popup a message for a specific
amount of time

View File

@ -511,7 +511,7 @@ static READ8_HANDLER( dkong_in2_r )
if (!lst && (readinputportbytag("TST") & 0x01))
{
ui_snd = (ui_snd + 1) % 10;
ui_popup("Sound %d", ui_snd);
popmessage("Sound %d", ui_snd);
}
lst = readinputportbytag("TST") & 0x01;
if (ui_snd<8)

View File

@ -1009,7 +1009,7 @@ static UINT16 cop2_hit_prot(void)
// xp = (param1 & 0x00f0) >> 4;
// yp = (param1 & 0x0f00) >> 8;
// ui_popup("%04x %04x",param1,param2);
// popmessage("%04x %04x",param1,param2);
xp = 0;
yp = 0;
@ -1172,7 +1172,7 @@ static WRITE16_HANDLER( cop2_mcu_w )
case (0x420/2):
{
//coin counter write
//ui_popup("%04x",mcu_ram[offset]);
//popmessage("%04x",mcu_ram[offset]);
prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]);
//prot_bcd = mcu_ram[offset] - 0x22;
break;
@ -1205,7 +1205,7 @@ static WRITE16_HANDLER( cop2_mcu_w )
break;
case 0x4100: break;
case 0x41c0: break;
//default: ui_popup("%04x",mcu_ram[offset]);
//default: popmessage("%04x",mcu_ram[offset]);
}
break;
}
@ -1471,7 +1471,7 @@ static READ16_HANDLER( sdgndmrb_cop_mcu_r )
if(offset > (0x500/2) && offset < (0x600/2))
{
logerror("CPU0 PC %06x MCU read offset: %04x\n",activecpu_get_previouspc(),offset*2);
//ui_popup("PC %06x MCU read: %04x",activecpu_get_previouspc(),offset*2);
//popmessage("PC %06x MCU read: %04x",activecpu_get_previouspc(),offset*2);
}
return mcu_ram[offset];
@ -1501,7 +1501,7 @@ static WRITE16_HANDLER( sdgndmrb_cop_mcu_w )
break;
case 0x4100: break;
case 0x41c0: break;
//default: ui_popup("%04x",mcu_ram[offset]);
//default: popmessage("%04x",mcu_ram[offset]);
}
break;
}
@ -1614,7 +1614,7 @@ static WRITE16_HANDLER( sdgndmrb_cop_mcu_w )
case (0x420/2):
{
//coin counter write
//ui_popup("%04x",mcu_ram[offset]);
//popmessage("%04x",mcu_ram[offset]);
prot_bcd[0] = protection_bcd_jsr(mcu_ram[offset]);
//prot_bcd = mcu_ram[offset] - 0x22;
break;
@ -1656,7 +1656,7 @@ static WRITE16_HANDLER( sdgndmrb_cop_mcu_w )
{
case 0xa180:/*do the job [1]*/
{
//ui_popup("%08x %08x %04x",dma_src,dma_dst,dma_size);
//popmessage("%08x %08x %04x",dma_src,dma_dst,dma_size);
/*fix the offset for easier reading*/
dma_src+=4;
//dma_dst+=4;
@ -1842,7 +1842,7 @@ static WRITE16_HANDLER( sdgndmrb_cop_mcu_w )
// default:
// logerror("CPU0 PC %06x MCU write offset: %04x data: %04x\n",activecpu_get_previouspc(),offset*2,data);
// ui_popup("CPU0 PC %06x MCU write offset: %04x data: %04x",activecpu_get_previouspc(),offset*2,data);
// popmessage("CPU0 PC %06x MCU write offset: %04x data: %04x",activecpu_get_previouspc(),offset*2,data);
}
}

View File

@ -319,31 +319,31 @@ VIDEO_UPDATE( legionna )
if (input_code_pressed_once (KEYCODE_Z))
{
dislayer[0] ^= 1;
ui_popup("bg0: %01x",dislayer[0]);
popmessage("bg0: %01x",dislayer[0]);
}
if (input_code_pressed_once (KEYCODE_X))
{
dislayer[1] ^= 1;
ui_popup("bg1: %01x",dislayer[1]);
popmessage("bg1: %01x",dislayer[1]);
}
if (input_code_pressed_once (KEYCODE_C))
{
dislayer[2] ^= 1;
ui_popup("bg2: %01x",dislayer[2]);
popmessage("bg2: %01x",dislayer[2]);
}
if (input_code_pressed_once (KEYCODE_V))
{
dislayer[3] ^= 1;
ui_popup("sprites: %01x",dislayer[3]);
popmessage("sprites: %01x",dislayer[3]);
}
if (input_code_pressed_once (KEYCODE_B))
{
dislayer[4] ^= 1;
ui_popup("text: %01x",dislayer[4]);
popmessage("text: %01x",dislayer[4]);
}
#endif