From 6350ab3302a4bf6cf7b7c6d83f784ab19736fcad Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Fri, 28 Mar 2008 18:59:31 +0000 Subject: [PATCH] Minor cleanup and simplification. Removed palette_config(). --- src/emu/emupal.c | 20 -------------------- src/emu/emupal.h | 3 --- src/emu/video.c | 25 ++++++++++++------------- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/src/emu/emupal.c b/src/emu/emupal.c index ca2fa1418a5..64e1a28a3d2 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -157,26 +157,6 @@ void palette_init(running_machine *machine) } -/*------------------------------------------------- - palette_config - palette initialization that - takes place after the display is created --------------------------------------------------*/ - -void palette_config(running_machine *machine) -{ - int i; - - /* now let the driver modify the initial palette and colortable */ - if (machine->config->init_palette) - (*machine->config->init_palette)(machine, memory_region(REGION_PROMS)); - - /* set the color table base for each graphics element */ - for (i = 0; i < MAX_GFX_ELEMENTS; i++) - if (machine->gfx[i] != NULL) - machine->gfx[i]->color_base = machine->config->gfxdecodeinfo[i].color_codes_start; -} - - /*************************************************************************** SHADOW/HIGHLIGHT CONFIGURATION diff --git a/src/emu/emupal.h b/src/emu/emupal.h index 825de114707..30f7d670ef3 100644 --- a/src/emu/emupal.h +++ b/src/emu/emupal.h @@ -126,9 +126,6 @@ typedef struct _colortable_t colortable_t; /* palette initialization that takes place before the display is created */ void palette_init(running_machine *machine); -/* palette initialization that takes place after the display is created */ -void palette_config(running_machine *machine); - /* ----- shadow/hilight configuration ----- */ diff --git a/src/emu/video.c b/src/emu/video.c index b642f5cce6f..3ed7bfd6edb 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -109,13 +109,11 @@ struct _video_global UINT32 overall_valid_counter; /* number of consecutive valid time periods */ /* configuration */ - UINT8 sleep; /* flag: TRUE if we're allowed to sleep */ UINT8 throttle; /* flag: TRUE if we're currently throttled */ UINT8 fastforward; /* flag: TRUE if we're currently fast-forwarding */ UINT32 seconds_to_run; /* number of seconds to run before quitting */ UINT8 auto_frameskip; /* flag: TRUE if we're automatically frameskipping */ UINT32 speed; /* overall speed (*100) */ - UINT8 update_in_pause; /* flag: TRUE if video is updated while in pause */ /* frameskipping */ UINT8 empty_skip_count; /* number of empty frames we have skipped */ @@ -305,14 +303,12 @@ void video_init(running_machine *machine) memset(&global, 0, sizeof(global)); global.speed_percent = 1.0; - /* extract global configuration settings */ - global.sleep = options_get_bool(mame_options(), OPTION_SLEEP); + /* extract initial execution state from global configuration settings */ + global.speed = original_speed_setting(); global.throttle = options_get_bool(mame_options(), OPTION_THROTTLE); global.auto_frameskip = options_get_bool(mame_options(), OPTION_AUTOFRAMESKIP); global.frameskip_level = options_get_int(mame_options(), OPTION_FRAMESKIP); global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN); - global.speed = original_speed_setting(); - global.update_in_pause = options_get_bool(mame_options(), OPTION_UPDATEINPAUSE); /* set the first screen device as the primary - this will set NULL if screenless */ machine->primary_screen = video_screen_first(machine->config); @@ -326,8 +322,9 @@ void video_init(running_machine *machine) if (machine->config->gfxdecodeinfo != NULL) allocate_graphics(machine, machine->config->gfxdecodeinfo); - /* configure the palette */ - palette_config(machine); + /* call the PALETTE_INIT function */ + if (machine->config->init_palette != NULL) + (*machine->config->init_palette)(machine, memory_region(REGION_PROMS)); /* actually decode the graphics */ if (machine->config->gfxdecodeinfo != NULL) @@ -570,7 +567,7 @@ static void decode_graphics(running_machine *machine, const gfx_decode_entry *gf /* count total graphics elements */ for (i = 0; i < MAX_GFX_ELEMENTS; i++) - if (machine->gfx[i]) + if (machine->gfx[i] != NULL) totalgfx += machine->gfx[i]->total_elements; /* loop over all elements */ @@ -1420,7 +1417,7 @@ void video_frame_update(running_machine *machine, int debug) assert(machine->config != NULL); /* only render sound and video if we're in the running phase */ - if (phase == MAME_PHASE_RUNNING && (!mame_is_paused(machine) || global.update_in_pause)) + if (phase == MAME_PHASE_RUNNING && (!mame_is_paused(machine) || options_get_bool(mame_options(), OPTION_UPDATEINPAUSE))) { int anything_changed = finish_screen_updates(machine); @@ -1870,12 +1867,14 @@ static osd_ticks_t throttle_until_ticks(running_machine *machine, osd_ticks_t ta osd_ticks_t minimum_sleep = osd_ticks_per_second() / 1000; osd_ticks_t current_ticks = osd_ticks(); osd_ticks_t new_ticks; - int allowed_to_sleep; + int allowed_to_sleep = FALSE; /* we're allowed to sleep via the OSD code only if we're configured to do so and we're not frameskipping due to autoframeskip, or if we're paused */ - allowed_to_sleep = mame_is_paused(machine) || - (global.sleep && (!effective_autoframeskip(machine) || effective_frameskip() == 0)); + if (options_get_bool(mame_options(), OPTION_SLEEP) && (!effective_autoframeskip(machine) || effective_frameskip() == 0)) + allowed_to_sleep = TRUE; + if (mame_is_paused(machine)) + allowed_to_sleep = TRUE; /* loop until we reach our target */ profiler_mark(PROFILER_IDLE);