Author Topic: Inter-modules framework or code samples?  (Read 2334 times)

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Inter-modules framework or code samples?
« on: September 19, 2013, 12:42:10 PM »
As more features get moved into modules, inter-module connections imho becomes more important as for example ettr using dual_iso's calls with "extern WEAK_FUNC(ret_0) ...". But what if I want to do these things w/o touching the other module:

1. detect if a module is loaded at all?

2. get or set other module's config vars?

Are there existing code samples anywhere? If not, it'd be great if there would be a core framework for these, for example module_check_enabled("ettr") and module_set/get_config("ettr", "auto_ettr", "0").

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3166
Re: Inter-modules framework or code samples?
« Reply #1 on: September 26, 2013, 11:58:11 PM »
nothing implemented like that yet.
feel free to implement it ;)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

coutts

  • Developer
  • Senior
  • *****
  • Posts: 401
Re: Inter-modules framework or code samples?
« Reply #2 on: September 27, 2013, 03:58:19 AM »
Hm good idea.

Sent from my Nexus 7

Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Inter-modules framework or code samples?
« Reply #3 on: September 27, 2013, 08:56:18 PM »
feel free to implement it ;)

No way - I tried to pull in "extern module_entry_t module_list" and search through it, but my C coding simply isn't up to the task so one of the devs will have to do it ...

... imho with more modules even now in the pull queue, this is necessary, and btw alex mentioned he's working on something like this when I asked about how to detect and disable ettr from my module.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Inter-modules framework or code samples?
« Reply #4 on: September 27, 2013, 10:19:44 PM »
should be really easy:

Code: [Select]
int is_module_enabled(char* name)
{
    for(int i = 0; i < MODULE_COUNT_MAX; i++)
    {
        if(streq(name, module_list[i]->name))
            return module_list[i]->enabled;
    }
    return 0;
}