From ad741ffa7144ac97ce096c1b05617df23d184546 Mon Sep 17 00:00:00 2001 From: randomdude999 Date: Tue, 14 Jul 2020 03:12:29 +0300 Subject: [PATCH] make automatic output file guessing use patch name instead of overwriting base rom --- flips.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flips.cpp b/flips.cpp index f871fa0..62d10cd 100644 --- a/flips.cpp +++ b/flips.cpp @@ -1349,7 +1349,17 @@ int flipsmain(int argc, WCHAR * argv[]) { if (numargs!=2 && numargs!=3) usage(); GUIClaimConsole(); - struct errorinfo errinf=ApplyPatch(arg[0], arg[1], !ignoreChecksum, arg[2]?arg[2]:arg[1], &manifestinfo, false); + LPCWSTR outname = arg[2]; + if(!outname) + { + WCHAR* base_ext = GetExtension(arg[1]); + int extlen = wcslen(base_ext); + LPWSTR tmp = (WCHAR*)malloc(sizeof(WCHAR)*(wcslen(arg[0])+extlen)); + wcscpy(tmp, arg[0]); + wcscpy(GetExtension(tmp), base_ext); + outname = tmp; + } + struct errorinfo errinf=ApplyPatch(arg[0], arg[1], !ignoreChecksum, outname, &manifestinfo, false); puts(errinf.description); return errinf.level; }