Fix loading order

This commit is contained in:
J-D-K
2020-01-06 16:55:16 -05:00
parent 8e04b7a48a
commit 1f4bb8d0f9
7 changed files with 27 additions and 20 deletions

View File

@@ -53,6 +53,9 @@ namespace ui
extern std::vector<ui::button> selButtons;
//Sets colors and stuff
void initTheme();
//Loads in the A, B, X, Y button graphics
void init();
void exit();

View File

@@ -427,10 +427,10 @@ namespace fs
bool fileExists(const std::string& path)
{
std::fstream chk(path, std::ios::in);
if(chk.is_open())
FILE *test = fopen(path.c_str(), "rb");
if(test != NULL)
{
chk.close();
fclose(test);
return true;
}

View File

@@ -36,8 +36,11 @@ int main(int argc, const char *argv[])
{
fs::init();
graphicsInit(1280, 720);
ui::init();
//Needed for icon gen
ui::initTheme();
data::loadDataInfo();
ui::init();
//built with 'make debug CFLAGS:=-D__debug__'
#ifdef __debug__
socketInitializeDefault();

View File

@@ -49,14 +49,13 @@ namespace ui
//Shared font
font *shared;
void init()
void initTheme()
{
shared = fontLoadSharedFonts();
ColorSetId gthm;
setsysGetColorSetId(&gthm);
top = texCreate(1280, 88);
bot = texCreate(1280, 72);
switch(gthm)
{
case ColorSetId_Light:
@@ -111,8 +110,12 @@ namespace ui
divClr = clrCreateU32(0xFFFFFFFF);
break;
}
}
shared = fontLoadSharedFonts();
void init()
{
top = texCreate(1280, 88);
bot = texCreate(1280, 72);
if(fs::fileExists(fs::getWorkDir() + "cls.txt"))
{

View File

@@ -116,7 +116,7 @@ void performCopyMenuOps()
{
//save menu
case 0:
if(data::curData.getType() != FsSaveDataType_SystemBcat)
if(data::curData.getType() != FsSaveDataType_System)
{
if(saveMenu.getSelected() == 0)
{

View File

@@ -116,8 +116,6 @@ namespace ui
fs::copyDirToDirCommit(fromPath, root, "sv");
}
}
else
ui::showMessage("Writing data to system save data is not allowed currently. It CAN brick your system.", "Sorry, bro:");
}
else if(down & KEY_X || fldNav[2].getEvent() == BUTTON_RELEASED)
{

View File

@@ -172,7 +172,7 @@ namespace util
break;
case FsSaveDataType_Bcat:
ret += "Bcat Delivery Cache\n\n";
ret += "BCAT\n\n";
break;
case FsSaveDataType_Device:
@@ -180,11 +180,15 @@ namespace util
break;
case FsSaveDataType_Temporary:
ret = "Temp Storage\n\n";
ret += "Temp Storage\n\n";
break;
case FsSaveDataType_Cache:
ret+= "Cache Storage\n\n";
ret += "Cache Storage\n\n";
break;
case FsSaveDataType_SystemBcat:
ret += "System BCAT";
break;
}
@@ -217,11 +221,7 @@ namespace util
char out[maxLength];
memset(out, 0, maxLength);
if(R_FAILED(swkbdShow(&swkbd, out, maxLength)))
{
ui::showMessage("Keyboard failed to open. Please use a different title for the homebrew menu.", "KB Failed");
return "";
}
swkbdShow(&swkbd, out, maxLength);
swkbdClose(&swkbd);
return std::string(out);