Skip to content
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

Extend feature support to all versions #185

Open
wants to merge 9 commits into
base: main
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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ Update July 2021: I have been too busy to work on D2DX for a while, but hope to

## Compatibility
Game versions supported:
- All features: 1.09d, 1.13c, 1.13d and 1.14d.
- Without resolution switching: 1.10f, 1.12.
- 1.09d, 1.10f, 1.12, 1.13c, 1.13d and 1.14d.
- Other versions are unsupported, will display a warning at startup and exhibit glitches.

For compatibility with mods, see the [wiki](https://github.com/bolrog/d2dx/wiki/Compatibility-with-other-mods).
Expand All @@ -45,7 +44,7 @@ For compatibility with mods, see the [wiki](https://github.com/bolrog/d2dx/wiki/

## Installation
Copy the included "glide3x.dll" into your Diablo II folder.

Note that in some cases you may have to also download and install the Visual C++ runtime library from Microsoft: https://aka.ms/vs/16/release/vc_redist.x86.exe

## Usage
Expand Down Expand Up @@ -94,7 +93,7 @@ D2DX is free software, but if you enjoy the project and want to buy me a coffee,
- Fix low fps in the menus for 1.09d.

### 0.99.527b
- Add 'filtering' option in cfg file, which allows using bilinear filtering or Catmull-Rom for scaling the game,
- Add 'filtering' option in cfg file, which allows using bilinear filtering or Catmull-Rom for scaling the game,
for those who prefer the softer look over the default integer-scale/sharp-bilinear.
- Fix artifacts when vsync is off.

Expand Down
2 changes: 2 additions & 0 deletions src/d2dx/BuiltinResMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ bool BuiltinResMod::IsCompatible(
auto gameVersion = gameHelper->GetVersion();

if (gameVersion != d2dx::GameVersion::Lod109d &&
gameVersion != d2dx::GameVersion::Lod110f &&
gameVersion != d2dx::GameVersion::Lod112 &&
gameVersion != d2dx::GameVersion::Lod113c &&
gameVersion != d2dx::GameVersion::Lod113d &&
gameVersion != d2dx::GameVersion::Lod114d)
Expand Down
17 changes: 6 additions & 11 deletions src/d2dx/D2DXContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ Offset D2DXContext::BeginDrawText(
{
auto hash = fnv_32a_buf((void*)str, wcslen(str), FNV1_32A_INIT);

const uint64_t textId =
const uint64_t textId =
(((uint64_t)(returnAddress & 0xFFFFFF) << 40ULL) |
((uint64_t)((uintptr_t)str & 0xFFFFFF) << 16ULL)) ^
(uint64_t)hash;
Expand All @@ -1311,7 +1311,7 @@ Offset D2DXContext::BeginDrawText(
// In 1.14d, some color codes are black. Remap them.

// Bright white -> white
while (wchar_t* subStr = wcsstr(str, L"�c/"))
while (wchar_t* subStr = wcsstr(str, L"\u00FFc/"))
{
subStr[2] = L'0';
}
Expand All @@ -1328,7 +1328,7 @@ void D2DXContext::EndDrawText()

_Use_decl_annotations_
Offset D2DXContext::BeginDrawImage(
const D2::CellContext* cellContext,
const D2::CellContextAny* cellContext,
uint32_t drawMode,
Offset pos,
D2Function d2Function)
Expand Down Expand Up @@ -1375,8 +1375,8 @@ Offset D2DXContext::BeginDrawImage(
else
{
DrawParameters drawParameters = _gameHelper->GetDrawParameters(cellContext);
const bool isMiscUi = drawParameters.unitType == 0 && cellContext->dwMode == 0 && drawMode != 3;
const bool isBeltItem = drawParameters.unitType == 4 && cellContext->dwMode == 4;
const bool isMiscUi = drawParameters.unitType == 0 && drawParameters.unitMode == 0 && drawMode != 3;
const bool isBeltItem = drawParameters.unitType == 4 && drawParameters.unitMode == 4;

if (isMiscUi || isBeltItem)
{
Expand Down Expand Up @@ -1413,6 +1413,7 @@ bool D2DXContext::IsFeatureEnabled(
{
if (
gameVersion == GameVersion::Lod109d ||
gameVersion == GameVersion::Lod110f ||
gameVersion == GameVersion::Lod112 ||
gameVersion == GameVersion::Lod113c ||
gameVersion == GameVersion::Lod113d ||
Expand All @@ -1422,12 +1423,6 @@ bool D2DXContext::IsFeatureEnabled(
D2DX_LOG(" UnitMotionPrediction");
_featureFlags |= (uint32_t)Feature::WeatherMotionPrediction;
D2DX_LOG(" WeatherMotionPrediction");
}

if (gameVersion == GameVersion::Lod113c ||
gameVersion == GameVersion::Lod113d ||
gameVersion == GameVersion::Lod114d)
{
_featureFlags |= (uint32_t)Feature::TextMotionPrediction;
D2DX_LOG(" TextMotionPrediction");
}
Expand Down
2 changes: 1 addition & 1 deletion src/d2dx/D2DXContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace d2dx
virtual void EndDrawText() override;

virtual Offset BeginDrawImage(
_In_ const D2::CellContext* cellContext,
_In_ const D2::CellContextAny* cellContext,
_In_ uint32_t drawMode,
_In_ Offset pos,
_In_ D2Function d2Function) override;
Expand Down
Loading