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

Issues compiling scaffolding generated from miHoYo games #150

Closed
flumf opened this issue Mar 23, 2021 · 7 comments
Closed

Issues compiling scaffolding generated from miHoYo games #150

flumf opened this issue Mar 23, 2021 · 7 comments
Labels

Comments

@flumf
Copy link

flumf commented Mar 23, 2021

Working with Genshin Impact version 1.2. UnityPlayer, global-metadata, and UserAssembly are all from the same version.
Target C++ compiler is MSVC, target Unity version is 2017.4.15 - 2017.4.40. No errors occur during export, and loading the project into Visual Studio (after retargeting) appears to function as expected.

Issues begin to arise after attempting to compile the scaffolding. Regardless of configuration used (I tried all 4), it immediately fails on il2cpp-api-functions.h. All errors seem to stem from issues with types being defined, which is odd because briefly looking through il2cpp-types.h shows that everything is (seemingly) in place.

Attached is a compilation log - if required I can send the project files as well.

debug-x64-compile.log

@flumf flumf added the bug label Mar 23, 2021
@djkaty
Copy link
Owner

djkaty commented Mar 23, 2021

Looks weird in the log. Feel free to send over the project.

I should add that I'm not sure there is any point making scaffolding for Genshin Impact 1.2 because I think they prevent you from injecting DLLs on that version, although I'm not 100% sure on that - have you checked this?

@flumf
Copy link
Author

flumf commented Mar 24, 2021

Hey, thanks for the quick response!

Attaching the scaffolding project generated here. It hasn't been retargeted yet (or even opened in any IDE), so hopefully nothing is broken there.

With regards to injecting DLLs into Genshin, there's a few patches you can apply to UnityPlayer.dll that allow you to prevent the driver from starting - which allows you to inject dlls, dump global-metadata, and things of that nature without (ab)using libcapcom/csrss renaming. I don't have a list of the patches on hand, however I'll post them (if needed) once I dig them up again.

tmp.zip

@djkaty
Copy link
Owner

djkaty commented Apr 5, 2021

Finally downloaded the project. I'm on hiatus til around mid-May so I'm gonna have to look into it then, sorry for the slowness.

I'd be very interested to see those patches if you're able to share :)

@flumf
Copy link
Author

flumf commented Apr 5, 2021

No worries about the hiatus, take your time.

Patches are attached, there's no guarantee that you'll be able to connect to actual servers since these will likely fail the file validation.

patches.txt

@jamescallen246
Copy link

jamescallen246 commented Apr 27, 2021

Hi, sorry that this is a bit unrelated but could you also add saving the global-metadata.dat after it has been decrypted/deobfuscated? Only if you have the time. It only saves the original one. Thank you

@Daedie-git
Copy link

No worries about the hiatus, take your time.

Patches are attached, there's no guarantee that you'll be able to connect to actual servers since these will likely fail the file validation.

patches.txt

If you (or Katy) happen to still be interested in fixing this. The problem is actually a bug in the unity header. in file 24-2017.4.15-2017.4.40.h at line 1871.

struct Il2CppDecimal
{
...
} Il2CppClass;

should be

struct Il2CppDecimal
{
...
};

@flumf
Copy link
Author

flumf commented Sep 14, 2021

Ah, thank you! It seems that there's already a pull request for this (see #181), so hopefully Katy merges that when she gets a chance. I'll fix this locally and close this issue for now.

@flumf flumf closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants