Skip to content

Commit e2039fa

Browse files
authored
Merge pull request #1050 from grumpycoders/chores-code-format
[Chores] Format code
2 parents 67179fa + 07974d0 commit e2039fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+859
-2066
lines changed

src/cdrom/cdriso.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,10 @@ uint8_t *PCSX::CDRIso::getBuffer() {
248248

249249
void PCSX::CDRIso::printTracks() {
250250
for (int i = 1; i <= m_numtracks; i++) {
251-
PCSX::g_system->printf(_("Track %.2d (%s) - Start %.2d:%.2d:%.2d, Length %.2d:%.2d:%.2d\n"), i,
252-
(m_ti[i].type == TrackType::DATA ? "DATA"
253-
: m_ti[i].cddatype == trackinfo::CCDDA ? "CZDA"
254-
: "CDDA"),
255-
m_ti[i].start.m, m_ti[i].start.s, m_ti[i].start.f, m_ti[i].length.m, m_ti[i].length.s,
256-
m_ti[i].length.f);
251+
PCSX::g_system->printf(
252+
_("Track %.2d (%s) - Start %.2d:%.2d:%.2d, Length %.2d:%.2d:%.2d\n"), i,
253+
(m_ti[i].type == TrackType::DATA ? "DATA" : m_ti[i].cddatype == trackinfo::CCDDA ? "CZDA" : "CDDA"),
254+
m_ti[i].start.m, m_ti[i].start.s, m_ti[i].start.f, m_ti[i].length.m, m_ti[i].length.s, m_ti[i].length.f);
257255
}
258256
}
259257

src/core/gpu.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,9 +1097,10 @@ void PCSX::GPU::Poly<shading, shape, textured, blend, modulation>::drawLogNode(u
10971097
ImGui::SameLine();
10981098
std::string label = fmt::format(f_("Go to texture##{}"), n);
10991099
if (ImGui::Button(label.c_str())) {
1100-
const auto mode = tpage.texDepth == TexDepth::Tex16Bits ? Events::GUI::VRAMFocus::VRAM_16BITS
1101-
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAMFocus::VRAM_8BITS
1102-
: Events::GUI::VRAMFocus::VRAM_4BITS;
1100+
const auto mode = tpage.texDepth == TexDepth::Tex16Bits
1101+
? Events::GUI::VRAMFocus::VRAM_16BITS
1102+
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAMFocus::VRAM_8BITS
1103+
: Events::GUI::VRAMFocus::VRAM_4BITS;
11031104
g_system->m_eventBus->signal(Events::GUI::SelectClut{clutX(), clutY()});
11041105
g_system->m_eventBus->signal(
11051106
Events::GUI::VRAMFocus{int(minU + tx), int(minV + ty), int(maxU + tx), int(maxV + ty), mode});
@@ -1193,9 +1194,10 @@ void PCSX::GPU::Rect<size, textured, blend, modulation>::drawLogNode(unsigned n)
11931194
ImGui::SameLine();
11941195
std::string label = fmt::format(f_("Go to texture##{}"), n);
11951196
if (ImGui::Button(label.c_str())) {
1196-
const auto mode = tpage.texDepth == TexDepth::Tex16Bits ? Events::GUI::VRAMFocus::VRAM_16BITS
1197-
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAMFocus::VRAM_8BITS
1198-
: Events::GUI::VRAMFocus::VRAM_4BITS;
1197+
const auto mode = tpage.texDepth == TexDepth::Tex16Bits
1198+
? Events::GUI::VRAMFocus::VRAM_16BITS
1199+
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAMFocus::VRAM_8BITS
1200+
: Events::GUI::VRAMFocus::VRAM_4BITS;
11991201
g_system->m_eventBus->signal(Events::GUI::SelectClut{clutX(), clutY()});
12001202
g_system->m_eventBus->signal(Events::GUI::VRAMFocus{int((u >> shift) + tx), int(v + ty),
12011203
int(((u + w) >> shift) + tx), int(v + h + ty), mode});

src/core/isoffi.lua

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,17 @@ end
8484

8585
local function createIsoBuilderWrapper(wrapper)
8686
local iso = {
87-
_wrapper = ffi.gc(wrapper, function(self) C.isoBuilderClose(self) C.deleteIsoBuilder(self) end),
87+
_wrapper = ffi.gc(wrapper, function(self)
88+
C.isoBuilderClose(self)
89+
C.deleteIsoBuilder(self)
90+
end),
8891
writeLicense = function(self, file)
8992
if not file then file = Support.File.failedFile() end
9093
C.isoBuilderWriteLicense(self._wrapper, file._wrapper)
9194
end,
9295
writeSector = function(self, sectorData, mode)
9396
if not mode then mode = 'M2_FORM1' end
94-
if Support.isLuaBuffer(sectorData) then
95-
sectorData = sectorData.data
96-
end
97+
if Support.isLuaBuffer(sectorData) then sectorData = sectorData.data end
9798
C.isoBuilderWriteSector(self._wrapper, sectorData, mode)
9899
end,
99100
close = function(self) C.isoBuilderClose(self._wrapper) end,
@@ -116,9 +117,7 @@ PCSX.isoTools = {
116117
local mul = 1
117118
while bcd ~= 0 do
118119
local digit = bcd % 16
119-
if digit >= 10 then
120-
error('Invalid BCD digit: ' .. digit)
121-
end
120+
if digit >= 10 then error('Invalid BCD digit: ' .. digit) end
122121
dec = dec + mul * digit
123122
mul = mul * 10
124123
bcd = math.floor(bcd / 16)
@@ -140,12 +139,8 @@ PCSX.isoTools = {
140139
m = PCSX.isoTools.fromBCD(m)
141140
s = PCSX.isoTools.fromBCD(s)
142141
f = PCSX.isoTools.fromBCD(f)
143-
if s >= 60 then
144-
error('Invalid MSF seconds: ' .. s)
145-
end
146-
if f >= 75 then
147-
error('Invalid MSF frames: ' .. f)
148-
end
142+
if s >= 60 then error('Invalid MSF seconds: ' .. s) end
143+
if f >= 75 then error('Invalid MSF frames: ' .. f) end
149144
return (m * 60 + s) * 75 + f - 150
150145
end,
151146
toMSF = function(lba)

src/core/logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ enum class LogClass : unsigned {
5353
template <LogClass logClass, bool enabled>
5454
struct Logger {
5555
template <typename... Args>
56-
static void Log(const char *format, const Args &...args) {
56+
static void Log(const char *format, const Args &... args) {
5757
if (!enabled) return;
5858
std::string s = fmt::sprintf(format, args...);
5959
g_system->log(logClass, std::move(s));

src/core/pad.cc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,8 @@ void PadsImpl::setLua(PCSX::Lua L) {
13031303
L.getfieldtable(1);
13041304

13051305
L.declareFunc(
1306-
"getButton", [this, pad](PCSX::Lua L) -> int {
1306+
"getButton",
1307+
[this, pad](PCSX::Lua L) -> int {
13071308
int n = L.gettop();
13081309
if (n == 0) {
13091310
return L.error("Not enough arguments to getButton");
@@ -1316,9 +1317,11 @@ void PadsImpl::setLua(PCSX::Lua L) {
13161317
unsigned button = L.checknumber(1);
13171318
L.push(((overrides & buttons) & (1 << button)) == 0);
13181319
return 1;
1319-
}, -1);
1320+
},
1321+
-1);
13201322
L.declareFunc(
1321-
"setOverride", [this, pad](PCSX::Lua L) -> int {
1323+
"setOverride",
1324+
[this, pad](PCSX::Lua L) -> int {
13221325
int n = L.gettop();
13231326
if (n == 0) {
13241327
return L.error("Not enough arguments to setOverride");
@@ -1331,9 +1334,11 @@ void PadsImpl::setLua(PCSX::Lua L) {
13311334
button = 1 << button;
13321335
overrides &= ~button;
13331336
return 0;
1334-
}, -1);
1337+
},
1338+
-1);
13351339
L.declareFunc(
1336-
"clearOverride", [this, pad](PCSX::Lua L) -> int {
1340+
"clearOverride",
1341+
[this, pad](PCSX::Lua L) -> int {
13371342
int n = L.gettop();
13381343
if (n == 0) {
13391344
return L.error("Not enough arguments to clearOverride");
@@ -1346,22 +1351,27 @@ void PadsImpl::setLua(PCSX::Lua L) {
13461351
button = 1 << button;
13471352
overrides |= button;
13481353
return 0;
1349-
}, -1);
1354+
},
1355+
-1);
13501356
L.declareFunc(
1351-
"setAnalogMode", [this, pad](PCSX::Lua L) -> int {
1357+
"setAnalogMode",
1358+
[this, pad](PCSX::Lua L) -> int {
13521359
int n = L.gettop();
13531360
if (n == 0) {
13541361
m_pads[pad].m_analogMode = false;
13551362
} else {
13561363
m_pads[pad].m_analogMode = L.toboolean();
13571364
}
13581365
return 0;
1359-
}, -1);
1366+
},
1367+
-1);
13601368
L.declareFunc(
1361-
"map", [this, pad](PCSX::Lua L) -> int {
1369+
"map",
1370+
[this, pad](PCSX::Lua L) -> int {
13621371
m_pads[pad].map();
13631372
return 0;
1364-
}, -1);
1373+
},
1374+
-1);
13651375

13661376
L.pop();
13671377
L.pop();

src/core/pcsxffi.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ PCSX = {
195195
GPU = {
196196
takeScreenShot = function()
197197
local ss = C.takeScreenShot()
198-
return { data = Support.File._createSliceWrapper(ss.data), width = ss.width, height = ss.height, bpp = ss.bpp }
198+
return {
199+
data = Support.File._createSliceWrapper(ss.data),
200+
width = ss.width,
201+
height = ss.height,
202+
bpp = ss.bpp,
203+
}
199204
end,
200205
},
201206
createSaveState = function()

src/core/pio-cart.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ namespace PCSX {
3131

3232
class PIOCart {
3333
public:
34-
PIOCart() : m_pal(this) {
35-
memset(m_detachedMemory, 0xff, sizeof(m_detachedMemory));
36-
}
34+
PIOCart() : m_pal(this) { memset(m_detachedMemory, 0xff, sizeof(m_detachedMemory)); }
3735

3836
void setLuts();
3937

src/core/psxemulator.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ class Emulator {
186186
typedef SettingPath<TYPESTRING("EXP1BrowsePath")> SettingEXP1BrowsePath;
187187
typedef Setting<bool, TYPESTRING("PIOConnected")> SettingPIOConnected;
188188

189-
Settings<SettingMcd1, SettingMcd2, SettingBios, SettingPpfDir, SettingPsxExe,
190-
SettingXa, SettingSpuIrq, SettingBnWMdec, SettingScaler, SettingAutoVideo, SettingVideo, SettingFastBoot,
191-
SettingDebugSettings, SettingRCntFix, SettingIsoPath, SettingLocale, SettingMcd1Inserted,
192-
SettingMcd2Inserted, SettingDynarec, Setting8MB,SettingGUITheme, SettingDither, SettingCachedDithering,
193-
SettingGLErrorReporting, SettingGLErrorReportingSeverity, SettingFullCaching, SettingHardwareRenderer,
194-
SettingShownAutoUpdateConfig, SettingAutoUpdate, SettingMSAA, SettingLinearFiltering, SettingKioskMode,
195-
SettingMcd1Pocketstation, SettingMcd2Pocketstation, SettingBiosBrowsePath, SettingEXP1Filepath,
196-
SettingEXP1BrowsePath, SettingPIOConnected>
189+
Settings<SettingMcd1, SettingMcd2, SettingBios, SettingPpfDir, SettingPsxExe, SettingXa, SettingSpuIrq,
190+
SettingBnWMdec, SettingScaler, SettingAutoVideo, SettingVideo, SettingFastBoot, SettingDebugSettings,
191+
SettingRCntFix, SettingIsoPath, SettingLocale, SettingMcd1Inserted, SettingMcd2Inserted, SettingDynarec,
192+
Setting8MB, SettingGUITheme, SettingDither, SettingCachedDithering, SettingGLErrorReporting,
193+
SettingGLErrorReportingSeverity, SettingFullCaching, SettingHardwareRenderer, SettingShownAutoUpdateConfig,
194+
SettingAutoUpdate, SettingMSAA, SettingLinearFiltering, SettingKioskMode, SettingMcd1Pocketstation,
195+
SettingMcd2Pocketstation, SettingBiosBrowsePath, SettingEXP1Filepath, SettingEXP1BrowsePath,
196+
SettingPIOConnected>
197197
settings;
198198
class PcsxConfig {
199199
public:

src/core/psxmem.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ void PCSX::Memory::write32(uint32_t address, uint32_t value) {
548548
address);
549549
} else {
550550
g_system->log(LogClass::CPU, _("32-bit write to unknown address: %8.8lx\n"), address);
551-
if (g_emulator->settings.get<Emulator::SettingDebugSettings>().get<Emulator::DebugSettings::Debug>()) {
551+
if (g_emulator->settings.get<Emulator::SettingDebugSettings>()
552+
.get<Emulator::DebugSettings::Debug>()) {
552553
g_system->pause();
553554
}
554555
}

src/core/psxmem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ class Memory {
192192

193193
// hopefully this should become private eventually, with only certain classes having direct access.
194194
public:
195-
196195
uint8_t *m_wram = nullptr; // Kernel & User Memory (8 Meg)
197196
uint8_t *m_exp1 = nullptr; // Expansion Region 1 (ROM/RAM) / Parallel Port (512K)
198197
uint8_t *m_bios = nullptr; // BIOS ROM (512K)

0 commit comments

Comments
 (0)