Add searchable wiki catalogue and biology material navigation

This commit is contained in:
shen
2026-10-15 00:48:50 -07:00
parent 6472d17306
commit 9d9993b007
21 changed files with 7926 additions and 3 deletions
@@ -2255,6 +2255,24 @@ PyObject* playerAutoHuntSetSkills(PyObject*,PyObject* args)
return Py_BuildNone();
}
// PORT feature search: use the same native codepage tables as rendered locale text.
// Python's embedded stdlib does not require a CJK codec extension for this bridge.
PyObject* playerFeatureLocaleToUTF8(PyObject*, PyObject* args)
{
char* text;
if (!PyTuple_GetString(args, 0, &text)) return Py_BuildException();
if (strlen(text) > 512) { PyErr_SetString(PyExc_ValueError, "feature text exceeds 512 bytes"); return nullptr; }
const int count = MultiByteToWideChar(GetDefaultCodePage(), 0, text, -1, NULL, 0);
if (count <= 0) return Py_BuildValue("s", "");
std::vector<WCHAR> wide(count);
MultiByteToWideChar(GetDefaultCodePage(), 0, text, -1, wide.data(), count);
const int size = WideCharToMultiByte(CP_UTF8, 0, wide.data(), -1, NULL, 0, NULL, NULL);
if (size <= 0) return Py_BuildValue("s", "");
std::vector<char> utf8(size);
WideCharToMultiByte(CP_UTF8, 0, wide.data(), -1, utf8.data(), size, NULL, NULL);
return Py_BuildValue("s", utf8.data());
}
// The auto hunt window's UTF-8 source strings in the locale's code page (locale.cfg), as the packed
// locale_game.txt strings are.
PyObject * playerAutoHuntLocalize(PyObject* poSelf, PyObject* poArgs)
@@ -2455,6 +2473,7 @@ void initPlayer()
{ "AutoHuntSetConfig", playerAutoHuntSetConfig, METH_VARARGS },
{ "AutoHuntGetSkills", playerAutoHuntGetSkills, METH_VARARGS },
{ "AutoHuntSetSkills", playerAutoHuntSetSkills, METH_VARARGS },
{ "FeatureLocaleToUTF8", playerFeatureLocaleToUTF8, METH_VARARGS },
{ "AutoHuntLocalize", playerAutoHuntLocalize, METH_VARARGS },
{ NULL, NULL, NULL },