1
+ #include < array>
1
2
#include < cmath>
2
3
#include < cstdio>
3
4
#include < cstdlib>
4
5
#include < cstring>
5
6
#include < fstream>
6
7
#include < iostream>
7
- #include < optional>
8
- #include < mutex>
9
- #include < array>
10
8
#include < memory>
11
9
#include < mutex>
10
+ #include < optional>
12
11
#include < unordered_map>
13
12
#include < unordered_set>
14
13
15
14
#ifdef _WIN32
16
- #include < Shlobj.h>
15
+ # include < Shlobj.h>
17
16
#elif defined(__linux__)
18
- #include < pwd.h>
17
+ # include < pwd.h>
19
18
#endif
20
19
21
20
#include " recomp.h"
@@ -89,7 +88,7 @@ static std::vector<uint8_t> read_file(const std::filesystem::path& path) {
89
88
90
89
bool write_file (const std::filesystem::path& path, const std::vector<uint8_t >& data) {
91
90
std::ofstream out_file{ path, std::ios::binary };
92
- recomp::g
91
+
93
92
if (!out_file.good ()) {
94
93
return false ;
95
94
}
@@ -107,7 +106,7 @@ std::filesystem::path recomp::get_app_folder_path() {
107
106
PWSTR known_path = NULL ;
108
107
HRESULT result = SHGetKnownFolderPath (FOLDERID_LocalAppData, 0 , NULL , &known_path);
109
108
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 ();
111
110
}
112
111
113
112
CoTaskMemFree (known_path);
@@ -118,9 +117,9 @@ std::filesystem::path recomp::get_app_folder_path() {
118
117
homedir = getpwuid (getuid ())->pw_dir ;
119
118
}
120
119
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
+ }
124
123
#endif
125
124
126
125
return recomp_dir;
@@ -455,20 +454,20 @@ void recomp::start(
455
454
std::unique_ptr<uint8_t []> rdram_buffer = std::make_unique<uint8_t []>(ultramodern::rdram_size);
456
455
std::memset (rdram_buffer.get (), 0 , ultramodern::rdram_size);
457
456
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 " );
460
460
461
- ultramodern::set_native_thread_name (" Game Start Thread" );
461
+ ultramodern::set_native_thread_name (" Game Start Thread" );
462
462
463
- ultramodern::preinit (rdram, window_handle);
463
+ ultramodern::preinit (rdram, window_handle);
464
464
465
465
game_status.wait (GameStatus::None);
466
466
recomp_context context{};
467
467
468
468
switch (game_status.load ()) {
469
469
// 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: {
472
471
if (!recomp::load_stored_rom (current_game.value ())) {
473
472
recomp::message_box (" Error opening stored ROM! Please restart this program." );
474
473
}
@@ -481,20 +480,21 @@ void recomp::start(
481
480
try {
482
481
recomp_entrypoint (rdram, &context);
483
482
} catch (ultramodern::thread_terminated& terminated) {
484
-
485
483
}
486
- }
487
- break ;
484
+ } break ;
488
485
489
- case GameStatus::Quit:
490
- break ;
486
+ case GameStatus::Quit:
487
+ break ;
491
488
492
- case GameStatus::None:
493
- break ;
494
- }
489
+ case GameStatus::None:
490
+ break ;
491
+ }
495
492
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
+ };
498
498
499
499
while (!exited) {
500
500
ultramodern::sleep_milliseconds (1 );
0 commit comments