GTA 5 0.351

Forum rules
new topics are not allowed in this subsection, only replies.
  • Author
  • Message
Offline
User avatar
*master*
Posts: 134
Joined: 07 Jan 2012, 12:39
Location: Gdynia

Re: GTA 5 0.351

It's a strange behaviour. Maybe in-game anti cheat affects it. Did you try it with a votalite variable? I think the compiler may do some optimizations, but CritSection object should unsure that global variable cannot be optimized.

//edit: I forgot that it works in SkyrimSE, so the votalite variable can't be a solution. Did you check if sdk_CallbackFuncList array was zeroed too? If not, you can iterate the array until a value from the array will be null. I think global arrays are zeroed during initialization in C++. Variables are zeroed for sure.
_________________
CPU: Ryzen 7 5800x MOBO: X570 Aorus Elite GPU: Gigabyte RTX 3070 Gaming OC RAM: Ballistix 2x16GB 3600MHz CL16 SSD: Aorus 1TB M.2 PCIe Gen4 NVMe TV: LG OLED C9 55"

My settings for GTA V
Like it on Facebook

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17559
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: GTA 5 0.351

Yes, i tried aligned volatile and using interlocked too, but no luck at all. I also tried to set temporary variable of the mod to some value when calling ENBSetCallbackFunction by plugin, but this value while in game did not change. It's like plugin is living in it's own address space. Compared projects setting, skyrim and gta5 mods are the same. And i load plugin only once at d3d functions call for creating device, so must be fine.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17559
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: GTA 5 0.351

Hmm, but maybe it's true that anticheat somehow ruin everything, because it should block any dll loading in to process, right? Anyway, my ideas are over now. Yes, different threads calling callback and assign of callback functions, but this still must not be a problem.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17559
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: GTA 5 0.351

How about using openiv or asi loader (dont know what now exist for gta5) to make plugin, then detect mod loaded, import it's functions used by plugins, then use them? It may do the trick.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*master*
Posts: 134
Joined: 07 Jan 2012, 12:39
Location: Gdynia

Re: GTA 5 0.351

I can do an asi script which will have the same functionality as your example plugin. I don't expect any better results, but hope dies last :)
_________________
CPU: Ryzen 7 5800x MOBO: X570 Aorus Elite GPU: Gigabyte RTX 3070 Gaming OC RAM: Ballistix 2x16GB 3600MHz CL16 SSD: Aorus 1TB M.2 PCIe Gen4 NVMe TV: LG OLED C9 55"

My settings for GTA V
Like it on Facebook

Offline
User avatar
*master*
Posts: 134
Joined: 07 Jan 2012, 12:39
Location: Gdynia

Re: GTA 5 0.351

I didn't believe that an asi script could help, but it seems to work :lol:
_________________
CPU: Ryzen 7 5800x MOBO: X570 Aorus Elite GPU: Gigabyte RTX 3070 Gaming OC RAM: Ballistix 2x16GB 3600MHz CL16 SSD: Aorus 1TB M.2 PCIe Gen4 NVMe TV: LG OLED C9 55"

My settings for GTA V
Like it on Facebook

Remix

Re: GTA 5 0.351

robi29 wrote:I didn't believe that an asi script could help, but it seems to work :lol:
This is good news ;)

Offline
User avatar
*master*
Posts: 134
Joined: 07 Jan 2012, 12:39
Location: Gdynia

Re: GTA 5 0.351

I think I found a bug. Color3, Color4 and Vector3 parameters don't work in sdk. I have this code:

Code: Select all

#pragma pack(push, 1)
struct Vector3
{
    float x;
    float y;
    float z;
};
#pragma pack(pop)

Code: Select all

ENBParameter parameterVector;
parameterVector.Type = ENBParam_VECTOR3;
parameterVector.Size = ENBParameterTypeToSize(parameterVector.Type);

Vector3 cameraRotation;
cameraRotation.x = -1.0f;
cameraRotation.y = 0.5f;
cameraRotation.z = 1.0f;

memcpy(parameterVector.Data, &cameraRotation, parameterVector.Size);

char angleName[] = "Angle";
enbSetParameter(NULL, shaderName, angleName, &parameterVector);
In shader:

Code: Select all

float3 Angle
<
    string UIName="Angle";
    string UIWidget="Spinner";
> = {0.0, 0.0, 0.0};
And I see in the enb shaders window three zeros instead of -1.0, 0.5 and 1.0.
It isn't any critical error, because I can pass three floats instead of one 3d vector.
_________________
CPU: Ryzen 7 5800x MOBO: X570 Aorus Elite GPU: Gigabyte RTX 3070 Gaming OC RAM: Ballistix 2x16GB 3600MHz CL16 SSD: Aorus 1TB M.2 PCIe Gen4 NVMe TV: LG OLED C9 55"

My settings for GTA V
Like it on Facebook

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17559
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: GTA 5 0.351

Do you have fallout 4 or skyrim se to check with them? Gta5 version is based on skyrim se core, so it should not work there too, if bug exist, but with gta5 i cant be sure any more.

Just in case, maybe the following code will help you to understand what happening inside

Code: Select all

/*
	serialize.Register("enbseries.ini", category, keyname, param, ENBParam_FLOAT, FALSE);
	//float	xparam;
	//ENBParameterType	xtype;
	//serialize.Get("enbseries.ini", category, keyname, &xparam, &xtype);
//	ENBParameter	outparam;
//	ENBGetParameter("enbseries.ini", category, keyname, &outparam);
	ENBParameter	inparam;
	float	xxx=6.0f;
	memcpy(inparam.Data, &xxx, 4);
	inparam.Type=ENBParam_FLOAT;
	inparam.Size=4;
	ENBSetParameter("enbseries.ini", category, keyname, &inparam);
*/


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EEXPORT long	ENBGetSDKVersion()
{
	return ENBSDKVERSION;
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EEXPORT long	ENBGetVersion()
{
	return EVERSION_NUMBER;
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EEXPORT long	ENBGetGameIdentifier()
{
	return ENBGAMEID_GTA5;
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EEXPORT BOOL	ENBGetParameter(char *filename, char *category, char *keyname, ENBParameter *outparam)
{
	//if (filename==NULL) return FALSE; //it's shader
	if (category==NULL) return FALSE;
	if (keyname==NULL) return FALSE;
	if (outparam==NULL) return FALSE;

	BOOL	res=FALSE;
	unsigned char	tempparam[16];
	for (DWORD k=0; k<16; k++) tempparam[k]=0;
	ENBParameterType	temptype=ENBParam_NONE;
	long	tempsize=0;

	res=serialize.Get(filename, category, keyname, tempparam, &temptype);
	if (res==TRUE)
	{
		if (temptype==ENBParam_NONE) res=FALSE;
		tempsize=ENBParameterTypeToSize(temptype);
		if (res==TRUE)
		{
			outparam->Size=tempsize;
			outparam->Type=temptype;
			memcpy(outparam->Data, tempparam, tempsize);
		}
	}

	return res;
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EEXPORT BOOL	ENBSetParameter(char *filename, char *category, char *keyname, ENBParameter *inparam)
{
	//bypass while locked
	if (sdk_IsLocked==1) return FALSE;

	//if (filename==NULL) return FALSE; //it's shader
	if (category==NULL) return FALSE;
	if (keyname==NULL) return FALSE;
	if (inparam==NULL) return FALSE;
	if (inparam->Size<1) return FALSE;
	if (inparam->Type==ENBParam_NONE) return FALSE;

	BOOL	res=FALSE;
	unsigned char	tempparam[16];
	for (DWORD k=0; k<16; k++) tempparam[k]=0;
	ENBParameterType	temptype=ENBParam_NONE;
	long	tempsize=0;

	temptype=inparam->Type;

	res=serialize.Set(filename, category, keyname, inparam->Data, temptype);

	return res;
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EEXPORT void	ENBSetCallbackFunction(ENBCallbackFunction func)
{
	if (!func) return;
	if (sdk_CallbackFuncCount>=1023) return;
	sdk_CallbackFuncList[sdk_CallbackFuncCount]=func;
	sdk_CallbackFuncCount++;
}



//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void	SDKExecuteCallback(ENBCallbackType calltype)
{
	if (sdk_CallbackFuncCount==0) return;
	if (calltype==0) return;

	//trick, call read parameters
	if (
		(sdk_PrevCallbackType==0) //first time call
		|| ((sdk_PrevCallbackType==ENBCallback_PreSave) && (calltype!=ENBCallback_PreSave))
		|| ((sdk_PrevCallbackType==ENBCallback_PreSave) && (calltype==ENBCallback_EndFrame))
		|| ((sdk_PrevCallbackType==ENBCallback_PreSave) && (calltype==ENBCallback_BeginFrame))
		)
	{
		//calltype=ENBCallback_PostLoad;
		_InterlockedExchange(&sdk_IsLocked, 0);
		for (int i=0; i<sdk_CallbackFuncCount; i++)
		{
			if (sdk_CallbackFuncList[i]!=NULL) sdk_CallbackFuncList[i](ENBCallback_PostLoad);
		}
		_InterlockedExchange(&sdk_IsLocked, 1);
	}


	_InterlockedExchange(&sdk_IsLocked, 0);
	for (int i=0; i<sdk_CallbackFuncCount; i++)
	{
		if (sdk_CallbackFuncList[i]!=NULL) sdk_CallbackFuncList[i](calltype);
	}
	_InterlockedExchange(&sdk_IsLocked, 1);

	_InterlockedExchange(&sdk_PrevCallbackType, (long)calltype);
}
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
User avatar
*master*
Posts: 134
Joined: 07 Jan 2012, 12:39
Location: Gdynia

Re: GTA 5 0.351

Unfortunately I don't have one of these games. But I have a friend who has Fallout 4, so I think I can borrow it from him for testing.
_________________
CPU: Ryzen 7 5800x MOBO: X570 Aorus Elite GPU: Gigabyte RTX 3070 Gaming OC RAM: Ballistix 2x16GB 3600MHz CL16 SSD: Aorus 1TB M.2 PCIe Gen4 NVMe TV: LG OLED C9 55"

My settings for GTA V
Like it on Facebook
Post Reply