Show info if your game has problems with sync #497

showSync changed from bool to frames counter
This commit is contained in:
BADIM-PC\Vadim 2018-01-05 12:34:14 +03:00
parent b9310a496b
commit 9c20b3a2f3
5 changed files with 14 additions and 13 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -68,10 +68,10 @@ static void readConfigNoSound(Config* config, lua_State* lua)
static void readConfigShowSync(Config* config, lua_State* lua) static void readConfigShowSync(Config* config, lua_State* lua)
{ {
lua_getglobal(lua, "SHOW_SYNC"); lua_getglobal(lua, "SYNC_FRAMES");
if(lua_isboolean(lua, -1)) if(lua_isinteger(lua, -1))
config->data.showSync = lua_toboolean(lua, -1); config->data.missedFrames = lua_tointeger(lua, -1);
lua_pop(lua, 1); lua_pop(lua, 1);
} }

View File

@ -58,7 +58,6 @@
#define OFFSET_TOP ((TIC80_FULLHEIGHT-TIC80_HEIGHT)/2) #define OFFSET_TOP ((TIC80_FULLHEIGHT-TIC80_HEIGHT)/2)
#define POPUP_DUR (TIC_FRAMERATE*2) #define POPUP_DUR (TIC_FRAMERATE*2)
#define DESYNC_FRAMES 10
#if defined(TIC80_PRO) #if defined(TIC80_PRO)
#define TIC_EDITOR_BANKS (TIC_BANKS) #define TIC_EDITOR_BANKS (TIC_BANKS)
@ -233,7 +232,7 @@ static struct
FileSystem* fs; FileSystem* fs;
bool quitFlag; bool quitFlag;
s32 deSync; s32 missedFrames;
s32 argc; s32 argc;
char **argv; char **argv;
@ -324,7 +323,7 @@ static struct
.fullscreen = false, .fullscreen = false,
.quitFlag = false, .quitFlag = false,
.deSync = 0, .missedFrames = 0,
.argc = 0, .argc = 0,
.argv = NULL, .argv = NULL,
}; };
@ -2116,7 +2115,7 @@ static void drawDesyncLabel(u32* frame)
0b1100110010010011, 0b1100110010010011,
}; };
if(studio.deSync >= DESYNC_FRAMES && getConfig()->showSync) if(studio.missedFrames >= getConfig()->missedFrames)
{ {
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)};
@ -2811,8 +2810,10 @@ s32 main(s32 argc, char **argv)
{ {
nextTick -= delay; nextTick -= delay;
if(studio.deSync < DESYNC_FRAMES) if(studio.missedFrames < getConfig()->missedFrames)
studio.deSync++; studio.missedFrames++;
continue;
} }
else else
{ {
@ -2820,8 +2821,8 @@ s32 main(s32 argc, char **argv)
SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency())); SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
} }
if(delay >= 0 && studio.deSync > 0) if(studio.missedFrames > 0)
studio.deSync--; studio.missedFrames--;
} }
} }
} }

View File

@ -101,7 +101,7 @@ typedef struct
bool checkNewVersion; bool checkNewVersion;
bool noSound; bool noSound;
bool showSync; s32 missedFrames;
} StudioConfig; } StudioConfig;