Skip to content

Commit

Permalink
[Chores] Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble authored Jan 17, 2025
1 parent 11ea342 commit 2d31c22
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/core/pcsxlua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/psxemulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void PCSX::Emulator::setLua() {
L.pop();
L.pop();
L.pop();

m_pads->setLua(L);

assert(L.gettop() == 0);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/luaimguiextra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/

#include <string_view>

#include "gui/luaimguiextra.h"

#include <string_view>

#include "gui/gui.h"
#include "imgui/imgui.h"
#include "imgui_stdlib.h"
Expand Down
10 changes: 5 additions & 5 deletions src/mips/common/crt0/cxxglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -69,16 +69,16 @@ 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++;

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++) {
Expand Down
4 changes: 2 additions & 2 deletions src/mips/psyqo/examples/cube/cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<psyqo::GTE::Register::MAC0>(reinterpret_cast<uint32_t *>(&mac0));
psyqo::GTE::read<psyqo::GTE::Register::MAC0>(reinterpret_cast<uint32_t*>(&mac0));
if (mac0 <= 0) continue;

// Since the GTE can only handle 3 vertices at a time, we need to store our first vertex
Expand All @@ -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<psyqo::GTE::Register::OTZ>(reinterpret_cast<uint32_t *>(&zIndex));
psyqo::GTE::read<psyqo::GTE::Register::OTZ>(reinterpret_cast<uint32_t*>(&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;
Expand Down
43 changes: 22 additions & 21 deletions src/mips/psyqo/examples/pcsxlua/pcsxlua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/mips/psyqo/iso9660-parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ SOFTWARE.

#pragma once

#include <coroutine>

#include <EASTL/fixed_string.h>
#include <EASTL/functional.h>
#include <EASTL/string_view.h>

#include <coroutine>

#include "psyqo/cdrom.hh"
#include "psyqo/task.hh"

Expand Down
3 changes: 2 additions & 1 deletion src/mips/psyqo/kernel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/mips/psyqo/primitives/common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 2 additions & 6 deletions src/mips/psyqo/primitives/control.hh
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,8 @@ struct MaskControl {
command |= static_cast<uint32_t>(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;
Expand Down

0 comments on commit 2d31c22

Please sign in to comment.