#497 USE_VSYNC added to the config (true by default)
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								config.tic
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								config.tic
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								src/config.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/config.c
									
									
									
									
									
								
							@@ -66,9 +66,9 @@ static void readConfigNoSound(Config* config, lua_State* lua)
 | 
				
			|||||||
	lua_pop(lua, 1);
 | 
						lua_pop(lua, 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void readConfigShowSync(Config* config, lua_State* lua)
 | 
					static void readConfigShowMissedFrames(Config* config, lua_State* lua)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	lua_getglobal(lua, "SYNC_FRAMES");
 | 
						lua_getglobal(lua, "MISSED_FRAMES");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(lua_isinteger(lua, -1))
 | 
						if(lua_isinteger(lua, -1))
 | 
				
			||||||
		config->data.missedFrames = lua_tointeger(lua, -1);
 | 
							config->data.missedFrames = lua_tointeger(lua, -1);
 | 
				
			||||||
@@ -76,6 +76,16 @@ static void readConfigShowSync(Config* config, lua_State* lua)
 | 
				
			|||||||
	lua_pop(lua, 1);
 | 
						lua_pop(lua, 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void readConfigUseVsync(Config* config, lua_State* lua)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						lua_getglobal(lua, "USE_VSYNC");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(lua_isboolean(lua, -1))
 | 
				
			||||||
 | 
							config->data.useVsync = 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");
 | 
				
			||||||
@@ -199,7 +209,8 @@ static void readConfig(Config* config)
 | 
				
			|||||||
			readConfigVideoScale(config, lua);
 | 
								readConfigVideoScale(config, lua);
 | 
				
			||||||
			readConfigCheckNewVersion(config, lua);
 | 
								readConfigCheckNewVersion(config, lua);
 | 
				
			||||||
			readConfigNoSound(config, lua);
 | 
								readConfigNoSound(config, lua);
 | 
				
			||||||
			readConfigShowSync(config, lua);
 | 
								readConfigShowMissedFrames(config, lua);
 | 
				
			||||||
 | 
								readConfigUseVsync(config, lua);
 | 
				
			||||||
			readTheme(config, lua);
 | 
								readTheme(config, lua);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2741,7 +2741,7 @@ static void onFSInitialized(FileSystem* fs)
 | 
				
			|||||||
#if defined(__CHIP__)
 | 
					#if defined(__CHIP__)
 | 
				
			||||||
		SDL_RENDERER_SOFTWARE
 | 
							SDL_RENDERER_SOFTWARE
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
		SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC
 | 
							SDL_RENDERER_ACCELERATED | (getConfig()->useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2819,7 +2819,11 @@ s32 main(s32 argc, char **argv)
 | 
				
			|||||||
				else
 | 
									else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if(useDelay || SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED)
 | 
										if(useDelay || SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED)
 | 
				
			||||||
						SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
 | 
										{
 | 
				
			||||||
 | 
											u32 time = (u32)(delay * 1000 / SDL_GetPerformanceFrequency());
 | 
				
			||||||
 | 
											if(time >= 10)
 | 
				
			||||||
 | 
												SDL_Delay(time);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if(studio.missedFrames > 0)
 | 
									if(studio.missedFrames > 0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,6 +101,7 @@ typedef struct
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	bool checkNewVersion;
 | 
						bool checkNewVersion;
 | 
				
			||||||
	bool noSound;
 | 
						bool noSound;
 | 
				
			||||||
 | 
						bool useVsync;
 | 
				
			||||||
	s32 missedFrames;
 | 
						s32 missedFrames;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} StudioConfig;
 | 
					} StudioConfig;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user