[Scummvm-devel] Engines initialization

Bertrand Augereau bertrand_augereau at yahoo.fr
Mon Nov 15 01:29:02 CET 2004


An obvious solution to this class of problems would be to throw an 
exception, I guess.
But I guess some porters will complain about the poor exception support of 
their compilers :)

Bertrand

----- Original Message ----- 
From: "Eugene Sandulenko" <sev at scummvm.org>
To: "ScummVM devel list" <scummvm-devel at lists.sourceforge.net>
Sent: Monday, November 15, 2004 5:19 AM
Subject: [Scummvm-devel] Engines initialization


> Hi all,
> 
> I just commited a discussed a while ago change to scumm engine. Next
> thing which is going to be implemented is possibility to change global
> extrapath in GUI.
> 
> Why this is done? Some things in a particular engine initialization
> process may require access to files. We have that nice list of default
> directories, which are added sequentally. Such subsystems as SCUMM
> FM-TOWNS Kanji ROM renderer or MT-32 emulator do benefit from it, as
> their data could be shared among more than one game. Putting these to
> extrapath saves space and eases maintenance.
> 
> But most of our engines do not make it possible, moreover some things
> they do in their engine constructor may fail, and there is no way to
> return status flag from a constructor.
> 
> So we should make it consistent, and I call for all engine
> maintainers to help me with this.
> 
> Required changes are trivial, but you better know how code you wrote
> works.
> 
> Basically your engine initialization should look like this:
> 
> MyEngine::MyEngine(GameDetector *detector, OSystem *syst) {
>    File::addDefaultDirectory("weirdplace");
> 
>    // optional
>    _simplevar = 0;
>    _moresimplevar = 0;
> }
> 
> void MyEngine::go() {
>     do_stuff();
> 
>    _system->initSize(_screenWidth, _screenHeight);
>    _midiDriver = GameDetector::detectMusicDriver(midi);
> 
>    whatever();
> 
>    mainLoop();
> }
> 
> Note, that constructor adds any default directories you need and
> doesn't touch other OSystem subsystems like graphics, sound or file
> opening.
> 
> Present implementation of go() method returns void, but it would be
> possible to catch any errors there and return them to caller in
> base/main.cpp, so user could be gracefully returned to the
> launcher. With constructor it cannot be done directly as it always
> return object instance.
> 
> Engines which fo heavy stuff in their constructors:
> 
>  kyra
>  simon
>  sword2
> 
> Engines which call initSize in their constructors:
> 
>  queen
>  sky
> 
> Engines which do not set up default directories in their constructors:
> 
>  queen
>  sky
>  sword1
> 
> 
> If you don't have time/desire to fix your engine, notify me here or on
> IRC and I will do it in the meantime.
> 
> 
> Eugene
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Scummvm-devel mailing list
> Scummvm-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scummvm-devel
> 
> ___[ Pub ]____________________________________________________________
> Inscrivez-vous gratuitement sur Tandaime, Le site de rencontres !
> http://rencontre.rencontres.com/index.php?origine=4
> 
> 
> 
> -- 
> Incoming mail is certified Virus Free.
> Checked by AVG Anti-Virus (http://www.grisoft.com).
> Version: 7.0.279 / Virus Database: 265.3.0 - Release Date: 13/11/2004
> 
>


-- 
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.279 / Virus Database: 265.3.0 - Release Date: 13/11/2004





More information about the Scummvm-devel mailing list