diff --git a/README.md b/README.md index 7485601..0b59da4 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine - Another War - Anstoss 3 - Arcanum: Of Steamworks and Magick Obscura -- Arcatera the Dark Brotherhood - Army Men 2 - Army Men: Air Tactics - Army Men: Toys in Space @@ -147,7 +146,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine - Cloud Kingdom 3 (only with /ddraw command line parameter) - Dark Earth - Dark Reign: The Future of War -- Dark Secret of Africa - Day Of The Tentacle - Daytona - Daytona USA (Sega - 1996) @@ -203,7 +201,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine - Full Throttle - Future Cop L.A.P.D - G-Police -- Gateway (Remake) - Geneforge - Gilbert Goodmate And The Mushroom Of Phungoria - Gorasul: The Legacy of the Dragon @@ -424,7 +421,6 @@ Wine (Linux/macOS/Android) only: override `ddraw` in [winecfg](https://wiki.wine - Sudden Strike 2 - Superbike 2000 - Swarog -- The Jungle Book Groove Party - The Curse Of Monkey Island - The Dig - The Last Express diff --git a/config/ConfigFormUnit.cpp b/config/ConfigFormUnit.cpp index 7d40a88..e203af5 100644 --- a/config/ConfigFormUnit.cpp +++ b/config/ConfigFormUnit.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "ConfigFormUnit.h" //--------------------------------------------------------------------------- #pragma package(smart_init) @@ -773,87 +774,6 @@ void TConfigForm::ApplyTranslation(TIniFile *ini) BoxingLbl->Hint = upscaleHint + enableUpscaleHint; BoxingChk->Hint = upscaleHint + enableUpscaleHint; } - else if (lang == "polish" || (lang == "auto" && priID == LANG_POLISH)) { - LanguageImg->Visible = true; - - /* -polish - made by WaRzillA @ github */ - - ConfigForm->Caption = L"Konfiguracja cnc-ddraw"; - DisplayBtn->Caption = L"Ustawienia wyświetlania"; - AdvancedBtn->Caption = L"Ustawienia zaawansowane"; - HotkeyBtn->Caption = L"Skróty klawiaturowe"; - CompatibilityBtn->Caption = L"Ustawienia kompatybilności"; - 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"; - AdjmouseLbl->Caption = L"Dostosuj czułość myszy"; - DevmodeLbl->Caption = L"Zablokuj kursor w oknie/na ekranie"; - RendererLbl->Caption = L"Silnik renderowania"; - BorderLbl->Caption = L"Pokaż ramki okna w trybie okienkowym"; - SavesettingsLbl->Caption = L"Zapamiętaj pozycję i rozmiar okna"; - ShaderLbl->Caption = L"Shader OpenGL"; - MaxfpsLbl->Caption = L"Ogranicz liczbę klatek na sekundę"; - BoxingLbl->Caption = L"Włącz windowboxing / integer scaling "; - ToggleWindowedLbl->Caption = L"Przełącz na tryb okienkowy"; - MaximizeWindowLbl->Caption = L"Maksymalizuj okno"; - UnlockCursor1Lbl->Caption = L"Odblokuj kursor 1"; - UnlockCursor2Lbl->Caption = L"Odblokuj kursor 2"; - ScreenshotLbl->Caption = L"Zrzut ekranu"; - MaxgameticksLbl->Caption = L"Ogranicz prędkość gry"; - NoactivateappLbl->Caption = L"Napraw nieprawidłowe działanie Alt+Tab"; - ResolutionsLbl->Caption = L"Odblokuj dodatkowe rozdzielczości ekranu"; - MinfpsLbl->Caption = L"Wymuś wysokie FPS / Napraw zacinanie Freesync/G-Sync"; - SinglecpuLbl->Caption = L"Napraw problemy z wydajnością i dźwiękiem"; - NonexclusiveLbl->Caption = L"Napraw niewidoczne filmy / elementy interfejsu"; - - RendererCbx->Items->Clear(); - RendererCbx->AddItem(L"Automatyczny", NULL); - RendererCbx->AddItem(L"Direct3D 9", NULL); - RendererCbx->AddItem(L"OpenGL", NULL); - RendererCbx->AddItem(L"GDI", NULL); - - PresentationCbx->Items->Clear(); - PresentationCbx->AddItem(L"Pełny ekran", NULL); - PresentationCbx->AddItem(L"Pełny ekran z upscalingiem", NULL); - PresentationCbx->AddItem(L"Tryb bezramkowy", NULL); - PresentationCbx->AddItem(L"Tryb okienkowy", NULL); - - MaxgameticksCbx->Items->Clear(); - MaxgameticksCbx->AddItem(L"Bez limitu", NULL); - MaxgameticksCbx->AddItem(L"Synchronizacja z odświeżaniem monitora", NULL); - MaxgameticksCbx->AddItem(L"Symulacja monitora 60 Hz", NULL); - MaxgameticksCbx->AddItem(L"1000 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"500 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"250 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"125 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"60 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"30 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"25 tików na sekundę", NULL); - MaxgameticksCbx->AddItem(L"15 tików na sekundę", NULL); - - System::UnicodeString shaderHint = - L"Niektóre shadery działają tylko wtedy, gdy włączone jest skalowanie. \n\n"; - - System::UnicodeString upscaleHint = - L"Skalowanie musi być włączone, aby ta opcja działała. \n\n"; - - System::UnicodeString enableUpscaleHint = - L"Aby włączyć skalowanie, ustaw tryb wyświetlania na 'Tryb bezramkowy' \n" - "lub 'Pełny ekran z upscalingiem'. Dla 'Tryb okienkowy' \n" - "musisz zmienić rozmiar lub zmaksymalizować okno."; - - ShaderLbl->Hint = shaderHint + enableUpscaleHint; - ShaderD3DCbx->Hint = shaderHint + enableUpscaleHint; - ShaderCbx->Hint = shaderHint + enableUpscaleHint; - - MaintasLbl->Hint = upscaleHint + enableUpscaleHint; - MaintasChk->Hint = upscaleHint + enableUpscaleHint; - AdjmouseLbl->Hint = upscaleHint + enableUpscaleHint; - AdjmouseChk->Hint = upscaleHint + enableUpscaleHint; - BoxingLbl->Hint = upscaleHint + enableUpscaleHint; - BoxingChk->Hint = upscaleHint + enableUpscaleHint; - } else { IsEnglish = true; @@ -906,12 +826,6 @@ void TConfigForm::ApplyTranslation(TIniFile *ini) LanguageImg->Picture->Graphic = png; LanguageImg->Visible = true; } - else if (priID == LANG_POLISH) { - TPngImage *png = new TPngImage(); - png->LoadFromResourceName((int)HInstance, "PngImage_PL"); - LanguageImg->Picture->Graphic = png; - LanguageImg->Visible = true; - } } catch (...) { } @@ -1285,6 +1199,11 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender) delete ini; + VsyncChk->Enabled = VsyncAllowed(); + if (!VsyncChk->Enabled) { + VsyncChk->State = tssOff; + } + Initialized = true; } @@ -1706,8 +1625,31 @@ bool TConfigForm::GetBool(TIniFile *ini, System::UnicodeString key, bool defValu return s == "true" || s == "yes" || s == "1"; } +bool TConfigForm::VsyncAllowed() +{ + if (GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version")) { + return true; + } + + if (!IsWindows8OrGreater()) { + return true; + } + + if (NonexclusiveChk->State == tssOff && + (PresentationCbx->ItemIndex == 0 || PresentationCbx->ItemIndex == 1)) { + return true; + } + + return false; +} + void __fastcall TConfigForm::PresentationCbxChange(TObject *Sender) { + VsyncChk->Enabled = VsyncAllowed(); + if (!VsyncChk->Enabled) { + VsyncChk->State = tssOff; + } + SaveSettings(); } @@ -1816,6 +1758,11 @@ void __fastcall TConfigForm::SinglecpuChkClick(TObject *Sender) void __fastcall TConfigForm::NonexclusiveChkClick(TObject *Sender) { + VsyncChk->Enabled = VsyncAllowed(); + if (!VsyncChk->Enabled) { + VsyncChk->State = tssOff; + } + SaveSettings(); } diff --git a/config/ConfigFormUnit.h b/config/ConfigFormUnit.h index 8a8a14c..8a46bf8 100644 --- a/config/ConfigFormUnit.h +++ b/config/ConfigFormUnit.h @@ -118,6 +118,7 @@ private: // Benutzer-Deklarationen virtual void __fastcall CreateParams(TCreateParams & Params); void SaveSettings(); bool GetBool(TIniFile *ini, System::UnicodeString key, bool defValue); + bool VsyncAllowed(); void ApplyTranslation(TIniFile *ini); System::UnicodeString GetKeyText(WORD key); WORD GetKeyCode(System::UnicodeString text); diff --git a/config/Resources/pl.png b/config/Resources/pl.png deleted file mode 100644 index d413d01..0000000 Binary files a/config/Resources/pl.png and /dev/null differ diff --git a/config/cnc-ddraw config.cbproj b/config/cnc-ddraw config.cbproj index 7792b8b..b2de346 100644 --- a/config/cnc-ddraw config.cbproj +++ b/config/cnc-ddraw config.cbproj @@ -227,10 +227,6 @@ RCDATA PngImage_IT - - RCDATA - PngImage_PL - RCDATA PngImage_RU @@ -368,7 +364,7 @@ - cnc-ddraw config.exe + cnc-ddraw_config.exe true @@ -434,12 +430,6 @@ true - - - .\ - true - - 1 diff --git a/config/cnc-ddraw config_resources.rc b/config/cnc-ddraw config_resources.rc index b077d3a..9d29fa1 100644 --- a/config/cnc-ddraw config_resources.rc +++ b/config/cnc-ddraw config_resources.rc @@ -4,7 +4,6 @@ PngImage_ES RCDATA "Resources\\ES.png" PngImage_FR RCDATA "Resources\\fr.png" PngImage_HU RCDATA "Resources\\hu.png" PngImage_IT RCDATA "Resources\\IT.png" -PngImage_PL RCDATA "Resources\\pl.png" PngImage_RU RCDATA "Resources\\RU.png" PngImage_US RCDATA "Resources\\US.png" PngImage_VN RCDATA "Resources\\VN.png" diff --git a/inc/config.h b/inc/config.h index e15bece..a353aa8 100644 --- a/inc/config.h +++ b/inc/config.h @@ -106,7 +106,6 @@ typedef struct CNCDDRAWCONFIG BOOL carma95_hack; BOOL sirtech_hack; BOOL flightsim98_hack; - BOOL darkcolony_hack; } CNCDDRAWCONFIG; diff --git a/src/config.c b/src/config.c index 36b756a..864b10b 100644 --- a/src/config.c +++ b/src/config.c @@ -116,7 +116,6 @@ void cfg_load() GET_BOOL(g_config.carma95_hack, "carma95_hack", FALSE); 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; @@ -374,7 +373,7 @@ static void cfg_create_ini() "; The following settings are for cnc-ddraw config.exe\n" "\n" "\n" - "; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french, italian, vietnamese, polish\n" + "; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french, italian, vietnamese\n" "configlang=auto\n" "\n" "; cnc-ddraw config program theme, possible values: Windows10, Cobalt XEMedia\n" @@ -404,12 +403,6 @@ static void cfg_create_ini() "[Atrox]\n" "nonexclusive=true\n" "\n" - "; Arcatera the Dark Brotherhood\n" - "[darksun]\n" - "maxgameticks=60\n" - "maxfps=60\n" - "minfps=-1\n" - "\n" "; Atomic Bomberman\n" "[BM]\n" "maxgameticks=60\n" @@ -541,7 +534,7 @@ static void cfg_create_ini() "; Atlantis\n" "[ATLANTIS]\n" "renderer=opengl\n" - "maxgameticks=30\n" + "maxgameticks=60\n" "center_cursor_fix=true\n" "\n" "; Airline Tycoon Deluxe\n" @@ -881,12 +874,6 @@ static void cfg_create_ini() "[corsairs]\n" "adjmouse=true\n" "\n" - "; Dark Colony\n" - "[dc16]\n" - "maxgameticks=30\n" - "darkcolony_hack=true\n" - "hook_peekmessage=true\n" - "\n" "; Divine Divinity\n" "[div]\n" "resolutions=2\n" @@ -902,12 +889,6 @@ static void cfg_create_ini() "noactivateapp=true\n" "limiter_type=2\n" "\n" - "; Dark Secret of Africa\n" - "[Game/5]\n" - "checkfile=.\\CONFIG.CFG\n" - "maxfps=60\n" - "minfps=-1\n" - "\n" "; Dark Reign: The Future of War\n" "[DKReign]\n" "maxgameticks=60\n" @@ -1631,10 +1612,6 @@ static void cfg_create_ini() "fake_mode=352x240x32\n" "fix_not_responding=true\n" "\n" - "; Seven Games of the Soul\n" - "[faust]\n" - "maxgameticks=25\n" - "\n" "; Swarog\n" "[Swarog]\n" "maxfps=60\n" diff --git a/src/ddsurface.c b/src/ddsurface.c index 96d69de..4fd92c1 100644 --- a/src/ddsurface.c +++ b/src/ddsurface.c @@ -909,11 +909,6 @@ HRESULT dds_GetClipper(IDirectDrawSurfaceImpl* This, IDirectDrawClipperImpl** lp HRESULT dds_GetColorKey(IDirectDrawSurfaceImpl* This, DWORD dwFlags, LPDDCOLORKEY lpColorKey) { - if (!(This->flags & DDSD_CKSRCBLT)) - { - return DDERR_NOCOLORKEY; - } - if (dwFlags != DDCKEY_SRCBLT || !lpColorKey) { TRACE(" NOT_IMPLEMENTED dwFlags=%08X, lpColorKey=%p\n", dwFlags, lpColorKey); @@ -1553,18 +1548,17 @@ HRESULT dd_CreateSurface( if (dst_surface->hdc) InterlockedIncrement(&g_dds_gdi_handles); - // CreateDIBSection cannot handle values higher than a WORD - 0xFF00 (guard lines); - DWORD map_offset = min(65280, dst_surface->pitch * g_config.guard_lines); - dst_surface->mapping = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE | SEC_COMMIT, 0, - bmp_size + 256 + map_offset, + bmp_size + 256, NULL); + DWORD map_offset = 0; + if (dst_surface->mapping) { LPVOID data = MapViewOfFile(dst_surface->mapping, FILE_MAP_ALL_ACCESS, 0, 0, 0); diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index 33655c1..c0705f7 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -780,14 +780,6 @@ BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wM BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) { - if (g_config.darkcolony_hack && !hWnd) - { - hWnd = g_ddraw.hwnd; - - MSG msg; - real_PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); - } - if (g_config.limiter_type == LIMIT_PEEKMESSAGE && g_ddraw.ticks_limiter.tick_length > 0 && InterlockedExchange(&g_ddraw.render.screen_updated, FALSE)) @@ -2054,14 +2046,6 @@ HWND WINAPI fake_CreateWindowExA( dwStyle &= ~WS_POPUP; } - /* Dark Colony */ - if (HIWORD(lpClassName) && _strcmpi(lpClassName, "Merc Direct Draw Driver") == 0 && - lpWindowName && _strcmpi(lpWindowName, "Direct Draw Driver") == 0 && - !dwExStyle) - { - dwExStyle |= WS_EX_APPWINDOW; - } - /* Fallout 1/2 */ if (HIWORD(lpClassName) && _strcmpi(lpClassName, "GNW95 Class") == 0 && lpWindowName && strstr(lpWindowName, "FALLOUT"))