Skip to content

Commit ddfb42b

Browse files
authored
Merge pull request #1548 from grumpycoders/chores-code-format
[Chores] Format code
2 parents 194f0cd + 5c63a22 commit ddfb42b

File tree

7 files changed

+40
-55
lines changed

7 files changed

+40
-55
lines changed

src/core/debug.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void PCSX::Debug::checkBP(uint32_t address, BreakpointType type, uint32_t width,
258258
auto it = torun.begin();
259259
auto bp = &*it;
260260
torun.erase(it);
261-
if (!triggerBP(bp, address, width, cause)) delete bp;
261+
if (!triggerBP(bp, address, width, cause)) delete bp;
262262
}
263263
}
264264

src/lua/extra.lua

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,21 @@
1717
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1818
Support.extra = {
1919

20-
loadfile = function(name)
21-
return loadstring(Support._internal.loadfile(name), '@' .. name)
22-
end,
20+
loadfile = function(name) return loadstring(Support._internal.loadfile(name), '@' .. name) end,
2321

2422
dofile = function(name)
2523
local func, msg = loadstring(Support._internal.loadfile(name), '@' .. name)
2624
if func then return func() end
2725
error(msg)
2826
end,
2927

30-
open = function(name)
31-
return Support.File._createFileWrapper(ffi.cast('LuaFile*', Support._internal.open(name)))
32-
end,
28+
open = function(name) return Support.File._createFileWrapper(ffi.cast('LuaFile*', Support._internal.open(name))) end,
3329

3430
safeFFI = function(name, func, ...)
3531
local status, ret = pcall(func, ...)
3632
if status then return ret end
3733
error('FFI call failed in ' .. name .. ': ' .. ret)
38-
end
34+
end,
3935

4036
}
4137
-- )EOF"

src/lua/fileffi.lua

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ local C = ffi.load 'SUPPORT_FILE'
2020
local function validateBuffer(buffer)
2121
if buffer:maxsize() < buffer.size then
2222
error('Invalid or corrupted LuaBuffer: claims size of ' .. buffer.size .. ' but actual size is ' ..
23-
buffer:maxsize())
23+
buffer:maxsize())
2424
end
2525
return buffer
2626
end
@@ -33,7 +33,8 @@ local function read(self, ptr, size)
3333
buf.size = size
3434
return validateBuffer(buf)
3535
elseif type(ptr) == 'cdata' and size == nil and ffi.typeof(ptr) == Support.File._LuaBuffer then
36-
return Support.extra.safeFFI('File::read(C.readFileBuffer)', C.readFileBuffer, self._wrapper, validateBuffer(ptr))
36+
return Support.extra.safeFFI('File::read(C.readFileBuffer)', C.readFileBuffer, self._wrapper,
37+
validateBuffer(ptr))
3738
elseif type(ptr) == 'userdata' and size == nil then
3839
return Support._internal.readFileUserData(self._wrapper, ptr)
3940
end
@@ -49,7 +50,8 @@ local function readAt(self, ptr, size, pos)
4950
buf.size = size
5051
return validateBuffer(buf)
5152
elseif type(ptr) == 'cdata' and type(size) == 'number' and pos == nil and ffi.typeof(ptr) == LuaBuffer then
52-
return Support.extra.safeFFI('File::readAt(C.readFileAtBuffer)', C.readFileAtBuffer, self._wrapper, validateBuffer(ptr), size)
53+
return Support.extra.safeFFI('File::readAt(C.readFileAtBuffer)', C.readFileAtBuffer, self._wrapper,
54+
validateBuffer(ptr), size)
5355
elseif type(ptr) == 'userdata' and type(size) == 'number' and pos == nil then
5456
return Support._internal.readFileAtUserData(self._wrapper, ptr, size)
5557
end
@@ -58,26 +60,31 @@ end
5860

5961
local function write(self, data, size)
6062
if type(data) == 'cdata' and size == nil and ffi.typeof(data) == LuaBuffer then
61-
return Support.extra.safeFFI('File::write(C.writeFileBuffer)', C.writeFileBuffer, self._wrapper, validateBuffer(data))
63+
return Support.extra.safeFFI('File::write(C.writeFileBuffer)', C.writeFileBuffer, self._wrapper,
64+
validateBuffer(data))
6265
elseif type(data) == 'userdata' and size == nil then
6366
return Support._internal.writeFileUserData(self._wrapper, data)
6467
elseif type(size) == 'number' then
6568
return Support.extra.safeFFI('File::write(C.writeFileRawPtr)', C.writeFileRawPtr, self._wrapper, data, size)
6669
end
6770
if type(data) ~= 'string' then data = tostring(data) end
68-
return Support.extra.safeFFI('File::write(C.writeFileRawPtr)', C.writeFileRawPtr, self._wrapper, data, string.len(data))
71+
return Support.extra.safeFFI('File::write(C.writeFileRawPtr)', C.writeFileRawPtr, self._wrapper, data,
72+
string.len(data))
6973
end
7074

7175
local function writeAt(self, data, size, pos)
7276
if type(data) == 'cdata' and type(size) == 'number' and pos == nil and ffi.typeof(data) == LuaBuffer then
73-
return Support.extra.safeFFI('File::writeAt(C.writeFileAtBuffer)', C.writeFileAtBuffer, self._wrapper, validateBuffer(data), size)
77+
return Support.extra.safeFFI('File::writeAt(C.writeFileAtBuffer)', C.writeFileAtBuffer, self._wrapper,
78+
validateBuffer(data), size)
7479
elseif type(data) == 'userdata' and type(size) == 'number' and pos == nil then
7580
return Support._internal.writeFileAtUserData(self._wrapper, data, size)
7681
elseif type(size) == 'number' and type(pos) == 'number' then
77-
return Support.extra.safeFFI('File::writeAt(C.writeFileAtRawPtr)', C.writeFileAtRawPtr, self._wrapper, data, size, pos)
82+
return Support.extra.safeFFI('File::writeAt(C.writeFileAtRawPtr)', C.writeFileAtRawPtr, self._wrapper, data,
83+
size, pos)
7884
end
7985
if type(data) ~= 'string' then data = tostring(data) end
80-
return Support.extra.safeFFI('File::writeAt(C.writeFileAtRawPtr)', C.writeFileAtRawPtr, self._wrapper, data, string.len(data), size)
86+
return Support.extra.safeFFI('File::writeAt(C.writeFileAtRawPtr)', C.writeFileAtRawPtr, self._wrapper, data,
87+
string.len(data), size)
8188
end
8289

8390
local function writeMoveSlice(self, slice) C.writeFileMoveSlice(self._wrapper, slice._wrapper) end
@@ -157,9 +164,7 @@ local int16_t = ffi.typeof 'int16_t[1]'
157164
local int32_t = ffi.typeof 'int32_t[1]'
158165
local int64_t = ffi.typeof 'int64_t[1]'
159166

160-
local function deleteFile(wrapper)
161-
Support.extra.safeFFI('File::~File', C.deleteFile, wrapper)
162-
end
167+
local function deleteFile(wrapper) Support.extra.safeFFI('File::~File', C.deleteFile, wrapper) end
163168

164169
local function createFileWrapper(wrapper)
165170
local file = {
@@ -295,9 +300,10 @@ end
295300
local function ffmpegAudioFile(file, options)
296301
if type(options) ~= 'table' then options = {} end
297302
local channels, endianness, sampleFormat, frequency = options.channels, options.endianness, options.sampleFormat,
298-
options.frequency
299-
return createFileWrapper(Support.extra.safeFFI('Support.File.ffmpegAudioFile', C.ffmpegAudioFile, file._wrapper, channels or 'Stereo', endianness or 'Little',
300-
sampleFormat or 'S16', frequency or 44100))
303+
options.frequency
304+
return createFileWrapper(Support.extra.safeFFI('Support.File.ffmpegAudioFile', C.ffmpegAudioFile, file._wrapper,
305+
channels or 'Stereo', endianness or 'Little', sampleFormat or 'S16',
306+
frequency or 44100))
301307
end
302308

303309
if (type(Support) ~= 'table') then Support = {} end

src/main/main.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,10 @@ int pcsxMain(int argc, char **argv) {
333333
bool luacovEnabled = false;
334334
if (args.get<bool>("luacov")) {
335335
auto L = *emulator->m_lua;
336-
L.load("package.path = package.path .. ';./lua_modules/share/lua/5.1/?.lua;../../../third_party/luacov/src/?.lua;./third_party/luacov/src/?.lua'",
337-
"internal:package.path.lua");
336+
L.load(
337+
"package.path = package.path .. "
338+
"';./lua_modules/share/lua/5.1/?.lua;../../../third_party/luacov/src/?.lua;./third_party/luacov/src/?.lua'",
339+
"internal:package.path.lua");
338340
try {
339341
L.load(R"(
340342
local runner = require 'luacov.runner'

src/mips/common/crt0/memory-c.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ SOFTWARE.
2424
2525
*/
2626

27-
#include <stdint.h>
2827
#include <stddef.h>
28+
#include <stdint.h>
2929

3030
// These are the 4 essential functions expected by gcc for a naked build.
3131
// The implementation of memcpy is in memory-s.s, and the rest are here.
@@ -87,4 +87,3 @@ __attribute__((weak)) void* memset(void* s_, int c, size_t n) {
8787

8888
return s_;
8989
}
90-

src/support/typestring-wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SOFTWARE.
2828

2929
#include "typestring.hh"
3030

31-
#if defined(_MSC_VER) // && !defined(__clang__)
31+
#if defined(_MSC_VER) // && !defined(__clang__)
3232
#define TYPESTRING_MAX_CONST_CHAR 63
3333

3434
#define TYPESTRING_MIN(a, b) (a) < (b) ? (a) : (b)

src/supportpsx/adpcmffi.lua

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,8 @@ PCSX.Adpcm = {
7979
channels = outData
8080
outData = nil
8181
end
82-
if outData == nil then
83-
outData = Support.NewLuaBuffer(56)
84-
end
85-
if channels == nil then
86-
channels = 1
87-
end
82+
if outData == nil then outData = Support.NewLuaBuffer(56) end
83+
if channels == nil then channels = 1 end
8884
local inp = inData
8985
local out = outData
9086
if Support.isLuaBuffer(inp) then
@@ -109,12 +105,8 @@ PCSX.Adpcm = {
109105
blockAttribute = outData
110106
outData = nil
111107
end
112-
if outData == nil then
113-
outData = Support.NewLuaBuffer(16)
114-
end
115-
if blockAttribute == nil then
116-
blockAttribute = 'OneShot'
117-
end
108+
if outData == nil then outData = Support.NewLuaBuffer(16) end
109+
if blockAttribute == nil then blockAttribute = 'OneShot' end
118110
local inp = inData
119111
local out = outData
120112
if Support.isLuaBuffer(inp) then
@@ -135,13 +127,9 @@ PCSX.Adpcm = {
135127
return outData
136128
end,
137129
finishSPU = function(self, outData)
138-
if outData == nil then
139-
outData = Support.NewLuaBuffer(16)
140-
end
130+
if outData == nil then outData = Support.NewLuaBuffer(16) end
141131
local out = outData
142-
if Support.isLuaBuffer(out) then
143-
out = out.data
144-
end
132+
if Support.isLuaBuffer(out) then out = out.data end
145133
C.adpcmEncoderFinishSPU(self._wrapped, out)
146134
return outData
147135
end,
@@ -158,15 +146,9 @@ PCSX.Adpcm = {
158146
channels = mode
159147
mode = nil
160148
end
161-
if outData == nil then
162-
outData = Support.NewLuaBuffer(128)
163-
end
164-
if mode == nil then
165-
mode = 'XAFourBits'
166-
end
167-
if channels == nil then
168-
channels = 1
169-
end
149+
if outData == nil then outData = Support.NewLuaBuffer(128) end
150+
if mode == nil then mode = 'XAFourBits' end
151+
if channels == nil then channels = 1 end
170152
local inp = inData
171153
local out = outData
172154
if Support.isLuaBuffer(inp) then
@@ -190,7 +172,7 @@ PCSX.Adpcm = {
190172
}
191173
debug.setmetatable(encoder._proxy, { __gc = function() C.destroyAdpcmEncoder(encoder._wrapped) end })
192174
return encoder
193-
end
175+
end,
194176
}
195177

196178
-- )EOF"

0 commit comments

Comments
 (0)