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

Fix AddResource offset for Linux #479

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

Yarukon
Copy link
Contributor

@Yarukon Yarukon commented Jun 5, 2024

need those who use linux to test this to see if the crash still occur
(i dont have linux enviroment to test this rn)
how to test:
try precache something and then change map

@Yarukon Yarukon requested a review from roflmuffin as a code owner June 5, 2024 14:00
@Yarukon Yarukon changed the title Fix linux's AddResource offset Fix AddResource offset for Linux Jun 5, 2024
@xen-000
Copy link

xen-000 commented Jun 6, 2024

I believe the offset should be 0 on linux and 2 on windows, this is because the first 3 functions in IEntityResourceManifest are all overloads of AddResource:

class IEntityResourceManifest
{
public:
	virtual void AddResource(const char*) = 0;
	virtual void AddResource(const char*, void*) = 0;
	virtual void AddResource(const char*, void*, void*, void*) = 0;
	virtual void unk_04() = 0;
	virtual void unk_05() = 0;
	virtual void unk_06() = 0;
	virtual void unk_07() = 0;
	virtual void unk_08() = 0;
	virtual void unk_09() = 0;
	virtual void unk_10() = 0;
};

So what you want to use is the first one, or offset 0. But MSVC flips overload ordering so it becomes the third function, or offset 2.

@Yarukon
Copy link
Contributor Author

Yarukon commented Jun 7, 2024

I believe the offset should be 0 on linux and 2 on windows, this is because the first 3 functions in IEntityResourceManifest are all overloads of AddResource:

class IEntityResourceManifest
{
public:
	virtual void AddResource(const char*) = 0;
	virtual void AddResource(const char*, void*) = 0;
	virtual void AddResource(const char*, void*, void*, void*) = 0;
	virtual void unk_04() = 0;
	virtual void unk_05() = 0;
	virtual void unk_06() = 0;
	virtual void unk_07() = 0;
	virtual void unk_08() = 0;
	virtual void unk_09() = 0;
	virtual void unk_10() = 0;
};

So what you want to use is the first one, or offset 0. But MSVC flips overload ordering so it becomes the third function, or offset 2.

changed to 0

@xLeviNx
Copy link
Contributor

xLeviNx commented Jun 7, 2024

Tested. This can be merged.

@roflmuffin

@roflmuffin roflmuffin merged commit 2eaf7c2 into roflmuffin:main Jun 13, 2024
5 checks passed
@Yarukon Yarukon deleted the try-fix-precache branch June 27, 2024 05:36
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.

4 participants