void InGameMenuScreen::render() { UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); ui_draw2d.DrawText(UBUNTU48, "Emulation Paused", dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER); VLinear vlinear(dp_xres - 10, 160, 20); if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Continue", ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Return to Menu", ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_OK); } DrawWatermark(); UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); }
void FileSelectScreen::render() { FileListAdapter adapter(options_, &listing_, screenManager()->getUIContext()); I18NCategory *g = GetI18NCategory("General"); UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); if (list_.Do(GEN_ID, 10, BUTTON_HEIGHT + 20, dp_xres-20, dp_yres - BUTTON_HEIGHT - 30, &adapter)) { if (listing_[list_.selected].isDirectory) { currentDirectory_ = listing_[list_.selected].fullName; ILOG("%s", currentDirectory_.c_str()); updateListing(); list_.selected = -1; } else { std::string boot_filename = listing_[list_.selected].fullName; ILOG("Selected: %i : %s", list_.selected, boot_filename.c_str()); list_.selected = -1; g_Config.Save(); UIEnd(); screenManager()->switchScreen(new EmuScreen(boot_filename)); return; } } ui_draw2d.DrawImageStretch(I_BUTTON, 0, 0, dp_xres, 70); if (UIButton(GEN_ID, Pos(10,10), SMALL_BUTTON_WIDTH, 0, g->T("Up"), ALIGN_TOPLEFT)) { currentDirectory_ = getDir(currentDirectory_); updateListing(); } ui_draw2d.DrawTextShadow(UBUNTU24, currentDirectory_.c_str(), 20 + SMALL_BUTTON_WIDTH, 10 + 25, 0xFFFFFFFF, ALIGN_LEFT | ALIGN_VCENTER); if (UIButton(GEN_ID, Pos(dp_xres - 10, 10), SMALL_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT)) { g_Config.Save(); screenManager()->switchScreen(new MenuScreen()); } UIEnd(); }
void AudioScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *a = GetI18NCategory("Audio"); ui_draw2d.DrawText(UBUNTU48, a->T("Audio Settings"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } int x = 30; int y = 30; int stride = 40; int columnw = 400; UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound); UIEnd(); }
void ErrorScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *ge = GetI18NCategory("Error"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, ge->T(errorTitle_.c_str()), dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); ui_draw2d.DrawText(UBUNTU24, ge->T(errorMessage_.c_str()), 40, 120, 0xFFFFFFFF, ALIGN_LEFT); I18NCategory *g = GetI18NCategory("General"); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), 200, 0, g->T("Back"), ALIGN_BOTTOMRIGHT)) { screenManager()->finishDialog(this, DR_OK); } UIEnd(); }
void SettingsScreen::render() { UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); ui_draw2d.DrawText(UBUNTU48, "Settings", dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER); // VLinear vlinear(10, 80, 10); int x = 30; int y = 50; UICheckBox(GEN_ID, x, y += 45, "Sound Emulation", ALIGN_TOPLEFT, &g_Config.bEnableSound); UICheckBox(GEN_ID, x, y += 45, "Buffered Rendering", ALIGN_TOPLEFT, &g_Config.bBufferedRendering); if (g_Config.bBufferedRendering) { bool doubleRes = g_Config.iWindowZoom == 2; UICheckBox(GEN_ID, x + 50, y += 50, "2x Render Resolution", ALIGN_TOPLEFT, &doubleRes); g_Config.iWindowZoom = doubleRes ? 2 : 1; } UICheckBox(GEN_ID, x, y += 45, "Hardware Transform", ALIGN_TOPLEFT, &g_Config.bHardwareTransform); bool useFastInt = g_Config.iCpuCore == CPU_FASTINTERPRETER; UICheckBox(GEN_ID, x, y += 45, "Slightly faster interpreter (may crash)", ALIGN_TOPLEFT, &useFastInt); // ui_draw2d.DrawText(UBUNTU48, "much faster JIT coming later", x, y+=50, 0xcFFFFFFF, ALIGN_LEFT); UICheckBox(GEN_ID, x, y += 45, "On-screen Touch Controls", ALIGN_TOPLEFT, &g_Config.bShowTouchControls); if (g_Config.bShowTouchControls) UICheckBox(GEN_ID, x + 50, y += 50, "Show Analog Stick", ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); g_Config.iCpuCore = useFastInt ? CPU_FASTINTERPRETER : CPU_INTERPRETER; // UICheckBox(GEN_ID, x, y += 50, "Draw raw framebuffer (for some homebrew)", ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, "Back", ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->switchScreen(new MenuScreen()); } UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); }
void AudioScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *a = GetI18NCategory("Audio"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, a->T("Audio Settings"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } int x = 30; int y = 35; int stride = 40; int columnw = 400; UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound); if (Atrac3plus_Decoder::IsInstalled() && g_Config.bEnableSound) { UICheckBox(GEN_ID, x, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus); } #if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A) VLinear vlinear(30, 300, 20); if (UIButton(GEN_ID, vlinear, 400, 0, a->T("Download Atrac3+ plugin"), ALIGN_LEFT)) { screenManager()->push(new PluginScreen()); } #endif UIEnd(); }
void SettingsScreen::render() { UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); ui_draw2d.DrawText(UBUNTU48, "Settings", dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER); // VLinear vlinear(10, 80, 10); int x = 30; int y = 50; UICheckBox(GEN_ID, x, y += 50, "Enable Sound Emulation", ALIGN_TOPLEFT, &g_Config.bEnableSound); UICheckBox(GEN_ID, x, y += 50, "Show Analog Stick", ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); UICheckBox(GEN_ID, x, y += 50, "Buffered Rendering (may fix flicker)", ALIGN_TOPLEFT, &g_Config.bBufferedRendering); // UICheckBox(GEN_ID, x, y += 50, "Draw raw framebuffer (for some homebrew)", ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, "Back", ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->switchScreen(new MenuScreen()); } UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); }
void SystemScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *s = GetI18NCategory("System"); I18NCategory *g = GetI18NCategory("General"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, s->T("System Settings"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } int x = 30; int y = 30; int stride = 40; int columnw = 400; UICheckBox(GEN_ID, x, y += stride, s->T("Dynarec", "Dynarec (JIT)"), ALIGN_TOPLEFT, &g_Config.bJit); if (g_Config.bJit) UICheckBox(GEN_ID, x, y += stride, s->T("Fast Memory", "Fast Memory (unstable)"), ALIGN_TOPLEFT, &g_Config.bFastMemory); UICheckBox(GEN_ID, x, y += stride, s->T("Show Debug Statistics"), ALIGN_TOPLEFT, &g_Config.bShowDebugStats); UICheckBox(GEN_ID, x, y += stride, s->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter); UICheckBox(GEN_ID, x, y += stride, s->T("Encrypt Save"), ALIGN_TOPLEFT, &g_Config.bEncryptSave); bool tf = g_Config.itimeformat == 1; UICheckBox(GEN_ID, x, y += stride, s->T("12HR Time Format"), ALIGN_TOPLEFT, &tf); g_Config.itimeformat = tf ? 1 : 0; if (UIButton(GEN_ID, Pos(x, y += stride * 3), LARGE_BUTTON_WIDTH, 0, s->T("Language"), ALIGN_BOTTOMLEFT)) { screenManager()->push(new LanguageScreen()); } UIEnd(); }
void GraphicsScreenP2::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, gs->T("Graphics Settings"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } HLinear hlinear(10, dp_yres - 10, 20.0f); if (UIButton(GEN_ID, hlinear, LARGE_BUTTON_WIDTH + 10, 0, g->T("Prev Page"), ALIGN_BOTTOMLEFT)) { screenManager()->switchScreen(new GraphicsScreenP1()); } if (UIButton(GEN_ID, hlinear, LARGE_BUTTON_WIDTH + 10, 0, g->T("Next Page"), ALIGN_BOTTOMLEFT)) { screenManager()->switchScreen(new GraphicsScreenP3()); } int x = 30; int y = 35; int stride = 40; int columnw = 400; UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering); bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0; UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering); if (AnisotropicFiltering) { if (g_Config.iAnisotropyLevel == 0) g_Config.iAnisotropyLevel = 2; ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 180, y, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, gs->T("2x"), ALIGN_LEFT)) g_Config.iAnisotropyLevel = 2; if (UIButton(GEN_ID, hlinear1, 45, 0, gs->T("4x"), ALIGN_LEFT)) g_Config.iAnisotropyLevel = 4; if (UIButton(GEN_ID, hlinear1, 45, 0, gs->T("8x"), ALIGN_LEFT)) g_Config.iAnisotropyLevel = 8; if (UIButton(GEN_ID, hlinear1, 60, 0, gs->T("16x"), ALIGN_LEFT)) g_Config.iAnisotropyLevel = 16; y += 20; } else { g_Config.iAnisotropyLevel = 0; } bool TexScaling = g_Config.iTexScalingLevel > 1; UICheckBox(GEN_ID, x, y += stride, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &TexScaling); if (TexScaling) { if (g_Config.iTexScalingLevel <= 1) g_Config.iTexScalingLevel = 2; ui_draw2d.DrawText(UBUNTU24, gs->T("Type :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 180, y, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, gs->T("xBRZ"), ALIGN_LEFT)) g_Config.iTexScalingType = 0; if (UIButton(GEN_ID, hlinear1, 150, 0, gs->T("Hybrid", "Hybrid(H)"), ALIGN_LEFT)) g_Config.iTexScalingType = 1; if (UIButton(GEN_ID, hlinear1, 150, 0, gs->T("Bicubic", "Bicubic(B)"), ALIGN_LEFT)) g_Config.iTexScalingType = 2; if (UIButton(GEN_ID, hlinear1, 80, 0, gs->T("H+B", "H+B"), ALIGN_LEFT)) g_Config.iTexScalingType = 3; ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride + 20, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear2(x + 180, y, 20); if (UIButton(GEN_ID, hlinear2, 45, 0, gs->T("2x"), ALIGN_LEFT)) g_Config.iTexScalingLevel = 2; if (UIButton(GEN_ID, hlinear2, 45, 0, gs->T("3x"), ALIGN_LEFT)) g_Config.iTexScalingLevel = 3; UICheckBox(GEN_ID, x + 60, y += stride + 20, gs->T("Deposterize"), ALIGN_LEFT, &g_Config.bTexDeposterize); } else { g_Config.iTexScalingLevel = 1; } UIEnd(); }
void EmuScreen::render() { if (invalid_) return; // Reapply the graphics state of the PSP ReapplyGfxState(); // We just run the CPU until we get to vblank. This will quickly sync up pretty nicely. // The actual number of cycles doesn't matter so much here as we will break due to CORE_NEXTFRAME, most of the time hopefully... int blockTicks = usToCycles(1000000 / 10); // Run until CORE_NEXTFRAME while (coreState == CORE_RUNNING) { u64 nowTicks = CoreTiming::GetTicks(); mipsr4k.RunLoopUntil(nowTicks + blockTicks); } // Hopefully coreState is now CORE_NEXTFRAME if (coreState == CORE_NEXTFRAME) { // set back to running for the next frame coreState = CORE_RUNNING; } else if (coreState == CORE_POWERDOWN) { ILOG("SELF-POWERDOWN!"); if (g_Config.bNewUI) screenManager()->switchScreen(new MainScreen()); else screenManager()->switchScreen(new MenuScreen()); } if (invalid_) return; if (g_Config.bBufferedRendering) fbo_unbind(); UIShader_Prepare(); uiTexture->Bind(0); glstate.viewport.set(0, 0, pixel_xres, pixel_yres); glstate.viewport.restore(); ui_draw2d.Begin(UIShader_Get(), DBMODE_NORMAL); float touchOpacity = g_Config.iTouchButtonOpacity / 100.0f; if (g_Config.bShowTouchControls) DrawGamepad(ui_draw2d, touchOpacity); DrawWatermark(); if (!osm.IsEmpty()) { osm.Draw(ui_draw2d); } if (g_Config.bShowDebugStats) { char statbuf[4096] = {0}; __DisplayGetDebugStats(statbuf); if (statbuf[4095]) ERROR_LOG(HLE, "Statbuf too big"); ui_draw2d.SetFontScale(.7f, .7f); ui_draw2d.DrawText(UBUNTU24, statbuf, 11, 11, 0xc0000000); ui_draw2d.DrawText(UBUNTU24, statbuf, 10, 10, 0xFFFFFFFF); ui_draw2d.SetFontScale(1.0f, 1.0f); } if (g_Config.iShowFPSCounter) { float vps, fps; __DisplayGetFPS(&vps, &fps); char fpsbuf[256]; switch (g_Config.iShowFPSCounter) { case 1: sprintf(fpsbuf, "Speed: %0.1f", vps); break; case 2: sprintf(fpsbuf, "FPS: %0.1f", fps); break; case 3: sprintf(fpsbuf, "Speed: %5.1f\nFPS: %0.1f", vps, fps); break; } ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT); ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT); } glsl_bind(UIShader_Get()); ui_draw2d.End(); ui_draw2d.Flush(); // Tiled renderers like PowerVR should benefit greatly from this. However - seems I can't call it? #if defined(USING_GLES2) bool hasDiscard = gl_extensions.EXT_discard_framebuffer; // TODO if (hasDiscard) { //const GLenum targets[3] = { GL_COLOR_EXT, GL_DEPTH_EXT, GL_STENCIL_EXT }; //glDiscardFramebufferEXT(GL_FRAMEBUFFER, 3, targets); } #endif }
void SettingsScreen::render() { UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); ui_draw2d.DrawText(UBUNTU48, "Settings", dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER); // TODO: Need to add tabs soon... // VLinear vlinear(10, 80, 10); int x = 30; int y = 30; int stride = 40; int columnw = 420; UICheckBox(GEN_ID, x, y += stride, "Sound Emulation", ALIGN_TOPLEFT, &g_Config.bEnableSound); UICheckBox(GEN_ID, x + columnw, y, "Linear Filtering", ALIGN_TOPLEFT, &g_Config.bLinearFiltering); if (UICheckBox(GEN_ID, x, y += stride, "Buffered Rendering", ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) { if (gpu) gpu->Resized(); } if (g_Config.bBufferedRendering) { bool doubleRes = g_Config.iWindowZoom == 2; if (UICheckBox(GEN_ID, x + columnw, y, "2x Render Resolution", ALIGN_TOPLEFT, &doubleRes)) { if (gpu) gpu->Resized(); } g_Config.iWindowZoom = doubleRes ? 2 : 1; } #ifndef __SYMBIAN32__ UICheckBox(GEN_ID, x, y += stride, "Hardware Transform", ALIGN_TOPLEFT, &g_Config.bHardwareTransform); UICheckBox(GEN_ID, x + columnw, y, "Draw using Stream VBO", ALIGN_TOPLEFT, &g_Config.bUseVBO); #endif UICheckBox(GEN_ID, x, y += stride, "Vertex Cache", ALIGN_TOPLEFT, &g_Config.bVertexCache); UICheckBox(GEN_ID, x + columnw, y, "Use Media Engine", ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); UICheckBox(GEN_ID, x, y += stride, "JIT (Dynarec)", ALIGN_TOPLEFT, &g_Config.bJit); if (g_Config.bJit) UICheckBox(GEN_ID, x + columnw, y, "Fastmem (may be unstable)", ALIGN_TOPLEFT, &g_Config.bFastMemory); UICheckBox(GEN_ID, x, y += stride, "On-screen Touch Controls", ALIGN_TOPLEFT, &g_Config.bShowTouchControls); if (g_Config.bShowTouchControls) { UICheckBox(GEN_ID, x + columnw, y, "Large Controls", ALIGN_TOPLEFT, &g_Config.bLargeControls); UICheckBox(GEN_ID, x + columnw, y += stride, "Show Analog Stick", ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); } else { y += stride; } UICheckBox(GEN_ID, x, y, "Tilt to Analog (horizontal)", ALIGN_TOPLEFT, &g_Config.bAccelerometerToAnalogHoriz); ui_draw2d.DrawText(UBUNTU24, "Some settings may require a restart to apply.", dp_xres/2, y += stride + 20, 0xFFFFFFFF, ALIGN_HCENTER); // UICheckBox(GEN_ID, x, y += stride, "Draw raw framebuffer (for some homebrew)", ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, "Back", ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } if (UIButton(GEN_ID, Pos(10, dp_yres-10), LARGE_BUTTON_WIDTH, "Developer Menu", ALIGN_BOTTOMLEFT)) { screenManager()->push(new DeveloperScreen()); } UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); }
void InGameMenuScreen::render() { UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); const char *title; // Try to ignore (tm) etc. if (UTF8StringNonASCIICount(game_title.c_str()) > 2) { title = "(can't display japanese title)"; } else { title = game_title.c_str(); } ui_draw2d.DrawText(UBUNTU48, title, dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER); int x = 30; int y = 50; int stride = 40; int columnw = 420; UICheckBox(GEN_ID, x, y += stride, "Show Debug Statistics", ALIGN_TOPLEFT, &g_Config.bShowDebugStats); UICheckBox(GEN_ID, x + columnw, y, "Show FPS", ALIGN_TOPLEFT, &g_Config.bShowFPSCounter); // TODO: Maybe shouldn't show this if the screen ratios are very close... UICheckBox(GEN_ID, x, y += stride, "Stretch to display", ALIGN_TOPLEFT, &g_Config.bStretchToDisplay); UICheckBox(GEN_ID, x, y += stride, "Hardware Transform", ALIGN_TOPLEFT, &g_Config.bHardwareTransform); if (UICheckBox(GEN_ID, x, y += stride, "Buffered Rendering", ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) { if (gpu) gpu->Resized(); } bool fs = g_Config.iFrameSkip == 1; UICheckBox(GEN_ID, x, y += stride, "Frameskip (beta)", ALIGN_TOPLEFT, &fs); g_Config.iFrameSkip = fs ? 1 : 0; // TODO: Add UI for more than one slot. HLinear hlinear1(x, y + 80, 20); if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, "Save State", ALIGN_LEFT)) { SaveState::SaveSlot(0, 0, 0); screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, "Load State", ALIGN_LEFT)) { SaveState::LoadSlot(0, 0, 0); screenManager()->finishDialog(this, DR_CANCEL); } VLinear vlinear(dp_xres - 10, 160, 20); if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Continue", ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Settings", ALIGN_RIGHT)) { screenManager()->push(new SettingsScreen(), 0); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Return to Menu", ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_OK); } /* if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH*2, "Debug: Dump Next Frame", ALIGN_BOTTOMRIGHT)) { gpu->DumpNextFrame(); } */ DrawWatermark(); UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); }
void MenuScreen::render() { UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); double xoff = 150 - frames_ * frames_ * 0.4f; if (xoff < -20) xoff = -20; if (frames_ > 200) // seems the above goes nuts after a while... xoff = -20; int w = LARGE_BUTTON_WIDTH + 40; ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres + xoff - w/2, 75, 0xFFFFFFFF, ALIGN_HCENTER | ALIGN_BOTTOM); ui_draw2d.SetFontScale(0.7f, 0.7f); ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_GIT_VERSION, dp_xres + xoff, 85, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM); ui_draw2d.SetFontScale(1.0f, 1.0f); VLinear vlinear(dp_xres + xoff, 100, 20); if (UIButton(GEN_ID, vlinear, w, "Load...", ALIGN_RIGHT)) { #if defined(USING_QT_UI) QString fileName = QFileDialog::getOpenFileName(NULL, "Load ROM", g_Config.currentDirectory.c_str(), "PSP ROMs (*.iso *.cso *.pbp *.elf)"); if (QFile::exists(fileName)) { QDir newPath; g_Config.currentDirectory = newPath.filePath(fileName).toStdString(); g_Config.Save(); screenManager()->switchScreen(new EmuScreen(fileName.toStdString())); } #else FileSelectScreenOptions options; options.allowChooseDirectory = true; options.filter = "iso:cso:pbp:elf:prx:"; options.folderIcon = I_ICON_FOLDER; options.iconMapping["iso"] = I_ICON_UMD; options.iconMapping["cso"] = I_ICON_UMD; options.iconMapping["pbp"] = I_ICON_EXE; options.iconMapping["elf"] = I_ICON_EXE; screenManager()->switchScreen(new FileSelectScreen(options)); #endif UIReset(); } if (UIButton(GEN_ID, vlinear, w, "Settings", ALIGN_RIGHT)) { screenManager()->push(new SettingsScreen(), 0); UIReset(); } if (UIButton(GEN_ID, vlinear, w, "Credits", ALIGN_RIGHT)) { screenManager()->switchScreen(new CreditsScreen()); UIReset(); } if (UIButton(GEN_ID, vlinear, w, "Exit", ALIGN_RIGHT)) { // TODO: Save when setting changes, rather than when we quit NativeShutdown(); // TODO: Need a more elegant way to quit exit(0); } if (UIButton(GEN_ID, vlinear, w, "www.ppsspp.org", ALIGN_RIGHT)) { LaunchBrowser("http://www.ppsspp.org/"); } DrawWatermark(); UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); }
void EmuScreen::render() { if (invalid_) return; if (PSP_CoreParameter().freezeNext) { PSP_CoreParameter().frozen = true; PSP_CoreParameter().freezeNext = false; SaveState::SaveToRam(freezeState_); } else if (PSP_CoreParameter().frozen) { if (CChunkFileReader::ERROR_NONE != SaveState::LoadFromRam(freezeState_)) { ERROR_LOG(HLE, "Failed to load freeze state. Unfreezing."); PSP_CoreParameter().frozen = false; } } // Reapply the graphics state of the PSP ReapplyGfxState(); // We just run the CPU until we get to vblank. This will quickly sync up pretty nicely. // The actual number of cycles doesn't matter so much here as we will break due to CORE_NEXTFRAME, most of the time hopefully... int blockTicks = usToCycles(1000000 / 10); // Run until CORE_NEXTFRAME while (coreState == CORE_RUNNING) { PSP_RunLoopFor(blockTicks); } // Hopefully coreState is now CORE_NEXTFRAME if (coreState == CORE_NEXTFRAME) { // set back to running for the next frame coreState = CORE_RUNNING; } else if (coreState == CORE_POWERDOWN) { PSP_Shutdown(); ILOG("SELF-POWERDOWN!"); screenManager()->switchScreen(new MainScreen()); invalid_ = true; } if (invalid_) return; bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE; if (useBufferedRendering) fbo_unbind(); UIShader_Prepare(); uiTexture->Bind(0); glstate.viewport.set(0, 0, pixel_xres, pixel_yres); glstate.viewport.restore(); ui_draw2d.Begin(UIShader_Get(), DBMODE_NORMAL); if (root_) { UI::LayoutViewHierarchy(*screenManager()->getUIContext(), root_); root_->Draw(*screenManager()->getUIContext()); } if (!osm.IsEmpty()) { osm.Draw(ui_draw2d, screenManager()->getUIContext()->GetBounds()); } if (g_Config.bShowDebugStats) { char statbuf[4096] = {0}; __DisplayGetDebugStats(statbuf); if (statbuf[4095]) { ELOG("Statbuf too small! :("); } ui_draw2d.SetFontScale(.7f, .7f); ui_draw2d.DrawText(UBUNTU24, statbuf, 11, 11, 0xc0000000, FLAG_DYNAMIC_ASCII); ui_draw2d.DrawText(UBUNTU24, statbuf, 10, 10, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII); ui_draw2d.SetFontScale(1.0f, 1.0f); } if (g_Config.iShowFPSCounter) { float vps, fps, actual_fps; __DisplayGetFPS(&vps, &fps, &actual_fps); char fpsbuf[256]; switch (g_Config.iShowFPSCounter) { case 1: sprintf(fpsbuf, "Speed: %0.1f%%", vps / (59.94f / 100.0f)); break; case 2: sprintf(fpsbuf, "FPS: %0.1f", actual_fps); break; case 3: sprintf(fpsbuf, "%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / (59.94f / 100.0f)); break; default: return; } const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); ui_draw2d.SetFontScale(0.7f, 0.7f); ui_draw2d.DrawText(UBUNTU24, fpsbuf, bounds.x2() - 8, 12, 0xc0000000, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII); ui_draw2d.DrawText(UBUNTU24, fpsbuf, bounds.x2() - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII); ui_draw2d.SetFontScale(1.0f, 1.0f); } glsl_bind(UIShader_Get()); ui_draw2d.End(); ui_draw2d.Flush(); // Tiled renderers like PowerVR should benefit greatly from this. However - seems I can't call it? #if defined(USING_GLES2) bool hasDiscard = gl_extensions.EXT_discard_framebuffer; // TODO if (hasDiscard) { //const GLenum targets[3] = { GL_COLOR_EXT, GL_DEPTH_EXT, GL_STENCIL_EXT }; //glDiscardFramebufferEXT(GL_FRAMEBUFFER, 3, targets); } #endif }
void LanguageScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *s = GetI18NCategory("System"); I18NCategory *g = GetI18NCategory("General"); I18NCategory *l = GetI18NCategory("Language"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, s->T("Language"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } VGrid vlang(50, 100, dp_yres - 50, 10, 10); for (size_t i = 0; i < langs_.size(); i++) { std::string code; size_t dot = langs_[i].name.find('.'); if (dot != std::string::npos) code = langs_[i].name.substr(0, dot); std::string buttonTitle = langs_[i].name; if (!code.empty()) buttonTitle = code; if (UIButton(GEN_ID_LOOP(i), vlang, LARGE_BUTTON_WIDTH - 40, 0, buttonTitle.c_str(), ALIGN_TOPLEFT)) { std::string oldLang = g_Config.languageIni; g_Config.languageIni = code; if (i18nrepo.LoadIni(g_Config.languageIni)) { // Dunno what else to do here. langValuesMapping["ja_JP"] = PSP_SYSTEMPARAM_LANGUAGE_JAPANESE; langValuesMapping["en_US"] = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH; langValuesMapping["fr_FR"] = PSP_SYSTEMPARAM_LANGUAGE_FRENCH; langValuesMapping["es_ES"] = PSP_SYSTEMPARAM_LANGUAGE_SPANISH; langValuesMapping["es_LA"] = PSP_SYSTEMPARAM_LANGUAGE_SPANISH; langValuesMapping["de_DE"] = PSP_SYSTEMPARAM_LANGUAGE_GERMAN; langValuesMapping["it_IT"] = PSP_SYSTEMPARAM_LANGUAGE_ITALIAN; langValuesMapping["nl_NL"] = PSP_SYSTEMPARAM_LANGUAGE_DUTCH; langValuesMapping["pt_BR"] = PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE; langValuesMapping["ru_RU"] = PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN; langValuesMapping["ko_KR"] = PSP_SYSTEMPARAM_LANGUAGE_KOREAN; langValuesMapping["zh_TW"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL; langValuesMapping["zh_CN"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED; if(langValuesMapping.find(code) == langValuesMapping.end()) { //Fallback to English g_Config.ilanguage = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH; } else { g_Config.ilanguage = langValuesMapping[code]; } // After this, g and s are no longer valid. Let's return, some flicker is okay. g = GetI18NCategory("General"); s = GetI18NCategory("System"); l = GetI18NCategory("Language"); } else { g_Config.languageIni = oldLang; } } } UIEnd(); }
void GraphicsScreenP2::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, gs->T("Graphics Settings"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } int x = 30; int y = 30; int stride = 40; int columnw = 400; bool FpsLimit = g_Config.iFpsLimit != 0; UICheckBox(GEN_ID, x, y += stride + 15, gs->T("Fps Limit"), ALIGN_TOPLEFT, &FpsLimit); if (FpsLimit) { if (g_Config.iFpsLimit == 0) g_Config.iFpsLimit = 60; ui_draw2d.DrawText(UBUNTU24, gs->T("Fps :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 180 , y, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, "Auto", ALIGN_LEFT)) g_Config.iFpsLimit = 60; if (UIButton(GEN_ID, hlinear1, 60, 0, "-30", ALIGN_LEFT)) if(g_Config.iFpsLimit > 30){ g_Config.iFpsLimit -= 30;} if (UIButton(GEN_ID, hlinear1, 60, 0, "+30", ALIGN_LEFT)) if(g_Config.iFrameSkip != 240){ g_Config.iFpsLimit += 30;} } else { g_Config.iFpsLimit = 0; } bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0; UICheckBox(GEN_ID, x, y += stride + 15, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering); if (AnisotropicFiltering) { if (g_Config.iAnisotropyLevel == 0) g_Config.iAnisotropyLevel = 2; ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 180 , y, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 2; if (UIButton(GEN_ID, hlinear1, 45, 0, "4x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 4; if (UIButton(GEN_ID, hlinear1, 45, 0, "8x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 8; if (UIButton(GEN_ID, hlinear1, 60, 0, "16x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 16; } else { g_Config.iAnisotropyLevel = 0; } bool TexScaling = g_Config.iTexScalingLevel > 1; UICheckBox(GEN_ID, x, y += stride + 15, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &TexScaling); if (TexScaling) { if (g_Config.iTexScalingLevel <= 1) g_Config.iTexScalingLevel = 2; ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 180 , y, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT)) g_Config.iTexScalingLevel = 2; if (UIButton(GEN_ID, hlinear1, 45, 0, "3x", ALIGN_LEFT)) g_Config.iTexScalingLevel = 3; UICheckBox(GEN_ID, x + 320, y , gs->T("Deposterize"), ALIGN_LEFT, &g_Config.bTexDeposterize); ui_draw2d.DrawText(UBUNTU24, gs->T("Type :"), x + 60, y += stride + 15, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear2(x + 180 , y + 10, 20); if (UIButton(GEN_ID, hlinear2, 80, 0, "xBRZ", ALIGN_LEFT)) g_Config.iTexScalingType = 0; if (UIButton(GEN_ID, hlinear2, 140, 0, "Hybrid(H)", ALIGN_LEFT)) g_Config.iTexScalingType = 1; if (UIButton(GEN_ID, hlinear2, 150, 0, "Bicubic(B)", ALIGN_LEFT)) g_Config.iTexScalingType = 2; if (UIButton(GEN_ID, hlinear2, 65, 0, "H+B", ALIGN_LEFT)) g_Config.iTexScalingType = 3; } else { g_Config.iTexScalingLevel = 1; } UIEnd(); }
void MenuScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); double xoff = 150 - frames_ * frames_ * 0.4f; if (xoff < -20) xoff = -20; if (frames_ > 200) // seems the above goes nuts after a while... xoff = -20; int w = LARGE_BUTTON_WIDTH + 60; ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres + xoff - w/2, 75, 0xFFFFFFFF, ALIGN_HCENTER | ALIGN_BOTTOM); ui_draw2d.SetFontScale(0.7f, 0.7f); ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_GIT_VERSION, dp_xres + xoff, 85, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM); ui_draw2d.SetFontScale(1.0f, 1.0f); VLinear vlinear(dp_xres + xoff, 100, 20); I18NCategory *m = GetI18NCategory("MainMenu"); if (UIButton(GEN_ID, vlinear, w, 0, m->T("Load", "Load..."), ALIGN_RIGHT)) { #if defined(USING_QT_UI) && !defined(MEEGO_EDITION_HARMATTAN) QString fileName = QFileDialog::getOpenFileName(NULL, "Load ROM", g_Config.currentDirectory.c_str(), "PSP ROMs (*.iso *.cso *.pbp *.elf)"); if (QFile::exists(fileName)) { QDir newPath; g_Config.currentDirectory = newPath.filePath(fileName).toStdString(); g_Config.Save(); screenManager()->switchScreen(new EmuScreen(fileName.toStdString())); } #elif _WIN32 MainWindow::BrowseAndBoot(""); #else FileSelectScreenOptions options; options.allowChooseDirectory = true; options.filter = "iso:cso:pbp:elf:prx:"; options.folderIcon = I_ICON_FOLDER; options.iconMapping["iso"] = I_ICON_UMD; options.iconMapping["cso"] = I_ICON_UMD; options.iconMapping["pbp"] = I_ICON_EXE; options.iconMapping["elf"] = I_ICON_EXE; screenManager()->switchScreen(new FileSelectScreen(options)); #endif UIReset(); } if (UIButton(GEN_ID, vlinear, w, 0, m->T("Settings"), ALIGN_RIGHT)) { screenManager()->push(new SettingsScreen(), 0); UIReset(); } if (UIButton(GEN_ID, vlinear, w, 0, m->T("Credits"), ALIGN_RIGHT)) { screenManager()->switchScreen(new CreditsScreen()); UIReset(); } if (UIButton(GEN_ID, vlinear, w, 0, m->T("Exit"), ALIGN_RIGHT)) { // TODO: Save when setting changes, rather than when we quit NativeShutdown(); // TODO: Need a more elegant way to quit #ifdef _WIN32 ExitProcess(0); #else exit(0); #endif } if (UIButton(GEN_ID, vlinear, w, 0, "www.ppsspp.org", ALIGN_RIGHT)) { LaunchBrowser("http://www.ppsspp.org/"); } int recentW = 350; if (g_Config.recentIsos.size()) { ui_draw2d.DrawText(UBUNTU24, m->T("Recent"), -xoff, 80, 0xFFFFFFFF, ALIGN_BOTTOMLEFT); } int spacing = 15; float textureButtonWidth = 144; float textureButtonHeight = 80; if (dp_yres < 480) spacing = 8; // On small screens, we can't fit four vertically. if (100 + spacing * 6 + textureButtonHeight * 4 > dp_yres) { textureButtonHeight = (dp_yres - 100 - spacing * 6) / 4; textureButtonWidth = (textureButtonHeight / 80) * 144; } VGrid vgrid_recent(-xoff, 100, std::min(dp_yres-spacing*2, 480), spacing, spacing); for (size_t i = 0; i < g_Config.recentIsos.size(); i++) { std::string filename; std::string rec = g_Config.recentIsos[i]; for (size_t j = 0; j < rec.size(); j++) if (rec[j] == '\\') rec[j] = '/'; SplitPath(rec, nullptr, &filename, nullptr); UIContext *ctx = screenManager()->getUIContext(); // This might create a texture so we must flush first. UIFlush(); GameInfo *ginfo = g_gameInfoCache.GetInfo(g_Config.recentIsos[i], false); if (ginfo && ginfo->fileType != FILETYPE_PSP_ELF) { u32 color; if (ginfo->iconTexture == 0) { color = 0; } else { color = whiteAlpha(ease((time_now_d() - ginfo->timeIconWasLoaded) * 2)); } if (UITextureButton(ctx, (int)GEN_ID_LOOP(i), vgrid_recent, textureButtonWidth, textureButtonHeight, ginfo->iconTexture, ALIGN_LEFT, color, I_DROP_SHADOW)) { UIEnd(); screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); return; } } else { if (UIButton((int)GEN_ID_LOOP(i), vgrid_recent, textureButtonWidth, textureButtonHeight, filename.c_str(), ALIGN_LEFT)) { UIEnd(); screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); return; } } } #if defined(_DEBUG) & defined(_WIN32) // Print the current dp_xres/yres in the corner. For UI scaling testing - just // resize to 800x480 to get an idea of what it will look like on a Nexus S. ui_draw2d.SetFontScale(0.4, 0.4); char temptext[64]; sprintf(temptext, "%ix%i", dp_xres, dp_yres); ui_draw2d.DrawTextShadow(UBUNTU24, temptext, 5, dp_yres-5, 0xFFFFFFFF, ALIGN_BOTTOMLEFT); ui_draw2d.SetFontScale(1.0, 1.0); #endif DrawWatermark(); UIEnd(); }
void PauseScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); std::string title = game_title.c_str(); // Try to ignore (tm) etc. //if (UTF8StringNonASCIICount(game_title.c_str()) > 2) { // title = "(can't display japanese title)"; //} else { //} UIContext *ctx = screenManager()->getUIContext(); // This might create a texture so we must flush first. UIFlush(); GameInfo *ginfo = g_gameInfoCache.GetInfo(PSP_CoreParameter().fileToStart, true); if (ginfo) { title = ginfo->title; } if (ginfo && ginfo->pic1Texture) { ginfo->pic1Texture->Bind(0); uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0; ui_draw2d.DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color); ui_draw2d.Flush(); ctx->RebindTexture(); } if (ginfo && ginfo->pic0Texture) { ginfo->pic0Texture->Bind(0); // Pic0 is drawn in the bottom right corner, overlaying pic1. float sizeX = dp_xres / 480 * ginfo->pic0Texture->Width(); float sizeY = dp_yres / 272 * ginfo->pic0Texture->Height(); uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 2)) & 0xFFc0c0c0; ui_draw2d.DrawTexRect(dp_xres - sizeX, dp_yres - sizeY, dp_xres, dp_yres, 0,0,1,1,color); ui_draw2d.Flush(); ctx->RebindTexture(); } if (ginfo && ginfo->iconTexture) { uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timeIconWasLoaded) * 1.5)); ginfo->iconTexture->Bind(0); ui_draw2d.DrawTexRect(10,10,10+144, 10+80, 0,0,1,1,0xFFFFFFFF); ui_draw2d.Flush(); ctx->RebindTexture(); } ui_draw2d.DrawText(UBUNTU24, title.c_str(), 10+144+10, 30, 0xFFFFFFFF, ALIGN_LEFT); int x = 30; int y = 50; int stride = 40; int columnw = 400; // Shared with settings I18NCategory *ss = GetI18NCategory("System"); I18NCategory *gs = GetI18NCategory("Graphics"); UICheckBox(GEN_ID, x, y += stride, ss->T("Show Debug Statistics"), ALIGN_TOPLEFT, &g_Config.bShowDebugStats); UICheckBox(GEN_ID, x, y += stride, ss->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter); // TODO: Maybe shouldn't show this if the screen ratios are very close... UICheckBox(GEN_ID, x, y += stride, gs->T("Stretch to Display"), ALIGN_TOPLEFT, &g_Config.bStretchToDisplay); UICheckBox(GEN_ID, x, y += stride, gs->T("Hardware Transform"), ALIGN_TOPLEFT, &g_Config.bHardwareTransform); if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) { if (gpu) gpu->Resized(); } bool fs = g_Config.iFrameSkip == 1; UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &fs); UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); g_Config.iFrameSkip = fs ? 1 : 0; I18NCategory *i = GetI18NCategory("Pause"); // TODO: Add UI for more than one slot. HLinear hlinear1(x, y + 80, 20); if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, 0, i->T("Save State"), ALIGN_LEFT)) { SaveState::SaveSlot(0, 0, 0); screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, 0, i->T("Load State"), ALIGN_LEFT)) { SaveState::LoadSlot(0, 0, 0); screenManager()->finishDialog(this, DR_CANCEL); } VLinear vlinear(dp_xres - 10, 160, 20); if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Continue"), ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Settings"), ALIGN_RIGHT)) { screenManager()->push(new SettingsScreen(), 0); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Back to Menu"), ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_OK); } /* if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH*2, 0, "Debug: Dump Next Frame", ALIGN_BOTTOMRIGHT)) { gpu->DumpNextFrame(); } */ DrawWatermark(); UIEnd(); }
void GraphicsScreenP2::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, gs->T("Graphics Settings"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } int x = 30; int y = 30; int stride = 40; int columnw = 400; if (g_Config.bBufferedRendering) { if (UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti Aliasing"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing)) { if (gpu) gpu->Resized(); } } UICheckBox(GEN_ID, x, y += stride, gs->T("Draw Wireframe"), ALIGN_TOPLEFT, &g_Config.bDrawWireframe); UICheckBox(GEN_ID, x, y += stride, gs->T("Display Raw Framebuffer"), ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer); UICheckBox(GEN_ID, x, y += stride, gs->T("True Color"), ALIGN_TOPLEFT, &g_Config.bTrueColor); bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0; UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering); if (AnisotropicFiltering) { if (g_Config.iAnisotropyLevel == 0) g_Config.iAnisotropyLevel = 2; ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride - 5, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 160 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 2; if (UIButton(GEN_ID, hlinear1, 45, 0, "4x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 4; if (UIButton(GEN_ID, hlinear1, 45, 0, "8x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 8; if (UIButton(GEN_ID, hlinear1, 60, 0, "16x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 16; } else { g_Config.iAnisotropyLevel = 0; } bool TexScaling = g_Config.iTexScalingLevel > 1; UICheckBox(GEN_ID, x, y += stride + 20, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &TexScaling); if (TexScaling) { if (g_Config.iTexScalingLevel <= 1) g_Config.iTexScalingLevel = 2; ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride + 5, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 160 , y - 5, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT)) g_Config.iTexScalingLevel = 2; if (UIButton(GEN_ID, hlinear1, 45, 0, "3x", ALIGN_LEFT)) g_Config.iTexScalingLevel = 3; HLinear hlinear2(x + 160 , y + 60, 20); ui_draw2d.DrawText(UBUNTU24, gs->T("Type :"), x + 60, y += stride + 20, 0xFFFFFFFF, ALIGN_LEFT); if (UIButton(GEN_ID, hlinear2, 90, 0, "xBRZ", ALIGN_LEFT)) g_Config.iTexScalingType = 0; if (UIButton(GEN_ID, hlinear2, 100, 0, "Hybrid", ALIGN_LEFT)) g_Config.iTexScalingType = 1; } else { g_Config.iTexScalingLevel = 1; } UIEnd(); }
void EmuThread::run() { running = true; setCurrentThreadName("EmuThread"); host->UpdateUI(); host->InitGL(); glWindow->makeCurrent(); #ifndef USING_GLES2 glewInit(); #endif NativeInitGraphics(); INFO_LOG(BOOT, "Starting up hardware."); QElapsedTimer timer; while(running) { //UpdateGamepad(*input_state); timer.start(); gameMutex.lock(); bool gRun = gameRunning; gameMutex.unlock(); if(gRun) { gameMutex.lock(); glWindow->makeCurrent(); if(needInitGame) { g_State.bEmuThreadStarted = true; CoreParameter coreParameter; coreParameter.fileToStart = fileToStart.toStdString(); coreParameter.enableSound = true; coreParameter.gpuCore = GPU_GLES; coreParameter.cpuCore = (CPUCore)g_Config.iCpuCore; coreParameter.enableDebugging = true; coreParameter.printfEmuLog = false; coreParameter.headLess = false; coreParameter.renderWidth = 480 * g_Config.iWindowZoom; coreParameter.renderHeight = 272 * g_Config.iWindowZoom; coreParameter.outputWidth = dp_xres; coreParameter.outputHeight = dp_yres; coreParameter.pixelWidth = pixel_xres; coreParameter.pixelHeight = pixel_yres; coreParameter.startPaused = !g_Config.bAutoRun; std::string error_string; if (!PSP_Init(coreParameter, &error_string)) { ERROR_LOG(BOOT, "Error loading: %s", error_string.c_str()); FinalShutdown(); return; } LayoutGamepad(dp_xres, dp_yres); _dbg_update_(); host->UpdateDisassembly(); Core_EnableStepping(coreParameter.startPaused ? TRUE : FALSE); g_State.bBooted = true; #ifdef _DEBUG host->UpdateMemView(); #endif host->BootDone(); needInitGame = false; } UpdateInputState(input_state); for (int i = 0; i < controllistCount; i++) { if (input_state->pad_buttons_down & controllist[i].emu_id) { __CtrlButtonDown(controllist[i].psp_id); } if (input_state->pad_buttons_up & controllist[i].emu_id) { __CtrlButtonUp(controllist[i].psp_id); } } __CtrlSetAnalog(input_state->pad_lstick_x, input_state->pad_lstick_y); EndInputState(input_state); glstate.Restore(); glViewport(0, 0, pixel_xres, pixel_yres); Matrix4x4 ortho; ortho.setOrtho(0.0f, dp_xres, dp_yres, 0.0f, -1.0f, 1.0f); glsl_bind(UIShader_Get()); glUniformMatrix4fv(UIShader_Get()->u_worldviewproj, 1, GL_FALSE, ortho.getReadPtr()); ReapplyGfxState(); Core_Run(); // Hopefully coreState is now CORE_NEXTFRAME if (coreState == CORE_NEXTFRAME) { // set back to running for the next frame coreState = CORE_RUNNING; qint64 time = timer.elapsed(); const int frameTime = (1.0f/60.0f) * 1000; gameMutex.unlock(); if(time < frameTime) { glWindow->doneCurrent(); msleep(frameTime-time); glWindow->makeCurrent(); } gameMutex.lock(); timer.start(); } fbo_unbind(); UIShader_Prepare(); uiTexture->Bind(0); glViewport(0, 0, pixel_xres, pixel_yres); ui_draw2d.Begin(DBMODE_NORMAL); //if (g_Config.bShowTouchControls) // DrawGamepad(ui_draw2d); glsl_bind(UIShader_Get()); ui_draw2d.End(); ui_draw2d.Flush(UIShader_Get()); // Tiled renderers like PowerVR should benefit greatly from this. However - seems I can't call it? #if defined(USING_GLES2) bool hasDiscard = false; // TODO if (hasDiscard) { //glDiscardFramebuffer(GL_COLOR_EXT | GL_DEPTH_EXT | GL_STENCIL_EXT); } #endif glWindow->swapBuffers(); glWindow->doneCurrent(); gameMutex.unlock(); } else { gameMutex.lock(); glWindow->makeCurrent(); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); time_update(); float t = (float)frames_ / 60.0f; frames_++; float alpha = t; if (t > 1.0f) alpha = 1.0f; float alphaText = alpha; //if (t > 2.0f) alphaText = 3.0f - t; glstate.Restore(); glViewport(0, 0, pixel_xres, pixel_yres); Matrix4x4 ortho; ortho.setOrtho(0.0f, dp_xres, dp_yres, 0.0f, -1.0f, 1.0f); glsl_bind(UIShader_Get()); glUniformMatrix4fv(UIShader_Get()->u_worldviewproj, 1, GL_FALSE, ortho.getReadPtr()); ReapplyGfxState(); UIShader_Prepare(); UIBegin(); DrawBackground(alpha); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU48, "PPSSPP", dp_xres / 2, dp_yres / 2 - 30, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); ui_draw2d.DrawText(UBUNTU24, "Created by Henrik Rydgard", dp_xres / 2, dp_yres / 2 + 40, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); ui_draw2d.DrawText(UBUNTU24, "Free Software under GPL 2.0", dp_xres / 2, dp_yres / 2 + 70, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); ui_draw2d.DrawText(UBUNTU24, "www.ppsspp.org", dp_xres / 2, dp_yres / 2 + 130, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); UIEnd(); glsl_bind(UIShader_Get()); ui_draw2d.Flush(UIShader_Get()); glWindow->swapBuffers(); glWindow->doneCurrent(); gameMutex.unlock(); qint64 time = timer.elapsed(); const int frameTime = (1.0f/60.0f) * 1000; if(time < frameTime) { msleep(frameTime-time); } timer.start(); } } if(gameRunning) { stopGame(); } }
void PauseScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); std::string title = game_title.c_str(); // Try to ignore (tm) etc. //if (UTF8StringNonASCIICount(game_title.c_str()) > 2) { // title = "(can't display japanese title)"; //} else { //} UIContext *ctx = screenManager()->getUIContext(); // This might create a texture so we must flush first. UIFlush(); GameInfo *ginfo = g_gameInfoCache.GetInfo(PSP_CoreParameter().fileToStart, true); if (ginfo) { title = ginfo->title; } if (ginfo && ginfo->pic1Texture) { ginfo->pic1Texture->Bind(0); uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0; ui_draw2d.DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color); ui_draw2d.Flush(); ctx->RebindTexture(); } if (ginfo && ginfo->pic0Texture) { ginfo->pic0Texture->Bind(0); // Pic0 is drawn in the bottom right corner, overlaying pic1. float sizeX = dp_xres / 480 * ginfo->pic0Texture->Width(); float sizeY = dp_yres / 272 * ginfo->pic0Texture->Height(); uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 2)) & 0xFFc0c0c0; ui_draw2d.DrawTexRect(dp_xres - sizeX, dp_yres - sizeY, dp_xres, dp_yres, 0,0,1,1,color); ui_draw2d.Flush(); ctx->RebindTexture(); } if (ginfo && ginfo->iconTexture) { uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timeIconWasLoaded) * 1.5)); ginfo->iconTexture->Bind(0); // Maintain the icon's aspect ratio. Minis are square, for example. float iconAspect = (float)ginfo->iconTexture->Width() / (float)ginfo->iconTexture->Height(); float h = 80.0f; float w = 144.0f; float x = 10.0f + (w - h * iconAspect) / 2.0f; w = h * iconAspect; ui_draw2d.DrawTexRect(x, 10, x + w, 10 + h, 0, 0, 1, 1, 0xFFFFFFFF); ui_draw2d.Flush(); ctx->RebindTexture(); } ui_draw2d.DrawText(UBUNTU24, title.c_str(), 10+144+10, 30, 0xFFFFFFFF, ALIGN_LEFT); int x = 30; int y = 50; int stride = 40; int columnw = 400; // Shared with settings I18NCategory *ss = GetI18NCategory("System"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *a = GetI18NCategory("Audio"); UICheckBox(GEN_ID, x, y += stride, ss->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter); UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound); // TODO: Maybe shouldn't show this if the screen ratios are very close... #ifdef BLACKBERRY10 if (pixel_xres == pixel_yres) UICheckBox(GEN_ID, x, y += stride, gs->T("Partial Vertical Stretch"), ALIGN_TOPLEFT, &g_Config.bPartialStretch); #endif UICheckBox(GEN_ID, x, y += stride, gs->T("Stretch to Display"), ALIGN_TOPLEFT, &g_Config.bStretchToDisplay); UICheckBox(GEN_ID, x, y += stride, gs->T("Hardware Transform"), ALIGN_TOPLEFT, &g_Config.bHardwareTransform); if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) { if (gpu) gpu->Resized(); } UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); bool enableFrameSkip = g_Config.iFrameSkip != 0; UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &enableFrameSkip); if (enableFrameSkip) { if (g_Config.iFrameSkip == 0) g_Config.iFrameSkip = 3; float getfskip= g_Config.iFrameSkip; char showfskip[256]; sprintf(showfskip, "Skip Frames: %0.0f", getfskip); ui_draw2d.DrawText(UBUNTU24, showfskip, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT); ui_draw2d.DrawText(UBUNTU24, showfskip, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT); ui_draw2d.DrawText(UBUNTU24, gs->T("Frames :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 200 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, "Auto", ALIGN_LEFT)) g_Config.iFrameSkip = 3; if (UIButton(GEN_ID, hlinear1, 40, 0, "-1", ALIGN_LEFT)) if(g_Config.iFrameSkip>0){ g_Config.iFrameSkip -= 1;} if (UIButton(GEN_ID, hlinear1, 40, 0, "+1", ALIGN_LEFT)) if(g_Config.iFrameSkip!=9){ g_Config.iFrameSkip += 1;} } else { g_Config.iFrameSkip = 0; } I18NCategory *i = GetI18NCategory("Pause"); // TODO: Add UI for more than one slot. HLinear hlinear1(x, y + 80, 20); if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, 0, i->T("Save State"), ALIGN_LEFT)) { SaveState::SaveSlot(0, 0, 0); screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, 0, i->T("Load State"), ALIGN_LEFT)) { SaveState::LoadSlot(0, 0, 0); screenManager()->finishDialog(this, DR_CANCEL); } VLinear vlinear(dp_xres - 10, 160, 20); if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Continue"), ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_CANCEL); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Settings"), ALIGN_RIGHT)) { screenManager()->push(new SettingsScreen(), 0); } if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH + 20, 0, i->T("Back to Menu"), ALIGN_RIGHT)) { screenManager()->finishDialog(this, DR_OK); } /* if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH*2, 0, "Debug: Dump Next Frame", ALIGN_BOTTOMRIGHT)) { gpu->DumpNextFrame(); } */ DrawWatermark(); UIEnd(); }
void GraphicsScreenP3::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, gs->T("Graphics Settings"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } HLinear hlinear(10, dp_yres - 10, 20.0f); if (UIButton(GEN_ID, hlinear, LARGE_BUTTON_WIDTH + 10, 0, g->T("Prev Page"), ALIGN_BOTTOMLEFT)) { screenManager()->switchScreen(new GraphicsScreenP2()); } if (UIButton(GEN_ID, hlinear, LARGE_BUTTON_WIDTH + 10, 0, g->T("Next Page"), ALIGN_BOTTOMLEFT)) { screenManager()->switchScreen(new GraphicsScreenP1()); } int x = 30; int y = 35; int stride = 40; int columnw = 400; bool FpsLimit = g_Config.iFpsLimit != 0; UICheckBox(GEN_ID, x, y += stride, gs->T("Fps Limit"), ALIGN_TOPLEFT, &FpsLimit); if (FpsLimit) { if (g_Config.iFpsLimit == 0) g_Config.iFpsLimit = 60; char showFps[256]; sprintf(showFps, "%s %d", gs->T("Fps :"), g_Config.iFpsLimit); ui_draw2d.DrawText(UBUNTU24, showFps, x + 60, (y += stride) - 5, 0xFFFFFFFF, ALIGN_LEFT); } else { g_Config.iFpsLimit = 0; } HLinear hlinear1(x + 60, y += stride, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, gs->T("Auto"), ALIGN_LEFT)) g_Config.iFpsLimit = 60; if (UIButton(GEN_ID, hlinear1, 60, 0, gs->T("-30"), ALIGN_LEFT)) if(g_Config.iFpsLimit > 30){ g_Config.iFpsLimit -= 30;} if (UIButton(GEN_ID, hlinear1, 60, 0, gs->T("+30"), ALIGN_LEFT)) if(g_Config.iFrameSkip != 240){ g_Config.iFpsLimit += 30;} bool enableFrameSkip = g_Config.iFrameSkip != 0; UICheckBox(GEN_ID, x, y += stride + 25, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &enableFrameSkip); if (enableFrameSkip) { if (g_Config.iFrameSkip == 0) g_Config.iFrameSkip = 3; char showFrameSkip[256]; sprintf(showFrameSkip, "%s %d", gs->T("Frames :"), g_Config.iFrameSkip); ui_draw2d.DrawText(UBUNTU24, showFrameSkip, x + 60, (y += stride) - 5, 0xFFFFFFFF, ALIGN_LEFT); } else { g_Config.iFrameSkip = 0; } HLinear hlinear2(x + 60, y += stride, 20); if (UIButton(GEN_ID, hlinear2, 80, 0, gs->T("Auto"), ALIGN_LEFT)) g_Config.iFrameSkip = 3; if (UIButton(GEN_ID, hlinear2, 40, 0, gs->T("-1"), ALIGN_LEFT)) if (g_Config.iFrameSkip > 1) g_Config.iFrameSkip -= 1; if (UIButton(GEN_ID, hlinear2, 40, 0, gs->T("+1"), ALIGN_LEFT)) if (g_Config.iFrameSkip < 9) g_Config.iFrameSkip += 1; UIEnd(); }
void LanguageScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *s = GetI18NCategory("System"); I18NCategory *g = GetI18NCategory("General"); I18NCategory *l = GetI18NCategory("Language"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, s->T("Language"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->finishDialog(this, DR_OK); } VGrid vlang(50, 100, dp_yres - 50, 10, 10); std::string text; for (size_t i = 0; i < langs_.size(); i++) { std::string code; size_t dot = langs_[i].name.find('.'); if (dot != std::string::npos) code = langs_[i].name.substr(0, dot); std::string buttonTitle = langs_[i].name; langValuesMapping["ja_JP"] = std::make_pair("日本語", PSP_SYSTEMPARAM_LANGUAGE_JAPANESE); langValuesMapping["en_US"] = std::make_pair("English",PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["fr_FR"] = std::make_pair("Français", PSP_SYSTEMPARAM_LANGUAGE_FRENCH); langValuesMapping["es_ES"] = std::make_pair("Español", PSP_SYSTEMPARAM_LANGUAGE_SPANISH); langValuesMapping["es_LA"] = std::make_pair("Español", PSP_SYSTEMPARAM_LANGUAGE_SPANISH); langValuesMapping["de_DE"] = std::make_pair("Deutsch", PSP_SYSTEMPARAM_LANGUAGE_GERMAN); langValuesMapping["it_IT"] = std::make_pair("Italiano", PSP_SYSTEMPARAM_LANGUAGE_ITALIAN); langValuesMapping["nl_NL"] = std::make_pair("Nederlands", PSP_SYSTEMPARAM_LANGUAGE_DUTCH); langValuesMapping["pt_PT"] = std::make_pair("Português", PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE); langValuesMapping["pt_BR"] = std::make_pair("Português", PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE); langValuesMapping["ru_RU"] = std::make_pair("Русский", PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN); langValuesMapping["ko_KR"] = std::make_pair("한국어", PSP_SYSTEMPARAM_LANGUAGE_KOREAN); langValuesMapping["zh_TW"] = std::make_pair("繁體中文", PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL); langValuesMapping["zh_CN"] = std::make_pair("简体中文", PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED); langValuesMapping["gr_EL"] = std::make_pair("ελληνικά", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["he_IL"] = std::make_pair("עברית", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["hu_HU"] = std::make_pair("Magyar", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["pl_PL"] = std::make_pair("Polski", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["sv_SE"] = std::make_pair("Svenska", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["tr_TR"] = std::make_pair("Türk", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["ca_ES"] = std::make_pair("Català", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["uk_UA"] = std::make_pair("Українська", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["ro_RO"] = std::make_pair("Român", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); langValuesMapping["id_ID"] = std::make_pair("Indonesia", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); if (!code.empty()) { if(langValuesMapping.find(code) == langValuesMapping.end()) { //No title found, show locale code buttonTitle = code; } else { buttonTitle = langValuesMapping[code].first; } } if (UIButton(GEN_ID_LOOP(i), vlang, LARGE_BUTTON_WIDTH - 30, 0, buttonTitle.c_str(), ALIGN_TOPLEFT)) { std::string oldLang = g_Config.languageIni; g_Config.languageIni = code; if (i18nrepo.LoadIni(g_Config.languageIni)) { // Dunno what else to do here. if(langValuesMapping.find(code) == langValuesMapping.end()) { //Fallback to English g_Config.ilanguage = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH; } else { g_Config.ilanguage = langValuesMapping[code].second; } // After this, g and s are no longer valid. Let's return, some flicker is okay. g = GetI18NCategory("General"); s = GetI18NCategory("System"); l = GetI18NCategory("Language"); } else { g_Config.languageIni = oldLang; } } } UIEnd(); }
void EmuThread::run() { running = true; setCurrentThreadName("EmuThread"); g_State.bEmuThreadStarted = true; host->UpdateUI(); host->InitGL(); glWindow->makeCurrent(); #ifndef USING_GLES2 glewInit(); #endif NativeInitGraphics(); INFO_LOG(BOOT, "Starting up hardware."); CoreParameter coreParameter; coreParameter.fileToStart = fileToStart.toStdString(); coreParameter.enableSound = true; coreParameter.gpuCore = GPU_GLES; coreParameter.cpuCore = (CPUCore)g_Config.iCpuCore; coreParameter.enableDebugging = true; coreParameter.printfEmuLog = false; coreParameter.headLess = false; coreParameter.renderWidth = 480 * g_Config.iWindowZoom; coreParameter.renderHeight = 272 * g_Config.iWindowZoom; coreParameter.outputWidth = dp_xres; coreParameter.outputHeight = dp_yres; coreParameter.pixelWidth = pixel_xres; coreParameter.pixelHeight = pixel_yres; coreParameter.startPaused = !g_Config.bAutoRun; std::string error_string; if (!PSP_Init(coreParameter, &error_string)) { ERROR_LOG(BOOT, "Error loading: %s", error_string.c_str()); FinalShutdown(); return; } LayoutGamepad(dp_xres, dp_yres); _dbg_update_(); host->UpdateDisassembly(); Core_EnableStepping(coreParameter.startPaused ? TRUE : FALSE); g_State.bBooted = true; #ifdef _DEBUG host->UpdateMemView(); #endif host->BootDone(); QElapsedTimer timer; while(running) { //UpdateGamepad(*input_state); timer.start(); UpdateInputState(input_state); static const int mapping[12][2] = { {PAD_BUTTON_A, CTRL_CROSS}, {PAD_BUTTON_B, CTRL_CIRCLE}, {PAD_BUTTON_X, CTRL_SQUARE}, {PAD_BUTTON_Y, CTRL_TRIANGLE}, {PAD_BUTTON_UP, CTRL_UP}, {PAD_BUTTON_DOWN, CTRL_DOWN}, {PAD_BUTTON_LEFT, CTRL_LEFT}, {PAD_BUTTON_RIGHT, CTRL_RIGHT}, {PAD_BUTTON_LBUMPER, CTRL_LTRIGGER}, {PAD_BUTTON_RBUMPER, CTRL_RTRIGGER}, {PAD_BUTTON_START, CTRL_START}, {PAD_BUTTON_SELECT, CTRL_SELECT}, }; for (int i = 0; i < 12; i++) { if (input_state->pad_buttons_down & mapping[i][0]) { __CtrlButtonDown(mapping[i][1]); } if (input_state->pad_buttons_up & mapping[i][0]) { __CtrlButtonUp(mapping[i][1]); } } __CtrlSetAnalog(input_state->pad_lstick_x, input_state->pad_lstick_y); EndInputState(input_state); glstate.Restore(); glViewport(0, 0, pixel_xres, pixel_yres); Matrix4x4 ortho; ortho.setOrtho(0.0f, dp_xres, dp_yres, 0.0f, -1.0f, 1.0f); glsl_bind(UIShader_Get()); glUniformMatrix4fv(UIShader_Get()->u_worldviewproj, 1, GL_FALSE, ortho.getReadPtr()); ReapplyGfxState(); Core_Run(); // Hopefully coreState is now CORE_NEXTFRAME if (coreState == CORE_NEXTFRAME) { // set back to running for the next frame coreState = CORE_RUNNING; qint64 time = timer.elapsed(); const int frameTime = (1.0f/60.0f) * 1000; if(time < frameTime) { msleep(frameTime-time); } timer.start(); } fbo_unbind(); UIShader_Prepare(); uiTexture->Bind(0); glViewport(0, 0, pixel_xres, pixel_yres); ui_draw2d.Begin(DBMODE_NORMAL); //if (g_Config.bShowTouchControls) // DrawGamepad(ui_draw2d); glsl_bind(UIShader_Get()); ui_draw2d.End(); ui_draw2d.Flush(UIShader_Get()); // Tiled renderers like PowerVR should benefit greatly from this. However - seems I can't call it? #if defined(USING_GLES2) bool hasDiscard = false; // TODO if (hasDiscard) { //glDiscardFramebuffer(GL_COLOR_EXT | GL_DEPTH_EXT | GL_STENCIL_EXT); } #endif glWindow->swapBuffers(); } glWindow->doneCurrent(); }