From 0af181ac6aa2d499da13df606b2ac3633788c523 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Wed, 5 Aug 2020 21:47:21 +0200 Subject: [PATCH] Check for import.db and title.db before attempting install --- arm9/source/utils/gameutil.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/arm9/source/utils/gameutil.c b/arm9/source/utils/gameutil.c index 6197c4e..fbc8cfd 100644 --- a/arm9/source/utils/gameutil.c +++ b/arm9/source/utils/gameutil.c @@ -2165,11 +2165,17 @@ u32 InstallGameFile(const char* path, bool to_emunand) { else if (!((tid64 >> 32) & 0x10)) to_sd = true; - // does the title.db exist? - if ((to_sd && !fvx_qsize(to_emunand ? "B:/dbs/title.db" : "A:/dbs/title.db")) || - (!to_sd && !fvx_qsize(to_emunand ? "4:/dbs/title.db" : "1:/dbs/title.db"))) - return 1; - + // does title.db & import.db exist? + if (to_sd) { + if (!fvx_qsize(to_emunand ? "B:/dbs/title.db" : "A:/dbs/title.db") || + !fvx_qsize(to_emunand ? "B:/dbs/import.db" : "A:/dbs/import.db")) + return 1; + } else { + if (!fvx_qsize(to_emunand ? "4:/dbs/title.db" : "1:/dbs/title.db") || + !fvx_qsize(to_emunand ? "4:/dbs/import.db" : "1:/dbs/import.db")) + return 1; + } + // now we know the correct drive drv = to_emunand ? (to_sd ? "B:" : to_twl ? "5:" : "4:") : (to_sd ? "A:" : to_twl ? "2:" : "1:");