Skip to content

[Chores] Format code #1886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/lua/extra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "lua-protobuf/pb.h"
#include "lua/luafile.h"
#include "lua/luawrapper.h"
#include "support/djbhash.h"
#include "support/file.h"
#include "support/strings-helpers.h"
#include "support/djbhash.h"
#include "support/zip.h"

namespace {
Expand Down Expand Up @@ -82,9 +82,7 @@ PCSX::File* load(std::string_view name, std::string_view from, bool inArchives =
return new PCSX::PosixFile(absolutePath);
}

uint64_t djbHash(const char* str, size_t len) {
return PCSX::djb::hash(str, len);
}
uint64_t djbHash(const char* str, size_t len) { return PCSX::djb::hash(str, len); }

template <typename T, size_t S>
void registerSymbol(PCSX::Lua L, const char (&name)[S], const T ptr) {
Expand Down
5 changes: 1 addition & 4 deletions src/lua/extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
-- along with this program; if not, write to the
-- Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

ffi.cdef [[
uint64_t djbHash(const char* str, size_t len);
]]
Expand All @@ -40,8 +39,6 @@ Support.extra = {
error('FFI call failed in ' .. name .. ': ' .. ret)
end,

djbHash = function(str)
return C.djbHash(str, #str)
end,
djbHash = function(str) return C.djbHash(str, #str) end,
}
-- )EOF"
30 changes: 15 additions & 15 deletions src/lua/fileffi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local C = ffi.load 'SUPPORT_FILE'
local function validateBuffer(buffer)
if buffer:maxsize() < buffer.size then
error('Invalid or corrupted LuaBuffer: claims size of ' .. buffer.size .. ' but actual size is ' ..
buffer:maxsize())
buffer:maxsize())
end
return buffer
end
Expand All @@ -34,19 +34,19 @@ local function read(self, ptr, size)
return validateBuffer(buf)
elseif type(ptr) == 'cdata' and size == nil and ffi.typeof(ptr) == Support.File._LuaBuffer then
return Support.extra.safeFFI('File::read(C.readFileBuffer)', C.readFileBuffer, self._wrapper,
validateBuffer(ptr))
validateBuffer(ptr))
elseif type(ptr) == 'userdata' and size == nil then
return Support._internal.readFileUserData(self._wrapper, ptr)
elseif type(ptr) == 'table' and ptr._type == 'Slice' then
return Support.extra.safeFFI('File::read(C.readFileToExistingSlice)', C.readFileToExistingSlice, self._wrapper,
ptr._wrapper, size or ptr:size())
ptr._wrapper, size or ptr:size())
end
return Support.extra.safeFFI('File::read(C.readFileRawPtr)', C.readFileRawPtr, self._wrapper, ptr, size)
end

local function readToSlice(self, size)
return Support.File._createSliceWrapper(Support.extra.safeFFI('File::read(C.readFileToSlice)', C.readFileToSlice,
self._wrapper, size))
self._wrapper, size))
end

local function readAt(self, ptr, size, pos)
Expand All @@ -59,48 +59,48 @@ local function readAt(self, ptr, size, pos)
return validateBuffer(buf)
elseif type(ptr) == 'cdata' and type(size) == 'number' and pos == nil and ffi.typeof(ptr) == LuaBuffer then
return Support.extra.safeFFI('File::readAt(C.readFileAtBuffer)', C.readFileAtBuffer, self._wrapper,
validateBuffer(ptr), size)
validateBuffer(ptr), size)
elseif type(ptr) == 'userdata' and type(size) == 'number' and pos == nil then
return Support._internal.readFileAtUserData(self._wrapper, ptr, size)
elseif type(ptr) == 'table' and ptr._type == 'Slice' then
return Support.extra.safeFFI('File::readAt(C.readFileAtToExistingSlice)', C.readFileAtToExistingSlice,
self._wrapper, ptr._wrapper, size or ptr:size(), pos)
self._wrapper, ptr._wrapper, size or ptr:size(), pos)
end
return Support.extra.safeFFI('File::readAt(C.readFileAtRawPtr)', C.readFileAtRawPtr, self._wrapper, ptr, size, pos)
end

local function readAtToSlice(self, size, pos)
return Support.File._createSliceWrapper(Support.extra.safeFFI('File::readAt(C.readFileAtToSlice)',
C.readFileAtToSlice, self._wrapper, size, pos))
C.readFileAtToSlice, self._wrapper, size, pos))
end

local function write(self, data, size)
if type(data) == 'cdata' and size == nil and ffi.typeof(data) == LuaBuffer then
return Support.extra.safeFFI('File::write(C.writeFileBuffer)', C.writeFileBuffer, self._wrapper,
validateBuffer(data))
validateBuffer(data))
elseif type(data) == 'userdata' and size == nil then
return Support._internal.writeFileUserData(self._wrapper, data)
elseif type(size) == 'number' then
return Support.extra.safeFFI('File::write(C.writeFileRawPtr)', C.writeFileRawPtr, self._wrapper, data, size)
end
if type(data) ~= 'string' then data = tostring(data) end
return Support.extra.safeFFI('File::write(C.writeFileRawPtr)', C.writeFileRawPtr, self._wrapper, data,
string.len(data))
string.len(data))
end

local function writeAt(self, data, size, pos)
if type(data) == 'cdata' and type(size) == 'number' and pos == nil and ffi.typeof(data) == LuaBuffer then
return Support.extra.safeFFI('File::writeAt(C.writeFileAtBuffer)', C.writeFileAtBuffer, self._wrapper,
validateBuffer(data), size)
validateBuffer(data), size)
elseif type(data) == 'userdata' and type(size) == 'number' and pos == nil then
return Support._internal.writeFileAtUserData(self._wrapper, data, size)
elseif type(size) == 'number' and type(pos) == 'number' then
return Support.extra.safeFFI('File::writeAt(C.writeFileAtRawPtr)', C.writeFileAtRawPtr, self._wrapper, data,
size, pos)
size, pos)
end
if type(data) ~= 'string' then data = tostring(data) end
return Support.extra.safeFFI('File::writeAt(C.writeFileAtRawPtr)', C.writeFileAtRawPtr, self._wrapper, data,
string.len(data), size)
string.len(data), size)
end

local function writeMoveSlice(self, slice) C.writeFileMoveSlice(self._wrapper, slice._wrapper) end
Expand Down Expand Up @@ -319,10 +319,10 @@ end
local function ffmpegAudioFile(file, options)
if type(options) ~= 'table' then options = {} end
local channels, endianness, sampleFormat, frequency = options.channels, options.endianness, options.sampleFormat,
options.frequency
options.frequency
return createFileWrapper(Support.extra.safeFFI('Support.File.ffmpegAudioFile', C.ffmpegAudioFile, file._wrapper,
channels or 'Stereo', endianness or 'Little', sampleFormat or 'S16',
frequency or 44100))
channels or 'Stereo', endianness or 'Little', sampleFormat or 'S16',
frequency or 44100))
end

if (type(Support) ~= 'table') then Support = {} end
Expand Down
4 changes: 1 addition & 3 deletions src/lua/fileffimeta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ local sliceMeta = {
elseif index == 'size' then
return tonumber(C.getSliceSize(slice._wrapper))
elseif index == 'resize' then
return function(slice, size)
C.resizeSlice(slice._wrapper, size)
end
return function(slice, size) C.resizeSlice(slice._wrapper, size) end
end
error('Unknown index `' .. index .. '` for LuaSlice')
end,
Expand Down
1 change: 1 addition & 0 deletions src/mips/common/hardware/sio.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SOFTWARE.
#pragma once

#include <stdint.h>

#include "common/hardware/irq.h"

struct SIOPort {
Expand Down
130 changes: 65 additions & 65 deletions src/mips/common/psxlibc/fastmemset.s
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fastMemset:
addu $a2, $a0
addiu $a2, -1
small_memset_loop:
sb $a1, 0($a0)
sb $a1, 0($a0)
bne $a0, $a2, small_memset_loop
addiu $a0, 1
jr $ra
Expand Down Expand Up @@ -95,70 +95,70 @@ t1 - the remainder counter to store

big_loop:
addiu $t0, -1
sw $a1, 0x0000($a0)
sw $a1, 0x0004($a0)
sw $a1, 0x0008($a0)
sw $a1, 0x000c($a0)
sw $a1, 0x0010($a0)
sw $a1, 0x0014($a0)
sw $a1, 0x0018($a0)
sw $a1, 0x001c($a0)
sw $a1, 0x0020($a0)
sw $a1, 0x0024($a0)
sw $a1, 0x0028($a0)
sw $a1, 0x002c($a0)
sw $a1, 0x0030($a0)
sw $a1, 0x0034($a0)
sw $a1, 0x0038($a0)
sw $a1, 0x003c($a0)
sw $a1, 0x0040($a0)
sw $a1, 0x0044($a0)
sw $a1, 0x0048($a0)
sw $a1, 0x004c($a0)
sw $a1, 0x0050($a0)
sw $a1, 0x0054($a0)
sw $a1, 0x0058($a0)
sw $a1, 0x005c($a0)
sw $a1, 0x0060($a0)
sw $a1, 0x0064($a0)
sw $a1, 0x0068($a0)
sw $a1, 0x006c($a0)
sw $a1, 0x0070($a0)
sw $a1, 0x0074($a0)
sw $a1, 0x0078($a0)
sw $a1, 0x007c($a0)
sw $a1, 0x0080($a0)
sw $a1, 0x0084($a0)
sw $a1, 0x0088($a0)
sw $a1, 0x008c($a0)
sw $a1, 0x0090($a0)
sw $a1, 0x0094($a0)
sw $a1, 0x0098($a0)
sw $a1, 0x009c($a0)
sw $a1, 0x00a0($a0)
sw $a1, 0x00a4($a0)
sw $a1, 0x00a8($a0)
sw $a1, 0x00ac($a0)
sw $a1, 0x00b0($a0)
sw $a1, 0x00b4($a0)
sw $a1, 0x00b8($a0)
sw $a1, 0x00bc($a0)
sw $a1, 0x00c0($a0)
sw $a1, 0x00c4($a0)
sw $a1, 0x00c8($a0)
sw $a1, 0x00cc($a0)
sw $a1, 0x00d0($a0)
sw $a1, 0x00d4($a0)
sw $a1, 0x00d8($a0)
sw $a1, 0x00dc($a0)
sw $a1, 0x00e0($a0)
sw $a1, 0x00e4($a0)
sw $a1, 0x00e8($a0)
sw $a1, 0x00ec($a0)
sw $a1, 0x00f0($a0)
sw $a1, 0x00f4($a0)
sw $a1, 0x00f8($a0)
sw $a1, 0x00fc($a0)
sw $a1, 0x0000($a0)
sw $a1, 0x0004($a0)
sw $a1, 0x0008($a0)
sw $a1, 0x000c($a0)
sw $a1, 0x0010($a0)
sw $a1, 0x0014($a0)
sw $a1, 0x0018($a0)
sw $a1, 0x001c($a0)
sw $a1, 0x0020($a0)
sw $a1, 0x0024($a0)
sw $a1, 0x0028($a0)
sw $a1, 0x002c($a0)
sw $a1, 0x0030($a0)
sw $a1, 0x0034($a0)
sw $a1, 0x0038($a0)
sw $a1, 0x003c($a0)
sw $a1, 0x0040($a0)
sw $a1, 0x0044($a0)
sw $a1, 0x0048($a0)
sw $a1, 0x004c($a0)
sw $a1, 0x0050($a0)
sw $a1, 0x0054($a0)
sw $a1, 0x0058($a0)
sw $a1, 0x005c($a0)
sw $a1, 0x0060($a0)
sw $a1, 0x0064($a0)
sw $a1, 0x0068($a0)
sw $a1, 0x006c($a0)
sw $a1, 0x0070($a0)
sw $a1, 0x0074($a0)
sw $a1, 0x0078($a0)
sw $a1, 0x007c($a0)
sw $a1, 0x0080($a0)
sw $a1, 0x0084($a0)
sw $a1, 0x0088($a0)
sw $a1, 0x008c($a0)
sw $a1, 0x0090($a0)
sw $a1, 0x0094($a0)
sw $a1, 0x0098($a0)
sw $a1, 0x009c($a0)
sw $a1, 0x00a0($a0)
sw $a1, 0x00a4($a0)
sw $a1, 0x00a8($a0)
sw $a1, 0x00ac($a0)
sw $a1, 0x00b0($a0)
sw $a1, 0x00b4($a0)
sw $a1, 0x00b8($a0)
sw $a1, 0x00bc($a0)
sw $a1, 0x00c0($a0)
sw $a1, 0x00c4($a0)
sw $a1, 0x00c8($a0)
sw $a1, 0x00cc($a0)
sw $a1, 0x00d0($a0)
sw $a1, 0x00d4($a0)
sw $a1, 0x00d8($a0)
sw $a1, 0x00dc($a0)
sw $a1, 0x00e0($a0)
sw $a1, 0x00e4($a0)
sw $a1, 0x00e8($a0)
sw $a1, 0x00ec($a0)
sw $a1, 0x00f0($a0)
sw $a1, 0x00f4($a0)
sw $a1, 0x00f8($a0)
sw $a1, 0x00fc($a0)
bnez $t0, big_loop
addiu $a0, 0x0100

Expand Down
9 changes: 3 additions & 6 deletions src/mips/openbios/sio0/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ int __attribute__((section(".ramtext"))) mcReadHandler() {
switch (g_mcOperation) {
case 1:
g_sio0Mask = port == 0 ? 0x0000 : SIO_CTRL_PORTSEL;
SIOS[0].ctrl = g_sio0Mask | SIO_CTRL_TXEN | SIO_CTRL_ACKIRQEN
| SIO_CTRL_DTR;
SIOS[0].ctrl = g_sio0Mask | SIO_CTRL_TXEN | SIO_CTRL_ACKIRQEN | SIO_CTRL_DTR;
exchangeByte((g_mcDeviceId[port] & 0x0f) + 0x81);
g_mcActionInProgress = 1;
break;
Expand Down Expand Up @@ -176,8 +175,7 @@ int __attribute__((section(".ramtext"))) mcWriteHandler() {
switch (g_mcOperation) {
case 1:
g_sio0Mask = port == 0 ? 0x0000 : SIO_CTRL_PORTSEL;
SIOS[0].ctrl = g_sio0Mask | SIO_CTRL_TXEN | SIO_CTRL_ACKIRQEN
| SIO_CTRL_DTR;
SIOS[0].ctrl = g_sio0Mask | SIO_CTRL_TXEN | SIO_CTRL_ACKIRQEN | SIO_CTRL_DTR;
exchangeByte((g_mcDeviceId[port] & 0x0f) + 0x81);
g_mcActionInProgress = 1;
break;
Expand Down Expand Up @@ -249,8 +247,7 @@ int __attribute__((section(".ramtext"))) mcInfoHandler() {
switch (g_mcOperation) {
case 1:
g_sio0Mask = port == 0 ? 0x0000 : SIO_CTRL_PORTSEL;
SIOS[0].ctrl = g_sio0Mask | SIO_CTRL_TXEN | SIO_CTRL_ACKIRQEN
| SIO_CTRL_DTR;
SIOS[0].ctrl = g_sio0Mask | SIO_CTRL_TXEN | SIO_CTRL_ACKIRQEN | SIO_CTRL_DTR;
exchangeByte((g_mcDeviceId[port] & 0x0f) + 0x81);
g_mcActionInProgress = 1;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/mips/openbios/sio0/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static void __attribute__((section(".ramtext"))) firstStageCardAction() {
sysDeqIntRP(1, &g_mcHandlerInfo);
SIOS[0].ctrl = SIO_CTRL_IR;
SIOS[0].baudRate = 2073600 / 15200;
SIOS[0].mode = 13; // MUL1, 8bit, no parity, normal polarity
SIOS[0].mode = 13; // MUL1, 8bit, no parity, normal polarity
SIOS[0].ctrl = 0;
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/mips/psyqo-paths/archive-manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ class ArchiveManager {
uint32_t indexSize = (getIndexCount() + 1) * sizeof(IndexEntry);
return (indexSize + 2047) / 2048;
}
static eastl::array<void (ArchiveManager::*)(const IndexEntry *), toUnderlying(IndexEntry::Method::COUNT)> s_decompressors;
static eastl::array<void (ArchiveManager::*)(const IndexEntry *), toUnderlying(IndexEntry::Method::COUNT)>
s_decompressors;
void decompressUCL_NRV2E(const IndexEntry *entry);
void decompressLZ4(const IndexEntry *entry);
};
Expand Down
4 changes: 1 addition & 3 deletions src/mips/psyqo-paths/cdrom-loader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ class CDRomLoader {
setupQueue(path, parser, {});
return m_queue.schedule();
}
ReadFileAwaiter readFile(eastl::string_view path, ISO9660Parser &parser) {
return {path, parser, *this};
}
ReadFileAwaiter readFile(eastl::string_view path, ISO9660Parser &parser) { return {path, parser, *this}; }

private:
void setupQueue(eastl::string_view path, ISO9660Parser &parser,
Expand Down
9 changes: 4 additions & 5 deletions src/mips/psyqo-paths/examples/cdrom-loader/cdrom-loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ void CDRomLoaderExample::prepare() {
void CDRomLoaderExample::createScene() {
m_font.uploadSystemFont(gpu());
pushScene(&cdromLoaderExampleScene);
m_cdromLoader.readFile("SYSTEM.CNF;1", cdromLoaderExample.m_isoParser,
[this](psyqo::Buffer<uint8_t>&& buffer) {
m_buffer = eastl::move(buffer);
m_callbackCalled = true;
});
m_cdromLoader.readFile("SYSTEM.CNF;1", cdromLoaderExample.m_isoParser, [this](psyqo::Buffer<uint8_t>&& buffer) {
m_buffer = eastl::move(buffer);
m_callbackCalled = true;
});
}

void CDRomLoaderExampleScene::frame() {
Expand Down
Loading
Loading