Applet mode warning + disable drive/browser to prevent crash

This commit is contained in:
J-D-K 2023-05-17 17:00:18 -04:00
parent 83228a2911
commit 6f8393483f
7 changed files with 24 additions and 8 deletions

Binary file not shown.

View File

@ -99,4 +99,5 @@ namespace data
SDL_Texture *getTitleIconByTID(const uint64_t& tid);
int getTitleIndexInUser(const data::user& u, const uint64_t& tid);
extern SetLanguage sysLang;
}

View File

@ -48,7 +48,6 @@ namespace ui
inline uint64_t padKeysDown() { return padGetButtonsDown(&pad); }
inline uint64_t padKeysHeld() { return padGetButtons(&pad); }
inline uint64_t padKeysUp() { return padGetButtonsUp(&pad); }
inline void touchGetXY(uint32_t *x, uint32_t *y) { *x = touchState.touches[0].x; *y = touchState.touches[0].y; }
inline void changeState(int newState)
{
@ -87,6 +86,9 @@ namespace ui
void init();
void exit();
//Inits HID
void hidInit();
//Adds a panel pointer to a vector since they need to be drawn over everything else
int registerMenu(ui::menu *m);
int registerPanel(ui::slideOutPanel *sop);

View File

@ -82,6 +82,7 @@ namespace util
{
return t > 30 && t < 127;
}
std::string safeString(const std::string& s);
std::string getStringInput(SwkbdType _type, const std::string& def, const std::string& head, size_t maxLength, unsigned dictCnt, const std::string dictWords[]);
@ -147,5 +148,11 @@ namespace util
void sysBoost();
void sysNormal();
inline bool isApplet()
{
AppletType type = appletGetAppletType();
return type == AppletType_LibraryApplet;
}
void checkForUpdate(void *a);
}

View File

@ -52,8 +52,11 @@ int main(int argc, const char *argv[])
curl_global_init(CURL_GLOBAL_ALL);
//Drive needs config read
fs::driveInit();
if(!util::isApplet())
fs::driveInit();
else
ui::showMessage(ui::getUICString("appletModeWarning", 0));
while(ui::runApp()){ }
fs::driveExit();

View File

@ -137,13 +137,9 @@ void ui::init()
break;
}
//setup pad
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
padInitializeDefault(&ui::pad);
//Setup touch
hidInitializeTouchScreen();
ui::usrInit();
ui::ttlInit();
ui::settInit();
@ -217,7 +213,11 @@ void ui::drawUI()
gfx::drawLine(NULL, &divClr, 30, 88, 1250, 88);
gfx::drawLine(NULL, &divClr, 30, 648, 1250, 648);
gfx::texDraw(NULL, icn, 66, 27);
gfx::drawTextf(NULL, 24, 130, 38, &ui::txtCont, "JKSV");
if(util::isApplet())
gfx::drawTextf(NULL, 24, 130, 38, &ui::txtCont, "JKSV *APPLET MODE*");
else
gfx::drawTextf(NULL, 24, 130, 38, &ui::txtCont, "JKSV");
//Version / translation author
gfx::drawTextf(NULL, 12, 8, 700, &ui::txtCont, "v. %02d.%02d.%04d", BLD_MON, BLD_DAY, BLD_YEAR);

View File

@ -314,6 +314,8 @@ void ui::initStrings()
addUIString("debugStatus", 2, "Current Title: ");
addUIString("debugStatus", 3, "Safe Title: ");
addUIString("debugStatus", 4, "Sort Type: ");
addUIString("appletModeWarning", 0, "*WARNING*: You are running JKSV in applet mode. Certain functions may not work.");
}
void ui::loadTrans()
@ -335,6 +337,7 @@ void ui::loadTrans()
util::replaceButtonsInString(ui::strings[std::make_pair("dialogYes", 0)]);
util::replaceButtonsInString(ui::strings[std::make_pair("dialogNo", 0)]);
util::replaceButtonsInString(ui::strings[std::make_pair("dialogOK", 0)]);
util::replaceButtonsInString(ui::strings[std::make_pair("appletModeWarning", 0)]);
}
void ui::saveTranslationFiles(void *a)