3 Copyright (C) 2013 sapier
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "lua_api/l_mainmenu.h"
21 #include "lua_api/l_internal.h"
22 #include "common/c_content.h"
23 #include "guiEngine.h"
24 #include "guiMainMenu.h"
25 #include "guiKeyChangeMenu.h"
26 #include "guiFileSelectMenu.h"
30 #include "convert_json.h"
31 #include "serverlist.h"
34 #include "main.h" // for g_settings
36 #include <IFileArchive.h>
37 #include <IFileSystem.h>
39 /******************************************************************************/
40 std::string ModApiMainMenu::getTextData(lua_State *L, std::string name)
42 lua_getglobal(L, "gamedata");
44 lua_getfield(L, -1, name.c_str());
49 return luaL_checkstring(L, -1);
52 /******************************************************************************/
53 int ModApiMainMenu::getIntegerData(lua_State *L, std::string name,bool& valid)
55 lua_getglobal(L, "gamedata");
57 lua_getfield(L, -1, name.c_str());
59 if(lua_isnil(L, -1)) {
65 return luaL_checkinteger(L, -1);
68 /******************************************************************************/
69 int ModApiMainMenu::getBoolData(lua_State *L, std::string name,bool& valid)
71 lua_getglobal(L, "gamedata");
73 lua_getfield(L, -1, name.c_str());
75 if(lua_isnil(L, -1)) {
81 return lua_toboolean(L, -1);
84 /******************************************************************************/
85 int ModApiMainMenu::l_update_formspec(lua_State *L)
87 GUIEngine* engine = getGuiEngine(L);
90 if (engine->m_startgame)
94 std::string formspec(luaL_checkstring(L, 1));
96 if (engine->m_formspecgui != 0) {
97 engine->m_formspecgui->setForm(formspec);
103 /******************************************************************************/
104 int ModApiMainMenu::l_start(lua_State *L)
106 GUIEngine* engine = getGuiEngine(L);
109 //update c++ gamedata from lua table
114 engine->m_data->selected_world = getIntegerData(L, "selected_world",valid) -1;
115 engine->m_data->simple_singleplayer_mode = getBoolData(L,"singleplayer",valid);
116 engine->m_data->name = getTextData(L,"playername");
117 engine->m_data->password = getTextData(L,"password");
118 engine->m_data->address = getTextData(L,"address");
119 engine->m_data->port = getTextData(L,"port");
120 engine->m_data->serverdescription = getTextData(L,"serverdescription");
121 engine->m_data->servername = getTextData(L,"servername");
123 //close menu next time
124 engine->m_startgame = true;
128 /******************************************************************************/
129 int ModApiMainMenu::l_close(lua_State *L)
131 GUIEngine* engine = getGuiEngine(L);
134 engine->m_data->kill = true;
136 //close menu next time
137 engine->m_startgame = true;
138 engine->m_menu->quitMenu();
142 /******************************************************************************/
143 int ModApiMainMenu::l_set_background(lua_State *L)
145 GUIEngine* engine = getGuiEngine(L);
148 std::string backgroundlevel(luaL_checkstring(L, 1));
149 std::string texturename(luaL_checkstring(L, 2));
153 if (backgroundlevel == "background") {
154 retval |= engine->setTexture(TEX_LAYER_BACKGROUND,texturename);
157 if (backgroundlevel == "overlay") {
158 retval |= engine->setTexture(TEX_LAYER_OVERLAY,texturename);
161 if (backgroundlevel == "header") {
162 retval |= engine->setTexture(TEX_LAYER_HEADER,texturename);
165 if (backgroundlevel == "footer") {
166 retval |= engine->setTexture(TEX_LAYER_FOOTER,texturename);
169 lua_pushboolean(L,retval);
173 /******************************************************************************/
174 int ModApiMainMenu::l_set_clouds(lua_State *L)
176 GUIEngine* engine = getGuiEngine(L);
179 bool value = lua_toboolean(L,1);
181 engine->m_clouds_enabled = value;
186 /******************************************************************************/
187 int ModApiMainMenu::l_get_textlist_index(lua_State *L)
189 GUIEngine* engine = getGuiEngine(L);
192 std::string listboxname(luaL_checkstring(L, 1));
194 int selection = engine->m_menu->getListboxIndex(listboxname);
199 lua_pushinteger(L, selection);
203 /******************************************************************************/
204 int ModApiMainMenu::l_get_worlds(lua_State *L)
206 GUIEngine* engine = getGuiEngine(L);
209 std::vector<WorldSpec> worlds = getAvailableWorlds();
212 int top = lua_gettop(L);
213 unsigned int index = 1;
215 for (unsigned int i = 0; i < worlds.size(); i++)
217 lua_pushnumber(L,index);
220 int top_lvl2 = lua_gettop(L);
222 lua_pushstring(L,"path");
223 lua_pushstring(L,worlds[i].path.c_str());
224 lua_settable(L, top_lvl2);
226 lua_pushstring(L,"name");
227 lua_pushstring(L,worlds[i].name.c_str());
228 lua_settable(L, top_lvl2);
230 lua_pushstring(L,"gameid");
231 lua_pushstring(L,worlds[i].gameid.c_str());
232 lua_settable(L, top_lvl2);
234 lua_settable(L, top);
240 /******************************************************************************/
241 int ModApiMainMenu::l_get_games(lua_State *L)
243 GUIEngine* engine = getGuiEngine(L);
246 std::vector<SubgameSpec> games = getAvailableGames();
249 int top = lua_gettop(L);
250 unsigned int index = 1;
252 for (unsigned int i = 0; i < games.size(); i++)
254 lua_pushnumber(L,index);
256 int top_lvl2 = lua_gettop(L);
258 lua_pushstring(L,"id");
259 lua_pushstring(L,games[i].id.c_str());
260 lua_settable(L, top_lvl2);
262 lua_pushstring(L,"path");
263 lua_pushstring(L,games[i].path.c_str());
264 lua_settable(L, top_lvl2);
266 lua_pushstring(L,"gamemods_path");
267 lua_pushstring(L,games[i].gamemods_path.c_str());
268 lua_settable(L, top_lvl2);
270 lua_pushstring(L,"name");
271 lua_pushstring(L,games[i].name.c_str());
272 lua_settable(L, top_lvl2);
274 lua_pushstring(L,"menuicon_path");
275 lua_pushstring(L,games[i].menuicon_path.c_str());
276 lua_settable(L, top_lvl2);
278 lua_pushstring(L,"addon_mods_paths");
280 int table2 = lua_gettop(L);
281 int internal_index=1;
282 for (std::set<std::string>::iterator iter = games[i].addon_mods_paths.begin();
283 iter != games[i].addon_mods_paths.end(); iter++) {
284 lua_pushnumber(L,internal_index);
285 lua_pushstring(L,(*iter).c_str());
286 lua_settable(L, table2);
289 lua_settable(L, top_lvl2);
290 lua_settable(L, top);
295 /******************************************************************************/
296 int ModApiMainMenu::l_get_modstore_details(lua_State *L)
298 const char *modid = luaL_checkstring(L, 1);
302 std::string url = "";
304 url = g_settings->get("modstore_details_url");
306 catch(SettingNotFoundException &e) {
311 size_t idpos = url.find("*");
313 url.insert(idpos,modid);
315 details = getModstoreUrl(url);
317 ModStoreModDetails current_mod = readModStoreModDetails(details);
319 if ( current_mod.valid) {
321 int top = lua_gettop(L);
323 lua_pushstring(L,"id");
324 lua_pushnumber(L,current_mod.id);
325 lua_settable(L, top);
327 lua_pushstring(L,"title");
328 lua_pushstring(L,current_mod.title.c_str());
329 lua_settable(L, top);
331 lua_pushstring(L,"basename");
332 lua_pushstring(L,current_mod.basename.c_str());
333 lua_settable(L, top);
335 lua_pushstring(L,"description");
336 lua_pushstring(L,current_mod.description.c_str());
337 lua_settable(L, top);
339 lua_pushstring(L,"author");
340 lua_pushstring(L,current_mod.author.username.c_str());
341 lua_settable(L, top);
343 lua_pushstring(L,"download_url");
344 lua_pushstring(L,current_mod.versions[0].file.c_str());
345 lua_settable(L, top);
347 lua_pushstring(L,"screenshot_url");
348 lua_pushstring(L,current_mod.titlepic.file.c_str());
349 lua_settable(L, top);
351 lua_pushstring(L,"license");
352 lua_pushstring(L,current_mod.license.shortinfo.c_str());
353 lua_settable(L, top);
355 lua_pushstring(L,"rating");
356 lua_pushnumber(L,current_mod.rating);
357 lua_settable(L, top);
368 /******************************************************************************/
369 int ModApiMainMenu::l_get_modstore_list(lua_State *L)
371 GUIEngine* engine = getGuiEngine(L);
374 std::string listtype = "local";
376 if (!lua_isnone(L,1)) {
377 listtype = luaL_checkstring(L,1);
380 std::string url = "";
382 url = g_settings->get("modstore_listmods_url");
384 catch(SettingNotFoundException &e) {
389 mods = getModstoreUrl(url);
391 std::vector<ModStoreMod> moddata = readModStoreList(mods);
394 int top = lua_gettop(L);
395 unsigned int index = 1;
397 for (unsigned int i = 0; i < moddata.size(); i++)
399 if (moddata[i].valid) {
400 lua_pushnumber(L,index);
403 int top_lvl2 = lua_gettop(L);
405 lua_pushstring(L,"id");
406 lua_pushnumber(L,moddata[i].id);
407 lua_settable(L, top_lvl2);
409 lua_pushstring(L,"title");
410 lua_pushstring(L,moddata[i].title.c_str());
411 lua_settable(L, top_lvl2);
413 lua_pushstring(L,"basename");
414 lua_pushstring(L,moddata[i].basename.c_str());
415 lua_settable(L, top_lvl2);
417 lua_settable(L, top);
424 /******************************************************************************/
425 int ModApiMainMenu::l_get_favorites(lua_State *L)
427 GUIEngine* engine = getGuiEngine(L);
430 std::string listtype = "local";
432 if (!lua_isnone(L,1)) {
433 listtype = luaL_checkstring(L,1);
436 std::vector<ServerListSpec> servers;
438 if(listtype == "online") {
439 servers = ServerList::getOnline();
441 servers = ServerList::getLocal();
444 servers = ServerList::getLocal();
448 int top = lua_gettop(L);
449 unsigned int index = 1;
451 for (unsigned int i = 0; i < servers.size(); i++)
453 lua_pushnumber(L,index);
456 int top_lvl2 = lua_gettop(L);
458 if (servers[i]["clients"].asString().size()) {
460 const char* clients_raw = servers[i]["clients"].asString().c_str();
462 int numbervalue = strtol(clients_raw,&endptr,10);
464 if ((*clients_raw != 0) && (*endptr == 0)) {
465 lua_pushstring(L,"clients");
466 lua_pushnumber(L,numbervalue);
467 lua_settable(L, top_lvl2);
471 if (servers[i]["clients_max"].asString().size()) {
473 const char* clients_max_raw = servers[i]["clients_max"].asString().c_str();
475 int numbervalue = strtol(clients_max_raw,&endptr,10);
477 if ((*clients_max_raw != 0) && (*endptr == 0)) {
478 lua_pushstring(L,"clients_max");
479 lua_pushnumber(L,numbervalue);
480 lua_settable(L, top_lvl2);
484 if (servers[i]["version"].asString().size()) {
485 lua_pushstring(L,"version");
486 lua_pushstring(L,servers[i]["version"].asString().c_str());
487 lua_settable(L, top_lvl2);
490 if (servers[i]["password"].asString().size()) {
491 lua_pushstring(L,"password");
492 lua_pushboolean(L,true);
493 lua_settable(L, top_lvl2);
496 if (servers[i]["creative"].asString().size()) {
497 lua_pushstring(L,"creative");
498 lua_pushboolean(L,true);
499 lua_settable(L, top_lvl2);
502 if (servers[i]["damage"].asString().size()) {
503 lua_pushstring(L,"damage");
504 lua_pushboolean(L,true);
505 lua_settable(L, top_lvl2);
508 if (servers[i]["pvp"].asString().size()) {
509 lua_pushstring(L,"pvp");
510 lua_pushboolean(L,true);
511 lua_settable(L, top_lvl2);
514 if (servers[i]["description"].asString().size()) {
515 lua_pushstring(L,"description");
516 lua_pushstring(L,servers[i]["description"].asString().c_str());
517 lua_settable(L, top_lvl2);
520 if (servers[i]["name"].asString().size()) {
521 lua_pushstring(L,"name");
522 lua_pushstring(L,servers[i]["name"].asString().c_str());
523 lua_settable(L, top_lvl2);
526 if (servers[i]["address"].asString().size()) {
527 lua_pushstring(L,"address");
528 lua_pushstring(L,servers[i]["address"].asString().c_str());
529 lua_settable(L, top_lvl2);
532 if (servers[i]["port"].asString().size()) {
533 lua_pushstring(L,"port");
534 lua_pushstring(L,servers[i]["port"].asString().c_str());
535 lua_settable(L, top_lvl2);
538 lua_settable(L, top);
544 /******************************************************************************/
545 int ModApiMainMenu::l_delete_favorite(lua_State *L)
547 GUIEngine* engine = getGuiEngine(L);
550 std::vector<ServerListSpec> servers;
552 std::string listtype = "local";
554 if (!lua_isnone(L,2)) {
555 listtype = luaL_checkstring(L,2);
558 if ((listtype != "local") &&
559 (listtype != "online"))
563 if(listtype == "online") {
564 servers = ServerList::getOnline();
566 servers = ServerList::getLocal();
569 servers = ServerList::getLocal();
572 int fav_idx = luaL_checkinteger(L,1) -1;
574 if ((fav_idx >= 0) &&
575 (fav_idx < (int) servers.size())) {
577 ServerList::deleteEntry(servers[fav_idx]);
583 /******************************************************************************/
584 int ModApiMainMenu::l_show_keys_menu(lua_State *L)
586 GUIEngine* engine = getGuiEngine(L);
589 GUIKeyChangeMenu *kmenu
590 = new GUIKeyChangeMenu( engine->m_device->getGUIEnvironment(),
593 engine->m_menumanager);
598 /******************************************************************************/
599 int ModApiMainMenu::l_create_world(lua_State *L)
601 GUIEngine* engine = getGuiEngine(L);
604 const char *name = luaL_checkstring(L, 1);
605 int gameidx = luaL_checkinteger(L,2) -1;
607 std::string path = porting::path_user + DIR_DELIM
611 std::vector<SubgameSpec> games = getAvailableGames();
613 if ((gameidx >= 0) &&
614 (gameidx < (int) games.size())) {
616 // Create world if it doesn't exist
617 if(!initializeWorld(path, games[gameidx].id)){
618 lua_pushstring(L, "Failed to initialize world");
626 lua_pushstring(L, "Invalid game index");
631 /******************************************************************************/
632 int ModApiMainMenu::l_delete_world(lua_State *L)
634 GUIEngine* engine = getGuiEngine(L);
637 int worldidx = luaL_checkinteger(L,1) -1;
639 std::vector<WorldSpec> worlds = getAvailableWorlds();
641 if ((worldidx >= 0) &&
642 (worldidx < (int) worlds.size())) {
644 WorldSpec spec = worlds[worldidx];
646 std::vector<std::string> paths;
647 paths.push_back(spec.path);
648 fs::GetRecursiveSubPaths(spec.path, paths);
651 if (!fs::DeletePaths(paths)) {
652 lua_pushstring(L, "Failed to delete world");
659 lua_pushstring(L, "Invalid world index");
664 /******************************************************************************/
665 int ModApiMainMenu::l_set_topleft_text(lua_State *L)
667 GUIEngine* engine = getGuiEngine(L);
670 std::string text = "";
672 if (!lua_isnone(L,1) && !lua_isnil(L,1))
673 text = luaL_checkstring(L, 1);
675 engine->setTopleftText(text);
679 /******************************************************************************/
680 int ModApiMainMenu::l_get_modpath(lua_State *L)
683 = fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "mods" + DIR_DELIM);
684 lua_pushstring(L, modpath.c_str());
688 /******************************************************************************/
689 int ModApiMainMenu::l_get_gamepath(lua_State *L)
692 = fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "games" + DIR_DELIM);
693 lua_pushstring(L, gamepath.c_str());
697 /******************************************************************************/
698 int ModApiMainMenu::l_get_texturepath(lua_State *L)
701 = fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "textures");
702 lua_pushstring(L, gamepath.c_str());
706 /******************************************************************************/
707 int ModApiMainMenu::l_get_dirlist(lua_State *L)
709 const char *path = luaL_checkstring(L, 1);
710 bool dironly = lua_toboolean(L, 2);
712 std::vector<fs::DirListNode> dirlist = fs::GetDirListing(path);
714 unsigned int index = 1;
716 int table = lua_gettop(L);
718 for (unsigned int i=0;i< dirlist.size(); i++) {
719 if ((dirlist[i].dir) || (dironly == false)) {
720 lua_pushnumber(L,index);
721 lua_pushstring(L,dirlist[i].name.c_str());
722 lua_settable(L, table);
730 /******************************************************************************/
731 int ModApiMainMenu::l_create_dir(lua_State *L) {
732 const char *path = luaL_checkstring(L, 1);
734 if (ModApiMainMenu::isMinetestPath(path)) {
735 lua_pushboolean(L,fs::CreateAllDirs(path));
738 lua_pushboolean(L,false);
742 /******************************************************************************/
743 int ModApiMainMenu::l_delete_dir(lua_State *L)
745 const char *path = luaL_checkstring(L, 1);
747 std::string absolute_path = fs::RemoveRelativePathComponents(path);
749 if (ModApiMainMenu::isMinetestPath(absolute_path)) {
750 lua_pushboolean(L,fs::RecursiveDelete(absolute_path));
753 lua_pushboolean(L,false);
757 /******************************************************************************/
758 int ModApiMainMenu::l_copy_dir(lua_State *L)
760 const char *source = luaL_checkstring(L, 1);
761 const char *destination = luaL_checkstring(L, 2);
763 bool keep_source = true;
765 if ((!lua_isnone(L,3)) &&
767 keep_source = lua_toboolean(L,3);
770 std::string absolute_destination = fs::RemoveRelativePathComponents(destination);
771 std::string absolute_source = fs::RemoveRelativePathComponents(source);
773 if ((ModApiMainMenu::isMinetestPath(absolute_source)) &&
774 (ModApiMainMenu::isMinetestPath(absolute_destination))) {
775 bool retval = fs::CopyDir(absolute_source,absolute_destination);
777 if (retval && (!keep_source)) {
779 retval &= fs::RecursiveDelete(absolute_source);
781 lua_pushboolean(L,retval);
784 lua_pushboolean(L,false);
788 /******************************************************************************/
789 int ModApiMainMenu::l_extract_zip(lua_State *L)
791 GUIEngine* engine = getGuiEngine(L);
794 const char *zipfile = luaL_checkstring(L, 1);
795 const char *destination = luaL_checkstring(L, 2);
797 std::string absolute_destination = fs::RemoveRelativePathComponents(destination);
799 if (ModApiMainMenu::isMinetestPath(absolute_destination)) {
800 fs::CreateAllDirs(absolute_destination);
802 io::IFileSystem* fs = engine->m_device->getFileSystem();
804 fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP);
806 assert(fs->getFileArchiveCount() > 0);
808 /**********************************************************************/
809 /* WARNING this is not threadsafe!! */
810 /**********************************************************************/
811 io::IFileArchive* opened_zip =
812 fs->getFileArchive(fs->getFileArchiveCount()-1);
814 const io::IFileList* files_in_zip = opened_zip->getFileList();
816 unsigned int number_of_files = files_in_zip->getFileCount();
818 for (unsigned int i=0; i < number_of_files; i++) {
819 std::string fullpath = destination;
820 fullpath += DIR_DELIM;
821 fullpath += files_in_zip->getFullFileName(i).c_str();
823 if (files_in_zip->isDirectory(i)) {
824 if (! fs::CreateAllDirs(fullpath) ) {
825 fs->removeFileArchive(fs->getFileArchiveCount()-1);
826 lua_pushboolean(L,false);
831 io::IReadFile* toread = opened_zip->createAndOpenFile(i);
833 FILE *targetfile = fopen(fullpath.c_str(),"wb");
835 if (targetfile == NULL) {
836 fs->removeFileArchive(fs->getFileArchiveCount()-1);
837 lua_pushboolean(L,false);
841 char read_buffer[1024];
842 unsigned int total_read = 0;
844 while (total_read < toread->getSize()) {
846 unsigned int bytes_read =
847 toread->read(read_buffer,sizeof(read_buffer));
848 unsigned int bytes_written;
849 if ((bytes_read < 0 ) ||
850 (bytes_written = fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
853 fs->removeFileArchive(fs->getFileArchiveCount()-1);
854 lua_pushboolean(L,false);
857 total_read += bytes_read;
865 fs->removeFileArchive(fs->getFileArchiveCount()-1);
866 lua_pushboolean(L,true);
870 lua_pushboolean(L,false);
874 /******************************************************************************/
875 int ModApiMainMenu::l_get_scriptdir(lua_State *L)
877 GUIEngine* engine = getGuiEngine(L);
880 lua_pushstring(L,engine->getScriptDir().c_str());
884 /******************************************************************************/
885 bool ModApiMainMenu::isMinetestPath(std::string path)
887 if (fs::PathStartsWith(path,fs::TempPath()))
891 if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_share + DIR_DELIM + "games")))
895 if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "mods")))
899 if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "worlds")))
906 /******************************************************************************/
907 int ModApiMainMenu::l_show_file_open_dialog(lua_State *L)
909 GUIEngine* engine = getGuiEngine(L);
912 const char *formname= luaL_checkstring(L, 1);
913 const char *title = luaL_checkstring(L, 2);
915 GUIFileSelectMenu* fileOpenMenu =
916 new GUIFileSelectMenu(engine->m_device->getGUIEnvironment(),
919 engine->m_menumanager,
922 fileOpenMenu->setTextDest(engine->m_buttonhandler);
923 fileOpenMenu->drop();
927 /******************************************************************************/
928 int ModApiMainMenu::l_get_version(lua_State *L)
930 lua_pushstring(L,VERSION_STRING);
934 /******************************************************************************/
935 int ModApiMainMenu::l_sound_play(lua_State *L)
937 GUIEngine* engine = getGuiEngine(L);
939 SimpleSoundSpec spec;
940 read_soundspec(L, 1, spec);
941 bool looped = lua_toboolean(L, 2);
943 u32 handle = engine->playSound(spec, looped);
945 lua_pushinteger(L, handle);
950 /******************************************************************************/
951 int ModApiMainMenu::l_sound_stop(lua_State *L)
953 GUIEngine* engine = getGuiEngine(L);
955 u32 handle = luaL_checkinteger(L, 1);
956 engine->stopSound(handle);
961 /******************************************************************************/
962 int ModApiMainMenu::l_download_file(lua_State *L)
964 GUIEngine* engine = getGuiEngine(L);
967 const char *url = luaL_checkstring(L, 1);
968 const char *target = luaL_checkstring(L, 2);
971 std::string absolute_destination = fs::RemoveRelativePathComponents(target);
973 if (ModApiMainMenu::isMinetestPath(absolute_destination)) {
974 if (engine->downloadFile(url,absolute_destination)) {
975 lua_pushboolean(L,true);
979 lua_pushboolean(L,false);
983 /******************************************************************************/
984 void ModApiMainMenu::Initialize(lua_State *L, int top)
986 API_FCT(update_formspec);
988 API_FCT(get_textlist_index);
993 API_FCT(get_favorites);
994 API_FCT(show_keys_menu);
995 API_FCT(create_world);
996 API_FCT(delete_world);
997 API_FCT(delete_favorite);
998 API_FCT(set_background);
999 API_FCT(set_topleft_text);
1000 API_FCT(get_modpath);
1001 API_FCT(get_gamepath);
1002 API_FCT(get_texturepath);
1003 API_FCT(get_dirlist);
1004 API_FCT(create_dir);
1005 API_FCT(delete_dir);
1007 API_FCT(extract_zip);
1008 API_FCT(get_scriptdir);
1009 API_FCT(show_file_open_dialog);
1010 API_FCT(get_version);
1011 API_FCT(download_file);
1012 API_FCT(get_modstore_details);
1013 API_FCT(get_modstore_list);
1014 API_FCT(sound_play);
1015 API_FCT(sound_stop);