diff -Nru old/emu/cheat.c src/emu/cheat.c --- old/emu/cheat.c 2008-07-06 11:49:28.000000000 -0500 +++ src/emu/cheat.c 2008-07-08 09:05:02.000000000 -0500 @@ -841,6 +841,9 @@ GLOBAL VARIABLES ***************************************************************************/ +// MKCHAMP - ADD VARIABLE SO HIGH SCORES AREN'T SAVED IF CHEAT IS ENABLED +int he_did_cheat = 0; + static const char *cheat_file; static emu_timer *periodic_timer; @@ -1995,6 +1998,8 @@ void cheat_init(running_machine *machine) { /* initialize lists */ + //MKCHAMP - DEFAULTING he_did_cheat to 0 + he_did_cheat = 0; cheat_list = NULL; cheat_list_length = 0; @@ -11962,6 +11967,8 @@ /* set activate flag */ entry->flags |= kCheatFlag_Active; + //MKCHAMP - CHEATS ARE ACTIVATED...SETTING he_did_cheat to 1 SO HIGH SCORES AREN'T SAVED + he_did_cheat = 1; } /*-------------------------------------------------------- diff -Nru old/emu/cheat.h src/emu/cheat.h --- old/emu/cheat.h 2008-06-23 01:32:44.000000000 -0500 +++ src/emu/cheat.h 2008-07-08 09:05:02.000000000 -0500 @@ -16,6 +16,9 @@ #include "mamecore.h" +//MKCHAMP - DECLARING he_did_cheat SO HIGH SCORES AREN'T SAVED IF CHEATS ARE ENABLED +extern int he_did_cheat; + void cheat_init(running_machine *machine); int cheat_menu(running_machine *machine, int selection); diff -Nru old/emu/crsshair.c src/emu/crsshair.c --- old/emu/crsshair.c 2008-05-15 09:25:04.000000000 -0500 +++ src/emu/crsshair.c 2008-07-08 09:05:02.000000000 -0500 @@ -202,7 +202,9 @@ /* mark as used and visible */ global.used[player] = TRUE; - global.visible[player] = TRUE; + /*MKCHAMP - DISABLING CROSSHAIRS BY DEFAULT + global.visible[player] = TRUE;*/ + global.visible[player] = FALSE; /* for now, use the main screen */ global.screen[player] = machine->primary_screen; diff -Nru old/emu/emu.mak src/emu/emu.mak --- old/emu/emu.mak 2008-06-26 07:51:24.000000000 -0500 +++ src/emu/emu.mak 2008-07-08 09:05:02.000000000 -0500 @@ -33,6 +33,7 @@ #------------------------------------------------- # emulator core objects +# MKCHAMP - ADDED hiscore.o TO LIST TO COMPILE THE HISCORE PIECE #------------------------------------------------- EMUOBJS = \ @@ -53,6 +54,7 @@ $(EMUOBJ)/emupal.o \ $(EMUOBJ)/fileio.o \ $(EMUOBJ)/hash.o \ + $(EMUOBJ)/hiscore.o \ $(EMUOBJ)/info.o \ $(EMUOBJ)/input.o \ $(EMUOBJ)/inputseq.o \ diff -Nru old/emu/emuopts.c src/emu/emuopts.c --- old/emu/emuopts.c 2008-06-26 09:51:20.000000000 -0500 +++ src/emu/emuopts.c 2008-07-08 09:05:02.000000000 -0500 @@ -57,6 +57,8 @@ /* filename options */ { NULL, NULL, OPTION_HEADER, "CORE FILENAME OPTIONS" }, { "cheat_file", "cheat.dat", 0, "cheat filename" }, + //MKCHAMP - ADDING CFG OPTION TO SPECIFY HISCORE DIRECTORY..."hi" BY DEFAULT + { "hiscore_directory", "hi", 0, "directory to save hiscores" }, /* state/playback options */ { NULL, NULL, OPTION_HEADER, "CORE STATE/PLAYBACK OPTIONS" }, diff -Nru old/emu/emuopts.h src/emu/emuopts.h --- old/emu/emuopts.h 2008-06-16 09:34:52.000000000 -0500 +++ src/emu/emuopts.h 2008-07-08 09:05:02.000000000 -0500 @@ -57,6 +57,8 @@ /* core filename options */ #define OPTION_CHEAT_FILE "cheat_file" +//MKCHAMP - DECLARING THE DIRECTORY OPTION FOR HIGH SCORES TO BE SAVED TO +#define OPTION_HISCORE_DIRECTORY "hiscore_directory" /* core state/playback options */ #define OPTION_STATE "state" diff -Nru old/emu/fileio.h src/emu/fileio.h --- old/emu/fileio.h 2008-05-12 20:02:12.000000000 -0500 +++ src/emu/fileio.h 2008-07-08 09:05:02.000000000 -0500 @@ -55,6 +55,8 @@ #define SEARCHPATH_SCREENSHOT OPTION_SNAPSHOT_DIRECTORY #define SEARCHPATH_MOVIE OPTION_SNAPSHOT_DIRECTORY #define SEARCHPATH_COMMENT OPTION_COMMENT_DIRECTORY +//MKCHAMP - DEFINING THE HIGHSCORE DIRECTORY OPTION +#define FILETYPE_HIGHSCORE OPTION_HISCORE_DIRECTORY diff -Nru old/emu/hiscore.c src/emu/hiscore.c --- old/emu/hiscore.c 1969-12-31 18:00:00.000000000 -0600 +++ src/emu/hiscore.c 2008-07-08 09:05:02.000000000 -0500 @@ -0,0 +1,521 @@ +/*************************************************************************** + + hiscore.c + + Manages the hiscore system. + + Copyright (c) 1996-2006, Nicola Salmoria and the MAME Team. + Visit http://mamedev.org for licensing and usage restrictions. + +***************************************************************************/ + +#include "driver.h" +#include "hiscore.h" +#include "cheat.h" +#include "deprecat.h" + +#define MAX_CONFIG_LINE_SIZE 48 + +#define VERBOSE 0 + +#define DIGITAL_JOYSTICKS_PER_PLAYER 3 + +static emu_timer *timer; + +#if VERBOSE +#define LOG(x) logerror x +#else +#define LOG(x) +#endif + +const char *db_filename = "hiscore.dat"; /* high score definition file */ + + +struct _memory_range +{ + UINT32 cpu, addr, num_bytes, start_value, end_value; + struct _memory_range *next; +}; +typedef struct _memory_range memory_range; + + +static struct +{ + int hiscores_have_been_loaded; + memory_range *mem_range; +} state; + +/* live analog field information */ +typedef struct _analog_field_state analog_field_state; +struct _analog_field_state +{ + analog_field_state * next; /* link to the next analog state for this port */ + const input_field_config * field; /* pointer to the input field referenced */ + + /* adjusted values (right-justified and tweaked) */ + UINT8 shift; /* shift to align final value in the port */ + INT32 adjdefvalue; /* adjusted default value from the config */ + INT32 adjmin; /* adjusted minimum value from the config */ + INT32 adjmax; /* adjusted maximum value from the config */ + + /* live values of configurable parameters */ + INT32 sensitivity; /* current live sensitivity (100=normal) */ + UINT8 reverse; /* current live reverse flag */ + INT32 delta; /* current live delta to apply each frame a digital inc/dec key is pressed */ + INT32 centerdelta; /* current live delta to apply each frame no digital inputs are pressed */ + + /* live analog value tracking */ + INT32 accum; /* accumulated value (including relative adjustments) */ + INT32 previous; /* previous adjusted value */ + INT32 previousanalog; /* previous analog value */ + + /* parameters for modifying live values */ + INT32 minimum; /* minimum adjusted value */ + INT32 maximum; /* maximum adjusted value */ + INT32 center; /* center adjusted value for autocentering */ + INT32 reverse_val; /* value where we subtract from to reverse directions */ + + /* scaling factors */ + INT64 scalepos; /* scale factor to apply to positive adjusted values */ + INT64 scaleneg; /* scale factor to apply to negative adjusted values */ + INT64 keyscalepos; /* scale factor to apply to the key delta field when pos */ + INT64 keyscaleneg; /* scale factor to apply to the key delta field when neg */ + INT64 positionalscale; /* scale factor to divide a joystick into positions */ + + /* misc flags */ + UINT8 absolute; /* is this an absolute or relative input? */ + UINT8 wraps; /* does the control wrap around? */ + UINT8 autocenter; /* autocenter this input? */ + UINT8 single_scale; /* scale joystick differently if default is between min/max */ + UINT8 interpolate; /* should we do linear interpolation for mid-frame reads? */ + UINT8 lastdigital; /* was the last modification caused by a digital form? */ +}; + + +/* shared digital joystick state */ +typedef struct _digital_joystick_state digital_joystick_state; +struct _digital_joystick_state +{ + const input_field_config * field[4]; /* input field for up, down, left, right respectively */ + UINT8 inuse; /* is this joystick used? */ + UINT8 current; /* current value */ + UINT8 current4way; /* current 4-way value */ + UINT8 previous; /* previous value */ +}; + + +/* live custom/changed field information */ +typedef struct _callback_field_info callback_field_info; +struct _callback_field_info +{ + callback_field_info * next; /* linked list of info for this port */ + const input_field_config * field; /* pointer to the input field referenced */ + UINT8 shift; /* shift to apply to the final result */ +}; + + +/* internal live state of an input field */ +struct _input_field_state +{ + analog_field_state * analog; /* pointer to live analog data if this is an analog field */ + digital_joystick_state * joystick; /* pointer to digital joystick information */ + input_seq seq[SEQ_TYPE_TOTAL];/* currently configured input sequences */ + input_port_value value; /* current value of this port */ + UINT8 impulse; /* counter for impulse controls */ + UINT8 last; /* were we pressed last time? */ + UINT8 toggle; /* current toggle state */ + UINT8 joydir; /* digital joystick direction index */ +}; + + +/* internal live state of an input port */ +struct _input_port_state +{ + analog_field_state * analoglist; /* pointer to list of analog port info */ + callback_field_info * customlist; /* pointer to list of custom port info */ + callback_field_info * changedlist; /* pointer to list of changed port info */ + input_port_value defvalue; /* combined default value across the port */ + input_port_value digital; /* current value from all digital inputs */ + input_port_value vblank; /* value of all IPT_VBLANK bits */ + input_port_value lastvalue; /* last value of the port, to detect changes */ +}; + + +/* internal live state of an input type */ +typedef struct _input_type_state input_type_state; +struct _input_type_state +{ + input_type_state * next; /* pointer to the next live state in the list */ + input_type_desc typedesc; /* copy of the original description, modified by the OSD */ + input_seq seq[SEQ_TYPE_TOTAL];/* currently configured sequences */ +}; + + +/* private input port state */ +struct _input_port_private +{ + /* types */ + input_type_state * typestatelist; /* list of live type states */ + input_type_state * type_to_typestate[__ipt_max][MAX_PLAYERS]; /* map from type/player to type state */ + + /* specific special global input states */ + digital_joystick_state joystick_info[MAX_PLAYERS][DIGITAL_JOYSTICKS_PER_PLAYER]; /* joystick states */ + osd_ticks_t ui_memory[__ipt_max];/* keypress timing for UI */ + + /* frame time tracking */ + attotime last_frame_time; /* time of the last frame callback */ + attoseconds_t last_delta_nsec; /* nanoseconds that passed since the previous callback */ + + /* playback/record information */ + mame_file * record_file; /* recording file (NULL if not recording) */ + mame_file * playback_file; /* playback file (NULL if not recording) */ + UINT64 playback_accumulated_speed;/* accumulated speed during playback */ + UINT32 playback_accumulated_frames;/* accumulated frames during playback */ +}; + + +static int is_highscore_enabled(running_machine *machine) +{ + input_port_private *portdata = machine->input_port_data; + /* disable high score when record/playback is on */ + if (portdata->record_file != NULL || portdata->playback_file != NULL) + return FALSE; + + /* disable high score when cheats are used */ + if (he_did_cheat != 0) + return FALSE; + + return TRUE; +} + + + +/*****************************************************************************/ + +static void copy_to_memory (int cpu, int addr, const UINT8 *source, int num_bytes) +{ + int i; + for (i=0; i='0' && c<='9') + { + digit = c-'0'; + } + else if (c>='a' && c<='f') + { + digit = 10+c-'a'; + } + else if (c>='A' && c<='F') + { + digit = 10+c-'A'; + } + else + { + /* not a hexadecimal digit */ + /* safety check for premature EOL */ + if (!c) string = NULL; + break; + } + result = result*16 + digit; + } + *pString = string; + } + return result; +} + +/* given a line in the hiscore.dat file, determine if it encodes a + memory range (or a game name). + For now we assume that CPU number is always a decimal digit, and + that no game name starts with a decimal digit. +*/ +static int is_mem_range (const char *pBuf) +{ + char c; + for(;;) + { + c = *pBuf++; + if (c == 0) return 0; /* premature EOL */ + if (c == ':') break; + } + c = *pBuf; /* character following first ':' */ + + return (c>='0' && c<='9') || + (c>='a' && c<='f') || + (c>='A' && c<='F'); +} + +/* matching_game_name is used to skip over lines until we find : */ +static int matching_game_name (const char *pBuf, const char *name) +{ + while (*name) + { + if (*name++ != *pBuf++) return 0; + } + return (*pBuf == ':'); +} + +/*****************************************************************************/ + +/* safe_to_load checks the start and end values of each memory range */ +static int safe_to_load (void) +{ + memory_range *mem_range = state.mem_range; + while (mem_range) + { + if (cpunum_read_byte (mem_range->cpu, mem_range->addr) != + mem_range->start_value) + { + return 0; + } + if (cpunum_read_byte (mem_range->cpu, mem_range->addr + mem_range->num_bytes - 1) != + mem_range->end_value) + { + return 0; + } + mem_range = mem_range->next; + } + return 1; +} + +/* hiscore_free disposes of the mem_range linked list */ +static void hiscore_free (void) +{ + memory_range *mem_range = state.mem_range; + while (mem_range) + { + memory_range *next = mem_range->next; + free (mem_range); + mem_range = next; + } + state.mem_range = NULL; +} + +static void hiscore_load (running_machine *machine) +{ + file_error filerr; + mame_file *f; + astring *fname; + if (is_highscore_enabled(machine)) + { + fname = astring_assemble_2(astring_alloc(), Machine->gamedrv->name, ".hi"); + filerr = mame_fopen(FILETYPE_HIGHSCORE, astring_c(fname), OPEN_FLAG_READ, &f); + astring_free(fname); + state.hiscores_have_been_loaded = 1; + LOG(("hiscore_load\n")); + if (filerr == FILERR_NONE) + { + memory_range *mem_range = state.mem_range; + LOG(("loading...\n")); + while (mem_range) + { + UINT8 *data = malloc (mem_range->num_bytes); + if (data) + { + /* this buffer will almost certainly be small + enough to be dynamically allocated, but let's + avoid memory trashing just in case + */ + mame_fread (f, data, mem_range->num_bytes); + copy_to_memory (mem_range->cpu, mem_range->addr, data, mem_range->num_bytes); + free (data); + } + mem_range = mem_range->next; + } + mame_fclose (f); + } + } +} + +static void hiscore_save (running_machine *machine) +{ + file_error filerr; + mame_file *f; + astring *fname; + if (is_highscore_enabled(machine)) + { + fname = astring_assemble_2(astring_alloc(), Machine->gamedrv->name, ".hi"); + filerr = mame_fopen(FILETYPE_HIGHSCORE, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &f); + astring_free(fname); + LOG(("hiscore_save\n")); + if (filerr == FILERR_NONE) + { + memory_range *mem_range = state.mem_range; + LOG(("saving...\n")); + while (mem_range) + { + UINT8 *data = malloc (mem_range->num_bytes); + if (data) + { + /* this buffer will almost certainly be small + enough to be dynamically allocated, but let's + avoid memory trashing just in case + */ + copy_from_memory (mem_range->cpu, mem_range->addr, data, mem_range->num_bytes); + mame_fwrite(f, data, mem_range->num_bytes); + free (data); + } + mem_range = mem_range->next; + } + mame_fclose(f); + } + } +} + + +/* call hiscore_update periodically (i.e. once per frame) */ +static void hiscore_periodic (int param, running_machine *machine) +{ + if (state.mem_range) + { + if (!state.hiscores_have_been_loaded) + { + if (safe_to_load()) + { + hiscore_load(machine); + timer_enable(timer, FALSE); + } + } + } +} + +static TIMER_CALLBACK( hiscore_periodic_callback ) +{ + hiscore_periodic(param,machine); +} + + +/* call hiscore_close when done playing game */ +void hiscore_close (running_machine *machine) +{ + if (state.hiscores_have_been_loaded) hiscore_save(machine); + hiscore_free(); +} + + +/*****************************************************************************/ +/* public API */ + +/* call hiscore_open once after loading a game */ +void hiscore_init (running_machine *machine) +{ + file_error filerr; + const char *name = machine->gamedrv->name; + memory_range *mem_range = state.mem_range; + mame_file *f; + state.hiscores_have_been_loaded = 0; + + while (mem_range) + { + cpunum_write_byte( + mem_range->cpu, + mem_range->addr, + ~mem_range->start_value + ); + + cpunum_write_byte( + mem_range->cpu, + mem_range->addr + mem_range->num_bytes-1, + ~mem_range->end_value + ); + mem_range = mem_range->next; + } + + state.mem_range = NULL; + filerr = mame_fopen(NULL, db_filename, OPEN_FLAG_READ, &f); + if (filerr == FILERR_NONE) + { + char buffer[MAX_CONFIG_LINE_SIZE]; + enum { FIND_NAME, FIND_DATA, FETCH_DATA } mode; + mode = FIND_NAME; + + while (mame_fgets (buffer, MAX_CONFIG_LINE_SIZE, f)) + { + if (mode==FIND_NAME) + { + if (matching_game_name (buffer, name)) + { + mode = FIND_DATA; + LOG(("hs config found!\n")); + } + } + else if (is_mem_range (buffer)) + { + const char *pBuf = buffer; + memory_range *mem_range = malloc(sizeof(memory_range)); + if (mem_range) + { + mem_range->cpu = hexstr2num (&pBuf); + mem_range->addr = hexstr2num (&pBuf); + mem_range->num_bytes = hexstr2num (&pBuf); + mem_range->start_value = hexstr2num (&pBuf); + mem_range->end_value = hexstr2num (&pBuf); + + mem_range->next = NULL; + { + memory_range *last = state.mem_range; + while (last && last->next) last = last->next; + if (last == NULL) + { + state.mem_range = mem_range; + } + else + { + last->next = mem_range; + } + } + + mode = FETCH_DATA; + } + else + { + hiscore_free(); + break; + } + } + else + { + /* line is a game name */ + if (mode == FETCH_DATA) break; + } + } + mame_fclose (f); + } + + timer = timer_alloc(hiscore_periodic_callback, NULL); + timer_adjust_periodic(timer, ATTOTIME_IN_HZ(60), 0, ATTOTIME_IN_HZ(60)); + add_exit_callback(machine, hiscore_close); +} diff -Nru old/emu/hiscore.h src/emu/hiscore.h --- old/emu/hiscore.h 1969-12-31 18:00:00.000000000 -0600 +++ src/emu/hiscore.h 2008-07-08 09:05:02.000000000 -0500 @@ -0,0 +1,19 @@ +/*************************************************************************** + + hiscore.h + + Manages the hiscore system. + + Copyright (c) 1996-2006, Nicola Salmoria and the MAME Team. + Visit http://mamedev.org for licensing and usage restrictions. + +***************************************************************************/ + +#pragma once + +#ifndef __HISCORE_H__ +#define __HISCORE_H__ + +void hiscore_init( running_machine *machine ); + +#endif /* __HISCORE_H__ */ diff -Nru old/emu/mame.c src/emu/mame.c --- old/emu/mame.c 2008-06-26 14:32:52.000000000 -0500 +++ src/emu/mame.c 2008-07-08 09:05:02.000000000 -0500 @@ -83,6 +83,8 @@ #include "driver.h" #include "config.h" #include "cheat.h" +//MKCHAMP - ADDING HEADER FILE HISCORE FOR INCLUSION +#include "hiscore.h" #include "debugger.h" #include "profiler.h" #include "render.h" @@ -372,7 +374,8 @@ nvram_load(machine); /* display the startup screens */ - ui_display_startup_screens(machine, firstrun, !settingsloaded); + //MKCHAMP - CHANGING !settingsloaded to !1 SO STARTUP SCREENS ARE BYPASSED + ui_display_startup_screens(machine, firstrun, !1); firstrun = FALSE; /* start resource tracking; note that soft_reset assumes it can */ @@ -1612,6 +1615,8 @@ /* initialize miscellaneous systems */ saveload_init(machine); + //MKCHAMP - INITIALIZING THE HISCORE ENGINE + hiscore_init(machine); if (options_get_bool(mame_options(), OPTION_CHEAT)) cheat_init(machine); } diff -Nru old/emu/profiler.c src/emu/profiler.c --- old/emu/profiler.c 2008-03-09 08:41:18.000000000 -0500 +++ src/emu/profiler.c 2008-07-08 09:05:02.000000000 -0500 @@ -126,6 +126,8 @@ "Sound ", "Mixer ", "Callbck", + //MKCHAMP - ADDED HISCORE ENGINE TO THE PROFILER + "Hiscore", "Input ", "Movie ", "Logerr ", diff -Nru old/emu/profiler.h src/emu/profiler.h --- old/emu/profiler.h 2008-01-05 17:47:42.000000000 -0600 +++ src/emu/profiler.h 2008-07-08 09:05:02.000000000 -0500 @@ -39,6 +39,8 @@ PROFILER_SOUND, PROFILER_MIXER, PROFILER_TIMER_CALLBACK, + //MKCHAMP - INCLUDING THE HISCORE ENGINE TO THE PROFILER + PROFILER_HISCORE, PROFILER_INPUT, /* input.c and inptport.c */ PROFILER_MOVIE_REC, /* movie recording */ PROFILER_LOGERROR, /* logerror */ diff -Nru old/emu/romload.c src/emu/romload.c --- old/emu/romload.c 2008-06-23 01:32:44.000000000 -0500 +++ src/emu/romload.c 2008-07-08 09:05:02.000000000 -0500 @@ -398,14 +398,15 @@ static void display_loading_rom_message(const char *name, rom_load_data *romdata) { - char buffer[200]; +//MKCHAMP - DISABLING WHOLE SUB ROUTINE TO ELIMINATE LOADING MESSAGES +/* char buffer[200]; if (name != NULL) sprintf(buffer, "Loading (%d%%)", 100 * romdata->romsloaded / romdata->romstotal); else sprintf(buffer, "Loading Complete"); - ui_set_startup_text(Machine, buffer, FALSE); + ui_set_startup_text(Machine, buffer, FALSE);*/ } diff -Nru old/emu/ui.c src/emu/ui.c --- old/emu/ui.c 2008-06-26 07:51:24.000000000 -0500 +++ src/emu/ui.c 2008-07-08 09:05:02.000000000 -0500 @@ -334,11 +334,15 @@ switch (state) { case 0: + //MKCHAMP - BREAKING OUT SO DISCLAIMERS AREN'T SHOWN + break; if (show_disclaimer && sprintf_disclaimer(machine, messagebox_text)) ui_set_handler(handler_messagebox_ok, 0); break; case 1: + //MKCHAMP - BREAKING OUT SO WARNINGS AREN'T SHOWN + break; if (show_warnings && sprintf_warnings(machine, messagebox_text)) { ui_set_handler(handler_messagebox_ok, 0); @@ -348,6 +352,8 @@ break; case 2: + //MKCHAMP - BREAKING OUT SO GAME INFO ISN'T SHOWN + break; if (show_gameinfo && sprintf_game_info(machine, messagebox_text)) ui_set_handler(handler_messagebox_anykey, 0); break; @@ -363,11 +369,13 @@ /* loop while we have a handler */ while (ui_handler_callback != handler_ingame && !mame_is_scheduled_event_pending(machine) && !ui_menu_is_force_game_select()) - video_frame_update(machine, FALSE); + //MKCHAMP - NOT UPDATING THE VIDEO FRAME FOR MESSAGES/WHITE BOXES -- NO NEED TO + /*video_frame_update(machine, FALSE);*/ /* clear the handler and force an update */ ui_set_handler(handler_ingame, 0); - video_frame_update(machine, FALSE); + //MKCHAMP - NOT UPDATING THE VIDEO FRAME FOR MESSAGES/WHITE BOXES -- NO NEED TO + /*video_frame_update(machine, FALSE);*/ } /* if we're the empty driver, force the menus on */ @@ -396,11 +404,12 @@ if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) { lastupdatetime = curtime; - video_frame_update(machine, FALSE); + /*MKCHAMP - CALLING NEW SUB CALLED video_frame_update_hi SO WHITE BOX DOES NOT SHOW BUT REFRESHSPEED IS STILL CALCULATED + video_frame_update(machine, FALSE); */ + video_frame_update_hi(machine, FALSE); } } - /*------------------------------------------------- ui_update_and_render - update the UI and render it; called by video.c @@ -437,7 +446,8 @@ display_rescale_message = FALSE; if (allow_rescale == 0) allow_rescale = 2; - ui_draw_text_box("Updating Artwork...", JUSTIFY_CENTER, 0.5f, 0.5f, messagebox_backcolor); + //MKCHAMP - DISABLING THE UPDATING ARTWORK MESSAGE + /*ui_draw_text_box("Updating Artwork...", JUSTIFY_CENTER, 0.5f, 0.5f, messagebox_backcolor);*/ } /* decrement the frame counter if it is non-zero */ diff -Nru old/emu/video.c src/emu/video.c --- old/emu/video.c 2008-07-05 23:07:24.000000000 -0500 +++ src/emu/video.c 2008-07-08 09:05:02.000000000 -0500 @@ -619,14 +619,16 @@ /* now decode the actual graphics */ for (j = 0; j < gfx->total_elements; j += 1024) { - char buffer[200]; + //MKCHAMP - NO LONGER USING THIS VARIABLE, SO NOT GOING TO DECLARE IT + /*char buffer[200];*/ int num_to_decode = (j + 1024 < gfx->total_elements) ? 1024 : (gfx->total_elements - j); decodegfx(gfx, region_base + gfxdecodeinfo[i].start, j, num_to_decode); curgfx += num_to_decode; /* display some startup text */ - sprintf(buffer, "Decoding (%d%%)", curgfx * 100 / totalgfx); - ui_set_startup_text(machine, buffer, FALSE); + //MKCHAMP - DISABLING THE DECODING MESSAGES + /*sprintf(buffer, "Decoding (%d%%)", curgfx * 100 / totalgfx); + ui_set_startup_text(machine, buffer, FALSE);*/ } } @@ -1530,6 +1532,79 @@ } } +/*------------------------------------------------- + MKCHAMP - BELOW IS THE NEW SUB CALLED FROM UI.C. ONLY DIFFERENCE BETWEEN THIS SUB AND + video_frame_update IS IT CALLS NEW SUB CALLED osd_update_hi INSTEAD OF osd_update (located + in osd/windows/video.c) +-------------------------------------------------*/ + +void video_frame_update_hi(running_machine *machine, int debug) +{ + attotime current_time = timer_get_time(); + int skipped_it = global.skipping_this_frame; + int phase = mame_get_phase(machine); + + /* validate */ + assert(machine != NULL); + 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) || options_get_bool(mame_options(), OPTION_UPDATEINPAUSE))) + { + int anything_changed = finish_screen_updates(machine); + + /* if none of the screens changed and we haven't skipped too many frames in a row, + mark this frame as skipped to prevent throttling; this helps for games that + don't update their screen at the monitor refresh rate */ + if (!anything_changed && !global.auto_frameskip && global.frameskip_level == 0 && global.empty_skip_count++ < 3) + skipped_it = TRUE; + else + global.empty_skip_count = 0; + } + + /* draw the user interface */ + ui_update_and_render(machine); + + /* if we're throttling, synchronize before rendering */ + if (!debug && !skipped_it && effective_throttle(machine)) + update_throttle(machine, current_time); + + /* ask the OSD to update */ + profiler_mark(PROFILER_BLIT); + osd_update_hi(machine, !debug && skipped_it); + profiler_mark(PROFILER_END); + + /* perform tasks for this frame */ + if (!debug) + mame_frame_update(machine); + + /* update frameskipping */ + if (!debug) + update_frameskip(machine); + + /* update speed computations */ + if (!debug && !skipped_it) + recompute_speed(machine, current_time); + + /* call the end-of-frame callback */ + if (phase == MAME_PHASE_RUNNING) + { + /* reset partial updates if we're paused or if the debugger is active */ + if (machine->primary_screen != NULL && (mame_is_paused(machine) || debug || debugger_within_instruction_hook(machine))) + { + void *param = (void *)machine->primary_screen; + scanline0_callback(machine, param, 0); + } + + /* otherwise, call the video EOF callback */ + else if (machine->config->video_eof != NULL) + { + profiler_mark(PROFILER_VIDEO); + (*machine->config->video_eof)(machine); + profiler_mark(PROFILER_END); + } + } +} /*------------------------------------------------- finish_screen_updates - finish updating all diff -Nru old/emu/video.h src/emu/video.h --- old/emu/video.h 2008-06-16 10:05:46.000000000 -0500 +++ src/emu/video.h 2008-07-08 09:05:02.000000000 -0500 @@ -224,6 +224,9 @@ /* update the screen, handling frame skipping and rendering */ void video_frame_update(running_machine *machine, int debug); +// MKCHAMP - DECLARING THE NEW video_frame_update_hi SUB +void video_frame_update_hi(running_machine *machine, int debug); + /* ----- throttling/frameskipping/performance ----- */ diff -Nru old/mame/machine/cps2crpt.c src/mame/machine/cps2crpt.c --- old/mame/machine/cps2crpt.c 2008-06-23 01:32:44.000000000 -0500 +++ src/mame/machine/cps2crpt.c 2008-07-08 09:05:02.000000000 -0500 @@ -671,9 +671,10 @@ if ((i & 0xff) == 0) { - char loadingMessage[256]; // for displaying with UI + //MKCHAMP - DISABLING THE DECRYPING MESSAGE + /*char loadingMessage[256]; // for displaying with UI sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000); - ui_set_startup_text(machine, loadingMessage,FALSE); + ui_set_startup_text(machine, loadingMessage,FALSE);*/ } diff -Nru old/osd/osdepend.h src/osd/osdepend.h --- old/osd/osdepend.h 2008-05-15 09:25:04.000000000 -0500 +++ src/osd/osdepend.h 2008-07-08 09:05:02.000000000 -0500 @@ -109,6 +109,8 @@ void osd_update(running_machine *machine, int skip_redraw); +//MKCHAMP - DECLARING THE NEW osd_update_hi SUB +void osd_update_hi(running_machine *machine, int skip_redraw); diff -Nru old/osd/windows/video.c src/osd/windows/video.c --- old/osd/windows/video.c 2008-06-26 07:51:24.000000000 -0500 +++ src/osd/windows/video.c 2008-07-08 09:05:02.000000000 -0500 @@ -210,6 +210,27 @@ check_osd_inputs(machine); } +//============================================================ +// MKCHAMP - BELOW IS THE NEW SUB CALLED FROM emu/video.c. ONLY +// DIFFERENCE BETWEEN THIS SUB AND osd_update IS IT CALLS NEW SUB CALLED winwindow_video_window_update_hi +// INSTEAD OF winwindow_video_window_update (located in osd/windows/window.c) +//============================================================ + +void osd_update_hi(running_machine *machine, int skip_redraw) +{ + win_window_info *window; + + // if we're not skipping this redraw, update all windows + if (!skip_redraw) + for (window = win_window_list; window != NULL; window = window->next) + winwindow_video_window_update_hi(window); + + // poll the joystick values here + winwindow_process_events(machine, TRUE); + wininput_poll(machine); + check_osd_inputs(machine); +} + //============================================================ diff -Nru old/osd/windows/window.c src/osd/windows/window.c --- old/osd/windows/window.c 2008-06-26 07:51:24.000000000 -0500 +++ src/osd/windows/window.c 2008-07-08 09:05:02.000000000 -0500 @@ -765,6 +765,84 @@ mtlog_add("winwindow_video_window_update: end"); } +//============================================================ +// MKCHAMP - LAST OF THE NEW SUB CHAIN. FOR THOSE FOLLOWING, THE PATH IS: +// emu/ui.c->ui_set_startup_text CALLS emu/video.c->video_frame_update_hi WHICH CALLS +// osd/windows/video.c->osd_update_hi WHICH CALLS THIS SUB. +// THE ONLY DIFFERENCE BETWEEN THIS SUB AND winwindow_video_window_update IS IT DOES NOT +// perform PostMessage(window->hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist) OR +// SendMessage(window->hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist) +// ALL THIS DOES IS ALLOW MAME TO PROPERLY RUN TO CALCULATE THE REFRESHSPEED/ETC. WITHOUT +// GIVING THE WHITE BOX THAT SEEMS TO ANNOY SOME PEOPLE! +//============================================================ + +void winwindow_video_window_update_hi(win_window_info *window) +{ + int targetview, targetorient, targetlayerconfig; + + assert(GetCurrentThreadId() == main_threadid); + + mtlog_add("winwindow_video_window_update: begin"); + + // see if the target has changed significantly in window mode + targetview = render_target_get_view(window->target); + targetorient = render_target_get_orientation(window->target); + targetlayerconfig = render_target_get_layer_config(window->target); + if (targetview != window->targetview || targetorient != window->targetorient || targetlayerconfig != window->targetlayerconfig) + { + window->targetview = targetview; + window->targetorient = targetorient; + window->targetlayerconfig = targetlayerconfig; + + // in window mode, reminimize/maximize + if (!window->fullscreen) + { + if (window->isminimized) + SendMessage(window->hwnd, WM_USER_SET_MINSIZE, 0, 0); + if (window->ismaximized) + SendMessage(window->hwnd, WM_USER_SET_MAXSIZE, 0, 0); + } + } + + // if we're visible and running and not in the middle of a resize, draw + if (window->hwnd != NULL && window->target != NULL) + { + int got_lock = TRUE; + + mtlog_add("winwindow_video_window_update: try lock"); + + // only block if we're throttled + if (video_get_throttle() || timeGetTime() - last_update_time > 250) + osd_lock_acquire(window->render_lock); + else + got_lock = osd_lock_try(window->render_lock); + + // only render if we were able to get the lock + if (got_lock) + { + const render_primitive_list *primlist; + + mtlog_add("winwindow_video_window_update: got lock"); + + // don't hold the lock; we just used it to see if rendering was still happening + osd_lock_release(window->render_lock); + + // ensure the target bounds are up-to-date, and then get the primitives + primlist = (*draw.window_get_primitives)(window); + + // post a redraw request with the primitive list as a parameter + last_update_time = timeGetTime(); + mtlog_add("winwindow_video_window_update: PostMessage start"); + //if (multithreading_enabled) + // PostMessage(window->hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist); + //else + // SendMessage(window->hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist); + mtlog_add("winwindow_video_window_update: PostMessage end"); + } + } + + mtlog_add("winwindow_video_window_update: end"); +} //============================================================ diff -Nru old/osd/windows/window.h src/osd/windows/window.h --- old/osd/windows/window.h 2008-04-11 07:05:26.000000000 -0500 +++ src/osd/windows/window.h 2008-07-08 09:05:02.000000000 -0500 @@ -111,6 +111,8 @@ BOOL winwindow_has_focus(void); void winwindow_update_cursor_state(running_machine *machine); void winwindow_video_window_update(win_window_info *window); +//MKCHAMP - DECLARING THE NEW SUB winwindow_video_window_update_hi +void winwindow_video_window_update_hi(win_window_info *window); win_monitor_info *winwindow_video_window_monitor(win_window_info *window, const RECT *proposed); LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);