1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Change some stuff for butt-endian architectures

This commit is contained in:
Valentin Ochs 2017-01-14 20:10:42 +01:00
parent d57d989963
commit c3f1058ff2
3 changed files with 10 additions and 6 deletions

View file

@ -506,8 +506,12 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
XMLElement *xml_data = doc.FirstChildElement("Data");
if (xml_data)
{
xml_data->QueryUnsignedAttribute("savePage", (unsigned int *)&data.savePage);
xml_data->QueryUnsignedAttribute("saveSlot", (unsigned int *)&data.saveSlot);
// use a temporary variable so we don't get into trouble on big-endian architectures
unsigned int tmp;
xml_data->QueryUnsignedAttribute("savePage", &tmp);
data.savePage = tmp;
xml_data->QueryUnsignedAttribute("saveSlot", &tmp);
data.saveSlot = tmp;
if(const char *patchlist = xml_data->Attribute("activePatches"))
{

View file

@ -370,7 +370,7 @@ void Shader::_queryUniforms()
{
glGetObjectParameterivARB(g_programObj, GL_OBJECT_ACTIVE_UNIFORMS_ARB , (GLint*)&numUniforms);
if (numUniforms <= 0)
if (numUniforms == 0 || numUniforms == -1)
{
uniforms.clear();
return;
@ -426,7 +426,7 @@ int Shader::_getUniformIndex(const char *name)
void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, int w /* = 0 */)
{
#if BBGE_BUILD_SHADERS
if(!g_programObj || numUniforms <= 0)
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
return;
int idx = _getUniformIndex(name);
if(unsigned(idx) >= uniforms.size())
@ -444,7 +444,7 @@ void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, i
void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = 0 */, float w /* = 0 */)
{
#if BBGE_BUILD_SHADERS
if(!g_programObj || numUniforms <= 0)
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
return;
int idx = _getUniformIndex(name);
if(unsigned(idx) >= uniforms.size())

View file

@ -46,7 +46,7 @@ protected:
std::string vertFile, fragFile;
std::string vertSrc, fragSrc;
GLuint g_programObj;
size_t numUniforms;
unsigned int numUniforms;
private:
static void staticInit();