VOGONS

Common searches


CLI2NOP FAQ - by Stiletto

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by Snover

User metadata
Rank l33t++
Rank
l33t++

Frequently Asked Questions about CLI2NOP
Created by "Stiletto"

Q. What, exactly, is the "CLI2NOP problem" - a.k.a. the VDM interrupt problem?
A. To quote the README file of SoundFX 2000 (It's called README for a reason):

Under Windows NT the virtual DOS machine (VDM) maintains a virtual interrupt enable state for each DOS box. Execution of a CLI or STI instruction causes a trap to the VDM, which then updates the virtual interrupt state. Many programs save the interrupt state before disabling them by executing a pushf instruction. Unfortunately, due to a limitation in the Intel architecture when running a process in protected mode at a privilege level above zero, the popf instruction that would normally restore the interrupt state does not cause a trap and hence the virtual interrupt state in the VDM gets out of step with what the program expects and further virtual interrupts such as timer, mouse or sound card are not delivered to the program.

Q. What does CLI2NOP do?
A. To paraphrase SoundFX 2000's manual again:

SoundFX 2000's solution to this problem is to fix the application by patching the application using CLI2NOP. CLI2NOP is a batch file script and utility that searches for and replaces interrupt disable instructions in an executable file image with no-ops. It does this to avoid the freezes that can occur with some applications as a result of the VDM interrupt problem. This program attempts to work around this problem for several common games.

In summary - it "no-op's" the CLI commands present in the binary code of the executable. This works around the sticking points but changes the code, usually leaving the application with a tendency to freeze, and freeze frequently. So the question is, will you trade freezing at one point with freezing at another?

Q. When do I need to run CLI2NOP?
A. When most compatibility lists suggest that you do so. Generally speaking, it is a problem that largely affects BUILD engine based games (Duke Nukem 3D, Blood 3D) and other popular games which use the same engine that DOOM, DOOM2, and Hexen use. That is, any game which is a protected-mode application and requires DPMI emulation to be enabled when you attempt to run the game, say, enabled with a utility such as VDMSound Launchpad. So the two factors to pay attention to are:

  1. if it requires DPMI
  2. it freezes / locks up sometimes at "start-up."

ALSO NOTE: the CLI2NOP application is only required under Windows NT 4.0 and Windows 2000. Windows XP includes a "feature" similar to CLI2NOP that is built in to their "virtual DOS machine" (VDM) emulation, which is called on the fly, rather than to be executed preemptively like CLI2NOP. VDMSound now includes the ability to call this feature of Windows XP from within VDMSound. Make sure you get the latest update. If you do not have Windows XP, you must (for now) use CLI2NOP.

Q. Where can I get the program CLI2NOP?
A. A new CLI2NOP is now available! It does not have a restrictive distribution license, so feel free to smear it around the web! Get it now!

Q. How do I install CLI2NOP?
A. CLI2NOP is not normally installed by the SoundFX 2000 setup program, so you should use your favorite ZIP decompression utility (such as WinZip) to extract CLI2NOP.BAT and PATCH.EXE from the "Patch" folder of the SoundFX 2000 distribution archive. You can create a folder that includes PATCH.EXE and CLI2NOP.BAT and list this folder in your path settings. Alternately, you can put CLI2NOP.BAT and PATCH.EXE in the folder that includes the executable for the application that you want to patch. Both files should be placed in the same directory.

Q. How do I use CLI2NOP?
A. CLI2NOP should be run from a Command Prompt window in the directory of the file that is to be patched. At the command prompt enter:

cli2nop [options] file-to-patch [patched file]

The only option is "2" which enables additional processing using a more aggressive search/replace. (In particular, it replaces "pushfd, cli" combinations with "pushfd, nop", instead of replacing "pushfd, pop eax, cli" combinations with "pushfd, pop eax, nop".) For example, SoundFX 2000 suggests that this setting be used with DOOM and DOOM2, but suggests that it not be used with Duke Nukem 3D.
If no output file is specified then the input file will be modified.
An example of this would be using "cli2nop -2 doom.exe doomnt.exe" for DOOM.
Once you have VDMSound installed, right click on your new executable and choose "Run With VDMS". The game will start, loading VDMS to emulate the sound.
You can also of course use SoundFX 2000 to emulate the sound, since at this time you have it as well on your computer - consult their instructions to install SoundFX 2000.
If you need help setting up the game with its setup program, you're on your own!

Q. Are there any problems in using CLI2NOP to work around the VDM interrupt problem?
A. To quote the SoundFX 2000 manual again: "Removing the interrupt disable sequences can render the application liable to race conditions and contentions that the original programmer had designed to avoid. Consequently the application may be unstable and hence crash more after being patched. Further the patch algorithm is very simple and can possibly replace instructions or data that are essential to normal operation."
When creating PIF settings for applications patched with CLI2NOP you should usually enable the "Compatible timer hardware operation" option after patching. This reduces the frequency of crashes caused by timer interrupt race conditions. It does tend to slow the app slightly so experimentation is worthwhile. A final reminder: if no output file is specified when using CLI2NOP, then the input file (the original game executable) will be modified. You have been warned.

Q. Are there any advanced features you can tell me about?
A. No. Seriously, the definitions of the switches used in executing PATCH.EXE are available by typing "patch.exe -h" while at the Command Prompt, should you wish to use PATCH.EXE for your own purposes.

Thanks To:
Software Systems, creators of SoundFX 2000 - your README file, Help file, and CLI2NOP batch file were invaluable in the creation of this FAQ. Thanks also to Lawrence Rust of Software Systems for his quick feedback on the initial version of this FAQ.
Vlad Romascanu, creator of VDMSound

If you must, contact Vlad or I through the VDMSound User's Forum on Bravenet, the messageboards on SourceForge, or the VOGONS forum if you have any further questions regarding CLI2NOP. You can also contact Software Systems at their contact email address. However, this FAQ should answer all your questions.

Games that require the usage of CLI2NOP as of a search of the forums on 2-9-2005:

Blood
Death Rally
Doom
Doom 2
Duke Nukem 3D
Extreme PaintBrawl
Fate
Legend of the Seven Paladins
NAM/Napalm
Powerslave
Redneck Rampage
Redneck Rampage Rides Again
Redneck Deer Huntin'
Shadow Warrior
Strife
TekWar
Tyrian 2000
Witchhaven
Witchhaven 2: Blood Vengeance
WWII GI

Stiletto - 04/26/02
Updated and HTML-ized by Snover - 07/09/2002
Further editing by Stiletto - 07/10/02
And again, by Snover! *eg* - 07/10/2002
2005-03-01 -- Added list of supported games from forum search

Attachments

  • Filename
    cli2nop.zip
    File size
    36.54 KiB
    Downloads
    4683 downloads
    File license
    Fair use/fair dealing exception
Last edited by Snover on 2002-07-10, 19:27. Edited 1 time in total.

Yes, it’s my fault.