Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,6 @@ async def generate_dll(
|
|
| 36 |
output_dir = os.path.join(temp_dir, "output")
|
| 37 |
os.makedirs(output_dir, exist_ok=True)
|
| 38 |
|
| 39 |
-
# Dumper'ın "Çıkmak için bir tuşa basın" ayarını (RequireAnyKey) kapatarak çökmeyi önle
|
| 40 |
config_path = "/app/dumper/config.json"
|
| 41 |
if os.path.exists(config_path):
|
| 42 |
try:
|
|
@@ -50,24 +49,31 @@ async def generate_dll(
|
|
| 50 |
|
| 51 |
dll_path = os.path.join(output_dir, "DummyDlls", "Assembly-CSharp.dll")
|
| 52 |
|
| 53 |
-
#
|
| 54 |
try:
|
| 55 |
-
subprocess.run([
|
| 56 |
"/app/dumper/Il2CppDumper",
|
| 57 |
binary_path,
|
| 58 |
metadata_path,
|
| 59 |
output_dir
|
| 60 |
-
],
|
|
|
|
|
|
|
| 61 |
except subprocess.CalledProcessError as e:
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
# Eğer dosya üretilmişse (hata verse de vermese de) kullanıcıya yolla
|
| 67 |
if os.path.exists(dll_path):
|
| 68 |
return FileResponse(dll_path, media_type="application/octet-stream", filename="Assembly-CSharp.dll")
|
| 69 |
else:
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
@app.post("/extract")
|
| 73 |
async def extract_dialogues(
|
|
|
|
| 36 |
output_dir = os.path.join(temp_dir, "output")
|
| 37 |
os.makedirs(output_dir, exist_ok=True)
|
| 38 |
|
|
|
|
| 39 |
config_path = "/app/dumper/config.json"
|
| 40 |
if os.path.exists(config_path):
|
| 41 |
try:
|
|
|
|
| 49 |
|
| 50 |
dll_path = os.path.join(output_dir, "DummyDlls", "Assembly-CSharp.dll")
|
| 51 |
|
| 52 |
+
# Tüm çıktıları (stdout ve stderr) yakalayarak çalıştır
|
| 53 |
try:
|
| 54 |
+
process = subprocess.run([
|
| 55 |
"/app/dumper/Il2CppDumper",
|
| 56 |
binary_path,
|
| 57 |
metadata_path,
|
| 58 |
output_dir
|
| 59 |
+
], capture_output=True)
|
| 60 |
+
stdout_text = process.stdout.decode('utf-8', errors='replace')
|
| 61 |
+
stderr_text = process.stderr.decode('utf-8', errors='replace')
|
| 62 |
except subprocess.CalledProcessError as e:
|
| 63 |
+
stdout_text = e.stdout.decode('utf-8', errors='replace') if e.stdout else ""
|
| 64 |
+
stderr_text = e.stderr.decode('utf-8', errors='replace') if e.stderr else ""
|
| 65 |
+
|
|
|
|
|
|
|
| 66 |
if os.path.exists(dll_path):
|
| 67 |
return FileResponse(dll_path, media_type="application/octet-stream", filename="Assembly-CSharp.dll")
|
| 68 |
else:
|
| 69 |
+
# Eğer klasörde herhangi başka bir dosya üretildiyse listesini çıkar
|
| 70 |
+
created_files = []
|
| 71 |
+
for root, dirs, files in os.walk(output_dir):
|
| 72 |
+
for file in files:
|
| 73 |
+
created_files.append(os.path.relpath(os.path.join(root, file), output_dir))
|
| 74 |
+
|
| 75 |
+
full_log = f"IL2CPPDUMPER DETAYLI RAPORU:\n\n{stdout_text}\n{stderr_text}\n\nÜretilen Dosyalar: {created_files}"
|
| 76 |
+
return {"error": "İşlem başarısız. DLL üretilemedi. Geliştirici logunu inceleyin.", "details": full_log}
|
| 77 |
|
| 78 |
@app.post("/extract")
|
| 79 |
async def extract_dialogues(
|