mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
lua fix yellow and add temploader
temp loader allows some lua requires to be loaded and later garbage collected unfortunately the module needs to be formatted in such a way to pass back a call table in order to keep the functions within from being garbage collected too early 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 Change-Id: I0b6f81e481b8c779edbd620c8403794f8353926f
This commit is contained in:
parent
489a5f3ff7
commit
9b2f23319c
4 changed files with 104 additions and 60 deletions
|
@ -153,7 +153,7 @@ RB_WRAP(kbd_input)
|
|||
|
||||
const char *input = lua_tostring(L, 1);
|
||||
size_t layout_len;
|
||||
const char *layout = lua_tolstring(L, 2, &layout_len);
|
||||
const unsigned char *layout = lua_tolstring(L, 2, &layout_len);
|
||||
char *buffer = luaL_prepbuffer(&b);
|
||||
|
||||
if(input != NULL)
|
||||
|
@ -161,8 +161,12 @@ RB_WRAP(kbd_input)
|
|||
else
|
||||
buffer[0] = '\0';
|
||||
|
||||
if(layout_len <= 1 || (unsigned short)layout[layout_len - 1] != 0xFFFE)
|
||||
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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue