mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 09:47:43 +00:00
initial MLVL and STRG trilogy integration
This commit is contained in:
@@ -1,33 +1,59 @@
|
||||
#ifndef __DNAMP1_STRG_HPP__
|
||||
#define __DNAMP1_STRG_HPP__
|
||||
|
||||
#include <unordered_map>
|
||||
#include "../DNACommon/DNACommon.hpp"
|
||||
#include "../DNACommon/STRG.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
namespace DNAMP1
|
||||
{
|
||||
|
||||
extern const HECL::FourCC ENGLfcc;
|
||||
extern const HECL::FourCC FRENfcc;
|
||||
extern const HECL::FourCC GERMfcc;
|
||||
extern const HECL::FourCC SPANfcc;
|
||||
extern const HECL::FourCC ITALfcc;
|
||||
extern const HECL::FourCC JAPNfcc;
|
||||
|
||||
struct STRG : BigDNA
|
||||
struct STRG : ISTRG, BigDNA
|
||||
{
|
||||
DECL_EXPLICIT_DNA
|
||||
atUint32 version;
|
||||
atUint32 langCount;
|
||||
atUint32 strCount;
|
||||
void _read(Athena::io::IStreamReader& reader);
|
||||
std::unordered_map<FourCC, std::vector<std::wstring>> langs;
|
||||
|
||||
struct Language
|
||||
inline int32_t lookupIdx(const std::string& name) const {return -1;}
|
||||
|
||||
inline size_t count() const
|
||||
{
|
||||
FourCC lang;
|
||||
std::vector<std::wstring> strings;
|
||||
};
|
||||
std::vector<Language> langs;
|
||||
size_t retval = 0;
|
||||
for (auto item : langs)
|
||||
{
|
||||
size_t sz = item.second.size();
|
||||
if (sz > retval)
|
||||
retval = sz;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
inline std::string getUTF8(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langs.find(lang);
|
||||
if (search != langs.end())
|
||||
return HECL::WideToUTF8(search->second.at(idx));
|
||||
return std::string();
|
||||
}
|
||||
inline std::wstring getUTF16(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langs.find(lang);
|
||||
if (search != langs.end())
|
||||
return search->second.at(idx);
|
||||
return std::wstring();
|
||||
}
|
||||
inline HECL::SystemString getSystemString(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langs.find(lang);
|
||||
if (search != langs.end())
|
||||
#if HECL_UCS2
|
||||
return search->second.at(idx);
|
||||
#else
|
||||
return HECL::WideToUTF8(search->second.at(idx));
|
||||
#endif
|
||||
return std::string();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user