Compare commits

..

3 Commits

Author SHA1 Message Date
c9c1919fdd
update 2024-10-29 20:57:00 +08:00
1b23f31f78
移除不通用的指令解释 2024-10-29 20:38:36 +08:00
5ca0fe2e9a
尝试兼容旧作Sennagi 2024-10-29 20:27:20 +08:00
6 changed files with 142 additions and 659 deletions

View File

@ -3,23 +3,6 @@ namespace EscudeTools
{ {
public static class Define public static class Define
{ {
public static readonly string[] ProcNames =
[
"proc_end", "proc_call", "proc_argv", "proc_argc", "proc_typeof", "proc_int", "proc_float", "proc_abs",
"proc_rand", "proc_min", "proc_max", "proc_rgb", "proc_refer", "proc_credit", "proc_log_new", "proc_log_out",
"proc_title", "proc_auto_save", "proc_is_pass", "proc_event", "proc_scene", "proc_open_name", "proc_notice",
"proc_log_img", "proc_msg_opt", "proc_cf", "proc_cv", "proc_vt", "proc_frame", "proc_text", "proc_vals",
"proc_clear", "proc_gap", "proc_menu_opt", "proc_menu", "proc_wait", "proc_lsf_init", "proc_lsf_set",
"proc_lsf_get", "proc_lsf_break", "proc_dt", "proc_ps", "proc_cg", "proc_cg_org", "proc_cg_set", "proc_cg_get",
"proc_cg_em", "proc_cg_clr", "proc_cg_disp", "proc_path", "proc_tween", "proc_trans", "proc_mot_set",
"proc_mot_get", "proc_quake", "proc_flash", "proc_flt", "proc_ptcl", "proc_sync", "proc_auto_kill", "proc_movie",
"proc_bgm_play", "proc_bgm_stop", "proc_bgm_vol", "proc_bgm_fx", "proc_amb_play", "proc_amb_stop", "proc_amb_vol",
"proc_amb_fx", "proc_se_play", "proc_se_stop", "proc_se_wait", "proc_se_vol", "proc_se_fx", "proc_voc_play",
"proc_voc_stop", "proc_voc_wait", "proc_voc_vol", "proc_voc_fx", "proc_bgv_play", "proc_bgv_stop", "proc_bgv_vol",
"proc_bgv_fx", "proc_set_param", "proc_get_param", "proc_jump", "proc_date", "proc_flow", "proc_diary",
"proc_unlock", "proc_section", "proc_omake"
];
// 说句实话,我觉得这些定义可能会发生变化
public const byte INST_POP = 1; public const byte INST_POP = 1;
public const byte INST_POP_N = 2; public const byte INST_POP_N = 2;
public const byte INST_POP_RET = 3; public const byte INST_POP_RET = 3;
@ -241,7 +224,9 @@ namespace EscudeTools
return $"File line number"; return $"File line number";
case INST_PROC: case INST_PROC:
uint index = BitConverter.ToUInt32(c.Parameter); uint index = BitConverter.ToUInt32(c.Parameter);
return $"Execute built-in function: {ProcNames[index]} {SetExtStr(c, sf)}"; //if(index>= ProcNames.Length)
// return $"Execute unknown built-in function";
return $"Execute built-in function {index}";
case INST_TEXT: case INST_TEXT:
messIndex++; messIndex++;
return (sm == null) ? "意外的指令此表无Mess" : sm.DataString[messIndex - 1]; return (sm == null) ? "意外的指令此表无Mess" : sm.DataString[messIndex - 1];
@ -261,581 +246,5 @@ namespace EscudeTools
} }
} }
} }
private static string SetExtStr(Command c, ScriptFile sf)
{
switch (BitConverter.ToUInt32(c.Parameter))
{
case 0:
{
//(0 = 标题 / -1 = 游戏结束,保留数据 / 1以上 = 通关,保留数据)
string[] ps = ["结束代码"];
SetExtStr1(ps, sf);
return "脚本结束";
}
case 1:
{
string[] ps = ["脚本编号"];
SetExtStr1(ps, sf);
return "调用文件";
}
case 2:
{
string[] ps = ["参数索引"];
SetExtStr1(ps, sf);
return "获取函数帧的参数";
}
case 3:
{
string[] ps = ["参数数量"];
SetExtStr1(ps, sf);
return "获取函数帧的参数数量";
}
case 4:
{
string[] ps = ["值"];
SetExtStr1(ps, sf);
return "获取变量的类型";
}
case 5:
{
string[] ps = ["值"];
SetExtStr1(ps, sf);
return "转换为整数";
}
case 6:
{
string[] ps = ["值"];
SetExtStr1(ps, sf);
return "转换为浮点数";
}
case 7:
{
string[] ps = ["值"];
SetExtStr1(ps, sf);
return "绝对值";
}
case 8:
{
string[] ps = ["可变长度参数"];
SetExtStr1(ps, sf);
return "获取随机数";
}
case 9:
{
string[] ps = ["可变长度参数"];
SetExtStr1(ps, sf);
return "获取最小值";
}
case 10:
{
string[] ps = ["可变长度参数"];
SetExtStr1(ps, sf);
return "获取最大值";
}
case 11:
{
string[] ps = ["R", "G", "B", "A"];
SetExtStr1(ps, sf);
return "将RGB值转换为颜色代码";
}
case 12:
{
string[] ps = ["索引", "可变长度参数"];
SetExtStr1(ps, sf);
return "引用转换";
}
case 13:
{
string[] ps = ["编号"];
SetExtStr1(ps, sf);
return "员工名单滚动";
}
case 14:
{
string[] ps = ["文件名"];
SetExtStr1(ps, sf);
return "新建日志";
}
case 15:
{
string[] ps = ["文件名", "输出值..."];
SetExtStr1(ps, sf);
return "输出日志";
}
case 16:
{
string[] ps = ["标题字符串"];
SetExtStr1(ps, sf);
return "设置场景标题";
}
case 17:
{
return "自动保存";
}
case 18:
{
string[] ps = ["脚本编号"];
SetExtStr1(ps, sf);
return "获取脚本通过标志";
}
case 19:
{
string[] ps = ["CG编号"];
SetExtStr1(ps, sf);
return "设置CG欣赏标志";
}
case 20:
{
string[] ps = ["脚本编号"];
SetExtStr1(ps, sf);
return "设置场景回想标志";
}
case 21:
{
string[] ps = ["名称编号"];
SetExtStr1(ps, sf);
return "打开名称";
}
case 22:
{
string[] ps = ["文本", "显示时间", "强制标志"];
SetExtStr1(ps, sf);
return "显示通知文本";
}
case 23:
{
string[] ps = ["角色ID"];
SetExtStr1(ps, sf);
return "设置日志中的角色图像";
}
case 24:
{
string[] ps = ["文本控制ID", "设置标志"];
SetExtStr1(ps, sf);
return "文本控制标志的设置";
}
case 25:
{
string[] ps = ["图像ID", "表情ID"];
SetExtStr1(ps, sf);
return "表情指定";
}
case 26:
{
string[] ps = ["声音编号"];
SetExtStr1(ps, sf);
return "声音指定";
}
case 27:
{
string[] ps = ["时间", "音轨"];
SetExtStr1(ps, sf);
return "声音的播放时间等待";
}
case 28:
{
string[] ps = ["框架编号"];
SetExtStr1(ps, sf);
return "文本框架的更改";
}
case 29:
{
//显示标志 (0 = 隐藏 / 1 = 显示)
//显示时间 (1 / 1000毫秒)
string[] ps = ["显示标志", "显示时间"];
SetExtStr1(ps, sf);
return "文本框架的显示/隐藏";
}
case 30:
{
string[] ps = ["可变长参数"];
SetExtStr1(ps, sf);
return "文本引用值的设置";
}
case 31:
{
string[] ps = ["时间(1/1000 ms)"];
SetExtStr1(ps, sf);
return "文本消息的消去";
}
case 32:
{
string[] ps = ["x间隔", "y间隔"];
SetExtStr1(ps, sf);
return "文本间距的设置";
}
case 33:
{
string[] ps = ["选择允许标志"];
SetExtStr1(ps, sf);
return "菜单选项的设置";
}
case 34:
{
string[] ps = ["随机显示标志", "流程分支标志"];
SetExtStr1(ps, sf);
return "菜单选择";
}
case 35:
{
string[] ps = ["延迟时间 (以毫秒为单位)", "点击取消标志"];
SetExtStr1(ps, sf);
return "延迟处理";
}
case 36:
{
string[] ps = ["角色ID"];
SetExtStr1(ps, sf);
return "初始化LSF部件";
}
case 37:
{
string[] ps = ["角色ID", "部件状态..."];
SetExtStr1(ps, sf);
return "设置LSF部件状态";
}
case 38:
{
string[] ps = ["角色ID", "部件ID"];
SetExtStr1(ps, sf);
return "获取LSF部件状态";
}
case 39:
{
string[] ps = ["角色ID", "部件ID..."];
SetExtStr1(ps, sf);
return "LSF部件破坏效果";
}
case 40:
{
string[] ps = ["相对值"];
SetExtStr1(ps, sf);
return "相对指定显示对象属性";
}
case 41:
{
string[] ps = ["显示对象..."];
SetExtStr1(ps, sf);
return "指定显示对象列表";
}
case 42:
{
string[] ps = ["显示对象", "图像ID", "表情ID", "分辨率等级", "滤镜ID", "Z", "X", "Y", "水平缩放率", "垂直缩放率", "旋转角度", "不透明度"];
SetExtStr1(ps, sf);
return "设置显示对象";
}
case 43:
{
string[] ps = ["显示对象", "X", "Y"];
SetExtStr1(ps, sf);
return "设置显示对象的原点坐标";
}
case 44:
{
string[] ps = ["显示对象", "属性ID", "属性值"];
SetExtStr1(ps, sf);
return "设置显示对象的属性值";
}
case 45:
{
string[] ps = ["显示对象", "属性ID"];
SetExtStr1(ps, sf);
return "获取显示对象的属性值";
}
case 46:
{
string[] ps = ["显示对象", "效果编号", "部位ID", "相对于部位的X坐标", "相对于部位的Y坐标", "显示顺序"];
SetExtStr1(ps, sf);
return "设置情感效果";
}
case 47:
{
string[] ps = ["显示对象列表"];
SetExtStr1(ps, sf);
return "删除显示对象";
}
case 48:
{
string[] ps = ["效果编号", "显示时间 (ms)", "时间曲线", "翻转规则图像标志", "逆向播放标志", "颜色"];
SetExtStr1(ps, sf);
return "更新屏幕";
}
case 49:
{
string[] ps = ["显示对象", "时间", "X", "Y", "水平缩放率", "垂直缩放率", "旋转角度", "不透明度"];
SetExtStr1(ps, sf);
return "设置插值";
}
case 50:
{
string[] ps = ["显示对象", "插值动画ID"];
SetExtStr1(ps, sf);
return "插值动画";
}
case 51:
{
return "插值";
}
case 52:
{
string[] ps = ["显示对象", "变量编号", "值"];
SetExtStr1(ps, sf);
return "设置MOT的变量";
}
case 53:
{
string[] ps = ["显示对象", "变量编号"];
SetExtStr1(ps, sf);
return "获取MOT的变量";
}
case 54:
{
string[] ps = ["显示对象", "X轴震动像素数", "Y轴震动像素数", "效果时间"];
SetExtStr1(ps, sf);
return "屏幕震动";
}
case 55:
{
string[] ps = ["闪光颜色", "闪光次数"];
SetExtStr1(ps, sf);
return "闪光效果";
}
case 56:
{
string[] ps = ["滤镜ID", "模式", "颜色", "水平模糊", "垂直模糊"];
SetExtStr1(ps, sf);
return "设置颜色滤镜";
}
case 57:
{
string[] ps = ["效果编号"];
SetExtStr1(ps, sf);
return "设置特殊效果";
}
case 58:
{
string[] ps = ["效果标志", "取消标志"];
SetExtStr1(ps, sf);
return "屏幕效果等待";
}
case 59:
{
string[] ps = ["显示对象", "自动消失标志"];
SetExtStr1(ps, sf);
return "设置自动消失标志";
}
case 60:
{
string[] ps = ["视频编号"];
SetExtStr1(ps, sf);
return "播放视频";
}
case 61:
{
string[] ps = ["BGM编号", "淡入时间", "音量", "播放开始时间"];
SetExtStr1(ps, sf);
return "播放BGM";
}
case 62:
{
string[] ps = ["淡出时间"];
SetExtStr1(ps, sf);
return "停止BGM";
}
case 63:
{
string[] ps = ["音量值", "淡入淡出时间"];
SetExtStr1(ps, sf);
return "设置BGM音量";
}
case 64:
{
string[] ps = ["效果编号"];
SetExtStr1(ps, sf);
return "设置BGM效果";
}
case 65:
{
string[] ps = ["环境音编号", "淡入时间", "音量", "播放开始时间"];
SetExtStr1(ps, sf);
return "播放环境音";
}
case 66:
{
string[] ps = ["淡出时间"];
SetExtStr1(ps, sf);
return "停止环境音";
}
case 67:
{
string[] ps = ["音量值", "淡入淡出时间"];
SetExtStr1(ps, sf);
return "设置环境音音量";
}
case 68:
{
string[] ps = ["效果编号"];
SetExtStr1(ps, sf);
return "设置环境音效果";
}
case 69:
{
string[] ps = ["轨道", "音效编号", "循环标志", "淡入时间", "音量", "播放开始时间"];
SetExtStr1(ps, sf);
return "播放音效";
}
case 70:
{
string[] ps = ["轨道", "淡出时间"];
SetExtStr1(ps, sf);
return "停止音效";
}
case 71:
{
string[] ps = ["轨道"];
SetExtStr1(ps, sf);
return "音效等待";
}
case 72:
{
string[] ps = ["轨道", "音量值", "淡入淡出时间"];
SetExtStr1(ps, sf);
return "设置音效音量";
}
case 73:
{
string[] ps = ["效果编号"];
SetExtStr1(ps, sf);
return "设置音效效果";
}
case 74:
{
string[] ps = ["轨道", "语音编号", "淡入时间", "音量", "播放开始时间"];
SetExtStr1(ps, sf);
return "播放角色语音";
}
case 75:
{
string[] ps = ["轨道", "淡出时间"];
SetExtStr1(ps, sf);
return "停止角色语音";
}
case 76:
{
string[] ps = ["轨道"];
SetExtStr1(ps, sf);
return "角色语音等待";
}
case 77:
{
string[] ps = ["轨道", "音量值", "淡入淡出时间"];
SetExtStr1(ps, sf);
return "设置角色语音音量";
}
case 78:
{
string[] ps = ["效果编号"];
SetExtStr1(ps, sf);
return "设置角色语音效果";
}
case 79:
{
string[] ps = ["轨道", "语音编号", "淡入时间", "音量", "播放开始时间"];
SetExtStr1(ps, sf);
return "播放BGV";
}
case 80:
{
string[] ps = ["轨道", "淡出时间"];
SetExtStr1(ps, sf);
return "停止BGV";
}
case 81:
{
string[] ps = ["轨道", "音量值", "淡入淡出时间"];
SetExtStr1(ps, sf);
return "设置BGV音量";
}
case 82:
{
string[] ps = ["效果编号"];
SetExtStr1(ps, sf);
return "设置BGV效果";
}
case 83:
{
string[] ps = ["类别ID", "参数ID", "参数值"];
SetExtStr1(ps, sf);
return "设置参数";
}
case 84:
{
string[] ps = ["类别ID", "参数ID"];
SetExtStr1(ps, sf);
return "获取参数";
}
case 85:
{
string[] ps = ["脚本ID"];
SetExtStr1(ps, sf);
return "文件跳转";
}
case 86:
{
string[] ps = ["经过天数"];
SetExtStr1(ps, sf);
return "更新日期";
}
case 87:
{
string[] ps = ["脚本ID"];
SetExtStr1(ps, sf);
return "更新并显示流程图";
}
case 88:
{
string[] ps = ["日记ID", "附加标志", "等待标志"];
SetExtStr1(ps, sf);
return "更新并显示日记";
}
case 89:
{
string[] ps = ["脚本ID", "父脚本ID"];
SetExtStr1(ps, sf);
return "解锁区块";
}
case 90:
{
string[] ps = ["章节ID"];
SetExtStr1(ps, sf);
return "设置章节";
}
case 91:
{
return "附加内容";
}
}
return "";
}
private static void SetExtStr1(string[] ps, ScriptFile sf)
{
int i = sf.Commands.Count - 2;
sf.Commands[i + 1].IsProcSet = true;
for (int k = 0; k < ps.Length; k++)
{
if (sf.Commands[i].IsProcSet || sf.Commands[i].Instruction < 4 || sf.Commands[i].Instruction > 10)
{
k--;
i--;
continue;
}
sf.Commands[i].Helper += $": {ps[k]}";
sf.Commands[i].IsProcSet = true;
i--;
}
}
} }
} }

View File

@ -4,9 +4,126 @@ namespace EscudeTools
{ {
public class ImageManager public class ImageManager
{ {
public static void ImgPreProcessNew(List<StTable> stts, Face[] faces, LsfManager lm, string outputDir)
{
var parallelOptions = new ParallelOptions
{
MaxDegreeOfParallelism = 6 // 设置最大并行线程数
};
Parallel.ForEach(stts, parallelOptions, stt =>
//foreach (StTable stt in stts)
{
if (stt.order == 0) //仅提取鉴赏中有的ST
return;
//continue;
string targetFilename = Path.Combine(outputDir, stt.name); //最后保存可用的文件名
LsfData? lsfData = lm.FindLsfDataByName(stt.file);
if (lsfData == null)
{
Console.WriteLine($"警告,未找到与{stt.file}对应的lsf数据");
return;
}
List<int> pendingList = [];
List<string> pendingListFn = [];
foreach (string o in stt.option)
{
List<int> t = TableManagercs.ParseOptions(lsfData, o);
if (t.Count == 0)
continue;
pendingList.AddRange(t);
foreach (int i in t)
{
pendingListFn.Add(lsfData.lli[i].nameStr);
}
}
//pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
int n = 0;
foreach (string o in faces[(int)stt.face].faceOptions)
{
List<int> pendingListCopy = new(pendingList);
List<string> pendingListFnCopy = new(pendingListFn);
List<int> t = TableManagercs.ParseOptions(lsfData, o);
if (t.Count == 0)
continue;
foreach (int i in t)
{
pendingListFnCopy.Add(lsfData.lli[i].nameStr);
}
pendingListCopy.AddRange(t);
pendingListCopy = TableManagercs.OrderLayer(pendingListCopy, pendingListFnCopy);
if (!ImageManager.Process(lsfData, [.. pendingListCopy], targetFilename + $"_{n}.png"))
throw new Exception("Process Fail");
else
Console.WriteLine($"Export {stt.name}_{n} Success");
n++;
}
});
}
public static void ImgPreProcessOld(List<StTable> stts, LsfManager lm, string outputDir)
{
var parallelOptions = new ParallelOptions
{
MaxDegreeOfParallelism = 6 // 设置最大并行线程数
};
Parallel.ForEach(stts, parallelOptions, stt =>
//foreach (var stt in stts)
{
if (stt.order == 0) //仅提取鉴赏中有的ST
return;
string targetFilename = Path.Combine(outputDir, stt.name);
LsfData? lsfData = lm.FindLsfDataByName(stt.file);
if (lsfData == null)
{
Console.WriteLine($"警告,未找到与{stt.file}对应的lsf数据");
return;
}
List<int> faceAvailList = [];
List<string> faceAvailNameList = [];
for (int i = 0; i < lsfData.lli.Length; i++)
{
if (lsfData.lli[i].index == 1)
{
faceAvailList.Add(i);
faceAvailNameList.Add(lsfData.lli[i].nameStr);
}
}
List<int> pendingList = [];
List<string> pendingListFn = [];
foreach (string o in stt.option)
{
List<int> t = TableManagercs.ParseOptions(lsfData, o);
if (t.Count == 0)
continue;
pendingList.AddRange(t);
foreach (int i in t)
{
pendingListFn.Add(lsfData.lli[i].nameStr);
}
}
//pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
int n = 0;
for (int k = 0; k < faceAvailList.Count; k++)
{
List<int> que = new(pendingList);
List<string> queStr = new(pendingListFn);
que.Add(faceAvailList[k]);
queStr.Add(faceAvailNameList[k]);
que = TableManagercs.OrderLayer(que, queStr);
if (!ImageManager.Process(lsfData, [.. que], targetFilename + $"_{n}.png"))
throw new Exception("Process Fail");
else
Console.WriteLine($"Export {stt.name}_{n} Success");
n++;
}
});
}
public static bool Process(LsfData ld, int[] n, string target) public static bool Process(LsfData ld, int[] n, string target)
{ {
//get base size
int height = ld.lfh.height, width = ld.lfh.width; int height = ld.lfh.height, width = ld.lfh.width;
using var baseImage = new MagickImage(MagickColors.Transparent, (uint)width, (uint)height); using var baseImage = new MagickImage(MagickColors.Transparent, (uint)width, (uint)height);
for (int i = 0; i < n.Length; i++) for (int i = 0; i < n.Length; i++)
@ -19,9 +136,9 @@ namespace EscudeTools
if (mode == 3) if (mode == 3)
{ {
overlayImage.Composite(baseImage, -1 * offsetX, -1 * offsetY, CompositeOperator.DstIn); overlayImage.Composite(baseImage, -1 * offsetX, -1 * offsetY, CompositeOperator.DstIn);
baseImage.Composite(overlayImage, offsetX, offsetY, CompositeOperator.Multiply);//原先就一条这个,发现处理透明时会有问题 baseImage.Composite(overlayImage, offsetX, offsetY, CompositeOperator.Multiply);//应该能解决透明度问题了
} }
else if (mode == 10) else if (mode == 10) //目前还没遇到过?
{ {
baseImage.Composite(overlayImage, offsetX, offsetY, CompositeOperator.Plus); baseImage.Composite(overlayImage, offsetX, offsetY, CompositeOperator.Plus);
} }
@ -34,10 +151,6 @@ namespace EscudeTools
return true; return true;
} }
//上面足够给Ev、St用了
//public static bool StProcess()
//{
// throw new NotImplementedException();
//}
} }
} }

View File

@ -42,7 +42,7 @@ namespace EscudeTools
public string pathStr; public string pathStr;
public string lsfName; public string lsfName;
} }
public class LsfFileHeader public class LsfFileHeader
{ {
//public uint signature; // Header signature (LSF) 0x46534C //public uint signature; // Header signature (LSF) 0x46534C

View File

@ -212,6 +212,7 @@ namespace EscudeTools
using (var command = new SqliteCommand($"SELECT * FROM {foundTN[0]};", connection)) using (var command = new SqliteCommand($"SELECT * FROM {foundTN[0]};", connection))
{ {
using var reader = command.ExecuteReader(); using var reader = command.ExecuteReader();
int fieldCount = reader.FieldCount;
while (reader.Read()) while (reader.Read())
{ {
if (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0))) if (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0)))
@ -223,7 +224,7 @@ namespace EscudeTools
option = (reader["オプション_44"].ToString() ?? "").Split(' '), option = (reader["オプション_44"].ToString() ?? "").Split(' '),
//coverd = (uint)reader.GetInt32(3), //coverd = (uint)reader.GetInt32(3),
//filter = (uint)reader.GetInt32(4), //filter = (uint)reader.GetInt32(4),
face = (uint)reader.GetInt32("表情_14"), face = (uint)(fieldCount == 9 ? 0 : reader.GetInt32("表情_14")),
//id = (uint)reader.GetInt32(6), //id = (uint)reader.GetInt32(6),
//loc = (uint)reader.GetInt32(7), //loc = (uint)reader.GetInt32(7),
order = reader.GetInt32("CG鑑賞_14"), order = reader.GetInt32("CG鑑賞_14"),
@ -232,10 +233,14 @@ namespace EscudeTools
} }
} }
List<string> fa = []; List<string> fa = [];
bool legacyMode = false;
using (var command = new SqliteCommand($"SELECT * FROM {foundTN[1]};", connection)) using (var command = new SqliteCommand($"SELECT * FROM {foundTN[1]};", connection))
{ {
using var reader = command.ExecuteReader(); using var reader = command.ExecuteReader();
while (reader.Read()) int fieldCount = reader.FieldCount;
if (fieldCount <= 2)
legacyMode = true;
while (reader.Read() && !legacyMode)
{ {
if (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0))) if (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0)))
continue; continue;
@ -263,55 +268,10 @@ namespace EscudeTools
string outputDir = Path.Combine(Path.GetDirectoryName(v1), "Output"); string outputDir = Path.Combine(Path.GetDirectoryName(v1), "Output");
if (!Directory.Exists(outputDir)) if (!Directory.Exists(outputDir))
Directory.CreateDirectory(outputDir); Directory.CreateDirectory(outputDir);
if (legacyMode)
var parallelOptions = new ParallelOptions ImageManager.ImgPreProcessOld(stts, lm, outputDir);
{ else
MaxDegreeOfParallelism = 6 // 设置最大并行线程数 ImageManager.ImgPreProcessNew(stts, faces, lm, outputDir);
};
Parallel.ForEach(stts, parallelOptions, stt =>
//foreach (StTable stt in stts)
{
if (stt.order == 0) //仅提取鉴赏中有的ST
return;
//continue;
string targetFilename = Path.Combine(outputDir, stt.name); //最后保存可用的文件名
LsfData? lsfData = lm.FindLsfDataByName(stt.file) ?? throw new Exception($"错误,未找到与{stt.file}对应的lsf数据");
List<int> pendingList = [];
List<string> pendingListFn = [];
foreach (string o in stt.option)
{
List<int> t = TableManagercs.ParseOptions(lsfData, o);
if (t.Count == 0)
continue;
pendingList.AddRange(t);
foreach (int i in t)
{
pendingListFn.Add(lsfData.lli[i].nameStr);
}
}
//pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
int n = 0;
foreach (string o in faces[(int)stt.face].faceOptions)
{
List<int> pendingListCopy = new(pendingList);
List<string> pendingListFnCopy = new(pendingListFn);
List<int> t = TableManagercs.ParseOptions(lsfData, o);
if (t.Count == 0)
continue;
foreach (int i in t)
{
pendingListFnCopy.Add(lsfData.lli[i].nameStr);
}
pendingListCopy.AddRange(t);
pendingListCopy = TableManagercs.OrderLayer(pendingListCopy, pendingListFnCopy);
if (!ImageManager.Process(lsfData, [.. pendingListCopy], targetFilename + $"_{n++}.png"))
throw new Exception("Process Fail");
else
Console.WriteLine($"Export {stt.name}_{n - 1} Success");
}
});
//}
} }
} }
@ -548,7 +508,7 @@ namespace EscudeTools
//导出db_*.bin //导出db_*.bin
if (Directory.Exists(v)) if (Directory.Exists(v))
{ {
string[] files = Directory.GetFiles(v, "db_*.bin"); string[] files = Directory.GetFiles(v, "*.bin");
DatabaseManager dm = new(); DatabaseManager dm = new();
foreach (string file in files) foreach (string file in files)
{ {
@ -647,7 +607,7 @@ namespace EscudeTools
Console.WriteLine("Ignore the 001 files; the program will read them if needed."); Console.WriteLine("Ignore the 001 files; the program will read them if needed.");
Console.WriteLine("Must specify the type of script bin file to unpack."); Console.WriteLine("Must specify the type of script bin file to unpack.");
Console.WriteLine("Accepts the following types: 0, 1, 2."); Console.WriteLine("Accepts the following types: 0, 1, 2.");
Console.WriteLine("Type 0: Full; this creates script.db containing all .bin and .001 information."); Console.WriteLine("Type 0(unstable): Full; this creates script.db containing all .bin and .001 information.");
Console.WriteLine("Type 2: Exports only the text from bin; this creates script_text.db and many .dat files (non-text data)."); Console.WriteLine("Type 2: Exports only the text from bin; this creates script_text.db and many .dat files (non-text data).");
Console.WriteLine("Type 1: Exports only the text from 001; this creates script_sm.db containing all .001 information."); Console.WriteLine("Type 1: Exports only the text from 001; this creates script_sm.db containing all .001 information.");
Console.WriteLine(); Console.WriteLine();

View File

@ -1,7 +1,8 @@
{ {
"profiles": { "profiles": {
"EscudeTools": { "EscudeTools": {
"commandName": "Project" "commandName": "Project",
"commandLineArgs": "-v\r\n\"G:\\x221.local\\[231027][1231724][エスクード] 戦巫<センナギ> ―穢れた契りと神ころも― DL版 (files)\\戦巫〈センナギ〉―穢れた契りと神ころも―\\1\\script\"\r\n-t\r\n0"
} }
} }
} }

View File

@ -89,9 +89,9 @@ namespace EscudeTools
foreach (string item in layer_fn) foreach (string item in layer_fn)
{ {
string[] parts = item.Split("_"); string[] parts = item.Split("_");
if (parts.Length == 3) if (parts.Length >= 3)
{ {
if (int.TryParse(parts[2], out int number)) if (int.TryParse(parts[^1], out int number))
{ {
order.Add(number); order.Add(number);
} }