r57zone / DualShock4-emulator

DualShock4 emulation for Xbox controllers or keyboard and mouse / Эмуляция DualShock4 для Xbox контроллеров или клавиатуры и мыши

Home Page:https://youtu.be/17hY1zTqoYQ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: Instructions in ReadMe or Wiki for how to compile exe from source

e-t-l opened this issue · comments

commented

Hi, would it be possible, in either the ReadMe or a page in the repo's Wiki, to write out the steps you use to compile the executable from source code? Thanks!

Hi, Install Visual Studio 2017 or newer, download the full source code, change the SDK in the projector properties and the version of the utilities for yours, after which the application can be build.
https://github.com/r57zone/DualShock4-emulator/releases/download/1.7.4/Full.source.code.zip

commented

Thanks. Do you have any idea why v1.7.3 and v1.7.4 are getting flagged by Kaspersky antivirus? Didn't have this issue with v1.7.2, and I'm not sure if something changed that is causing AV false positives

I think that Kaspersky AV is garbage, like most other antiviruses, but who knows, maybe I put a virus in there to steal people nude photos 😂 .

Antiviruses constantly work falsely, maybe he didn't like hiding the cursor for PSNow and the Keyboard and Mouse mode, maybe something else, that's their business.

AVG antivirus specialists manually checked and removed false positives Screenshot 2

Microsoft is still checking

commented

@r57zone

Hi, Install Visual Studio 2017 or newer, download the full source code, change the SDK in the projector properties and the version of the utilities for yours, after which the application can be build.

This doesn't make sense. I have been trying for HOURS today to make this build successfully. It seems to be missing an .sln file? The only project file is DS4Emulator.vcxproj but that's not even in the highest parent folder. As a result, when cloning it into VS, it only opens in "folder view." There is no way to import it into a VS project or solution, which means there's no way to build it. Could you either share your .sln file so it can be imported properly, or describe in more detail how someone is supposed to clone this repo and build it properly?

@e-t-l

First, you need to unpack the Vigem library, then you will get this Source.zip archive (you can't download it anymore).

Sln file is not needed for assembly, you need to open DS4Emulator.vcxproj after unpacking.

Next, you need to open the options and change the properties of DS4Emulator (project properties) and select there your SDK, your set of platform tools. Close properties.

Next, you need to select the build type Debug / Release, select x86 release, then click on the green triangle and F5 and the updated exe file will appear.

commented

@r57zone as always, thank you for being so quick to respond to questions 🙏
When I cloned this repo using Visual Studio's built-in Github integration, this is what it produced:
image
You can see in the File View on the right-hand side, the directory tree looks identical to the directory tree here in the Github repo. (I also opened the downloaded files in Windows File Explorer). However, Visual Studios is just in "Folder View" mode; it says that no project or solution is loaded.

Right-clicking DS4Emulator.vcxproj and selecting Properties shows a blank Properties window, as shown below)
image

If I try to build it using the "green triangle" like you suggested, the build fails with this output:

1>------ Build started: Project: ViGEmClient, Configuration: Debug|Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(436,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32.
2>------ Build started: Project: DS4Emulator, Configuration: Debug|Win32 ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(436,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32.
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

When I started fresh, using the zip file you shared, opening DS4Emulator.vcxproj as a new project, retargeting the SDK and platform tools, and building for Debug | x86, I get almost the exact same error:

1>------ Build started: Project: DS4Emulator, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(436,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32.
1>Done building project "ViGEmClient.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So, even if it doesn't require an .sln file as you say, it still seems to be missing some sort of necessary configuration file.

  1. Unpack source.zip, Vigem libraries are already included in the archive, without them the project will not assemble.
  2. Open DS4Emulator.vcxproj & change proporties.
    изображение
    изображение
  3. Build
    изображение
    изображение
commented

Yes, I did all of that already.
image

Build fails with this output:

Build started...
1>------ Build started: Project: DS4Emulator, Configuration: Release Win32 ------
1>LINK : fatal error C1047: The object or library file 'ViGEm\lib\x86\ViGEmClient.lib' was created by a different version of the compiler than other objects like 'Release\DS4Emulator.obj'; rebuild all objects and libraries with the same compiler
1>LINK : fatal error LNK1257: code generation failed
1>Done building project "DS4Emulator.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I tried Clean Solution then Rebuild and it still gave the same error.

Change Tools and SDK to yours in proporties, probably don't have those versions like I do.

commented

I do. I installed the versions you have so I wouldn't have to worry about any compatibility issues.
For what it's worth, when I try to clean and rebuild ViGEmClient, I now get this output:

1>------ Rebuild All started: Project: ViGEmClient, Configuration: Release_LIB Win32 ------
1>ViGEmClient.cpp
1>ViGEmClient.obj : error LNK2001: unresolved external symbol __imp__SetupDiDestroyDeviceInfoList@4
1>ViGEmClient.obj : error LNK2001: unresolved external symbol __imp__SetupDiEnumDeviceInterfaces@20
1>ViGEmClient.obj : error LNK2001: unresolved external symbol __imp__SetupDiGetClassDevsW@16
1>ViGEmClient.obj : error LNK2001: unresolved external symbol __imp__SetupDiGetDeviceInterfaceDetailW@24
1>...\Release_LIB\ViGEmClient.dll : fatal error LNK1120: 4 unresolved externals
1>Done building project "ViGEmClient.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
commented

Ok, I just deleted everything and redownloaded all the files fresh, following your instructions exactly step-by-step.
I still got the error error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug | Win32, but based off this Stack Overflow answer I added the following to ViGEmClient.vcxproj:

<Platform Condition="'$(Platform)' == ''">Win32</Platform>
<Platform Condition="'$(Configuration)' == ''">Release_DLL</Platform>

and that seemed to address that bug.

However, building after that still fails with the error:

1>------ Rebuild All started: Project: DS4Emulator, Configuration: Release Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(969,5): error MSB4096: The item "ViGEmClient.cpp" in item list "ClCompile" does not define a value for metadata "ProgramDataBaseFileName".  In order to use this metadata, either qualify it by specifying %(ClCompile.ProgramDataBaseFileName), or ensure that all items in this list define a value for this metadata.
1>Done building project "ViGEmClient.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

This Stack Overflow answer suggested that in the Project Properties > C/C++ > Output Files of ViGEmClient.vcxproj, to assign "Program Database File Name" = $(IntDir)$(TargetName).pdb, which I did (originally it was set to $(IntDir)vc$(PlatformToolsetVersion).pdb). In Properties > General Configuration, the "Intermediate Directory" is $(Configuration)\, which is its default value. It still fails with the same error.

Maybe the weirdest thing is, if I open ViGEmClient.vcxproj as its own project, I can build it successfully. It is only when I am trying to build DS4Emulator.vcxproj that it fails.

Is there some way to manually provide DS4Emulator with the output files I built from ViGEmClient so it doesn't try to build them itself?

commented

I finally figured out what went wrong.
The current source code contains two ViGEmClient.lib files, which @r57zone pre-compiled (presumably with SDK 10.0.17763.0 and Platform Tools v141). That caused an error saying ViGEmClient.lib was compiled with a different toolset, and the current source code does not contain the ViGEmClient project needed to rebuild it.

In #36#issuecomment-958191701, you can download older versions of the source code:

https://github.com/r57zone/DualShock4-emulator/releases/download/1.7.4/Full.source.code.zip

This contains the folder .\src\ containing all the source files, as well as the Visual Studio solution file .\ViGEmClient.sln. You must open the ViGEmClient project, retarget it to your current SDK and Platform Tools versions, then compile new Release_LIB files. You must copy these compiled libs into .\ViGEm\lib\x64\ and .\ViGEm\lib\x86\, respectively, replacing the ViGEmClient.lib files that are currently in there.

Then DS4Emulator.vcxproj will build successfully.