void ResetPlugins() { int ret; CDR_shutdown(); GPU_shutdown(); SPU_shutdown(); PAD1_shutdown(); PAD2_shutdown(); if (Config.UseNet) NET_shutdown(); ret = CDR_init(); if (ret != 0) { SysMessage (_("CDRinit error: %d"), ret); return; } ret = GPU_init(); if (ret != 0) { SysMessage (_("GPUinit error: %d"), ret); return; } ret = SPU_init(); if (ret != 0) { SysMessage (_("SPUinit error: %d"), ret); return; } ret = PAD1_init(1); if (ret != 0) { SysMessage (_("PAD1init error: %d"), ret); return; } ret = PAD2_init(2); if (ret != 0) { SysMessage (_("PAD2init error: %d"), ret); return; } if (Config.UseNet) { ret = NET_init(); if (ret < 0) { SysMessage (_("NETinit error: %d"), ret); return; } } NetOpened = 0; }
void ResetPlugins() { long ret; CDR_shutdown(); GPU_shutdown(); SPU_shutdown(); PAD1_shutdown(); PAD2_shutdown(); #ifdef ENABLE_SIO1API SIO1_shutdown(); #endif if (Config.UseNet) NET_shutdown(); ret = CDR_init(); if (ret < 0) { SysMessage(_("CDRinit error: %d"), ret); return; } ret = GPU_init(); if (ret < 0) { SysMessage(_("GPUinit error: %d"), ret); return; } ret = SPU_init(); if (ret < 0) { SysMessage(_("SPUinit error: %d"), ret); return; } ret = PAD1_init(1); if (ret < 0) { SysMessage(_("PAD1init error: %d"), ret); return; } ret = PAD2_init(2); if (ret < 0) { SysMessage(_("PAD2init error: %d"), ret); return; } #ifdef ENABLE_SIO1API ret = SIO1_init(); if (ret < 0) { SysMessage(_("SIO1init error: %d!"), ret); return; } #endif if (Config.UseNet) { ret = NET_init(); if (ret < 0) { SysMessage(_("NETinit error: %d"), ret); return; } } NetOpened = FALSE; }
struct Computer *createComputer() { struct Computer *computer = (struct Computer *) malloc(sizeof(struct Computer)); // REFERENCES computer->screen = NULL; // OBJECTS CPU_init(&computer->cpu); computer->cpu.clockRate = 6000; // 6 Khz computer->cpu.interruptVectorTable = computer->ram.buffer + INT_VECTOR_TABLE_ADDR; computer->cpu.ram = &computer->ram; GPU_init(&computer->gpu); computer->gpu.refreshRate = 60; // 60 Hz computer->gpu.vram = computer->ram.buffer + VRAM_ADDR; RAM_init(&computer->ram); RAM_setAccess(&computer->ram, 0, RAM_SIZE, RAM_READ | RAM_WRITE); DMA_init(&computer->dma); computer->dma.ptrIO = computer->ram.buffer + IO_DMA_ADDR; computer->dma.ram = &computer->ram; return computer; }
void ResetPlugins() { int ret; CDR_shutdown(); GPU_shutdown(); SPU_shutdown(); PAD1_shutdown(); PAD2_shutdown(); ret = CDR_init(); if (ret != 0) { SysMessage ("CDRinit error : %d\n",ret); exit(1); } ret = GPU_init(); if (ret != 0) { SysMessage ("GPUinit error : %d\n",ret); exit(1); } ret = SPU_init(); if (ret != 0) { SysMessage ("SPUinit error : %d\n",ret); exit(1); } ret = PAD1_init(1); if (ret != 0) { SysMessage ("PAD1init error : %d\n",ret); exit(1); } ret = PAD2_init(2); if (ret != 0) { SysMessage ("PAD2init error : %d\n",ret); exit(1); } }
int LoadPlugins(void) { int ret; const char *cdrfilename=NULL; ReleasePlugins(); LoadMcds(Config.Mcd1, Config.Mcd2); ret = CDR_init(); if (ret < 0) { printf ("Error initializing CD-ROM plugin: %d\n", ret); return -1; } ret = GPU_init(); if (ret < 0) { printf ("Error initializing GPU plugin: %d\n", ret); return -1; } ret = SPU_init(); if (ret < 0) { printf ("Error initializing SPU plugin: %d\n", ret); return -1; } #ifdef spu_pcsxrearmed //senquack - NOTE: this is an important function to call, as SPU // IRQs will not be acknowledged otherwise, leading to repeating sound // problems in games like NFS3, Grandia, Fifa98, and some games will // lack music like Chrono Cross FMV music, THPS2 etc. // Only spu_pcsxrearmed supports this (older SPU plugins all had // problems with sound in these games.. TODO: add support?) SPU_registerCallback(AcknowledgeSPUIRQ); //senquack - pcsx_rearmed SPU plugin schedules its own updates: SPU_registerScheduleCb(ScheduleSPUUpdate); #endif cdrfilename=GetIsoFile(); if (cdrfilename[0] != '\0') { ret=CDR_open(); if (ret < 0) { printf ("Error opening CD-ROM: %s\n", cdrfilename); return -1; } } printf("Plugins loaded.\n"); return 0; }
void ResetPlugins() { int ret; CDR_shutdown(); GPU_shutdown(); SPU_shutdown(); PAD1_shutdown(); PAD2_shutdown(); ret = CDR_init(); if (ret != 0) { SysMessage(_("CDRinit error: %d"), ret); return; } ret = GPU_init(); if (ret != 0) { SysMessage(_("GPUinit error: %d"), ret); return; } ret = SPU_init(); if (ret != 0) { SysMessage(_("SPUinit error: %d"), ret); return; } ret = PAD1_init(1); if (ret != 0) { SysMessage(_("PAD1init error: %d"), ret); return; } ret = PAD2_init(2); if (ret != 0) { SysMessage(_("PAD2init error: %d"), ret); return; } NetOpened = FALSE; }
void init() { Z80_init(); MMU_init(); GPU_init(); printf("=Init"); }
/* only called once, for startup */ void WM_init(bContext *C, int argc, const char **argv) { if (!G.background) { wm_ghost_init(C); /* note: it assigns C to ghost! */ wm_init_cursor_data(); } GHOST_CreateSystemPaths(); BKE_addon_pref_type_init(); wm_operatortype_init(); wm_operatortypes_register(); WM_menutype_init(); WM_uilisttype_init(); ED_undosys_type_init(); BKE_library_callback_free_window_manager_set(wm_close_and_free); /* library.c */ BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference); /* library.c */ BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference); /* library.c */ BKE_blender_callback_test_break_set(wm_window_testbreak); /* blender.c */ BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */ DAG_editors_update_cb(ED_render_id_flush_update, ED_render_scene_update, ED_render_scene_update_pre); /* depsgraph.c */ ED_spacetypes_init(); /* editors/space_api/spacetype.c */ ED_file_init(); /* for fsmenu */ ED_node_init_butfuncs(); BLF_init(); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ BLT_lang_init(); /* Must call first before doing any .blend file reading, since versionning code may create new IDs... See T57066. */ BLT_lang_set(NULL); /* reports cant be initialized before the wm, * but keep before file reading, since that may report errors */ wm_init_reports(C); /* get the default database, plus a wm */ wm_homefile_read(C, NULL, G.factory_startup, false, true, NULL, WM_init_state_app_template_get()); /* Call again to set from userpreferences... */ BLT_lang_set(NULL); if (!G.background) { #ifdef WITH_INPUT_NDOF /* sets 3D mouse deadzone */ WM_ndof_deadzone_set(U.ndof_deadzone); #endif GPU_init(); GPU_set_mipmap(G_MAIN, !(U.gameflags & USER_DISABLE_MIPMAP)); GPU_set_linear_mipmap(true); GPU_set_anisotropic(G_MAIN, U.anisotropic_filter); GPU_set_gpu_mipmapping(G_MAIN, U.use_gpu_mipmap); #ifdef WITH_OPENSUBDIV BKE_subsurf_osd_init(); #endif UI_init(); } else { /* Note: Currently only inits icons, which we now want in background mode too * (scripts could use those in background processing...). * In case we do more later, we may need to pass a 'background' flag. * Called from 'UI_init' above */ BKE_icons_init(1); } ED_spacemacros_init(); /* note: there is a bug where python needs initializing before loading the * startup.blend because it may contain PyDrivers. It also needs to be after * initializing space types and other internal data. * * However cant redo this at the moment. Solution is to load python * before wm_homefile_read() or make py-drivers check if python is running. * Will try fix when the crash can be repeated. - campbell. */ #ifdef WITH_PYTHON BPY_context_set(C); /* necessary evil */ BPY_python_start(argc, argv); BPY_python_reset(C); #else (void)argc; /* unused */ (void)argv; /* unused */ #endif if (!G.background && !wm_start_with_console) GHOST_toggleConsole(3); clear_matcopybuf(); ED_render_clear_mtex_copybuf(); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); wm_history_file_read(); /* allow a path of "", this is what happens when making a new file */ #if 0 if (BKE_main_blendfile_path_from_global()[0] == '\0') BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend"); #endif BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib)); #ifdef WITH_COMPOSITOR if (1) { extern void *COM_linker_hack; COM_linker_hack = COM_execute; } #endif /* load last session, uses regular file reading so it has to be in end (after init py etc) */ if (U.uiflag2 & USER_KEEP_SESSION) { /* calling WM_recover_last_session(C, NULL) has been moved to creator.c */ /* that prevents loading both the kept session, and the file on the command line */ } else { Main *bmain = CTX_data_main(C); /* note, logic here is from wm_file_read_post, * call functions that depend on Python being initialized. */ /* normally 'wm_homefile_read' will do this, * however python is not initialized when called from this function. * * unlikely any handlers are set but its possible, * note that recovering the last session does its own callbacks. */ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE); BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST); wm_file_read_report(C, bmain); if (!G.background) { CTX_wm_window_set(C, NULL); } } }
bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) { if (!m_engineInitialized) { GPU_init(); bgl::InitExtensions(true); // get and set the preferences SYS_SystemHandle syshandle = SYS_GetSystem(); if (!syshandle) return false; // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0); // SYS_WriteCommandLineInt(syshandle, "vertexarrays",1); GameData *gm= &m_startScene->gm; bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); bool showPhysics = (gm->flag & GAME_SHOW_PHYSICS); SYS_WriteCommandLineInt(syshandle, "show_physics", showPhysics); bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixedtime", (gm->flag & GAME_ENABLE_ALL_FRAMES)) != 0); bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0) && GPU_display_list_support(); bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); bool restrictAnimFPS = (gm->flag & GAME_RESTRICT_ANIM_UPDATES) != 0; if (GLEW_ARB_multitexture && GLEW_VERSION_1_1) m_blendermat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0); if (GPU_glsl_support()) m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0); else if (m_globalSettings->matmode == GAME_MAT_GLSL) m_blendermat = false; // create the canvas, rasterizer and rendertools m_canvas = new GPG_Canvas(window); if (!m_canvas) return false; if (gm->vsync == VSYNC_ADAPTIVE) m_canvas->SetSwapInterval(-1); else m_canvas->SetSwapInterval((gm->vsync == VSYNC_ON) ? 1 : 0); m_canvas->Init(); if (gm->flag & GAME_SHOW_MOUSE) m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); //Don't use displaylists with VBOs //If auto starts using VBOs, make sure to check for that here if (useLists && gm->raster_storage != RAS_STORE_VBO) m_rasterizer = new RAS_ListRasterizer(m_canvas, false, gm->raster_storage); else m_rasterizer = new RAS_OpenGLRasterizer(m_canvas, gm->raster_storage); /* Stereo parameters - Eye Separation from the UI - stereomode from the command-line/UI */ m_rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) stereoMode); m_rasterizer->SetEyeSeparation(m_startScene->gm.eyeseparation); if (!m_rasterizer) goto initFailed; // create the inputdevices m_keyboard = new GPG_KeyboardDevice(); if (!m_keyboard) goto initFailed; m_mouse = new GPC_MouseDevice(); if (!m_mouse) goto initFailed; // create a networkdevice m_networkdevice = new NG_LoopBackNetworkDeviceInterface(); if (!m_networkdevice) goto initFailed; BKE_sound_init(m_maggie); // create a ketsjisystem (only needed for timing and stuff) m_kxsystem = new GPG_System (m_system); if (!m_kxsystem) goto initFailed; // create the ketsjiengine m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); // set the devices m_ketsjiengine->SetKeyboardDevice(m_keyboard); m_ketsjiengine->SetMouseDevice(m_mouse); m_ketsjiengine->SetNetworkDevice(m_networkdevice); m_ketsjiengine->SetCanvas(m_canvas); m_ketsjiengine->SetRasterizer(m_rasterizer); KX_KetsjiEngine::SetExitKey(ConvertKeyCode(gm->exitkey)); #ifdef WITH_PYTHON CValue::SetDeprecationWarnings(nodepwarnings); #else (void)nodepwarnings; #endif m_ketsjiengine->SetUseFixedTime(fixed_framerate); m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties); m_ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); //set the global settings (carried over if restart/load new files) m_ketsjiengine->SetGlobalSettings(m_globalSettings); m_engineInitialized = true; } return m_engineInitialized; initFailed: BKE_sound_exit(); delete m_kxsystem; delete m_networkdevice; delete m_mouse; delete m_keyboard; delete m_rasterizer; delete m_canvas; m_canvas = NULL; m_rasterizer = NULL; m_keyboard = NULL; m_mouse = NULL; m_networkdevice = NULL; m_kxsystem = NULL; return false; }
/* only called once, for startup */ void WM_init(bContext *C, int argc, const char **argv) { if (!G.background) { wm_ghost_init(C); /* note: it assigns C to ghost! */ wm_init_cursor_data(); } GHOST_CreateSystemPaths(); BKE_addon_pref_type_init(); wm_operatortype_init(); WM_menutype_init(); WM_uilisttype_init(); set_free_windowmanager_cb(wm_close_and_free); /* library.c */ set_free_notifier_reference_cb(WM_main_remove_notifier_reference); /* library.c */ set_blender_test_break_cb(wm_window_testbreak); /* blender.c */ DAG_editors_update_cb(ED_render_id_flush_update, ED_render_scene_update); /* depsgraph.c */ ED_spacetypes_init(); /* editors/space_api/spacetype.c */ ED_file_init(); /* for fsmenu */ ED_node_init_butfuncs(); BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ BLF_lang_init(); /* Enforce loading the UI for the initial homefile */ G.fileflags &= ~G_FILE_NO_UI; /* get the default database, plus a wm */ wm_homefile_read(C, NULL, G.factory_startup, NULL); BLF_lang_set(NULL); /* note: there is a bug where python needs initializing before loading the * startup.blend because it may contain PyDrivers. It also needs to be after * initializing space types and other internal data. * * However cant redo this at the moment. Solution is to load python * before wm_homefile_read() or make py-drivers check if python is running. * Will try fix when the crash can be repeated. - campbell. */ #ifdef WITH_PYTHON BPY_context_set(C); /* necessary evil */ BPY_python_start(argc, argv); BPY_python_reset(C); #else (void)argc; /* unused */ (void)argv; /* unused */ #endif ED_spacemacros_init(); if (!G.background && !wm_start_with_console) GHOST_toggleConsole(3); wm_init_reports(C); /* reports cant be initialized before the wm */ if (!G.background) { GPU_init(); GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); GPU_set_anisotropic(U.anisotropic_filter); GPU_set_gpu_mipmapping(U.use_gpu_mipmap); UI_init(); } clear_matcopybuf(); ED_render_clear_mtex_copybuf(); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ED_preview_init_dbase(); wm_read_history(); /* allow a path of "", this is what happens when making a new file */ #if 0 if (G.main->name[0] == 0) BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend"); #endif BLI_strncpy(G.lib, G.main->name, FILE_MAX); #ifdef WITH_COMPOSITOR if (1) { extern void *COM_linker_hack; COM_linker_hack = COM_execute; } #endif /* load last session, uses regular file reading so it has to be in end (after init py etc) */ if (U.uiflag2 & USER_KEEP_SESSION) { /* calling WM_recover_last_session(C, NULL) has been moved to creator.c */ /* that prevents loading both the kept session, and the file on the command line */ } else { /* normally 'wm_homefile_read' will do this, * however python is not initialized when called from this function. * * unlikely any handlers are set but its possible, * note that recovering the last session does its own callbacks. */ BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE); BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); } }
/* belongs to below */ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; GHOST_GLSettings glSettings = {0}; static int multisamples = -1; int scr_w, scr_h, posy; /* force setting multisamples only once, it requires restart - and you cannot * mix it, either all windows have it, or none (tested in OSX opengl) */ if (multisamples == -1) multisamples = U.ogl_multisamples; glSettings.numOfAASamples = multisamples; /* a new window is created when pageflip mode is required for a window */ if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) glSettings.flags |= GHOST_glStereoVisual; if (G.debug & G_DEBUG_GPU) { glSettings.flags |= GHOST_glDebugContext; } if (!(U.uiflag2 & USER_OPENGL_NO_WARN_SUPPORT)) glSettings.flags |= GHOST_glWarnSupport; wm_get_screensize(&scr_w, &scr_h); posy = (scr_h - win->posy - win->sizey); ghostwin = GHOST_CreateWindow(g_system, title, win->posx, posy, win->sizex, win->sizey, (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, glSettings); if (ghostwin) { GHOST_RectangleHandle bounds; /* the new window has already been made drawable upon creation */ wm->windrawable = win; /* needed so we can detect the graphics card below */ GPU_init(); win->ghostwin = ghostwin; GHOST_SetWindowUserData(ghostwin, win); /* pointer back */ if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); #ifdef __APPLE__ /* set the state here, else OSX would not recognize changed screen resolution */ /* we agreed to not set any fullscreen or iconized state on startup */ GHOST_SetWindowState(ghostwin, GHOST_kWindowStateNormal); #endif /* store actual window size in blender window */ bounds = GHOST_GetClientBounds(win->ghostwin); win->sizex = GHOST_GetWidthRectangle(bounds); win->sizey = GHOST_GetHeightRectangle(bounds); GHOST_DisposeRectangle(bounds); #ifndef __APPLE__ /* set the state here, so minimized state comes up correct on windows */ GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate); #endif /* until screens get drawn, make it nice gray */ glClearColor(0.55, 0.55, 0.55, 0.0); /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { glClear(GL_COLOR_BUFFER_BIT); } /* displays with larger native pixels, like Macbook. Used to scale dpi with */ /* needed here, because it's used before it reads userdef */ U.pixelsize = wm_window_pixelsize(win); BKE_userdef_state(); wm_window_swap_buffers(win); //GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified); /* standard state vars for window */ glEnable(GL_SCISSOR_TEST); GPU_state_init(); } }