History of Oni modding/The tale of Dev Mode

From OniGalore
< History of Oni modding
Revision as of 21:41, 29 January 2015 by Iritscen (talk | contribs) (a couple additional editor's notes)
Jump to navigation Jump to search
This page's text comes from an old revision of a wiki article mostly written a few weeks after Dev Mode was first found, and makes for a fun (albeit technical) read about what may be the single most important discovery made so far in Oni. I have inserted a few notes in brackets to correct and update information. --Iritscen

thedayismine

It was very much of a myth ever since Oni was released. Random game sites around the web kept posting overviews of Oni's cheat codes with stuff like :

(this one from Oni Online)
Cheat codes
  • ...
  • thedayismine - Developer Mode
Developer Mode Commands
While in developer mode, you can use certain key combinations and access the command console. These are the keys I have found (in dev mode):
  • Cntl-Shift-Y = FPS Counter (works always, not only in dev)
  • F7 = Cycle through all possible weapons
  • F8 = Change character
  • F9 = Start recording
  • F10 = Stop recording
  • F11 = Playback recording
  • Cntl-Shift-G = toggles between slow motion and normal modes
  • Cntl-Shift-S = toggles textures on some objects
  • Cntl-Shift-B = shows your current opponent logic
  • ` = brings up the cmd prompt
Command prompt is perhaps the most interesting thing out there. You can execute script commands from there or assign values to internal variables. The best way to find out what commands/variable are there is to type at the cmd prompt: dump_docs. This command will dump all known docs and variables (sometimes with comments!) to the text file. CMD prompt has autocompletion feature, to accept the suggestion it gives you, use Tab key. Up and down arrows scrolls through the command history.
Some handy commands:
  • door_ignore_locks = 1 unlocks all doors for you
  • ai2_kill kills all nearby AI
  • chr_nocollision 0 1 'noclip' mode, allows you to walk through avoid jumping. The designed levels are beautiful.
More stuff can be found in the docs file created by dump_docs command.
Special thanks to:
Dr.Qwerty, nop, Mary

W.O.W. , right? One would rush to one's PC (or Mac), type in "thedayismine"...

and... :D :) :| :(

It just didn't work. No matter what one did. One has tried to call up the console through scripting, but without any success.

So, as years flew by, it looked more and more like the Developer Mode was left out of the retail version of Oni, and those lucky bastards at Oni Online (and elsewhere) were either repeating each other's BS without having actually used the Dev Mode, or they had gotten their hands on the beta or pre-beta version... or something [Editor's note: The leaked Mac beta from 2000 did have working Dev Mode, which the community was aware of at the time].

(maybe add links to frustrated forum talk etc)

It looked like we were screwed.

Until...

January 21, 2006

Screenshot.jpg

SFeli came around. He rediscovered the Developer Mode, reenabled it, and there was much rejoicing.

Below is a slightly reformatted version of his "dev diary"

[Editor's note: Please note that more understandable instructions for unlocking Dev Mode are found on the Dev Mode page, for anyone who wants to do it manually for some reason.]

Enabling Developer Mode (console)
22-01-2006

It is so simple, that I'm wondering why it wasn't done yet.

Two years ago I've read on Bungie's Oni site, that there was developer mode in Oni. It could be activated by the cheat code ("thedayismine"). But this cheat code didn't work for me, because Bungie had removed it before releasing Oni...

Look at the cheat table entry structure:

struct ONI_CHEAT_ENTRY                ;FASM-style structure declaration.
  lpszCheatName   dd ?                ;Address of "magic" word.
  lpszDescOn      dd ?                ;Address of "Cheat is enabled" message.
  lpszDescOff     dd ?                ;Address of "Cheat is disabled" message.
  nFnIndex        dd ?                ;Index in in CcLocations array.
ends

At the address 0x005533f8 (real 0x001533f8) in OniEn, 0x0054dea8 (real 0x0014dea8) in OniRu, there is an array of ONI_CHEAT_ENTRY structures (used by one of the core functions).

The whole array
ONI_CHEAT_ENTRY
lpszCheatName lpszDescOn lpszDescOff nFnIndex
shapeshifter szShapeShifter szShapeShiftOn szShapeShiftOff 0x00
liveforever szLive4Ever szLive4EverOn szLive4EverOff 0x01
touchofdeath szTouchOfDeath szTODOn szTODOff 0x02
canttouchthis szCantTouch szCantTouchOn szCantTouchOff 0x03
fatloot (1) szFatLoot szFatLootOn 0 0x04
glassworld szGlassWorld szGlassWorldOn szGlassWorldOff 0x05
winlevel (2) szWinLevel szWinLevelOn 0 0x06
loselevel (2) szLoseLevel szLoseLevelOff 0 0x07
bighead szBigHead szBigHeadOn szBigHeadOff 0x08
minime szMiniMe szMiniMeOn szMiniMeOff 0x09
superammo szSuperAmmo szSuperAmmoOn szSuperAmmoOff 0x0a
reservoirdogs szResDogs szResDogsOn szResDogsOff 0x0c
roughjustice szRoughJustice szRJOn szRJOff 0x0d
chenille szChenille szChenilleOn szChenilleOff 0x0e
behemoth szBehemoth szBehemothOn szBehemothOff 0x0f
elderrune szElderrune szElderruneOn szElderruneOff 0x10
moonshadow szMoonShadow szMoonShadowOn szMoonShadowOff 0x11
munitionfrenzy (2) szMunitionFrenzy szMunFrenOn 0 0x12
fistsoflegend szFistsOfLegend szFistsOn szFistsOff 0x13
killmequick szKillMeQuick szKillMeQOn szKillMeQOff 0x14
carousel szCarousel szCarouselOn szCarouselOff 0x15
(3) 0 0 0 0
  1. you can't undo fatloot, so no "disabled" message
  2. no undo for winlevel, loselevel or munitionfrenzy, either
  3. Null entry (see below)

Look at the 'superammo' cheat, then at the 'reservoirdogs' cheat. Something strange? Their .nFnIndex'es are 0x0a and 0x0c.

Guess why? Yes, it's because Bungie have commented element 0x0b of cheats array in the game source-code (Oni_GameState.c) before building the release version.

What was that cheat? Developer mode, of course!!! :-) And since cheats array was fixed-size (0x16) elements -- we have a zero entry at the end of array. Fill it with correct szCheatName, szDescOn, szDescOff pointers, set nFnIndex to 0x0b and you will have working developer mode cheat code.

About cheat function with index 0x0b (CcCaseDevMode). Actually it's not a function -- it's part of CcDispatcher's switch-case statement (CcLocations array is a jumptable for it), and it is part of CcDispatcher in OniEn version -- it uses step-by-step compare instead of jumptable (less compiler optimization ;-)).

You can find CcCaseDevMode at the address 0x004f5da5/0x004f2297 (En/Ru). It inverts value of the flag bfDevMode at 0x005ece8e/0x005e87e6 and then registers (binds) additional actions (calling CcBindDevActions at 0x0404730/0x00404610).

Here is complete list of bound actions:

  • 'profile_toggle' to ONI_KEY_BSLASH ;Backslash.
  • 'console' to '`'  ;'~' key (tilde).
  • 'unstick' to 'u'
  • 'cutscene1' to ONI_KEY_F2
  • 'cutscene2' to ONI_KEY_F3
  • 'f4' to ONI_KEY_F4
  • 'f5' to ONI_KEY_F5
  • 'f6' to ONI_KEY_F6
  • 'f7' to ONI_KEY_F7
  • 'f8' to ONI_KEY_F8
  • 'start_record' to ONI_KEY_F9
  • 'stop_record' to ONI_KEY_F10
  • 'play_record' to ONI_KEY_F11
  • 'camera_record' to 'n'
  • 'camera_stop' to 'm'
  • 'camera_play' to ONI_KEY_COMMA
  • 'record_screen' to 'l'
  • 'addflag' to ONI_KEY_INS ;NumPad Insert.
  • 'deleteflag' to ONI_KEY_DEL ;NumPad Delete.
  • 'man_cam_move_up' to ONI_KEY_SUB ;NumPad Subtract.
  • 'man_cam_move_down' to ONI_KEY_ADD ;NumPad Add.
  • 'man_cam_move_left' to ONI_KEY_NUM1
  • 'man_cam_move_right' to ONI_KEY_NUM3
  • 'man_cam_move_forward' to ONI_KEY_NUM8
  • 'man_cam_move_backward' to ONI_KEY_NUM5
  • 'man_cam_pan_left' to ONI_KEY_NUM6
  • 'man_cam_pan_right' to ONI_KEY_NUM4
  • 'man_cam_pan_up' to ONI_KEY_UP ;Up Arrow.
  • 'man_cam_pan_down' to ONI_KEY_DOWN ;Down Arrow.
  • 'place_quad' to ONI_KEY_COMMA
  • 'place_quad_mode' to ONI_KEY_PERIOD

Some of them don't work, but I'm working on this now. ;-)

Key '`' (twiddle) activates console. Press 'Tab' to cycle through all available commands / autocomplete command that you've started to type in.

Developer Mode

Yeah, Developer Mode... it's there after all. That's when we all say W.O.W. and hurry to our PCs.

Yeah, it's a sorry thing for Mac users, but Dev Mode was completely cut from the Mac build [Editor's note: this turned out not to be true, much to Mac users' collective relief; see here].

Enabling the cheat

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

  • OniDev.zip [Editor's note: Nowadays you just want to install the Daodan DLL to unlock Dev Mode. Don't download this old executable.]

(I've packed the cheat-code strings together, so that they don't take any extra space)

(I also had to reverse-engineer Ian's stuff a little bit : Ian's patch disables a lot of output routines, including dev console output...)

You can also follow SFeli's instructions and patch it yourself...

Binding extra functions

One event you absolutely want to bind is "console" (if you don't have a US keyboard, the automatic binding to "apostrophe" may not work for you).

As for the other ones... some of them are already bindable without the Dev Mode. Some others will be bound automatically and will work without you having to edit you key_config.txt.

A few of them don't work out as nicely as expected. We'll tell you more about them in the near future.

Enjoying

Type in "thedayismine" as you'd type in any other cheat. Use OSGE to enable cheats if you haven't finished the game and don't want to hack persist.dat manually. Go back to the game and hit the "console" key.

Filling in...