More log cleanup. Fix resize issue: Fixes #9392

This commit is contained in:
Henrik Rydgård 2017-03-06 13:50:22 +01:00
parent 440e72d250
commit a895936913
9 changed files with 64 additions and 40 deletions

View file

@ -32,10 +32,23 @@
#include <cstdio>
namespace LogTypes
{
namespace LogTypes {
enum LOG_TYPE {
SYSTEM = 0,
BOOT,
COMMON,
CPU,
FILESYS,
G3D,
HLE, // dumping ground that we should get rid of
JIT,
LOADER,
ME,
MEMMAP,
SASMIX,
SAVESTATE,
SCEAUDIO,
SCECTRL,
SCEDISPLAY,
@ -51,21 +64,6 @@ enum LOG_TYPE {
SCEUTILITY,
SCEMISC,
SYSTEM,
BOOT,
COMMON,
CPU,
FILESYS,
G3D,
HLE, // dumping ground that we should get rid off
JIT,
LOADER,
ME,
MEMMAP,
TIME,
SASMIX,
SAVESTATE,
NUMBER_OF_LOGS, // Must be last
};

View file

@ -59,6 +59,20 @@ struct LogNameTableEntry {
};
static const LogNameTableEntry logTable[] = {
{LogTypes::SYSTEM, "SYSTEM"},
{LogTypes::BOOT, "BOOT"},
{LogTypes::COMMON, "COMMON"},
{LogTypes::CPU, "CPU"},
{LogTypes::FILESYS, "FILESYS"},
{LogTypes::G3D, "G3D"},
{LogTypes::HLE, "HLE"},
{LogTypes::JIT, "JIT"},
{LogTypes::LOADER, "LOADER"},
{LogTypes::ME, "ME"}, // Media Engine
{LogTypes::MEMMAP, "MEMMAP"},
{LogTypes::SASMIX, "SASMIX"},
{LogTypes::SAVESTATE, "SAVESTATE"},
{LogTypes::SCEAUDIO, "SCEAUDIO"},
{LogTypes::SCECTRL, "SCECTRL"},
{LogTypes::SCEDISPLAY, "SCEDISP"},
@ -73,21 +87,6 @@ static const LogNameTableEntry logTable[] = {
{LogTypes::SCESAS, "SCESAS"},
{LogTypes::SCEUTILITY, "SCEUTIL"},
{LogTypes::SCEMISC, "SCEMISC"},
{LogTypes::SYSTEM, "SYSTEM"},
{LogTypes::BOOT, "BOOT"},
{LogTypes::COMMON, "COMMON"},
{LogTypes::CPU, "CPU"},
{LogTypes::FILESYS, "FILESYS"},
{LogTypes::G3D, "G3D"},
{LogTypes::HLE, "HLE"},
{LogTypes::JIT, "JIT"},
{LogTypes::LOADER, "LOADER"},
{LogTypes::ME, "ME"},
{LogTypes::MEMMAP, "MEMMAP"},
{LogTypes::TIME, "TIME"},
{LogTypes::SASMIX, "SASMIX"},
{LogTypes::SAVESTATE, "SAVESTATE"},
};
LogManager::LogManager() {

View file

@ -184,7 +184,7 @@ bool UpdateScreenScale(int width, int height) {
dp_yres = new_dp_yres;
pixel_xres = width;
pixel_yres = height;
INFO_LOG(SYSTEM, "pixel_res: %dx%d", pixel_xres, pixel_yres);
NativeResized();
return true;
}

View file

@ -181,7 +181,7 @@ int RegisterEvent(const char *name, TimedCallback callback)
void AntiCrashCallback(u64 userdata, int cyclesLate)
{
ERROR_LOG(TIME, "Savestate broken: an unregistered event was called.");
ERROR_LOG(SAVESTATE, "Savestate broken: an unregistered event was called.");
Core_Halt("invalid timing events");
}
@ -526,7 +526,7 @@ void ProcessFifoWaitEvents()
{
if (first->time <= (s64)GetTicks())
{
// LOG(TIMER, "[Scheduler] %s (%lld, %lld) ",
// LOG(CPU, "[Scheduler] %s (%lld, %lld) ",
// first->name ? first->name : "?", (u64)GetTicks(), (u64)first->time);
Event* evt = first;
first = first->next;
@ -638,7 +638,7 @@ void Idle(int maxIdle)
}
}
VERBOSE_LOG(TIME, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(CPU_HZ * 0.001f));
// VERBOSE_LOG(CPU, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(CPU_HZ * 0.001f));
idledCycles += cyclesDown;
currentMIPS->downcount -= cyclesDown;

View file

@ -1664,4 +1664,5 @@ void FramebufferManagerCommon::ShowScreenResolution() {
messageStream << PSP_CoreParameter().pixelWidth << "x" << PSP_CoreParameter().pixelHeight;
host->NotifyUserMessage(messageStream.str(), 2.0f, 0xFFFFFF, "resize");
INFO_LOG(SYSTEM, "%s", messageStream.str().c_str());
}

View file

@ -223,6 +223,8 @@ void LogConfigScreen::CreateViews() {
LinearLayout *topbar = new LinearLayout(ORIENT_HORIZONTAL);
topbar->Add(new Choice(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
topbar->Add(new Choice(di->T("Toggle All")))->OnClick.Handle(this, &LogConfigScreen::OnToggleAll);
topbar->Add(new Choice(di->T("Enable All")))->OnClick.Handle(this, &LogConfigScreen::OnEnableAll);
topbar->Add(new Choice(di->T("Disable All")))->OnClick.Handle(this, &LogConfigScreen::OnDisableAll);
topbar->Add(new Choice(dev->T("Log Level")))->OnClick.Handle(this, &LogConfigScreen::OnLogLevel);
vert->Add(topbar);
@ -250,13 +252,28 @@ void LogConfigScreen::CreateViews() {
UI::EventReturn LogConfigScreen::OnToggleAll(UI::EventParams &e) {
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);
LogChannel *chan = logMan->GetLogChannel((LogTypes::LOG_TYPE)i);
chan->enable_ = !chan->enable_;
}
return UI::EVENT_DONE;
}
UI::EventReturn LogConfigScreen::OnEnableAll(UI::EventParams &e) {
LogManager *logMan = LogManager::GetInstance();
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogChannel *chan = logMan->GetLogChannel((LogTypes::LOG_TYPE)i);
chan->enable_ = true;
}
return UI::EVENT_DONE;
}
UI::EventReturn LogConfigScreen::OnDisableAll(UI::EventParams &e) {
LogManager *logMan = LogManager::GetInstance();
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogChannel *chan = logMan->GetLogChannel((LogTypes::LOG_TYPE)i);
chan->enable_ = false;
}
return UI::EVENT_DONE;
}

View file

@ -53,6 +53,8 @@ public:
private:
UI::EventReturn OnToggleAll(UI::EventParams &e);
UI::EventReturn OnEnableAll(UI::EventParams &e);
UI::EventReturn OnDisableAll(UI::EventParams &e);
UI::EventReturn OnLogLevel(UI::EventParams &e);
UI::EventReturn OnLogLevelChange(UI::EventParams &e);
};

View file

@ -151,7 +151,7 @@ void EmuScreen::bootGame(const std::string &filename) {
invalid_ = true;
CoreParameter coreParam;
CoreParameter coreParam{};
coreParam.cpuCore = (CPUCore)g_Config.iCpuCore;
coreParam.gpuCore = GPUCORE_GLES;
switch (GetGPUBackend()) {
@ -205,6 +205,8 @@ void EmuScreen::bootGame(const std::string &filename) {
coreParam.renderWidth = 480 * g_Config.iInternalResolution;
coreParam.renderHeight = 272 * g_Config.iInternalResolution;
}
coreParam.pixelWidth = pixel_xres;
coreParam.pixelHeight = pixel_yres;
std::string error_string;
if (!PSP_InitStart(coreParam, &error_string)) {
@ -792,9 +794,12 @@ void EmuScreen::update(InputState &input) {
// Simply forcibly update to the current screen size every frame. Doesn't cost much.
// If bounds is set to be smaller than the actual pixel resolution of the display, respect that.
// TODO: Should be able to use g_dpi_scale here instead. Might want to store the dpi scale in the UI context too.
#ifndef _WIN32
const Bounds &bounds = screenManager()->getUIContext()->GetBounds();
PSP_CoreParameter().pixelWidth = pixel_xres * bounds.w / dp_xres;
PSP_CoreParameter().pixelHeight = pixel_yres * bounds.h / dp_yres;
#endif
if (!invalid_) {
UpdateUIState(UISTATE_INGAME);

View file

@ -276,6 +276,8 @@ namespace MainWindow
PSP_CoreParameter().pixelHeight = height;
}
INFO_LOG(SYSTEM, "Pixel width/height: %dx%d", PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
if (UpdateScreenScale(width, height)) {
NativeMessageReceived("gpu resized", "");
}