void osd_init(running_machine *machine) { // thread priority if (!options_get_bool(mame_options(), OPTION_DEBUG)) SetThreadPriority(GetCurrentThread(), options_get_int(mame_options(), WINOPTION_PRIORITY)); // ensure we get called on the way out add_exit_callback(machine, osd_exit); // initialize the subsystems winvideo_init(machine); winsound_init(machine); wininput_init(machine); winoutput_init(machine); // hook up the debugger log if (options_get_bool(mame_options(), WINOPTION_OSLOG)) add_logerror_callback(machine, output_oslog); // crank up the multimedia timer resolution to its max // this gives the system much finer timeslices timeresult = timeGetDevCaps(&caps, sizeof(caps)); if (timeresult == TIMERR_NOERROR) timeBeginPeriod(caps.wPeriodMin); // set our multimedia tasks if we can // if (av_set_mm_thread_characteristics != NULL) // mm_task = (*av_set_mm_thread_characteristics)(TEXT("Playback"), &task_index); start_profiler(); }
void osd_init(running_machine *machine) { int watchdog = options_get_int(mame_options(), WINOPTION_WATCHDOG); const char *stemp; // thread priority if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)) SetThreadPriority(GetCurrentThread(), options_get_int(mame_options(), WINOPTION_PRIORITY)); // ensure we get called on the way out add_exit_callback(machine, osd_exit); // get number of processors stemp = options_get_string(mame_options(), WINOPTION_NUMPROCESSORS); osd_num_processors = 0; if (strcmp(stemp, "auto") != 0) { osd_num_processors = atoi(stemp); if (osd_num_processors < 1) { mame_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n"); osd_num_processors = 0; } } // initialize the subsystems winvideo_init(machine); winsound_init(machine); wininput_init(machine); winoutput_init(machine); // hook up the debugger log if (options_get_bool(mame_options(), WINOPTION_OSLOG)) add_logerror_callback(machine, output_oslog); // crank up the multimedia timer resolution to its max // this gives the system much finer timeslices timeresult = timeGetDevCaps(&caps, sizeof(caps)); if (timeresult == TIMERR_NOERROR) timeBeginPeriod(caps.wPeriodMin); // set our multimedia tasks if we can // if (av_set_mm_thread_characteristics != NULL) // mm_task = (*av_set_mm_thread_characteristics)(TEXT("Playback"), &task_index); start_profiler(); // if a watchdog thread is requested, create one if (watchdog != 0) { watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL); assert_always(watchdog_reset_event != NULL, "Failed to create watchdog reset event"); watchdog_exit_event = CreateEvent(NULL, TRUE, FALSE, NULL); assert_always(watchdog_exit_event != NULL, "Failed to create watchdog exit event"); watchdog_thread = CreateThread(NULL, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, NULL); assert_always(watchdog_thread != NULL, "Failed to create watchdog thread"); } }
int CLIP_DLLEXPORT _clip_start_profiler(ClipMachine * ClipMachineMemory) { ProfileBucket *bp; bp = find_profile_bucket(ClipMachineMemory); return start_profiler(ClipMachineMemory, bp); }
int utf8_main(int argc, char **argv) { int game_index; char *ext; int res = 0; HMODULE library; // initialize common controls InitCommonControls(); // set up exception handling pass_thru_filter = SetUnhandledExceptionFilter(exception_filter); #ifndef WINUI // check for double-clicky starts if (check_for_double_click_start(argc) != 0) return 1; #endif // see if we can use TryEnterCriticalSection try_enter_critical_section = NULL; library = LoadLibrary(TEXT("kernel32.dll")); if (library != NULL) try_enter_critical_section = (try_enter_critical_section_ptr)GetProcAddress(library, "TryEnterCriticalSection"); strcpy(mapfile_name, argv[0]); ext = strchr(mapfile_name, '.'); if (ext) strcpy(ext, ".map"); else strcat(mapfile_name, ".map"); // parse config and cmdline options game_index = cli_frontend_init(argc, argv); // have we decided on a game? if (game_index != -1) { TIMECAPS caps; MMRESULT result; // crank up the multimedia timer resolution to its max // this gives the system much finer timeslices result = timeGetDevCaps(&caps, sizeof(caps)); if (result == TIMERR_NOERROR) timeBeginPeriod(caps.wPeriodMin); start_profiler(); // run the game res = run_game(game_index); stop_profiler(); // restore the timer resolution if (result == TIMERR_NOERROR) timeEndPeriod(caps.wPeriodMin); } // one last pass at events winwindow_process_events(0); // close errorlog, input and playback cli_frontend_exit(); return res; }