diff --git a/Makefile b/Makefile index a3c97c2..3045143 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ INCLUDES := inc EXEFS_SRC := exefs_src APP_TITLE := JKSV APP_AUTHOR := JK -APP_VERSION := 12/23/2018 +APP_VERSION := 01/08/2018 ROMFS := romfs #--------------------------------------------------------------------------------- diff --git a/src/main.cpp b/src/main.cpp index 0f2969a..30dee25 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,15 +13,20 @@ extern "C" { void userAppInit(void) { + appletInitialize(); romfsInit(); hidInitialize(); nsInitialize(); setsysInitialize(); accountInitialize(); + + void *add = NULL; + svcSetHeapSize(&add, 0x12000000); } void userAppExit(void) { + appletExit(); romfsExit(); hidExit(); nsExit(); diff --git a/src/ui.cpp b/src/ui.cpp index 4cfcaa5..aeeb76d 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -11,7 +11,7 @@ #include "util.h" #include "file.h" -#define VER_STRING "v. 12/22/2018" +#define VER_STRING "v. 01/08/2018" //background that can be drawn from "/JKSV/back.jpg" //txtSide and fldSide are to fake alpha blending so the framerate doesn't suffer diff --git a/src/ui/fldrsel.cpp b/src/ui/fldrsel.cpp index 749d40d..50d8929 100644 --- a/src/ui/fldrsel.cpp +++ b/src/ui/fldrsel.cpp @@ -58,11 +58,11 @@ namespace ui { const std::string dict[] = { - util::getDateTime(util::DATE_FMT_YMD), - util::getDateTime(util::DATE_FMT_YDM), - util::getDateTime(util::DATE_FMT_HOYSTE), - data::curUser.getUsernameSafe(), - data::curData.getTitleSafe() + util::getDateTime(util::DATE_FMT_YMD).c_str(), + util::getDateTime(util::DATE_FMT_YDM).c_str(), + util::getDateTime(util::DATE_FMT_HOYSTE).c_str(), + data::curUser.getUsernameSafe().c_str(), + data::curData.getTitleSafe(), }; folder = util::getStringInput("", "Enter a folder name", 64, 5, dict); } diff --git a/src/util.cpp b/src/util.cpp index 8086787..cc8f710 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -11,6 +11,59 @@ static const char verboten[] = { ',', '/', '\\', '<', '>', ':', '"', '|', '?', '*'}; +//Missing swkbd config funcs for now +typedef enum +{ + SwkbdPosStart = 0, + SwkbdPosEnd = 1 +} SwkbdInitPos; + +void swkbdConfigSetMaxLength(SwkbdConfig *c, unsigned int maxLength) +{ + c->arg.arg.stringLenMax = maxLength; +} + +void swkbdConfigSetType(SwkbdConfig *c, SwkbdType type) +{ + c->arg.arg.type = type; +} + +void swkbdConfigSetInitialPos(SwkbdConfig *c, SwkbdInitPos pos) +{ + c->arg.arg.initialCursorPos = pos; +} + +void swkbdConfigSetDisableBitmask(SwkbdConfig *c, uint32_t bits) +{ + c->arg.arg.keySetDisableBitmask = bits; +} + +void swkbdConfigBlurBackground(SwkbdConfig *c, bool blur) +{ + c->arg.arg.blurBackground = blur; +} + +typedef struct +{ + uint16_t read[0x32 / sizeof(uint16_t)]; + uint16_t word[0x32 / sizeof(uint16_t)]; +} dictWord; + +void swkbdDictWordCreate(dictWord *w, const char *read, const char *word) +{ + memset(w->read, 0, 0x32); + memset(w->word, 0, 0x32); + + uint16_t tmp[0x32 / sizeof(uint16_t)]; + memset(tmp, 0, 0x32); + + utf8_to_utf16(tmp, (uint8_t *)read, 0x30); + memcpy(w->read, tmp, 0x30); + + utf8_to_utf16(tmp, (uint8_t *)word, 0x30); + memcpy(w->word, tmp, 0x30); +} + namespace util { std::string getDateTime(int fmt) @@ -154,13 +207,23 @@ namespace util { SwkbdConfig swkbd; swkbdCreate(&swkbd, dictCnt); - swkbdConfigMakePresetDefault(&swkbd); + swkbdConfigBlurBackground(&swkbd, true); swkbdConfigSetInitialText(&swkbd, def.c_str()); - swkbd.arg.arg.type = SwkbdType_QWERTY; swkbdConfigSetHeaderText(&swkbd, head.c_str()); - swkbdConfigSetOkButtonText(&swkbd, "Done"); - swkbd.arg.arg.initialCursorPos = 1; - swkbd.arg.arg.stringLenMax = maxLength; + swkbdConfigSetGuideText(&swkbd, head.c_str()); + swkbdConfigSetInitialPos(&swkbd, SwkbdPosEnd); + swkbdConfigSetType(&swkbd, SwkbdType_QWERTY); + swkbdConfigSetMaxLength(&swkbd, maxLength); + swkbdConfigSetDisableBitmask(&swkbd, SwkbdKeyDisableBitmask_Backslash | SwkbdKeyDisableBitmask_ForwardSlash | SwkbdKeyDisableBitmask_Percent); + + if(dictCnt > 0) + { + dictWord words[dictCnt]; + for(unsigned i = 0; i < dictCnt; i++) + swkbdDictWordCreate(&words[i], dictWords[i].c_str(), dictWords[i].c_str()); + + swkbdConfigSetDictionary(&swkbd, (SwkbdDictWord *)words, dictCnt); + } char out[maxLength]; memset(out, 0, maxLength);