Cnass commited on
Commit
a12a00e
·
verified ·
1 Parent(s): ae268b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -6
app.py CHANGED
@@ -36,7 +36,21 @@ async def generate_dll(
36
  output_dir = os.path.join(temp_dir, "output")
37
  os.makedirs(output_dir, exist_ok=True)
38
 
39
- # Il2CppDumper'ı Linux ortamında çalıştır
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  try:
41
  subprocess.run([
42
  "/app/dumper/Il2CppDumper",
@@ -45,14 +59,15 @@ async def generate_dll(
45
  output_dir
46
  ], check=True, capture_output=True)
47
  except subprocess.CalledProcessError as e:
48
- return {"error": "Il2CppDumper çalışırken hata oluştu.", "details": e.stderr.decode('utf-8')}
49
-
50
- # Çıkarılan DLL'yi bul ve geri yolla
51
- dll_path = os.path.join(output_dir, "DummyDlls", "Assembly-CSharp.dll")
 
52
  if os.path.exists(dll_path):
53
  return FileResponse(dll_path, media_type="application/octet-stream", filename="Assembly-CSharp.dll")
54
  else:
55
- return {"error": "İşlem tamamlandı ancak DLL dosyası üretilemedi. Dosyaların doğru oyuna ait olduğundan emin olun."}
56
 
57
  @app.post("/extract")
58
  async def extract_dialogues(
 
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:
43
+ with open(config_path, "r") as f:
44
+ config_data = f.read()
45
+ config_data = config_data.replace('"RequireAnyKey": true', '"RequireAnyKey": false')
46
+ with open(config_path, "w") as f:
47
+ f.write(config_data)
48
+ except Exception:
49
+ pass
50
+
51
+ dll_path = os.path.join(output_dir, "DummyDlls", "Assembly-CSharp.dll")
52
+
53
+ # Il2CppDumper'ı çalıştır
54
  try:
55
  subprocess.run([
56
  "/app/dumper/Il2CppDumper",
 
59
  output_dir
60
  ], check=True, capture_output=True)
61
  except subprocess.CalledProcessError as e:
62
+ # EĞER PROGRAM KLAVYE YÜZÜNDEN ÇÖKMÜŞSE AMA DOSYAYI ÜRETMİŞSE, HATAYI GÖRMEZDEN GEL!
63
+ if not os.path.exists(dll_path):
64
+ return {"error": "Il2CppDumper çalışırken hata oluştu.", "details": e.stderr.decode('utf-8') or e.stdout.decode('utf-8')}
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
+ return {"error": "İşlem tamamlandı ancak DLL dosyası bulunamadı. Lütfen doğru so/dll ve metadata dosyasını yüklediğinizden emin olun."}
71
 
72
  @app.post("/extract")
73
  async def extract_dialogues(