Skip to content

Commit

Permalink
Add some options.
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaMoo committed Dec 10, 2017
1 parent 93a526d commit 2ed534f
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 4 deletions.
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ static ConfigSetting generalSettings[] = {
ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""),
ConfigSetting("ShowDebuggerOnLoad", &g_Config.bShowDebuggerOnLoad, false),
ConfigSetting("SimpleUI", &g_Config.bSimpleUI, true),
ConfigSetting("SimpleUIhide", &g_Config.bSimpleUIhide, false),
ConfigSetting("CheckForNewVersion", &g_Config.bCheckForNewVersion, false),
ConfigSetting("Language", &g_Config.sLanguageIni, &DefaultLangRegion),
ConfigSetting("ForceLagSync", &g_Config.bForceLagSync, false, true, true),
Expand Down
1 change: 1 addition & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ struct Config {
bool bFastMemory;
int iCpuCore;
bool bSimpleUI;
bool bSimpleUIhide;
bool bCheckForNewVersion;
bool bForceLagSync;
bool bFuncReplacements;
Expand Down
2 changes: 1 addition & 1 deletion Core/HLE/ThreadQueueList.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct ThreadQueueList {
cur = cur->next;
}

_dbg_assert_msg_(SCEKERNEL, false, "ThreadQueueList should not be empty.");
//_dbg_assert_msg_(SCEKERNEL, false, "ThreadQueueList should not be empty.");
return 0;
}

Expand Down
42 changes: 41 additions & 1 deletion UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ void GameSettingsScreen::CreateViews() {
if (!g_Config.bSimpleUI) {
tools->Add(new Choice(dev->T("System Information")))->OnClick.Handle(this, &GameSettingsScreen::OnSysInfo);
tools->Add(new Choice(sy->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools);
tools->Add(new Choice(sy->T("Other Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnOtherSettings);
}
tools->Add(new Choice(ri->T("Remote disc streaming")))->OnClick.Handle(this, &GameSettingsScreen::OnRemoteISO);

Expand Down Expand Up @@ -1033,7 +1034,11 @@ UI::EventReturn GameSettingsScreen::OnDumpNextFrameToLog(UI::EventParams &e) {

void GameSettingsScreen::update() {
UIScreen::update();
g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0;

if (g_Config.iForceMaxEmulatedFPS == 60 || g_Config.iForceMaxEmulatedFPS == 0)
g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0;
else
cap60FPS_ = false;

g_Config.iFpsLimit = (iAlternateSpeedPercent_ * 60) / 100;

Expand Down Expand Up @@ -1181,6 +1186,11 @@ UI::EventReturn GameSettingsScreen::OnDeveloperTools(UI::EventParams &e) {
return UI::EVENT_DONE;
}

UI::EventReturn GameSettingsScreen::OnOtherSettings(UI::EventParams &e) {
screenManager()->push(new OtherSettingsScreen());
return UI::EVENT_DONE;
}

UI::EventReturn GameSettingsScreen::OnRemoteISO(UI::EventParams &e) {
screenManager()->push(new RemoteISOScreen());
return UI::EVENT_DONE;
Expand Down Expand Up @@ -1288,6 +1298,36 @@ void DeveloperToolsScreen::onFinish(DialogResult result) {
g_Config.Save();
}


void OtherSettingsScreen::CreateViews() {
using namespace UI;
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
ScrollView *settingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
settingsScroll->SetTag("OtherSettings");
root_->Add(settingsScroll);

I18NCategory *gr = GetI18NCategory("Graphics");
I18NCategory *sy = GetI18NCategory("System");

AddStandardBack(root_);

LinearLayout *list = settingsScroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->SetSpacing(0);

list->Add(new ItemHeader(sy->T("Settings that should not be changed by most users")));
list->Add(new CheckBox(&g_Config.bEncryptSave, sy->T("Encrypt savedata")));
list->Add(new CheckBox(&g_Config.bSavedataUpgrade, sy->T("Allow savedata with wrong encryption(unsafe workaround for outdated PSP savedata)")));
list->Add(new CheckBox(&g_Config.bFrameSkipUnthrottle, gr->T("Frameskip unthrottle(good for CPU benchmark)")));
list->Add(new CheckBox(&g_Config.bTrueColor, gr->T("True Color(Disable to get PSP colors)")));
PopupSliderChoice *emulatedSpeed = list->Add(new PopupSliderChoice(&g_Config.iForceMaxEmulatedFPS, 0, 60, gr->T("Force Max Emulated FPS(affects speed in most games!)"), 1, screenManager(), gr->T("FPS, 0:Disabled")));
emulatedSpeed->SetFormat("%i FPS");
emulatedSpeed->SetZeroLabel(gr->T("Disabled"));
}

void OtherSettingsScreen::onFinish(DialogResult result) {
g_Config.Save();
}

void GameSettingsScreen::CallbackRestoreDefaults(bool yes) {
if (yes)
g_Config.RestoreDefaults();
Expand Down
13 changes: 13 additions & 0 deletions UI/GameSettingsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class GameSettingsScreen : public UIDialogScreenWithGameBackground {
UI::EventReturn OnPostProcShader(UI::EventParams &e);
UI::EventReturn OnPostProcShaderChange(UI::EventParams &e);
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
UI::EventReturn OnOtherSettings(UI::EventParams &e);
UI::EventReturn OnRemoteISO(UI::EventParams &e);
UI::EventReturn OnChangeNickname(UI::EventParams &e);
UI::EventReturn OnChangeproAdhocServerAddress(UI::EventParams &e);
Expand Down Expand Up @@ -157,6 +158,18 @@ class DeveloperToolsScreen : public UIDialogScreenWithBackground {
UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);
};

class OtherSettingsScreen : public UIDialogScreenWithBackground {
public:
OtherSettingsScreen() {}
void onFinish(DialogResult result) override;

protected:
void CreateViews() override;

private:
bool QualityDepth_;
};

class ProAdhocServerScreen : public UIDialogScreenWithBackground {
public:
ProAdhocServerScreen() {}
Expand Down
3 changes: 2 additions & 1 deletion UI/MainScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ void MainScreen::CreateViews() {
#endif
rightColumnItems->Add(new Choice(mm->T("Game Settings", "Settings")))->OnClick.Handle(this, &MainScreen::OnGameSettings);
rightColumnItems->Add(new Choice(mm->T("Credits")))->OnClick.Handle(this, &MainScreen::OnCredits);
rightColumnItems->Add(new CheckBox(&g_Config.bSimpleUI, mm->T("SimpleUI", "Simple UI")))->OnClick.Handle(this, &MainScreen::OnRecentChange);
if (!g_Config.bSimpleUIhide)
rightColumnItems->Add(new CheckBox(&g_Config.bSimpleUI, mm->T("SimpleUI", "Simple UI")))->OnClick.Handle(this, &MainScreen::OnRecentChange);
if (!g_Config.bSimpleUI) {
rightColumnItems->Add(new Choice(mm->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg);
if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) {
Expand Down
3 changes: 2 additions & 1 deletion UI/UI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
<ProjectGuid>{004B8D11-2BE3-4BD9-AB40-2BE04CF2096F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>UI</RootNamespace>
<WindowsTargetPlatformVersion></WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>
</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down
31 changes: 31 additions & 0 deletions Windows/MainWindowMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace MainWindow {
MENU_DEBUG = 2,
MENU_OPTIONS = 3,
MENU_HELP = 4,
MENU_SIMPLEUI = 5,

// File submenus
SUBMENU_FILE_SAVESTATE_SLOT = 6,
Expand Down Expand Up @@ -159,6 +160,23 @@ namespace MainWindow {
AppendMenu(helpMenu, MF_STRING | MF_BYCOMMAND, ID_HELP_ABOUT, aboutPPSSPP.c_str());
}

void CreateSimpleUIMenu(HMENU menu) {
I18NCategory *des = GetI18NCategory("DesktopUI");

const std::wstring simpleUI = ConvertUTF8ToWString(des->T("Simple UI"));
const std::wstring enable = ConvertUTF8ToWString(des->T("Enable"));
const std::wstring hide = ConvertUTF8ToWString(des->T("Hide from main menu"));

// Simply remove the old help menu and create a new one.
RemoveMenu(menu, MENU_SIMPLEUI, MF_BYPOSITION);

HMENU simpleUImenu = CreatePopupMenu();
InsertMenu(menu, MENU_SIMPLEUI, MF_POPUP | MF_STRING | MF_BYPOSITION, (UINT_PTR)simpleUImenu, simpleUI.c_str());

AppendMenu(simpleUImenu, MF_STRING | MF_BYCOMMAND, ID_SIMPLEUI_TOGGLE, enable.c_str());
AppendMenu(simpleUImenu, MF_STRING | MF_BYCOMMAND, ID_SIMPLEUI_HIDE, hide.c_str());
}

void UpdateDynamicMenuCheckmarks(HMENU menu) {
int item = ID_SHADERS_BASE + 1;

Expand Down Expand Up @@ -250,6 +268,7 @@ namespace MainWindow {
TranslateMenu(menu, "Debugging", MENU_DEBUG);
TranslateMenu(menu, "Game Settings", MENU_OPTIONS);
TranslateMenu(menu, "Help", MENU_HELP);
TranslateMenu(menu, "Help", MENU_SIMPLEUI);

// File menu
TranslateMenuItem(menu, ID_FILE_LOAD);
Expand Down Expand Up @@ -352,6 +371,7 @@ namespace MainWindow {

// Help menu: it's translated in CreateHelpMenu.
CreateHelpMenu(menu);
CreateSimpleUIMenu(menu);
}

void TranslateMenus(HWND hWnd, HMENU menu) {
Expand Down Expand Up @@ -1034,6 +1054,15 @@ namespace MainWindow {
g_Config.bDumpAudio = !g_Config.bDumpAudio;
break;

case ID_SIMPLEUI_TOGGLE:
g_Config.bSimpleUI = !g_Config.bSimpleUI;
NativeMessageReceived("recreateviews", "");
break;
case ID_SIMPLEUI_HIDE:
g_Config.bSimpleUIhide = !g_Config.bSimpleUIhide;
NativeMessageReceived("recreateviews", "");
break;

default:
{
// Handle the dynamic shader switching here.
Expand Down Expand Up @@ -1078,6 +1107,8 @@ namespace MainWindow {
CHECKITEM(ID_FILE_DUMPFRAMES, g_Config.bDumpFrames);
CHECKITEM(ID_FILE_USEFFV1, g_Config.bUseFFV1);
CHECKITEM(ID_FILE_DUMPAUDIO, g_Config.bDumpAudio);
CHECKITEM(ID_SIMPLEUI_TOGGLE, g_Config.bSimpleUI);
CHECKITEM(ID_SIMPLEUI_HIDE, g_Config.bSimpleUIhide);

static const int displayrotationitems[] = {
ID_EMULATION_ROTATION_H,
Expand Down
2 changes: 2 additions & 0 deletions Windows/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
#define ID_FILE_DUMPAUDIO 40167
#define ID_HELP_GITHUB 40168
#define IDC_GEDBG_RECORD 40169
#define ID_SIMPLEUI_TOGGLE 40200
#define ID_SIMPLEUI_HIDE 40201

// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
Expand Down

0 comments on commit 2ed534f

Please sign in to comment.