Hi,
after getting godot engine compiled without SCons with a few configurations I am working on a
GUI-only configuration.
But there are a lot of references (e.g. to AudioServer) which are
unresolved.
I decided to introduce Callback's in globals
static PVOID (*driver_callbacks [MAX_CALLBACK]) ();
static PVOID (*module_callbacks[MAX_CALLBACK]) ();
static PVOID (*scene_callbacks [MAX_CALLBACK]) ();
static PVOID (*thirdparty_callbacks [MAX_CALLBACK]) ();
static PVOID (*server_callbacks [MAX_CALLBACK]) ();
static PVOID (*tools_callbacks[MAX_CALLBACK]) ();
and e.g. in os_windows.cpp I replace the method invocations by calls which are
void (*f_audio_driverManager_init)(int) = (void(*)(int))Globals::server_callbacks[CallbackEnums::AudioDriverManagerSW_init];
if (f_audio_driverManager_init) {
f_audio_driverManager_init(p_audio_driver);
sample_manager = (SampleManagerMallocSW *) Globals::server_callbacks[CallbackEnums::newSampleManager]();
audio_server = ((AudioServerSW*(*)(SampleManagerMallocSW *)) Globals::server_callbacks[CallbackEnums::newAudioServer])(sample_manager);
}
spatial_sound_server = memnew( SpatialSoundServerSW );
spatial_sound_server->init();
spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
spatial_sound_2d_server->init();
```
and there are new functions
e.g
void initialize_server_types() {
#ifdef PHYSICSSERVER_ENABLED
extern PhysicsServerSW *physics_server_init();
Globals::server_callbacks[CallbackEnums::newPhysicsServer] = (PFunc)physics_server_init;
#endif PHYSICSSERVER_ENABLED
#ifdef AUDIOSERVER_ENABLED
Globals::server_callbacks[CallbackEnums::AudioDriverManagerSW_init] = (PFunc) audio_driverManager_init;
Globals::server_callbacks[CallbackEnums::newSampleManager] = (PFunc) newSampleManagerSW;
Globals::server_callbacks[CallbackEnums::newAudioServer] = (PFunc)audio_server_init;
#endif AUDIOSERVER_ENABLED
}
which installs the callbacks at an early initialization state.
The idea is to invoke a method only if the entry in the callback table is not null.
This way I hope to get a very small GUI only version of Godot-Engine. If this works it should be possible to get very small
exe's which contain only stuff which are needed. Also it should reduce the development-cycle drastically.
Frank