Write an Morrowind.ini to openmw.cfg converter

Everything about development and the OpenMW source code.
User avatar
Zini
Posts: 5536
Joined: 06 Aug 2011, 15:16

Re: Write an Morrowind.ini to openmw.cfg converter

Post by Zini » 31 Mar 2012, 15:25

Better.

First a few technical corrections:

- please don't use defines (other than for include guards and conditional compilation)
- mMergeMap should be initialised in the cpp file
- don't manually write every single key into it (there will be too many of them); read it from a const array instead (see StatsWindow in mwgui for an example)

About master/plugin: Importing these should be made optional (command line option, off by default). There can be more than one key of each type. And when you import them, you need to import all of then, e.g. when this function is enabled, if there are any master or plugin keys in the ini, remove all old master and plugin keys from the cfg and use the master/plugin settings from the ini instead. Master and plugin must always be handled together.


User avatar
Zini
Posts: 5536
Joined: 06 Aug 2011, 15:16

Re: Write an Morrowind.ini to openmw.cfg converter

Post by Zini » 31 Mar 2012, 18:17

That doesn't look right. What are EMS files? And we don't use archive settings currently. And master and plugins are handled separately. And somehow you connected bsa files (which should not be handled at all) with plugins.

Edit: And multimaps won't work. For master and plugins the order is important. You have now guarantees about the order of objects with the same key when using a multimap.

swick
Posts: 96
Joined: 06 Aug 2011, 13:00

Re: Write an Morrowind.ini to openmw.cfg converter

Post by swick » 31 Mar 2012, 18:34

maybe you should tell me what you mean with master/plugin because it seems like I dont know it ;)

User avatar
Zini
Posts: 5536
Joined: 06 Aug 2011, 15:16

Re: Write an Morrowind.ini to openmw.cfg converter

Post by Zini » 31 Mar 2012, 18:38

A master file is an ESM (e.g. Morrowind.esm). A plugin file is an ESP.

swick
Posts: 96
Joined: 06 Aug 2011, 13:00

Re: Write an Morrowind.ini to openmw.cfg converter

Post by swick » 31 Mar 2012, 20:09

if I understand it correct, then it should work now https://github.com/swick/openmw/commit/ ... 6c9eeaad12

User avatar
Zini
Posts: 5536
Joined: 06 Aug 2011, 15:16

Re: Write an Morrowind.ini to openmw.cfg converter

Post by Zini » 31 Mar 2012, 20:24

Very close now. I see two more problems:

1. You are always deleting master and plugin keys from the original cfg. You should only do that when you import master/plugin keys from the ini file.

2. You are storing the cfg file in a std::map<std::string, std::string>. That can't work, because keys can appear more than once. Maybe use a std::map<std::string, std::vector<std::string> > instead (remember: order matters)?

swick
Posts: 96
Joined: 06 Aug 2011, 13:00

Re: Write an Morrowind.ini to openmw.cfg converter

Post by swick » 31 Mar 2012, 21:49

should be fixed now.

User avatar
Zini
Posts: 5536
Joined: 06 Aug 2011, 15:16

Re: Write an Morrowind.ini to openmw.cfg converter

Post by Zini » 31 Mar 2012, 21:58

It seems there is still the issue of master and plugin settings handled separately. You can't replace one without the other meaningfully.

Since you are replacing them anyway in importGameFiles, I guess you could just drop the if (!esxFiles.empty()) lines.

The rest looks good though. Will test later or tomorrow.

btw. I added a follow up tasktask to the tracker. Interrested? (don't start yet, if the answer is yes; I need to provide a bit more input first).

swick
Posts: 96
Joined: 06 Aug 2011, 13:00

Re: Write an Morrowind.ini to openmw.cfg converter

Post by swick » 31 Mar 2012, 22:17

done (there was also a bug so that only the first 10 game files were noticed).
Yes to the follow up task :)

Post Reply