prim: Add specific RTTI implementation for mods#251
Conversation
MonsterDruide1
left a comment
There was a problem hiding this comment.
@MonsterDruide1 reviewed 2 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on Fuzzy2319).
include/prim/seadRuntimeTypeInfo.h line 182 at r2 (raw file):
this->BASE::checkDerivedRuntimeTypeInfo(typeInfo)) ? \ this : \ nullptr; \
Why did you move this from the main SEAD_RTTI macro into this one?
Code quote:
return (checkDerivedRuntimeTypeInfoStatic(typeInfo) || \
this->BASE::checkDerivedRuntimeTypeInfo(typeInfo)) ? \
this : \
nullptr; \include/prim/seadRuntimeTypeInfo.h line 207 at r2 (raw file):
{ \ return checkDerivedRuntimeTypeInfoStatic(typeInfo) || \ this->BASE::checkDerivedRuntimeTypeInfo(typeInfo); \
same here
Code quote:
return checkDerivedRuntimeTypeInfoStatic(typeInfo) || \
this->BASE::checkDerivedRuntimeTypeInfo(typeInfo); \include/prim/seadRuntimeTypeInfo.h line 262 at r2 (raw file):
{ \ const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic(); \ return typeInfo == clsTypeInfo; \
(this is the location I would have expected the BASE:: check)
Code quote:
const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic(); \
return typeInfo == clsTypeInfo; \
Fuzzy2319
left a comment
There was a problem hiding this comment.
@Fuzzy2319 made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on MonsterDruide1).
include/prim/seadRuntimeTypeInfo.h line 182 at r2 (raw file):
Previously, MonsterDruide1 wrote…
Why did you move this from the main
SEAD_RTTImacro into this one?
checkDerivedRuntimeTypeInfoStatic is defined in the header, it is inlined and never appear in the base game so I moved the check here for compatibilty reasons between a class that uses SEAD_RTTI_BASE and a class with SEAD_RTTI_OVERRIDE_CUSTOM
include/prim/seadRuntimeTypeInfo.h line 207 at r2 (raw file):
Previously, MonsterDruide1 wrote…
same here
same as above
include/prim/seadRuntimeTypeInfo.h line 262 at r2 (raw file):
Previously, MonsterDruide1 wrote…
(this is the location I would have expected the
BASE::check)
I can't do the base check here because this function is static, I can't use this in a static context.
MonsterDruide1
left a comment
There was a problem hiding this comment.
@MonsterDruide1 made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on Fuzzy2319).
include/prim/seadRuntimeTypeInfo.h line 262 at r2 (raw file):
Previously, Fuzzy2319 wrote…
I can't do the base check here because this function is static, I can't use
thisin a static context.
You should still be able to use BASE::, as it's a template parameter.
Fuzzy2319
left a comment
There was a problem hiding this comment.
@Fuzzy2319 made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on MonsterDruide1).
include/prim/seadRuntimeTypeInfo.h line 262 at r2 (raw file):
Previously, MonsterDruide1 wrote…
You should still be able to use
BASE::, as it's a template parameter.
yes but that would cause incompatibility between a class that uses SEAD_RTTI_BASE and a class with SEAD_RTTI_OVERRIDE_CUSTOM for exemple: In SMO, I want to make a custom message, al::SensorMsg use SEAD_RTTI_BASE my custom message extends that class and use SEAD_RTTI_OVERRIDE_CUSTOM, if I can't do the check here because checkDerivedRuntimeTypeInfoStatic doesn't exist for the parent class
MonsterDruide1
left a comment
There was a problem hiding this comment.
@MonsterDruide1 made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on Fuzzy2319).
include/prim/seadRuntimeTypeInfo.h line 262 at r2 (raw file):
Previously, Fuzzy2319 wrote…
yes but that would cause incompatibility between a class that uses
SEAD_RTTI_BASEand a class withSEAD_RTTI_OVERRIDE_CUSTOMfor exemple: In SMO, I want to make a custom message,al::SensorMsguseSEAD_RTTI_BASEmy custom message extends that class and useSEAD_RTTI_OVERRIDE_CUSTOM, if I can't do the check here becausecheckDerivedRuntimeTypeInfoStaticdoesn't exist for the parent class
Ah, oh. I see. Why not use Base::checkDerivedRuntimeTypeInfo(...) (non-static version) instead?
Fuzzy2319
left a comment
There was a problem hiding this comment.
@Fuzzy2319 made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on MonsterDruide1).
include/prim/seadRuntimeTypeInfo.h line 262 at r2 (raw file):
Previously, MonsterDruide1 wrote…
Ah, oh. I see. Why not use
Base::checkDerivedRuntimeTypeInfo(...)(non-static version) instead?
I don't understand your comment. I can't access an instance method without an instance object and checkDerivedRuntimeTypeInfoStatic is static so I can't use this and no instance are passed to the function. That's why I moved the call in the non-static function.
This PR add specific
RTTIimplementation for mods that allow the modding framework to call game functions instead of redefining them in your mod. To use this feature, you have to defineSEAD_TARGETto 2 and then useSEAD_RTTI_BASE_CUSTOMorSEAD_RTTI_OVERRIDE_CUSTOMin your mod headers.This change is