erri120 / GameFinder

.NET library for finding games.
GNU General Public License v3.0
57 stars 5 forks source link

EA Desktop: add Wine support #71

Open erri120 opened 1 year ago

erri120 commented 1 year ago

This requires adding a new implementation of IHardwareInfoProvider. https://github.com/Jinjinov/Hardware.Info might be interesting. It's probably just easier to use wineconsole.

Name Value (Windows) Method (Windows) Method (Linux) Value (Linux) Notes
Win32_BaseBoard Manufacturer ASRock WMI cat /sys/class/dmi/id/board_vendor ASRock
Win32_BaseBoard SerialNumber (22 white spaces) WMI cat /sys/class/dmi/id/board_serial (empty string) Only readable by root
Win32_BIOS Manufacturer American Megatrends Inc. WMI cat /sys/class/dmi/id/bios_vendor American Megatrends Inc.
Win32_BIOS SerialNumber To Be Filled By O.E.M. WMI cat /sys/class/dmi/id/product_serial To Be Filled By O.E.M. Only readable by root
hex string of the Serial Number of the C:\ drive 7CB7433E GetVolumeInformationW ? ?
Win32_VideoController PNPDeviceId PCI\VEN_10DE&DEV_2486&SUBSYS_147A10DE&REV_A1\4&2283F625&0&0019 WMI ? ?
Win32_Processor Manufacturer AuthenticAMD WMI grep -m1 ^"vendor_id" /proc/cpuinfo \| awk '{ print $3 }' AuthenticAMD
Win32_Processor ProcessorId 178BFBFF00A20F10 WMI ? ?
Win32_Processor Name AMD Ryzen 7 5800X 8-Core Processor (total length: 47, has 13 white spaces at the end) WMI grep -m1 ^"model name" /proc/cpuinfo \| awk '{ split($0,a,": ") ; print a[2] }' AMD Ryzen 7 5800X 8-Core Processor Linux value is trimmed
Sajito commented 9 months ago

Hello @erri120, I used your findings and documentation from https://github.com/erri120/erri120.github.io/issues/45 to also look into this.

I'm not entirely sure yet, but I think for the Win32_BaseBoard SerialNumber and Win32_BIOS SerialNumber we could take a shortcut. It's possible to read those values using wmic inside a wine prefix. The hardware_key needed to decrypt my IS file has these values mapped as follows:

baseBoardSerialNumber: 'Default string'
biosSerialNumber: '0'

As you already noticed it's not possible to get those values from linux without root. From my understanding wine does not have root access and therefore shouldn't be able to access those information either. That's why I'm pretty confident that those values are always the same in a wine environment.

Then we have the "volume serial number". This might also be rather simple. In my wine prefixes this is always 43000000, which is hex representation for "C", the drive letter. This can be changed with winecfg, but then the value will be stored in C:/.windows-serial. So either we have this file, with the correct value or it's 43000000.

Do you have the ability to check if my assumptions apply to a wine installation?

The easiest way to get Win32_Processor ProcessorId might be to just dispatch the wmic call inside the prefix.

The only major showstopper for me at this time is Win32_VideoController PNPDeviceId. I can get this value with wmic, but the resulting string does not match the required string, they differ. I'm still looking into how to get the correct value.

erri120 commented 9 months ago

@Sajito thanks for looking into it!

Sajito commented 9 months ago

My problem with Win32_VideoController PNPDeviceId seems to be a dead end for me. I used x64dbg to step through the program. The wmi query used to get the video devices is Select * from Win32_VideoController. The value is retrieved at 000000006E786BD9, as a template string though. The final value is present at 000000006E786BFA.

I tried doing exactly the same, using a simple dotnet tool. Using System.Management to query the video devices using the same query. Checked the PNPDeviceId, getting the same as using wmic PATH Win32_VideoController get PNPDeviceId. But the id I retrieve is not the same id, which is retrieved inside EABackgroundService.exe, therefore unusable to create the correct hardware key.

Maybe someone else can pick up at this point...

Sajito commented 9 months ago

Some more information here. Win32_BaseBoard SerialNumber is not always "Default string", so it must be read from somewhere.

Also I figured out why my PNPDeviceId is different than the one used by EA App. I have an Nvidia gpu, which is hidden by dxvk dxgi. So when EA App queries the PNPDeviceId for the gpu, then an amd card is reported instead of my actual gpu.

Though I don't know yet how to obtain the same PNPDeviceId as EA App.