예제 #1
0
파일: output.cpp 프로젝트: NULUSIOS/mame
output_manager::output_manager(running_machine &machine)
	: m_machine(machine),
		m_uniqueid(12345)
{
	/* add pause callback */
	machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(output_manager::pause), this));
	machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(output_manager::resume), this));
}
예제 #2
0
파일: output.cpp 프로젝트: ursine/mame
void output_init(running_machine &machine)
{
	/* add pause callback */
	machine.add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(output_pause), &machine));
	machine.add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(output_resume), &machine));

	/* get a callback when done */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(output_exit), &machine));

	/* reset the lists */
	memset(itemtable, 0, sizeof(itemtable));
	global_notifylist.reset();
}
예제 #3
0
void osd_xenon_video_hw_init(running_machine &machine) {
    XenosSurface * fb = Xe_GetFramebufferSurface(g_pVideoDevice);

    Xe_SetRenderTarget(g_pVideoDevice, fb);

    LoadShaderEffects();

    g_pTexture = Xe_CreateTexture(g_pVideoDevice, XE_W, XE_H, 1, XE_FMT_8888 | XE_FMT_ARGB, 0);
    screen = (unsigned int*) Xe_Surface_LockRect(g_pVideoDevice, g_pTexture, 0, 0, 0, 0, XE_LOCK_WRITE);
    Xe_Surface_Unlock(g_pVideoDevice, g_pTexture);

    g_pTexture->use_filtering = 0;

    pitch = g_pTexture->wpitch;

    screen_width = fb->width;
    screen_height = fb->height;

    vb = Xe_CreateVertexBuffer(g_pVideoDevice, 65536 * sizeof (MameVerticeFormats));
    soft_vb = Xe_CreateVertexBuffer(g_pVideoDevice, 65536 * sizeof (MameVerticeFormats));


    float w = fb->width;
    float h = fb->height;

    Xe_SetClearColor(g_pVideoDevice, 0);

    osd_xenon_video_resume();

    // on mame exit
    machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_xenon_video_cleanup), &machine));
}
예제 #4
0
int sdlvideo_init(running_machine &machine)
{
	int index;

	// extract data from the options
	extract_video_config(machine);

	// ensure we get called on the way out
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(video_exit), &machine));

	// set up monitors first
	init_monitors();

	// we need the beam width in a float, contrary to what the core does.
	video_config.beamwidth = machine.options().beam();

	// initialize the window system so we can make windows
	if (sdlwindow_init(machine))
		return 1;

	// create the windows
	sdl_options &options = downcast<sdl_options &>(machine.options());
	for (index = 0; index < video_config.numscreens; index++)
	{
		sdl_window_config conf;
		memset(&conf, 0, sizeof(conf));
		extract_window_config(machine, index, &conf);
		if (sdlwindow_video_window_create(machine, index, pick_monitor(options, index), &conf))
			return 1;
	}

	return 0;
}
예제 #5
0
파일: debugger.cpp 프로젝트: robsonfr/mame
void debugger_init(running_machine &machine)
{
    /* only if debugging is enabled */
    if (machine.debug_flags & DEBUG_FLAG_ENABLED)
    {
        machine_entry *entry;

        /* initialize the submodules */
        machine.m_debug_view.reset(global_alloc(debug_view_manager(machine)));
        debug_cpu_init(machine);
        debug_command_init(machine);
        debug_console_init(machine);

        /* allocate a new entry for our global list */
        machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugger_exit), &machine));
        entry = global_alloc(machine_entry);
        entry->next = machine_list;
        entry->machine = &machine;
        machine_list = entry;

        /* register an atexit handler if we haven't yet */
        if (!atexit_registered)
            atexit(debugger_flush_all_traces_on_abnormal_exit);
        atexit_registered = TRUE;

        /* listen in on the errorlog */
        machine.add_logerror_callback(debug_errorlog_write_line);

        /* initialize osd debugger features */
        machine.osd().init_debugger();
    }
}
예제 #6
0
void osd_xenon_video_hw_init(running_machine &machine) {
    TR;
    XenosSurface * fb = Xe_GetFramebufferSurface(g_pVideoDevice);
    Xe_SetClearColor(g_pVideoDevice, 0);
    // on mame exit
    machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_xenon_video_cleanup), &machine));
}
예제 #7
0
파일: cheat.c 프로젝트: jiangzhonghui/mame
cheat_manager::cheat_manager(running_machine &machine)
	: m_machine(machine),
		m_disabled(true),
		m_symtable(&machine)
{
	// if the cheat engine is disabled, we're done
	if (!machine.options().cheat())
		return;

	// request a callback
	machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(cheat_manager::frame_update), this));

	// create a global symbol table
	m_symtable.add("frame", symbol_table::READ_ONLY, &m_framecount);
	m_symtable.add("frombcd", NULL, 1, 1, execute_frombcd);
	m_symtable.add("tobcd", NULL, 1, 1, execute_tobcd);

	// we rely on the debugger expression callbacks; if the debugger isn't
	// enabled, we must jumpstart them manually
	if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0)
		debug_cpu_init(machine);

	// configure for memory access (shared with debugger)
	debug_cpu_configure_memory(machine, m_symtable);

	// load the cheats
	reload();
}
예제 #8
0
파일: menu.cpp 프로젝트: toughkidcst/mame
void ui_menu::init(running_machine &machine)
{
	int x;

	// initialize the menu stack
	ui_menu::stack_reset(machine);

	// create a texture for hilighting items
	hilight_bitmap = std::make_unique<bitmap_rgb32>(256, 1);
	for (x = 0; x < 256; x++)
	{
		int alpha = 0xff;
		if (x < 25) alpha = 0xff * x / 25;
		if (x > 256 - 25) alpha = 0xff * (255 - x) / 25;
		hilight_bitmap->pix32(0, x) = rgb_t(alpha,0xff,0xff,0xff);
	}
	hilight_texture = machine.render().texture_alloc();
	hilight_texture->set_bitmap(*hilight_bitmap, hilight_bitmap->cliprect(), TEXFORMAT_ARGB32);

	// create a texture for arrow icons
	arrow_texture = machine.render().texture_alloc(render_triangle);

	// add an exit callback to free memory
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu::exit), &machine));
}
예제 #9
0
void ui_gfx_init(running_machine &machine)
{
	ui_gfx_state *state = &ui_gfx;
	UINT8 rotate = machine.system().flags & ORIENTATION_MASK;

	// make sure we clean up after ourselves
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_gfx_exit), &machine));

	// initialize our global state
	memset(state, 0, sizeof(*state));

	// set up the palette state
	state->palette.columns = 16;

	// set up the graphics state
	for (UINT8 i = 0; i < MAX_GFX_DECODERS; i++)
		for (UINT8 j = 0; j < MAX_GFX_ELEMENTS; j++)
		{
			state->gfxdev[i].rotate[j] = rotate;
			state->gfxdev[i].columns[j] = 16;
		}

	// set up the tilemap state
	state->tilemap.rotate = rotate;
}
예제 #10
0
파일: romload.c 프로젝트: broftkd/mess-svn
void rom_init(running_machine &machine)
{
	rom_load_data *romdata;

	/* allocate private data */
	machine.romload_data = romdata = auto_alloc_clear(machine, romload_private);

	/* make sure we get called back on the way out */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rom_exit), &machine));

	/* reset the romdata struct */
	romdata->m_machine = &machine;

	/* figure out which BIOS we are using */
	determine_bios_rom(romdata);

	/* count the total number of ROMs */
	count_roms(romdata);

	/* reset the disk list */
	romdata->chd_list.reset();

	/* process the ROM entries we were passed */
	process_region_list(romdata);

	/* display the results and exit */
	display_rom_load_results(romdata);
}
예제 #11
0
파일: image.c 프로젝트: bdidier/MAME-OS-X
void image_postdevice_init(running_machine &machine)
{
	device_image_interface *image = NULL;

	/* make sure that any required devices have been allocated */
    for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image))
    {
			int result = image->finish_load();
			/* did the image load fail? */
			if (result)
			{
				/* retrieve image error message */
				astring image_err = astring(image->error());

				/* unload all images */
				image_unload_all(machine);

				fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load failed: %s",
					image->device().name(),
					image_err.cstr());
			}
	}

	/* add a callback for when we shut down */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(image_unload_all), &machine));
}
예제 #12
0
파일: video.c 프로젝트: Ilgrim/MAMEHub
void winvideo_init(running_machine &machine)
{
	int index;

	// ensure we get called on the way out
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winvideo_exit), &machine));

	// extract data from the options
	extract_video_config(machine);

	// set up monitors first
	init_monitors();

	// initialize the window system so we can make windows
	winwindow_init(machine);

	// create the windows
	windows_options &options = downcast<windows_options &>(machine.options());
	for (index = 0; index < video_config.numscreens; index++)
		winwindow_video_window_create(machine, index, pick_monitor(options, index), &video_config.window[index]);
	if (video_config.mode != VIDEO_MODE_NONE)
		SetForegroundWindow(win_window_list->hwnd);

	// possibly create the debug window, but don't show it yet
	if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)
		machine.osd().init_debugger();
}
예제 #13
0
파일: viewgfx.cpp 프로젝트: qwijibo/mame
void ui_gfx_init(running_machine &machine)
{
	ui_gfx_state *state = &ui_gfx;
	uint8_t rotate = machine.system().flags & machine_flags::MASK_ORIENTATION;

	// make sure we clean up after ourselves
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&ui_gfx_exit, &machine));

	// initialize our global state
	memset(state, 0, sizeof(*state));

	// set up the palette state
	state->palette.columns = 16;

	// set up the graphics state
	for (uint8_t i = 0; i < MAX_GFX_DECODERS; i++)
		for (uint8_t j = 0; j < MAX_GFX_ELEMENTS; j++)
		{
			state->gfxdev[i].rotate[j] = rotate;
			state->gfxdev[i].columns[j] = 16;
		}

	// set up the tilemap state
	state->tilemap.rotate = rotate;
	state->tilemap.flags = TILEMAP_DRAW_ALL_CATEGORIES;
}
예제 #14
0
void generic_machine_init(running_machine &machine)
{
	generic_machine_private *state;
	int counternum;

	/* allocate our state */
	machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private);
	state = machine.generic_machine_data;

	/* reset coin counters */
	for (counternum = 0; counternum < COIN_COUNTERS; counternum++)
	{
		state->lastcoin[counternum] = 0;
		state->coinlockedout[counternum] = 0;
	}

	/* register coin save state */
	machine.save().save_item(NAME(state->coin_count));
	machine.save().save_item(NAME(state->coinlockedout));
	machine.save().save_item(NAME(state->lastcoin));

	/* reset memory card info */
	state->memcard_inserted = -1;

	/* register for configuration */
	config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine));

	/* for memory cards, request save state and an exit callback */
	if (machine.config().m_memcard_handler != NULL)
	{
		machine.save().save_item(NAME(state->memcard_inserted));
		machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine));
	}
}
예제 #15
0
void generic_machine_init(running_machine &machine)
{
    generic_machine_private *state;
    int counternum;

    /* allocate our state */
    machine.generic_machine_data = auto_alloc_clear(machine, generic_machine_private);
    state = machine.generic_machine_data;

    /* reset coin counters */
    for (counternum = 0; counternum < COIN_COUNTERS; counternum++)
    {
        state->lastcoin[counternum] = 0;
        state->coinlockedout[counternum] = 0;
    }

    // map devices to the interrupt state
    memset(state->interrupt_device, 0, sizeof(state->interrupt_device));
    device_execute_interface *exec = NULL;
    int index = 0;
    for (bool gotone = machine.devicelist().first(exec); gotone && index < ARRAY_LENGTH(state->interrupt_device); gotone = exec->next(exec))
        state->interrupt_device[index++] = &exec->device();

    /* register coin save state */
    machine.save().save_item(NAME(state->coin_count));
    machine.save().save_item(NAME(state->coinlockedout));
    machine.save().save_item(NAME(state->lastcoin));

    /* reset memory card info */
    state->memcard_inserted = -1;

    /* register a reset callback and save state for interrupt enable */
    machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(interrupt_reset), &machine));
    machine.save().save_item(NAME(state->interrupt_enable));

    /* register for configuration */
    config_register(machine, "counters", config_saveload_delegate(FUNC(counters_load), &machine), config_saveload_delegate(FUNC(counters_save), &machine));

    /* for memory cards, request save state and an exit callback */
    if (machine.config().m_memcard_handler != NULL)
    {
        state_save_register_global(machine, state->memcard_inserted);
        machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(memcard_eject), &machine));
    }
}
예제 #16
0
void gtia_init(running_machine &machine, const gtia_interface *intf)
{
	memset(&gtia, 0, sizeof(gtia));
	gtia.intf = *intf;

	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(gtia_reset), &machine));

	/* state saves */
	gtia_state(machine);
}
예제 #17
0
void ui_input_init(running_machine &machine)
{
    /* create the private data */
    machine.ui_input_data = auto_alloc_clear(machine, ui_input_private);
    machine.ui_input_data->current_mouse_x = -1;
    machine.ui_input_data->current_mouse_y = -1;

    /* add a frame callback to poll inputs */
    machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(ui_input_frame_update), &machine));
}
예제 #18
0
파일: window.c 프로젝트: clobber/UME
int sdlwindow_init(running_machine &machine)
{
	mame_printf_verbose("Enter sdlwindow_init\n");
	// determine if we are using multithreading or not
	multithreading_enabled = downcast<sdl_options &>(machine.options()).multithreading();

	// get the main thread ID before anything else
	main_threadid = SDL_ThreadID();

	// ensure we get called on the way out
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdlwindow_exit), &machine));

	// if multithreading, create a thread to run the windows
	if (multithreading_enabled)
	{
		// create a thread to run the windows from
		work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_IO);
		if (work_queue == NULL)
			return 1;
		osd_work_item_queue(work_queue, &sdlwindow_thread_id, NULL, WORK_ITEM_FLAG_AUTO_RELEASE);
	}
	else
	{
		// otherwise, treat the window thread as the main thread
		//window_threadid = main_threadid;
		sdlwindow_thread_id(NULL, 0);
	}

	// initialize the drawers
#if USE_OPENGL
	if (video_config.mode == VIDEO_MODE_OPENGL)
	{
		if (drawogl_init(machine, &draw))
			video_config.mode = VIDEO_MODE_SOFT;
	}
#endif
#if SDLMAME_SDL2
	if (video_config.mode == VIDEO_MODE_SDL13)
	{
		if (draw13_init(machine, &draw))
			video_config.mode = VIDEO_MODE_SOFT;
	}
#endif
	if (video_config.mode == VIDEO_MODE_SOFT)
	{
		if (drawsdl_init(&draw))
			return 1;
	}

	// set up the window list
	last_window_ptr = &sdl_window_list;
	mame_printf_verbose("Leave sdlwindow_init\n");
	return 0;
}
예제 #19
0
void watchdog_init(running_machine &machine)
{
	/* allocate a timer for the watchdog */
	watchdog_timer = machine.scheduler().timer_alloc(FUNC(watchdog_callback));

	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(watchdog_internal_reset), &machine));

	/* save some stuff in the default tag */
	machine.save().save_item(NAME(watchdog_enabled));
	machine.save().save_item(NAME(watchdog_counter));
}
예제 #20
0
void winoutput_init(running_machine &machine)
{
	int result;

	// ensure we get cleaned up
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winoutput_exit), &machine));

	// reset globals
	clientlist = NULL;

	// create our window class
	result = create_window_class();
	assert(result == 0);
	(void)result; // to silence gcc 4.6

	// create a window
	output_hwnd = CreateWindowEx(
						WINDOW_STYLE_EX,
						OUTPUT_WINDOW_CLASS,
						OUTPUT_WINDOW_NAME,
						WINDOW_STYLE,
						0, 0,
						1, 1,
						NULL,
						NULL,
						GetModuleHandle(NULL),
						NULL);
	assert(output_hwnd != NULL);

	// set a pointer to the running machine
	SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)&machine);

	// allocate message ids
	om_mame_start = RegisterWindowMessage(OM_MAME_START);
	assert(om_mame_start != 0);
	om_mame_stop = RegisterWindowMessage(OM_MAME_STOP);
	assert(om_mame_stop != 0);
	om_mame_update_state = RegisterWindowMessage(OM_MAME_UPDATE_STATE);
	assert(om_mame_update_state != 0);

	om_mame_register_client = RegisterWindowMessage(OM_MAME_REGISTER_CLIENT);
	assert(om_mame_register_client != 0);
	om_mame_unregister_client = RegisterWindowMessage(OM_MAME_UNREGISTER_CLIENT);
	assert(om_mame_unregister_client != 0);
	om_mame_get_id_string = RegisterWindowMessage(OM_MAME_GET_ID_STRING);
	assert(om_mame_get_id_string != 0);

	// broadcast a startup message
	PostMessage(HWND_BROADCAST, om_mame_start, (WPARAM)output_hwnd, 0);

	// register a notifier for output changes
	output_set_notifier(NULL, notifier_callback, NULL);
}
예제 #21
0
void tecmosys_prot_init(running_machine &machine, int which)
{
	tecmosys_state *state = machine.driver_data<tecmosys_state>();
	switch (which)
	{
	case 0: state->m_device_data = &deroon_data; break;
	case 1: state->m_device_data = &tkdensho_data; break;
	case 2: state->m_device_data = &tkdensha_data; break;
	}

	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_prot_reset), &machine));
}
예제 #22
0
void osd_common_t::init(running_machine &machine)
{
	//
	// This function is responsible for initializing the OSD-specific
	// video and input functionality, and registering that functionality
	// with the MAME core.
	//
	// In terms of video, this function is expected to create one or more
	// render_targets that will be used by the MAME core to provide graphics
	// data to the system. Although it is possible to do this later, the
	// assumption in the MAME core is that the user interface will be
	// visible starting at init() time, so you will have some work to
	// do to avoid these assumptions.
	//
	// In terms of input, this function is expected to enumerate all input
	// devices available and describe them to the MAME core by adding
	// input devices and their attached items (buttons/axes) via the input
	// system.
	//
	// Beyond these core responsibilities, init() should also initialize
	// any other OSD systems that require information about the current
	// running_machine.
	//
	// This callback is also the last opportunity to adjust the options
	// before they are consumed by the rest of the core.
	//
	// Future work/changes:
	//
	// Audio initialization may eventually move into here as well,
	// instead of relying on independent callbacks from each system.
	//

	m_machine = &machine;

	osd_options &options = downcast<osd_options &>(machine.options());
	// extract the verbose printing option
	if (options.verbose())
		set_verbose(true);

	// ensure we get called on the way out
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_common_t::osd_exit), this));


	/* now setup watchdog */
	int watchdog_timeout = options.watchdog();

	if (watchdog_timeout != 0)
	{
		m_watchdog = std::make_unique<osd_watchdog>();
		m_watchdog->setTimeout(watchdog_timeout);
	}
}
예제 #23
0
파일: atari.c 프로젝트: coinhelper/jsmess
void atari_machine_start(running_machine &machine)
{
	gtia_interface gtia_intf;

	/* GTIA */
	memset(&gtia_intf, 0, sizeof(gtia_intf));
	if (machine.root_device().ioport("console") != NULL)
		gtia_intf.console_read = console_read;
	if (machine.device<dac_device>("dac") != NULL)
		gtia_intf.console_write = console_write;
	gtia_init(machine, &gtia_intf);

	/* pokey */
	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(pokey_reset), &machine));

	/* ANTIC */
	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(_antic_reset), &machine));

	/* save states */
	state_save_register_global_pointer(machine, ((UINT8 *) &antic.r), sizeof(antic.r));
	state_save_register_global_pointer(machine, ((UINT8 *) &antic.w), sizeof(antic.w));
}
예제 #24
0
파일: uiinput.cpp 프로젝트: dlabi/mame
ui_input_manager::ui_input_manager(running_machine &machine)
	: m_machine(machine),
		m_current_mouse_target(nullptr),
		m_current_mouse_down(false),
		m_events_start(0),
		m_events_end(0)
{
	/* create the private data */
	m_current_mouse_x = -1;
	m_current_mouse_y = -1;

	/* add a frame callback to poll inputs */
	machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(ui_input_manager::frame_update), this));
}
예제 #25
0
void winsound_init(running_machine &machine)
{
	// if no sound, don't create anything
	if (!machine.options().sound())
		return;

#ifdef USE_AUDIO_SYNC
	audio_sync = machine.options().bool_value(WINOPTION_AUDIO_SYNC);
#endif /* USE_AUDIO_SYNC */

	// ensure we get called on the way out
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sound_exit), &machine));

	// attempt to initialize directsound
	// don't make it fatal if we can't -- we'll just run without sound
	dsound_init(machine);
}
예제 #26
0
void debug_console_init(running_machine &machine)
{
	/* allocate text buffers */
	console_textbuf = text_buffer_alloc(CONSOLE_BUF_SIZE, CONSOLE_MAX_LINES);
	if (!console_textbuf)
		return;

	errorlog_textbuf = text_buffer_alloc(ERRORLOG_BUF_SIZE, ERRORLOG_MAX_LINES);
	if (!errorlog_textbuf)
		return;

	/* print the opening lines */
	debug_console_printf(machine, "%s debugger version %s\n", emulator_info::get_appname(), build_version);
	debug_console_printf(machine, "Currently targeting %s (%s)\n", machine.system().name, machine.system().description);

	/* request callback upon exiting */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_console_exit), &machine));
}
예제 #27
0
파일: sound.c 프로젝트: Ilgrim/MAMEHub
//============================================================
//  osd_start_audio_stream
//============================================================
void sdlaudio_init(running_machine &machine)
{
	if (LOG_SOUND)
		sound_log = fopen(SDLMAME_SOUND_LOG, "w");

	// skip if sound disabled
	if (machine.sample_rate() != 0)
	{
		// attempt to initialize SDL
		if (sdl_init(machine))
			return;

		machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdl_cleanup_audio), &machine));
		// set the startup volume
		machine.osd().set_mastervolume(attenuation);
	}
	return;
}
예제 #28
0
void rom_init(running_machine &machine)
{
	romload_private *romdata;

	/* allocate private data */
	machine.romload_data = romdata = auto_alloc_clear(machine, romload_private);

	/* make sure we get called back on the way out */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rom_exit), &machine));

	/* reset the romdata struct */
	romdata->m_machine = &machine;

	/* figure out which BIOS we are using */
	device_iterator deviter(romdata->machine().config().root_device());
	for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) {
		if (device->rom_region()) {
			const char *specbios;
			astring temp;
			if (strcmp(device->tag(),":")==0) {
				specbios = romdata->machine().options().bios();
			} else {
				specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios");
				if (strlen(specbios) == 0) {
					specbios = device->default_bios_tag().cstr();
				}
			}
			determine_bios_rom(romdata, device, specbios);
		}
	}

	/* count the total number of ROMs */
	count_roms(romdata);

	/* reset the disk list */
	romdata->chd_list.reset();

	/* process the ROM entries we were passed */
	process_region_list(romdata);

	/* display the results and exit */
	display_rom_load_results(romdata, FALSE);
}
예제 #29
0
파일: crsshair.c 프로젝트: broftkd/mess-svn
void crosshair_init(running_machine &machine)
{
	/* request a callback upon exiting */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_exit), &machine));

	/* clear all the globals */
	memset(&global, 0, sizeof(global));

	/* setup the default auto visibility time */
	global.auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;

	/* determine who needs crosshairs */
	for (ioport_port *port = machine.ioport().first_port(); port != NULL; port = port->next())
		for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
			if (field->crosshair_axis() != CROSSHAIR_AXIS_NONE)
			{
				int player = field->player();

				assert(player < MAX_PLAYERS);

				/* mark as used and set the default visibility and mode */
				global.usage = TRUE;
				global.used[player] = TRUE;
				global.mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
				global.visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;

				/* for now, use the main screen */
				global.screen[player] = machine.primary_screen;

				create_bitmap(machine, player);
			}

	/* register callbacks for when we load/save configurations */
	if (global.usage)
		config_register(machine, "crosshairs", config_saveload_delegate(FUNC(crosshair_load), &machine), config_saveload_delegate(FUNC(crosshair_save), &machine));

	/* register the animation callback */
	if (machine.primary_screen != NULL)
		machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(animate), &machine));
}
예제 #30
0
파일: crsshair.cpp 프로젝트: Fulg/mame
crosshair_manager::crosshair_manager(running_machine &machine)
	: m_machine(machine)
{
	/* request a callback upon exiting */
	machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(crosshair_manager::exit), this));

	/* setup the default auto visibility time */
	m_auto_time = CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT;

	/* determine who needs crosshairs */
	for (auto &port : machine.ioport().ports())
		for (ioport_field &field : port.second->fields())
			if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE)
			{
				int player = field.player();

				assert(player < MAX_PLAYERS);

				/* mark as used and set the default visibility and mode */
				m_usage = TRUE;
				m_used[player] = TRUE;
				m_mode[player] = CROSSHAIR_VISIBILITY_DEFAULT;
				m_visible[player] = (CROSSHAIR_VISIBILITY_DEFAULT == CROSSHAIR_VISIBILITY_OFF) ? FALSE : TRUE;

				/* for now, use the main screen */
				m_screen[player] = machine.first_screen();

				create_bitmap(player);
			}

	/* register callbacks for when we load/save configurations */
	if (m_usage)
		machine.configuration().config_register("crosshairs", config_saveload_delegate(FUNC(crosshair_manager::config_load), this), config_saveload_delegate(FUNC(crosshair_manager::config_save), this));

	/* register the animation callback */
	if (machine.first_screen() != nullptr)
		machine.first_screen()->register_vblank_callback(vblank_state_delegate(FUNC(crosshair_manager::animate), this));
}