Da NW2 jetzt nen neuen besseren Patcher hat release ich mal meinen alten Patcher von NW2
Source:
PHP Code:
#Include <File.au3>
#Include <GuiConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#NoTrayIcon
Global $m2ordner = @ScriptDir
Global $ScriptDir = @ScriptDir
Global $TempDir = @TempDir
Global $url = FileReadLine($ScriptDir & "\patch.ini", 1)
Global $adurl = FileReadLine ($ScriptDir & "\patch.ini",2)
Global $fensterurl = FileReadLine ($ScriptDir & "\patch.ini",3)
Global $accurl = FileReadLine ($ScriptDir & "\patch.ini",4)
$version = 6
$hTimer = TimerInit()
$iTimer = TimerDiff($hTimer)
Global $hTimer, $iTimer, $sData
ConsoleWrite("! CRC32 took " & $iTimer & " ms" & @CRLF)
ConsoleWrite("Result: " & $sData & @CRLF & @CRLF)
FileInstall("C:\Users\iMer\Desktop\patcher.exe",@TempDir&"\patcher.exe",1)
FileInstall("C:\Users\iMer\Pictures\metin2start.bmp", @Tempdir&"\metin2start.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_startgame_up.bmp", @Tempdir&"\btn_startgame_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_settings_up.bmp", @Tempdir&"\btn_settings_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_newaccount_up.bmp", @Tempdir&"\btn_newaccount_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_idpwd_up.bmp", @Tempdir&"\btn_idpwd_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_quit_up.bmp", @Tempdir&"\btn_quit_up.bmp",1)
;GUI######################################################
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("New World2 - Auto Patcher", 373, 541, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "_close")
$stat = GUICtrlCreateEdit("", 16, 8, 337, 281)
GUICtrlSetData(-1, "((`~Patcher by iMer~´))"&@CRLF&"Dateiüberprüfung wird gestartet...")
$cancel = GUICtrlCreateButton("Cancel", 288, 496, 75, 25, 0)
GUICtrlSetOnEvent($cancel, "_close")
$Progress1 = GUICtrlCreateProgress(16, 464, 334, 17)
;16, 312, 340, 13
$oIE = _IECreateEmbedded()
$oIE_ctrl = GUICtrlCreateObj($oIE, 16, 312, 336, 136)
GUISetState(@SW_SHOW)
_IENavigate($oIE, $adurl)
$Form2 = GUICreate("New-World2", 595, 385, 328, 160)
GUISetOnEvent($GUI_EVENT_CLOSE, "_close")
$Pic1 = GUICtrlCreatePic(@Tempdir&"\metin2start.bmp", 0, 0, 593, 382, $BS_BITMAP)
$start = GUICtrlCreateButton("(Not allowed)", 464, 40, 127, 41, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_startgame_up.bmp", 1)
GUICtrlSetOnEvent($start, "start")
$config = GUICtrlCreateButton("(Not allowed)", 464, 96, 127, 25, $BS_BITMAP)
GUICtrlSetOnEvent($config, "config")
GUICtrlSetImage(-1, @Tempdir&"\btn_settings_up.bmp", 1)
$seite1 = GUICtrlCreateButton("(Not allowed)", 464, 184, 127, 25, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_newaccount_up.bmp", 1)
GUICtrlSetOnEvent($seite1, "seite")
$seite2 = GUICtrlCreateButton("(Not allowed)", 464, 160, 129, 25, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_idpwd_up.bmp", 1)
GUICtrlSetOnEvent($seite2, "seite")
$ende = GUICtrlCreateButton("(Not allowed)", 464, 352, 127, 25, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_quit_up.bmp", 1)
GUICtrlSetOnEvent($ende, "_close")
$oIE1 = _IECreateEmbedded()
$oIE.Document.body.Scroll = "no"
$oIE.document.body.style.border = "0px"
$oIE1.Document.body.Scroll = "no"
$oIE1.document.body.style.border = "0px"
$oIE_ctrl1 = GUICtrlCreateObj($oIE1, 8, 8, 456, 376)
_IENavigate($oIE1, $fensterurl)
GUISetState(@SW_HIDE)
;gui#####################################################
Func seite ()
_IECreate($accurl)
EndFunc
func start ()
run($Scriptdir&"/metin2.bin")
Exit
EndFunc
Func config ()
Run($ScriptDir&"\config.exe")
EndFunc
Func _HashCRC32($sFile)
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)
If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf
Local $hFile = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Local $hFileMappingObject = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf
Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)
Local $a_iCall = DllCall("ntdll.dll", "dword", "RtlComputeCrc32", _
"dword", 0, _
"ptr", $pFile, _
"int", $iBufferSize)
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Local $iCRC32 = $a_iCall[0]
Return SetError(0, 0, Hex($iCRC32))
EndFunc
func _close ()
Exit
EndFunc
Sleep (500)
patch ()
;################################ PATCH ###################################################
;###########################################################################################
func patch ()
If Not FileExists("settings.txt") Then
FileWrite("settings.txt","0")
EndIf
FileDelete("patcher.exe")
$ver = @TempDir&"\version"
InetGet( $url&"/version" , $ver)
$v = FileRead($ver)
If $v = "" Then
MsgBox(48,"Fehler","Fehler beim übertragen der Versionsdatei!")
Exit
EndIf
If $version <> $v Then
MsgBox(64,"Neue Patcherversion!","Es gibt eine neue Version vom Patcher!"&@CRLF&"Es wird nun die neue Version geladen!",10)
FileCopy(@TempDir&"\patcher.exe","patcher.exe")
Run("patcher.exe")
Exit
EndIf
$file = $TempDir&"\crc.txt"
FileDelete($file)
InetGet( $url&"/crc.txt" , $file,1,0)
$lines = _FileCountLines($file)
If $lines = 0 Then
MsgBox(48,"Fehler","Fehler beim übertragen der Patchlist!")
Exit
EndIf
DirCreate("pack")
DirCreate("BGM")
DirCreate("lib")
DirCreate("mark")
DirCreate("miles")
DirCreate("screenshot")
DirCreate("upload")
While ($lines >= 1)
$string = FileReadLine($file,$lines)
$datei = StringSplit($string,";")
; MsgBox(64,"1:"&$datei[1],"2:"&$datei[2])
GUICtrlSetData($stat,"Überprüfung von: "& $datei[1] & @CRLF & GUICtrlRead($stat))
If FileExists($ScriptDir&"\"&$datei[1]) Then
$size_ordner = _HashCRC32($ScriptDir&"\"&$datei[1])
$size_inet = $datei[2]
If StringCompare ( $size_ordner , $size_inet,1) = 0 Then
GUICtrlSetData($stat,"Überspringen der Datei: "& $datei[1] & @CRLF & GUICtrlRead($stat))
Else
GUICtrlSetData($stat,"Download von: "& $datei[1] & @CRLF & GUICtrlRead($stat))
InetGet($url&$datei[1] , $ScriptDir& "\" & $datei[1] , 1 , 1)
$size = InetGetSize($url&"\"&$datei[1])
while 1
$hFileSize = FileGetSize($ScriptDir & "\" & $datei[1]) ;Wie viel wurde schon geladen.
$iPercent = round ( $hFileSize / $size *100) ;Rechen Operation ? O.O
GUICtrlSetData($Progress1, $iPercent) ;Progressbar einstellen
If $hFileSize = $size Then
GUICtrlSetData($Progress1, 100)
ExitLoop
EndIf
sleep (50)
WEnd
EndIf
Else
InetGet($url&$datei[1],$ScriptDir&"\"&$datei[1],1,1)
$size =InetGetSize($url&"\"&$datei[1])
GUICtrlSetData($stat, "Download von: "& $datei[1]& @CRLF & GUICtrlRead($stat))
while 1
$hFileSize = FileGetSize($ScriptDir & "\" & $datei[1]) ;Wie viel wurde schon geladen.
$iPercent = round ( $hFileSize / $size *100) ;Rechen Operation ? O.O
GUICtrlSetData($Progress1, $iPercent) ;Progressbar einstellen
If $hFileSize = $size Then
GUICtrlSetData($Progress1, 100)
ExitLoop
EndIf
sleep (50)
WEnd
EndIf
$lines = $lines-1
WEnd
FileDelete($TempDir&"\files.txt")
GUISetState(@SW_HIDE,$Form1)
GUISetState(@SW_SHOW,$Form2)
while 1
Sleep(100)
WEnd
EndFunc
Programm zum crc.txt machen (Source):
PHP Code:
#Include <File.au3>
#Include <GuiConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#NoTrayIcon
Global $m2ordner = @ScriptDir
Global $ScriptDir = @ScriptDir
Global $TempDir = @TempDir
Global $url = FileReadLine($ScriptDir & "\patch.ini", 1)
Global $adurl = FileReadLine ($ScriptDir & "\patch.ini",2)
Global $fensterurl = FileReadLine ($ScriptDir & "\patch.ini",3)
Global $accurl = FileReadLine ($ScriptDir & "\patch.ini",4)
$version = 1
$hTimer = TimerInit()
$iTimer = TimerDiff($hTimer)
Global $hTimer, $iTimer, $sData
ConsoleWrite("! CRC32 took " & $iTimer & " ms" & @CRLF)
ConsoleWrite("Result: " & $sData & @CRLF & @CRLF)
FileInstall("C:\Users\iMer\Pictures\metin2start.bmp", @Tempdir&"\metin2start.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_startgame_up.bmp", @Tempdir&"\btn_startgame_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_settings_up.bmp", @Tempdir&"\btn_settings_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_newaccount_up.bmp", @Tempdir&"\btn_newaccount_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_idpwd_up.bmp", @Tempdir&"\btn_idpwd_up.bmp",1)
FileInstall("D:\Games\longjuyt2.de\patchskin\btn_quit_up.bmp", @Tempdir&"\btn_quit_up.bmp",1)
;GUI######################################################
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("New World2 - Auto Patcher", 373, 541, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "_close")
$stat = GUICtrlCreateEdit("", 16, 8, 337, 281)
GUICtrlSetData(-1, "((`~Patcher by iMer~´))"&@CRLF&"Dateiüberprüfung wird gestartet...")
$cancel = GUICtrlCreateButton("Cancel", 288, 496, 75, 25, 0)
GUICtrlSetOnEvent($cancel, "_close")
$Progress1 = GUICtrlCreateProgress(16, 464, 334, 17)
;16, 312, 340, 13
$oIE = _IECreateEmbedded()
$oIE_ctrl = GUICtrlCreateObj($oIE, 16, 312, 336, 136)
GUISetState(@SW_SHOW)
_IENavigate($oIE, $adurl)
$Form2 = GUICreate("New-World2", 595, 385, 328, 160)
GUISetOnEvent($GUI_EVENT_CLOSE, "_close")
$Pic1 = GUICtrlCreatePic(@Tempdir&"\metin2start.bmp", 0, 0, 593, 382, $BS_BITMAP)
$start = GUICtrlCreateButton("(Not allowed)", 464, 40, 127, 41, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_startgame_up.bmp", 1)
GUICtrlSetOnEvent($start, "start")
$config = GUICtrlCreateButton("(Not allowed)", 464, 96, 127, 25, $BS_BITMAP)
GUICtrlSetOnEvent($config, "config")
GUICtrlSetImage(-1, @Tempdir&"\btn_settings_up.bmp", 1)
$seite1 = GUICtrlCreateButton("(Not allowed)", 464, 184, 127, 25, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_newaccount_up.bmp", 1)
GUICtrlSetOnEvent($seite1, "seite")
$seite2 = GUICtrlCreateButton("(Not allowed)", 464, 160, 129, 25, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_idpwd_up.bmp", 1)
GUICtrlSetOnEvent($seite2, "seite")
$ende = GUICtrlCreateButton("(Not allowed)", 464, 352, 127, 25, $BS_BITMAP)
GUICtrlSetImage(-1, @Tempdir&"\btn_quit_up.bmp", 1)
GUICtrlSetOnEvent($ende, "_close")
$oIE1 = _IECreateEmbedded()
$oIE_ctrl1 = GUICtrlCreateObj($oIE1, 8, 8, 456, 376)
_IENavigate($oIE1, $fensterurl)
GUISetState(@SW_HIDE)
;gui#####################################################
Func seite ()
_IECreate($accurl)
EndFunc
func start ()
run($Scriptdir&"/metin2.bin")
Exit
EndFunc
Func config ()
Run($ScriptDir&"\config.exe")
EndFunc
Func _HashCRC32($sFile)
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)
If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf
Local $hFile = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Local $hFileMappingObject = $a_hCall[0]
$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)
If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf
Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)
Local $a_iCall = DllCall("ntdll.dll", "dword", "RtlComputeCrc32", _
"dword", 0, _
"ptr", $pFile, _
"int", $iBufferSize)
If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Local $iCRC32 = $a_iCall[0]
Return SetError(0, 0, Hex($iCRC32))
EndFunc
func _close ()
Exit
EndFunc
Sleep (500)
patch ()
;################################ PATCH ###################################################
;###########################################################################################
func patch ()
$file = @TempDir&"\crc.txt"
InetGet( $url&"\crc.txt" , $file)
$lines = _FileCountLines($file)
$ges = _FileCountLines($file)
$lin = 0
If $lines = 0 Then
MsgBox(48,"Fehler","Fehler beim übertragen der Patchlist!")
Exit
EndIf
While ($lines >= 1)
$string = FileReadLine($file,$lines)
$datei = StringSplit($string,";")
FileWrite("crc.txt",$datei[1]&";"&_HashCRC32($datei[1])&@CRLF)
Local $perc = Round($lin/$ges*100)
GUICtrlSetData($Progress1,$perc)
$lin=$lin+1
$lines = $lines-1
WEnd
FileDelete($TempDir&"\files.txt")
MsgBox(64,"Fertig","CRC-Datei fertig erstellt")
Exit
EndFunc
Pics:
Installation:
1. Ladet euren Client auf einen Webspace
2. Erstellt eine Datei die "version" heißt und schreibt eine 6 rein
3. Ladet die "version" auf den Webspace
4. Erstellt eine Datei die "crc.txt" heißt
5. Schreibt in die Datei den Pfad & den Dateinamen rein der gepatcht werden soll und ein ; dahinter
ca. so:
PHP Code:
pack/root.epk;
pack/root.eix;
6. Macht eine Datei "patch.ini" und passt sie so an:
PHP Code:
URL zum Webspace
URL für das kleine Fenster im Patcher
URL für das Fenster nach dem Patchen
Url der Homepage
8. Ladet die neue crc.txt hoch
9. Freut euch