From b5983f505fcf4a45294b9be4e36e209f819f32da Mon Sep 17 00:00:00 2001 From: Lil-Ran Date: Tue, 18 Nov 2025 23:55:37 +0800 Subject: [PATCH] sync with 766647f: prompt, only 1 file, flush on err --- pycdas.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pycdas.cpp b/pycdas.cpp index aecb165..3d0f6d6 100644 --- a/pycdas.cpp +++ b/pycdas.cpp @@ -262,6 +262,8 @@ void output_object(PycRef obj, PycModule* mod, int indent, int main(int argc, char* argv[]) { + fputs("LilRan's fork of Pycdc, output will be written to .das and .cdc.py\n", stderr); + const char* infile = nullptr; const char* outfile = nullptr; bool marshalled = false; @@ -304,8 +306,12 @@ int main(int argc, char* argv[]) } else if (argv[arg][0] == '-') { fprintf(stderr, "Error: Unrecognized argument %s\n", argv[arg]); return 1; - } else { + } else if (!infile) { infile = argv[arg]; + } else { + fprintf(stderr, "Error: Only one input file allowed, got %s and %s\n", + infile, argv[arg]); + return 1; } } @@ -361,6 +367,8 @@ int main(int argc, char* argv[]) output_object(mod.code().try_cast(), &mod, 0, disasm_flags, das_out_file); } catch (std::exception& ex) { + das_out_file.flush(); + das_out_file.close(); fprintf(stderr, "Error disassembling %s: %s\n", infile, ex.what()); return 1; } @@ -375,6 +383,8 @@ int main(int argc, char* argv[]) try { decompyle(mod.code(), &mod, dc_out_file); } catch (std::exception& ex) { + dc_out_file.flush(); + dc_out_file.close(); fprintf(stderr, "Error decompyling %s: %s\n", infile, ex.what()); return 1; }