From 94159d0cee87e9654cd840316c72302c16529deb Mon Sep 17 00:00:00 2001 From: nicolasnoble Date: Mon, 20 Jan 2025 03:42:26 +0000 Subject: [PATCH] [Chores] Format code --- src/core/pcsxlua.cc | 2 +- src/core/psxemulator.cc | 2 +- src/gui/luaimguiextra.cc | 4 +- src/mips/common/crt0/cxxglue.c | 10 ++--- src/mips/psyqo/examples/cube/cube.cpp | 4 +- src/mips/psyqo/examples/pcsxlua/pcsxlua.lua | 43 +++++++++++---------- src/mips/psyqo/iso9660-parser.hh | 4 +- src/mips/psyqo/kernel.hh | 3 +- src/mips/psyqo/primitives/common.hh | 2 +- src/mips/psyqo/primitives/control.hh | 8 +--- src/mips/psyqo/shared.hh | 2 +- 11 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/core/pcsxlua.cc b/src/core/pcsxlua.cc index 98a2fd899..3f77359fb 100644 --- a/src/core/pcsxlua.cc +++ b/src/core/pcsxlua.cc @@ -34,7 +34,7 @@ struct LuaBreakpoint { PCSX::Debug::BreakpointUserListType wrapper; }; -uint64_t getCPUCycles() { return PCSX::g_emulator->m_cpu->m_regs.cycle; } +uint64_t getCPUCycles() { return PCSX::g_emulator->m_cpu->m_regs.cycle; } void* getMemPtr() { return PCSX::g_emulator->m_mem->m_wram; } void* getParPtr() { return PCSX::g_emulator->m_mem->m_exp1; } void* getRomPtr() { return PCSX::g_emulator->m_mem->m_bios; } diff --git a/src/core/psxemulator.cc b/src/core/psxemulator.cc index 6276328f5..97ce821bc 100644 --- a/src/core/psxemulator.cc +++ b/src/core/psxemulator.cc @@ -128,7 +128,7 @@ void PCSX::Emulator::setLua() { L.pop(); L.pop(); L.pop(); - + m_pads->setLua(L); assert(L.gettop() == 0); diff --git a/src/gui/luaimguiextra.cc b/src/gui/luaimguiextra.cc index 80da6bdc7..1f0b771cb 100644 --- a/src/gui/luaimguiextra.cc +++ b/src/gui/luaimguiextra.cc @@ -17,10 +17,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ -#include - #include "gui/luaimguiextra.h" +#include + #include "gui/gui.h" #include "imgui/imgui.h" #include "imgui_stdlib.h" diff --git a/src/mips/common/crt0/cxxglue.c b/src/mips/common/crt0/cxxglue.c index 80610b742..9d3a7a539 100644 --- a/src/mips/common/crt0/cxxglue.c +++ b/src/mips/common/crt0/cxxglue.c @@ -43,9 +43,9 @@ extern fptr __preinit_array_end[] __attribute__((weak)); extern fptr __init_array_start[] __attribute__((weak)); extern fptr __init_array_end[] __attribute__((weak)); -int main(int argc, char ** argv); +int main(int argc, char** argv); -void cxxmain(int argc, char ** argv) { +void cxxmain(int argc, char** argv) { size_t count, i; count = __preinit_array_end - __preinit_array_start; @@ -69,7 +69,7 @@ void cxxmain(int argc, char ** argv) { // These two technically aren't part of the standard library requirements, but can // be invoked by the freestanding libstdc++, so might as well. -__attribute__((weak)) size_t strlen(const char * s) { +__attribute__((weak)) size_t strlen(const char* s) { size_t r = 0; while (*s++) r++; @@ -77,8 +77,8 @@ __attribute__((weak)) size_t strlen(const char * s) { return r; } -__attribute__((weak)) const void * memchr(const void * _s, int c, size_t n) { - const uint8_t * s = (uint8_t *) _s; +__attribute__((weak)) const void* memchr(const void* _s, int c, size_t n) { + const uint8_t* s = (uint8_t*)_s; size_t i; for (i = 0; i < n; i++, s++) { diff --git a/src/mips/psyqo/examples/cube/cube.cpp b/src/mips/psyqo/examples/cube/cube.cpp index 395f9fe04..93237b027 100644 --- a/src/mips/psyqo/examples/cube/cube.cpp +++ b/src/mips/psyqo/examples/cube/cube.cpp @@ -175,7 +175,7 @@ void CubeScene::frame() { // Read the result of nclip and skip rendering this face if it's not facing us int32_t mac0 = 0; - psyqo::GTE::read(reinterpret_cast(&mac0)); + psyqo::GTE::read(reinterpret_cast(&mac0)); if (mac0 <= 0) continue; // Since the GTE can only handle 3 vertices at a time, we need to store our first vertex @@ -191,7 +191,7 @@ void CubeScene::frame() { // Calculate the average Z for the z-Index to be put in the ordering table psyqo::GTE::Kernels::avsz4(); int32_t zIndex = 0; - psyqo::GTE::read(reinterpret_cast(&zIndex)); + psyqo::GTE::read(reinterpret_cast(&zIndex)); // If the Z-index is out of bounds for our ordering table, we skip rendering this face. if (zIndex < 0 || zIndex >= ORDERING_TABLE_SIZE) continue; diff --git a/src/mips/psyqo/examples/pcsxlua/pcsxlua.lua b/src/mips/psyqo/examples/pcsxlua/pcsxlua.lua index ac89897b1..d90beb921 100644 --- a/src/mips/psyqo/examples/pcsxlua/pcsxlua.lua +++ b/src/mips/psyqo/examples/pcsxlua/pcsxlua.lua @@ -20,31 +20,32 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---]] - --- This is the companion Lua script for the PCSX-Redux Lua editor demo. +--]] -- This is the companion Lua script for the PCSX-Redux Lua editor demo. -- See pcsxlua.cpp for the C++ side of the demo. - local addresses = {} PCSX.execSlots[255] = function() - local mem = PCSX.getMemPtr() - local regs = PCSX.getRegisters().GPR.n - local name = ffi.string(mem + bit.band(regs.a1, 0x7fffff)) - addresses[name] = regs.a0 + local mem = PCSX.getMemPtr() + local regs = PCSX.getRegisters().GPR.n + local name = ffi.string(mem + bit.band(regs.a1, 0x7fffff)) + addresses[name] = regs.a0 end function DrawImguiFrame() - imgui.safe.Begin('Lua editor demo', true, function() - local mem = PCSX.getMemoryAsFile() - local addr = addresses['pcsxLuaScene.m_bg'] - if type(addr) == 'number' then - local color = { r = mem:readU8At(addr + 0) / 255, g = mem:readU8At(addr + 1) / 255, b = mem:readU8At(addr + 2) / 255 } - local modified, n = imgui.extra.ColorEdit3('bgColor', color) - if modified then - mem:writeU8At(n.r * 255, addr + 0) - mem:writeU8At(n.g * 255, addr + 1) - mem:writeU8At(n.b * 255, addr + 2) - end - end - end) + imgui.safe.Begin('Lua editor demo', true, function() + local mem = PCSX.getMemoryAsFile() + local addr = addresses['pcsxLuaScene.m_bg'] + if type(addr) == 'number' then + local color = { + r = mem:readU8At(addr + 0) / 255, + g = mem:readU8At(addr + 1) / 255, + b = mem:readU8At(addr + 2) / 255, + } + local modified, n = imgui.extra.ColorEdit3('bgColor', color) + if modified then + mem:writeU8At(n.r * 255, addr + 0) + mem:writeU8At(n.g * 255, addr + 1) + mem:writeU8At(n.b * 255, addr + 2) + end + end + end) end diff --git a/src/mips/psyqo/iso9660-parser.hh b/src/mips/psyqo/iso9660-parser.hh index ec4d9e166..eef602575 100644 --- a/src/mips/psyqo/iso9660-parser.hh +++ b/src/mips/psyqo/iso9660-parser.hh @@ -26,12 +26,12 @@ SOFTWARE. #pragma once -#include - #include #include #include +#include + #include "psyqo/cdrom.hh" #include "psyqo/task.hh" diff --git a/src/mips/psyqo/kernel.hh b/src/mips/psyqo/kernel.hh index 5f2040a9a..65d90986d 100644 --- a/src/mips/psyqo/kernel.hh +++ b/src/mips/psyqo/kernel.hh @@ -110,7 +110,8 @@ enum class IRQ : unsigned { /** * @brief Stops the execution of the application. */ -[[noreturn]] static inline void abort(const char* msg, std::source_location location = std::source_location::current()) { +[[noreturn]] static inline void abort(const char* msg, + std::source_location location = std::source_location::current()) { if constexpr (debugMode) { Internal::abort(msg, location); } else if constexpr (!debugMode) { diff --git a/src/mips/psyqo/primitives/common.hh b/src/mips/psyqo/primitives/common.hh index 5d308e5ae..c29d5ab81 100644 --- a/src/mips/psyqo/primitives/common.hh +++ b/src/mips/psyqo/primitives/common.hh @@ -102,7 +102,7 @@ enum ColorMode { Tex4Bits, Tex8Bits, Tex16Bits }; } // namespace Prim::TPageAttr namespace Prim { - enum class Transparency { Auto, Opaque, SemiTransparent }; +enum class Transparency { Auto, Opaque, SemiTransparent }; } namespace PrimPieces { diff --git a/src/mips/psyqo/primitives/control.hh b/src/mips/psyqo/primitives/control.hh index 4679abed9..b02859f6a 100644 --- a/src/mips/psyqo/primitives/control.hh +++ b/src/mips/psyqo/primitives/control.hh @@ -135,12 +135,8 @@ struct MaskControl { command |= static_cast(test) << 1; return *this; } - MaskControl &set(Set set, Test test) { - return *this = MaskControl(set, test); - } - MaskControl &set(Test test, Set set) { - return *this = MaskControl(set, test); - } + MaskControl &set(Set set, Test test) { return *this = MaskControl(set, test); } + MaskControl &set(Test test, Set set) { return *this = MaskControl(set, test); } private: uint32_t command; diff --git a/src/mips/psyqo/shared.hh b/src/mips/psyqo/shared.hh index a748d3447..d77795e8c 100644 --- a/src/mips/psyqo/shared.hh +++ b/src/mips/psyqo/shared.hh @@ -33,4 +33,4 @@ namespace psyqo { */ enum class Safe : unsigned { No, Yes }; -} +} // namespace psyqo