This page contains fixes for various issues with the Klingon Academy game on new versions of Windows OS.
Multithreading crash fix
Resolution enabler
Rendering fix

Multithreading crash fix


Sometimes the game crashes with Access violation error because its memory gets corrupted. This is caused by use of the no-serialize heap. This heap type assumes that it will be never accessed by more than one thread. Problem is that some callbacks from system functions are run in separate threads. This breaks that assumption. The result is a heap corruption. The fix removes the HEAP_NO_SERIALIZE flag from call to HeapCreate. For this to work properly, the game must not use its own heap implementation for small blocks. The small block heap is disabled on Windows 2000+ unless you run the executable in compatibility mode for earlier OS. If you run the game in Windows 95 or 98 compatibility mode, the fix does not work properly!.

How to apply automatically

The fix assumes that 1.02 patch (US, UK or German) is already applied.
  1. Download the patcher
  2. Unpack it to game directory where the ka.exe file resides
  3. Run the extracted ka_patcher.exe file.
If you plan to use the AI training variant kaai.exe, here is a patcher for it.

How to apply manually

The fix assumes that 1.02 patch (US, UK or German) is already applied. You need to open the ka.exe file in any hexadecimal editor and apply the changes mentioned bellow. The changes are described in following format:

offset: old_value new_value

Where the offset is offset from start of the file. At this offset is a single byte which should be changed. The old_value is value which should be there if you are at correct position in correct version of the ka.exe file. The new_value is value to which you should change the old value.

0030F1AB: 0F 90
0030F1AC: 94 90
0030F1AD: C0 90

If you are unsure how to do this change, there is a description how to do it with the free PSPad editor. Remember to back-up you original file so you can revert to it if you do something incorrectly.
  1. Open the file in the PSPad. The program should open in the hexadecimal mode
  2. Press Ctrl+G or select "Goto Line" from the Search menu.
  3. Ensure that the "From file beginning" choice is selected.
  4. Enter $0030F1AB into the "Bytes" field
  5. Starting from the cursor position you should see following: 0F 94C0 50FF. If that is not true, you are in incorrect version of file or you did something wrong in the previous steps so do NOT continue with the editing and try again from the beginning.
  6. Ensure that the overwrite mode is selected (visible in the status bar at the bottom of the window)
  7. Type 909090
  8. The result should now look like: 90 9090 50FF
  9. Save the file
The manual change for kaai.exe is:

0030F4CB: 0F 90
0030F4CC: 94 90
0030F4CD: C0 90

Resolution enabler

The resolution selection window in the standard launcher presents only limited number of resolutions. This patch disables the check so all resolutions enumerated on the system are available.

How to apply automatically

  1. Download the patcher
  2. Unpack it to game directory where the kalaunch.exe file resides
  3. Run the extracted kalaunch_patcher.exe file.

How to apply manually

Apply following changes to kalaunch.exe. Similar to the manual use of the multithreading patch.

000012CA: 75 90
000012CB: 1D 90
000012D2: 0F E9
000012D3: 84 85
000012D4: 84 00

Rendering fix & improvements

The game has some graphical issues on new OS and GPUs. The most annoying one are white flashes in the background during movement. Another problem is absence of dithering on latest cards which makes the limitations of the 16bit color mode even more noticeable. I made a wrapper which translates game calls to the DX9 to fix the first issue. It also converts part of the rendering to 24bit colors to reduce the second issue (the textures are still 16 bit so additional dithering would still help), generates mipmaps and forces the textures to use trilinear filtering.<

To use it, extract the file into the directory containing the ka.exe file. To remove it, delete the extracted ddraw.dll file. If you have any feedback, you can contact me at jiridvorak at centrum dot cz

Few screenshots of the improved rendering (click image for full scale version).
Klingon Academy 24bit rendering of beta ceti background Klingon Academy 24bit rendering of corona Klingon Academy 24bit rendering of nebula Klingon Academy mipmapping on ships

Known limitations


The wrapper provides limited configuration options to work around issues on various systems or to trade output quality for speed. The configuration is done by creating environmental variables with specific name and any value unless specified otherwise.

Following variables are available:
Configuration you might want to maximize depending on your HW
D3DEMU_ANISOTROPYThe value must be number greater than or equal to 1 specifying quality of the filtering (1 - minimal). Alternatively a max might be used to indicate maximal supported quality. Quality values above the supported range are clamped to nearest valid value.
D3DEMU_MSAA_QUALITYThe value must be number greater than or equal to 1 specifying quality of the anti-aliasing. Alternatively a max might be used to indicate maximal supported quality. Quality values above the supported range are clamped to nearest valid value.
Configuration you might want to try
D3DEMU_NO_CPU_STARFIELDDisables CPU drawn dots in the starfield for significant performance gain.
D3DEMU_NO_LOCKABLE_ZDisables emulation of depth buffer reads. Increases speed and might fix compatibility issues with SLI solutions. Enabled automatically on ATI cards. No noticeable visual effect
D3DEMU_UI_30FPSAllows the UI to be run on 30 fps instead of the default 16. Causes UI stalls on lower end HW or when Fraps video recording is active.
D3DEMU_FORCE_BLACK_ALPHAImproves color consistency between surfaces with light sources (windows/impulse/warp) and surfaces without them.
Configuration for special uses
D3DEMU_3D_VISIONEnables support for Nvidia 3D Vision for KA (no SFA). As the game is old, there are few glitches - the PIP image is broken and the target reticle is drawn at the screen level. D3DEMU_NO_CPU_STARFIELD should be used
D3DEMU_KA_LOGReactivates remnants of the KA internal log and redirects its to wrapper's log.
D3DEMU_LOG_FLUSHFlushes the log after each output to ensure that it contains all the data if the game crashes for some reason.
Compatibility workarounds
D3DEMU_NO_VISTADisables use of extended DirectX interfaces on Vista.
D3DEMU_NO_HW_PROCESSINGSwitches between HW and SW vertex processing.
D3DEMU_NO_BUFFERSDisables use of vertex and index buffers.
D3DEMU_NO_HW_COLOR_CONVERSIONDisables GPU based color conversion for render targets.
D3DEMU_NO_COMPOSITION_COMPAREDisables check for changes in composition surface.
D3DEMU_NO_TIMERDisables timer based screen refreshes in the UI mode.
D3DEMU_NO_TIME_REDIRECTDisables redirection of GetTickCount to timeGetTime.
Creation of environment variables on English versions of Vista+
Use the control panel to search for "environment" keyword. In Vista it finds entry "Edit environment variables for your account". Use it to add new user variable with the desired name and any value.
Compilation from source code
To directly compile the source code you need the Microsoft Visual Studio 2008 (otherwise you might have to update the project for your environment) and DirectX SDK for DX versions 7 and 9.


Version 1.22 (20.3.2015) - Stable.
Source code


Version 1.21 (19.8.2014) - Experimental.
Source code
Version 1.19 (21.3.2011) - Stable.
Source code
Version 1.20 (9.4.2011) - Experimental.
Source code
Version 1.18 (20.3.2011) - Experimental.
Source code
Version 1.17 (24.2.2011) - Stable.
Source code
Version 1.16 (23.2.2011) - Experimental.
Source code
Version 1.15 (19.2.2011) - Experimental.
Source code
Version 1.14 (14.2.2011) - Experimental.
Source code
Version 1.13 (6.2.2011) - Stable
Version 1.12 (5.2.2011) - Stable
Version 1.11 (30.1.2011) - Stable
Version 1.10 (29.1.2011) - Experimental, might contain new bugs
Version 1.09 (28.1.2011) - Experimental, might contain new bugs
Version 1.08 (27.1.2011) - Experimental, might contain new bugs
Version 1.07 (26.1.2011) - Experimental, might contain new bugs
Version 1.06 (23.1.2011) - Experimental, might contain new bugs
Version 1.05 (23.1.2011) - Experimental, might contain new bugs
Version 1.04 (22.1.2011) - Stable
Version 1.03 (20.1.2011)
Version 1.02 (20.1.2011)
Version 1.01 (15.1.2011)
Version 1.00 (27.12.2010)
Version 0.07 (24.12.2010)
Version 0.06 (23.12.2010)
Version 0.05 (23.12.2010)
Version 0.04
Version 0.03
Version 0.02