higan-ui.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #include "higan-ui.hpp"
  2. shared_pointer<higan::Interface> interface;
  3. vector<shared_pointer<higan::Interface>> interfaces;
  4. namespace nall::Path {
  5. string settings;
  6. string templates;
  7. string data;
  8. }
  9. Video videoInstance;
  10. Audio audioInstance;
  11. Input inputInstance;
  12. #include <cv/interface/interface.hpp>
  13. #include <fc/interface/interface.hpp>
  14. #include <gb/interface/interface.hpp>
  15. #include <gba/interface/interface.hpp>
  16. #include <md/interface/interface.hpp>
  17. #include <ms/interface/interface.hpp>
  18. #include <msx/interface/interface.hpp>
  19. #include <ngp/interface/interface.hpp>
  20. #include <pce/interface/interface.hpp>
  21. #include <sfc/interface/interface.hpp>
  22. #include <sg/interface/interface.hpp>
  23. #include <ws/interface/interface.hpp>
  24. #include <nall/main.hpp>
  25. auto nall::main(Arguments arguments) -> void {
  26. Application::setName("higan");
  27. Application::setScreenSaver(false);
  28. settings.load();
  29. if(file::exists({Path::program(), "paths.bml"})) {
  30. Path::settings = Path::program();
  31. } else {
  32. Path::settings = {Path::userSettings(), "higan/"};
  33. directory::create(Path::settings);
  34. }
  35. if(auto document = BML::unserialize(file::read({Path::settings, "paths.bml"}))) {
  36. Path::templates = document["templates"].text();
  37. Path::data = document["data"].text();
  38. }
  39. if(!directory::exists(Path::templates)) {
  40. Path::templates = {Path::userData(), "higan/"};
  41. directory::create(Path::templates);
  42. }
  43. if(!directory::exists(Path::data)) {
  44. Path::data = {Path::user(), "higan/"};
  45. directory::create(Path::data);
  46. }
  47. file::write({Path::settings, "paths.bml"}, string{
  48. "data: ", Path::data, "\n",
  49. "templates: ", Path::templates, "\n"
  50. });
  51. //create interfaces list in alphabetical order of interface->name() values
  52. #ifdef CORE_CV
  53. interfaces.append(new higan::ColecoVision::ColecoVisionInterface);
  54. #endif
  55. #ifdef CORE_FC
  56. interfaces.append(new higan::Famicom::FamicomInterface);
  57. #endif
  58. #ifdef CORE_GB
  59. interfaces.append(new higan::GameBoy::GameBoyInterface);
  60. #endif
  61. #ifdef CORE_GB
  62. interfaces.append(new higan::GameBoy::GameBoyColorInterface);
  63. #endif
  64. #ifdef CORE_GBA
  65. interfaces.append(new higan::GameBoyAdvance::GameBoyAdvanceInterface);
  66. #endif
  67. #ifdef CORE_GBA
  68. interfaces.append(new higan::GameBoyAdvance::GameBoyPlayerInterface);
  69. #endif
  70. #ifdef CORE_MD
  71. interfaces.append(new higan::MegaDrive::MegaDriveInterface);
  72. #endif
  73. #ifdef CORE_MS
  74. interfaces.append(new higan::MasterSystem::GameGearInterface);
  75. #endif
  76. #ifdef CORE_MS
  77. interfaces.append(new higan::MasterSystem::MasterSystemInterface);
  78. #endif
  79. #ifdef CORE_MSX
  80. interfaces.append(new higan::MSX::MSXInterface);
  81. #endif
  82. #ifdef CORE_MSX
  83. interfaces.append(new higan::MSX::MSX2Interface);
  84. #endif
  85. #ifdef CORE_NGP
  86. interfaces.append(new higan::NeoGeoPocket::NeoGeoPocketInterface);
  87. #endif
  88. #ifdef CORE_NGP
  89. interfaces.append(new higan::NeoGeoPocket::NeoGeoPocketColorInterface);
  90. #endif
  91. #ifdef CORE_PCE
  92. interfaces.append(new higan::PCEngine::PCEngineInterface);
  93. #endif
  94. #ifdef CORE_PCE
  95. interfaces.append(new higan::PCEngine::PCEngineDuoInterface);
  96. #endif
  97. #ifdef CORE_WS
  98. interfaces.append(new higan::WonderSwan::PocketChallengeV2Interface);
  99. #endif
  100. #ifdef CORE_SG
  101. interfaces.append(new higan::SG1000::SC3000Interface);
  102. #endif
  103. #ifdef CORE_SG
  104. interfaces.append(new higan::SG1000::SG1000Interface);
  105. #endif
  106. #ifdef CORE_SFC
  107. interfaces.append(new higan::SuperFamicom::SuperFamicomInterface);
  108. #endif
  109. #ifdef CORE_PCE
  110. interfaces.append(new higan::PCEngine::SuperGrafxInterface);
  111. #endif
  112. #ifdef CORE_WS
  113. interfaces.append(new higan::WonderSwan::SwanCrystalInterface);
  114. #endif
  115. #ifdef CORE_WS
  116. interfaces.append(new higan::WonderSwan::WonderSwanInterface);
  117. #endif
  118. #ifdef CORE_WS
  119. interfaces.append(new higan::WonderSwan::WonderSwanColorInterface);
  120. #endif
  121. higan::platform = &emulator;
  122. Instances::program.construct();
  123. emulator.inputUpdate();
  124. inputManager.poll();
  125. hotkeys.bind();
  126. Application::onMain({&Emulator::main, &emulator});
  127. Application::run();
  128. settings.save();
  129. Instances::program.destruct();
  130. }