18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 09:56:01 +01:00

wasm display support

This commit is contained in:
2026-11-10 00:57:37 +01:00
parent 685258d787
commit 18c333b089
25 changed files with 2521 additions and 23 deletions

View File

@@ -72,6 +72,10 @@ void global_settings::FinalizeConfig()
python_enabled = false;
#endif
#ifndef WITH_WASM
wasm_enabled = false;
#endif
#ifdef _WIN32
Console::ModeSet(iFeedbackMode, iFeedbackPort);
#endif
@@ -877,6 +881,29 @@ bool global_settings::ConfigParseUI(cParser& Parser, const std::string& token)
return false;
}
bool global_settings::ConfigParseWasm(cParser& Parser, std::string_view const token)
{
if (token == "wasm.enabled")
{
ParseOne(Parser, wasm_enabled, 1);
return true;
}
if (token == "wasm.cabframes")
{
ParseOneClamped(Parser, wasm_cabframes, 1, 1000);
return true;
}
if (token == "wasm.externalframes")
{
ParseOneClamped(Parser, wasm_externalframes, 1, 1000);
return true;
}
return false;
}
bool global_settings::ConfigParsePython(cParser& Parser, const std::string& token)
{
if (token == "python.enabled")
@@ -1373,6 +1400,9 @@ void global_settings::ConfigParse(cParser& Parser)
if (ConfigParsePython(Parser, token))
continue;
if (ConfigParseWasm(Parser, token))
continue;
if (ConfigParseNetwork(Parser, token))
continue;
@@ -1840,6 +1870,9 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "python.threadedupload", python_threadedupload );
export_as_text( Output, "python.uploadmain", python_uploadmain );
export_as_text( Output, "python.mipmaps", python_mipmaps );
export_as_text( Output, "wasm.enabled", wasm_enabled );
export_as_text( Output, "wasm.cabframes", wasm_cabframes );
export_as_text( Output, "wasm.externalframes", wasm_externalframes );
export_as_text( Output, "async.trainThreads", trainThreads );
for( auto const &server : network_servers ) {
Output

View File

@@ -296,6 +296,9 @@ struct global_settings {
bool python_sharectx = true;
bool python_uploadmain = true;
std::chrono::duration<float> python_minframetime {0.01f};
bool wasm_enabled{true}; // screens drawn by WebAssembly modules (wasmscreen:, wasmdestinationsign: in the .mmd)
int wasm_cabframes{4}; // the wasm screens in the cab are refreshed every so many rendered frames
int wasm_externalframes{30}; // the wasm screens outside the cab (destination signs) are refreshed every so many rendered frames
bool gfx_skiprendering = false;
int gfx_framebuffer_width = -1;
@@ -390,6 +393,7 @@ struct global_settings {
bool ConfigParseSimulation(cParser& Parser, const std::string& token);
bool ConfigParseUI(cParser& Parser, const std::string& token);
bool ConfigParsePython(cParser& Parser, const std::string& token);
bool ConfigParseWasm(cParser& Parser, std::string_view token);
bool ConfigParseNetwork(cParser& Parser, const std::string& token);
bool ConfigParseHardware(cParser& Parser, const std::string& token);
bool ConfigParseDebug(cParser& Parser, const std::string& token);