1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Implement OSD Display: Internal Resolution and Rendering Resolution

Fixed #1733
This commit is contained in:
Sergey Lipskiy 2018-03-05 22:35:10 +07:00
parent b37200239e
commit 822b098d6a
6 changed files with 57 additions and 2 deletions

View File

@ -164,6 +164,8 @@ struct Config
u32 vis;
u32 fps;
u32 percent;
u32 internalResolution;
u32 renderingResolution;
u32 pos;
} onScreenDisplay;

View File

@ -269,6 +269,8 @@ void ConfigDialog::_init()
ui->fpsCheckBox->setChecked(config.onScreenDisplay.fps != 0);
ui->visCheckBox->setChecked(config.onScreenDisplay.vis != 0);
ui->percentCheckBox->setChecked(config.onScreenDisplay.percent != 0);
ui->internalResolutionCheckBox->setChecked(config.onScreenDisplay.internalResolution != 0);
ui->renderingResolutionCheckBox->setChecked(config.onScreenDisplay.renderingResolution != 0);
// Buttons
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));
@ -494,6 +496,8 @@ void ConfigDialog::accept()
config.onScreenDisplay.fps = ui->fpsCheckBox->isChecked() ? 1 : 0;
config.onScreenDisplay.vis = ui->visCheckBox->isChecked() ? 1 : 0;
config.onScreenDisplay.percent = ui->percentCheckBox->isChecked() ? 1 : 0;
config.onScreenDisplay.internalResolution = ui->internalResolutionCheckBox->isChecked() ? 1 : 0;
config.onScreenDisplay.renderingResolution = ui->renderingResolutionCheckBox->isChecked() ? 1 : 0;
config.debug.dumpMode = 0;
if (ui->dumpLowCheckBox->isChecked())

View File

@ -109,6 +109,8 @@ void _loadSettings(QSettings & settings)
config.onScreenDisplay.fps = settings.value("showFPS", config.onScreenDisplay.fps).toInt();
config.onScreenDisplay.vis = settings.value("showVIS", config.onScreenDisplay.vis).toInt();
config.onScreenDisplay.percent = settings.value("showPercent", config.onScreenDisplay.percent).toInt();
config.onScreenDisplay.internalResolution = settings.value("showInternalResolution", config.onScreenDisplay.internalResolution).toInt();
config.onScreenDisplay.renderingResolution = settings.value("showRenderingResolution", config.onScreenDisplay.renderingResolution).toInt();
config.onScreenDisplay.pos = settings.value("osdPos", config.onScreenDisplay.pos).toInt();
settings.endGroup();
@ -222,6 +224,8 @@ void writeSettings(const QString & _strIniFolder)
settings.setValue("showFPS", config.onScreenDisplay.fps);
settings.setValue("showVIS", config.onScreenDisplay.vis);
settings.setValue("showPercent", config.onScreenDisplay.percent);
settings.setValue("showInternalResolution", config.onScreenDisplay.internalResolution);
settings.setValue("showRenderingResolution", config.onScreenDisplay.renderingResolution);
settings.setValue("osdPos", config.onScreenDisplay.pos);
settings.endGroup();

View File

@ -3275,6 +3275,20 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="internalResolutionCheckBox">
<property name="text">
<string>Display internal resolution</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="renderingResolutionCheckBox">
<property name="text">
<string>Display rendering resolution</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -1426,7 +1426,12 @@ void GraphicsDrawer::_drawOSD(const char *_pText, float _x, float & _y)
void GraphicsDrawer::drawOSD()
{
if ((config.onScreenDisplay.fps | config.onScreenDisplay.vis | config.onScreenDisplay.percent) == 0 &&
if ((config.onScreenDisplay.fps |
config.onScreenDisplay.vis |
config.onScreenDisplay.percent |
config.onScreenDisplay.internalResolution |
config.onScreenDisplay.renderingResolution
) == 0 &&
m_osdMessages.empty())
return;
@ -1457,7 +1462,7 @@ void GraphicsDrawer::drawOSD()
vShift *= 0.5f;
const float x = hp - hShift * hp;
float y = vp - vShift * vp;
char buf[16];
char buf[40];
if (config.onScreenDisplay.fps) {
sprintf(buf, "%d FPS", int(perf.getFps()));
@ -1474,6 +1479,26 @@ void GraphicsDrawer::drawOSD()
_drawOSD(buf, x, y);
}
if (config.onScreenDisplay.renderingResolution) {
FrameBuffer * pBuffer = frameBufferList().getCurrent();
if (pBuffer != nullptr && VI.width != 0) {
const float aspect = float(VI.height) / float(VI.width);
const u32 height = u32(pBuffer->m_pTexture->width * aspect);
sprintf(buf, "Rendering Resolution %ux%u", pBuffer->m_pTexture->width, height);
_drawOSD(buf, x, y);
}
}
if (config.onScreenDisplay.internalResolution) {
FrameBuffer * pBuffer = frameBufferList().getCurrent();
if (pBuffer != nullptr && VI.width != 0) {
const float aspect = float(VI.height) / float(VI.width);
const u32 height = u32(pBuffer->m_width * aspect);
sprintf(buf, "Internal Resolution %ux%u", pBuffer->m_width, height);
_drawOSD(buf, x, y);
}
}
for (const std::string & m : m_osdMessages) {
_drawOSD(m.c_str(), x, y);
}

View File

@ -171,6 +171,10 @@ bool Config_SetDefault()
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowPercent", config.onScreenDisplay.percent, "Show percent counter.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowInternalResolution", config.onScreenDisplay.internalResolution, "Show internal resolution.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "ShowRenderingResolution", config.onScreenDisplay.renderingResolution, "Show rendering resolution.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultInt(g_configVideoGliden64, "CountersPos", config.onScreenDisplay.pos,
"Counters position (1=top left, 2=top center, 4=top right, 8=bottom left, 16=bottom center, 32=bottom right)");
assert(res == M64ERR_SUCCESS);
@ -393,6 +397,8 @@ void Config_LoadConfig()
config.onScreenDisplay.fps = ConfigGetParamBool(g_configVideoGliden64, "ShowFPS");
config.onScreenDisplay.vis = ConfigGetParamBool(g_configVideoGliden64, "ShowVIS");
config.onScreenDisplay.percent = ConfigGetParamBool(g_configVideoGliden64, "ShowPercent");
config.onScreenDisplay.internalResolution = ConfigGetParamBool(g_configVideoGliden64, "ShowInternalResolution");
config.onScreenDisplay.renderingResolution = ConfigGetParamBool(g_configVideoGliden64, "ShowRenderingResolution");
config.onScreenDisplay.pos = ConfigGetParamInt(g_configVideoGliden64, "CountersPos");
#ifdef DEBUG_DUMP