using config file instead of registry

Place to report bugs in MoM IME and suggest ideas for enhancements (please read rules before posting)
Locked
valis
Posts: 3
Joined: Fri Jun 30, 2006 2:02 am

using config file instead of registry

Post by valis »

Using the registry makes it difficult to run your application as a normal user (I also don't see a big reason the info should be hidden), would you mind moving a configuration file instead (an ini specifically)?

If so I wrote a very light wrapper around TIniFile I called TIMOMConfig you could use that has the following:
function GetInt(settingName : string) : Integer;
function GetStr(settingName : string) : string;
procedure SetInt(settingName : string; setting : Integer);
procedure SetStr(settingName : string; setting : string);
function GetLBXPath : string;
function GetMusicPath : string;
function GetTexturePath : string;
function GetServerDBPath : string;
function GetLanguageFilePath : string;
function GetClientGraphicsDBFilename : string;
function GetLanguage : string;
I also overloaded Create so that you can specify a config file or not (if not then ".\config.ini" is used); if the config file is not found it is created and if config_file_path is set then the value is used as the config file so things like %homepath% are easily accomidated.

If you are interested and want to use what I wrote instead of using straight TIniFile then I'll post the file.

edit:
I'll be gone from the 4th through the 11th so when I don't reply it's not because I died or lost interest.
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Re: using config file instead of registry

Post by Implode »

valis wrote:Using the registry makes it difficult to run your application as a normal user (I also don't see a big reason the info should be hidden), would you mind moving a configuration file instead (an ini specifically)?
Umm, I agree the registry is overcomplicated for normal users - but INI files are so Windows 3.1 :D I don't understand why you're having a need to set up the registry values manually anyway? All of the values are set correctly when you install the game, other than the location of the original MoM 1.31 LBX files, which I provide a special program just to set this registry entry? Why do you need to keep changing the values?

Implode.
valis
Posts: 3
Joined: Fri Jun 30, 2006 2:02 am

Post by valis »

I apologize, the language I used ambiguated my problem.

I mean as a non-administrator I can't run the game because of registry issues. I see it's in HKLU but I get errors stating the apps can't find database <some database> (presumably because I installed it as an admin so the keys aren't set for my normal user). Using config files this problem is avoided.

If you don't like ini's I could give you a config library I'm writing in C (so expressions, among other things, are supported).

By the way, great job on your remake, very polished and not too far from your goal.
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Post by Implode »

Ah, right, yes I am aware of that. As you say, it writes everything to HKLU, so if you install as one user (admin or otherwise) and then try to run as someone else, it won't work. I do plan to fix that at some point, by splitting values appropriately across HKLU and HKLM. Its too big of a change to put in 0.8.8 though since I need to make changes to the underlying graphics and music layers as well as the game itself, so it'll take a little while to do.

Thanks,

Implode.
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Fixed in 0.8.9

Post by Implode »

I've fixed this in 0.8.9, although that won't be available for at least another month. It now stores all path-related settings in HKEY_LOCAL_MACHINE so they work for all users, and user-specific settings such as the name last used and chosen language under HKEY_CURRENT_USER.

Probably means you'll need Administrator rights in order to install it from now on - that's something I'll need to experiment with once I build the installation file for it.

Implode.
Locked