main.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/Memory/OSAllocator.h>
  9. #include <AzCore/Module/DynamicModuleHandle.h>
  10. #include <AzFramework/ProjectManager/ProjectManager.h>
  11. int main(int argc, char* argv[])
  12. {
  13. const AZ::Debug::Trace tracer;
  14. // Verify a project path can be found, launch the project manager and shut down otherwise
  15. if (AzFramework::ProjectManager::CheckProjectPathProvided(argc, argv) == AzFramework::ProjectManager::ProjectPathCheckResult::ProjectManagerLaunched)
  16. {
  17. return 2;
  18. }
  19. using CryEditMain = int (*)(int, char*[]);
  20. constexpr const char CryEditMainName[] = "CryEditMain";
  21. auto handle = AZ::DynamicModuleHandle::Create("EditorLib");
  22. [[maybe_unused]] const bool loaded = handle->Load(AZ::DynamicModuleHandle::LoadFlags::InitFuncRequired);
  23. AZ_Assert(loaded, "EditorLib could not be loaded");
  24. int ret = 1;
  25. if (auto fn = handle->GetFunction<CryEditMain>(CryEditMainName); fn != nullptr)
  26. {
  27. ret = AZStd::invoke(fn, argc, argv);
  28. }
  29. handle = {};
  30. return ret;
  31. }