void osd_init(running_machine *machine) { //add_exit_callback(machine, osd_exit); machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit); our_target = render_target_alloc(machine, NULL, 0); if (our_target == NULL) fatalerror("Error creating render target"); myosd_inGame = !(machine->gamedrv == &GAME_NAME(empty)); options_set_bool(mame_options(), OPTION_CHEAT,myosd_cheat,OPTION_PRIORITY_CMDLINE); options_set_bool(mame_options(), OPTION_AUTOSAVE,myosd_autosave,OPTION_PRIORITY_CMDLINE); options_set_bool(mame_options(), OPTION_SOUND,myosd_sound_value != -1,OPTION_PRIORITY_CMDLINE); if(myosd_sound_value!=-1) options_set_int(mame_options(), OPTION_SAMPLERATE,myosd_sound_value,OPTION_PRIORITY_CMDLINE); options_set_float(mame_options(), OPTION_BEAM,myosd_vector_bean2x ? 2.5 : 1.0, OPTION_PRIORITY_CMDLINE); options_set_float(mame_options(), OPTION_FLICKER,myosd_vector_flicker ? 0.4 : 0.0, OPTION_PRIORITY_CMDLINE); options_set_bool(mame_options(), OPTION_ANTIALIAS,myosd_vector_antialias,OPTION_PRIORITY_CMDLINE); droid_ios_init_input(machine); droid_ios_init_sound(machine); droid_ios_init_video(machine); netplay_t *handle = netplay_get_handle(); if(handle->has_connection) { handle->has_begun_game = 1; } }
void osd_init(running_machine *machine) { //add_exit_callback(machine, osd_exit); machine->add_notifier(MACHINE_NOTIFY_EXIT, osd_exit); our_target = render_target_alloc(machine, NULL, 0); if (our_target == NULL) fatalerror("Error creating render target"); myosd_inGame = !(machine->gamedrv == &GAME_NAME(empty)); options_set_bool(mame_options(), OPTION_CHEAT,myosd_cheat,OPTION_PRIORITY_CMDLINE); options_set_bool(mame_options(), OPTION_AUTOSAVE,myosd_autosave,OPTION_PRIORITY_CMDLINE); options_set_bool(mame_options(), OPTION_SOUND,myosd_sound_value != -1,OPTION_PRIORITY_CMDLINE); if(myosd_sound_value!=-1) options_set_int(mame_options(), OPTION_SAMPLERATE,myosd_sound_value,OPTION_PRIORITY_CMDLINE); droid_ios_init_input(machine); droid_ios_init_sound(machine); droid_ios_init_video(machine); }
int winwindow_video_window_create(int index, win_monitor_info *monitor, const win_window_config *config) { win_window_info *window, *win; char option[20]; assert(GetCurrentThreadId() == main_threadid); // allocate a new window object window = malloc_or_die(sizeof(*window)); memset(window, 0, sizeof(*window)); window->maxwidth = config->width; window->maxheight = config->height; window->refresh = config->refresh; window->monitor = monitor; window->fullscreen = !video_config.windowed; // see if we are safe for fullscreen window->fullscreen_safe = TRUE; for (win = win_window_list; win != NULL; win = win->next) if (win->monitor == monitor) window->fullscreen_safe = FALSE; // add us to the list *last_window_ptr = window; last_window_ptr = &window->next; // create a lock that we can use to skip blitting window->render_lock = osd_lock_alloc(); // load the layout window->target = render_target_alloc(NULL, 0); if (window->target == NULL) goto error; render_target_set_orientation(window->target, video_orientation); render_target_set_layer_config(window->target, video_config.layerconfig); // set the specific view sprintf(option, "view%d", index); set_starting_view(index, window, options_get_string(option)); // remember the current values in case they change window->targetview = render_target_get_view(window->target); window->targetorient = render_target_get_orientation(window->target); window->targetlayerconfig = render_target_get_layer_config(window->target); // make the window title if (video_config.numscreens == 1) sprintf(window->title, APPNAME ": %s [%s]", Machine->gamedrv->description, Machine->gamedrv->name); else sprintf(window->title, APPNAME ": %s [%s] - Screen %d", Machine->gamedrv->description, Machine->gamedrv->name, index); // set the initial maximized state window->startmaximized = options_get_bool("maximize"); // finish the window creation on the window thread if (multithreading_enabled) { // wait until the window thread is ready to respond to events WaitForSingleObject(window_thread_ready_event, INFINITE); PostThreadMessage(window_threadid, WM_USER_FINISH_CREATE_WINDOW, 0, (LPARAM)window); while (window->init_state == 0) Sleep(1); } else window->init_state = complete_create(window) ? -1 : 1; // handle error conditions if (window->init_state == -1) goto error; return 0; error: winwindow_video_window_destroy(window); return 1; }
int video_init(running_machine *machine) { int scrnum; add_exit_callback(machine, video_exit); /* reset globals */ memset(scrinfo, 0, sizeof(scrinfo)); /* configure all of the screens */ for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++) if (machine->drv->screen[scrnum].tag != NULL) { internal_screen_info *info = &scrinfo[scrnum]; screen_state *state = &machine->screen[scrnum]; /* configure the screen with the default parameters */ video_screen_configure(scrnum, state->width, state->height, &state->visarea, state->refresh); /* reset VBLANK timing */ info->vblank_time = sub_mame_times(time_zero, double_to_mame_time(Machine->screen[0].vblank)); /* register for save states */ state_save_register_item("video", scrnum, info->vblank_time.seconds); state_save_register_item("video", scrnum, info->vblank_time.subseconds); } /* create spriteram buffers if necessary */ if (machine->drv->video_attributes & VIDEO_BUFFERS_SPRITERAM) init_buffered_spriteram(); /* convert the gfx ROMs into character sets. This is done BEFORE calling the driver's */ /* palette_init() routine because it might need to check the machine->gfx[] data */ if (machine->drv->gfxdecodeinfo != NULL) allocate_graphics(machine->drv->gfxdecodeinfo); /* configure the palette */ palette_config(machine); /* actually decode the graphics */ if (machine->drv->gfxdecodeinfo != NULL) decode_graphics(machine->drv->gfxdecodeinfo); /* reset performance data */ last_fps_time = osd_ticks(); rendered_frames_since_last_fps = frames_since_last_fps = 0; performance.game_speed_percent = 100; performance.frames_per_second = machine->screen[0].refresh; performance.vector_updates_last_second = 0; /* reset video statics and get out of here */ pdrawgfx_shadow_lowpri = 0; leds_status = 0; /* initialize tilemaps */ if (tilemap_init(machine) != 0) fatalerror("tilemap_init failed"); /* create a render target for snapshots */ if (Machine->drv->screen[0].tag != NULL) { snap_bitmap = NULL; snap_target = render_target_alloc(layout_snap, RENDER_CREATE_SINGLE_FILE | RENDER_CREATE_HIDDEN); assert(snap_target != NULL); if (snap_target == NULL) return 1; render_target_set_layer_config(snap_target, 0); } /* create crosshairs */ crosshair_init(); return 0; }
int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config) { sdl_window_info *window; worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param)); char option[20]; int result; ASSERT_MAIN_THREAD(); clear_worker_param(wp); // allocate a new window object window = global_alloc_clear(sdl_window_info); window->maxwidth = config->width; window->maxheight = config->height; window->depth = config->depth; window->refresh = config->refresh; window->monitor = monitor; window->machine = machine; window->index = index; //FIXME: these should be per_window in config-> or even better a bit set window->fullscreen = !video_config.windowed; window->prescale = video_config.prescale; window->scale_mode = video_config.scale_mode; // set the initial maximized state // FIXME: Does not belong here window->startmaximized = options_get_bool(machine->options(), SDLOPTION_MAXIMIZE); if (!window->fullscreen) { window->windowed_width = config->width; window->windowed_height = config->height; } window->totalColors = config->totalColors; // add us to the list *last_window_ptr = window; last_window_ptr = &window->next; draw.attach(&draw, window); // create an event that we can use to skip blitting window->rendered_event = osd_event_alloc(FALSE, TRUE); // load the layout window->target = render_target_alloc(machine, NULL, FALSE); if (window->target == NULL) { osd_free(wp); goto error; } // set the specific view sprintf(option, SDLOPTION_VIEW("%d"), index); set_starting_view(machine, index, window, options_get_string(machine->options(), option)); // make the window title if (video_config.numscreens == 1) sprintf(window->title, APPNAME ": %s [%s]", machine->gamedrv->description, machine->gamedrv->name); else sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine->gamedrv->description, machine->gamedrv->name, index); wp->window = window; if (multithreading_enabled) { osd_work_item *wi; wi = osd_work_item_queue(work_queue, &complete_create_wt, (void *) wp, 0); sdlwindow_sync(); result = *((int *) (osd_work_item_result)(wi)); osd_work_item_release(wi); } else result = *((int *) complete_create_wt((void *) wp, 0)); // handle error conditions if (result == 1) goto error; return 0; error: sdlwindow_video_window_destroy(machine, window); return 1; }
int osd_init(running_machine *machine) { target = render_target_alloc(NULL, 0); render_target_set_orientation(target, 0); return 0; }