22// 一些辅助的功能
33// 一些常数的设置比较不合理,建议以调试模式手动执行
44
5- #include " File .h"
5+ #include " GameUtil .h"
66#include " GrpIdxFile.h"
7- #include " TypesABC.h"
8- #include " strfunc.h"
9- #include " fmt1.h"
10- #include " Save.h"
117#include " OpenCCConverter.h"
128#include " PotConv.h"
13- #include " GameUtil.h"
9+ #include " Save.h"
10+ #include " TypesABC.h"
11+ #include " filefunc.h"
12+ #include " fmt1.h"
13+ #include " strfunc.h"
1414
1515// 转换二进制文件为文本
1616void trans_bin_list (std::string in, std::string out)
1717{
1818 std::vector<int16_t > leave_list;
19- File ::readFileToVector (in, leave_list);
19+ filefunc ::readFileToVector (in, leave_list);
2020
2121 std::string s;
2222 for (auto a : leave_list)
@@ -34,9 +34,9 @@ void trans_fight_frame()
3434 std::string path = fmt1::format (" C:/Users/sty/Desktop/ff/fight{:03}" , i);
3535 std::vector<int16_t > frame;
3636 std::string filename = path + " /fightframe.ka" ;
37- if (File ::fileExist (filename))
37+ if (filefunc ::fileExist (filename))
3838 {
39- File ::readFileToVector (path + " /fightframe.ka" , frame);
39+ filefunc ::readFileToVector (path + " /fightframe.ka" , frame);
4040 std::string content;
4141 fmt1::print (" role {}\n " , i);
4242 for (int j = 0 ; j < 5 ; j++)
@@ -56,7 +56,7 @@ void trans_fight_frame()
5656// 最后一个参数:帧数需从之前存档格式获取
5757int expandR (std::string idx, std::string grp, bool ranger = true , bool make_fightframe = false )
5858{
59- if (!File ::fileExist (grp) || !File ::fileExist (idx))
59+ if (!filefunc ::fileExist (grp) || !filefunc ::fileExist (idx))
6060 {
6161 return -1 ;
6262 }
@@ -91,7 +91,7 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
9191 std::vector<MagicSave1> magics_mem_;
9292 std::vector<ItemSave1> items_mem_;
9393 std::vector<SubMapInfoSave1> submap_infos_mem_;
94- File ::readDataToVector (rgrp1 + offset1[1 ], length1[1 ], roles_mem_);
94+ filefunc ::readDataToVector (rgrp1 + offset1[1 ], length1[1 ], roles_mem_);
9595 if (make_fightframe)
9696 {
9797 for (auto it = roles_mem_.end () - 1 ; it >= roles_mem_.begin (); it--)
@@ -109,27 +109,27 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
109109 }
110110 if (!content.empty ())
111111 {
112- auto p = File::getFilePath (idx);
113- p = File::getFilePath (p);
112+ auto p = filefunc::getParentPath (idx);
113+ p = filefunc::getParentPath (p);
114114 auto f = fmt1::format (" {}/resource/fight/fight{:03}/fightframe.txt" , p, r.HeadID );
115115 strfunc::writeStringToFile (content, f);
116116 }
117117 }
118118 if (!ranger) { return 1 ; }
119119 }
120120
121- File ::readDataToVector (rgrp1 + offset1[2 ], length1[2 ], items_mem_);
122- File ::readDataToVector (rgrp1 + offset1[3 ], length1[3 ], submap_infos_mem_);
123- File ::readDataToVector (rgrp1 + offset1[4 ], length1[4 ], magics_mem_);
121+ filefunc ::readDataToVector (rgrp1 + offset1[2 ], length1[2 ], items_mem_);
122+ filefunc ::readDataToVector (rgrp1 + offset1[3 ], length1[3 ], submap_infos_mem_);
123+ filefunc ::readDataToVector (rgrp1 + offset1[4 ], length1[4 ], magics_mem_);
124124
125125 std::vector<RoleSave> roles;
126126 std::vector<MagicSave> magics;
127127 std::vector<ItemSave> items;
128128 std::vector<SubMapInfoSave> submap_infos;
129- File ::readDataToVector (rgrp2 + offset2[1 ], length2[1 ], roles);
130- File ::readDataToVector (rgrp2 + offset2[2 ], length2[2 ], items);
131- File ::readDataToVector (rgrp2 + offset2[3 ], length2[3 ], submap_infos);
132- File ::readDataToVector (rgrp2 + offset2[4 ], length2[4 ], magics);
129+ filefunc ::readDataToVector (rgrp2 + offset2[1 ], length2[1 ], roles);
130+ filefunc ::readDataToVector (rgrp2 + offset2[2 ], length2[2 ], items);
131+ filefunc ::readDataToVector (rgrp2 + offset2[3 ], length2[3 ], submap_infos);
132+ filefunc ::readDataToVector (rgrp2 + offset2[4 ], length2[4 ], magics);
133133 for (int i = 0 ; i < roles.size (); i++)
134134 {
135135 memset (roles[i].Name , 0 , sizeof (roles[i].Name ));
@@ -154,14 +154,14 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
154154 memset (submap_infos[i].Name , 0 , sizeof (submap_infos[i].Name ));
155155 memcpy (submap_infos[i].Name , submap_infos_mem_[i].Name , sizeof (submap_infos_mem_[i].Name ));
156156 }
157- File ::writeVectorToData (rgrp2 + offset2[1 ], length2[1 ], roles, sizeof (RoleSave));
158- File ::writeVectorToData (rgrp2 + offset2[2 ], length2[2 ], items, sizeof (ItemSave));
159- File ::writeVectorToData (rgrp2 + offset2[3 ], length2[3 ], submap_infos, sizeof (SubMapInfoSave));
160- File ::writeVectorToData (rgrp2 + offset2[4 ], length2[4 ], magics, sizeof (MagicSave));
157+ filefunc ::writeVectorToData (rgrp2 + offset2[1 ], length2[1 ], roles, sizeof (RoleSave));
158+ filefunc ::writeVectorToData (rgrp2 + offset2[2 ], length2[2 ], items, sizeof (ItemSave));
159+ filefunc ::writeVectorToData (rgrp2 + offset2[3 ], length2[3 ], submap_infos, sizeof (SubMapInfoSave));
160+ filefunc ::writeVectorToData (rgrp2 + offset2[4 ], length2[4 ], magics, sizeof (MagicSave));
161161 }
162162 s32[1 ]--; // submap scene id
163- File ::writeFile (grp + " 32" , rgrp2, len * 2 );
164- File ::writeFile (idx + " 32" , &offset2[1 ], 4 * offset2.size () - 4 );
163+ filefunc ::writeFile (grp + " 32" , rgrp2, len * 2 );
164+ filefunc ::writeFile (idx + " 32" , &offset2[1 ], 4 * offset2.size () - 4 );
165165 // delete rgrp1;
166166 delete rgrp2;
167167
@@ -173,8 +173,8 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
173173void combine_ka (std::string in, std::string out)
174174{
175175 std::vector<int16_t > in1, out1;
176- File ::readFileToVector (in, in1);
177- File ::readFileToVector (out, out1);
176+ filefunc ::readFileToVector (in, in1);
177+ filefunc ::readFileToVector (out, out1);
178178 std::string s;
179179 int i = 0 ;
180180 for (int i = 0 ; i < out1.size (); i += 2 )
@@ -185,9 +185,8 @@ void combine_ka(std::string in, std::string out)
185185 out1[i + 1 ] = in1[i + 1 ];
186186 fmt1::print (" {}, " , i / 2 );
187187 }
188-
189188 }
190- File ::writeFile (out, out1.data (), out1.size () * 2 );
189+ filefunc ::writeFile (out, out1.data (), out1.size () * 2 );
191190 // convert::writeStringToFile(s, out);
192191}
193192
@@ -197,9 +196,9 @@ void check_fight_frame(std::string path, int repair = 0)
197196 for (int i = 0 ; i < 500 ; i++)
198197 {
199198 auto path1 = fmt1::format (" {}/fight{:03}" , path, i);
200- if (File ::pathExist (path1))
199+ if (filefunc ::pathExist (path1))
201200 {
202- auto files = File ::getFilesInPath (path1, 0 );
201+ auto files = filefunc ::getFilesInPath (path1, 0 );
203202 int count = files.size () - 3 ;
204203 int sum = 0 ;
205204 auto filename = path1 + " /fightframe.txt" ;
@@ -227,7 +226,7 @@ void check_fight_frame(std::string path, int repair = 0)
227226// 检查3号指令的最后3个参数正确性
228227void check_script (std::string path)
229228{
230- auto files = File ::getFilesInPath (path, 0 );
229+ auto files = filefunc ::getFilesInPath (path, 0 );
231230 for (auto & f : files)
232231 {
233232 bool repair = false ;
@@ -279,7 +278,7 @@ void check_script(std::string path)
279278// 重新产生头像
280279void make_heads (std::string path)
281280{
282- auto h_lib = File ::getFilesInPath (path);
281+ auto h_lib = filefunc ::getFilesInPath (path);
283282 Save::getInstance ()->loadR (0 );
284283 for (auto r : Save::getInstance ()->getRoles ())
285284 {
@@ -300,7 +299,6 @@ void make_heads(std::string path)
300299 }
301300 }
302301 }
303-
304302}
305303
306304int main ()
0 commit comments