Can I get rid of the standard .cfg files?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Can I get rid of the standard .cfg files?

Post 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!
--
CG
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

You can get rid of it by looking at the code for meshviewer.
The code is @ ogreaddons. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

It uses the registry, too.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Post 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!
--
CG
Kai-Peter
Greenskin
Posts: 133
Joined: Tue Oct 15, 2002 10:14 am
Location: Helsinki, Finland
x 1
Contact:

Post 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.
Kai Backman, programmer (Blog)
ShortHike - Space Station Game
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Post 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!
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Post by gamac »

Hi Kai-Peter!

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

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

???

Any idea?
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Post 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?
Kai-Peter
Greenskin
Posts: 133
Joined: Tue Oct 15, 2002 10:14 am
Location: Helsinki, Finland
x 1
Contact:

Post 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
Kai Backman, programmer (Blog)
ShortHike - Space Station Game
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Post 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!
Kai-Peter
Greenskin
Posts: 133
Joined: Tue Oct 15, 2002 10:14 am
Location: Helsinki, Finland
x 1
Contact:

Post 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
Kai Backman, programmer (Blog)
ShortHike - Space Station Game
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Many games produce a debug log; I think it's very important to have one for debugging card problems and exceptions.
gamac
Gnoblar
Posts: 8
Joined: Wed May 11, 2005 7:14 pm
Location: Portugal

Post 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!
Kai-Peter
Greenskin
Posts: 133
Joined: Tue Oct 15, 2002 10:14 am
Location: Helsinki, Finland
x 1
Contact:

Post 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 ..
Kai Backman, programmer (Blog)
ShortHike - Space Station Game
Post Reply