void SavedataScreen::CreateViews() { using namespace UI; I18NCategory *sa = GetI18NCategory("Savedata"); I18NCategory *di = GetI18NCategory("Dialog"); std::string savedata_dir = GetSysDirectory(DIRECTORY_SAVEDATA); std::string savestate_dir = GetSysDirectory(DIRECTORY_SAVESTATE); gridStyle_ = false; root_ = new LinearLayout(ORIENT_VERTICAL); TabHolder *tabs = new TabHolder(ORIENT_HORIZONTAL, 64, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f)); tabs->SetTag("Savedata"); ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); scroll->SetTag("SavedataBrowser"); browser_ = scroll->Add(new SavedataBrowser(savedata_dir, new LayoutParams(FILL_PARENT, FILL_PARENT))); browser_->OnChoice.Handle(this, &SavedataScreen::OnSavedataButtonClick); tabs->AddTab(sa->T("Save Data"), scroll); ScrollView *scroll2 = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); scroll2->SetTag("SavedataStatesBrowser"); SavedataBrowser *browser2 = scroll2->Add(new SavedataBrowser(savestate_dir)); browser2->OnChoice.Handle(this, &SavedataScreen::OnSavedataButtonClick); tabs->AddTab(sa->T("Save States"), scroll2); root_->Add(tabs); root_->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); }
void TouchControlLayoutScreen::CreateViews() { // setup g_Config for button layout const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); InitPadLayout(bounds.w, bounds.h); local_dp_xres = bounds.w; local_dp_yres = bounds.h; using namespace UI; I18NCategory *co = GetI18NCategory("Controls"); I18NCategory *di = GetI18NCategory("Dialog"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); Choice *reset = new Choice(di->T("Reset"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 84)); Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10)); Choice *visibility = new Choice(co->T("Visibility"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158)); // controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, co->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(di->T("Move")); mode_->AddChoice(di->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)); tabHolder->SetTag("TouchControlLayout"); 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); int rectImage = g_Config.iTouchButtonStyle ? I_RECT_LINE : I_RECT; int shoulderImage = g_Config.iTouchButtonStyle ? I_SHOULDER_LINE : I_SHOULDER; int dirImage = g_Config.iTouchButtonStyle ? I_DIR_LINE : I_DIR; int stickImage = g_Config.iTouchButtonStyle ? I_STICK_LINE : I_STICK; int stickBg = g_Config.iTouchButtonStyle ? I_STICK_BG_LINE : I_STICK_BG; int roundImage = g_Config.iTouchButtonStyle ? I_ROUND_LINE : I_ROUND; const int comboKeyImages[5] = { I_1, I_2, I_3, I_4, I_5 }; 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, rectImage, I_SELECT, g_Config.fSelectKeyScale)); } if (g_Config.bShowTouchStart) { controls_.push_back(new DragDropButton(g_Config.fStartKeyX, g_Config.fStartKeyY, rectImage, I_START, g_Config.fStartKeyScale)); } if (g_Config.bShowTouchUnthrottle) { DragDropButton *unthrottle = new DragDropButton(g_Config.fUnthrottleKeyX, g_Config.fUnthrottleKeyY, rectImage, 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, shoulderImage, I_L, g_Config.fLKeyScale)); } if (g_Config.bShowTouchRTrigger) { DragDropButton *rbutton = new DragDropButton(g_Config.fRKeyX, g_Config.fRKeyY, shoulderImage, 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, stickBg, stickImage, g_Config.fAnalogStickScale)); } if (g_Config.bShowComboKey0) { controls_.push_back(new DragDropButton(g_Config.fcombo0X, g_Config.fcombo0Y, roundImage, comboKeyImages[0], g_Config.fcomboScale0)); } if (g_Config.bShowComboKey1) { controls_.push_back(new DragDropButton(g_Config.fcombo1X, g_Config.fcombo1Y, roundImage, comboKeyImages[1], g_Config.fcomboScale1)); } if (g_Config.bShowComboKey2) { controls_.push_back(new DragDropButton(g_Config.fcombo2X, g_Config.fcombo2Y, roundImage, comboKeyImages[2], g_Config.fcomboScale2)); } if (g_Config.bShowComboKey3) { controls_.push_back(new DragDropButton(g_Config.fcombo3X, g_Config.fcombo3Y, roundImage, comboKeyImages[3], g_Config.fcomboScale3)); } if (g_Config.bShowComboKey4) { controls_.push_back(new DragDropButton(g_Config.fcombo4X, g_Config.fcombo4Y, roundImage, comboKeyImages[4], g_Config.fcomboScale4)); }; for (size_t i = 0; i < controls_.size(); i++) { root_->Add(controls_[i]); } }
void SystemInfoScreen::CreateViews() { using namespace Draw; using namespace UI; // NOTE: Do not translate this section. It will change a lot and will be impossible to keep up. I18NCategory *di = GetI18NCategory("Dialog"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); AddStandardBack(root_); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 225, new AnchorLayoutParams(10, 0, 10, 0, false)); tabHolder->SetTag("DevSystemInfo"); root_->Add(tabHolder); ViewGroup *deviceSpecsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); deviceSpecsScroll->SetTag("DevSystemInfoDeviceSpecs"); 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)); #if defined(ARM) || defined(ARM64) || defined(MIPS) 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")); DrawContext *draw = screenManager()->getDrawContext(); deviceSpecs->Add(new InfoItem("3D API", std::string(draw->GetInfoString(InfoField::APINAME)))); deviceSpecs->Add(new InfoItem("Vendor", std::string(draw->GetInfoString(InfoField::VENDORSTRING)))); std::string vendor = draw->GetInfoString(InfoField::VENDOR); if (vendor.size()) deviceSpecs->Add(new InfoItem("Vendor (detected)", vendor)); deviceSpecs->Add(new InfoItem("Driver", draw->GetInfoString(InfoField::DRIVER))); #ifdef _WIN32 deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION))); #if !PPSSPP_PLATFORM(UWP) if (GetGPUBackend() == GPUBackend::DIRECT3D9) { deviceSpecs->Add(new InfoItem("D3DX Version", StringFromFormat("%d", GetD3DXVersion()))); } #endif #endif deviceSpecs->Add(new ItemHeader("OS Information")); deviceSpecs->Add(new InfoItem("Memory Page Size", StringFromFormat("%d bytes", GetMemoryProtectPageSize()))); deviceSpecs->Add(new InfoItem("RW/RX exclusive: ", PlatformIsWXExclusive() ? "Yes" : "No")); const char *build = "Release"; #ifdef _DEBUG build = "Debug"; #endif deviceSpecs->Add(new InfoItem("PPSSPP build: ", build)); #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; if (GetGPUBackend() == GPUBackend::OPENGL) { if (gl_extensions.IsGLES) { apiVersion = StringFromFormat("v%d.%d.%d ES", gl_extensions.ver[0], gl_extensions.ver[1], gl_extensions.ver[2]); } else { apiVersion = StringFromFormat("v%d.%d.%d", gl_extensions.ver[0], gl_extensions.ver[1], gl_extensions.ver[2]); } } else { apiVersion = draw->GetInfoString(InfoField::APIVERSION); if (apiVersion.size() > 30) apiVersion.resize(30); } deviceSpecs->Add(new InfoItem("API Version", apiVersion)); deviceSpecs->Add(new InfoItem("Shading Language", draw->GetInfoString(InfoField::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 ViewGroup *buildConfigScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); buildConfigScroll->SetTag("DevSystemInfoBuildConfig"); LinearLayout *buildConfig = new LinearLayout(ORIENT_VERTICAL); buildConfig->SetSpacing(0); buildConfigScroll->Add(buildConfig); tabHolder->AddTab("Build Config", buildConfigScroll); buildConfig->Add(new ItemHeader("Build Configuration")); #ifdef JENKINS buildConfig->Add(new InfoItem("Built by", "Jenkins")); #endif #ifdef _DEBUG buildConfig->Add(new InfoItem("_DEBUG", "")); #else buildConfig->Add(new InfoItem("NDEBUG", "")); #endif #ifdef USING_GLES2 buildConfig->Add(new InfoItem("USING_GLES2", "")); #endif #ifdef MOBILE_DEVICE buildConfig->Add(new InfoItem("MOBILE_DEVICE", "")); #endif if (System_GetPropertyInt(SYSPROP_APP_GOLD)) { buildConfig->Add(new InfoItem("GOLD", "")); } ViewGroup *cpuExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); cpuExtensionsScroll->SetTag("DevSystemInfoCPUExt"); 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]))->SetFocusable(true); } ViewGroup *oglExtensionsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); oglExtensionsScroll->SetTag("DevSystemInfoOGLExt"); LinearLayout *oglExtensions = new LinearLayout(ORIENT_VERTICAL); oglExtensions->SetSpacing(0); oglExtensionsScroll->Add(oglExtensions); if (g_Config.iGPUBackend == GPU_BACKEND_OPENGL) { tabHolder->AddTab("OGL Extensions", oglExtensionsScroll); if (!gl_extensions.IsGLES) { 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")); } 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)); eglExtensionsScroll->SetTag("DevSystemInfoEGLExt"); 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); } } } else if (g_Config.iGPUBackend == GPU_BACKEND_VULKAN) { tabHolder->AddTab("Vulkan Features", oglExtensionsScroll); oglExtensions->Add(new ItemHeader("Vulkan Features")); std::vector<std::string> features = draw->GetFeatureList(); for (auto &feature : features) { oglExtensions->Add(new TextView(feature))->SetFocusable(true); } } }