From 26c5ee4a6d06acdd406b99e67629b13a9bc5656d Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 7 Sep 2013 13:38:37 +0200 Subject: [PATCH] Add screen to control debug levels. Will make it easier to access later. --- CMakeLists.txt | 1 + Common/LogManager.cpp | 106 ++++++++++++++------------- Common/LogManager.h | 59 ++++++++------- UI/DevScreens.cpp | 103 ++++++++++++++++++++++++++ UI/DevScreens.h | 44 ++++++++++++ UI/GameSettingsScreen.cpp | 148 +++----------------------------------- UI/GameSettingsScreen.h | 1 + UI/MiscScreens.cpp | 38 +--------- UI/MiscScreens.h | 5 -- UI/UI.vcxproj | 2 + UI/UI.vcxproj.filters | 6 ++ android/jni/Android.mk | 1 + native | 2 +- 13 files changed, 257 insertions(+), 259 deletions(-) create mode 100644 UI/DevScreens.cpp create mode 100644 UI/DevScreens.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b17247ab5..3a37a4300 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1131,6 +1131,7 @@ endif() set(NativeAppSource UI/NativeApp.cpp + UI/DevScreens.cpp UI/EmuScreen.cpp android/jni/TestRunner.cpp UI/GameInfoCache.cpp diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 2e9e04fc0..ae6308b39 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -47,7 +47,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, va_end(args); } -LogManager *LogManager::m_logManager = NULL; +LogManager *LogManager::logManager_ = NULL; struct LogNameTableEntry { LogTypes::LOG_TYPE logType; @@ -62,9 +62,9 @@ static const LogNameTableEntry logTable[] = { {LogTypes::CPU ,"CPU", "CPU"}, {LogTypes::LOADER ,"LOAD", "Loader"}, {LogTypes::IO ,"IO", "IO"}, - {LogTypes::DISCIO ,"DIO", "DiscIO"}, {LogTypes::PAD ,"PAD", "Pad"}, {LogTypes::FILESYS ,"FileSys", "File System"}, + {LogTypes::DISCIO ,"DIO", "DiscIO"}, {LogTypes::G3D ,"G3D", "3D Graphics"}, {LogTypes::DMA ,"DMA", "DMA"}, {LogTypes::INTC ,"INTC", "Interrupts"}, @@ -81,75 +81,76 @@ static const LogNameTableEntry logTable[] = { LogManager::LogManager() { for (size_t i = 0; i < ARRAY_SIZE(logTable); i++) { - m_Log[logTable[i].logType] = new LogContainer(logTable[i].name, logTable[i].longName); + if (i != logTable[i].logType) { + FLOG("Bad logtable at %i", i); + } + log_[logTable[i].logType] = new LogChannel(logTable[i].name, logTable[i].longName); } // Remove file logging on small devices #if !defined(USING_GLES2) || defined(_DEBUG) - m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); - m_consoleLog = new ConsoleListener(); - m_debuggerLog = new DebuggerLogListener(); + fileLog_ = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); + consoleLog_ = new ConsoleListener(); + debuggerLog_ = new DebuggerLogListener(); #else - m_fileLog = NULL; - m_consoleLog = NULL; - m_debuggerLog = NULL; + fileLog_ = NULL; + consoleLog_ = NULL; + debuggerLog_ = NULL; #endif for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { - m_Log[i]->SetEnable(true); + log_[i]->SetEnable(true); #if !defined(USING_GLES2) || defined(_DEBUG) - m_Log[i]->AddListener(m_fileLog); - m_Log[i]->AddListener(m_consoleLog); + log_[i]->AddListener(fileLog_); + log_[i]->AddListener(consoleLog_); #ifdef _MSC_VER - if (IsDebuggerPresent() && m_debuggerLog != NULL && LOG_MSC_OUTPUTDEBUG) - m_Log[i]->AddListener(m_debuggerLog); + if (IsDebuggerPresent() && debuggerLog_ != NULL && LOG_MSC_OUTPUTDEBUG) + log_[i]->AddListener(debuggerLog_); #endif #endif } } -LogManager::~LogManager() -{ - for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - { +LogManager::~LogManager() { + for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { #if !defined(USING_GLES2) || defined(_DEBUG) - if (m_fileLog != NULL) - m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog); - m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_consoleLog); + if (fileLog_ != NULL) + logManager_->RemoveListener((LogTypes::LOG_TYPE)i, fileLog_); + logManager_->RemoveListener((LogTypes::LOG_TYPE)i, consoleLog_); #ifdef _MSC_VER - m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog); + logManager_->RemoveListener((LogTypes::LOG_TYPE)i, debuggerLog_); #endif #endif } for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - delete m_Log[i]; - if (m_fileLog != NULL) - delete m_fileLog; + delete log_[i]; + if (fileLog_ != NULL) + delete fileLog_; #if !defined(USING_GLES2) || defined(_DEBUG) - delete m_consoleLog; - delete m_debuggerLog; + delete consoleLog_; + delete debuggerLog_; #endif } void LogManager::ChangeFileLog(const char *filename) { - if (m_fileLog != NULL) { + if (fileLog_ != NULL) { for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog); - delete m_fileLog; + logManager_->RemoveListener((LogTypes::LOG_TYPE)i, fileLog_); + delete fileLog_; } if (filename != NULL) { - m_fileLog = new FileLogListener(filename); + fileLog_ = new FileLogListener(filename); for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) - m_Log[i]->AddListener(m_fileLog); + log_[i]->AddListener(fileLog_); } } void LogManager::SaveConfig(IniFile::Section *section) { for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) { - section->Set((std::string(m_Log[i]->GetShortName()) + "Enabled").c_str(), m_Log[i]->IsEnabled()); - section->Set((std::string(m_Log[i]->GetShortName()) + "Level").c_str(), (int)m_Log[i]->GetLevel()); + section->Set((std::string(log_[i]->GetShortName()) + "Enabled").c_str(), log_[i]->IsEnabled()); + section->Set((std::string(log_[i]->GetShortName()) + "Level").c_str(), (int)log_[i]->GetLevel()); } } @@ -157,18 +158,18 @@ void LogManager::LoadConfig(IniFile::Section *section) { for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) { bool enabled; int level; - section->Get((std::string(m_Log[i]->GetShortName()) + "Enabled").c_str(), &enabled, true); - section->Get((std::string(m_Log[i]->GetShortName()) + "Level").c_str(), &level, 0); - m_Log[i]->SetEnable(enabled); - m_Log[i]->SetLevel((LogTypes::LOG_LEVELS)level); + section->Get((std::string(log_[i]->GetShortName()) + "Enabled").c_str(), &enabled, true); + section->Get((std::string(log_[i]->GetShortName()) + "Level").c_str(), &level, 0); + log_[i]->SetEnable(enabled); + log_[i]->SetLevel((LogTypes::LOG_LEVELS)level); } } void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *file, int line, const char *format, va_list args) { - std::lock_guard lk(m_log_lock); + std::lock_guard lk(log_lock_); char msg[MAX_MSGLEN * 2]; - LogContainer *log = m_Log[type]; + LogChannel *log = log_[type]; if (!log || !log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners()) return; @@ -193,16 +194,13 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const #endif char *msgPos = msg; - if (hleCurrentThreadName != NULL) - { + if (hleCurrentThreadName != NULL) { msgPos += sprintf(msgPos, "%s %-12.12s %c[%s]: %s:%d ", formattedTime, hleCurrentThreadName, level_to_char[(int)level], log->GetShortName(), file, line); - } - else - { + } else { msgPos += sprintf(msgPos, "%s %s:%d %c[%s]: ", formattedTime, file, line, level_to_char[(int)level], @@ -217,33 +215,33 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const } void LogManager::Init() { - m_logManager = new LogManager(); + logManager_ = new LogManager(); } void LogManager::Shutdown() { - delete m_logManager; - m_logManager = NULL; + delete logManager_; + logManager_ = NULL; } -LogContainer::LogContainer(const char* shortName, const char* fullName, bool enable) - : m_enable(enable) { +LogChannel::LogChannel(const char* shortName, const char* fullName, bool enable) + : enable_(enable) { strncpy(m_fullName, fullName, 128); strncpy(m_shortName, shortName, 32); - m_level = LogTypes::LDEBUG; + level_ = LogTypes::LDEBUG; } // LogContainer -void LogContainer::AddListener(LogListener *listener) { +void LogChannel::AddListener(LogListener *listener) { std::lock_guard lk(m_listeners_lock); m_listeners.insert(listener); } -void LogContainer::RemoveListener(LogListener *listener) { +void LogChannel::RemoveListener(LogListener *listener) { std::lock_guard lk(m_listeners_lock); m_listeners.erase(listener); } -void LogContainer::Trigger(LogTypes::LOG_LEVELS level, const char *msg) { +void LogChannel::Trigger(LogTypes::LOG_LEVELS level, const char *msg) { #ifdef __SYMBIAN32__ RDebug::Printf("%s",msg); #else diff --git a/Common/LogManager.h b/Common/LogManager.h index fa0f964f0..cd401ea09 100644 --- a/Common/LogManager.h +++ b/Common/LogManager.h @@ -62,9 +62,13 @@ public: void Log(LogTypes::LOG_LEVELS, const char *msg); }; -class LogContainer { +// TODO: A simple buffered log that can be used to display the log in-window +// on Android etc. +// class BufferedLogListener { ... } + +class LogChannel { public: - LogContainer(const char* shortName, const char* fullName, bool enable = false); + LogChannel(const char* shortName, const char* fullName, bool enable = false); const char* GetShortName() const { return m_shortName; } const char* GetFullName() const { return m_fullName; } @@ -74,20 +78,21 @@ public: void Trigger(LogTypes::LOG_LEVELS, const char *msg); - bool IsEnabled() const { return m_enable; } - void SetEnable(bool enable) { m_enable = enable; } + bool IsEnabled() const { return enable_; } + void SetEnable(bool enable) { enable_ = enable; } - LogTypes::LOG_LEVELS GetLevel() const { return m_level; } - - void SetLevel(LogTypes::LOG_LEVELS level) { m_level = level; } + LogTypes::LOG_LEVELS GetLevel() const { return (LogTypes::LOG_LEVELS)level_; } + void SetLevel(LogTypes::LOG_LEVELS level) { level_ = level; } bool HasListeners() const { return !m_listeners.empty(); } + // Although not elegant, easy to set with a PopupMultiChoice... + int level_; + bool enable_; + private: char m_fullName[128]; char m_shortName[32]; - bool m_enable; - LogTypes::LOG_LEVELS m_level; std::mutex m_listeners_lock; std::set m_listeners; }; @@ -96,56 +101,62 @@ class ConsoleListener; class LogManager : NonCopyable { private: - LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS]; - FileLogListener *m_fileLog; - ConsoleListener *m_consoleLog; - DebuggerLogListener *m_debuggerLog; - static LogManager *m_logManager; // Singleton. Ugh. - std::mutex m_log_lock; + LogChannel* log_[LogTypes::NUMBER_OF_LOGS]; + FileLogListener *fileLog_; + ConsoleListener *consoleLog_; + DebuggerLogListener *debuggerLog_; + static LogManager *logManager_; // Singleton. Ugh. + std::mutex log_lock_; LogManager(); ~LogManager(); + public: static u32 GetMaxLevel() { return MAX_LOGLEVEL; } + static int GetNumChannels() { return LogTypes::NUMBER_OF_LOGS; } void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *file, int line, const char *fmt, va_list args); + LogChannel *GetLogChannel(LogTypes::LOG_TYPE type) { + return log_[type]; + } + void SetLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) { - m_Log[type]->SetLevel(level); + log_[type]->SetLevel(level); } void SetEnable(LogTypes::LOG_TYPE type, bool enable) { - m_Log[type]->SetEnable(enable); + log_[type]->SetEnable(enable); } LogTypes::LOG_LEVELS GetLogLevel(LogTypes::LOG_TYPE type) { - return m_Log[type]->GetLevel(); + return log_[type]->GetLevel(); } void AddListener(LogTypes::LOG_TYPE type, LogListener *listener) { - m_Log[type]->AddListener(listener); + log_[type]->AddListener(listener); } void RemoveListener(LogTypes::LOG_TYPE type, LogListener *listener) { - m_Log[type]->RemoveListener(listener); + log_[type]->RemoveListener(listener); } ConsoleListener *GetConsoleListener() const { - return m_consoleLog; + return consoleLog_; } DebuggerLogListener *GetDebuggerListener() const { - return m_debuggerLog; + return debuggerLog_; } static LogManager* GetInstance() { - return m_logManager; + return logManager_; } static void SetInstance(LogManager *logManager) { - m_logManager = logManager; + logManager_ = logManager; } static void Init(); diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp new file mode 100644 index 000000000..36c438e0b --- /dev/null +++ b/UI/DevScreens.cpp @@ -0,0 +1,103 @@ +// Copyright (c) 2013- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include "gfx_es2/gl_state.h" +#include "i18n/i18n.h" +#include "ui/ui_context.h" +#include "ui/view.h" +#include "ui/viewgroup.h" +#include "ui/ui.h" +#include "UI/MiscScreens.h" +#include "UI/DevScreens.h" +#include "UI/GameSettingsScreen.h" +#include "Common/LogManager.h" +#include "Core/Config.h" + +// It's not so critical to translate everything here, most of this is developers only. + +void LogConfigScreen::CreateViews() { + using namespace UI; + + I18NCategory *d = GetI18NCategory("Dialog"); + + root_ = new ScrollView(ORIENT_VERTICAL); + + LinearLayout *vert = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); + vert->SetSpacing(0); + + vert->Add(new ItemHeader("Log Channels")); + + static const char *logLevelList[] = { + "Notice (highest)", + "Error", + "Warning", + "Info", + "Debug", + "Verbose (lowest)" + }; + + LogManager *logMan = LogManager::GetInstance(); + + for (int i = 0; i < LogManager::GetNumChannels(); i++) { + LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i; + LogChannel *chan = logMan->GetLogChannel(type); + LinearLayout *row = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + row->Add(new PopupMultiChoice(&chan->level_, chan->GetFullName(), logLevelList, 1, 6, 0, screenManager(), new LinearLayoutParams(1.0))); + row->Add(new CheckBox(&chan->enable_, "", "", new LinearLayoutParams(100, WRAP_CONTENT))); + + vert->Add(row); + } + + vert->Add(new Button(d->T("Back"), new LayoutParams(260, 64)))->OnClick.Handle(this, &UIScreen::OnBack); +} + +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 ScrollView(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); + + LinearLayout *scroll = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); + root_->Add(scroll); + + scroll->Add(new ItemHeader("System Information")); + scroll->Add(new InfoItem("System Name", System_GetProperty(SYSPROP_NAME))); + scroll->Add(new InfoItem("System Lang/Region", System_GetProperty(SYSPROP_LANGREGION))); + scroll->Add(new InfoItem("GPU Vendor", (char *)glGetString(GL_VENDOR))); + scroll->Add(new InfoItem("GPU Model", (char *)glGetString(GL_RENDERER))); + scroll->Add(new InfoItem("OpenGL Version Supported", (char *)glGetString(GL_VERSION))); + scroll->Add(new Button(d->T("Back"), new LayoutParams(260, 64)))->OnClick.Handle(this, &UIScreen::OnBack); + +#ifdef _WIN32 + scroll->Add(new ItemHeader("OpenGL Extensions")); +#else + scroll->Add(new ItemHeader("OpenGL ES 2.0 Extensions")); +#endif + std::vector exts; + SplitString(g_all_gl_extensions, ' ', exts); + for (size_t i = 0; i < exts.size(); i++) { + scroll->Add(new TextView(exts[i])); + } + + scroll->Add(new ItemHeader("EGL Extensions")); + exts.clear(); + SplitString(g_all_egl_extensions, ' ', exts); + for (size_t i = 0; i < exts.size(); i++) { + scroll->Add(new TextView(exts[i])); + } +} diff --git a/UI/DevScreens.h b/UI/DevScreens.h new file mode 100644 index 000000000..c0bd2b154 --- /dev/null +++ b/UI/DevScreens.h @@ -0,0 +1,44 @@ +// Copyright (c) 2013- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +#include +#include +#include + +#include "base/functional.h" +#include "file/file_util.h" +#include "ui/ui_screen.h" + +#include "UI/MiscScreens.h" + +class LogConfigScreen : public UIDialogScreenWithBackground { +public: + LogConfigScreen() {} + virtual void CreateViews(); + +private: + UI::EventReturn OnLogLevelChanged(UI::EventParams &e); + UI::EventReturn OnLogEnabledChanged(UI::EventParams &e); +}; + +class SystemInfoScreen : public UIDialogScreenWithBackground { +public: + SystemInfoScreen() {} + virtual void CreateViews(); +}; \ No newline at end of file diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index a4dfe5656..cb3ebe1fc 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -26,6 +26,8 @@ #include "UI/GameInfoCache.h" #include "UI/MiscScreens.h" #include "UI/ControlMappingScreen.h" +#include "UI/DevScreens.h" + #include "Core/Config.h" #include "Core/Host.h" #include "android/jni/TestRunner.h" @@ -57,142 +59,6 @@ namespace MainWindow { extern bool isJailed; #endif -namespace UI { - -// Reads and writes value to determine the current selection. -class PopupMultiChoice : public Choice { -public: - PopupMultiChoice(int *value, const std::string &text, const char **choices, int minVal, int numChoices, - I18NCategory *category, ScreenManager *screenManager, LayoutParams *layoutParams = 0) - : Choice(text, "", false, layoutParams), value_(value), choices_(choices), minVal_(minVal), numChoices_(numChoices), - category_(category), screenManager_(screenManager) { - if (*value >= numChoices+minVal) *value = numChoices+minVal-1; - if (*value < minVal) *value = minVal; - OnClick.Handle(this, &PopupMultiChoice::HandleClick); - UpdateText(); - } - - virtual void Draw(UIContext &dc); - - UI::Event OnChoice; - -private: - void UpdateText(); - EventReturn HandleClick(EventParams &e); - - void ChoiceCallback(int num); - - int *value_; - const char **choices_; - int minVal_; - int numChoices_; - I18NCategory *category_; - ScreenManager *screenManager_; - std::string valueText_; -}; - -EventReturn PopupMultiChoice::HandleClick(EventParams &e) { - std::vector choices; - for (int i = 0; i < numChoices_; i++) { - choices.push_back(category_ ? category_->T(choices_[i]) : choices_[i]); - } - - Screen *popupScreen = new ListPopupScreen(text_, choices, *value_ - minVal_, - std::bind(&PopupMultiChoice::ChoiceCallback, this, placeholder::_1)); - screenManager_->push(popupScreen); - return EVENT_DONE; -} - -void PopupMultiChoice::UpdateText() { - valueText_ = category_ ? category_->T(choices_[*value_ - minVal_]) : choices_[*value_ - minVal_]; -} - -void PopupMultiChoice::ChoiceCallback(int num) { - if (num != -1) { - *value_ = num + minVal_; - UpdateText(); - - UI::EventParams e; - e.v = this; - e.a = num; - OnChoice.Trigger(e); - } -} - -void PopupMultiChoice::Draw(UIContext &dc) { - Choice::Draw(dc); - int paddingX = 12; - dc.SetFontStyle(dc.theme->uiFont); - dc.DrawText(valueText_.c_str(), bounds_.x2() - paddingX, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER); -} - -class PopupSliderChoice : public Choice { -public: - PopupSliderChoice(int *value, int minValue, int maxValue, const std::string &text, ScreenManager *screenManager, LayoutParams *layoutParams = 0) - : Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), screenManager_(screenManager) { - OnClick.Handle(this, &PopupSliderChoice::HandleClick); - } - - void Draw(UIContext &dc); - -private: - EventReturn HandleClick(EventParams &e); - - int *value_; - int minValue_; - int maxValue_; - ScreenManager *screenManager_; -}; - -class PopupSliderChoiceFloat : public Choice { -public: - PopupSliderChoiceFloat(float *value, float minValue, float maxValue, const std::string &text, ScreenManager *screenManager, LayoutParams *layoutParams = 0) - : Choice(text, "", false, layoutParams), value_(value), minValue_(minValue), maxValue_(maxValue), screenManager_(screenManager) { - OnClick.Handle(this, &PopupSliderChoiceFloat::HandleClick); - } - - void Draw(UIContext &dc); - -private: - EventReturn HandleClick(EventParams &e); - - float *value_; - float minValue_; - float maxValue_; - ScreenManager *screenManager_; -}; - -EventReturn PopupSliderChoice::HandleClick(EventParams &e) { - Screen *popupScreen = new SliderPopupScreen(value_, minValue_, maxValue_, text_); - screenManager_->push(popupScreen); - return EVENT_DONE; -} - - -void PopupSliderChoice::Draw(UIContext &dc) { - Choice::Draw(dc); - char temp[32]; - sprintf(temp, "%i", *value_); - dc.SetFontStyle(dc.theme->uiFont); - dc.DrawText(temp, bounds_.x2() - 12, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER); -} - -EventReturn PopupSliderChoiceFloat::HandleClick(EventParams &e) { - Screen *popupScreen = new SliderFloatPopupScreen(value_, minValue_, maxValue_, text_); - screenManager_->push(popupScreen); - return EVENT_DONE; -} - -void PopupSliderChoiceFloat::Draw(UIContext &dc) { - Choice::Draw(dc); - char temp[32]; - sprintf(temp, "%2.2f", *value_); - dc.SetFontStyle(dc.theme->uiFont); - dc.DrawText(temp, bounds_.x2() - 12, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER); -} - -} - static const int alternateSpeedTable[9] = { 0, 15, 30, 45, 60, 75, 90, 120, 180 }; @@ -370,6 +236,7 @@ void GameSettingsScreen::CreateViews() { 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"))); @@ -384,7 +251,6 @@ void GameSettingsScreen::CreateViews() { enableReportsCheckbox_ = new CheckBox(&enableReports_, s->T("Enable Compatibility Server Reports")); enableReportsCheckbox_->SetEnabled(Reporting::IsSupported()); systemSettings->Add(enableReportsCheckbox_); - systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools); systemSettings->Add(new ItemHeader(s->T("PSP Settings"))); @@ -572,6 +438,7 @@ void DeveloperToolsScreen::CreateViews() { 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 Choice(de->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig); 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__ @@ -605,7 +472,7 @@ UI::EventReturn DeveloperToolsScreen::OnRestoreDefaultSettings(UI::EventParams & I18NCategory *de = GetI18NCategory("Developer"); I18NCategory *d = GetI18NCategory("Dialog"); screenManager()->push( - new PromptScreen(de->T("RestoreDefaultSettings", "Are you sure you want to restore all settings(except control mapping)\nback to their defaults?\nYou can't undo this.\nPlease restart PPSSPP after restoring settings."), d->T("OK"), d->T("Cancel"), + new PromptScreen(de->T("RestoreDefaultSettings", "Are you sure you want to restore all settings(except control mapping)\nback to their defaults?\nYou can't undo this.\nPlease restart PPSSPP after restoring settings."), d->T("OK"), d->T("Cancel"), std::bind(&DeveloperToolsScreen::CallbackRestoreDefaults, this, placeholder::_1))); return UI::EVENT_DONE; @@ -637,3 +504,8 @@ UI::EventReturn DeveloperToolsScreen::OnLoadLanguageIni(UI::EventParams &e) { i18nrepo.LoadIni(g_Config.languageIni); return UI::EVENT_DONE; } + +UI::EventReturn DeveloperToolsScreen::OnLogConfig(UI::EventParams &e) { + screenManager()->push(new LogConfigScreen()); + return UI::EVENT_DONE; +} diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 05f6b81fd..b9a2deed8 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -96,6 +96,7 @@ private: UI::EventReturn OnLoadLanguageIni(UI::EventParams &e); UI::EventReturn OnSaveLanguageIni(UI::EventParams &e); UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e); + UI::EventReturn OnLogConfig(UI::EventParams &e); // Temporary variable. bool enableLogging_; diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 7c6c531ec..05189188e 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -33,6 +33,7 @@ #include "Core/Config.h" #include "Core/System.h" #include "Core/HLE/sceUtility.h" +#include "Common/CPUDetect.h" #include "ui_atlas.h" @@ -331,43 +332,6 @@ void LogoScreen::render() { dc.Flush(); } -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 ScrollView(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); - - LinearLayout *scroll = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); - root_->Add(scroll); - - scroll->Add(new ItemHeader("System Information")); - scroll->Add(new InfoItem("System Name", System_GetProperty(SYSPROP_NAME))); - scroll->Add(new InfoItem("System Lang/Region", System_GetProperty(SYSPROP_LANGREGION))); - scroll->Add(new InfoItem("GPU Vendor", (char *)glGetString(GL_VENDOR))); - scroll->Add(new InfoItem("GPU Model", (char *)glGetString(GL_RENDERER))); - scroll->Add(new InfoItem("OpenGL Version Supported", (char *)glGetString(GL_VERSION))); - scroll->Add(new Button(d->T("Back"), new LayoutParams(260, 64)))->OnClick.Handle(this, &UIScreen::OnBack); - -#ifdef _WIN32 - scroll->Add(new ItemHeader("OpenGL Extensions")); -#else - scroll->Add(new ItemHeader("OpenGL ES 2.0 Extensions")); -#endif - std::vector exts; - SplitString(g_all_gl_extensions, ' ', exts); - for (size_t i = 0; i < exts.size(); i++) { - scroll->Add(new TextView(exts[i])); - } - - scroll->Add(new ItemHeader("EGL Extensions")); - exts.clear(); - SplitString(g_all_egl_extensions, ' ', exts); - for (size_t i = 0; i < exts.size(); i++) { - scroll->Add(new TextView(exts[i])); - } -} - void CreditsScreen::CreateViews() { using namespace UI; I18NCategory *d = GetI18NCategory("Dialog"); diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index 35822ada8..41ec4c8b5 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -104,11 +104,6 @@ private: int frames_; }; -class SystemInfoScreen : public UIDialogScreenWithBackground { -public: - SystemInfoScreen() {} - virtual void CreateViews(); -}; // Utility functions that create various popup screens ListPopupScreen *CreateLanguageScreen(); \ No newline at end of file diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index 5dcd9e0e1..556ef1ba4 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -21,6 +21,7 @@ + @@ -36,6 +37,7 @@ + diff --git a/UI/UI.vcxproj.filters b/UI/UI.vcxproj.filters index a2ce7847c..2dcad7033 100644 --- a/UI/UI.vcxproj.filters +++ b/UI/UI.vcxproj.filters @@ -29,6 +29,9 @@ Screens + + Screens + @@ -58,6 +61,9 @@ Screens + + Screens + diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 55fb7e937..8bbfabf39 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -149,6 +149,7 @@ LOCAL_SRC_FILES := \ $(SRC)/Core/MIPS/MIPSDebugInterface.cpp \ $(SRC)/UI/ui_atlas.cpp \ $(SRC)/UI/NativeApp.cpp \ + $(SRC)/UI/DevScreens.cpp \ $(SRC)/UI/EmuScreen.cpp \ $(SRC)/UI/MainScreen.cpp \ $(SRC)/UI/MiscScreens.cpp \ diff --git a/native b/native index 0b752abc4..997aae346 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 0b752abc4139a24d705a4a059af76b98d030c6f7 +Subproject commit 997aae346bae42ef5a8d047bb3d09d757385d855