Linguica Posted January 28, 2003 Why exactly was 31 the value that got doom(2).exe to turn on autorun? It seems like an awfully weird number to do so. 1 Share this post Link to post
Job Posted January 28, 2003 I say it was a dartboard. They figured that random values were best. 0 Share this post Link to post
pritch Posted January 28, 2003 Ling, you're task for the day is to ask Romero that very question and report your answer on #zdoom :P 0 Share this post Link to post
RjY Posted January 28, 2003 In short, it's an array overflow. Two snippets of code from g_game.c: (1)boolean joyarray[5]; boolean* joybuttons = &joyarray[1]; // allow [-1] (2)speed = gamekeydown[key_speed] || joybuttons[joybspeed]; (where joybspeed is initialised from joyb_speed in the .cfg file by code in m_misc.c) From (1) joybuttons[joybspeed] i.e. joybuttons[31] is so far off the end of the array (and the stuff after it) that it's hitting on some code or data that is permanently non-zero. Precisely what that is could only be determined by disassembling executables. Anyway, then speed in (2) is permanently true, and you get always-run. It wasn't a deliberate choice. It just happened to be true because of the way in which the compiler built the executable, and of course people editing illegal values into their .cfg files. I haven't tried it but 666 might well work... 5 Share this post Link to post
Biffy Posted January 30, 2003 I don't think that 31 is needed, I used a value of 30 to set doom2 autorun when I used to play on DWANGO. Shit, no one told me about that for at least a year when I played, so I got so used to holding my left pinky on the shift key that I still do it. 1 Share this post Link to post
fraggle Posted January 30, 2003 RjY said:In short, it's an array overflow. Two snippets of code from g_game.c: (1)boolean joyarray[5]; boolean* joybuttons = &joyarray[1]; // allow [-1] (2)speed = gamekeydown[key_speed] || joybuttons[joybspeed]; (where joybspeed is initialised from joyb_speed in the .cfg file by code in m_misc.c) From (1) joybuttons[joybspeed] i.e. joybuttons[31] is so far off the end of the array (and the stuff after it) that it's hitting on some code or data that is permanently non-zero. Precisely what that is could only be determined by disassembling executables. Anyway, then speed in (2) is permanently true, and you get always-run. It wasn't a deliberate choice. It just happened to be true because of the way in which the compiler built the executable, and of course people editing illegal values into their .cfg files. I haven't tried it but 666 might well work... That sounds about right. Too far (666) and you're likely to cause doom to crash, though. I seem to remember trying to get autorun to work in the final doom dos .exe, but I had to use a slightly different value for joyb_speed (it was like 32 instead of 31, something like that) 0 Share this post Link to post
myk Posted January 30, 2003 The difference is that joyb_speed 31 will cause autorun using DOOM II's doom2, but not with Final DOOM's. If you set it to 29 it will work on both engines. The Ultimate DOOM's EXE responds like DOOM II's. 0 Share this post Link to post