mirror of
https://github.com/cxchency/manosaba-character-composer.git
synced 2026-01-24 02:57:10 +08:00
1
This commit is contained in:
@@ -16,9 +16,7 @@ from tqdm import tqdm
|
||||
|
||||
import UnityPy
|
||||
from UnityPy.files import ObjectReader
|
||||
from UnityPy.classes import TextAsset, Texture2D, AudioClip, AssetBundle, Sprite, GameObject, Transform, SpriteRenderer, Shader, EditorExtension
|
||||
from PyCriCodecsEx.acb import ACB
|
||||
from PyCriCodecsEx.hca import HCACodec
|
||||
from UnityPy.classes import TextAsset, Texture2D, AudioClip, AssetBundle, Sprite, GameObject, Transform, SpriteRenderer, EditorExtension
|
||||
|
||||
ILLEGAL_CHARS_RE = re.compile(r'[<>:"/\\|?*#]')
|
||||
|
||||
@@ -130,25 +128,6 @@ class AssetBundleExtractor:
|
||||
res_name = getattr(data, "m_Name", None) or f"unnamed_{obj.path_id}"
|
||||
sanitized_res_name = _sanitize_name(res_name)
|
||||
out_base_path = out_dir / sanitized_res_name
|
||||
if out_base_path.name.endswith(".acb"):
|
||||
# 处理 .acb 格式的音频
|
||||
try:
|
||||
byte_content = data.m_Script.encode("utf-8", "surrogateescape")
|
||||
output_flac_path = out_base_path.with_suffix(".flac")
|
||||
if self._skip_if_exists(output_flac_path): return
|
||||
acb_obj = ACB(byte_content)
|
||||
waveforms = acb_obj.get_waveforms()
|
||||
if waveforms and isinstance(waveforms[0], HCACodec):
|
||||
wf = waveforms[0]
|
||||
with io.BytesIO(wf.decode()) as bio:
|
||||
audio, samplerate = sf.read(bio)
|
||||
sf.write(output_flac_path, audio, samplerate, format="FLAC", compression_level=1)
|
||||
self._log("debug", f"导出音频: {output_flac_path}")
|
||||
self.type_counter["audio"] += 1
|
||||
except Exception as e:
|
||||
self._log("error", f"处理 ACB 音频失败: {out_base_path.name} | {e}")
|
||||
self.type_counter["error"] += 1
|
||||
else:
|
||||
out_base_path = out_base_path.with_suffix(".txt")
|
||||
if self._skip_if_exists(out_base_path): return
|
||||
# 处理普通文本
|
||||
|
||||
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Flask
|
||||
Pillow
|
||||
soundfile
|
||||
tqdm
|
||||
unitypy
|
||||
Reference in New Issue
Block a user