summaryrefslogtreecommitdiff
path: root/apps/plugins/vbrfix.c
blob: 3e152be3fc8f13e0a769067978fa54573ff4219c (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2004 Linus Nielsen Feltzing
 *
 * 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.
 *
 ****************************************************************************/
#include "plugin.h"

PLUGIN_HEADER

static char   *audiobuf;
static ssize_t audiobuflen;
unsigned char xingbuf[1500];
char tmpname[MAX_PATH];

static void xingupdate(int percent)
{
    char buf[32];

    rb->snprintf(buf, 32, "%d%%", percent);
    rb->lcd_puts(0, 1, buf);
    rb->lcd_update();
}

static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_bytes)
{
    int readlen;
    int rc;
    int orig_fd, fd;
    
    rb->snprintf(tmpname, MAX_PATH, "%s.tmp", fname);

    orig_fd = rb->open(fname, O_RDONLY);
    if(orig_fd < 0) {
        return 10*orig_fd - 1;
    }

    fd = rb->creat(tmpname);
    if(fd < 0) {
        rb->close(orig_fd);
        return 10*fd - 2;
    }

    /* First, copy the initial portion (the ID3 tag) */
    if(fpos) {
        readlen = rb->read(orig_fd, audiobuf, fpos);
        if(readlen < 0) {
            rb->close(fd);
            rb->close(orig_fd);
            return 10*readlen - 3;
        }
        
        rc = rb->write(fd, audiobuf, readlen);
        if(rc < 0) {
            rb->close(fd);
            rb->close(orig_fd);
            return 10*rc - 4;
        }
    }
    
    /* Now insert the data into the file */
    rc = rb->write(fd, buf, num_bytes);
    if(rc < 0) {
        rb->close(orig_fd);
        rb->close(fd);
        return 10*rc - 5;
    }

    /* Copy the file */
    do {
        readlen = rb->read(orig_fd, audiobuf, audiobuflen);
        if(readlen < 0) {
            rb->close(fd);
            rb->close(orig_fd);
            return 10*readlen - 7;
        }

        rc = rb->write(fd, audiobuf, readlen);
        if(rc < 0) {
            rb->close(fd);
            rb->close(orig_fd);
            return 10*rc - 8;
        }
    } while(readlen > 0);
    
    rb->close(fd);
    rb->close(orig_fd);

    /* Remove the old file */
    rc = rb->remove(fname);
    if(rc < 0) {
        return 10*rc - 9;
    }

    /* Replace the old file with the new */
    rc = rb->rename(tmpname, fname);
    if(rc < 0) {
        return 10*rc - 9;
    }
    
    return 0;
}

static void fileerror(int rc)
{
    rb->splashf(HZ*2, "File error: %d", rc);
}

static const unsigned char empty_id3_header[] =
{
    'I', 'D', '3', 0x04, 0x00, 0x00,
    0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */
};

static bool vbr_fix(const char *selected_file)
{
    struct mp3entry entry;
    int fd;
    int rc;
    int flen;
    int num_frames;
    int numbytes;
    int framelen;
    int unused_space;

    rb->lcd_clear_display();
    rb->lcd_puts_scroll(0, 0, selected_file);
    rb->lcd_update();

    xingupdate(0);

    rc = rb->mp3info(&entry, selected_file);
    if(rc < 0) {
        fileerror(rc);
        return true;
    }
    
    fd = rb->open(selected_file, O_RDWR);
    if(fd < 0) {
        fileerror(fd);
        return true;
    }

    flen = rb->lseek(fd, 0, SEEK_END);

    xingupdate(0);

    num_frames = rb->count_mp3_frames(fd, entry.first_frame_offset,
                                      flen, xingupdate);

    if(num_frames) {
        /* Note: We don't need to pass a template header because it will be
           taken from the mpeg stream */
        framelen = rb->create_xing_header(fd, entry.first_frame_offset,
                                          flen, xingbuf, num_frames, 0,
                                          0, xingupdate, true);
        
        /* Try to fit the Xing header first in the stream. Replace the existing
           VBR header if there is one, else see if there is room between the
           ID3 tag and the first MP3 frame. */
        if(entry.first_frame_offset - entry.id3v2len >=
           (unsigned int)framelen) {
            DEBUGF("Using existing space between ID3 and first frame\n");

            /* Seek to the beginning of the unused space */
            rc = rb->lseek(fd, entry.id3v2len, SEEK_SET);
            if(rc < 0) {
                rb->close(fd);
                fileerror(rc);
                return true;
            }

            unused_space =
                entry.first_frame_offset - entry.id3v2len - framelen;
            
            /* Fill the unused space with 0's (using the MP3 buffer)
               and write it to the file */
            if(unused_space)
            {
                rb->memset(audiobuf, 0, unused_space);
                rc = rb->write(fd, audiobuf, unused_space);
                if(rc < 0) {
                    rb->close(fd);
                    fileerror(rc);
                    return true;
                }
            }

            /* Then write the Xing header */
            rc = rb->write(fd, xingbuf, framelen);
            if(rc < 0) {
                rb->close(fd);
                fileerror(rc);
                return true;
            }
            
            rb->close(fd);
        } else {
            /* If not, insert some space. If there is an ID3 tag in the
               file we only insert just enough to squeeze the Xing header
               in. If not, we insert an additional empty ID3 tag of 4K. */
            
            rb->close(fd);
            
            /* Nasty trick alert! The insert_data_in_file() function
               uses the MP3 buffer when copying the data. We assume
               that the ID3 tag isn't longer than 1MB so the xing
               buffer won't be overwritten. */
            
            if(entry.first_frame_offset) {
                DEBUGF("Inserting %d bytes\n", framelen);
                numbytes = framelen;
            } else {
                DEBUGF("Inserting 4096+%d bytes\n", framelen);
                numbytes = 4096 + framelen;
                
                rb->memset(audiobuf + 0x100000, 0, numbytes);
                
                /* Insert the ID3 header */
                rb->memcpy(audiobuf + 0x100000, empty_id3_header,
                           sizeof(empty_id3_header));
            }
            
            /* Copy the Xing header */
            rb->memcpy(audiobuf + 0x100000 + numbytes - framelen,
                       xingbuf, framelen);
            
            rc = insert_data_in_file(selected_file,
                                     entry.first_frame_offset,
                                     audiobuf + 0x100000, numbytes);
            
            if(rc < 0) {
                fileerror(rc);
                return true;
            }
        }
        
        xingupdate(100);
    }
    else
    {
        /* Not a VBR file */
        DEBUGF("Not a VBR file\n");
        rb->splash(HZ*2, "Not a VBR file");
    }

    return false;
}

enum plugin_status plugin_start(const void *parameter)
{

    if (!parameter)
        return PLUGIN_ERROR;

    audiobuf = rb->plugin_get_audio_buffer((size_t *)&audiobuflen);
    
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
    rb->cpu_boost(true);
#endif

    vbr_fix(parameter);

#ifdef HAVE_ADJUSTABLE_CPU_FREQ
    rb->cpu_boost(false);
#endif
    return PLUGIN_OK;
}
pan> 1); lua_pushfstring(L, ROCKLUA_IMAGE ": %dx%d", a->width, a->height); return 1; } static const struct luaL_reg rli_lib [] = { {"__tostring", rli_tostring}, {"set", rli_set}, {"get", rli_get}, {"width", rli_width}, {"height", rli_height}, {NULL, NULL} }; static inline void rli_init(lua_State *L) { luaL_newmetatable(L, ROCKLUA_IMAGE); lua_pushstring(L, "__index"); lua_pushvalue(L, -2); /* pushes the metatable */ lua_settable(L, -3); /* metatable.__index = metatable */ luaL_register(L, NULL, rli_lib); } /* * ----------------------------- * * Rockbox wrappers start here! * * ----------------------------- */ #define RB_WRAP(M) static int rock_##M(lua_State *L) #define SIMPLE_VOID_WRAPPER(func) RB_WRAP(func) { (void)L; func(); return 0; } /* Helper function for opt_viewport */ static void check_tablevalue(lua_State *L, const char* key, int tablepos, void* res, bool unsigned_val) { lua_getfield(L, tablepos, key); /* Find table[key] */ if(!lua_isnoneornil(L, -1)) { if(unsigned_val) *(unsigned*)res = luaL_checkint(L, -1); else *(int*)res = luaL_checkint(L, -1); } lua_pop(L, 1); /* Pop the value off the stack */ } static struct viewport* opt_viewport(lua_State *L, int narg, struct viewport* alt) { if(lua_isnoneornil(L, narg)) return alt; int tablepos = lua_gettop(L); struct viewport *vp; lua_getfield(L, tablepos, "vp"); /* get table['vp'] */ if(lua_isnoneornil(L, -1)) { lua_pop(L, 1); /* Pop nil off stack */ vp = (struct viewport*) lua_newuserdata(L, sizeof(struct viewport)); /* Allocate memory and push it as udata on the stack */ memset(vp, 0, sizeof(struct viewport)); /* Init viewport values to 0 */ lua_setfield(L, tablepos, "vp"); /* table['vp'] = vp (pops value off the stack) */ } else { vp = (struct viewport*) lua_touserdata(L, -1); /* Reuse viewport struct */ lua_pop(L, 1); /* We don't need the value on stack */ } luaL_checktype(L, narg, LUA_TTABLE); check_tablevalue(L, "x", tablepos, &vp->x, false); check_tablevalue(L, "y", tablepos, &vp->y, false); check_tablevalue(L, "width", tablepos, &vp->width, false); check_tablevalue(L, "height", tablepos, &vp->height, false); #ifdef HAVE_LCD_BITMAP check_tablevalue(L, "font", tablepos, &vp->font, false); check_tablevalue(L, "drawmode", tablepos, &vp->drawmode, false); #endif #if LCD_DEPTH > 1 check_tablevalue(L, "fg_pattern", tablepos, &vp->fg_pattern, true); check_tablevalue(L, "bg_pattern", tablepos, &vp->bg_pattern, true); #ifdef HAVE_LCD_COLOR check_tablevalue(L, "lss_pattern", tablepos, &vp->lss_pattern, true); check_tablevalue(L, "lse_pattern", tablepos, &vp->lse_pattern, true); check_tablevalue(L, "lst_pattern", tablepos, &vp->lst_pattern, true); #endif #endif return vp; } RB_WRAP(set_viewport) { struct viewport *vp = opt_viewport(L, 1, NULL); int screen = luaL_optint(L, 2, SCREEN_MAIN); rb->screens[screen]->set_viewport(vp); return 0; } RB_WRAP(clear_viewport) { int screen = luaL_optint(L, 1, SCREEN_MAIN); rb->screens[screen]->clear_viewport(); return 0; } #ifdef HAVE_LCD_BITMAP RB_WRAP(lcd_framebuffer) { rli_wrap(L, rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT); return 1; } RB_WRAP(lcd_mono_bitmap_part) { struct rocklua_image *src = rli_checktype(L, 1); int src_x = luaL_checkint(L, 2); int src_y = luaL_checkint(L, 3); int stride = luaL_checkint(L, 4); int x = luaL_checkint(L, 5); int y = luaL_checkint(L, 6); int width = luaL_checkint(L, 7); int height = luaL_checkint(L, 8); int screen = luaL_optint(L, 9, SCREEN_MAIN); rb->screens[screen]->mono_bitmap_part((const unsigned char *)src->data, src_x, src_y, stride, x, y, width, height); return 0; } RB_WRAP(lcd_mono_bitmap) { struct rocklua_image *src = rli_checktype(L, 1); int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); int width = luaL_checkint(L, 4); int height = luaL_checkint(L, 5); int screen = luaL_optint(L, 6, SCREEN_MAIN); rb->screens[screen]->mono_bitmap((const unsigned char *)src->data, x, y, width, height); return 0; } #if LCD_DEPTH > 1 RB_WRAP(lcd_bitmap_part) { struct rocklua_image *src = rli_checktype(L, 1); int src_x = luaL_checkint(L, 2); int src_y = luaL_checkint(L, 3); int stride = luaL_checkint(L, 4); int x = luaL_checkint(L, 5); int y = luaL_checkint(L, 6); int width = luaL_checkint(L, 7); int height = luaL_checkint(L, 8); int screen = luaL_optint(L, 9, SCREEN_MAIN); rb->screens[screen]->bitmap_part(src->data, src_x, src_y, stride, x, y, width, height); return 0; } RB_WRAP(lcd_bitmap) { struct rocklua_image *src = rli_checktype(L, 1); int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); int width = luaL_checkint(L, 4); int height = luaL_checkint(L, 5); int screen = luaL_optint(L, 6, SCREEN_MAIN); rb->screens[screen]->bitmap(src->data, x, y, width, height); return 0; } RB_WRAP(lcd_get_backdrop) { fb_data* backdrop = rb->lcd_get_backdrop(); if(backdrop == NULL) lua_pushnil(L); else rli_wrap(L, backdrop, LCD_WIDTH, LCD_HEIGHT); return 1; } #endif /* LCD_DEPTH > 1 */ #if LCD_DEPTH == 16 RB_WRAP(lcd_bitmap_transparent_part) { struct rocklua_image *src = rli_checktype(L, 1); int src_x = luaL_checkint(L, 2); int src_y = luaL_checkint(L, 3); int stride = luaL_checkint(L, 4); int x = luaL_checkint(L, 5); int y = luaL_checkint(L, 6); int width = luaL_checkint(L, 7); int height = luaL_checkint(L, 8); int screen = luaL_optint(L, 9, SCREEN_MAIN); rb->screens[screen]->transparent_bitmap_part(src->data, src_x, src_y, stride, x, y, width, height); return 0; } RB_WRAP(lcd_bitmap_transparent) { struct rocklua_image *src = rli_checktype(L, 1); int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); int width = luaL_checkint(L, 4); int height = luaL_checkint(L, 5); int screen = luaL_optint(L, 6, SCREEN_MAIN); rb->screens[screen]->transparent_bitmap(src->data, x, y, width, height); return 0; } #endif /* LCD_DEPTH == 16 */ #endif /* defined(LCD_BITMAP) */ RB_WRAP(current_tick) { lua_pushinteger(L, *rb->current_tick); return 1; } #ifdef HAVE_TOUCHSCREEN RB_WRAP(action_get_touchscreen_press) { short x, y; int result = rb->action_get_touchscreen_press(&x, &y); lua_pushinteger(L, result); lua_pushinteger(L, x); lua_pushinteger(L, y); return 3; } #endif RB_WRAP(kbd_input) { luaL_Buffer b; luaL_buffinit(L, &b); const char *input = luaL_optstring(L, 1, NULL); char *buffer = luaL_prepbuffer(&b); if(input != NULL) rb->strlcpy(buffer, input, LUAL_BUFFERSIZE); else buffer[0] = '\0'; if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE)) { luaL_addsize(&b, strlen(buffer)); luaL_pushresult(&b); } else lua_pushnil(L); return 1; } #ifdef HAVE_TOUCHSCREEN RB_WRAP(touchscreen_set_mode) { enum touchscreen_mode mode = luaL_checkint(L, 1); rb->touchscreen_set_mode(mode); return 0; } #endif RB_WRAP(font_getstringsize) { const unsigned char* str = luaL_checkstring(L, 1); int fontnumber = luaL_checkint(L, 2); int w, h; int result = rb->font_getstringsize(str, &w, &h, fontnumber); lua_pushinteger(L, result); lua_pushinteger(L, w); lua_pushinteger(L, h); return 3; } #ifdef HAVE_LCD_COLOR RB_WRAP(lcd_rgbpack) { int r = luaL_checkint(L, 1); int g = luaL_checkint(L, 2); int b = luaL_checkint(L, 3); int result = LCD_RGBPACK(r, g, b); lua_pushinteger(L, result); return 1; } RB_WRAP(lcd_rgbunpack) { int rgb = luaL_checkint(L, 1); lua_pushinteger(L, RGB_UNPACK_RED(rgb)); lua_pushinteger(L, RGB_UNPACK_GREEN(rgb)); lua_pushinteger(L, RGB_UNPACK_BLUE(rgb)); return 3; } #endif RB_WRAP(read_bmp_file) { struct bitmap bm; const char* filename = luaL_checkstring(L, 1); bool dither = luaL_optboolean(L, 2, true); bool transparent = luaL_optboolean(L, 3, false); int format = FORMAT_NATIVE; if(dither) format |= FORMAT_DITHER; if(transparent) format |= FORMAT_TRANSPARENT; int result = rb->read_bmp_file(filename, &bm, 0, format | FORMAT_RETURN_SIZE, NULL); if(result > 0) { bm.data = (unsigned char*) rli_alloc(L, bm.width, bm.height); if(rb->read_bmp_file(filename, &bm, result, format, NULL) < 0) { /* Error occured, drop newly allocated image from stack */ lua_pop(L, 1); lua_pushnil(L); } } else lua_pushnil(L); return 1; } RB_WRAP(current_path) { const char *current_path = get_current_path(L, 1); if(current_path != NULL) lua_pushstring(L, current_path); else lua_pushnil(L); return 1; } static void fill_text_message(lua_State *L, struct text_message * message, int pos) { int i; luaL_checktype(L, pos, LUA_TTABLE); int n = luaL_getn(L, pos); const char **lines = (const char**) dlmalloc(n * sizeof(const char*)); if(lines == NULL) luaL_error(L, "Can't allocate %d bytes!", n * sizeof(const char*)); for(i=1; i<=n; i++) { lua_rawgeti(L, pos, i); lines[i-1] = luaL_checkstring(L, -1); lua_pop(L, 1); } message->message_lines = lines; message->nb_lines = n; } RB_WRAP(gui_syncyesno_run) { struct text_message main_message, yes_message, no_message; struct text_message *yes = NULL, *no = NULL; fill_text_message(L, &main_message, 1); if(!lua_isnoneornil(L, 2)) fill_text_message(L, (yes = &yes_message), 2); if(!lua_isnoneornil(L, 3)) fill_text_message(L, (no = &no_message), 3); enum yesno_res result = rb->gui_syncyesno_run(&main_message, yes, no); dlfree(main_message.message_lines); if(yes) dlfree(yes_message.message_lines); if(no) dlfree(no_message.message_lines); lua_pushinteger(L, result); return 1; } RB_WRAP(do_menu) { struct menu_callback_with_desc menu_desc = {NULL, NULL, Icon_NOICON}; struct menu_item_ex menu = {MT_RETURN_ID | MENU_HAS_DESC, {.strings = NULL}, {.callback_and_desc = &menu_desc}}; int i, n, start_selected; const char **items, *title; title = luaL_checkstring(L, 1); luaL_checktype(L, 2, LUA_TTABLE); start_selected = luaL_optint(L, 3, 0); n = luaL_getn(L, 2); items = (const char**) dlmalloc(n * sizeof(const char*)); if(items == NULL) luaL_error(L, "Can't allocate %d bytes!", n * sizeof(const char*)); for(i=1; i<=n; i++) { lua_rawgeti(L, 2, i); /* Push item on the stack */ items[i-1] = luaL_checkstring(L, -1); lua_pop(L, 1); /* Pop it */ } menu.strings = items; menu.flags |= MENU_ITEM_COUNT(n); menu_desc.desc = (unsigned char*) title; int result = rb->do_menu(&menu, &start_selected, NULL, false); dlfree(items); lua_pushinteger(L, result); return 1; } SIMPLE_VOID_WRAPPER(backlight_force_on); SIMPLE_VOID_WRAPPER(backlight_use_settings); #ifdef HAVE_REMOTE_LCD SIMPLE_VOID_WRAPPER(remote_backlight_force_on); SIMPLE_VOID_WRAPPER(remote_backlight_use_settings); #endif #ifdef HAVE_BUTTON_LIGHT SIMPLE_VOID_WRAPPER(buttonlight_force_on); SIMPLE_VOID_WRAPPER(buttonlight_use_settings); #endif #ifdef HAVE_BACKLIGHT_BRIGHTNESS RB_WRAP(backlight_brightness_set) { int brightness = luaL_checkint(L, 1); backlight_brightness_set(brightness); return 0; } SIMPLE_VOID_WRAPPER(backlight_brightness_use_setting); #endif #define R(NAME) {#NAME, rock_##NAME} static const luaL_Reg rocklib[] = { /* Graphics */ #ifdef HAVE_LCD_BITMAP R(lcd_framebuffer), R(lcd_mono_bitmap_part), R(lcd_mono_bitmap), #if LCD_DEPTH > 1 R(lcd_get_backdrop), R(lcd_bitmap_part), R(lcd_bitmap), #endif #if LCD_DEPTH == 16 R(lcd_bitmap_transparent_part), R(lcd_bitmap_transparent), #endif #endif #ifdef HAVE_LCD_COLOR R(lcd_rgbpack), R(lcd_rgbunpack), #endif /* Kernel */ R(current_tick), /* Buttons */ #ifdef HAVE_TOUCHSCREEN R(action_get_touchscreen_press), R(touchscreen_set_mode), #endif R(kbd_input), R(font_getstringsize), R(read_bmp_file), R(set_viewport), R(clear_viewport), R(current_path), R(gui_syncyesno_run), R(do_menu), /* Backlight helper */ R(backlight_force_on), R(backlight_use_settings), #ifdef HAVE_REMOTE_LCD R(remote_backlight_force_on), R(remote_backlight_use_settings), #endif #ifdef HAVE_BUTTON_LIGHT R(buttonlight_force_on), R(buttonlight_use_settings), #endif #ifdef HAVE_BACKLIGHT_BRIGHTNESS R(backlight_brightness_set), R(backlight_brightness_use_setting), #endif {"new_image", rli_new}, {NULL, NULL} }; #undef R extern const luaL_Reg rocklib_aux[]; #define RB_CONSTANT(x) lua_pushinteger(L, x); lua_setfield(L, -2, #x); /* ** Open Rockbox library */ LUALIB_API int luaopen_rock(lua_State *L) { luaL_register(L, LUA_ROCKLIBNAME, rocklib); luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux); RB_CONSTANT(HZ); RB_CONSTANT(LCD_WIDTH); RB_CONSTANT(LCD_HEIGHT); RB_CONSTANT(LCD_DEPTH); RB_CONSTANT(FONT_SYSFIXED); RB_CONSTANT(FONT_UI); #ifdef HAVE_TOUCHSCREEN RB_CONSTANT(TOUCHSCREEN_POINT); RB_CONSTANT(TOUCHSCREEN_BUTTON); #endif RB_CONSTANT(SCREEN_MAIN); #ifdef HAVE_REMOTE_LCD RB_CONSTANT(SCREEN_REMOTE); #endif rli_init(L); return 1; }