Skip to content

Commit 1b8312e

Browse files
authored
[Chores] Format code
1 parent cc9a1a6 commit 1b8312e

File tree

10 files changed

+80
-74
lines changed

10 files changed

+80
-74
lines changed

src/core/gpu.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,16 @@ uint32_t PCSX::GPU::gpuDmaChainSize(uint32_t addr) {
450450
addr &= 0xfffffffc;
451451
switch (g_emulator->m_mem->msanGetStatus<4>(addr)) {
452452
case PCSX::MsanStatus::UNINITIALIZED:
453-
g_system->log(LogClass::GPU, _("GPU DMA went into usable but uninitialized msan memory: %8.8lx\n"), addr);
453+
g_system->log(LogClass::GPU, _("GPU DMA went into usable but uninitialized msan memory: %8.8lx\n"),
454+
addr);
454455
g_system->pause();
455456
return size;
456457
case PCSX::MsanStatus::UNUSABLE:
457458
g_system->log(LogClass::GPU, _("GPU DMA went into unusable msan memory: %8.8lx\n"), addr);
458459
g_system->pause();
459460
return size;
460461
case PCSX::MsanStatus::OK:
461-
header = *(uint32_t *) (g_emulator->m_mem->m_msanRAM + (addr - PCSX::Memory::c_msanStart));
462+
header = *(uint32_t *)(g_emulator->m_mem->m_msanRAM + (addr - PCSX::Memory::c_msanStart));
462463
break;
463464
}
464465
} else {
@@ -479,8 +480,8 @@ uint32_t PCSX::GPU::gpuDmaChainSize(uint32_t addr) {
479480
continue;
480481
}
481482
addr = nextAddr;
482-
} while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually
483-
return size; // 0xFF'FFFF any pointer with bit 23 set will do.
483+
} while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually
484+
return size; // 0xFF'FFFF any pointer with bit 23 set will do.
484485
}
485486

486487
uint32_t PCSX::GPU::readStatus() {
@@ -713,10 +714,11 @@ void PCSX::GPU::chainedDMAWrite(const uint32_t *memory, uint32_t hwAddr) {
713714
const uint32_t *feed;
714715
if (usingMsan && PCSX::Memory::inMsanRange(addr)) {
715716
addr &= 0xfffffffc;
716-
const uint32_t *headerPtr = (uint32_t *) (g_emulator->m_mem->m_msanRAM + (addr - PCSX::Memory::c_msanStart));
717+
const uint32_t *headerPtr = (uint32_t *)(g_emulator->m_mem->m_msanRAM + (addr - PCSX::Memory::c_msanStart));
717718
switch (g_emulator->m_mem->msanGetStatus<4>(addr)) {
718719
case PCSX::MsanStatus::UNINITIALIZED:
719-
g_system->log(LogClass::GPU, _("GPU DMA went into usable but uninitialized msan memory: %8.8lx\n"), addr);
720+
g_system->log(LogClass::GPU, _("GPU DMA went into usable but uninitialized msan memory: %8.8lx\n"),
721+
addr);
720722
g_system->pause();
721723
return;
722724
case PCSX::MsanStatus::UNUSABLE:
@@ -751,8 +753,8 @@ void PCSX::GPU::chainedDMAWrite(const uint32_t *memory, uint32_t hwAddr) {
751753
continue;
752754
}
753755
addr = nextAddr;
754-
} while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually
755-
} // 0xFF'FFFF any pointer with bit 23 set will do.
756+
} while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually
757+
} // 0xFF'FFFF any pointer with bit 23 set will do.
756758

757759
void PCSX::GPU::Command::processWrite(Buffer &buf, Logged::Origin origin, uint32_t originValue, uint32_t length) {
758760
while (!buf.isEmpty()) {

src/core/psxhw.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include "core/psxemulator.h"
3131
#include "core/sio.h"
3232
#include "core/sio1.h"
33-
#include "supportpsx/memory.h"
3433
#include "lua/luawrapper.h"
3534
#include "spu/interface.h"
35+
#include "supportpsx/memory.h"
3636

3737
static constexpr bool between(uint32_t val, uint32_t beg, uint32_t end) {
3838
return (beg > end) ? false : (val >= beg && val <= end - 3);

src/core/psxhw.h

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class HW {
5050
if ((chcr & 0x01000000) && mem->template isDMAEnabled<n>()) {
5151
uint32_t madr = mem->template getMADR<n>();
5252
bool usingMsan = g_emulator->m_mem->msanInitialized();
53-
if (usingMsan && PCSX::Memory::inMsanRange(madr)) {
53+
if (usingMsan && PCSX::Memory::inMsanRange(madr)) {
5454
madr &= 0xfffffffc;
5555
} else {
5656
madr &= 0x7ffffc;
@@ -75,20 +75,23 @@ class HW {
7575
uint32_t DMACommandCounter = 0;
7676

7777
do {
78-
if (usingMsan && PCSX::Memory::inMsanRange(madr)) {
78+
if (usingMsan && PCSX::Memory::inMsanRange(madr)) {
7979
madr &= 0xfffffffc;
80-
switch (g_emulator->m_mem->msanGetStatus<4>(madr)) {
81-
case PCSX::MsanStatus::UNINITIALIZED:
82-
g_system->log(LogClass::GPU, _("GPU DMA went into usable but uninitialized msan memory: %8.8lx\n"), madr);
83-
g_system->pause();
84-
return;
85-
case PCSX::MsanStatus::UNUSABLE:
86-
g_system->log(LogClass::GPU, _("GPU DMA went into unusable msan memory: %8.8lx\n"), madr);
87-
g_system->pause();
88-
return;
89-
case PCSX::MsanStatus::OK:
90-
break;
91-
}
80+
switch (g_emulator->m_mem->msanGetStatus<4>(madr)) {
81+
case PCSX::MsanStatus::UNINITIALIZED:
82+
g_system->log(LogClass::GPU,
83+
_("GPU DMA went into usable but uninitialized msan memory: %8.8lx\n"),
84+
madr);
85+
g_system->pause();
86+
return;
87+
case PCSX::MsanStatus::UNUSABLE:
88+
g_system->log(LogClass::GPU, _("GPU DMA went into unusable msan memory: %8.8lx\n"),
89+
madr);
90+
g_system->pause();
91+
return;
92+
case PCSX::MsanStatus::OK:
93+
break;
94+
}
9295
} else {
9396
madr &= 0x7ffffc;
9497
}

src/core/psxmem.cc

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -279,23 +279,24 @@ uint8_t PCSX::Memory::read8(uint32_t address) {
279279
const bool pioConnected = g_emulator->settings.get<Emulator::SettingPIOConnected>().value;
280280

281281
if (pointer != nullptr) {
282-
if (msanInitialized() && inMsanRange(address)) [[unlikely]] {
283-
switch (msanGetStatus<1>(address)) {
284-
case MsanStatus::UNINITIALIZED:
285-
g_system->log(LogClass::CPU, _("8-bit read from usable but uninitialized msan memory: %8.8lx\n"), address);
286-
break;
287-
case MsanStatus::UNUSABLE:
288-
g_system->log(LogClass::CPU, _("8-bit read from unusable msan memory: %8.8lx\n"), address);
289-
break;
290-
case MsanStatus::OK:
291-
return m_msanRAM[address - c_msanStart];
292-
}
293-
g_system->pause();
294-
return 0;
295-
}
282+
if (msanInitialized() && inMsanRange(address)) [[unlikely]] {
283+
switch (msanGetStatus<1>(address)) {
284+
case MsanStatus::UNINITIALIZED:
285+
g_system->log(LogClass::CPU, _("8-bit read from usable but uninitialized msan memory: %8.8lx\n"),
286+
address);
287+
break;
288+
case MsanStatus::UNUSABLE:
289+
g_system->log(LogClass::CPU, _("8-bit read from unusable msan memory: %8.8lx\n"), address);
290+
break;
291+
case MsanStatus::OK:
292+
return m_msanRAM[address - c_msanStart];
293+
}
294+
g_system->pause();
295+
return 0;
296+
}
296297
[[likely]];
297298
const uint32_t offset = address & 0xffff;
298-
return *(pointer + offset);
299+
return *(pointer + offset);
299300
} else if (page == 0x1f80 || page == 0x9f80 || page == 0xbf80) {
300301
if ((address & 0xffff) < 0x400) {
301302
return m_hard[address & 0x3ff];
@@ -329,10 +330,11 @@ uint16_t PCSX::Memory::read16(uint32_t address) {
329330
const bool pioConnected = g_emulator->settings.get<Emulator::SettingPIOConnected>().value;
330331

331332
if (pointer != nullptr) {
332-
if (msanInitialized() && inMsanRange(address)) {
333+
if (msanInitialized() && inMsanRange(address)) {
333334
switch (msanGetStatus<2>(address)) {
334335
case MsanStatus::UNINITIALIZED:
335-
g_system->log(LogClass::CPU, _("16-bit read from usable but uninitialized msan memory: %8.8lx\n"), address);
336+
g_system->log(LogClass::CPU, _("16-bit read from usable but uninitialized msan memory: %8.8lx\n"),
337+
address);
336338
break;
337339
case MsanStatus::UNUSABLE:
338340
g_system->log(LogClass::CPU, _("16-bit read from unusable msan memory: %8.8lx\n"), address);
@@ -379,7 +381,8 @@ uint32_t PCSX::Memory::read32(uint32_t address, ReadType readType) {
379381
if (msanInitialized() && inMsanRange(address)) {
380382
switch (msanGetStatus<4>(address)) {
381383
case MsanStatus::UNINITIALIZED:
382-
g_system->log(LogClass::CPU, _("32-bit read from usable but uninitialized msan memory: %8.8lx\n"), address);
384+
g_system->log(LogClass::CPU, _("32-bit read from usable but uninitialized msan memory: %8.8lx\n"),
385+
address);
383386
break;
384387
case MsanStatus::UNUSABLE:
385388
g_system->log(LogClass::CPU, _("32-bit read from unusable msan memory: %8.8lx\n"), address);

src/core/psxmem.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
namespace PCSX {
4949

5050
enum class MsanStatus {
51-
UNUSABLE, // memory that hasn't been allocated or has been freed
52-
UNINITIALIZED, // allocated memory that has never been written to, has undefined contents
53-
OK // free to use
51+
UNUSABLE, // memory that hasn't been allocated or has been freed
52+
UNINITIALIZED, // allocated memory that has never been written to, has undefined contents
53+
OK // free to use
5454
};
5555

5656
class Memory {
@@ -91,7 +91,7 @@ class Memory {
9191
uint32_t msanSetChainPtr(uint32_t headerAddr, uint32_t ptrToNext, uint32_t size);
9292
uint32_t msanGetChainPtr(uint32_t addr) const;
9393

94-
template<uint32_t length>
94+
template <uint32_t length>
9595
MsanStatus msanGetStatus(uint32_t addr) const {
9696
uint32_t bitmapIndex = (addr - c_msanStart) / 8;
9797
uint32_t bitmask = ((1 << length) - 1) << addr % 8;
@@ -115,8 +115,8 @@ class Memory {
115115
}
116116

117117
// if the write is valid, marks the address as initialized, otherwise returns false
118-
template<uint32_t length>
119-
bool msanValidateWrite(uint32_t addr) {
118+
template <uint32_t length>
119+
bool msanValidateWrite(uint32_t addr) {
120120
uint32_t bitmapIndex = (addr - c_msanStart) / 8;
121121
uint32_t bitmask = ((1 << length) - 1) << addr % 8;
122122
if (uint32_t nextBitmask = bitmask >> 8) [[unlikely]] {
@@ -133,9 +133,7 @@ class Memory {
133133
return true;
134134
}
135135

136-
static inline bool inMsanRange(uint32_t addr) {
137-
return addr >= c_msanStart && addr < c_msanEnd;
138-
}
136+
static inline bool inMsanRange(uint32_t addr) { return addr >= c_msanStart && addr < c_msanEnd; }
139137

140138
template <unsigned n>
141139
void dmaInterrupt() {

src/core/r3000a.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#include "core/sio.h"
3535
#include "core/sio1.h"
3636
#include "core/spu.h"
37-
#include "supportpsx/memory.h"
3837
#include "fmt/format.h"
38+
#include "supportpsx/memory.h"
3939

4040
int PCSX::R3000Acpu::psxInit() {
4141
g_system->printf(_("PCSX-Redux booting\n"));
@@ -506,7 +506,7 @@ void PCSX::R3000Acpu::processB0KernelCall(uint32_t call) {
506506

507507
std::pair<const uint32_t, std::string>* PCSX::R3000Acpu::findContainingSymbol(uint32_t addr) {
508508
auto symBefore = m_symbols.upper_bound(addr);
509-
if (symBefore != m_symbols.begin()) { // verify there is actually a symbol before addr
509+
if (symBefore != m_symbols.begin()) { // verify there is actually a symbol before addr
510510
symBefore--;
511511
if (symBefore->first != addr) {
512512
PCSX::PSXAddress addrInfo(addr);

src/core/r3000a.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ class R3000Acpu {
290290

291291
std::map<uint32_t, std::string> m_symbols;
292292

293-
std::pair<const uint32_t, std::string>* findContainingSymbol(uint32_t addr);
294-
std::string* getSymbolAt(uint32_t addr);
293+
std::pair<const uint32_t, std::string> *findContainingSymbol(uint32_t addr);
294+
std::string *getSymbolAt(uint32_t addr);
295295

296296
static int psxInit();
297297
virtual bool isDynarec() = 0;

src/gui/gui.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,18 @@ class GUI final : public UI {
151151
typedef Setting<size_t, TYPESTRING("HWRegsEditorAddr"), 0> HWRegsEditorAddr;
152152
typedef Setting<size_t, TYPESTRING("BiosEditorAddr"), 0> BiosEditorAddr;
153153
typedef Setting<size_t, TYPESTRING("VRAMEditorAddr"), 0> VRAMEditorAddr;
154-
Settings<Fullscreen, FullWindowRender, ShowMenu, ShowLog, WindowPosX, WindowPosY, WindowSizeX, WindowSizeY, WindowMaximized,
155-
IdleSwapInterval, ShowLuaConsole, ShowLuaInspector, ShowLuaEditor, ShowMainVRAMViewer, ShowCLUTVRAMViewer,
156-
ShowVRAMViewer1, ShowVRAMViewer2, ShowVRAMViewer3, ShowVRAMViewer4, ShowMemoryObserver, ShowTypedDebugger,
157-
ShowPatches, ShowMemcardManager, ShowRegisters, ShowAssembly, ShowDisassembly, ShowBreakpoints,
158-
ShowNamedSaveStates, ShowEvents, ShowHandlers, ShowKernelLog, ShowCallstacks, ShowSIO1, ShowIsoBrowser,
159-
ShowGPULogger, MainFontSize, MonoFontSize, GUITheme, AllowMouseCaptureToggle, EnableRawMouseMotion,
160-
WidescreenRatio, ShowPIOCartConfig, ShowMemoryEditor1, ShowMemoryEditor2, ShowMemoryEditor3,
161-
ShowMemoryEditor4, ShowMemoryEditor5, ShowMemoryEditor6, ShowMemoryEditor7, ShowMemoryEditor8,
162-
ShowParallelPortEditor, ShowScratchpadEditor, ShowHWRegsEditor, ShowBiosEditor, ShowVRAMEditor,
163-
MemoryEditor1Addr, MemoryEditor2Addr, MemoryEditor3Addr, MemoryEditor4Addr, MemoryEditor5Addr,
164-
MemoryEditor6Addr, MemoryEditor7Addr, MemoryEditor8Addr, ParallelPortEditorAddr, ScratchpadEditorAddr,
165-
HWRegsEditorAddr, BiosEditorAddr, VRAMEditorAddr>
154+
Settings<Fullscreen, FullWindowRender, ShowMenu, ShowLog, WindowPosX, WindowPosY, WindowSizeX, WindowSizeY,
155+
WindowMaximized, IdleSwapInterval, ShowLuaConsole, ShowLuaInspector, ShowLuaEditor, ShowMainVRAMViewer,
156+
ShowCLUTVRAMViewer, ShowVRAMViewer1, ShowVRAMViewer2, ShowVRAMViewer3, ShowVRAMViewer4, ShowMemoryObserver,
157+
ShowTypedDebugger, ShowPatches, ShowMemcardManager, ShowRegisters, ShowAssembly, ShowDisassembly,
158+
ShowBreakpoints, ShowNamedSaveStates, ShowEvents, ShowHandlers, ShowKernelLog, ShowCallstacks, ShowSIO1,
159+
ShowIsoBrowser, ShowGPULogger, MainFontSize, MonoFontSize, GUITheme, AllowMouseCaptureToggle,
160+
EnableRawMouseMotion, WidescreenRatio, ShowPIOCartConfig, ShowMemoryEditor1, ShowMemoryEditor2,
161+
ShowMemoryEditor3, ShowMemoryEditor4, ShowMemoryEditor5, ShowMemoryEditor6, ShowMemoryEditor7,
162+
ShowMemoryEditor8, ShowParallelPortEditor, ShowScratchpadEditor, ShowHWRegsEditor, ShowBiosEditor,
163+
ShowVRAMEditor, MemoryEditor1Addr, MemoryEditor2Addr, MemoryEditor3Addr, MemoryEditor4Addr,
164+
MemoryEditor5Addr, MemoryEditor6Addr, MemoryEditor7Addr, MemoryEditor8Addr, ParallelPortEditorAddr,
165+
ScratchpadEditorAddr, HWRegsEditorAddr, BiosEditorAddr, VRAMEditorAddr>
166166
settings;
167167

168168
// imgui can't handle more than one "instance", so...

src/gui/widgets/callstacks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#include "core/callstacks.h"
2323
#include "core/psxemulator.h"
2424
#include "core/system.h"
25-
#include "supportpsx/memory.h"
2625
#include "fmt/format.h"
2726
#include "gui/gui.h"
2827
#include "imgui.h"
28+
#include "supportpsx/memory.h"
2929

3030
static void drawSymbol(uint32_t pc) {
3131
std::pair<const uint32_t, std::string>* symbol = PCSX::g_emulator->m_cpu->findContainingSymbol(pc);

src/mips/openbios/kernel/alloc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ _Static_assert(sizeof(allocated_block) == (2 * sizeof(void *)), "allocated_block
6767
static empty_block *user_heap_head = NULL;
6868
static empty_block *kern_heap_head = NULL;
6969

70-
static empty_block marker = { .next = NULL, .size = 0 };
70+
static empty_block marker = {.next = NULL, .size = 0};
7171

7272
enum heap { HEAP_USER, HEAP_KERNEL };
7373

@@ -137,7 +137,7 @@ static __attribute__((section(".ramtext"))) void multi_free(void *ptr_, const en
137137
empty_block *block = (empty_block *)ptr_;
138138
block--;
139139
size_t size = block->size;
140-
empty_block * const head = heap == HEAP_USER ? user_heap_head : kern_heap_head;
140+
empty_block *const head = heap == HEAP_USER ? user_heap_head : kern_heap_head;
141141

142142
if (head == &marker) {
143143
if (heap == HEAP_USER) {
@@ -218,7 +218,7 @@ static __attribute__((section(".ramtext"))) void *multi_realloc(void *ptr_, size
218218
return ptr_;
219219
}
220220

221-
empty_block * const head = heap == HEAP_USER ? user_heap_head : kern_heap_head;
221+
empty_block *const head = heap == HEAP_USER ? user_heap_head : kern_heap_head;
222222
if (head == &marker) {
223223
if (size < old_size) {
224224
empty_block *new_block = (empty_block *)((char *)block + size);
@@ -323,8 +323,8 @@ static __attribute__((section(".ramtext"))) void *multi_realloc(void *ptr_, size
323323
if (new_ptr == NULL) {
324324
return NULL;
325325
}
326-
uint32_t * src = (uint32_t *)ptr_;
327-
uint32_t * dst = (uint32_t *)new_ptr;
326+
uint32_t *src = (uint32_t *)ptr_;
327+
uint32_t *dst = (uint32_t *)new_ptr;
328328
uint32_t size_to_copy = old_size - sizeof(empty_block);
329329
while (size_to_copy > 0) {
330330
*dst++ = *src++;
@@ -340,7 +340,7 @@ __attribute__((section(".ramtext"))) void *user_realloc(void *ptr, size_t size)
340340
return multi_realloc(ptr, size, HEAP_USER);
341341
}
342342
__attribute__((section(".ramtext"))) void user_initheap(void *base, size_t size) {
343-
user_heap_head = (empty_block*)ALIGN_TO(base);
343+
user_heap_head = (empty_block *)ALIGN_TO(base);
344344
user_heap_head->next = &marker;
345345
user_heap_head->size = ALIGN_TO(size - sizeof(empty_block));
346346
}
@@ -351,7 +351,7 @@ __attribute__((section(".ramtext"))) void *kern_realloc(void *ptr, size_t size)
351351
return multi_realloc(ptr, size, HEAP_KERNEL);
352352
}
353353
__attribute__((section(".ramtext"))) void kern_initheap(void *base, size_t size) {
354-
kern_heap_head = (empty_block*)ALIGN_TO(base);
354+
kern_heap_head = (empty_block *)ALIGN_TO(base);
355355
kern_heap_head->next = &marker;
356356
kern_heap_head->size = ALIGN_TO(size - sizeof(empty_block));
357357
}

0 commit comments

Comments
 (0)