1+ #include < array>
12#include < cmath>
23#include < cstdio>
34#include < cstdlib>
45#include < cstring>
56#include < fstream>
67#include < iostream>
7- #include < optional>
8- #include < mutex>
9- #include < array>
108#include < memory>
119#include < mutex>
10+ #include < optional>
1211#include < unordered_map>
1312#include < unordered_set>
1413
1514#ifdef _WIN32
16- #include < Shlobj.h>
15+ # include < Shlobj.h>
1716#elif defined(__linux__)
18- #include < pwd.h>
17+ # include < pwd.h>
1918#endif
2019
2120#include " recomp.h"
@@ -89,7 +88,7 @@ static std::vector<uint8_t> read_file(const std::filesystem::path& path) {
8988
9089bool write_file (const std::filesystem::path& path, const std::vector<uint8_t >& data) {
9190 std::ofstream out_file{ path, std::ios::binary };
92- recomp::g
91+
9392 if (!out_file.good ()) {
9493 return false ;
9594 }
@@ -107,7 +106,7 @@ std::filesystem::path recomp::get_app_folder_path() {
107106 PWSTR known_path = NULL ;
108107 HRESULT result = SHGetKnownFolderPath (FOLDERID_LocalAppData, 0 , NULL , &known_path);
109108 if (result == S_OK) {
110- recomp_dir = std::filesystem::path{known_path} / recomp::get_program_id ();
109+ recomp_dir = std::filesystem::path{ known_path } / recomp::get_program_id ();
111110 }
112111
113112 CoTaskMemFree (known_path);
@@ -118,9 +117,9 @@ std::filesystem::path recomp::get_app_folder_path() {
118117 homedir = getpwuid (getuid ())->pw_dir ;
119118 }
120119
121- if (homedir != nullptr ) {
122- recomp_dir = std::filesystem::path{homedir} / (std::u8string{u8" .config/" } + recomp::get_program_id ());
123- }
120+ if (homedir != nullptr ) {
121+ recomp_dir = std::filesystem::path{ homedir } / (std::u8string{ u8" .config/" } + recomp::get_program_id ());
122+ }
124123#endif
125124
126125 return recomp_dir;
@@ -455,20 +454,20 @@ void recomp::start(
455454 std::unique_ptr<uint8_t []> rdram_buffer = std::make_unique<uint8_t []>(ultramodern::rdram_size);
456455 std::memset (rdram_buffer.get (), 0 , ultramodern::rdram_size);
457456
458- std::thread game_thread{[](ultramodern::WindowHandle window_handle, uint8_t * rdram) {
459- debug_printf (" [Recomp] Starting\n " );
457+ std::thread game_thread{
458+ [](ultramodern::WindowHandle window_handle, uint8_t * rdram) {
459+ debug_printf (" [Recomp] Starting\n " );
460460
461- ultramodern::set_native_thread_name (" Game Start Thread" );
461+ ultramodern::set_native_thread_name (" Game Start Thread" );
462462
463- ultramodern::preinit (rdram, window_handle);
463+ ultramodern::preinit (rdram, window_handle);
464464
465465 game_status.wait (GameStatus::None);
466466 recomp_context context{};
467467
468468 switch (game_status.load ()) {
469469 // TODO refactor this to allow a project to specify what entrypoint function to run for a give game.
470- case GameStatus::Running:
471- {
470+ case GameStatus::Running: {
472471 if (!recomp::load_stored_rom (current_game.value ())) {
473472 recomp::message_box (" Error opening stored ROM! Please restart this program." );
474473 }
@@ -481,20 +480,21 @@ void recomp::start(
481480 try {
482481 recomp_entrypoint (rdram, &context);
483482 } catch (ultramodern::thread_terminated& terminated) {
484-
485483 }
486- }
487- break ;
484+ } break ;
488485
489- case GameStatus::Quit:
490- break ;
486+ case GameStatus::Quit:
487+ break ;
491488
492- case GameStatus::None:
493- break ;
494- }
489+ case GameStatus::None:
490+ break ;
491+ }
495492
496- debug_printf (" [Recomp] Quitting\n " );
497- }, window_handle, rdram_buffer.get (),};
493+ debug_printf (" [Recomp] Quitting\n " );
494+ },
495+ window_handle,
496+ rdram_buffer.get (),
497+ };
498498
499499 while (!exited) {
500500 ultramodern::sleep_milliseconds (1 );
0 commit comments