FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Unity 2022.3.10 offsets and/or changes by nalka0 · Pull Request #20 · hackf5/unityspy · GitHub

Unity 2022.3.10 offsets and/or changes - #20

Draft
nalka0 wants to merge 1 commit into
hackf5:masterfrom
nalka0:master
Draft

Unity 2022.3.10 offsets and/or changes#20
nalka0 wants to merge 1 commit into
hackf5:masterfrom
nalka0:master

Conversation

nalka0 commented Dec 25, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

This PR contains all the changes I made to make unity spy work on a game using Unity 2022.3.10.

I'm unsure how to create a complete new offset object and would need help with it (I commented the offsets I had to replace with the values I figured out).

There are also some non-offset changes, these probably need some work/testing to make them compatible with all other supported unity versions.

nalka0 marked this pull request as draft December 25, 2023 21:38

sebastientromp commented Jan 14, 2024
edited
Loading

Copy link
Copy Markdown
Collaborator

So the first step to define a new version is to add a new public static readonly MonoLibraryOffsets declaration in MonoLibraryOffsets.cs. By convention, the variable name has the version name, as well as whether it's for a 32- or 64-bits game.
Then you need to fill out all the new offsets. Some of them might have stayed the same, but you'll still have to provide a value for all of them.

Once this is done, you can add it to the List<MonoLibraryOffsets> SupportedVersions in MonoLibraryOffsets.cs.

Normally, these are the only places you should need to modify. If there are other pieces of the code that don't work with that new version, we'll need to investigate more thoroughly.
Edit: Also add the new version to the UnityVersions class like you did

int classCache = this.Process.MonoLibraryOffsets.ImageClassCache;
var classCacheSize = this.ReadUInt32(classCache + this.Process.MonoLibraryOffsets.HashTableSize);
var classCacheTableArray = this.ReadPtr(classCache + this.Process.MonoLibraryOffsets.HashTableTable);
var classCacheSize = this.ReadUInt32(/*classCache + this.Process.MonoLibraryOffsets.HashTableSize*/1256);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Here I only know the good values for classeCache + HashTableSize and classCache + HashTableTable but I have no idea about the individual values of each offset

// Get the generic type arguments
if (this.TypeInfo.TypeCode == TypeCode.GENERICINST)
{
this.fieldCount = this.ReadInt32(96);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Here I can't simply use 96 for the TypeDefinitionFieldCount offset since this line isn't always executed at the same time as the line that uses TypeDefinitionFieldCount


var fields = new List<FieldDefinition>();
if (this.ClassKind == MonoClassKind.GInst)
if (this.ClassKind is MonoClassKind.GInst or MonoClassKind.GParam)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This isn't simply an offset change

private TypeDefinition GetGeneric()
{
if (this.ClassKind != MonoClassKind.GInst)
if (this.ClassKind is MonoClassKind.GInst or MonoClassKind.GParam)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This isn't simply an offset change

case TypeCode.U4:
return sizeof(uint);

return 8;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This doesn't seem to be bound to offsets

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL