Newbie Spellweaver
- Joined
- Apr 25, 2015
- Messages
- 7
- Reaction score
- 14
Hi guys its me FreehuntX,
i started working on Dragonball Online.
My first goal was to get a nice old version of the client.
Well the oldest i could find was the one posted here. (0.59)
So i thought, maybe i can download the old patchfiles and patch it from 0.47 - 0.54
To do so i tried simplepatcher, but i realized soon its bad written, so i took a look at the patchw32 lib.
It is the library from RTPatch.
Here some information about what RTPatch is, and how it works.
RTPatch is mainly a program, which stores changed information about a file, and overwrites it.
Or, if some new files came, just add them.
So you get the point, you cant simply "Unpack" this files.
You need to patch them.
Thats what patchw32.dll is there for.
Well enough of the talk, here a screen of my tool:
And here the source (Autoit):
Virusscan:
i started working on Dragonball Online.
My first goal was to get a nice old version of the client.
Well the oldest i could find was the one posted here. (0.59)
So i thought, maybe i can download the old patchfiles and patch it from 0.47 - 0.54
To do so i tried simplepatcher, but i realized soon its bad written, so i took a look at the patchw32 lib.
It is the library from RTPatch.
Here some information about what RTPatch is, and how it works.
RTPatch is mainly a program, which stores changed information about a file, and overwrites it.
Or, if some new files came, just add them.
So you get the point, you cant simply "Unpack" this files.
You need to patch them.
Thats what patchw32.dll is there for.
Well enough of the talk, here a screen of my tool:
And here the source (Autoit):
utility.au3
rtpatch.au3
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <FileConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include "rtpatch.au3"
Global $numFiles = 0, $numAllFiles = 0
If Not FileExists [USER=2000175386]Script[/USER]Dir&"\patchw32.dll") Then
MsgBox(16, "Fatal error", "patchw32.dll not found!")
Exit
EndIf
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("RTPatch Utility", 491, 566, 788, 3, -1, $WS_EX_ACCEPTFILES)
GUICtrlCreateLabel("RTP file:", 8, 16, 45, 17)
$fileInput = GUICtrlCreateInput("", 56, 13, 353, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$fileButton = GUICtrlCreateButton("...", 416, 11, 67, 25)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlCreateLabel("Output:", 8, 48, 39, 17)
$outInput = GUICtrlCreateInput("", 56, 45, 353, 21)
$outButton = GUICtrlCreateButton("...", 416, 43, 67, 25)
GUICtrlCreateGroup("Settings", 8, 80, 473, 153)
$ignoreMissingCheckbox = GUICtrlCreateCheckbox("ignoreMissing", 24, 128, 81, 17)
$backupCheckbox = GUICtrlCreateCheckbox("backup", 24, 104, 57, 17)
$listCheckbox = GUICtrlCreateCheckbox("list", 24, 152, 33, 17)
$singleFileCheckbox = GUICtrlCreateCheckbox("singleFile", 24, 176, 65, 17)
$singleFileInput = GUICtrlCreateInput("", 88, 174, 121, 21)
$confirmCheckbox = GUICtrlCreateCheckbox("confirm", 24, 200, 57, 17)
$errorFileCheckbox = GUICtrlCreateCheckbox("errorFile", 224, 104, 57, 17)
$messageCheckbox = GUICtrlCreateCheckbox("message", 224, 128, 65, 17)
$pathSearchCheckbox = GUICtrlCreateCheckbox("pathSearch", 224, 152, 73, 17)
$splitCheckbox = GUICtrlCreateCheckbox("split", 224, 176, 41, 17)
$subDirSearchCheckbox = GUICtrlCreateCheckbox("subDirSearch", 224, 200, 81, 17)
$tzCheckbox = GUICtrlCreateCheckbox("tz", 368, 104, 97, 17)
$undoCheckbox = GUICtrlCreateCheckbox("undo", 368, 128, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$patchProgress = GUICtrlCreateProgress(8, 240, 473, 25)
$logEdit = GUICtrlCreateEdit("", 8, 272, 473, 249, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$WS_VSCROLL,$WS_HSCROLL))
_GUICtrlEdit_SetLimitText(-1, 1000000)
GUICtrlSetData(-1, "")
$patchButton = GUICtrlCreateButton("Patch", 8, 531, 475, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
GUICtrlSetData($fileInput, [USER=284105]Gui[/USER]_DragFile)
GUICtrlSetData($outInput, getFilePath( [USER=284105]Gui[/USER]_DragFile ))
Case $fileButton
$file = FileOpenDialog("Select a valid patchfile", [USER=2000175386]Script[/USER]Dir & "", "RTPatch (*.RTP)", $FD_FILEMUSTEXIST)
GUICtrlSetData($fileInput, $file)
GUICtrlSetData($outInput, getFilePath( $file ))
Case $outButton
$out = FileSelectFolder ( "Select a output folder", [USER=2000175386]Script[/USER]dir )
GUICtrlSetData($outInput, $out)
Case $patchButton
$numFiles = 0
patchApply( GUICtrlRead($fileInput), GUICtrlRead($outInput) )
EndSwitch
WEnd
Func patchApply( $file, $out )
$CMD = '"'&$file&'" "'&$out&'"'
If GUICtrlRead($backupCheckbox) = 1 Then $CMD &= " /b"
If GUICtrlRead($ignoreMissingCheckbox) = 1 Then $CMD &= " /i"
If GUICtrlRead($listCheckbox) = 1 Then $CMD &= " /l"
If GUICtrlRead($singleFileCheckbox) = 1 Then $CMD &= " /f:"&GUICtrlRead($singleFileInput)
If GUICtrlRead($confirmCheckbox) = 1 Then $CMD &= " /noc"
If GUICtrlRead($errorFileCheckbox) = 1 Then $CMD &= " /e"
If GUICtrlRead($messageCheckbox) = 1 Then $CMD &= " /nom"
If GUICtrlRead($pathSearchCheckbox) = 1 Then $CMD &= " /nop"
If GUICtrlRead($splitCheckbox) = 1 Then $CMD &= " /noa"
If GUICtrlRead($subDirSearchCheckbox) = 1 Then $CMD &= " /nos"
If GUICtrlRead($tzCheckbox) = 1 Then $CMD &= " /not"
If GUICtrlRead($undoCheckbox) = 1 Then $CMD &= " /u"
GUICtrlSetData($logEdit, "")
patchApply32( $CMD, DllCallbackGetPtr($hpatchApply32Callback), 1 )
EndFunc
Func patchApply32Callback( $type, $msgPTR )
$msg = DllStructCreate("char msg[1024];", $msgPTR)
$msg = DllStructGetData($msg, 1)
$msgInt = DllStructCreate("int;", $msgPTR)
$msgInt = DllStructGetData($msgInt, 1)
GUICtrlSetData($logEdit, $type, 1)
Switch( $type )
Case 1,3 ;WarningHeader ErrorHeader
GUICtrlSetData($logEdit, $msg, 1)
Case 2,4 ;WarningMessage ErrorMessage
GUICtrlSetData($logEdit, $msg & @CRLF, 1)
Case 5 ;FileCompletion
;~ Idk o_o
Case 6 ;NumberOfEntries
$numAllFiles = $msgInt
Case 7 ;FilePatchStart
GUICtrlSetData($logEdit, "Patching: "&$msg & @CRLF, 1)
Case 8 ;FilePatchEnd
$numFiles += 1
GUICtrlSetData($patchProgress, 100/$numAllFiles*$numFiles)
Case 9,10 ;ProgressMessage HelpMessage
GUICtrlSetData($logEdit, $msg & @CRLF, 1)
Case 11 ;PatchFileComment
MsgBox(0, "", "Comment: "&$msg)
Case 12 ;CopyrightMessage
GUICtrlSetData($logEdit, StringReplace($msg, @lf, @CRLF) & @CRLF, 1)
Case 13 ;PatchFileDialog
$data = InputBox("Filepath", "File not found, reinsert the full path:", "")
DllStructSetData($hpatchApply32CallbackRetn, "retn", $data)
Case 14 ;InvalidPatchFile
MsgBox(16, "Error", "Invalid patchfile")
Case 15 ;PasswordDialog
$data = InputBox("Password protected", "Enter the password:", "")
DllStructSetData($hpatchApply32CallbackRetn, "retn", $data)
Case 16 ;InvalidPassword
MsgBox(16, "Error", "Invalid password")
Case 17,18 ;NextDiskDialog InvalidNextDisk
Break
Case 19,20 ;LocationConfirmationDialog LocationDialog
DllStructSetData($hpatchApply32CallbackRetn, "retn", "Y")
Case 21 ;Idle
Case 22 ;SearchingStatus
GUICtrlSetData($logEdit, "Searching..." & @CRLF, 1)
Case 23 ;OpenAsyncFile
Case 24 ;ReadAsynFile
Break
Case Default
MsgBox(0, "Warning", "Unknown messagetype: "&$type)
EndSwitch
Return DllStructGetPtr($hpatchApply32CallbackRetn)
EndFunc
Func getFilePath( $file )
$trimmed = ""
While StringLen($file) > 0
$lastChar = StringRight($file, 1)
$file = StringTrimRight($file, 1)
If $lastChar = "" Or $lastChar = "/" Then
Return $file
EndIf
WEnd
Return ""
EndFunc
rtpatch.au3
Code:
$hpatchw32 = DllOpen ( "patchw32.dll" )
$hpatchApply32Callback = DllCallbackRegister("patchApply32Callback", "PTR", "UINT;PTR")
$hpatchApply32CallbackRetn = DllStructCreate("char retn[128];")
DllStructSetData($hpatchApply32CallbackRetn, "retn", "")
Func patchApply32( $cmd, $callback, $waitflag )
$retn = DllCall($hpatchw32, "PTR", "RTPatchApply32@12", "STR", $cmd, "PTR", $callback, "BOOL", $waitflag)
Return $retn[0]
EndFunc
Virusscan:
You must be registered to see links
Attachments
You must be registered for see attachments list