diff --git a/docs/guides/options.md b/docs/guides/options.md index 0314c475..aaee5e95 100644 --- a/docs/guides/options.md +++ b/docs/guides/options.md @@ -72,6 +72,10 @@ When software rendering is on, you can check this to skip some steps in the rend Displays some information on the game screen such as framecount, inputs, notifications and ram watches. The placement of these texts can be modified, and can be displayed in the encode video. +### Lua on video encode + +Display text from Lua script in video encode. + ## Runtime ### Time tracking diff --git a/src/library/frame.cpp b/src/library/frame.cpp index 14b1d9ab..227274d8 100644 --- a/src/library/frame.cpp +++ b/src/library/frame.cpp @@ -348,7 +348,7 @@ void frameBoundary(std::function draw, RenderHUD& hud) * We encode at the end so that we can encode with or without the OSD easily */ if (Global::shared_config.av_dumping) { - if (Global::shared_config.osd_encode) { + if (Global::shared_config.osd_encode || Global::shared_config.osd_lua) { /* We need to recapture the whole screen with OSD, so we redo the * whole steps without the final `draw()` call */ if (!Global::skipping_draw && draw) { diff --git a/src/library/renderhud/RenderHUD.cpp b/src/library/renderhud/RenderHUD.cpp index 8c801a43..699ebcba 100644 --- a/src/library/renderhud/RenderHUD.cpp +++ b/src/library/renderhud/RenderHUD.cpp @@ -216,6 +216,12 @@ void RenderHUD::drawAll(uint64_t framecount, uint64_t nondraw_framecount, const ImGui::EndMainMenuBar(); } ImGui::PopStyleColor(2); + } else if (Global::shared_config.av_dumping && Global::shared_config.osd_lua) { + show_lua = true; + show_framecount = false; + show_inputs = false; + show_messages = false; + show_watches = false; } if (supportsGameWindow() && !show_game_window && old_show_game_window) { diff --git a/src/program/Config.cpp b/src/program/Config.cpp index b5f162a4..81e6cad8 100644 --- a/src/program/Config.cpp +++ b/src/program/Config.cpp @@ -162,6 +162,7 @@ void Config::save(const std::string& gamepath) { settings.setValue("screen_height", sc.screen_height); settings.setValue("osd", sc.osd); settings.setValue("osd_encode", sc.osd_encode); + settings.setValue("osd_lua", sc.osd_lua); settings.setValue("prevent_savefiles", sc.prevent_savefiles); settings.setValue("audio_bitdepth", sc.audio_bitdepth); settings.setValue("audio_channels", sc.audio_channels); @@ -367,6 +368,7 @@ void Config::load(const std::string& gamepath) { sc.screen_height = settings.value("screen_height", sc.screen_height).toInt(); sc.osd = settings.value("osd", sc.osd).toBool(); sc.osd_encode = settings.value("osd_encode", sc.osd_encode).toBool(); + sc.osd_lua = settings.value("osd_lua", sc.osd_lua).toBool(); sc.prevent_savefiles = settings.value("prevent_savefiles", sc.prevent_savefiles).toBool(); sc.audio_bitdepth = settings.value("audio_bitdepth", sc.audio_bitdepth).toInt(); sc.audio_channels = settings.value("audio_channels", sc.audio_channels).toInt(); diff --git a/src/program/ui/settings/VideoPane.cpp b/src/program/ui/settings/VideoPane.cpp index 33e5904a..3d051200 100644 --- a/src/program/ui/settings/VideoPane.cpp +++ b/src/program/ui/settings/VideoPane.cpp @@ -86,9 +86,11 @@ void VideoPane::initLayout() osdMenuBox = new QCheckBox(tr("Main Menu")); osdEncodeBox = new QCheckBox(tr("OSD on video encode")); + osdLuaBox = new QCheckBox(tr("Lua on video encode")); osdLayout->addWidget(osdMenuBox); osdLayout->addWidget(osdEncodeBox); + osdLayout->addWidget(osdLuaBox); renderingBox = new QGroupBox(tr("Rendering")); QVBoxLayout* renderingLayout = new QVBoxLayout; @@ -134,6 +136,7 @@ void VideoPane::initSignals() }); connect(osdMenuBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig); connect(osdEncodeBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig); + connect(osdLuaBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig); connect(rendSoftBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig); connect(rendPerfBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig); @@ -187,6 +190,7 @@ void VideoPane::loadConfig() osdMenuBox->setChecked(context->config.sc.osd); osdEncodeBox->setChecked(context->config.sc.osd_encode); + osdLuaBox->setChecked(context->config.sc.osd_lua); rendSoftBox->setChecked(context->config.sc.opengl_soft); rendPerfBox->setChecked(context->config.sc.opengl_performance); @@ -210,6 +214,7 @@ void VideoPane::saveConfig() context->config.sc.osd = osdMenuBox->isChecked(); context->config.sc.osd_encode = osdEncodeBox->isChecked(); + context->config.sc.osd_lua = osdLuaBox->isChecked(); context->config.sc.opengl_soft = rendSoftBox->isChecked(); context->config.sc.opengl_performance = rendPerfBox->isChecked(); diff --git a/src/program/ui/settings/VideoPane.h b/src/program/ui/settings/VideoPane.h index 560dc525..6d40cd16 100644 --- a/src/program/ui/settings/VideoPane.h +++ b/src/program/ui/settings/VideoPane.h @@ -56,6 +56,7 @@ class VideoPane : public QWidget { QSpinBox* widthField; QSpinBox* heightField; + QCheckBox* osdLuaBox; QCheckBox* osdMenuBox; QCheckBox* osdEncodeBox; diff --git a/src/shared/SharedConfig.h b/src/shared/SharedConfig.h index 51b50a7a..eaf100a6 100644 --- a/src/shared/SharedConfig.h +++ b/src/shared/SharedConfig.h @@ -281,6 +281,9 @@ struct __attribute__((packed, aligned(8))) SharedConfig { /* Display OSD in the video encode */ bool osd_encode = false; + /* Display lua text in the video encode */ + bool osd_lua = false; + /* Use a backup of savefiles in memory, which leaves the original * savefiles unmodified and save the content in savestates */ bool prevent_savefiles = true;