Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions nfs_hits_cpu90_fix.cmd
Original file line number Diff line number Diff line change
@@ -1,47 +1,56 @@
@echo off
title = Fix 90%% load for NEED FOR SPEED HEAT. by Octanium
set "CPU_Cores=0"
set "CPU_Threads=0"
title Fix 90%% load for NEED FOR SPEED HEAT by Octanium, Toastcode
setlocal enabledelayedexpansion

set "UserCFGFileCDDir=%~dp0"
set "UserCFGFileName=user.cfg"
set "UserCFGFile=%UserCFGFileCDDir%%UserCFGFileName%"
for /f "tokens=*" %%a in ('powershell -Command "Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty NumberOfCores"') do set "CPU_Cores=%%a"
for /f "tokens=*" %%a in ('powershell -Command "Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty NumberOfLogicalProcessors"') do set "CPU_Threads=%%a"
if %CPU_Cores% == 0 goto oops_a

rem ======== Using PowerShell Method =========
for /f %%a in ('powershell -command "(Get-CimInstance Win32_Processor).NumberOfCores"') do set "CPU_Cores=%%a"
for /f %%a in ('powershell -command "(Get-CimInstance Win32_Processor).NumberOfLogicalProcessors"') do set "CPU_Threads=%%a"

if "%CPU_Cores%"=="" goto oops_a
if "%CPU_Threads%"=="" goto oops_a

echo.
echo Fix 90%% CPU load!
echo For game NEED FOR SPEED HEAT
echo by Octanium
echo by Octanium and Toastcode
echo.
echo ==== Your CPU ====
echo CPU cores : %CPU_Cores%
echo CPU threads: %CPU_Threads%
echo ==================
REM Create user.cfg
echo.

rem ======== Crear user.cfg =========
if exist "%UserCFGFile%" (
if exist "%UserCFGFileCDDir%%UserCFGFileName%.bak" (
del "%UserCFGFile%" /q /f
) else (
rename "%UserCFGFileCDDir%%UserCFGFileName%" "%UserCFGFileName%.bak"
)
)
echo Thread.ProcessorCount %CPU_Cores% >> "%UserCFGFile%"
echo Thread.MaxProcessorCount %CPU_Cores% >> "%UserCFGFile%"
echo Thread.MinFreeProcessorCount 0 >> "%UserCFGFile%"
echo Thread.JobThreadPriority 0 >> "%UserCFGFile%"
echo GstRender.Thread.MaxProcessorCount %CPU_Threads% >> "%UserCFGFile%"

(
echo Thread.ProcessorCount %CPU_Cores%
echo Thread.MaxProcessorCount %CPU_Cores%
echo Thread.MinFreeProcessorCount 0
echo Thread.JobThreadPriority 0
echo GstRender.Thread.MaxProcessorCount %CPU_Threads%
) > "%UserCFGFile%"

if exist "%UserCFGFile%" (
echo.
echo =============================
echo File user.cfg created!
echo =============================
echo.
) else (
) else (
echo.
echo =============================
echo File user.cfg NOT created!
echo =============================
echo.
)
pause
exit
Expand All @@ -53,6 +62,5 @@ echo =============================================
echo Oooops something went wrong :( (code: a)
echo =============================================
echo.
echo.
pause
exit
exit