Remove useless GPR stuff, and re-add accidentally deleted files

This commit is contained in:
shibbo 2019-08-12 20:34:34 -04:00
parent 0c59482938
commit 6d2c56abf7
5 changed files with 134 additions and 2 deletions

14
include/OS/OSError.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef OSERROR_H
#define OSERROR_H
#ifdef __cplusplus
extern "C" {
#endif
void OSReport(const char *, ...);
#ifdef __cplusplus
}
#endif
#endif // OSERROR_H

25
include/OS/mtx.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef MTX_H
#define MTX_H
#include "types.h"
const static f32 mtx_zero = 0.0f;
const static f32 mtx_one_half = 0.5f;
const static f32 mtx_one = 1.0f;
#ifdef __cplusplus
extern "C" {
#endif
void PSMTXIdentity(Mtx matrix);
void PSMTXCopy(Mtx src, Mtx dest);
u32 PSMTXInverse(Mtx src, Mtx dest);
u32 PSMTXInvXpose(Mtx src, Mtx dest);
void PSMTXRotTrig(Mtx matrix, s8 axis, f32 sin, f32 cos);
#ifdef __cplusplus
}
#endif
#endif // MTX_H

View File

@ -1,5 +1,4 @@
#include "Actor/NameObj/NameObjGroup.h"
#include "os/gpr.h"
#include "MR/ObjUtil.h"
NameObjGroup::NameObjGroup(const char *name, s32 len) : NameObj(name)

View File

@ -1,6 +1,5 @@
#include "actor/NameObj/NameObjHolder.h"
#include "MR/ObjUtil.h"
#include "os/gpr.h"
NameObjHolder::NameObjHolder(s32 a1)
{

95
source/OS/mtx.c Normal file
View File

@ -0,0 +1,95 @@
#include "os/mtx.h"
void PSMTXIdentity(Mtx matrix)
{
__asm
{
lfs f0, (mtx_zero)(r2)
lfs f1, (mtx_one)(r2)
psq_st f0, 8(r3), 0, 0
ps_merge10 f2, f1, f0
ps_merge01 f1, f0, f1
psq_st f0, 0x18(r3), 0, 0
psq_st f0, 0x20(r3), 0, 0
psq_st f1, 0x10(r3), 0, 0
psq_st f2, 0(r3), 0, 0
psq_st f2, 0x28(r3), 0, 0
blr
}
}
void PSMTXCopy(Mtx src, Mtx dest)
{
__asm
{
psq_l f0, 0(r3), 0, 0
psq_st f0, 0(r4), 0, 0
psq_l f1, 8(r3), 0, 0
psq_st f1, 8(r4), 0, 0
psq_l f2, 0x10(r3), 0, 0
psq_st f2, 0x10(r4), 0, 0
psq_l f3, 0x18(r3), 0, 0
psq_st f3, 0x18(r4), 0, 0
psq_l f4, 0x20(r3), 0, 0
psq_st f4, 0x20(r4), 0, 0
psq_l f5, 0x28(r3), 0, 0
psq_st f5, 0x28(r4), 0, 0
}
}
void PSMTXRotTrig(Mtx mtx, s8 axis, f32 sin, f32 cos)
{
__asm
{
frsp f5, f1
ori r0, r4, 0x20
frsp f4, f2
cmplwi r0, 0x78
lfs f0, (mtx_zero)(r2)
ps_neg f2, f5
lfs f1, (mtx_one)(r2)
beq isEqual78
cmplwi r0, 0x79
beq isEqual79
cmplwi r0, 0x7A
beq isEqual7A
blr
isEqual78:
ps_merge00 f3, f5, f4
psq_st f1, 0(r3), 1, 0
ps_merge00 f1, f4, f2
psq_st f0, 4(r3), 0, 0
psq_st f0, 0xC(r3), 0, 0
psq_st f0, 0x1C(r3), 0, 0
psq_st f0, 0x2C(r3), 1, 0
psq_st f3, 0x24(r3), 0, 0
psq_st f1, 0x14(r3), 0, 0
blr
isEqual79:
ps_merge00 f3, f4, f0
psq_st f0, 0x18(r3), 0, 0
ps_merge00 f1, f0, f1
ps_merge00 f2, f2, f0
ps_merge00 f0, f5, f0
psq_st f3, 0(r3), 0, 0
psq_st f3, 0x28(r3), 0, 0
psq_st f1, 0x10(r3), 0, 0
psq_st f0, 8(r3), 0, 0
psq_st f2, 0x20(r3), 0, 0
blr
isEqual7A:
ps_merge00 f3, f5, f4
psq_st f0, 8(r3), 0, 0
ps_merge00 f2, f4, f2
ps_merge00 f1, f1, f0
psq_st f0, 0x18(r3), 0, 0
psq_st f0, 0x20(r3), 0, 0
psq_st f3, 0x10(r3), 0, 0
psq_st f2, 0(r3), 0, 0
psq_st f1, 0x28(r3), 0, 0
blr
}
}