mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-22 09:05:44 +00:00
ZoneCommon: Add GameLanguagePrefix class and save known prefixes for languages in the game object
This commit is contained in:
parent
f73c27a7dc
commit
9f8022c2ca
@ -61,6 +61,12 @@ void ObjLoaderT6::LoadIPakForZone(ISearchPath* searchPath, const std::string& ip
|
|||||||
{
|
{
|
||||||
LoadIPakForZone(searchPath, "mp", zone);
|
LoadIPakForZone(searchPath, "mp", zone);
|
||||||
LoadIPakForZone(searchPath, "so", zone);
|
LoadIPakForZone(searchPath, "so", zone);
|
||||||
|
|
||||||
|
auto languagePrefixes = g_GameT6.GetLanguagePrefixes();
|
||||||
|
for(const auto& languagePrefix : languagePrefixes)
|
||||||
|
{
|
||||||
|
LoadIPakForZone(searchPath, languagePrefix.m_prefix + "base", zone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,58 +3,58 @@
|
|||||||
|
|
||||||
using namespace T6;
|
using namespace T6;
|
||||||
|
|
||||||
std::string AssetDumperLocalizeEntry::GetNameOfLanguage(ZoneLanguage language)
|
std::string AssetDumperLocalizeEntry::GetNameOfLanguage(GameLanguage language)
|
||||||
{
|
{
|
||||||
switch(language)
|
switch(language)
|
||||||
{
|
{
|
||||||
case ZoneLanguage::LANGUAGE_NONE:
|
case GameLanguage::LANGUAGE_NONE:
|
||||||
case ZoneLanguage::LANGUAGE_ENGLISH:
|
case GameLanguage::LANGUAGE_ENGLISH:
|
||||||
default:
|
default:
|
||||||
return "english";
|
return "english";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_FRENCH:
|
case GameLanguage::LANGUAGE_FRENCH:
|
||||||
return "french";
|
return "french";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_GERMAN:
|
case GameLanguage::LANGUAGE_GERMAN:
|
||||||
return "german";
|
return "german";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_ITALIAN:
|
case GameLanguage::LANGUAGE_ITALIAN:
|
||||||
return "italian";
|
return "italian";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_SPANISH:
|
case GameLanguage::LANGUAGE_SPANISH:
|
||||||
return "spanish";
|
return "spanish";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_BRITISH:
|
case GameLanguage::LANGUAGE_BRITISH:
|
||||||
return "british";
|
return "british";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_RUSSIAN:
|
case GameLanguage::LANGUAGE_RUSSIAN:
|
||||||
return "russian";
|
return "russian";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_POLISH:
|
case GameLanguage::LANGUAGE_POLISH:
|
||||||
return "polish";
|
return "polish";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_KOREAN:
|
case GameLanguage::LANGUAGE_KOREAN:
|
||||||
return "korean";
|
return "korean";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_JAPANESE:
|
case GameLanguage::LANGUAGE_JAPANESE:
|
||||||
return "japanese";
|
return "japanese";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_CZECH:
|
case GameLanguage::LANGUAGE_CZECH:
|
||||||
return "czech";
|
return "czech";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_FRENCH_CAN:
|
case GameLanguage::LANGUAGE_FRENCH_CAN:
|
||||||
return "frenchcan";
|
return "frenchcan";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_AUSTRIAN:
|
case GameLanguage::LANGUAGE_AUSTRIAN:
|
||||||
return "austrian";
|
return "austrian";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_PORTUGUESE:
|
case GameLanguage::LANGUAGE_PORTUGUESE:
|
||||||
return "portuguese";
|
return "portuguese";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_MEXICAN_SPANISH:
|
case GameLanguage::LANGUAGE_MEXICAN_SPANISH:
|
||||||
return "mexicanspanish";
|
return "mexicanspanish";
|
||||||
|
|
||||||
case ZoneLanguage::LANGUAGE_FULL_JAPANESE:
|
case GameLanguage::LANGUAGE_FULL_JAPANESE:
|
||||||
return "fulljapanese";
|
return "fulljapanese";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
#include "Dumping/AbstractAssetDumper.h"
|
#include "Dumping/AbstractAssetDumper.h"
|
||||||
#include "Game/T6/T6.h"
|
#include "Game/T6/T6.h"
|
||||||
|
#include "Game/GameLanguage.h"
|
||||||
|
|
||||||
class AssetDumperLocalizeEntry final : public IAssetDumper<T6::LocalizeEntry>
|
class AssetDumperLocalizeEntry final : public IAssetDumper<T6::LocalizeEntry>
|
||||||
{
|
{
|
||||||
static std::string GetNameOfLanguage(ZoneLanguage language);
|
static std::string GetNameOfLanguage(GameLanguage language);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void DumpPool(Zone* zone, AssetPool<T6::LocalizeEntry>* pool, const std::string& basePath) override;
|
void DumpPool(Zone* zone, AssetPool<T6::LocalizeEntry>* pool, const std::string& basePath) override;
|
||||||
|
41
src/ZoneCommon/Game/GameLanguage.h
Normal file
41
src/ZoneCommon/Game/GameLanguage.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
enum class GameLanguage
|
||||||
|
{
|
||||||
|
LANGUAGE_NONE,
|
||||||
|
LANGUAGE_ENGLISH,
|
||||||
|
LANGUAGE_FRENCH,
|
||||||
|
LANGUAGE_GERMAN,
|
||||||
|
LANGUAGE_ITALIAN,
|
||||||
|
LANGUAGE_SPANISH,
|
||||||
|
LANGUAGE_BRITISH,
|
||||||
|
LANGUAGE_RUSSIAN,
|
||||||
|
LANGUAGE_POLISH,
|
||||||
|
LANGUAGE_KOREAN,
|
||||||
|
LANGUAGE_TAIWANESE,
|
||||||
|
LANGUAGE_JAPANESE,
|
||||||
|
LANGUAGE_CHINESE,
|
||||||
|
LANGUAGE_THAI,
|
||||||
|
LANGUAGE_LEET,
|
||||||
|
LANGUAGE_CZECH,
|
||||||
|
LANGUAGE_FRENCH_CAN,
|
||||||
|
LANGUAGE_AUSTRIAN,
|
||||||
|
LANGUAGE_PORTUGUESE,
|
||||||
|
LANGUAGE_MEXICAN_SPANISH,
|
||||||
|
LANGUAGE_FULL_JAPANESE
|
||||||
|
};
|
||||||
|
|
||||||
|
class GameLanguagePrefix
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GameLanguage m_language;
|
||||||
|
const std::string m_prefix;
|
||||||
|
|
||||||
|
GameLanguagePrefix(const GameLanguage language, std::string prefix)
|
||||||
|
: m_language(language),
|
||||||
|
m_prefix(std::move(prefix))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Zone/Zone.h"
|
#include "Zone/Zone.h"
|
||||||
|
#include "GameLanguage.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Zone;
|
class Zone;
|
||||||
@ -10,4 +11,5 @@ public:
|
|||||||
virtual void AddZone(Zone* zone) = 0;
|
virtual void AddZone(Zone* zone) = 0;
|
||||||
virtual void RemoveZone(Zone* zone) = 0;
|
virtual void RemoveZone(Zone* zone) = 0;
|
||||||
virtual std::vector<Zone*> GetZones() = 0;
|
virtual std::vector<Zone*> GetZones() = 0;
|
||||||
|
virtual std::vector<GameLanguagePrefix> GetLanguagePrefixes() = 0;
|
||||||
};
|
};
|
@ -22,3 +22,27 @@ std::vector<Zone*> GameT6::GetZones()
|
|||||||
{
|
{
|
||||||
return m_zones;
|
return m_zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<GameLanguagePrefix> GameT6::GetLanguagePrefixes()
|
||||||
|
{
|
||||||
|
std::vector<GameLanguagePrefix> prefixes;
|
||||||
|
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_ENGLISH, "en_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH, "fr_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_FRENCH_CAN, "fc_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_GERMAN, "ge_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_AUSTRIAN, "as_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_ITALIAN, "it_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_SPANISH, "sp_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_BRITISH, "br_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_RUSSIAN, "ru_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_POLISH, "po_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_KOREAN, "ko_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_JAPANESE, "ja_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_CZECH, "cz_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_FULL_JAPANESE, "fj_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_PORTUGUESE, "bp_");
|
||||||
|
prefixes.emplace_back(GameLanguage::LANGUAGE_MEXICAN_SPANISH, "ms_");
|
||||||
|
|
||||||
|
return prefixes;
|
||||||
|
}
|
||||||
|
@ -9,6 +9,7 @@ public:
|
|||||||
void AddZone(Zone* zone) override;
|
void AddZone(Zone* zone) override;
|
||||||
void RemoveZone(Zone* zone) override;
|
void RemoveZone(Zone* zone) override;
|
||||||
std::vector<Zone*> GetZones() override;
|
std::vector<Zone*> GetZones() override;
|
||||||
|
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameT6 g_GameT6;
|
extern GameT6 g_GameT6;
|
@ -6,7 +6,7 @@ Zone::Zone(std::string name, const zone_priority_t priority, IZoneAssetPools* po
|
|||||||
m_priority = priority;
|
m_priority = priority;
|
||||||
m_pools = pools;
|
m_pools = pools;
|
||||||
m_game = game;
|
m_game = game;
|
||||||
m_language = ZoneLanguage::LANGUAGE_NONE;
|
m_language = GameLanguage::LANGUAGE_NONE;
|
||||||
m_memory = new ZoneMemory();
|
m_memory = new ZoneMemory();
|
||||||
m_registered = false;
|
m_registered = false;
|
||||||
}
|
}
|
||||||
|
@ -2,37 +2,13 @@
|
|||||||
#include "ZoneTypes.h"
|
#include "ZoneTypes.h"
|
||||||
#include "Pool/IZoneAssetPools.h"
|
#include "Pool/IZoneAssetPools.h"
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
#include "Game/GameLanguage.h"
|
||||||
#include "Zone/XBlock.h"
|
#include "Zone/XBlock.h"
|
||||||
#include "ZoneMemory.h"
|
#include "ZoneMemory.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class IGame;
|
class IGame;
|
||||||
|
|
||||||
enum class ZoneLanguage
|
|
||||||
{
|
|
||||||
LANGUAGE_NONE,
|
|
||||||
LANGUAGE_ENGLISH,
|
|
||||||
LANGUAGE_FRENCH,
|
|
||||||
LANGUAGE_GERMAN,
|
|
||||||
LANGUAGE_ITALIAN,
|
|
||||||
LANGUAGE_SPANISH,
|
|
||||||
LANGUAGE_BRITISH,
|
|
||||||
LANGUAGE_RUSSIAN,
|
|
||||||
LANGUAGE_POLISH,
|
|
||||||
LANGUAGE_KOREAN,
|
|
||||||
LANGUAGE_TAIWANESE,
|
|
||||||
LANGUAGE_JAPANESE,
|
|
||||||
LANGUAGE_CHINESE,
|
|
||||||
LANGUAGE_THAI,
|
|
||||||
LANGUAGE_LEET,
|
|
||||||
LANGUAGE_CZECH,
|
|
||||||
LANGUAGE_FRENCH_CAN,
|
|
||||||
LANGUAGE_AUSTRIAN,
|
|
||||||
LANGUAGE_PORTUGUESE,
|
|
||||||
LANGUAGE_MEXICAN_SPANISH,
|
|
||||||
LANGUAGE_FULL_JAPANESE
|
|
||||||
};
|
|
||||||
|
|
||||||
class Zone
|
class Zone
|
||||||
{
|
{
|
||||||
IZoneAssetPools* m_pools;
|
IZoneAssetPools* m_pools;
|
||||||
@ -44,7 +20,7 @@ class Zone
|
|||||||
public:
|
public:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
zone_priority_t m_priority;
|
zone_priority_t m_priority;
|
||||||
ZoneLanguage m_language;
|
GameLanguage m_language;
|
||||||
IGame* m_game;
|
IGame* m_game;
|
||||||
|
|
||||||
Zone(std::string name, zone_priority_t priority, IZoneAssetPools* pools, IGame* game);
|
Zone(std::string name, zone_priority_t priority, IZoneAssetPools* pools, IGame* game);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "ContentLoaderT6.h"
|
#include "ContentLoaderT6.h"
|
||||||
#include "Game/T6/GameAssetPoolT6.h"
|
#include "Game/T6/GameAssetPoolT6.h"
|
||||||
#include "Game/T6/GameT6.h"
|
#include "Game/T6/GameT6.h"
|
||||||
|
#include "Game/GameLanguage.h"
|
||||||
|
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_SIGNED_TREYARCH = "TAff0100";
|
const std::string ZoneLoaderFactoryT6::MAGIC_SIGNED_TREYARCH = "TAff0100";
|
||||||
const std::string ZoneLoaderFactoryT6::MAGIC_SIGNED_ASSET_BUILDER = "ABff0100";
|
const std::string ZoneLoaderFactoryT6::MAGIC_SIGNED_ASSET_BUILDER = "ABff0100";
|
||||||
@ -85,74 +86,19 @@ const uint8_t ZoneLoaderFactoryT6::RSA_PUBLIC_KEY_TREYARCH[]
|
|||||||
|
|
||||||
class ZoneLoaderFactoryT6::ZoneLoaderFactoryT6Impl
|
class ZoneLoaderFactoryT6::ZoneLoaderFactoryT6Impl
|
||||||
{
|
{
|
||||||
static ZoneLanguage GetZoneLanguage(std::string& zoneName)
|
static GameLanguage GetZoneLanguage(std::string& zoneName)
|
||||||
{
|
{
|
||||||
if(zoneName.compare(0, 3, "en_") == 0)
|
auto languagePrefixes = g_GameT6.GetLanguagePrefixes();
|
||||||
|
|
||||||
|
for(const auto& languagePrefix : languagePrefixes)
|
||||||
{
|
{
|
||||||
return ZoneLanguage::LANGUAGE_ENGLISH;
|
if(zoneName.compare(0, languagePrefix.m_prefix.length(), languagePrefix.m_prefix) == 0)
|
||||||
|
{
|
||||||
|
return languagePrefix.m_language;
|
||||||
}
|
}
|
||||||
if(zoneName.compare(0, 3, "fr_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_FRENCH;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "fc_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_FRENCH_CAN;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "ge_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_GERMAN;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "as_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_AUSTRIAN;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "it_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_ITALIAN;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "sp_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_SPANISH;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "br_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_BRITISH;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "ru_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_RUSSIAN;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "po_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_POLISH;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "ko_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_KOREAN;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "ja_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_JAPANESE;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "cz_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_CZECH;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "fj_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_FULL_JAPANESE;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "bp_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_PORTUGUESE;
|
|
||||||
}
|
|
||||||
if(zoneName.compare(0, 3, "ms_") == 0)
|
|
||||||
{
|
|
||||||
return ZoneLanguage::LANGUAGE_MEXICAN_SPANISH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZoneLanguage::LANGUAGE_NONE;
|
return GameLanguage::LANGUAGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CanLoad(ZoneHeader& header, bool* isSecure, bool* isOfficial, bool* isEncrypted)
|
static bool CanLoad(ZoneHeader& header, bool* isSecure, bool* isOfficial, bool* isEncrypted)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user