source: branches/reyalp-flt/core/modules/simple_game.c @ 1516

Revision 1516, 2.0 KB checked in by tsv, 17 months ago (diff)

reyalp-flt branch update:

  • common unified api versioning
  • unified interaction with loadable libraries. export symbols moved to versioned api structures
  • libcurves interface simplified slightly
  • Property svn:eol-style set to native
Line 
1#include "platform.h"
2#include "../module_load.h"
3#include "../gui_draw.h"
4#include "../gui_lang.h"
5#include "../gui_mbox.h"
6
7extern int basic_module_init();
8
9
10// =========  MODULE INIT =================
11
12int module_idx=-1;
13
14/***************** BEGIN OF AUXILARY PART *********************
15  ATTENTION: DO NOT REMOVE OR CHANGE SIGNATURES IN THIS SECTION
16 **************************************************************/
17
18void* MODULE_EXPORT_LIST[] = {
19        /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER,
20        /* 1 */ (void*)0
21                };
22
23
24//---------------------------------------------------------
25// PURPOSE:   Bind module symbols with chdk.
26//              Required function
27// PARAMETERS: pointer to chdk list of export
28// RETURN VALUE: 1 error, 0 ok
29//---------------------------------------------------------
30int _module_loader( void** chdk_export_list )
31{
32  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER )
33     return 1;
34
35  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) )
36          return 1;
37
38  return 0;
39}
40
41
42
43//---------------------------------------------------------
44// PURPOSE: Finalize module operations (close allocs, etc)
45// RETURN VALUE: 0-ok, 1-fail
46//---------------------------------------------------------
47int _module_unloader()
48{
49  return 0;
50}
51
52
53//---------------------------------------------------------
54// PURPOSE: Default action for simple modules (direct run)
55// NOTE: Please comment this function if no default action and this library module
56//---------------------------------------------------------
57int _module_run(int moduleidx, int argn, int* arguments)
58{
59  module_idx=moduleidx;
60
61
62  int rv = 0;
63  if ((mode_get()&MODE_MASK) != MODE_PLAY) {
64      gui_mbox_init(LANG_MSG_INFO_TITLE, LANG_MSG_SWITCH_TO_PLAY_MODE,
65                    MBOX_FUNC_RESTORE|MBOX_TEXT_CENTER, 0);
66  } else {
67        rv = basic_module_init();
68  }
69  if ( ! rv )
70        module_async_unload(moduleidx);         // fail to init - "unload me"
71
72  return 0;
73}
74
75
76/*************** END OF AUXILARY PART *******************/
Note: See TracBrowser for help on using the repository browser.