Daodan DLL: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (removing link to obsolete page that can only confuse readers)
m (corrected a section name that changed and added more SectionLinks for convenience)
 
(88 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The Daodan DLL is a modification for Oni that hooks into the game engine and applies bug fixes and patches. It also replaces parts of the engine with its own code. Daodan fixes many issues, including the famous "[[Blam|Blam!]]" error that occurs on many Windows XP machines. It also adds new features such as support for extra screen resolutions (including many widescreen resolutions) and bonus cheat codes. Daodan is in constant development and there are many versions.
{{Hatnote|This is about a Windows-only patch for the game engine. For the entity within the game's story, see [[Daodan]]. For information on the patches to Mac versions of Oni and historical patching of Windows Oni, see the [[:Category:Patches|Patches category]]. Also see [[OniX]], a rebuild of the Oni application for modern Windows systems.}}
The '''Daodan DLL''' is a patch for Oni for Windows that hooks into the game engine to fix bugs and add features. It does this by posing as '''binkw32.dll''', the library that Oni loads so that it can play the game's opening and ending videos. The Daodan fixes issues such as the famous "[[Blam|Blam!]]" error that occurs on modern machines. It also adds new features such as support for widescreen resolutions and bonus cheat codes. The Daodan DLL was created by [[User:SFeLi|SFeLi]] and then developed further by [[User:RossyMiles|RossyMiles]], [[User:Gumby|Gumby]] and [[User:Admin|Alloc]].
:''Subpages:'' [[/Change log|Change log]]
{{TOCfloat}}


==C-Daodan==
Note that you '''already have the Daodan DLL installed''' if you installed the [[Anniversary Edition]].
The recommended version is the last stable version of C-Daodan. This is also the only version that supports windowed mode.


[http://rossy.oni2.net/files/daodan/binkw32.dll Download C-Daodan (binkw32.dll)] Installation instructions are below.
===Manual installation instructions===
:'''''(For non-AE users)'''''
1. You'll have to extract the Daodan DLL files yourself from the AE package [http://mods.oni2.net/node/233 here]. The files you need are in the plain\win_only\ directory.<br />
2. Extract the Oni.exe meant to go with the Daodan DLL from the AE package [http://mods.oni2.net/node/231 here].<br />
3. Find where your copy of Oni has been installed on your hard drive; usually it's "C:\Program Files\Oni\". This folder should contain GameDataFolder and Oni.exe (just called "Oni" if you have file extensions hidden). Back up this Oni.exe by renaming it (e.g. "Oni-original.exe").<br />
4. Place the newly-downloaded Oni.exe, binkw32.dll, realbink.dll, and assorted files into the Oni\ folder.<br />
5. To confirm that you have done everything correctly, run Oni.exe. Enter the game, bring up the Data Comlink (F1 by default), and type "tellmetheversion"; if you get a result like "Daodan v.''x.y''", the DLL is working.


[http://rossy.oni2.net/files/daodan/binkplay.exe Download BinkPlay (binkplay.exe)] BinkPlay is required to play the intro and outro movies; if Daodan is installed without BinkPlay, the movies will not play. BinkPlay is copyright RAD Game Tools, Inc.
===Troubleshooting===
If the game does not display correctly (for instance, a black window), try the following in any order:


===Features===
1. Disable the intro movie by renaming GameDataFolder\intro.bik. This often fixes the game window.<br />
*Windows XP patch - Fixed Oni crashing at startup on modern computers.
2. Open the daodan.ini in Notepad and set either "daodangl" or "windowhack" to true. "windowhack" should at least center the window on the screen.<br />
*Windowed mode - Oni runs inside a window, there is a menu option to enter fullscreen mode.
3. Try [http://www.google.com/search?q=windows+run+as+administrator launching Oni as Administrator].<br />
*Custom screen resolutions - Includes many more default screen resolutions, the ability to add custom resolutions (see below) and a patch to stop the overlays from being stretched when playing in widescreen.
4. Make the Oni folder writable by un-checking "Read-only" in the Properties window for the folder.<br />
*Extra cheats - This version of Daodan adds four extra cheats, along with re-enabling Developer Mode (extra cheats are listed below).
5. Try both the run_full and run_wind scripts.
*Cheats always enabled - Cheats are always enabled (they are usually only enabled after the player completes the game).
*Extra command line options - For advanced users, for a list, type "Oni -help".
*DirectInput is used on NT, XP and Vista - Better support for keyboard layouts.
*Level plugins - Added modding support for the Oni community.
*Projectile awareness patch - When combined with the Edition, AIs have the ability to dodge projectiles.


===Unsupported Version===
You can report problems with the Daodan DLL on [{{Discord}} our Discord server].
The current release of C-Daodan is a complete rewrite of the stable version and is considered alpha quality software. If you just intend to play Oni and are not interested in making your own modifications to Daodan's source code, it is highly recommended to use the stable version above.


Many features of the previous version have not been implemented yet in the rewrite, these include windowed mode, extra cheats and the added command line options.
===Feature summary===
*Buffer overflow patch – Fixes Oni crashing at startup on modern computers.
*Windowed mode – Oni can run inside a window properly.
*Custom screen resolutions – Includes many more possible screen resolutions.
*BGRA32 (ARGB8888) texture support.
*Extra cheats – See {{SectionLink||Added cheat codes}}.
*Cheats always enabled – No need to beat game first.
*Extra command-line options (for advanced users) – For a list, type "Oni -help".
*A new input system based on Raw Input, which should fix mouse lag and judder, as well as disabling mouse acceleration.
*AIs have ability to properly dodge projectiles.
*Stops fly-in character portraits from being stretched when playing in widescreen resolutions.
*Enables [[Developer Mode]] – Enter the [[Data Comlink]] and type "thedayismine" or simply 'x' to activate it.


[http://svn.oni2.net/Daodan/release/binkw32.dll Download C-Daodan (binkw32.dll, UNSTABLE!)] [http://websvn.chrilly.net/dl.php?repname=Oni2&path=%2FDaodan%2Frelease%2F&rev=0&isdir=1 (Tarball)] Installation instructions are the same as the stable version, except BinkPlay is not required and not used (The intro and outro movies are not played in this version).
===Languages===
The Daodan DLL offers support for the Chinese version of the game as well as multibyte languages in general (see "multibyte" under {{SectionLink||All configuration settings}}). It also adds some basic localization support by allowing cheat code names and two hardcoded strings in Oni to be translated.


==FASM-Daodan==
To enable Chinese support, type:
There is also a much older release of Daodan, referred to as FASM-Daodan. This is the original version by SFeLi. Unlike the stable version of C-Daodan, FASM-Daodan requires a different DLL to be downloaded depending on which Oni.exe is used. It does not support the newer Daodan features, such as windowed mode and custom resolutions, however it still contains the basic patches such as the Windows XP patch and the custom cheats.
[language]
Chinese = True
This will load a DLL called xfhsm_oni.dll (provided with a Chinese copy of Oni in order to load the Chinese font that also comes with it).


[http://geyser.oni2.net/EXE/pc.east/vtuneapi.dll Download FASM-Daodan basic (vtuneapi.dll, English, "standard" Oni.exe)]
Here are the strings that you can replace using the .ini file:
{| class="wikitable"
!INI name
!Description
|-
|blam
|Replaces body text of the [[:Image:Blam!.png|Blam window]].
|-
|damn
|Replaces title of the Blam window.
|-
|savepoint
|Replaces string "Save Point" in Load Game menu (see "Locales" below).
|-
|syndicatewarehouse
|Replaces string "Syndicate Warehouse" in Load Game menu (see "Locales" below).
|-
|''nameofcheat''_on/_off
|Replaces name of the built-in cheat code as it appears on the Data Comlink screen when code is entered. E.g., "behemoth_on=Gojira Desu!".
|}


[http://geyser.oni2.net/EXE/pc.buka/vtuneapi.dll Download FASM-Daodan basic (vtuneapi.dll, Russian, "buka" Oni.exe)]
====Locales====
In order to use the "savepoint" and "syndicatewarehouse" settings above, you must create a locale:
:1. Add a setting called "language" under the daodan.ini's [language] section with the name of your locale, e.g.:
[language]
language = xx
:You can call the locale whatever you want and it need not be an official ISO locale code such as "en" or "pt", but [[wp:List of ISO 639 language codes|here's the list of language codes]] if you want it.
:2. Create a folder alongside the Daodan DLL called "daodan_locales".
:3. Create an INI file inside called xx.ini (or whatever you called your locale in step 1).
:4. The contents of the INI should be:
savepoint = ''translation''
syndicatewarehouse = ''translation''
The next time Oni runs, you should see your translated strings in the Load Game screen. This approach allows you to create/download as many locale INIs as you want, place them in daodan_locales, and switch between them by changing the "language" setting in daodan.ini.


[http://geyser.oni2.net/EXE/pc.demo/vtuneapi.dll Download FASM-Daodan basic (vtuneapi.dll, Demo Oni.exe)]
===Configuration===
Creating a plain-text file called "daodan.[[wp:INI file|ini]]" in the same directory as the Daodan DLL will allow you to configure which patches are enabled, as well as to store configuration settings and language items. This file is typically created by the Daodan DLL the first time it loads.


[http://sfeli.oni2.net/daodan/basic-0.6.6.zip Download a ZIP containing the DLLs for each version.]
On modern versions of Windows (starting with Windows Vista), Oni does not properly request write access to the directory containing Oni.exe (i.e. C:\Program Files (x86)\Oni in typical installs). Windows detects this, and creates a dedicated directory for Oni.exe (and thus the Daodan DLL) to write its files to, located in C:\Users\<Your Username>\AppData\Local\VirtualStore. The directory for Oni will mirror its relative path on disk, so in a typical install it will be at VirtualStore\Program Files (x86)\Oni. This is where all files output by the program (startup.txt, persist.dat, key_config.txt, etc.) will be located when Oni is not run as an administrator. '''This is the location where daodan.ini must be placed if Oni is to be run as a non-administrator.''' Note that you can create your own folder for Oni, e.g. C:\Games\, to avoid this permissions issue.


[http://geyser.oni2.net/EXE/pc.east/daodan.txt View the Readme file (daodan.txt)] This file includes descriptions of all the cheats enabled with this version of Daodan.
Inside of the daodan.ini file, each configuration setting is stored inside a section as a name-value pair. To temporarily disable a setting in the INI, add a '#' to the beginning of the line and the Daodan will ignore it. Any settings not listed in the INI will use their default values which are listed in {{SectionLink||All configuration settings}}. To change a setting away from its default, add the setting to the relevant section. If the section does not yet exist, add it to the end of the file and add relevant entries under it.  Entries are case-<u>in</u>sensitive and spacing does not matter.


[http://sfeli.oni2.net/daodan/current.zip Download a ZIP containing the DLLs for an experimental (unstable) FASM-Daodan] This includes the projectile awareness patch and support for any language (except Chinese and Japanese). This is currently the only version of Daodan with added language support.
Here is a simple example of a daodan.ini file:
[devmode]
highres_console = True
showtriggervolumes = True
[gameplay]
cooldowntimer = False


==Installation Instructions==
daodan.ini may contain the following sections:
Before installation, it is important to know where your copy of Oni has been installed to. For most people, it is stored in "C:\Program Files\Oni" (My Computer -> Local Disk (C:) -> Program Files -> Oni). This folder should contain a "GameDataFolder" and "Oni" or "Oni.exe". It is important that you replace your "Oni.exe" with one that is compatible with Daodan. If you are using the unstable C-Daodan or the FASM-Daodan, Oni will not start unless you have the correct EXE. If you are using the recommended version of C-Daodan, Oni will start, but most of the features of Daodan will not be present.
* devmode ''(Developer Mode Configuration)''
* gameplay ''(Gameplay Configuration)''
* graphics ''(Graphics Configuration)''
* language ''(Language Configuration)''
* modding ''(Modding Configuration)''
* oni ''(Original Oni Options Configuration)''
* windows ''(OS Interaction Options)''


If you are using the demo version, it is probably not necessary to replace the EXE, skip to the next step.
For information on all possible settings, see {{SectionLink||All configuration settings}}.


Make sure to make a backup of your "Oni.exe" before replacing it in case the replacment doesn't work. The easiest way to do this is by renaming "Oni" or "Oni.exe" to something else like "Oni.old.exe".
===Command-line arguments===
[[Customizing#Command-line arguments|Command line options]] for the Daodan DLL can also be used when launching Oni, although the syntax is a little different (and a bit more powerful). The basic syntax for a command line option is this:
-<ini section>.<option> <value>
For example, to disable sound start Oni with this:
oni -options.sound false
When <ini section> is omitted, it is assumed to be '''options'''. When <value> is omitted, it is assumed to be '''true''' unless <option> starts with '''no''' (eg. '''nosound''') in which case it is assumed to be '''false'''. So an easier way to write the above command would be:
oni -nosound
Options or patches specified on the command line take precedence over options specified in daodan.ini so that you can temporarily override the usual settings. Currently Oni's command line parser isn't powerful enough to parse Language settings (no support for quoting arguments); this will be fixed in a later release.


If you are already using a modded EXE (such as Ian's Windows XP patch), it is still recommended to replace it with the EXEs from here as the modifications in the EXE could conflict with Daodan.
===All configuration settings===
Below are the names of the configuration settings you can turn on and off in daodan.ini (names and sections are case-insensitive). Also noted is whether the DLL has this patch turned on or off by default.
{| class="wikitable"
!INI Section
!INI Name
!Default
!Description
|-
|[devmode]
|highres_console
|true
|Fixes bug where console line becomes invisible at higher resolutions.
|-
|[devmode]
|showtriggervolumes
|true
|Allows BSL variable "show_triggervolumes" and Ctrl+Shift+X (in devmode) to work.
|-
|[gameplay]
|bindablecheats
|true
|Enables cheats to be bound to keys using key_config.txt. Requires "customactions" and "cheattable" to be on.
|-
|[gameplay]
|characterawareness
|true
|Prevents AIs from forgetting about you when they are pursuing you and lose sight of you.
|-
|[gameplay]
|cheatsenabled
|true
|Enables cheats without having to beat the game first. Required for using 'tellmetheversion'.
|-
|[gameplay]
|cheattable
|true
|Replaces Oni's cheat table with table that includes new cheats (see section below). Required for using 'tellmetheversion'.
|-
|[gameplay]
|cooldowntimer
|true
|Disables weapon cooldown exploit, e.g. dropping the Mercury Bow and picking it back up right away to reset weapon cooldown.
|-
|[gameplay]
|customactions
|true
|Allows new bindable actions to be registered with the DLL, such as bindable cheats (if "bindablecheats" is on).
|-
|[gameplay]
|kickguns
|false
|EXPERIMENTAL! Unfinished, do not use.
|-
|[gameplay]
|pathfinding
|true
|Multiplies size of pathfinding grid cache by eight in order to prevent crashes in large levels.
|-
|[gameplay]
|projaware
|true
|Allows AI to dodge incoming gunfire properly.
|-
|[gameplay]
|throwtest
|false
|EXPERIMENTAL! Enables experimentation with allowing enemies to be thrown over railings.
|-
|[gameplay]
|wpfadetime
|true
|Adds working function for existing BSL command wp_fadetime, sets fade time to 4800.
|-
|[graphics]
|binkplay
|true
|Fixes binkplay calls to use GDI and outro same mode as intro.
|-
|[graphics]
|daodangl
|true
|Provides an improved windowed mode (-noswitch); this patch is known to break the hiding of the Windows taskbar in fullscreen mode.
|-
|[graphics]
|displayenum
|true
|Offers a more accurate list of available display modes in the Options menu.
|-
|[graphics]
|gamma
|true
|Enables gamma slider in fullscreen, disables it in windowed mode.
|-
|[graphics]
|newweap
|true
|Enables weapon info, so that standing above a weapon displays a message containing the weapon name and amount of ammo.
|-
|[graphics]
|optionsvisible
|true
|Enables always showing the options button in main menu, even when pausing from a game.
|-
|[graphics]
|showalllasersights
|false
|Enables visibility of all (also enemies') weapon lasersights
|-
|[graphics]
|widescreenportraits
|true
|Prevents fly-in portraits from being stretched when playing in widescreen resolutions.
|-
|[language]
|chinese
|true
|Allows Chinese fonts to be shown if the required DLL is available.
|-
|[language]
|fonttexturecache
|true
|Doubles size of font texture cache.
|-
|[language]
|language
|en
|Sets locale name for hardcoded strings (see {{SectionLink||Locales}}).
|-
|[language]
|nomultibyte
|true
|Enables languages which use multibyte coding (such as Chinese).
|-
|[modding]
|argb8888
|true
|Enables the use of textures using ARGB8888.
|-
|[modding]
|d_regen
|true
|Enables script command d_regen (query/set regeneration for any character).
|-
|[modding]
|daodanbsl
|true
|Adds new BSL commands (see below).
|-
|[modding]
|hdscreens_lowres
|true
|Allows HD intro/ending screens on game resolutions smaller than 1024x768.
|-
|[modding]
|largetextures
|true
|Enables the use of textures up to 512x512.
|-
|[modding]
|levelplugins
|true
|Allows level files that do not end in "_Final" to be loaded from the GDF.
|-
|[oni]
|debug
|false
|Not useful; probably does nothing.
|-
|[oni]
|debugfiles
|false
|Enables function logging; when active, BSL function calls are logged to script_debug.txt.
|-
|[oni]
|findsounds
|false
|Not useful, extends output of sound_list_broken_links.
|-
|[oni]
|ignore_private_data
|false
|Disables the loading of 'private data' in level0. Probably has no effect.
|-
|[oni]
|sound
|true
|Enables sound.
|-
|[oni]
|switch
|true
|Enables always switching screen to resolution on Oni's Options screen, making the game fullscreen; opposite of Oni's built-in argument "noswitch".
|-
|[windows]
|alttab
|true
|Allows user to switch applications while in Oni (Alt-Tab) and use the Windows key; however, it may enable the screensaver as well.
|-
|[windows]
|border
|true
|Adds a border in windowed mode if '[graphics] daodangl' is active.
|-
|[windows]
|clipcursor
|true
|Limits cursor to Oni's window. This is always enabled if Daodan Input is enabled.
|-
|[windows]
|daodaninput
|true
|A new input system which reports input on every frame, which should fix issues with mouse lag/judder and high-FPS displays.
|-
|[windows]
|directinput
|true
|Forces on DirectInput when Daodan Input is disabled.
|-
|[windows]
|mousesensitivity
|1.0
|Multiplier for mouse movement values when Daodan Input is enabled. 1.0 is Oni's default.
|-
|[windows]
|disablecmdline
|true
|Disables Oni's existing command line parser as Daodan has its own.
|-
|[windows]
|killvtune
|false
|Prevents loading of vtuneapi.dll.
|-
|[windows]
|safeprintf
|true
|Replaces Oni's function that prints to startup.txt with a safer one.
|-
|[windows]
|topmost
|false
|Keeps game window on top in windowed mode, even when switching applications.
|-
|[windows]
|usegettickcount
|true
|Replaces Oni's timing functions with more accurate ones.
|}


==Replacement EXEs==
===Added cheat codes===
[http://geyser.oni2.net/EXE/pc.east/Oni.exe Eastern English engine (Oni.exe, recommended)] Use this EXE if you have an English version of Oni, or you are using the experimental FASM-Daodan (which adds support for any language.)
*'''bigbadboss'''
:Player takes less weapon damage.
*'''buddha'''
:Player is unkillable (will not go below 1HP).
*'''bulletproof'''
:Player takes no weapon damage.
*'''kangaroo'''
:Player can make super-high jumps.
*'''marypoppins'''
:Player can fly by holding down jump key.
*'''shinobi'''
:Extra difficulty mode; player always has 1HP, but also is immune to weapons, and the enemy AI cannot hear the player.


[http://geyser.oni2.net/EXE/pc.buka/Oni.exe Russian (buka) engine (Oni.exe)] Use this EXE if you have a Russian version of Oni, or you have a language that isn't English and are using a version of Daodan without support for any language. This EXE does not work with the unstable version of C-Daodan.
===Added BSL functions===
Any time a function can both get and set a value, and you set the value, the old value should be returned, barring any programming oversight by Gumby.


[http://geyser.oni2.net/EXE/pc.demo/Oni.exe Demo engine (Oni.exe)] This is the EXE included with the Oni Demo. If you have a Demo version of Oni, it is probably the same as the EXE you already have. This EXE does not work with the unstable version of C-Daodan.
====Math====
* int '''int32div''' n1:int n2:int
:Divides two integers
* int '''int32mul''' n1:int n2:int
:Multiplies two integers
* float '''div''' [int1:int|float1:float] [int2:int|float2:float]
:Divides two two numbers
* float '''mul''' [int1:int|float1:float] [int2:int|float2:float]
:Multiplies two numbers
* int '''int32rand''' start:int end:int
:Returns a pseudo-random number between two numbers (inclusive).


===Installation===
====Characters====
If you are using FASM-Daodan, simply copy a "vtuneapi.dll" from this site into Oni's folder. If you are using C-Daodan, make a backup of "binkw32.dll" (by renaming it to something else), then copy a "binkw32.dll" from this site (and a "binkplay.exe" if necessary) into Oni's folder. If you are upgrading from FASM-Daodan to C-Daodan, make sure to delete your old "vtuneapi.dll" to prevent conflicts between the new and old versions.
* float '''d_distance''' [ai_name:string | script_id:int] [ai_name:string | script_id:int]
:Gets the distance between two characters
* int '''d_getdamage''' [ai_name:str | script_id:int]
:Gets the amount of damage a character has caused
* int '''d_getindex''' [ai_name:str]
:Gets a character's script_id from their name
* int '''d_getkills''' [ai_name:str | script_id:int]
:Gets the number of kills a character has
* int '''d_health''' [ai_name:str | script_id:int] [newhealth:int]
:Gets or sets a character's health
* int '''d_holdkey''' [ai_name:string | script_id:int] keys frames:int
:Makes a character hold a key
:Possibly broken
* int '''d_isheld''' keys
:Checks if player is holding a key
:Possibly broken
* float '''d_location''' [ai_name:string | script_id:int] axis:string anything:string
:Gets the X, Y or Z coordinate of a character, as specified in "axis"; the "anything" parameter is unused but must be present
* float '''d_location''' [ai_name:string | script_id:int] x:float y:float z:float
:Sets the XYZ coordinates of a character
* int '''d_maxhealth''' [ai_name:str | script_id:int] [newmaxhealth:int]
:Gets or sets a character's maxhealth
* string '''d_name''' [ai_name:str | script_id:int] [newname:string]
:Gets or sets a character's name
* int '''d_powerup''' ai_name:str|script_id:int powerup:str [newcount:int]
:Gets or sets the amount of powerups a character has
:Powerup list is the same one used with '''chr_givepowerup''', with the addition of "bossshield"
* int '''d_regen''' [ai_name:str | script_id:int] on_off:bool
:Gets or sets a character's regeneration (like elderrune for the player)
* int '''d_waitforkey''' keys
:Waits for a keypress from the player


==Testing==
====Text====
To test if you have done everything correctly, run "Oni.exe". If you are using the recommended C-Daodan, the results should be obvious: Oni will open in a window instead of full screen (if Oni opens in full screen, go to its options and change to a lower resolution to test the windowed mode). If you are using the unstable C-Daodan, Oni will still run full screen, but there will be many more resolution choices in the options menu. If you are using the FASM-Daodan, the only way to tell is to start a level and test one of the new cheat codes (view the readme file above for the cheats, the last 5 cheats are only available with Daodan, the last cheat is only available in the experimental version).
* void '''d_dprint''' text:string [textcolor: r b g] [shadowcolor: r b g]
:Prints to console in color
:Colors are ints between 0 and 255. Other numbers will be reduced to 255.
:Any colors you do not supply will be replaced with the default values: 255, 255, 255 and 63, 63. 63
* string '''sprintf''' str1:format ...
:Does a C-style sprintf operation on a string


==Custom screen resolutions==
===Added input bindings===
If you wish to run in a screen resolution that is not available and you are running the recommended version of C-Daodan, create a text file (Notepad document) in your Oni folder (C:\Program Files\Oni) containing a list of custom resolutions in this format (one resolution per line):
When Daodan Input is enabled, the following inputs can be bound in key_config.txt in addition to the [[Customizing/Binding#Bindable key names|usual ones]].


800x600
*'''mousebutton5'''
 
:The "forward" button on most 5-button mice.
1024x600
*'''scrollup'''
 
:Scrolling up one notch on a mouse scroll wheel or touchpad.
1024x768
*'''scrolldown'''
 
:Scrolling down one notch on a mouse scroll wheel or touchpad.
Save the file as "res.txt".
*'''scrollleft'''
 
:Scrolling left on a mouse with an omnidirectional scroll wheel or a touchpad.
==Uninstallation==
*'''scrollright'''
To remove the Daodan mod, delete all the files you downloaded from this site and restore the files you backed up.
:Scrolling right on a mouse with an omnidirectional scroll wheel or a touchpad.
 
*'''pagedown'''
==Source Code==
:This was broken in DirectInput mode in vanilla Oni.
[http://rossy.oni2.net/files/daodan/src.zip Source code of C-Daodan (stable)] C source code ZIP, compiles with MinGW.
 
[http://websvn.chrilly.net/dl.php?repname=Oni2&path=%2FDaodan%2Fsrc%2F&rev=0&isdir=1 Source code of C-Daodan (unstable)] C source code tarball, compiles with MinGW.
 
[http://sfeli.oni2.net/daodan/basic_src-0.6.6.zip Source code of FASM-Daodan 0.6.6] FASM source code ZIP, compiles with FASM.


[[Category:Patches]]
[[Category:Patches]]

Latest revision as of 18:10, 27 March 2024

This is about a Windows-only patch for the game engine. For the entity within the game's story, see Daodan. For information on the patches to Mac versions of Oni and historical patching of Windows Oni, see the Patches category. Also see OniX, a rebuild of the Oni application for modern Windows systems.

The Daodan DLL is a patch for Oni for Windows that hooks into the game engine to fix bugs and add features. It does this by posing as binkw32.dll, the library that Oni loads so that it can play the game's opening and ending videos. The Daodan fixes issues such as the famous "Blam!" error that occurs on modern machines. It also adds new features such as support for widescreen resolutions and bonus cheat codes. The Daodan DLL was created by SFeLi and then developed further by RossyMiles, Gumby and Alloc.

Subpages: Change log

Note that you already have the Daodan DLL installed if you installed the Anniversary Edition.

Manual installation instructions

(For non-AE users)

1. You'll have to extract the Daodan DLL files yourself from the AE package here. The files you need are in the plain\win_only\ directory.
2. Extract the Oni.exe meant to go with the Daodan DLL from the AE package here.
3. Find where your copy of Oni has been installed on your hard drive; usually it's "C:\Program Files\Oni\". This folder should contain GameDataFolder and Oni.exe (just called "Oni" if you have file extensions hidden). Back up this Oni.exe by renaming it (e.g. "Oni-original.exe").
4. Place the newly-downloaded Oni.exe, binkw32.dll, realbink.dll, and assorted files into the Oni\ folder.
5. To confirm that you have done everything correctly, run Oni.exe. Enter the game, bring up the Data Comlink (F1 by default), and type "tellmetheversion"; if you get a result like "Daodan v.x.y", the DLL is working.

Troubleshooting

If the game does not display correctly (for instance, a black window), try the following in any order:

1. Disable the intro movie by renaming GameDataFolder\intro.bik. This often fixes the game window.
2. Open the daodan.ini in Notepad and set either "daodangl" or "windowhack" to true. "windowhack" should at least center the window on the screen.
3. Try launching Oni as Administrator.
4. Make the Oni folder writable by un-checking "Read-only" in the Properties window for the folder.
5. Try both the run_full and run_wind scripts.

You can report problems with the Daodan DLL on our Discord server.

Feature summary

  • Buffer overflow patch – Fixes Oni crashing at startup on modern computers.
  • Windowed mode – Oni can run inside a window properly.
  • Custom screen resolutions – Includes many more possible screen resolutions.
  • BGRA32 (ARGB8888) texture support.
  • Extra cheats – See § Added cheat codes.
  • Cheats always enabled – No need to beat game first.
  • Extra command-line options (for advanced users) – For a list, type "Oni -help".
  • A new input system based on Raw Input, which should fix mouse lag and judder, as well as disabling mouse acceleration.
  • AIs have ability to properly dodge projectiles.
  • Stops fly-in character portraits from being stretched when playing in widescreen resolutions.
  • Enables Developer Mode – Enter the Data Comlink and type "thedayismine" or simply 'x' to activate it.

Languages

The Daodan DLL offers support for the Chinese version of the game as well as multibyte languages in general (see "multibyte" under § All configuration settings). It also adds some basic localization support by allowing cheat code names and two hardcoded strings in Oni to be translated.

To enable Chinese support, type:

[language]
Chinese = True

This will load a DLL called xfhsm_oni.dll (provided with a Chinese copy of Oni in order to load the Chinese font that also comes with it).

Here are the strings that you can replace using the .ini file:

INI name Description
blam Replaces body text of the Blam window.
damn Replaces title of the Blam window.
savepoint Replaces string "Save Point" in Load Game menu (see "Locales" below).
syndicatewarehouse Replaces string "Syndicate Warehouse" in Load Game menu (see "Locales" below).
nameofcheat_on/_off Replaces name of the built-in cheat code as it appears on the Data Comlink screen when code is entered. E.g., "behemoth_on=Gojira Desu!".

Locales

In order to use the "savepoint" and "syndicatewarehouse" settings above, you must create a locale:

1. Add a setting called "language" under the daodan.ini's [language] section with the name of your locale, e.g.:
[language]
language = xx
You can call the locale whatever you want and it need not be an official ISO locale code such as "en" or "pt", but here's the list of language codes if you want it.
2. Create a folder alongside the Daodan DLL called "daodan_locales".
3. Create an INI file inside called xx.ini (or whatever you called your locale in step 1).
4. The contents of the INI should be:
savepoint = translation
syndicatewarehouse = translation

The next time Oni runs, you should see your translated strings in the Load Game screen. This approach allows you to create/download as many locale INIs as you want, place them in daodan_locales, and switch between them by changing the "language" setting in daodan.ini.

Configuration

Creating a plain-text file called "daodan.ini" in the same directory as the Daodan DLL will allow you to configure which patches are enabled, as well as to store configuration settings and language items. This file is typically created by the Daodan DLL the first time it loads.

On modern versions of Windows (starting with Windows Vista), Oni does not properly request write access to the directory containing Oni.exe (i.e. C:\Program Files (x86)\Oni in typical installs). Windows detects this, and creates a dedicated directory for Oni.exe (and thus the Daodan DLL) to write its files to, located in C:\Users\<Your Username>\AppData\Local\VirtualStore. The directory for Oni will mirror its relative path on disk, so in a typical install it will be at VirtualStore\Program Files (x86)\Oni. This is where all files output by the program (startup.txt, persist.dat, key_config.txt, etc.) will be located when Oni is not run as an administrator. This is the location where daodan.ini must be placed if Oni is to be run as a non-administrator. Note that you can create your own folder for Oni, e.g. C:\Games\, to avoid this permissions issue.

Inside of the daodan.ini file, each configuration setting is stored inside a section as a name-value pair. To temporarily disable a setting in the INI, add a '#' to the beginning of the line and the Daodan will ignore it. Any settings not listed in the INI will use their default values which are listed in § All configuration settings. To change a setting away from its default, add the setting to the relevant section. If the section does not yet exist, add it to the end of the file and add relevant entries under it. Entries are case-insensitive and spacing does not matter.

Here is a simple example of a daodan.ini file:

[devmode]
highres_console = True
showtriggervolumes = True

[gameplay]
cooldowntimer = False

daodan.ini may contain the following sections:

  • devmode (Developer Mode Configuration)
  • gameplay (Gameplay Configuration)
  • graphics (Graphics Configuration)
  • language (Language Configuration)
  • modding (Modding Configuration)
  • oni (Original Oni Options Configuration)
  • windows (OS Interaction Options)

For information on all possible settings, see § All configuration settings.

Command-line arguments

Command line options for the Daodan DLL can also be used when launching Oni, although the syntax is a little different (and a bit more powerful). The basic syntax for a command line option is this:

-<ini section>.<option> <value>

For example, to disable sound start Oni with this:

oni -options.sound false

When <ini section> is omitted, it is assumed to be options. When <value> is omitted, it is assumed to be true unless <option> starts with no (eg. nosound) in which case it is assumed to be false. So an easier way to write the above command would be:

oni -nosound

Options or patches specified on the command line take precedence over options specified in daodan.ini so that you can temporarily override the usual settings. Currently Oni's command line parser isn't powerful enough to parse Language settings (no support for quoting arguments); this will be fixed in a later release.

All configuration settings

Below are the names of the configuration settings you can turn on and off in daodan.ini (names and sections are case-insensitive). Also noted is whether the DLL has this patch turned on or off by default.

INI Section INI Name Default Description
[devmode] highres_console true Fixes bug where console line becomes invisible at higher resolutions.
[devmode] showtriggervolumes true Allows BSL variable "show_triggervolumes" and Ctrl+Shift+X (in devmode) to work.
[gameplay] bindablecheats true Enables cheats to be bound to keys using key_config.txt. Requires "customactions" and "cheattable" to be on.
[gameplay] characterawareness true Prevents AIs from forgetting about you when they are pursuing you and lose sight of you.
[gameplay] cheatsenabled true Enables cheats without having to beat the game first. Required for using 'tellmetheversion'.
[gameplay] cheattable true Replaces Oni's cheat table with table that includes new cheats (see section below). Required for using 'tellmetheversion'.
[gameplay] cooldowntimer true Disables weapon cooldown exploit, e.g. dropping the Mercury Bow and picking it back up right away to reset weapon cooldown.
[gameplay] customactions true Allows new bindable actions to be registered with the DLL, such as bindable cheats (if "bindablecheats" is on).
[gameplay] kickguns false EXPERIMENTAL! Unfinished, do not use.
[gameplay] pathfinding true Multiplies size of pathfinding grid cache by eight in order to prevent crashes in large levels.
[gameplay] projaware true Allows AI to dodge incoming gunfire properly.
[gameplay] throwtest false EXPERIMENTAL! Enables experimentation with allowing enemies to be thrown over railings.
[gameplay] wpfadetime true Adds working function for existing BSL command wp_fadetime, sets fade time to 4800.
[graphics] binkplay true Fixes binkplay calls to use GDI and outro same mode as intro.
[graphics] daodangl true Provides an improved windowed mode (-noswitch); this patch is known to break the hiding of the Windows taskbar in fullscreen mode.
[graphics] displayenum true Offers a more accurate list of available display modes in the Options menu.
[graphics] gamma true Enables gamma slider in fullscreen, disables it in windowed mode.
[graphics] newweap true Enables weapon info, so that standing above a weapon displays a message containing the weapon name and amount of ammo.
[graphics] optionsvisible true Enables always showing the options button in main menu, even when pausing from a game.
[graphics] showalllasersights false Enables visibility of all (also enemies') weapon lasersights
[graphics] widescreenportraits true Prevents fly-in portraits from being stretched when playing in widescreen resolutions.
[language] chinese true Allows Chinese fonts to be shown if the required DLL is available.
[language] fonttexturecache true Doubles size of font texture cache.
[language] language en Sets locale name for hardcoded strings (see § Locales).
[language] nomultibyte true Enables languages which use multibyte coding (such as Chinese).
[modding] argb8888 true Enables the use of textures using ARGB8888.
[modding] d_regen true Enables script command d_regen (query/set regeneration for any character).
[modding] daodanbsl true Adds new BSL commands (see below).
[modding] hdscreens_lowres true Allows HD intro/ending screens on game resolutions smaller than 1024x768.
[modding] largetextures true Enables the use of textures up to 512x512.
[modding] levelplugins true Allows level files that do not end in "_Final" to be loaded from the GDF.
[oni] debug false Not useful; probably does nothing.
[oni] debugfiles false Enables function logging; when active, BSL function calls are logged to script_debug.txt.
[oni] findsounds false Not useful, extends output of sound_list_broken_links.
[oni] ignore_private_data false Disables the loading of 'private data' in level0. Probably has no effect.
[oni] sound true Enables sound.
[oni] switch true Enables always switching screen to resolution on Oni's Options screen, making the game fullscreen; opposite of Oni's built-in argument "noswitch".
[windows] alttab true Allows user to switch applications while in Oni (Alt-Tab) and use the Windows key; however, it may enable the screensaver as well.
[windows] border true Adds a border in windowed mode if '[graphics] daodangl' is active.
[windows] clipcursor true Limits cursor to Oni's window. This is always enabled if Daodan Input is enabled.
[windows] daodaninput true A new input system which reports input on every frame, which should fix issues with mouse lag/judder and high-FPS displays.
[windows] directinput true Forces on DirectInput when Daodan Input is disabled.
[windows] mousesensitivity 1.0 Multiplier for mouse movement values when Daodan Input is enabled. 1.0 is Oni's default.
[windows] disablecmdline true Disables Oni's existing command line parser as Daodan has its own.
[windows] killvtune false Prevents loading of vtuneapi.dll.
[windows] safeprintf true Replaces Oni's function that prints to startup.txt with a safer one.
[windows] topmost false Keeps game window on top in windowed mode, even when switching applications.
[windows] usegettickcount true Replaces Oni's timing functions with more accurate ones.

Added cheat codes

  • bigbadboss
Player takes less weapon damage.
  • buddha
Player is unkillable (will not go below 1HP).
  • bulletproof
Player takes no weapon damage.
  • kangaroo
Player can make super-high jumps.
  • marypoppins
Player can fly by holding down jump key.
  • shinobi
Extra difficulty mode; player always has 1HP, but also is immune to weapons, and the enemy AI cannot hear the player.

Added BSL functions

Any time a function can both get and set a value, and you set the value, the old value should be returned, barring any programming oversight by Gumby.

Math

  • int int32div n1:int n2:int
Divides two integers
  • int int32mul n1:int n2:int
Multiplies two integers
  • float div [int1:int|float1:float] [int2:int|float2:float]
Divides two two numbers
  • float mul [int1:int|float1:float] [int2:int|float2:float]
Multiplies two numbers
  • int int32rand start:int end:int
Returns a pseudo-random number between two numbers (inclusive).

Characters

  • float d_distance [ai_name:string | script_id:int] [ai_name:string | script_id:int]
Gets the distance between two characters
  • int d_getdamage [ai_name:str | script_id:int]
Gets the amount of damage a character has caused
  • int d_getindex [ai_name:str]
Gets a character's script_id from their name
  • int d_getkills [ai_name:str | script_id:int]
Gets the number of kills a character has
  • int d_health [ai_name:str | script_id:int] [newhealth:int]
Gets or sets a character's health
  • int d_holdkey [ai_name:string | script_id:int] keys frames:int
Makes a character hold a key
Possibly broken
  • int d_isheld keys
Checks if player is holding a key
Possibly broken
  • float d_location [ai_name:string | script_id:int] axis:string anything:string
Gets the X, Y or Z coordinate of a character, as specified in "axis"; the "anything" parameter is unused but must be present
  • float d_location [ai_name:string | script_id:int] x:float y:float z:float
Sets the XYZ coordinates of a character
  • int d_maxhealth [ai_name:str | script_id:int] [newmaxhealth:int]
Gets or sets a character's maxhealth
  • string d_name [ai_name:str | script_id:int] [newname:string]
Gets or sets a character's name
  • int d_powerup ai_name:str|script_id:int powerup:str [newcount:int]
Gets or sets the amount of powerups a character has
Powerup list is the same one used with chr_givepowerup, with the addition of "bossshield"
  • int d_regen [ai_name:str | script_id:int] on_off:bool
Gets or sets a character's regeneration (like elderrune for the player)
  • int d_waitforkey keys
Waits for a keypress from the player

Text

  • void d_dprint text:string [textcolor: r b g] [shadowcolor: r b g]
Prints to console in color
Colors are ints between 0 and 255. Other numbers will be reduced to 255.
Any colors you do not supply will be replaced with the default values: 255, 255, 255 and 63, 63. 63
  • string sprintf str1:format ...
Does a C-style sprintf operation on a string

Added input bindings

When Daodan Input is enabled, the following inputs can be bound in key_config.txt in addition to the usual ones.

  • mousebutton5
The "forward" button on most 5-button mice.
  • scrollup
Scrolling up one notch on a mouse scroll wheel or touchpad.
  • scrolldown
Scrolling down one notch on a mouse scroll wheel or touchpad.
  • scrollleft
Scrolling left on a mouse with an omnidirectional scroll wheel or a touchpad.
  • scrollright
Scrolling right on a mouse with an omnidirectional scroll wheel or a touchpad.
  • pagedown
This was broken in DirectInput mode in vanilla Oni.