Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

[SA]Creating Custom Binary IPL


Grinch_
 Share

Recommended Posts

Binary IPL
 

If you don't know anything about ipl I'll suggest you read from below sites first covering the text ipl files.

GTA Mods

Basically binary ipl files are text ipl in binary format.Its only present in GTA San Andreas, GTA IV, and Bully Scholarship Edition. Only INST CARS sections are found used by R*, about the rest sections are unknown. These files are basically located inside IMG archives

Before we start, I'm listing tools you'll need,

1.Text Editor(Notepad will do)
2.An IMG Editor. I suggest this one IMG Factory
3.A text to the binary ipl compiler. I suggest Fastman92 processor

Basically, binary & text ipl are totally the same. There's a structure for the binary ipl here. Let's take a look at an inst line


Normal Ipl:

Quote

15072, PLS_carpark, 0, 2579.8796445, 645.50208432, 9.93, 0, 0, 0, 1, -1

 

 

Binary Ipl:

Quote

15072, dummy, 0, 2579.8796445, 645.50208432, 9.93, 0, 0, 0, 1, -1

 

These above two lines are the placement data of the same object. First one is the line in text ipl files & the second one is the decompiled form of the binary line. It's not actually related to this converting thingy but I just wanted to point it out that the name is actually ignored by the game both in text & binary form. 


So, now extract the fastman92 processor in a folder. After that copy your ipl files there.
yZxOXPU.png

Let's take a look at our ipl file,
mh9RFsP.png
Now edit the fastman92_processor.bat
Hzj7UDf.png

You'll find a window like this,
djqOO0p.png

Next, you'll have to do is change this line,

fastman92_processor.exe /file_type ipl /input_type binary /input_game GAME_EXACT_BULLY_SCHOLARSHIP_EDITION_PC /input_filename "trich.ipb" /output_type text /output_game GAME_EXACT_BULLY_SCHOLARSHIP_EDITION_PC /output_filename "trich.ipl" /string_list data\bully_strings.txt

 

With this one below,

fastman92_processor.exe /file_type ipl /input_type text /input_game GAME_EXACT_GTASA_PC /input_filename "bin.ipl" /output_type binary /output_game GAME_EXACT_GTASA_PC /output_filename "bin_stream.ipl"

 

Change your input and output file names in the above code but keep the _stream extension in the output file name or you'll have to add it later.

Next, save it and run.

7UunMI5.png

After running you'll end up with something like this,
OAAWXTp.png

after this open up your IMG archive(gta3.img or other) using IMG Factory and import it and rebuild. Then create a new text file and rename it with your output file but without the _stream extension.

I've only used "bin_stream.ipl" file but multiple binary ipl files can also be loaded through a single text counterpart by using below naming scheme,

Quote

bin_stream0.ipl

bin_stream1.ipl

bin_stream2.ipl

bin_stream3.ipl

...

etc

 


BRwnMNC.png

The file preview
bZiz7UI.png

You can leave this file empty but it's necessary to load the binary file. Please be caution with naming. The only difference with this and the binary file should be "_stream" or it won't work.

After this copy this file location and goto your game directory data/ and open up the gta.dat file. Then goto ipl section paste your file location like this,
MRob35U.png

or if you got modloader you can just paste the location in a text file and put it in mod loader directory.
L242Yny.png

Then save it. Now run your game and check if the object is spawned or not.

Thanks to fastman92 and junior for their help with this.
Note: I learned all this through trial and error process. So, if I wrote anything wrong, please point it and I'll fix it as soon as I can. Thanks!

Edited by Grinch_
  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

I recommend you to make a batch script for converting the file in both ways.

Fastman92 processor is command-line application. It's your task to make some form of GUI if necessary.

  • Like 2
Link to comment
Share on other sites

5 hours ago, fastman92 said:

I recommend you to make a batch script for converting the file in both ways.

Fastman92 processor is command-line application. It's your task to make some form of GUI if necessary.

hmm.Still,its one of the best one yet.Cause most of them I've tied didnt work for me rather than this.

Edited by Inan-Ahammad
Link to comment
Share on other sites

Binary placement files are also used in Bully Scholarship Editor.

  • Like 2
Link to comment
Share on other sites

  • 2 years later...
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <AutoItConstants.au3>
#include <Process.au3>

Global $g_sFilePath = "", $g_sSetFile = "", $g_hSelect = 0
Global $g_hForm1, $g_hLabel2, $g_hButton1, $g_hBackup, $g_hButton2, $g_hLog
#Region ### START Koda GUI section ### Form=C:\ufc\pywrite\Form1.kxf
$g_hForm1 = GUICreate("GTA San Andreas IPL CONVERTER.", 295, 296, 379, 211)
$g_hLabel2 = GUICtrlCreateLabel("IPL CONVERTER. (It is automatic Backup/decomp.).", 16, 32, 242, 17)
$g_hButton1 = GUICtrlCreateButton("Select", 32, 88, 73, 25)
$g_hSelect = GUICtrlCreateInput("Select fileload.* file.", 16, 56, 265, 21)
$g_hBackup = GUICtrlCreateCheckbox("Backup", 176, 88, 81, 17)
$g_hButton2 = GUICtrlCreateButton("Start", 104, 256, 89, 25)
$g_hLog = GUICtrlCreateEdit("", 16, 128, 257, 113)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $g_hButton1 ; Select
			; Create a constant variable in Local scope of the filepath that will be read/written to.
			$g_sFilePath = FileOpenDialog("Select IPL file.", @ScriptDir & "\", "IPL (*.ipl)|All Files (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
			If @error <> 0 Or StringIsSpace($g_sFilePath) Then $g_sFilePath = $g_sSetFile
			If $g_sFilePath <> $g_sSetFile Then
				$g_sSetFile = String($g_sFilePath)
				GUICtrlSetData($g_hSelect, $g_sFilePath)
			EndIf
		Case $g_hButton2 ; Start
			FixTool()
	EndSwitch
WEnd

Func FixTool()
	Static $sLog = "Fail", $sExtended = 0
	Local $aFiles = StringSplit($g_sFilePath, "|", 2)
	If Not @error Or FileExists($g_sFilePath) Then

		If StringInStr($g_sFilePath, "|") > 0 Then
			For $s = 1 To UBound($aFiles) -1
				$aFiles[$s] = $aFiles[0] & "\" & $aFiles[$s]
			Next

			_ArrayDelete($aFiles, 0)
		Else
			Local $aFiles[1] = [$g_sFilePath]
		EndIf

		; _ArrayDisplay($aFiles)
		$sLog = "# LOG" & @CRLF
		For $s in $aFiles

			If FileExists($s) = 0 Then ContinueLoop

			; Open the file for reading and store the handle to a variable.
			Local $hFileOpen = FileOpen($s, $FO_BINARY)
			If $hFileOpen = -1 Then
				MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file. - " & $s)
				ContinueLoop
			EndIf

			; Read the contents of the file using the handle returned by FileOpen.
			Local $sFileRead = FileRead($hFileOpen)

			Local $sBaka = $s & '.tmp'
			FileCopy($s, $sBaka)

			SetLog(StringLeft($sFileRead, 10))
			If StringLeft($sFileRead, 10) = "0x626E7279" Then
				FileClose($hFileOpen)
				$sExtended = runHelper('"' & @ScriptDir & "\fastman92_processor.exe" & '" /file_type ipl /input_type binary /input_game GAME_EXACT_GTASA_PC /input_filename "' & $s & '" /output_type text /output_game GAME_EXACT_GTASA_PC /output_filename "' & $sBaka  & '"')
				$sExtended = "input_type binary"
				If _IsChecked($g_hBackup) Then
					FileCopy($s, $s & ".oldbin")
				EndIf
			Else
				FileCopy($s, $sBaka)
				$sExtended = runHelper('"' & @ScriptDir & "\fastman92_processor.exe" & '" /file_type ipl /input_type text /input_game GAME_EXACT_GTASA_PC /input_filename "' & $s & '" /output_type binary /output_game GAME_EXACT_GTASA_PC /output_filename "' & $sBaka  & '"')
				$sExtended = "input_type text"
				If _IsChecked($g_hBackup) Then
					FileCopy($s, $s & ".oldtext")
				EndIf
			EndIf

			FileMove($s & ".tmp", $s, $FC_OVERWRITE)


			$sLog &= $s & " - " & $sExtended & @CRLF
		Next
	EndIf
	GUICtrlSetData($g_hLog, $sLog)
EndFunc   ;==>Example

Func Write($sFilePath, $dBINARYDATA)
    Local $hFile = FileOpen($sFilePath, $FO_OVERWRITE + $FO_BINARY)
    FileWrite($hFile, $dBINARYDATA)
    FileClose($hFile)
EndFunc   ;==>Example

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

Func runHelper($sMsg)
	Local $sCommand, $sDOS, $tHelperStartTime, $tTime_Difference
	Static $sMessage = ''

	SetLog($sMsg)
	$sCommand = $sMsg

	$sDOS = Run($sCommand, "", @SW_HIDE, 8)
	$tHelperStartTime = TimerInit()
	$sMessage = ''
	While 1
		$sMessage &= StdoutRead($sDOS)
		If @error Then ExitLoop
	WEnd
	_RunDos("taskkill -f -im fastman92_processor.exe") ; force kill
	Return StringStripWS($sMessage, 7)
EndFunc   ;==>runHelper

Func SetLog($s = "", $s2Dummy = "")
	ConsoleWrite($s & @CRLF)
EndFunc

 

AutoIT Script :p It has some bugs, but it is supposed to detect whether it is binary or text.

Edited by boludoz
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.