Skip to content

Commit 4de8cfd

Browse files
committed
Add setting to display Lua text on video encode
1 parent 552b93e commit 4de8cfd

7 files changed

Lines changed: 21 additions & 1 deletion

File tree

docs/guides/options.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ When software rendering is on, you can check this to skip some steps in the rend
7272

7373
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.
7474

75+
### Lua on video encode
76+
77+
Display text from Lua script in video encode.
78+
7579
## Runtime
7680

7781
### Time tracking

src/library/frame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void frameBoundary(std::function<void()> draw, RenderHUD& hud)
348348
* We encode at the end so that we can encode with or without the OSD easily
349349
*/
350350
if (Global::shared_config.av_dumping) {
351-
if (Global::shared_config.osd_encode) {
351+
if (Global::shared_config.osd_encode || Global::shared_config.osd_lua) {
352352
/* We need to recapture the whole screen with OSD, so we redo the
353353
* whole steps without the final `draw()` call */
354354
if (!Global::skipping_draw && draw) {

src/library/renderhud/RenderHUD.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ void RenderHUD::drawAll(uint64_t framecount, uint64_t nondraw_framecount, const
216216
ImGui::EndMainMenuBar();
217217
}
218218
ImGui::PopStyleColor(2);
219+
} else if (Global::shared_config.osd_lua) {
220+
show_lua = true;
221+
show_framecount = false;
222+
show_inputs = false;
223+
show_messages = false;
224+
show_watches = false;
219225
}
220226

221227
if (supportsGameWindow() && !show_game_window && old_show_game_window) {

src/program/Config.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ void Config::save(const std::string& gamepath) {
162162
settings.setValue("screen_height", sc.screen_height);
163163
settings.setValue("osd", sc.osd);
164164
settings.setValue("osd_encode", sc.osd_encode);
165+
settings.setValue("osd_lua", sc.osd_lua);
165166
settings.setValue("prevent_savefiles", sc.prevent_savefiles);
166167
settings.setValue("audio_bitdepth", sc.audio_bitdepth);
167168
settings.setValue("audio_channels", sc.audio_channels);

src/program/ui/settings/VideoPane.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ void VideoPane::initLayout()
8686

8787
osdMenuBox = new QCheckBox(tr("Main Menu"));
8888
osdEncodeBox = new QCheckBox(tr("OSD on video encode"));
89+
osdLuaBox = new QCheckBox(tr("Lua on video encode"));
8990

9091
osdLayout->addWidget(osdMenuBox);
9192
osdLayout->addWidget(osdEncodeBox);
93+
osdLayout->addWidget(osdLuaBox);
9294

9395
renderingBox = new QGroupBox(tr("Rendering"));
9496
QVBoxLayout* renderingLayout = new QVBoxLayout;
@@ -134,6 +136,7 @@ void VideoPane::initSignals()
134136
});
135137
connect(osdMenuBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig);
136138
connect(osdEncodeBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig);
139+
connect(osdLuaBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig);
137140

138141
connect(rendSoftBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig);
139142
connect(rendPerfBox, &QAbstractButton::clicked, this, &VideoPane::saveConfig);
@@ -187,6 +190,7 @@ void VideoPane::loadConfig()
187190

188191
osdMenuBox->setChecked(context->config.sc.osd);
189192
osdEncodeBox->setChecked(context->config.sc.osd_encode);
193+
osdLuaBox->setChecked(context->config.sc.osd_lua);
190194

191195
rendSoftBox->setChecked(context->config.sc.opengl_soft);
192196
rendPerfBox->setChecked(context->config.sc.opengl_performance);
@@ -210,6 +214,7 @@ void VideoPane::saveConfig()
210214

211215
context->config.sc.osd = osdMenuBox->isChecked();
212216
context->config.sc.osd_encode = osdEncodeBox->isChecked();
217+
context->config.sc.osd_lua = osdLuaBox->isChecked();
213218

214219
context->config.sc.opengl_soft = rendSoftBox->isChecked();
215220
context->config.sc.opengl_performance = rendPerfBox->isChecked();

src/program/ui/settings/VideoPane.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class VideoPane : public QWidget {
5656
QSpinBox* widthField;
5757
QSpinBox* heightField;
5858

59+
QCheckBox* osdLuaBox;
5960
QCheckBox* osdMenuBox;
6061
QCheckBox* osdEncodeBox;
6162

src/shared/SharedConfig.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ struct __attribute__((packed, aligned(8))) SharedConfig {
281281
/* Display OSD in the video encode */
282282
bool osd_encode = false;
283283

284+
/* Display lua text in the video encode */
285+
bool osd_lua = false;
286+
284287
/* Use a backup of savefiles in memory, which leaves the original
285288
* savefiles unmodified and save the content in savestates */
286289
bool prevent_savefiles = true;

0 commit comments

Comments
 (0)