Write-Host "*******************************************************************" -ForegroundColor White
Write-Host "***	   Football Manager 2024 Unofficial Patch v1.2   	***" -ForegroundColor White
Write-Host "***		   Match Engine Mod Code Remover    	  	***" -ForegroundColor White
Write-Host "***		   Scripted by crushw @ playgm.cc    	  	***" -ForegroundColor White
Write-Host "***	          For Epic / Steam on WIN PLATFORM        	***" -ForegroundColor White
Write-Host "***	            Game Version  24.4.2+2081827        	***" -ForegroundColor White
Write-Host "***		 	LOVE	FROM	CHINA	 	   	***" -ForegroundColor White
Write-Host "*******************************************************************" -ForegroundColor White
Write-Host "`n"

Write-Host "Put this installation script in the same folder with your fm.exe," -ForegroundColor Yellow
Write-Host("װļfm.exeͬһĿ¼£")
Write-Host "Rename this to removeengine.PS1,(YES IT IS P-S-ONE)" -ForegroundColor Yellow
Write-Host("Ϊ removeengine.PS1(Ǹ˹Ҽ)")
Write-Host "Right-click then PowerShell," -ForegroundColor Yellow
Write-Host("ҼPowerShell")
Write-Host "DO NOT EDIT ANY CODE unless you are a professional," -ForegroundColor Yellow
Write-Host("ҪҶݣרҵʿ")
Write-Host "Now be sure you have 1 GB of free disk space and memory BOTH," -ForegroundColor Yellow
Write-Host("뱣1GBʣ̺ڴռ䣬")
Write-Host "Use this to remove modded codes on match engine." -ForegroundColor Yellow
Write-Host("ָԭ롣")
cmd /c pause

$A = 0
$B = 31
$i = 0
$flag = 0

if (Test-Path -Path "fm.exe" -PathType Leaf){
$file = Get-Item "fm.exe"
$bytes = [System.IO.File]::ReadAllBytes("$file")
$Length = $bytes.Length

for(;;){

	if ($Length -eq 489128448){
	$flag = 1
	Write-Host "Epic game file Detected!" -ForegroundColor Green
	Write-Host "⵽Ϸƽ̨Epic" -ForegroundColor Green
	Write-Host "Using on a corrupted file MAY CAUSE CRASH. Be sure you have a VERIFIED copy." -BackgroundColor Black
	Write-Host "𻵵ļпܵ´֧" -BackgroundColor Black
	Write-Host "Click X on right-top to exit. (or continue at your OWN RISK)." -BackgroundColor Black
	Write-Host "Ͻ X رճ򣬻߰" -BackgroundColor Black
	cmd /c pause
	break
	}	

	if ($Length -eq 491339776){
	$flag = 2
	Write-Host "Steam game file Detected!" -ForegroundColor Green
	Write-Host "⵽Ϸƽ̨Steam" -ForegroundColor Green
	Write-Host "Using on a corrupted file MAY CAUSE CRASH, Be sure that you have a VERIFIED copy." -BackgroundColor Black
	Write-Host "𻵵ļпܵ´֧" -BackgroundColor Black
	Write-Host "Click X on right-top to exit. (or continue at your OWN RISK)." -BackgroundColor Black
	Write-Host "Ͻ X رճ򣬻߰" -BackgroundColor Black
	cmd /c pause
	break
	}	

	else { return }
}

Copy-Item "fm.exe" "fm.exe.temp"
$file = Get-Item "fm.exe.temp"

$bytes[70989279] = 0x41
$bytes[70989280] = 0x0F
$bytes[70989281] = 0xBE
$bytes[70989282] = 0xBC
$bytes[70989283] = 0x0D
$bytes[70989284] = 0x88
$bytes[70989285] = 0x03
$bytes[70989286] = 0x00
$bytes[70989287] = 0x00
[System.IO.File]::WriteAllBytes($file, $bytes)

}# Test-Path

	Write-Host "Done!" -BackgroundColor Green
	Write-Host "㶨!" -BackgroundColor Green
	Remove-Item -Path "fm.exe"
	Rename-Item -Path "fm.exe.temp" -NewName "FM.EXE"

cmd /c pause



