Skip to content

Match geometry.c#47

Merged
gcsmith merged 3 commits intogcsmith:mainfrom
inspectredc:geometry
Feb 16, 2026
Merged

Match geometry.c#47
gcsmith merged 3 commits intogcsmith:mainfrom
inspectredc:geometry

Conversation

@inspectredc
Copy link
Contributor

No description provided.

var_v0 = 15;
gSPVertex(gGfxDisplayListHead++, OS_PHYSICAL_TO_K0(&gGeomVertexPtrs[var_t5]), 14, 1);
gSP1Triangle(gGfxDisplayListHead++, 0, 15, 1, 0);
gSPVertex(gGfxDisplayListHead++, (((u32)(&gGeomVertexPtrs[var_t5]) + 0x80000000)) + 14 * sizeof(Vtx), 1, 15);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was a bit weird to match but using OS_PHYSICAL_TO_K0 would break it as using any kind of pointer cast would majorly change the addition orders. https://decomp.me/scratch/Wb6aE Here is the scratch in case someone can find a better method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this is weird. If we change the cast to u32, it can be used: #define OS_PHYSICAL_TO_K0(x) (u32)(((u32)(x)+0x80000000)) here as well. But the order of the addition is just strange. I feel like this would have been more clearly originally written OS_PHYSICAL_TO_K0(&gGeomVertexPtrs[var_t5 + 14]) but that's not how it was.

var_v0 = 15;
gSPVertex(gGfxDisplayListHead++, OS_PHYSICAL_TO_K0(&gGeomVertexPtrs[var_t5]), 14, 1);
gSP1Triangle(gGfxDisplayListHead++, 0, 15, 1, 0);
gSPVertex(gGfxDisplayListHead++, (((u32)(&gGeomVertexPtrs[var_t5]) + 0x80000000)) + 14 * sizeof(Vtx), 1, 15);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this is weird. If we change the cast to u32, it can be used: #define OS_PHYSICAL_TO_K0(x) (u32)(((u32)(x)+0x80000000)) here as well. But the order of the addition is just strange. I feel like this would have been more clearly originally written OS_PHYSICAL_TO_K0(&gGeomVertexPtrs[var_t5 + 14]) but that's not how it was.

@gcsmith gcsmith merged commit bea4ca0 into gcsmith:main Feb 16, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants