void mainemuinit() { // initialize cpu memory mem_init(); #ifndef __GP32__ graphics_init(NULL); #else graphics_init(); #endif // initialize the TLCS-900H cpu tlcs_init(); #ifdef DRZ80 Z80_Reset(); #else z80Init(); #endif // if neogeo pocket color rom, act if we are a neogeo pocket color tlcsMemWriteB(0x6F91,tlcsMemReadB(0x00200023)); // pretend we're running in English mode tlcsMemWriteB(0x00006F87,0x01); // kludges & fixes switch (tlcsMemReadW(0x00200020)) { case 0x0059: // Sonic case 0x0061: // Metal SLug 2nd *get_address(0x0020001F) = 0xFF; break; } ngpSoundOff(); //Flavor sound_start(); }
int main(int argc, char **argv) { srand(get_tick_count()); memset(&kb, 0, sizeof(kb)); set_keys(); player_init(&p1); smp_alloc((void*)&p1); graphics_init(); physics_init(); glutInit(&argc, argv); glutInitWindowPosition(200, 100); glutInitWindowSize(window_x, window_y); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutCreateWindow(PROGRAM_NAME); glutDisplayFunc(graphics_loop); glutIdleFunc(graphics_loop); glutReshapeFunc(reshape); glutKeyboardFunc(kb_controller_dn_char); glutKeyboardUpFunc(kb_controller_up_char); glutSpecialFunc(kb_controller_dn); glutSpecialUpFunc(kb_controller_up); glutMouseFunc(mouse_handler); glutMotionFunc(mouse_motion_handler); glutPassiveMotionFunc(mouse_motion_handler); threads.phys_main = thread_create(physics_loop, NULL); glutMainLoop(); return EXIT_SUCCESS; }
int kernel_main() { graphics_init(); console_init(); console_printf("video: %d x %d\n", video_xres, video_yres, video_xbytes); console_printf("kernel: %d bytes\n", kernel_size); memory_init(); interrupt_init(); rtc_init(); clock_init(); keyboard_init(); /* process_init() is a big step. This initializes the process table, but also gives us our own process structure, private stack, and enables paging. Now we can do complex things like wait upon events. */ process_init(); mouse_init(); ata_init(); console_printf("\nNUNYA READY:\n"); cmd_line_init(); while(1) { cmd_line_show_prompt(); cmd_line_attempt(keyboard_read_str()); } return 0; }
int init() { srand(time(0) ^ getpid()); if (SDL_Init(0) < 0) { fprintf(stderr, "Error initialising SDL: %s\n", SDL_GetError()); return -1; } if (config_init() == -1 || input_init() == -1 || graphics_init() == -1 || sound_init() == -1 || level_init() == -1 || bomber_init() == -1 || bomb_init() == -1) { return -1; } // load images/animations - its done up ^ in init's // init calc_delta_time calc_delta_time(); return 0; }
void kmain(multiboot_info_t* mbt, unsigned int magic) { if (magic != MULTIBOOT_BOOTLOADER_MAGIC) return; graphics_init(); /* Core modules */ gdt_init(); idt_init(); irq_init(); isr_init(); /* Kernel heap */ heap_init(); /* Drivers */ timer_init(); tasking_init(); keyboard_init(); /* Let the games begin */ set_interrupts(ENABLED); kprintf("Running kernel tests...\n\n"); test_kmalloc_kfree(); test_list(); test_tasking(); kprintf("\nDone with kernel tests.\n"); for (;;); }
void * display_run(void *v) { struct display_run_args *d_args = v; ending_t ending = d_args->ending; controller_state_t cs = d_args->cs; (void)cs; graphics_init(); while (1) { if (ending_get(ending)) { break; } SDL_Delay(100); draw_display(); print_info("display looping"); } graphics_deinit(); print_info("display exiting"); return NULL; }
void MainThread () { FILE *Fp_in; FILE *Fp_out; Fp_in = fopen("in.dat","r"); Fp_out = fopen("out.dat","w"); //-----Initialization of graphics---------------------- graphics_init(); //---optimization-------------------------------------- devol(Fp_in,Fp_out); fclose(Fp_in); fclose(Fp_out); //-----enable zooming in and out even when optimization is finished---- while(1) { update_graphics(gt_best.fa_vector, gi_D, gfa_bound, gl_nfeval, gi_gen, gt_best.fa_cost[0],gi_strategy,gi_genmax); Sleep(50); // provide some time (50ms) for the eye to see the graphics if (gi_exit_flag == 1) { gi_exit_flag = 0; } } }
int main(void) { flash_led(LED1); // init logger log_init(&mainlog, "main"); lcd_init(); graphics_init(); touch_panel_init(); lcd_backlight_init(); lcd_backlight_auto_off(false); lcd_backlight_enable(); set_background_colour(BLACK); panel_meter_init(&panelmeter, buffer, BOX_LOCATION, BOX_SIZE, true, "%.3f", "C", BOX_MAIN_FONT, BOX_UNIT_FONT); panel_meter_enable_touch(&panelmeter, (touch_callback_t)touch_key_callback, panelmeter_touch_appdata); float val = 0; while(1) { printf("val %.3f\n", (double)val); panel_meter_update(&panelmeter, val); val += 0.1; sleep(1); } pthread_exit(0); return 0; }
int gs_create(graphics_t *pgraphics, const char *module, struct gs_init_data *data) { int errcode = GS_ERROR_FAIL; graphics_t graphics = bmalloc(sizeof(struct graphics_subsystem)); memset(graphics, 0, sizeof(struct graphics_subsystem)); pthread_mutex_init_value(&graphics->mutex); graphics->module = os_dlopen(module); if (!graphics->module) { errcode = GS_ERROR_MODULENOTFOUND; goto error; } if (!load_graphics_imports(&graphics->exports, graphics->module, module)) goto error; graphics->device = graphics->exports.device_create(data); if (!graphics->device) goto error; if (!graphics_init(graphics)) goto error; *pgraphics = graphics; return GS_SUCCESS; error: gs_destroy(graphics); return errcode; }
int main(int argc, char** argv) { int result; // Intermediate result. // Parse arguments to the argument parser, populates parameters structure. parseArgs(argc, argv); // graphics initialize pass through to glutInit graphics_init(&argc, argv); // set problem_execute to point to address of the given problem // entry point function. switch (params.single_problem) { case 102: problem_execute = &run_p102; break; case 305: problem_execute = &run_p305; break; case 45: problem_execute = &run_p45; break; default: problem_execute = &run_nothing; } // Execute the problem; *may* render graphics depending on // the problem. result = (*problem_execute) (); printf("%d", result); return EXIT_SUCCESS & result; }
void vid_preinit() { graphics_init(528, 320, (void*)0xAC200000); set_pen(create_rgb16(0, 0, 0)); if (!load_skin()) draw_rect(0, 0, 528, 320); lcdc_copy_vram(); }
struct navit * navit_new(const char *ui, const char *graphics, struct coord *center, enum projection pro, int zoom) { struct navit *this_=g_new0(struct navit, 1); FILE *f; main_add_navit(this_); this_->vehicle_cbl=callback_list_new(); f=popen("pidof /usr/bin/ipaq-sleep","r"); if (f) { fscanf(f,"%d",&this_->pid); dbg(1,"ipaq_sleep pid=%d\n", this_->pid); pclose(f); } this_->bookmarks_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); this_->cursor_flag=1; this_->tracking_flag=1; this_->trans=transform_new(); transform_set_projection(this_->trans, pro); transform_setup(this_->trans, center, zoom, 0); this_->displaylist=graphics_displaylist_new(); this_->gui=gui_new(this_, ui, 792, 547); if (! this_->gui) { g_warning("failed to create gui '%s'", ui); navit_destroy(this_); return NULL; } if (gui_has_main_loop(this_->gui)) { if (! main_loop_gui) { main_loop_gui=this_->gui; } else { g_warning("gui with main loop already active, ignoring this instance"); navit_destroy(this_); return NULL; } } this_->menubar=gui_menubar_new(this_->gui); this_->toolbar=gui_toolbar_new(this_->gui); this_->statusbar=gui_statusbar_new(this_->gui); this_->gra=graphics_new(graphics); if (! this_->gra) { g_warning("failed to create graphics '%s'", graphics); navit_destroy(this_); return NULL; } graphics_register_resize_callback(this_->gra, navit_resize, this_); graphics_register_button_callback(this_->gra, navit_button, this_); if (gui_set_graphics(this_->gui, this_->gra)) { g_warning("failed to connect graphics '%s' to gui '%s'\n", graphics, ui); navit_destroy(this_); return NULL; } graphics_init(this_->gra); return this_; }
int main (){ audio_init(); graphics_init(); return 0; }
void switch_to_hw_sdl(int first_time) { GFXVIDINFO_HEIGHT=240; SDL_ShowCursor(SDL_DISABLE); usleep(100*1000); // reinit video graphics_init(); }
err_t font_bitmap_init(font_bitmap_t* font_bitmap, font_char_t first_char, font_char_t last_char, const uint8_t* data, graphics_size_t width, graphics_size_t height, graphics_format_t format, const font_char_descr_t* char_descrs) { font_bitmap->first_char = first_char; font_bitmap->last_char = last_char; font_bitmap->char_descrs = char_descrs; return graphics_init((graphics_t*)&font_bitmap->graphics, (uint8_t*)data, width, height, format); }
void client_render_init() { frame_render_interval = 1; md1 = new MovementData[MAX_ENTITIES]; md2 = new MovementData[MAX_ENTITIES]; assert( md1 != NULL && md2 != NULL ); nmd = nmd2 = 0; graphics_init(); }
int main(int argc,char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE); glutInitWindowSize(500,500); glutInitWindowPosition(100,100); glutCreateWindow("basic GLSL demo"); p=set_shaders(); graphics_init(); glutDisplayFunc(do_stuff); glutIdleFunc(do_stuff); glutMainLoop(); return 0; }
struct navit * navit_new(const char *ui, const char *graphics, struct coord *center, enum projection pro, int zoom) { struct navit *this_=g_new0(struct navit, 1); this_->cursor_flag=1; this_->trans=transform_new(); transform_set_projection(this_->trans, pro); transform_setup(this_->trans, center, zoom, 0); /* this_->flags=g_new0(struct map_flags, 1); */ this_->displaylist=graphics_displaylist_new(); this_->gui=gui_new(this_, ui, 792, 547); if (! this_->gui) { g_warning("failed to create gui '%s'", ui); navit_destroy(this_); return NULL; } if (gui_has_main_loop(this_->gui)) { if (! main_loop_gui) { main_loop_gui=this_->gui; } else { g_warning("gui with main loop already active, ignoring this instance"); navit_destroy(this_); return NULL; } } this_->menubar=gui_menubar_new(this_->gui); this_->toolbar=gui_toolbar_new(this_->gui); this_->statusbar=gui_statusbar_new(this_->gui); this_->gra=graphics_new(graphics); if (! this_->gra) { g_warning("failed to create graphics '%s'", graphics); navit_destroy(this_); return NULL; } graphics_register_resize_callback(this_->gra, navit_resize, this_); graphics_register_button_callback(this_->gra, navit_button, this_); if (gui_set_graphics(this_->gui, this_->gra)) { g_warning("failed to connect graphics '%s' to gui '%s'\n", graphics, ui); navit_destroy(this_); return NULL; } graphics_init(this_->gra); return this_; }
/* * This function is used to print text at the center of screen. Depending on the * message type, different foreground and background colors are used. */ void fb_print_text_on_screen(fb_msg_t type, const char *msg, size_t len) { static int initialized; if (initialized == 0) { if (graphics_init()) return; backlight_update(1); initialized = 1; } /* Print text on black screen. */ const struct rgb_color black = { 0x0, 0x0, 0x0 }; graphics_print_single_text_block(msg, &black, color_table[type].fg, color_table[type].bg, VIDEO_PRINTF_ALIGN_CENTER); }
int main(void) { flash_led(LED1); // init logger log_init(&mainlog, "main"); lcd_init(); graphics_init(); touch_panel_init(); lcd_backlight_init(); set_background_colour(BACKGROUND); lcd_backlight_auto_off(true); lcd_backlight_enable(); lcd_backlight_timeout(30000); statusbar_init(); // init filesystem sdfs_init(); log_info(&mainlog, "wait for filesystem..."); while(!sdfs_ready()); // init networking net_config(&netconf, DEFAULT_RESOLV_CONF_PATH, DEFAULT_NETIF_CONF_PATH); net_init(&netconf); log_info(&mainlog, "device init done..."); init_heater_cooler(); log_info(&mainlog, "service init done..."); while(1) { usleep(250000); update_heater_cooler(); } return 0; }
int main (int argc, char *argv[]) { gchar *game_filename = NULL; gchar *graphics_filename = NULL; gchar *splash_filename = NULL; gchar *music_filename = NULL; gchar *hints_filename = NULL; gtk_init (&argc, &argv); gui_init (); text_init (); graphics_init (); read_config_file (); if (argc >= 6) hints_filename = g_strdup (argv[5]); if (argc >= 5) music_filename = g_strdup (argv[4]); if (argc >= 4) splash_filename = g_strdup (argv[3]); if (argc >= 3) graphics_filename = g_strdup (argv[2]); if (argc >= 2) game_filename = g_strdup (argv[1]); gtk_widget_show_all (Gui.main_window); if (start_new_game (game_filename, graphics_filename, splash_filename, music_filename, hints_filename)) gtk_main (); return 0; }
void kissSim_init(int world, int rx, int ry, float rt) { int i,splash=1; if(world<0){world=-world; splash=0;}//a negative world means no splash screen kissSimLoadWorld(world);//sets .world, .simHeight & .simWidth (leaving default values if sim is smaller) kissSimRobotDim(&ksWindow.rWidth, &ksWindow.rHeight);//set robot window dimensions ksWindow.height=ksWindow.simHeight+ksWindow.rHeight;//set overall window height kissSimComputerDim(&ksWindow.cWidth, &ksWindow.cHeight);//set computer window dimentsions ksWindow.width=ksWindow.simWidth+ksWindow.cWidth;//set overall window width graphics_init(ksWindow.width, ksWindow.height); graphics_fill(255,255,255); glfwSetWindowTitle(_world.title); // Draw the spash screen if(splash)kissSplashBG(ksWindow.width, ksWindow.height); robot.x=rx; robot.y=ry; robot.theta=rt; kissSimRobotInit(); kissSimComputerInit(); graphics_rectangle_fill(0,0,ksWindow.simWidth-1,ksWindow.simHeight-1,255,200,200);// instruction background is light pink kissSimPrintInstructions(); graphics_update(); while(!kiss_get_key(' '));while(kiss_get_key(' '));//pause until space bar is hit start_process(kissSimInBgd); kissSimPause(); }
int main(int argc, char *argv[]) { carmen_ipc_initialize(argc, argv); carmen_param_check_version(argv[0]); gtk_init(&argc, &argv); //if (!g_thread_supported()) // g_thread_init(NULL); graphics_init(); if (argc >= 2) { strncpy(logfilename, argv[1], 1023); load_logfile(NULL); } laser_scans_display(NULL); vascocore_init(argc, argv); gtk_main(); return 0; }
void core_window_create(lodge_window_t window) { /* Set up ratio. */ int w, h; lodge_window_get_size(window, &w, &h); core_resize_callback(window, w, h); /* Set up graphics */ int ret = graphics_init(&core_global->graphics, &core_think, &core_render, core_global->fps_callback); if (ret != GRAPHICS_OK) { core_error("Graphics initialization failed (%d)\n", ret); graphics_free(&core_global->graphics); exit(ret); } /* Set up OpenGL. */ ret = graphics_opengl_init(&core_global->graphics); if (ret != GRAPHICS_OK) { core_error("opengl initialization failed (%d)\n", ret); exit(ret); } }
int main() { unsigned int row, col; unsigned int i = 0; unsigned int j = 0; pixbuf_t *pixbuf; graphics_init(); pixbuf = graphics_get_final_buffer(); alt_putstr("Restoring default palette\n"); switch_palette(&palette_332); graphics_clear_screen(); // Draw to edges of screen graphics_draw_rectangle(pixbuf, 0, 0, 640-1, 480-1, 0xE0); graphics_draw_rectangle(pixbuf, 1, 1, 640-2, 480-2, 0xFF); ALT_CI_CI_FRAME_DONE_0; // Draw the colors at the top of the screen for (i = 0; i < sizeof(color_array); i++) { graphics_draw_rectangle(pixbuf, i, 0, i, 0, color_array[i]); } // Cycle through a pattern for (i = 0; i < 256; i++) { graphics_draw_rectangle(pixbuf, 300, 50, 301, 127, color_array[i % sizeof(color_array)]); graphics_draw_rectangle(pixbuf, 201, 111, 400, 230, color_array[(i+4) % sizeof(color_array)]); graphics_draw_rectangle(pixbuf, 100, 200, 500, 430, color_array[(i+8) % sizeof(color_array)]); ALT_CI_CI_FRAME_DONE_0; for (j = 0; j < 10000; j++) { // Do nothing } } graphics_clear_screen(); // Draw a geometric pattern in the most inefficient way possible... for (row = 0; row < 480; row++) { for (col = 0; col < 640; col++) { if (row == col) { graphics_draw_rectangle(pixbuf, col, row, col, row, 0xFF); } if (row == col - 160) { graphics_draw_rectangle(pixbuf, col, row, col, row, 0xFF); } if (480 - row - 1 == col) { graphics_draw_rectangle(pixbuf, col, row, col, row, 0xFF); } if (480 - row - 1 == col - 160) { graphics_draw_rectangle(pixbuf, col, row, col, row, 0xFF); } } } ALT_CI_CI_FRAME_DONE_0; for ( i = 0; i < 100000; i++) { //wait for a while } graphics_clear_screen(); int genesis_value; while(1) { genesis_value = IORD_32DIRECT(GENESIS_0_BASE, 0); if ((genesis_value)& (1 << 4)){ graphics_draw_rectangle(pixbuf, 100, 100, 150, 150, 0x1A); } else graphics_draw_rectangle(pixbuf, 100, 100, 150, 150, 0x0); if ((genesis_value)& (1 << 5)){ graphics_draw_rectangle(pixbuf, 200, 200, 250, 250, 0xE0); } else graphics_draw_rectangle(pixbuf, 200, 200, 250, 250, 0x0); if ((genesis_value)& (1 << 6)){ graphics_draw_rectangle(pixbuf, 300, 300, 350, 350, 0x03); } else graphics_draw_rectangle(pixbuf, 300, 300, 350, 350, 0x0); ALT_CI_CI_FRAME_DONE_0; // Do nothing } return 0; }
void corange_init(const char* core_assets_path) { /* Attach signal handlers */ signal(SIGABRT, corange_signal); signal(SIGFPE, corange_signal); signal(SIGILL, corange_signal); signal(SIGINT, corange_signal); signal(SIGSEGV, corange_signal); signal(SIGTERM, corange_signal); logout = fopen("output.log", "w"); at_error(corange_error); at_warning(corange_warning); at_debug(corange_debug); /* Starting Corange */ debug("Starting Corange..."); /* Asset Manager */ debug("Creating Asset Manager..."); debug("Core Assets At '%s' ...", core_assets_path); asset_init(); asset_add_path_variable(P("$CORANGE"), P(core_assets_path)); asset_handler(renderable, "bmf", bmf_load_file, renderable_delete); asset_handler(renderable, "obj", obj_load_file, renderable_delete); asset_handler(renderable, "smd", smd_load_file, renderable_delete); asset_handler(renderable, "ply", ply_load_file, renderable_delete); asset_handler(skeleton, "skl", skl_load_file, skeleton_delete); asset_handler(animation, "ani", ani_load_file, animation_delete); asset_handler(cmesh, "col", col_load_file, cmesh_delete); asset_handler(terrain, "raw", raw_load_file, terrain_delete); asset_handler(texture, "bmp", bmp_load_file, texture_delete); asset_handler(texture, "tga", tga_load_file, texture_delete); asset_handler(texture, "dds", dds_load_file, texture_delete); asset_handler(texture, "lut", lut_load_file, texture_delete); asset_handler(texture, "acv", acv_load_file, texture_delete); asset_handler(shader, "vs" , vs_load_file, shader_delete); asset_handler(shader, "fs" , fs_load_file, shader_delete); asset_handler(shader, "gs" , gs_load_file, shader_delete); asset_handler(shader, "tcs" , tcs_load_file, shader_delete); asset_handler(shader, "tes" , tes_load_file, shader_delete); asset_handler(config, "cfg", cfg_load_file, config_delete); asset_handler(lang, "lang", lang_load_file, lang_delete); asset_handler(font, "fnt", font_load_file, font_delete); asset_handler(material, "mat", mat_load_file, material_delete); asset_handler(effect, "effect" , effect_load_file, effect_delete); asset_handler(sound, "wav", wav_load_file, sound_delete); asset_handler(music, "ogg", ogg_load_file, music_delete); asset_handler(music, "mp3", mp3_load_file, music_delete); /* Entity Manager */ debug("Creating Entity Manager..."); entity_init(); entity_handler(static_object, static_object_new, static_object_delete); entity_handler(animated_object, animated_object_new, animated_object_delete); entity_handler(physics_object, physics_object_new, physics_object_delete); entity_handler(instance_object, instance_object_new, instance_object_delete); entity_handler(camera, camera_new, camera_delete); entity_handler(light, light_new, light_delete); entity_handler(landscape, landscape_new, landscape_delete); entity_handler(particles, particles_new, particles_delete); /* UI Manager */ debug("Creating UI Manager..."); ui_init(); ui_handler(ui_rectangle, ui_rectangle_new, ui_rectangle_delete, ui_rectangle_event, ui_rectangle_update, ui_rectangle_render); ui_handler(ui_text, ui_text_new, ui_text_delete, ui_text_event, ui_text_update, ui_text_render); ui_handler(ui_spinner, ui_spinner_new, ui_spinner_delete, ui_spinner_event, ui_spinner_update, ui_spinner_render); ui_handler(ui_button, ui_button_new, ui_button_delete, ui_button_event, ui_button_update, ui_button_render); ui_handler(ui_textbox, ui_textbox_new, ui_textbox_delete, ui_textbox_event, ui_textbox_update, ui_textbox_render); ui_handler(ui_browser, ui_browser_new, ui_browser_delete, ui_browser_event, ui_browser_update, ui_browser_render); ui_handler(ui_toast, ui_toast_new, ui_toast_delete, ui_toast_event, ui_toast_update, ui_toast_render); ui_handler(ui_dialog, ui_dialog_new, ui_dialog_delete, ui_dialog_event, ui_dialog_update, ui_dialog_render); ui_handler(ui_listbox, ui_listbox_new, ui_listbox_delete, ui_listbox_event, ui_listbox_update, ui_listbox_render); ui_handler(ui_option, ui_option_new, ui_option_delete, ui_option_event, ui_option_update, ui_option_render); ui_handler(ui_slider, ui_slider_new, ui_slider_delete, ui_slider_event, ui_slider_update, ui_slider_render); /* Graphics Manager */ debug("Creating Graphics Manager..."); graphics_init(); /* Audio Manager */ debug("Creating Audio Manager..."); audio_init(); /* Joystick Manager */ debug("Creating Joystick Manager..."); joystick_init(); /* Network Manager */ debug("Creating Network Manager..."); net_init(); debug("Finished!"); }
static void real_main2 (int argc, char **argv) { #if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER ) extern int EvalException ( LPEXCEPTION_POINTERS blah, int n_except ); __try #endif { if (! graphics_setup ()) { exit (1); } if (restart_config[0]) { #ifdef FILESYS free_mountinfo (currprefs.mountinfo); currprefs.mountinfo = alloc_mountinfo (); #endif default_prefs (&currprefs, 0); fix_options (); } #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef FILESYS rtarea_init (); hardfile_install (); #endif if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; uae_inithrtimer (); sleep_test (); machdep_init (); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; if (! no_gui) { int err = gui_init (); struct uaedev_mount_info *mi = currprefs.mountinfo; currprefs = changed_prefs; currprefs.mountinfo = mi; if (err == -1) { write_log ("Failed to initialize the GUI\n"); if (restart_program == 3) { restart_program = 0; return; } } else if (err == -2) { restart_program = 0; return; } } restart_program = 0; #ifdef JIT if (!(( currprefs.cpu_level >= 2 ) && ( currprefs.address_space_24 == 0 ) && ( currprefs.cachesize ))) canbang = 0; #endif #ifdef _WIN32 logging_init(); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #endif fix_options (); changed_prefs = currprefs; #ifdef SAVESTATE savestate_init (); #endif #ifdef SCSIEMU scsidev_install (); #endif #ifdef AUTOCONFIG /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif memory_init (); memory_reset (); #ifdef FILESYS filesys_install (); #endif #ifdef AUTOCONFIG bsdlib_install (); emulib_install (); uaeexe_install (); native2amiga_install (); #endif if (custom_init ()) { /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif #ifdef WIN32 #ifdef FILESYS filesys_init (); /* New function, to do 'add_filesys_unit()' calls at start-up */ #endif #endif if (sound_available && currprefs.produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } start_program (); } } } #if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER ) __except( EvalException( GetExceptionInformation(), GetExceptionCode() ) ) { // EvalException does the good stuff... } #endif }
int main() { lua_State *lua = luaL_newstate(); luaL_openlibs(lua); motor_Config config; l_motor_register(lua); l_audio_register(lua); l_graphics_register(lua); l_image_register(lua); l_keyboard_register(lua); l_mouse_register(lua); l_filesystem_register(lua); l_timer_register(lua); l_math_register(lua); l_event_register(lua); l_joystick_register(lua); chdir("/love"); l_boot(lua, &config); if(config.identity) { filesystem_setIdentity(config.identity, false); } image_init(); joystick_init(); keyboard_init(); graphics_init(config.window.width, config.window.height); audio_init(); math_init(); if(luaL_dofile(lua, "main.lua")) { printf("Error: %s\n", lua_tostring(lua, -1)); } lua_pushcfunction(lua, errorhandler); lua_getglobal(lua, "love"); lua_pushstring(lua, "load"); lua_rawget(lua, -2); /*if(lua_pcall(lua, 0, 0, 1)) { printf("Error in love.load: %s\n", lua_tostring(lua, -1)); } */ pcall(lua, 0); lua_pop(lua, 1); lua_pushcfunction(lua, errorhandler); mainLoopData.luaState = lua; mainLoopData.errhand = luaL_ref(lua, LUA_REGISTRYINDEX); timer_init(); #ifdef EMSCRIPTEN emscripten_set_main_loop_arg(main_loop, &mainLoopData, 0, 1); #else for(;;) { main_loop(&mainLoopData); } #endif }
static int real_main2 (int argc, TCHAR **argv) { #ifdef USE_SDL int result = (SDL_Init (SDL_INIT_TIMER | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) == 0); if (result) atexit (SDL_Quit); #endif set_config_changed (); if (restart_config[0]) { default_prefs (&currprefs, 0); fixup_prefs (&currprefs); } if (! graphics_setup ()) { write_log (_T("Graphics Setup Failed\n")); exit (1); } if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; // uae_inithrtimer (); if (!machdep_init ()) { write_log (_T("Machine Init Failed.\n")); restart_program = 0; return -1; } if (console_emulation) { consolehook_config (&currprefs); fixup_prefs (&currprefs); } if (! setup_sound ()) { write_log (_T("Sound driver unavailable: Sound output disabled\n")); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; restart_program = 0; if (! no_gui && currprefs.start_gui) { int err = gui_init (); currprefs = changed_prefs; set_config_changed (); if (err == -1) { write_log (_T("Failed to initialize the GUI\n")); return -1; } else if (err == -2) { return 1; } } memset (&gui_data, 0, sizeof gui_data); gui_data.cd = -1; gui_data.hd = -1; gui_data.md = -1; #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef PICASSO96 picasso_reset (); #endif fixup_prefs (&currprefs); #ifdef RETROPLATFORM rp_fixup_options (&currprefs); #endif changed_prefs = currprefs; target_run (); /* force sound settings change */ currprefs.produce_sound = 0; savestate_init (); keybuf_init (); /* Must come after init_joystick */ memory_hardreset (2); memory_reset (); #ifdef AUTOCONFIG native2amiga_install (); #endif custom_init (); /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k (); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif if (!init_audio ()) { if (sound_available && currprefs.produce_sound > 1) { write_log (_T("Sound driver unavailable: Sound output disabled\n")); } currprefs.produce_sound = 0; } start_program (); } return 0; }
/* * Initialization of emulator proper */ static int do_init_machine (void) { #ifdef JIT if (!(( currprefs.cpu_level >= 2 ) && ( currprefs.address_space_24 == 0 ) && ( currprefs.cachesize ))) canbang = 0; #endif #ifdef _WIN32 logging_init(); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #endif #ifdef SAVESTATE savestate_init (); #endif #ifdef SCSIEMU scsidev_install (); #endif #ifdef AUTOCONFIG /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif memory_init (); memory_reset (); #ifdef FILESYS filesys_install (); #endif #ifdef AUTOCONFIG bsdlib_install (); emulib_install (); uaeexe_install (); native2amiga_install (); #endif if (custom_init ()) { /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif #ifdef WIN32 #ifdef FILESYS filesys_init (); /* New function, to do 'add_filesys_unit()' calls at start-up */ #endif #endif if (sound_available && currprefs.produce_sound > 1 && ! audio_init ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } return 1; } } return 0; }