diff --git a/README.md b/README.md index 0b59da4..7485601 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ 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 @@ -146,6 +147,7 @@ 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) @@ -201,6 +203,7 @@ 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 @@ -421,6 +424,7 @@ 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 e203af5..7d40a88 100644 --- a/config/ConfigFormUnit.cpp +++ b/config/ConfigFormUnit.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include "ConfigFormUnit.h" //--------------------------------------------------------------------------- #pragma package(smart_init) @@ -774,6 +773,87 @@ 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; @@ -826,6 +906,12 @@ 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 (...) { } @@ -1199,11 +1285,6 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender) delete ini; - VsyncChk->Enabled = VsyncAllowed(); - if (!VsyncChk->Enabled) { - VsyncChk->State = tssOff; - } - Initialized = true; } @@ -1625,31 +1706,8 @@ 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(); } @@ -1758,11 +1816,6 @@ 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 8a46bf8..8a8a14c 100644 --- a/config/ConfigFormUnit.h +++ b/config/ConfigFormUnit.h @@ -118,7 +118,6 @@ 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 new file mode 100644 index 0000000..d413d01 Binary files /dev/null and b/config/Resources/pl.png differ diff --git a/config/cnc-ddraw config.cbproj b/config/cnc-ddraw config.cbproj index b2de346..7792b8b 100644 --- a/config/cnc-ddraw config.cbproj +++ b/config/cnc-ddraw config.cbproj @@ -227,6 +227,10 @@ RCDATA PngImage_IT + + RCDATA + PngImage_PL + RCDATA PngImage_RU @@ -364,7 +368,7 @@ - cnc-ddraw_config.exe + cnc-ddraw config.exe true @@ -430,6 +434,12 @@ true + + + .\ + true + + 1 diff --git a/config/cnc-ddraw config_resources.rc b/config/cnc-ddraw config_resources.rc index 9d29fa1..b077d3a 100644 --- a/config/cnc-ddraw config_resources.rc +++ b/config/cnc-ddraw config_resources.rc @@ -4,6 +4,7 @@ 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 a353aa8..e15bece 100644 --- a/inc/config.h +++ b/inc/config.h @@ -106,6 +106,7 @@ 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 864b10b..36b756a 100644 --- a/src/config.c +++ b/src/config.c @@ -116,6 +116,7 @@ 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; @@ -373,7 +374,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\n" + "; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french, italian, vietnamese, polish\n" "configlang=auto\n" "\n" "; cnc-ddraw config program theme, possible values: Windows10, Cobalt XEMedia\n" @@ -403,6 +404,12 @@ 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" @@ -534,7 +541,7 @@ static void cfg_create_ini() "; Atlantis\n" "[ATLANTIS]\n" "renderer=opengl\n" - "maxgameticks=60\n" + "maxgameticks=30\n" "center_cursor_fix=true\n" "\n" "; Airline Tycoon Deluxe\n" @@ -874,6 +881,12 @@ 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" @@ -889,6 +902,12 @@ 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" @@ -1612,6 +1631,10 @@ 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 4fd92c1..96d69de 100644 --- a/src/ddsurface.c +++ b/src/ddsurface.c @@ -909,6 +909,11 @@ 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); @@ -1548,17 +1553,18 @@ 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, + bmp_size + 256 + map_offset, 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 c0705f7..33655c1 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -780,6 +780,14 @@ 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)) @@ -2046,6 +2054,14 @@ 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"))