Skip to content

Commit c69f43c

Browse files
committed
format files again
1 parent fe500e3 commit c69f43c

File tree

4 files changed

+40
-38
lines changed

4 files changed

+40
-38
lines changed

librecomp/include/recomp_overlays.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __RECOMP_OVERLAYS_H__
33

44
#include <cstdint>
5+
56
#include "sections.h"
67

78
namespace recomp {
@@ -18,7 +19,7 @@ namespace recomp {
1819

1920
extern void register_overlays(const overlay_section_table_data_t& sections, const overlays_by_index_t& overlays);
2021
extern void register_patch_section(SectionTableEntry* code_sections);
21-
};
22+
}; // namespace recomp
2223

2324
extern "C" void load_overlays(uint32_t rom, int32_t ram_addr, uint32_t size);
2425
extern "C" void unload_overlays(int32_t ram_addr, uint32_t size);

librecomp/src/overlays.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include "recomp_overlays.h"
88
#include "sections.h"
99

10-
static recomp::overlay_section_table_data_t sections_info {};
11-
static recomp::overlays_by_index_t overlays_info {};
10+
static recomp::overlay_section_table_data_t sections_info{};
11+
static recomp::overlays_by_index_t overlays_info{};
1212

1313
void recomp::register_overlays(const recomp::overlay_section_table_data_t& sections, const recomp::overlays_by_index_t& overlays) {
1414
sections_info = sections;
@@ -58,12 +58,13 @@ int32_t* section_addresses = nullptr;
5858
extern "C" void load_overlays(uint32_t rom, int32_t ram_addr, uint32_t size) {
5959
// Search for the first section that's included in the loaded rom range
6060
// Sections were sorted by `init_overlays` so we can use the bounds functions
61-
auto lower = std::lower_bound(&sections_info.code_sections[0], &sections_info.code_sections[sections_info.num_code_sections], rom,
61+
auto lower = std::lower_bound(
62+
&sections_info.code_sections[0], &sections_info.code_sections[sections_info.num_code_sections], rom,
6263
[](const SectionTableEntry& entry, uint32_t addr) {
6364
return entry.rom_addr < addr;
64-
}
65-
);
66-
auto upper = std::upper_bound(&sections_info.code_sections[0], &sections_info.code_sections[sections_info.num_code_sections], (uint32_t)(rom + size),
65+
});
66+
auto upper = std::upper_bound(
67+
&sections_info.code_sections[0], &sections_info.code_sections[sections_info.num_code_sections], (uint32_t)(rom + size),
6768
[](uint32_t addr, const SectionTableEntry& entry) {
6869
return addr < entry.size + entry.rom_addr;
6970
});
@@ -146,18 +147,18 @@ extern "C" void unload_overlays(int32_t ram_addr, uint32_t size) {
146147
void load_patch_functions();
147148

148149
void init_overlays() {
149-
section_addresses = (int32_t *)malloc(sections_info.total_num_sections * sizeof(int32_t));
150+
section_addresses = (int32_t*)malloc(sections_info.total_num_sections * sizeof(int32_t));
150151

151152
for (size_t section_index = 0; section_index < sections_info.total_num_sections; section_index++) {
152153
section_addresses[sections_info.code_sections[section_index].index] = sections_info.code_sections[section_index].ram_addr;
153154
}
154155

155156
// Sort the executable sections by rom address
156-
std::sort(&sections_info.code_sections[0], &sections_info.code_sections[sections_info.num_code_sections],
157+
std::sort(
158+
&sections_info.code_sections[0], &sections_info.code_sections[sections_info.num_code_sections],
157159
[](const SectionTableEntry& a, const SectionTableEntry& b) {
158160
return a.rom_addr < b.rom_addr;
159-
}
160-
);
161+
});
161162

162163
load_patch_functions();
163164
}

librecomp/src/patch_loading.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <vector>
44

55
#include "recomp.h"
6-
#include "sections.h"
76
#include "recomp_overlays.h"
7+
#include "sections.h"
88

99
static SectionTableEntry* code_sections = nullptr;
1010

librecomp/src/recomp.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
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

9089
bool 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

Comments
 (0)