mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Get all available maps from VPK instead
Before we used the stbsp's, but we don't need to copy these for each maps (we could load existing ones to get working texture streaming for maps that don't have this)
This commit is contained in:
parent
ad08685e9b
commit
93f634022a
@ -41,16 +41,28 @@ IBrowser::IBrowser(void)
|
||||
{
|
||||
memset(m_chServerConnStringBuffer, 0, sizeof(m_chServerConnStringBuffer));
|
||||
|
||||
std::string path = "stbsp";
|
||||
for (const auto& entry : std::filesystem::directory_iterator(path))
|
||||
{
|
||||
std::string filename = entry.path().string();
|
||||
int slashPos = filename.rfind("\\", std::string::npos);
|
||||
filename = filename.substr(static_cast<std::basic_string<char, std::char_traits<char>, std::allocator<char>>::size_type>(slashPos) + 1, std::string::npos);
|
||||
filename = filename.substr(0, filename.size() - 6);
|
||||
std::regex rgArchiveRegex{ R"([^_]*_(.*)(.bsp.pak000_dir).*)" };
|
||||
std::smatch smRegexMatches;
|
||||
|
||||
m_vszMapsList.push_back(filename);
|
||||
m_vszMapFileNameList.push_back(filename);
|
||||
for (const auto& dEntry : std::filesystem::directory_iterator("vpk"))
|
||||
{
|
||||
std::string svFileName = dEntry.path().string();
|
||||
std::regex_search(svFileName, smRegexMatches, rgArchiveRegex);
|
||||
|
||||
if (smRegexMatches.size() > 0)
|
||||
{
|
||||
if (strcmp(smRegexMatches[1].str().c_str(), "frontend") == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(smRegexMatches[1].str().c_str(), "mp_common") == 0)
|
||||
{
|
||||
m_vszMapsList.push_back("mp_lobby");
|
||||
continue;
|
||||
}
|
||||
|
||||
m_vszMapsList.push_back(smRegexMatches[1].str());
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
|
@ -92,7 +92,6 @@ public:
|
||||
////////////////////
|
||||
ServerListing m_Server;
|
||||
std::vector<std::string> m_vszMapsList;
|
||||
std::vector<std::string> m_vszMapFileNameList;
|
||||
std::string m_szHostRequestMessage = "";
|
||||
std::string m_szHostToken = "";
|
||||
ImVec4 m_iv4HostRequestMessageColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
|
@ -296,7 +296,7 @@ namespace VSquirrel
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetAvailableMaps(HSQUIRRELVM v)
|
||||
{
|
||||
std::vector<std::string> vsvMapList = g_pIBrowser->m_vszMapFileNameList;
|
||||
std::vector<std::string> vsvMapList = g_pIBrowser->m_vszMapsList;
|
||||
|
||||
if (vsvMapList.empty())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user