mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 05:24:03 +02:00
Drop GP2X platform support.
The GP2X build was unused and totally broken.
This commit is contained in:
parent
374371c1d2
commit
9263c782e7
@ -29,11 +29,6 @@ AC_ARG_ENABLE(platform,
|
|||||||
[GMENU2X_PLATFORM="$enableval"], [GMENU2X_PLATFORM="default"])
|
[GMENU2X_PLATFORM="$enableval"], [GMENU2X_PLATFORM="default"])
|
||||||
|
|
||||||
case "$GMENU2X_PLATFORM" in
|
case "$GMENU2X_PLATFORM" in
|
||||||
gp2x)
|
|
||||||
AC_DEFINE(PLATFORM_GP2X)
|
|
||||||
PLATFORM="gp2x"
|
|
||||||
SCREEN_RES="320x240"
|
|
||||||
;;
|
|
||||||
dingux)
|
dingux)
|
||||||
AC_DEFINE(PLATFORM_DINGUX)
|
AC_DEFINE(PLATFORM_DINGUX)
|
||||||
PLATFORM="dingux"
|
PLATFORM="dingux"
|
||||||
|
340
src/gmenu2x.cpp
340
src/gmenu2x.cpp
@ -257,69 +257,25 @@ void GMenu2X::init() {
|
|||||||
usbHandle = 0;
|
usbHandle = 0;
|
||||||
acHandle = 0;
|
acHandle = 0;
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
/* gp2x_mem = open("/dev/mem", O_RDWR);
|
|
||||||
gp2x_memregs=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_mem, 0xc0000000);
|
|
||||||
MEM_REG=&gp2x_memregs[0];
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
batteryHandle = fopen("/sys/class/power_supply/battery/capacity", "r");
|
batteryHandle = fopen("/sys/class/power_supply/battery/capacity", "r");
|
||||||
usbHandle = fopen("/sys/class/power_supply/usb/online", "r");
|
usbHandle = fopen("/sys/class/power_supply/usb/online", "r");
|
||||||
acHandle = fopen("/sys/class/power_supply/ac/online", "r");
|
acHandle = fopen("/sys/class/power_supply/ac/online", "r");
|
||||||
backlightHandle = fopen(
|
#if defined(PLATFORM_NANONOTE)
|
||||||
#ifdef PLATFORM_NANONOTE
|
backlightHandle = fopen("/sys/class/lcd/ili8960-lcd/contrast", "w+");
|
||||||
"/sys/class/lcd/ili8960-lcd/contrast",
|
#elif defined(PLATFORM_DINGUX)
|
||||||
#else
|
backlightHandle = fopen("/sys/class/backlight/pwm-backlight/brightness", "w+");
|
||||||
"/sys/class/backlight/pwm-backlight/brightness",
|
|
||||||
#endif
|
|
||||||
"w+");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::deinit() {
|
void GMenu2X::deinit() {
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
/* if (gp2x_mem!=0) {
|
|
||||||
gp2x_memregs[0x28DA>>1]=0x4AB;
|
|
||||||
gp2x_memregs[0x290C>>1]=640;
|
|
||||||
close(gp2x_mem);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
if (batteryHandle) fclose(batteryHandle);
|
if (batteryHandle) fclose(batteryHandle);
|
||||||
if (backlightHandle) fclose(backlightHandle);
|
if (backlightHandle) fclose(backlightHandle);
|
||||||
if (usbHandle) fclose(usbHandle);
|
if (usbHandle) fclose(usbHandle);
|
||||||
if (acHandle) fclose(acHandle);
|
if (acHandle) fclose(acHandle);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GMenu2X::GMenu2X()
|
GMenu2X::GMenu2X()
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
//Detect firmware version and type
|
|
||||||
if (fileExists("/etc/open2x")) {
|
|
||||||
fwType = "open2x";
|
|
||||||
fwVersion = "";
|
|
||||||
} else {
|
|
||||||
fwType = "gph";
|
|
||||||
fwVersion = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//open2x
|
|
||||||
savedVolumeMode = 0;
|
|
||||||
volumeMode = VOLUME_MODE_NORMAL;
|
|
||||||
volumeScalerNormal = VOLUME_SCALER_NORMAL;
|
|
||||||
volumeScalerPhones = VOLUME_SCALER_PHONES;
|
|
||||||
|
|
||||||
o2x_usb_net_on_boot = false;
|
|
||||||
o2x_usb_net_ip = "";
|
|
||||||
o2x_ftp_on_boot = false;
|
|
||||||
o2x_telnet_on_boot = false;
|
|
||||||
o2x_gp2xjoy_on_boot = false;
|
|
||||||
o2x_usb_host_on_boot = false;
|
|
||||||
o2x_usb_hid_on_boot = false;
|
|
||||||
o2x_usb_storage_on_boot = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
usbnet = samba = inet = web = false;
|
usbnet = samba = inet = web = false;
|
||||||
useSelectionPng = false;
|
useSelectionPng = false;
|
||||||
|
|
||||||
@ -327,19 +283,6 @@ GMenu2X::GMenu2X()
|
|||||||
//load config data
|
//load config data
|
||||||
readConfig();
|
readConfig();
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
if (fwType=="open2x") {
|
|
||||||
readConfigOpen2x();
|
|
||||||
// VOLUME MODIFIER
|
|
||||||
switch(volumeMode) {
|
|
||||||
case VOLUME_MODE_MUTE: setVolumeScaler(VOLUME_SCALER_MUTE); break;
|
|
||||||
case VOLUME_MODE_PHONES: setVolumeScaler(volumeScalerPhones); break;
|
|
||||||
case VOLUME_MODE_NORMAL: setVolumeScaler(volumeScalerNormal); break;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
readCommonIni();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
halfX = resX/2;
|
halfX = resX/2;
|
||||||
halfY = resY/2;
|
halfY = resY/2;
|
||||||
bottomBarIconY = resY-18;
|
bottomBarIconY = resY-18;
|
||||||
@ -398,8 +341,6 @@ GMenu2X::GMenu2X()
|
|||||||
PowerSaver::getInstance()->setScreenTimeout( confInt["backlightTimeout"] );
|
PowerSaver::getInstance()->setScreenTimeout( confInt["backlightTimeout"] );
|
||||||
|
|
||||||
setInputSpeed();
|
setInputSpeed();
|
||||||
initServices();
|
|
||||||
applyDefaultTimings();
|
|
||||||
setClock(confInt["menuClock"]);
|
setClock(confInt["menuClock"]);
|
||||||
//recover last session
|
//recover last session
|
||||||
readTmp();
|
readTmp();
|
||||||
@ -425,15 +366,6 @@ void GMenu2X::quit() {
|
|||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
unsetenv("SDL_FBCON_DONT_CLEAR");
|
unsetenv("SDL_FBCON_DONT_CLEAR");
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
/* if (gp2x_mem!=0) {
|
|
||||||
//Fix tv-out
|
|
||||||
if (gp2x_memregs[0x2800>>1]&0x100) {
|
|
||||||
gp2x_memregs[0x2906>>1]=512;
|
|
||||||
gp2x_memregs[0x28E4>>1]=gp2x_memregs[0x290C>>1];
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
deinit();
|
deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,14 +459,6 @@ void GMenu2X::initMenu() {
|
|||||||
menu->addActionLink(i,"GMenu2X",MakeDelegate(this,&GMenu2X::options),tr["Configure GMenu2X's options"],"skin:icons/configure.png");
|
menu->addActionLink(i,"GMenu2X",MakeDelegate(this,&GMenu2X::options),tr["Configure GMenu2X's options"],"skin:icons/configure.png");
|
||||||
menu->addActionLink(i,tr["Skin"],MakeDelegate(this,&GMenu2X::skinMenu),tr["Configure skin"],"skin:icons/skin.png");
|
menu->addActionLink(i,tr["Skin"],MakeDelegate(this,&GMenu2X::skinMenu),tr["Configure skin"],"skin:icons/skin.png");
|
||||||
menu->addActionLink(i,tr["Wallpaper"],MakeDelegate(this,&GMenu2X::changeWallpaper),tr["Change GMenu2X wallpaper"],"skin:icons/wallpaper.png");
|
menu->addActionLink(i,tr["Wallpaper"],MakeDelegate(this,&GMenu2X::changeWallpaper),tr["Change GMenu2X wallpaper"],"skin:icons/wallpaper.png");
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
if (fwType=="open2x")
|
|
||||||
menu->addActionLink(i,"Open2x",MakeDelegate(this,&GMenu2X::settingsOpen2x),tr["Configure Open2x system settings"],"skin:icons/o2xconfigure.png");
|
|
||||||
/* menu->addActionLink(i,"USB Sd",MakeDelegate(this,&GMenu2X::activateSdUsb),tr["Activate Usb on SD"],"skin:icons/usb.png");
|
|
||||||
if (fwType=="gph" && !f200)
|
|
||||||
menu->addActionLink(i,"USB Nand",MakeDelegate(this,&GMenu2X::activateNandUsb),tr["Activate Usb on Nand"],"skin:icons/usb.png");
|
|
||||||
//menu->addActionLink(i,"USB Root",MakeDelegate(this,&GMenu2X::activateRootUsb),tr["Activate Usb on the root of the Gp2x Filesystem"],"skin:icons/usb.png");*/
|
|
||||||
#endif
|
|
||||||
if (fileExists(getHome()+"/log.txt"))
|
if (fileExists(getHome()+"/log.txt"))
|
||||||
menu->addActionLink(i,tr["Log Viewer"],MakeDelegate(this,&GMenu2X::viewLog),tr["Displays last launched program's output"],"skin:icons/ebook.png");
|
menu->addActionLink(i,tr["Log Viewer"],MakeDelegate(this,&GMenu2X::viewLog),tr["Displays last launched program's output"],"skin:icons/ebook.png");
|
||||||
menu->addActionLink(i,tr["About"],MakeDelegate(this,&GMenu2X::about),tr["Info about GMenu2X"],"skin:icons/about.png");
|
menu->addActionLink(i,tr["About"],MakeDelegate(this,&GMenu2X::about),tr["Info about GMenu2X"],"skin:icons/about.png");
|
||||||
@ -587,11 +511,9 @@ void GMenu2X::viewLog() {
|
|||||||
mb.setButton(InputManager::ACCEPT, tr["Yes"]);
|
mb.setButton(InputManager::ACCEPT, tr["Yes"]);
|
||||||
mb.setButton(InputManager::CANCEL, tr["No"]);
|
mb.setButton(InputManager::CANCEL, tr["No"]);
|
||||||
if (mb.exec() == InputManager::ACCEPT) {
|
if (mb.exec() == InputManager::ACCEPT) {
|
||||||
ledOn();
|
|
||||||
unlink(logfile.c_str());
|
unlink(logfile.c_str());
|
||||||
sync();
|
sync();
|
||||||
menu->deleteSelectedLink();
|
menu->deleteSelectedLink();
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,7 +568,6 @@ void GMenu2X::readConfig(string conffile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::writeConfig() {
|
void GMenu2X::writeConfig() {
|
||||||
ledOn();
|
|
||||||
string conffile = getHome() + "/gmenu2x.conf";
|
string conffile = getHome() + "/gmenu2x.conf";
|
||||||
ofstream inf(conffile.c_str());
|
ofstream inf(conffile.c_str());
|
||||||
if (inf.is_open()) {
|
if (inf.is_open()) {
|
||||||
@ -661,63 +582,9 @@ void GMenu2X::writeConfig() {
|
|||||||
inf.close();
|
inf.close();
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
void GMenu2X::readConfigOpen2x() {
|
|
||||||
string conffile = "/etc/config/open2x.conf";
|
|
||||||
if (fileExists(conffile)) {
|
|
||||||
ifstream inf(conffile.c_str(), ios_base::in);
|
|
||||||
if (inf.is_open()) {
|
|
||||||
string line;
|
|
||||||
while (getline(inf, line, '\n')) {
|
|
||||||
string::size_type pos = line.find("=");
|
|
||||||
string name = trim(line.substr(0,pos));
|
|
||||||
string value = trim(line.substr(pos+1,line.length()));
|
|
||||||
|
|
||||||
if (name=="USB_NET_ON_BOOT") o2x_usb_net_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="USB_NET_IP") o2x_usb_net_ip = value;
|
|
||||||
else if (name=="TELNET_ON_BOOT") o2x_telnet_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="FTP_ON_BOOT") o2x_ftp_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="GP2XJOY_ON_BOOT") o2x_gp2xjoy_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="USB_HOST_ON_BOOT") o2x_usb_host_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="USB_HID_ON_BOOT") o2x_usb_hid_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="USB_STORAGE_ON_BOOT") o2x_usb_storage_on_boot = value == "y" ? true : false;
|
|
||||||
else if (name=="VOLUME_MODE") volumeMode = savedVolumeMode = constrain( atoi(value.c_str()), 0, 2);
|
|
||||||
else if (name=="PHONES_VALUE") volumeScalerPhones = constrain( atoi(value.c_str()), 0, 100);
|
|
||||||
else if (name=="NORMAL_VALUE") volumeScalerNormal = constrain( atoi(value.c_str()), 0, 150);
|
|
||||||
}
|
|
||||||
inf.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void GMenu2X::writeConfigOpen2x() {
|
|
||||||
ledOn();
|
|
||||||
string conffile = "/etc/config/open2x.conf";
|
|
||||||
ofstream inf(conffile.c_str());
|
|
||||||
if (inf.is_open()) {
|
|
||||||
inf << "USB_NET_ON_BOOT=" << ( o2x_usb_net_on_boot ? "y" : "n" ) << endl;
|
|
||||||
inf << "USB_NET_IP=" << o2x_usb_net_ip << endl;
|
|
||||||
inf << "TELNET_ON_BOOT=" << ( o2x_telnet_on_boot ? "y" : "n" ) << endl;
|
|
||||||
inf << "FTP_ON_BOOT=" << ( o2x_ftp_on_boot ? "y" : "n" ) << endl;
|
|
||||||
inf << "GP2XJOY_ON_BOOT=" << ( o2x_gp2xjoy_on_boot ? "y" : "n" ) << endl;
|
|
||||||
inf << "USB_HOST_ON_BOOT=" << ( (o2x_usb_host_on_boot || o2x_usb_hid_on_boot || o2x_usb_storage_on_boot) ? "y" : "n" ) << endl;
|
|
||||||
inf << "USB_HID_ON_BOOT=" << ( o2x_usb_hid_on_boot ? "y" : "n" ) << endl;
|
|
||||||
inf << "USB_STORAGE_ON_BOOT=" << ( o2x_usb_storage_on_boot ? "y" : "n" ) << endl;
|
|
||||||
inf << "VOLUME_MODE=" << volumeMode << endl;
|
|
||||||
if (volumeScalerPhones != VOLUME_SCALER_PHONES) inf << "PHONES_VALUE=" << volumeScalerPhones << endl;
|
|
||||||
if (volumeScalerNormal != VOLUME_SCALER_NORMAL) inf << "NORMAL_VALUE=" << volumeScalerNormal << endl;
|
|
||||||
inf.close();
|
|
||||||
sync();
|
|
||||||
}
|
|
||||||
ledOff();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GMenu2X::writeSkinConfig() {
|
void GMenu2X::writeSkinConfig() {
|
||||||
ledOn();
|
|
||||||
|
|
||||||
string conffile = getHome() + "/skins/";
|
string conffile = getHome() + "/skins/";
|
||||||
if (!fileExists(conffile))
|
if (!fileExists(conffile))
|
||||||
mkdir(conffile.c_str(), 0770);
|
mkdir(conffile.c_str(), 0770);
|
||||||
@ -752,49 +619,8 @@ void GMenu2X::writeSkinConfig() {
|
|||||||
inf.close();
|
inf.close();
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
void GMenu2X::readCommonIni() {
|
|
||||||
if (fileExists("/usr/gp2x/common.ini")) {
|
|
||||||
ifstream inf("/usr/gp2x/common.ini", ios_base::in);
|
|
||||||
if (inf.is_open()) {
|
|
||||||
string line;
|
|
||||||
string section = "";
|
|
||||||
while (getline(inf, line, '\n')) {
|
|
||||||
line = trim(line);
|
|
||||||
if (line[0]=='[' && line[line.length()-1]==']') {
|
|
||||||
section = line.substr(1,line.length()-2);
|
|
||||||
} else {
|
|
||||||
string::size_type pos = line.find("=");
|
|
||||||
string name = trim(line.substr(0,pos));
|
|
||||||
string value = trim(line.substr(pos+1,line.length()));
|
|
||||||
|
|
||||||
if (section=="usbnet") {
|
|
||||||
if (name=="enable")
|
|
||||||
usbnet = value=="true" ? true : false;
|
|
||||||
else if (name=="ip")
|
|
||||||
ip = value;
|
|
||||||
|
|
||||||
} else if (section=="server") {
|
|
||||||
if (name=="inet")
|
|
||||||
inet = value=="true" ? true : false;
|
|
||||||
else if (name=="samba")
|
|
||||||
samba = value=="true" ? true : false;
|
|
||||||
else if (name=="web")
|
|
||||||
web = value=="true" ? true : false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inf.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMenu2X::writeCommonIni() {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GMenu2X::readTmp() {
|
void GMenu2X::readTmp() {
|
||||||
lastSelectorElement = -1;
|
lastSelectorElement = -1;
|
||||||
if (fileExists("/tmp/gmenu2x.tmp")) {
|
if (fileExists("/tmp/gmenu2x.tmp")) {
|
||||||
@ -836,29 +662,6 @@ void GMenu2X::writeTmp(int selelem, const string &selectordir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::initServices() {
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
/* if (usbnet) {
|
|
||||||
string services = "scripts/services.sh "+ip+" "+(inet?"on":"off")+" "+(samba?"on":"off")+" "+(web?"on":"off")+" &";
|
|
||||||
system(services.c_str());
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMenu2X::ledOn() {
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
// if (gp2x_mem!=0 && !f200) gp2x_memregs[0x106E >> 1] ^= 16;
|
|
||||||
//SDL_SYS_JoystickGp2xSys(joy.joystick, BATT_LED_ON);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMenu2X::ledOff() {
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
// if (gp2x_mem!=0 && !f200) gp2x_memregs[0x106E >> 1] ^= 16;
|
|
||||||
//SDL_SYS_JoystickGp2xSys(joy.joystick, BATT_LED_OFF);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMenu2X::setBacklight(int val)
|
void GMenu2X::setBacklight(int val)
|
||||||
{
|
{
|
||||||
if (backlightHandle) {
|
if (backlightHandle) {
|
||||||
@ -888,11 +691,7 @@ void GMenu2X::main() {
|
|||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
int x,y, offset = menu->sectionLinks()->size()>linksPerPage ? 2 : 6;
|
int x,y, offset = menu->sectionLinks()->size()>linksPerPage ? 2 : 6;
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
int helpBoxHeight = fwType=="open2x" ? 154 : 139;
|
|
||||||
#else
|
|
||||||
int helpBoxHeight = 154;
|
int helpBoxHeight = 154;
|
||||||
#endif
|
|
||||||
uint i;
|
uint i;
|
||||||
long tickBattery = -60000, tickNow;
|
long tickBattery = -60000, tickNow;
|
||||||
string batteryIcon = "imgs/battery/0.png";
|
string batteryIcon = "imgs/battery/0.png";
|
||||||
@ -1011,15 +810,6 @@ void GMenu2X::main() {
|
|||||||
s->write( font, tr["L, R: Change section"], 20, 110 );
|
s->write( font, tr["L, R: Change section"], 20, 110 );
|
||||||
s->write( font, tr["SELECT: Show contextual menu"], 20, 155 );
|
s->write( font, tr["SELECT: Show contextual menu"], 20, 155 );
|
||||||
s->write( font, tr["START: Show options menu"], 20, 170 );
|
s->write( font, tr["START: Show options menu"], 20, 170 );
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
s->write( font, tr["B, Stick press: Launch link / Confirm action"], 20, 80 );
|
|
||||||
s->write( font, tr["L, R: Change section"], 20, 95 );
|
|
||||||
s->write( font, tr["VOLUP, VOLDOWN: Change cpu clock"], 20, 125 );
|
|
||||||
s->write( font, tr["A+VOLUP, A+VOLDOWN: Change volume"], 20, 140 );
|
|
||||||
s->write( font, tr["SELECT: Show contextual menu"], 20, 155 );
|
|
||||||
s->write( font, tr["START: Show options menu"], 20, 170 );
|
|
||||||
if (fwType=="open2x") s->write( font, tr["X: Toggle speaker mode"], 20, 185 );
|
|
||||||
#endif
|
#endif
|
||||||
s->flip();
|
s->flip();
|
||||||
while (input.waitForPressedButton() != InputManager::CANCEL) {}
|
while (input.waitForPressedButton() != InputManager::CANCEL) {}
|
||||||
@ -1171,10 +961,6 @@ void GMenu2X::explorer() {
|
|||||||
if (fd.exec()) {
|
if (fd.exec()) {
|
||||||
if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex()))
|
if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex()))
|
||||||
writeConfig();
|
writeConfig();
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
if (fwType == "open2x" && savedVolumeMode != volumeMode)
|
|
||||||
writeConfigOpen2x();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//string command = cmdclean(fd.path()+"/"+fd.file) + "; sync & cd "+cmdclean(getExePath())+"; exec ./gmenu2x";
|
//string command = cmdclean(fd.path()+"/"+fd.file) + "; sync & cd "+cmdclean(getExePath())+"; exec ./gmenu2x";
|
||||||
string command = cmdclean(fd.getPath()+"/"+fd.getFile());
|
string command = cmdclean(fd.getPath()+"/"+fd.getFile());
|
||||||
@ -1245,32 +1031,6 @@ void GMenu2X::options() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
void GMenu2X::settingsOpen2x() {
|
|
||||||
SettingsDialog sd(this, input, ts, tr["Open2x Settings"]);
|
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["USB net on boot"], tr["Allow USB networking to be started at boot time"], &o2x_usb_net_on_boot));
|
|
||||||
sd.addSetting(new MenuSettingString(this, ts, tr["USB net IP"], tr["IP address to be used for USB networking"], &o2x_usb_net_ip));
|
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Telnet on boot"], tr["Allow telnet to be started at boot time"], &o2x_telnet_on_boot));
|
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["FTP on boot"], tr["Allow FTP to be started at boot time"], &o2x_ftp_on_boot));
|
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["GP2XJOY on boot"], tr["Create a js0 device for GP2X controls"], &o2x_gp2xjoy_on_boot));
|
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["USB host on boot"], tr["Allow USB host to be started at boot time"], &o2x_usb_host_on_boot));
|
|
||||||
sd.addSetting(new MenuSettingBool(this,ts, tr["USB HID on boot"], tr["Allow USB HID to be started at boot time"], &o2x_usb_hid_on_boot));
|
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["USB storage on boot"], tr["Allow USB storage to be started at boot time"], &o2x_usb_storage_on_boot));
|
|
||||||
//sd.addSetting(new MenuSettingInt(this, ts, tr["Speaker Mode on boot"], tr["Set Speaker mode. 0 = Mute, 1 = Phones, 2 = Speaker"], &volumeMode, 0, 2));
|
|
||||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Speaker Scaler"], tr["Set the Speaker Mode scaling 0-150\% (default is 100\%)"], &volumeScalerNormal, 0, 150));
|
|
||||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Headphones Scaler"], tr["Set the Headphones Mode scaling 0-100\% (default is 65\%)"], &volumeScalerPhones, 0, 100));
|
|
||||||
|
|
||||||
if (sd.exec() && sd.edited()) {
|
|
||||||
writeConfigOpen2x();
|
|
||||||
switch(volumeMode) {
|
|
||||||
case VOLUME_MODE_MUTE: setVolumeScaler(VOLUME_SCALER_MUTE); break;
|
|
||||||
case VOLUME_MODE_PHONES: setVolumeScaler(volumeScalerPhones); break;
|
|
||||||
case VOLUME_MODE_NORMAL: setVolumeScaler(volumeScalerNormal); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GMenu2X::skinMenu() {
|
void GMenu2X::skinMenu() {
|
||||||
FileLister fl_sk(getHome() + "/skins", true, false);
|
FileLister fl_sk(getHome() + "/skins", true, false);
|
||||||
fl_sk.addExclude("..");
|
fl_sk.addExclude("..");
|
||||||
@ -1573,10 +1333,8 @@ void GMenu2X::changeWallpaper() {
|
|||||||
void GMenu2X::addLink() {
|
void GMenu2X::addLink() {
|
||||||
FileDialog fd(this, ts, tr["Select an application"]);
|
FileDialog fd(this, ts, tr["Select an application"]);
|
||||||
if (fd.exec()) {
|
if (fd.exec()) {
|
||||||
ledOn();
|
|
||||||
menu->addLink(fd.getPath(), fd.getFile());
|
menu->addLink(fd.getPath(), fd.getFile());
|
||||||
sync();
|
sync();
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1598,7 +1356,6 @@ void GMenu2X::editLink() {
|
|||||||
string linkSelFilter = menu->selLinkApp()->getSelectorFilter();
|
string linkSelFilter = menu->selLinkApp()->getSelectorFilter();
|
||||||
string linkSelDir = menu->selLinkApp()->getSelectorDir();
|
string linkSelDir = menu->selLinkApp()->getSelectorDir();
|
||||||
bool linkSelBrowser = menu->selLinkApp()->getSelectorBrowser();
|
bool linkSelBrowser = menu->selLinkApp()->getSelectorBrowser();
|
||||||
bool linkUseRamTimings = menu->selLinkApp()->getUseRamTimings();
|
|
||||||
string linkSelScreens = menu->selLinkApp()->getSelectorScreens();
|
string linkSelScreens = menu->selLinkApp()->getSelectorScreens();
|
||||||
string linkSelAliases = menu->selLinkApp()->getAliasFile();
|
string linkSelAliases = menu->selLinkApp()->getAliasFile();
|
||||||
int linkClock = menu->selLinkApp()->clock();
|
int linkClock = menu->selLinkApp()->clock();
|
||||||
@ -1613,7 +1370,6 @@ void GMenu2X::editLink() {
|
|||||||
sd.addSetting(new MenuSettingImage(this, ts, tr["Icon"], tr.translate("Select an icon for the link: $1", linkTitle.c_str(), NULL), &linkIcon, ".png,.bmp,.jpg,.jpeg"));
|
sd.addSetting(new MenuSettingImage(this, ts, tr["Icon"], tr.translate("Select an icon for the link: $1", linkTitle.c_str(), NULL), &linkIcon, ".png,.bmp,.jpg,.jpeg"));
|
||||||
sd.addSetting(new MenuSettingFile(this, ts, tr["Manual"], tr["Select a graphic/textual manual or a readme"], &linkManual, ".man.png,.txt"));
|
sd.addSetting(new MenuSettingFile(this, ts, tr["Manual"], tr["Select a graphic/textual manual or a readme"], &linkManual, ".man.png,.txt"));
|
||||||
sd.addSetting(new MenuSettingInt(this, ts, tr["Clock (default: 336)"], tr["Cpu clock frequency to set when launching this link"], &linkClock, cpuFreqMin, confInt["maxClock"], cpuFreqMultiple));
|
sd.addSetting(new MenuSettingInt(this, ts, tr["Clock (default: 336)"], tr["Cpu clock frequency to set when launching this link"], &linkClock, cpuFreqMin, confInt["maxClock"], cpuFreqMultiple));
|
||||||
// sd.addSetting(new MenuSettingBool(this, ts, tr["Tweak RAM Timings"], tr["This usually speeds up the application at the cost of stability"], &linkUseRamTimings));
|
|
||||||
sd.addSetting(new MenuSettingString(this, ts, tr["Parameters"], tr["Parameters to pass to the application"], &linkParams, diagTitle, diagIcon));
|
sd.addSetting(new MenuSettingString(this, ts, tr["Parameters"], tr["Parameters to pass to the application"], &linkParams, diagTitle, diagIcon));
|
||||||
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Directory"], tr["Directory to scan for the selector"], &linkSelDir));
|
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Directory"], tr["Directory to scan for the selector"], &linkSelDir));
|
||||||
sd.addSetting(new MenuSettingBool(this, ts, tr["Selector Browser"], tr["Allow the selector to change directory"], &linkSelBrowser));
|
sd.addSetting(new MenuSettingBool(this, ts, tr["Selector Browser"], tr["Allow the selector to change directory"], &linkSelBrowser));
|
||||||
@ -1626,8 +1382,6 @@ void GMenu2X::editLink() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sd.exec() && sd.edited()) {
|
if (sd.exec() && sd.edited()) {
|
||||||
ledOn();
|
|
||||||
|
|
||||||
menu->selLinkApp()->setTitle(linkTitle);
|
menu->selLinkApp()->setTitle(linkTitle);
|
||||||
menu->selLinkApp()->setDescription(linkDescription);
|
menu->selLinkApp()->setDescription(linkDescription);
|
||||||
menu->selLinkApp()->setIcon(linkIcon);
|
menu->selLinkApp()->setIcon(linkIcon);
|
||||||
@ -1636,7 +1390,6 @@ void GMenu2X::editLink() {
|
|||||||
menu->selLinkApp()->setSelectorFilter(linkSelFilter);
|
menu->selLinkApp()->setSelectorFilter(linkSelFilter);
|
||||||
menu->selLinkApp()->setSelectorDir(linkSelDir);
|
menu->selLinkApp()->setSelectorDir(linkSelDir);
|
||||||
menu->selLinkApp()->setSelectorBrowser(linkSelBrowser);
|
menu->selLinkApp()->setSelectorBrowser(linkSelBrowser);
|
||||||
menu->selLinkApp()->setUseRamTimings(linkUseRamTimings);
|
|
||||||
menu->selLinkApp()->setSelectorScreens(linkSelScreens);
|
menu->selLinkApp()->setSelectorScreens(linkSelScreens);
|
||||||
menu->selLinkApp()->setAliasFile(linkSelAliases);
|
menu->selLinkApp()->setAliasFile(linkSelAliases);
|
||||||
menu->selLinkApp()->setClock(linkClock);
|
menu->selLinkApp()->setClock(linkClock);
|
||||||
@ -1664,8 +1417,6 @@ void GMenu2X::editLink() {
|
|||||||
}
|
}
|
||||||
menu->selLinkApp()->save();
|
menu->selLinkApp()->save();
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1675,10 +1426,8 @@ void GMenu2X::deleteLink() {
|
|||||||
mb.setButton(InputManager::ACCEPT, tr["Yes"]);
|
mb.setButton(InputManager::ACCEPT, tr["Yes"]);
|
||||||
mb.setButton(InputManager::CANCEL, tr["No"]);
|
mb.setButton(InputManager::CANCEL, tr["No"]);
|
||||||
if (mb.exec() == InputManager::ACCEPT) {
|
if (mb.exec() == InputManager::ACCEPT) {
|
||||||
ledOn();
|
|
||||||
menu->deleteSelectedLink();
|
menu->deleteSelectedLink();
|
||||||
sync();
|
sync();
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1690,12 +1439,10 @@ void GMenu2X::addSection() {
|
|||||||
if (find(menu->getSections().begin(), menu->getSections().end(), id.getInput())
|
if (find(menu->getSections().begin(), menu->getSections().end(), id.getInput())
|
||||||
== menu->getSections().end()) {
|
== menu->getSections().end()) {
|
||||||
//section directory doesn't exists
|
//section directory doesn't exists
|
||||||
ledOn();
|
|
||||||
if (menu->addSection(id.getInput())) {
|
if (menu->addSection(id.getInput())) {
|
||||||
menu->setSectionIndex( menu->getSections().size()-1 ); //switch to the new section
|
menu->setSectionIndex( menu->getSections().size()-1 ); //switch to the new section
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1710,7 +1457,6 @@ void GMenu2X::renameSection() {
|
|||||||
//section directory doesn't exists
|
//section directory doesn't exists
|
||||||
string newsectiondir = getHome() + "/sections/" + id.getInput();
|
string newsectiondir = getHome() + "/sections/" + id.getInput();
|
||||||
string sectiondir = getHome() + "/sections/" + menu->selSection();
|
string sectiondir = getHome() + "/sections/" + menu->selSection();
|
||||||
ledOn();
|
|
||||||
|
|
||||||
if (!rename(sectiondir.c_str(), newsectiondir.c_str())) {
|
if (!rename(sectiondir.c_str(), newsectiondir.c_str())) {
|
||||||
string oldpng = menu->selSection() + ".png";
|
string oldpng = menu->selSection() + ".png";
|
||||||
@ -1730,7 +1476,6 @@ void GMenu2X::renameSection() {
|
|||||||
menu->renameSection(menu->selSectionIndex(), id.getInput());
|
menu->renameSection(menu->selSectionIndex(), id.getInput());
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1740,12 +1485,11 @@ void GMenu2X::deleteSection() {
|
|||||||
mb.setButton(InputManager::ACCEPT, tr["Yes"]);
|
mb.setButton(InputManager::ACCEPT, tr["Yes"]);
|
||||||
mb.setButton(InputManager::CANCEL, tr["No"]);
|
mb.setButton(InputManager::CANCEL, tr["No"]);
|
||||||
if (mb.exec() == InputManager::ACCEPT) {
|
if (mb.exec() == InputManager::ACCEPT) {
|
||||||
ledOn();
|
|
||||||
if (rmtree(getHome() + "/sections/" + menu->selSection())) {
|
if (rmtree(getHome() + "/sections/" + menu->selSection())) {
|
||||||
menu->deleteSelectedSection();
|
menu->deleteSelectedSection();
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
ledOff();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1779,11 +1523,7 @@ void GMenu2X::scanner() {
|
|||||||
|
|
||||||
const char *nandpath = NULL;
|
const char *nandpath = NULL;
|
||||||
|
|
||||||
#if defined(PLATFORM_GP2X)
|
#ifdef PLATFORM_DINGUX
|
||||||
//Onyl gph firmware has nand
|
|
||||||
if (fwType=="gph" && !isF200())
|
|
||||||
nandpath = "/boot/local/nand";
|
|
||||||
#elif defined(PLATFORM_DINGUX)
|
|
||||||
nandpath = "/media/ccnandb1";
|
nandpath = "/media/ccnandb1";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1810,7 +1550,6 @@ void GMenu2X::scanner() {
|
|||||||
string::size_type pos;
|
string::size_type pos;
|
||||||
uint linkCount = 0;
|
uint linkCount = 0;
|
||||||
|
|
||||||
ledOn();
|
|
||||||
for (uint i = 0; i<files.size(); i++) {
|
for (uint i = 0; i<files.size(); i++) {
|
||||||
pos = files[i].rfind("/");
|
pos = files[i].rfind("/");
|
||||||
if (pos!=string::npos && pos>0) {
|
if (pos!=string::npos && pos>0) {
|
||||||
@ -1838,7 +1577,6 @@ void GMenu2X::scanner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
ledOff();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InputManager::Button button;
|
InputManager::Button button;
|
||||||
@ -1867,9 +1605,7 @@ void GMenu2X::scanPath(string path, vector<string> *files) {
|
|||||||
scanPath(filepath, files);
|
scanPath(filepath, files);
|
||||||
if (statRet != -1) {
|
if (statRet != -1) {
|
||||||
ext = filepath.substr(filepath.length()-4,4);
|
ext = filepath.substr(filepath.length()-4,4);
|
||||||
#ifdef PLATFORM_GP2X
|
#if defined(PLATFORM_DINGUX) || defined(PLATFORM_NANONOTE)
|
||||||
if (ext==".gpu")
|
|
||||||
#elif defined(PLATFORM_DINGUX) || defined(PLATFORM_NANONOTE)
|
|
||||||
if (ext==".dge")
|
if (ext==".dge")
|
||||||
#else
|
#else
|
||||||
if (ext==".pxml")
|
if (ext==".pxml")
|
||||||
@ -1887,41 +1623,6 @@ typedef struct {
|
|||||||
} MMSP2ADC;
|
} MMSP2ADC;
|
||||||
|
|
||||||
unsigned short GMenu2X::getBatteryLevel() {
|
unsigned short GMenu2X::getBatteryLevel() {
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
/* if (batteryHandle<=0) return 0;
|
|
||||||
|
|
||||||
if (f200) {
|
|
||||||
MMSP2ADC val;
|
|
||||||
read(batteryHandle, &val, sizeof(MMSP2ADC));
|
|
||||||
|
|
||||||
if (val.batt==0) return 5;
|
|
||||||
if (val.batt==1) return 3;
|
|
||||||
if (val.batt==2) return 1;
|
|
||||||
if (val.batt==3) return 0;
|
|
||||||
} else {
|
|
||||||
int battval = 0;
|
|
||||||
unsigned short cbv, min=900, max=0;
|
|
||||||
|
|
||||||
for (int i = 0; i < BATTERY_READS; i ++) {
|
|
||||||
if ( read(batteryHandle, &cbv, 2) == 2) {
|
|
||||||
battval += cbv;
|
|
||||||
if (cbv>max) max = cbv;
|
|
||||||
if (cbv<min) min = cbv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
battval -= min+max;
|
|
||||||
battval /= BATTERY_READS-2;
|
|
||||||
|
|
||||||
if (battval>=850) return 6;
|
|
||||||
if (battval>780) return 5;
|
|
||||||
if (battval>740) return 4;
|
|
||||||
if (battval>700) return 3;
|
|
||||||
if (battval>690) return 2;
|
|
||||||
if (battval>680) return 1;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
#else
|
|
||||||
if (!batteryHandle) return 0;
|
if (!batteryHandle) return 0;
|
||||||
int battval = 0;
|
int battval = 0;
|
||||||
fscanf(batteryHandle, "%d", &battval);
|
fscanf(batteryHandle, "%d", &battval);
|
||||||
@ -1939,9 +1640,6 @@ unsigned short GMenu2X::getBatteryLevel() {
|
|||||||
if (usbval==1) return 6;
|
if (usbval==1) return 6;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
//#else
|
|
||||||
// return 6; //AC Power
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::setInputSpeed() {
|
void GMenu2X::setInputSpeed() {
|
||||||
@ -1962,30 +1660,6 @@ void GMenu2X::setInputSpeed() {
|
|||||||
SDL_EnableKeyRepeat(1,150);
|
SDL_EnableKeyRepeat(1,150);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMenu2X::applyRamTimings() {
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
// 6 4 1 1 1 2 2
|
|
||||||
/* if (gp2x_mem!=0) {
|
|
||||||
int tRC = 5, tRAS = 3, tWR = 0, tMRD = 0, tRFC = 0, tRP = 1, tRCD = 1;
|
|
||||||
gp2x_memregs[0x3802>>1] = ((tMRD & 0xF) << 12) | ((tRFC & 0xF) << 8) | ((tRP & 0xF) << 4) | (tRCD & 0xF);
|
|
||||||
gp2x_memregs[0x3804>>1] = ((tRC & 0xF) << 8) | ((tRAS & 0xF) << 4) | (tWR & 0xF);
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMenu2X::applyDefaultTimings() {
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
// 8 16 3 8 8 8 8
|
|
||||||
/* if (gp2x_mem!=0) {
|
|
||||||
int tRC = 7, tRAS = 15, tWR = 2, tMRD = 7, tRFC = 7, tRP = 7, tRCD = 7;
|
|
||||||
gp2x_memregs[0x3802>>1] = ((tMRD & 0xF) << 12) | ((tRFC & 0xF) << 8) | ((tRP & 0xF) << 4) | (tRCD & 0xF);
|
|
||||||
gp2x_memregs[0x3804>>1] = ((tRC & 0xF) << 8) | ((tRAS & 0xF) << 4) | (tWR & 0xF);
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GMenu2X::setClock(unsigned mhz) {
|
void GMenu2X::setClock(unsigned mhz) {
|
||||||
mhz = constrain(mhz, cpuFreqMin, confInt["maxClock"]);
|
mhz = constrain(mhz, cpuFreqMin, confInt["maxClock"]);
|
||||||
#if defined(PLATFORM_DINGUX) || defined(PLATFORM_NANONOTE)
|
#if defined(PLATFORM_DINGUX) || defined(PLATFORM_NANONOTE)
|
||||||
|
@ -117,16 +117,6 @@ private:
|
|||||||
void initFont();
|
void initFont();
|
||||||
void initMenu();
|
void initMenu();
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
void readConfigOpen2x();
|
|
||||||
void readCommonIni();
|
|
||||||
void writeCommonIni();
|
|
||||||
|
|
||||||
unsigned long gp2x_mem;
|
|
||||||
unsigned short *gp2x_memregs;
|
|
||||||
volatile unsigned short *MEM_REG;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void initCPULimits();
|
void initCPULimits();
|
||||||
void init();
|
void init();
|
||||||
void deinit();
|
void deinit();
|
||||||
@ -167,23 +157,6 @@ public:
|
|||||||
bool useSelectionPng;
|
bool useSelectionPng;
|
||||||
void setSkin(const std::string &skin, bool setWallpaper = true);
|
void setSkin(const std::string &skin, bool setWallpaper = true);
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
//firmware type and version
|
|
||||||
std::string fwType, fwVersion;
|
|
||||||
|
|
||||||
bool isF200() { return ts.available(); }
|
|
||||||
|
|
||||||
// Open2x settings ---------------------------------------------------------
|
|
||||||
bool o2x_usb_net_on_boot, o2x_ftp_on_boot, o2x_telnet_on_boot, o2x_gp2xjoy_on_boot, o2x_usb_host_on_boot, o2x_usb_hid_on_boot, o2x_usb_storage_on_boot;
|
|
||||||
std::string o2x_usb_net_ip;
|
|
||||||
int volumeMode, savedVolumeMode; // just use the const int scale values at top of source
|
|
||||||
|
|
||||||
// Volume scaling values to store from config files
|
|
||||||
int volumeScalerPhones;
|
|
||||||
int volumeScalerNormal;
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SurfaceCollection sc;
|
SurfaceCollection sc;
|
||||||
Translator tr;
|
Translator tr;
|
||||||
Surface *s, *bg;
|
Surface *s, *bg;
|
||||||
@ -192,9 +165,6 @@ public:
|
|||||||
//Status functions
|
//Status functions
|
||||||
void main();
|
void main();
|
||||||
void options();
|
void options();
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
void settingsOpen2x();
|
|
||||||
#endif
|
|
||||||
void skinMenu();
|
void skinMenu();
|
||||||
/*
|
/*
|
||||||
void activateSdUsb();
|
void activateSdUsb();
|
||||||
@ -206,9 +176,6 @@ public:
|
|||||||
void contextMenu();
|
void contextMenu();
|
||||||
void changeWallpaper();
|
void changeWallpaper();
|
||||||
|
|
||||||
void applyRamTimings();
|
|
||||||
void applyDefaultTimings();
|
|
||||||
|
|
||||||
void setClock(unsigned mhz);
|
void setClock(unsigned mhz);
|
||||||
|
|
||||||
void setVolume(int vol);
|
void setVolume(int vol);
|
||||||
@ -222,15 +189,9 @@ public:
|
|||||||
void setInputSpeed();
|
void setInputSpeed();
|
||||||
|
|
||||||
void writeConfig();
|
void writeConfig();
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
void writeConfigOpen2x();
|
|
||||||
#endif
|
|
||||||
void writeSkinConfig();
|
void writeSkinConfig();
|
||||||
void writeTmp(int selelem=-1, const std::string &selectordir="");
|
void writeTmp(int selelem=-1, const std::string &selectordir="");
|
||||||
|
|
||||||
void ledOn();
|
|
||||||
void ledOff();
|
|
||||||
|
|
||||||
void addLink();
|
void addLink();
|
||||||
void editLink();
|
void editLink();
|
||||||
void deleteLink();
|
void deleteLink();
|
||||||
|
@ -57,7 +57,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
selectorfilter = "";
|
selectorfilter = "";
|
||||||
icon = iconPath = "";
|
icon = iconPath = "";
|
||||||
selectorbrowser = false;
|
selectorbrowser = false;
|
||||||
useRamTimings = false;
|
|
||||||
#ifdef PLATFORM_DINGUX
|
#ifdef PLATFORM_DINGUX
|
||||||
consoleApp = false;
|
consoleApp = false;
|
||||||
#endif
|
#endif
|
||||||
@ -96,8 +95,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
setSelectorDir( value );
|
setSelectorDir( value );
|
||||||
} else if (name == "selectorbrowser") {
|
} else if (name == "selectorbrowser") {
|
||||||
if (value=="true") selectorbrowser = true;
|
if (value=="true") selectorbrowser = true;
|
||||||
} else if (name == "useramtimings") {
|
|
||||||
if (value=="true") useRamTimings = true;
|
|
||||||
} else if (name == "selectorfilter") {
|
} else if (name == "selectorfilter") {
|
||||||
setSelectorFilter( value );
|
setSelectorFilter( value );
|
||||||
} else if (name == "selectorscreens") {
|
} else if (name == "selectorscreens") {
|
||||||
@ -172,7 +169,6 @@ bool LinkApp::save() {
|
|||||||
if (params!="" ) f << "params=" << params << endl;
|
if (params!="" ) f << "params=" << params << endl;
|
||||||
if (manual!="" ) f << "manual=" << manual << endl;
|
if (manual!="" ) f << "manual=" << manual << endl;
|
||||||
if (iclock!=0 ) f << "clock=" << iclock << endl;
|
if (iclock!=0 ) f << "clock=" << iclock << endl;
|
||||||
if (useRamTimings ) f << "useramtimings=true" << endl;
|
|
||||||
if (selectordir!="" ) f << "selectordir=" << selectordir << endl;
|
if (selectordir!="" ) f << "selectordir=" << selectordir << endl;
|
||||||
if (selectorbrowser ) f << "selectorbrowser=true" << endl;
|
if (selectorbrowser ) f << "selectorbrowser=true" << endl;
|
||||||
if (selectorfilter!="" ) f << "selectorfilter=" << selectorfilter << endl;
|
if (selectorfilter!="" ) f << "selectorfilter=" << selectorfilter << endl;
|
||||||
@ -382,9 +378,6 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useRamTimings)
|
|
||||||
gmenu2x->applyRamTimings();
|
|
||||||
|
|
||||||
INFO("Executing '%s' (%s %s)\n", title.c_str(), exec.c_str(), params.c_str());
|
INFO("Executing '%s' (%s %s)\n", title.c_str(), exec.c_str(), params.c_str());
|
||||||
|
|
||||||
//check if we have to quit
|
//check if we have to quit
|
||||||
@ -420,13 +413,6 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
|
|||||||
gmenu2x->writeConfig();
|
gmenu2x->writeConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
if (gmenu2x->fwType == "open2x"
|
|
||||||
&& gmenu2x->savedVolumeMode != gmenu2x->volumeMode) {
|
|
||||||
gmenu2x->writeConfigOpen2x();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (selectedFile == "") {
|
if (selectedFile == "") {
|
||||||
gmenu2x->writeTmp();
|
gmenu2x->writeTmp();
|
||||||
}
|
}
|
||||||
@ -529,15 +515,6 @@ void LinkApp::setSelectorBrowser(bool value) {
|
|||||||
edited = true;
|
edited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LinkApp::getUseRamTimings() {
|
|
||||||
return useRamTimings;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LinkApp::setUseRamTimings(bool value) {
|
|
||||||
useRamTimings = value;
|
|
||||||
edited = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const string &LinkApp::getSelectorFilter() {
|
const string &LinkApp::getSelectorFilter() {
|
||||||
return selectorfilter;
|
return selectorfilter;
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,6 @@ public:
|
|||||||
void setSelectorDir(const std::string &selectordir);
|
void setSelectorDir(const std::string &selectordir);
|
||||||
bool getSelectorBrowser();
|
bool getSelectorBrowser();
|
||||||
void setSelectorBrowser(bool value);
|
void setSelectorBrowser(bool value);
|
||||||
bool getUseRamTimings();
|
|
||||||
void setUseRamTimings(bool value);
|
|
||||||
const std::string &getSelectorScreens();
|
const std::string &getSelectorScreens();
|
||||||
void setSelectorScreens(const std::string &selectorscreens);
|
void setSelectorScreens(const std::string &selectorscreens);
|
||||||
const std::string &getSelectorFilter();
|
const std::string &getSelectorFilter();
|
||||||
|
@ -48,10 +48,6 @@ void MenuSetting::handleTS()
|
|||||||
buttonBox.handleTS();
|
buttonBox.handleTS();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSetting::adjustInput()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSetting::drawSelected(int /*y*/)
|
void MenuSetting::drawSelected(int /*y*/)
|
||||||
{
|
{
|
||||||
buttonBox.paint(5);
|
buttonBox.paint(5);
|
||||||
|
@ -48,7 +48,6 @@ public:
|
|||||||
virtual void handleTS();
|
virtual void handleTS();
|
||||||
|
|
||||||
virtual bool handleButtonPress(InputManager::Button button) = 0;
|
virtual bool handleButtonPress(InputManager::Button button) = 0;
|
||||||
virtual void adjustInput();
|
|
||||||
virtual void drawSelected(int y);
|
virtual void drawSelected(int y);
|
||||||
virtual bool edited() = 0;
|
virtual bool edited() = 0;
|
||||||
|
|
||||||
|
@ -117,14 +117,6 @@ int MenuSettingInt::value()
|
|||||||
return *_value;
|
return *_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingInt::adjustInput()
|
|
||||||
{
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
// gmenu2x->input.setInterval(30, ACTION_LEFT );
|
|
||||||
// gmenu2x->input.setInterval(30, ACTION_RIGHT);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MenuSettingInt::edited()
|
bool MenuSettingInt::edited()
|
||||||
{
|
{
|
||||||
return originalValue != value();
|
return originalValue != value();
|
||||||
|
@ -44,7 +44,6 @@ public:
|
|||||||
virtual ~MenuSettingInt() {}
|
virtual ~MenuSettingInt() {}
|
||||||
|
|
||||||
virtual bool handleButtonPress(InputManager::Button button);
|
virtual bool handleButtonPress(InputManager::Button button);
|
||||||
virtual void adjustInput();
|
|
||||||
virtual void draw(int);
|
virtual void draw(int);
|
||||||
virtual bool edited();
|
virtual bool edited();
|
||||||
|
|
||||||
|
@ -199,17 +199,6 @@ unsigned short MenuSettingRGBA::getSelPart()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSettingRGBA::adjustInput()
|
|
||||||
{
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
/*
|
|
||||||
gmenu2x->input.setInterval(30, ACTION_Y );
|
|
||||||
gmenu2x->input.setInterval(30, ACTION_X );
|
|
||||||
gmenu2x->input.setInterval(30, ACTION_L );
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuSettingRGBA::drawSelected(int y)
|
void MenuSettingRGBA::drawSelected(int y)
|
||||||
{
|
{
|
||||||
int x = 166+selPart*36;
|
int x = 166+selPart*36;
|
||||||
|
@ -56,7 +56,6 @@ public:
|
|||||||
virtual void draw(int y);
|
virtual void draw(int y);
|
||||||
virtual void handleTS();
|
virtual void handleTS();
|
||||||
virtual bool handleButtonPress(InputManager::Button button);
|
virtual bool handleButtonPress(InputManager::Button button);
|
||||||
virtual void adjustInput();
|
|
||||||
virtual void drawSelected(int y);
|
virtual void drawSelected(int y);
|
||||||
virtual bool edited();
|
virtual bool edited();
|
||||||
|
|
||||||
|
@ -100,19 +100,6 @@ int MessageBox::exec() {
|
|||||||
|
|
||||||
int result = -1;
|
int result = -1;
|
||||||
while (result < 0) {
|
while (result < 0) {
|
||||||
|
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
//touchscreen
|
|
||||||
if (gmenu2x->f200 && gmenu2x->ts.poll()) {
|
|
||||||
for (uint i = 0; i < BUTTON_TYPE_SIZE; i++) {
|
|
||||||
if (buttons[i] != "" && gmenu2x->ts.inRect(buttonPositions[i])) {
|
|
||||||
result = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InputManager::ButtonEvent event;
|
InputManager::ButtonEvent event;
|
||||||
if (gmenu2x->input.pollEvent(&event)
|
if (gmenu2x->input.pollEvent(&event)
|
||||||
&& (event.state == InputManager::PRESSED)
|
&& (event.state == InputManager::PRESSED)
|
||||||
|
@ -56,7 +56,6 @@ bool SettingsDialog::exec() {
|
|||||||
|
|
||||||
bool close = false, ts_pressed = false;
|
bool close = false, ts_pressed = false;
|
||||||
uint i, sel = 0, firstElement = 0;
|
uint i, sel = 0, firstElement = 0;
|
||||||
voices[sel]->adjustInput();
|
|
||||||
|
|
||||||
const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"];
|
const int topBarHeight = gmenu2x->skinConfInt["topBarHeight"];
|
||||||
SDL_Rect clipRect = {
|
SDL_Rect clipRect = {
|
||||||
@ -146,13 +145,11 @@ bool SettingsDialog::exec() {
|
|||||||
sel -= 1;
|
sel -= 1;
|
||||||
}
|
}
|
||||||
gmenu2x->setInputSpeed();
|
gmenu2x->setInputSpeed();
|
||||||
voices[sel]->adjustInput();
|
|
||||||
break;
|
break;
|
||||||
case InputManager::DOWN:
|
case InputManager::DOWN:
|
||||||
sel += 1;
|
sel += 1;
|
||||||
if (sel>=voices.size()) sel = 0;
|
if (sel>=voices.size()) sel = 0;
|
||||||
gmenu2x->setInputSpeed();
|
gmenu2x->setInputSpeed();
|
||||||
voices[sel]->adjustInput();
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,7 @@ Touchscreen::Touchscreen() {
|
|||||||
event.x = 0;
|
event.x = 0;
|
||||||
event.y = 0;
|
event.y = 0;
|
||||||
event.pressure = 0;
|
event.pressure = 0;
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
ts_fd = open("/dev/touchscreen/wm97xx", O_RDONLY|O_NOCTTY);
|
|
||||||
#else
|
|
||||||
ts_fd = 0;
|
ts_fd = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Touchscreen::~Touchscreen() {
|
Touchscreen::~Touchscreen() {
|
||||||
@ -58,15 +54,6 @@ void Touchscreen::calibrate() {
|
|||||||
|
|
||||||
bool Touchscreen::poll() {
|
bool Touchscreen::poll() {
|
||||||
wasPressed = pressed();
|
wasPressed = pressed();
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
read(ts_fd, &event, sizeof(TS_EVENT));
|
|
||||||
if (!calibrated) calibrate();
|
|
||||||
|
|
||||||
if (event.pressure > 0) {
|
|
||||||
x = ((event.x - 200) * 320 / 3750) - calibX;
|
|
||||||
y = (240 - ((event.y - 200) * 240 / 3750)) - calibY;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
int mx, my;
|
int mx, my;
|
||||||
if (SDL_GetMouseState(&mx,&my) && SDL_BUTTON(1)) {
|
if (SDL_GetMouseState(&mx,&my) && SDL_BUTTON(1)) {
|
||||||
@ -76,7 +63,6 @@ bool Touchscreen::poll() {
|
|||||||
} else {
|
} else {
|
||||||
event.pressure = 0;
|
event.pressure = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
_handled = false;
|
_handled = false;
|
||||||
|
|
||||||
if (!wasPressed && pressed()) {
|
if (!wasPressed && pressed()) {
|
||||||
|
@ -39,9 +39,6 @@ public:
|
|||||||
~Touchscreen();
|
~Touchscreen();
|
||||||
|
|
||||||
bool available() {
|
bool available() {
|
||||||
#ifdef PLATFORM_GP2X
|
|
||||||
return ts_fd > 0;
|
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user