Skip to content

Commit

Permalink
[d3d8] Link d3d9 statically
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpyneDreams committed Feb 26, 2023
1 parent 9309c1f commit b3fb153
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
9 changes: 2 additions & 7 deletions setup_d3d8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ uninstall() {
fi
}

$action d3d9
$action d3d8

if [ "$action" == "install" ] && ! [ -z "$PROTON" ]; then
Expand Down Expand Up @@ -295,10 +294,8 @@ if [ "$action" == "install" ] && ! [ -z "$PROTON" ]; then
PROTON="$PROTON_D3D8"
fi

# Install d3d8 and d3d9 to Proton
installFile "$PROTON/$proton_dxvk" "$dxvk_lib32" "d3d9" "d3d9.dll -> \$PROTON/files/lib/wine/dxvk/d3d9.dll"
# Install d3d8 to Proton
installNewFile "$PROTON/$proton_dxvk" "$dxvk_lib32" "d3d8" "d3d8.dll -> \$PROTON/files/lib/wine/dxvk/d3d8.dll"
installFile "$PROTON/$proton_dxvk64" "$dxvk_lib32" "d3d9" "d3d9.dll -> \$PROTON/files/lib64/wine/dxvk/d3d9.dll"
installNewFile "$PROTON/$proton_dxvk64" "$dxvk_lib32" "d3d8" "d3d8.dll -> \$PROTON/files/lib64/wine/dxvk/d3d8.dll"

# Update ./proton to install d8vk
Expand All @@ -316,10 +313,8 @@ elif ! [ -z "$PROTON" ]; then
echo "Done! Make sure you restart Steam and make your game use something other than Proton-D8VK!"
exit 1
else
# Uninstall d3d8/d3d9 from Proton
uninstallFile "$PROTON/$proton_dxvk" "$dxvk_lib32" "d3d9" "d3d9.dll.old -> \$PROTON/files/lib/wine/dxvk/d3d9.dll"
# Uninstall d3d8 from Proton
uninstallNewFile "$PROTON/$proton_dxvk" "$dxvk_lib32" "d3d8" "Removing \$PROTON/files/lib/wine/dxvk/d3d8.dll"
uninstallFile "$PROTON/$proton_dxvk64" "$dxvk_lib32" "d3d9" "d3d9.dll.old -> \$PROTON/files/lib64/wine/dxvk/d3d9.dll"
uninstallNewFile "$PROTON/$proton_dxvk64" "$dxvk_lib32" "d3d8" "Removing \$PROTON/files/lib64/wine/dxvk/d3d8.dll"

# Revert ./proton to not install d8vk
Expand Down
7 changes: 6 additions & 1 deletion src/d3d8/d3d8_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#include "d3d8_interface.h"

namespace dxvk {
Logger Logger::s_instance("d3d8.log");

static struct LoggerD3D8 {
LoggerD3D8() {
Logger::setLogFile("d3d8.log");
}
} s_instance;

HRESULT CreateD3D8(
UINT SDKVersion,
Expand Down
6 changes: 1 addition & 5 deletions src/d3d8/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ d3d8_src = [
'd3d8_shader.cpp'
]

if platform != 'windows'
lib_d3d9 = d3d9_dep
endif

d3d8_dll = shared_library('d3d8'+dll_ext, d3d8_src, d3d8_res,
name_prefix : '',
dependencies : [ lib_d3d9, util_dep, dxso_dep, dxvk_dep ],
dependencies : [ d3d9_dep, util_dep, dxso_dep, dxvk_dep ],
include_directories : dxvk_include_path,
install : true,
objects : (not dxvk_is_msvc and platform == 'windows') ? 'd3d8'+def_spec_ext : [],
Expand Down
5 changes: 2 additions & 3 deletions src/d3d9/d3d9_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ namespace dxvk {
B* GetD3D9Bridge(T* object) {
B* pointer;
if (FAILED(object->QueryInterface(__uuidof(B), (void**)&pointer))) {
Logger::err("GetD3D9Bridge: ERROR! Failed to get D3D9 Bridge. d3d9.dll might be DXVK, but not a version built for D8VK!");
Logger::err("Please install the d3d9.dll that came with d3d8.dll");
throw DxvkError("GetD3D9Bridge: ERROR! Failed to get D3D9 Bridge. d3d9.dll might be DXVK, but not a version built for D8VK!");
Logger::err("GetD3D9Bridge: ERROR! Failed to get D3D9 Bridge.");
throw DxvkError("GetD3D9Bridge: ERROR! Failed to get D3D9 Bridge.");
}
return pointer;
}
Expand Down
6 changes: 4 additions & 2 deletions src/d3d9/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if platform != 'windows'
d3d9_link_depends += files('d3d9.sym')
endif

d3d9_dll = shared_library('d3d9'+dll_ext, d3d9_src, glsl_generator.process(d3d9_shaders), d3d9_res,
d3d9_lib = both_libraries('d3d9'+dll_ext, d3d9_src, glsl_generator.process(d3d9_shaders), d3d9_res,
name_prefix : dxvk_name_prefix,
dependencies : [ dxso_dep, dxvk_dep ],
include_directories : dxvk_include_path,
Expand All @@ -66,8 +66,10 @@ d3d9_dll = shared_library('d3d9'+dll_ext, d3d9_src, glsl_generator.process(d3d9_
link_depends : [ d3d9_link_depends ],
)

d3d9_dll = d3d9_lib.get_shared_lib()

d3d9_dep = declare_dependency(
link_with : [ d3d9_dll ],
link_with : [ d3d9_lib.get_static_lib() ],
include_directories : [ dxvk_include_path ],
)

2 comments on commit b3fb153

@shmerl
Copy link

@shmerl shmerl commented on b3fb153 Feb 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be used now? Do I still need d3d9.dll from this build or d3d8.dll alone is enough?

@Blisto91
Copy link

@Blisto91 Blisto91 commented on b3fb153 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make it so (if it works properly) so that the upstream dxvk dll can be used.

Edit: Actually a certain yearly season told me that you won't even need a d3d9 DLL for now?

Please sign in to comment.