void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); screens[0].not_on_heap = false; screens[0].width = SCREENWIDTH; screens[0].height = SCREENHEIGHT; screens[0].byte_pitch = SCREENPITCH; screens[0].short_pitch = screens[0].byte_pitch/2; screens[0].int_pitch = screens[0].short_pitch/2; V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); // For now, use 8-bit rendering but default 24-bit framebuffer mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } // reset video modes gfxExit(); // disable console Done_ConsoleWin(); gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false); I_ClearFrameBuffer(GFX_TOP, GFX_LEFT); I_ClearFrameBuffer(GFX_TOP, GFX_RIGHT); I_ClearFrameBuffer(GFX_BOTTOM, 0); V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
static void I_UpdateVideoMode(void) { if (log_cb) log_cb(RETRO_LOG_INFO, "I_UpdateVideoMode: %dx%d\n", SCREENWIDTH, SCREENHEIGHT); V_InitMode(); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); screens[0].not_on_heap = true; screens[0].data = (unsigned char *)screen_buf; V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); // Initialize SDL with this graphics mode if (V_GetMode() == VID_MODEGL) { init_flags = SDL_OPENGL; } else { if (use_doublebuffer) init_flags = SDL_DOUBLEBUF; else init_flags = SDL_SWSURFACE; #ifndef _DEBUG init_flags |= SDL_HWPALETTE; #endif } if ( desired_fullscreen ) init_flags |= SDL_FULLSCREEN; if (V_GetMode() == VID_MODEGL) { SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, gl_colorbuffer_bits ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, gl_depthbuffer_bits ); screen = SDL_SetVideoMode(SCREENWIDTH, SCREENHEIGHT, gl_colorbuffer_bits, init_flags); } else { screen = SDL_SetVideoMode(SCREENWIDTH, SCREENHEIGHT, V_GetNumPixelBits(), init_flags); } if(screen == NULL) { I_Error("Couldn't set %dx%d video mode [%s]", SCREENWIDTH, SCREENHEIGHT, SDL_GetError()); } lprintf(LO_INFO, "I_UpdateVideoMode: 0x%x, %s, %s\n", init_flags, screen->pixels ? "SDL buffer" : "own buffer", SDL_MUSTLOCK(screen) ? "lock-and-copy": "direct access"); // Get the info needed to render to the display if (!SDL_MUSTLOCK(screen)) { screens[0].not_on_heap = true; screens[0].data = (unsigned char *) (screen->pixels); screens[0].byte_pitch = screen->pitch; screens[0].short_pitch = screen->pitch / V_GetModePixelDepth(VID_MODE16); screens[0].int_pitch = screen->pitch / V_GetModePixelDepth(VID_MODE32); } else { screens[0].not_on_heap = false; } V_AllocScreens(); // Hide pointer while over this window SDL_ShowCursor(0); I_PrepareMouse(1); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); if (V_GetMode() == VID_MODEGL) { int temp; lprintf(LO_INFO,"SDL OpenGL PixelFormat:\n"); SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_RED_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_GREEN_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_BLUE_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_STENCIL_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_RED_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_RED_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_GREEN_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_GREEN_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_BLUE_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_BLUE_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_ALPHA_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &temp ); lprintf(LO_INFO," SDL_GL_DOUBLEBUFFER: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_BUFFER_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_BUFFER_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_DEPTH_SIZE: %i\n",temp); #ifdef GL_DOOM gld_Init(SCREENWIDTH, SCREENHEIGHT); #endif } }