How to stop GameLauncher from C++?

Hi LY engineers! I made some key binding stuff for my module.

module code

and now I just want to stop whole game and exit from it on some button pressing. how to do this? I mean how to stop game and exit ? Is there exist some kinda Ebus event in that case or just AZ::SomeSystem::Quit?

@everybody

Hi fluffy.

You can use function.

#include "ISystem.h"
..
gEnv->pSystem->Quit();

or console command

gEnv->pConsole->ExecuteString("quit");

Thanks you! I have some problems with Input, but now it works!

At first time I tried using callback from IActionListener for ProjectModule, but with no luck.

My assumption about this - it’s because modules too much early initialized than Input, InputSystem not ready at this time.

So I moved with IActionListener to systemComponent, and again with no luck!

I think it’s the same problem with it, SystemComponent they also using early initialization than Input.

In this situation I tryed to find place somewhere in project where I can invoke EBus LateActivation() event for MyCustomSystemComponent.

and I found it, it’s OnSystemEvent in projectModule

  void OnSystemEvent(ESystemEvent systemEvent, UINT_PTR wparam, UINT_PTR lparam)
{
CryHooksModule::OnSystemEvent(systemEvent, wparam, lparam);
switch (systemEvent)
{
case ESYSTEM_EVENT_GAME_POST_INIT_DONE:
{
EBUS_EVENT(MyCustomSystemRequestBus, LateActivation);
}
break;
case ESYSTEM_EVENT_FULL_SHUTDOWN:
{
}
break;
default:
break;
}
}