Files
PS2Recomp/ps2xRuntime/include/runtime/ps2_vu1.h
T
Ranieri 8c8a97af65 Feature/mpeg decoder (#120)
* feat: added ffmepg as dependency

* feat: wip decoder video

* feat: some perf and cleanup

* feat:  added generic MPEG stream notification

* feat: CMakeLists.txt in ps2xStudio to configure SDL2 build options for static linking.
fix: fix ffmpeg setup for linux
fix: now MPEG decoder now identify that movie has ended and can play again anytime
feat: better audio stub to not block games

* feat: fix expansion test

* feat: foo

* a

* feat: finally added a helper to to prevent thread starvation

* feat: added basic  vu0 code execution

* feat: added yield Guest Execution After Wake to prevent deadlock

* feat: added  options  on  cmake for logs
feat: better input for keyboard pad

* feat: small corrections like top and itop vu branches etc

* feat: changes

* feat: working feature

* feat: fatal frame iop

* feat: test fix
feat: z buffer fix

* fix: gix GsPutIMR IMR

* feat: added rl imgui

* feat: added helper to get snapshot

* feat: added debug panel consuming snapshots

* feat: added pad snapshot
feat: added RCP debug events

* feat: final cleanup from old code

* feat: added EE timer counter
feat: applyed sound driver for Lotr
feat: better check for sound driver compat layout
feat: enquee and cosumed DMa cause
feat: added Pad execCMd
feat: update GS vsync signal flag
feat: custom IOPs for LotR

* feat: small cleanups

* fix: fix wrong import
2026-06-26 21:04:39 -03:00

67 lines
1.7 KiB
C++

#ifndef PS2_VU1_H
#define PS2_VU1_H
#include <cstdint>
class GS;
class PS2Memory;
struct VU1State
{
float vf[32][4];
int32_t vi[16];
float acc[4];
float q;
float p;
float i;
uint32_t pc;
uint32_t mac;
uint32_t clip;
uint32_t status;
bool ebit;
uint32_t top; // VIF1 TOP visible to VU1 XTOP
uint32_t itop; // VIF1 ITOP visible to VU1 XITOP
bool branchPending;
uint32_t branchTarget;
uint32_t branchDelay;
};
class VU1Interpreter
{
public:
VU1Interpreter();
void reset();
void execute(uint8_t *vuCode, uint32_t codeSize,
uint8_t *vuData, uint32_t dataSize,
GS &gs, PS2Memory *memory = nullptr,
uint32_t startPC = 0, uint32_t top = 0, uint32_t itop = 0,
uint32_t maxCycles = 65536);
void resume(uint8_t *vuCode, uint32_t codeSize,
uint8_t *vuData, uint32_t dataSize,
GS &gs, PS2Memory *memory = nullptr,
uint32_t top = 0, uint32_t itop = 0, uint32_t maxCycles = 65536);
VU1State &state() { return m_state; }
const VU1State &state() const { return m_state; }
private:
VU1State m_state;
void run(uint8_t *vuCode, uint32_t codeSize,
uint8_t *vuData, uint32_t dataSize,
GS &gs, PS2Memory *memory, uint32_t maxCycles);
void execUpper(uint32_t instr);
void execLower(uint32_t instr, uint8_t *vuData, uint32_t dataSize, GS &gs, PS2Memory *memory, uint32_t upperInstr);
void applyDest(float *dst, const float *result, uint8_t dest);
void applyDestAcc(const float *result, uint8_t dest);
float broadcast(const float *vf, uint8_t bc);
};
#endif