Clean up and extend ArkApiUtils.#18
Clean up and extend ArkApiUtils.#18SubstituteR wants to merge 18 commits intoArkServerApi:masterfrom
Conversation
MolluskARK
left a comment
There was a problem hiding this comment.
IApiUtils is an exported class. It looks like you've mostly avoided falling victim to AsaApi's DLL Export Hell by adding new versions of functions. But there are a couple problem spots.
| * \brief Converts FVector into coords that are displayed when you view the ingame map | ||
| */ | ||
| FORCEINLINE MapCoords FVectorToCoords(FVector actor_position) | ||
| FORCEINLINE MapCoords FVectorToCoords(const FVector& position) const |
There was a problem hiding this comment.
Before:
?FVectorToCoords@IApiUtils@AsaApi@@QEAA?AUMapCoords@2@U?$TVector@N@Math@UE@@@Z
After:
?FVectorToCoords@IApiUtils@AsaApi@@QEBA?AUMapCoords@2@AEBU?$TVector@N@Math@UE@@@Z
There was a problem hiding this comment.
This is a purposeful breaking change to avoid copies and better reflect the intent of the function.
Recompiling plugins against the new api version would resolve the issue -- we can also force export this with the old name with a linker comment.
| * \param Command Command to run | ||
| */ | ||
| void RunHiddenCommand(AShooterPlayerController* _this, FString* Command) | ||
| void RunHiddenCommand(AShooterPlayerController* _this, const FString* Command) const |
There was a problem hiding this comment.
Before:
?RunHiddenCommand@IApiUtils@AsaApi@@QEAAXPEAUAShooterPlayerController@@PEAVFString@@@Z
After:
?RunHiddenCommand@IApiUtils@AsaApi@@QEBAXPEAUAShooterPlayerController@@PEBVFString@@@Z
There was a problem hiding this comment.
This is a purposeful breaking change to better reflect the intent of the function.
Recompiling plugins against the new api version would resolve the issue -- we can also force export this with the old name with a linker comment.
There was a problem hiding this comment.
Doesn't bother me :) I don't know if many plugins are even using RunHiddenCommand(). And I imagine FVectorToCoords() is mostly getting inlined anyways.
Personally, there's a lot of exports I wouldn't mind seeing broken (a whole lot of FString exports that could have just been defined in headers with NativeCall, among other things). Maybe if the dev team doesn't mind potentially breaking existing plugins, then there's hope for cleaning up some other exports as well.
There was a problem hiding this comment.
I agree, I am also not a fan of a singleton for ApiUtils.
This is just the first of a larger set of changes -- realistically we wouldn't push a new API version officially until most things are cleaned up and developers have time to recompile plugins.
With that said, we should also be using Git tags to help version the API so that people can download the latest stable source more easily, even if there are changes to master.
Needs rigorous testing before merging