void NDS_3D_ChangeCore(int newCore) { gpu3D->NDS_3D_Close(); NDS_3D_SetDriver(newCore); if(gpu3D->NDS_3D_Init() == 0) { NDS_3D_SetDriver(GPU3D_NULL); gpu3D->NDS_3D_Init(); } }
bool NDS_3D_ChangeCore(int newCore) { gpu3D->NDS_3D_Close(); NDS_3D_SetDriver(newCore); if(gpu3D->NDS_3D_Init() == 0) { NDS_3D_SetDriver(GPU3D_NULL); gpu3D->NDS_3D_Init(); return false; } return true; }
static int common_gtk_glade_main( struct configured_features *my_config) { SDL_TimerID limiter_timer; gdbstub_handle_t arm9_gdb_stub; gdbstub_handle_t arm7_gdb_stub; struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; struct armcpu_ctrl_iface *arm9_ctrl_iface; struct armcpu_ctrl_iface *arm7_ctrl_iface; #ifdef GTKGLEXT_AVAILABLE // check if you have GTHREAD when running configure script //g_thread_init(NULL); register_gl_fun(my_gl_Begin,my_gl_End); #endif #ifdef DEBUG LogStart(); #endif init_keyvals(); if ( my_config->arm9_gdb_port != 0) { arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port, &arm9_memio, &arm9_base_memory_iface); if ( arm9_gdb_stub == NULL) { g_print( "Failed to create ARM9 gdbstub on port %d\n", my_config->arm9_gdb_port); return -1; } } if ( my_config->arm7_gdb_port != 0) { arm7_gdb_stub = createStub_gdb( my_config->arm7_gdb_port, &arm7_memio, &arm7_base_memory_iface); if ( arm7_gdb_stub == NULL) { g_print( "Failed to create ARM7 gdbstub on port %d\n", my_config->arm7_gdb_port); return -1; } } if(SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) { fprintf(stderr, "Error trying to initialize SDL: %s\n", SDL_GetError()); return 1; } desmume_init( arm9_memio, &arm9_ctrl_iface, arm7_memio, &arm7_ctrl_iface); /* * Activate the GDB stubs * This has to come after the NDS_Init (called in desmume_init) * where the cpus are set up. */ if ( my_config->arm9_gdb_port != 0) { activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); } if ( my_config->arm7_gdb_port != 0) { activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); } /* Initialize joysticks */ if(!init_joy()) return 1; CONFIG_FILE = g_build_filename(g_get_home_dir(), ".desmume.ini", NULL); Read_ConfigFile(); /* load the interface */ xml = glade_xml_new(get_ui_file("DeSmuMe.glade"), NULL, NULL); xml_tools = glade_xml_new(get_ui_file("DeSmuMe_Dtools.glade"), NULL, NULL); pWindow = glade_xml_get_widget(xml, "wMainW"); pDrawingArea = glade_xml_get_widget(xml, "wDraw_Main"); pDrawingArea2 = glade_xml_get_widget(xml, "wDraw_Sub"); /* connect the signals in the interface */ glade_xml_signal_autoconnect_StringObject(xml); glade_xml_signal_autoconnect_StringObject(xml_tools); init_GL_capabilities( my_config->software_colour_convert); /* check command line file */ if( my_config->nds_file) { if(desmume_open( my_config->nds_file) >= 0) { desmume_resume(); enable_rom_features(); } else { GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Unable to load :\n%s", my_config->nds_file); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog); } } gtk_widget_show(pDrawingArea); gtk_widget_show(pDrawingArea2); { int use_null_3d = my_config->disable_3d; #ifdef GTKGLEXT_AVAILABLE if ( !use_null_3d) { /* setup the gdk 3D emulation */ if ( init_opengl_gdk_3Demu()) { NDS_3D_SetDriver(1); if (!gpu3D->NDS_3D_Init()) { fprintf( stderr, "Failed to initialise openGL 3D emulation; " "removing 3D support\n"); use_null_3d = 1; } } else { fprintf( stderr, "Failed to setup openGL 3D emulation; " "removing 3D support\n"); use_null_3d = 1; } } #endif if ( use_null_3d) { NDS_3D_SetDriver ( 0); gpu3D->NDS_3D_Init(); } } // on_menu_tileview_activate(NULL,NULL); /* setup the frame limiter and indicate if it is disabled */ glade_fps_limiter_disabled = my_config->disable_limiter; if ( !glade_fps_limiter_disabled) { /* create the semaphore used for fps limiting */ glade_fps_limiter_semaphore = SDL_CreateSemaphore( 1); /* start a SDL timer for every FPS_LIMITER_FRAME_PERIOD * frames to keep us at 60 fps */ limiter_timer = SDL_AddTimer( 16 * FPS_LIMITER_FRAME_PERIOD, glade_fps_limiter_fn, glade_fps_limiter_semaphore); if ( limiter_timer == NULL) { fprintf( stderr, "Error trying to start FPS limiter timer: %s\n", SDL_GetError()); SDL_DestroySemaphore( glade_fps_limiter_semaphore); glade_fps_limiter_disabled = 1; } } /* start event loop */ gtk_main(); desmume_free(); if ( !glade_fps_limiter_disabled) { /* tidy up the FPS limiter timer and semaphore */ SDL_RemoveTimer( limiter_timer); SDL_DestroySemaphore( glade_fps_limiter_semaphore); } #ifdef DEBUG LogStop(); #endif /* Unload joystick */ uninit_joy(); SDL_Quit(); Write_ConfigFile(); return EXIT_SUCCESS; }