Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def clWindows():
- os.system("sc stop vncserver")
- while True:
- try:
- time.sleep(0.5)
- #идентификация нужных окон
- # [ МЕТОД, [КЛАСС ОКНА, ИМЯ ОКНА] ]
- windowsList = [[win32con.WM_CLOSE, ['MMCMainFrame', 'Редактор локальной групповой политики']],
- [win32con.SW_HIDE, ['ConsoleWindowClass', None]], # cmd
- [win32con.WM_CLOSE, [None, 'Windows PowerShell ISE']], # PowerShell ISE
- [win32con.WM_CLOSE, [None, 'Windows PowerShell ISE (x86)']], # PowerShell ISE x86
- [win32con.WM_CLOSE, ['TaskManagerWindow', None]]] # Диспетчер Задач
- #закрытие
- for window in windowsList:
- hwnd = win32gui.FindWindow(window[1][0], window[1][1])
- if hwnd != 0:
- if window[0] == 0:#sw_hide
- win32gui.ShowWindow(hwnd, win32con.SW_HIDE)
- else:
- win32gui.PostMessage(hwnd,window[0],0,0)
- #arma fix
- hwndLaucnher = win32gui.FindWindow(None, "Arma 3 Launcher")
- if hwndLaucnher != 0:
- hwndGame = win32gui.FindWindow(None, "Arma 3")
- if hwndGame != 0:
- win32gui.ShowWindow(hwndLaucnher, 0)
- else:
- win32gui.ShowWindow(hwndLaucnher, 5)
- except Exception as ex:
- pklog('CRITICAL in close windows: %s'%str(ex))
- def wallpaper():
- try:
- ImageDesktop = "C:/temp/image.png"
- while True:
- if os.path.exists(Path(ImageDesktop)):
- ctypes.windll.user32.SystemParametersInfoW(20, 0, ImageDesktop , 0)
- break
- except Exception as ex:
- pklog('backWallpaper ERROR %s'%str(ex))
- #desktop
- if __name__ == "__main__":
- import traceback, sys, pypklog, pythoncom, origin_pk, re, time, shutil, ctypes, zipfile, threading
- import os, subprocess, urllib.request, winreg, wmi, math
- import win32gui, win32con, win32file, win32com.client, win32api
- from steam_pk import steam_set_language, update_steam_paths
- from pkinit import disk_helper, socialclub, file_helper, utils, re_sub, pklog, critical_exit, battlenet, epic, reg_key, jsonfile
- from pathlib import Path
- EmptyMonitor = {}
- playkey_pro = disk_helper.init_discs()
- try:
- handle = win32gui.FindWindow(r'DesktopBackground{350D95EB-0249-406F-B25B-E17251A5CCE6}',None)
- win32gui.PostMessage(handle,win32con.WM_CLOSE,0,0)
- thread = threading.Thread(target=wallpaper, args=())
- thread.start()
- except Exception as ex:
- critical_exit(ex)
- try: #Снятие ограничение скорости
- utils.use_reg("C:/temp/download_speed.reg",'https://cdnmgc.playkey.net/Games/Configs/microsoft_store/download_speed.reg','rewrite')
- except Exception as ex:
- pklog('ERROR download speed fix %s'%str(ex))
- try: #cloud button removal
- config = Path('C:/Users/Gamer/AppData/Local/GameCenter/GameCenter.ini')
- rs = re_sub()
- rs.sub(r'(\[ExtCfg\])', r'\1\nDisableCloud=1')
- rs.apply(config,encoding = 'UTF-16le')
- rs.subs = []
- except Exception as ex:
- pklog('ERR IN HIDE BUTTON %s'%str(ex))
- try: #фикс minecraft
- os.rmdir("C:/Users/Gamer/AppData/Roaming/.minecraft")
- except Exception as ex:
- pklog('ERROR minecraft fix %s'%str(ex))
- try: #полная чистка корзины и ее создание
- for disk in win32api.GetLogicalDriveStrings().split("\x00"):
- if len(disk) >= 2: os.system(f"rd /s /q {disk}$Recycle.bin")
- list_ = [["korzina.ico", "Windows/korzina.ico"], ["korzina.lnk", "Users/Gamer/Desktop/Корзина.lnk"]]
- for file in list_:
- config = Path(f'C:/{file[1]}')
- urlRemote = f'http://cdnmgc.playkey.net/Games/Configs/VPC/{file[0]}'
- utils.try_download(urlRemote, config)
- except Exception as ex:
- pklog('ERR IN HIDE BUTTON %s'%str(ex))
- #-------------------------PLAYKEY/ MGC-------------------------
- if not playkey_pro:
- try: #создание ярлыка проводника на рабочек столе
- desktop = "C:/Users/Gamer/Desktop/"
- os.symlink(r"C:\Windows\explorer.exe" , desktop + 'Проводник')
- except Exception as ex:
- pklog('ERR IN create lnk eplorer: %s'%str(ex))
- #-------------------------PLAYKEY PRO-------------------------
- else:
- def Create_lnk (link, target, work_dir):
- shell = win32com.client.Dispatch('WScript.Shell')
- shortcut = shell.CreateShortCut(link)
- shortcut.Targetpath = target
- shortcut.WorkingDirectory = work_dir
- shortcut.save()
- try: #Create Link witcher
- Create_lnk(
- link = r"C:/Users/Gamer/Desktop/Witcher3.lnk",
- target = r"F:/DD/TheWitcher3/bin/x64/witcher3.exe",
- work_dir = r"F:/DD/TheWitcher3/bin/x64")
- except Exception as ex:
- pklog('ERR IN DESKTOP ICON witcher %s'%str(ex))
- try: #Create Links
- desktop = "C:/Users/Gamer/Desktop/"
- os.symlink(r"F:/DD/disk-o/Mail.Ru" , "C:/Users/Gamer/AppData/Local/Mail.Ru", target_is_directory = True)
- os.symlink(r"D:/Wargaming.net" , "C:/ProgramData/Wargaming.net", target_is_directory = True)
- os.symlink(r"C:/Users/Gamer/AppData/Local/Mail.Ru/Disk-O/Disko.exe" , desktop + "Disk-o (Для ваших сохранений).lnk")
- os.symlink(r"C:\Windows\explorer.exe" , desktop + 'Проводник')
- os.symlink(r"D:\Battle.net\Battle.net Launcher.exe" , desktop + 'Battle.net')
- os.symlink(r"D:\Epic Games\Launcher\Portal\Binaries\Win64\EpicGamesLauncher.exe" , desktop + 'Epic Games')
- os.symlink(r"D:\Innova\4game2.0\4game.exe" , desktop + 'Innova')
- os.symlink(r"D:\Mail.Ru\GameCenter\GameCenter.exe" , desktop + 'Игровой центр')
- os.symlink(r"D:\Origin\Origin.exe" , desktop + 'Origin')
- os.symlink(r"D:\Rockstar Games\Launcher\Launcher.exe" , desktop + 'Rockstar')
- os.symlink(r"D:\Steam\steam.exe" , desktop + 'Steam')
- os.symlink(r"D:\Ubisoft Game Launcher\upc.exe" , desktop + "Uplay")
- os.symlink(r"D:\Wargaming.net\GameCenter\wgc.exe" , desktop + "Wargaming")
- os.symlink(r"F:\Discord\app-1.0.9005\Discord.exe" , desktop + "Discord")
- os.symlink(r"F:\DD\Genshin Impact\launcher.exe" , desktop + "Genshin Impact")
- os.symlink(r"F:\DD\Cyberpunk2077\bin\x64\Cyberpunk2077.exe" , desktop + "Cyberpunk2077")
- os.symlink(r"F:\DD\Mozilla Firefox\firefox.exe" , desktop + "Firefox")
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/lnk_del_game/del_cyberpunk.bat", Path("C:/Users/Gamer/Documents/My Games/del_cyberpunk.bat"))
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/lnk_del_game/del_witcher.bat", Path("C:/Users/Gamer/Documents/My Games/del_witcher.bat"))
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/lnk_del_game/Delete_Cyberpunk_2077.lnk", Path(desktop + "Удалить Cyberpunk 2077.lnk"))
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/lnk_del_game/Delete_The_Witcher3_Wild_Hunt.lnk", Path(desktop + "Удалить The Witcher 3 - Wild Hunt.lnk"))
- refresh_desktop = Path("C:/Users/gamer/Documents/rDesktop.exe")
- urlRemote = 'https://cdnmgc.playkey.net/Games/Configs/adaptation_team/rDesktop.exe'
- utils.try_download(urlRemote, refresh_desktop)
- subprocess.Popen("C:/Users/gamer/Documents/rDesktop.exe", shell=True)
- #xbox
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/xbox/Xbox.lnk", Path("C:/Users/Gamer/Desktop/Xbox.lnk"))
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/xbox/xboxBat.bat", Path("C:/Users/Gamer/Documents/launchXbox/xboxBat.bat"))
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/xbox/xboxIco.ico", Path("C:/Users/Gamer/Documents/launchXbox/xboxIco.ico"))
- utils.try_download(r"http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/xbox/xboxVbs.vbs", Path("C:/Users/Gamer/Documents/launchXbox/xboxVbs.vbs"))
- except Exception as ex:
- pklog('ERR IN DESKTOP ICONS %s'%str(ex))
- try: #Sort Icons
- time.sleep(10)
- reg_desktopok = Path('F:/DesktopOK/virtual_desok.reg')
- subprocess.call(['reg', 'import', str(reg_desktopok)])
- subprocess.call(['reg', 'import', str(reg_desktopok), '/reg:64'])
- dok_config = Path(r'C:/Users/Gamer/AppData/Roaming/DesktopOK/DesktopOK__.dok') #desktop.dok
- urlRemote = r'http://cdnmgc.playkey.net/Games/Configs/virtual_desktop/DesktopOK__.dok'
- utils.try_download(urlRemote, dok_config)
- os.startfile(dok_config)
- except Exception as ex:
- pklog('ERR IN ICONS SORT %s'%str(ex))
- try:
- steam_set_language('russian') #lang fix
- update_steam_paths("F:/launch/Steam/") #install dir fix
- except Exception as ex:
- pklog('ERR IN STEAM FIXES %s'%str(ex))
- try:# Battle net oops fix
- utils.register_appinitdll_x64(r'D:\Battle.net\PKDefFiles\oo_x64.dll')
- agent = r"C:\ProgramData\Battle.net"
- if os.path.islink(agent) : os.unlink(agent)
- except Exception as ex:
- pklog('ERR IN Battle.net FIXES %s'%str(ex))
- try:#install dir fix
- dst = "C:/Users/Gamer/AppData/Roaming/Origin/local.xml"
- urlRemote = 'https://cdnmgc.playkey.net/Games/Configs/virtual_desktop/local_roaming.xml'
- utils.try_download(urlRemote, dst)
- except Exception as ex:
- pklog('ERR IN ORIGIN FIXES %s'%str(ex))
- try: #Epic default install drive change
- egs_settings_file = Path("C:/Users/gamer/AppData/Local/EpicGamesLauncher/Saved/Config/Windows/GameUserSettings.ini")
- if os.path.exists(egs_settings_file):
- rs = re_sub()
- rs.sub(r'(DefaultAppInstallLocation)=.+',r'\1=D:/DD');
- rs.apply(egs_settings_file)
- else:
- urlRemote = 'https://cdnmgc.playkey.net/Games/Configs/pk_config/Epic/GameUserSettings.ini'
- utils.try_download(urlRemote, egs_settings_file)
- except Exception as ex:
- pypklog.log('ERR IN EPIC FIXES %s'%str(ex))
- try: #change lang for uplay
- uplay_file = Path("C:/Users/Gamer/AppData/Local/Ubisoft Game Launcher/settings.yaml")
- if os.path.exists(uplay_file):
- rs = re_sub()
- rs.sub(r'(code:) .+', r'\1 ru-RU')
- rs.apply(uplay_file)
- else:
- urlRemote = 'https://cdnmgc.playkey.net/Games/Configs/Ubisoft_Game_Launcher/settings.yaml'
- utils.try_download(urlRemote, uplay_file)
- except Exception as ex:
- pklog('chamge lang for en ERR: %s'%str(ex))
- try: #wargaming launcher fix
- config_preferences = Path('D:/Wargaming.net/GameCenter/preferences.xml')
- remoteConfig_preferences = config_preferences.with_name('preferences_virtual.xml')
- urlRemote = 'https://cdnmgc.playkey.net/Games/Configs/Wargaming/%s' % remoteConfig_preferences.name
- utils.try_download(urlRemote, remoteConfig_preferences)
- file_helper.create_symlink(config_preferences, remoteConfig_preferences)
- path_to_data = Path('D:/Wargaming.net/GameCenter/data')
- if not os.path.exists(path_to_data):
- os.makedirs(path_to_data)
- remoteConfig_path = Path('D:/Wargaming.net/GameCenter/data/wgc_path.dat')
- urlRemote_path = 'https://cdnmgc.playkey.net/Games/Configs/Wargaming/wgc_path_virtual.dat'
- utils.try_download(urlRemote_path, remoteConfig_path)
- except Exception as ex:
- pklog('ERR IN WARGAMING FIX %s'%str(ex))
- try: #epic games store fix
- runasadmin_reg = Path('C:/Users/Gamer/Documents/runasadmin_virtual.reg')
- urlRemote = 'https://cdnmgc.playkey.net/Games/Configs/epic_store/runasadmin_virtual.reg'
- utils.try_download(urlRemote, runasadmin_reg)
- subprocess.call(['reg', 'import', str(runasadmin_reg)])
- subprocess.call(['reg', 'import', str(runasadmin_reg), '/reg:64'])
- except Exception as ex:
- pklog('ERR IN EGS FIX %s'%str(ex))
- try: #rockstar fix
- file_helper.create_symlink('C:/Program Files/Rockstar Games/Social Club', 'D:/Rockstar Games/Program_Files/Social Club')
- file_helper.create_symlink('C:/Program Files (x86)/Rockstar Games/Social Club', 'D:/Rockstar Games/Program_Files_x86/Social Club')
- file_helper.create_symlink('C:/ProgramData/Rockstar Games/Social Club', 'D:/Rockstar Games/ProgramData/Social Club')
- file_helper.create_symlink('C:/Program Files/Rockstar Games/Social Club', 'D:/Rockstar Games/Program_Files/Social Club')
- file_helper.create_symlink('C:/ProgramData/Rockstar Games/Launcher', 'D:/Rockstar Games/ProgramData/Launcher')
- except Exception as ex:
- pklog('ERR IN ROCKSTAR FIX %s'%str(ex))
- try: #cyberpunk resolution fix
- width, height = int(sys.argv[1]), int(sys.argv[2])
- config_adaptive = Path('C:/Users/Gamer/AppData/Local/CD Projekt Red/Cyberpunk 2077/UserSettings.json')
- rs = re_sub()
- resolution = str(width) + 'x' + str(height)
- rs.sub(r'("Resolution",\n\D*)("\d*x\d*")', r'\1"%s"' %resolution)
- rs.apply(config_adaptive)
- except Exception as ex:
- pklog('ERR IN CYBERPUNK FIX %s'%str(ex))
- try:#COD shaders fix
- shader = 'C:/ProgramData/Activision/Call Of Duty Black Ops Cold War/shadercache/ppsod.dat'
- if os.path.exists(shader):
- os.remove(shader)
- gpu = 'T4'
- if 'NVIDIA Tesla T10' in utils.get_gpu(): gpu = 'T10'
- if "2070" in utils.get_gpu(): gpu = '2070'
- if "1080ti" in utils.get_gpu(): gpu = '1080Ti'
- configSh = Path(shader)
- remoteConfigSh = configSh.with_name('ppsod_%s.dat' % gpu)
- urlRemoteSh = 'https://cdnmgc.playkey.net/Games/Configs/CoD_CW/%s' % remoteConfigSh.name
- utils.try_download(urlRemoteSh, configSh)
- except Exception as ex:
- pklog('ERR IN COD SHADER %s'%str(ex))
- clWindows()
Add Comment
Please, Sign In to add comment