Developer Mode: Difference between revisions

From OniGalore
Jump to navigation Jump to search
Line 138: Line 138:
;On PC and PC demo : look for '''13 00 00 00 ## ## ## ## ## ## ## ## ## ## ## ## 14 00 00 00 ## ## ## ## ## ## ## ## ## ## ## ## 15 00 00 00'''
;On PC and PC demo : look for '''13 00 00 00 ## ## ## ## ## ## ## ## ## ## ## ## 14 00 00 00 ## ## ## ## ## ## ## ## ## ## ## ## 15 00 00 00'''
;On Mac OSX : look for '''00 00 00 13 ## ## ## ## ## ## ## ## ## ## ## ## 00 00 00 14 ## ## ## ## ## ## ## ## ## ## ## ## 00 00 00 15'''
;On Mac OSX : look for '''00 00 00 13 ## ## ## ## ## ## ## ## ## ## ## ## 00 00 00 14 ## ## ## ## ## ## ## ## ## ## ## ## 00 00 00 15'''
;On Mac OS9 beta/retail : look for '''00 00 13 ## ## ## ## ## ## ## ## ## 00 00 14 ## ## ## ## ## ## ## ## ## 00 00 15'''
;On Mac OS9 retail/demo : look for '''00 00 13 ## ## ## ## ## ## ## ## ## 00 00 14 ## ## ## ## ## ## ## ## ## 00 00 15'''
;On Mac OS9 demo : look for '''00 13 ## ## ## ## ## ## 00 14 ## ## ## ## ## ## 00 15'''
;On Mac OS9 beta : look for '''00 13 ## ## ## ## 00 14 ## ## ## ## 00 15'''
where the ## are joker chars. Once you've found that data (make sure it occurs only once in the file), replace the '''14''' with a '''0B'''.
where the ## are joker chars. Once you've found that data (make sure it occurs only once in the file), replace the '''14''' with a '''0B'''.


Line 146: Line 146:


----
----
==Using it==
==Using it==
===First check===
===First check===

Revision as of 18:36, 16 June 2006

Label on a crate in
Syndicate Warehouse
(an Easter egg)
TheDayIsMine.png TheDayIsMine0.png

The developer mode is a bundle of features (a set of hotkeys, plus console input/output) that was available via the thedayismine cheatcode in beta and pre-beta versions of Oni, up to beta 4.

Until recently, it was believed that the developer mode was completely cut from beta 5 and later. However, the developer mode is actually present in all available versions of Oni (except PS2...). It just needs to be unlocked (e.g. made available via a cheat).

The developer mode was first unlocked on the Russian & English PC versions by SFeLi in January 2006. Since all other versions (Mac and PC demo) have other limitations (e.g. no console-related scripting commands), it was believed the developer was only present in the retail PC versions.

Then, in June 2006, I looked at the PC demo version, and noticed that the developer mode was there. All Mac versions (demo, OS9 retail, OSX port) followed within a few hours (with a little help from EdT).

Below you will find download links, unlocking instructions, and finally an overview of the Developer Mode's features.

Getting it to work

Download it...

PC retail

You can get the patched executable here (English version, patched with Ian's patch, then patched by myself according to SFeli's instructions) :

In the PC retail, thedayismine is available as a separate cheat (thus killmequick is spared, even if it doesn't have any effect...).

I also reverse-engineered Ian's patch a little bit : it disables a lot of output routines, including dev console output...

PC demo

Same as above, but I was too lazy to make a separate cheat : the dev mode is activated/deactivated when you type killmequick, and you get "Ultra Mode" confirmation messages.

Mac demo

Lazy hack : killmequick turns Dev Mode on and off, with "Ultra Mode" confirmation messages.

Mac retail (OS9)

Same thing

Mac OSX port

Same thing

...or do it yourself

You may want to read this if your version of Oni is not covered by the above downloads (e.g. if you have an odd language version).

First, get a good hex editor. Ideally, it should allow you to search for sequences containing joker characters. One such editor for PC is XVI32. Dunno for Mac.

Cheat code lookup tables

Cheats : "magic words" and IDs
shapeshifter 0x00
liveforever 0x01
touchofdeath 0x02
canttouchthis 0x03
fatloot 0x04
glassworld 0x05
winlevel 0x06
loselevel 0x07
bighead 0x08
minime 0x09
superammo 0x0A
thedayismine 0x0B
reservoirdogs 0x0C
roughjustice 0x0D
chenille 0x0E
behemoth 0x0F
elderrune 0x10
moonshadow 0x11
munitionfrenzy 0x12
fistsoflegend 0x13
killmequick 0x14
carousel 0x15

First, a little information for the nerds :

Magic words and IDs
There are 22 cheat events in every version of Oni, indexed from 0 to 21 (from 0x00 to 0x15 in hexadecimal).
The indexation is the same in every version, so we can refer to the cheats by that ID, or by the "magic word" originally used to activate the cheat event (which is also version-independent).
The correspondence is shown in the little table on the right : all the cheats can be enabled and disabled, except for the 4 in italics (fatloot, winlevel, loselevel, munitionfrenzy).
Cheat lookup table
When you type characters in the "pause screen", the text you enter is compared with a set of "magic words".
When and if there is a match, the appropriate confirmation message is displayed (except for fatloot, winlevel, loselevel and munitionfrenzy, there are two messages to choose from), and the corresponding cheat event is launched.
This logic appears in an Oni executable in the form of a table
An element of that table consists of
a pointer to the "magic word"
a pointer to the "enabled" message
a pointer to the "disabled" message (if any)
the ID of the cheat event to launch

There is an element for every cheat, and they appear by order of increasing ID. The developer mode (ID 0x0B) is simply "skipped" : reservoirdogs (0x0C) comes right after superammo (0x0A).

Data size on different platforms
On PC, PC demo and Mac OSX : every element of the lookup table takes up 16 bytes; the 3 pointers and the ID are 4-byte data words (Little Endian on PC, Big Endian on Mac OSX); if a cheat has no "disabled" message, the third pointer is null
On Mac OS9 beta and retail : every element of the lookup table takes up 12 bytes; the 3 pointers and the ID are 3-byte data words (Big Endian); if a cheat has no disabled message, the last byte of the third pointer field is taken up by the ID (the remaining 2 bytes are garbage, as well as the ID field)
On Mac OS9 demo : the pointers and the ID are 2-byte words (Big Endian); regular elements take up 8 bytes; if a cheat has no "disabled" message, weird stuff happens to the third pointer and to the ID, and the element takes up 10 bytes (yes, 10, not 6)... the ID can be found in what would be the first byte of the ID field.

killmequick

On PC, PC demo and Mac OSX, there's extra space at the end of the lookup table and where the cheatcodes/messages are stored, so one can add thedayismine as an extra cheat. On Mac OS9, the data is packed tighter (and the text strings are stored together with their size), so the only easy way is to replace an existing cheat. The following mini-tutorial will explain how to bind the developer mode to the "ultra mode" cheat AKA killmequick.

Finding the lookup table

Open the executable (or the data fork of the executable on Mac), after backing it up of course... We shall look for the last three elements of the table, corresponding to fistsoflegend, killmequick and carousel.

On PC and PC demo
look for 13 00 00 00 ## ## ## ## ## ## ## ## ## ## ## ## 14 00 00 00 ## ## ## ## ## ## ## ## ## ## ## ## 15 00 00 00
On Mac OSX
look for 00 00 00 13 ## ## ## ## ## ## ## ## ## ## ## ## 00 00 00 14 ## ## ## ## ## ## ## ## ## ## ## ## 00 00 00 15
On Mac OS9 retail/demo
look for 00 00 13 ## ## ## ## ## ## ## ## ## 00 00 14 ## ## ## ## ## ## ## ## ## 00 00 15
On Mac OS9 beta
look for 00 13 ## ## ## ## 00 14 ## ## ## ## 00 15

where the ## are joker chars. Once you've found that data (make sure it occurs only once in the file), replace the 14 with a 0B.

Developer mode will now be enabled/disabled every time you type killmequick at the pause screen : you'll get "Ultra Mode Enabled" and "Ultra Mode Disabled" as confirmation messages.



Using it

First check

Cheats are normally unlocked when you finish the full version of the game. For unlocking cheats "manually" (especially necessary with the demos), see HERE

Let's say cheats are enabled and the developer mode has been made available via the thedayismine cheatcode (or killmequick or x or whatever).

Just type the developer mode cheat and watch for the confirmation message. However, it is likely that you won't notice anything special when you get back to the game. Below are a few quick ways to test the developer mode's functionality.

Hotkeys

The quickest way to tell whether it works at all, right after you get the confirmation message, is : to exit the pausescreen; to press End. That should teleport you to where the camera is (usually back and up, possibly through walls and ceilings).

End is one of the many hotkeys available in Developer Mode. You can also try Enter. A full list is provided below.

Here's another quick test, meant to see if the Control and Alt buttons work fine (on Mac, they should be replaced with "Apple" and "Option", respectively). Ctrl+Shift+U and Ctrl+Alt+U should both perform the "unstick" action : the player makes a small no-clipping step forward (overriding collision).

Console output

In developer mode, Oni prints debug messages about ingame events along the bottom line of the screen. Past messages scroll up across the screen and fade. In some situations, messages don't fade (e.g. if character debugging is enabled).

The easiest way to check whether that output works at all is to press F8 : the character class (skin) change is acknowledged with a console message.

You can also run around one of the original levels with developer mode on : you're guaranteed to see debug messages dumped to the console output.

If you don't see anything, that means console output is unfortunately disabled in your version of Oni.

If you're on PC retail, you may have applied Ian's patch (aka XP patch), which disables console output.
On PC demo, both console output and console input are invisible (i.e. you can enter script commands, but you're "blindfolded"). No can do.
Same thing for Mac, probably (please confirm)

Console input

By default, Oni auto-binds the "console" event to the "tilde" key ("~", usually located below Escape). On non-US keyboards, that key may not be recognized. Just add the line "bind leftalt to console" (or "bind leftoption to console") to key_config.txt in your Oni folder.

Features

Hotkeys

Complete overview of hotkeys coming soon...

Runtime scripting

Basic idea

(Almost) anything you write in scripts you can enter at runtime with the console. The only thing you can't do is register new variables and functions.

You can call existing functions, check on the values of existing variables. "Existing" means either built-in ones, or part of the original level logic, or part of your own scripts for the given level.

If a function/variable was succesfully registered by Oni during level load, you will be able to refer to them from the console.

You will even be able to browse the registered variables/functions with the Tab key, while typing at the console. Tab autocompletes the command being typed, then cycles through all available commands in (hex)alphabetical order (A...Z come before a...z). Shift+Tab lets you go back.

Previous commands can be navigated with up and down arrows. You can't insert/delete text in the middle of a command : you have to use Backspace.

The only keys that have an effect while the console is active are : Escape, Enter, Backspace, (Shift+)Tab, ASCII character keys and the arrow keys.

If you press an illegal key during console input (such as F1), the input display will freeze : hit Tab a few times to fix.

Limitations

Obviously, if you have no console output, it's a bit frustrating. Even more so if console input is invisible : you're in for some blindfolded scripting then. Still there are a few commands which you can type in as complements to regular cheats :

chr_nocollision 0 1 and chr_nocollision 0 0 enable/disable no-clipping. When in no-clipping, you can't fall down : jumping makes you flail in midair, and eventually you die (so be careful about that)
give_powerup shield gives you a force shield (which you can't have with fatloot)
dump_docs prints all the registered commands/variables to a file in your Oni folder (so you know just what you can type)
other stuff...

Also, the available scripting commands may be limited in your version. The most commands are on PC retail, or on beta 4 and earlier. On Mac, the functionality is much more limited (see HERE for details).