mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-23 20:22:40 +00:00
Do not use a0 register in pspgum
Fixes some examples (see #26) Reason is newlib's `memset()` clobbers the a0 register, meaning that `t` points to garbage after the call.
This commit is contained in:
@@ -439,7 +439,7 @@ void sceGumMultMatrix(const ScePspFMatrix4* m)
|
|||||||
#ifdef F_sceGumOrtho
|
#ifdef F_sceGumOrtho
|
||||||
void sceGumOrtho(float left, float right, float bottom, float top, float near, float far)
|
void sceGumOrtho(float left, float right, float bottom, float top, float near, float far)
|
||||||
{
|
{
|
||||||
register ScePspFMatrix4* t __asm("a0") = GUM_ALIGNED_MATRIX();
|
register ScePspFMatrix4* t = GUM_ALIGNED_MATRIX();
|
||||||
float dx = right-left, dy = top-bottom, dz = far-near;
|
float dx = right-left, dy = top-bottom, dz = far-near;
|
||||||
|
|
||||||
memset(t,0,sizeof(ScePspFMatrix4));
|
memset(t,0,sizeof(ScePspFMatrix4));
|
||||||
@@ -462,7 +462,7 @@ void sceGumPerspective(float fovy, float aspect, float near, float far)
|
|||||||
float angle = (fovy / 2) * (GU_PI/180.0f);
|
float angle = (fovy / 2) * (GU_PI/180.0f);
|
||||||
float cotangent = cosf(angle) / sinf(angle);
|
float cotangent = cosf(angle) / sinf(angle);
|
||||||
float delta_z = near-far;
|
float delta_z = near-far;
|
||||||
register ScePspFMatrix4* t __asm("a0") = GUM_ALIGNED_MATRIX();
|
register ScePspFMatrix4* t = GUM_ALIGNED_MATRIX();
|
||||||
|
|
||||||
memset(t,0,sizeof(ScePspFMatrix4));
|
memset(t,0,sizeof(ScePspFMatrix4));
|
||||||
t->x.x = cotangent / aspect;
|
t->x.x = cotangent / aspect;
|
||||||
|
|||||||
Reference in New Issue
Block a user