diff options
| author | Franklin Wei <git@fwei.tk> | 2018-12-21 22:13:13 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2018-12-21 22:13:33 -0500 |
| commit | b3356e3aff34a4ab94778e7f6a8db43f9135296c (patch) | |
| tree | 9119f850f2138db65da93461505b0a9b08e56d32 /apps/plugins/puzzles/src/nestedvm.c | |
| parent | f08d218e676f9ee8b5c26e755088671baf3a70b7 (diff) | |
| download | rockbox-b3356e3aff34a4ab94778e7f6a8db43f9135296c.zip rockbox-b3356e3aff34a4ab94778e7f6a8db43f9135296c.tar.gz rockbox-b3356e3aff34a4ab94778e7f6a8db43f9135296c.tar.bz2 rockbox-b3356e3aff34a4ab94778e7f6a8db43f9135296c.tar.xz | |
puzzles: resync with upstream
This brings the code to upstream commit 3ece3d6 (I've made my own Rockbox-
specific changes on top of that).
Changes include using C99 `bool' throughout, and minor logic fixes for some
puzzles.
Change-Id: Ie823e73ae49a8ee1de411d6d406df2ba835af541
Diffstat (limited to 'apps/plugins/puzzles/src/nestedvm.c')
| -rw-r--r-- | apps/plugins/puzzles/src/nestedvm.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/apps/plugins/puzzles/src/nestedvm.c b/apps/plugins/puzzles/src/nestedvm.c index 0ad0f3f..947abe0 100644 --- a/apps/plugins/puzzles/src/nestedvm.c +++ b/apps/plugins/puzzles/src/nestedvm.c @@ -31,10 +31,11 @@ void fatal(const char *fmt, ...) struct frontend { // TODO kill unneeded members! midend *me; - int timer_active; + bool timer_active; struct timeval last_time; config_item *cfg; - int cfg_which, cfgret; + int cfg_which; + bool cfgret; int ox, oy, w, h; }; @@ -216,7 +217,7 @@ int jcallback_resize(int width, int height) int x, y; x = width; y = height; - midend_size(fe->me, &x, &y, TRUE); + midend_size(fe->me, &x, &y, true); fe->ox = (width - x) / 2; fe->oy = (height - y) / 2; fe->w = x; @@ -244,7 +245,7 @@ void deactivate_timer(frontend *fe) { if (fe->timer_active) _call_java(4, 13, 0, 0); - fe->timer_active = FALSE; + fe->timer_active = false; } void activate_timer(frontend *fe) @@ -253,7 +254,7 @@ void activate_timer(frontend *fe) _call_java(4, 12, 0, 0); gettimeofday(&fe->last_time, NULL); } - fe->timer_active = TRUE; + fe->timer_active = true; } void jcallback_config_ok() @@ -266,7 +267,7 @@ void jcallback_config_ok() if (err) _call_java(2, (int) "Error", (int)err, 1); else { - fe->cfgret = TRUE; + fe->cfgret = true; } } @@ -282,7 +283,7 @@ void jcallback_config_set_string(int item_ptr, int char_ptr) { void jcallback_config_set_boolean(int item_ptr, int selected) { config_item *i = (config_item *)item_ptr; assert(i->type == C_BOOLEAN); - i->u.boolean.bval = selected != 0 ? TRUE : FALSE; + i->u.boolean.bval = selected != 0 ? true : false; } void jcallback_config_set_choice(int item_ptr, int selected) { @@ -291,13 +292,13 @@ void jcallback_config_set_choice(int item_ptr, int selected) { i->u.choices.selected = selected; } -static int get_config(frontend *fe, int which) +static bool get_config(frontend *fe, int which) { char *title; config_item *i; fe->cfg = midend_get_config(fe->me, which, &title); fe->cfg_which = which; - fe->cfgret = FALSE; + fe->cfgret = false; _call_java(10, (int)title, 0, 0); for (i = fe->cfg; i->type != C_END; i++) { _call_java(5, (int)i, i->type, (int)i->name); @@ -357,7 +358,7 @@ static void resize_fe(frontend *fe) x = INT_MAX; y = INT_MAX; - midend_size(fe->me, &x, &y, FALSE); + midend_size(fe->me, &x, &y, false); _call_java(3, x, y, 0); } @@ -443,7 +444,7 @@ int main(int argc, char **argv) float* colours; _fe = snew(frontend); - _fe->timer_active = FALSE; + _fe->timer_active = false; _fe->me = midend_new(_fe, &thegame, &nestedvm_drawing, _fe); if (argc > 1) midend_game_id(_fe->me, argv[1]); /* ignore failure */ |