Merge pull request #102 from t895/more-find-funcs
Some checks failed
CI / build (push) Has been cancelled
Frogress / update-progress (push) Has been cancelled

Implement more functions in find.c
This commit is contained in:
Zac 2024-10-17 14:00:08 -04:00 committed by GitHub
commit d4fd4e90e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 4 deletions

View File

@ -395,6 +395,8 @@ CploFindSwObjectsByClass__FP2SWi3CIDP2LOiPP2LO = 0x15A4F0; // type:func
PloFindSwObjectByClass__FP2SWi3CIDP2LO = 0x15A838; // type:func
PaloFindLoCommonParent__FP2LOT0 = 0x15A868; // type:func
g_mpcidpvt = 0x247448; // size:0x328
////////////////////////////////////////////////////////////////
// P2/flash.c
////////////////////////////////////////////////////////////////

View File

@ -10,6 +10,7 @@
#include <alo.h>
#include <sw.h>
#include <cid.h>
#include <so.h>
/**
* @brief Gets the DL for the SW object with the given OID.
@ -56,4 +57,6 @@ LO *PloFindSwObjectByClass(SW *psw, int grffso, CID cid, LO *ploContext);
*/
ALO *PaloFindLoCommonParent(LO *plo, LO *ploOther);
extern void** g_mpcidpvt;
#endif // FIND_H

View File

@ -6,13 +6,37 @@ INCLUDE_ASM(const s32, "P2/find", MatchSwObject__FP2LOiiiT0iPiPP2LOT6);
INCLUDE_ASM(const s32, "P2/find", CploFindSwObjects__FP2SWi3OIDP2LOiPP2LO);
INCLUDE_ASM(const s32, "P2/find", PloFindSwObject__FP2SWi3OIDP2LO);
LO * PloFindSwObject(SW *psw, int grffso, OID oid, LO *ploContext) {
LO *value1[4];
value1[0] = 0;
CploFindSwObjects(psw, FSO_ReturnActualCount | grffso, oid, ploContext, 1, value1);
return value1[0];
}
INCLUDE_ASM(const s32, "P2/find", PloFindSwNearest__FP2SW3OIDP2LO);
LO * PloFindSwNearest(SW *psw, OID oid, LO *ploContext) {
LO *aplo[4];
aplo[0] = 0;
CploFindSwObjects(psw, FSO_ReturnActualCount | FSO_FindNearest, oid, ploContext, 1, aplo);
return aplo[0];
}
INCLUDE_ASM(const s32, "P2/find", PloFindSwChild__FP2SW3OIDP3ALO);
LO * PloFindSwChild(SW *psw, OID oid, ALO *paloAncestor) {
LO *aplo[4];
aplo[0] = 0;
CploFindSwObjects(psw, FSO_ReturnActualCount | FSO_FindChild, oid, paloAncestor, 1, aplo);
return aplo[0];
}
INCLUDE_ASM(const s32, "P2/find", FIsCidDerivedFrom__F3CIDT0);
int FIsCidDerivedFrom(CID cid, CID cidAncestor) {
void **value1 = (&g_mpcidpvt)[cid];
while (value1 != (void**)0) {
if (value1[1] == (void*)cidAncestor) {
return 1;
}
value1 = (void**) *value1;
}
return 0;
}
INCLUDE_ASM(const s32, "P2/find", CploFindSwObjectsByClass__FP2SWi3CIDP2LOiPP2LO);