diff -r -c -N old/emu/cheat.c src/emu/cheat.c *** old/emu/cheat.c Tue Mar 11 22:13:04 2008 --- src/emu/cheat.c Mon Mar 24 09:24:23 2008 *************** *** 525,530 **** --- 525,532 ---- EXPORTED VARIABLES ***************************************************************************/ + // MKCHAMP - ADD VARIABLE SO HIGH SCORES AREN'T SAVED IF CHEAT IS ENABLED + int he_did_cheat = 0; static const char * cheatfile = NULL; /*************************************************************************** *************** *** 1461,1466 **** --- 1463,1470 ---- void cheat_init(running_machine *machine) { /* ----- initialize lists ----- */ + //MKCHAMP - DEFAULTING he_did_cheat to 0 + he_did_cheat = 0; cheatList = NULL; cheatListLength = 0; *************** *** 11153,11158 **** --- 11157,11164 ---- } 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 -r -c -N old/emu/cheat.h src/emu/cheat.h *** old/emu/cheat.h Thu Jan 24 02:12:04 2008 --- src/emu/cheat.h Mon Mar 24 09:24:23 2008 *************** *** 16,21 **** --- 16,24 ---- #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 -r -c -N old/emu/crsshair.c src/emu/crsshair.c *** old/emu/crsshair.c Mon Mar 17 05:47:24 2008 --- src/emu/crsshair.c Mon Mar 24 09:24:23 2008 *************** *** 200,206 **** /* mark as used and visible */ global.used[player] = TRUE; ! global.visible[player] = TRUE; /* for now, use the main screen */ global.screen[player] = machine->primary_screen; --- 200,208 ---- /* mark as used and visible */ global.used[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 -r -c -N old/emu/emu.mak src/emu/emu.mak *** old/emu/emu.mak Mon Mar 10 19:41:26 2008 --- src/emu/emu.mak Mon Mar 24 09:24:23 2008 *************** *** 33,38 **** --- 33,39 ---- #------------------------------------------------- # emulator core objects + # MKCHAMP - ADDED hiscore.o TO LIST TO COMPILE THE HISCORE PIECE #------------------------------------------------- EMUOBJS = \ *************** *** 52,57 **** --- 53,59 ---- $(EMUOBJ)/emupal.o \ $(EMUOBJ)/fileio.o \ $(EMUOBJ)/hash.o \ + $(EMUOBJ)/hiscore.o \ $(EMUOBJ)/info.o \ $(EMUOBJ)/input.o \ $(EMUOBJ)/inputseq.o \ diff -r -c -N old/emu/emuopts.c src/emu/emuopts.c *** old/emu/emuopts.c Sat Feb 2 01:57:40 2008 --- src/emu/emuopts.c Mon Mar 24 09:24:23 2008 *************** *** 57,62 **** --- 57,64 ---- /* 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 -r -c -N old/emu/emuopts.h src/emu/emuopts.h *** old/emu/emuopts.h Sat Jan 5 17:47:42 2008 --- src/emu/emuopts.h Mon Mar 24 09:24:23 2008 *************** *** 57,62 **** --- 57,64 ---- /* 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 -r -c -N old/emu/fileio.h src/emu/fileio.h *** old/emu/fileio.h Sat Jan 5 17:47:42 2008 --- src/emu/fileio.h Mon Mar 24 09:24:23 2008 *************** *** 55,60 **** --- 55,62 ---- #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 -r -c -N old/emu/hiscore.c src/emu/hiscore.c *** old/emu/hiscore.c Wed Dec 31 18:00:00 1969 --- src/emu/hiscore.c Mon Mar 24 09:24:23 2008 *************** *** 0 **** --- 1,390 ---- + /*************************************************************************** + + 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 + + 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; + + + static int is_highscore_enabled(void) + { + /* disable high score when record/playback is on */ + if (Machine->record_file != NULL || Machine->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 (void) + { + file_error filerr; + mame_file *f; + astring *fname; + if (is_highscore_enabled()) + { + 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 (void) + { + file_error filerr; + mame_file *f; + astring *fname; + if (is_highscore_enabled()) + { + 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) + { + if (state.mem_range) + { + if (!state.hiscores_have_been_loaded) + { + if (safe_to_load()) + { + hiscore_load(); + timer_enable(timer, FALSE); + } + } + } + } + + static TIMER_CALLBACK( hiscore_periodic_callback ) + { + hiscore_periodic(param); + } + + + /* call hiscore_close when done playing game */ + void hiscore_close (running_machine *machine) + { + if (state.hiscores_have_been_loaded) hiscore_save(); + 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 -r -c -N old/emu/hiscore.h src/emu/hiscore.h *** old/emu/hiscore.h Wed Dec 31 18:00:00 1969 --- src/emu/hiscore.h Mon Mar 24 09:24:23 2008 *************** *** 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 -r -c -N old/emu/mame.c src/emu/mame.c *** old/emu/mame.c Wed Mar 12 04:06:30 2008 --- src/emu/mame.c Mon Mar 24 09:24:23 2008 *************** *** 83,88 **** --- 83,90 ---- #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" *************** *** 375,381 **** nvram_load(); /* display the startup screens */ ! ui_display_startup_screens(machine, firstrun, !settingsloaded); firstrun = FALSE; /* start resource tracking; note that soft_reset assumes it can */ --- 377,384 ---- nvram_load(); /* display the startup screens */ ! //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 */ *************** *** 1604,1609 **** --- 1607,1614 ---- /* 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 -r -c -N old/emu/profiler.c src/emu/profiler.c *** old/emu/profiler.c Sun Mar 9 08:41:18 2008 --- src/emu/profiler.c Mon Mar 24 09:24:23 2008 *************** *** 126,131 **** --- 126,133 ---- "Sound ", "Mixer ", "Callbck", + //MKCHAMP - ADDED HISCORE ENGINE TO THE PROFILER + "Hiscore", "Input ", "Movie ", "Logerr ", diff -r -c -N old/emu/profiler.h src/emu/profiler.h *** old/emu/profiler.h Sat Jan 5 17:47:42 2008 --- src/emu/profiler.h Mon Mar 24 09:24:23 2008 *************** *** 39,44 **** --- 39,46 ---- 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 -r -c -N old/emu/romload.c src/emu/romload.c *** old/emu/romload.c Sun Feb 17 23:08:40 2008 --- src/emu/romload.c Mon Mar 24 09:24:23 2008 *************** *** 389,402 **** static void display_loading_rom_message(const char *name, rom_load_data *romdata) { ! 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); } --- 389,403 ---- static void display_loading_rom_message(const char *name, rom_load_data *romdata) { ! //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);*/ } diff -r -c -N old/emu/ui.c src/emu/ui.c *** old/emu/ui.c Fri Mar 21 07:51:28 2008 --- src/emu/ui.c Mon Mar 24 09:29:54 2008 *************** *** 333,343 **** --- 333,347 ---- 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); *************** *** 347,352 **** --- 351,358 ---- 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; *************** *** 362,372 **** /* 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); /* clear the handler and force an update */ ui_set_handler(handler_ingame, 0); ! video_frame_update(machine, FALSE); } /* if we're the empty driver, force the menus on */ --- 368,380 ---- /* loop while we have a handler */ while (ui_handler_callback != handler_ingame && !mame_is_scheduled_event_pending(machine) && !ui_menu_is_force_game_select()) ! //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); ! //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 */ *************** *** 395,405 **** if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) { lastupdatetime = curtime; ! video_frame_update(machine, FALSE); } } - /*------------------------------------------------- ui_update_and_render - update the UI and render it; called by video.c --- 403,414 ---- if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) { lastupdatetime = curtime; ! /*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 *************** *** 436,442 **** 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); } /* decrement the frame counter if it is non-zero */ --- 445,452 ---- display_rescale_message = FALSE; if (allow_rescale == 0) allow_rescale = 2; ! //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 -r -c -N old/emu/video.c src/emu/video.c *** old/emu/video.c Sun Mar 23 06:48:44 2008 --- src/emu/video.c Mon Mar 24 09:24:23 2008 *************** *** 557,563 **** static void decode_graphics(running_machine *machine, const gfx_decode_entry *gfxdecodeinfo) { int totalgfx = 0, curgfx = 0; ! char buffer[200]; int i; /* count total graphics elements */ --- 557,564 ---- static void decode_graphics(running_machine *machine, const gfx_decode_entry *gfxdecodeinfo) { int totalgfx = 0, curgfx = 0; ! //MKCHAMP - NO LONGER USING THIS VARIABLE, SO NOT GOING TO DECLARE IT ! /*char buffer[200];*/ int i; /* count total graphics elements */ *************** *** 584,591 **** curgfx += num_to_decode; /* display some startup text */ ! sprintf(buffer, "Decoding (%d%%)", curgfx * 100 / totalgfx); ! ui_set_startup_text(machine, buffer, FALSE); } } --- 585,593 ---- curgfx += num_to_decode; /* display some startup text */ ! //MKCHAMP - DISABLING THE DECODING MESSAGES ! /*sprintf(buffer, "Decoding (%d%%)", curgfx * 100 / totalgfx); ! ui_set_startup_text(machine, buffer, FALSE);*/ } } *************** *** 1468,1473 **** --- 1470,1549 ---- } } + /*------------------------------------------------- + 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) || global.update_in_pause)) + { + 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 || mame_debug_is_active())) + { + 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 -r -c -N old/emu/video.h src/emu/video.h *** old/emu/video.h Wed Mar 19 01:15:38 2008 --- src/emu/video.h Mon Mar 24 09:24:23 2008 *************** *** 223,228 **** --- 223,231 ---- /* 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 -r -c -N old/mame/machine/cps2crpt.c src/mame/machine/cps2crpt.c *** old/mame/machine/cps2crpt.c Mon Feb 25 15:43:38 2008 --- src/mame/machine/cps2crpt.c Mon Mar 24 09:24:23 2008 *************** *** 672,680 **** if ((i & 0xff) == 0) { ! char loadingMessage[256]; // for displaying with UI sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000); ! ui_set_startup_text(Machine, loadingMessage,FALSE); } --- 672,681 ---- if ((i & 0xff) == 0) { ! //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);*/ } diff -r -c -N old/osd/osdepend.h src/osd/osdepend.h *** old/osd/osdepend.h Sat Feb 23 10:46:54 2008 --- src/osd/osdepend.h Mon Mar 24 09:24:23 2008 *************** *** 108,113 **** --- 108,115 ---- 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 -r -c -N old/osd/windows/video.c src/osd/windows/video.c *** old/osd/windows/video.c Thu Mar 20 22:02:20 2008 --- src/osd/windows/video.c Mon Mar 24 09:24:23 2008 *************** *** 214,219 **** --- 214,240 ---- check_osd_inputs(); } + //============================================================ + // 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(TRUE); + wininput_poll(); + check_osd_inputs(); + } + //============================================================ diff -r -c -N old/osd/windows/window.c src/osd/windows/window.c *** old/osd/windows/window.c Thu Mar 20 22:02:20 2008 --- src/osd/windows/window.c Mon Mar 24 09:24:23 2008 *************** *** 769,774 **** --- 769,849 ---- 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"); + + mtlog_add("winwindow_video_window_update: PostMessage end"); + } + } + + mtlog_add("winwindow_video_window_update: end"); + } //============================================================ diff -r -c -N old/osd/windows/window.h src/osd/windows/window.h *** old/osd/windows/window.h Sun Mar 16 15:46:58 2008 --- src/osd/windows/window.h Mon Mar 24 09:24:23 2008 *************** *** 111,116 **** --- 111,118 ---- BOOL winwindow_has_focus(void); void winwindow_update_cursor_state(void); 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);