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

Failure to determine end of function scope in freemode. #16

Open
gir489returns opened this issue Jul 28, 2024 · 0 comments
Open

Failure to determine end of function scope in freemode. #16

gir489returns opened this issue Jul 28, 2024 · 0 comments

Comments

@gir489returns
Copy link

The decompiler failed to understand that func_17111 is a nullsub, and simply continued on instead of ending the function scope and starting over.

This is what it generated:

void func_17111()//Position - 0x5599D6
{
	return;
	if (func_17096(0) == 0 && func_17096(1) == 0)
	{
		Global_1573131.f_6 = 0;
		return;
	}
	if (PED::IS_PED_INJURED(PLAYER::PLAYER_PED_ID()))
	{
		Global_1573131.f_6 = 0;
		return;
	}
	if (TASK::IS_PED_RUNNING(PLAYER::PLAYER_PED_ID()) || TASK::IS_PED_SPRINTING(PLAYER::PLAYER_PED_ID()))
	{
		Global_1573131.f_6 = 1;
		return;
	}
	Global_1573131.f_6 = 0;
}

But this is what it looks like in the script opcode VM.

CODE:005599D6                sub_5599D6:                             ; CODE XREF: sub_55155B+35↑P
CODE:005599D6 2D 00 02 00 00                 ENTER   0, 2
CODE:005599DB 2E 00 00                       LEAVE   0, 0
CODE:005599DB                ; End of function sub_5599D6
CODE:005599DB
CODE:005599DE                ; ---------------------------------------------------------------------------
CODE:005599DE 71                             PUSH_CONST_0 0
CODE:005599DF 5D 93 93 55                    CALL    sub_559393
CODE:005599E3 71                             PUSH_CONST_0 0
CODE:005599E4 08                             IEQ
CODE:005599E5 2A                             DUP
CODE:005599E6 56 08 00                       JZ      loc_5599F1
CODE:005599E9 72                             PUSH_CONST_1 1
CODE:005599EA 5D 93 93 55                    CALL    sub_559393
CODE:005599EE 71                             PUSH_CONST_0 0
CODE:005599EF 08                             IEQ
CODE:005599F0 1F                             IAND
CODE:005599F1
CODE:005599F1                loc_5599F1:                             ; CODE XREF: CODE:005599E6↑o
CODE:005599F1 56 0A 00                       JZ      loc_5599FE
CODE:005599F4 71                             PUSH_CONST_0 0
CODE:005599F5 61 0B 01 18                    GLOBAL_U24 0x18010B
CODE:005599F9 42 06                          IOFFSET_U8_STORE 6
CODE:005599FB 2E 00 00                       LEAVE   0, 0
CODE:005599FE                ; ---------------------------------------------------------------------------
CODE:005599FE
CODE:005599FE                loc_5599FE:                             ; CODE XREF: CODE:loc_5599F1↑o
CODE:005599FE 2C 01 01 D7                    NATIVE  1, native_4A8C381C258A124D
CODE:00559A02 2C 05 0A 49                    NATIVE  5, native_4FAFF4BCB7633475
CODE:00559A06 56 0A 00                       JZ      loc_559A13
CODE:00559A09 71                             PUSH_CONST_0 0
CODE:00559A0A 61 0B 01 18                    GLOBAL_U24 0x18010B
CODE:00559A0E 42 06                          IOFFSET_U8_STORE 6
CODE:00559A10 2E 00 00                       LEAVE   0, 0
CODE:00559A13                ; ---------------------------------------------------------------------------
CODE:00559A13
CODE:00559A13                loc_559A13:                             ; CODE XREF: CODE:00559A06↑o
CODE:00559A13 2C 01 01 D7                    NATIVE  1, native_4A8C381C258A124D
CODE:00559A17 2C 05 02 C6                    NATIVE  5, native_24433628C02BED5F
CODE:00559A1B 2A                             DUP
CODE:00559A1C 06                             INOT
CODE:00559A1D 56 09 00                       JZ      loc_559A29
CODE:00559A20 2C 01 01 D7                    NATIVE  1, native_4A8C381C258A124D
CODE:00559A24 2C 05 06 F5                    NATIVE  5, native_6F21822F60DC0945
CODE:00559A28 20                             IOR
CODE:00559A29
CODE:00559A29                loc_559A29:                             ; CODE XREF: CODE:00559A1D↑o
CODE:00559A29 56 0A 00                       JZ      loc_559A36
CODE:00559A2C 72                             PUSH_CONST_1 1
CODE:00559A2D 61 0B 01 18                    GLOBAL_U24 0x18010B
CODE:00559A31 42 06                          IOFFSET_U8_STORE 6
CODE:00559A33 2E 00 00                       LEAVE   0, 0
CODE:00559A36                ; ---------------------------------------------------------------------------
CODE:00559A36
CODE:00559A36                loc_559A36:                             ; CODE XREF: CODE:loc_559A29↑o
CODE:00559A36 71                             PUSH_CONST_0 0
CODE:00559A37 61 0B 01 18                    GLOBAL_U24 0x18010B
CODE:00559A3B 42 06                          IOFFSET_U8_STORE 6
CODE:00559A3D 2E 00 00                       LEAVE   0, 0
CODE:00559A40
CODE:00559A40                ; =============== S U B R O U T I N E =======================================
CODE:00559A40
CODE:00559A40
CODE:00559A40                sub_559A40:                             ; CODE XREF: sub_55155B+31↑P
CODE:00559A40 2D 00 03 00 00                 ENTER   0, 3
CODE:00559A45 62 17 04 18                    GLOBAL_U24_LOAD 0x180417
CODE:00559A49 71                             PUSH_CONST_0 0
CODE:00559A4A 57 03 00                       IEQ_JZ  loc_559A50
CODE:00559A4D 2E 00 00                       LEAVE   0, 0
CODE:00559A50                ; ---------------------------------------------------------------------------
CODE:00559A50
CODE:00559A50                loc_559A50:                             ; CODE XREF: sub_559A40+A↑o
CODE:00559A50 2C 01 0A 52                    NATIVE  1, native_7E3F74F641EE6B27
CODE:00559A54 61 0B 01 18                    GLOBAL_U24 0x18010B
CODE:00559A58 41 19                          IOFFSET_U8_LOAD 0x19
CODE:00559A5A 2C 09 0A B2                    NATIVE  9, native_C9FA0059132D5731
CODE:00559A5E 56 03 00                       JZ      loc_559A64
CODE:00559A61 2E 00 00                       LEAVE   0, 0
CODE:00559A64                ; ---------------------------------------------------------------------------
CODE:00559A64
CODE:00559A64                loc_559A64:                             ; CODE XREF: sub_559A40+1E↑o
CODE:00559A64 2C 01 0A 52                    NATIVE  1, native_7E3F74F641EE6B27
CODE:00559A68 43 E8 03                       PUSH_CONST_S16 0x3E8
CODE:00559A6B 2C 09 00 A1                    NATIVE  9, native_AD5B43C219C4CB92
CODE:00559A6F 61 0B 01 18                    GLOBAL_U24 0x18010B
CODE:00559A73 42 19                          IOFFSET_U8_STORE 0x19
CODE:00559A75 71                             PUSH_CONST_0 0
CODE:00559A76 39 02                          LOCAL_U8_STORE 2
CODE:00559A78 2C 01 0A 52                    NATIVE  1, native_7E3F74F641EE6B27
CODE:00559A7C 38 02                          LOCAL_U8_LOAD 2
CODE:00559A7E 61 FE 03 18                    GLOBAL_U24 0x1803FE
CODE:00559A82 34 03                          ARRAY_U8 3
CODE:00559A84 41 02                          IOFFSET_U8_LOAD 2
CODE:00559A86 2C 09 0A B2                    NATIVE  9, native_C9FA0059132D5731
CODE:00559A8A 56 03 00                       JZ      loc_559A90
CODE:00559A8D 2E 00 00                       LEAVE   0, 0
CODE:00559A90                ; ---------------------------------------------------------------------------
CODE:00559A90
CODE:00559A90                loc_559A90:                             ; CODE XREF: sub_559A40+4A↑o
CODE:00559A90 5D AB 27 55                    CALL    sub_5527AB
CODE:00559A94 2E 00 00                       LEAVE   0, 0
CODE:00559A94                ; End of function sub_559A40
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

No branches or pull requests

1 participant