diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 935f28b..af6a259 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1705,6 +1705,9 @@ void GMenu2X::editLink() { sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Screenshots"], tr["Directory of the screenshots for the selector"], &linkSelScreens)); sd.addSetting(new MenuSettingFile(this, ts, tr["Selector Aliases"], tr["File containing a list of aliases for the selector"], &linkSelAliases)); sd.addSetting(new MenuSettingBool(this, ts, tr["Don't Leave"], tr["Don't quit GMenu2X when launching this link"], &menu->selLinkApp()->runsInBackgroundRef())); +#ifdef PLATFORM_DINGUX + sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &menu->selLinkApp()->consoleApp)); +#endif if (sd.exec() && sd.edited()) { ledOn(); diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 011b1ff..33777dd 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,9 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_, icon = iconPath = ""; selectorbrowser = false; useRamTimings = false; +#ifdef PLATFORM_DINGUX + consoleApp = false; +#endif string line; ifstream infile (linkfile, ios_base::in); @@ -78,6 +82,10 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_, manual = value; } else if (name == "dontleave") { if (value=="true") dontleave = true; +#ifdef PLATFORM_DINGUX + } else if (name == "consoleapp") { + if (value == "true") consoleApp = true; +#endif } else if (name == "clock") { setClock( atoi(value.c_str()) ); } else if (name == "selectordir") { @@ -167,6 +175,9 @@ bool LinkApp::save() { if (selectorscreens!="") f << "selectorscreens=" << selectorscreens << endl; if (aliasfile!="" ) f << "selectoraliases=" << aliasfile << endl; if (dontleave ) f << "dontleave=true" << endl; +#ifdef PLATFORM_DINGUX + if (consoleApp ) f << "consoleapp=true" << endl; +#endif f.close(); sync(); return true; @@ -429,6 +440,20 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) { signal(SIGTTOU, SIG_IGN); tcsetpgrp(STDOUT_FILENO, pgid); +#ifdef PLATFORM_DINGUX + if (consoleApp) { + /* Enable the framebuffer console */ + char c = '1'; + int fd = open("/sys/devices/virtual/vtconsole/vtcon1/bind", O_WRONLY); + if (fd < 0) { + WARNING("Unable to open fbcon handle\n"); + } else { + write(fd, &c, 1); + close(fd); + } + } +#endif + execlp("/bin/sh","/bin/sh", "-c", command.c_str(), NULL); //if execution continues then something went wrong and as we already called SDL_Quit we cannot continue //try relaunching gmenu2x diff --git a/src/linkapp.h b/src/linkapp.h index 058a2a6..0ed55b8 100644 --- a/src/linkapp.h +++ b/src/linkapp.h @@ -58,6 +58,10 @@ public: const char* linkfile); virtual const std::string &searchIcon(); +#ifdef PLATFORM_DINGUX + bool consoleApp; +#endif + const std::string &getExec(); void setExec(const std::string &exec); const std::string &getParams();