Quantcast
Channel: MobileRead Forums - PocketBook
Viewing all articles
Browse latest Browse all 1250

How to use OpenConfigEditor on new firmware?

$
0
0
I'm currently developing a port of the SGT puzzle collection (see the other thread here in the Developer's Corner).

I found OpenConfigEditor in inkview.h, and this looks like it would make it very easy to implement individual changing of game parameters. I also found examples in various projects at GitHub.

Unfortunately I just cannot get it to work. I am basically using code like this in a test application:

Code:

char *difficulties[] = { "Easy", "Normal", "Tricky", "Hard", NULL };
iconfig *myconfig = NULL;
iconfigedit myconfigedit[] = {
{ CFG_CHOICE, NULL, "Difficulty", "Game difficulty", "param.diff", "Easy", difficulties, NULL, NULL},
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};

void config_ok() {}
void config_change_handler(char* name) {}

myconfig = OpenConfig(STATEPATH "/configtest.cfg", myconfigedit);
OpenConfigEditor("Game parameters", myconfig, myconfigedit, config_ok, config_change_handler);

Code compiles without warnings, but the app crashes (I assume segfault) at OpenConfigEditor.

Platform Touch HD 3, newest firmware (6.1.900)

I know that the format of iconfigedit changed, above code should be according to the new format.

Furthermore, for testing what is going wrong I added a Message(...) directly after OpenConfigEditor(...), then the behaviour got even stranger. Then it indeed showed a screen containing one entry "Difficulty Easy", below was the string "Game difficulty" in a weird huge font, and the reader froze. No reaction anymore, needed a hard reset.

OpenConfigEditor is definitely the culprit, when I comment out this line the app continues, so OpenConfig executes successfully.

I also tried various combinations of setting some of the callback functions to NULL, also played around with entries in myconfigedit, all in vain.

Any hint what I am doing wrong?

Viewing all articles
Browse latest Browse all 1250

Trending Articles