Switch over to using TString to represent filesystem paths instead of TWideString. Fixed FileUtil not handling UTF-8 paths with Unicode characters correctly.

This commit is contained in:
Aruki
2017-05-04 15:43:25 -06:00
parent bdf0d188c3
commit e950634db2
38 changed files with 469 additions and 509 deletions

View File

@@ -83,7 +83,7 @@ public:
}
ASSERT(ParamString.Size() == IDLength * 2);
pTree->AddDependency( CAssetID::FromString(ParamString) );
pTree->AddDependency( CAssetID::FromString(ParamString.ToUTF8()) );
}
// Image
@@ -129,7 +129,7 @@ public:
}
ASSERT(Param.Size() == IDLength * 2);
pTree->AddDependency( CAssetID::FromString(Param) );
pTree->AddDependency( CAssetID::FromString(Param.ToUTF8()) );
}
}
}

View File

@@ -65,7 +65,7 @@ TString CWorld::InGameName() const
if (mpWorldName)
return mpWorldName->String("ENGL", 0).ToUTF8();
else
return Entry()->Name().ToUTF8();
return Entry()->Name();
}
TString CWorld::AreaInGameName(u32 AreaIndex) const

View File

@@ -68,7 +68,7 @@ void CScriptCooker::WriteProperty(IProperty *pProp, bool InSingleStruct)
case eStringProperty:
{
TStringProperty *pStringCast = static_cast<TStringProperty*>(pProp);
mpSCLY->WriteString(pStringCast->Get().ToStdString());
mpSCLY->WriteString(pStringCast->Get());
break;
}

View File

@@ -134,7 +134,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
rMLVL.WriteLong(ModuleNames.size());
for (u32 iMod = 0; iMod < ModuleNames.size(); iMod++)
rMLVL.WriteString(ModuleNames[iMod].ToStdString());
rMLVL.WriteString(ModuleNames[iMod]);
rMLVL.WriteLong(ModuleLayerOffsets.size());
@@ -144,7 +144,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
// Internal Name
if (Game >= eEchoesDemo)
rMLVL.WriteString(rArea.InternalName.ToStdString());
rMLVL.WriteString(rArea.InternalName);
}
if (Game <= eCorruption)
@@ -218,7 +218,7 @@ bool CWorldCooker::CookMLVL(CWorld *pWorld, IOutputStream& rMLVL)
rMLVL.WriteLong(LayerNames.size());
for (u32 iLyr = 0; iLyr < LayerNames.size(); iLyr++)
rMLVL.WriteString(LayerNames[iLyr].ToStdString());
rMLVL.WriteString(LayerNames[iLyr]);
// todo: Layer Saved State IDs go here for MP3/DKCR; need support for saved state IDs to implement
if (Game == eCorruption || Game == eReturns)

View File

@@ -562,7 +562,7 @@ void CAreaLoader::Decompress()
TString Source = mpMREA->GetSourceString();
mpMREA = new CMemoryInStream(mpDecmpBuffer, mTotalDecmpSize, IOUtil::eBigEndian);
mpMREA->SetSourceString(Source.ToStdString());
mpMREA->SetSourceString(Source);
mpSectionMgr->SetInputStream(mpMREA);
mHasDecompressedBuffer = true;
}

View File

@@ -117,7 +117,7 @@ void CStringLoader::LoadCorruptionSTRG(IInputStream& rSTRG)
rSTRG.Seek(StringsStart + LangOffsets[iLang][iStr], SEEK_SET);
rSTRG.Seek(0x4, SEEK_CUR); // Skipping string size
pLang->Strings[iStr] = rSTRG.ReadString();
pLang->Strings[iStr] = rSTRG.ReadString().ToUTF16();
}
}
}