std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetLongNames() const { std::vector<u8> name_data(NAMES_TOTAL_BYTES); if (!Read(m_opening_bnr_offset + 0x9C, NAMES_TOTAL_BYTES, name_data.data())) return std::map<IVolume::ELanguage, std::string>(); return ReadWiiNames(name_data); }
std::map<Language, std::string> VolumeWAD::GetLongNames() const { if (!m_tmd.IsValid() || !IOS::ES::IsChannel(m_tmd.GetTitleId())) return {}; std::vector<u8> name_data(NAMES_TOTAL_BYTES); if (!Read(m_opening_bnr_offset + 0x9C, NAMES_TOTAL_BYTES, name_data.data())) return std::map<Language, std::string>(); return ReadWiiNames(name_data); }
void Shader::addAllUniforms() { /* Get all active uniforms except uniforms in blocks */ GLenum program_interface = GL_UNIFORM; GLint num_uniforms = 0; glGetProgramInterfaceiv(m_program_id, program_interface, GL_ACTIVE_RESOURCES, &num_uniforms); const GLenum properties[] = { GL_BLOCK_INDEX, GL_TYPE, GL_NAME_LENGTH, GL_LOCATION }; const GLint properties_size = sizeof(properties) / sizeof(properties[0]); for(GLint i = 0; i < num_uniforms; ++i) { GLint values[properties_size]; glGetProgramResourceiv(m_program_id, program_interface, i, properties_size, properties, properties_size, nullptr, values); /* Skip all uniforms in blocks */ if(values[0] != -1) { continue; } std::vector<char> name_data(values[2]); glGetProgramResourceName(m_program_id, program_interface, i, name_data.size(), nullptr, &name_data[0]); std::string uniform_name(name_data.begin(), name_data.end() - 1); std::string prefix = uniform_name.substr(0, 2); if(GLOBAL_UNIFORM_PREFIX == prefix) { m_global_uniforms_types.push_back(values[1]); m_global_uniforms_names.push_back(uniform_name); m_uniforms_locations[uniform_name] = values[3]; } else if(SKIP_UNIFORM_PREFIX == prefix) { m_uniforms_locations[uniform_name] = values[3]; } else { m_uniforms_types.push_back(values[1]); m_uniforms_names.push_back(uniform_name); m_uniforms_locations[uniform_name] = values[3]; } } }
void Shader::addAllSubroutines() { GLenum interfaces[] = { GL_VERTEX_SUBROUTINE, GL_FRAGMENT_SUBROUTINE }; GLenum shader_stages[] = { GL_VERTEX_SHADER, GL_FRAGMENT_SHADER }; GLint interfaces_count = sizeof(interfaces) / sizeof(interfaces[0]); for(GLint i = 0; i < interfaces_count; ++i) { /* Get all active subroutines */ GLenum program_interface = interfaces[i]; GLint num_subroutines = 0; glGetProgramInterfaceiv(m_program_id, program_interface, GL_ACTIVE_RESOURCES, &num_subroutines); const GLenum properties[] = { GL_NAME_LENGTH }; const GLint properties_size = sizeof(properties) / sizeof(properties[0]); GLint count_subroutine_locations = 0; glGetProgramStageiv(m_program_id, shader_stages[i], GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS, &count_subroutine_locations); m_active_subroutine_uniform_locations[shader_stages[i]] = count_subroutine_locations; for (GLint j = 0; j < num_subroutines; ++j) { GLint values[properties_size]; GLint length = 0; glGetProgramResourceiv(m_program_id, program_interface, j, properties_size, properties, properties_size, &length, values); std::vector<char> name_data(values[0]); glGetProgramResourceName(m_program_id, program_interface, j, name_data.size(), nullptr, &name_data[0]); std::string subroutine_name(name_data.begin(), name_data.end() - 1); GLuint subroutine_index = glGetSubroutineIndex(m_program_id, shader_stages[i], subroutine_name.c_str()); m_subroutine_indices[subroutine_name] = subroutine_index; } } }