Shop  •   Avatar  •   FAQ  •   Search  •   Memberlist  •   Usergroups  •   Profile  •   Log in to check private messages  •   Log in  •  Register 

ImageCFG - Fix old games to run on a Single CPU core
Post new topic   Reply to topic     Forum Index -> Modding tools
View previous topic :: View next topic  
Author Message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sun Sep 05, 2021 3:27 am    Post subject: ImageCFG - Fix old games to run on a Single CPU core Reply with quote

ImageCFG - Fix old games to run on a Single CPU core

Warning modifies the game executable, Backup recommended


ImageCFG

https://robpol86.com/imagecfg.html

Quote:

ImageCFG is a utility that probably does a lot of things (I cannot find any official documentation), but the only reason I use it is to fix old games (UT99 for example) which have problems on multicore/multicpu systems. It does so by assigning an executable to specific logical CPUs permanently (by modifying the .exe file, so backup the original in case you want to restore it).

This utility will work in pretty much any modern Windows operating system (2000/XP/Vista/7) and it is meant to be used on computers with multiple CPUs, multiple cores, or Hyper Threading.

Robpol86.com


History

Many years ago, sometime in 2001 or 2002, I was looking for a utility that would permanently set which CPU a program would run under. To my dismay checking the affinity boxes in the task manager was only temporary, and unless I set the affinity of tribes2.exe to one CPU instead of both, my dual Pentium III Windows XP computer would blue screen (it turned out a faulty VP6 motherboard and dissimilar CPUs were to blame).

After many days of searching the internet and Direct Connect, I finally found the utility. While searching I noticed a lot of other people looking for the same tool, so at that time I decided to host the tool and make it easy for anyone to find. Since it’s a small tool that hardly takes up disk space or bandwidth, I have decided to keep hosting this file indefinitely

Usage

ImageCFG will work from any directory, but for ease of use it can be placed in %systemroot%system32 (or C:\Windows\system32 or C:\Windows\SysWOW64 (thanks chris.xudo333) if system32 doesn’t work) and %systemroot%system32dllcache (or C:\Windows\system32dllcache). Doing so will make imagecfg a system command (run it from anywhere in any cmd window or the run dialog). This article assumes you have done so.

The -u option sets a specified executable to only run in “uni-processor” mode on multi-processor systems. This is probably optional but I run it anyways.

The -a option sets a process affinity mask (hexadecimal value) to the specified executable, so that it always runs using the specified CPU. You can also add up the bits to set multiple CPUs (thanks LigH). Examples (hex = decimal = CPU):

0x01 = 1 = CPU0

0x02 = 2 = CPU1

0x04 = 4 = CPU2

0x08 = 8 = CPU3

0x10 = 16 = CPU4

0x20 = 32 = CPU5

0x40 = 64 = CPU6

0x80 = 128 = CPU7

0x0f = 15 = CPU0, CPU1, CPU2, and CPU3 (1+2+4+8 = 15)


Examples

The following examples will use UT99 from Steam to fix the speed issues I have been experiencing on my FX-60 (AMD dual core) computer running Windows 7 Ultimate 64bit.

This first command is probably optional. It sets the exe to use only one CPU:

imagecfg -u "C:\Program Files (x86)\Steam\steamapps\common\unreal tournament\System\unrealtournament.exe"

This is the important one. It sets the exe to use CPU0:

imagecfg -a 0x1 "C:\Program Files (x86)\Steam\steamapps\common\unreal tournament\System\unrealtournament.exe"



Download

https://robpol86.com/_downloads/7f7796a455da6c06f5b83015b11550e6/Imagecfg.zip

Imagecfg.zip


Last edited by corsair91 on Fri Jan 12, 2024 9:20 pm; edited 5 times in total
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sun Sep 05, 2021 3:36 am    Post subject: Reply with quote

Original description of ImageCFG
on the wayback Machine

Download link is dead, use link in previous post


https://web.archive.org/web/20031203173758fw_/http://www.robpol86.com/tutorials/imagecfg.php


ImageCFG.exe

ImageCFG is a utility that comes with the Windows 2000 Resource Kit, and other NT based resource kits. This executable is meant to run only on NT based systems, which includes Windows NT 4.0, Windows 2000, Windows XP Home, Windows XP Pro, Windows 2003 Server. It will not work on Win9x (Windows 95a, Windows 95b, Windows 98 (and 97 if it exists), Windows 98 SE, Windows ME). It is primarily used to permanently assign a processor affinity mask to another executable on multiprocessor machines, or computers with symmetric multi processing (SMP). This means, for example:

You have an application called file.exe and when it runs on your computer, it crashes after a few seconds. The only way to prevent that application from crashing is in the task manager, right when the application is launched, you right click on the process, click on Set Affinity... and quickly uncheck CPU1.

When ImageCFG is applied to the applications executable, it will set the affinity mask for you automatically when the application launches. No more crashing application. There are plenty of other reasons to use this utility, but this is my primary use of it. ImageCFG can also do other things, which im not going to discuss them right here. For more information, after downloading ImageCFG, type in the console ImageCFG -?

Installation - To install ImageCFG you must first download it. You can download it HERE. (see previous post).

After downloading, you install it by copying the file (Imagecfg.exe) over to %systemroot%\system32 (or C:\Windows\system32).

Then make another copy of it in %systemroot%\system32\dllcache (or C:\WINDOWS\system32\dllcache). You will end up having two copies, one in system32, and the other in dllcache. Doing this will make ImageCFG a system command, kinda like "dir" and "md". Usage - Please note that ImageCFG.exe does alter the executable, and as of now, i don't know how to reverse this on the file. So its best that you make a backup copy of the *.exe file before applying ImageCFG to it.

To use ImageCFG.exe for setting the affinity mask of an executable, you have to do a couple of things. First, you must make the executable think that its in a uniprocessor environment. This will disable the operating systems multithread emulation on that one single process. To do this, you type (in the console) imagecfg -u file.exe. After that, you type in the switch that assigns the executable to a processor. Type imagecfg -a 0x1 file.exe to assign the executable to processor one. the 0x1 part tells it what processor to bind the exe to. Its in hex. Like, 0x1 is your 1st processor (cpu0), 0x2 is the second (cpu1), 0x3 is cpu2, and so on and so forth. The pictures at the bottom show me assigning the Folding core executable to my first processor.

These tools are also handy to have:
How to Install and Use the Interrupt-Affinity Filter Tool
IntFilt is also included in the Windows Server 2003 Resource Kit Tools (Also works with XP)

This page was last updated on: Sunday, November 23rd, 2003 at 6:25:11 PM CST
http://www.Robpol86.com/
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sat Feb 25, 2023 4:33 pm    Post subject: Reply with quote

An example of using Imagecfg from pcgamingwiki


Force only one CPU core to run the game


Download ImageCFG.

https://web.archive.org/web/20080721084339/http://www16.brinkster.com/salvage/thief/imagecfg.zip


Extract the contents of the download to <path-to-game>.
Open a text editor (ex. Notepad) and paste in the following

(using Pharoh.exe as a game executable example,
alter this to suit your specific game)


@echo off
if not exist Pharaoh.exe goto end
if exist Pharaoh.exe.bak goto end
copy Pharaoh.exe Pharaoh.exe.bak
imagecfg -u Pharaoh.exe
imagecfg -a 0x1 Pharaoh.exe
pause
:end


save as a batch file .bat extension

run the batch file to start the game
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sun Mar 19, 2023 2:16 am    Post subject: Reply with quote

Use of Imagecfg tool
https://social.technet.microsoft.com/Forums/windows/en-US/9408b38e-bd85-4b7a-9afe-f72a50405339/use-of-imagecfg-tool?forum=itproxpsp

imagecfg tool which was originally found in the Windows 2000 or Windows XP Server Resource Kit Query


In the microsoft response mentions

You also can use psexec with the -a switch to replace imagecfg.exe.
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

The only downside of psexec is that it doesn't modifies the executable.
So, you need to execute the legacy application always with psexec


PsExec v2.40
https://learn.microsoft.com/en-gb/sysinternals/downloads/psexec

execute process

-a Separate processors on which the application can run with commas where 1 is the lowest numbered CPU.
For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4"


Last edited by corsair91 on Sun Mar 19, 2023 2:51 am; edited 1 time in total
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sun Mar 19, 2023 2:17 am    Post subject: Reply with quote

What is IMAGECFG.EXE? Is it Safe or a Virus? How to remove or fix it
https://windowsbulletin.com/files/exe/microsoft/msdn-disc-5/imagecfg-exe

IMAGECFG.EXE is an executable file that is part of MSDN Disc 5 developed by Microsoft. The Windows version of the software: 1.0.0.0 is usually about 114960 bytes in size, but the version you have may differ.


Warning
March 2023 Update
Product placement included


Last edited by corsair91 on Sun Mar 19, 2023 2:53 am; edited 2 times in total
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sun Mar 19, 2023 2:25 am    Post subject: Reply with quote

Max Payne Guide as an example

Making game work by forcing CPU affinity
https://steamcommunity.com/sharedfiles/filedetails/?id=805455947


the game wasn't designed to be played on multi-core processors

using ImageCFG utility, which basically modifies the executable, forcing it to run on specific CPUs.



Open game folder
C:\Program Files (x86)\Steam\steamapps\common\Max Payne


Download ImageCFG utility from here[robpol86.com], place it in game folder
https://robpol86.com/imagecfg.html


backup the exe file
copy maxpayne.exe to maxpaynebackup.exe


Load up Command Line (press Win+R, type cmd, hit Enter)

Type
cd "<game folder>"
imagecfg -a 0x1 maxpayne.exe

Done, try to launch a game
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Sun Mar 19, 2023 2:42 am    Post subject: Reply with quote

Mirror Link

Imagecfg
https://gamebanana.com/tools/2614


set the affinity for a program permanently, instead of having to do it each time you start the application/game.

used to fix old games/programs ( anything thats an .exe ) that were not designed to work with processors with more than one core.


"Processor affinity" is a term used when running applications on a system with more than one processor. The tool in question is named IMAGECFG.EXE -- Image Config, so named because Microsoft refers to application binaries in Windows as the "image" of an application.


use IMAGECFG on third-party applications
not on any binaries that come bundled with the OS


To set processor affinity for an app, you'll need to run IMAGECFG from the command line with the following parameters.

imagecfg -a 0xn Path program.exe

The "0xn" is a hex code that sets which processor to give the program affinity to.

For processor 0, it's 0x1;
for processor 1, it's 0x2.

The numbers go up to 32 processors, but the progression of the mask is peculiar:
0x1, 0x2, 0x4, 0x8, then 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, and so on.


Warning Once you do this, the binary for the program in question will be changed permanently, so it's a good idea to make a backup copy of the binary in question before playing with this
Back to top
View user's profile Send private message
corsair91
Sailing Master
Posts: 8250



207513 Gold -

PostPosted: Tue Oct 24, 2023 2:29 pm    Post subject: Reply with quote

How to Set CPU Affinity via Windows Task Manager, System Properties, PowerShell, and CMD

https://winbuzzer.com/2024/01/02/how-to-set-cpu-affinity-in-windows-10-with-task-manager-or-system-properties-xcxwbt/


We show you how to set CPU affinity in Windows to claw back some
performance, as well as how to change your CPU scheduling.

Ryan Maskell
January 2, 2024


The process described is the same in Windows 11 as it is in Windows 10. However, bear in mind that we'll be using screenshots from Windows 10

See website article for further Info & screenshots


Needs to be set in Task Manager for each Gameplay session
if set via Task Manager
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Modding tools All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group