SYNC label appears everywhere if your computer is slow #511
This commit is contained in:
parent
cb7206db34
commit
607515947c
File diff suppressed because one or more lines are too long
BIN
config.tic
BIN
config.tic
Binary file not shown.
10
src/config.c
10
src/config.c
|
@ -66,12 +66,12 @@ static void readConfigNoSound(Config* config, lua_State* lua)
|
||||||
lua_pop(lua, 1);
|
lua_pop(lua, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void readConfigShowMissedFrames(Config* config, lua_State* lua)
|
static void readConfigShowSync(Config* config, lua_State* lua)
|
||||||
{
|
{
|
||||||
lua_getglobal(lua, "MISSED_FRAMES");
|
lua_getglobal(lua, "SHOW_SYNC");
|
||||||
|
|
||||||
if(lua_isinteger(lua, -1))
|
if(lua_isboolean(lua, -1))
|
||||||
config->data.missedFrames = lua_tointeger(lua, -1);
|
config->data.showSync = lua_toboolean(lua, -1);
|
||||||
|
|
||||||
lua_pop(lua, 1);
|
lua_pop(lua, 1);
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ static void readConfig(Config* config)
|
||||||
readConfigVideoScale(config, lua);
|
readConfigVideoScale(config, lua);
|
||||||
readConfigCheckNewVersion(config, lua);
|
readConfigCheckNewVersion(config, lua);
|
||||||
readConfigNoSound(config, lua);
|
readConfigNoSound(config, lua);
|
||||||
readConfigShowMissedFrames(config, lua);
|
readConfigShowSync(config, lua);
|
||||||
readConfigUseVsync(config, lua);
|
readConfigUseVsync(config, lua);
|
||||||
readTheme(config, lua);
|
readTheme(config, lua);
|
||||||
}
|
}
|
||||||
|
|
45
src/studio.c
45
src/studio.c
|
@ -224,7 +224,7 @@ static struct
|
||||||
FileSystem* fs;
|
FileSystem* fs;
|
||||||
|
|
||||||
bool quitFlag;
|
bool quitFlag;
|
||||||
s32 missedFrames;
|
bool missedFrame;
|
||||||
|
|
||||||
s32 argc;
|
s32 argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
@ -315,7 +315,7 @@ static struct
|
||||||
|
|
||||||
.fullscreen = false,
|
.fullscreen = false,
|
||||||
.quitFlag = false,
|
.quitFlag = false,
|
||||||
.missedFrames = 0,
|
.missedFrame = false,
|
||||||
.argc = 0,
|
.argc = 0,
|
||||||
.argv = NULL,
|
.argv = NULL,
|
||||||
};
|
};
|
||||||
|
@ -2111,17 +2111,17 @@ static void drawRecordLabel(u32* frame, s32 sx, s32 sy, const u32* color)
|
||||||
|
|
||||||
static void drawDesyncLabel(u32* frame)
|
static void drawDesyncLabel(u32* frame)
|
||||||
{
|
{
|
||||||
static const u16 DesyncLabel[] =
|
if(getConfig()->showSync && studio.missedFrame)
|
||||||
{
|
|
||||||
0b0110101010010011,
|
|
||||||
0b1000101011010100,
|
|
||||||
0b1110111010110100,
|
|
||||||
0b0010001010010100,
|
|
||||||
0b1100110010010011,
|
|
||||||
};
|
|
||||||
|
|
||||||
if(studio.missedFrames >= getConfig()->missedFrames)
|
|
||||||
{
|
{
|
||||||
|
static const u16 DesyncLabel[] =
|
||||||
|
{
|
||||||
|
0b0110101010010011,
|
||||||
|
0b1000101011010100,
|
||||||
|
0b1110111010110100,
|
||||||
|
0b0010001010010100,
|
||||||
|
0b1100110010010011,
|
||||||
|
};
|
||||||
|
|
||||||
enum{sx = TIC80_WIDTH-24, sy = 8, Cols = sizeof DesyncLabel[0]*BITS_IN_BYTE, Rows = COUNT_OF(DesyncLabel)};
|
enum{sx = TIC80_WIDTH-24, sy = 8, Cols = sizeof DesyncLabel[0]*BITS_IN_BYTE, Rows = COUNT_OF(DesyncLabel)};
|
||||||
|
|
||||||
const u32* pal = tic_palette_blit(&studio.tic->config.palette);
|
const u32* pal = tic_palette_blit(&studio.tic->config.palette);
|
||||||
|
@ -2789,6 +2789,8 @@ static void emstick()
|
||||||
{
|
{
|
||||||
static double nextTick = -1.0;
|
static double nextTick = -1.0;
|
||||||
|
|
||||||
|
studio.missedFrame = false;
|
||||||
|
|
||||||
if(nextTick < 0.0)
|
if(nextTick < 0.0)
|
||||||
nextTick = emscripten_get_now();
|
nextTick = emscripten_get_now();
|
||||||
|
|
||||||
|
@ -2797,9 +2799,15 @@ static void emstick()
|
||||||
double delay = nextTick - emscripten_get_now();
|
double delay = nextTick - emscripten_get_now();
|
||||||
|
|
||||||
if(delay < 0.0)
|
if(delay < 0.0)
|
||||||
|
{
|
||||||
nextTick -= delay;
|
nextTick -= delay;
|
||||||
|
studio.missedFrame = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
emscripten_set_main_loop_timing(EM_TIMING_SETTIMEOUT, delay);
|
emscripten_set_main_loop_timing(EM_TIMING_SETTIMEOUT, delay);
|
||||||
|
|
||||||
|
if(studio.missedFrames > 0)
|
||||||
|
studio.missedFrames--;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2841,7 +2849,9 @@ s32 main(s32 argc, char **argv)
|
||||||
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
||||||
|
|
||||||
while (!studio.quitFlag)
|
while (!studio.quitFlag)
|
||||||
{
|
{
|
||||||
|
studio.missedFrame = false;
|
||||||
|
|
||||||
nextTick += Delta;
|
nextTick += Delta;
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
|
@ -2851,11 +2861,7 @@ s32 main(s32 argc, char **argv)
|
||||||
if(delay < 0)
|
if(delay < 0)
|
||||||
{
|
{
|
||||||
nextTick -= delay;
|
nextTick -= delay;
|
||||||
|
studio.missedFrame = true;
|
||||||
if(studio.missedFrames < getConfig()->missedFrames)
|
|
||||||
studio.missedFrames++;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2866,9 +2872,6 @@ s32 main(s32 argc, char **argv)
|
||||||
SDL_Delay(time);
|
SDL_Delay(time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(studio.missedFrames > 0)
|
|
||||||
studio.missedFrames--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ typedef struct
|
||||||
bool checkNewVersion;
|
bool checkNewVersion;
|
||||||
bool noSound;
|
bool noSound;
|
||||||
bool useVsync;
|
bool useVsync;
|
||||||
s32 missedFrames;
|
bool showSync;
|
||||||
|
|
||||||
} StudioConfig;
|
} StudioConfig;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue