Beispiel #1
0
void osd_common_t::init_subsystems()
{
	if (!video_init())
	{
		video_exit();
		osd_printf_error("video_init: Initialization failed!\n\n\n");
		fflush(stderr);
		fflush(stdout);
		exit(-1);
	}

	input_init();
	// we need pause callbacks
	machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(osd_common_t::input_pause), this));
	machine().add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(osd_common_t::input_resume), this));

	output_init();

	m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER);

	m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER);
	m_sound->m_sample_rate = options().sample_rate();
	m_sound->m_audio_latency = options().audio_latency();

	m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER);

	select_module_options<netdev_module *>(options(), OSD_NETDEV_PROVIDER);

	m_midi = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);

	m_mod_man.init(options());

}
Beispiel #2
0
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));
}
Beispiel #3
0
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();
}
Beispiel #4
0
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);
}
Beispiel #5
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));
}
Beispiel #6
0
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();
    }
}
Beispiel #7
0
ui_manager* mame_machine_manager::create_ui(running_machine& machine)
{
	m_ui = std::make_unique<mame_ui_manager>(machine);
	m_ui->init();

	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(mame_machine_manager::reset), this));
	
	// start the inifile manager
	m_inifile = std::make_unique<inifile_manager>(machine);
	
	m_ui->set_startup_text("Initializing...", true);
	// set up the cheat engine
	m_cheat = std::make_unique<cheat_manager>(machine);

	// allocate autoboot timer
	m_autoboot_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mame_machine_manager::autoboot_callback), this));

	// start datfile manager
	m_datfile = std::make_unique<datfile_manager>(machine);

	// start favorite manager
	m_favorite = std::make_unique<favorite_manager>(machine);

	return m_ui.get();
}
Beispiel #8
0
void taitopjc_state::video_start()
{
	m_screen_ram = std::make_unique<UINT32[]>(0x40000);
	m_pal_ram = std::make_unique<UINT32[]>(0x8000);

	machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitopjc_state::video_exit), this));
}
Beispiel #9
0
void taitopjc_state::video_start()
{
	static const gfx_layout char_layout =
	{
		16, 16,
		4032,
		8,
		{ 0,1,2,3,4,5,6,7 },
		{ 3*8, 2*8, 1*8, 0*8, 7*8, 6*8, 5*8, 4*8, 11*8, 10*8, 9*8, 8*8, 15*8, 14*8, 13*8, 12*8 },
		{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
		8*256
	};

	m_screen_ram = std::make_unique<UINT32[]>(0x40000);
	m_pal_ram = std::make_unique<UINT32[]>(0x8000);

	m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(taitopjc_state::tile_get_info),this), tilemap_mapper_delegate(FUNC(taitopjc_state::tile_scan_layer0),this), 16, 16, 32, 32);
	m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(taitopjc_state::tile_get_info),this), tilemap_mapper_delegate(FUNC(taitopjc_state::tile_scan_layer1),this), 16, 16, 32, 32);
	m_tilemap[0]->set_transparent_pen(0);
	m_tilemap[1]->set_transparent_pen(1);

	m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(*m_palette, char_layout, (UINT8*)m_screen_ram.get(), 0, m_palette->entries() / 256, 0));

	machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitopjc_state::video_exit), this));
}
Beispiel #10
0
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;
}
Beispiel #11
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;
}
Beispiel #12
0
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();
}
Beispiel #13
0
void isa8_pgc_device::device_start()
{
	address_space &space = m_cpu->space( AS_PROGRAM );
	int width = PGC_DISP_HORZ;
	int height = PGC_DISP_VERT;

	if (m_palette != nullptr && !m_palette->started())
		throw device_missing_dependencies();

	set_isa_device();

	for (int i = 0; i < 256; i++ )
	{
		m_palette->set_pen_color( i, 0, 0, 0 );
	}

	m_bitmap = std::make_unique<bitmap_ind16>(width, height);
	m_bitmap->fill(0);

	m_vram = std::make_unique<uint8_t[]>(0x78000);
	space.install_readwrite_bank(0x80000, 0xf7fff, "vram");
	membank("vram")->set_base(m_vram.get());

	m_eram = std::make_unique<uint8_t[]>(0x8000);

	machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(&isa8_pgc_device::reset_common, this));
}
Beispiel #14
0
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();
}
Beispiel #15
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));
}
Beispiel #16
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));
	}
}
Beispiel #17
0
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));
}
Beispiel #18
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;
}
Beispiel #19
0
void nes_state::video_start()
{

	m_last_frame_flip =  0;

	machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(nes_vh_reset),&machine()));
}
Beispiel #20
0
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));
}
Beispiel #21
0
void cybiko_state::machine_start()
{
	_logerror( 0, ("machine_start_cybikov1\n"));
	// serial port
	cybiko_rs232_init();
	// other
	machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybiko),this));
}
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));
    }
}
Beispiel #23
0
void osd_common_t::init_subsystems()
{
	// monitors have to be initialized before video init
	m_monitor_module = select_module_options<monitor_module *>(options(), OSD_MONITOR_PROVIDER);
	assert(m_monitor_module != nullptr);
	m_monitor_module->init(options());

	if (!video_init())
	{
		video_exit();
		osd_printf_error("video_init: Initialization failed!\n\n\n");
		fflush(stderr);
		fflush(stdout);
		exit(-1);
	}

	m_keyboard_input = select_module_options<input_module *>(options(), OSD_KEYBOARDINPUT_PROVIDER);
	m_mouse_input = select_module_options<input_module *>(options(), OSD_MOUSEINPUT_PROVIDER);
	m_lightgun_input = select_module_options<input_module *>(options(), OSD_LIGHTGUNINPUT_PROVIDER);
	m_joystick_input = select_module_options<input_module *>(options(), OSD_JOYSTICKINPUT_PROVIDER);

	m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER);
	m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER);
	m_sound->m_sample_rate = options().sample_rate();
	m_sound->m_audio_latency = options().audio_latency();

	m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER);

	select_module_options<netdev_module *>(options(), OSD_NETDEV_PROVIDER);

	m_midi = select_module_options<midi_module *>(options(), OSD_MIDI_PROVIDER);

	m_output = select_module_options<output_module *>(options(), OSD_OUTPUT_PROVIDER);
	m_output->set_machine(&machine());
	machine().output().set_notifier(nullptr, output_notifier_callback, this);

	m_mod_man.init(options());

	input_init();
	// we need pause callbacks
	machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(osd_common_t::input_pause), this));
	machine().add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(osd_common_t::input_resume), this));
}
Beispiel #24
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));
}
Beispiel #25
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);
}
Beispiel #26
0
void tecmosys_state::prot_init(int which)
{
	switch (which)
	{
	case 0: m_device_data = &deroon_data; break;
	case 1: m_device_data = &tkdensho_data; break;
	case 2: m_device_data = &tkdensha_data; break;
	}

	machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_state::prot_reset),this));
}
Beispiel #27
0
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;
}
Beispiel #28
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));
}
Beispiel #29
0
ui_manager* mame_machine_manager::create_ui(running_machine& machine)
{
	m_ui = std::make_unique<mame_ui_manager>(machine);
	m_ui->init();

	machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(mame_machine_manager::reset), this));

	m_ui->set_startup_text("Initializing...", true);

	return m_ui.get();
}
Beispiel #30
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);
}