Skip to content

Enable V-Sync option by default #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cnc-ddraw can fix compatibility issues in older 2D games, such as black screen,
- Alt+Enter support to switch quickly between Fullscreen and Windowed mode
- Automatically saves and restores window position/size/state
- FPS Limiter
- VSync
- Vertical Synchronization (V-Sync)
- Optional mouse sensitivity scaling
- Preliminary libretro shader support - https://github.com/libretro/glsl-shaders
- ...
Expand Down
20 changes: 10 additions & 10 deletions config/ConfigFormUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Restaurar la configuración predeterminada";
PresentationLbl->Caption = L"Presentación";
MaintasLbl->Caption = L"Mantener la relación de aspecto";
VsyncLbl->Caption = L"Activar VSync";
VsyncLbl->Caption = L"Activar V-Sync";
AdjmouseLbl->Caption = L"Ajustar sensibilidad de ratón";
DevmodeLbl->Caption = L"Bloquear cursor a la ventana / pantalla";
RendererLbl->Caption = L"Renderizador";
Expand Down Expand Up @@ -298,7 +298,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Standardeinstellungen wiederherstellen";
PresentationLbl->Caption = L"Darstellung";
MaintasLbl->Caption = L"Seitenverhältnis beibehalten";
VsyncLbl->Caption = L"VSync aktiveren";
VsyncLbl->Caption = L"V-Sync aktiveren";
AdjmouseLbl->Caption = L"Mausempfindlichkeit anpassen";
DevmodeLbl->Caption = L"Sperre Cursor zu Fenster / Bildschirm"; //Not 100% sure, if not a better translation exists
RendererLbl->Caption = L"Renderer";
Expand Down Expand Up @@ -381,7 +381,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Восстановить настройки по умолчанию";
PresentationLbl->Caption = L"Отображение";
MaintasLbl->Caption = L"Сохранять соотношение сторон";
VsyncLbl->Caption = L"Включить VSync";
VsyncLbl->Caption = L"Включить V-Sync";
AdjmouseLbl->Caption = L"Регулировка чувствительности мыши";
DevmodeLbl->Caption = L"Зафиксировать курсор на окне / экране";
RendererLbl->Caption = L"Рендер";
Expand Down Expand Up @@ -462,7 +462,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Visszaállítja az alapértelmezett beállításokat";
PresentationLbl->Caption = L"Bemutató";
MaintasLbl->Caption = L"Képarány megtartása";
VsyncLbl->Caption = L"VSync bekapcsolása";
VsyncLbl->Caption = L"V-Sync bekapcsolása";
AdjmouseLbl->Caption = L"Egérérzékenység beállítás";
DevmodeLbl->Caption = L"Kurzor bezárása az ablakba / képbe";
RendererLbl->Caption = L"Renderelő";
Expand Down Expand Up @@ -543,7 +543,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Restaurer les paramètres par défaut";
PresentationLbl->Caption = L"Présentation";
MaintasLbl->Caption = L"Conserver les proportions de l'image";
VsyncLbl->Caption = L"Activer la synchro verticale (VSync)";
VsyncLbl->Caption = L"Activer la synchro verticale (V-Sync)";
AdjmouseLbl->Caption = L"Ajuster la sensibilité souris";
DevmodeLbl->Caption = L"Capturer le curseur dans la fenêtre / l'écran";
RendererLbl->Caption = L"Moteur de rendu";
Expand Down Expand Up @@ -624,7 +624,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Ripristina le impostazioni predefinite";
PresentationLbl->Caption = L"Presentazione";
MaintasLbl->Caption = L"Mantieni il rapporto d'aspetto";
VsyncLbl->Caption = L"Abilita la sincronizzazione verticale (VSync)";
VsyncLbl->Caption = L"Abilita la sincronizzazione verticale (V-Sync)";
AdjmouseLbl->Caption = L"Regola la sensibilità del mouse";
DevmodeLbl->Caption = L"Cattura il cursore nella finestra / schermo";
RendererLbl->Caption = L"Renderer";
Expand Down Expand Up @@ -705,7 +705,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Khôi phục cài đặt gốc";
PresentationLbl->Caption = L"Chế Độ Hiển Thị";
MaintasLbl->Caption = L"Giữ nguyên tỉ lệ khung hình";
VsyncLbl->Caption = L"Bật VSync";
VsyncLbl->Caption = L"Bật V-Sync";
AdjmouseLbl->Caption = L"Điều chỉnh độ nhạy của chuột";
DevmodeLbl->Caption = L"Khóa con trỏ vào cửa sổ / màn hình";
RendererLbl->Caption = L"Trình kết xuất";
Expand Down Expand Up @@ -786,7 +786,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Przywróć ustawienia domyślne";
PresentationLbl->Caption = L"Tryb wyświetlania";
MaintasLbl->Caption = L"Zachowaj proporcje obrazu";
VsyncLbl->Caption = L"Włącz VSync";
VsyncLbl->Caption = L"Włącz V-Sync";
AdjmouseLbl->Caption = L"Dostosuj czułość myszy";
DevmodeLbl->Caption = L"Zablokuj kursor w oknie/na ekranie";
RendererLbl->Caption = L"Silnik renderowania";
Expand Down Expand Up @@ -924,7 +924,7 @@ void TConfigForm::ApplyTranslation(TIniFile *ini)
RestoreDefaultsBtn->Caption = L"Restore default settings";
PresentationLbl->Caption = L"Presentation";
MaintasLbl->Caption = L"Maintain aspect ratio";
VsyncLbl->Caption = L"Enable VSync";
VsyncLbl->Caption = L"Enable V-Sync";
AdjmouseLbl->Caption = L"Adjust mouse sensitivity";
DevmodeLbl->Caption = L"Lock cursor to window / screen";
RendererLbl->Caption = L"Renderer";
Expand Down Expand Up @@ -1103,7 +1103,7 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
}

MaintasChk->State = GetBool(ini, "maintas", false) ? tssOn : tssOff;
VsyncChk->State = GetBool(ini, "vsync", false) ? tssOn : tssOff;
VsyncChk->State = GetBool(ini, "vsync", true) ? tssOn : tssOff;
AdjmouseChk->State = GetBool(ini, "adjmouse", true) ? tssOn : tssOff;
DevmodeChk->State = GetBool(ini, "devmode", false) ? tssOff : tssOn;

Expand Down
2 changes: 1 addition & 1 deletion config/ConfigFormUnit.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -2734,7 +2734,7 @@ object ConfigForm: TConfigForm
Width = 93
Height = 21
Margins.Top = 18
Caption = 'Enable VSync'
Caption = 'Enable V-Sync'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Expand Down
24 changes: 12 additions & 12 deletions inc/ddraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ typedef struct _DDSURFACEDESC2
union
{
DWORD dwBackBufferCount; // number of back buffers requested
DWORD dwDepth; // the depth if this is a volume texture
DWORD dwDepth; // the depth if this is a volume texture
} DUMMYUNIONNAMEN(5);
union
{
Expand Down Expand Up @@ -2890,7 +2890,7 @@ typedef struct _DDCOLORCONTROL
#define DDSCAPS2_NPATCHES 0x02000000L

/*
* This bit is reserved for internal use
* This bit is reserved for internal use
*/
#define DDSCAPS2_RESERVED3 0x04000000L

Expand Down Expand Up @@ -2942,12 +2942,12 @@ typedef struct _DDCOLORCONTROL
#define DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT 5

/*
* This bit is reserved for internal use
* This bit is reserved for internal use
*/
#define DDSCAPS3_RESERVED1 0x00000100L

/*
* This bit is reserved for internal use
* This bit is reserved for internal use
*/
#define DDSCAPS3_RESERVED2 0x00000200L

Expand Down Expand Up @@ -2982,7 +2982,7 @@ typedef struct _DDCOLORCONTROL
#define DDSCAPS3_READONLYRESOURCE 0x00004000L

/*
* This indicates that this surface is to share an existing video memory with
* This indicates that this surface is to share an existing video memory with
* another surface created with DDSCAPS3_CREATESHAREDRESOURCE, This bit is never
* used with DDSCAPS3_CREATESHAREDRESOURCE
*/
Expand Down Expand Up @@ -3193,7 +3193,7 @@ typedef struct _DDCOLORCONTROL

/*
* The overlay can be automatically flipped according to the video port
* VSYNCs, providing automatic doubled buffered display of video port
* V-SYNCs, providing automatic doubled buffered display of video port
* data using an overlay
*/
#define DDCAPS2_AUTOFLIPOVERLAY 0x00000008l
Expand Down Expand Up @@ -4447,7 +4447,7 @@ typedef struct _DDCOLORCONTROL
* that moves surface contents from an offscreen back buffer to the primary
* surface). The driver is not allowed to "queue" more than three such blts.
* The "end" of the presentation blt is indicated, since the
* blt may be clipped, in which case the runtime will call the driver with
* blt may be clipped, in which case the runtime will call the driver with
* several blts. All blts (even if not clipped) are tagged with DDBLT_PRESENTATION
* and the last (even if not clipped) additionally with DDBLT_LAST_PRESENTATION.
* Thus the true rule is that the driver must not schedule a DDBLT_PRESENTATION
Expand All @@ -4461,20 +4461,20 @@ typedef struct _DDCOLORCONTROL
* When excessive queueing occurs, applications become unusable because the application
* visibly lags user input, and such problems make windowed interactive applications impossible.
* Some drivers may not have sufficient knowledge of their hardware's FIFO to know
* when a certain blt has been retired. Such drivers should code cautiously, and
* when a certain blt has been retired. Such drivers should code cautiously, and
* simply not allow any frames to be queued at all. DDBLT_LAST_PRESENTATION should cause
* such drivers to return DDERR_WASSTILLDRAWING until the accelerator is completely
* finished- exactly as if the application had called Lock on the source surface
* before calling Blt.
* In other words, the driver is allowed and encouraged to
* before calling Blt.
* In other words, the driver is allowed and encouraged to
* generate as much latency as it can, but never more than 3 frames worth.
* Implementation detail: Drivers should count blts against the SOURCE surface, not
* against the primary surface. This enables multiple parallel windowed application
* to function more optimally.
* This flag is passed only to DX8 or higher drivers.
*
* APPLICATIONS DO NOT SET THESE FLAGS. THEY ARE SET BY THE DIRECTDRAW RUNTIME.
*
*
*/
#define DDBLT_PRESENTATION 0x10000000l
#define DDBLT_LAST_PRESENTATION 0x20000000l
Expand Down Expand Up @@ -4513,7 +4513,7 @@ typedef struct _DDCOLORCONTROL
* NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED
* FOR USE BY THE DIRECT3D RUNTIME. Use IDirect3DSwapChain9::Present
* and specify D3DPRESENT_LINEAR_CONTENT in order to use this functionality.
*/
*/
#define DDBLT_EXTENDED_LINEAR_CONTENT 0x00000004l


Expand Down
18 changes: 10 additions & 8 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void cfg_load()
{
cfg_init();

/* Optional settings */
/* Optional settings */

GET_INT(g_config.window_rect.right, "width", 0);
GET_INT(g_config.window_rect.bottom, "height", 0);
Expand All @@ -41,7 +41,7 @@ void cfg_load()
GET_STRING("aspect_ratio", "", g_config.aspect_ratio, sizeof(g_config.aspect_ratio));
GET_BOOL(g_config.boxing, "boxing", FALSE);
GET_INT(g_config.maxfps, "maxfps", -1);
GET_BOOL(g_config.vsync, "vsync", FALSE);
GET_BOOL(g_config.vsync, "vsync", TRUE);
GET_BOOL(g_config.adjmouse, "adjmouse", TRUE);
GET_STRING("shader", "Shaders\\interpolation\\catmull-rom-bilinear.glsl", g_config.shader, sizeof(g_config.shader));
GET_INT(g_config.window_rect.left, "posX", -32000);
Expand Down Expand Up @@ -106,7 +106,7 @@ void cfg_load()
GET_INT(g_config.hotkeys.screenshot, "keyscreenshot", VK_SNAPSHOT);

/* Game specific settings */

GET_BOOL(g_config.armadahack, "armadahack", FALSE);
GET_BOOL(g_config.tshack, "tshack", FALSE);
GET_BOOL(g_config.infantryhack, "infantryhack", FALSE);
Expand All @@ -117,7 +117,7 @@ void cfg_load()
GET_BOOL(g_config.sirtech_hack, "sirtech_hack", FALSE);
GET_BOOL(g_config.flightsim98_hack, "flightsim98_hack", FALSE);
GET_BOOL(g_config.darkcolony_hack, "darkcolony_hack", FALSE);

GameHandlesClose = GameHandlesClose || g_config.infantryhack;

if (g_config.lock_mouse_top_left)
Expand Down Expand Up @@ -213,9 +213,11 @@ static void cfg_create_ini()
"; Note: Does not have an impact on the game speed, to limit your game speed use 'maxgameticks='\n"
"maxfps=-1\n"
"\n"
"; Vertical synchronization, enable if you get tearing - (Requires 'renderer=auto/opengl*/direct3d9*')\n"
"; Note: vsync=true can fix tearing but it will cause input lag\n"
"vsync=false\n"
"; Vertical synchronization. Requires 'renderer=auto/opengl*/direct3d9*'.\n"
"; Note: vsync=true can fix tearing but it may cause input lag\n"
"; V-Sync is enabled for most games by default even if this setting\n"
"; is disabled because we already disable exclusive fullscreen by default\n"
"vsync=true\n"
"\n"
"; Automatic mouse sensitivity scaling\n"
"; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window\n"
Expand Down Expand Up @@ -996,7 +998,7 @@ static void cfg_create_ini()
"; Flight Simulator 98\n"
"[FLTSIM98]\n"
"flightsim98_hack=true\n"
"\n"
"\n"
"; Fairy Tale About Father Frost, Ivan and Nastya\n"
"[mrazik]\n"
"guard_lines=0\n"
Expand Down