The Multi Script Bug - Ships & Houses

The Multi Script Bug - Ships & Houses

Postby Batlin on Mon Jan 10, 2011 11:34 am

First I encourage you to read roguan's post about ships (if you haven't read it already) : http://www.joinuo.com/forums/viewtopic.php?f=32&t=615.

I've researched the source of the "NAME INVALID" issue roguan discovered using Process Monitor.
If you look at his screenshot (see his post), you will see that the name looks valid and that there is no real visible reason for the function to fail.

However, if we investigate the actual loading and parsing of multi.txt.q using a debugger, then we see that the script name ends with an invalid 0D character (return character or \r).
The Multi-Bug.png
The Multi-Bug.png (18.04 KiB) Viewed 37 times


Why is that 0D character there? If you look at the screenshot you may notice that OSI's code is scanning for a 0A character (newline character or \n). The 0D 0A sequence as a line seperator is common in the DOS/Windows world. The 0A sequence is common in the Unix/Linux world. http://en.wikipedia.org/wiki/Newline

Let's look at the multi.txt.q itself (using a hex editor so we can see the line seperators):
multi.txt.q.png
multi.txt.q.png (17.3 KiB) Viewed 37 times


Why is the demo scanning for a Unix-sequence whereas the file itself is Windows-based?

It's obvious that OSI's server code ran on Unix systems, check out this CV:
http://www.talisman.org/~erlkonig/resume/
Unix Systems Analyst (June 1994 - April 1997)
Origin Systems

Sole (until mid 1996) Unix systems administrator for a medium-sized network of Silicon Graphics machines at Origin Systems, ranging from desktop workstations to a half-million dollar SGI Onyx RE2, working tangent to the PC/Macintosh technical staff. Involved in or responsible for all Origin Internet services. My game credits include:

ULTIMA ONLINE: Shattered Legacy pre-alpha
Also check out this one: http://jasons.wumple.com/Resume/
Senior Software Engineer, Origin Systems, studio of Electronic Arts, 11/1996 to 12/1997
Released Ultima Online, the award winning massively multiplayer online game.
Programmer, Ultima Online, an award winning massively multi player online role playing game supporting tens of thousands of simultaneous players.
Designed and implemented auto patching system (client and server), interprocess script communication system, multiobj system, boats, player housing, global hint system, game master tools, object decay, communication crystals, magic item creation system. Worked on most systems in the game.
Extensive use of C++, templates, STL, TCP/IP (sockets), Win32, MFC, Win32 threads and POSIX pthreads with development under Linux, Solaris, and Windows.
Lead Programmer from 1/1998. Maintained task lists, reported progress, managed small team of engineers.
On call 24/7. Fixed many critical problems whenever they occurred.
Made numerous CPU and memory optimizations which greatly improved performance of game servers. Improved stability of service.


My guess is that they converted the file itself to a Windows based file, but didn't do effort to fix/test the code when they converted the server code from Unix to Windows for creating the demo. Also, the Time Bug I described here : http://www.joinuo.com/forums/viewtopic.php?f=32&t=569, is a bug I believe to be of the same origin, a unix-to-windows conversion related issue.

Now, how to fix this bug?

1) You can use roguan's approach which is quite technical (see his post).

2) You can convert the multi.txt.q file back to Unix format by replacing the 0D 0A sequence by a 0A sequence using a hex editor.

3) You patch the EXE, again using a hex editor, so that the demo scans up-to-the 0D character instead of the 0A character.
The Fix.png
The Fix.png (3.6 KiB) Viewed 37 times
At 0x21B00E change 0x0A in 0x0D. That's it!

Note, an-easy-to-use-and-free hex editor is HxD : http://mh-nexus.de/en/hxd/
I've also attached a pre-patched multi.txt.q file to this post.
Attachments
multi.txt.zip
(47.45 KiB) Downloaded 4 times
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Re: The Multi Script Bug - Ships & Houses

Postby roguan on Mon Jan 10, 2011 11:51 am

Haha! Great find and very nice research with the CVs!

Hilarious.

Thanks for clearing this up. It definitely gives us an indication regarding the caliber of future bugs we'll be facing in the demo :P
roguan
 
Posts: 17
Joined: Tue Sep 07, 2010 1:57 pm



Return to UO Demo

Who is online

Users browsing this forum: No registered users and 1 guest