fix more bugs and crap

This commit is contained in:
Arisotura 2024-06-15 20:57:26 +02:00
parent 890dc4f228
commit 649462ff5c
3 changed files with 34 additions and 10 deletions

View File

@ -40,8 +40,8 @@ extern "C" {
#include <windows.h>
typedef unsigned __int64 QWORD;
#include <float.h>
#define isnan(v) _isnan(v)
#define isinf(v) (!_finite(v))
//#define isnan(v) _isnan(v)
//#define isinf(v) (!_finite(v))
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
#define FF_INTDEF 2

View File

@ -320,8 +320,37 @@ LegacyEntry LegacyFile[] =
static std::string GetDefaultKey(std::string path)
{
std::regex re("(Instance|Window)(\\d+)\\.");
return std::regex_replace(path, re, "$1*.");
std::string tables[] = {"Instance", "Window", "Camera"};
std::string ret = "";
int plen = path.length();
for (int i = 0; i < plen;)
{
bool found = false;
for (auto& tbl : tables)
{
int tlen = tbl.length();
if ((plen-i) <= tlen) continue;
if (path.substr(i, tlen) != tbl) continue;
if (path[i+tlen] < '0' || path[i+tlen] > '9') continue;
ret += tbl + "*";
i = path.find('.', i+tlen);
if (i == std::string::npos) return ret;
found = true;
break;
}
if (!found)
{
ret += path[i];
i++;
}
}
return ret;
}

View File

@ -25,12 +25,7 @@
#include <unordered_map>
#include <tuple>
#ifndef TOML11_VALUE_HPP
namespace toml
{
class value;
}
#endif
#include "toml/value.hpp"
namespace Config
{