GTA-V-Script-Decompiler icon indicating copy to clipboard operation
GTA-V-Script-Decompiler copied to clipboard

Large number of "unhandled jumps" and logical issues

Open Lucas7yoshi opened this issue 1 year ago • 1 comments

blackjack.ysc (as of 2944) has a immense number of unhandled jumps in a large array of functions that all are basically just elaborate switch statements, all of which have defaults with goto's:

An example is the function at 0x7B6C

// Unhandled jump detected. Output should be considered invalid
char* _GET_DEALER_IDLE_SINGLE_ANIM(int iParam0, int iParam1) // Position - 0x7B6C Hash - 0x3782CC3B ^0x3782CC3B
{
	// [[some code trimmed for size]]
	if (uLocal_112.f_1550_DEALER_VARIATION[iParam0] >= 7)
	{
		switch (num)
		{
			case 0:
				return "female_idle_single_p01";
		
			case 1:
				return "female_idle_single_p02";
		
			case 2:
				return "female_idle_single_p03";
		
			case 3:
				return "female_idle_single_p04";
		
			default:
				goto 0xC0;
		}
	}
	else
	{
		switch (num)
		{
			case 0:
				return "idle_single_p01";
		
			case 1:
				return "idle_single_p02";
		
			case 2:
				return "idle_single_p03";
		
			case 3:
				return "idle_single_p04";
		
			default:
			
		}
	}

	return "";
}

These are all over blackjack.ysc

Logical issues

Conveniently easy to find by just searching for \t! If statements appear to have parts of them escape into being inside of the code Blackjack.c aswell:

void func_77(var uParam0) // Position - 0x89F1 Hash - 0x7623605C ^0x6B47B1A0
{
	Entity entity;

	if (NETWORK::NETWORK_DOES_NETWORK_ID_EXIST(*hand))
		!NETWORK::NETWORK_HAS_CONTROL_OF_NETWORK_ID(*hand);

	if (NETWORK::NETWORK_DOES_ENTITY_EXIST_WITH_NETWORK_ID(*hand))
	{
		entity = NETWORK::NET_TO_ENT(*hand);
		ENTITY::DELETE_ENTITY(&entity);
	}

	return;
}```
Some other functions in blackjack.ysc
0x19692
0x19476
0x1A2FB

Hopefully these aren't too much trouble, nonetheless the best decompiler :p

Lucas7yoshi avatar Jul 06 '23 20:07 Lucas7yoshi

has a immense number of unhandled jumps

There is not much I can do about this, though I could try to optimize the output when I have the time

If statements appear to have parts of them escape into being inside of the code

This is caused by remnants of debug code in the release version of the game. The decompiler removes trivial expressions already, but it can't remove functions or natives since it is impossible to predict the possible side-effects they could have

maybegreat48 avatar Jul 11 '23 02:07 maybegreat48