Announcement

Collapse
No announcement yet.

Tool to patch CTP I & II

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tool to patch CTP I & II

    Hello,

    I did a small tool to patch Call to power I & II.

    The "prepare for internet game" option installs the last servers.dat and anet .dll.

    You can download it here :



    This is an autoit programm.

    Here is the source code :

    #NoTrayIcon
    #include


    ; Variables
    Dim $version="1.0"
    Dim $default_ctp1=0
    Dim $default_ctp2=0
    Dim $path_is_right1=0
    Dim $path_is_right2=0
    Dim $ctp_default_path=@ProgramFilesDir & "\Activision\Civilization-Call to Power"
    Dim $ctp2_default_path=@ProgramFilesDir & "\Activision\Call To Power 2"


    AddExe()

    #Region ### START Koda GUI section ### Form=E:\lettre\autoit\ctp\Main.kxf
    $Form1 = GUICreate("CTPPatchsCollection " & $version, 434, 233, 326, 402)
    GUISetIcon("E:\lettre\autoit\ctp\ctp.ico")
    $Radio1 = GUICtrlCreateRadio("Patch CTP I - English", 16, 24, 137, 17)
    $Radio2 = GUICtrlCreateRadio("Patch CTP I - Français", 16, 48, 145, 17)
    $Radio3 = GUICtrlCreateRadio("Patch CTP I - German", 16, 72, 145, 17)
    $Radio4 = GUICtrlCreateRadio("Install CTP 1.21 Hack", 16, 96, 193, 17)
    $Radio5 = GUICtrlCreateRadio("Patch CTP II - Multi", 16, 120, 145, 17)
    $Radio6 = GUICtrlCreateRadio("Prepare CTP I for Internet Games", 16, 144, 201, 17)
    $Radio7 = GUICtrlCreateRadio("Preapare CTP II for Internet Games", 16, 168, 201, 17)
    $Button1 = GUICtrlCreateButton("Quit", 216, 192, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("About", 344, 192, 75, 25, 0)
    $Pic1 = GUICtrlCreatePic("E:\lettre\images\divers\sarasvati6.jpg", 216, 24, 201, 161, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    DelExe()
    Exit
    Case $Button1
    DelExe()
    Exit
    Case $Radio1
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "You are going to update Call to Power I to version 1.2.")
    if $Choice=6 then ; Yes
    run(@TempDir & "\cctp1_2_us.exe")
    DelExe()
    exit
    EndIf
    GUICtrlSetState($Radio1,$GUI_UNCHECKED)
    Case $Button2
    #Region ### START Koda GUI section ### Form=E:\lettre\autoit\ctp\About.kxf
    $Form2 = GUICreate("About", 314, 160, 481, 520)
    GUISetIcon("E:\lettre\autoit\ctp\ctp.ico")
    $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 297, 113)
    $Label1 = GUICtrlCreateLabel("CTPPatchsCollection " & $version & " - 03062007", 16, 24, 182, 17, $WS_GROUP)
    $Label4 = GUICtrlCreateLabel("http://apolyton.net/ .", 16, 72, 104, 17, $WS_GROUP)
    $Label3 = GUICtrlCreateLabel("Free of use. Files contain in the exe were downloaded from", 16, 48, 281, 17, $WS_GROUP)
    $Label5 = GUICtrlCreateLabel("Michel Grandchamp - zemitch@raga.ch", 16, 96, 191, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $QuitAbout = GUICtrlCreateButton("&OK", 120, 128, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE

    ExitLoop
    Case $QuitAbout
    GUIDelete("About")
    ExitLoop
    EndSwitch
    WEnd
    Case $Radio2
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "Vous allez installer le Patch 1.2 de Call to Power.")
    if $Choice=6 then ; Yes
    run(@TempDir & "\cctp1_2_f.exe")
    DelExe()
    exit
    EndIf
    GUICtrlSetState($Radio2,$GUI_UNCHECKED)

    Case $Radio3
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "Sie werden Patch 1.2 von Call to Power installieren.")
    if $Choice=6 then ; Yes
    run(@TempDir & "\cctp1_2_g.exe")
    DelExe()
    exit
    EndIf
    GUICtrlSetState($Radio3,$GUI_UNCHECKED)

    Case $Radio4
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "You are going to install Call To Power 1.21 Hack patch.")
    if $Choice=6 then ; Yes
    run(@TempDir & "\CivCTP121update.exe")
    DelExe()
    exit
    EndIf
    GUICtrlSetState($Radio4,$GUI_UNCHECKED)

    Case $Radio5
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "You are going to install Call To Power II 1.11 multi-language patch.")
    if $Choice=6 then ; Yes
    run(@TempDir & "\ctp2patch1_11.exe")
    DelExe()
    exit
    EndIf
    GUICtrlSetState($Radio5,$GUI_UNCHECKED)

    Case $Radio6
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "You are going to prepare CTP for Internet games.")
    if $choice=6 then
    IsDefaultPath()
    while $path_is_right1=0
    if $default_ctp1 <> 1 then
    $ctp_default_path = FileSelectFolder("Select the root folder of your CTP installation." , "")
    If FileExists($ctp_default_path & "\playctp.exe") Then
    $path_is_right1=1
    else
    MsgBox(0, "CTPPatchsCollection " & $version, "Unable to find installation path.")
    $path_is_right1=2
    EndIf
    EndIf
    WEnd
    if $path_is_right1=1 then
    PrepCTPI()
    DelExe()
    Exit
    EndIf
    EndIF
    GUICtrlSetState($Radio6,$GUI_UNCHECKED)

    Case $Radio7
    $Choice = MsgBox(4, "CTPPatchsCollection " & $version, "You are going to prepare CTP II for Internet games.")
    if $choice=6 then
    IsDefaultPath()
    while $path_is_right2=0
    if $default_ctp2 <> 1 then
    $ctp2_default_path = FileSelectFolder("Select the root folder of your CTP installation." , "")
    If FileExists($ctp2_default_path & "\ctp2_program\ctp\ctp2.exe") Then
    $path_is_right2=1
    else
    MsgBox(0, "CTPPatchsCollection " & $version, "Unable to find installation path.")
    $path_is_right2=2
    EndIf
    EndIf
    WEnd
    if $path_is_right2=1 then
    PrepCTPII()
    DelExe()
    Exit
    EndIf
    EndIF
    GUICtrlSetState($Radio7,$GUI_UNCHECKED)

    Case $Pic1
    EndSwitch
    WEnd



    Func PrepCTPI()
    ; rename existing Files
    FileMove($ctp_default_path & "\ctp_program\ctp\servers.dat", $ctp_default_path & "\ctp_program\ctp\servers.dat.old")
    FileMove($ctp_default_path & "\ctp_program\ctp\anet2.dll", $ctp_default_path & "\ctp_program\ctp\anet2.dll.old")
    FileMove($ctp_default_path & "\ctp_program\ctp\dll\net\winets2.dll", $ctp_default_path & "\ctp_program\ctp\dll\net\winets2.dll.old")
    FileMove($ctp_default_path & "\ctp_program\ctp\dll\net\wudplan.dll", $ctp_default_path & "\ctp_program\ctp\dll\net\wudplan.dll.old")
    ; copy new Files
    FileCopy(@TempDir & "\servers.dat", $ctp_default_path & "\ctp_program\ctp\servers.dat",1)
    FileCopy(@TempDir & "\anet2.dll", $ctp_default_path & "\ctp_program\ctp\anet2.dll",1)
    FileCopy(@TempDir & "\winets2.dll", $ctp_default_path & "\ctp_program\ctp\dll\net\winets2.dll",1)
    FileCopy(@TempDir & "\wudplan.dll", $ctp_default_path & "\ctp_program\ctp\dll\net\wudplan.dll",1)
    MsgBox(0, "CTPPatchsCollection " & $version, "Finished! Your old files were renamed (*.old).")
    EndFunc

    Func PrepCTPII()
    ; rename existing Files
    FileMove($ctp2_default_path & "\ctp2_program\ctp\servers.dat", $ctp2_default_path & "\ctp2_program\ctp\servers.dat.old")
    FileMove($ctp2_default_path & "\ctp2_program\ctp\anet2.dll", $ctp2_default_path & "\ctp2_program\ctp\anet2.dll.old")
    FileMove($ctp2_default_path & "\ctp2_program\ctp\dll\net\winets2.dll", $ctp2_default_path & "\ctp2_program\ctp\dll\net\winets2.dll.old")
    FileMove($ctp2_default_path & "\ctp2_program\ctp\dll\net\wudplan.dll", $ctp2_default_path & "\ctp2_program\ctp\dll\net\wudplan.dll.old")
    ; copy new Files
    FileCopy(@TempDir & "\servers.dat", $ctp2_default_path & "\ctp2_program\ctp\servers.dat",1)
    FileCopy(@TempDir & "\anet2.dll", $ctp2_default_path & "\ctp2_program\ctp\anet2.dll",1)
    FileCopy(@TempDir & "\winets2.dll", $ctp2_default_path & "\ctp2_program\ctp\dll\net\winets2.dll",1)
    FileCopy(@TempDir & "\wudplan.dll", $ctp2_default_path & "\ctp2_program\ctp\dll\net\wudplan.dll",1)
    MsgBox(0, "CTPPatchsCollection " & $version, "Finished! Your old files were renamed (*.old).")
    EndFunc

    Func IsDefaultPath()
    if FileExists("C:\Program Files\Activision\Civilization-Call to Power\playctp.exe") Then
    $default_ctp1=1
    $path_is_right1=1
    Else
    $path_is_right1=0
    EndIf
    if FileExists("C:\Program Files\Activision\Call To Power 2\ctp2_program\ctp\ctp2.exe") Then
    $default_ctp2=1
    $path_is_right2=1
    Else
    $path_is_right2=0
    EndIf
    EndFunc

    Func AddExe()
    FileInstall("E:\lettre\autoit\ctp\servers.dat", @TempDir & "\servers.dat",1)
    FileInstall("E:\lettre\autoit\ctp\anet\ctp2_program\ctp2\anet2. dll", @TempDir & "\anet2.dll",1)
    FileInstall("E:\lettre\autoit\ctp\anet\ctp2_program\ctp2\dll\ne t\winets2.dll", @TempDir & "\winets2.dll",1)
    FileInstall("E:\lettre\autoit\ctp\anet\ctp2_program\ctp2\dll\ne t\wudplan.dll", @TempDir & "\wudplan.dll",1)
    FileInstall("E:\lettre\autoit\ctp\cctp1_2_f.exe", @TempDir & "\cctp1_2_f.exe",1)
    FileInstall("E:\lettre\autoit\ctp\cctp1_2_g.exe", @TempDir & "\cctp1_2_g.exe",1)
    FileInstall("E:\lettre\autoit\ctp\cctp1_2_us.exe", @TempDir & "\cctp1_2_us.exe",1)
    FileInstall("E:\lettre\autoit\ctp\ctp2patch1_11.exe", @TempDir & "\ctp2patch1_11.exe",1)
    FileInstall("E:\lettre\autoit\ctp\CivCTP121update.exe", @TempDir & "\CivCTP121update.exe",1)
    EndFunc

    Func DelExe()
    FileDelete (@TempDir & "\servers.dat")
    FileDelete (@TempDir & "\anet2.dll")
    FileDelete (@TempDir & "\winets2.dll")
    FileDelete (@TempDir & "\wudplan.dll")
    FileDelete (@TempDir & "\cctp1_2_f.exe")
    FileDelete (@TempDir & "\cctp1_2_g.exe")
    FileDelete (@TempDir & "\cctp1_2_us.exe")
    FileDelete (@TempDir & "\ctp2patch1_11.exe")
    FileDelete (@TempDir & "\CivCTP121update.exe")
    EndFunc



  • #2
    That's a handy program, thanks for the effort tentaal

    Comment


    • #3
      Looks to be a nice tool. By the way tentaal havy you considerd it to add it to the Apolyton Directory?

      - Martin
      Civ2 military advisor: "No complaints, Sir!"

      Comment


      • #4
        The tool is larger than 10 Meg, but I send a mail to upload it.

        Comment

        Working...
        X