fix(linux): localise chunk transforms and guard optional iggy paths

This commit is contained in:
MatthewBeshay 2026-03-28 21:09:35 +11:00 committed by Tropical
parent dc8c0b04c0
commit 31acc46308
8 changed files with 71 additions and 40 deletions

View file

@ -10,7 +10,12 @@ UIControl::UIControl() {
m_controlName = "";
m_isVisible = true;
m_bHidden = false;
m_isValid = false;
m_eControlType = eNoControl;
m_x = 0;
m_y = 0;
m_width = 0;
m_height = 0;
}
bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
@ -20,6 +25,7 @@ bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
rrbool res =
IggyValuePathMakeNameRef(&m_iggyPath, parent, controlName.c_str());
m_isValid = res ? true : false;
m_nameXPos = registerFastName(L"x");
m_nameYPos = registerFastName(L"y");
@ -28,16 +34,32 @@ bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent,
m_funcSetAlpha = registerFastName(L"SetControlAlpha");
m_nameVisible = registerFastName(L"visible");
F64 fx, fy, fwidth, fheight;
IggyValueGetF64RS(getIggyValuePath(), m_nameXPos, NULL, &fx);
IggyValueGetF64RS(getIggyValuePath(), m_nameYPos, NULL, &fy);
IggyValueGetF64RS(getIggyValuePath(), m_nameWidth, NULL, &fwidth);
IggyValueGetF64RS(getIggyValuePath(), m_nameHeight, NULL, &fheight);
if (m_isValid) {
IggyDatatype controlType = IGGY_DATATYPE__invalid_request;
IggyResult typeResult =
IggyValueGetTypeRS(getIggyValuePath(), 0, NULL, &controlType);
m_isValid = typeResult == IGGY_RESULT_SUCCESS &&
controlType != IGGY_DATATYPE__invalid_request &&
controlType != IGGY_DATATYPE_undefined;
}
m_x = (S32)fx;
m_y = (S32)fy;
m_width = (S32)Math::round(fwidth);
m_height = (S32)Math::round(fheight);
if (m_isValid) {
F64 fx, fy, fwidth, fheight;
IggyValueGetF64RS(getIggyValuePath(), m_nameXPos, NULL, &fx);
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;
}
@ -57,6 +79,8 @@ void UIControl::UpdateControl() {
#endif // __PSVITA__
void UIControl::ReInit() {
if (!m_isValid) return;
if (m_lastOpacity != 1.0f) {
IggyDataValue result;
IggyDataValue value[2];
@ -91,6 +115,7 @@ S32 UIControl::getHeight() { return m_height; }
void UIControl::setOpacity(float percent) {
if (percent != m_lastOpacity) {
m_lastOpacity = percent;
if (!m_isValid) return;
IggyDataValue result;
IggyDataValue value[2];
@ -112,6 +137,11 @@ void UIControl::setOpacity(float percent) {
void UIControl::setVisible(bool visible) {
if (visible != m_isVisible) {
if (!m_isValid) {
m_isVisible = visible;
return;
}
rrbool succ = IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible,
NULL, visible);
if (succ)
@ -122,6 +152,8 @@ void UIControl::setVisible(bool visible) {
}
bool UIControl::getVisible() {
if (!m_isValid) return m_isVisible;
rrbool bVisible = false;
IggyResult result = IggyValueGetBooleanRS(getIggyValuePath(), m_nameVisible,

View file

@ -34,6 +34,7 @@ protected:
eUIControlType m_eControlType;
int m_id;
bool m_bHidden; // set by the Remove call
bool m_isValid;
public:
void setControlType(eUIControlType eType) { m_eControlType = eType; }
@ -83,6 +84,7 @@ public:
void setVisible(bool visible);
bool getVisible();
bool isVisible() { return m_isVisible; }
bool isValid() { return m_isValid; }
virtual bool hasFocus() { return false; }

View file

@ -77,6 +77,15 @@ static void RADLINK WarningCallback(void* user_callback_data, Iggy* player,
// IGGY_RESULT_Error_UndefinedEntity = 504,
// 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) {
case IGGY_RESULT_Warning_CannotSustainFrameRate:
// Ignore warning
@ -3233,4 +3242,4 @@ void UIController::SendTouchInput(unsigned int iPad, unsigned int key,
}
}
#endif
#endif

View file

@ -19,6 +19,7 @@ UIScene::UIScene(int iPad, UILayer* parentLayer) {
m_bVisible = true;
m_bCanHandleInput = false;
m_bIsReloading = false;
m_hasSetSafeZoneMethod = false;
m_iFocusControl = -1;
m_iFocusChild = 0;
@ -53,6 +54,7 @@ void UIScene::destroyMovie() {
/* Destroy the Iggy player. */
IggyPlayerDestroy(swf);
swf = NULL;
m_hasSetSafeZoneMethod = false;
// Clear out the controls collection (doesn't delete the controls, and they
// get re-setup later)
@ -76,6 +78,7 @@ void UIScene::reloadMovie(bool force) {
// Clear out the controls collection (doesn't delete the controls, and
// they get re-setup later)
m_controls.clear();
m_hasSetSafeZoneMethod = false;
// Clear out all the fast names for the current movie
m_fastNames.clear();
@ -194,6 +197,8 @@ void UIScene::updateSafeZone() {
void UIScene::setSafeZone(S32 safeTop, S32 safeBottom, S32 safeLeft,
S32 safeRight) {
if (!m_hasSetSafeZoneMethod) return;
IggyDataValue result;
IggyDataValue value[4];
@ -251,6 +256,13 @@ bool UIScene::mapElementsAndNames() {
m_funcSetAlpha = registerFastName(L"SetAlpha");
m_funcSetFocus = registerFastName(L"SetFocus");
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;
}

View file

@ -72,6 +72,7 @@ private:
bool m_bUpdateOpacity;
bool m_bVisible;
bool m_bCanHandleInput;
bool m_hasSetSafeZoneMethod;
UIScene* m_backScene;
size_t m_callbackUniqueId;

View file

@ -219,14 +219,11 @@ void LinuxGLLogLightmapState(const char* stage, int textureId,
::glActiveTexture(GL_TEXTURE1);
GLint unit1Binding = 0;
::glGetIntegerv(GL_TEXTURE_BINDING_2D, &unit1Binding);
const bool unit1Enabled = (::glIsEnabled(GL_TEXTURE_2D) == GL_TRUE);
::glActiveTexture(restoreTexture);
app.DebugPrintf(
"[linux-lightmap] %s tex=%d scale=%d active=%#x unit1Bound=%d "
"unit1Enabled=%d\n",
stage, textureId, scaleLight ? 1 : 0, activeTexture, unit1Binding,
unit1Enabled ? 1 : 0);
"[linux-lightmap] %s tex=%d scale=%d active=%#x unit1Bound=%d\n",
stage, textureId, scaleLight ? 1 : 0, activeTexture, unit1Binding);
}
#endif

View file

@ -410,20 +410,8 @@ void Chunk::rebuild() {
MemSect(31);
glNewList(lists + currentLayer, GL_COMPILE);
MemSect(0);
glPushMatrix();
glDepthMask(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->offset((float)(-this->x), (float)(-this->y),
(float)(-this->z));
@ -471,7 +459,6 @@ void Chunk::rebuild() {
#endif
t->end();
bounds.addBounds(t->bounds); // 4J MGH - added
glPopMatrix();
glEndList();
t->useCompactVertices(false); // 4J added
t->offset(0, 0, 0);
@ -734,19 +721,8 @@ void Chunk::rebuild_SPU() {
{
glNewList(lists + currentLayer, GL_COMPILE);
MemSect(0);
glPushMatrix();
glDepthMask(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->offset((float)(-this->x), (float)(-this->y), (float)(-this->z));
}
@ -806,7 +782,6 @@ void Chunk::rebuild_SPU() {
{
t->end();
bounds.addBounds(t->bounds);
glPopMatrix();
glEndList();
t->useCompactVertices(false); // 4J added
t->offset(0, 0, 0);

View file

@ -543,6 +543,9 @@ void Textures::bindTextureLayers(ResourceLocation* resource) {
void Textures::bind(int id) {
// 4jcraft: Classic GUI code still performs some raw glBindTexture calls, so
// 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 < 0) return;