diff --git a/ddraw.rc b/ddraw.rc index 9a80d98..add2f79 100644 --- a/ddraw.rc +++ b/ddraw.rc @@ -1,6 +1,6 @@ 1 VERSIONINFO -FILEVERSION 1,1,5,3 -PRODUCTVERSION 1,1,5,3 +FILEVERSION 1,1,5,4 +PRODUCTVERSION 1,1,5,4 { BLOCK "StringFileInfo" { @@ -8,13 +8,13 @@ PRODUCTVERSION 1,1,5,3 { VALUE "CompanyName", "cncnet.org" VALUE "FileDescription", "DirectDraw replacement for C&C95 and Red Alert" - VALUE "FileVersion", "1.1.5.3" + VALUE "FileVersion", "1.1.5.4" VALUE "InternalName", "ddraw" VALUE "LegalCopyright", "Copyright (c) 2010-2018" VALUE "LegalTrademarks", "" VALUE "OriginalFileName", "ddraw.dll" VALUE "ProductName", "DirectDraw replacement for C&C95 and Red Alert" - VALUE "ProductVersion", "1.1.5.3" + VALUE "ProductVersion", "1.1.5.4" VALUE "Comments", "https://cncnet.org" } } diff --git a/inc/main.h b/inc/main.h index 746a9c4..4fe056e 100644 --- a/inc/main.h +++ b/inc/main.h @@ -84,6 +84,7 @@ typedef struct IDirectDrawImpl char screenshotKey; BOOL opengl_pbo; BOOL fullscreen; + BOOL maintas; } IDirectDrawImpl; diff --git a/src/main.c b/src/main.c index 8b02b9b..8c75d50 100644 --- a/src/main.c +++ b/src/main.c @@ -895,6 +895,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk "windowed=false\n" "; show window borders in windowed mode\n" "border=true\n" + "; maintain aspect ratio (GDI only!)\n" + "maintas=false\n" "; use letter- or windowboxing to make a best fit (GDI only!)\n" "boxing=false\n" "; real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n" @@ -961,6 +963,16 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk { This->boxing = TRUE; } + + GetPrivateProfileStringA("ddraw", "maintas", "FALSE", tmp, sizeof(tmp), SettingsIniPath); + if (tolower(tmp[0]) == 'n' || tolower(tmp[0]) == 'f' || tolower(tmp[0]) == 'd' || tmp[0] == '0') + { + This->maintas = FALSE; + } + else + { + This->maintas = TRUE; + } GetPrivateProfileStringA("ddraw", "screenshotKey", "G", tmp, sizeof(tmp), SettingsIniPath); ddraw->screenshotKey = toupper(tmp[0]); diff --git a/src/render_soft.c b/src/render_soft.c index 06132af..7d7665e 100644 --- a/src/render_soft.c +++ b/src/render_soft.c @@ -69,7 +69,21 @@ DWORD WINAPI render_soft_main(void) DWORD tick_end = 0; DWORD frame_len = 0; - if (ddraw->boxing) + if (ddraw->maintas) + { + dst_width = ddraw->render.width; + dst_height = ((float)ddraw->height / ddraw->width) * dst_width; + + if (dst_height > ddraw->render.height) + { + dst_width = ((float)dst_width / dst_height) * ddraw->render.height; + dst_height = ddraw->render.height; + } + + dst_top = ddraw->render.height / 2 - dst_height / 2; + dst_left = ddraw->render.width / 2 - dst_width / 2; + } + else if (ddraw->boxing) { dst_width = ddraw->width; dst_height = ddraw->height;