Update SortRdb code and add it to project
This commit is contained in:
parent
6c9237f603
commit
edeaf14471
|
@ -68,6 +68,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "discord-rpc", "Source\3rdPa
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64-input", "Source\Project64-input\Project64-input.vcxproj", "{D3F979CE-8FA7-48C9-A2B3-A33594B48536}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SortRdb", "Source\SortRdb\SortRdb.vcxproj", "{5788717F-E3D4-40CF-9637-3A2AEE85BB81}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -235,6 +237,12 @@ Global
|
|||
{D3F979CE-8FA7-48C9-A2B3-A33594B48536}.Release|Win32.Build.0 = Release|Win32
|
||||
{D3F979CE-8FA7-48C9-A2B3-A33594B48536}.Release|x64.ActiveCfg = Release|x64
|
||||
{D3F979CE-8FA7-48C9-A2B3-A33594B48536}.Release|x64.Build.0 = Release|x64
|
||||
{5788717F-E3D4-40CF-9637-3A2AEE85BB81}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5788717F-E3D4-40CF-9637-3A2AEE85BB81}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5788717F-E3D4-40CF-9637-3A2AEE85BB81}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{5788717F-E3D4-40CF-9637-3A2AEE85BB81}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5788717F-E3D4-40CF-9637-3A2AEE85BB81}.Release|Win32.Build.0 = Release|Win32
|
||||
{5788717F-E3D4-40CF-9637-3A2AEE85BB81}.Release|x64.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -13,42 +13,17 @@
|
|||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5788717F-E3D4-40CF-9637-3A2AEE85BB81}</ProjectGuid>
|
||||
<RootNamespace>SortRdb</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(SolutionDir)PropertySheets\Platform.$(Configuration).props" />
|
||||
</ImportGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)PropertySheets/Win32.Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(SolutionDir)PropertySheets/Win32.Debug.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader />
|
||||
</ClCompile>
|
||||
|
@ -65,7 +40,4 @@
|
|||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,5 +1,6 @@
|
|||
#include <windows.h>
|
||||
#include <common/IniFileClass.h>
|
||||
#include <Common/IniFile.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <set>
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
|
@ -232,27 +233,28 @@ int main (int argc, char *argv[])
|
|||
PDNames.insert("Yoshi's Story BootEmu (PD)");
|
||||
|
||||
strmap GoodNameSections, PDNameSections;
|
||||
for (size_t i = 0, n = Sections.size(); i < n; i++)
|
||||
for (CIniFile::SectionList::const_iterator SectionItr = Sections.begin(); SectionItr != Sections.end(); SectionItr++)
|
||||
{
|
||||
const char * Section = SectionItr->c_str();
|
||||
stdstr GoodName;
|
||||
if (!RomIniFile.GetString(Sections[i].c_str(),"Good Name","",GoodName))
|
||||
if (!RomIniFile.GetString(Section,"Good Name","",GoodName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::vector<std::string> items;
|
||||
items.push_back(Sections[i]);
|
||||
items.push_back(Section);
|
||||
if (PDNames.find(GoodName) == PDNames.end())
|
||||
{
|
||||
strmap::_Pairib res = GoodNameSections.insert(strmap::value_type(GoodName,items));
|
||||
if (!res.second)
|
||||
{
|
||||
res.first->second.push_back(Sections[i]);
|
||||
res.first->second.push_back(Section);
|
||||
}
|
||||
} else {
|
||||
strmap::_Pairib res = PDNameSections.insert(strmap::value_type(GoodName,items));
|
||||
if (!res.second)
|
||||
{
|
||||
res.first->second.push_back(Sections[i]);
|
||||
res.first->second.push_back(Section);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,12 +275,12 @@ int main (int argc, char *argv[])
|
|||
for (size_t i = 0, n = itr->second.size(); i < n; i++)
|
||||
{
|
||||
std::string & SectionName = itr->second[i];
|
||||
strlist KeyList;
|
||||
CIniFileBase::strlist KeyList;
|
||||
RomIniFile.GetKeyList(SectionName.c_str(),KeyList);
|
||||
std::set<stdstr> SortedKeyList;
|
||||
for (strlist::iterator itr = KeyList.begin(); itr != KeyList.end(); itr++)
|
||||
for (CIniFileBase::strlist::iterator KeyListItr = KeyList.begin(); KeyListItr != KeyList.end(); KeyListItr++)
|
||||
{
|
||||
SortedKeyList.insert(*itr);
|
||||
SortedKeyList.insert(*KeyListItr);
|
||||
}
|
||||
|
||||
if (LastGoodName.length() == 0 || LastGoodName[0] != GoodName[0])
|
||||
|
@ -297,29 +299,29 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
LastGoodName = GoodName;
|
||||
fprintf(fp,"[%s]\n",SectionName.c_str());
|
||||
for (strlist::iterator itr = NonSortedArray.begin(); itr != NonSortedArray.end(); itr++)
|
||||
for (strlist::iterator NonSortedItr = NonSortedArray.begin(); NonSortedItr != NonSortedArray.end(); NonSortedItr++)
|
||||
{
|
||||
std::set<stdstr>::iterator find_itr = SortedKeyList.find(itr->c_str());
|
||||
std::set<stdstr>::iterator find_itr = SortedKeyList.find(NonSortedItr->c_str());
|
||||
if (find_itr != SortedKeyList.end())
|
||||
{
|
||||
stdstr Value;
|
||||
if (RomIniFile.GetString(SectionName.c_str(),itr->c_str(),"",Value))
|
||||
if (RomIniFile.GetString(SectionName.c_str(), NonSortedItr->c_str(),"",Value))
|
||||
{
|
||||
fprintf(fp,"%s=%s\n",itr->c_str(), Value.c_str());
|
||||
fprintf(fp,"%s=%s\n", NonSortedItr->c_str(), Value.c_str());
|
||||
}
|
||||
SortedKeyList.erase(find_itr);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::set<stdstr>::iterator itr = SortedKeyList.begin(); itr != SortedKeyList.end(); itr++)
|
||||
for (std::set<stdstr>::iterator SortedKeyListItr = SortedKeyList.begin(); SortedKeyListItr != SortedKeyList.end(); SortedKeyListItr++)
|
||||
{
|
||||
stdstr Value;
|
||||
if (RomIniFile.GetString(SectionName.c_str(),itr->c_str(),"",Value))
|
||||
if (RomIniFile.GetString(SectionName.c_str(), SortedKeyListItr->c_str(),"",Value))
|
||||
{
|
||||
fprintf(fp,"%s=%s\n",itr->c_str(), Value.c_str());
|
||||
fprintf(fp,"%s=%s\n", SortedKeyListItr->c_str(), Value.c_str());
|
||||
}
|
||||
}
|
||||
fprintf(fp,"\n",SectionName.c_str());
|
||||
fprintf(fp,"\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,38 +335,38 @@ int main (int argc, char *argv[])
|
|||
for (size_t i = 0, n = itr->second.size(); i < n; i++)
|
||||
{
|
||||
std::string & SectionName = itr->second[i];
|
||||
strlist KeyList;
|
||||
CIniFileBase::strlist KeyList;
|
||||
RomIniFile.GetKeyList(SectionName.c_str(),KeyList);
|
||||
std::set<stdstr> SortedKeyList;
|
||||
for (strlist::iterator itr = KeyList.begin(); itr != KeyList.end(); itr++)
|
||||
for (CIniFileBase::strlist::iterator KeyListItr = KeyList.begin(); KeyListItr != KeyList.end(); KeyListItr++)
|
||||
{
|
||||
SortedKeyList.insert(*itr);
|
||||
SortedKeyList.insert(*KeyListItr);
|
||||
}
|
||||
|
||||
fprintf(fp,"[%s]\n",SectionName.c_str());
|
||||
for (strlist::iterator itr = NonSortedArray.begin(); itr != NonSortedArray.end(); itr++)
|
||||
for (strlist::iterator NonSortedItr = NonSortedArray.begin(); NonSortedItr != NonSortedArray.end(); NonSortedItr++)
|
||||
{
|
||||
std::set<stdstr>::iterator find_itr = SortedKeyList.find(itr->c_str());
|
||||
std::set<stdstr>::iterator find_itr = SortedKeyList.find(NonSortedItr->c_str());
|
||||
if (find_itr != SortedKeyList.end())
|
||||
{
|
||||
stdstr Value;
|
||||
if (RomIniFile.GetString(SectionName.c_str(),itr->c_str(),"",Value))
|
||||
if (RomIniFile.GetString(SectionName.c_str(), NonSortedItr->c_str(),"",Value))
|
||||
{
|
||||
fprintf(fp,"%s=%s\n",itr->c_str(), Value.c_str());
|
||||
fprintf(fp,"%s=%s\n", NonSortedItr->c_str(), Value.c_str());
|
||||
}
|
||||
SortedKeyList.erase(find_itr);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::set<stdstr>::iterator itr = SortedKeyList.begin(); itr != SortedKeyList.end(); itr++)
|
||||
for (std::set<stdstr>::iterator SortedKeyItr = SortedKeyList.begin(); SortedKeyItr != SortedKeyList.end(); SortedKeyItr++)
|
||||
{
|
||||
stdstr Value;
|
||||
if (RomIniFile.GetString(SectionName.c_str(),itr->c_str(),"",Value))
|
||||
if (RomIniFile.GetString(SectionName.c_str(), SortedKeyItr->c_str(),"",Value))
|
||||
{
|
||||
fprintf(fp,"%s=%s\n",itr->c_str(), Value.c_str());
|
||||
fprintf(fp,"%s=%s\n", SortedKeyItr->c_str(), Value.c_str());
|
||||
}
|
||||
}
|
||||
fprintf(fp,"\n",SectionName.c_str());
|
||||
fprintf(fp,"\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue