summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/rockbox.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-08-23 14:16:13 -0400
committerFranklin Wei <git@fwei.tk>2017-08-23 14:22:09 -0400
commit4dd300d9f0229269aa8f9a46b07a5aa65f882985 (patch)
treeafac45c833e70c183e9a775b8465bb95297549cb /apps/plugins/puzzles/rockbox.c
parentec1a74a37c43763e9d24f6dbb578811a7947d5c5 (diff)
downloadrockbox-4dd300d9f0229269aa8f9a46b07a5aa65f882985.tar.gz
rockbox-4dd300d9f0229269aa8f9a46b07a5aa65f882985.zip
puzzles: remove old combined build code
We don't really need it anymore. Change-Id: I7c8149faa6b80807ca718b73483bdb2e41830cbd
Diffstat (limited to 'apps/plugins/puzzles/rockbox.c')
-rw-r--r--apps/plugins/puzzles/rockbox.c108
1 files changed, 6 insertions, 102 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 509528c95a..65d491cc38 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -25,16 +25,15 @@
25 25
26#include "help.h" 26#include "help.h"
27#include "keymaps.h" 27#include "keymaps.h"
28#include "lz4tiny.h"
29
28#include "src/puzzles.h" 30#include "src/puzzles.h"
29 31
30#ifndef COMBINED
31#include "lib/playback_control.h" 32#include "lib/playback_control.h"
32#endif
33#include "lib/simple_viewer.h" 33#include "lib/simple_viewer.h"
34#include "lib/xlcd.h" 34#include "lib/xlcd.h"
35 35
36#include "fixedpoint.h" 36#include "fixedpoint.h"
37#include "lz4tiny.h"
38 37
39/* how many ticks between timer callbacks */ 38/* how many ticks between timer callbacks */
40#define TIMER_INTERVAL (HZ / 50) 39#define TIMER_INTERVAL (HZ / 50)
@@ -54,10 +53,6 @@
54 53
55#define MAX_FONTS (MAXUSERFONTS - 2) 54#define MAX_FONTS (MAXUSERFONTS - 2)
56 55
57#ifdef COMBINED
58#define SAVE_FILE PLUGIN_GAMES_DATA_DIR "/puzzles.sav"
59#endif
60
61#define FONT_TABLE PLUGIN_GAMES_DATA_DIR "/.sgt-puzzles.fnttab" 56#define FONT_TABLE PLUGIN_GAMES_DATA_DIR "/.sgt-puzzles.fnttab"
62 57
63#define MURICA 58#define MURICA
@@ -1457,17 +1452,10 @@ static int pausemenu_cb(int action, const struct menu_item_ex *this_item)
1457 case 7: 1452 case 7:
1458 break; 1453 break;
1459 case 8: 1454 case 8:
1460#ifdef COMBINED
1461 /* audio buf is used, so no playback */
1462 /* TODO: neglects app builds, but not many people will
1463 * care, I bet */
1464 return ACTION_EXIT_MENUITEM;
1465#else
1466 if(audiobuf_available) 1455 if(audiobuf_available)
1467 break; 1456 break;
1468 else 1457 else
1469 return ACTION_EXIT_MENUITEM; 1458 return ACTION_EXIT_MENUITEM;
1470#endif
1471 case 9: 1459 case 9:
1472 if(!midend_get_presets(me, NULL)->n_entries) 1460 if(!midend_get_presets(me, NULL)->n_entries)
1473 return ACTION_EXIT_MENUITEM; 1461 return ACTION_EXIT_MENUITEM;
@@ -1525,9 +1513,6 @@ static int pause_menu(void)
1525 "Game Type", 1513 "Game Type",
1526 "Debug Menu", 1514 "Debug Menu",
1527 "Configure Game", 1515 "Configure Game",
1528#ifdef COMBINED
1529 "Select Another Game",
1530#endif
1531 "Quit without Saving", 1516 "Quit without Saving",
1532 "Quit"); 1517 "Quit");
1533#undef static 1518#undef static
@@ -1616,19 +1601,10 @@ static int pause_menu(void)
1616 quit = true; 1601 quit = true;
1617 } 1602 }
1618 break; 1603 break;
1619#ifdef COMBINED
1620 case 12:
1621 return -1;
1622 case 13:
1623 return -2;
1624 case 14:
1625 return -3;
1626#else
1627 case 12: 1604 case 12:
1628 return -2; 1605 return -2;
1629 case 13: 1606 case 13:
1630 return -3; 1607 return -3;
1631#endif
1632 default: 1608 default:
1633 break; 1609 break;
1634 } 1610 }
@@ -1643,10 +1619,6 @@ static int pause_menu(void)
1643static bool want_redraw = true; 1619static bool want_redraw = true;
1644static bool accept_input = true; 1620static bool accept_input = true;
1645 1621
1646/* ignore the excess of LOGFs below... */
1647#ifdef LOGF_ENABLE
1648#undef LOGF_ENABLE
1649#endif
1650static int process_input(int tmo) 1622static int process_input(int tmo)
1651{ 1623{
1652 LOGF("process_input start"); 1624 LOGF("process_input start");
@@ -1696,9 +1668,9 @@ static int process_input(int tmo)
1696 return rc; 1668 return rc;
1697 } 1669 }
1698 1670
1699 /* these three games require, for one reason or another, that 1671 /* these games require, for one reason or another, that events
1700 * events fire upon buttons being released rather than when they 1672 * fire upon buttons being released rather than when they are
1701 * are pressed */ 1673 * pressed */
1702 if(strcmp("Inertia", midend_which_game(me)->name) == 0 || 1674 if(strcmp("Inertia", midend_which_game(me)->name) == 0 ||
1703 strcmp("Mines", midend_which_game(me)->name) == 0 || 1675 strcmp("Mines", midend_which_game(me)->name) == 0 ||
1704 strcmp("Magnets", midend_which_game(me)->name) == 0 || 1676 strcmp("Magnets", midend_which_game(me)->name) == 0 ||
@@ -1867,23 +1839,10 @@ void deactivate_timer(frontend *fe)
1867 timer_on = false; 1839 timer_on = false;
1868} 1840}
1869 1841
1870#ifdef COMBINED
1871/* can't use audio buffer */
1872char giant_buffer[1024*1024*4];
1873#else
1874/* points to pluginbuf */ 1842/* points to pluginbuf */
1875char *giant_buffer = NULL; 1843char *giant_buffer = NULL;
1876#endif
1877static size_t giant_buffer_len = 0; /* set on start */ 1844static size_t giant_buffer_len = 0; /* set on start */
1878 1845
1879#ifdef COMBINED
1880const char *formatter(char *buf, size_t n, int i, const char *unit)
1881{
1882 rb->snprintf(buf, n, "%s", gamelist[i]->name);
1883 return buf;
1884}
1885#endif
1886
1887static void fix_size(void) 1846static void fix_size(void)
1888{ 1847{
1889 int w = LCD_WIDTH, h = LCD_HEIGHT, h_x; 1848 int w = LCD_WIDTH, h = LCD_HEIGHT, h_x;
@@ -2139,30 +2098,6 @@ static bool load_game(void)
2139 /* seek to beginning */ 2098 /* seek to beginning */
2140 rb->lseek(fd, 0, SEEK_SET); 2099 rb->lseek(fd, 0, SEEK_SET);
2141 2100
2142#ifdef COMBINED
2143 /* search for the game and initialize the midend */
2144 for(int i = 0; i < gamecount; ++i)
2145 {
2146 if(!strcmp(game, gamelist[i]->name))
2147 {
2148 sfree(ret);
2149 ret = init_for_game(gamelist[i], fd, true);
2150 if(ret)
2151 {
2152 rb->splash(HZ, ret);
2153 sfree(ret);
2154 rb->close(fd);
2155 return false;
2156 }
2157 rb->close(fd);
2158 rb->remove(fname);
2159 return true;
2160 }
2161 }
2162 rb->splashf(HZ, "Incompatible game %s reported as compatible!?!? REEEPORT MEEEE!!!!", game);
2163 rb->close(fd);
2164 return false;
2165#else
2166 if(!strcmp(game, thegame.name)) 2101 if(!strcmp(game, thegame.name))
2167 { 2102 {
2168 sfree(ret); 2103 sfree(ret);
@@ -2192,7 +2127,6 @@ static bool load_game(void)
2192 rb->remove(fname); 2127 rb->remove(fname);
2193 2128
2194 return false; 2129 return false;
2195#endif
2196 } 2130 }
2197} 2131}
2198 2132
@@ -2232,17 +2166,10 @@ static int mainmenu_cb(int action, const struct menu_item_ex *this_item)
2232 case 3: 2166 case 3:
2233 break; 2167 break;
2234 case 4: 2168 case 4:
2235#ifdef COMBINED
2236 /* audio buf is used, so no playback */
2237 /* TODO: neglects app builds, but not many people will
2238 * care, I bet */
2239 return ACTION_EXIT_MENUITEM;
2240#else
2241 if(audiobuf_available) 2169 if(audiobuf_available)
2242 break; 2170 break;
2243 else 2171 else
2244 return ACTION_EXIT_MENUITEM; 2172 return ACTION_EXIT_MENUITEM;
2245#endif
2246 case 5: 2173 case 5:
2247 if(!midend_get_presets(me, NULL)->n_entries) 2174 if(!midend_get_presets(me, NULL)->n_entries)
2248 return ACTION_EXIT_MENUITEM; 2175 return ACTION_EXIT_MENUITEM;
@@ -2267,19 +2194,13 @@ enum plugin_status plugin_start(const void *param)
2267 rb->cpu_boost(true); 2194 rb->cpu_boost(true);
2268#endif 2195#endif
2269 2196
2270#ifdef COMBINED
2271 giant_buffer_len = sizeof(giant_buffer);
2272#else
2273 giant_buffer = rb->plugin_get_buffer(&giant_buffer_len); 2197 giant_buffer = rb->plugin_get_buffer(&giant_buffer_len);
2274#endif
2275
2276#ifndef COMBINED
2277#endif
2278 2198
2279 rb_atexit(exit_handler); 2199 rb_atexit(exit_handler);
2280 2200
2281 init_tlsf(); 2201 init_tlsf();
2282 2202
2203 /* sanity check */
2283 if(fabs(sqrt(3)/2 - sin(PI/3)) > .01) 2204 if(fabs(sqrt(3)/2 - sin(PI/3)) > .01)
2284 { 2205 {
2285 return PLUGIN_ERROR; 2206 return PLUGIN_ERROR;
@@ -2291,13 +2212,11 @@ enum plugin_status plugin_start(const void *param)
2291 2212
2292 load_success = load_game(); 2213 load_success = load_game();
2293 2214
2294#ifndef COMBINED
2295 if(!load_success) 2215 if(!load_success)
2296 { 2216 {
2297 /* our main menu expects a ready-to-use midend */ 2217 /* our main menu expects a ready-to-use midend */
2298 init_for_game(&thegame, -1, false); 2218 init_for_game(&thegame, -1, false);
2299 } 2219 }
2300#endif
2301 2220
2302#ifdef HAVE_ADJUSTABLE_CPU_FREQ 2221#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2303 /* about to go to menu or button block */ 2222 /* about to go to menu or button block */
@@ -2308,7 +2227,6 @@ enum plugin_status plugin_start(const void *param)
2308 help_times = 0; 2227 help_times = 0;
2309#endif 2228#endif
2310 2229
2311#ifndef COMBINED
2312#define static auto 2230#define static auto
2313#define const 2231#define const
2314 MENUITEM_STRINGLIST(menu, NULL, mainmenu_cb, 2232 MENUITEM_STRINGLIST(menu, NULL, mainmenu_cb,
@@ -2389,24 +2307,10 @@ enum plugin_status plugin_start(const void *param)
2389 break; 2307 break;
2390 } 2308 }
2391 } 2309 }
2392#else
2393 if(load_success)
2394 goto game_loop;
2395#endif
2396 2310
2397#ifdef COMBINED
2398 int gm = 0;
2399#endif
2400 while(1) 2311 while(1)
2401 { 2312 {
2402#ifdef COMBINED
2403 if(rb->set_int("Choose Game", "", UNIT_INT, &gm, NULL, 1, 0, gamecount - 1, formatter))
2404 return PLUGIN_OK;
2405
2406 init_for_game(gamelist[gm], -1, true);
2407#else
2408 init_for_game(&thegame, -1, true); 2313 init_for_game(&thegame, -1, true);
2409#endif
2410 2314
2411 last_keystate = 0; 2315 last_keystate = 0;
2412 accept_input = true; 2316 accept_input = true;