Results 1 to 1 of 1

Thread: GTA IV Xassist

Threaded View

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    GTA IV Xassist

    Hi,

    I made this small application in Visual Basic 6.0 to automatically delete the stupid default settings that keep overriding and resetting the default controls in GTA IV. All you need to do is ad the code to a form and compile the project. After that place the execute file that is created in the GTA IV directory and run it.


    Version1 (aka GTA IV Controls override):
    vb Code:
    1. 'Description: checks the system for the default GTA IV settings files
    2. 'and deletes them so you can play the game using the controls you define.
    3. 'Date: 04/05/2011
    4. 'Update 07/04/2011 Refined the code to remove unnecessary code.
    5. '                  Also, remove the need for a form the code only requires a module to run.
    6. 'Author: Aaron Spehr
    7. 'Alias: Nightwalker83
    8. 'Website: http://aaronspehr.net/
    9.  
    10. Option Explicit
    11. Private sUserName As String
    12.      Private path As String
    13. 'Used to get the username of the currently logged in account
    14. Private Declare Function GetUserName Lib "advapi32.dll" _
    15. Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    16. 'Used to get the operating system version
    17. Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Integer
    18.    Private Type STARTUPINFO
    19.      cb As Long
    20.      lpReserved As String
    21.      lpDesktop As String
    22.      lpTitle As String
    23.      dwX As Long
    24.      dwY As Long
    25.      dwXSize As Long
    26.      dwYSize As Long
    27.      dwXCountChars As Long
    28.      dwYCountChars As Long
    29.      dwFillAttribute As Long
    30.      dwFlags As Long
    31.      wShowWindow As Integer
    32.      cbReserved2 As Integer
    33.      lpReserved2 As Long
    34.      hStdInput As Long
    35.      hStdOutput As Long
    36.      hStdError As Long
    37.   End Type
    38.  
    39.   Private Type PROCESS_INFORMATION
    40.      hProcess As Long
    41.      hThread As Long
    42.      dwProcessId As Long
    43.      dwThreadID As Long
    44.   End Type
    45.  
    46.   Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
    47.      hHandle As Long, ByVal dwMilliseconds As Long) As Long
    48. 'API Constants
    49.  Const SMTO_BLOCK = &H1
    50.  Const SMTO_ABORTIFHUNG = &H2
    51.  Const WM_NULL = &H0
    52.  Const WM_CLOSE = &H10
    53.  Const PROCESS_ALL_ACCESS = &H1F0FFF
    54. 'API functions
    55.  
    56. Private Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" _
    57. (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As _
    58. Long, ByVal fuFlags As Long, ByVal uTimeout As Long, lpdwResult As Long) As Long
    59.  
    60.   Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
    61.      lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
    62.      lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
    63.      ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
    64.      ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
    65.      lpStartupInfo As STARTUPINFO, lpProcessInformation As _
    66.      PROCESS_INFORMATION) As Long
    67.  
    68.   Private Declare Function CloseHandle Lib "kernel32" _
    69.      (ByVal hObject As Long) As Long
    70.  
    71.   Private Declare Function GetExitCodeProcess Lib "kernel32" _
    72.      (ByVal hProcess As Long, lpExitCode As Long) As Long
    73.  
    74.   Private Const NORMAL_PRIORITY_CLASS = &H20&
    75.      Private Const INFINITE = -1&
    76.      Dim proc As PROCESS_INFORMATION
    77.      Dim start As STARTUPINFO
    78.      Dim ret&
    79. Private Type OSVERSIONINFO
    80. dwOSVersionInfoSize As Long
    81. dwMajorVersion As Long
    82. dwMinorVersion As Long
    83. dwBuildNumber As Long
    84. dwPlatformId As Long
    85. szCSDVersion As String * 128
    86. End Type
    87.  
    88.   Public Function ExecCmd(cmdline$)
    89.  
    90.      ' Initialize the STARTUPINFO structure:
    91.      start.cb = Len(start)
    92.  
    93.      ' Start the shelled application:
    94.      ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
    95.         NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
    96.  
    97.      ' Wait for the shelled application to finish:
    98.         ret& = WaitForSingleObject(proc.hProcess, INFINITE)
    99.         Call GetExitCodeProcess(proc.hProcess, ret&)
    100.         Call CloseHandle(proc.hThread)
    101.         Call CloseHandle(proc.hProcess)
    102.         ExecCmd = ret&
    103.   End Function
    104.  
    105. Private Sub Main()
    106.    Dim retval As Long
    107.    Dim lngResult As Long
    108.    Dim lngReturnValue As Long
    109.       CurrentUser
    110.       WinVersion
    111.    'Replace the path and app.name.type with that of the application you want to use
    112.      retval = ExecCmd("GTAIV.exe")
    113.      
    114.        lngReturnValue = SendMessageTimeout(0, WM_NULL, 0&, 0&, SMTO_ABORTIFHUNG And SMTO_BLOCK, 1000, lngResult)
    115.    DoEvents
    116.    If Not lngReturnValue Then
    117.    'Close the host and the client if the client does not respond
    118.        Call GetExitCodeProcess(proc.hProcess, ret&)
    119.        Call CloseHandle(proc.hThread)
    120.        Call CloseHandle(proc.hProcess)
    121.       'Unload Me
    122.    End If
    123. End Sub
    124.  
    125.  
    126. Private Sub WinVersion()
    127. 'Retrive the current operating system and set the settings path accordingly
    128. 'http://social.msdn.microsoft.com/Forums/en/vbide/thread/395b12fd-ccfc-4281-b1b3-4c69b56f8b85
    129.    Dim osinfo As OSVERSIONINFO
    130.    Dim retvalue As Integer
    131.  
    132.    osinfo.dwOSVersionInfoSize = 148
    133.    osinfo.szCSDVersion = Space$(128)
    134.    retvalue = GetVersionExA(osinfo)
    135.    If osinfo.dwMajorVersion = 7 Then 'Windows 7
    136.    path = "C:\Users\" + sUserName + "\AppData\Local\Rockstar Games\GTA IV\Settings\"
    137.    ElseIf osinfo.dwMajorVersion = 6 Then 'Vista
    138.    path = "C:\Users\" + sUserName + "\AppData\Local\Rockstar Games\GTA IV\Settings\"
    139.    'MsgBox (path)
    140.    ElseIf osinfo.dwMajorVersion = 5 Then 'XP
    141.    path = "C:\Documents and Settings\" + sUserName + "\Local Settings\Application Data\Rockstar Games\GTA IV\Settings\"
    142.    'ElseIf osinfo.dwMajorVersion = 4 Then 'Win2k etc.
    143.    Else
    144.    End If
    145.    Call Delete(path)
    146. End Sub
    147.  
    148. Public Function CurrentUser() As String
    149. '*********************************************************
    150. '* Function to get the current logged on user in windows *
    151. '*********************************************************
    152. 'http://www.vbforums.com/showthread.php?t=357723
    153. Dim strBuff As String * 255
    154. Dim X As Long
    155.  
    156. CurrentUser = ""
    157. X = GetUserName(strBuff, Len(strBuff) - 1)
    158. If X > 0 Then
    159. 'Look for Null Character, usually included
    160. X = InStr(strBuff, vbNullChar)
    161. 'Trim off buffered spaces too
    162. If X > 0 Then
    163. CurrentUser = UCase(Left$(strBuff, X - 1)) 'UCase is optional;)
    164. Else
    165. CurrentUser = UCase(Left$(strBuff, X))
    166. End If
    167. End If
    168. sUserName = CurrentUser
    169. End Function
    170.  
    171. Private Function Delete(path As String)
    172. Dim sNextFile As String
    173. sNextFile = Dir$(path + "*.*", vbNormal + vbHidden + vbReadOnly)
    174. Do While sNextFile <> ""
    175.     SetAttr path & sNextFile, vbNormal
    176.     Kill (path & sNextFile)
    177.     sNextFile = Dir$
    178. Loop
    179. End Function

    I have been working on a little program in Visual Basic 6.0 that automatically deletes the default controls in GTA IV thus allows the player to use the controls they define. I have also added code to keep the fps in-game to 25 hopefully making the last mission easier and able to be completed first try. I have also added command line input. Just play the "commandline.txt" in the GTA IV game directory and run the game.


    Change log: version 2.1.0.0

    'Description: checks the system for the default GTA IV settings files
    'and deletes them so you can play the game using the controls you define.
    'Date: 04/05/2011
    'Update 07/05/2011 Refined the code to remove unnecessary code.
    ' Also, removed the need for a form the code only requires a module to run.
    'Update: 16/05/2011 Modified the code to use dynamic paths instead of hard coded paths.
    'Update: 18/05/2011 Added a function to copy the source files to a new directory if the user is using xliveless.
    'Update: 20/05/2011 Added function to retrieve the folder name of the folder containing the save files
    'Update: 26/05/2011 Added command-line functions
    'Update: 16/07/2011 Added code to adjust the default frame rate
    'Update: 30/07/2011 The code now includes a sub to detect if the target program is still responding
    ' Added GTA IV icon
    'Author: Aaron Spehr
    'Alias: Nightwalker83
    'Website: http://aaronspehr.net/

    To install just put the "Xassist.exe" in the GTA IV game folder and create a desktop shortcut for the program then run it.

    Please check: http://www.gtaforums.com/index.php?showtopic=482307 for future updates.
    Attached Files Attached Files
    Last edited by Nightwalker83; Dec 28th, 2011 at 08:57 PM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width