summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/battery_bench.c14
-rw-r--r--apps/plugins/blackjack.c20
-rw-r--r--apps/plugins/calculator.c188
-rw-r--r--apps/plugins/calendar.c10
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.h14
-rw-r--r--apps/plugins/chessclock.c21
-rw-r--r--apps/plugins/chopper.c6
-rw-r--r--apps/plugins/clix.c8
-rw-r--r--apps/plugins/cube.c20
-rw-r--r--apps/plugins/doom/doomdef.c2
-rw-r--r--apps/plugins/doom/doomdef.h2
-rw-r--r--apps/plugins/doom/i_video.c10
-rw-r--r--apps/plugins/doom/m_misc.c2
-rw-r--r--apps/plugins/fractals/fractal.h14
-rw-r--r--apps/plugins/greyscale.c8
-rw-r--r--apps/plugins/imageviewer/imageviewer_button.h11
-rw-r--r--apps/plugins/invadrox.c7
-rw-r--r--apps/plugins/jewels.c20
-rw-r--r--apps/plugins/lib/grey_core.c1
-rw-r--r--apps/plugins/lib/pluginlib_actions.c22
-rw-r--r--apps/plugins/lua/include_lua/create_kbd_layout.lua107
-rw-r--r--apps/plugins/lua/include_lua/menubuttons.lua59
-rw-r--r--apps/plugins/lua/include_lua/menucoresettings.lua78
-rw-r--r--apps/plugins/lua/include_lua/print.lua14
-rw-r--r--apps/plugins/lua/include_lua/printmenus.lua91
-rw-r--r--apps/plugins/lua/include_lua/printsubmenu.lua314
-rw-r--r--apps/plugins/lua/include_lua/printtable.lua61
-rw-r--r--apps/plugins/lua/include_lua/rbsettings.lua7
-rw-r--r--apps/plugins/lua/include_lua/temploader.lua63
-rw-r--r--apps/plugins/lua/lauxlib.c37
-rw-r--r--apps/plugins/lua/loadlib.c4
-rw-r--r--apps/plugins/lua/lparser.c5
-rw-r--r--apps/plugins/lua/lua.make13
-rwxr-xr-xapps/plugins/lua/rbdefines_helper.pl2
-rw-r--r--apps/plugins/lua/rockaux.c80
-rw-r--r--apps/plugins/lua/rocklib.c16
-rw-r--r--apps/plugins/lua_scripts/print_buttons.lua70
-rw-r--r--apps/plugins/lua_scripts/print_lua_func.lua72
-rw-r--r--apps/plugins/lua_scripts/submenu_demo.lua121
-rw-r--r--apps/plugins/midi/midiplay.c8
-rw-r--r--apps/plugins/mp3_encoder.c6
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c8
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c9
-rw-r--r--apps/plugins/pacbox/pacbox.h12
-rw-r--r--apps/plugins/pegbox.c17
-rw-r--r--apps/plugins/pictureflow/pictureflow.c19
-rw-r--r--apps/plugins/plugin.lds19
-rw-r--r--apps/plugins/pong.c8
-rw-r--r--apps/plugins/reversi/reversi-gui.h9
-rw-r--r--apps/plugins/rockblox.c22
-rw-r--r--apps/plugins/rockboy/cpu.c50
-rw-r--r--apps/plugins/rockboy/rockboy.c10
-rw-r--r--apps/plugins/sokoban.c14
-rw-r--r--apps/plugins/stopwatch.c17
-rw-r--r--apps/plugins/sudoku/sudoku.h10
-rw-r--r--apps/plugins/text_viewer/tv_button.h23
-rw-r--r--apps/plugins/xobox.c9
-rw-r--r--apps/plugins/zxbox/keymaps.h16
-rw-r--r--apps/plugins/zxbox/zxbox_keyb.c77
59 files changed, 1278 insertions, 699 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index f8269f5c3b..2534e3bebe 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -61,13 +61,6 @@
#define BATTERY_ON_TXT "SELECT - start"
#define BATTERY_OFF_TXT "POWER"
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-#define BATTERY_ON BUTTON_SELECT
-#define BATTERY_OFF BUTTON_PLAY
-#define BATTERY_ON_TXT "SELECT - start"
-#define BATTERY_OFF_TXT "PLAY"
-
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
@@ -141,13 +134,6 @@
#define BATTERY_OFF BUTTON_POWER
#define BATTERY_OFF_TXT "POWER"
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define BATTERY_OFF BUTTON_POWER
-#define BATTERY_OFF_TXT "POWER"
-#define BATTERY_ON BUTTON_PLAY
-#define BATTERY_ON_TXT "PLAY - start"
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define BATTERY_ON BUTTON_PLAY
#define BATTERY_ON_TXT "PLAY - start"
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c
index 0667c31ef6..4242f5a89f 100644
--- a/apps/plugins/blackjack.c
+++ b/apps/plugins/blackjack.c
@@ -104,22 +104,6 @@ enum {
#define BJACK_RIGHT BUTTON_RIGHT
#define BJACK_LEFT BUTTON_LEFT
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define BJACK_SELECT_NAME "MODE"
-#define BJACK_STAY_NAME "MODE"
-#define BJACK_QUIT_NAME "PLAY"
-#define BJACK_DOUBLE_NAME "SELECT"
-#define BJACK_SELECT BUTTON_MODE
-#define BJACK_QUIT BUTTON_PLAY
-#define BJACK_MAX (BUTTON_EQ|BUTTON_UP)
-#define BJACK_MIN (BUTTON_EQ|BUTTON_DOWN)
-#define BJACK_STAY BUTTON_MODE
-#define BJACK_DOUBLEDOWN BUTTON_SELECT
-#define BJACK_UP BUTTON_UP
-#define BJACK_DOWN BUTTON_DOWN
-#define BJACK_RIGHT BUTTON_RIGHT
-#define BJACK_LEFT BUTTON_LEFT
-
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define BJACK_SELECT_NAME "SELECT"
#define BJACK_STAY_NAME "VOL-"
@@ -1085,7 +1069,7 @@ static void blackjack_savegame(struct game_context* bj) {
/*****************************************************************************
* blackjack_get_yes_no() gets a yes/no answer from the user
******************************************************************************/
-static unsigned int blackjack_get_yes_no(char message[20]) {
+static unsigned int blackjack_get_yes_no(const char *message) {
int button;
unsigned int w, h, b, choice = 0;
bool breakout = false;
@@ -1146,7 +1130,7 @@ static unsigned int blackjack_get_yes_no(char message[20]) {
/*****************************************************************************
* blackjack_get_amount() gets an amount from the player to be used
******************************************************************************/
-static signed int blackjack_get_amount(const char message[20],
+static signed int blackjack_get_amount(const char *message,
signed int lower_limit,
signed int upper_limit,
signed int start) {
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c
index 4d1b6fa594..cbaea8aa7e 100644
--- a/apps/plugins/calculator.c
+++ b/apps/plugins/calculator.c
@@ -269,19 +269,6 @@ F3: equal to "="
#define CALCULATOR_QUIT BUTTON_POWER
#define CALCULATOR_CLEAR BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define CALCULATOR_LEFT BUTTON_LEFT
-#define CALCULATOR_RIGHT BUTTON_RIGHT
-#define CALCULATOR_UP BUTTON_VOLUP
-#define CALCULATOR_DOWN BUTTON_VOLDOWN
-#define CALCULATOR_QUIT BUTTON_POWER
-#define CALCULATOR_INPUT BUTTON_PLAY
-#define CALCULATOR_CALC BUTTON_MENU
-#define CALCULATOR_CLEAR BUTTON_STOP
-
-#define CALCULATOR_RC_QUIT (BUTTON_MENU|BUTTON_PLAY)
-
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
#define CALCULATOR_LEFT BUTTON_LEFT
@@ -733,6 +720,8 @@ static void doMultiple(double* operandOne, int* powerOne,
double operandTwo, int powerTwo);
static void doAdd (double* operandOne, int* powerOne,
double operandTwo, int powerTwo);
+static void doExponent(double* operandOne, int* powerOne,
+ double operandTwo, int powerTwo);
static void printResult(void);
static void formatResult(void);
static void oneOperand(void);
@@ -740,6 +729,75 @@ static void oneOperand(void);
static void drawLines(void);
static void drawButtons(int group);
+double strtod(const char *nptr, char **endptr);
+long long atoll(const char *nptr);
+
+/* -----------------------------------------------------------------------
+Standard library function
+----------------------------------------------------------------------- */
+double strtod(const char *nptr, char **endptr)
+{
+ double out;
+ long mantissa;
+ int length=0, end=0;
+ mantissa=atoll(nptr);
+ while(!end)
+ {
+ switch(*nptr)
+ {
+ case '\0':
+ end=1;
+ break;
+ case ',':
+ case '.':
+ case '\'':
+ end=1;
+ default:
+ nptr++;
+ }
+ }
+ out=atoll(nptr);
+ while( (*nptr == '0')||(*nptr == '1')||(*nptr == '2')||(*nptr == '3')||(*nptr == '4')||
+ (*nptr == '5')||(*nptr == '6')||(*nptr == '7')||(*nptr == '8')||(*nptr == '9') )
+ {
+ nptr++;
+ length++;
+ }
+ for(;length;length--)
+ out /= 10;
+ out += mantissa;
+ if(endptr != NULL)
+ *endptr=(char *) nptr;
+ return out;
+}
+
+// WARNING Unsafe: Use strtoll instead
+long long atoll(const char *nptr)
+{
+ long long result=0;
+ char negative=0;
+ while( (*nptr == ' ') || (*nptr == '\f') || (*nptr == '\n')||
+ (*nptr == '\r') || (*nptr == '\t') || (*nptr == '\v') )
+ nptr++;
+ if(*nptr == '+')
+ nptr++;
+ if(*nptr == '-')
+ {
+ negative++;
+ nptr++;
+ }
+ while (*nptr)
+ {
+ if( (*nptr < '0') || (*nptr > '9') )
+ break;
+ result *=10;
+ result+= (*(nptr++) -'0');
+ }
+ if(negative)
+ result = 0 - result;
+ return result;
+}
+
/* -----------------------------------------------------------------------
Handy functions
----------------------------------------------------------------------- */
@@ -1062,6 +1120,93 @@ static void doMultiple(double* operandOne, int* powerOne,
}
/* -----------------------------------------------------------------------
+exponentiate in scientific number format
+----------------------------------------------------------------------- */
+static void doExponent(double* operandOne, int* powerOne,
+ double operandTwo, int powerTwo)
+{
+ char negative=0;
+ char *lastDigit;
+ char negativeBuffer[25];
+ if (*operandOne == 0)
+ {
+ if (operandTwo == 0)
+ {
+ calStatus=cal_error; // result is undefined
+ }
+ else{
+ *powerOne = 0;
+ *operandOne = 0;
+ }
+ return;
+ }
+ if (operandTwo == 0)
+ {
+ *powerOne = 1;
+ *operandOne = 0.1;
+ return;
+ }
+ if (operandTwo < 0)
+ {
+ negative+=2;
+ operandTwo= ABS(operandTwo);
+ }
+ if (*operandOne < 0)
+ {
+#if MEMORYSIZE < 8
+ (void)negativeBuffer;
+ (void)lastDigit;
+ calStatus=cal_error;
+ return;
+#else
+ if(powerTwo < 0)
+ {
+ calStatus=cal_error; // result is imaginary
+ return;
+ }
+
+ /*Truncate operandTwo to three places past the radix
+ in order to eliminate floating point artifacts
+ (function should set error if truncating a non-integer) */
+ rb->snprintf(negativeBuffer, 25, "%.*f", powerTwo+3, operandTwo);
+ operandTwo = strtod(negativeBuffer, NULL);
+
+ /*Truncate operandTwo to powerTwo digits by way of string
+ in order to confirm operandTwo *10^powerTwo is an integer*/
+ rb->snprintf(negativeBuffer, 25, "%.*f", powerTwo, operandTwo);
+
+ if(strtod(negativeBuffer, &lastDigit) != operandTwo)
+ {
+ calStatus=cal_error; // result is imaginary
+ return;
+ }
+ if(rb->atoi(lastDigit-1) % 2)
+ negative++;
+#endif
+ }
+ (*operandOne) = myLn(ABS(*operandOne)) + (double) (*powerOne) * 2.302585092994046;
+ (*powerOne) = 0;
+ doMultiple(operandOne, powerOne, ABS(operandTwo), powerTwo);
+ while(*powerOne)
+ {
+ if(*powerOne > 0)
+ {
+ (*operandOne) *= 10;
+ (*powerOne) --;
+ }
+ else{
+ (*operandOne) /= 10;
+ (*powerOne) ++;
+ }
+ }
+ (*operandOne) = myExp(*operandOne);
+ if(negative & 2)
+ (*operandOne) = 1/(*operandOne);
+ if(negative & 1)
+ *operandOne = -(*operandOne);
+}
+
+/* -----------------------------------------------------------------------
Handles all one operand calculations
----------------------------------------------------------------------- */
static void oneOperand(void)
@@ -1205,6 +1350,9 @@ static void twoOperands(void)
else
calStatus = cal_error;
break;
+ case '^':
+ doExponent(&operand, &operandPower, result, power);
+ break;
default: /* ' ' */
switchOperands(); /* counter switchOperands() below */
break;
@@ -1697,7 +1845,9 @@ static void basicButtonsProcess(void){
#ifdef CALCULATOR_OPERATORS
case_cycle_operators: /* F2 shortkey entrance */
#endif
- calStatus = cal_normal;
+ if (calStatus == cal_typing ||
+ calStatus == cal_dotted)
+ calStatus = cal_normal;
formatResult();
operand = result;
operandPower = power;
@@ -1753,8 +1903,14 @@ static void sciButtonsProcess(void){
break;
case sci_xy:
- /*Not implemented yet
- Maybe it could use x^y = exp(y*ln(x))*/
+ if(!operInputted) {twoOperands(); operInputted = true;}
+ oper = '^';
+ if (calStatus == cal_typing ||
+ calStatus == cal_dotted)
+ calStatus = cal_normal;
+ formatResult();
+ operand = result;
+ operandPower = power;
break;
case sci_sci:
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 54173fde1c..e7f221a3c9 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -68,16 +68,6 @@
#define CALENDAR_NEXT_MONTH BUTTON_VOL_DOWN
#define CALENDAR_PREV_MONTH BUTTON_VOL_UP
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CALENDAR_QUIT BUTTON_PLAY
-#define CALENDAR_SELECT BUTTON_SELECT
-#define CALENDAR_NEXT_WEEK BUTTON_DOWN
-#define CALENDAR_PREV_WEEK BUTTON_UP
-#define CALENDAR_NEXT_DAY BUTTON_RIGHT
-#define CALENDAR_PREV_DAY BUTTON_LEFT
-#define CALENDAR_NEXT_MONTH BUTTON_MODE
-#define CALENDAR_PREV_MONTH BUTTON_EQ
-
#elif CONFIG_KEYPAD == SANSA_E200_PAD
#define CALENDAR_QUIT BUTTON_POWER
#define CALENDAR_SELECT BUTTON_SELECT
diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h
index 5bfce10ec5..827f045a4b 100644
--- a/apps/plugins/chessbox/chessbox_pgn.h
+++ b/apps/plugins/chessbox/chessbox_pgn.h
@@ -70,20 +70,6 @@
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CB_SELECT BUTTON_SELECT
-#define CB_UP BUTTON_UP
-#define CB_DOWN BUTTON_DOWN
-#define CB_LEFT BUTTON_LEFT
-#define CB_RIGHT BUTTON_RIGHT
-#define CB_PLAY BUTTON_PLAY
-#define CB_LEVEL BUTTON_EQ
-#define CB_MENU BUTTON_MODE
-#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
-#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
-#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
-#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
-
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
#define CB_SELECT BUTTON_SELECT
#define CB_UP BUTTON_UP
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 9a30dee984..91b04e713a 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -46,16 +46,6 @@
#define CHC_SETTINGS_OK BUTTON_SELECT
#define CHC_SETTINGS_CANCEL BUTTON_MENU
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CHC_QUIT BUTTON_PLAY
-#define CHC_STARTSTOP BUTTON_MODE
-#define CHC_RESET BUTTON_EQ
-#define CHC_MENU BUTTON_SELECT
-#define CHC_SETTINGS_INC BUTTON_RIGHT
-#define CHC_SETTINGS_DEC BUTTON_LEFT
-#define CHC_SETTINGS_OK BUTTON_SELECT
-#define CHC_SETTINGS_CANCEL BUTTON_PLAY
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define CHC_QUIT BUTTON_REC
#define CHC_STARTSTOP BUTTON_PLAY
@@ -157,17 +147,6 @@
#define CHC_SETTINGS_DEC BUTTON_MINUS
#define CHC_SETTINGS_CANCEL BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define CHC_QUIT BUTTON_POWER
-#define CHC_STARTSTOP BUTTON_PLAY
-#define CHC_RESET BUTTON_LEFT
-#define CHC_MENU BUTTON_MENU
-#define CHC_SETTINGS_INC BUTTON_VOLUP
-#define CHC_SETTINGS_DEC BUTTON_VOLDOWN
-#define CHC_SETTINGS_OK BUTTON_PLAY
-#define CHC_SETTINGS_OK2 BUTTON_LEFT
-#define CHC_SETTINGS_CANCEL BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define CHC_QUIT BUTTON_BACK
#define CHC_STARTSTOP BUTTON_PLAY
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index ab8f7b5540..70763a1b67 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -108,12 +108,6 @@ Still To do:
#define QUIT BUTTON_POWER
#define ACTION2 BUTTON_PLUS
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define QUIT BUTTON_POWER
-#define ACTION BUTTON_PLAY
-#define ACTION2 BUTTON_STOP
-#define ACTIONTEXT "PLAY"
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define QUIT BUTTON_BACK
#define ACTION BUTTON_UP
diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c
index f1f21f6312..c127a300f2 100644
--- a/apps/plugins/clix.c
+++ b/apps/plugins/clix.c
@@ -100,14 +100,6 @@
#define CLIX_BUTTON_UP BUTTON_SCROLL_UP
#define CLIX_BUTTON_DOWN BUTTON_SCROLL_DOWN
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define CLIX_BUTTON_QUIT BUTTON_POWER
-#define CLIX_BUTTON_LEFT BUTTON_LEFT
-#define CLIX_BUTTON_RIGHT BUTTON_RIGHT
-#define CLIX_BUTTON_CLICK BUTTON_PLAY
-#define CLIX_BUTTON_UP BUTTON_STOP
-#define CLIX_BUTTON_DOWN BUTTON_PLAY
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define CLIX_BUTTON_QUIT BUTTON_POWER
#define CLIX_BUTTON_LEFT BUTTON_LEFT
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 6587fdcb65..857f2415d4 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -62,16 +62,6 @@
#define CUBE_HIGHSPEED_PRE BUTTON_SELECT
#define CUBE_HIGHSPEED (BUTTON_SELECT | BUTTON_REL)
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CUBE_QUIT BUTTON_PLAY
-#define CUBE_NEXT BUTTON_RIGHT
-#define CUBE_PREV BUTTON_LEFT
-#define CUBE_INC BUTTON_UP
-#define CUBE_DEC BUTTON_DOWN
-#define CUBE_MODE BUTTON_MODE
-#define CUBE_PAUSE BUTTON_SELECT
-#define CUBE_HIGHSPEED BUTTON_EQ
-
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
#define CUBE_QUIT BUTTON_POWER
#define CUBE_NEXT BUTTON_RIGHT
@@ -171,16 +161,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define CUBE_QUIT BUTTON_POWER
-#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
-#define CUBE_QUIT BUTTON_POWER
-#define CUBE_NEXT BUTTON_RIGHT
-#define CUBE_PREV BUTTON_LEFT
-#define CUBE_INC BUTTON_VOLUP
-#define CUBE_DEC BUTTON_VOLDOWN
-#define CUBE_MODE BUTTON_MENU
-#define CUBE_PAUSE BUTTON_PLAY
-#define CUBE_HIGHSPEED BUTTON_STOP
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define CUBE_QUIT BUTTON_BACK
#define CUBE_NEXT BUTTON_RIGHT
diff --git a/apps/plugins/doom/doomdef.c b/apps/plugins/doom/doomdef.c
index 3facfbb299..6ae4bb6894 100644
--- a/apps/plugins/doom/doomdef.c
+++ b/apps/plugins/doom/doomdef.c
@@ -34,7 +34,7 @@
// Location for any defines turned variables.
#if(LCD_HEIGHT>LCD_WIDTH)
-bool rotate_screen=0;
+int rotate_screen=0;
int SCREENWIDTH;
int SCREENHEIGHT;
#endif
diff --git a/apps/plugins/doom/doomdef.h b/apps/plugins/doom/doomdef.h
index 05346cd443..43114f75ef 100644
--- a/apps/plugins/doom/doomdef.h
+++ b/apps/plugins/doom/doomdef.h
@@ -94,7 +94,7 @@ typedef unsigned Language_t;
// when multiple screen sizes are supported
#if(LCD_HEIGHT>LCD_WIDTH)
-extern bool rotate_screen;
+extern int rotate_screen;
// proff 08/17/98: Changed for high-res
#define MAX_SCREENWIDTH LCD_HEIGHT
#define MAX_SCREENHEIGHT LCD_HEIGHT
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index bb04194acc..2381a7614d 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -316,16 +316,6 @@ void I_ShutdownGraphics(void)
#define DOOMBUTTON_ENTER BUTTON_MENU
#define DOOMBUTTON_WEAPON BUTTON_DISPLAY
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define DOOMBUTTON_ESC BUTTON_POWER
-#define DOOMBUTTON_UP BUTTON_STOP
-#define DOOMBUTTON_DOWN BUTTON_PLAY
-#define DOOMBUTTON_LEFT BUTTON_LEFT
-#define DOOMBUTTON_RIGHT BUTTON_RIGHT
-#define DOOMBUTTON_SHOOT BUTTON_VOLUP
-#define DOOMBUTTON_OPEN BUTTON_VOLDOWN
-#define DOOMBUTTON_ENTER BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define DOOMBUTTON_UP BUTTON_UP
#define DOOMBUTTON_DOWN BUTTON_DOWN
diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c
index 586a4a1c2f..0318c9d741 100644
--- a/apps/plugins/doom/m_misc.c
+++ b/apps/plugins/doom/m_misc.c
@@ -308,7 +308,7 @@ default_t defaults[] =
{"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200,
def_int,ss_none, 0, 0},*/
#if(LCD_HEIGHT>LCD_WIDTH)
- {"rotate_screen",{(void *)&rotate_screen, NULL},{0, NULL},0,1,
+ {"rotate_screen",{&rotate_screen, NULL},{0, NULL},0,1,
def_bool,ss_none, 0, 0}, /* kwk - rotate the screen 90 degrees */
#endif
{"fake_contrast",{&fake_contrast, NULL},{1, NULL},0,1,
diff --git a/apps/plugins/fractals/fractal.h b/apps/plugins/fractals/fractal.h
index 28172aed9f..b64bf942fe 100644
--- a/apps/plugins/fractals/fractal.h
+++ b/apps/plugins/fractals/fractal.h
@@ -155,20 +155,6 @@
#define FRACTAL_PRECISION_DEC BUTTON_REW
#define FRACTAL_RESET (BUTTON_PLAY | BUTTON_REW)
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define FRACTAL_QUIT BUTTON_EQ
-#define FRACTAL_UP BUTTON_UP
-#define FRACTAL_DOWN BUTTON_DOWN
-#define FRACTAL_LEFT BUTTON_LEFT
-#define FRACTAL_RIGHT BUTTON_RIGHT
-#define FRACTAL_ZOOM_IN_PRE BUTTON_SELECT
-#define FRACTAL_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
-#define FRACTAL_ZOOM_OUT_PRE BUTTON_SELECT
-#define FRACTAL_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
-#define FRACTAL_PRECISION_INC (BUTTON_PLAY | BUTTON_RIGHT)
-#define FRACTAL_PRECISION_DEC (BUTTON_PLAY | BUTTON_LEFT)
-#define FRACTAL_RESET BUTTON_MODE
-
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
#define FRACTAL_QUIT BUTTON_BACK
#define FRACTAL_UP BUTTON_UP
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c
index c44b1f77c0..d9cb7436de 100644
--- a/apps/plugins/greyscale.c
+++ b/apps/plugins/greyscale.c
@@ -57,14 +57,6 @@
#define GREYSCALE_RIGHT BUTTON_RIGHT
#define GREYSCALE_OFF BUTTON_MENU
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define GREYSCALE_SHIFT BUTTON_PLAY
-#define GREYSCALE_UP BUTTON_UP
-#define GREYSCALE_DOWN BUTTON_DOWN
-#define GREYSCALE_LEFT BUTTON_LEFT
-#define GREYSCALE_RIGHT BUTTON_RIGHT
-#define GREYSCALE_OFF BUTTON_EQ
-
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
#define GREYSCALE_SHIFT BUTTON_RC_PLAY /* somewhat dangerous... */
#define GREYSCALE_UP BUTTON_RC_VOL_UP
diff --git a/apps/plugins/imageviewer/imageviewer_button.h b/apps/plugins/imageviewer/imageviewer_button.h
index cfb9a2969b..d588de95ca 100644
--- a/apps/plugins/imageviewer/imageviewer_button.h
+++ b/apps/plugins/imageviewer/imageviewer_button.h
@@ -207,17 +207,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define IMGVIEW_ZOOM_IN BUTTON_VOLUP
-#define IMGVIEW_ZOOM_OUT BUTTON_VOLDOWN
-#define IMGVIEW_UP BUTTON_STOP
-#define IMGVIEW_DOWN BUTTON_PLAY
-#define IMGVIEW_LEFT BUTTON_LEFT
-#define IMGVIEW_RIGHT BUTTON_RIGHT
-#define IMGVIEW_NEXT (BUTTON_PLAY|BUTTON_VOLUP)
-#define IMGVIEW_PREVIOUS (BUTTON_PLAY|BUTTON_VOLDOWN)
-#define IMGVIEW_MENU BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define IMGVIEW_ZOOM_IN BUTTON_PLAY
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 8b0519d9d0..c28ab7e830 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -163,13 +163,6 @@
#define RIGHT BUTTON_PLUS
#define FIRE BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define QUIT BUTTON_POWER
-#define LEFT BUTTON_LEFT
-#define RIGHT BUTTON_RIGHT
-#define FIRE BUTTON_PLAY
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define QUIT BUTTON_BACK
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index 83a44eea02..7f7965b07d 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -63,16 +63,6 @@
#define HK_SELECT "SELECT"
#define HK_CANCEL "MENU"
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define JEWELS_UP BUTTON_UP
-#define JEWELS_DOWN BUTTON_DOWN
-#define JEWELS_LEFT BUTTON_LEFT
-#define JEWELS_RIGHT BUTTON_RIGHT
-#define JEWELS_SELECT BUTTON_SELECT
-#define JEWELS_CANCEL BUTTON_PLAY
-#define HK_SELECT "SELECT"
-#define HK_CANCEL "PLAY"
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define JEWELS_UP BUTTON_UP
#define JEWELS_DOWN BUTTON_DOWN
@@ -201,16 +191,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define JEWELS_CANCEL BUTTON_POWER
#define HK_CANCEL "POWER"
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define JEWELS_UP BUTTON_STOP
-#define JEWELS_DOWN BUTTON_PLAY
-#define JEWELS_LEFT BUTTON_LEFT
-#define JEWELS_RIGHT BUTTON_RIGHT
-#define JEWELS_SELECT BUTTON_MENU
-#define JEWELS_CANCEL BUTTON_POWER
-#define HK_SELECT "MENU"
-#define HK_CANCEL "POWER"
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define JEWELS_UP BUTTON_UP
#define JEWELS_DOWN BUTTON_DOWN
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index e3543aeba2..b025ef8eaa 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -294,7 +294,6 @@ static const unsigned char lcdlinear[256] = {
#define LCD_SCANRATE 73 /* Hz */
#else /* not yet calibrated targets - generic linear mapping */
-/* TODO: calibrate iFP7xx */
static const unsigned char lcdlinear[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c
index b1bcd06ee6..028472d9a8 100644
--- a/apps/plugins/lib/pluginlib_actions.c
+++ b/apps/plugins/lib/pluginlib_actions.c
@@ -91,7 +91,6 @@ const struct button_mapping pla_main_ctx[] =
|| (CONFIG_KEYPAD == IRIVER_H300_PAD) \
|| (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_PAD) \
- || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
|| (CONFIG_KEYPAD == SANSA_C200_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
|| (CONFIG_KEYPAD == MROBE100_PAD) \
@@ -161,15 +160,6 @@ const struct button_mapping pla_main_ctx[] =
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
-#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
- { PLA_UP, BUTTON_STOP, BUTTON_NONE },
- { PLA_DOWN, BUTTON_PLAY, BUTTON_NONE },
- { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
- { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
- { PLA_UP_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE },
- { PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
- { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
@@ -357,12 +347,6 @@ const struct button_mapping pla_main_ctx[] =
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
-#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
- {PLA_CANCEL, BUTTON_EQ|BUTTON_REL, BUTTON_EQ},
- {PLA_EXIT, BUTTON_EQ|BUTTON_REPEAT, BUTTON_NONE},
- {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
- {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
- {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MROBE500_PAD)
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
@@ -394,12 +378,6 @@ const struct button_mapping pla_main_ctx[] =
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
-#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
- {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
- {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
- {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
- {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
- {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT BUTTON_NONE},
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
{PLA_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK},
{PLA_EXIT, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE},
diff --git a/apps/plugins/lua/include_lua/create_kbd_layout.lua b/apps/plugins/lua/include_lua/create_kbd_layout.lua
new file mode 100644
index 0000000000..7d0792a667
--- /dev/null
+++ b/apps/plugins/lua/include_lua/create_kbd_layout.lua
@@ -0,0 +1,107 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+]]
+--create keyboard layout
+--BILGUS 4/2021
+-- create_kbd_layout = require("create_kbd_layout")
+-- local layout = create_kbd_layout("abcd")
+
+local function encode_short(n)
+ return string.char(bit.band(0x00FF, n), bit.rshift(bit.band(0xFF00, n), 8))
+end
+
+local function utf8decode(str)
+ local INVALID = 0xfffd
+ local t = {}
+ local function check_char(c)
+ local tail = false
+ local code
+ c = string.byte(c)
+ if (c <= 0x7f) or (c >= 0xc2) then
+ -- Start of new character
+ if (c < 0x80) then -- U-00000000 - U-0000007F, 1 string.byte
+ code = c;
+ elseif (c < 0xe0) then -- U-00000080 - U-000007FF, 2 string.bytes
+ tail = 1;
+ code = bit.band(c, 0x1f)
+ elseif (c < 0xf0) then -- U-00000800 - U-0000FFFF, 3 string.bytes
+ tail = 2;
+ code = bit.band(c, 0x0f)
+ elseif (c < 0xf5) then -- U-00010000 - U-001FFFFF, 4 string.bytes
+ tail = 3;
+ code = bit.band(c, 0x07)
+ else
+ -- Invalid size
+ code = INVALID;
+ end
+
+ while tail and c ~= 0 do
+ tail = tail - 1
+ if bit.band(c, 0xc0) == 0x80 then
+ -- Valid continuation character
+ code = bit.bor(bit.lshift(code, 6),bit.band(c, 0x3f))
+ else
+ -- Invalid continuation char
+ code = INVALID;
+ break;
+ end
+ end
+ else
+ -- Invalid UTF-8 char
+ code = INVALID;
+ end
+ -- currently we don't support chars above U-FFFF
+ t[#t + 1 ] = encode_short((code < 0x10000) and code or INVALID)
+ end
+ str:gsub(".", check_char) -- run check function for every char
+ return table.concat(t)
+end
+
+local function create_keyboard_layout(s_layout)
+ local insert = table.insert
+ lines = {}
+
+ for str in string.gmatch(s_layout, "([^\n]+)") do
+ local len = string.len(str)
+ lines[#lines + 1] =
+ table.concat({encode_short(len), utf8decode(str)})
+ end
+ lines[#lines + 1] = encode_short(0xFEFF)
+
+ return table.concat(lines)
+end
+
+
+--[[
+local name = "Test_KBD_LAYOUT_" .. tostring(1)
+local test = create_keyboard_layout("ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\n0123456789")
+local file = io.open('/' .. name, "w+") -- overwrite, rb ignores the 'b' flag
+file:write(test)-- write the layout to the file now
+file:close()
+
+if not file then
+ rb.splash(rb.HZ, "Error opening /" .. name)
+ return
+end
+rb.kbd_input(name, test)
+]]
+return create_keyboard_layout
diff --git a/apps/plugins/lua/include_lua/menubuttons.lua b/apps/plugins/lua/include_lua/menubuttons.lua
new file mode 100644
index 0000000000..7c19592bbe
--- /dev/null
+++ b/apps/plugins/lua/include_lua/menubuttons.lua
@@ -0,0 +1,59 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+]]
+-- Bilgus 4/2021
+local oldrb = rb
+local tmploader = require("temploader")
+
+local a_is_loaded = (package.loaded.actions ~= nil)
+local rbold = rb
+
+if not a_is_loaded then
+ --replace the rb table so we can keep the defines out of the namespace
+ rb = {}
+end
+
+--require("actions") -- Contains rb.actions & rb.contexts
+local actions, err = tmploader("actions")
+if err then
+ error(err)
+end
+
+-- Menu Button definitions --
+local button_t = {
+ CANCEL = rb.actions.PLA_CANCEL,
+ DOWN = rb.actions.PLA_DOWN,
+ DOWNR = rb.actions.PLA_DOWN_REPEAT,
+ EXIT = rb.actions.PLA_EXIT,
+ LEFT = rb.actions.PLA_LEFT,
+ LEFTR = rb.actions.PLA_LEFT_REPEAT,
+ RIGHT = rb.actions.PLA_RIGHT,
+ RIGHTR = rb.actions.PLA_RIGHT_REPEAT,
+ SEL = rb.actions.PLA_SELECT,
+ SELREL = rb.actions.PLA_SELECT_REL,
+ SELR = rb.actions.PLA_SELECT_REPEAT,
+ UP = rb.actions.PLA_UP,
+ UPR = rb.actions.PLA_UP_REPEAT,
+}
+
+rb = oldrb
+return button_t
diff --git a/apps/plugins/lua/include_lua/menucoresettings.lua b/apps/plugins/lua/include_lua/menucoresettings.lua
new file mode 100644
index 0000000000..27d5e86ca1
--- /dev/null
+++ b/apps/plugins/lua/include_lua/menucoresettings.lua
@@ -0,0 +1,78 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+]]
+--menu core settings loaded from rockbox user settings
+--Bilgus 4/2021
+
+local function get_core_settings()
+ local tmploader = require("temploader")
+ -- rbsettings is a large module to have sitting in RAM
+ -- if user already has it in RAM then use that
+ local rbs_is_loaded = (package.loaded.rbsettings ~= nil)
+ local s_is_loaded = (package.loaded.settings ~= nil)
+ local rbold = rb
+
+ if not rbs_is_loaded then
+ --replace the rb table so we can keep the defines out of the namespace
+ rb = { global_settings = rb.global_settings,
+ global_status = rb.global_status}
+ end
+
+ tmploader("rbsettings")
+ tmploader("settings")
+ -- these are exact matches color and talk are wildcard matches
+ local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|"
+ local function filterfn(struct, k)
+ k = k or ""
+ --rbold.splash(100, struct .. " " .. k)
+ return (k:find("color") or k:find("talk") or list_settings:find(k))
+ end
+ local rb_settings = rb.settings.dump('global_settings', "system", nil, nil, filterfn)
+
+ local color_table = {}
+ local talk_table = {}
+ local list_settings_table = {}
+
+ for key, value in pairs(rb_settings) do
+ key = key or ""
+ if (key:find("color")) then
+ color_table[key]=value
+ elseif (key:find("talk")) then
+ talk_table[key]=value
+ else --if (list_settings:find(key)) then
+ list_settings_table[key]=value
+ end
+ end
+
+ if not s_is_loaded then
+ rb.settings = nil
+ end
+
+ rb = rbold
+ rb.core_color_table = color_table
+ rb.core_talk_table = talk_table
+ rb.core_list_settings_table = list_settings_table
+end
+get_core_settings()
+get_core_settings = nil
+package.loaded.menucoresettings = nil
+collectgarbage("collect")
diff --git a/apps/plugins/lua/include_lua/print.lua b/apps/plugins/lua/include_lua/print.lua
index 3b4c389848..6f2010422a 100644
--- a/apps/plugins/lua/include_lua/print.lua
+++ b/apps/plugins/lua/include_lua/print.lua
@@ -343,20 +343,15 @@ local _print = {} do
tld.line_end_color = line_end_color
end
- line_separator = ld.line_separator
-
+ line_separator = ld.line_separator or o.drawsep
+ local indent = line_indent < 0 and 0 or line_indent --rb scroller doesn't like negative offset!
if o.line == 1 and o.header then
- --rb scroller doesn't like negative offset!
- local indent = line_indent < 0 and 0 or line_indent
set_desc(ld, true, 1, false, rb.STYLE_DEFAULT,
indent, o.fg_pattern, o.bg_pattern, o.bg_pattern)
ld.show_cursor = false
elseif s_lines[o.line] then
--/* Display line selector */
local style = show_cursor == true and rb.STYLE_DEFAULT or linestyle
-
- local indent = line_indent < 0 and 0 or line_indent
- --rb scroller doesn't like negative offset!
local ovfl = (o.ovfl == "auto" and w >= o.width and x == 0)
set_desc(ld, ovfl, 0, true, style, indent,
o.bg_pattern, o.sel_pattern, o.sel_pattern)
@@ -377,7 +372,9 @@ local _print = {} do
if ld.selected == true then
rb.set_viewport(o) -- revert drawmode if selected
end
- rb.lcd_drawline(0, line * h, o.width, line * h)
+ if not o.header then
+ rb.lcd_drawline(0, line * h, o.width, line * h)
+ end
rb.lcd_drawline(0, line * h + h, o.width, line * h + h) --only to add the last line
-- but we don't have an idea which line is the last line here so every line is the last line!
end
@@ -457,6 +454,7 @@ local _print = {} do
_print.opt.line = set_line
_print.opt.linedesc = set_linedesc
_print.opt.autoupdate = set_update
+ _print.selected = function() return s_lines end
_print.clear = clear
_print.f = printf
diff --git a/apps/plugins/lua/include_lua/printmenus.lua b/apps/plugins/lua/include_lua/printmenus.lua
index 3e8f870104..938d99a5ed 100644
--- a/apps/plugins/lua/include_lua/printmenus.lua
+++ b/apps/plugins/lua/include_lua/printmenus.lua
@@ -23,74 +23,18 @@
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
require("printtable")
+require("menucoresettings") --loads user settings from rockbox
local _clr = require("color")
+
local _LCD = rb.lcd_framebuffer()
--[[ -- dpad requires:
-require("actions") -- Contains rb.actions & rb.contexts
+local BUTTON = require("menubuttons")
local _timer = require("timer")
--- Button definitions --
-local CANCEL_BUTTON = rb.actions.PLA_CANCEL
-local DOWN_BUTTON = rb.actions.PLA_DOWN
-local DOWNR_BUTTON = rb.actions.PLA_DOWN_REPEAT
-local EXIT_BUTTON = rb.actions.PLA_EXIT
-local LEFT_BUTTON = rb.actions.PLA_LEFT
-local LEFTR_BUTTON = rb.actions.PLA_LEFT_REPEAT
-local RIGHT_BUTTON = rb.actions.PLA_RIGHT
-local RIGHTR_BUTTON = rb.actions.PLA_RIGHT_REPEAT
-local SEL_BUTTON = rb.actions.PLA_SELECT
-local SELREL_BUTTON = rb.actions.PLA_SELECT_REL
-local SELR_BUTTON = rb.actions.PLA_SELECT_REPEAT
-local UP_BUTTON = rb.actions.PLA_UP
-local UPR_BUTTON = rb.actions.PLA_UP_REPEAT
]]
--------------------------------------------------------------------------------
-local function get_core_settings()
- if rb.core_color_table ~= nil and rb.core_talk_table ~= nil and
- rb.core_list_settings_table ~= nil then return end
-
- local rbs_is_loaded = (package.loaded.rbsettings ~= nil)
- local s_is_loaded = (package.loaded.settings ~= nil)
-
- require("rbsettings")
- require("settings")
- rb.metadata = nil -- remove track metadata settings
-
- local rb_settings = rb.settings.dump('global_settings', "system")
- local color_table = {}
- local talk_table = {}
- local list_settings_table = {}
- local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|"
- for key, value in pairs(rb_settings) do
- key = key or ""
- if (key:find("color")) then
- color_table[key]=value
- elseif (key:find("talk")) then
- talk_table[key]=value
- elseif (list_settings:find(key)) then
- list_settings_table[key]=value
- end
- end
-
- if not s_is_loaded then
- rb.settings = nil
- package.loaded.settings = nil
- end
-
- if not rbs_is_loaded then
- rb.system = nil
- rb.metadata = nil
- package.loaded.rbsettings = nil
- end
-
- rb.core_color_table = color_table
- rb.core_talk_table = talk_table
- rb.core_list_settings_table = list_settings_table
- collectgarbage("collect")
-end
-
--[[ cursor style button routine
-- left / right are x, xi is increment xir is increment when repeat
-- up / down are y, yi is increment yir is increment when repeat
@@ -112,44 +56,44 @@ local function dpad(x, xi, xir, y, yi, yir, timeout, overflow)
while true do
button = rb.get_plugin_action(timeout)
- if button == CANCEL_BUTTON then
+ if button == BUTTON.CANCEL then
cancel = 1
break;
- elseif button == EXIT_BUTTON then
+ elseif button == BUTTON.EXIT then
cancel = 1
break;
- elseif button == SEL_BUTTON then
+ elseif button == BUTTON.SEL then
select = 1
timeout = timeout + 1
- elseif button == SELR_BUTTON then
+ elseif button == BUTTON.SELR then
select = 2
timeout = timeout + 1
- elseif button == SELREL_BUTTON then
+ elseif button == BUTTON.SELREL then
select = -1
timeout = timeout + 1
- elseif button == LEFT_BUTTON then
+ elseif button == BUTTON.LEFT then
x_chg = x_chg - xi
if scroll_is_fixed then
cancel = 1
break;
end
- elseif button == LEFTR_BUTTON then
+ elseif button == BUTTON.LEFTR then
x_chg = x_chg - xir
- elseif button == RIGHT_BUTTON then
+ elseif button == BUTTON.RIGHT then
x_chg = x_chg + xi
if scroll_is_fixed then
select = 1
timeout = timeout + 1
end
- elseif button == RIGHTR_BUTTON then
+ elseif button == BUTTON.RIGHTR then
x_chg = x_chg + xir
- elseif button == UP_BUTTON then
+ elseif button == BUTTON.UP then
y_chg = y_chg + yi
- elseif button == UPR_BUTTON then
+ elseif button == BUTTON.UPR then
y_chg = y_chg + yir
- elseif button == DOWN_BUTTON then
+ elseif button == BUTTON.DOWN then
y_chg = y_chg - yi
- elseif button == DOWNR_BUTTON then
+ elseif button == BUTTON.DOWNR then
y_chg = y_chg - yir
elseif timeout >= 0 then--and rb.button_queue_count() < 1 then
break;
@@ -175,7 +119,6 @@ function print_menu(menu_t, func_t, selected, settings, copy_screen)
if selected then vcur = selected + 1 end
if vcur and vcur <= 1 then vcur = 2 end
- get_core_settings()
local c_table = rb.core_color_table or {}
if not settings then
@@ -239,7 +182,7 @@ function print_menu(menu_t, func_t, selected, settings, copy_screen)
if copy_screen == true then _LCD:copy(screen_img) end
if func_t and func_t[i] then
- if func_t[i](i, menu_t) == true then break end
+ if func_t[i](i, menu_t, func_t) == true then break end
else
break
end
diff --git a/apps/plugins/lua/include_lua/printsubmenu.lua b/apps/plugins/lua/include_lua/printsubmenu.lua
new file mode 100644
index 0000000000..f4b93db98d
--- /dev/null
+++ b/apps/plugins/lua/include_lua/printsubmenu.lua
@@ -0,0 +1,314 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+]]
+if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
+--GLOBALS
+menu_ctx = {}
+submenu_insert = table.insert
+submenu_remove = table.remove
+
+local last_ctx = false
+local p_settings
+local function empty_fn() end
+
+--[[root menu tables
+expanded menus get inserted / removed
+and context menus replace them but unless you
+want a new root menu they are never overwritten
+func_t functions get 3 variables passed by the menu_system
+func_t[i] =function sample(i, menu_t, func_t]
+this function gets run on user selection
+for every function in func_t:
+'i' is the selected item
+'menu_t' is the current strings table
+'func_t' is the current function table
+
+menu_t[i] will returnm the text of the item user selected and
+func_t[i] will return the function we are currently in
+]]
+
+menu_t = {}
+func_t = {}
+
+require("printmenus")
+
+local BUTTON = require("menubuttons")
+local last_sel = 0
+
+local function display_context_menu() end -- forward declaration
+
+local function dpad(x, xi, xir, y, yi, yir, timeout, overflow, selected)
+ local scroll_is_fixed = overflow ~= "manual"
+ if timeout == nil then timeout = -1 end
+ local cancel, select = 0, 0
+ local x_chg, y_chg = 0, 0
+ local button
+ while true do
+ button = rb.get_plugin_action(timeout)
+
+ if button == BUTTON.CANCEL then
+ cancel = 1
+ break;
+ elseif button == BUTTON.EXIT then
+ cancel = 1
+ break;
+ elseif button == BUTTON.SEL then
+ last_sel = 1
+ timeout = timeout + 1
+ elseif button == BUTTON.SELR then
+ last_sel = 2
+ if display_context_menu(selected or -1) == true then
+ select = 1
+ break;
+ end
+ timeout = timeout + 1
+ elseif button == BUTTON.SELREL then
+ if last_sel == 1 then
+ select = 1
+ end
+ last_sel = 0
+ timeout = timeout + 1
+ elseif button == BUTTON.LEFT then
+ x_chg = x_chg - xi
+ if scroll_is_fixed then
+ cancel = 1
+ break;
+ end
+ elseif button == BUTTON.LEFTR then
+ x_chg = x_chg - xir
+ elseif button == BUTTON.RIGHT then
+ x_chg = x_chg + xi
+ if scroll_is_fixed then
+ select = 1
+ timeout = timeout + 1
+ end
+ elseif button == BUTTON.RIGHTR then
+ x_chg = x_chg + xir
+ elseif button == BUTTON.UP then
+ y_chg = y_chg + yi
+ elseif button == BUTTON.UPR then
+ y_chg = y_chg + yir
+ elseif button == BUTTON.DOWN then
+ y_chg = y_chg - yi
+ elseif button == BUTTON.DOWNR then
+ y_chg = y_chg - yir
+ elseif timeout >= 0 then--and rb.button_queue_count() < 1 then
+ break;
+ end
+
+ if x_chg ~= 0 or y_chg ~= 0 then
+ timeout = timeout + 1
+ end
+ end
+
+ x = x + x_chg
+ y = y + y_chg
+
+ return cancel, select, x_chg, x, y_chg, y, 0xffff
+end -- dpad
+
+local function ctx_loop()
+ local loopfn = ctx_loop
+ ctx_loop = empty_fn() --prevent another execution
+ local mt, ft = get_menu()
+ local i
+ repeat
+ if menu_ctx.update then mt, ft = get_menu(); menu_ctx.update = false end
+ _, i = print_menu(mt, ft, menu_ctx.start, p_settings)
+ until menu_ctx.quit
+
+ ctx_loop = loopfn --restore for another run
+end
+
+--[[ push_ctx() save surrent menu and load another ]]
+local function push_ctx(new_getmenu)
+ last_ctx = last_ctx or {}
+ submenu_insert(last_ctx, menu_ctx)
+ menu_ctx.getmenu = get_menu
+ menu_ctx.settings = p_settings
+ --menu_ctx is a new variable after this point
+ submenu_set_defaults()
+ menu_ctx.update = true
+ if type(new_getmenu) == 'function' then
+ get_menu = new_getmenu
+ end
+end
+
+--[[ pop_ctx() restore last menu ]]
+local function pop_ctx()
+ menu_ctx = submenu_remove(last_ctx)
+ if menu_ctx then
+ get_menu = menu_ctx.getmenu
+ p_settings = menu_ctx.settings
+ if menu_ctx.restorefn then
+ menu_ctx.restorefn(menu_t, func_t)
+ menu_ctx.restorefn = nil
+ end
+ menu_ctx.getmenu = nil
+ menu_ctx.settings = nil
+ menu_ctx.update = true
+ return true
+ end
+end
+
+--[[ display_context_menu_internal() supplies a new get_menu function that returns
+ the context menu 'user_context_fn' supplied by set_menu()
+ this menu is immediately displayed and when finished will
+ automatically restore the last menu
+]]
+local function display_context_menu_internal(sel)
+ if sel <= 0 or not menu_ctx.user_context_fn then return false end
+ local parent = submenu_get_parent() or 0
+ local user_context_fn = menu_ctx.user_context_fn
+
+ local function display_context_menu(i, menu_t, func_t)
+ local function new_getmenu()
+ local mt, ft = user_context_fn(parent, i, menu_t, func_t)
+ ft[0] = pop_ctx --set back fn
+ return mt, ft
+ end
+ push_ctx(new_getmenu)
+ return true
+ end
+
+ --save the current function in closure restore_fn for later
+ local funct = func_t[sel]
+ local function restore_fn(mt, ft)
+ ft[sel] = funct
+ menu_ctx.start = sel - 1
+ end
+
+ menu_ctx.restorefn = restore_fn
+ -- insert into the current fn table so it gets execd by the menu
+ func_t[sel] = display_context_menu
+
+ return true
+end
+
+--[[ submenu_get_parent() gets the parent of the top most level
+ if lv is supplied it instead gets the parent of that level ]]
+function submenu_get_parent(lv)
+ lv = lv or #menu_ctx.collapse_fn or 1
+ collectgarbage("step")
+ local t = menu_ctx.collapse_fn[lv] or {}
+ return t[2] or -1, lv
+end
+
+--[[ submenu_collapse() collapses submenu till level or ROOT is reached ]]
+function submenu_collapse(parent, lv)
+ local lv_out, menu_sz = 0, 0
+ local item_out = -1
+ local items_removed = 0
+ if lv <= #menu_ctx.collapse_fn then
+ repeat
+ local collapse_fn = submenu_remove(menu_ctx.collapse_fn)
+ if collapse_fn then
+ lv_out, item_out, menu_sz = collapse_fn[1](parent, menu_t, func_t)
+ items_removed = items_removed + menu_sz
+ end
+
+ until not collapse_fn or lv >= lv_out
+ end
+ return lv_out, item_out, items_removed
+end
+
+--[[ submenu_create() supply level of submenu > 0, ROOT is lv 0
+ supply menu strings table and function table
+ closure returned run this function to expand the menu
+]]
+function submenu_create(lv, mt, ft)
+ if lv < 1 then error("Level < 1") end
+ if type(mt) ~= 'table' or type(ft) ~= 'table' then
+ error("mt and ft must be tables")
+ end
+
+ -- everything in lua is 1 based menu level is no exception
+ local lv_tab = string.rep ("\t", lv)
+ local function submenu_closure(i, m, f)
+ menu_ctx.lv = lv
+ local lv_out, menusz_out, start_item
+ local item_in, item_out = i, i
+ if lv <= #menu_ctx.collapse_fn then --something else expanded??
+ repeat
+ local collapse_fn = submenu_remove(menu_ctx.collapse_fn)
+ if collapse_fn then
+ lv_out, item_out, menusz_out = collapse_fn[1](i, m, f)
+ -- if the item i is below this menu, it needs to shift too
+ if item_in > item_out then i = i - (menusz_out) end
+ end
+ until not collapse_fn or lv >= lv_out
+ menu_ctx.start = i
+ if item_out == item_in then return end
+ end
+
+ local menu_sz = #mt
+ menu_ctx.start = i
+ start_item = i
+ menu_ctx.update = true
+ for item, _ in ipairs(mt) do
+ i = i + 1
+ submenu_insert(m, i, lv_tab .. mt[item])
+ submenu_insert(f, i, ft[item])
+ end
+
+ local function collapse_closure(i, m, f)
+ --creates a closure around lv, start_item and menu_sz
+ for j = 1, menu_sz, 1 do
+ submenu_remove(m, start_item + 1)
+ submenu_remove(f, start_item + 1)
+ end
+ return lv, start_item, menu_sz
+ end
+
+ submenu_insert(menu_ctx.collapse_fn, lv, {collapse_closure, start_item})
+ return true
+ end
+
+ return submenu_closure
+end
+
+--
+function submenu_set_defaults(settings, ctx)
+ p_settings = settings or {wrap = true, hasheader = true, justify = "left", dpad_fn = dpad}
+ menu_ctx = ctx or {collapse_fn = {}, lv = 0, update = false, start = 1}
+end
+
+--[[ get_menu() returns the ROOT string and fn tables]]
+function get_menu()
+ return menu_t, func_t
+end
+
+--[[ set_menu() set your menu and the menu has now been entered ]]
+function set_menu(mt, ft, user_context_fn, settings)
+
+ submenu_set_defaults(settings)
+ if type(user_context_fn) == 'function' then
+ display_context_menu = display_context_menu_internal
+ menu_ctx.user_context_fn = user_context_fn
+ else
+ display_context_menu = empty_fn
+ menu_ctx.user_context_fn = false
+ end
+ p_settings = settings or p_settings
+ menu_t, func_t = mt, ft
+ ctx_loop()
+end
diff --git a/apps/plugins/lua/include_lua/printtable.lua b/apps/plugins/lua/include_lua/printtable.lua
index c23d801f83..c70fc1343f 100644
--- a/apps/plugins/lua/include_lua/printtable.lua
+++ b/apps/plugins/lua/include_lua/printtable.lua
@@ -22,28 +22,12 @@
]]
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
-require("actions") -- Contains rb.actions & rb.contexts
-
local _clr = require("color")
local _print = require("print")
local _timer = require("timer")
+local BUTTON = require("menubuttons")
local sb_width = 5
--- Button definitions --
-local CANCEL_BUTTON = rb.actions.PLA_CANCEL
-local DOWN_BUTTON = rb.actions.PLA_DOWN
-local DOWNR_BUTTON = rb.actions.PLA_DOWN_REPEAT
-local EXIT_BUTTON = rb.actions.PLA_EXIT
-local LEFT_BUTTON = rb.actions.PLA_LEFT
-local LEFTR_BUTTON = rb.actions.PLA_LEFT_REPEAT
-local RIGHT_BUTTON = rb.actions.PLA_RIGHT
-local RIGHTR_BUTTON = rb.actions.PLA_RIGHT_REPEAT
-local SEL_BUTTON = rb.actions.PLA_SELECT
-local SELREL_BUTTON = rb.actions.PLA_SELECT_REL
-local SELR_BUTTON = rb.actions.PLA_SELECT_REPEAT
-local UP_BUTTON = rb.actions.PLA_UP
-local UPR_BUTTON = rb.actions.PLA_UP_REPEAT
-
-- clamps value to >= min and <= max
local function clamp(iVal, iMin, iMax)
if iMin > iMax then
@@ -71,7 +55,7 @@ end
-- time since last button press is returned in ticks..
-- make xi, xir, yi, yir negative to flip direction...
]]
-local function dpad(x, xi, xir, y, yi, yir, timeout, overflow)
+local function dpad(x, xi, xir, y, yi, yir, timeout, overflow, selected)
local scroll_is_fixed = overflow ~= "manual"
_timer("dpad") -- start a persistant timer; keeps time between button events
if timeout == nil then timeout = -1 end
@@ -81,44 +65,44 @@ local function dpad(x, xi, xir, y, yi, yir, timeout, overflow)
while true do
button = rb.get_plugin_action(timeout)
- if button == CANCEL_BUTTON then
+ if button == BUTTON.CANCEL then
cancel = 1
break;
- elseif button == EXIT_BUTTON then
+ elseif button == BUTTON.EXIT then
cancel = 1
break;
- elseif button == SEL_BUTTON then
+ elseif button == BUTTON.SEL then
select = 1
timeout = timeout + 1
- elseif button == SELR_BUTTON then
+ elseif button == BUTTON.SELR then
select = 2
timeout = timeout + 1
- elseif button == SELREL_BUTTON then
+ elseif button == BUTTON.SELREL then
select = -1
timeout = timeout + 1
- elseif button == LEFT_BUTTON then
+ elseif button == BUTTON.LEFT then
x_chg = x_chg - xi
if scroll_is_fixed then
cancel = 1
break;
end
- elseif button == LEFTR_BUTTON then
+ elseif button == BUTTON.LEFTR then
x_chg = x_chg - xir
- elseif button == RIGHT_BUTTON then
+ elseif button == BUTTON.RIGHT then
x_chg = x_chg + xi
if scroll_is_fixed then
select = 1
timeout = timeout + 1
end
- elseif button == RIGHTR_BUTTON then
+ elseif button == BUTTON.RIGHTR then
x_chg = x_chg + xir
- elseif button == UP_BUTTON then
+ elseif button == BUTTON.UP then
y_chg = y_chg + yi
- elseif button == UPR_BUTTON then
+ elseif button == BUTTON.UPR then
y_chg = y_chg + yir
- elseif button == DOWN_BUTTON then
+ elseif button == BUTTON.DOWN then
y_chg = y_chg - yi
- elseif button == DOWNR_BUTTON then
+ elseif button == BUTTON.DOWNR then
y_chg = y_chg - yir
elseif timeout >= 0 then--and rb.button_queue_count() < 1 then
break;
@@ -247,7 +231,8 @@ function print_table(t, t_count, settings)
rb.lcd_update()
local quit, select, x_chg, xi, y_chg, yi, timeb =
- dpad_fn(t_p.col, -1, -t_p.col_scrl, t_p.row, -1, -t_p.row_scrl, nil, overflow)
+ dpad_fn(t_p.col, -1, -t_p.col_scrl, t_p.row, -1, -t_p.row_scrl,
+ nil, overflow, (t_p.row + t_p.vcursor - 1))
t_p.vcursor = t_p.vcursor + y_chg
@@ -316,7 +301,7 @@ function print_table(t, t_count, settings)
if t[i] == nil then
rb.splash(1, string.format("ERROR %d is nil", i))
t[i] = "???"
- if rb.get_plugin_action(10) == CANCEL_BUTTON then return 0 end
+ if rb.get_plugin_action(10) == BUTTON.CANCEL then return 0 end
end
if m_sel == true and t[i]:sub(-1) == "\0" then
@@ -351,6 +336,16 @@ function print_table(t, t_count, settings)
table_p = init_position(15, 5)
line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2)
+
+ if (curpos or 0) > maxline then
+ local c = maxline / 2
+ start = (start or 1) + curpos - maxline
+ curpos = maxline
+ while start + maxline <= t_count and curpos > c do
+ curpos = curpos - 1
+ start = start + 1
+ end
+ end
maxline = math.min(maxline, t_count)
-- allow user to start at a position other than the beginning
diff --git a/apps/plugins/lua/include_lua/rbsettings.lua b/apps/plugins/lua/include_lua/rbsettings.lua
index defdb11b77..995e5023c9 100644
--- a/apps/plugins/lua/include_lua/rbsettings.lua
+++ b/apps/plugins/lua/include_lua/rbsettings.lua
@@ -151,12 +151,15 @@ function rb.settings.read(s_settings, s_var, s_groupname)
return data
end
-function rb.settings.dump(s_settings, s_groupname, s_structname, t_output)
+function rb.settings.dump(s_settings, s_groupname, s_structname, t_output, fn_filter)
t_output = t_output or {}
+ fn_filter = fn_filter or function(s,k) return true end
local tgroup = rb[s_groupname]
s_structname = s_structname or s_settings
for k, v in pairs(tgroup[s_structname]) do
- t_output[k] = rb.settings.read(s_settings, v, s_groupname)
+ if fn_filter(s_structname, k) then
+ t_output[k] = rb.settings.read(s_settings, v, s_groupname)
+ end
end
return t_output
end
diff --git a/apps/plugins/lua/include_lua/temploader.lua b/apps/plugins/lua/include_lua/temploader.lua
new file mode 100644
index 0000000000..7fd58aee99
--- /dev/null
+++ b/apps/plugins/lua/include_lua/temploader.lua
@@ -0,0 +1,63 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+--
+temp_loader allows some (pure) lua requires to be loaded and later garbage collected
+unfortunately the 'required' module needs to be formatted in such a way to
+pass back a reference to a function or call table in order to keep the functions
+within from being garbage collected too early
+
+modules that add things to _G table are unaffected by using this function
+except if later you use require or temp_loader those tables will again
+be reloaded with fresh data since nothing was recorded about the module being loaded
+
+modulename - same as require()
+newinstance == true -- get a new copy (from disk) of the module
+... other args for the module
+
+BE AWARE this bypasses the module loader
+which would allow code reuse so if you aren't careful this memory saving tool
+could spell disaster for free RAM if you load the same code multiple times
+--]]
+
+local function tempload(modulename, newinstance, ...)
+ --http://lua-users.org/wiki/LuaModulesLoader
+ local errmsg = ""
+ -- Is there current a loaded module by this name?
+ if package.loaded[modulename] ~= nil and not newinstance then
+ return require(modulename)
+ end
+ -- Find source
+ local modulepath = string.gsub(modulename, "%.", "/")
+ for path in string.gmatch(package.path, "([^;]+)") do
+ local filename = string.gsub(path, "%?", modulepath)
+ --attempt to open and compile module
+ local file, err = loadfile(filename)
+ if file then
+ -- execute the compiled chunk
+ return file(... or modulename)
+ end
+ errmsg = table.concat({errmsg, "\n\tno file '", filename, "' (temp loader)"})
+ end
+ return nil, errmsg
+end
+
+return tempload
diff --git a/apps/plugins/lua/lauxlib.c b/apps/plugins/lua/lauxlib.c
index acd7e0e636..b8332427f0 100644
--- a/apps/plugins/lua/lauxlib.c
+++ b/apps/plugins/lua/lauxlib.c
@@ -268,7 +268,8 @@ static int latebind_func_index(lua_State *L)
const char *name = lua_tostring(L, -1);
lua_pushstring (L, "__latebind");/* basetable;name;__latebind;*/
- lua_rawget (L, -3);/* basetable;name;__latebind(t);*/
+ if(lua_istable(L, -3))
+ lua_rawget (L, -3);/* basetable;name;__latebind(t);*/
luaL_argcheck(L, lua_istable(L, -3) && lua_istable(L, -1), 1,
"__latebind table expected");
@@ -324,25 +325,31 @@ static int latebind_func_pairs(lua_State *L)
{
/* basetable @ top of stack 1(basetable)-1 */
luaL_argcheck(L, lua_istable(L, 1), 1, "table expected");
- lua_getglobal(L, "pairs"); /* function to be called / returned (btable;pairs) */
- lua_createtable(L, 0, 15); /* btable;pairs;newtable; */
- /* clone base table */
+#if 0
+ lua_getglobal(L, "next"); /* function to be called / returned (btable;next) */
+ lua_createtable(L, 0, 15); /* btable;next;newtable; */
+ lua_pushnil(L); /* nil name retrieves all unbound latebound functions */
lua_pushnil(L); /* first key */
- while(lua_next(L, 1) != 0) {
- /* (btable;pairs;ntable;k;v) */
+#else
+ /* this way is more RAM efficient in testing */
+ if(luaL_dostring(L, "return next, {}, nil, nil")!= 0)
+ lua_error(L);
+#endif
+ /* (btable;next;ntable;nil;nil) */
+ /* clone base table */
+ while(lua_next(L, 1) > 0) {
+ /* (btable;next;ntable;nil;k;v) */
lua_pushvalue(L, -2); /* dupe key Stk = (..;k;v -> ..k;v;k)*/
lua_insert(L, -2); /* Stk = (..k;k;v) */
- lua_rawset(L, 3); /* btable;pairs;ntable;k */
+ lua_rawset(L, -5); /* btable;next;ntable;nil;k */
}
-
- lua_pushnil(L); /*nil name retrieves all unbound late bound functions */
- latebind_func_index(L);/* (btable;pairs;ntable;nil) -> (btable;pairs;ntable) */
-
- /* (btable;pairs;ntable) */
- lua_call(L, 1, 3); /* pairs(ntable) -> (btable;iter;state;value) */
-
- return 3;
+ /* fill the new table with all the latebound functions */
+ /* nil name retrieves all unbound latebound functions */
+ latebind_func_index(L);/* (btable;next;ntable;nil) -> (btable;next;ntable) */
+ lua_pushnil(L); /*nil initial key for next*/
+ /* stack = (btable;next;ntable;nil) */
+ return 3; /*(next,ntable,nil)*/
}
diff --git a/apps/plugins/lua/loadlib.c b/apps/plugins/lua/loadlib.c
index 1e310beed1..732ad707b5 100644
--- a/apps/plugins/lua/loadlib.c
+++ b/apps/plugins/lua/loadlib.c
@@ -130,9 +130,11 @@ static int ll_require (lua_State *L) {
lua_pushliteral(L, ""); /* error message accumulator */
for (i=1; ; i++) {
lua_rawgeti(L, -2, i); /* get a loader */
- if (lua_isnil(L, -1))
+ if (lua_isnil(L, -1)) {
+ lua_setfield(L, 2, name); /* _LOADED[name] = nil */
luaL_error(L, "module " LUA_QS " not found:%s",
name, lua_tostring(L, -2));
+ }
lua_pushstring(L, name);
lua_call(L, 1, 1); /* call it */
if (lua_isfunction(L, -1)) /* did it find module? */
diff --git a/apps/plugins/lua/lparser.c b/apps/plugins/lua/lparser.c
index 8b93237918..23d3972036 100644
--- a/apps/plugins/lua/lparser.c
+++ b/apps/plugins/lua/lparser.c
@@ -603,7 +603,12 @@ static void parlist (LexState *ls) {
} while (!f->is_vararg && testnext(ls, ','));
}
adjustlocalvars(ls, nparams);
+ //f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));
+#if defined(LUA_COMPAT_VARARG)
f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));
+#else
+ f->numparams = cast_byte(fs->nactvar);
+#endif
luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
}
diff --git a/apps/plugins/lua/lua.make b/apps/plugins/lua/lua.make
index 1e74277549..60dfd24cdd 100644
--- a/apps/plugins/lua/lua.make
+++ b/apps/plugins/lua/lua.make
@@ -16,11 +16,14 @@ LUA_OBJ := $(call c2obj, $(LUA_SRC))
OTHER_SRC += $(LUA_SRC)
LUA_INCLUDEDIR := $(LUA_SRCDIR)/include_lua
-LUA_INCLUDELIST := $(addprefix $(LUA_BUILDDIR)/,audio.lua blit.lua color.lua draw.lua draw_floodfill.lua draw_poly.lua \
- draw_num.lua draw_text.lua files.lua image.lua image_save.lua lcd.lua math_ex.lua \
- print.lua timer.lua playlist.lua pcm.lua sound.lua printmenus.lua\
- rbcompat.lua rbsettings.lua poly_points.lua printtable.lua)
-
+LUA_INCLUDELIST := $(addprefix $(LUA_BUILDDIR)/,audio.lua blit.lua color.lua \
+ draw.lua draw_floodfill.lua draw_poly.lua draw_num.lua \
+ draw_text.lua files.lua image.lua image_save.lua lcd.lua \
+ math_ex.lua print.lua timer.lua playlist.lua pcm.lua \
+ sound.lua rbcompat.lua rbsettings.lua poly_points.lua \
+ printtable.lua printmenus.lua printsubmenu.lua \
+ menubuttons.lua menucoresettings.lua create_kbd_layout.lua \
+ temploader.lua)
ifndef APP_TYPE
ROCKS += $(LUA_BUILDDIR)/lua.rock
diff --git a/apps/plugins/lua/rbdefines_helper.pl b/apps/plugins/lua/rbdefines_helper.pl
index eca09187fa..e788855e87 100755
--- a/apps/plugins/lua/rbdefines_helper.pl
+++ b/apps/plugins/lua/rbdefines_helper.pl
@@ -47,7 +47,7 @@ if ($def_type eq "rb_defines") {
'^PLAYLIST_(INSERT|PREPEND|REPLACE)',
'^TOUCHSCREEN_(POINT|BUTTON)$',
'^SYS_CHARGER_(DIS|)CONNECTED$',
- '^SYS_(TIMEOUT|POWEROFF)$',
+ '^SYS_(TIMEOUT|POWEROFF|BATTERY_UPDATE)$',
'^SYS_USB_(DIS|)CONNECTED$',
'^HOME_DIR$',
'^PLUGIN_DIR$',
diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c
index 25bace3451..929dea798b 100644
--- a/apps/plugins/lua/rockaux.c
+++ b/apps/plugins/lua/rockaux.c
@@ -52,6 +52,8 @@ char *strerror(int errnum)
*/
int splash_scroller(int timeout, const char* str)
{
+ if (!str)
+ str = "[nil]";
int w, ch_w, ch_h;
rb->lcd_getstringsize("W", &ch_w, &ch_h);
@@ -104,7 +106,8 @@ int splash_scroller(int timeout, const char* str)
{
brk = strpbrk_n(ch+1, max_ch, break_chars);
chars_next_break = (brk - ch);
- if (chars_next_break < 2 || w + (ch_w * chars_next_break) > max_w)
+ if (brk &&
+ (chars_next_break < 2 || w + (ch_w * chars_next_break) > max_w))
{
if (!isprint(line[linepos]))
{
@@ -133,28 +136,32 @@ int splash_scroller(int timeout, const char* str)
}
rb->lcd_update();
-
- action = rb->get_action(CONTEXT_STD, timeout);
- switch(action)
+ if (timeout >= TIMEOUT_BLOCK)
{
- case ACTION_STD_OK:
- case ACTION_STD_CANCEL:
- cycles--;
- /* Fall Through */
- case ACTION_NONE:
- cycles--;
- break;
- case ACTION_STD_PREV:
- timeout = TIMEOUT_BLOCK; /* disable timeout */
- if(firstline > 0)
- firstline--;
- break;
- case ACTION_STD_NEXT:
- timeout = TIMEOUT_BLOCK; /* disable timeout */
- if (linesdisp == max_lines)
- firstline++;
- break;
+ action = rb->get_action(CONTEXT_STD, timeout);
+ switch(action)
+ {
+ case ACTION_STD_OK:
+ case ACTION_STD_CANCEL:
+ cycles--;
+ /* Fall Through */
+ case ACTION_NONE:
+ cycles--;
+ break;
+ case ACTION_STD_PREV:
+ timeout = TIMEOUT_BLOCK; /* disable timeout */
+ if(firstline > 0)
+ firstline--;
+ break;
+ case ACTION_STD_NEXT:
+ timeout = TIMEOUT_BLOCK; /* disable timeout */
+ if (linesdisp == max_lines)
+ firstline++;
+ break;
+ }
}
+ else
+ break;
}
return action;
}
@@ -220,7 +227,7 @@ int get_current_path(lua_State *L, int level)
}
}
- lua_pushnil(L);
+ lua_pushnil(L);
return 1;
}
@@ -244,25 +251,32 @@ int filetol(int fd, long *num)
while (rb->read(fd, &chbuf, 1) == 1)
{
- if(!isspace(chbuf) || retn == 1)
+ if(retn || !isspace(chbuf))
{
- if(chbuf == '0') /* strip preceeding zeros */
- {
- *num = 0;
- retn = 1;
- }
- else if(chbuf == '-' && retn != 1)
- neg = true;
- else
+ switch(chbuf)
{
- rb->lseek(fd, -1, SEEK_CUR);
- break;
+ case '-':
+ {
+ if (retn) /* 0 preceeds, this negative sign must be in error */
+ goto get_digits;
+ neg = true;
+ continue;
+ }
+ case '0': /* strip preceeding zeros */
+ {
+ *num = 0;
+ retn = 1;
+ continue;
+ }
+ default:
+ goto get_digits;
}
}
}
while (rb->read(fd, &chbuf, 1) == 1)
{
+get_digits:
if(!isdigit(chbuf))
{
rb->lseek(fd, -1, SEEK_CUR);
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 81b6f4ce2a..2672d446fc 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -143,10 +143,17 @@ RB_WRAP(touchscreen_mode)
RB_WRAP(kbd_input)
{
+ /*kbd_input(text, layout)*
+ note: layout needs special formatting
+ see includes/create_kbd_layout.lua
+ or lib/kbd_helper.c
+ */
luaL_Buffer b;
luaL_buffinit(L, &b);
const char *input = lua_tostring(L, 1);
+ size_t layout_len;
+ const unsigned char *layout = lua_tolstring(L, 2, &layout_len);
char *buffer = luaL_prepbuffer(&b);
if(input != NULL)
@@ -154,7 +161,14 @@ RB_WRAP(kbd_input)
else
buffer[0] = '\0';
- if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, NULL))
+ if(layout_len <= 2 ||
+ layout[layout_len - 1] != 0xFE ||
+ layout[layout_len - 2] != 0xFF)
+ {
+ layout = NULL;
+ }
+
+ if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, (unsigned short *)layout))
{
luaL_addstring(&b, buffer);
luaL_pushresult(&b);
diff --git a/apps/plugins/lua_scripts/print_buttons.lua b/apps/plugins/lua_scripts/print_buttons.lua
new file mode 100644
index 0000000000..1b488ddd64
--- /dev/null
+++ b/apps/plugins/lua_scripts/print_buttons.lua
@@ -0,0 +1,70 @@
+-- bilgus 4/2021
+require "buttons"
+local BUTTON_NONE = 0
+
+local function decode_ord_btn(btn)
+ local btntxt = ""
+ for k, v in pairs(rb.buttons) do
+ if btn > BUTTON_NONE and v ~= BUTTON_NONE and bit.band(btn, v) == v then
+ if #btntxt > 0 then
+ btntxt = btntxt .. " | "
+ end
+ btntxt = btntxt .. k
+ end
+ end
+ if btntxt == "" then return nil end
+ return btntxt
+end
+
+local _, w, h = rb.font_getstringsize("W", rb.FONT_UI)
+local max_lines = rb.LCD_HEIGHT / h - 1
+
+button_text = {}
+for k, v in pairs(rb.buttons) do
+ button_text[v] = k
+end
+
+--Add the system button codes to the button_text table
+for k, v in pairs(rb) do
+ if string.find(k or "", "SYS_", 1, true) and type(v) == "number" then
+ button_text[v] = k
+ end
+end
+
+local s = {[1] = "Buttons Found:"}
+for k, v in pairs(button_text) do
+ table.insert(s, tostring(k) .. " : " .. tostring(v))
+end
+rb.splash_scroller(rb.HZ, table.concat(s, "\n"))
+
+button_text[BUTTON_NONE] = " "
+
+local lastbtn = BUTTON_NONE
+local lastkey = BUTTON_NONE
+local s_t = {"Press same button 3x to exit"}
+local keyrpt = 0
+
+repeat
+
+ local btn
+ if lastbtn == BUTTON_NONE then
+ btn = rb.button_get(true)
+ else
+ btn = rb.button_get_w_tmo(rb.HZ)
+ end
+
+ if btn ~= lastkey then
+ table.insert(s_t, 1, (button_text[btn] or decode_ord_btn(btn) or "unknown " .. tostring (btn)))
+ end
+
+ if btn == lastbtn then keyrpt = keyrpt + 1 end
+ if button_text[btn] then lastbtn = btn end
+ lastkey = btn
+
+ rb.splash_scroller(-2, table.concat(s_t, "\n"))
+
+ if #s_t > max_lines then
+ table.remove(s_t)
+ end
+
+until keyrpt >= 2
diff --git a/apps/plugins/lua_scripts/print_lua_func.lua b/apps/plugins/lua_scripts/print_lua_func.lua
index ef0290bbd8..8519914d5f 100644
--- a/apps/plugins/lua_scripts/print_lua_func.lua
+++ b/apps/plugins/lua_scripts/print_lua_func.lua
@@ -1,23 +1,26 @@
+
--RB LUA show all global variables; BILGUS
-require "actions"
-require "audio"
-require "buttons"
-require "color"
-require "draw"
-require "draw_floodfill"
-require "draw_poly"
-require "draw_text"
-
-require "image"
-require "image_save"
-
-require "lcd"
-require "math_ex"
-require "pcm"
-require "playlist"
-require "print"
---require "settings" --uses a lot of memory
-require "sound"
+if not ... then --if executed directly this is nil
+ require "actions"
+ require "audio"
+ require "buttons"
+ require "color"
+ require "draw"
+ require "draw_floodfill"
+ require "draw_poly"
+ require "draw_text"
+
+ require "image"
+ require "image_save"
+
+ require "lcd"
+ require "math_ex"
+ require "pcm"
+ require "playlist"
+ require "print"
+ --require "settings" --uses a lot of memory
+ require "sound"
+end
collectgarbage("collect")
local sDumpFile = "/rb-lua_functions.txt"
@@ -276,8 +279,9 @@ end
for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- reuse table
end
end
-
- tcBase= nil tkSortCbase= nil
+ if ... then
+ tcBase= nil tkSortCbase= nil
+ end
tWriteBuf[#tWriteBuf + 1] = "\r\n"
tWriteBuf[#tWriteBuf + 1] = dtTag("?")
tWriteBuf[#tWriteBuf + 1] = "\r\n\r\n"
@@ -306,5 +310,29 @@ end
filehandle:write(table.concat(tWriteBuf))
for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- empty table
filehandle:close()
- rb.splash(rb.HZ * 5, n .. " Items dumped to : " .. sDumpFile)
+ --rb.splash((rb.HZ or 100) * 5, n .. " Items dumped to : " .. sDumpFile)
--rb.splash(500, collectgarbage("count"))
+if not ... then
+ local lu = collectgarbage("collect")
+ local used, allocd, free = rb.mem_stats()
+ local lu = collectgarbage("count")
+ local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end
+ local s_t = {}
+ s_t[1] = n
+ s_t[2] = " Items dumped to:\n"
+ s_t[3] = sDumpFile
+ s_t[4] = "\n\nLoaded Modules:\n"
+ n = 0
+ for k, v in pairsByPairs(tcBase, tkSortCbase ) do
+ n = n + 1
+ if n ~= 1 then
+ s_t[#s_t + 1] = ", "
+ end
+ s_t[#s_t + 1] = tostring(k)
+ if n >= 3 then -- split loaded modules to multiple lines
+ n = 0
+ s_t[#s_t + 1] = "\n"
+ end
+ end
+ rb.splash_scroller(5 * (rb.HZ or 100), table.concat(s_t))
+end
diff --git a/apps/plugins/lua_scripts/submenu_demo.lua b/apps/plugins/lua_scripts/submenu_demo.lua
new file mode 100644
index 0000000000..8eac825474
--- /dev/null
+++ b/apps/plugins/lua_scripts/submenu_demo.lua
@@ -0,0 +1,121 @@
+--Bilgus 4/2021 Menu with subitems and context demo
+require("printsubmenu")
+
+local scrpath = rb.current_path()
+
+local function get_ctx_menu(parent, sel, menu_t, func_t)
+ local mt = {"Context menu " .. (menu_t[parent] or "ROOT") ..
+ " : " .. menu_t[sel], "Quit", "Action 1", "Action 2"}
+ local ft = {false, function() menu_ctx.quit = true return true end}
+ return mt, ft
+end
+
+local function ITEM_MENU()
+
+ local function flung(i, menu_t, func_t)
+ local parent = submenu_get_parent() or 0
+ rb.splash(100, "flung " .. (menu_t[parent] or "?"))
+ end
+
+ local function foo(i, menu_t, func_t)
+ local parent = submenu_get_parent() or 0
+ rb.splash(100, "FOO " .. menu_t[parent])
+ end
+
+ local function far(i, menu_t, func_t)
+ local parent = submenu_get_parent() or 0
+ rb.splash(100, "far" .. menu_t[parent])
+ end
+
+ return {"Flung", "FOO", "Far"},
+ {flung, foo, far}
+end
+
+local function USERITEMS()
+ local lv = 2
+ local mt = {"Item_1", "Item_2", "Item_3"}
+ local ft = {}
+
+ local function insert_item(i, name, func) --closure
+ submenu_insert(mt, i, name)
+ submenu_insert(ft, i, func)
+ end
+
+ for i = 1, #mt, 1 do
+ ft[i] = submenu_create(lv, ITEM_MENU())
+ end
+
+ local function add_new(i, menu_t, func_t)
+ local parent, lv = submenu_get_parent(lv - 1)
+ local last = #mt
+ local name = "Item_" .. tostring(last)
+ local func = submenu_create(lv + 1, ITEM_MENU())
+
+ local lv_out, item_out, removed = submenu_collapse(parent, lv + 1)-- collapse others
+ submenu_collapse(parent, lv) -- collapse the parent
+
+ insert_item(last, name, func)
+
+ func_t[parent](parent, menu_t, func_t) -- reopen parent
+ menu_ctx.start = i - removed
+ return true
+ end
+
+ local next = #mt + 1
+ insert_item(next, "Add New", add_new)
+ return mt, ft
+end
+
+local function MAIN_MENU()
+
+ local function go_back(i, m, f)
+ local parent = submenu_get_parent() or 0
+ if parent > 0 then
+ f[parent](parent, m, f)
+ else
+ menu_ctx.quit = true
+ end
+ menu_ctx.start = parent - 1
+ return true
+ end
+
+ local mt = {
+ [1] = "lua Menu Demo",
+ [2] = "Items",
+ [3] = "Back",
+ }
+
+ local ft = {
+ [0] = go_back, --if user cancels do this function
+ [1] = false, -- shouldn't happen title occupies this slot
+ [2] = submenu_create(1, USERITEMS()),
+ [3] = go_back,
+ }
+ return mt, ft, get_ctx_menu
+end
+
+function ShowMain()
+ set_menu(MAIN_MENU())
+end
+
+--ShowMainMenu()
+ShowMain()
+rb.lcd_clear_display()
+rb.lcd_update()
+local lu = collectgarbage("collect")
+local used, allocd, free = rb.mem_stats()
+local lu = collectgarbage("count")
+local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end
+
+-- this is how lua recommends to concat strings rather than ..
+local s_t = {}
+s_t[1] = "rockbox:\n"
+s_t[2] = fmt("Used ", used)
+s_t[3] = fmt("Allocd ", allocd)
+s_t[4] = fmt("Free ", free)
+s_t[5] = "\nlua:\n"
+s_t[6] = fmt("Used", lu * 1024)
+s_t[7] = "\n\nNote that the rockbox used count is a high watermark"
+rb.splash_scroller(5 * rb.HZ, table.concat(s_t))
+--require("print_lua_func")
+os.exit(1, "Goodbye")
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c
index f07cdd4dcf..a28d1d3862 100644
--- a/apps/plugins/midi/midiplay.c
+++ b/apps/plugins/midi/midiplay.c
@@ -140,14 +140,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define MIDI_QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MIDI_QUIT BUTTON_POWER
-#define MIDI_FFWD BUTTON_RIGHT
-#define MIDI_REWIND BUTTON_LEFT
-#define MIDI_VOL_UP BUTTON_STOP
-#define MIDI_VOL_DOWN BUTTON_PLAY
-#define MIDI_PLAYPAUSE BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MIDI_QUIT BUTTON_BACK
#define MIDI_FFWD BUTTON_RIGHT
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index 7c5084529b..db10185c91 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -2443,12 +2443,6 @@ static void get_mp3_filename(const char *wav_name)
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define MP3ENC_DONE BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MP3ENC_PREV BUTTON_LEFT
-#define MP3ENC_NEXT BUTTON_RIGHT
-#define MP3ENC_DONE BUTTON_POWER
-#define MP3ENC_SELECT BUTTON_PLAY
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MP3ENC_PREV BUTTON_UP
#define MP3ENC_NEXT BUTTON_DOWN
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index d59797eaa7..505f3aa33d 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -142,14 +142,6 @@ struct mpeg_settings settings;
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define MPEG_START_TIME_EXIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MPEG_START_TIME_SELECT BUTTON_MENU
-#define MPEG_START_TIME_LEFT BUTTON_LEFT
-#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
-#define MPEG_START_TIME_UP BUTTON_STOP
-#define MPEG_START_TIME_DOWN BUTTON_PLAY
-#define MPEG_START_TIME_EXIT BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MPEG_START_TIME_SELECT BUTTON_SELECT
#define MPEG_START_TIME_LEFT BUTTON_LEFT
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 6b18e4fa3a..34eafd5d9c 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -254,15 +254,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define MPEG_VOLDOWN BUTTON_MINUS
#define MPEG_VOLUP BUTTON_PLUS
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MPEG_MENU BUTTON_MENU
-#define MPEG_STOP BUTTON_STOP
-#define MPEG_PAUSE BUTTON_PLAY
-#define MPEG_VOLDOWN BUTTON_VOLDOWN
-#define MPEG_VOLUP BUTTON_VOLUP
-#define MPEG_RW BUTTON_LEFT
-#define MPEG_FF BUTTON_RIGHT
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MPEG_MENU BUTTON_MENU
#define MPEG_STOP BUTTON_BACK
diff --git a/apps/plugins/pacbox/pacbox.h b/apps/plugins/pacbox/pacbox.h
index c1a1c6b9e5..a3d42b099c 100644
--- a/apps/plugins/pacbox/pacbox.h
+++ b/apps/plugins/pacbox/pacbox.h
@@ -169,18 +169,6 @@
#define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define PACMAN_UP BUTTON_STOP
-#define PACMAN_DOWN BUTTON_PLAY
-#define PACMAN_LEFT BUTTON_LEFT
-#define PACMAN_RIGHT BUTTON_RIGHT
-#define PACMAN_1UP BUTTON_VOLDOWN
-#define PACMAN_2UP BUTTON_VOLUP
-#define PACMAN_COIN_PRE BUTTON_MENU
-#define PACMAN_COIN (BUTTON_MENU | BUTTON_PLAY)
-#define PACMAN_MENU BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define PACMAN_UP BUTTON_UP
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c
index 498aa36357..f089c38023 100644
--- a/apps/plugins/pegbox.c
+++ b/apps/plugins/pegbox.c
@@ -95,23 +95,6 @@
#define LVL_UP_TEXT "PLAY"
#define LVL_DOWN_TEXT "-"
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define PEGBOX_SELECT BUTTON_MODE
-#define PEGBOX_QUIT BUTTON_PLAY
-#define PEGBOX_RESTART (BUTTON_EQ|BUTTON_MODE)
-#define PEGBOX_LVL_UP (BUTTON_EQ|BUTTON_UP)
-#define PEGBOX_LVL_DOWN (BUTTON_EQ|BUTTON_DOWN)
-#define PEGBOX_UP BUTTON_UP
-#define PEGBOX_DOWN BUTTON_DOWN
-#define PEGBOX_RIGHT BUTTON_RIGHT
-#define PEGBOX_LEFT BUTTON_LEFT
-
-#define SELECT_TEXT "MODE"
-#define QUIT_TEXT "PLAY"
-#define RESTART_TEXT "EQ+MODE"
-#define LVL_UP_TEXT "EQ+UP"
-#define LVL_DOWN_TEXT "EQ+DOWN"
-
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
#define PEGBOX_SELECT BUTTON_PLAY
#define PEGBOX_QUIT BUTTON_POWER
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 42930f0ff6..9731d92d35 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -103,10 +103,8 @@ const struct button_mapping pf_context_buttons[] =
{PF_SELECT, BUTTON_CENTER, BUTTON_NONE},
{PF_BACK, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
#endif
-#if CONFIG_KEYPAD == SANSA_C100_PAD
- {PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
-#elif CONFIG_KEYPAD == CREATIVEZV_PAD || CONFIG_KEYPAD == CREATIVEZVM_PAD || \
- CONFIG_KEYPAD == PHILIPS_HDD1630_PAD || CONFIG_KEYPAD == IAUDIO67_PAD || \
+#if CONFIG_KEYPAD == CREATIVEZV_PAD || CONFIG_KEYPAD == CREATIVEZVM_PAD || \
+ CONFIG_KEYPAD == PHILIPS_HDD1630_PAD || \
CONFIG_KEYPAD == GIGABEAT_PAD || CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == MROBE100_PAD || CONFIG_KEYPAD == MROBE500_PAD || \
CONFIG_KEYPAD == PHILIPS_SA9200_PAD || CONFIG_KEYPAD == SANSA_CLIP_PAD || \
@@ -130,15 +128,11 @@ const struct button_mapping pf_context_buttons[] =
#endif
#elif CONFIG_KEYPAD == SANSA_E200_PAD
{PF_QUIT, BUTTON_POWER, BUTTON_NONE},
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
- {PF_QUIT, BUTTON_EQ, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD) \
|| (CONFIG_KEYPAD == MPIO_HD300_PAD)
{PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
-#elif CONFIG_KEYPAD == LOGIK_DAX_PAD
- {PF_QUIT, BUTTON_POWERPLAY|BUTTON_REPEAT, BUTTON_POWERPLAY},
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{PF_QUIT, BUTTON_RC_REC, BUTTON_NONE},
#elif CONFIG_KEYPAD == MEIZU_M6SL_PAD
@@ -154,6 +148,15 @@ const struct button_mapping pf_context_buttons[] =
{PF_CONTEXT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_FFWD},
{PF_TRACKLIST, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD},
{PF_WPS, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
+#elif CONFIG_KEYPAD == FIIO_M3K_PAD
+ {PF_PREV, BUTTON_LEFT, BUTTON_NONE},
+ {PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_NEXT, BUTTON_RIGHT, BUTTON_NONE},
+ {PF_NEXT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
+ {PF_QUIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER},
+ {PF_CONTEXT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
+ {PF_TRACKLIST, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
#endif
#if CONFIG_KEYPAD == IAUDIO_M3_PAD
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE)
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 5931b6b0a5..cc0be3abd5 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -54,7 +54,7 @@ OUTPUT_FORMAT(elf32-littlemips)
#elif CONFIG_CPU==S3C2440
#include "cpu.h"
/* must be 16Kb (0x4000) aligned */
-#define TTB_SIZE (0x4000)
+#define TTB_SIZE (0x4000)
#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
#elif CONFIG_CPU==TCC7801
@@ -77,9 +77,9 @@ OUTPUT_FORMAT(elf32-littlemips)
#include "cpu.h"
#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - FRAME_SIZE - TTB_SIZE)
#elif CONFIG_CPU==X1000
-#include "config.h"
+#include "cpu.h"
#undef STUBOFFSET
-#define STUBOFFSET 0x4000
+#define DRAMSIZE (X1000_DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE)
#endif
/* default to full RAM (minus codecs&plugins) unless specified otherwise */
@@ -127,7 +127,7 @@ OUTPUT_FORMAT(elf32-littlemips)
/* The bit of IRAM that is available is used in the core */
#define IRAMSIZE 0
-#elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
+#elif defined(CPU_TCC780X)
#define DRAMORIG 0x20000000
#if CONFIG_CPU==TCC7801
#define IRAMORIG 0x1000c000
@@ -179,7 +179,7 @@ OUTPUT_FORMAT(elf32-littlemips)
/* The bit of IRAM that is available is used in the core */
#elif CONFIG_CPU == X1000
-#define DRAMORIG (0x80000000 + STUBOFFSET)
+#define DRAMORIG X1000_DRAM_BASE
#define IRAM DRAM
#define IRAMSIZE 0
@@ -272,7 +272,7 @@ SECTIONS
*(.idata)
#endif
} > PLUGIN_RAM
-
+
#if NOCACHE_BASE != 0
.ncdata . + NOCACHE_BASE :
{
@@ -281,7 +281,7 @@ SECTIONS
. = ALIGN(CACHEALIGN_SIZE);
/* EABI currently needs these defined here, otherwise .iram and .bss can
sometimes have an incorrect load address, breaking codecs and plugins. */
- bssaddr = . - NOCACHE_BASE;
+ bssaddr = . - NOCACHE_BASE;
#if defined(IRAMSIZE) && IRAMSIZE != 0
iramcopy = . - NOCACHE_BASE;
#endif
@@ -299,6 +299,7 @@ SECTIONS
{
*(.eh_frame)
#ifdef CPU_MIPS
+ *(.MIPS.abiflags)
*(.rel.dyn)
#endif
}
@@ -314,7 +315,7 @@ SECTIONS
*(COMMON)
. = ALIGN(0x4);
} > PLUGIN_RAM
-
+
#if NOCACHE_BASE != 0
.ncbss . + NOCACHE_BASE (NOLOAD) :
{
@@ -354,7 +355,7 @@ SECTIONS
. = ALIGN(0x4);
iend = .;
} > PLUGIN_IRAM
-
+
loadendaddr = MAX(plugin_end_addr, LOADADDR(.iram) + SIZEOF(.iram));
#else
loadendaddr = plugin_end_addr;
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c
index b06789af6b..22484d0bc9 100644
--- a/apps/plugins/pong.c
+++ b/apps/plugins/pong.c
@@ -139,14 +139,6 @@
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
#define PONG_QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define PONG_QUIT BUTTON_POWER
-#define PONG_PAUSE BUTTON_MENU
-#define PONG_LEFT_UP BUTTON_VOLUP
-#define PONG_LEFT_DOWN BUTTON_VOLDOWN
-#define PONG_RIGHT_UP BUTTON_RIGHT
-#define PONG_RIGHT_DOWN BUTTON_LEFT
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define PONG_QUIT BUTTON_BACK
#define PONG_LEFT_UP BUTTON_UP
diff --git a/apps/plugins/reversi/reversi-gui.h b/apps/plugins/reversi/reversi-gui.h
index fd60b23927..7e031e6103 100644
--- a/apps/plugins/reversi/reversi-gui.h
+++ b/apps/plugins/reversi/reversi-gui.h
@@ -136,15 +136,6 @@
#define REVERSI_BUTTON_QUIT BUTTON_POWER
#define REVERSI_BUTTON_MENU BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define REVERSI_BUTTON_QUIT BUTTON_POWER
-#define REVERSI_BUTTON_UP BUTTON_STOP
-#define REVERSI_BUTTON_DOWN BUTTON_PLAY
-#define REVERSI_BUTTON_LEFT BUTTON_LEFT
-#define REVERSI_BUTTON_RIGHT BUTTON_RIGHT
-#define REVERSI_BUTTON_MAKE_MOVE BUTTON_VOLUP
-#define REVERSI_BUTTON_MENU BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define REVERSI_BUTTON_QUIT BUTTON_BACK
#define REVERSI_BUTTON_UP BUTTON_UP
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 9c36f8f62f..07a15bfb62 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -152,17 +152,6 @@
#define ROCKBLOX_DROP BUTTON_SELECT
#define ROCKBLOX_RESTART BUTTON_A
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-#define ROCKBLOX_OFF BUTTON_PLAY
-#define ROCKBLOX_ROTATE_CCW BUTTON_UP
-#define ROCKBLOX_ROTATE_CW BUTTON_SELECT
-#define ROCKBLOX_DOWN BUTTON_DOWN
-#define ROCKBLOX_LEFT BUTTON_LEFT
-#define ROCKBLOX_RIGHT BUTTON_RIGHT
-#define ROCKBLOX_DROP BUTTON_MODE
-#define ROCKBLOX_RESTART BUTTON_EQ
-
#elif CONFIG_KEYPAD == MROBE500_PAD
#define ROCKBLOX_OFF BUTTON_POWER
@@ -205,17 +194,6 @@
#define ROCKBLOX_OFF BUTTON_POWER
#define ROCKBLOX_RESTART BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define ROCKBLOX_OFF BUTTON_POWER
-#define ROCKBLOX_ROTATE_CCW BUTTON_VOLDOWN
-#define ROCKBLOX_ROTATE_CW BUTTON_VOLUP
-#define ROCKBLOX_DOWN BUTTON_STOP
-#define ROCKBLOX_LEFT BUTTON_LEFT
-#define ROCKBLOX_RIGHT BUTTON_RIGHT
-#define ROCKBLOX_DROP BUTTON_PLAY
-#define ROCKBLOX_RESTART BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define ROCKBLOX_OFF BUTTON_BACK
#define ROCKBLOX_ROTATE_CCW BUTTON_UP
diff --git a/apps/plugins/rockboy/cpu.c b/apps/plugins/rockboy/cpu.c
index 392dd49b5f..037ea1bc37 100644
--- a/apps/plugins/rockboy/cpu.c
+++ b/apps/plugins/rockboy/cpu.c
@@ -13,7 +13,6 @@
#include "asm.h"
#endif
-
struct cpu cpu IBSS_ATTR;
bool plugbuf;
@@ -764,25 +763,32 @@ next:
__JR:
JR; break;
case 0x20: /* JR NZ */
- if (!(F&FZ)) goto __JR; NOJR; break;
+ if (!(F&FZ)) goto __JR;
+ NOJR; break;
case 0x28: /* JR Z */
- if (F&FZ) goto __JR; NOJR; break;
+ if (F&FZ) goto __JR;
+ NOJR; break;
case 0x30: /* JR NC */
- if (!(F&FC)) goto __JR; NOJR; break;
+ if (!(F&FC)) goto __JR;
+ NOJR; break;
case 0x38: /* JR C */
- if (F&FC) goto __JR; NOJR; break;
-
+ if (F&FC) goto __JR;
+ NOJR; break;
case 0xC3: /* JP */
__JP:
JP; break;
case 0xC2: /* JP NZ */
- if (!(F&FZ)) goto __JP; NOJP; break;
+ if (!(F&FZ)) goto __JP;
+ NOJP; break;
case 0xCA: /* JP Z */
- if (F&FZ) goto __JP; NOJP; break;
+ if (F&FZ) goto __JP;
+ NOJP; break;
case 0xD2: /* JP NC */
- if (!(F&FC)) goto __JP; NOJP; break;
+ if (!(F&FC)) goto __JP;
+ NOJP; break;
case 0xDA: /* JP C */
- if (F&FC) goto __JP; NOJP; break;
+ if (F&FC) goto __JP;
+ NOJP; break;
case 0xE9: /* JP HL */
PC = HL; break;
@@ -790,13 +796,17 @@ next:
__RET:
RET; break;
case 0xC0: /* RET NZ */
- if (!(F&FZ)) goto __RET; NORET; break;
+ if (!(F&FZ)) goto __RET;
+ NORET; break;
case 0xC8: /* RET Z */
- if (F&FZ) goto __RET; NORET; break;
+ if (F&FZ) goto __RET;
+ NORET; break;
case 0xD0: /* RET NC */
- if (!(F&FC)) goto __RET; NORET; break;
+ if (!(F&FC)) goto __RET;
+ NORET; break;
case 0xD8: /* RET C */
- if (F&FC) goto __RET; NORET; break;
+ if (F&FC) goto __RET;
+ NORET; break;
case 0xD9: /* RETI */
IME = IMA = 1; goto __RET;
@@ -804,13 +814,17 @@ next:
__CALL:
CALL; break;
case 0xC4: /* CALL NZ */
- if (!(F&FZ)) goto __CALL; NOCALL; break;
+ if (!(F&FZ)) goto __CALL;
+ NOCALL; break;
case 0xCC: /* CALL Z */
- if (F&FZ) goto __CALL; NOCALL; break;
+ if (F&FZ) goto __CALL;
+ NOCALL; break;
case 0xD4: /* CALL NC */
- if (!(F&FC)) goto __CALL; NOCALL; break;
+ if (!(F&FC)) goto __CALL;
+ NOCALL; break;
case 0xDC: /* CALL C */
- if (F&FC) goto __CALL; NOCALL; break;
+ if (F&FC) goto __CALL;
+ NOCALL; break;
case 0xC7: /* RST 0 */
b = 0x00; goto __RST;
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 6dd010961e..d2c56ff6cc 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -122,16 +122,6 @@ static void setoptions (void)
options.SELECT = BUTTON_NONE;
options.MENU = (BUTTON_SELECT | BUTTON_REPEAT);
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
- options.UP = BUTTON_UP;
- options.DOWN = BUTTON_DOWN;
-
- options.A = BUTTON_PLAY;
- options.B = BUTTON_EQ;
- options.START = BUTTON_MODE;
- options.SELECT = (BUTTON_SELECT | BUTTON_REL);
- options.MENU = (BUTTON_SELECT | BUTTON_REPEAT);
-
#elif CONFIG_KEYPAD == GIGABEAT_PAD
options.UP = BUTTON_UP;
options.DOWN = BUTTON_DOWN;
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 9d57d7428c..41c671a38c 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -312,20 +312,6 @@
#define SOKOBAN_LEVEL_UP BUTTON_PLUS
#define SOKOBAN_MENU_NAME "[MENU]"
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define SOKOBAN_LEFT BUTTON_LEFT
-#define SOKOBAN_RIGHT BUTTON_RIGHT
-#define SOKOBAN_UP BUTTON_STOP
-#define SOKOBAN_DOWN BUTTON_PLAY
-#define SOKOBAN_MENU BUTTON_MENU
-#define SOKOBAN_UNDO BUTTON_VOLDOWN
-#define SOKOBAN_REDO BUTTON_VOLUP
-#define SOKOBAN_PAUSE (BUTTON_MENU|BUTTON_LEFT)
-#define BUTTON_SAVE (BUTTON_MENU|BUTTON_PLAY)
-#define BUTTON_SAVE_NAME "MENU+PLAY"
-
-#define SOKOBAN_RC_MENU (BUTTON_MENU|BUTTON_STOP)
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define SOKOBAN_LEFT BUTTON_LEFT
#define SOKOBAN_RIGHT BUTTON_RIGHT
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c
index 5259d0d616..bb96b8a44b 100644
--- a/apps/plugins/stopwatch.c
+++ b/apps/plugins/stopwatch.c
@@ -51,14 +51,6 @@
#define STOPWATCH_SCROLL_UP BUTTON_SCROLL_FWD
#define STOPWATCH_SCROLL_DOWN BUTTON_SCROLL_BACK
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define STOPWATCH_QUIT BUTTON_PLAY
-#define STOPWATCH_START_STOP BUTTON_MODE
-#define STOPWATCH_RESET_TIMER BUTTON_EQ
-#define STOPWATCH_LAP_TIMER BUTTON_SELECT
-#define STOPWATCH_SCROLL_UP BUTTON_UP
-#define STOPWATCH_SCROLL_DOWN BUTTON_DOWN
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define STOPWATCH_QUIT BUTTON_POWER
#define STOPWATCH_START_STOP BUTTON_PLAY
@@ -133,15 +125,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define STOPWATCH_QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define STOPWATCH_QUIT BUTTON_MENU
-#define STOPWATCH_START_STOP BUTTON_PLAY
-#define STOPWATCH_RESET_TIMER BUTTON_STOP
-#define STOPWATCH_LAP_TIMER BUTTON_LEFT
-#define STOPWATCH_SCROLL_UP BUTTON_VOLUP
-#define STOPWATCH_SCROLL_DOWN BUTTON_VOLDOWN
-#define STOPWATCH_RC_QUIT BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define STOPWATCH_QUIT BUTTON_BACK
#define STOPWATCH_START_STOP BUTTON_PLAY
diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h
index 6ee3eb33ee..1332a9a80f 100644
--- a/apps/plugins/sudoku/sudoku.h
+++ b/apps/plugins/sudoku/sudoku.h
@@ -181,16 +181,6 @@
#define SUDOKU_BUTTON_QUIT BUTTON_POWER
#define SUDOKU_BUTTON_MENU BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define SUDOKU_BUTTON_QUIT BUTTON_POWER
-#define SUDOKU_BUTTON_UP BUTTON_STOP
-#define SUDOKU_BUTTON_DOWN BUTTON_PLAY
-#define SUDOKU_BUTTON_LEFT BUTTON_LEFT
-#define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
-#define SUDOKU_BUTTON_TOGGLE BUTTON_VOLUP
-#define SUDOKU_BUTTON_MENU BUTTON_MENU
-#define SUDOKU_BUTTON_POSSIBLE BUTTON_VOLDOWN
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define SUDOKU_BUTTON_QUIT BUTTON_BACK
#define SUDOKU_BUTTON_UP BUTTON_UP
diff --git a/apps/plugins/text_viewer/tv_button.h b/apps/plugins/text_viewer/tv_button.h
index bea8f829ef..d9a57d114f 100644
--- a/apps/plugins/text_viewer/tv_button.h
+++ b/apps/plugins/text_viewer/tv_button.h
@@ -75,17 +75,6 @@
#define TV_AUTOSCROLL BUTTON_PLAY
#define TV_BOOKMARK BUTTON_SELECT
-/* iFP7xx keys */
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define TV_QUIT BUTTON_PLAY
-#define TV_SCROLL_UP BUTTON_UP
-#define TV_SCROLL_DOWN BUTTON_DOWN
-#define TV_SCREEN_LEFT BUTTON_LEFT
-#define TV_SCREEN_RIGHT BUTTON_RIGHT
-#define TV_MENU BUTTON_MODE
-#define TV_AUTOSCROLL BUTTON_SELECT
-#define TV_BOOKMARK (BUTTON_LEFT|BUTTON_SELECT)
-
/* iAudio X5/M5 keys */
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define TV_QUIT BUTTON_POWER
@@ -247,18 +236,6 @@
#define TV_SCROLL_DOWN BUTTON_PLUS
#define TV_BOOKMARK (BUTTON_MENU|BUTTON_PLUS)
-/* Cowon iAudio 7 keys */
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define TV_QUIT BUTTON_POWER
-#define TV_SCROLL_UP BUTTON_VOLUP
-#define TV_SCROLL_DOWN BUTTON_VOLDOWN
-#define TV_SCREEN_LEFT BUTTON_LEFT
-#define TV_SCREEN_RIGHT BUTTON_RIGHT
-#define TV_MENU BUTTON_MENU
-#define TV_AUTOSCROLL BUTTON_PLAY
-#define TV_RC_QUIT BUTTON_STOP
-#define TV_BOOKMARK (BUTTON_LEFT|BUTTON_PLAY)
-
/* Creative Zen Vision:M keys */
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define TV_QUIT BUTTON_BACK
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index 36aae071cb..cf959ad7f5 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -146,15 +146,6 @@
#define QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define QUIT BUTTON_POWER
-#define LEFT BUTTON_LEFT
-#define RIGHT BUTTON_RIGHT
-#define UP BUTTON_STOP
-#define DOWN BUTTON_PLAY
-#define PAUSE BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define QUIT BUTTON_BACK
diff --git a/apps/plugins/zxbox/keymaps.h b/apps/plugins/zxbox/keymaps.h
index dbebc3b1d9..e9316a301b 100644
--- a/apps/plugins/zxbox/keymaps.h
+++ b/apps/plugins/zxbox/keymaps.h
@@ -47,14 +47,6 @@
#define ZX_SELECT BUTTON_SELECT
#define ZX_MENU BUTTON_PLAY
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define ZX_SELECT BUTTON_SELECT
-#define ZX_MENU BUTTON_PLAY
-#define ZX_LEFT BUTTON_LEFT
-#define ZX_RIGHT BUTTON_RIGHT
-#define ZX_UP BUTTON_UP
-#define ZX_DOWN BUTTON_DOWN
-
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
#define ZX_SELECT BUTTON_REW
#define ZX_MENU BUTTON_FF
@@ -110,14 +102,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define ZX_MENU (BUTTON_MENU|BUTTON_REL)
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define ZX_UP BUTTON_STOP
-#define ZX_DOWN BUTTON_PLAY
-#define ZX_LEFT BUTTON_LEFT
-#define ZX_RIGHT BUTTON_RIGHT
-#define ZX_SELECT BUTTON_VOLUP
-#define ZX_MENU BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define ZX_UP BUTTON_UP
#define ZX_DOWN BUTTON_DOWN
diff --git a/apps/plugins/zxbox/zxbox_keyb.c b/apps/plugins/zxbox/zxbox_keyb.c
index dd517e01e7..6e0997c339 100644
--- a/apps/plugins/zxbox/zxbox_keyb.c
+++ b/apps/plugins/zxbox/zxbox_keyb.c
@@ -32,17 +32,6 @@
#define KBD_UP BUTTON_SCROLL_BACK
#define KBD_DOWN BUTTON_SCROLL_FWD
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-/* TODO: Check keyboard mappings */
-
-#define KBD_SELECT BUTTON_SELECT
-#define KBD_ABORT BUTTON_PLAY
-#define KBD_LEFT BUTTON_LEFT
-#define KBD_RIGHT BUTTON_RIGHT
-#define KBD_UP BUTTON_UP
-#define KBD_DOWN BUTTON_DOWN
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
/* TODO: Check keyboard mappings */
@@ -113,15 +102,6 @@
#define KBD_ABORT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define KBD_SELECT BUTTON_MENU
-#define KBD_ABORT BUTTON_POWER
-#define KBD_LEFT BUTTON_LEFT
-#define KBD_RIGHT BUTTON_RIGHT
-#define KBD_UP BUTTON_STOP
-#define KBD_DOWN BUTTON_PLAY
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define KBD_SELECT BUTTON_SELECT
@@ -512,27 +492,27 @@ int zx_kbd_input(char* text/*, int buflen*/)
len_utf8 = rb->utf8length(text);
#endif
FOR_NB_SCREENS(l)
+ {
rb->screens[l]->clear_display();
+ }
-
- /* draw page */
- FOR_NB_SCREENS(l)
- {
- rb->screens[l]->setfont(param[l].curfont);
- k = param[l].page*param[l].max_chars*param[l].lines;
- for (i=j=0; j < param[l].lines && k < param[l].nchars; k++) {
- utf8 = rb->utf8encode(param[l].kbd_buf[k], outline);
- *utf8 = 0;
- rb->screens[l]->getstringsize(outline, &w, NULL);
- rb->screens[l]->putsxy(i*param[l].font_w + (param[l].font_w-w)/2, j*param[l].font_h
- + statusbar_size, outline);
- if (++i == param[l].max_chars) {
- i = 0;
- j++;
- }
+ /* draw page */
+ FOR_NB_SCREENS(l)
+ {
+ rb->screens[l]->setfont(param[l].curfont);
+ k = param[l].page*param[l].max_chars*param[l].lines;
+ for (i=j=0; j < param[l].lines && k < param[l].nchars; k++) {
+ utf8 = rb->utf8encode(param[l].kbd_buf[k], outline);
+ *utf8 = 0;
+ rb->screens[l]->getstringsize(outline, &w, NULL);
+ rb->screens[l]->putsxy(i*param[l].font_w + (param[l].font_w-w)/2, j*param[l].font_h
+ + statusbar_size, outline);
+ if (++i == param[l].max_chars) {
+ i = 0;
+ j++;
}
}
-
+ }
/* separator */
FOR_NB_SCREENS(l)
@@ -581,19 +561,20 @@ int zx_kbd_input(char* text/*, int buflen*/)
}
cur_blink = !cur_blink;
-
- /* highlight the key that has focus */
- FOR_NB_SCREENS(l)
- {
- rb->screens[l]->set_drawmode(DRMODE_COMPLEMENT);
- rb->screens[l]->fillrect(param[l].font_w * param[l].x,
- statusbar_size + param[l].font_h * param[l].y,
- param[l].font_w, param[l].font_h);
- rb->screens[l]->set_drawmode(DRMODE_SOLID);
- }
+ /* highlight the key that has focus */
+ FOR_NB_SCREENS(l)
+ {
+ rb->screens[l]->set_drawmode(DRMODE_COMPLEMENT);
+ rb->screens[l]->fillrect(param[l].font_w * param[l].x,
+ statusbar_size + param[l].font_h * param[l].y,
+ param[l].font_w, param[l].font_h);
+ rb->screens[l]->set_drawmode(DRMODE_SOLID);
+ }
FOR_NB_SCREENS(l)
- rb->screens[l]->update();
+ {
+ rb->screens[l]->update();
+ }
button = rb->button_get_w_tmo(HZ/2);