Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: WMELite settings.xml handling  (Read 6364 times)

0 Members and 1 Guest are viewing this topic.

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
WMELite settings.xml handling
« on: August 12, 2014, 06:43:33 AM »

Hi,

I wonder whether the logic in

Code: [Select]
CBRegistry::ReadString(const AnsiString& subKey, const AnsiString& key, const AnsiString& init)

is actually correct, w.r.t. the order of the values of both xml files being checked for the matching key:

Code: [Select]
ret = GetValue(m_LocalValues, subKey, key, found);
if (!found) ret = GetValue(m_Values, subKey, key, found);

The settings.xml that will be read into the "m_LocalValues" map is a "readonly" version (e.g. one that you might distribute with the game), because these values will never be written to nor saved.

The settings.xml that will be read into "m_Values", however, is the one where values are updated and that is saved for every user/player.

If an item is present in both maps, a user-defined redefinition should override the read-only "default". If I read the code of the original WME correctly, there it is done as I would expect, checking "HKEY_CURRENT_USER" before "HKEY_LOCAL_MACHINE" when reading, and writing always to "HKEY_CURRENT_USER". But in WMELite it is reversed. Is this intended behaviour or can I savely reverse this? (BTW I would then change the wording for the "local" values/settings, to clarify these are read-only global defaults).
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: WMELite settings.xml handling
« Reply #1 on: August 13, 2014, 07:56:45 AM »

The idea in WME Lite is that the engine only ever works with the settings stored in user's profile directory.
The "local" values, i.e. the ones stored in a file which is in the game directory are meant for temporarily overriding some settings, mainly for debugging purposes.

It does not map to the LOCAL_MACHINE / CURRENT_USER logic in Windows, rather it maps to the registry/wme.ini logic in the original WME - normally WME only works with registry settings, but you can override those by placing wme.ini file to the game directory.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: WMELite settings.xml handling
« Reply #2 on: August 13, 2014, 08:56:40 AM »

So when I want to make wmelite behave like WME in this regard I need to think about something else.

What I need is that the installer of the game generates a "settings.xml" with some sane defaults (in our case, the default language of the game), which can then be overridden by every user of the game. Because such a setting shall not be in the savegames, the registry is the correct place.

This works with WME already, when I put a registry key into either HKCU or HKLM during installation, WME will pick it up. Once a user decides to change the language, it is placed in HKCU (either replacing the original setting or "overriding" the default in HKLM).

I could, for instance, add a third settings.xml, to have this logic:

1) "local" settings.xml (searched in ".", read-only)
2) "global" settings.xml (generated during install or packaged with the game, read-only)
3) "user" settings.xml (stored in user account, read-write)

Any other idea (maybe less complex) to achieve this?
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: WMELite settings.xml handling
« Reply #3 on: August 29, 2014, 10:58:24 PM »

How about having per user settings in that xml file?

Btw. you are my personal hero, Daniel for spotting the crash in ConvertUtf.h I was pulling my hair over that one. :) I owe you a few   ::beer ::beer ::beer
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.027 seconds with 23 queries.