mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
fix(linux): localise chunk transforms and guard optional iggy paths
This commit is contained in:
parent
dc8c0b04c0
commit
31acc46308
|
|
@ -10,7 +10,12 @@ UIControl::UIControl() {
|
||||||
m_controlName = "";
|
m_controlName = "";
|
||||||
m_isVisible = true;
|
m_isVisible = true;
|
||||||
m_bHidden = false;
|
m_bHidden = false;
|
||||||
|
m_isValid = false;
|
||||||
m_eControlType = eNoControl;
|
m_eControlType = eNoControl;
|
||||||
|
m_x = 0;
|
||||||
|
m_y = 0;
|
||||||
|
m_width = 0;
|
||||||
|
m_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
|
bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||||
|
|
@ -20,6 +25,7 @@ bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||||
|
|
||||||
rrbool res =
|
rrbool res =
|
||||||
IggyValuePathMakeNameRef(&m_iggyPath, parent, controlName.c_str());
|
IggyValuePathMakeNameRef(&m_iggyPath, parent, controlName.c_str());
|
||||||
|
m_isValid = res ? true : false;
|
||||||
|
|
||||||
m_nameXPos = registerFastName(L"x");
|
m_nameXPos = registerFastName(L"x");
|
||||||
m_nameYPos = registerFastName(L"y");
|
m_nameYPos = registerFastName(L"y");
|
||||||
|
|
@ -28,16 +34,32 @@ bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
|
||||||
m_funcSetAlpha = registerFastName(L"SetControlAlpha");
|
m_funcSetAlpha = registerFastName(L"SetControlAlpha");
|
||||||
m_nameVisible = registerFastName(L"visible");
|
m_nameVisible = registerFastName(L"visible");
|
||||||
|
|
||||||
F64 fx, fy, fwidth, fheight;
|
if (m_isValid) {
|
||||||
IggyValueGetF64RS(getIggyValuePath(), m_nameXPos, NULL, &fx);
|
IggyDatatype controlType = IGGY_DATATYPE__invalid_request;
|
||||||
IggyValueGetF64RS(getIggyValuePath(), m_nameYPos, NULL, &fy);
|
IggyResult typeResult =
|
||||||
IggyValueGetF64RS(getIggyValuePath(), m_nameWidth, NULL, &fwidth);
|
IggyValueGetTypeRS(getIggyValuePath(), 0, NULL, &controlType);
|
||||||
IggyValueGetF64RS(getIggyValuePath(), m_nameHeight, NULL, &fheight);
|
m_isValid = typeResult == IGGY_RESULT_SUCCESS &&
|
||||||
|
controlType != IGGY_DATATYPE__invalid_request &&
|
||||||
|
controlType != IGGY_DATATYPE_undefined;
|
||||||
|
}
|
||||||
|
|
||||||
m_x = (S32)fx;
|
if (m_isValid) {
|
||||||
m_y = (S32)fy;
|
F64 fx, fy, fwidth, fheight;
|
||||||
m_width = (S32)Math::round(fwidth);
|
IggyValueGetF64RS(getIggyValuePath(), m_nameXPos, NULL, &fx);
|
||||||
m_height = (S32)Math::round(fheight);
|
IggyValueGetF64RS(getIggyValuePath(), m_nameYPos, NULL, &fy);
|
||||||
|
IggyValueGetF64RS(getIggyValuePath(), m_nameWidth, NULL, &fwidth);
|
||||||
|
IggyValueGetF64RS(getIggyValuePath(), m_nameHeight, NULL, &fheight);
|
||||||
|
|
||||||
|
m_x = (S32)fx;
|
||||||
|
m_y = (S32)fy;
|
||||||
|
m_width = (S32)Math::round(fwidth);
|
||||||
|
m_height = (S32)Math::round(fheight);
|
||||||
|
} else {
|
||||||
|
m_x = 0;
|
||||||
|
m_y = 0;
|
||||||
|
m_width = 0;
|
||||||
|
m_height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -57,6 +79,8 @@ void UIControl::UpdateControl() {
|
||||||
#endif // __PSVITA__
|
#endif // __PSVITA__
|
||||||
|
|
||||||
void UIControl::ReInit() {
|
void UIControl::ReInit() {
|
||||||
|
if (!m_isValid) return;
|
||||||
|
|
||||||
if (m_lastOpacity != 1.0f) {
|
if (m_lastOpacity != 1.0f) {
|
||||||
IggyDataValue result;
|
IggyDataValue result;
|
||||||
IggyDataValue value[2];
|
IggyDataValue value[2];
|
||||||
|
|
@ -91,6 +115,7 @@ S32 UIControl::getHeight() { return m_height; }
|
||||||
void UIControl::setOpacity(float percent) {
|
void UIControl::setOpacity(float percent) {
|
||||||
if (percent != m_lastOpacity) {
|
if (percent != m_lastOpacity) {
|
||||||
m_lastOpacity = percent;
|
m_lastOpacity = percent;
|
||||||
|
if (!m_isValid) return;
|
||||||
|
|
||||||
IggyDataValue result;
|
IggyDataValue result;
|
||||||
IggyDataValue value[2];
|
IggyDataValue value[2];
|
||||||
|
|
@ -112,6 +137,11 @@ void UIControl::setOpacity(float percent) {
|
||||||
|
|
||||||
void UIControl::setVisible(bool visible) {
|
void UIControl::setVisible(bool visible) {
|
||||||
if (visible != m_isVisible) {
|
if (visible != m_isVisible) {
|
||||||
|
if (!m_isValid) {
|
||||||
|
m_isVisible = visible;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rrbool succ = IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible,
|
rrbool succ = IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible,
|
||||||
NULL, visible);
|
NULL, visible);
|
||||||
if (succ)
|
if (succ)
|
||||||
|
|
@ -122,6 +152,8 @@ void UIControl::setVisible(bool visible) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIControl::getVisible() {
|
bool UIControl::getVisible() {
|
||||||
|
if (!m_isValid) return m_isVisible;
|
||||||
|
|
||||||
rrbool bVisible = false;
|
rrbool bVisible = false;
|
||||||
|
|
||||||
IggyResult result = IggyValueGetBooleanRS(getIggyValuePath(), m_nameVisible,
|
IggyResult result = IggyValueGetBooleanRS(getIggyValuePath(), m_nameVisible,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ protected:
|
||||||
eUIControlType m_eControlType;
|
eUIControlType m_eControlType;
|
||||||
int m_id;
|
int m_id;
|
||||||
bool m_bHidden; // set by the Remove call
|
bool m_bHidden; // set by the Remove call
|
||||||
|
bool m_isValid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setControlType(eUIControlType eType) { m_eControlType = eType; }
|
void setControlType(eUIControlType eType) { m_eControlType = eType; }
|
||||||
|
|
@ -83,6 +84,7 @@ public:
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
bool getVisible();
|
bool getVisible();
|
||||||
bool isVisible() { return m_isVisible; }
|
bool isVisible() { return m_isVisible; }
|
||||||
|
bool isValid() { return m_isValid; }
|
||||||
|
|
||||||
virtual bool hasFocus() { return false; }
|
virtual bool hasFocus() { return false; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,15 @@ static void RADLINK WarningCallback(void* user_callback_data, Iggy* player,
|
||||||
// IGGY_RESULT_Error_UndefinedEntity = 504,
|
// IGGY_RESULT_Error_UndefinedEntity = 504,
|
||||||
// IGGY_RESULT_Error_OutOfMemory = 1001,};
|
// IGGY_RESULT_Error_OutOfMemory = 1001,};
|
||||||
|
|
||||||
|
if (message != NULL) {
|
||||||
|
// Some Linux movie variants do not ship these optional hooks/controls.
|
||||||
|
// We guard the call sites, so drop the residual Iggy warning noise.
|
||||||
|
if (strstr(message, "LabelGamertag") != NULL ||
|
||||||
|
strstr(message, "Method SetSafeZone was not a function") != NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case IGGY_RESULT_Warning_CannotSustainFrameRate:
|
case IGGY_RESULT_Warning_CannotSustainFrameRate:
|
||||||
// Ignore warning
|
// Ignore warning
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ UIScene::UIScene(int iPad, UILayer* parentLayer) {
|
||||||
m_bVisible = true;
|
m_bVisible = true;
|
||||||
m_bCanHandleInput = false;
|
m_bCanHandleInput = false;
|
||||||
m_bIsReloading = false;
|
m_bIsReloading = false;
|
||||||
|
m_hasSetSafeZoneMethod = false;
|
||||||
|
|
||||||
m_iFocusControl = -1;
|
m_iFocusControl = -1;
|
||||||
m_iFocusChild = 0;
|
m_iFocusChild = 0;
|
||||||
|
|
@ -53,6 +54,7 @@ void UIScene::destroyMovie() {
|
||||||
/* Destroy the Iggy player. */
|
/* Destroy the Iggy player. */
|
||||||
IggyPlayerDestroy(swf);
|
IggyPlayerDestroy(swf);
|
||||||
swf = NULL;
|
swf = NULL;
|
||||||
|
m_hasSetSafeZoneMethod = false;
|
||||||
|
|
||||||
// Clear out the controls collection (doesn't delete the controls, and they
|
// Clear out the controls collection (doesn't delete the controls, and they
|
||||||
// get re-setup later)
|
// get re-setup later)
|
||||||
|
|
@ -76,6 +78,7 @@ void UIScene::reloadMovie(bool force) {
|
||||||
// Clear out the controls collection (doesn't delete the controls, and
|
// Clear out the controls collection (doesn't delete the controls, and
|
||||||
// they get re-setup later)
|
// they get re-setup later)
|
||||||
m_controls.clear();
|
m_controls.clear();
|
||||||
|
m_hasSetSafeZoneMethod = false;
|
||||||
|
|
||||||
// Clear out all the fast names for the current movie
|
// Clear out all the fast names for the current movie
|
||||||
m_fastNames.clear();
|
m_fastNames.clear();
|
||||||
|
|
@ -194,6 +197,8 @@ void UIScene::updateSafeZone() {
|
||||||
|
|
||||||
void UIScene::setSafeZone(S32 safeTop, S32 safeBottom, S32 safeLeft,
|
void UIScene::setSafeZone(S32 safeTop, S32 safeBottom, S32 safeLeft,
|
||||||
S32 safeRight) {
|
S32 safeRight) {
|
||||||
|
if (!m_hasSetSafeZoneMethod) return;
|
||||||
|
|
||||||
IggyDataValue result;
|
IggyDataValue result;
|
||||||
IggyDataValue value[4];
|
IggyDataValue value[4];
|
||||||
|
|
||||||
|
|
@ -251,6 +256,13 @@ bool UIScene::mapElementsAndNames() {
|
||||||
m_funcSetAlpha = registerFastName(L"SetAlpha");
|
m_funcSetAlpha = registerFastName(L"SetAlpha");
|
||||||
m_funcSetFocus = registerFastName(L"SetFocus");
|
m_funcSetFocus = registerFastName(L"SetFocus");
|
||||||
m_funcHorizontalResizeCheck = registerFastName(L"DoHorizontalResizeCheck");
|
m_funcHorizontalResizeCheck = registerFastName(L"DoHorizontalResizeCheck");
|
||||||
|
|
||||||
|
IggyDatatype safeZoneType = IGGY_DATATYPE__invalid_request;
|
||||||
|
IggyResult safeZoneResult = IggyValueGetTypeRS(
|
||||||
|
m_rootPath, m_funcSetSafeZone, NULL, &safeZoneType);
|
||||||
|
m_hasSetSafeZoneMethod =
|
||||||
|
safeZoneResult == IGGY_RESULT_SUCCESS &&
|
||||||
|
safeZoneType == IGGY_DATATYPE_function;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ private:
|
||||||
bool m_bUpdateOpacity;
|
bool m_bUpdateOpacity;
|
||||||
bool m_bVisible;
|
bool m_bVisible;
|
||||||
bool m_bCanHandleInput;
|
bool m_bCanHandleInput;
|
||||||
|
bool m_hasSetSafeZoneMethod;
|
||||||
UIScene* m_backScene;
|
UIScene* m_backScene;
|
||||||
|
|
||||||
size_t m_callbackUniqueId;
|
size_t m_callbackUniqueId;
|
||||||
|
|
|
||||||
|
|
@ -219,14 +219,11 @@ void LinuxGLLogLightmapState(const char* stage, int textureId,
|
||||||
::glActiveTexture(GL_TEXTURE1);
|
::glActiveTexture(GL_TEXTURE1);
|
||||||
GLint unit1Binding = 0;
|
GLint unit1Binding = 0;
|
||||||
::glGetIntegerv(GL_TEXTURE_BINDING_2D, &unit1Binding);
|
::glGetIntegerv(GL_TEXTURE_BINDING_2D, &unit1Binding);
|
||||||
const bool unit1Enabled = (::glIsEnabled(GL_TEXTURE_2D) == GL_TRUE);
|
|
||||||
::glActiveTexture(restoreTexture);
|
::glActiveTexture(restoreTexture);
|
||||||
|
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"[linux-lightmap] %s tex=%d scale=%d active=%#x unit1Bound=%d "
|
"[linux-lightmap] %s tex=%d scale=%d active=%#x unit1Bound=%d\n",
|
||||||
"unit1Enabled=%d\n",
|
stage, textureId, scaleLight ? 1 : 0, activeTexture, unit1Binding);
|
||||||
stage, textureId, scaleLight ? 1 : 0, activeTexture, unit1Binding,
|
|
||||||
unit1Enabled ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -410,20 +410,8 @@ void Chunk::rebuild() {
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
glNewList(lists + currentLayer, GL_COMPILE);
|
glNewList(lists + currentLayer, GL_COMPILE);
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
glPushMatrix();
|
|
||||||
glDepthMask(true); // 4J added
|
glDepthMask(true); // 4J added
|
||||||
t->useCompactVertices(true); // 4J added
|
t->useCompactVertices(true); // 4J added
|
||||||
translateToPos();
|
|
||||||
float ss = 1.000001f;
|
|
||||||
// 4J - have removed this scale as I don't think we
|
|
||||||
// should need it, and have now optimised the vertex
|
|
||||||
// shader so it doesn't do anything other than
|
|
||||||
// translate with this matrix anyway
|
|
||||||
#if 0
|
|
||||||
glTranslatef(-zs / 2.0f, -ys / 2.0f, -zs / 2.0f);
|
|
||||||
glScalef(ss, ss, ss);
|
|
||||||
glTranslatef(zs / 2.0f, ys / 2.0f, zs / 2.0f);
|
|
||||||
#endif
|
|
||||||
t->begin();
|
t->begin();
|
||||||
t->offset((float)(-this->x), (float)(-this->y),
|
t->offset((float)(-this->x), (float)(-this->y),
|
||||||
(float)(-this->z));
|
(float)(-this->z));
|
||||||
|
|
@ -471,7 +459,6 @@ void Chunk::rebuild() {
|
||||||
#endif
|
#endif
|
||||||
t->end();
|
t->end();
|
||||||
bounds.addBounds(t->bounds); // 4J MGH - added
|
bounds.addBounds(t->bounds); // 4J MGH - added
|
||||||
glPopMatrix();
|
|
||||||
glEndList();
|
glEndList();
|
||||||
t->useCompactVertices(false); // 4J added
|
t->useCompactVertices(false); // 4J added
|
||||||
t->offset(0, 0, 0);
|
t->offset(0, 0, 0);
|
||||||
|
|
@ -734,19 +721,8 @@ void Chunk::rebuild_SPU() {
|
||||||
{
|
{
|
||||||
glNewList(lists + currentLayer, GL_COMPILE);
|
glNewList(lists + currentLayer, GL_COMPILE);
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
glPushMatrix();
|
|
||||||
glDepthMask(true); // 4J added
|
glDepthMask(true); // 4J added
|
||||||
t->useCompactVertices(true); // 4J added
|
t->useCompactVertices(true); // 4J added
|
||||||
translateToPos();
|
|
||||||
float ss = 1.000001f;
|
|
||||||
// 4J - have removed this scale as I don't think we should need it,
|
|
||||||
// and have now optimised the vertex shader so it doesn't do
|
|
||||||
// anything other than translate with this matrix anyway
|
|
||||||
#if 0
|
|
||||||
glTranslatef(-zs / 2.0f, -ys / 2.0f, -zs / 2.0f);
|
|
||||||
glScalef(ss, ss, ss);
|
|
||||||
glTranslatef(zs / 2.0f, ys / 2.0f, zs / 2.0f);
|
|
||||||
#endif
|
|
||||||
t->begin();
|
t->begin();
|
||||||
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
t->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
|
||||||
}
|
}
|
||||||
|
|
@ -806,7 +782,6 @@ void Chunk::rebuild_SPU() {
|
||||||
{
|
{
|
||||||
t->end();
|
t->end();
|
||||||
bounds.addBounds(t->bounds);
|
bounds.addBounds(t->bounds);
|
||||||
glPopMatrix();
|
|
||||||
glEndList();
|
glEndList();
|
||||||
t->useCompactVertices(false); // 4J added
|
t->useCompactVertices(false); // 4J added
|
||||||
t->offset(0, 0, 0);
|
t->offset(0, 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -543,6 +543,9 @@ void Textures::bindTextureLayers(ResourceLocation* resource) {
|
||||||
void Textures::bind(int id) {
|
void Textures::bind(int id) {
|
||||||
// 4jcraft: Classic GUI code still performs some raw glBindTexture calls, so
|
// 4jcraft: Classic GUI code still performs some raw glBindTexture calls, so
|
||||||
// this path must always rebind rather than trusting lastBoundId to be in sync.
|
// this path must always rebind rather than trusting lastBoundId to be in sync.
|
||||||
|
// TODO(4jcraft): Long term, route all texture binds through one synchronized
|
||||||
|
// path or invalidate lastBoundId at every raw glBindTexture call so this can
|
||||||
|
// safely use cached binds again without breaking font/UI rendering.
|
||||||
// if (id != lastBoundId)
|
// if (id != lastBoundId)
|
||||||
{
|
{
|
||||||
if (id < 0) return;
|
if (id < 0) return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue