static void ResizeStep2(void) { g_CritialSection.Lock(); // Delete all OpenGL textures gTextureManager.CleanUp(); RDP_Cleanup(); // delete our opengl renderer CDeviceBuilder::GetBuilder()->DeleteRender(); // call video extension function with updated width, height (this creates a new OpenGL context) windowSetting.uDisplayWidth = status.gNewResizeWidth; windowSetting.uDisplayHeight = status.gNewResizeHeight; CoreVideo_ResizeWindow(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight); // re-initialize our OpenGL graphics context state bool res = CGraphicsContext::Get()->ResizeInitialize(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, !windowSetting.bDisplayFullscreen); if (res) { // re-create the OpenGL renderer CDeviceBuilder::GetBuilder()->CreateRender(); CRender::GetRender()->Initialize(); DLParser_Init(); } g_CritialSection.Unlock(); status.ToResize = false; }
static bool StartVideo(void) { windowSetting.dps = windowSetting.fps = -1; windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF; memcpy(&g_curRomInfo.romheader, gfx_info.HEADER, sizeof(ROMHeader)); unsigned char *puc = (unsigned char *) &g_curRomInfo.romheader; unsigned int i; unsigned char temp; for (i = 0; i < sizeof(ROMHeader); i += 4) /* byte-swap the ROM header */ { temp = puc[i]; puc[i] = puc[i+3]; puc[i+3] = temp; temp = puc[i+1]; puc[i+1] = puc[i+2]; puc[i+2] = temp; } ROM_GetRomNameFromHeader(g_curRomInfo.szGameName, &g_curRomInfo.romheader); Ini_GetRomOptions(&g_curRomInfo); char *p = (char *) g_curRomInfo.szGameName + (strlen((char *) g_curRomInfo.szGameName) -1); // -1 to skip null while (p >= (char *) g_curRomInfo.szGameName) { if( *p == ':' || *p == '\\' || *p == '/' ) *p = '-'; p--; } GenerateCurrentRomOptions(); status.dwTvSystem = CountryCodeToTVSystem(g_curRomInfo.romheader.nCountryID); if( status.dwTvSystem == TV_SYSTEM_NTSC ) status.fRatio = 0.75f; else status.fRatio = 9/11.0f;; CDeviceBuilder::GetBuilder()->CreateGraphicsContext(); CGraphicsContext::InitWindowInfo(); bool res = CGraphicsContext::Get()->Initialize(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight); if (!res) { return false; } CDeviceBuilder::GetBuilder()->CreateRender(); CRender::GetRender()->Initialize(); DLParser_Init(); status.bGameIsRunning = true; return true; }
bool StartVideo(void) { #ifndef _XBOX SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &windowSetting.screenSaverStatus, 0); if( windowSetting.screenSaverStatus ) SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0); // Disable screen saver windowSetting.timer = SetTimer(g_GraphicsInfo.hWnd, 100, 1000, (TIMERPROC)TimerProc); #endif windowSetting.dps = windowSetting.fps = -1; windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF; g_CritialSection.Lock(); memcpy(&g_curRomInfo.romheader, g_GraphicsInfo.HEADER, sizeof(ROMHeader)); unsigned char *puc = (unsigned char *) &g_curRomInfo.romheader; unsigned int i; unsigned char temp; for (i = 0; i < sizeof(ROMHeader); i += 4) /* byte-swap the ROM header */ { temp = puc[i]; puc[i] = puc[i+3]; puc[i+3] = temp; temp = puc[i+1]; puc[i+1] = puc[i+2]; puc[i+2] = temp; } ROM_GetRomNameFromHeader(g_curRomInfo.szGameName, &g_curRomInfo.romheader); Ini_GetRomOptions(&g_curRomInfo); char *p = g_curRomInfo.szGameName + (lstrlen(g_curRomInfo.szGameName) -1); // -1 to skip null while (p >= g_curRomInfo.szGameName) { if( *p == ':' || *p == '\\' || *p == '/' ) *p = '-'; p--; } GenerateCurrentRomOptions(); status.dwTvSystem = CountryCodeToTVSystem(g_curRomInfo.romheader.nCountryID); if( status.dwTvSystem == TV_SYSTEM_NTSC ) status.fRatio = 0.75f; else status.fRatio = 9/11.0f;; InitExternalTextures(); try { CDeviceBuilder::GetBuilder()->CreateGraphicsContext(); CGraphicsContext::InitWindowInfo(); bool res = CGraphicsContext::Get()->Initialize(g_GraphicsInfo.hWnd, g_GraphicsInfo.hStatusBar, 640, 480, TRUE); if(!res ) { g_CritialSection.Unlock(); return false; } CDeviceBuilder::GetBuilder()->CreateRender(); CRender::GetRender()->Initialize(); DLParser_Init(); status.bGameIsRunning = true; } catch(...) { ErrorMsg("Exception caught while starting video renderer"); throw 0; } g_CritialSection.Unlock(); return true; }
void StartVideo(void) { #ifdef DEBUGON // _break(); #endif windowSetting.dps = windowSetting.fps = -1; windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF; g_CritialSection.Lock(); memcpy(&g_curRomInfo.romheader, g_GraphicsInfo.HEADER, sizeof(ROMHeader)); #ifndef _BIG_ENDIAN unsigned char *puc = (unsigned char *) &g_curRomInfo.romheader; unsigned int i; unsigned char temp; for (i = 0; i < sizeof(ROMHeader); i += 4) { temp = puc[i]; puc[i] = puc[i+3]; puc[i+3] = temp; temp = puc[i+1]; puc[i+1] = puc[i+2]; puc[i+2] = temp; } #endif //_BIG_ENDIAN ROM_GetRomNameFromHeader(g_curRomInfo.szGameName, &g_curRomInfo.romheader); Ini_GetRomOptions(&g_curRomInfo); char *p = (char *) g_curRomInfo.szGameName + (strlen((char *) g_curRomInfo.szGameName) -1); // -1 to skip null while (p >= (char *) g_curRomInfo.szGameName) { if( *p == ':' || *p == '\\' || *p == '/' ) *p = '-'; p--; } GenerateCurrentRomOptions(); status.dwTvSystem = CountryCodeToTVSystem(g_curRomInfo.romheader.nCountryID); if( status.dwTvSystem == TV_SYSTEM_NTSC ) status.fRatio = 0.75f; else status.fRatio = 9/11.0f;; InitExternalTextures(); try { #ifdef __GX__ CDeviceBuilder::SelectDeviceType(OGL_DEVICE); #endif //__GX__ #ifdef XENON CDeviceBuilder::SelectDeviceType(OGL_DEVICE); #endif CDeviceBuilder::GetBuilder()->CreateGraphicsContext(); CGraphicsContext::InitWindowInfo(); windowSetting.bDisplayFullscreen = FALSE; bool res = CGraphicsContext::Get()->Initialize(0, 0, 640, 480, TRUE); CDeviceBuilder::GetBuilder()->CreateRender(); CRender::GetRender()->Initialize(); if( res ) { DLParser_Init(); } status.bGameIsRunning = true; } catch(...) { ErrorMsg("Error to start video"); throw 0; } g_CritialSection.Unlock(); }
void riceUpdateScreen(void) { status.bVIOriginIsUpdated = false; if (status.ToResize && status.gDlistCount > 0) { // Delete all OpenGL textures gTextureManager.CleanUp(); RDP_Cleanup(); // delete our opengl renderer CDeviceBuilder::GetBuilder()->DeleteRender(); // call video extension function with updated width, height (this creates a new OpenGL context) windowSetting.uDisplayWidth = status.gNewResizeWidth; windowSetting.uDisplayHeight = status.gNewResizeHeight; //CoreVideo_ResizeWindow(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight); // re-initialize our OpenGL graphics context state bool res = CGraphicsContext::Get()->ResizeInitialize(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight); if (res) { // re-create the OpenGL renderer CDeviceBuilder::GetBuilder()->CreateRender(); CRender::GetRender()->Initialize(); DLParser_Init(); } status.ToResize = false; return; } if( status.bHandleN64RenderTexture ) g_pFrameBufferManager->CloseRenderTexture(true); g_pFrameBufferManager->SetAddrBeDisplayed(*gfx_info.VI_ORIGIN_REG); if( status.gDlistCount == 0 ) { // CPU frame buffer update uint32_t width = *gfx_info.VI_WIDTH_REG; if( (*gfx_info.VI_ORIGIN_REG & (g_dwRamSize-1) ) > width*2 && *gfx_info.VI_H_START_REG != 0 && width != 0 ) { SetVIScales(); CRender::GetRender()->DrawFrameBuffer(true, 0, 0, 0, 0); CGraphicsContext::Get()->UpdateFrame(false); } return; } TXTRBUF_DETAIL_DUMP(TRACE1("VI ORIG is updated to %08X", *gfx_info.VI_ORIGIN_REG)); if( currentRomOptions.screenUpdateSetting == SCREEN_UPDATE_AT_VI_UPDATE ) { CGraphicsContext::Get()->UpdateFrame(false); return; } TXTRBUF_DETAIL_DUMP(TRACE1("VI ORIG is updated to %08X", *gfx_info.VI_ORIGIN_REG)); if( currentRomOptions.screenUpdateSetting == SCREEN_UPDATE_AT_VI_UPDATE_AND_DRAWN ) { if( status.bScreenIsDrawn ) CGraphicsContext::Get()->UpdateFrame(false); return; } if( currentRomOptions.screenUpdateSetting==SCREEN_UPDATE_AT_VI_CHANGE ) { if( *gfx_info.VI_ORIGIN_REG != status.curVIOriginReg ) { if( *gfx_info.VI_ORIGIN_REG < status.curDisplayBuffer || *gfx_info.VI_ORIGIN_REG > status.curDisplayBuffer+0x2000 ) { status.curDisplayBuffer = *gfx_info.VI_ORIGIN_REG; status.curVIOriginReg = status.curDisplayBuffer; //status.curRenderBuffer = NULL; CGraphicsContext::Get()->UpdateFrame(false); } else { status.curDisplayBuffer = *gfx_info.VI_ORIGIN_REG; status.curVIOriginReg = status.curDisplayBuffer; } } return; } if( currentRomOptions.screenUpdateSetting >= SCREEN_UPDATE_AT_1ST_CI_CHANGE ) { status.bVIOriginIsUpdated=true; return; } }