const
VERSION_UNKNOWN = -1,
VERSION_1_0_US_CRACKED = 1
VERSION_1_0_EURO_CRACKED = 2
VERSION_1_0_EURO_ORIGINAL = 3
VERSION_1_01_EURO_CRACKED = 4
end

jump @Detect_EXE_version_end

:Get_EXE_version_ID
{
 Description: 
    Returns number of running gta_sa.exe, number depends on gta_sa.exe version.
 Type: PROPERTY
 
 Parameters:
   Passed:
     none
   Result:
     0@ - ID of running version, returned values:
        ; -1   unknown
        ;  1 - GTA San Andreas v1.0 [US] HOODLUM No-CD  Fixed EXE
        ;  2 - GTA San Andreas v1.0 [EURO] No-CD Fixed EXE
        ;  3 - GTA San Andreas v1.0 [EURO] Original
        ;  4 - GTA: San Andreas v1.01 [EURO] No-CD/Fixed EXE
 
 Example:
  0AB1: call_scm_func @Get_EXE_version_ID 0 get_version_number_to 3@
}
0A8D: 0@ = read_memory 0x400088 size 1 virtual_protect 1
0871: init_jump_table 0@ total_jumps 4 default_jump 0 @Get_EXE_version_ID_unknown jumps 0x8A @Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_No_CD_Fixed_EXE 0xCA @Get_EXE_version_ID_GTA_San_Andreas_v1_0_US_HOODLUM_No_CD_Fixed_EXE 0xD0 @Get_EXE_version_ID_GTA_San_Andreas_v1_01_EURO_No_CD_Fixed_EXE 0xF9 @Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_Original -1 @Get_EXE_version_ID_unknown -1 @Get_EXE_version_ID_unknown -1 @Get_EXE_version_ID_unknown

:Get_EXE_version_ID_GTA_San_Andreas_v1_0_US_HOODLUM_No_CD_Fixed_EXE
0AB2: ret 1 VERSION_1_0_US_CRACKED

:Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_No_CD_Fixed_EXE
0AB2: ret 1 VERSION_1_0_EURO_CRACKED

:Get_EXE_version_ID_GTA_San_Andreas_v1_0_EURO_Original
0AB2: ret 1 VERSION_1_0_EURO_ORIGINAL

:Get_EXE_version_ID_GTA_San_Andreas_v1_01_EURO_No_CD_Fixed_EXE
0AB2: ret 1 VERSION_1_01_EURO_CRACKED
                        
:Get_EXE_version_ID_unknown
0AB2: ret 1 VERSION_UNKNOWN

:Is_EXE_version_equal
{
 Description: 
    Compares ID of running gta_sa.exe with passed ID and checks if game version is equal.
 Type: CHECK
 
 Parameters:
   Passed:
     0@ - ID of running version, returned values:
        ; -1   unknown
        ;  1 - GTA San Andreas v1.0 [US] HOODLUM No-CD  Fixed EXE
        ;  2 - GTA San Andreas v1.0 [EURO] No-CD Fixed EXE
        ;  3 - GTA San Andreas v1.0 [EURO] Original
        ;  4 - GTA: San Andreas v1.01 [EURO] No-CD/Fixed EXE
   Result:
     none
 
 Example:
  if
  0AB1: call_scm_func @Is_EXE_version_equal 1 is_exe_version_id_like_this 1     // GTA San Andreas v1.0 [US] HOOLDRUM No-CD  Fixed EXE 
}
0AB1: call_scm_func @Get_EXE_version_ID 0 get_version_number_to 1@
    if
    003B:   0@ == 1@  // (int)
    then
      return_true
    else
      return_false
    end
0AB2: ret 0

:Detect_EXE_version_end