Show homebrew as a list by default, allow changing the view mode

Homebrew often has poor icons, making the names important.

Also fix an issue with touch button scaling.

Conflicts:
	Core/Config.cpp
	UI/MainScreen.cpp
This commit is contained in:
Henrik Rydgård 2013-11-29 16:46:47 +01:00
parent 2f7057eeb0
commit e017a17dbb
7 changed files with 49 additions and 44 deletions

View file

@ -92,7 +92,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
general->Get("RewindFlipFrequency", &iRewindFlipFrequency, 0);
general->Get("GridView1", &bGridView1, true);
general->Get("GridView2", &bGridView2, true);
general->Get("GridView3", &bGridView3, true);
general->Get("GridView3", &bGridView3, false);
// "default" means let emulator decide, "" means disable.
general->Get("ReportingHost", &sReportHost, "default");
@ -184,7 +184,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
#else
graphics->Get("VertexDecJit", &bVertexDecoderJit, true);
#endif
#ifdef _WIN32
graphics->Get("FullScreen", &bFullScreen, false);
#endif
@ -391,7 +391,7 @@ void Config::Save() {
}
IniFile::Section *general = iniFile.GetOrCreateSection("General");
// Need to do this somewhere...
bFirstRun = false;
general->Set("FirstRun", bFirstRun);
@ -439,7 +439,7 @@ void Config::Save() {
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);
cpu->Set("SeparateCPUThread", bSeparateCPUThread);
cpu->Set("AtomicAudioLocks", bAtomicAudioLocks);
cpu->Set("AtomicAudioLocks", bAtomicAudioLocks);
cpu->Set("SeparateIOThread", bSeparateIOThread);
cpu->Set("FastMemoryAccess", bFastMemory);
cpu->Set("CPUSpeed", iLockedCPUSpeed);
@ -496,7 +496,6 @@ void Config::Save() {
control->Set("ShowTouchUnthrottle", bShowTouchUnthrottle);
control->Set("ShowTouchDpad", bShowTouchDpad);
// control->Set("KeyMapping",iMappingMap);
#ifdef USING_GLES2
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
control->Set("TiltBaseX", fTiltBaseX);

View file

@ -26,6 +26,7 @@
#include "UI/EmuScreen.h"
#include "UI/GameSettingsScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/GamepadEmu.h"
#include "UI/MiscScreens.h"
#include "UI/ControlMappingScreen.h"
#include "UI/DevScreens.h"
@ -47,6 +48,7 @@ namespace MainWindow {
extern HWND hwndMain;
}
#endif
#ifdef IOS
extern bool iosCanUseJit;
#endif
@ -244,7 +246,8 @@ void GameSettingsScreen::CreateViews() {
layoutEditorChoice_->OnClick.Handle(this, &GameSettingsScreen::OnTouchControlLayout);
layoutEditorChoice_->SetEnabledPtr(&g_Config.bShowTouchControls);
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 PopupSliderChoiceFloat(&g_Config.fButtonScale, 0.80, 2.0, c->T("Button Scaling"), screenManager()))
->OnChange.Handle(this, &GameSettingsScreen::OnChangeControlScaling);
// System
ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
@ -291,7 +294,7 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new Choice(s->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname);
// Screenshot functionality is not yet available on non-Windows
systemSettings->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, s->T("Screenshots as PNG")));
#endif
#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()));
@ -301,6 +304,11 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new PopupMultiChoice(&g_Config.iButtonPreference, s->T("Confirmation Button"), buttonPref, 0, 2, s, screenManager()));
}
UI::EventReturn GameSettingsScreen::OnChangeControlScaling(UI::EventParams &e) {
UpdateDpadRadius();
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnRenderingMode(UI::EventParams &e) {
// We do not want to report when rendering mode is Framebuffer to memory - so many issues
// are caused by that (framebuffer copies overwriting display lists, etc).

View file

@ -69,6 +69,7 @@ private:
UI::EventReturn OnShaderChange(UI::EventParams &e);
UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e);
UI::EventReturn OnRenderingMode(UI::EventParams &e);
UI::EventReturn OnChangeControlScaling(UI::EventParams &e);
// Temporaries to convert bools to int settings
bool cap60FPS_;

View file

@ -269,45 +269,47 @@ void PSPStick::ProcessTouch(float x, float y, bool down) {
}
}
// Should we really have a specific float for dpad radius? There's no UI to change it.
void UpdateDpadRadius() {
float scale = g_Config.fButtonScale;
const int D_pad_Radius = 40 * scale;
g_Config.iDpadRadius = D_pad_Radius;
}
void InitPadLayout() {
// TODO: See if we can make some kind of global scaling for views instead of this hackery.
float scale = g_Config.fButtonScale;
//PSP buttons (triangle, circle, square, cross)---------------------
//space between the PSP buttons (triangle, circle, square and cross)
// PSP buttons (triangle, circle, square, cross)---------------------
// space between the PSP buttons (triangle, circle, square and cross)
const int Action_button_spacing = 50 * scale;
if (g_Config.iActionButtonSpacing == -1) {
g_Config.iActionButtonSpacing = Action_button_spacing;
}
//position of the circle button (the PSP circle button). It is the farthest to the left
// Position of the circle button (the PSP circle button). It is the farthest to the left
int Action_button_center_X = dp_xres - Action_button_spacing * 2;
int Action_button_center_Y = dp_yres - Action_button_spacing * 2;
if(g_Config.fActionButtonCenterX == -1.0 || g_Config.fActionButtonCenterY == -1.0 ) {
//setup defaults
if (g_Config.fActionButtonCenterX == -1.0 || g_Config.fActionButtonCenterY == -1.0) {
// Setup defaults
g_Config.fActionButtonCenterX = (float)Action_button_center_X / dp_xres;
g_Config.fActionButtonCenterY = (float)Action_button_center_Y / dp_yres;
}
//D-PAD (up down left right) (aka PSP cross)--------------------------------------------------------------
//D-PAD (up down left right) (aka PSP cross)----------------------------
//radius to the D-pad
UpdateDpadRadius();
const int D_pad_Radius = 40 * scale;
if (g_Config.iDpadRadius == -1) {
g_Config.iDpadRadius = D_pad_Radius;
}
int D_pad_X = 2.5 * D_pad_Radius;
int D_pad_Y = dp_yres - D_pad_Radius;
if (g_Config.bShowTouchAnalogStick) {
D_pad_Y -= 200 * scale;
}
if(g_Config.fDpadX == -1.0 || g_Config.fDpadY == -1.0 ) {
if (g_Config.fDpadX == -1.0 || g_Config.fDpadY == -1.0 ) {
//setup defaults
g_Config.fDpadX = (float)D_pad_X / dp_xres;
g_Config.fDpadY = (float)D_pad_Y / dp_yres;
@ -326,7 +328,7 @@ void InitPadLayout() {
//select, start, throttle--------------------------------------------
//space between the bottom keys (space between select, start and un-throttle)
const int bottom_key_spacing = 100 * scale;
int start_key_X = dp_xres / 2 + (bottom_key_spacing) * scale;
int start_key_Y = dp_yres - 60 * scale;

View file

@ -123,4 +123,5 @@ private:
//initializes the layout from Config. if a default layout does not exist,
//it sets up default values
void InitPadLayout();
void UpdateDpadRadius(); // TODO: get rid of somehow
UI::ViewGroup *CreatePadLayout(bool *pause);

View file

@ -311,23 +311,27 @@ void GameBrowser::Refresh() {
Add(new Spacer(5.0f));
I18NCategory *m = GetI18NCategory("MainMenu");
LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
if (allowBrowsing_) {
LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
Margins pathMargins(5, 0);
topBar->Add(new TextView(path_.GetFriendlyPath().c_str(), ALIGN_VCENTER, true, new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT, 1.0f, pathMargins)));
topBar->Add(new TextView(path_.GetFriendlyPath().c_str(), ALIGN_VCENTER, true, new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT, pathMargins)));
topBar->Add(new Spacer(new LinearLayoutParams(1.0f)));
#if defined(_WIN32) || defined(USING_QT_UI)
topBar->Add(new Choice(m->T("Browse", "Browse...")))->OnClick.Handle(this, &GameBrowser::HomeClick);
#else
topBar->Add(new Choice(m->T("Home")))->OnClick.Handle(this, &GameBrowser::HomeClick);
#endif
ChoiceStrip *layoutChoice = topBar->Add(new ChoiceStrip(ORIENT_HORIZONTAL));
layoutChoice->AddChoice(I_GRID);
layoutChoice->AddChoice(I_LINES);
layoutChoice->SetSelection(*gridStyle_ ? 0 : 1);
layoutChoice->OnChoice.Handle(this, &GameBrowser::LayoutChange);
Add(topBar);
} else {
topBar->Add(new Spacer(new LinearLayoutParams(1.0f)));
}
ChoiceStrip *layoutChoice = topBar->Add(new ChoiceStrip(ORIENT_HORIZONTAL));
layoutChoice->AddChoice(I_GRID);
layoutChoice->AddChoice(I_LINES);
layoutChoice->SetSelection(*gridStyle_ ? 0 : 1);
layoutChoice->OnChoice.Handle(this, &GameBrowser::LayoutChange);
Add(topBar);
if (*gridStyle_) {
gameList_ = new UI::GridLayout(UI::GridLayoutSettings(150, 85), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
} else {
@ -448,7 +452,6 @@ void MainScreen::CreateViews() {
m->T("How to get homebrew & demos", "How to get homebrew && demos"), "http://www.ppsspp.org/gethomebrew.html",
new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
scrollRecentGames->Add(tabRecentGames);
scrollAllGames->Add(tabAllGames);
scrollHomebrew->Add(tabHomebrew);
@ -464,20 +467,11 @@ void MainScreen::CreateViews() {
tabAllGames->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected);
tabHomebrew->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected);
if (g_Config.recentIsos.size() > 0) {
leftColumn->SetCurrentTab(0);
}else{
leftColumn->SetCurrentTab(1);
}
/*
if (info) {
texvGameIcon_ = leftColumn->Add(new TextureView(0, IS_DEFAULT, new AnchorLayoutParams(144 * 2, 80 * 2, 10, 10, NONE, NONE)));
tvTitle_ = leftColumn->Add(new TextView(0, info->title, ALIGN_LEFT, 1.0f, new AnchorLayoutParams(10, 200, NONE, NONE)));
tvGameSize_ = leftColumn->Add(new TextView(0, "...", ALIGN_LEFT, 1.0f, new AnchorLayoutParams(10, 250, NONE, NONE)));
tvSaveDataSize_ = leftColumn->Add(new TextView(0, "...", ALIGN_LEFT, 1.0f, new AnchorLayoutParams(10, 290, NONE, NONE)));
}
*/
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL);
LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
@ -514,8 +508,8 @@ void MainScreen::CreateViews() {
if (vertical) {
root_ = new LinearLayout(ORIENT_VERTICAL);
rightColumn->ReplaceLayoutParams(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0));
root_->Add(rightColumn);
leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0));
root_->Add(rightColumn);
root_->Add(leftColumn);
} else {
root_ = new LinearLayout(ORIENT_HORIZONTAL);
@ -714,7 +708,7 @@ GamePauseScreen::~GamePauseScreen() {
}
void GamePauseScreen::CreateViews() {
static const int NUM_SAVESLOTS = 5;
static const int NUM_SAVESLOTS = 5;
using namespace UI;
Margins actionMenuMargins(0, 100, 15, 0);

2
native

@ -1 +1 @@
Subproject commit 81249616761d6b80535e6121b2087cbe8065b780
Subproject commit 8391f2ac810b35e86349efd94709287e919ed18a