Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoMico authored and NicoMico committed Jun 22, 2024
1 parent f8a60a3 commit c92fa97
Show file tree
Hide file tree
Showing 13 changed files with 532 additions and 458 deletions.
2 changes: 2 additions & 0 deletions 3Dmigoto-Wheel-GUI/MainForm/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions MMT/CODE_STANDARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Boost.log和easyloggingpp都只能使用std::string都不能使用std::wstring.
- 不能一个解决方案多个项目,尤其是多个项目之间文件名和方法名都差不多,会导致Visual Studio无法正确分析符号链接,无法正确的使用对应的符号。
- 不要在克隆项目后直接以文件夹形式打开项目,然后再打开sln项目,这样会导致所有类名都无法正常解析,应该直接打开.sln,这样才能确保VisualStudio的语法解析器正常工作。
- 应该尽可能使用面向对象的方法进行设计,把方法的调用抽象为类,在类的初始化方法中传递方法参数,通过赋值类的属性来获取返回值,这样基本上全部都是模块化处理,方便理解和维护。

# 从源代码编译构建
Some preconfig you will need to have:
Expand Down
2 changes: 2 additions & 0 deletions MMT/MMT.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@
<ClCompile Include="IndexBufferBufFile.cpp" />
<ClCompile Include="MigotoFormatUtils.cpp" />
<ClCompile Include="MMTLogUtils.cpp" />
<ClCompile Include="ModFormatBasic.cpp" />
<ClCompile Include="ModFormatExtra.cpp" />
<ClCompile Include="ModFormat_ParseBasic.cpp" />
<ClCompile Include="ModFormat_ParseSelf.cpp" />
<ClCompile Include="ModFormat_ParseUtil.cpp" />
Expand Down
32 changes: 19 additions & 13 deletions MMT/MMT.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<Filter Include="Utils\ThirdParty">
<UniqueIdentifier>{c088ef43-21fc-40d3-9cbf-87a668aadd66}</UniqueIdentifier>
</Filter>
<Filter Include="Sword-Lv4">
<UniqueIdentifier>{7b111c10-a0b9-4c34-b1d9-10f95fed13b8}</UniqueIdentifier>
</Filter>
<Filter Include="DataModel\IndexBuffer">
<UniqueIdentifier>{64ff23be-f294-42af-9578-cf1187da023f}</UniqueIdentifier>
</Filter>
Expand Down Expand Up @@ -40,6 +37,9 @@
<Filter Include="Sword-Lv3-Deprecated">
<UniqueIdentifier>{fd2fc426-9f5c-4b0b-b253-d2f8a26e94e2}</UniqueIdentifier>
</Filter>
<Filter Include="Reverse">
<UniqueIdentifier>{7b111c10-a0b9-4c34-b1d9-10f95fed13b8}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
Expand Down Expand Up @@ -78,10 +78,10 @@
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="ModFormat_ParseSelf.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="Reverse_Lv4_Merged_OutfitCompiler.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="IndexBufferTxtFile.cpp">
<Filter>DataModel\IndexBuffer</Filter>
Expand Down Expand Up @@ -150,22 +150,28 @@
<Filter>Games\WuWa</Filter>
</ClCompile>
<ClCompile Include="Reverse_Lv4_Single.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="Reverse_Lv4_Merged_Toggle.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="Reverse_Lv4_Merged_NameSpace.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="ModFormat_ParseUtil.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="ModFormat_ParseBasic.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="Reverse_Lv4_3Dmigoto_Simulator.cpp">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="ModFormatExtra.cpp">
<Filter>Reverse</Filter>
</ClCompile>
<ClCompile Include="ModFormatBasic.cpp">
<Filter>Reverse</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -201,7 +207,7 @@
<Filter>Utils</Filter>
</ClInclude>
<ClInclude Include="ModFormatExtra.h">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClInclude>
<ClInclude Include="GlobalFunctions.h" />
<ClInclude Include="IndexBufferTxtFile.h">
Expand Down Expand Up @@ -244,7 +250,7 @@
<Filter>Games\WuWa</Filter>
</ClInclude>
<ClInclude Include="ModFormatBasic.h">
<Filter>Sword-Lv4</Filter>
<Filter>Reverse</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions MMT/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ std::int32_t wmain(std::int32_t argc, wchar_t* argv[])
UnityGenerate();
}
}
//逆向提取
else if (G.RunCommand == L"mergeReverse") {
if (G.GameName == L"HI3") {
ExtractFromBuffer_VS_Reverse();
Expand All @@ -95,22 +96,25 @@ std::int32_t wmain(std::int32_t argc, wchar_t* argv[])
ExtractFromBuffer_VS_Reverse();
}
}
//Happy Reverse!
else if (G.RunCommand == L"reverseOutfitCompiler") {
Reverse_Lv4_Merged_OutfitCompiler();
}
else if (G.RunCommand == L"reverseSingle") {
Reverse_Lv4_Single();
}
else if (G.RunCommand == L"reverseMerged") {
Reverse_Lv4_Merged_Toggle();
//Reverse_Lv4_Merged_Toggle();
ReverseMerged();
}
else if (G.RunCommand == L"reverseMergedNameSpace") {
Reverse_Lv4_Merged_NameSpace();
}
else if (G.RunCommand == L"reverse3DmigotoSimulator") {
Reverse_Lv4_3Dmigoto_Simulator();
}


//If we success executed,we will run to here.
LOG.Success();
#endif
return 0;
Expand Down
160 changes: 160 additions & 0 deletions MMT/ModFormatBasic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
#include "ModFormatBasic.h"
#include <iostream>


//--------------------------------------------------------------------------------------------------------------------
M_Condition::M_Condition() {

}


//传入if或者else if后面的条件判断部分字符串,随后解析出其中涉及的变量和逻辑
M_Condition::M_Condition(std::wstring ConditionStr) {
LOG.NewLine();
LOG.Info(L"Start to parse condition expression for: " + ConditionStr);
//首先查找是否含有&& 或者 || 这种类型符号,如果找到了那就按多个进行处理,否则按单个进行处理
bool singleExpression = true;
if (ConditionStr.find(L"&&") != std::wstring::npos) {
singleExpression = false;
}
else if (ConditionStr.find(L"||") != std::wstring::npos) {
singleExpression = false;
}

if (singleExpression) {
LOG.Info("Can't find && or || in ConditionStr, take it as a single expression condition.");
//首先偷懒,使用= 或 ==分割,如果分割出来的ConditionVarValue里没有再出现== !=或者变量$这类的东西,说明正常运作
IniLineObject conditionLine(ConditionStr);
this->Condition_VarName_VarValue_Map[conditionLine.LeftStrTrim] = conditionLine.RightStrTrim;
}
else {
LOG.Info("find && or || in ConditionStr, take it as a multiple expression condition.");

}


//检查ConditionVarValue中是否含有变量名,逻辑符号等,进行更复杂的解析判断。
LOG.Info(L"Parse condition expression over.");
LOG.NewLine();
}

void M_Condition::show() {

}


//--------------------------------------------------------------------------------------------------------------------
IniLineObject::IniLineObject() {

}

IniLineObject::IniLineObject(std::wstring readLine) {
int firstDoubleEqualIndex = (int)readLine.find(L"==");
int firstEqualIndex = (int)readLine.find(L"=");
//LOG.Info(L"firstDoubleEqualIndex: " + std::to_wstring(firstDoubleEqualIndex));
//LOG.Info(L"firstEqualIndex: " + std::to_wstring(firstEqualIndex));
//默认使用==,如果==找不到,那就换成=
std::wstring delimiter = L"==";
if (firstDoubleEqualIndex == std::wstring::npos) {
delimiter = L"=";
}

//找到了==或者找到了=都可以接受
if (firstEqualIndex != std::wstring::npos || firstDoubleEqualIndex != std::wstring::npos) {
std::vector<std::wstring> lowerReadLineSplitList = MMTString_SplitString(readLine, delimiter);
if (lowerReadLineSplitList.size() < 2) {
LOG.Error(L"lowerReadLineSplitList size is " + std::to_wstring(lowerReadLineSplitList.size()) + L",please check!");
}
std::wstring leftStr = lowerReadLineSplitList[0];
std::wstring rightStr = lowerReadLineSplitList[1];
//LOG.Info(L"leftStr:" + leftStr);
//LOG.Info(L"rightStr:" + rightStr);
LeftStr = leftStr;
RightStr = rightStr;
boost::algorithm::trim(leftStr);
boost::algorithm::trim(rightStr);
LeftStrTrim = leftStr;
RightStrTrim = rightStr;
valid = true;
}
else {
LeftStr = L"";
RightStr = L"";
LeftStrTrim = L"";
RightStrTrim = L"";
valid = false;
}
}

//下面这个留着指定分隔符,上面那个用来判断变量相关的时候
IniLineObject::IniLineObject(std::wstring readLine, std::wstring delimiter) {
int firstEqualIndex = (int)readLine.find_first_of(delimiter);
if (firstEqualIndex != std::wstring::npos) {
std::vector<std::wstring> lowerReadLineSplitList = MMTString_SplitString(readLine, delimiter);
std::wstring leftStr = lowerReadLineSplitList[0];
std::wstring rightStr = lowerReadLineSplitList[1];
LeftStr = leftStr;
RightStr = rightStr;
boost::algorithm::trim(leftStr);
boost::algorithm::trim(rightStr);
LeftStrTrim = leftStr;
RightStrTrim = rightStr;
valid = true;
}
else {
LeftStr = L"";
RightStr = L"";
LeftStrTrim = L"";
RightStrTrim = L"";
valid = false;
}
}


//--------------------------------------------------------------------------------------------------------------------
M_SectionLine::M_SectionLine() {

}


//--------------------------------------------------------------------------------------------------------------------
M_Variable::M_Variable() {

}


M_Variable::M_Variable(std::wstring InNameSpace, std::wstring InVariableName, std::wstring InType) {
this->NameSpace = InNameSpace;
this->VariableName = InVariableName;
this->NamespacedVarName = this->NameSpace + L"\\" + this->VariableName;
this->Type = InType;
}


M_Variable::M_Variable(std::wstring InNameSpace, std::wstring InVariableName, std::wstring InInitializeValue, std::wstring InType) {
this->NameSpace = InNameSpace;
this->VariableName = InVariableName;
this->NamespacedVarName = this->NameSpace + L"\\" + this->VariableName;
this->InitializeValue = InInitializeValue;
this->Type = InType;
}


//--------------------------------------------------------------------------------------------------------------------
M_DrawIndexed::M_DrawIndexed() {

}

//--------------------------------------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------------------------
Loading

0 comments on commit c92fa97

Please sign in to comment.