Skip to content

Commit

Permalink
RObj work (#1276)
Browse files Browse the repository at this point in the history
* Change JObjRefThis to appropriate call of iref_INC which does a null check itself

* Fix match of HSD_RObjResolveRefs

* Match HSD_RObjSetConstraintObj
  • Loading branch information
PsiLupan authored Feb 20, 2024
1 parent 3c8eaf2 commit 4a828fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/sysdolphin/baselib/jobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,7 @@ static inline void HSD_JObjRef(HSD_JObj* jobj)

static inline void HSD_JObjRefThis(HSD_JObj* jobj)
{
if (jobj != NULL) {
iref_INC(jobj);
}
iref_INC(jobj);
}

void HSD_JObjResolveRefs(HSD_JObj* jobj, HSD_Joint* joint);
Expand Down
6 changes: 4 additions & 2 deletions src/sysdolphin/baselib/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ static inline void ref_INC(void* o)

static inline void iref_INC(void* o)
{
HSD_OBJ(o)->ref_count_individual++;
HSD_ASSERT(158, HSD_OBJ(o)->ref_count_individual != 0);
if (o != NULL) {
HSD_OBJ(o)->ref_count_individual++;
HSD_ASSERT(158, HSD_OBJ(o)->ref_count_individual != 0);
}
}

#endif
12 changes: 5 additions & 7 deletions src/sysdolphin/baselib/robj.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,7 @@ void HSD_RObjResolveRefs(HSD_RObj* robj, HSD_RObjDesc* desc)
HSD_JObjUnrefThis(robj->u.jobj);
robj->u.jobj = HSD_IDGetData((u32) desc->u.joint, NULL);
HSD_ASSERT(883, robj->u.jobj);
if (robj->u.jobj != NULL) {
iref_INC(robj->u.jobj);
}
iref_INC(robj->u.jobj);
break;
case 0x0:
HSD_RvalueResolveRefsAll(robj->u.exp.rvalue, desc->u.exp->rvalue);
Expand Down Expand Up @@ -663,12 +661,12 @@ void HSD_RvalueResolveRefsAll(HSD_Rvalue* rvalue, HSD_RvalueList* list)
}
}

static inline void ref_JObj(HSD_RObj* robj, HSD_JObj* o)
static inline void ref_JObj(HSD_RObj* robj, void* o)
{
// HSD_JObj* jobj;
bool isDesc;

if (isDesc = hsdObjIsDescendantOf(&o->object, &hsdJObj.parent.parent),
if (isDesc = hsdObjIsDescendantOf(&((HSD_JObj*) o)->object,
&hsdJObj.parent.parent),
isDesc != 0)
{
robj->u.jobj = o;
Expand All @@ -681,7 +679,7 @@ static inline void ref_JObj(HSD_RObj* robj, HSD_JObj* o)

void HSD_RObjSetConstraintObj(HSD_RObj* robj, void* obj)
{
// HSD_JObj* jobj;
bool isDesc;

if (robj != NULL) {
if (robj->u.jobj != NULL) {
Expand Down

0 comments on commit 4a828fa

Please sign in to comment.