void GameScreen::CreateViews() { std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); if (info && !info->id.empty()) saveDirs = info->GetSaveDataDirectories(); // Get's very heavy, let's not do it in update() I18NCategory *di = GetI18NCategory("Dialog"); I18NCategory *ga = GetI18NCategory("Game"); I18NCategory *pa = GetI18NCategory("Pause"); // Information in the top left. // Back button to the bottom left. // Scrolling action menu to the right. using namespace UI; Margins actionMenuMargins(0, 100, 15, 0); root_ = new LinearLayout(ORIENT_HORIZONTAL); ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); leftColumn->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &GameScreen::OnSwitchBack); if (info) { texvGameIcon_ = leftColumn->Add(new TextureView(0, IS_DEFAULT, new AnchorLayoutParams(144 * 2, 80 * 2, 10, 10, NONE, NONE))); LinearLayout *infoLayout = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(10, 200, NONE, NONE)); leftColumn->Add(infoLayout); tvTitle_ = infoLayout->Add(new TextView(info->GetTitle(), ALIGN_LEFT | FLAG_WRAP_TEXT, false, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); tvTitle_->SetShadow(true); infoLayout->Add(new Spacer(12)); // This one doesn't need to be updated. infoLayout->Add(new TextView(gamePath_, ALIGN_LEFT | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetShadow(true); tvGameSize_ = infoLayout->Add(new TextView("...", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); tvGameSize_->SetShadow(true); tvSaveDataSize_ = infoLayout->Add(new TextView("...", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); tvSaveDataSize_->SetShadow(true); tvInstallDataSize_ = infoLayout->Add(new TextView("", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); tvInstallDataSize_->SetShadow(true); tvInstallDataSize_->SetVisibility(V_GONE); tvRegion_ = infoLayout->Add(new TextView("", ALIGN_LEFT, true, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); tvRegion_->SetShadow(true); } else { texvGameIcon_ = nullptr; tvTitle_ = nullptr; tvGameSize_ = nullptr; tvSaveDataSize_ = nullptr; tvInstallDataSize_ = nullptr; tvRegion_ = nullptr; } ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins)); root_->Add(rightColumn); LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL); rightColumnItems->SetSpacing(0.0f); rightColumn->Add(rightColumnItems); rightColumnItems->Add(new Choice(ga->T("Play")))->OnClick.Handle(this, &GameScreen::OnPlay); btnGameSettings_ = rightColumnItems->Add(new Choice(ga->T("Game Settings"))); btnGameSettings_->OnClick.Handle(this, &GameScreen::OnGameSettings); btnDeleteGameConfig_ = rightColumnItems->Add(new Choice(ga->T("Delete Game Config"))); btnDeleteGameConfig_->OnClick.Handle(this, &GameScreen::OnDeleteConfig); btnCreateGameConfig_ = rightColumnItems->Add(new Choice(ga->T("Create Game Config"))); btnCreateGameConfig_->OnClick.Handle(this, &GameScreen::OnCreateConfig); btnGameSettings_->SetVisibility(V_GONE); btnDeleteGameConfig_->SetVisibility(V_GONE); btnCreateGameConfig_->SetVisibility(V_GONE); btnDeleteSaveData_ = new Choice(ga->T("Delete Save Data")); rightColumnItems->Add(btnDeleteSaveData_)->OnClick.Handle(this, &GameScreen::OnDeleteSaveData); btnDeleteSaveData_->SetVisibility(V_GONE); if (info && !info->pending) { otherChoices_.clear(); } rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Delete Game"))))->OnClick.Handle(this, &GameScreen::OnDeleteGame); if (host->CanCreateShortcut()) { rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Create Shortcut"))))->OnClick.Handle(this, &GameScreen::OnCreateShortcut); } if (isRecentGame(gamePath_)) { rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Remove From Recent"))))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent); } #ifdef _WIN32 rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Show In Folder"))))->OnClick.Handle(this, &GameScreen::OnShowInFolder); #endif if (g_Config.bEnableCheats) { rightColumnItems->Add(AddOtherChoice(new Choice(pa->T("Cheats"))))->OnClick.Handle(this, &GameScreen::OnCwCheat); } btnSetBackground_ = rightColumnItems->Add(new Choice(ga->T("Use UI background"))); btnSetBackground_->OnClick.Handle(this, &GameScreen::OnSetBackground); btnSetBackground_->SetVisibility(V_GONE); }
PromptScreen::PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText, std::function<void(bool)> callback) : message_(message), callback_(callback) { I18NCategory *d = GetI18NCategory("Dialog"); yesButtonText_ = d->T(yesButtonText.c_str()); noButtonText_ = d->T(noButtonText.c_str()); }
void CreditsScreen::render() { UIScreen::render(); I18NCategory *c = GetI18NCategory("PSPCredits"); const char * credits[] = { "PPSSPP", "", c->T("title", "A fast and portable PSP emulator"), "", "", c->T("created", "Created by"), "Henrik Rydg\xc3\xa5rd", "", "", c->T("contributors", "Contributors:"), "unknownbrackets", "oioitff", "xsacha", "raven02", "tpunix", "orphis", "sum2012", "mikusp", "aquanull", "The Dax", "bollu", "tmaul", "artart78", "ced2911", "soywiz", "kovensky", "xele", "chaserhjk", "evilcorn", "daniel dressler", "makotech222", "CPkmn", "mgaver", "jeid3", "cinaera/BeaR", "jtraynham", "Kingcom", "arnastia", "lioncash", "JulianoAmaralChaves", "vnctdj", "kaienfr", "shenweip", "Danyal Zia", "Igor Calabria", "Coldbird", "Kyhel", "", "", c->T("specialthanks", "Special thanks to:"), "Maxim for his amazing Atrac3+ decoder work", "Keith Galocy at nVidia (hw, advice)", "Orphis (build server)", "angelxwind (iOS builds)", "W.MS (iOS builds)", "solarmystic (testing)", "all the forum mods", "", c->T("this translation by", ""), // Empty string as this is the original :) c->T("translators1", ""), c->T("translators2", ""), c->T("translators3", ""), c->T("translators4", ""), c->T("translators5", ""), c->T("translators6", ""), "", c->T("written", "Written in C++ for speed and portability"), "", "", c->T("tools", "Free tools used:"), #ifdef ANDROID "Android SDK + NDK", #elif defined(BLACKBERRY) "Blackberry NDK", #endif #if defined(USING_QT_UI) "Qt", #elif !defined(USING_WIN_UI) "SDL", #endif "CMake", "freetype2", "zlib", "PSP SDK", "", "", c->T("website", "Check out the website:"), "www.ppsspp.org", c->T("list", "compatibility lists, forums, and development info"), "", "", c->T("check", "Also check out Dolphin, the best Wii/GC emu around:"), "http://www.dolphin-emu.org", "", "", c->T("info1", "PPSSPP is only intended to play games you own."), c->T("info2", "Please make sure that you own the rights to any games"), c->T("info3", "you play by owning the UMD or by buying the digital"), c->T("info4", "download from the PSN store on your real PSP."), "", "", c->T("info5", "PSP is a trademark by Sony, Inc."), }; // TODO: This is kinda ugly, done on every frame... char temp[256]; snprintf(temp, sizeof(temp), "PPSSPP %s", PPSSPP_GIT_VERSION); credits[0] = (const char *)temp; UIContext &dc = *screenManager()->getUIContext(); dc.Begin(); const Bounds &bounds = dc.GetBounds(); const int numItems = ARRAY_SIZE(credits); int itemHeight = 36; int totalHeight = numItems * itemHeight + bounds.h + 200; int y = bounds.y2() - (frames_ % totalHeight); for (int i = 0; i < numItems; i++) { float alpha = linearInOut(y+32, 64, bounds.y2() - 192, 64); if (alpha > 0.0f) { dc.SetFontScale(ease(alpha), ease(alpha)); dc.DrawText(credits[i], dc.GetBounds().centerX(), y, whiteAlpha(alpha), ALIGN_HCENTER); dc.SetFontScale(1.0f, 1.0f); } y += itemHeight; } dc.End(); dc.Flush(); }
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); 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); 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 TouchControlLayoutScreen::CreateViews() { // setup g_Config for button layout InitPadLayout(); using namespace UI; I18NCategory *c = GetI18NCategory("Controls"); I18NCategory *d = GetI18NCategory("Dialog"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); Choice *reset = new Choice(d->T("Reset"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 84)); Choice *back = new Choice(d->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10)); Choice *visibility = new Choice(c->T("Visibility"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158)); // controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, c->T("Button Scaling"), screenManager())) // ->OnChange.Handle(this, &GameSettingsScreen::OnChangeControlScaling); mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158 + 64 + 10)); mode_->AddChoice(d->T("Move")); mode_->AddChoice(d->T("Resize")); mode_->SetSelection(0); reset->OnClick.Handle(this, &TouchControlLayoutScreen::OnReset); back->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); visibility->OnClick.Handle(this, &TouchControlLayoutScreen::OnVisibility); root_->Add(mode_); root_->Add(visibility); root_->Add(reset); root_->Add(back); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); // this is more for show than anything else. It's used to provide a boundary // so that buttons like back can be placed within the boundary. // serves no other purpose. AnchorLayout *controlsHolder = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); I18NCategory *ms = GetI18NCategory("MainSettings"); tabHolder->AddTab(ms->T("Controls"), controlsHolder); if (!g_Config.bShowTouchControls) { // Shouldn't even be able to get here as the way into this dialog should be closed. return; } controls_.clear(); PSPActionButtons *actionButtons = new PSPActionButtons(g_Config.fActionButtonCenterX, g_Config.fActionButtonCenterY, g_Config.fActionButtonScale, g_Config.fActionButtonSpacing); actionButtons->setCircleVisibility(g_Config.bShowTouchCircle); actionButtons->setCrossVisibility(g_Config.bShowTouchCross); actionButtons->setTriangleVisibility(g_Config.bShowTouchTriangle); actionButtons->setSquareVisibility(g_Config.bShowTouchSquare); controls_.push_back(actionButtons); if (g_Config.bShowTouchDpad) { controls_.push_back(new PSPDPadButtons(g_Config.fDpadX, g_Config.fDpadY, g_Config.fDpadScale, g_Config.fDpadSpacing)); } if (g_Config.bShowTouchSelect) { controls_.push_back(new DragDropButton(g_Config.fSelectKeyX, g_Config.fSelectKeyY, I_RECT, I_SELECT, g_Config.fSelectKeyScale)); } if (g_Config.bShowTouchStart) { controls_.push_back(new DragDropButton(g_Config.fStartKeyX, g_Config.fStartKeyY, I_RECT, I_START, g_Config.fStartKeyScale)); } if (g_Config.bShowTouchUnthrottle) { DragDropButton *unthrottle = new DragDropButton(g_Config.fUnthrottleKeyX, g_Config.fUnthrottleKeyY, I_RECT, I_ARROW, g_Config.fUnthrottleKeyScale); unthrottle->SetAngle(180.0f); controls_.push_back(unthrottle); } if (g_Config.bShowTouchLTrigger) { controls_.push_back(new DragDropButton(g_Config.fLKeyX, g_Config.fLKeyY, I_SHOULDER, I_L, g_Config.fLKeyScale)); } if (g_Config.bShowTouchRTrigger) { DragDropButton *rbutton = new DragDropButton(g_Config.fRKeyX, g_Config.fRKeyY, I_SHOULDER, I_R, g_Config.fRKeyScale); rbutton->FlipImageH(true); controls_.push_back(rbutton); } if (g_Config.bShowTouchAnalogStick) { controls_.push_back(new DragDropButton(g_Config.fAnalogStickX, g_Config.fAnalogStickY, I_STICKBG, I_STICK, g_Config.fAnalogStickScale)); }; for (size_t i = 0; i < controls_.size(); i++) { root_->Add(controls_[i]); } }
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 SettingsScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *ms = GetI18NCategory("MainSettings"); ui_draw2d.SetFontScale(1.5f, 1.5f); ui_draw2d.DrawText(UBUNTU24, ms->T("Settings"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER); ui_draw2d.SetFontScale(1.0f, 1.0f); VLinear vlinear(40, 150, 20); 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 w = LARGE_BUTTON_WIDTH + 25; int s = 280; if (UIButton(GEN_ID, vlinear, w, 0, ms->T("Audio"), ALIGN_BOTTOMLEFT)) { screenManager()->push(new AudioScreen()); } ui_draw2d.DrawText(UBUNTU24, ms->T("AudioDesc", "Adjust Audio Settings"), s, 110, 0xFFFFFFFF, ALIGN_LEFT); if (UIButton(GEN_ID, vlinear, w, 0, ms->T("Graphics"), ALIGN_BOTTOMLEFT)) { screenManager()->push(new GraphicsScreenP1()); } ui_draw2d.DrawText(UBUNTU24, ms->T("GraphicsDesc", "Change graphics options"), s, 180, 0xFFFFFFFF, ALIGN_LEFT); if (UIButton(GEN_ID, vlinear, w, 0, ms->T("System"), ALIGN_BOTTOMLEFT)) { screenManager()->push(new SystemScreen()); } ui_draw2d.DrawText(UBUNTU24, ms->T("SystemDesc", "Turn on Dynarec (JIT), Fast Memory"), s, 250, 0xFFFFFFFF, ALIGN_LEFT); if (UIButton(GEN_ID, vlinear, w, 0, ms->T("Controls"), ALIGN_BOTTOMLEFT)) { screenManager()->push(new ControlsScreen()); } ui_draw2d.DrawText(UBUNTU24, ms->T("ControlsDesc", "On Screen Controls, Large Buttons"), s, 320, 0xFFFFFFFF, ALIGN_LEFT); if (UIButton(GEN_ID, vlinear, w, 0, ms->T("Developer"), ALIGN_BOTTOMLEFT)) { screenManager()->push(new DeveloperScreen()); } ui_draw2d.DrawText(UBUNTU24, ms->T("DeveloperDesc", "Run CPU test, Dump Next Frame Log"), s, 390, 0xFFFFFFFF, ALIGN_LEFT); UIEnd(); }
void GamePauseScreen::CreateViews() { static const int NUM_SAVESLOTS = 5; using namespace UI; Margins actionMenuMargins(0, 100, 15, 0); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *i = GetI18NCategory("Pause"); root_ = new LinearLayout(ORIENT_HORIZONTAL); ViewGroup *leftColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(520, FILL_PARENT, actionMenuMargins)); root_->Add(leftColumn); root_->Add(new Spacer(new LinearLayoutParams(1.0))); ViewGroup *leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); leftColumn->Add(leftColumnItems); for (int i = 0; i < NUM_SAVESLOTS; i++) { SaveSlotView *slot = leftColumnItems->Add(new SaveSlotView(i, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); slot->OnStateLoaded.Handle(this, &GamePauseScreen::OnState); slot->OnStateSaved.Handle(this, &GamePauseScreen::OnState); slot->OnScreenshotClicked.Handle(this, &GamePauseScreen::OnScreenshotClicked); } if (g_Config.iRewindFlipFrequency > 0) { UI::Choice *rewindButton = leftColumnItems->Add(new Choice(i->T("Rewind"))); rewindButton->SetEnabled(SaveState::CanRewind()); rewindButton->OnClick.Handle(this, &GamePauseScreen::OnRewind); } ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins)); root_->Add(rightColumn); LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL); rightColumn->Add(rightColumnItems); rightColumnItems->SetSpacing(0.0f); if (getUMDReplacePermit()) { rightColumnItems->Add(new Choice(i->T("Switch UMD")))->OnClick.Handle(this, &GamePauseScreen::OnSwitchUMD); } Choice *continueChoice = rightColumnItems->Add(new Choice(i->T("Continue"))); root_->SetDefaultFocusView(continueChoice); continueChoice->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); std::string gameId = g_paramSFO.GetValueString("DISC_ID"); if (g_Config.hasGameConfig(gameId)) { rightColumnItems->Add(new Choice(i->T("Game Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings); rightColumnItems->Add(new Choice(i->T("Delete Game Config")))->OnClick.Handle(this, &GamePauseScreen::OnDeleteConfig); } else { rightColumnItems->Add(new Choice(i->T("Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings); rightColumnItems->Add(new Choice(i->T("Create Game Config")))->OnClick.Handle(this, &GamePauseScreen::OnCreateConfig); } if (g_Config.bEnableCheats) { rightColumnItems->Add(new Choice(i->T("Cheats")))->OnClick.Handle(this, &GamePauseScreen::OnCwCheat); } // TODO, also might be nice to show overall compat rating here? // Based on their platform or even cpu/gpu/config. Would add an API for it. if (Reporting::IsEnabled()) { I18NCategory *rp = GetI18NCategory("Reporting"); rightColumnItems->Add(new Choice(rp->T("ReportButton", "Report Feedback")))->OnClick.Handle(this, &GamePauseScreen::OnReportFeedback); } rightColumnItems->Add(new Spacer(25.0)); rightColumnItems->Add(new Choice(i->T("Exit to menu")))->OnClick.Handle(this, &GamePauseScreen::OnExitToMenu); }
void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo, bool hasOK) { float WRAP_WIDTH = 300.0f; if (UTF8StringNonASCIICount(text.c_str()) > 3) WRAP_WIDTH = 372.0f; float y = 140.0f; float h; int n; PPGeMeasureText(0, &h, &n, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH); float h2 = h * (float)n / 2.0f; if (hasYesNo) { I18NCategory *d = GetI18NCategory("Dialog"); const char *choiceText; u32 yesColor, noColor; float x, w; if (yesnoChoice == 1) { choiceText = d->T("Yes"); x = 204.0f; yesColor = 0xFFFFFFFF; noColor = 0xFFFFFFFF; } else { choiceText = d->T("No"); x = 273.0f; yesColor = 0xFFFFFFFF; noColor = 0xFFFFFFFF; } PPGeMeasureText(&w, &h, 0, choiceText, FONT_SCALE); w = w / 2.0f + 5.0f; h /= 2.0f; float y2 = y + h2; h2 += h + 4.0f; y = 132.0f - h; PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF)); PPGeDrawText(d->T("Yes"), 204.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawText(d->T("Yes"), 203.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(yesColor)); PPGeDrawText(d->T("No"), 273.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawText(d->T("No"), 272.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(noColor)); if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) { yesnoChoice = 1; } else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) { yesnoChoice = 0; } } if (hasOK) { I18NCategory *d = GetI18NCategory("Dialog"); float x, w; x = 240.0f; w = 15.0f; h /= 2.0f; float y2 = y + h2; h2 += h + 4.0f; y = 132.0f - h; PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF)); PPGeDrawText(d->T("OK"), 240.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawText(d->T("OK"), 239.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF)); } PPGeDrawTextWrapped(text.c_str(), 241.0f, y+2, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000)); PPGeDrawTextWrapped(text.c_str(), 240.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF)); float sy = 125.0f - h2, ey = 145.0f + h2; PPGeDrawRect(40.0f, sy, 440.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawRect(40.0f, ey, 440.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF)); }
void EmuScreen::update(InputState &input) { if (!booted_) bootGame(gamePath_); UIScreen::update(input); // Simply forcibily update to the current screen size every frame. Doesn't cost much. PSP_CoreParameter().outputWidth = dp_xres; PSP_CoreParameter().outputHeight = dp_yres; PSP_CoreParameter().pixelWidth = pixel_xres; PSP_CoreParameter().pixelHeight = pixel_yres; UpdateUIState(UISTATE_INGAME); if (errorMessage_.size()) { // Special handling for ZIP files. It's not very robust to check an error message but meh, // at least it's pre-translation. if (errorMessage_.find("ZIP") != std::string::npos) { screenManager()->push(new InstallZipScreen(gamePath_)); errorMessage_ = ""; return; } I18NCategory *g = GetI18NCategory("Error"); std::string errLoadingFile = g->T("Error loading file", "Could not load game"); errLoadingFile.append(" "); errLoadingFile.append(g->T(errorMessage_.c_str())); screenManager()->push(new PromptScreen(errLoadingFile, "OK", "")); errorMessage_ = ""; return; } if (invalid_) return; float leftstick_x = 0.0f; float leftstick_y = 0.0f; float rightstick_x = 0.0f; float rightstick_y = 0.0f; // Virtual keys. __CtrlSetRapidFire(virtKeys[VIRTKEY_RAPID_FIRE - VIRTKEY_FIRST]); // Apply tilt to left stick // TODO: Make into an axis #ifdef USING_GLES2 if (g_Config.bAccelerometerToAnalogHoriz) { // Get the "base" coordinate system which is setup by the calibration system float base_x = g_Config.fTiltBaseX; float base_y = g_Config.fTiltBaseY; //convert the current input into base coordinates and normalize //TODO: check if all phones give values between [-50, 50]. I'm not sure how iOS works. float normalized_input_x = (input.acc.y - base_x) / 50.0 ; float normalized_input_y = (input.acc.x - base_y) / 50.0 ; //TODO: need a better name for computed x and y. float delta_x = tiltInputCurve(normalized_input_x * 2.0 * (g_Config.iTiltSensitivityX)) ; //if the invert is enabled, invert the motion if (g_Config.bInvertTiltX) { delta_x *= -1; } float delta_y = tiltInputCurve(normalized_input_y * 2.0 * (g_Config.iTiltSensitivityY)) ; if (g_Config.bInvertTiltY) { delta_y *= -1; } //clamp the delta between [-1, 1] leftstick_x += clamp1(delta_x); __CtrlSetAnalogX(clamp1(leftstick_x), CTRL_STICK_LEFT); leftstick_y += clamp1(delta_y); __CtrlSetAnalogY(clamp1(leftstick_y), CTRL_STICK_LEFT); } #endif // Make sure fpsLimit starts at 0 if (PSP_CoreParameter().fpsLimit != 0 && PSP_CoreParameter().fpsLimit != 1) { PSP_CoreParameter().fpsLimit = 0; } // This is here to support the iOS on screen back button. if (pauseTrigger_) { pauseTrigger_ = false; screenManager()->push(new GamePauseScreen(gamePath_)); } }
void EmuScreen::bootGame(const std::string &filename) { booted_ = true; std::string fileToStart = filename; CoreParameter coreParam; coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER; coreParam.gpuCore = g_Config.bSoftwareRendering ? GPU_SOFTWARE : GPU_GLES; coreParam.enableSound = g_Config.bEnableSound; coreParam.fileToStart = fileToStart; coreParam.mountIso = ""; coreParam.startPaused = false; coreParam.printfEmuLog = false; coreParam.headLess = false; if (g_Config.iInternalResolution == 0) { coreParam.renderWidth = dp_xres; coreParam.renderHeight = dp_yres; } else { if (g_Config.iInternalResolution < 0) g_Config.iInternalResolution = 1; coreParam.renderWidth = 480 * g_Config.iInternalResolution; coreParam.renderHeight = 272 * g_Config.iInternalResolution; } coreParam.outputWidth = dp_xres; coreParam.outputHeight = dp_yres; coreParam.pixelWidth = pixel_xres; coreParam.pixelHeight = pixel_yres; std::string error_string; if (PSP_Init(coreParam, &error_string)) { invalid_ = false; } else { invalid_ = true; errorMessage_ = error_string; ERROR_LOG(BOOT, "%s", errorMessage_.c_str()); System_SendMessage("event", "failstartgame"); return; } globalUIState = UISTATE_INGAME; host->BootDone(); host->UpdateDisassembly(); g_gameInfoCache.FlushBGs(); NOTICE_LOG(BOOT, "Loading %s...", fileToStart.c_str()); autoLoad(); I18NCategory *s = GetI18NCategory("Screen"); #ifdef _WIN32 if (g_Config.bFirstRun) { osm.Show(s->T("PressESC", "Press ESC to open the pause menu"), 3.0f); } #endif memset(virtKeys, 0, sizeof(virtKeys)); const char *renderer = (const char*)glGetString(GL_RENDERER); if (strstr(renderer, "Chainfire3D") != 0) { osm.Show(s->T("Chainfire3DWarning", "WARNING: Chainfire3D detected, may cause problems"), 10.0f, 0xFF30a0FF, -1, true); } System_SendMessage("event", "startgame"); }
void GraphicsScreen::render() { UIShader_Prepare(); UIBegin(UIShader_Get()); DrawBackground(1.0f); I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); ui_draw2d.DrawText(UBUNTU48, gs->T("Graphics 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, gs->T("Vertex Cache"), ALIGN_TOPLEFT, &g_Config.bVertexCache); #ifndef __SYMBIAN32__ UICheckBox(GEN_ID, x, y += stride, gs->T("Hardware Transform"), ALIGN_TOPLEFT, &g_Config.bHardwareTransform); UICheckBox(GEN_ID, x, y += stride, gs->T("Stream VBO"), ALIGN_TOPLEFT, &g_Config.bUseVBO); #endif UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering); bool fs = g_Config.iFrameSkip == 1; UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &fs); g_Config.iFrameSkip = fs ? 1 : 0; UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap); if (UICheckBox(GEN_ID, x, y += stride, gs->T("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, y += stride, gs->T("2X", "2x Render Resolution"), ALIGN_TOPLEFT, &doubleRes)) { if (gpu) gpu->Resized(); } g_Config.iWindowZoom = doubleRes ? 2 : 1; } UIEnd(); }
void EmuScreen::onVKeyDown(int virtualKeyCode) { I18NCategory *s = GetI18NCategory("Screen"); switch (virtualKeyCode) { case VIRTKEY_UNTHROTTLE: PSP_CoreParameter().unthrottle = true; break; case VIRTKEY_SPEED_TOGGLE: if (PSP_CoreParameter().fpsLimit == 0) { PSP_CoreParameter().fpsLimit = 1; osm.Show(s->T("fixed", "Speed: alternate"), 1.0); } else if (PSP_CoreParameter().fpsLimit == 1) { PSP_CoreParameter().fpsLimit = 0; osm.Show(s->T("standard", "Speed: standard"), 1.0); } break; case VIRTKEY_PAUSE: pauseTrigger_ = true; break; case VIRTKEY_AXIS_SWAP: KeyMap::SwapAxis(); break; case VIRTKEY_AXIS_X_MIN: case VIRTKEY_AXIS_X_MAX: setVKeyAnalogX(CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX); break; case VIRTKEY_AXIS_Y_MIN: case VIRTKEY_AXIS_Y_MAX: setVKeyAnalogY(CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX); break; case VIRTKEY_AXIS_RIGHT_X_MIN: case VIRTKEY_AXIS_RIGHT_X_MAX: setVKeyAnalogX(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX); break; case VIRTKEY_AXIS_RIGHT_Y_MIN: case VIRTKEY_AXIS_RIGHT_Y_MAX: setVKeyAnalogY(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX); break; case VIRTKEY_ANALOG_LIGHTLY: setVKeyAnalogX(CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX); setVKeyAnalogY(CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX); setVKeyAnalogX(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX); setVKeyAnalogY(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX); break; case VIRTKEY_REWIND: if (SaveState::CanRewind()) { SaveState::Rewind(); } else { osm.Show(s->T("norewind", "No rewind save states available"), 2.0); } break; case VIRTKEY_SAVE_STATE: SaveState::SaveSlot(g_Config.iCurrentStateSlot, SaveState::Callback()); break; case VIRTKEY_LOAD_STATE: if (SaveState::HasSaveInSlot(g_Config.iCurrentStateSlot)) { SaveState::LoadSlot(g_Config.iCurrentStateSlot, SaveState::Callback()); } break; case VIRTKEY_NEXT_SLOT: SaveState::NextSlot(); break; case VIRTKEY_TOGGLE_FULLSCREEN: System_SendMessage("toggle_fullscreen", ""); break; } }
void PluginScreen::update(InputState &input) { UIScreen::update(input); I18NCategory *p = GetI18NCategory("Plugin"); downloader_.Update(); if (json_.get() && json_->Done()) { if (json_->ResultCode() != 200) { char codeStr[18]; sprintf(codeStr, "%i", json_->ResultCode()); tvDescription_->SetText(p->T("Failed to reach server", "Failed to reach server.\nPlease try again later and check that you have a\nworking internet connection.")); buttonDownload_->SetEnabled(false); } else { std::string json; json_->buffer().TakeAll(&json); JsonReader reader(json.data(), json.size()); const json_value *root = reader.root(); std::string abi = ""; #if defined(_M_IX86) && defined(_WIN32) abi = "Win32"; #elif defined(_M_X64) && defined(_WIN32) abi = "Win64"; #elif defined(ARMEABI) abi = "armeabi"; #elif defined(ARMEABI_V7A) abi = "armeabi-v7a"; #endif if (!abi.empty()) { at3plusdecoderUrl_ = root->getString(abi.c_str(), ""); if (at3plusdecoderUrl_.empty()) { buttonDownload_->SetEnabled(false); } else { buttonDownload_->SetEnabled(true); const char *notInstalledText = p->T("To download and install", "To download and install Mai's Atrac3+ decoding support, click Download.\n"); const char *reInstallText = p->T("Already installed", "Mai's Atrac3+ decoder already installed.\nWould you like to redownload and reinstall it?\n"); tvDescription_->SetText(Atrac3plus_Decoder::IsInstalled() ? reInstallText : notInstalledText); } } } json_.reset(); } if (at3plusdecoder_.get() && at3plusdecoder_->Done()) { // Done! yay. progress_->SetProgress(1.0); if (at3plusdecoder_->ResultCode() == 200) { // Yay! tvDescription_->SetText(p->T("Installed Correctly", "Mai Atrac3plus plugin downloaded and installed.\n" "Please press Back.")); buttonDownload_->SetVisibility(UI::V_GONE); } else { char codeStr[18]; sprintf(codeStr, "%i", at3plusdecoder_->ResultCode()); tvDescription_->SetText(p->T("Failed to download plugin", "Failed to download plugin.\nPlease try again later.")); progress_->SetVisibility(UI::V_GONE); buttonDownload_->SetEnabled(true); } at3plusdecoder_.reset(); } }
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; 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, 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, 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 + 75, 20); ui_draw2d.DrawText(UBUNTU24, gs->T("Type :"), x + 60, y += stride + 25, 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 SystemInfoScreen::CreateViews() { // NOTE: Do not translate this section. It will change a lot and will be impossible to keep up. I18NCategory *d = GetI18NCategory("Dialog"); using namespace UI; root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); root_->Add(new Choice(d->T("Back"), "", false, new AnchorLayoutParams(225, 64, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 225, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); ViewGroup *deviceSpecsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *deviceSpecs = new LinearLayout(ORIENT_VERTICAL); deviceSpecs->SetSpacing(0); deviceSpecsScroll->Add(deviceSpecs); tabHolder->AddTab("Device Info", deviceSpecsScroll); deviceSpecs->Add(new ItemHeader("System Information")); deviceSpecs->Add(new InfoItem("Name", System_GetProperty(SYSPROP_NAME))); deviceSpecs->Add(new InfoItem("Lang/Region", System_GetProperty(SYSPROP_LANGREGION))); deviceSpecs->Add(new InfoItem("ABI", GetCompilerABI())); deviceSpecs->Add(new ItemHeader("CPU Information")); deviceSpecs->Add(new InfoItem("Name", cpu_info.brand_string)); #ifdef ARM deviceSpecs->Add(new InfoItem("Cores", StringFromInt(cpu_info.num_cores))); #else int totalThreads = cpu_info.num_cores * cpu_info.logical_cpu_count; std::string cores = StringFromFormat("%d (%d per core, %d cores)", totalThreads, cpu_info.logical_cpu_count, cpu_info.num_cores); deviceSpecs->Add(new InfoItem("Threads", cores)); #endif deviceSpecs->Add(new ItemHeader("GPU Information")); Thin3DContext *thin3d = screenManager()->getThin3DContext(); deviceSpecs->Add(new InfoItem("3D API", thin3d->GetInfoString(T3DInfo::APINAME))); deviceSpecs->Add(new InfoItem("Vendor", thin3d->GetInfoString(T3DInfo::VENDOR))); deviceSpecs->Add(new InfoItem("Model", thin3d->GetInfoString(T3DInfo::RENDERER))); #ifdef _WIN32 deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION))); if (g_Config.iGPUBackend == GPU_BACKEND_DIRECT3D9) { deviceSpecs->Add(new InfoItem("D3DX Version", StringFromFormat("%d", GetD3DXVersion()))); } #endif #ifdef ANDROID deviceSpecs->Add(new ItemHeader("Audio Information")); deviceSpecs->Add(new InfoItem("Sample rate", StringFromFormat("%d Hz", System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE)))); deviceSpecs->Add(new InfoItem("Frames per buffer", StringFromFormat("%d", System_GetPropertyInt(SYSPROP_AUDIO_FRAMES_PER_BUFFER)))); deviceSpecs->Add(new InfoItem("Optimal sample rate", StringFromFormat("%d Hz", System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_SAMPLE_RATE)))); deviceSpecs->Add(new InfoItem("Optimal frames per buffer", StringFromFormat("%d", System_GetPropertyInt(SYSPROP_AUDIO_OPTIMAL_FRAMES_PER_BUFFER)))); deviceSpecs->Add(new ItemHeader("Display Information")); deviceSpecs->Add(new InfoItem("Native Resolution", StringFromFormat("%dx%d", System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)))); deviceSpecs->Add(new InfoItem("Refresh rate", StringFromFormat("%0.3f Hz", (float)System_GetPropertyInt(SYSPROP_DISPLAY_REFRESH_RATE) / 1000.0f))); #endif deviceSpecs->Add(new ItemHeader("Version Information")); std::string apiVersion = thin3d->GetInfoString(T3DInfo::APIVERSION); apiVersion.resize(30); deviceSpecs->Add(new InfoItem("API Version", apiVersion)); deviceSpecs->Add(new InfoItem("Shading Language", thin3d->GetInfoString(T3DInfo::SHADELANGVERSION))); #ifdef ANDROID std::string moga = System_GetProperty(SYSPROP_MOGA_VERSION); if (moga.empty()) { moga = "(none detected)"; } deviceSpecs->Add(new InfoItem("Moga", moga)); #endif #ifdef ANDROID char temp[256]; sprintf(temp, "%dx%d", System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)); deviceSpecs->Add(new InfoItem("Display resolution", temp)); #endif if (gl_extensions.precision[0] != 0) { const char *stypes[2] = { "Vertex", "Fragment" }; const char *ptypes[6] = { "LowF", "MediumF", "HighF", "LowI", "MediumI", "HighI" }; for (int st = 0; st < 2; st++) { char bufValue[256], bufTitle[256]; for (int p = 0; p < 6; p++) { snprintf(bufTitle, sizeof(bufTitle), "Precision %s %s:", stypes[st], ptypes[p]); snprintf(bufValue, sizeof(bufValue), "(%i, %i): %i", gl_extensions.range[st][p][0], gl_extensions.range[st][p][1], gl_extensions.precision[st][p]); deviceSpecs->Add(new InfoItem(bufTitle, bufValue, new LayoutParams(FILL_PARENT, 30))); } } } ViewGroup *cpuExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *cpuExtensions = new LinearLayout(ORIENT_VERTICAL); cpuExtensions->SetSpacing(0); cpuExtensionsScroll->Add(cpuExtensions); tabHolder->AddTab("CPU Extensions", cpuExtensionsScroll); cpuExtensions->Add(new ItemHeader("CPU Extensions")); std::vector<std::string> exts; SplitString(cpu_info.Summarize(), ',', exts); for (size_t i = 2; i < exts.size(); i++) { cpuExtensions->Add(new TextView(exts[i])); } ViewGroup *oglExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *oglExtensions = new LinearLayout(ORIENT_VERTICAL); oglExtensions->SetSpacing(0); oglExtensionsScroll->Add(oglExtensions); tabHolder->AddTab("OGL Extensions", oglExtensionsScroll); #ifndef USING_GLES2 oglExtensions->Add(new ItemHeader("OpenGL Extensions")); #else if (gl_extensions.GLES3) oglExtensions->Add(new ItemHeader("OpenGL ES 3.0 Extensions")); else oglExtensions->Add(new ItemHeader("OpenGL ES 2.0 Extensions")); #endif exts.clear(); SplitString(g_all_gl_extensions, ' ', exts); std::sort(exts.begin(), exts.end()); for (size_t i = 0; i < exts.size(); i++) { oglExtensions->Add(new TextView(exts[i]))->SetFocusable(true); } exts.clear(); SplitString(g_all_egl_extensions, ' ', exts); std::sort(exts.begin(), exts.end()); // If there aren't any EGL extensions, no need to show the tab. if (exts.size() > 0) { ViewGroup *eglExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *eglExtensions = new LinearLayout(ORIENT_VERTICAL); eglExtensions->SetSpacing(0); eglExtensionsScroll->Add(eglExtensions); tabHolder->AddTab("EGL Extensions", eglExtensionsScroll); eglExtensions->Add(new ItemHeader("EGL Extensions")); for (size_t i = 0; i < exts.size(); i++) { eglExtensions->Add(new TextView(exts[i]))->SetFocusable(true); } } }
void UIDialogScreenWithBackground::AddStandardBack(UI::ViewGroup *parent) { using namespace UI; I18NCategory *di = GetI18NCategory("Dialog"); parent->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, 64, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); }
void PSPSaveDialog::DisplaySaveDataInfo1() { if (param.GetFileInfo(currentSelectedSave).size == 0) { I18NCategory *d = GetI18NCategory("Dialog"); PPGeDrawText(d->T("New Save"), 180, 136, PPGE_ALIGN_VCENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF)); } else { char title[512]; char time[512]; char saveTitle[512]; char saveDetail[512]; char am_pm[] = "AM"; char hour_time[10] ; int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour; int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min; switch (g_Config.iTimeFormat) { case 1: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); break; case 2: snprintf(hour_time,10,"%02d:%02d", hour, min); break; default: if (hour > 12) { strcpy(am_pm, "PM"); hour -= 12; } snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm); } snprintf(title, 512, "%s", param.GetFileInfo(currentSelectedSave).title); int day = param.GetFileInfo(currentSelectedSave).modif_time.tm_mday; int month = param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1; int year = param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900; s64 sizeK = param.GetFileInfo(currentSelectedSave).size / 1024; switch (g_Config.iDateFormat) { case 1: snprintf(time, 512, "%d/%02d/%02d %s %lld KB", year, month, day, hour_time, sizeK); break; case 2: snprintf(time, 512, "%02d/%02d/%d %s %lld KB", month, day, year, hour_time, sizeK); break; case 3: snprintf(time, 512, "%02d/%02d/%d %s %lld KB", day, month, year, hour_time, sizeK); break; default: snprintf(time, 512, "%d/%02d/%02d %s %lld KB", year, month, day, hour_time, sizeK); } snprintf(saveTitle, 512, "%s", param.GetFileInfo(currentSelectedSave).saveTitle); snprintf(saveDetail, 512, "%s", param.GetFileInfo(currentSelectedSave).saveDetail); PPGeDrawRect(180, 136, 980, 137, CalcFadedColor(0xFFFFFFFF)); std::string titleTxt = title; std::string timeTxt = time; std::string saveTitleTxt = saveTitle; std::string saveDetailTxt = saveDetail; PPGeDrawText(titleTxt.c_str(), 180, 136, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0xFFC0C0C0)); PPGeDrawText(timeTxt.c_str(), 180, 137, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(saveTitleTxt.c_str(), 175, 159, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(saveDetailTxt.c_str(), 175, 181, PPGE_ALIGN_LEFT, 0.45f, CalcFadedColor(0xFFFFFFFF)); } }
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(); } UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &g_Config.bFrameSkip); if (g_Config.bFrameSkip) { ui_draw2d.DrawText(UBUNTU24, gs->T("Skip Frames :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 250 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, "Auto", ALIGN_LEFT)) g_Config.iNumSkip = 3; if (UIButton(GEN_ID, hlinear1, 30, 0, "1", ALIGN_LEFT)) g_Config.iNumSkip = 1; if (UIButton(GEN_ID, hlinear1, 30, 0, "2", ALIGN_LEFT)) g_Config.iNumSkip = 2; } UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); 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(); }
int PSPSaveDialog::Update() { switch (status) { case SCE_UTILITY_STATUS_FINISHED: status = SCE_UTILITY_STATUS_SHUTDOWN; break; default: break; } if (status != SCE_UTILITY_STATUS_RUNNING) return SCE_ERROR_UTILITY_INVALID_STATUS; if (!param.GetPspParam()) { status = SCE_UTILITY_STATUS_SHUTDOWN; return 0; } buttons = __CtrlPeekButtons(); UpdateFade(); okButtonImg = I_CIRCLE; cancelButtonImg = I_CROSS; okButtonFlag = CTRL_CIRCLE; cancelButtonFlag = CTRL_CROSS; if (param.GetPspParam()->common.buttonSwap == 1) { okButtonImg = I_CROSS; cancelButtonImg = I_CIRCLE; okButtonFlag = CTRL_CROSS; cancelButtonFlag = CTRL_CIRCLE; } I18NCategory *d = GetI18NCategory("Dialog"); switch (display) { case DS_SAVE_LIST_CHOICE: StartDraw(); DisplaySaveList(); DisplaySaveDataInfo1(); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_SAVE); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } else if (IsButtonPressed(okButtonFlag)) { // Save exist, ask user confirm if (param.GetFileInfo(currentSelectedSave).size > 0) { yesnoChoice = 0; display = DS_SAVE_CONFIRM_OVERWRITE; } else { display = DS_SAVE_SAVING; if (param.Save(param.GetPspParam(), GetSelectedSaveDirName())) { param.SetPspParam(param.GetPspParam()); // Optim : Just Update modified save display = DS_SAVE_DONE; } else display = DS_SAVE_LIST_CHOICE; // This will probably need error message ? } } EndDraw(); break; case DS_SAVE_CONFIRM: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("Confirm Save", "Do you want to save this data?"), true); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_SAVE); if (IsButtonPressed(cancelButtonFlag) || (IsButtonPressed(okButtonFlag) && yesnoChoice == 0)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } else if (IsButtonPressed(okButtonFlag)) { display = DS_SAVE_SAVING; if (param.Save(param.GetPspParam(), GetSelectedSaveDirName())) { param.SetPspParam(param.GetPspParam()); // Optim : Just Update modified save display = DS_SAVE_DONE; } else { // TODO: This should probably show an error message? StartFade(false); } } EndDraw(); break; case DS_SAVE_CONFIRM_OVERWRITE: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("Do you want to overwrite the data?"), true); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_SAVE); if (IsButtonPressed(cancelButtonFlag) || (IsButtonPressed(okButtonFlag) && yesnoChoice == 0)) { if (param.GetPspParam()->mode != SCE_UTILITY_SAVEDATA_TYPE_SAVE) display = DS_SAVE_LIST_CHOICE; else { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } } else if (IsButtonPressed(okButtonFlag)) { display = DS_SAVE_SAVING; if (param.Save(param.GetPspParam(), GetSelectedSaveDirName())) { param.SetPspParam(param.GetPspParam()); // Optim : Just Update modified save display = DS_SAVE_DONE; } else { // TODO: This should probably show an error message? if (param.GetPspParam()->mode != SCE_UTILITY_SAVEDATA_TYPE_SAVE) display = DS_SAVE_LIST_CHOICE; else StartFade(false); } } EndDraw(); break; case DS_SAVE_SAVING: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("Saving","Saving\nPlease Wait...")); DisplayBanner(DB_SAVE); EndDraw(); break; case DS_SAVE_DONE: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("Save completed")); DisplayButtons(DS_BUTTON_CANCEL); DisplayBanner(DB_SAVE); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_SUCCESS; // Set the save to use for autosave and autoload param.SetSelectedSave(param.GetFileInfo(currentSelectedSave).idx); StartFade(false); } EndDraw(); break; case DS_LOAD_LIST_CHOICE: StartDraw(); DisplaySaveList(); DisplaySaveDataInfo1(); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_LOAD); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } else if (IsButtonPressed(okButtonFlag)) { display = DS_LOAD_LOADING; if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave)) display = DS_LOAD_DONE; } EndDraw(); break; case DS_LOAD_CONFIRM: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("ConfirmLoad", "Load this data?"), true); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_LOAD); if (IsButtonPressed(cancelButtonFlag) || (IsButtonPressed(okButtonFlag) && yesnoChoice == 0)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } else if (IsButtonPressed(okButtonFlag)) { display = DS_LOAD_LOADING; if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave)) display = DS_LOAD_DONE; else { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } } EndDraw(); break; case DS_LOAD_LOADING: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("Loading","Loading\nPlease Wait...")); DisplayBanner(DB_LOAD); EndDraw(); break; case DS_LOAD_DONE: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("Load completed")); DisplayButtons(DS_BUTTON_CANCEL); DisplayBanner(DB_LOAD); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_SUCCESS; // Set the save to use for autosave and autoload param.SetSelectedSave(param.GetFileInfo(currentSelectedSave).idx); StartFade(false); } EndDraw(); break; case DS_LOAD_NODATA: StartDraw(); DisplayMessage(d->T("There is no data")); DisplayButtons(DS_BUTTON_CANCEL); DisplayBanner(DB_LOAD); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA; StartFade(false); } EndDraw(); break; case DS_DELETE_LIST_CHOICE: StartDraw(); DisplaySaveList(); DisplaySaveDataInfo1(); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_DELETE); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } else if (IsButtonPressed(okButtonFlag)) { yesnoChoice = 0; display = DS_DELETE_CONFIRM; } EndDraw(); break; case DS_DELETE_CONFIRM: StartDraw(); DisplaySaveIcon(); DisplaySaveDataInfo2(); DisplayMessage(d->T("DeleteConfirm", "This save data will be deleted.\nAre you sure you want to continue?"), true); DisplayButtons(DS_BUTTON_OK | DS_BUTTON_CANCEL); DisplayBanner(DB_DELETE); if (IsButtonPressed(cancelButtonFlag)) display = DS_DELETE_LIST_CHOICE; else if (IsButtonPressed(okButtonFlag)) { if (yesnoChoice == 0) display = DS_DELETE_LIST_CHOICE; else { display = DS_DELETE_DELETING; if (param.Delete(param.GetPspParam(),currentSelectedSave)) { param.SetPspParam(param.GetPspParam()); // Optim : Just Update modified save display = DS_DELETE_DONE; } else display = DS_DELETE_LIST_CHOICE; // This will probably need error message ? } } EndDraw(); break; case DS_DELETE_DELETING: StartDraw(); DisplayMessage(d->T("Deleting","Deleting\nPlease Wait...")); DisplayBanner(DB_DELETE); EndDraw(); break; case DS_DELETE_DONE: StartDraw(); DisplayMessage(d->T("Delete completed")); DisplayButtons(DS_BUTTON_CANCEL); DisplayBanner(DB_DELETE); if (IsButtonPressed(cancelButtonFlag)) { if (param.GetFilenameCount() == 0) display = DS_DELETE_NODATA; else display = DS_DELETE_LIST_CHOICE; } EndDraw(); break; case DS_DELETE_NODATA: StartDraw(); DisplayMessage(d->T("There is no data")); DisplayButtons(DS_BUTTON_CANCEL); DisplayBanner(DB_DELETE); if (IsButtonPressed(cancelButtonFlag)) { param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA; StartFade(false); } EndDraw(); break; case DS_NONE: // For action which display nothing { switch (param.GetPspParam()->mode) { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: // Only load and exit case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD: if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave)) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA; status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_SAVE: // Only save and exit case SCE_UTILITY_SAVEDATA_TYPE_AUTOSAVE: if (param.Save(param.GetPspParam(), GetSelectedSaveDirName())) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE; status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_SIZES: if (param.GetSizes(param.GetPspParam())) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA; status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_LIST: param.GetList(param.GetPspParam()); param.GetPspParam()->common.result = 0; status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_FILES: param.GetPspParam()->common.result = param.GetFilesList(param.GetPspParam()); status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_GETSIZE: { bool result = param.GetSize(param.GetPspParam()); // TODO: According to JPCSP, should test/verify this part but seems edge casey. if (MemoryStick_State() != PSP_MEMORYSTICK_STATE_DRIVER_READY) param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_MEMSTICK; else if (result) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; status = SCE_UTILITY_STATUS_FINISHED; } break; case SCE_UTILITY_SAVEDATA_TYPE_DELETEDATA: // TODO: This should probably actually delete something. // For now, always say it couldn't be deleted. WARN_LOG(HLE, "FAKE sceUtilitySavedata DELETEDATA: %s", param.GetPspParam()->saveName); param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_STATUS; status = SCE_UTILITY_STATUS_FINISHED; break; //case SCE_UTILITY_SAVEDATA_TYPE_AUTODELETE: case SCE_UTILITY_SAVEDATA_TYPE_SINGLEDELETE: if (param.Delete(param.GetPspParam(), param.GetSelectedSave())) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA; status = SCE_UTILITY_STATUS_FINISHED; break; // TODO: Should reset the directory's other files. case SCE_UTILITY_SAVEDATA_TYPE_MAKEDATA: case SCE_UTILITY_SAVEDATA_TYPE_MAKEDATASECURE: if (param.Save(param.GetPspParam(), GetSelectedSaveDirName(), param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_MAKEDATASECURE)) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_WRITEDATA: case SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE: if (param.Save(param.GetPspParam(), GetSelectedSaveDirName(), param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE)) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; status = SCE_UTILITY_STATUS_FINISHED; break; case SCE_UTILITY_SAVEDATA_TYPE_READDATA: case SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE: if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave, param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE)) param.GetPspParam()->common.result = 0; else param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; // not sure if correct code status = SCE_UTILITY_STATUS_FINISHED; break; default: status = SCE_UTILITY_STATUS_FINISHED; break; } } break; default: status = SCE_UTILITY_STATUS_FINISHED; break; } lastButtons = buttons; if (status == SCE_UTILITY_STATUS_FINISHED) Memory::Memcpy(requestAddr,&request,request.common.size); return 0; }
void GraphicsScreenP1::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); } if (UIButton(GEN_ID, Pos( 220 , dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Next Page"), ALIGN_RIGHT | ALIGN_BOTTOM)) { screenManager()->push(new GraphicsScreenP2()); } int x = 30; int y = 30; int stride = 40; int columnw = 400; UICheckBox(GEN_ID, x, y += stride, gs->T("Vertex Cache"), ALIGN_TOPLEFT, &g_Config.bVertexCache); #ifndef __SYMBIAN32__ UICheckBox(GEN_ID, x, y += stride, gs->T("Hardware Transform"), ALIGN_TOPLEFT, &g_Config.bHardwareTransform); UICheckBox(GEN_ID, x, y += stride, gs->T("Stream VBO"), ALIGN_TOPLEFT, &g_Config.bUseVBO); #endif UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering); UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &g_Config.bFrameSkip); UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap); if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) { if (gpu) gpu->Resized(); } if (g_Config.bBufferedRendering) { if (UICheckBox(GEN_ID, x, y += stride, gs->T("2X", "2x Render Resolution"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing)) { if (gpu) gpu->Resized(); } } UIEnd(); }
void DeveloperToolsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); enableLogging_ = g_Config.bEnableLogging; I18NCategory *d = GetI18NCategory("Dialog"); I18NCategory *de = GetI18NCategory("Developer"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *a = GetI18NCategory("Audio"); I18NCategory *s = GetI18NCategory("System"); LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->SetSpacing(0); list->Add(new ItemHeader(s->T("General"))); list->Add(new Choice(de->T("System Information")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSysInfo); list->Add(new CheckBox(&enableLogging_, de->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged); list->Add(new Choice(de->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig); list->Add(new CheckBox(&g_Config.bShowDeveloperMenu, de->T("Show Developer Menu"))); list->Add(new Choice(de->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests); list->Add(new Choice(de->T("Restore Default Settings")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRestoreDefaultSettings); #ifndef __SYMBIAN32__ list->Add(new CheckBox(&g_Config.bSoftwareRendering, gs->T("Software Rendering", "Software Rendering (experimental)"))); #endif list->Add(new ItemHeader(de->T("Language"))); list->Add(new Choice(de->T("Load language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoadLanguageIni); list->Add(new Choice(de->T("Save language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSaveLanguageIni); list->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack); }
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; #ifdef IOS if(!isJailed) UICheckBox(GEN_ID, x, y += stride, s->T("Dynarec", "Dynarec (JIT)"), ALIGN_TOPLEFT, &g_Config.bJit); else { UICheckBox(GEN_ID, x, y += stride, s->T("DynarecisJailed", "Dynarec (JIT) - (Not jailbroken - JIT not available)"), ALIGN_TOPLEFT, &g_Config.bJit); g_Config.bJit = false; } #else UICheckBox(GEN_ID, x, y += stride, s->T("Dynarec", "Dynarec (JIT)"), ALIGN_TOPLEFT, &g_Config.bJit); #endif 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); UICheckBox(GEN_ID, x, y += stride, s->T("Use Button X to Confirm"), ALIGN_TOPLEFT, &g_Config.bButtonPreference); 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 GameSettingsScreen::CreateViews() { GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true); cap60FPS_ = g_Config.iForceMaxEmulatedFPS == 60; iAlternateSpeedPercent_ = 3; for (int i = 0; i < 8; i++) { if (g_Config.iFpsLimit <= alternateSpeedTable[i]) { iAlternateSpeedPercent_ = i; break; } } // Information in the top left. // Back button to the bottom left. // Scrolling action menu to the right. using namespace UI; I18NCategory *d = GetI18NCategory("Dialog"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *c = GetI18NCategory("Controls"); I18NCategory *a = GetI18NCategory("Audio"); I18NCategory *s = GetI18NCategory("System"); I18NCategory *ms = GetI18NCategory("MainSettings"); I18NCategory *dev = GetI18NCategory("Developer"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); root_->Add(new Choice(d->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &GameSettingsScreen::OnBack); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); // TODO: These currently point to global settings, not game specific ones. // Graphics ViewGroup *graphicsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *graphicsSettings = new LinearLayout(ORIENT_VERTICAL); graphicsSettings->SetSpacing(0); graphicsSettingsScroll->Add(graphicsSettings); tabHolder->AddTab(ms->T("Graphics"), graphicsSettingsScroll); graphicsSettings->Add(new ItemHeader(gs->T("Rendering Mode"))); static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory (CPU)", "Read Framebuffers To Memory (GPU)"}; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, ARRAY_SIZE(renderingMode), gs, screenManager()))->OnChoice.Handle(this, &GameSettingsScreen::OnRenderingMode); graphicsSettings->Add(new ItemHeader(gs->T("Frame Rate Control"))); static const char *frameSkip[] = {"Off", "Auto", "1", "2", "3", "4", "5", "6", "7", "8"}; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iFrameSkip, gs->T("Frame Skipping"), frameSkip, 0, ARRAY_SIZE(frameSkip), gs, screenManager())); static const char *fpsChoices[] = {"None", "Speed", "FPS", "Both"}; graphicsSettings->Add(new CheckBox(&cap60FPS_, gs->T("Force max 60 FPS (helps GoW)"))); static const char *customSpeed[] = {"Unlimited", "25%", "50%", "75%", "100%", "125%", "150%", "200%", "300%"}; graphicsSettings->Add(new PopupMultiChoice(&iAlternateSpeedPercent_, gs->T("Alternative Speed"), customSpeed, 0, ARRAY_SIZE(customSpeed), gs, screenManager())); graphicsSettings->Add(new ItemHeader(gs->T("Features"))); graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform"))); graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache"))); static const char *internalResolutions[] = {"Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iInternalResolution, gs->T("Rendering Resolution"), internalResolutions, 0, ARRAY_SIZE(internalResolutions), gs, screenManager()))->OnClick.Handle(this, &GameSettingsScreen::OnResolutionChange); graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display"))); #ifdef BLACKBERRY if (pixel_xres == pixel_yres) graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch"))); #endif graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping"))); // This setting is not really useful for anyone atm. // graphicsSettings->Add(new CheckBox(&g_Config.bTrueColor, gs->T("True Color"))); #ifdef _WIN32 graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync"))); graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen"))); #endif graphicsSettings->Add(new ItemHeader(gs->T("Overlay Information"))); graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, ARRAY_SIZE(fpsChoices), gs, screenManager())); graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gs->T("Show Debug Statistics"))); graphicsSettings->Add(new ItemHeader(gs->T("Texture Scaling"))); #ifndef USING_GLES2 static const char *texScaleLevels[] = {"Off", "2x", "3x","4x", "5x"}; #else static const char *texScaleLevels[] = {"Off", "2x", "3x"}; #endif graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingLevel, gs->T("Upscale Level"), texScaleLevels, 1, ARRAY_SIZE(texScaleLevels), gs, screenManager())); static const char *texScaleAlgos[] = { "xBRZ", "Hybrid", "Bicubic", "Hybrid + Bicubic", }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gs->T("Upscale Type"), texScaleAlgos, 0, ARRAY_SIZE(texScaleAlgos), gs, screenManager())); graphicsSettings->Add(new CheckBox(&g_Config.bTexDeposterize, gs->T("Deposterize"))); graphicsSettings->Add(new ItemHeader(gs->T("Texture Filtering"))); static const char *anisoLevels[] = { "Off", "2x", "4x", "8x", "16x" }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAnisotropyLevel, gs->T("Anisotropic Filtering"), anisoLevels, 0, ARRAY_SIZE(anisoLevels), gs, screenManager())); static const char *texFilters[] = { "Auto", "Nearest", "Linear", "Linear on FMV", }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), gs, screenManager())); graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings"))); graphicsSettings->Add(new CheckBox(&g_Config.bDisableStencilTest, gs->T("Disable Stencil Test"))); graphicsSettings->Add(new CheckBox(&g_Config.bAlwaysDepthWrite, gs->T("Always Depth Write"))); // Developer tools are not accessible ingame, so it goes here graphicsSettings->Add(new ItemHeader(gs->T("Debugging"))); Choice *dump = graphicsSettings->Add(new Choice(gs->T("Dump next frame to log"))); dump->OnClick.Handle(this, &GameSettingsScreen::OnDumpNextFrameToLog); if (!PSP_IsInited()) dump->SetEnabled(false); // Audio ViewGroup *audioSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *audioSettings = new LinearLayout(ORIENT_VERTICAL); audioSettings->SetSpacing(0); audioSettingsScroll->Add(audioSettings); tabHolder->AddTab(ms->T("Audio"), audioSettingsScroll); std::string atracString; atracString.assign(Atrac3plus_Decoder::IsInstalled() ? "Redownload Atrac3+ plugin" : "Download Atrac3+ plugin"); audioSettings->Add(new ItemHeader(ms->T("Audio"))); audioSettings->Add(new Choice(a->T(atracString.c_str())))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin); audioSettings->Add(new PopupSliderChoice(&g_Config.iSFXVolume, 0, 8, a->T("SFX volume"), screenManager())); audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, 8, a->T("BGM volume"), screenManager())); audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound"))); audioSettings->Add(new CheckBox(&g_Config.bEnableAtrac3plus, a->T("Enable Atrac3+"))); audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio"))); // Control ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *controlsSettings = new LinearLayout(ORIENT_VERTICAL); controlsSettings->SetSpacing(0); controlsSettingsScroll->Add(controlsSettings); tabHolder->AddTab(ms->T("Controls"), controlsSettingsScroll); controlsSettings->Add(new ItemHeader(ms->T("Controls"))); controlsSettings->Add(new Choice(c->T("Control Mapping")))->OnClick.Handle(this, &GameSettingsScreen::OnControlMapping); controlsSettings->Add(new CheckBox(&g_Config.bAccelerometerToAnalogHoriz, c->T("Tilt", "Tilt to Analog (horizontal)"))); controlsSettings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivity, 10, 200, c->T("Tilt Sensitivity"), screenManager())); controlsSettings->Add(new ItemHeader(c->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 100, c->T("Button Opacity"), screenManager())); controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, c->T("Button Scaling"), screenManager())); controlsSettings->Add(new CheckBox(&g_Config.bShowAnalogStick, c->T("Show Left Analog Stick"))); // System ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *systemSettings = new LinearLayout(ORIENT_VERTICAL); systemSettings->SetSpacing(0); systemSettingsScroll->Add(systemSettings); tabHolder->AddTab(ms->T("System"), systemSettingsScroll); systemSettings->Add(new ItemHeader(s->T("Emulation"))); systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (Unstable)"))); #ifdef IOS if (isJailed) { systemSettings->Add(new TextView(s->T("DynarecisJailed", "Dynarec (JIT) - (Not jailbroken - JIT not available)"))); } else { systemSettings->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); } #else systemSettings->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); #endif #ifndef __SYMBIAN32__ systemSettings->Add(new CheckBox(&g_Config.bSeparateCPUThread, s->T("Multithreaded (experimental)")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new CheckBox(&g_Config.bSeparateIOThread, s->T("I/O on thread (experimental)")))->SetEnabled(!PSP_IsInited()); #endif systemSettings->Add(new PopupSliderChoice(&g_Config.iLockedCPUSpeed, 0, 1000, s->T("Change CPU Clock", "Change CPU Clock (0 = default)"), screenManager())); enableReports_ = Reporting::IsEnabled(); //#ifndef ANDROID systemSettings->Add(new ItemHeader(s->T("Cheats", "Cheats (experimental, see forums)"))); systemSettings->Add(new CheckBox(&g_Config.bEnableCheats, s->T("Enable Cheats"))); //#endif LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); systemSettings->SetSpacing(0); systemSettings->Add(new ItemHeader(s->T("General"))); systemSettings->Add(new Choice(dev->T("Language", "Language")))->OnClick.Handle(this, &GameSettingsScreen::OnLanguage); systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools); #ifdef _WIN32 // Screenshot functionality is not yet available on non-Windows systemSettings->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, s->T("Screenshots as PNG"))); #endif // TODO: Come up with a way to display a keyboard for mobile users, // so until then, this is Windows/Desktop only. #ifdef _WIN32 systemSettings->Add(new Choice(s->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); #endif systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents); enableReportsCheckbox_ = new CheckBox(&enableReports_, s->T("Enable Compatibility Server Reports")); enableReportsCheckbox_->SetEnabled(Reporting::IsSupported()); systemSettings->Add(enableReportsCheckbox_); systemSettings->Add(new ItemHeader(s->T("PSP Settings"))); systemSettings->Add(new CheckBox(&g_Config.bDayLightSavings, s->T("Day Light Saving"))); static const char *dateFormat[] = { "YYYYMMDD", "MMDDYYYY", "DDMMYYYY"}; systemSettings->Add(new PopupMultiChoice(&g_Config.iDateFormat, s->T("Date Format"), dateFormat, 1, 3, s, screenManager())); static const char *timeFormat[] = { "12HR", "24HR"}; systemSettings->Add(new PopupMultiChoice(&g_Config.iTimeFormat, s->T("Time Format"), timeFormat, 1, 2, s, screenManager())); static const char *buttonPref[] = { "Use O to confirm", "Use X to confirm" }; systemSettings->Add(new PopupMultiChoice(&g_Config.iButtonPreference, s->T("Confirmation Button"), buttonPref, 0, 2, s, screenManager())); }
void NativeInit(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID, bool fs) { #ifdef ANDROID_NDK_PROFILER setenv("CPUPROFILE_FREQUENCY", "500", 1); setenv("CPUPROFILE", "/sdcard/gmon.out", 1); monstartup("ppsspp_jni.so"); #endif InitFastMath(cpu_info.bNEON); // Sets both FZ and DefaultNaN on ARM, flipping some ARM implementations into "RunFast" mode for VFP. // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0274h/Babffifj.html // Do we need to do this on all threads? // Also, the FZ thing may actually be a little bit dangerous, I'm not sure how compliant the MIPS // CPU is with denormal handling. Needs testing. Default-NAN should be reasonably safe though. FPU_SetFastMode(); bool skipLogo = false; setlocale( LC_ALL, "C" ); std::string user_data_path = savegame_directory; pendingMessages.clear(); #ifdef IOS user_data_path += "/"; #endif // We want this to be FIRST. #ifdef USING_QT_UI VFSRegister("", new AssetsAssetReader()); #elif defined(BLACKBERRY) || defined(IOS) // Packed assets are included in app VFSRegister("", new DirectoryAssetReader(external_directory)); #elif defined(__APPLE__) || (defined(__linux__) && !defined(ANDROID)) VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory() + "assets/").c_str())); VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory()).c_str())); VFSRegister("", new DirectoryAssetReader("/usr/share/ppsspp/assets/")); #else VFSRegister("", new DirectoryAssetReader("assets/")); #endif VFSRegister("", new DirectoryAssetReader(savegame_directory)); #if defined(MOBILE_DEVICE) || !defined(USING_QT_UI) host = new NativeHost(); #endif #if defined(ANDROID) g_Config.internalDataDirectory = savegame_directory; // Maybe there should be an option to use internal memory instead, but I think // that for most people, using external memory (SDCard/USB Storage) makes the // most sense. g_Config.memStickDirectory = std::string(external_directory) + "/"; g_Config.flash0Directory = std::string(external_directory) + "/flash0/"; #elif defined(BLACKBERRY) || defined(__SYMBIAN32__) || defined(MAEMO) || defined(IOS) g_Config.memStickDirectory = user_data_path; g_Config.flash0Directory = std::string(external_directory) + "/flash0/"; #elif !defined(_WIN32) std::string config; if (getenv("XDG_CONFIG_HOME") != NULL) config = getenv("XDG_CONFIG_HOME"); else if (getenv("HOME") != NULL) config = getenv("HOME") + std::string("/.config"); else // Just in case config = "./config"; g_Config.memStickDirectory = config + "/ppsspp/"; g_Config.flash0Directory = File::GetExeDirectory() + "/flash0/"; #endif #ifndef _WIN32 logger = new AndroidLogger(); LogManager::Init(); LogManager *logman = LogManager::GetInstance(); g_Config.AddSearchPath(user_data_path); g_Config.AddSearchPath(g_Config.memStickDirectory + "PSP/SYSTEM/"); g_Config.SetDefaultPath(g_Config.memStickDirectory + "PSP/SYSTEM/"); g_Config.Load(); g_Config.externalDirectory = external_directory; #endif #ifdef ANDROID // On Android, create a PSP directory tree in the external_directory, // to hopefully reduce confusion a bit. ILOG("Creating %s", (g_Config.memStickDirectory + "PSP").c_str()); mkDir((g_Config.memStickDirectory + "PSP").c_str()); mkDir((g_Config.memStickDirectory + "PSP/SAVEDATA").c_str()); mkDir((g_Config.memStickDirectory + "PSP/GAME").c_str()); #endif const char *fileToLog = 0; const char *stateToLoad = 0; bool gfxLog = false; // Parse command line LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO; for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'd': // Enable debug logging // Note that you must also change the max log level in Log.h. logLevel = LogTypes::LDEBUG; break; case 'g': gfxLog = true; break; case 'j': g_Config.bJit = true; g_Config.bSaveSettings = false; break; case 'i': g_Config.bJit = false; g_Config.bSaveSettings = false; break; case '-': if (!strncmp(argv[i], "--log=", strlen("--log=")) && strlen(argv[i]) > strlen("--log=")) fileToLog = argv[i] + strlen("--log="); if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state=")) stateToLoad = argv[i] + strlen("--state="); #if !defined(MOBILE_DEVICE) if (!strncmp(argv[i], "--escape-exit", strlen("--escape-exit"))) g_Config.bPauseExitsEmulator = true; #endif break; } } else { if (boot_filename.empty()) { boot_filename = argv[i]; skipLogo = true; std::unique_ptr<FileLoader> fileLoader(ConstructFileLoader(boot_filename)); if (!fileLoader->Exists()) { fprintf(stderr, "File not found: %s\n", boot_filename.c_str()); exit(1); } } else { fprintf(stderr, "Can only boot one file"); exit(1); } } } if (fileToLog != NULL) LogManager::GetInstance()->ChangeFileLog(fileToLog); #ifndef _WIN32 if (g_Config.currentDirectory == "") { #if defined(ANDROID) g_Config.currentDirectory = external_directory; #elif defined(BLACKBERRY) || defined(__SYMBIAN32__) || defined(MAEMO) || defined(IOS) || defined(_WIN32) g_Config.currentDirectory = savegame_directory; #else if (getenv("HOME") != NULL) g_Config.currentDirectory = getenv("HOME"); else g_Config.currentDirectory = "./"; #endif } for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) { LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i; logman->SetEnable(type, true); logman->SetLogLevel(type, gfxLog && i == LogTypes::G3D ? LogTypes::LDEBUG : logLevel); #ifdef ANDROID logman->AddListener(type, logger); #endif } // Special hack for G3D as it's very spammy. Need to make a flag for this. if (!gfxLog) logman->SetLogLevel(LogTypes::G3D, LogTypes::LERROR); #endif // Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to // test new languages without recompiling the entire app, which is a hassle). const std::string langOverridePath = g_Config.memStickDirectory + "PSP/SYSTEM/lang/"; // If we run into the unlikely case that "lang" is actually a file, just use the built-in translations. if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath)) i18nrepo.LoadIni(g_Config.sLanguageIni); else i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath); I18NCategory *d = GetI18NCategory("DesktopUI"); // Note to translators: do not translate this/add this to PPSSPP-lang's files. // It's intended to be custom for every user. // Only add it to your own personal copies of PPSSPP. #ifdef _WIN32 // TODO: Could allow a setting to specify a font file to load? // TODO: Make this a constant if we can sanely load the font on other systems? AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL); g_Config.sFont = d->T("Font", "Roboto"); #endif if (!boot_filename.empty() && stateToLoad != NULL) SaveState::Load(stateToLoad); g_gameInfoCache.Init(); screenManager = new ScreenManager(); if (skipLogo) { screenManager->switchScreen(new EmuScreen(boot_filename)); } else { screenManager->switchScreen(new LogoScreen()); } std::string sysName = System_GetProperty(SYSPROP_NAME); isOuya = KeyMap::IsOuya(sysName); #if !defined(MOBILE_DEVICE) && defined(USING_QT_UI) MainWindow* mainWindow = new MainWindow(0,fs); mainWindow->show(); host = new QtHost(mainWindow); #endif // We do this here, instead of in NativeInitGraphics, because the display may be reset. // When it's reset we don't want to forget all our managed things. gl_lost_manager_init(); }
void DeveloperToolsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); I18NCategory *d = GetI18NCategory("Dialog"); I18NCategory *de = GetI18NCategory("Developer"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *a = GetI18NCategory("Audio"); I18NCategory *s = GetI18NCategory("System"); LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->SetSpacing(0); list->Add(new ItemHeader(s->T("General"))); #ifdef IOS if (!iosCanUseJit) { list->Add(new TextView(s->T("DynarecisJailed", "Dynarec (JIT) - (Not jailbroken - JIT not available)"))); } else { list->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); } #else list->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); #endif list->Add(new Choice(de->T("System Information")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSysInfo); list->Add(new CheckBox(&g_Config.bShowDeveloperMenu, de->T("Show Developer Menu"))); list->Add(new CheckBox(&g_Config.bDumpDecryptedEboot, de->T("Dump Decrypted Eboot", "Dump Decrypted EBOOT.BIN (If Encrypted) When Booting Game"))); Choice *cpuTests = new Choice(de->T("Run CPU Tests")); list->Add(cpuTests)->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests); #ifdef IOS const std::string testDirectory = g_Config.flash0Directory + "../"; #else const std::string testDirectory = g_Config.memCardDirectory; #endif if (!File::Exists(testDirectory + "pspautotests/tests/")) { cpuTests->SetEnabled(false); } list->Add(new CheckBox(&g_Config.bEnableLogging, de->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged); list->Add(new Choice(de->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig); list->Add(new ItemHeader(de->T("Language"))); list->Add(new Choice(de->T("Load language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoadLanguageIni); list->Add(new Choice(de->T("Save language ini")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSaveLanguageIni); list->Add(new ItemHeader("")); list->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); }
UI::EventReturn CreditsScreen::OnShare(UI::EventParams &e) { I18NCategory *c = GetI18NCategory("PSPCredits"); System_SendMessage("sharetext", c->T("CheckOutPPSSPP", "Check out PPSSPP, the awesome PSP emulator: http://www.ppsspp.org/")); return UI::EVENT_DONE; }
void GameSettingsScreen::CreateViews() { GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true); cap60FPS_ = g_Config.iForceMaxEmulatedFPS == 60; showDebugStats_ = g_Config.bShowDebugStats; iAlternateSpeedPercent_ = 3; for (int i = 0; i < 8; i++) { if (g_Config.iFpsLimit <= alternateSpeedTable[i]) { iAlternateSpeedPercent_ = i; break; } } // Information in the top left. // Back button to the bottom left. // Scrolling action menu to the right. using namespace UI; I18NCategory *d = GetI18NCategory("Dialog"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *c = GetI18NCategory("Controls"); I18NCategory *a = GetI18NCategory("Audio"); I18NCategory *s = GetI18NCategory("System"); I18NCategory *ms = GetI18NCategory("MainSettings"); I18NCategory *dev = GetI18NCategory("Developer"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); root_->Add(new Choice(d->T("Back"), "", false, new AnchorLayoutParams(150, 64, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); // TODO: These currently point to global settings, not game specific ones. // Graphics ViewGroup *graphicsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *graphicsSettings = new LinearLayout(ORIENT_VERTICAL); graphicsSettings->SetSpacing(0); graphicsSettingsScroll->Add(graphicsSettings); tabHolder->AddTab(ms->T("Graphics"), graphicsSettingsScroll); graphicsSettings->Add(new ItemHeader(gs->T("Rendering Mode"))); static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory (CPU)", "Read Framebuffers To Memory (GPU)"}; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, ARRAY_SIZE(renderingMode), gs, screenManager()))->OnChoice.Handle(this, &GameSettingsScreen::OnRenderingMode); graphicsSettings->Add(new ItemHeader(gs->T("Frame Rate Control"))); static const char *frameSkip[] = {"Off", "1", "2", "3", "4", "5", "6", "7", "8"}; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iFrameSkip, gs->T("Frame Skipping"), frameSkip, 0, ARRAY_SIZE(frameSkip), gs, screenManager()))->OnChoice.Handle(this, &GameSettingsScreen::OnFrameSkipChange); frameSkipAuto_ = graphicsSettings->Add(new CheckBox(&g_Config.bAutoFrameSkip, gs->T("Auto FrameSkip"))); frameSkipAuto_->SetEnabled(g_Config.iFrameSkip != 0); graphicsSettings->Add(new CheckBox(&cap60FPS_, gs->T("Force max 60 FPS (helps GoW)"))); static const char *customSpeed[] = {"Unlimited", "25%", "50%", "75%", "100%", "125%", "150%", "200%", "300%"}; graphicsSettings->Add(new PopupMultiChoice(&iAlternateSpeedPercent_, gs->T("Alternative Speed"), customSpeed, 0, ARRAY_SIZE(customSpeed), gs, screenManager())); graphicsSettings->Add(new ItemHeader(gs->T("Features"))); postProcChoice_ = graphicsSettings->Add(new Choice(gs->T("Postprocessing Shader"))); postProcChoice_->OnClick.Handle(this, &GameSettingsScreen::OnPostProcShader); postProcChoice_->SetEnabled(g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); #if defined(_WIN32) || defined(USING_QT_UI) graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); #endif graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display"))); // Small Display: To avoid overlapping touch controls on large tablets. Better control over this will be coming later. graphicsSettings->Add(new CheckBox(&g_Config.bSmallDisplay, gs->T("Small Display"))); if (pixel_xres < pixel_yres * 1.3) // Smaller than 4:3 graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch"))); #ifdef ANDROID graphicsSettings->Add(new CheckBox(&g_Config.bImmersiveMode, gs->T("Immersive Mode")))->OnClick.Handle(this, &GameSettingsScreen::OnImmersiveModeChange); #endif graphicsSettings->Add(new ItemHeader(gs->T("Performance"))); #ifndef MOBILE_DEVICE static const char *internalResolutions[] = {"Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP", "6x PSP", "7x PSP", "8x PSP", "9x PSP", "10x PSP" }; #else static const char *internalResolutions[] = {"Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; #endif resolutionChoice_ = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iInternalResolution, gs->T("Rendering Resolution"), internalResolutions, 0, ARRAY_SIZE(internalResolutions), gs, screenManager())); resolutionChoice_->OnClick.Handle(this, &GameSettingsScreen::OnResolutionChange); resolutionChoice_->SetEnabled(g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); #ifdef _WIN32 graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync"))); #endif graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping"))); graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform"))); CheckBox *swSkin = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareSkinning, gs->T("Software Skinning"))); CheckBox *vtxCache = graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache"))); vtxCache->SetEnabledPtr((bool *)&g_Config.bHardwareTransform); graphicsSettings->Add(new CheckBox(&g_Config.bTextureBackoffCache, gs->T("Lazy texture caching", "Lazy texture caching (speedup)"))); graphicsSettings->Add(new CheckBox(&g_Config.bTextureSecondaryCache, gs->T("Retain changed textures", "Retain changed textures (speedup, mem hog)"))); // Seems solid, so we hide the setting. // CheckBox *vtxJit = graphicsSettings->Add(new CheckBox(&g_Config.bVertexDecoderJit, gs->T("Vertex Decoder JIT"))); if (PSP_IsInited()) { swSkin->SetEnabled(false); // vtxJit->SetEnabled(false); } graphicsSettings->Add(new CheckBox(&g_Config.bLowQualitySplineBezier, gs->T("LowCurves", "Low quality spline/bezier curves"))); // In case we're going to add few other antialiasing option like MSAA in the future. // graphicsSettings->Add(new CheckBox(&g_Config.bFXAA, gs->T("FXAA"))); graphicsSettings->Add(new ItemHeader(gs->T("Texture Scaling"))); #ifndef MOBILE_DEVICE static const char *texScaleLevelsNPOT[] = {"Auto", "Off", "2x", "3x", "4x", "5x"}; static const char *texScaleLevelsPOT[] = {"Auto", "Off", "2x", "4x"}; #else static const char *texScaleLevelsNPOT[] = {"Auto", "Off", "2x", "3x"}; static const char *texScaleLevelsPOT[] = {"Auto", "Off", "2x"}; #endif static const char **texScaleLevels; static int numTexScaleLevels; if (gl_extensions.OES_texture_npot) { texScaleLevels = texScaleLevelsNPOT; numTexScaleLevels = ARRAY_SIZE(texScaleLevelsNPOT); } else { texScaleLevels = texScaleLevelsPOT; numTexScaleLevels = ARRAY_SIZE(texScaleLevelsPOT); } graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingLevel, gs->T("Upscale Level"), texScaleLevels, 0, numTexScaleLevels, gs, screenManager())); static const char *texScaleAlgos[] = { "xBRZ", "Hybrid", "Bicubic", "Hybrid + Bicubic", }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gs->T("Upscale Type"), texScaleAlgos, 0, ARRAY_SIZE(texScaleAlgos), gs, screenManager())); graphicsSettings->Add(new CheckBox(&g_Config.bTexDeposterize, gs->T("Deposterize"))); graphicsSettings->Add(new ItemHeader(gs->T("Texture Filtering"))); static const char *anisoLevels[] = { "Off", "2x", "4x", "8x", "16x" }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAnisotropyLevel, gs->T("Anisotropic Filtering"), anisoLevels, 0, ARRAY_SIZE(anisoLevels), gs, screenManager())); static const char *texFilters[] = { "Auto", "Nearest", "Linear", "Linear on FMV", }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), gs, screenManager())); graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings", "Hack Settings (these WILL cause glitches)"))); graphicsSettings->Add(new CheckBox(&g_Config.bTimerHack, gs->T("Timer Hack"))); // Maybe hide this on non-PVR? graphicsSettings->Add(new CheckBox(&g_Config.bDisableAlphaTest, gs->T("Disable Alpha Test (PowerVR speedup)")))->OnClick.Handle(this, &GameSettingsScreen::OnShaderChange); graphicsSettings->Add(new CheckBox(&g_Config.bDisableStencilTest, gs->T("Disable Stencil Test"))); graphicsSettings->Add(new CheckBox(&g_Config.bAlwaysDepthWrite, gs->T("Always Depth Write"))); CheckBox *prescale = graphicsSettings->Add(new CheckBox(&g_Config.bPrescaleUV, gs->T("Texture Coord Speedhack"))); if (PSP_IsInited()) prescale->SetEnabled(false); graphicsSettings->Add(new ItemHeader(gs->T("Overlay Information"))); static const char *fpsChoices[] = { "None", "Speed", "FPS", "Both" #ifdef BLACKBERRY , "Statistics" #endif }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, ARRAY_SIZE(fpsChoices), gs, screenManager())); graphicsSettings->Add(new CheckBox(&showDebugStats_, gs->T("Show Debug Statistics"))); // Developer tools are not accessible ingame, so it goes here. graphicsSettings->Add(new ItemHeader(gs->T("Debugging"))); Choice *dump = graphicsSettings->Add(new Choice(gs->T("Dump next frame to log"))); dump->OnClick.Handle(this, &GameSettingsScreen::OnDumpNextFrameToLog); if (!PSP_IsInited()) dump->SetEnabled(false); // We normally use software rendering to debug so put it in debugging. CheckBox *softwareGPU = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareRendering, gs->T("Software Rendering", "Software Rendering (experimental)"))); if (PSP_IsInited()) softwareGPU->SetEnabled(false); // Audio ViewGroup *audioSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *audioSettings = new LinearLayout(ORIENT_VERTICAL); audioSettings->SetSpacing(0); audioSettingsScroll->Add(audioSettings); tabHolder->AddTab(ms->T("Audio"), audioSettingsScroll); audioSettings->Add(new ItemHeader(ms->T("Audio"))); PopupSliderChoice *sfxVol = audioSettings->Add(new PopupSliderChoice(&g_Config.iSFXVolume, 0, MAX_CONFIG_VOLUME, a->T("SFX volume"), screenManager())); sfxVol->SetEnabledPtr(&g_Config.bEnableSound); PopupSliderChoice *bgmVol = audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, MAX_CONFIG_VOLUME, a->T("BGM volume"), screenManager())); bgmVol->SetEnabledPtr(&g_Config.bEnableSound); audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound"))); CheckBox *lowAudio = audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio"))); lowAudio->SetEnabledPtr(&g_Config.bEnableSound); // Control ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *controlsSettings = new LinearLayout(ORIENT_VERTICAL); controlsSettings->SetSpacing(0); controlsSettingsScroll->Add(controlsSettings); tabHolder->AddTab(ms->T("Controls"), controlsSettingsScroll); controlsSettings->Add(new ItemHeader(ms->T("Controls"))); controlsSettings->Add(new Choice(c->T("Control Mapping")))->OnClick.Handle(this, &GameSettingsScreen::OnControlMapping); #if defined(MOBILE_DEVICE) controlsSettings->Add(new CheckBox(&g_Config.bHapticFeedback, c->T("HapticFeedback", "Haptic Feedback (vibration)"))); static const char *tiltTypes[] = { "None (Disabled)", "Analog Stick", "D-PAD", "PSP Action Buttons"}; controlsSettings->Add(new PopupMultiChoice(&g_Config.iTiltInputType, c->T("Tilt Input Type"), tiltTypes, 0, ARRAY_SIZE(tiltTypes), c, screenManager()))->OnClick.Handle(this, &GameSettingsScreen::OnTiltTypeChange); Choice *customizeTilt = controlsSettings->Add(new Choice(c->T("Customize tilt"))); customizeTilt->OnClick.Handle(this, &GameSettingsScreen::OnTiltCuztomize); customizeTilt->SetEnabledPtr((bool *)&g_Config.iTiltInputType); //<- dirty int-to-bool cast #endif controlsSettings->Add(new ItemHeader(c->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls"))); layoutEditorChoice_ = controlsSettings->Add(new Choice(c->T("Custom layout..."))); layoutEditorChoice_->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlLayout); layoutEditorChoice_->SetEnabledPtr(&g_Config.bShowTouchControls); // On systems that aren't Symbian, iOS, and Meego Harmattan, offer to let the user see this button. // Some Windows touch devices don't have a back button or other button to call up the menu. #if !defined(__SYMBIAN32__) && !defined(IOS) && !defined(MEEGO_EDITION_HARMATTAN) CheckBox *enablePauseBtn = controlsSettings->Add(new CheckBox(&g_Config.bShowTouchPause, c->T("Show Touch Pause Menu Button"))); // Don't allow the user to disable it once in-game, so they can't lock themselves out of the menu. enablePauseBtn->SetEnabled(!PSP_IsInited()); #endif CheckBox *disableDiags = controlsSettings->Add(new CheckBox(&g_Config.bDisableDpadDiagonals, c->T("Disable D-Pad diagonals (4-way touch)"))); disableDiags->SetEnabledPtr(&g_Config.bShowTouchControls); View *opacity = controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 100, c->T("Button Opacity"), screenManager())); opacity->SetEnabledPtr(&g_Config.bShowTouchControls); static const char *touchControlStyles[] = {"Classic", "Thin borders"}; View *style = controlsSettings->Add(new PopupMultiChoice(&g_Config.iTouchButtonStyle, c->T("Button style"), touchControlStyles, 0, ARRAY_SIZE(touchControlStyles), c, screenManager())); style->SetEnabledPtr(&g_Config.bShowTouchControls); #if defined(USING_WIN_UI) controlsSettings->Add(new ItemHeader(c->T("Keyboard", "Keyboard Control Settings"))); controlsSettings->Add(new CheckBox(&g_Config.bIgnoreWindowsKey, c->T("Ignore Windows Key"))); #endif // System ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *systemSettings = new LinearLayout(ORIENT_VERTICAL); systemSettings->SetSpacing(0); systemSettingsScroll->Add(systemSettings); tabHolder->AddTab(ms->T("System"), systemSettingsScroll); systemSettings->Add(new ItemHeader(s->T("UI Language"))); systemSettings->Add(new Choice(dev->T("Language", "Language")))->OnClick.Handle(this, &GameSettingsScreen::OnLanguage); systemSettings->Add(new ItemHeader(s->T("Emulation"))); systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (Unstable)"))); systemSettings->Add(new CheckBox(&g_Config.bSeparateCPUThread, s->T("Multithreaded (experimental)")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new CheckBox(&g_Config.bSeparateIOThread, s->T("I/O on thread (experimental)")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new PopupSliderChoice(&g_Config.iLockedCPUSpeed, 0, 1000, s->T("Change CPU Clock", "Change CPU Clock (0 = default) (unstable)"), screenManager())); #ifndef MOBILE_DEVICE systemSettings->Add(new PopupSliderChoice(&g_Config.iRewindFlipFrequency, 0, 1800, s->T("Rewind Snapshot Frequency", "Rewind Snapshot Frequency (0 = off, mem hog)"), screenManager())); #endif systemSettings->Add(new CheckBox(&g_Config.bAtomicAudioLocks, s->T("Atomic Audio locks (experimental)")))->SetEnabled(!PSP_IsInited()); systemSettings->Add(new ItemHeader(s->T("Developer Tools"))); systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools); systemSettings->Add(new ItemHeader(s->T("General"))); #ifdef ANDROID static const char *screenRotation[] = {"Auto", "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed"}; PopupMultiChoice *rot = systemSettings->Add(new PopupMultiChoice(&g_Config.iScreenRotation, c->T("Screen Rotation"), screenRotation, 0, ARRAY_SIZE(screenRotation), c, screenManager())); rot->OnChoice.Handle(this, &GameSettingsScreen::OnScreenRotation); #endif systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, s->T("VersionCheck", "Check for new versions of PPSSPP"))); systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents); systemSettings->Add(new Choice(s->T("Restore Default Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnRestoreDefaultSettings); systemSettings->Add(new CheckBox(&g_Config.bEnableAutoLoad, s->T("Auto Load Newest Savestate"))); enableReports_ = Reporting::IsEnabled(); enableReportsCheckbox_ = new CheckBox(&enableReports_, s->T("Enable Compatibility Server Reports")); enableReportsCheckbox_->SetEnabled(Reporting::IsSupported()); systemSettings->Add(enableReportsCheckbox_); systemSettings->Add(new ItemHeader(s->T("Networking"))); systemSettings->Add(new CheckBox(&g_Config.bEnableWlan, s->T("Enable networking", "Enable networking/wlan (beta)"))); //#ifndef ANDROID systemSettings->Add(new ItemHeader(s->T("Cheats", "Cheats (experimental, see forums)"))); systemSettings->Add(new CheckBox(&g_Config.bEnableCheats, s->T("Enable Cheats"))); //#endif LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); systemSettings->SetSpacing(0); systemSettings->Add(new ItemHeader(s->T("PSP Settings"))); static const char *models[] = {"PSP-1000" , "PSP-2000/3000"}; systemSettings->Add(new PopupMultiChoice(&g_Config.iPSPModel, s->T("PSP Model"), models, 0, ARRAY_SIZE(models), s, screenManager())); // TODO: Come up with a way to display a keyboard for mobile users, // so until then, this is Windows/Desktop only. #if defined(_WIN32) || defined(USING_QT_UI) systemSettings->Add(new Choice(s->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); #endif #if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE)) // Screenshot functionality is not yet available on non-Windows/non-Qt systemSettings->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, s->T("Screenshots as PNG"))); #endif systemSettings->Add(new CheckBox(&g_Config.bDayLightSavings, s->T("Day Light Saving"))); static const char *dateFormat[] = { "YYYYMMDD", "MMDDYYYY", "DDMMYYYY"}; systemSettings->Add(new PopupMultiChoice(&g_Config.iDateFormat, s->T("Date Format"), dateFormat, 1, 3, s, screenManager())); static const char *timeFormat[] = { "12HR", "24HR"}; systemSettings->Add(new PopupMultiChoice(&g_Config.iTimeFormat, s->T("Time Format"), timeFormat, 1, 2, s, screenManager())); static const char *buttonPref[] = { "Use O to confirm", "Use X to confirm" }; systemSettings->Add(new PopupMultiChoice(&g_Config.iButtonPreference, s->T("Confirmation Button"), buttonPref, 0, 2, s, screenManager())); }
void GameSettingsScreen::CreateViews() { GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true); // Information in the top left. // Back button to the bottom left. // Scrolling action menu to the right. using namespace UI; I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *c = GetI18NCategory("Controls"); I18NCategory *a = GetI18NCategory("Audio"); I18NCategory *s = GetI18NCategory("System"); Margins actionMenuMargins(0, 0, 15, 0); root_ = new LinearLayout(ORIENT_HORIZONTAL); ViewGroup *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); root_->Add(leftColumn); leftColumn->Add(new Spacer(new LinearLayoutParams(1.0))); leftColumn->Add(new Choice("Back"))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new LinearLayoutParams(600, FILL_PARENT, actionMenuMargins)); root_->Add(tabHolder); // TODO: These currently point to global settings, not game specific ones. ViewGroup *graphicsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *graphicsSettings = new LinearLayout(ORIENT_VERTICAL); graphicsSettingsScroll->Add(graphicsSettings); tabHolder->AddTab("Graphics", graphicsSettingsScroll); graphicsSettings->Add(new CheckBox(&g_Config.bNearestFiltering, gs->T("Force Nearest Filtering"))); graphicsSettings->Add(new CheckBox(&g_Config.bLinearFiltering, gs->T("Force Linear Filtering"))); graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display"))); graphicsSettings->Add(new CheckBox(&g_Config.bBufferedRendering, gs->T("Buffered Rendering"))); graphicsSettings->Add(new CheckBox(&g_Config.bDisplayFramebuffer, gs->T("Display Raw Framebuffer"))); graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping"))); graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache"))); graphicsSettings->Add(new CheckBox(&g_Config.bUseVBO, gs->T("Stream VBO"))); graphicsSettings->Add(new CheckBox(&g_Config.SSAntiAliasing, gs->T("Anti Aliasing"))); // graphicsSettings->Add(new CheckBox(&g_Config.iShowFPSCounter, gs->T("Show FPS"))); ViewGroup *audioSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *audioSettings = new LinearLayout(ORIENT_VERTICAL); audioSettingsScroll->Add(audioSettings); tabHolder->AddTab("Audio", audioSettingsScroll); audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound"))); audioSettings->Add(new CheckBox(&g_Config.bEnableAtrac3plus, a->T("Enable Atrac3+"))); audioSettings->Add(new Choice(a->T("Download Atrac3+ plugin")))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin); ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *controlsSettings = new LinearLayout(ORIENT_VERTICAL); controlsSettingsScroll->Add(controlsSettings); tabHolder->AddTab("Controls", controlsSettingsScroll); controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls"))); controlsSettings->Add(new CheckBox(&g_Config.bLargeControls, c->T("Large Controls"))); controlsSettings->Add(new CheckBox(&g_Config.bShowAnalogStick, c->T("Show Analog Stick"))); controlsSettings->Add(new CheckBox(&g_Config.bAccelerometerToAnalogHoriz, c->T("Tilt", "Tilt to Analog (horizontal)"))); ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *systemSettings = new LinearLayout(ORIENT_VERTICAL); systemSettingsScroll->Add(systemSettings); tabHolder->AddTab("System", systemSettingsScroll); systemSettings->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)"))); systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (unstable)"))); }
void SetBackgroundPopupScreen::CreatePopupContents(UI::ViewGroup *parent) { I18NCategory *ga = GetI18NCategory("Game"); parent->Add(new UI::TextView(ga->T("One moment please..."), ALIGN_LEFT | ALIGN_VCENTER, false, new UI::LinearLayoutParams(UI::Margins(10, 0, 10, 10)))); }