This commit is contained in:
d0k3 2021-07-23 14:01:19 +02:00
parent c9b6a335f7
commit 4dc96d37e8
4 changed files with 20 additions and 4 deletions

View File

@ -55,7 +55,7 @@
#define FTYPE_CIAINSTALL(tp) ((tp&(GAME_NCSD|GAME_NCCH|GAME_CIA|GAME_CDNTMD|GAME_TWLTMD)) || ((tp&GAME_NDS)&&(tp&(FLAG_DSIW))))
#define FTYPE_TIKINSTALL(tp) (tp&(GAME_TICKET))
#define FTYPE_TIKDUMP(tp) (tp&(GAME_TIE))
#define FTYPE_CXIDUMP(tp) (tp&(GAME_TMD))
#define FTYPE_CXIDUMP(tp) (tp&(GAME_TMD|GAME_TIE))
#define FTYPE_UNINSTALL(tp) (tp&(GAME_TIE))
#define FTYPE_TIKBUILD(tp) (tp&(GAME_TICKET|SYS_TICKDB|BIN_TIKDB))
#define FTYPE_KEYBUILD(tp) (tp&(BIN_KEYDB|BIN_LEGKEY))

View File

@ -1551,7 +1551,7 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
}
DrawDirContents(current_dir, (*cursor = i), scroll);
if (((user_select != cxi_dump) && (BuildCiaFromGameFile(path, force_legit) == 0)) ||
((user_select == cxi_dump) && (DumpCxiSrlFromTmdFile(path) == 0))) n_success++;
((user_select == cxi_dump) && (DumpCxiSrlFromGameFile(path) == 0))) n_success++;
else { // on failure: show error, continue
char lpathstr[32+1];
TruncateString(lpathstr, path, 32, 8);
@ -1571,7 +1571,7 @@ u32 FileHandlerMenu(char* current_path, u32* cursor, u32* scroll, PaneData** pan
}
} else {
if (((user_select != cxi_dump) && (BuildCiaFromGameFile(file_path, force_legit) == 0)) ||
((user_select == cxi_dump) && (DumpCxiSrlFromTmdFile(file_path) == 0))) {
((user_select == cxi_dump) && (DumpCxiSrlFromGameFile(file_path) == 0))) {
ShowPrompt(false, "%s\n%s built to %s", pathstr, type, OUTPUT_PATH);
if (in_output_path) GetDirContents(current_dir, current_path);
} else {

View File

@ -3020,6 +3020,22 @@ u32 DumpCxiSrlFromTmdFile(const char* path) {
return 0;
}
u32 DumpCxiSrlFromGameFile(const char* path) {
u64 filetype = IdentifyFileType(path);
const char* path_tmd = path;
char path_data[256];
if (!(filetype & (GAME_TIE|GAME_TMD)))
return 1;
if (filetype & GAME_TIE) {
if (GetTieTmdPath(path_data, path) != 0)
return 1;
path_tmd = path_data;
}
return DumpCxiSrlFromTmdFile(path_tmd);
}
u32 ExtractCodeFromCxiFile(const char* path, const char* path_out, char* extstr) {
u64 filetype = IdentifyFileType(path);
char dest[256];

View File

@ -9,7 +9,7 @@ u32 BuildCiaFromGameFile(const char* path, bool force_legit);
u32 InstallGameFile(const char* path, bool to_emunand);
u32 InstallTicketFile(const char* path, bool to_emunand);
u32 DumpTicketForGameFile(const char* path, bool force_legit);
u32 DumpCxiSrlFromTmdFile(const char* path);
u32 DumpCxiSrlFromGameFile(const char* path);
u32 ExtractCodeFromCxiFile(const char* path, const char* path_out, char* extstr);
u32 CompressCode(const char* path, const char* path_out);
u64 GetGameFileTrimmedSize(const char* path);