Results 1 to 2 of 2

Thread: Patch switcher for cod2

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts

    Patch switcher for cod2

    Edit: This is outdated. Go to the next post.

    Here's a python-based patch switcher for CoD2:

    PHP Code:
    import socket
    import StringIO
    import csv
    import os
    import shutil
    import _winreg 
    as wreg
    import sys
    import subprocess
    import Tkinter 
    as tk

    def switch_patch
    (versionframe):
        
    source "C:\\Program Files (x86)\\Activision\\Call of Duty 2 Patch switcher\\" version "\\"
        
    dest "C:\\Program Files (x86)\\Activision\\Call of Duty 2\\"
        
    files = ["main\\iw_15.iwd""CoD2MP_s.exe""gfx_d3d_mp_x86_s.dll""gfx_d3d_x86_s.dll"]
        for 
    file in files:
            if 
    os.path.exists(dest file):
                
    os.remove(dest file)
            if 
    os.path.exists(source file):
                
    shutil.copyfile(source filedest file)
        if 
    frame is not None:
            
    frame.destroy()
        return


    version '0.0'
    if len(sys.argv) >= 2:
        
    args " ".join(sys.argv[2:])
        if 
    "+connect" in sys.argv[2:]:
            
    index sys.argv[2:].index("+connect")
            
    info sys.argv[2:][index 1].split(":")
            if 
    len(info) >= 2:
                
    ip info[0]
                
    port int(info[1])
                
    sock socket.socket(socket.AF_INETsocket.SOCK_DGRAM)
                
    sock.settimeout(2.0)
                
    packet "\xff\xff\xff\xffgetstatus"
                
    try:
                    
    sock.sendto(packet, (ipport))
                    
    response sock.recvfrom(8196)[0]
                    
    StringIO.StringIO(response[4:])
                    
    reader csv.reader(fdelimiter='\\')
                    for 
    row in reader:
                        if 
    'shortversion' in row:
                            
    version row[row.index('shortversion') + 1]
                
    except:
                    
    pass

    if version == "0.0":
        
        
    root tk.Tk()
        
    args ""
        
    root.title("Patch Switcher")
        
    versions = ["1.0""1.2""1.3"]
        for 
    v in versions:
            
    tk.Button(roottext=vwidth=25height=3command=lambda v=v:switch_patch(vroot)).pack()
        
    root.mainloop()
    else:
        
    switch_patch(versionNone)
    key wreg.CreateKey(wreg.HKEY_LOCAL_MACHINE"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\CoD2MP_s.exe")
    try:
        
    wreg.DeleteValue(key'Debugger')
    except WindowsError:
        
    pass
    key
    .Close()

    subprocess.call("C:\\Program Files (x86)\\Activision\\Call of Duty 2\\CoD2MP_s.exe " argscwd="C:\\Program Files (x86)\\Activision\\Call of Duty 2\\")

    key wreg.CreateKey(wreg.HKEY_LOCAL_MACHINE"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\CoD2MP_s.exe")
    wreg.SetValueEx(key'Debugger'0wreg.REG_SZ"\"C:\\Python27\\Pythonw.exe\" \"Versionswitcher.pyw\"")
    key.Close() 
    Requirements:
    Python 2.7 installed in C:/python27
    CoD2 installed in C:/program files (x86)/activision/call of duty 2/
    Cod2 patch switcher installed in C:/program files (x86)/activision/call of duty 2 patch switcher (www.iznogod.tweak.nl/cod2ps.rar )

    How to install: Save the file as VersionSwitcher.pyw in C:/program files (x86)/activision/call of duty 2/ , then doubleclick the file once, it should set everything correctly.

    From then on out it should hijack all calls to cod2mp_s.exe, get the +connect server version, switch patch and connect.
    If no +connect is given, a UI will pop up asking for a version.
    Last edited by IzNoGoD; 7th February 2015 at 17:27.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following 5 Users Say Thank You to IzNoGoD For This Useful Post:

    BurntToast (7th February 2015),kung foo man (7th February 2015),Mitch (7th February 2015),php (7th February 2015),thOuMta (12th February 2015)

Posting Permissions

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