diff -Nru old/emu/emuopts.cpp src/emu/emuopts.cpp --- old/emu/emuopts.cpp 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/emuopts.cpp 2015-11-30 09:57:15.000000000 -0600 @@ -52,6 +52,10 @@ { OPTION_SNAPSHOT_DIRECTORY, "snap", OPTION_STRING, "directory to save screenshots" }, { OPTION_DIFF_DIRECTORY, "diff", OPTION_STRING, "directory to save hard drive image difference files" }, { OPTION_COMMENT_DIRECTORY, "comments", OPTION_STRING, "directory to save debugger comments" }, + + // MKCHAMP - ADDING CFG OPTION TO SPECIFY HISCORE DIRECTORY..."hi" BY DEFAULT + { NULL, NULL, OPTION_HEADER, "CORE OUTPUT DIRECTORY OPTIONS" }, + { OPTION_HISCORE_DIRECTORY, "hi", OPTION_STRING, "directory to save hiscores" }, // state/playback options { NULL, NULL, OPTION_HEADER, "CORE STATE/PLAYBACK OPTIONS" }, @@ -185,6 +189,11 @@ { OPTION_AUTOBOOT_COMMAND ";ab", NULL, OPTION_STRING, "command to execute after machine boot" }, { OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" }, { OPTION_AUTOBOOT_SCRIPT ";script", NULL, OPTION_STRING, "lua script to execute after machine boot" }, + // MKChamp Hiscore Diff options + { NULL, NULL, OPTION_HEADER, "CORE MKChamp OPTIONS" }, + { OPTION_DISABLE_HISCORE_PATCH, "0", OPTION_BOOLEAN, "disable hiscore saving" }, + { OPTION_DISABLE_NAGSCREEN_PATCH, "0", OPTION_BOOLEAN, "disable suppression of nagscreens" }, + { OPTION_DISABLE_LOADING_PATCH, "0", OPTION_BOOLEAN, "disable suppression of loading screens /white box" }, { NULL } }; diff -Nru old/emu/emuopts.h src/emu/emuopts.h --- old/emu/emuopts.h 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/emuopts.h 2015-11-30 09:58:08.000000000 -0600 @@ -65,6 +65,8 @@ #define OPTION_SNAPSHOT_DIRECTORY "snapshot_directory" #define OPTION_DIFF_DIRECTORY "diff_directory" #define OPTION_COMMENT_DIRECTORY "comment_directory" +//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" @@ -189,6 +191,11 @@ #define OPTION_AUTOBOOT_DELAY "autoboot_delay" #define OPTION_AUTOBOOT_SCRIPT "autoboot_script" + /* MKChamp Hiscore Diff Options */ + #define OPTION_DISABLE_HISCORE_PATCH "disable_hiscore_patch" + #define OPTION_DISABLE_NAGSCREEN_PATCH "disable_nagscreen_patch" + #define OPTION_DISABLE_LOADING_PATCH "disable_loading_patch" + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -239,6 +246,9 @@ const char *snapshot_directory() const { return value(OPTION_SNAPSHOT_DIRECTORY); } const char *diff_directory() const { return value(OPTION_DIFF_DIRECTORY); } const char *comment_directory() const { return value(OPTION_COMMENT_DIRECTORY); } + + // MKCHAMP - hiscore directory options + const char *hiscore_directory() const { return value(OPTION_HISCORE_DIRECTORY); } // core state/playback options const char *state() const { return value(OPTION_STATE); } @@ -347,6 +357,11 @@ bool skip_gameinfo() const { return bool_value(OPTION_SKIP_GAMEINFO); } const char *ui_font() const { return value(OPTION_UI_FONT); } const char *ram_size() const { return value(OPTION_RAMSIZE); } + + // MKChamp Hiscore Diff options + bool disable_hiscore_patch() const { return bool_value(OPTION_DISABLE_HISCORE_PATCH); } + bool disable_nagscreen_patch() const { return bool_value(OPTION_DISABLE_NAGSCREEN_PATCH); } + bool disable_loading_patch() const { return bool_value(OPTION_DISABLE_LOADING_PATCH); } // core comm options const char *comm_localhost() const { return value(OPTION_COMM_LOCAL_HOST); } diff -Nru old/emu/hiscore.cpp src/emu/hiscore.cpp --- old/emu/hiscore.cpp 1969-12-31 18:00:00.000000000 -0600 +++ src/emu/hiscore.cpp 2015-11-30 09:54:22.000000000 -0600 @@ -0,0 +1,376 @@ +/*************************************************************************** + + hiscore.cpp + + Manages the hiscore system. + + This is an unofficial version based on MAME. + Please do not send any reports from this build to the MAME team. + +***************************************************************************/ + +#include "emu.h" +#include "emuopts.h" +#include "hiscore.h" + + +#define MAX_CONFIG_LINE_SIZE 48 + +static emu_timer *timer; + +struct memory_range +{ + UINT32 cpu, addr, num_bytes, start_value, end_value; + struct memory_range *next; +}; + +static struct +{ + int hiscores_have_been_loaded; + memory_range *mem_range; +} state; + + +static void copy_to_memory (running_machine &machine, int cpu, int addr, UINT8 *source, int num_bytes) +{ + int i; + address_space *targetspace; + + if (strstr(machine.system().source_file,"cinemat.cpp") > 0) + { + targetspace = &machine.cpu[cpu]->memory().space(AS_DATA); + } + else + { + targetspace = &machine.cpu[cpu]->memory().space(AS_PROGRAM); + } + + for (i=0; iwrite_byte(addr+i, source[i]); + } +} + +static void copy_from_memory (running_machine &machine, int cpu, int addr, UINT8 *dest, int num_bytes) +{ + int i; + address_space *targetspace; + + if (strstr(machine.system().source_file,"cinemat.cpp") > 0) + { + targetspace = &machine.cpu[cpu]->memory().space(AS_DATA); + } + else + { + targetspace = &machine.cpu[cpu]->memory().space(AS_PROGRAM); + } + + for (i=0; iread_byte(addr+i); + } +} + +/* hexstr2num extracts and returns the value of a hexadecimal field from the + character buffer pointed to by pString. + When hexstr2num returns, *pString points to the character following + the first non-hexadecimal digit, or NULL if an end-of-string marker + (0x00) is encountered. */ +static UINT32 hexstr2num (const char **pString) +{ + const char *string = *pString; + UINT32 result = 0; + + if (string) + { + for(;;) + { + char c = *string++; + int digit; + + if (c>='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 (running_machine &machine) +{ + memory_range *mem_range = state.mem_range; + address_space *srcspace; + + if (strstr(machine.system().source_file,"cinemat.cpp") > 0) + { + srcspace = &machine.cpu[mem_range->cpu]->memory().space(AS_DATA); + } + else + { + srcspace = &machine.cpu[mem_range->cpu]->memory().space(AS_PROGRAM); + } + + while (mem_range) + { + if (srcspace->read_byte(mem_range->addr) != mem_range->start_value) + { + return 0; + } + + if (srcspace->read_byte(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; + global_free_array(mem_range); + mem_range = next; + } + state.mem_range = NULL; +} + +static void hiscore_load (running_machine &machine) +{ + file_error filerr; + emu_file f(machine.options().hiscore_directory(), OPEN_FLAG_READ); + filerr = f.open(machine.basename(), ".hi"); + state.hiscores_have_been_loaded = 1; + + if (filerr == FILERR_NONE) + { + memory_range *mem_range = state.mem_range; + + while (mem_range) + { + UINT8 *data = global_alloc_array(UINT8, 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 */ + f.read(data, mem_range->num_bytes); + copy_to_memory (machine,mem_range->cpu, mem_range->addr, data, mem_range->num_bytes); + global_free_array(data); + } + mem_range = mem_range->next; + } + f.close(); + } +} + +static void hiscore_save (running_machine &machine) +{ + file_error filerr; + emu_file f(machine.options().hiscore_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + filerr = f.open(machine.basename(), ".hi"); + + if (filerr == FILERR_NONE) + { + memory_range *mem_range = state.mem_range; + + while (mem_range) + { + UINT8 *data = global_alloc_array(UINT8, 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 (machine, mem_range->cpu, mem_range->addr, data, mem_range->num_bytes); + f.write(data, mem_range->num_bytes); + global_free_array(data); + } + mem_range = mem_range->next; + } + f.close(); + } +} + +/* call hiscore_update periodically (i.e. once per frame) */ +static TIMER_CALLBACK( hiscore_periodic ) +{ + if (state.mem_range) + { + if (!state.hiscores_have_been_loaded) + { + if (safe_to_load(machine)) + { + hiscore_load(machine); + timer->enable(false); + } + } + } +} + +/* call hiscore_close when done playing game */ +void hiscore_close (running_machine &machine) +{ + if (state.hiscores_have_been_loaded) + hiscore_save(machine); + hiscore_free(); +} + +/* call hiscore_open once after loading a game */ +void hiscore_init (running_machine &machine) +{ + memory_range *mem_range = state.mem_range; + address_space *initspace; + file_error filerr; + const char *name = machine.system().name; + state.hiscores_have_been_loaded = 0; + + while (mem_range) + { + if (strstr(machine.system().source_file,"cinemat.cpp") > 0) + { + initspace = &machine.cpu[mem_range->cpu]->memory().space(AS_DATA); + initspace->write_byte(mem_range->addr, ~mem_range->start_value); + initspace->write_byte(mem_range->addr + mem_range->num_bytes-1, ~mem_range->end_value); + mem_range = mem_range->next; + } + else + { + initspace = &machine.cpu[mem_range->cpu]->memory().space(AS_PROGRAM); + initspace->write_byte(mem_range->addr, ~mem_range->start_value); + initspace->write_byte(mem_range->addr + mem_range->num_bytes-1, ~mem_range->end_value); + mem_range = mem_range->next; + } + } + + state.mem_range = NULL; + emu_file f(OPEN_FLAG_READ); + filerr = f.open("hiscore", ".dat"); + + if(filerr == FILERR_NONE) + { + char buffer[MAX_CONFIG_LINE_SIZE]; + enum { FIND_NAME, FIND_DATA, FETCH_DATA } mode; + mode = FIND_NAME; + + while (f.gets(buffer, MAX_CONFIG_LINE_SIZE)) + { + if (mode == FIND_NAME) + { + if (matching_game_name (buffer, name)) + { + mode = FIND_DATA; + } + } + else if (is_mem_range (buffer)) + { + const char *pBuf = buffer; + mem_range = (memory_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; + } + } + f.close(); + } + + timer = machine.scheduler().timer_alloc(FUNC(hiscore_periodic)); + timer->adjust(machine.first_screen()->frame_period(), 0, machine.first_screen()->frame_period()); + + machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(hiscore_close), &machine)); +} 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 2015-11-30 09:54:22.000000000 -0600 @@ -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/machine.cpp src/emu/machine.cpp --- old/emu/machine.cpp 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/machine.cpp 2015-11-30 09:59:18.000000000 -0600 @@ -75,6 +75,8 @@ #include "debugger.h" #include "render.h" #include "cheat.h" +//MKCHAMP - ADDING HEADER FILE HISCORE FOR INCLUSION +#include "hiscore.h" #include "uiinput.h" #include "crsshair.h" #include "unzip.h" @@ -114,6 +116,8 @@ // running_machine - constructor //------------------------------------------------- +int cpunum; + running_machine::running_machine(const machine_config &_config, machine_manager &manager) : firstcpu(NULL), primary_screen(NULL), @@ -160,6 +164,11 @@ } screen_device_iterator screeniter(root_device()); primary_screen = screeniter.first(); + + //MKCHAMP--initialize the cpu for hiscore + cpu[0] = firstcpu; + for (cpunum = 1; cpunum < ARRAY_LENGTH(cpu) && cpu[cpunum - 1] != NULL; cpunum++) + cpu[cpunum] = cpu[cpunum - 1]->next(); // fetch core options if (options().debug()) @@ -336,6 +345,10 @@ // load the configuration settings and NVRAM config_load_settings(*this); + + //MKCHAMP - INITIALIZING THE HISCORE ENGINE + if (! options().disable_hiscore_patch()) + hiscore_init(*this); // disallow save state registrations starting here. // Don't do it earlier, config load can create network diff -Nru old/emu/machine.h src/emu/machine.h --- old/emu/machine.h 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/machine.h 2015-11-30 09:54:22.000000000 -0600 @@ -232,6 +232,7 @@ // CPU information cpu_device * firstcpu; // first CPU + device_t * cpu[8]; // MKChamp--CPU for hiscore support private: // video-related information diff -Nru old/emu/profiler.cpp src/emu/profiler.cpp --- old/emu/profiler.cpp 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/profiler.cpp 2015-11-30 09:54:22.000000000 -0600 @@ -156,6 +156,8 @@ { PROFILER_BLIT, "OSD Blitting" }, { PROFILER_SOUND, "Sound Generation" }, { PROFILER_TIMER_CALLBACK, "Timer Callbacks" }, + //MKCHAMP - INCLUDING THE HISCORE ENGINE TO THE PROFILER + { PROFILER_HISCORE, "Hiscore" }, { PROFILER_INPUT, "Input Processing" }, { PROFILER_MOVIE_REC, "Movie Recording" }, { PROFILER_LOGERROR, "Error Logging" }, diff -Nru old/emu/profiler.h src/emu/profiler.h --- old/emu/profiler.h 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/profiler.h 2015-11-30 10:02:29.000000000 -0600 @@ -51,6 +51,8 @@ PROFILER_BLIT, PROFILER_SOUND, 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.cpp src/emu/romload.cpp --- old/emu/romload.cpp 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/romload.cpp 2015-11-30 09:54:22.000000000 -0600 @@ -532,7 +532,10 @@ static void display_loading_rom_message(romload_private *romdata, const char *name, bool from_list) { char buffer[200]; - + //MKCHAMP - DISABLING WHOLE SUB ROUTINE TO ELIMINATE LOADING MESSAGES + //REMOVING ALWAYS + //if (!options_get_bool(mame_options(), OPTION_DISABLE_LOADING_PATCH)) + return; if (name != NULL) sprintf(buffer, "Loading %s (%d%%)", from_list ? "Software" : emulator_info::get_capstartgamenoun(), (UINT32)(100 * (UINT64)romdata->romsloadedsize / (UINT64)romdata->romstotalsize)); else diff -Nru old/emu/ui/ui.cpp src/emu/ui/ui.cpp --- old/emu/ui/ui.cpp 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/ui/ui.cpp 2015-11-30 10:05:59.000000000 -0600 @@ -337,11 +337,17 @@ switch (state) { case 0: + //MKCHAMP - BREAKING OUT SO DISCLAIMERS AREN'T SHOWN + if (!machine().options().disable_nagscreen_patch()) + break; if (show_disclaimer && disclaimer_string(messagebox_text).length() > 0) set_handler(handler_messagebox_ok, 0); break; case 1: + //MKCHAMP - BREAKING OUT SO WARNINGS AREN'T SHOWN + if (!machine().options().disable_nagscreen_patch()) + break; if (show_warnings && warnings_string(messagebox_text).length() > 0) { set_handler(handler_messagebox_ok, 0); @@ -353,6 +359,9 @@ break; case 2: + //MKCHAMP - BREAKING OUT SO GAME INFO ISN'T SHOWN + if (!machine().options().disable_nagscreen_patch()) + break; if (show_gameinfo && game_info_astring(messagebox_text).length() > 0) set_handler(handler_messagebox_anykey, 0); break; @@ -374,12 +383,18 @@ // loop while we have a handler while (m_handler_callback != handler_ingame && !machine().scheduled_event_pending() && !ui_menu::stack_has_special_main_menu()) { - machine().video().frame_update(); + //MKChamp Disabling of whitebox + if (machine().options().disable_nagscreen_patch()) + { + machine().video().frame_update(); + } } // clear the handler and force an update set_handler(handler_ingame, 0); - machine().video().frame_update(); + //MKChamp Disabling of whitebox + if (machine().options().disable_nagscreen_patch()) + machine().video().frame_update(); } // if we're the empty driver, force the menus on @@ -399,14 +414,22 @@ osd_ticks_t curtime = osd_ticks(); // copy in the new text - messagebox_text.assign(text); - messagebox_backcolor = UI_BACKGROUND_COLOR; + //MKCHAMP -- DISABLE IS NOT DISABLED :-) + if (machine().options().disable_nagscreen_patch()) + { + messagebox_text.assign(text); + messagebox_backcolor = UI_BACKGROUND_COLOR; + } // don't update more than 4 times/second if (force || (curtime - lastupdatetime) > osd_ticks_per_second() / 4) { lastupdatetime = curtime; - machine().video().frame_update(); + //MKCHAMP - CALLING NEW SUB CALLED video_frame_update_hi SO WHITE BOX DOES NOT SHOW BUT REFRESHSPEED IS STILL CALCULATED + if (!machine().options().disable_loading_patch()) + machine().video().frame_update_hi(); + else + machine().video().frame_update(); } } diff -Nru old/emu/video.cpp src/emu/video.cpp --- old/emu/video.cpp 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/video.cpp 2015-11-30 09:54:22.000000000 -0600 @@ -467,6 +467,66 @@ } } +/*------------------------------------------------- + MKCHAMP - BELOW IS THE NEW SUB CALLED FROM UI.C. ONLY DIFFERENCE BETWEEN THIS SUB AND + frame_update IS IT CALLS NEW SUB CALLED update_hi INSTEAD OF update (located + in osd/windows/video.c) +-------------------------------------------------*/ + +void video_manager::frame_update_hi(bool debug) +{ + // only render sound and video if we're in the running phase + int phase = machine().phase(); + bool skipped_it = m_skipping_this_frame; + if (phase == MACHINE_PHASE_RUNNING && (!machine().paused() || machine().options().update_in_pause())) + { + bool anything_changed = finish_screen_updates(); + + // 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 && !m_auto_frameskip && m_frameskip_level == 0 && m_empty_skip_count++ < 3) + skipped_it = true; + else + m_empty_skip_count = 0; + } + + // draw the user interface + machine().ui().update_and_render(&machine().render().ui_container()); + + // if we're throttling, synchronize before rendering + attotime current_time = machine().time(); + if (!debug && !skipped_it && effective_throttle()) + update_throttle(current_time); + + // ask the OSD to update + g_profiler.start(PROFILER_BLIT); + machine().osd().update_hi(!debug && skipped_it); + g_profiler.stop(); + + machine().manager().lua()->periodic_check(); + + // perform tasks for this frame + if (!debug) + machine().call_notifiers(MACHINE_NOTIFY_FRAME); + + // update frameskipping + if (!debug) + update_frameskip(); + + // update speed computations + if (!debug) + recompute_speed(current_time); + + // call the end-of-frame callback + if (phase == MACHINE_PHASE_RUNNING) + { + // reset partial updates if we're paused or if the debugger is active + if (machine().first_screen() != NULL && (machine().paused() || debug || debugger_within_instruction_hook(machine()))) + machine().first_screen()->reset_partial_updates(); + } +} + //------------------------------------------------- // end_recording - stop recording of a movie diff -Nru old/emu/video.h src/emu/video.h --- old/emu/video.h 2015-11-25 03:01:02.000000000 -0600 +++ src/emu/video.h 2015-11-30 09:54:23.000000000 -0600 @@ -79,6 +79,9 @@ // render a frame void frame_update(bool debug = false); + + // MKCHAMP - DECLARING THE NEW video_frame_update_hi SUB + void frame_update_hi(bool debug = false); // current speed helpers std::string &speed_text(std::string &str); diff -Nru old/mame/machine/cps2crpt.cpp src/mame/machine/cps2crpt.cpp --- old/mame/machine/cps2crpt.cpp 2015-11-25 03:01:11.000000000 -0600 +++ src/mame/machine/cps2crpt.cpp 2015-11-30 09:54:23.000000000 -0600 @@ -113,6 +113,7 @@ *******************************************************************************/ #include "emu.h" +#include "emuopts.h" #include "cpu/m68000/m68000.h" #include "ui/ui.h" #include "includes/cps1.h" @@ -670,9 +671,13 @@ if ((i & 0xff) == 0) { - char loadingMessage[256]; // for displaying with UI - sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000); - machine.ui().set_startup_text(loadingMessage,FALSE); + //MKCHAMP - DISABLING THE DECRYPING MESSAGE + if (machine.options().disable_loading_patch()) + { + char loadingMessage[256]; // for displaying with UI + sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000); + machine.ui().set_startup_text(loadingMessage,FALSE); + } } diff -Nru old/osd/modules/lib/osdobj_common.cpp src/osd/modules/lib/osdobj_common.cpp --- old/osd/modules/lib/osdobj_common.cpp 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/modules/lib/osdobj_common.cpp 2015-11-30 09:54:23.000000000 -0600 @@ -358,6 +358,22 @@ //------------------------------------------------- +// MKCHAMP +//------------------------------------------------- + +void osd_common_t::update_hi(bool skip_redraw) +{ + // + // This method is called periodically to flush video updates to the + // screen, and also to allow the OSD a chance to update other systems + // on a regular basis. In general this will be called at the frame + // rate of the system being run; however, it may be called at more + // irregular intervals in some circumstances (e.g., multi-screen games + // or games with asynchronous updates). + // +} + +//------------------------------------------------- // init_debugger - perform debugger-specific // initialization //------------------------------------------------- diff -Nru old/osd/modules/lib/osdobj_common.h src/osd/modules/lib/osdobj_common.h --- old/osd/modules/lib/osdobj_common.h 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/modules/lib/osdobj_common.h 2015-11-30 09:54:23.000000000 -0600 @@ -168,6 +168,9 @@ // general overridables virtual void init(running_machine &machine); virtual void update(bool skip_redraw); + + // MKCHAMP DECLARING UPDATE_HI + virtual void update_hi(bool skip_redraw); // debugger overridables virtual void init_debugger(); diff -Nru old/osd/osdepend.h src/osd/osdepend.h --- old/osd/osdepend.h 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/osdepend.h 2015-11-30 09:54:23.000000000 -0600 @@ -64,6 +64,9 @@ // video overridables virtual void *get_slider_list() = 0; // FIXME: returns slider_state * + + //MKCHAMP - DECLARING THE NEW osd_update_hi SUB + virtual void update_hi(bool skip_redraw) = 0; // font interface virtual osd_font *font_alloc() = 0; diff -Nru old/osd/osdmini/minimain.cpp src/osd/osdmini/minimain.cpp --- old/osd/osdmini/minimain.cpp 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/osdmini/minimain.cpp 2015-11-30 09:54:24.000000000 -0600 @@ -164,6 +164,33 @@ machine().schedule_exit(); } +//------------------------------------------------- +// MKChamp update_hi - periodic system update +//------------------------------------------------- + +void mini_osd_interface::update_hi(bool skip_redraw) +{ + // get the minimum width/height for the current layout + int minwidth, minheight; + our_target->compute_minimum_size(minwidth, minheight); + + // make that the size of our target + our_target->set_bounds(minwidth, minheight); + + // get the list of primitives for the target at the current size + render_primitive_list &primlist = our_target->get_primitives(); + + // lock them, and then render them + primlist.acquire_lock(); + + // do the drawing here + primlist.release_lock(); + + // after 5 seconds, exit + if (machine().time() > attotime::from_seconds(5)) + machine().schedule_exit(); +} + //============================================================ // keyboard_get_state diff -Nru old/osd/osdmini/osdmini.h src/osd/osdmini/osdmini.h --- old/osd/osdmini/osdmini.h 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/osdmini/osdmini.h 2015-11-30 09:54:24.000000000 -0600 @@ -33,6 +33,8 @@ // general overridables virtual void init(running_machine &machine); virtual void update(bool skip_redraw); + //MKCHAMP Declaring update_hi + virtual void update_hi(bool skip_redraw); }; diff -Nru old/osd/sdl/osdsdl.h src/osd/sdl/osdsdl.h --- old/osd/sdl/osdsdl.h 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/sdl/osdsdl.h 2015-11-30 09:54:24.000000000 -0600 @@ -149,6 +149,9 @@ // general overridables virtual void init(running_machine &machine); virtual void update(bool skip_redraw); + + //OZFALCON - Declaring hi subroutine + virtual void update_hi(bool skip_redraw); // input overridables virtual void customize_input_type_list(simple_list &typelist); diff -Nru old/osd/sdl/video.cpp src/osd/sdl/video.cpp --- old/osd/sdl/video.cpp 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/sdl/video.cpp 2015-11-30 09:54:24.000000000 -0600 @@ -323,6 +323,35 @@ debugger_update(); } +//============================================================ +// OZFALCON - BELOW IS THE NEW SUB CALLED FROM emu/video.c. ONLY +// DIFFERENCE BETWEEN THIS SUB AND osd_update IS IT CALLS NEW SUB CALLED sdlwindow_video_window_update_hi +// INSTEAD OF sdlwindow_video_window_update (located in osd/sdl/window.c) +//============================================================ + +void sdl_osd_interface::update_hi(bool skip_redraw) +{ + sdl_window_info *window; + + if (m_watchdog != NULL) + m_watchdog->reset(); + + // if we're not skipping this redraw, update all windows + if (!skip_redraw) + { +// profiler_mark(PROFILER_BLIT); + for (window = sdl_window_list; window != NULL; window = window->m_next) + window->update_hi(); +// profiler_mark(PROFILER_END); + } + + // poll the joystick values here + sdlinput_poll(machine()); + check_osd_inputs(machine()); + // if we're running, disable some parts of the debugger + if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0) + debugger_update(); +} //============================================================ // add_primary_monitor diff -Nru old/osd/sdl/window.cpp src/osd/sdl/window.cpp --- old/osd/sdl/window.cpp 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/sdl/window.cpp 2015-11-30 09:54:24.000000000 -0600 @@ -1055,6 +1055,68 @@ } } +//============================================================ +// OZFALCON - 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/sdl/video.c->osd_update_hi WHICH CALLS THIS SUB. +// THE ONLY DIFFERENCE BETWEEN THIS SUB AND sdlwindow_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 sdl_window_info::update_hi() +{ + osd_ticks_t event_wait_ticks; + ASSERT_MAIN_THREAD(); + + // adjust the cursor state + //sdlwindow_update_cursor_state(machine, window); + + execute_async(&update_cursor_state_wt, worker_param(this)); + + // if we're visible and running and not in the middle of a resize, draw + if (m_target != NULL) + { + int tempwidth, tempheight; + + // see if the games video mode has changed + m_target->compute_minimum_size(tempwidth, tempheight); + if (osd_dim(tempwidth, tempheight) != m_minimum_dim) + { + m_minimum_dim = osd_dim(tempwidth, tempheight); + + if (!this->m_fullscreen) + { + //Don't resize window without user interaction; + //window_resize(blitwidth, blitheight); + } + else if (video_config.switchres) + { + osd_dim tmp = this->pick_best_mode(); + resize(tmp.width(), tmp.height()); + } + } + + if (video_config.waitvsync && video_config.syncrefresh) + event_wait_ticks = osd_ticks_per_second(); // block at most a second + else + event_wait_ticks = 0; + + if (osd_event_wait(m_rendered_event, event_wait_ticks)) + { + // ensure the target bounds are up-to-date, and then get the primitives + + render_primitive_list &primlist = *m_renderer->get_primitives(); + + // and redraw now + + execute_async(&draw_video_contents_wt, worker_param(this, primlist)); + + } + } +} //============================================================ // set_starting_view diff -Nru old/osd/sdl/window.h src/osd/sdl/window.h --- old/osd/sdl/window.h 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/sdl/window.h 2015-11-30 09:54:24.000000000 -0600 @@ -72,6 +72,8 @@ int window_init(); void update(); + //MKCHAMP DECLARING UPDATE_HI + void update_hi(); void toggle_full_screen(); void modify_prescale(int dir); void resize(INT32 width, INT32 height); diff -Nru old/osd/windows/video.cpp src/osd/windows/video.cpp --- old/osd/windows/video.cpp 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/windows/video.cpp 2015-11-30 09:54:24.000000000 -0600 @@ -199,6 +199,33 @@ debugger_update(); } +//============================================================ +// MKCHAMP - BELOW IS THE NEW SUB CALLED FROM emu/video.c. +//============================================================ + +void windows_osd_interface::update_hi(bool skip_redraw) +{ + // ping the watchdog on each update + winmain_watchdog_ping(); + + // if we're not skipping this redraw, update all windows + if (!skip_redraw) + { +// profiler_mark(PROFILER_BLIT); + for (win_window_info *window = win_window_list; window != NULL; window = window->m_next) + window->update_hi(); +// profiler_mark(PROFILER_END); + } + + // poll the joystick values here + winwindow_process_events(machine(), TRUE, FALSE); + wininput_poll(machine()); + check_osd_inputs(machine()); + // if we're running, disable some parts of the debugger + if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0) + debugger_update(); +} + diff -Nru old/osd/windows/window.cpp src/osd/windows/window.cpp --- old/osd/windows/window.cpp 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/windows/window.cpp 2015-11-30 09:54:24.000000000 -0600 @@ -829,6 +829,77 @@ mtlog_add("winwindow_video_window_update: end"); } +//============================================================ +// MKCHAMP - LAST OF THE NEW SUB CHAIN. + +void win_window_info::update_hi() +{ + int targetview, targetorient; + render_layer_config targetlayerconfig; + + assert(GetCurrentThreadId() == main_threadid); + + mtlog_add("winwindow_video_window_update: begin"); + + // see if the target has changed significantly in window mode + targetview = m_target->view(); + targetorient = m_target->orientation(); + targetlayerconfig = m_target->layer_config(); + if (targetview != m_targetview || targetorient != m_targetorient || targetlayerconfig != m_targetlayerconfig) + { + m_targetview = targetview; + m_targetorient = targetorient; + m_targetlayerconfig = targetlayerconfig; + + // in window mode, reminimize/maximize + if (!m_fullscreen) + { + if (m_isminimized) + SendMessage(m_hwnd, WM_USER_SET_MINSIZE, 0, 0); + if (m_ismaximized) + SendMessage(m_hwnd, WM_USER_SET_MAXSIZE, 0, 0); + } + } + + // if we're visible and running and not in the middle of a resize, draw + if (m_hwnd != NULL && m_target != NULL && m_renderer != NULL) + { + int got_lock = TRUE; + + mtlog_add("winwindow_video_window_update: try lock"); + + // only block if we're throttled + if (machine().video().throttled() || timeGetTime() - last_update_time > 250) + osd_lock_acquire(m_render_lock); + else + got_lock = osd_lock_try(m_render_lock); + + // only render if we were able to get the lock + if (got_lock) + { + //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(m_render_lock); + + // ensure the target bounds are up-to-date, and then get the primitives + m_renderer->get_primitives(); + + // 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(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist); + //else + // SendMessage(m_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 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/windows/window.h 2015-11-30 09:54:25.000000000 -0600 @@ -45,6 +45,9 @@ int fullscreen() const { return m_fullscreen; } void update(); + + //MKCHAMP + void update_hi(); osd_monitor_info *winwindow_video_window_monitor(const osd_rect *proposed); diff -Nru old/osd/windows/winmain.h src/osd/windows/winmain.h --- old/osd/windows/winmain.h 2015-11-25 03:01:14.000000000 -0600 +++ src/osd/windows/winmain.h 2015-11-30 09:54:25.000000000 -0600 @@ -271,6 +271,9 @@ void osd_exit(); windows_options &m_options; + //MKChamp - Declaring hi subroutine + virtual void update_hi(bool skip_redraw); + static const int DEFAULT_FONT_HEIGHT = 200; }; diff -Nru oldscripts/src/emu.lua scripts/src/emu.lua --- oldscripts/src/emu.lua 2015-11-25 03:00:55.000000000 -0600 +++ scripts/src/emu.lua 2015-11-30 10:08:19.000000000 -0600 @@ -119,6 +119,8 @@ MAME_DIR .. "src/emu/fileio.h", MAME_DIR .. "src/emu/hash.cpp", MAME_DIR .. "src/emu/hash.h", + MAME_DIR .. "src/emu/hiscore.cpp", + MAME_DIR .. "src/emu/hiscore.h", MAME_DIR .. "src/emu/image.cpp", MAME_DIR .. "src/emu/image.h", MAME_DIR .. "src/emu/info.cpp",