2023-09-03 04:30:26 +00:00
|
|
|
// SPDX-FileCopyrightText: 2016 iCatButler, 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2020-08-01 14:25:07 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
namespace PGXP {
|
|
|
|
|
|
|
|
void Initialize();
|
2021-06-12 12:02:28 +00:00
|
|
|
void Reset();
|
2020-09-02 12:44:52 +00:00
|
|
|
void Shutdown();
|
2020-08-01 14:25:07 +00:00
|
|
|
|
|
|
|
// -- GTE functions
|
|
|
|
// Transforms
|
2021-06-12 12:02:28 +00:00
|
|
|
void GTE_PushSXYZ2f(float x, float y, float z, u32 v);
|
2020-08-01 14:25:07 +00:00
|
|
|
int GTE_NCLIP_valid(u32 sxy0, u32 sxy1, u32 sxy2);
|
|
|
|
float GTE_NCLIP();
|
|
|
|
|
|
|
|
// Data transfer tracking
|
2023-08-15 13:12:21 +00:00
|
|
|
void CPU_MFC2(u32 instr, u32 rdVal); // copy GTE data reg to GPR reg (MFC2)
|
|
|
|
void CPU_MTC2(u32 instr, u32 rtVal); // copy GPR reg to GTE data reg (MTC2)
|
2020-08-01 14:25:07 +00:00
|
|
|
// Memory Access
|
2023-08-15 13:12:21 +00:00
|
|
|
void CPU_LWC2(u32 instr, u32 addr, u32 rtVal); // copy memory to GTE reg
|
|
|
|
void CPU_SWC2(u32 instr, u32 addr, u32 rtVal); // copy GTE reg to memory
|
2020-08-01 14:25:07 +00:00
|
|
|
|
2020-08-19 15:05:03 +00:00
|
|
|
bool GetPreciseVertex(u32 addr, u32 value, int x, int y, int xOffs, int yOffs, float* out_x, float* out_y,
|
|
|
|
float* out_w);
|
2020-08-01 14:25:07 +00:00
|
|
|
|
|
|
|
// -- CPU functions
|
2023-08-15 13:12:21 +00:00
|
|
|
void CPU_LW(u32 instr, u32 addr, u32 rtVal);
|
2023-09-03 04:30:26 +00:00
|
|
|
void CPU_LH(u32 instr, u32 addr, u32 rtVal);
|
|
|
|
void CPU_LHU(u32 instr, u32 addr, u32 rtVal);
|
2023-08-15 13:12:21 +00:00
|
|
|
void CPU_LBx(u32 instr, u32 addr, u32 rtVal);
|
|
|
|
void CPU_SB(u32 instr, u32 addr, u32 rtVal);
|
|
|
|
void CPU_SH(u32 instr, u32 addr, u32 rtVal);
|
|
|
|
void CPU_SW(u32 instr, u32 addr, u32 rtVal);
|
2020-10-04 12:13:33 +00:00
|
|
|
void CPU_MOVE(u32 rd_and_rs, u32 rsVal);
|
2020-08-01 14:25:07 +00:00
|
|
|
|
2020-08-19 13:26:57 +00:00
|
|
|
// Arithmetic with immediate value
|
2021-02-17 15:45:32 +00:00
|
|
|
void CPU_ADDI(u32 instr, u32 rsVal);
|
|
|
|
void CPU_ANDI(u32 instr, u32 rsVal);
|
|
|
|
void CPU_ORI(u32 instr, u32 rsVal);
|
|
|
|
void CPU_XORI(u32 instr, u32 rsVal);
|
|
|
|
void CPU_SLTI(u32 instr, u32 rsVal);
|
|
|
|
void CPU_SLTIU(u32 instr, u32 rsVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// Load Upper
|
2021-02-17 14:47:38 +00:00
|
|
|
void CPU_LUI(u32 instr);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// Register Arithmetic
|
2021-02-17 15:45:32 +00:00
|
|
|
void CPU_ADD(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_SUB(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_AND_(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_OR_(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_XOR_(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_NOR(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_SLT(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_SLTU(u32 instr, u32 rsVal, u32 rtVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// Register mult/div
|
2021-02-17 14:37:17 +00:00
|
|
|
void CPU_MULT(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_MULTU(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_DIV(u32 instr, u32 rsVal, u32 rtVal);
|
|
|
|
void CPU_DIVU(u32 instr, u32 rsVal, u32 rtVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// Shift operations (sa)
|
2021-02-17 15:45:32 +00:00
|
|
|
void CPU_SLL(u32 instr, u32 rtVal);
|
|
|
|
void CPU_SRL(u32 instr, u32 rtVal);
|
|
|
|
void CPU_SRA(u32 instr, u32 rtVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// Shift operations variable
|
2021-02-17 15:45:32 +00:00
|
|
|
void CPU_SLLV(u32 instr, u32 rtVal, u32 rsVal);
|
|
|
|
void CPU_SRLV(u32 instr, u32 rtVal, u32 rsVal);
|
|
|
|
void CPU_SRAV(u32 instr, u32 rtVal, u32 rsVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// Move registers
|
2021-02-17 14:27:31 +00:00
|
|
|
void CPU_MFHI(u32 instr, u32 hiVal);
|
2023-08-15 13:12:21 +00:00
|
|
|
void CPU_MTHI(u32 instr, u32 rsVal);
|
2021-02-17 14:27:31 +00:00
|
|
|
void CPU_MFLO(u32 instr, u32 loVal);
|
2023-08-15 13:12:21 +00:00
|
|
|
void CPU_MTLO(u32 instr, u32 rsVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
|
|
|
|
// CP0 Data transfer tracking
|
2021-02-17 15:15:18 +00:00
|
|
|
void CPU_MFC0(u32 instr, u32 rdVal);
|
2020-08-19 13:26:57 +00:00
|
|
|
void CPU_MTC0(u32 instr, u32 rdVal, u32 rtVal);
|
|
|
|
|
2020-08-01 14:25:07 +00:00
|
|
|
} // namespace PGXP
|