Refactor platform-specific initialization

- Removed `#if defined(_WIN32)` and `#define main SDL_main`
- Set `SDL_MAIN_HANDLED` and called `SDL_SetMainReady` for Windows
This commit is contained in:
Justin Scofield
2024-12-30 08:18:46 -05:00
parent 690255d29e
commit e7ff32e223

View File

@@ -1,6 +1,4 @@
#if defined(_WIN32)
#define main SDL_main
#elif __APPLE__
#if __APPLE__
#include "app/core/platform/app_delegate.h"
#endif
@@ -14,9 +12,6 @@
*/
using namespace yaze;
/**
* @brief Main entry point for the application.
*/
int main(int argc, char** argv) {
absl::InitializeSymbolizer(argv[0]);
@@ -35,6 +30,9 @@ int main(int argc, char** argv) {
#ifdef __APPLE__
yaze_run_cocoa_app_delegate(rom_filename.c_str());
return EXIT_SUCCESS;
#elif defined(_WIN32)
// We set SDL_MAIN_HANDLED for Win32 to avoid SDL hijacking main()
SDL_SetMainReady();
#endif
core::Controller controller;