LanguageScreen::LanguageScreen() { #ifdef ANDROID VFSGetFileListing("assets/lang", &langs_, "ini"); #else VFSGetFileListing("lang", &langs_, "ini"); #endif }
void LoadPostShaderInfo(std::vector<std::string> directories) { shaderInfo.clear(); ShaderInfo off; off.name = "Off"; off.section = "Off"; off.outputResolution = false; off.isUpscalingFilter = false; shaderInfo.push_back(off); for (size_t d = 0; d < directories.size(); d++) { std::vector<FileInfo> fileInfo; getFilesInDir(directories[d].c_str(), &fileInfo, "ini:"); if (fileInfo.size() == 0) { // TODO: Really gotta fix the filter, now it's gonna open shaders as ini files.. VFSGetFileListing(directories[d].c_str(), &fileInfo, "ini:"); } for (size_t f = 0; f < fileInfo.size(); f++) { IniFile ini; bool success = false; std::string name = fileInfo[f].fullName; std::string path = directories[d]; // Hack around Android VFS path bug. really need to redesign this. if (name.substr(0, 7) == "assets/") name = name.substr(7); if (path.substr(0, 7) == "assets/") path = path.substr(7); if (ini.LoadFromVFS(name) || ini.Load(fileInfo[f].fullName)) { success = true; // vsh load. meh. } if (!success) continue; // Alright, let's loop through the sections and see if any is a shader. for (size_t i = 0; i < ini.Sections().size(); i++) { IniFile::Section §ion = ini.Sections()[i]; if (section.Exists("Fragment") && section.Exists("Vertex")) { // Valid shader! ShaderInfo info; std::string temp; info.section = section.name(); section.Get("Name", &info.name, section.name().c_str()); section.Get("Fragment", &temp, ""); info.fragmentShaderFile = path + "/" + temp; section.Get("Vertex", &temp, ""); info.vertexShaderFile = path + "/" + temp; section.Get("OutputResolution", &info.outputResolution, false); section.Get("Upscaling", &info.isUpscalingFilter, false); // Let's ignore shaders we can't support. TODO: Not a very good check if (gl_extensions.IsGLES && !gl_extensions.GLES3) { bool requiresIntegerSupport; section.Get("RequiresIntSupport", &requiresIntegerSupport, false); if (requiresIntegerSupport) continue; } auto beginErase = std::find(shaderInfo.begin(), shaderInfo.end(), info.name); if (beginErase != shaderInfo.end()) { shaderInfo.erase(beginErase, shaderInfo.end()); } shaderInfo.push_back(info); } } } } }