Skip to content

Commit

Permalink
[Chores] Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble authored Oct 4, 2024
1 parent 7efde14 commit 2de3b2e
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 123 deletions.
16 changes: 8 additions & 8 deletions src/core/gpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,10 @@ void PCSX::GPU::Poly<shading, shape, textured, blend, modulation>::drawLogNode(u
ImGui::SameLine();
std::string label = fmt::format(f_("Go to texture##{}"), n);
if (ImGui::Button(label.c_str())) {
const auto mode = tpage.texDepth == TexDepth::Tex16Bits
? Events::GUI::VRAM_16BITS
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAM_8BITS
: Events::GUI::VRAM_4BITS;
const auto mode =
tpage.texDepth == TexDepth::Tex16Bits
? Events::GUI::VRAM_16BITS
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAM_8BITS : Events::GUI::VRAM_4BITS;
g_system->m_eventBus->signal(Events::GUI::SelectClut{clutX(), clutY()});
g_system->m_eventBus->signal(
Events::GUI::VRAMFocus{int(minU + tx), int(minV + ty), int(maxU + tx), int(maxV + ty), mode});
Expand Down Expand Up @@ -1234,10 +1234,10 @@ void PCSX::GPU::Rect<size, textured, blend, modulation>::drawLogNode(unsigned n)
ImGui::SameLine();
std::string label = fmt::format(f_("Go to texture##{}"), n);
if (ImGui::Button(label.c_str())) {
const auto mode = tpage.texDepth == TexDepth::Tex16Bits
? Events::GUI::VRAM_16BITS
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAM_8BITS
: Events::GUI::VRAM_4BITS;
const auto mode =
tpage.texDepth == TexDepth::Tex16Bits
? Events::GUI::VRAM_16BITS
: tpage.texDepth == TexDepth::Tex8Bits ? Events::GUI::VRAM_8BITS : Events::GUI::VRAM_4BITS;
g_system->m_eventBus->signal(Events::GUI::SelectClut{clutX(), clutY()});
g_system->m_eventBus->signal(Events::GUI::VRAMFocus{int((u >> shift) + tx), int(v + ty),
int(((u + w) >> shift) + tx), int(v + h + ty), mode});
Expand Down
4 changes: 2 additions & 2 deletions src/core/psxmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

#if defined(__BIGENDIAN__)

#define SWAP_LE16(v) ((((v) & 0xff00) >> 8) | (((v) & 0xff) << 8))
#define SWAP_LE16(v) ((((v)&0xff00) >> 8) | (((v)&0xff) << 8))
#define SWAP_LE32(v) \
((((v) & 0xff000000ul) >> 24) | (((v) & 0xff0000ul) >> 8) | (((v) & 0xff00ul) << 8) | (((v) & 0xfful) << 24))
((((v)&0xff000000ul) >> 24) | (((v)&0xff0000ul) >> 8) | (((v)&0xff00ul) << 8) | (((v)&0xfful) << 24))
#define SWAP_LEu16(v) SWAP_LE16((uint16_t)(v))
#define SWAP_LEu32(v) SWAP_LE32((uint32_t)(v))

Expand Down
6 changes: 3 additions & 3 deletions src/core/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,21 @@ class System {

// Legacy printf stuff; needs to be replaced with loggers
template <typename... Args>
void printf(const char *format, const Args &...args) {
void printf(const char *format, const Args &... args) {
std::string s = fmt::sprintf(format, args...);
printf(std::move(s));
}
virtual void printf(std::string &&) = 0;
// Add a log line
template <typename... Args>
void log(LogClass logClass, const char *format, const Args &...args) {
void log(LogClass logClass, const char *format, const Args &... args) {
std::string s = fmt::sprintf(format, args...);
log(logClass, std::move(s));
}
virtual void log(LogClass, std::string &&) = 0;
// Display a popup message to the user
template <typename... Args>
void message(const char *format, const Args &...args) {
void message(const char *format, const Args &... args) {
std::string s = fmt::sprintf(format, args...);
message(std::move(s));
}
Expand Down
2 changes: 1 addition & 1 deletion src/mips/common/syscalls/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static __attribute__((always_inline)) int changeThreadSubFunction(uint32_t addre
static __attribute__((always_inline)) size_t syscall_write(int fd, const void *buf, size_t size) {
register int n asm("t1") = 0x03;
__asm__ volatile("" : "=r"(n) : "r"(n));
return ((size_t (*)(int, const void *, size_t))0xa0)(fd, buf, size);
return ((size_t(*)(int, const void *, size_t))0xa0)(fd, buf, size);
}

static __attribute__((always_inline, returns_twice)) int syscall_setjmp(struct JmpBuf *buf) {
Expand Down
6 changes: 4 additions & 2 deletions src/mips/modplayer/modplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ static void SPUUploadInstruments(uint32_t SpuAddr, const uint8_t* data, uint32_t

SPU_RAM_DTA = SpuAddr >> 3;
SPU_CTRL = (SPU_CTRL & ~0x0030) | 0x0020;
while ((SPU_CTRL & 0x0030) != 0x0020);
while ((SPU_CTRL & 0x0030) != 0x0020)
;
// original code erroneously was doing SBUS_DEV4_CTRL = SBUS_DEV4_CTRL;
SBUS_DEV4_CTRL &= ~0x0f000000;
DMA_CTRL[DMA_SPU].MADR = (uint32_t)data;
DMA_CTRL[DMA_SPU].BCR = bcr;
DMA_CTRL[DMA_SPU].CHCR = 0x01000201;

while ((DMA_CTRL[DMA_SPU].CHCR & 0x01000000) != 0);
while ((DMA_CTRL[DMA_SPU].CHCR & 0x01000000) != 0)
;
}

static void SPUUnMute() { SPU_CTRL = 0xc000; }
Expand Down
2 changes: 1 addition & 1 deletion src/mips/psyqo/cdrom-device.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct CDRomDeviceStateEnumHasIdle<T, std::enable_if_t<T::IDLE == T(0)>> : std::

template <typename T>
concept IsCDRomDeviceStateEnum =
std::is_enum_v<T> && std::is_same_v<uint8_t, std::underlying_type_t<T>> && CDRomDeviceStateEnumHasIdle<T>::value;
std::is_enum_v<T> &&std::is_same_v<uint8_t, std::underlying_type_t<T>> &&CDRomDeviceStateEnumHasIdle<T>::value;

} // namespace Concepts

Expand Down
3 changes: 1 addition & 2 deletions src/mips/psyqo/fixed-point.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ void printInt(uint32_t value, const eastl::function<void(char)>&, unsigned preci
* @tparam T The underlying integer type to use.
*/
template <unsigned precisionBits = 12, std::integral T = int32_t>
requires((precisionBits > 0) && (precisionBits < 32) && ((sizeof(T) == 4) || (sizeof(T) == 2)))
class FixedPoint {
requires((precisionBits > 0) && (precisionBits < 32) && ((sizeof(T) == 4) || (sizeof(T) == 2))) class FixedPoint {
using signedUpType = std::conditional<sizeof(T) == 4, int64_t, int32_t>::type;
using unsignedUpType = std::conditional<sizeof(T) == 4, uint64_t, uint32_t>::type;
using upType = std::conditional<std::is_signed<T>::value, signedUpType, unsignedUpType>::type;
Expand Down
14 changes: 8 additions & 6 deletions src/mips/psyqo/fragment-concept.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ struct has_explicit_copy_constructor<

template <typename Frag>
concept Fragment = requires(Frag frag) {
{ (alignof(Frag) & 3) == 0 };
{ (sizeof(Frag) & 3) == 0 };
{ (sizeof(frag.head)) == 4 };
{ ((offsetof(Frag, head)) & 3) == 0 };
{ has_explicit_copy_constructor<Frag>() } -> std::convertible_to<std::true_type>;
{ frag.getActualFragmentSize() } -> std::convertible_to<size_t>;
{(alignof(Frag) & 3) == 0};
{(sizeof(Frag) & 3) == 0};
{(sizeof(frag.head)) == 4};
{((offsetof(Frag, head)) & 3) == 0};
{ has_explicit_copy_constructor<Frag>() }
->std::convertible_to<std::true_type>;
{ frag.getActualFragmentSize() }
->std::convertible_to<size_t>;
};

} // namespace psyqo
126 changes: 63 additions & 63 deletions src/mips/psyqo/gte-registers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,72 +69,72 @@ struct PackedVec3 {

/**
* @brief The list of available GTE registers.
*/
*/
enum class Register {
VXY0, /* Vector 0 (X,Y) */
VZ0, /* Vector 0 (Z) */
VXY1, /* Vector 1 (X,Y) */
VZ1, /* Vector 1 (Z) */
VXY2, /* Vector 2 (X,Y) */
VZ2, /* Vector 2 (Z) */
RGB, /* Color/code value */
OTZ, /* Average Z value (for Ordering Table) */
IR0, /* 16bit Accumulator 0 (Interpolate) */
IR1, /* 16bit Accumulator 1 (Vector) */
IR2, /* 16bit Accumulator 2 (Vector) */
IR3, /* 16bit Accumulator 3 (Vector) */
SXY0, /* Screen XY-coordinate 0 FIFO */
SXY1, /* Screen XY-coordinate 1 FIFO */
SXY2, /* Screen XY-coordinate 2 FIFO */
SXYP, /* Screen XY-coordinate P FIFO */
SZ0, /* Screen Z-coordinate 0 FIFO */
SZ1, /* Screen Z-coordinate 1 FIFO */
SZ2, /* Screen Z-coordinate 2 FIFO */
SZ3, /* Screen Z-coordinate 3 FIFO */
RGB0, /* Color CRGB-code/color 0 FIFO */
RGB1, /* Color CRGB-code/color 1 FIFO */
RGB2, /* Color CRGB-code/color 2 FIFO */
RES1, /* Prohibited */
MAC0, /* 32bit Maths Accumulators 0 (Value) */
MAC1, /* 32bit Maths Accumulators 1 (Vector) */
MAC2, /* 32bit Maths Accumulators 2 (Vector) */
MAC3, /* 32bit Maths Accumulators 3 (Vector) */
IRGB, /* Convert RGB Color (48bit vs 15bit) */
ORGB, /* Convert RGB Color (48bit vs 15bit) */
LZCS, /* Count Leading-Zeroes/Ones (sign bits) */
LZCR, /* Count Leading-Zeroes/Ones (sign bits) */
VXY0, /* Vector 0 (X,Y) */
VZ0, /* Vector 0 (Z) */
VXY1, /* Vector 1 (X,Y) */
VZ1, /* Vector 1 (Z) */
VXY2, /* Vector 2 (X,Y) */
VZ2, /* Vector 2 (Z) */
RGB, /* Color/code value */
OTZ, /* Average Z value (for Ordering Table) */
IR0, /* 16bit Accumulator 0 (Interpolate) */
IR1, /* 16bit Accumulator 1 (Vector) */
IR2, /* 16bit Accumulator 2 (Vector) */
IR3, /* 16bit Accumulator 3 (Vector) */
SXY0, /* Screen XY-coordinate 0 FIFO */
SXY1, /* Screen XY-coordinate 1 FIFO */
SXY2, /* Screen XY-coordinate 2 FIFO */
SXYP, /* Screen XY-coordinate P FIFO */
SZ0, /* Screen Z-coordinate 0 FIFO */
SZ1, /* Screen Z-coordinate 1 FIFO */
SZ2, /* Screen Z-coordinate 2 FIFO */
SZ3, /* Screen Z-coordinate 3 FIFO */
RGB0, /* Color CRGB-code/color 0 FIFO */
RGB1, /* Color CRGB-code/color 1 FIFO */
RGB2, /* Color CRGB-code/color 2 FIFO */
RES1, /* Prohibited */
MAC0, /* 32bit Maths Accumulators 0 (Value) */
MAC1, /* 32bit Maths Accumulators 1 (Vector) */
MAC2, /* 32bit Maths Accumulators 2 (Vector) */
MAC3, /* 32bit Maths Accumulators 3 (Vector) */
IRGB, /* Convert RGB Color (48bit vs 15bit) */
ORGB, /* Convert RGB Color (48bit vs 15bit) */
LZCS, /* Count Leading-Zeroes/Ones (sign bits) */
LZCR, /* Count Leading-Zeroes/Ones (sign bits) */
R11R12, /* Rotation matrix (3x3) */
R13R21, /* Rotation matrix (3x3) */
R22R23, /* Rotation matrix (3x3) */
R31R32, /* Rotation matrix (3x3) */
R33, /* Rotation matrix (3x3) */
TRX, /* Translation vector (X) */
TRY, /* Translation vector (Y) */
TRZ, /* Translation vector (Z) */
R33, /* Rotation matrix (3x3) */
TRX, /* Translation vector (X) */
TRY, /* Translation vector (Y) */
TRZ, /* Translation vector (Z) */
L11L12, /* Light source matrix (3x3) */
L13L21, /* Light source matrix (3x3) */
L22L23, /* Light source matrix (3x3) */
L31L32, /* Light source matrix (3x3) */
L33, /* Light source matrix (3x3) */
RBK, /* Background color(R) */
GBK, /* Background color(G) */
BBK, /* Background color(B) */
L33, /* Light source matrix (3x3) */
RBK, /* Background color(R) */
GBK, /* Background color(G) */
BBK, /* Background color(B) */
LR1LR2, /* Light color matrix source (3x3) */
LR3LG1, /* Light color matrix source (3x3) */
LG2LG3, /* Light color matrix source (3x3) */
LB1LB2, /* Light color matrix source (3x3) */
LB3, /* Light color matrix source (3x3) */
RFC, /* Far color (R) */
GFC, /* Far color (G) */
BFC, /* Far color (B) */
OFX, /* Screen offset (X) */
OFY, /* Screen offset (Y) */
H, /* Projection plane distance. */
DQA, /* Depth queing parameter A (coeff) */
DQB, /* Depth queing parameter B (offset) */
ZSF3, /* Average Z scale factors */
ZSF4, /* Average Z scale factors */
FLAG, /* Returns any calculation errors */
LB3, /* Light color matrix source (3x3) */
RFC, /* Far color (R) */
GFC, /* Far color (G) */
BFC, /* Far color (B) */
OFX, /* Screen offset (X) */
OFY, /* Screen offset (Y) */
H, /* Projection plane distance. */
DQA, /* Depth queing parameter A (coeff) */
DQB, /* Depth queing parameter B (offset) */
ZSF3, /* Average Z scale factors */
ZSF4, /* Average Z scale factors */
FLAG, /* Returns any calculation errors */
};

/**
Expand All @@ -150,7 +150,7 @@ enum class Register {
*/
enum Safety {
Unsafe, /* avoid nops */
Safe, /* insert nops */
Safe, /* insert nops */
};

/**
Expand Down Expand Up @@ -247,15 +247,15 @@ static inline void writeUnsafe(Short low, Short hi) {
* @brief The list of available GTE pseudo registers.
*/
enum class PseudoRegister {
Rotation, /* pseudo register for full rotation matrix, mapped to registers R11R12-R33 */
Light, /* pseudo register for full light matrix, mapped to registers L11L12-L33 */
Color, /* pseudo register for full light color matrix, mapped to registers LR1LR2-LB3 */
V0, /* pseudo register for full Vector 0, mapped to registers VXY0 and VZ0 */
V1, /* pseudo register for full Vector 1, mapped to registers VXY1 and VZ1 */
V2, /* pseudo register for full Vector 2, mapped to registers VXY2 and VZ2 */
SV, /* pseudo register for full 16bit Accumulator Vector, mapped to registers IR1-IR3 */
LV, /* pseudo register for full 32bit Maths Accumulator Vector, mapped to registers MAC1-MAC3 */
Translation, /* pseudo register for full Translation vector, mapped to registers TRX-TRZ */
Rotation, /* pseudo register for full rotation matrix, mapped to registers R11R12-R33 */
Light, /* pseudo register for full light matrix, mapped to registers L11L12-L33 */
Color, /* pseudo register for full light color matrix, mapped to registers LR1LR2-LB3 */
V0, /* pseudo register for full Vector 0, mapped to registers VXY0 and VZ0 */
V1, /* pseudo register for full Vector 1, mapped to registers VXY1 and VZ1 */
V2, /* pseudo register for full Vector 2, mapped to registers VXY2 and VZ2 */
SV, /* pseudo register for full 16bit Accumulator Vector, mapped to registers IR1-IR3 */
LV, /* pseudo register for full 32bit Maths Accumulator Vector, mapped to registers MAC1-MAC3 */
Translation, /* pseudo register for full Translation vector, mapped to registers TRX-TRZ */
ScreenOffset, /* pseudo register for full Screen offset, mapped to registers OFX and OFY */
};

Expand Down
4 changes: 2 additions & 2 deletions src/mips/psyqo/kernel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ void setBreakHandler(unsigned category, eastl::function<bool(uint32_t)>&& handle

/**
* @brief Queues a break handler for psyqo's reserved category.
*
*
* @param handler The handler to call when a break occurs.
*/
void queuePsyqoBreakHandler(eastl::function<bool(uint32_t)> && handler);
void queuePsyqoBreakHandler(eastl::function<bool(uint32_t)>&& handler);

namespace Internal {
void pumpCallbacks();
Expand Down
11 changes: 7 additions & 4 deletions src/mips/psyqo/primitive-concept.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ namespace psyqo {

template <typename Prim>
concept Primitive = requires {
{ (alignof(Prim) & 3) == 0 };
{ (sizeof(Prim) & 3) == 0 };
{ !requires { typename Prim::head; } };
};
{(alignof(Prim) & 3) == 0};
{(sizeof(Prim) & 3) == 0};
{!requires {typename Prim::head;
}
}; // namespace psyqo
}
;

} // namespace psyqo
Loading

0 comments on commit 2de3b2e

Please sign in to comment.