Suggestion: -nosound command line parameter #227

This commit is contained in:
BADIM-PC\Vadim 2017-11-20 11:29:52 +03:00
parent 0f67e6e9ef
commit 9b82e54658
6 changed files with 24 additions and 1 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -56,6 +56,16 @@ static void readConfigCheckNewVersion(Config* config, lua_State* lua)
lua_pop(lua, 1); lua_pop(lua, 1);
} }
static void readConfigNoSound(Config* config, lua_State* lua)
{
lua_getglobal(lua, "NO_SOUND");
if(lua_isboolean(lua, -1))
config->data.noSound = lua_toboolean(lua, -1);
lua_pop(lua, 1);
}
static void readCursorTheme(Config* config, lua_State* lua) static void readCursorTheme(Config* config, lua_State* lua)
{ {
lua_getfield(lua, -1, "CURSOR"); lua_getfield(lua, -1, "CURSOR");
@ -156,6 +166,7 @@ static void readConfig(Config* config)
readConfigVideoLength(config, lua); readConfigVideoLength(config, lua);
readConfigVideoScale(config, lua); readConfigVideoScale(config, lua);
readConfigCheckNewVersion(config, lua); readConfigCheckNewVersion(config, lua);
readConfigNoSound(config, lua);
readTheme(config, lua); readTheme(config, lua);
} }
@ -173,6 +184,8 @@ static void update(Config* config, const u8* buffer, size_t size)
static void setDefault(Config* config) static void setDefault(Config* config)
{ {
SDL_memset(&config->data, 0, sizeof(StudioConfig));
{ {
static const u8 DefaultBiosZip[] = static const u8 DefaultBiosZip[] =
{ {

View File

@ -2800,6 +2800,10 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
cmdInjectMap(console, argv[i], argv[i + 1]); cmdInjectMap(console, argv[i], argv[i + 1]);
} }
} }
for (s32 i = 1; i < argc; i++)
if(strcmp(argv[i], "-nosound") == 0)
config->data.noSound = true;
} }
#if defined(__EMSCRIPTEN__) #if defined(__EMSCRIPTEN__)

View File

@ -2069,6 +2069,8 @@ static void useSystemPalette()
static void renderStudio() static void renderStudio()
{ {
tic_mem* tic = studio.tic;
showTooltip(""); showTooltip("");
studio.gesture.active = false; studio.gesture.active = false;
@ -2124,6 +2126,9 @@ static void renderStudio()
TIC80_HEIGHT - TIC_FONT_HEIGHT, (tic_color_white)); TIC80_HEIGHT - TIC_FONT_HEIGHT, (tic_color_white));
} }
if(getConfig()->noSound)
SDL_memset(tic->ram.registers, 0, sizeof tic->ram.registers);
studio.tic->api.tick_end(studio.tic); studio.tic->api.tick_end(studio.tic);
blitSound(); blitSound();

View File

@ -103,6 +103,7 @@ typedef struct
s32 gifLength; s32 gifLength;
bool checkNewVersion; bool checkNewVersion;
bool noSound;
} StudioConfig; } StudioConfig;