- Joined
- May 26, 2007
- Messages
- 5,545
- Reaction score
- 1,315
You must be registered to see links
Why doesn't my client connect to my server?
Part 2 - Configuration
Part 2 - Configuration
Tools
To work with these configuration files, you'll need:-
- a good text editor that can read and display Korean ANSI text.For this I'd recommend Notepad ++ or MadEdit.
- a good hex editorFor that I'd recommend either HxD or MadEdit.
- A means of reading and editing your Windows system Registry.RegEdit is usually sufficient for this job, but RegEdt32 has some advantages on NT 5 based systems. (2K, XP, 2K3) There are 3rd party editors which you can use as you like.
Okay? Got everything you need? Then lets move on.
Client Configuration
There are several ways official clients are configured to find the game server.
- hotuk.ini
- System Registry
- ptReg.rgx
- ldata.bmp
All the official clients (I think) use HKEY_LOCAL_MACHINE\SOFTWARE\Triglow Pictures\PristonTale and the value pairs it holds to configure their graphics, sound and network connection to the server.
This is only the second oldest method, but it's still supported by most official clients (at the time of writing) simulating commands that should be found in the clients hotuk.ini. That was the original configuration.
The value pairs supported are:-
- "Server1" = An IP address in a REG_SZ string
- "Server2" = An IP address in a REG_SZ string
- "Server3" = An IP address in a REG_SZ string
- "Graphic" = a number between 0 and 3 in a REG_SZ string
- "Network" = a number between 0 and 3 in a REG_SZ string
- "Sound" = either "off" or anything else is considered on, in a REG_SZ string
- "ScreenSize" = a number between 0 and 3 in a REG_SZ string
- "ColorBPP" = either 16 or 32 in a REG_SZ string
- "Version" = almost anything you like so long as it's a REG_SZ string
- "MotionBlur" = either "true" or "false" in a REG_SZ string
- "CameraSight" = either "ON" or "OFF" in a REG_SZ string
- "CameraInvert" = either "true" or "false" in a REG_SZ string
- "FullMode" = either "Off" or is considered "on" in a REG_SZ string
- "MicOption" = either "ON" or "OFF" in a REG_SZ string
- "Account" = the name of the last user to log in to PT as a REG_SZ string
Modern problems. When Window 98 was released and Visual Studio updated to version 6, Microsoft told developers that they should only store alterations that apply globally to all users including the "System" user that runs before login in "HKEY_LOCAL_MACHINE" anything else should either be added to "HKEY_CURRENT_USER" or "HKEY_USERS\.Default", since you can't play PT before you log in, it's clear that it shouldn't store anything in HKEY_LOCAL_MACHINE, but like many other badly written Windows programs, it does. Why? Because even programmers don't RTFM. >.<
In Windows 95 through the 9x series up until Windows ME this didn't matter very much anyway, because there was no "System" user, and very little "user account management" at all, unless you installed Novel Netware and ran a Netware Workgroup. Microsoft did run Workgroups, and had since Windows 3.2 (otherwise known as Windows for Workgroups) but the "Group Policy" objects that went with them and particularly "user security tokens" couldn't be properly secured on an OS who's kernel ran on top of DOS... simply because it was too easy to bypass any such security from DOS before the Win32 Kernel loaded on top.
If your application had to run properly on NT3 or NT4 workstations, you would have had to take much more notice of this, especially if you utilised "roaming profiles". But PT wouldn't play on NT3 or NT4 workstations, so they didn't care about that.
The NT5 series OS became very popular because they kept all of the Gaming capabilities of the 9x series, and added the speed, stability and security of the NT series into one OS, and with the parallel release of ME and 2K the 9x series and Win32 kernels launched from DOS was dropped. NT5 = Windows 2000, XP and Server 2003.
In order to ensure that Win9x "games" would run on NT5 based systems, using HKEY_LOCAL_MACHINE inappropriately was allowed to slide. You could do it, but it was strongly advised that you didn't, especially if you wanted your program to work under NT Domain network situations... again PT didn't care about Domain networks and so ignored the warnings.
If your application had to run properly on NT3 or NT4 workstations, you would have had to take much more notice of this, especially if you utilised "roaming profiles". But PT wouldn't play on NT3 or NT4 workstations, so they didn't care about that.
The NT5 series OS became very popular because they kept all of the Gaming capabilities of the 9x series, and added the speed, stability and security of the NT series into one OS, and with the parallel release of ME and 2K the 9x series and Win32 kernels launched from DOS was dropped. NT5 = Windows 2000, XP and Server 2003.
In order to ensure that Win9x "games" would run on NT5 based systems, using HKEY_LOCAL_MACHINE inappropriately was allowed to slide. You could do it, but it was strongly advised that you didn't, especially if you wanted your program to work under NT Domain network situations... again PT didn't care about Domain networks and so ignored the warnings.
This isn't good if your planning on distributing to Gamers, who really don't care to go poking around in such things when all they want is to play a game. But there is a very simple way you (as a dev) can fix your client if you are going to use the "system registry" settings method. Just look out for the API calls and switch them from HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER... you can use your setup program, or the launcher to put the IP in "HKEY_USERS\.Default" if you want to ensure every user on the machine gets the same server settings. I'm not going into that any more, because it's off-topic.
If you client uses these configurations as it's primary, or preferred settings, then you should maybe make a "PTSettings.reg" file something like this
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Triglow Pictures\PristonTale]
"Server1"="[COLOR=Blue]127.0.0.1[/COLOR]"
"Server1"="[COLOR=Blue]127.0.0.1[/COLOR]"
"Server1"="[COLOR=Blue]127.0.0.1[/COLOR]"
Okay, let's move on, to "ptReg.rgx". This file is the new System Registry just as the System Registry was the new hotuk.ini, early clients didn't support it, around the 185x 196x KPT clients preference for Registry or the ptReg.rgx file kept switching back and forth which one overrides the other. Especially in non-KPT official clients.
This file is a complete mimic of the registry settings, but stored as a plain text file. It's not quite the same as a .reg file though. Lets have an example:-
Code:
"FullMode" "Off"
"Version" "3124Ä"
"Graphic" "4"
"Network" "1"
"ColorBPP" "32"
"MotionBlur" "false"
"CameraSight" "ON"
"RainMode" "2"
"Sound" "Off"
"CameraInvert" "true"
"MicOption" "OFF"
"ServerName" "Personal-PT"
"Server1" "[COLOR=Blue]127.0.0.1[/COLOR]"
"Server2" "[COLOR=Blue]127.0.0.1[/COLOR]"
"Server3" "[COLOR=Blue]127.0.0.1[/COLOR]"
"Account" "noob"
"MicOption" has been in both... but only a few official servers ever implemented the voice chat ability.
I can tell you that there is some code in all the clients for using it, but that they require an external executable which shares some communication with the main game.exe. The game.exe will give it a handle to it's primary display DC, and the external program will then display a new UI over the game enabling the player to "push to talk". The system is not as good as TeamSpeak, Ventrillo or other VOIP systems and such, because only after you release the "push to talk" is a .WAV sent back to the server, and it should then send that .WAV file out to the receiving players so they can hear what you said.
Anyway... the option you are interested in is, of course, the "Server1", "Server2" and "Server3" options... again, remember to change the IP to the one your server is listening on.
Moving on to "ldata.bmp". This one is a sneaky version of ptReg.rgx. It seems to be based on the "hotuk.ini" settings (getting to that) but is hidden in a bitmap file, located in the "images" sub-folder of the game folder.
The bitmap it's self is an 8 by 8 pixel 24-bit uncompressed Windows / OS/2 bitmap image where every pixel (normally) is yellow. You can actually make any bitmap image, as the binary data is skipped, but I'll give you the Hex code for the one I have.
Code:
42 4D 38 90 2D 00 00 00 00 00 36 00 00 00 28 00
00 00 08 00 00 00 08 00 00 00 01 00 18 00 00 00
00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 FF FF 00 FF FF 00 FF FF 00
FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF
FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF
00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00
FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF
FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF
00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00
FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF
FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF
00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00
FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF
FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF 00 FF FF
00 FF FF 00 FF FF
Next comes the actual configuration. That header is only to make people think you aren't storing any configuration data in there.
Code:
*Graphic 0
*Network 1
*ColorBPP 32
*MotionBlur false
*CameraSight ON
*ScreenSize 1
*MicOption ON
*Sound Off
*CameraInvert true
*Server1 [COLOR=Blue]127.0.0.1[/COLOR]
*Server2 [COLOR=Blue]127.0.0.1[/COLOR]
*Server3 [COLOR=Blue]127.0.0.1[/COLOR]
*ServerName Personal-PT
*Version 3124
*TestVersion 0
*FullMode Off
You can save that in another file. Say, "BMPText.txt". Then, you just concatenate them. "Do what now?" Okay, in any *nix that would just be "cat BMPHeader.BMP BMPText.txt > ldata.bmp" but you're probably on Windows machine right? (You could use one of a number of GNU "cat" for Win32 builds if you want, but Windows can do it natively... just with completely different syntax)
So open a command Window (Start -> Run, and "cmd" [or "Command.com" on Windows 9x]), then type "Copy /B BMPHeader.BMP + BMPText.txt ldata.bmp". That should do it. It's not as intuitive as the "cat" syntax IMHO, but it does the same job, and it's not all that bad. There are GUI programs for "concatenation" of files, or "file split & join". Either of those terms in Google will find GUI lovers a program to suit them I'm sure, but for just this one job, I think the built in command line tools are fine. (I mention "cat" because it wouldn't surprise me to find a number of you have "UnixUtils" or "Cygwin" or "GNU Win32" or "Microsofts' NT Services for Unix" installed already, all of which will include "cat" as part of the "BASE" package)
Finally, let's consider hotuk.ini.
Many clients will still accept the *Server commands in "hotuk.ini" however, it has been depreciated since before PT came out of Beta and very much Pre-AOR. If no other configuration is found in any of the other files, some clients may still fall back on these. Many "private" server developers don't like to support "hotuk.ini" at all however, and will disable reading from it in their clients... so watch out for that if you are using a client from a server-repack or one shared on here. (I never do it, as I find there are too many useful features enabled there, and only there. I also know how to enable the feature that "private" server devs fear most from "hotuk.ini", the admin line, even if "hotuk.ini" isn't read. So I don't see the point)
Customised Configuration
Now lets consider "modified clients"... by which I'm thinking of Blood, Sky, Quantumfusion type client releases... or my own even. It's very easy to change the files, registry settings and such that the client reads. Changing the name of a file is the simplest, and I can see good cause to do that. The ZPT client I released didn't read hotuk.ini, ldata.bmp or ptReg.rgx at all, but read all configurations from a "client.cfg" file. The strings which enabled different modes and settings where also changed, and unified so they all looked like they are meant to be in one file... I never got around to unifying the code so that they where all read from the same place though.
If you are looking to make your client easier to manage settings when users have issues and so on, I would recommend you look at this client to see how easy it was to make that change. You can do it in a hex editor, no need for Olly or anything.
A common way of locking a client to a particular server (which "private" devs like to do so people don't steal their client) is to replace the primary function to read "Server1" IP address with a memory lookup which points to a string containing your servers IP in the executable of the game it's self. I'm not sure if it was Frogg or Fusion or SGPT or who, who did this first, but there are variations on this theme in many released "modified" clients here.
This is okay. It's good to keep your custom client private and gets around a lot of problems when players like to play on several "private" servers.
If you are trying to keep your personal client to your self, however, you should really try to hide that IP. Most people blindly trust in some Exe packer and / or encrypt, but again, I don't agree with that. (it's a pain for users, and a pleasure for hackers) A more recent QF based client performed an XOR over the top of the IP string, and some other details, and that's really nice. You can do the same thing with strings that contain the codes for your settings, then people wouldn't even know what codes to include in a configuration file unless they traced at a later date.
You can keep the encrypted versions encrypted, and only store the strings temporarily, on the stack or so, if you want to really make a cracker work.
You can perform similar XOR encryption to individual lines of the file as they are read in... then opening the file in notepad still gives anybody prying no idea of which lines are the server address lines and which are other settings. That's a bit ugly, but not exactly stupid IMHO.
Another idea I had, is that an IP is made up of 4 numbers between 0 and 255. Does that sound familiar? Why keep it as a string at all (except that that is how the Windows APIs will expect you to pass it to them) why not store a 32-bit number, and write a routine to break it down into bytes, turn the bytes into strings and sprintf them together with "%s.%s.%s.%s" or, just turn them into bytes and sprintf "%d.%d.%d.%d". You can still XOR the 32-bit number, or mess with the byte order to your hearts content.
I've not seen people doing these things with their clients, yet, but I see no reason why they couldn't or shouldn't. So if your client is not an official one, look out for these sort of configuration changes. If it's a true "release" of a "modified" client, as ZPT is, there should be some documentation with the release about how you should configure it.
That's all for now. Thanks for reading.
You must be registered to see links
Last edited: