Difference between revisions of "HOWTO-Backends"

Jump to navigation Jump to search
54 bytes added ,  21:39, 19 April 2022
no edit summary
 
Line 20: Line 20:
# Make sure to provide the <tt>main</tt> function in your backend (the actual main function of ScummVM is <tt>scummvm_main</tt>, which your backend must invoke at some point).
# Make sure to provide the <tt>main</tt> function in your backend (the actual main function of ScummVM is <tt>scummvm_main</tt>, which your backend must invoke at some point).
# Instantiate the OSystem class and assign it to <tt>g_system</tt>, do that before calling <tt>scumm_main</tt>.
# Instantiate the OSystem class and assign it to <tt>g_system</tt>, do that before calling <tt>scumm_main</tt>.
# Deinit properly after calling <tt>scumm_main</tt>, particularly call <tt>g_system->quit()</tt>.
# Deinit properly after calling <tt>scumm_main</tt>, particularly call <tt>g_system->destroy()</tt>.
# If appropriate, edit <tt>configure</tt> to add your backend (this is only necessary if you are going to use the "./configure && make" build system).
# If appropriate, edit <tt>configure</tt> to add your backend (this is only necessary if you are going to use the "./configure && make" build system).


==== Example of minimal main() ====
==== Example of minimal main() ====
<syntaxhighlight lang="cpp">int main(int argc, char *argv[]) {
<syntaxhighlight lang="cpp">int main(int argc, char *argv[]) {
// Create our OSystem instance
     g_system = new OSystem_Foobar();
     g_system = new OSystem_Foobar();
     assert(g_system);
     assert(g_system);
Line 30: Line 31:
     // Invoke the actual ScummVM main entry point:
     // Invoke the actual ScummVM main entry point:
     int res = scummvm_main(argc, argv);
     int res = scummvm_main(argc, argv);
    g_system->quit();
 
// Free OSystem
g_system->destroy();
 
     return res;
     return res;
}</syntaxhighlight>
}</syntaxhighlight>
271

edits

Navigation menu