Skip to content

👼Script: Added partial support for AngelScript maximum portability mode - #3444

Open
EMN-CSharp wants to merge 8 commits into
RigsOfRods:masterfrom
EMN-CSharp:generic-call-conv
Open

👼Script: Added partial support for AngelScript maximum portability mode#3444
EMN-CSharp wants to merge 8 commits into
RigsOfRods:masterfrom
EMN-CSharp:generic-call-conv

Conversation

@EMN-CSharp

Copy link
Copy Markdown
Contributor

This PR adds all the basic components needed for supporting AngelScript in maximum portability mode, and implements the first generic bindings for BeamClass, GameScriptClass and TurbojetClass (I did the first tests with Turbojet since it has just a few methods :) ).

Generated with support for functions with up to 8 parameters for now.
…nes!

I initially implemented generic bindings for Turbojet to do some initial testing, since it has just a few methods :)
Added this for making testing easier.
Comment thread source/main/scripting/ScriptEngine.cpp Outdated

#include "InputEngine.h"

#define REGISTER_NATIVE_OR_GENERIC(native, generic) if (max_portability) generic(engine); else native(engine);

@ohlidalp ohlidalp Jul 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic and native bindings can't be mixed - if actually compiled on a platform not supporting natives, their registrations will probably error out, but either way we shouldn't try to mix them at all.
Please remake this in the angelscript-addons convention, and where generic bindings aren't available, just register nothing (you may log a warning to Angelscript.log).

void RegisterActor(asIScriptEngine * engine)
{
    RegisterActorCommon();
	if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY"))
		RegisterActorGeneric(engine);
	else
		RegisterActorNative(engine);
}

You can place these funcs as inline into 'AngelScriptBindings.h' I suppose.

@ohlidalp

Copy link
Copy Markdown
Member

I tested using the cvar and everything seems to be running fine. However, currently there are mixed native/generic bindings which wouldn't work on actual non-native platform, see above.

@EMN-CSharp

EMN-CSharp commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Yes, I'm aware of that. I mixed generic and native bindings because I wanted to test with all the bindings available, I'll change it tonight.
Edit: BeamClass and GameScriptClass reference other bindings, so I had to mix them anyway.

EMN-CSharp and others added 5 commits July 30, 2026 17:30
Now only one of them is registered, unless diag_angelscript_generic_bind_test is set to true.

Other changes:
 - Renamed all Register*() functions for native bindings to Register*Native().
 - Renamed CVar diag_force_generic_as_bindings to diag_angelscript_generic_bind_test.
Ported bindings:
 - `AircraftEngineClass`
 - `AutopilotClass`
 - `DashBoardManagerClass`
 - `EngineClass`
 - `ScrewpropClass`
 - `TurbopropClass`
 - `VehicleAIClass`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants