offset: old_value new_value
0030F1AB: 0F 90
0030F1AC: 94 90
0030F1AD: C0 90
0030F4CB: 0F 90
0030F4CC: 94 90
0030F4CD: C0 90
000012CA: 75 90
000012CB: 1D 90
000012D2: 0F E9
000012D3: 84 85
000012D4: 84 00
The Microsoft provided dinput.dll can in some cases cause memory corruption by writing after end of the allocated memory when the game is using EnumDevices to enumerate input devices. This happens because it incorrectly parses a HID information from some devices (e.g. Stream Deck) and attempts to initialize information for more axes than it allocated memory for.
In normal situation the issue causes semi random crashes when launching the game depending on what happens to be in the corrupted memory. When running with heap usage verification enabled, it will appear as crash in _CHid_InitAxisClass@16
The KA triggers this issue because it does not enable any device type filter when looking for joystick so the function will attempt to process all HID devices. The 1.30+ wrapper works around it by internally redirecting game's DirectInput enumeration and forces use of DIDEVTYPE_JOYSTICK filter. If necessary, this behavior can be disabled using D3DEMU_NO_DIRECT_INPUT_REDIRECT.
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).Configuration you might want to maximize depending on your HW | |
D3DEMU_ANISOTROPY | The 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_QUALITY | The 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_STARFIELD | Disables CPU drawn dots in the starfield for significant performance gain. |
D3DEMU_NO_LOCKABLE_Z | Disables 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_30FPS | Allows 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_ALPHA | Improves color consistency between surfaces with light sources (windows/impulse/warp) and surfaces without them. |
D3DEMU_3D_FPS_LIMIT | Specifies FPS limit to use for 3D game scene. Might improve game stability. |
D3DEMU_UI_KEEP_ASPECT_RATIO | Forces the UI to be shown in the correct 4:3 aspect ratio on widescreen monitors. Note that 3D images on some control stations will have incorrect aspect ratio in this mode. |
D3DEMU_VIDEO_KEEP_ASPECT_RATIO | Attempts to detect KA video and show it in the correct 4:3 aspect ratio in fullscreen mode on widescreen monitors. Video might be vertically cropped on ultra-wide monitors. |
Configuration for special uses | |
D3DEMU_3D_VISION | Enables 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_LOG | Reactivates remnants of the KA internal log and redirects its to wrapper's log. |
D3DEMU_LOG_FLUSH | Flushes the log after each output to ensure that it contains all the data if the game crashes for some reason. |
Compatibility workarounds | |
D3DEMU_NO_VISTA | Disables use of extended DirectX interfaces on Vista. |
D3DEMU_NO_HW_PROCESSING | Switches between HW and SW vertex processing. |
D3DEMU_NO_BUFFERS | Disables use of vertex and index buffers. |
D3DEMU_NO_HW_COLOR_CONVERSION | Disables GPU based color conversion for render targets. |
D3DEMU_NO_COMPOSITION_COMPARE | Disables check for changes in composition surface. |
D3DEMU_NO_TIMER | Disables timer based screen refreshes in the UI mode. |
D3DEMU_NO_TIME_REDIRECT | Disables redirection of GetTickCount to timeGetTime. |
D3DEMU_NO_DIRECT_INPUT_REDIRECT | Disables DirectInput redirection. |
D3DEMU_NO_JOY_INDEX_REDIRECT | Disables remapping of device indices Multimedia Joystick functions. |
D3DEMU_MAX_BUSY_WAIT | Maximal duration of busy wait while applying framerate limit, defaults to 4 ms. |
D3DEMU_IGNORE_KA_EXE_CHECK | Applies KA specific patches regardless of name of the executable. |