Page 1 of 1

Can I get rid of the standard .cfg files?

Posted: Wed May 11, 2005 7:30 pm
by gamac
I'm working on a new project using OGRE, and I intend to distribute my game with a classic Windows installer (something like setup.exe) that should install all my binary files (executables, gfx, sound, etc.) as well as any third party dependecies such as the subset of OGRE DLL's I'll be using.
My only problem is with the .cfg files, like plugins.cfg! I would prefer not to use them and have my own single config file (or even use the Windows registry)!
Can someone give me some ideas on how can I do that? I.e. how can I tweak OGRE so that it dosen't look for plugins.cfg nor any other .cfg file?
I tried implementing my own code to acomplish the same as the Root::showConfigDialog method, but it keeps looking for the plugins.cfg file!
Currently I'm just using Root::restoreConfig and creating my Root object with a saved copy of ogre.cfg and plugins.cfg files, renamed to something like ProjX.cfg and ProjXPlugins.cfg.
But that's not quite what I'm looking for! I want to use a single config file and actually I want the options that go into plugins.cfg to be "hardcoded" in my game, i.e. I always want to use DX9, a fixed resolution, and a predefined, pre-bunded set of plugins!

How can I "get rid of" the "standard" .cfg files????

Thanks in advance for your help!

Posted: Wed May 11, 2005 7:34 pm
by jacmoe
You can get rid of it by looking at the code for meshviewer.
The code is @ ogreaddons. :wink:

Posted: Wed May 11, 2005 7:36 pm
by jacmoe
It uses the registry, too.

Posted: Wed May 11, 2005 7:47 pm
by gamac
Whow! That was a fast reply! I'm truly impressed (and happy :)!

Thank's a lot for the tip! I'll get the meshviewer from the cvs and take a peek!

Cheers!

Posted: Thu May 12, 2005 4:14 pm
by Kai-Peter
Initialize Ogre::Root like this:

Code: Select all

 new Ogre::Root("", "", "");
The first param default to "plugins.cfg", the second param to "ogre.cfg" and the third to "Ogre.log". By doing that you get no input or output from Ogre .. You might want the log however.

I do exactly what you are talking about and load the plugins hardcoded. Check the API docs for more details.

Posted: Thu May 12, 2005 5:03 pm
by gamac
Cool! I'll try that as well, as I'm having trouble with cvs access to the addons (my network firewall sucks!).

Thanks!

Posted: Thu May 12, 2005 5:55 pm
by gamac
Hi Kai-Peter!

I tried your suggestion but I get a "Debug Assertion Failed" exception:

Expression: *file != _T('J')

???

Any idea?

Posted: Thu May 12, 2005 6:01 pm
by gamac
Well... it seems to work if I specify a log file:

new Root("", "", "MyLog.log");

Is there a way to stop the logging at all?

Posted: Fri May 13, 2005 9:36 pm
by Kai-Peter
Patch the code to accept a no-log option or replace the default log with your own No-Op object. I'm using the log myself as that's simply easier. Just rename it to something that you can use.. I think it's more important to get rid of the config and plugin files .. :D

Posted: Sat May 14, 2005 9:22 am
by gamac
Hmm... I'll check the No-Op option, that's a good idea! In the meantime I notice that a not so uncommon technique is to delete the log file when the application terminates, but I don't like it! I intend to use the log file during development only but not for the releas version.

Thanks again for the ideas!

Posted: Sat May 14, 2005 11:10 am
by Kai-Peter
Using no log for release sounds kind of backwards. How are you going to fix bugs people report to you if you have no log? I actually leave asserts (or their equivalent) into production code to make error reporting easier .. :D

Posted: Sat May 14, 2005 11:15 am
by :wumpus:
Many games produce a debug log; I think it's very important to have one for debugging card problems and exceptions.

Posted: Sat May 14, 2005 11:19 am
by gamac
Good point Kai-Peter, I see what you mean! But I'm not planning to provide any support for this at this time, I'm just planning to do a demo of my app. I will consider supportablilty in the final full version, though!

Thx for pointing that out!

Posted: Sat May 14, 2005 4:35 pm
by Kai-Peter
:D I'm just jaded by a few years of running first Space Station Manager and now ShortHike in production. Logs are sooo cool ..