mirror of https://github.com/AxioDL/metaforce.git
Char16 refactor and GuiSys bug fixes
This commit is contained in:
parent
f8853fbccf
commit
7a60151d3e
|
@ -16,7 +16,7 @@ struct ISTRG : BigYAML
|
|||
|
||||
virtual size_t count() const=0;
|
||||
virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0;
|
||||
virtual std::wstring getUTF16(const FourCC& lang, size_t idx) const=0;
|
||||
virtual std::u16string getUTF16(const FourCC& lang, size_t idx) const=0;
|
||||
virtual hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const=0;
|
||||
virtual int32_t lookupIdx(const std::string& name) const=0;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "ScriptObjects/SpecialFunction.hpp"
|
||||
#include "ScriptObjects/DoorArea.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/World/ScriptObjectSupport.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
@ -207,7 +208,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
std::vector<Scan> scans;
|
||||
for (std::unique_ptr<IScriptObject>& obj : layer.objects)
|
||||
{
|
||||
if (obj->type == 0x13)
|
||||
if (obj->type == int(urde::EScriptObjectType::MemoryRelay))
|
||||
{
|
||||
MemoryRelay& memRelay = static_cast<MemoryRelay&>(*obj);
|
||||
for (IScriptObject::Connection& conn : memRelay.connections)
|
||||
|
@ -221,7 +222,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
}
|
||||
savw.relays.push_back(memRelay.id);
|
||||
}
|
||||
else if (obj->type == 0x3A)
|
||||
else if (obj->type == int(urde::EScriptObjectType::SpecialFunction))
|
||||
{
|
||||
SpecialFunction& specialFunc = static_cast<SpecialFunction&>(*obj);
|
||||
if (specialFunc.function == ESpecialFunctionType::CinematicSkip)
|
||||
|
@ -234,7 +235,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
layer.layer = specialFunc.layerSwitch.layerIdx;
|
||||
}
|
||||
}
|
||||
else if (obj->type == 0x3)
|
||||
else if (obj->type == int(urde::EScriptObjectType::Door))
|
||||
{
|
||||
DoorArea& doorArea = static_cast<DoorArea&>(*obj);
|
||||
savw.doors.push_back(doorArea.id);
|
||||
|
|
|
@ -38,7 +38,7 @@ void STRG::_read(athena::io::IStreamReader& reader)
|
|||
langs.reserve(skLanguages.size());
|
||||
for (const std::pair<FourCC, atUint32>& lang : readLangs)
|
||||
{
|
||||
std::vector<std::wstring> strs;
|
||||
std::vector<std::u16string> strs;
|
||||
reader.seek(tablesStart + lang.second, athena::SeekOrigin::Begin);
|
||||
reader.readUint32Big(); // table size
|
||||
atUint32 langStart = reader.position();
|
||||
|
@ -47,7 +47,7 @@ void STRG::_read(athena::io::IStreamReader& reader)
|
|||
atUint32 strOffset = reader.readUint32Big();
|
||||
atUint32 tmpOffset = reader.position();
|
||||
reader.seek(langStart + strOffset, athena::SeekOrigin::Begin);
|
||||
strs.emplace_back(reader.readWStringBig());
|
||||
strs.emplace_back(reader.readU16StringBig());
|
||||
reader.seek(tmpOffset, athena::SeekOrigin::Begin);
|
||||
}
|
||||
langs.emplace_back(lang.first, strs);
|
||||
|
@ -55,7 +55,7 @@ void STRG::_read(athena::io::IStreamReader& reader)
|
|||
|
||||
langMap.clear();
|
||||
langMap.reserve(langCount);
|
||||
for (std::pair<FourCC, std::vector<std::wstring>>& item : langs)
|
||||
for (std::pair<FourCC, std::vector<std::u16string>>& item : langs)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void STRG::write(athena::io::IStreamWriter& writer) const
|
|||
writer.writeUint32Big(strCount);
|
||||
|
||||
atUint32 offset = 0;
|
||||
for (const std::pair<FourCC, std::vector<std::wstring>>& lang : langs)
|
||||
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
|
||||
{
|
||||
DNAFourCC(lang.first).write(writer);
|
||||
writer.writeUint32Big(offset);
|
||||
|
@ -97,7 +97,7 @@ void STRG::write(athena::io::IStreamWriter& writer) const
|
|||
}
|
||||
}
|
||||
|
||||
for (const std::pair<FourCC, std::vector<std::wstring>>& lang : langs)
|
||||
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
|
||||
{
|
||||
atUint32 langStrCount = lang.second.size();
|
||||
atUint32 tableSz = strCount * 4;
|
||||
|
@ -123,7 +123,7 @@ void STRG::write(athena::io::IStreamWriter& writer) const
|
|||
for (atUint32 s=0 ; s<strCount ; ++s)
|
||||
{
|
||||
if (s < langStrCount)
|
||||
writer.writeWStringBig(lang.second[s]);
|
||||
writer.writeU16StringBig(lang.second[s]);
|
||||
else
|
||||
writer.writeUByte(0);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ size_t STRG::binarySize(size_t __isz) const
|
|||
|
||||
size_t strCount = STRG::count();
|
||||
__isz += langs.size() * strCount * 4;
|
||||
for (const std::pair<FourCC, std::vector<std::wstring>>& lang : langs)
|
||||
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
|
||||
{
|
||||
atUint32 langStrCount = lang.second.size();
|
||||
for (atUint32 s=0 ; s<strCount ; ++s)
|
||||
|
@ -197,9 +197,9 @@ void STRG::read(athena::io::YAMLDocReader& reader)
|
|||
if (lang.first == "DNAType")
|
||||
continue;
|
||||
|
||||
std::vector<std::wstring> strs;
|
||||
std::vector<std::u16string> strs;
|
||||
for (const auto& str : lang.second->m_seqChildren)
|
||||
strs.emplace_back(hecl::UTF8ToWide(str->m_scalarString));
|
||||
strs.emplace_back(hecl::UTF8ToChar16(str->m_scalarString));
|
||||
langs.emplace_back(FourCC(lang.first.c_str()), strs);
|
||||
}
|
||||
|
||||
|
@ -214,8 +214,8 @@ void STRG::write(athena::io::YAMLDocWriter& writer) const
|
|||
for (const auto& lang : langs)
|
||||
{
|
||||
writer.enterSubVector(lang.first.toString().c_str());
|
||||
for (const std::wstring& str : lang.second)
|
||||
writer.writeWString(nullptr, str);
|
||||
for (const std::u16string& str : lang.second)
|
||||
writer.writeU16String(nullptr, str);
|
||||
writer.leaveSubVector();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ struct STRG : ISTRG
|
|||
DECL_YAML
|
||||
Delete expl;
|
||||
void _read(athena::io::IStreamReader& reader);
|
||||
std::vector<std::pair<FourCC, std::vector<std::wstring>>> langs;
|
||||
std::unordered_map<FourCC, std::vector<std::wstring>*> langMap;
|
||||
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
|
||||
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
|
||||
|
||||
inline int32_t lookupIdx(const std::string& name) const {return -1;}
|
||||
|
||||
|
@ -36,15 +36,15 @@ struct STRG : ISTRG
|
|||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
return hecl::WideToUTF8(search->second->at(idx));
|
||||
return hecl::Char16ToUTF8(search->second->at(idx));
|
||||
return std::string();
|
||||
}
|
||||
inline std::wstring getUTF16(const FourCC& lang, size_t idx) const
|
||||
inline std::u16string getUTF16(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
return search->second->at(idx);
|
||||
return std::wstring();
|
||||
return std::u16string();
|
||||
}
|
||||
inline hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ struct STRG : ISTRG
|
|||
#if HECL_UCS2
|
||||
return search->second->at(idx);
|
||||
#else
|
||||
return hecl::WideToUTF8(search->second->at(idx));
|
||||
return hecl::Char16ToUTF8(search->second->at(idx));
|
||||
#endif
|
||||
return hecl::SystemString();
|
||||
}
|
||||
|
|
|
@ -40,16 +40,16 @@ void STRG::_read(athena::io::IStreamReader& reader)
|
|||
langs.reserve(langCount);
|
||||
for (FourCC& lang : readLangs)
|
||||
{
|
||||
std::vector<std::wstring> strs;
|
||||
std::vector<std::u16string> strs;
|
||||
reader.seek(strCount * 4);
|
||||
for (atUint32 s=0 ; s<strCount ; ++s)
|
||||
strs.emplace_back(reader.readWStringBig());
|
||||
strs.emplace_back(reader.readU16StringBig());
|
||||
langs.emplace_back(lang, strs);
|
||||
}
|
||||
|
||||
langMap.clear();
|
||||
langMap.reserve(langCount);
|
||||
for (std::pair<FourCC, std::vector<std::wstring>>& item : langs)
|
||||
for (std::pair<FourCC, std::vector<std::u16string>>& item : langs)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ void STRG::write(athena::io::IStreamWriter& writer) const
|
|||
writer.writeUint32Big(strCount);
|
||||
|
||||
atUint32 offset = 0;
|
||||
for (const std::pair<DNAFourCC, std::vector<std::wstring>>& lang : langs)
|
||||
for (const std::pair<DNAFourCC, std::vector<std::u16string>>& lang : langs)
|
||||
{
|
||||
lang.first.write(writer);
|
||||
writer.writeUint32Big(offset);
|
||||
|
@ -114,7 +114,7 @@ void STRG::write(athena::io::IStreamWriter& writer) const
|
|||
for (const std::pair<std::string, int32_t>& name : names)
|
||||
writer.writeString(name.first);
|
||||
|
||||
for (const std::pair<DNAFourCC, std::vector<std::wstring>>& lang : langs)
|
||||
for (const std::pair<DNAFourCC, std::vector<std::u16string>>& lang : langs)
|
||||
{
|
||||
offset = strCount * 4;
|
||||
atUint32 langStrCount = lang.second.size();
|
||||
|
@ -130,7 +130,7 @@ void STRG::write(athena::io::IStreamWriter& writer) const
|
|||
for (atUint32 s=0 ; s<strCount ; ++s)
|
||||
{
|
||||
if (s < langStrCount)
|
||||
writer.writeWStringBig(lang.second[s]);
|
||||
writer.writeU16StringBig(lang.second[s]);
|
||||
else
|
||||
writer.writeUByte(0);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ size_t STRG::binarySize(size_t __isz) const
|
|||
__isz += name.first.size() + 1;
|
||||
|
||||
size_t strCount = STRG::count();
|
||||
for (const std::pair<DNAFourCC, std::vector<std::wstring>>& lang : langs)
|
||||
for (const std::pair<DNAFourCC, std::vector<std::u16string>>& lang : langs)
|
||||
{
|
||||
atUint32 langStrCount = lang.second.size();
|
||||
__isz += strCount * 4;
|
||||
|
@ -207,9 +207,9 @@ void STRG::read(athena::io::YAMLDocReader& reader)
|
|||
langs.clear();
|
||||
for (const auto& lang : root->m_mapChildren)
|
||||
{
|
||||
std::vector<std::wstring> strs;
|
||||
std::vector<std::u16string> strs;
|
||||
for (const auto& str : lang.second->m_seqChildren)
|
||||
strs.emplace_back(hecl::UTF8ToWide(str->m_scalarString));
|
||||
strs.emplace_back(hecl::UTF8ToChar16(str->m_scalarString));
|
||||
langs.emplace_back(FourCC(lang.first.c_str()), strs);
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ void STRG::read(athena::io::YAMLDocReader& reader)
|
|||
|
||||
langMap.clear();
|
||||
langMap.reserve(langs.size());
|
||||
for (std::pair<FourCC, std::vector<std::wstring>>& item : langs)
|
||||
for (std::pair<FourCC, std::vector<std::u16string>>& item : langs)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
|
@ -230,8 +230,8 @@ void STRG::write(athena::io::YAMLDocWriter& writer) const
|
|||
for (const auto& lang : langs)
|
||||
{
|
||||
writer.enterSubVector(lang.first.toString().c_str());
|
||||
for (const std::wstring& str : lang.second)
|
||||
writer.writeWString(nullptr, str);
|
||||
for (const std::u16string& str : lang.second)
|
||||
writer.writeU16String(nullptr, str);
|
||||
writer.leaveSubVector();
|
||||
}
|
||||
if (names.size())
|
||||
|
|
|
@ -15,8 +15,8 @@ struct STRG : ISTRG
|
|||
DECL_YAML
|
||||
Delete expl;
|
||||
void _read(athena::io::IStreamReader& reader);
|
||||
std::vector<std::pair<FourCC, std::vector<std::wstring>>> langs;
|
||||
std::unordered_map<FourCC, std::vector<std::wstring>*> langMap;
|
||||
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
|
||||
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
|
||||
std::map<std::string, int32_t> names;
|
||||
|
||||
inline int32_t lookupIdx(const std::string& name) const
|
||||
|
@ -42,15 +42,15 @@ struct STRG : ISTRG
|
|||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
return hecl::WideToUTF8(search->second->at(idx));
|
||||
return hecl::Char16ToUTF8(search->second->at(idx));
|
||||
return std::string();
|
||||
}
|
||||
inline std::wstring getUTF16(const FourCC& lang, size_t idx) const
|
||||
inline std::u16string getUTF16(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
return search->second->at(idx);
|
||||
return std::wstring();
|
||||
return std::u16string();
|
||||
}
|
||||
inline hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ struct STRG : ISTRG
|
|||
#if HECL_UCS2
|
||||
return search->second->at(idx);
|
||||
#else
|
||||
return hecl::WideToUTF8(search->second->at(idx));
|
||||
return hecl::Char16ToUTF8(search->second->at(idx));
|
||||
#endif
|
||||
return hecl::SystemString();
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ struct STRG : ISTRG
|
|||
return search->second->at(idx);
|
||||
return std::string();
|
||||
}
|
||||
inline std::wstring getUTF16(const FourCC& lang, size_t idx) const
|
||||
inline std::u16string getUTF16(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
return hecl::UTF8ToWide(search->second->at(idx));
|
||||
return std::wstring();
|
||||
return hecl::UTF8ToChar16(search->second->at(idx));
|
||||
return std::u16string();
|
||||
}
|
||||
inline hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream)
|
|||
for (const auto& world : memWorlds)
|
||||
{
|
||||
TLockedToken<CSaveWorld> saveWorld =
|
||||
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.first});
|
||||
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
|
||||
cinematicCount += saveWorld->GetCinematicCount();
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream)
|
|||
for (const auto& world : memWorlds)
|
||||
{
|
||||
TLockedToken<CSaveWorld> saveWorld =
|
||||
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.first});
|
||||
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
|
||||
|
||||
auto stateIt = cinematicStates.cbegin();
|
||||
for (TEditorId cineId : saveWorld->GetCinematics())
|
||||
|
|
|
@ -278,7 +278,7 @@ ECardResult CMemoryCardSys::CCardFileInfo::PumpCardTransfer()
|
|||
result = GetStatus(stat);
|
||||
if (result != ECardResult::READY)
|
||||
return result;
|
||||
result = CMemoryCardSys::SetStatus(m_handle, stat);
|
||||
result = CMemoryCardSys::SetStatus(m_handle.slot, m_handle.getFileNo(), stat);
|
||||
if (result != ECardResult::READY)
|
||||
return result;
|
||||
return ECardResult::BUSY;
|
||||
|
@ -294,7 +294,7 @@ ECardResult CMemoryCardSys::CCardFileInfo::PumpCardTransfer()
|
|||
|
||||
ECardResult CMemoryCardSys::CCardFileInfo::GetStatus(kabufuda::CardStat& stat) const
|
||||
{
|
||||
ECardResult result = CMemoryCardSys::GetStatus(m_handle, stat);
|
||||
ECardResult result = CMemoryCardSys::GetStatus(m_handle.slot, m_handle.getFileNo(), stat);
|
||||
if (result != ECardResult::READY)
|
||||
return result;
|
||||
|
||||
|
@ -438,11 +438,11 @@ ECardResult CMemoryCardSys::CloseFile(CardFileHandle& info)
|
|||
g_OpResults[int(info.slot)] = err;
|
||||
return err;
|
||||
}
|
||||
info.handle.reset();
|
||||
card.closeFile(info.handle);
|
||||
return ECardResult::READY;
|
||||
}
|
||||
|
||||
ECardResult CMemoryCardSys::ReadFile(const CardFileHandle& info, void* buf, s32 length, s32 offset)
|
||||
ECardResult CMemoryCardSys::ReadFile(CardFileHandle& info, void* buf, s32 length, s32 offset)
|
||||
{
|
||||
kabufuda::Card& card = g_CardStates[int(info.slot)];
|
||||
if (CardResult err = card.getError())
|
||||
|
@ -450,13 +450,13 @@ ECardResult CMemoryCardSys::ReadFile(const CardFileHandle& info, void* buf, s32
|
|||
g_OpResults[int(info.slot)] = err;
|
||||
return err;
|
||||
}
|
||||
card.seek(info, offset, kabufuda::SeekOrigin::Begin);
|
||||
card.read(info, buf, length);
|
||||
card.seek(info.handle, offset, kabufuda::SeekOrigin::Begin);
|
||||
card.read(info.handle, buf, length);
|
||||
g_OpResults[int(info.slot)] = ECardResult::READY;
|
||||
return ECardResult::READY;
|
||||
}
|
||||
|
||||
ECardResult CMemoryCardSys::WriteFile(const CardFileHandle& info, const void* buf, s32 length, s32 offset)
|
||||
ECardResult CMemoryCardSys::WriteFile(CardFileHandle& info, const void* buf, s32 length, s32 offset)
|
||||
{
|
||||
kabufuda::Card& card = g_CardStates[int(info.slot)];
|
||||
if (CardResult err = card.getError())
|
||||
|
@ -464,8 +464,8 @@ ECardResult CMemoryCardSys::WriteFile(const CardFileHandle& info, const void* bu
|
|||
g_OpResults[int(info.slot)] = err;
|
||||
return err;
|
||||
}
|
||||
card.seek(info, offset, kabufuda::SeekOrigin::Begin);
|
||||
card.write(info, buf, length);
|
||||
card.seek(info.handle, offset, kabufuda::SeekOrigin::Begin);
|
||||
card.write(info.handle, buf, length);
|
||||
g_OpResults[int(info.slot)] = ECardResult::READY;
|
||||
return ECardResult::READY;
|
||||
}
|
||||
|
@ -501,29 +501,29 @@ ECardResult CMemoryCardSys::GetResultCode(kabufuda::ECardSlot port)
|
|||
return g_OpResults[int(port)];
|
||||
}
|
||||
|
||||
ECardResult CMemoryCardSys::GetStatus(const CardFileHandle& info, CardStat& statOut)
|
||||
ECardResult CMemoryCardSys::GetStatus(kabufuda::ECardSlot port, int fileNo, CardStat& statOut)
|
||||
{
|
||||
kabufuda::Card& card = g_CardStates[int(info.slot)];
|
||||
kabufuda::Card& card = g_CardStates[int(port)];
|
||||
if (CardResult err = card.getError())
|
||||
{
|
||||
g_OpResults[int(info.slot)] = err;
|
||||
g_OpResults[int(port)] = err;
|
||||
return err;
|
||||
}
|
||||
ECardResult result = card.getStatus(info, statOut);
|
||||
g_OpResults[int(info.slot)] = result;
|
||||
ECardResult result = card.getStatus(fileNo, statOut);
|
||||
g_OpResults[int(port)] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
ECardResult CMemoryCardSys::SetStatus(const CardFileHandle& info, const CardStat& stat)
|
||||
ECardResult CMemoryCardSys::SetStatus(kabufuda::ECardSlot port, int fileNo, const CardStat& stat)
|
||||
{
|
||||
kabufuda::Card& card = g_CardStates[int(info.slot)];
|
||||
kabufuda::Card& card = g_CardStates[int(port)];
|
||||
if (CardResult err = card.getError())
|
||||
{
|
||||
g_OpResults[int(info.slot)] = err;
|
||||
g_OpResults[int(port)] = err;
|
||||
return err;
|
||||
}
|
||||
ECardResult result = card.setStatus(info, stat);
|
||||
g_OpResults[int(info.slot)] = result;
|
||||
ECardResult result = card.setStatus(fileNo, stat);
|
||||
g_OpResults[int(port)] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ public:
|
|||
|
||||
const TLockedToken<CStringTable>& GetWorldName() const { return x2c_worldName; }
|
||||
const TLockedToken<CSaveWorld>& GetSaveWorld() const { return x3c_saveWorld; }
|
||||
const wchar_t* GetFrontEndName() const
|
||||
const char16_t* GetFrontEndName() const
|
||||
{
|
||||
if (!x2c_worldName)
|
||||
return L"";
|
||||
return u"";
|
||||
return x2c_worldName->GetString(0);
|
||||
}
|
||||
};
|
||||
|
@ -79,11 +79,9 @@ public:
|
|||
struct CardFileHandle
|
||||
{
|
||||
kabufuda::ECardSlot slot;
|
||||
std::unique_ptr<kabufuda::IFileHandle> handle;
|
||||
kabufuda::FileHandle handle;
|
||||
CardFileHandle(kabufuda::ECardSlot slot) : slot(slot) {}
|
||||
kabufuda::IFileHandle* operator->() const { return handle.get(); }
|
||||
operator std::unique_ptr<kabufuda::IFileHandle>&() { return handle; }
|
||||
operator const std::unique_ptr<kabufuda::IFileHandle>&() const { return handle; }
|
||||
int getFileNo() const { return handle.getFileNo(); }
|
||||
};
|
||||
|
||||
using CardStat = kabufuda::CardStat;
|
||||
|
@ -134,7 +132,7 @@ public:
|
|||
void LockIconToken(ResId iconTxtr, kabufuda::EAnimationSpeed speed, CSimplePool& sp);
|
||||
|
||||
kabufuda::ECardSlot GetCardPort() const { return m_handle.slot; }
|
||||
int GetFileNo() const { return m_handle->getFileNo(); }
|
||||
int GetFileNo() const { return m_handle.getFileNo(); }
|
||||
u32 CalculateBannerDataSize() const;
|
||||
u32 CalculateTotalDataSize() const;
|
||||
void BuildCardBuffer();
|
||||
|
@ -162,13 +160,13 @@ public:
|
|||
static ECardResult OpenFile(kabufuda::ECardSlot port, const char* name, CardFileHandle& info);
|
||||
static ECardResult FastOpenFile(kabufuda::ECardSlot port, int fileNo, CardFileHandle& info);
|
||||
static ECardResult CloseFile(CardFileHandle& info);
|
||||
static ECardResult ReadFile(const CardFileHandle& info, void* buf, s32 length, s32 offset);
|
||||
static ECardResult WriteFile(const CardFileHandle& info, const void* buf, s32 length, s32 offset);
|
||||
static ECardResult ReadFile(CardFileHandle& info, void* buf, s32 length, s32 offset);
|
||||
static ECardResult WriteFile(CardFileHandle& info, const void* buf, s32 length, s32 offset);
|
||||
static ECardResult GetNumFreeBytes(kabufuda::ECardSlot port, s32& freeBytes, s32& freeFiles);
|
||||
static ECardResult GetSerialNo(kabufuda::ECardSlot port, u64& serialOut);
|
||||
static ECardResult GetResultCode(kabufuda::ECardSlot port);
|
||||
static ECardResult GetStatus(const CardFileHandle& info, CardStat& statOut);
|
||||
static ECardResult SetStatus(const CardFileHandle& info, const CardStat& stat);
|
||||
static ECardResult GetStatus(kabufuda::ECardSlot port, int fileNo, CardStat& statOut);
|
||||
static ECardResult SetStatus(kabufuda::ECardSlot port, int fileNo, const CardStat& stat);
|
||||
static ECardResult DeleteFile(kabufuda::ECardSlot port, const char* name);
|
||||
static ECardResult FastDeleteFile(kabufuda::ECardSlot port, int fileNo);
|
||||
static ECardResult Rename(kabufuda::ECardSlot port, const char* oldName, const char* newName);
|
||||
|
|
|
@ -119,7 +119,7 @@ std::shared_ptr<CGuiWidget> CGuiTextPane::Create(CGuiFrame* frame, CInputStream&
|
|||
fontCol, outlineCol, extentX, extentY);
|
||||
ret->ParseBaseInfo(frame, in, parms);
|
||||
ret->InitializeBuffers();
|
||||
ret->TextSupport()->SetText(L"?\?(?\?)");
|
||||
ret->TextSupport()->SetText(u"?\?(?\?)");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,9 +145,9 @@ void CGuiTextSupport::CheckAndRebuildTextBuffer()
|
|||
g_TextExecuteBuf->AddColor(EColorType::Main, x24_fontColor);
|
||||
g_TextExecuteBuf->AddColor(EColorType::Outline, x28_outlineColor);
|
||||
|
||||
std::wstring initStr;
|
||||
std::u16string initStr;
|
||||
if ((x5c_fontId & 0xffff) != 0xffff)
|
||||
initStr = hecl::WideFormat(L"&font=%08X;", u32(x5c_fontId));
|
||||
initStr = hecl::Char16Format(L"&font=%08X;", u32(x5c_fontId));
|
||||
initStr += x0_string;
|
||||
|
||||
g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size());
|
||||
|
@ -231,7 +231,7 @@ void CGuiTextSupport::SetFontColor(const zeus::CColor& col)
|
|||
}
|
||||
}
|
||||
|
||||
void CGuiTextSupport::AddText(const std::wstring& str)
|
||||
void CGuiTextSupport::AddText(const std::u16string& str)
|
||||
{
|
||||
if (x60_renderBuf)
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ void CGuiTextSupport::AddText(const std::wstring& str)
|
|||
ClearRenderBuffer();
|
||||
}
|
||||
|
||||
void CGuiTextSupport::SetText(const std::wstring& str, bool multipage)
|
||||
void CGuiTextSupport::SetText(const std::u16string& str, bool multipage)
|
||||
{
|
||||
if (x0_string.compare(str))
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ void CGuiTextSupport::SetText(const std::wstring& str, bool multipage)
|
|||
|
||||
void CGuiTextSupport::SetText(const std::string& str, bool multipage)
|
||||
{
|
||||
SetText(hecl::UTF8ToWide(str), multipage);
|
||||
SetText(hecl::UTF8ToChar16(str), multipage);
|
||||
}
|
||||
|
||||
bool CGuiTextSupport::_GetIsTextSupportFinishedLoading() const
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
class CGuiTextSupport
|
||||
{
|
||||
friend class CGuiTextPane;
|
||||
std::wstring x0_string;
|
||||
std::u16string x0_string;
|
||||
float x10_curTimeMod900 = 0.f;
|
||||
CGuiTextProperties x14_props;
|
||||
zeus::CColor x24_fontColor;
|
||||
|
@ -125,8 +125,8 @@ public:
|
|||
void SetGeometryColor(const zeus::CColor& col);
|
||||
void SetOutlineColor(const zeus::CColor& col);
|
||||
void SetFontColor(const zeus::CColor& col);
|
||||
void AddText(const std::wstring& str);
|
||||
void SetText(const std::wstring& str, bool multipage=false);
|
||||
void AddText(const std::u16string& str);
|
||||
void SetText(const std::u16string& str, bool multipage=false);
|
||||
void SetText(const std::string& str, bool multipage=false);
|
||||
bool GetIsTextSupportFinishedLoading() const;
|
||||
};
|
||||
|
|
|
@ -321,7 +321,7 @@ void CBlockInstruction::PageInvoke(CFontRenderState& state, CTextRenderBuffer* b
|
|||
void CWordInstruction::InvokeLTR(CFontRenderState& state) const
|
||||
{
|
||||
CRasterFont* font = state.x48_font.GetObj();
|
||||
wchar_t space = L' ';
|
||||
char16_t space = u' ';
|
||||
int w, h;
|
||||
font->GetSize(state.x0_drawStrOpts, w, h, &space, 1);
|
||||
|
||||
|
|
|
@ -132,9 +132,9 @@ public:
|
|||
|
||||
class CTextInstruction : public CInstruction
|
||||
{
|
||||
std::wstring x4_str; /* used to be a placement-new sized allocation */
|
||||
std::u16string x4_str; /* used to be a placement-new sized allocation */
|
||||
public:
|
||||
CTextInstruction(const wchar_t* str, int len) : x4_str(str, len) {}
|
||||
CTextInstruction(const char16_t* str, int len) : x4_str(str, len) {}
|
||||
void Invoke(CFontRenderState& state, CTextRenderBuffer* buf) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
|||
|
||||
for (u32 i = 0 ; i < glyphCount ; ++i)
|
||||
{
|
||||
wchar_t chr = in.readUint16Big();
|
||||
char16_t chr = in.readUint16Big();
|
||||
float startU = in.readFloatBig();
|
||||
float startV = in.readFloatBig();
|
||||
float endU = in.readFloatBig();
|
||||
|
@ -66,8 +66,8 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
|||
|
||||
for (u32 i = 0 ; i < kernCount ; ++i)
|
||||
{
|
||||
wchar_t first = in.readUint16Big();
|
||||
wchar_t second = in.readUint16Big();
|
||||
char16_t first = in.readUint16Big();
|
||||
char16_t second = in.readUint16Big();
|
||||
s32 howMuch = in.readUint32Big();
|
||||
x1c_kerning.emplace_back(first, second, howMuch);
|
||||
}
|
||||
|
@ -78,14 +78,14 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
|||
|
||||
void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout,
|
||||
CTextRenderBuffer* renderBuf,
|
||||
const wchar_t* str, s32 length) const
|
||||
const char16_t* str, s32 length) const
|
||||
{
|
||||
if (!x0_initialized)
|
||||
return;
|
||||
|
||||
const wchar_t* chr = str;
|
||||
const char16_t* chr = str;
|
||||
const CGlyph* prevGlyph = nullptr;
|
||||
while (*chr != '\0')
|
||||
while (*chr != u'\0')
|
||||
{
|
||||
const CGlyph* glyph = GetGlyph(*chr);
|
||||
if (glyph)
|
||||
|
@ -130,7 +130,8 @@ void CRasterFont::DrawSpace(const CDrawStringOptions& opts, int x, int y, int& x
|
|||
yout = y;
|
||||
}
|
||||
|
||||
void CRasterFont::DrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout, CTextRenderBuffer* renderBuf, const wchar_t* str, int len) const
|
||||
void CRasterFont::DrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout,
|
||||
CTextRenderBuffer* renderBuf, const char16_t* str, int len) const
|
||||
{
|
||||
if (!x0_initialized)
|
||||
return;
|
||||
|
@ -152,15 +153,15 @@ void CRasterFont::DrawString(const CDrawStringOptions& opts, int x, int y, int&
|
|||
SinglePassDrawString(opts, x, y, xout, yout, renderBuf, str, len);
|
||||
}
|
||||
|
||||
void CRasterFont::GetSize(const CDrawStringOptions& opts, int& width, int& height, const wchar_t* str, int len) const
|
||||
void CRasterFont::GetSize(const CDrawStringOptions& opts, int& width, int& height, const char16_t* str, int len) const
|
||||
{
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
const wchar_t* chr = str;
|
||||
const char16_t* chr = str;
|
||||
const CGlyph* prevGlyph = nullptr;
|
||||
int prevWidth = 0;
|
||||
while (*chr != L'\0')
|
||||
while (*chr != u'\0')
|
||||
{
|
||||
const CGlyph* glyph = GetGlyph(*chr);
|
||||
|
||||
|
|
|
@ -55,18 +55,18 @@ public:
|
|||
class CKernPair
|
||||
{
|
||||
private:
|
||||
wchar_t x0_first;
|
||||
wchar_t x2_second;
|
||||
char16_t x0_first;
|
||||
char16_t x2_second;
|
||||
s32 x4_howMuch;
|
||||
|
||||
public:
|
||||
CKernPair() = default;
|
||||
CKernPair(wchar_t first, wchar_t second, s32 howMuch)
|
||||
CKernPair(char16_t first, char16_t second, s32 howMuch)
|
||||
: x0_first(first), x2_second(second), x4_howMuch(howMuch)
|
||||
{}
|
||||
|
||||
wchar_t GetFirst() const { return x0_first; }
|
||||
wchar_t GetSecond() const { return x2_second; }
|
||||
char16_t GetFirst() const { return x0_first; }
|
||||
char16_t GetSecond() const { return x2_second; }
|
||||
s32 GetHowMuch() const { return x4_howMuch; }
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ class CRasterFont
|
|||
bool x0_initialized = false;
|
||||
s32 x4_monoWidth = 16;
|
||||
s32 x8_monoHeight = 16;
|
||||
std::vector<std::pair<wchar_t, CGlyph>> xc_glyphs;
|
||||
std::vector<std::pair<char16_t, CGlyph>> xc_glyphs;
|
||||
std::vector<CKernPair> x1c_kerning;
|
||||
EColorType x2c_mode = EColorType::Main;
|
||||
CFontInfo x30_fontInfo;
|
||||
|
@ -100,7 +100,7 @@ class CRasterFont
|
|||
s32 x8c_baseline;
|
||||
s32 x90_lineMargin = 0;
|
||||
|
||||
const CGlyph* InternalGetGlyph(wchar_t chr) const
|
||||
const CGlyph* InternalGetGlyph(char16_t chr) const
|
||||
{
|
||||
u32 i = 0;
|
||||
for (; i < xc_glyphs.size(); ++i)
|
||||
|
@ -135,17 +135,17 @@ public:
|
|||
|
||||
void SinglePassDrawString(const CDrawStringOptions&, int x, int y, int& xout, int& yout,
|
||||
CTextRenderBuffer* renderBuf,
|
||||
const wchar_t* str, s32 len) const;
|
||||
const char16_t* str, s32 len) const;
|
||||
void DrawSpace(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout, int len) const;
|
||||
void DrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout,
|
||||
CTextRenderBuffer* renderBuf,
|
||||
const wchar_t* str, int len) const;
|
||||
const CGlyph* GetGlyph(wchar_t chr) const
|
||||
const char16_t* str, int len) const;
|
||||
const CGlyph* GetGlyph(char16_t chr) const
|
||||
{
|
||||
return InternalGetGlyph(chr);
|
||||
}
|
||||
void GetSize(const CDrawStringOptions& opts, int& width, int& height,
|
||||
const wchar_t* str, int len) const;
|
||||
const char16_t* str, int len) const;
|
||||
TToken<CTexture>& GetTexture() { return x80_texture; }
|
||||
};
|
||||
|
||||
|
|
|
@ -70,13 +70,13 @@ void CStringTable::LoadStringTable(CInputStream &in)
|
|||
}
|
||||
}
|
||||
|
||||
const wchar_t* CStringTable::GetString(s32 str) const
|
||||
const char16_t* CStringTable::GetString(s32 str) const
|
||||
{
|
||||
if (str < 0 || u32(str) >= x0_stringCount)
|
||||
return L"Invalid";
|
||||
return u"Invalid";
|
||||
|
||||
u32 off = *reinterpret_cast<u32*>(x4_data.get() + str * 4);
|
||||
return reinterpret_cast<wchar_t*>(x4_data.get() + off);
|
||||
return reinterpret_cast<char16_t*>(x4_data.get() + off);
|
||||
}
|
||||
|
||||
void CStringTable::SetLanguage(s32 lang)
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
CStringTable(CInputStream& in);
|
||||
void LoadStringTable(CInputStream& in);
|
||||
|
||||
const wchar_t* GetString(s32) const;
|
||||
const char16_t* GetString(s32) const;
|
||||
static void SetLanguage(s32);
|
||||
};
|
||||
|
||||
|
|
|
@ -133,21 +133,21 @@ std::vector<CToken> CTextExecuteBuffer::GetAssets() const
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
|
||||
void CTextExecuteBuffer::AddString(const char16_t* str, int count)
|
||||
{
|
||||
if (!xa4_curLine)
|
||||
StartNewLine();
|
||||
|
||||
const wchar_t* charCur = str;
|
||||
const wchar_t* wordCur = str;
|
||||
const char16_t* charCur = str;
|
||||
const char16_t* wordCur = str;
|
||||
|
||||
for (int ac=0 ; *charCur && (ac < count || count == -1) ; ++charCur, ++ac)
|
||||
{
|
||||
if (*charCur == L'\n' || *charCur == L' ')
|
||||
if (*charCur == u'\n' || *charCur == u' ')
|
||||
{
|
||||
AddStringFragment(wordCur, charCur - wordCur);
|
||||
wordCur = charCur + 1;
|
||||
if (*charCur == L'\n')
|
||||
if (*charCur == u'\n')
|
||||
{
|
||||
StartNewLine();
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
|
|||
{
|
||||
StartNewWord();
|
||||
int w, h;
|
||||
wchar_t space = L' ';
|
||||
char16_t space = u' ';
|
||||
x18_textState.x48_font.GetObj()->GetSize(x18_textState.x0_drawStrOpts,
|
||||
w, h, &space, 1);
|
||||
if (xa0_curBlock->x14_direction == ETextDirection::Horizontal)
|
||||
|
@ -176,14 +176,14 @@ void CTextExecuteBuffer::AddString(const wchar_t* str, int count)
|
|||
AddStringFragment(wordCur, charCur - wordCur);
|
||||
}
|
||||
|
||||
void CTextExecuteBuffer::AddStringFragment(const wchar_t* str, int len)
|
||||
void CTextExecuteBuffer::AddStringFragment(const char16_t* str, int len)
|
||||
{
|
||||
if (xa0_curBlock->x14_direction == ETextDirection::Horizontal)
|
||||
for (int i=0 ; i<len ;)
|
||||
i += WrapOneLTR(str + i, len - i);
|
||||
}
|
||||
|
||||
int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
|
||||
int CTextExecuteBuffer::WrapOneLTR(const char16_t* str, int len)
|
||||
{
|
||||
if (!x18_textState.x48_font)
|
||||
return len;
|
||||
|
@ -204,7 +204,7 @@ int CTextExecuteBuffer::WrapOneLTR(const wchar_t* str, int len)
|
|||
}
|
||||
if (w + xa4_curLine->x8_curX > xa0_curBlock->xc_blockExtentX && len > 1)
|
||||
{
|
||||
const wchar_t* strEnd = str + len;
|
||||
const char16_t* strEnd = str + len;
|
||||
int aRank = 5;
|
||||
|
||||
do
|
||||
|
|
|
@ -46,9 +46,9 @@ public:
|
|||
InstList::const_iterator pgEnd) const;
|
||||
std::list<CTextRenderBuffer> BuildRenderBufferPages(const zeus::CVector2i& extent) const;
|
||||
std::vector<CToken> GetAssets() const;
|
||||
void AddString(const wchar_t* str, int len);
|
||||
void AddStringFragment(const wchar_t* str, int len);
|
||||
int WrapOneLTR(const wchar_t* str, int len);
|
||||
void AddString(const char16_t* str, int len);
|
||||
void AddStringFragment(const char16_t* str, int len);
|
||||
int WrapOneLTR(const char16_t* str, int len);
|
||||
void MoveWordLTR();
|
||||
void StartNewLine();
|
||||
void StartNewWord();
|
||||
|
|
|
@ -5,7 +5,17 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CTextColor CTextParser::ParseColor(const wchar_t* str, int len)
|
||||
static float u16stof(char16_t* str)
|
||||
{
|
||||
wchar_t wstr[16];
|
||||
int i;
|
||||
for (i=0 ; i<15 && str[i] != u'\0' ; ++i)
|
||||
wstr[i] = str[i];
|
||||
wstr[i+1] = L'\0';
|
||||
return std::wcstof(wstr, nullptr);
|
||||
}
|
||||
|
||||
CTextColor CTextParser::ParseColor(const char16_t* str, int len)
|
||||
{
|
||||
u8 r = GetColorValue(str + 1);
|
||||
u8 g = GetColorValue(str + 3);
|
||||
|
@ -16,30 +26,30 @@ CTextColor CTextParser::ParseColor(const wchar_t* str, int len)
|
|||
return CTextColor(r, g, b, a);
|
||||
}
|
||||
|
||||
u8 CTextParser::GetColorValue(const wchar_t* str)
|
||||
u8 CTextParser::GetColorValue(const char16_t* str)
|
||||
{
|
||||
return (FromHex(str[0]) << 4) + FromHex(str[1]);
|
||||
}
|
||||
|
||||
u32 CTextParser::FromHex(wchar_t ch)
|
||||
u32 CTextParser::FromHex(char16_t ch)
|
||||
{
|
||||
if (ch >= L'0' && ch <= L'9')
|
||||
return ch - L'0';
|
||||
if (ch >= u'0' && ch <= u'9')
|
||||
return ch - u'0';
|
||||
|
||||
if (ch >= L'A' && ch <= L'F')
|
||||
return ch - L'A' + 10;
|
||||
if (ch >= u'A' && ch <= u'F')
|
||||
return ch - u'A' + 10;
|
||||
|
||||
if (ch >= L'a' && ch <= L'f')
|
||||
return ch - L'a' + 10;
|
||||
if (ch >= u'a' && ch <= u'f')
|
||||
return ch - u'a' + 10;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CTextParser::ParseInt(const wchar_t* str, int len, bool signVal)
|
||||
s32 CTextParser::ParseInt(const char16_t* str, int len, bool signVal)
|
||||
{
|
||||
bool neg = false;
|
||||
int procCur = 0;
|
||||
if (signVal && len && *str == L'-')
|
||||
if (signVal && len && *str == u'-')
|
||||
{
|
||||
neg = true;
|
||||
procCur = 1;
|
||||
|
@ -50,14 +60,14 @@ s32 CTextParser::ParseInt(const wchar_t* str, int len, bool signVal)
|
|||
{
|
||||
val *= 10;
|
||||
wchar_t ch = str[procCur];
|
||||
val += ch - L'0';
|
||||
val += ch - u'0';
|
||||
++procCur;
|
||||
}
|
||||
|
||||
return neg ? -val : val;
|
||||
}
|
||||
|
||||
bool CTextParser::Equals(const wchar_t* str, int len, const wchar_t* other)
|
||||
bool CTextParser::Equals(const char16_t* str, int len, const char16_t* other)
|
||||
{
|
||||
int i=0;
|
||||
for (; *other && i<len ; ++i, ++str, ++other)
|
||||
|
@ -65,10 +75,10 @@ bool CTextParser::Equals(const wchar_t* str, int len, const wchar_t* other)
|
|||
if (*str != *other)
|
||||
return false;
|
||||
}
|
||||
return other[i] == L'\0';
|
||||
return other[i] == u'\0';
|
||||
}
|
||||
|
||||
bool CTextParser::BeginsWith(const wchar_t* str, int len, const wchar_t* other)
|
||||
bool CTextParser::BeginsWith(const char16_t* str, int len, const char16_t* other)
|
||||
{
|
||||
int i=0;
|
||||
for (; *other && i<len ; ++i, ++str, ++other)
|
||||
|
@ -79,52 +89,52 @@ bool CTextParser::BeginsWith(const wchar_t* str, int len, const wchar_t* other)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CTextParser::ParseTag(CTextExecuteBuffer& out, const wchar_t* str, int len)
|
||||
void CTextParser::ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len)
|
||||
{
|
||||
if (BeginsWith(str, len, L"font="))
|
||||
if (BeginsWith(str, len, u"font="))
|
||||
{
|
||||
TToken<CRasterFont> font = GetFont(str + 5, len - 5);
|
||||
out.AddFont(font);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"image="))
|
||||
else if (BeginsWith(str, len, u"image="))
|
||||
{
|
||||
CFontImageDef image = GetImage(str + 6, len - 6);
|
||||
out.AddImage(image);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"fg-color="))
|
||||
else if (BeginsWith(str, len, u"fg-color="))
|
||||
{
|
||||
CTextColor color = ParseColor(str + 9, len - 9);
|
||||
out.AddColor(EColorType::Foreground, color);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"main-color="))
|
||||
else if (BeginsWith(str, len, u"main-color="))
|
||||
{
|
||||
CTextColor color = ParseColor(str + 11, len - 11);
|
||||
out.AddColor(EColorType::Main, color);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"geometry-color="))
|
||||
else if (BeginsWith(str, len, u"geometry-color="))
|
||||
{
|
||||
CTextColor color = ParseColor(str + 15, len - 15);
|
||||
out.AddColor(EColorType::Geometry, color);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"outline-color="))
|
||||
else if (BeginsWith(str, len, u"outline-color="))
|
||||
{
|
||||
CTextColor color = ParseColor(str + 14, len - 14);
|
||||
out.AddColor(EColorType::Outline, color);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"color"))
|
||||
else if (BeginsWith(str, len, u"color"))
|
||||
{
|
||||
const wchar_t* valCur = str + 7;
|
||||
const char16_t* valCur = str + 7;
|
||||
len -= 7;
|
||||
int val = str[6] - L'0';
|
||||
if (str[7] >= L'0' && str[7] <= L'9')
|
||||
int val = str[6] - u'0';
|
||||
if (str[7] >= u'0' && str[7] <= u'9')
|
||||
{
|
||||
++valCur;
|
||||
--len;
|
||||
val *= 10;
|
||||
val += str[7] - L'0';
|
||||
val += str[7] - u'0';
|
||||
}
|
||||
|
||||
if (Equals(valCur + 10, len - 10, L"no"))
|
||||
if (Equals(valCur + 10, len - 10, u"no"))
|
||||
out.AddRemoveColorOverride(val);
|
||||
else
|
||||
{
|
||||
|
@ -132,80 +142,80 @@ void CTextParser::ParseTag(CTextExecuteBuffer& out, const wchar_t* str, int len)
|
|||
out.AddColorOverride(val, color);
|
||||
}
|
||||
}
|
||||
else if (BeginsWith(str, len, L"line-spacing="))
|
||||
else if (BeginsWith(str, len, u"line-spacing="))
|
||||
{
|
||||
out.AddLineSpacing(ParseInt(str + 13, len - 13, true) / 100.0);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"line-extra-space="))
|
||||
else if (BeginsWith(str, len, u"line-extra-space="))
|
||||
{
|
||||
out.AddLineSpacing(ParseInt(str + 17, len - 17, true));
|
||||
}
|
||||
else if (BeginsWith(str, len, L"just="))
|
||||
else if (BeginsWith(str, len, u"just="))
|
||||
{
|
||||
if (Equals(str + 5, len - 5, L"left"))
|
||||
if (Equals(str + 5, len - 5, u"left"))
|
||||
out.AddJustification(EJustification::Left);
|
||||
else if (Equals(str + 5, len - 5, L"center"))
|
||||
else if (Equals(str + 5, len - 5, u"center"))
|
||||
out.AddJustification(EJustification::Center);
|
||||
else if (Equals(str + 5, len - 5, L"right"))
|
||||
else if (Equals(str + 5, len - 5, u"right"))
|
||||
out.AddJustification(EJustification::Right);
|
||||
else if (Equals(str + 5, len - 5, L"full"))
|
||||
else if (Equals(str + 5, len - 5, u"fulu"))
|
||||
out.AddJustification(EJustification::Full);
|
||||
else if (Equals(str + 5, len - 5, L"nleft"))
|
||||
else if (Equals(str + 5, len - 5, u"nleft"))
|
||||
out.AddJustification(EJustification::NLeft);
|
||||
else if (Equals(str + 5, len - 5, L"ncenter"))
|
||||
else if (Equals(str + 5, len - 5, u"ncenter"))
|
||||
out.AddJustification(EJustification::NCenter);
|
||||
else if (Equals(str + 5, len - 5, L"nright"))
|
||||
else if (Equals(str + 5, len - 5, u"nright"))
|
||||
out.AddJustification(EJustification::NRight);
|
||||
}
|
||||
else if (BeginsWith(str, len, L"vjust="))
|
||||
else if (BeginsWith(str, len, u"vjust="))
|
||||
{
|
||||
if (Equals(str + 6, len - 6, L"top"))
|
||||
if (Equals(str + 6, len - 6, u"top"))
|
||||
out.AddVerticalJustification(EVerticalJustification::Top);
|
||||
else if (Equals(str + 6, len - 6, L"center"))
|
||||
else if (Equals(str + 6, len - 6, u"center"))
|
||||
out.AddVerticalJustification(EVerticalJustification::Center);
|
||||
else if (Equals(str + 6, len - 6, L"bottom"))
|
||||
else if (Equals(str + 6, len - 6, u"bottom"))
|
||||
out.AddVerticalJustification(EVerticalJustification::Bottom);
|
||||
else if (Equals(str + 6, len - 6, L"full"))
|
||||
else if (Equals(str + 6, len - 6, u"fulu"))
|
||||
out.AddVerticalJustification(EVerticalJustification::Full);
|
||||
else if (Equals(str + 6, len - 6, L"ntop"))
|
||||
else if (Equals(str + 6, len - 6, u"ntop"))
|
||||
out.AddVerticalJustification(EVerticalJustification::NTop);
|
||||
else if (Equals(str + 6, len - 6, L"ncenter"))
|
||||
else if (Equals(str + 6, len - 6, u"ncenter"))
|
||||
out.AddVerticalJustification(EVerticalJustification::NCenter);
|
||||
else if (Equals(str + 6, len - 6, L"nbottom"))
|
||||
else if (Equals(str + 6, len - 6, u"nbottom"))
|
||||
out.AddVerticalJustification(EVerticalJustification::NBottom);
|
||||
}
|
||||
else if (Equals(str, len, L"push"))
|
||||
else if (Equals(str, len, u"push"))
|
||||
{
|
||||
out.AddPushState();
|
||||
}
|
||||
else if (Equals(str, len, L"pop"))
|
||||
else if (Equals(str, len, u"pop"))
|
||||
{
|
||||
out.AddPopState();
|
||||
}
|
||||
}
|
||||
|
||||
CFontImageDef CTextParser::GetImage(const wchar_t* str, int len)
|
||||
CFontImageDef CTextParser::GetImage(const char16_t* str, int len)
|
||||
{
|
||||
int commaCount = 0;
|
||||
for (int i=0 ; i<len ; ++i)
|
||||
if (str[i] == L',')
|
||||
if (str[i] == u',')
|
||||
++commaCount;
|
||||
|
||||
if (commaCount)
|
||||
{
|
||||
std::wstring iterable(str, len);
|
||||
std::u16string iterable(str, len);
|
||||
size_t tokenPos;
|
||||
size_t commaPos;
|
||||
commaPos = iterable.find(L',');
|
||||
iterable[commaPos] = L'\0';
|
||||
commaPos = iterable.find(u',');
|
||||
iterable[commaPos] = u'\0';
|
||||
tokenPos = commaPos + 1;
|
||||
|
||||
auto AdvanceCommaPos = [&]()
|
||||
{
|
||||
commaPos = iterable.find(L',', tokenPos);
|
||||
if (commaPos == std::wstring::npos)
|
||||
commaPos = iterable.find(u',', tokenPos);
|
||||
if (commaPos == std::u16string::npos)
|
||||
commaPos = iterable.size();
|
||||
iterable[commaPos] = L'\0';
|
||||
iterable[commaPos] = u'\0';
|
||||
};
|
||||
|
||||
auto AdvanceTokenPos = [&]()
|
||||
|
@ -213,11 +223,11 @@ CFontImageDef CTextParser::GetImage(const wchar_t* str, int len)
|
|||
tokenPos = commaPos + 1;
|
||||
};
|
||||
|
||||
if (BeginsWith(str, len, L"A"))
|
||||
if (BeginsWith(str, len, u"A"))
|
||||
{
|
||||
/* Animated texture array */
|
||||
AdvanceCommaPos();
|
||||
float interval = std::wcstof(&iterable[tokenPos], nullptr);
|
||||
float interval = u16stof(&iterable[tokenPos]);
|
||||
AdvanceTokenPos();
|
||||
|
||||
std::vector<TToken<CTexture>> texs;
|
||||
|
@ -232,19 +242,19 @@ CFontImageDef CTextParser::GetImage(const wchar_t* str, int len)
|
|||
|
||||
return CFontImageDef(std::move(texs), interval, zeus::CVector2f(1.f, 1.f));
|
||||
}
|
||||
else if (BeginsWith(str, len, L"SA"))
|
||||
else if (BeginsWith(str, len, u"SA"))
|
||||
{
|
||||
/* Scaled and animated texture array */
|
||||
AdvanceCommaPos();
|
||||
float interval = std::wcstof(&iterable[tokenPos], nullptr);
|
||||
float interval = u16stof(&iterable[tokenPos]);
|
||||
AdvanceTokenPos();
|
||||
|
||||
AdvanceCommaPos();
|
||||
float scaleX = std::wcstof(&iterable[tokenPos], nullptr);
|
||||
float scaleX = u16stof(&iterable[tokenPos]);
|
||||
AdvanceTokenPos();
|
||||
|
||||
AdvanceCommaPos();
|
||||
float scaleY = std::wcstof(&iterable[tokenPos], nullptr);
|
||||
float scaleY = u16stof(&iterable[tokenPos]);
|
||||
AdvanceTokenPos();
|
||||
|
||||
std::vector<TToken<CTexture>> texs;
|
||||
|
@ -259,15 +269,15 @@ CFontImageDef CTextParser::GetImage(const wchar_t* str, int len)
|
|||
|
||||
return CFontImageDef(std::move(texs), interval, zeus::CVector2f(scaleX, scaleY));
|
||||
}
|
||||
else if (BeginsWith(str, len, L"SI"))
|
||||
else if (BeginsWith(str, len, u"SI"))
|
||||
{
|
||||
/* Scaled single texture */
|
||||
AdvanceCommaPos();
|
||||
float scaleX = std::wcstof(&iterable[tokenPos], nullptr);
|
||||
float scaleX = u16stof(&iterable[tokenPos]);
|
||||
AdvanceTokenPos();
|
||||
|
||||
AdvanceCommaPos();
|
||||
float scaleY = std::wcstof(&iterable[tokenPos], nullptr);
|
||||
float scaleY = u16stof(&iterable[tokenPos]);
|
||||
AdvanceTokenPos();
|
||||
|
||||
AdvanceCommaPos();
|
||||
|
@ -283,7 +293,7 @@ CFontImageDef CTextParser::GetImage(const wchar_t* str, int len)
|
|||
return CFontImageDef(std::move(tex), zeus::CVector2f(1.f, 1.f));
|
||||
}
|
||||
|
||||
ResId CTextParser::GetAssetIdFromString(const wchar_t* str)
|
||||
ResId CTextParser::GetAssetIdFromString(const char16_t* str)
|
||||
{
|
||||
u8 r = GetColorValue(str);
|
||||
u8 g = GetColorValue(str + 2);
|
||||
|
@ -292,27 +302,27 @@ ResId CTextParser::GetAssetIdFromString(const wchar_t* str)
|
|||
return (r << 24) | (g << 16) | (b << 8) | a;
|
||||
}
|
||||
|
||||
TToken<CRasterFont> CTextParser::GetFont(const wchar_t* str, int len)
|
||||
TToken<CRasterFont> CTextParser::GetFont(const char16_t* str, int len)
|
||||
{
|
||||
return x0_store.GetObj({SBIG('FONT'), GetAssetIdFromString(str)});
|
||||
}
|
||||
|
||||
void CTextParser::ParseText(CTextExecuteBuffer& out, const wchar_t* str, int len)
|
||||
void CTextParser::ParseText(CTextExecuteBuffer& out, const char16_t* str, int len)
|
||||
{
|
||||
for (int b=0, e=0 ; str[e] && (len == -1 || e < len) ;)
|
||||
{
|
||||
if (str[e] != L'&')
|
||||
if (str[e] != u'&')
|
||||
{
|
||||
++e;
|
||||
continue;
|
||||
}
|
||||
if ((len == -1 || e+1 < len) && str[e+1] != L'&')
|
||||
if ((len == -1 || e+1 < len) && str[e+1] != u'&')
|
||||
{
|
||||
out.AddString(str + b, e - b);
|
||||
++e;
|
||||
b = e;
|
||||
|
||||
while (str[e] && (len == -1 || e < len) && str[e] != L';')
|
||||
while (str[e] && (len == -1 || e < len) && str[e] != u';')
|
||||
++e;
|
||||
|
||||
ParseTag(out, str + e, e - b);
|
||||
|
|
|
@ -12,20 +12,20 @@ class CTextParser
|
|||
{
|
||||
IObjectStore& x0_store;
|
||||
|
||||
static CTextColor ParseColor(const wchar_t* str, int len);
|
||||
static u8 GetColorValue(const wchar_t* str);
|
||||
static u32 FromHex(wchar_t ch);
|
||||
static s32 ParseInt(const wchar_t* str, int len, bool signVal);
|
||||
static ResId GetAssetIdFromString(const wchar_t* str);
|
||||
static bool Equals(const wchar_t* str, int len, const wchar_t* other);
|
||||
static bool BeginsWith(const wchar_t* str, int len, const wchar_t* other);
|
||||
void ParseTag(CTextExecuteBuffer& out, const wchar_t* str, int len);
|
||||
CFontImageDef GetImage(const wchar_t* str, int len);
|
||||
TToken<CRasterFont> GetFont(const wchar_t* str, int len);
|
||||
static CTextColor ParseColor(const char16_t* str, int len);
|
||||
static u8 GetColorValue(const char16_t* str);
|
||||
static u32 FromHex(char16_t ch);
|
||||
static s32 ParseInt(const char16_t* str, int len, bool signVal);
|
||||
static ResId GetAssetIdFromString(const char16_t* str);
|
||||
static bool Equals(const char16_t* str, int len, const char16_t* other);
|
||||
static bool BeginsWith(const char16_t* str, int len, const char16_t* other);
|
||||
void ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len);
|
||||
CFontImageDef GetImage(const char16_t* str, int len);
|
||||
TToken<CRasterFont> GetFont(const char16_t* str, int len);
|
||||
|
||||
public:
|
||||
CTextParser(IObjectStore& store) : x0_store(store) {}
|
||||
void ParseText(CTextExecuteBuffer& out, const wchar_t* str, int len);
|
||||
void ParseText(CTextExecuteBuffer& out, const char16_t* str, int len);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ void CFrontEndUI::SNewFileSelectFrame::DeactivateNewGamePopup()
|
|||
|
||||
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].
|
||||
x0_base->SetColor(zeus::CColor::skWhite);
|
||||
x60_textpane_cancel->TextSupport()->SetText(L"");
|
||||
x60_textpane_cancel->TextSupport()->SetText(u"");
|
||||
}
|
||||
|
||||
void CFrontEndUI::SNewFileSelectFrame::ActivateNewGamePopup()
|
||||
|
@ -339,7 +339,7 @@ void CFrontEndUI::SNewFileSelectFrame::ResetFrame()
|
|||
|
||||
for (int i=2 ; i>=0 ; --i)
|
||||
x20_tablegroup_fileselect->GetWorkerWidget(i)->SetIsSelectable(true);
|
||||
x60_textpane_cancel->TextSupport()->SetText(L"");
|
||||
x60_textpane_cancel->TextSupport()->SetText(u"");
|
||||
}
|
||||
|
||||
void CFrontEndUI::SNewFileSelectFrame::ActivateErase()
|
||||
|
@ -383,7 +383,7 @@ void CFrontEndUI::SNewFileSelectFrame::ClearFrameContents()
|
|||
option.x2c_chRate = SFileMenuOption::ComputeRandom();
|
||||
option.x28_curField = -1;
|
||||
for (int j=0 ; j<4 ; ++j)
|
||||
option.x4_textpanes[j].SetPairText(L"");
|
||||
option.x4_textpanes[j].SetPairText(u"");
|
||||
}
|
||||
|
||||
StartTextAnimating(x28_textpane_erase.x0_panes[0], g_MainStringTable->GetString(38), 60.f);
|
||||
|
@ -439,7 +439,7 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents()
|
|||
{
|
||||
if (++option.x28_curField < 4)
|
||||
{
|
||||
std::wstring str;
|
||||
std::u16string str;
|
||||
SGuiTextPair& populatePair = option.x4_textpanes[option.x28_curField];
|
||||
const CGameState::GameFileStateInfo* data = x4_saveUI->GetGameData(i);
|
||||
|
||||
|
@ -449,8 +449,8 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents()
|
|||
// Completion percent
|
||||
if (data)
|
||||
{
|
||||
std::wstring fileStr = g_MainStringTable->GetString(data->x20_hardMode ? 106 : 39);
|
||||
str = fileStr + hecl::WideFormat(L" %02d%%", data->x18_itemPercent);
|
||||
std::u16string fileStr = g_MainStringTable->GetString(data->x20_hardMode ? 106 : 39);
|
||||
str = fileStr + hecl::Char16Format(L" %02d%%", data->x18_itemPercent);
|
||||
break;
|
||||
}
|
||||
str = g_MainStringTable->GetString(36);
|
||||
|
@ -475,7 +475,7 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents()
|
|||
if (data)
|
||||
{
|
||||
auto pt = std::div(data->x0_playTime, 3600);
|
||||
str = hecl::WideFormat(L"%02d:%02d", pt.quot, pt.rem / 60);
|
||||
str = hecl::Char16Format(L"%02d:%02d", pt.quot, pt.rem / 60);
|
||||
}
|
||||
str = g_MainStringTable->GetString(52);
|
||||
break;
|
||||
|
@ -614,7 +614,7 @@ CFrontEndUI::SFileMenuOption CFrontEndUI::SNewFileSelectFrame::FindFileSelectOpt
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CFrontEndUI::SNewFileSelectFrame::StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate)
|
||||
void CFrontEndUI::SNewFileSelectFrame::StartTextAnimating(CGuiTextPane* text, const std::u16string& str, float chRate)
|
||||
{
|
||||
text->TextSupport()->SetText(str);
|
||||
text->TextSupport()->SetTypeWriteEffectOptions(true, 0.1f, chRate);
|
||||
|
@ -710,17 +710,17 @@ void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::SetUIText(EUIType tp)
|
|||
break;
|
||||
}
|
||||
|
||||
std::wstring instructionsStr;
|
||||
std::u16string instructionsStr;
|
||||
if (instructions != -1)
|
||||
instructionsStr = g_MainStringTable->GetString(instructions);
|
||||
xc_textpane_instructions.SetPairText(instructionsStr);
|
||||
|
||||
std::wstring yesStr;
|
||||
std::u16string yesStr;
|
||||
if (yes != -1)
|
||||
yesStr = g_MainStringTable->GetString(yes);
|
||||
x14_textpane_yes->TextSupport()->SetText(yesStr);
|
||||
|
||||
std::wstring noStr;
|
||||
std::u16string noStr;
|
||||
if (no != -1)
|
||||
noStr = g_MainStringTable->GetString(no);
|
||||
x18_textpane_no->TextSupport()->SetText(noStr);
|
||||
|
@ -947,7 +947,7 @@ void CFrontEndUI::SFusionBonusFrame::Update(float dt, CSaveUI* saveUI)
|
|||
x2c_tablegroup_fusionsuit->SetIsVisible(showFusionSuitProceed);
|
||||
x24_loadedFrame->FindWidget("textpane_proceed")->SetIsVisible(showFusionSuitProceed);
|
||||
|
||||
std::wstring instructionStr;
|
||||
std::u16string instructionStr;
|
||||
if (x28_tablegroup_options->GetUserSelection() == 1)
|
||||
{
|
||||
/* Fusion Suit */
|
||||
|
@ -1022,7 +1022,7 @@ void CFrontEndUI::SFusionBonusFrame::DoCancel(CGuiTableGroup* caller)
|
|||
x8_action = EAction::GoBack;
|
||||
x28_tablegroup_options->SetUserSelection(0);
|
||||
x2c_tablegroup_fusionsuit->SetIsActive(false);
|
||||
x30_textpane_instructions.SetPairText(L"");
|
||||
x30_textpane_instructions.SetPairText(u"");
|
||||
SetTableColors(x28_tablegroup_options);
|
||||
}
|
||||
}
|
||||
|
@ -1090,7 +1090,7 @@ void CFrontEndUI::SFusionBonusFrame::DoAdvance(CGuiTableGroup* caller)
|
|||
}
|
||||
}
|
||||
|
||||
void CFrontEndUI::SGuiTextPair::SetPairText(const std::wstring& str)
|
||||
void CFrontEndUI::SGuiTextPair::SetPairText(const std::u16string& str)
|
||||
{
|
||||
x0_panes[0]->TextSupport()->SetText(str);
|
||||
x0_panes[1]->TextSupport()->SetText(str);
|
||||
|
@ -1104,7 +1104,7 @@ CFrontEndUI::SGuiTextPair CFrontEndUI::FindTextPanePair(CGuiFrame* frame, const
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CFrontEndUI::FindAndSetPairText(CGuiFrame* frame, const char* name, const std::wstring& str)
|
||||
void CFrontEndUI::FindAndSetPairText(CGuiFrame* frame, const char* name, const std::u16string& str)
|
||||
{
|
||||
CGuiTextPane* w1 = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
||||
w1->TextSupport()->SetText(str);
|
||||
|
@ -1557,7 +1557,7 @@ void CFrontEndUI::SOptionsFrontEndFrame::SetRightUIText()
|
|||
}
|
||||
else
|
||||
{
|
||||
FindTextPanePair(x1c_loadedFrame, name).SetPairText(L"");
|
||||
FindTextPanePair(x1c_loadedFrame, name).SetPairText(u"");
|
||||
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,10 +78,10 @@ public:
|
|||
struct SGuiTextPair
|
||||
{
|
||||
CGuiTextPane* x0_panes[2] = {};
|
||||
void SetPairText(const std::wstring& str);
|
||||
void SetPairText(const std::u16string& str);
|
||||
};
|
||||
static SGuiTextPair FindTextPanePair(CGuiFrame* frame, const char* name);
|
||||
static void FindAndSetPairText(CGuiFrame* frame, const char* name, const std::wstring& str);
|
||||
static void FindAndSetPairText(CGuiFrame* frame, const char* name, const std::u16string& str);
|
||||
|
||||
struct SFileMenuOption
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
void DoFileMenuAdvance(CGuiTableGroup* caller);
|
||||
|
||||
static SFileMenuOption FindFileSelectOption(CGuiFrame* frame, int idx);
|
||||
static void StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate);
|
||||
static void StartTextAnimating(CGuiTextPane* text, const std::u16string& str, float chRate);
|
||||
};
|
||||
|
||||
struct SFusionBonusFrame
|
||||
|
|
|
@ -29,7 +29,7 @@ ECardResult CMemoryCardDriver::SFileInfo::Close()
|
|||
ECardResult CMemoryCardDriver::SFileInfo::StartRead()
|
||||
{
|
||||
CMemoryCardSys::CardStat stat = {};
|
||||
ECardResult result = CMemoryCardSys::GetStatus(x0_fileInfo, stat);
|
||||
ECardResult result = CMemoryCardSys::GetStatus(x0_fileInfo.slot, x0_fileInfo.getFileNo(), stat);
|
||||
if (result != ECardResult::READY)
|
||||
return result;
|
||||
|
||||
|
@ -78,7 +78,7 @@ ECardResult CMemoryCardDriver::SFileInfo::FileRead()
|
|||
ECardResult CMemoryCardDriver::SFileInfo::GetSaveDataOffset(u32& offOut)
|
||||
{
|
||||
CMemoryCardSys::CardStat stat = {};
|
||||
ECardResult result = CMemoryCardSys::GetStatus(x0_fileInfo, stat);
|
||||
ECardResult result = CMemoryCardSys::GetStatus(x0_fileInfo.slot, x0_fileInfo.getFileNo(), stat);
|
||||
if (result != ECardResult::READY)
|
||||
{
|
||||
offOut = -1;
|
||||
|
@ -189,7 +189,8 @@ void CMemoryCardDriver::ReadFinished()
|
|||
{
|
||||
CMemoryCardSys::CardStat stat = {};
|
||||
SFileInfo& fileInfo = x100_mcFileInfos[x194_fileIdx].second;
|
||||
if (CMemoryCardSys::GetStatus(fileInfo.x0_fileInfo, stat) != ECardResult::READY)
|
||||
if (CMemoryCardSys::GetStatus(fileInfo.x0_fileInfo.slot,
|
||||
fileInfo.x0_fileInfo.getFileNo(), stat) != ECardResult::READY)
|
||||
{
|
||||
NoCardFound();
|
||||
return;
|
||||
|
@ -201,6 +202,7 @@ void CMemoryCardDriver::ReadFinished()
|
|||
r.readBytesToBuf(x30_systemData, 174);
|
||||
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
if (header.x4_savePresent[i])
|
||||
xe4_fileSlots[i] = LoadSaveFile(r);
|
||||
|
||||
if (x19d_inGame)
|
||||
|
@ -245,7 +247,8 @@ void CMemoryCardDriver::IndexFiles()
|
|||
else if (result == ECardResult::READY)
|
||||
{
|
||||
CMemoryCardSys::CardStat stat = {};
|
||||
if (CMemoryCardSys::GetStatus(info.second.x0_fileInfo, stat) ==
|
||||
if (CMemoryCardSys::GetStatus(info.second.x0_fileInfo.slot,
|
||||
info.second.x0_fileInfo.getFileNo(), stat) ==
|
||||
ECardResult::READY)
|
||||
{
|
||||
u32 comment = stat.GetCommentAddr();
|
||||
|
@ -278,11 +281,13 @@ void CMemoryCardDriver::IndexFiles()
|
|||
if (x100_mcFileInfos[1].first == EFileState::File)
|
||||
{
|
||||
CMemoryCardSys::CardStat stat = {};
|
||||
if (CMemoryCardSys::GetStatus(x100_mcFileInfos[0].second.x0_fileInfo, stat) ==
|
||||
if (CMemoryCardSys::GetStatus(x100_mcFileInfos[0].second.x0_fileInfo.slot,
|
||||
x100_mcFileInfos[0].second.x0_fileInfo.getFileNo(), stat) ==
|
||||
ECardResult::READY)
|
||||
{
|
||||
u32 timeA = stat.GetTime();
|
||||
if (CMemoryCardSys::GetStatus(x100_mcFileInfos[1].second.x0_fileInfo, stat) ==
|
||||
if (CMemoryCardSys::GetStatus(x100_mcFileInfos[1].second.x0_fileInfo.slot,
|
||||
x100_mcFileInfos[1].second.x0_fileInfo.getFileNo(), stat) ==
|
||||
ECardResult::READY)
|
||||
{
|
||||
u32 timeB = stat.GetTime();
|
||||
|
|
|
@ -74,6 +74,7 @@ private:
|
|||
struct SFileInfo
|
||||
{
|
||||
CMemoryCardSys::CardFileHandle x0_fileInfo;
|
||||
|
||||
std::string x14_name;
|
||||
std::vector<u8> x24_saveFileData;
|
||||
std::vector<u8> x34_saveData;
|
||||
|
@ -81,7 +82,7 @@ private:
|
|||
kabufuda::ECardResult Open();
|
||||
kabufuda::ECardResult Close();
|
||||
kabufuda::ECardSlot GetFileCardPort() const { return x0_fileInfo.slot; }
|
||||
int GetFileNo() const { return x0_fileInfo->getFileNo(); }
|
||||
int GetFileNo() const { return x0_fileInfo.getFileNo(); }
|
||||
kabufuda::ECardResult StartRead();
|
||||
kabufuda::ECardResult TryFileRead();
|
||||
kabufuda::ECardResult FileRead();
|
||||
|
|
|
@ -30,7 +30,7 @@ void CSaveUI::ResetCardDriver()
|
|||
|
||||
CIOWin::EMessageReturn CSaveUI::Update(float dt)
|
||||
{
|
||||
if (PumpLoad())
|
||||
if (!PumpLoad())
|
||||
return CIOWin::EMessageReturn::Normal;
|
||||
|
||||
x50_loadedFrame->Update(dt);
|
||||
|
@ -61,6 +61,10 @@ CIOWin::EMessageReturn CSaveUI::Update(float dt)
|
|||
x6c_cardDriver->IndexFiles();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x6c_cardDriver->IndexFiles();
|
||||
}
|
||||
}
|
||||
else if (x6c_cardDriver->x10_state == EState::Ready)
|
||||
{
|
||||
|
@ -304,30 +308,30 @@ void CSaveUI::SetUIText()
|
|||
default: break;
|
||||
}
|
||||
|
||||
std::wstring msgAStr;
|
||||
std::u16string msgAStr;
|
||||
if (msgA != -1)
|
||||
msgAStr = x38_strgMemoryCard->GetString(msgA);
|
||||
std::wstring msgBStr;
|
||||
std::u16string msgBStr;
|
||||
if (msgB != -1)
|
||||
msgBStr = x38_strgMemoryCard->GetString(msgB);
|
||||
x54_textpane_message->TextSupport()->SetText(msgAStr + msgBStr);
|
||||
|
||||
std::wstring opt0Str;
|
||||
std::u16string opt0Str;
|
||||
if (opt0 != -1)
|
||||
opt0Str = x38_strgMemoryCard->GetString(opt0);
|
||||
x5c_textpane_choice0->TextSupport()->SetText(opt0Str);
|
||||
|
||||
std::wstring opt1Str;
|
||||
std::u16string opt1Str;
|
||||
if (opt1 != -1)
|
||||
opt1Str = x38_strgMemoryCard->GetString(opt1);
|
||||
x60_textpane_choice1->TextSupport()->SetText(opt1Str);
|
||||
|
||||
std::wstring opt2Str;
|
||||
std::u16string opt2Str;
|
||||
if (opt2 != -1)
|
||||
opt2Str = x38_strgMemoryCard->GetString(opt2);
|
||||
x64_textpane_choice2->TextSupport()->SetText(opt2Str);
|
||||
|
||||
std::wstring opt3Str;
|
||||
std::u16string opt3Str;
|
||||
x68_textpane_choice3->TextSupport()->SetText(opt3Str);
|
||||
|
||||
x5c_textpane_choice0->SetIsSelectable(opt0 != -1);
|
||||
|
|
|
@ -389,7 +389,7 @@ void CWorldTransManager::EnableTransition(ResId fontId, ResId stringId, bool b1,
|
|||
|
||||
x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate);
|
||||
xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId});
|
||||
x8_textData->SetText(L"");
|
||||
x8_textData->SetText(u"");
|
||||
}
|
||||
|
||||
void CWorldTransManager::DisableTransition()
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit df935c31c1f5c21519ed432c128dd7b1541cd972
|
||||
Subproject commit 767d2a471138dfa7f68e3254fdb942151b02cb78
|
2
kabufuda
2
kabufuda
|
@ -1 +1 @@
|
|||
Subproject commit 3121f67f4da34f64bcef3aecab1d269fc5a4e035
|
||||
Subproject commit 408ac735b4741d2d4b27e1cf985c3f69098025be
|
Loading…
Reference in New Issue