citra.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #include <thread>
  5. #include "common/common.h"
  6. #include "common/logging/text_formatter.h"
  7. #include "common/logging/backend.h"
  8. #include "common/scope_exit.h"
  9. #include "core/settings.h"
  10. #include "core/system.h"
  11. #include "core/core.h"
  12. #include "core/loader/loader.h"
  13. #include "citra/config.h"
  14. #include "citra/emu_window/emu_window_glfw.h"
  15. /// Application entry point
  16. int __cdecl main(int argc, char **argv) {
  17. std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
  18. std::thread logging_thread(Log::TextLoggingLoop, logger);
  19. SCOPE_EXIT({
  20. logger->Close();
  21. logging_thread.join();
  22. });
  23. if (argc < 2) {
  24. LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
  25. return -1;
  26. }
  27. Config config;
  28. std::string boot_filename = argv[1];
  29. EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
  30. System::Init(emu_window);
  31. Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
  32. if (Loader::ResultStatus::Success != load_result) {
  33. LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
  34. return -1;
  35. }
  36. while (emu_window->IsOpen()) {
  37. Core::RunLoop();
  38. }
  39. delete emu_window;
  40. return 0;
  41. }