Core: Renamed the class that stores object references

This commit is contained in:
Gabriel Correia 2024-06-22 21:28:45 -03:00
parent 39b0dd28f7
commit 2795a81120
36 changed files with 96 additions and 96 deletions

View File

@ -10,10 +10,10 @@
#include <common/alias.h>
namespace cosmic {
template <typename T>
class Optional : public std::optional<std::reference_wrapper<T>> {
class Wrapper : public std::optional<std::reference_wrapper<T>> {
public:
Optional() = default;
Optional(T& reference) : std::optional<std::reference_wrapper<T>>(reference) {
Wrapper() = default;
Wrapper(T& reference) : std::optional<std::reference_wrapper<T>>(reference) {
}
auto take() const {
return this->value().get();

View File

@ -5,11 +5,11 @@ namespace cosmic {
}
namespace cosmic::console {
BackDoor::BackDoor(vm::EmuVm& aliveVm) {
vm = Optional(aliveVm);
vm = Wrapper(aliveVm);
echo.lock();
vmRefs = 1;
}
Optional<vm::EmuVm> BackDoor::openVm() {
Wrapper<vm::EmuVm> BackDoor::openVm() {
std::thread::id nub{};
if (owner == nub && owner != std::this_thread::get_id()) {
while (echo.try_lock()) {
@ -22,14 +22,14 @@ namespace cosmic::console {
}
if (owner != std::this_thread::get_id())
throw AppErr("This resource should have the lock held until the object is released");
Optional<vm::EmuVm> vmRef{};
Wrapper<vm::EmuVm> vmRef{};
if (vmRefs) {
vmRef = vm;
vmRefs++;
}
return vmRef;
}
void BackDoor::leaveVm(Optional<vm::EmuVm>& lvm) {
void BackDoor::leaveVm(Wrapper<vm::EmuVm>& lvm) {
if (echo.try_lock()) {
if (owner != std::this_thread::get_id())
throw AppErr("The program flow is broken, review the usage of BackDoor in the code");
@ -37,7 +37,7 @@ namespace cosmic::console {
vmRefs--;
if (!vm || vmRefs <= 0) {
vm.reset();
vm = Optional(lvm);
vm = Wrapper(lvm);
vmRefs = 1;
}
owner = {};

View File

@ -10,12 +10,12 @@ namespace cosmic::console {
class BackDoor {
public:
BackDoor(vm::EmuVm& aliveVm);
Optional<vm::EmuVm> openVm();
void leaveVm(Optional<vm::EmuVm>& lvm);
Wrapper<vm::EmuVm> openVm();
void leaveVm(Wrapper<vm::EmuVm>& lvm);
private:
std::thread::id owner;
std::mutex echo;
Optional<vm::EmuVm> vm;
Wrapper<vm::EmuVm> vm;
i32 vmRefs;
};
}

View File

@ -46,7 +46,7 @@ namespace cosmic::console {
biosf.readFrom(here, 0);
romHeader.release();
}
Optional<RomEntry> BiosLoader::getModule(const std::string model) {
Wrapper<RomEntry> BiosLoader::getModule(const std::string model) {
std::span<u8> modelBin{BitCast<u8*>(model.c_str()), model.size()};
std::span<u8> hdrBin{romHeader->operator*(), hdrSize};
auto indexInt{ranges::search(hdrBin, modelBin)};

View File

@ -26,7 +26,7 @@ namespace cosmic::console {
private:
bool isABios();
Optional<RomEntry> getModule(const std::string model);
Wrapper<RomEntry> getModule(const std::string model);
bool loadVersionInfo(std::span<u8> info);
void fillVersion(hle::BiosInfo& bios, std::span<char> info);

View File

@ -30,8 +30,8 @@ namespace cosmic::console {
gif = std::make_shared<gs::GifBridge>(gs);
mio::HardWithDmaCap caps{};
caps.vif0 = Optional(VUs->vifs[0]);
caps.vif1 = Optional(VUs->vifs[1]);
caps.vif0 = Wrapper(VUs->vifs[0]);
caps.vif1 = Wrapper(VUs->vifs[1]);
caps.ee = eeR5900;
pipe->controller->connectDevices(caps);

View File

@ -32,7 +32,7 @@ namespace cosmic::creeper {
auto endIterator{std::end(run)};
for (; opIterator != run.end(); executedInst++) {
Optional<CachedMultiOp> opcInside{*opIterator};
Wrapper<CachedMultiOp> opcInside{*opIterator};
bool isLastABr{false};
// Todo: May not work as expected
if (opIterator != run.begin()) {
@ -57,7 +57,7 @@ namespace cosmic::creeper {
if ((opIterator + 1) != endIterator) {
// Simulating the pipeline execution with the aim of resolving one or more instructions
// within the same cycle
Optional<CachedMultiOp> opcSuper{*(opIterator + 1)};
Wrapper<CachedMultiOp> opcSuper{*(opIterator + 1)};
// Execute only two instructions if the operations use different pipelines
if (((opcInside->infoCallable.pipe ^ opcSuper->infoCallable.pipe) != invPipe) &&
opcSuper->infoCallable.pipe != dangerousPipe) {
@ -102,7 +102,7 @@ namespace cosmic::creeper {
block = localPc32;
}
}
MipsIvInterpreter::MipsIvInterpreter(Optional<ee::EeMipsCore> mips) :
MipsIvInterpreter::MipsIvInterpreter(Wrapper<ee::EeMipsCore> mips) :
ee::EeExecutor(mips) {
lastCleaned = actualPc = 0;
memset(metrics.data(), 0, sizeof(metrics));
@ -115,8 +115,8 @@ namespace cosmic::creeper {
auto vmRef{outside->openVm()};
vm = vmRef;
fpu = Optional(cpu->cop1);
c0 = Optional(cpu->cop0);
fpu = Wrapper(cpu->cop1);
c0 = Wrapper(cpu->cop0);
outside->leaveVm(vmRef);
}
@ -127,16 +127,16 @@ namespace cosmic::creeper {
PCs[0] = cpu->eePc;
actualPc = PCs[0];
PCs[1] = PCs[0] & cleanPcBlock;
Optional<BlockFrequency> chosen{};
Wrapper<BlockFrequency> chosen{};
ranges::for_each(metrics, [&](auto& met){
if (met.blockPc == PCs[1])
chosen = Optional(met);
chosen = Wrapper(met);
});
bool isCached{true};
if (!chosen) {
// Choosing the metric with the lowest frequency number
std::sort(metrics.begin(), metrics.end());
chosen = Optional(metrics[0]);
chosen = Wrapper(metrics[0]);
isCached = false;
}
[[unlikely]] if (!isCached) {

View File

@ -78,7 +78,7 @@ namespace cosmic::creeper {
class MipsIvInterpreter : public ee::EeExecutor {
public:
MipsIvInterpreter(Optional<ee::EeMipsCore> mips);
MipsIvInterpreter(Wrapper<ee::EeMipsCore> mips);
u32 executeCode() override;
void performInvalidation(u32 address) override;
@ -184,10 +184,10 @@ namespace cosmic::creeper {
u32 lastCleaned;
u32 actualPc;
static Optional<ee::EeMipsCore> cpu;
static Optional<vm::EmuVm> vm;
static Optional<ee::FpuCop> fpu;
static Optional<ee::CtrlCop> c0;
static Wrapper<ee::EeMipsCore> cpu;
static Wrapper<vm::EmuVm> vm;
static Wrapper<ee::FpuCop> fpu;
static Wrapper<ee::CtrlCop> c0;
static EeMapSpecial ivSpecial;
static EeRegImm ivRegImm;

View File

@ -208,10 +208,10 @@ namespace cosmic::creeper {
const u32 opcode{cpu->fetchByAddress(pc)};
return opcode;
}
Optional<EeMipsCore> MipsIvInterpreter::cpu;
Optional<vm::EmuVm> MipsIvInterpreter::vm;
Optional<FpuCop> MipsIvInterpreter::fpu;
Optional<CtrlCop> MipsIvInterpreter::c0;
Wrapper<EeMipsCore> MipsIvInterpreter::cpu;
Wrapper<vm::EmuVm> MipsIvInterpreter::vm;
Wrapper<FpuCop> MipsIvInterpreter::fpu;
Wrapper<CtrlCop> MipsIvInterpreter::c0;
u32& MipsIvInterpreter::doReg(const Reg regId) {
return cpu->GPRs[regId].words[0];

View File

@ -7,7 +7,7 @@
namespace cosmic::creeper {
void MipsIvInterpreter::tlbr(Operands ops) {
auto entry{cpu->fetchTlbFromCop(c0->GPRs.data())};
auto& entry{cpu->fetchTlbFromCop(c0->GPRs.data())};
c0->loadFromGprToTlb(entry);
}
void MipsIvInterpreter::c0mfc(Operands ops) {

View File

@ -219,9 +219,9 @@ namespace cosmic::creeper {
}
}
IopInterpreter::IopInterpreter(
Optional<iop::IoMipsCore> core) :
Wrapper<iop::IoMipsCore> core) :
IopExecVe(core) {
Optional<vm::EmuVm> vmInter{outside->openVm()};
Wrapper<vm::EmuVm> vmInter{outside->openVm()};
vm = vmInter;
outside->leaveVm(vm);

View File

@ -9,7 +9,7 @@ namespace cosmic::vm {
namespace cosmic::creeper {
class IopInterpreter : public iop::IopExecVe {
public:
IopInterpreter(Optional<iop::IoMipsCore> core);
IopInterpreter(Wrapper<iop::IoMipsCore> core);
u32 executeCode() override;
u32 execPsx(u32 opcode, std::array<u8, 3> opeRegs);
u32 execCop(u32 opcode, std::array<u8, 3> opeRegs);
@ -19,7 +19,7 @@ namespace cosmic::creeper {
CachedFastPc fastPc;
u32 fetchPcInst() override;
Optional<vm::EmuVm> vm;
Wrapper<vm::EmuVm> vm;
void issueInterruptSignal();
void sltiu(Operands ops);

View File

@ -1,7 +1,7 @@
#include <creeper/vector_codes.h>
#include <vu/vecu.h>
namespace cosmic::creeper {
Optional<vu::VectorUnit> VuMicroInterpreter::vu;
Wrapper<vu::VectorUnit> VuMicroInterpreter::vu;
u32 VuMicroInterpreter::executeCode() {
VuMicroOperands ops[2];

View File

@ -26,7 +26,7 @@ namespace cosmic::creeper {
class VuMicroInterpreter : public vu::VuMicroExecutor {
public:
VuMicroInterpreter(Optional<vu::VectorUnit> vuCake) :
VuMicroInterpreter(Wrapper<vu::VectorUnit> vuCake) :
vu::VuMicroExecutor(vuCake) {
vu = vuMicro;
}
@ -57,6 +57,6 @@ namespace cosmic::creeper {
private:
VuMicroOrder ordered;
static Optional<vu::VectorUnit> vu;
static Wrapper<vu::VectorUnit> vu;
};
}

View File

@ -6,7 +6,7 @@ namespace cosmic::ee {
// We don't check for a cache miss here
const os::vec& CtrlCop::readCache(u32 address, CacheMode mode) {
auto tagAddr{getCachePfn(address, mode)};
auto cachedData{getCache(address, false, mode)};
auto& cachedData{getCache(address, false, mode)};
u8 lineLayer{};
tagAddr |= dirtyBit;
if (cachedData.tags[0] == tagAddr)
@ -21,7 +21,7 @@ namespace cosmic::ee {
return cont.vec[(address >> 4) & 3];
}
void CtrlCop::invIndexed(u32 address) {
auto invWaysAt{getCache(address, true)};
auto& invWaysAt{getCache(address, true)};
invWaysAt.tags[0] &= ~dirtyBit;
invWaysAt.tags[1] &= ~dirtyBit;
invWaysAt.lrf[0] = invWaysAt.lrf[1] = {
@ -32,7 +32,7 @@ namespace cosmic::ee {
bool CtrlCop::isCacheHit(u32 address, u8 lane, CacheMode mode) {
// Each cache line is indexed by virtual address
auto addrTag{getCachePfn(address, mode)};
auto mirror{getCache(address, false, mode)};
auto& mirror{getCache(address, false, mode)};
addrTag |= dirtyBit;
switch (lane) {
@ -136,13 +136,13 @@ namespace cosmic::ee {
cacheIndex = (mem >> 6) & 0x3f;
cacheBank = dataCache;
}
Optional<CopCacheLine> roCache{cacheBank[cacheIndex]};
Wrapper<CopCacheLine> roCache{cacheBank[cacheIndex]};
const auto firstWayLayer{roCache->tags[0]};
const auto secondWayLayer{roCache->tags[1]};
std::array<Optional<u8*>, 2> maps{
Optional(virtMap[firstWayLayer >> 12]),
Optional(virtMap[secondWayLayer >> 12])
std::array<Wrapper<u8*>, 2> maps{
Wrapper(virtMap[firstWayLayer >> 12]),
Wrapper(virtMap[secondWayLayer >> 12])
};
const auto firstLrf{roCache->lrf[0]};
const auto secondLrf{roCache->lrf[1]};

View File

@ -72,7 +72,7 @@ namespace cosmic::ee {
!cop0.isCacheHit(eePc, 1)) {
cop0.loadCacheLine(eePc, *this);
}
auto pcCached{cop0.readCache(eePc)};
auto& pcCached{cop0.readCache(eePc)};
const u32 part{(incPc() & 0xf) / 4};
return pcCached.to32(part);
}
@ -105,7 +105,7 @@ namespace cosmic::ee {
cached.isValid = false;
if (!cached.isValid) {
const auto fasterInstructions{cop0.readCache(address)};
const auto& fasterInstructions{cop0.readCache(address)};
cached[0] = fasterInstructions.to32(0);
cached[4] = fasterInstructions.to32(1);
cached[8] = fasterInstructions.to32(2);
@ -127,9 +127,9 @@ namespace cosmic::ee {
if (executor)
executor.reset();
if (cpuMode == CachedInterpreter) {
executor = std::make_unique<creeper::MipsIvInterpreter>(Optional(*this));
executor = std::make_unique<creeper::MipsIvInterpreter>(Wrapper(*this));
} else if (cpuMode == JitRe) {
executor = std::make_unique<fishron::EeArm64Jitter>(Optional(*this));
executor = std::make_unique<fishron::EeArm64Jitter>(Wrapper(*this));
}
});
}

View File

@ -5,14 +5,14 @@ namespace cosmic::ee {
class EeMipsCore;
class EeExecutor {
public:
EeExecutor(Optional<EeMipsCore>& mips) :
EeExecutor(Wrapper<EeMipsCore>& mips) :
eeCpu(mips) {}
virtual u32 executeCode() = 0;
virtual u32 fetchPcInst(u32 pc) = 0;
virtual void performInvalidation(u32 address) = 0;
virtual ~EeExecutor() = default;
protected:
Optional<EeMipsCore> eeCpu;
Wrapper<EeMipsCore> eeCpu;
};
enum MipsRegsHw : u8 {

View File

@ -5,7 +5,7 @@
namespace cosmic::fishron {
class EeArm64Jitter : public ee::EeExecutor {
public:
EeArm64Jitter(Optional<ee::EeMipsCore> intCpu) :
EeArm64Jitter(Wrapper<ee::EeMipsCore> intCpu) :
EeExecutor(intCpu) {}
u32 executeCode() override;
u32 fetchPcInst(u32 address) override;

View File

@ -1,7 +1,7 @@
#include <gpu/vulcano/vram_allocator.h>
namespace cosmic::gpu::vulcano {
VramManager::VramManager(Optional<GraphicsLayer>& gpu) : graphics(gpu) {
VramManager::VramManager(Wrapper<GraphicsLayer>& gpu) : graphics(gpu) {
VmaAllocatorCreateInfo allocatorInfo{};
vmaCreateAllocator(&allocatorInfo, &vma);
}

View File

@ -6,10 +6,10 @@ namespace cosmic::gpu::vulcano {
class GraphicsLayer;
class VramManager {
public:
VramManager(Optional<GraphicsLayer>& gpu);
VramManager(Wrapper<GraphicsLayer>& gpu);
~VramManager();
private:
VmaAllocator vma{VK_NULL_HANDLE};
Optional<GraphicsLayer> graphics;
Wrapper<GraphicsLayer> graphics;
};
}

View File

@ -24,6 +24,6 @@ namespace cosmic::hle {
void doSyscall(SyscallOrigin origin, i16 sys);
private:
void resetEe();
Optional<vm::EmuVm> vm;
Wrapper<vm::EmuVm> vm;
};
}

View File

@ -15,7 +15,7 @@ namespace cosmic::iop {
IoMipsCore::IoMipsCore(std::shared_ptr<mio::MemoryPipe>& pipe) :
iopMem(pipe) {
interpreter = std::make_unique<creeper::IopInterpreter>(Optional(*this));
interpreter = std::make_unique<creeper::IopInterpreter>(Wrapper(*this));
for (auto& cache : instCache) {
cache.data = {};
cache.tag = {};

View File

@ -23,7 +23,7 @@ namespace cosmic::iop {
void IopDma::pulseSpu2Chain() {
// When true, it means that we will write into the SPU2 device
bool write2Spu;
auto spu2ch{Optional(channels[IopSpu2])};
auto spu2ch{Wrapper(channels[IopSpu2])};
std::array<u32, 2> packet{};
write2Spu = spu2ch->status.isFrom2Device;

View File

@ -5,14 +5,14 @@ namespace cosmic::iop {
class IopExecVe {
public:
IopExecVe(Optional<IoMipsCore>& mips) :
IopExecVe(Wrapper<IoMipsCore>& mips) :
cpu(mips) {}
virtual u32 executeCode() = 0;
virtual u32 fetchPcInst() = 0;
virtual ~IopExecVe() = default;
protected:
Optional<IoMipsCore> cpu;
Wrapper<IoMipsCore> cpu;
};
enum IopSpecial {

View File

@ -72,7 +72,7 @@ namespace cosmic::mio {
u32 countOfQw{};
for (; hasOwner && highCycles > 0; ) {
auto owner{Optional(channels.at(hasOwner.getId()))};
auto owner{Wrapper(channels.at(hasOwner.getId()))};
// "Owner" is the privileged channel that will use the available clock pulses at the moment
switch (owner->index) {
@ -229,13 +229,13 @@ namespace cosmic::mio {
} else if (!isVu) {
return *PipeCraftPtr<u128*>(pipe, address & 0x01fffff0);
}
Optional<vu::VuWorkMemory> vu01Mem{};
Wrapper<vu::VuWorkMemory> vu01Mem{};
u32 mask;
if (address < 0x11008000) {
vu01Mem = Optional(hw.vif0->vifVu->vecRegion);
vu01Mem = Wrapper(hw.vif0->vifVu->vecRegion);
mask = hw.vif0->vifVu->getMemMask();
} else {
vu01Mem = Optional(hw.vif1->vifVu->vecRegion);
vu01Mem = Wrapper(hw.vif1->vifVu->vecRegion);
mask = hw.vif1->vifVu->getMemMask();
}
bool is0Inst{address < 0x11004000};

View File

@ -20,7 +20,7 @@ namespace cosmic::mio {
struct HardWithDmaCap {
public:
HardWithDmaCap() {}
Optional<vu::VifMalice>
Wrapper<vu::VifMalice>
vif0,
vif1;
std::shared_ptr<ee::EeMipsCore> ee;
@ -194,7 +194,7 @@ namespace cosmic::mio {
std::shared_ptr<MemoryPipe> pipe;
struct {
Optional<vu::VifMalice> vif1, vif0;
Wrapper<vu::VifMalice> vif1, vif0;
std::shared_ptr<ee::EeMipsCore> core;
} hw;
};

View File

@ -12,7 +12,7 @@ namespace cosmic::vm {
};
struct SharedVm {
SharedVm(EmuVm& svm) {
vm = Optional(svm);
vm = Wrapper(svm);
running.store(false);
monitor.store(SvrNone);
}
@ -32,7 +32,7 @@ namespace cosmic::vm {
auto isRunning() const {
return running.load();
}
Optional<EmuVm> vm;
Wrapper<EmuVm> vm;
std::atomic<bool> running;
std::atomic<MonitorMode> monitor;
@ -47,10 +47,10 @@ namespace cosmic::vm {
void updateValues(std::shared_ptr<SharedVm>& svm, bool running, u8 isSuper);
static void vmMain(std::shared_ptr<SharedVm>& svm);
static void vmSupervisor(std::shared_ptr<SharedVm> svm);
static void runFrameLoop(Optional<EmuVm>& vm);
static void stepMips(Optional<EmuVm>& vm, u32 mips, u32 iop, u32 bus);
static void stepVus(Optional<EmuVm>& vm, u32 mips, u32 bus);
static void stepGs(Optional<EmuVm>& vm, u32 bus);
static void runFrameLoop(Wrapper<EmuVm>& vm);
static void stepMips(Wrapper<EmuVm>& vm, u32 mips, u32 iop, u32 bus);
static void stepVus(Wrapper<EmuVm>& vm, u32 mips, u32 bus);
static void stepGs(Wrapper<EmuVm>& vm, u32 bus);
std::thread vmThread;
std::shared_ptr<SharedVm> vmSharedPtr;

View File

@ -40,7 +40,7 @@ namespace cosmic::vm {
status.setDesiredFrames(30);
Optional<vu::VectorUnit> vus[]{
Wrapper<vu::VectorUnit> vus[]{
vu01->vpu0Cop2,
vu01->vpu1Dlo
};

View File

@ -2,25 +2,25 @@
#include <vm/emu_vm.h>
namespace cosmic::vm {
void EmuThread::stepMips(Optional<EmuVm>& vm, u32 mips, u32 iop, u32 bus) {
void EmuThread::stepMips(Wrapper<EmuVm>& vm, u32 mips, u32 iop, u32 bus) {
vm->mips->pulse(mips);
vm->iop->pulse(iop);
// DMAC runs in parallel, which could be optimized (and will be early next year)
vm->sharedPipe->controller->pulse(bus);
vm->mpegDecoder->update();
}
void EmuThread::stepVus(Optional<EmuVm>& vm, u32 mips, u32 bus) {
void EmuThread::stepVus(Wrapper<EmuVm>& vm, u32 mips, u32 bus) {
// VUs can run in parallel with EE...
for (u8 runVifs{}; runVifs < 2; runVifs++)
vm->vu01->vifs[runVifs].update(bus);
vm->vu01->vpu0Cop2.pulse(mips);
vm->vu01->vpu1Dlo.pulse(mips);
}
void EmuThread::stepGs(Optional<EmuVm>& vm, u32 bus) {
void EmuThread::stepGs(Wrapper<EmuVm>& vm, u32 bus) {
vm->gsGif->update(bus);
}
void EmuThread::runFrameLoop(Optional<EmuVm>& vm) {
void EmuThread::runFrameLoop(Wrapper<EmuVm>& vm) {
auto sched{vm->scheduler};
while (!vm->status.get(HasFrame)) {
u32 mipsCycles{sched->getNextCycles(Scheduler::Mips)};

View File

@ -1,7 +1,7 @@
#include <vu/v01_cop2vu.h>
namespace cosmic::vu {
MacroModeCop2::MacroModeCop2(Optional<VectorUnit> vus[2])
MacroModeCop2::MacroModeCop2(Wrapper<VectorUnit> vus[2])
: v0(vus[0]),
v1(vus[1]) {
cop2il = false;

View File

@ -6,7 +6,7 @@ namespace cosmic::vu {
// Just a communication interface between these two VUs
class MacroModeCop2 {
public:
MacroModeCop2(Optional<vu::VectorUnit> vus[2]);
MacroModeCop2(Wrapper<vu::VectorUnit> vus[2]);
void clearInterlock();
bool checkInterlock();
bool interlockCheck(bool isCop2);
@ -14,8 +14,8 @@ namespace cosmic::vu {
u32 cfc2(u32 special);
void ctc2(u32 special, u32 value);
Optional<vu::VectorUnit> v0;
Optional<vu::VectorUnit> v1;
Wrapper<vu::VectorUnit> v0;
Wrapper<vu::VectorUnit> v1;
bool cop2il,
vuIl;
};

View File

@ -28,7 +28,7 @@ namespace cosmic::vu {
}
}
VectorUnit::VectorUnit(Optional<VectorUnit> vu2, VuWorkMemory vuWm) :
VectorUnit::VectorUnit(Wrapper<VectorUnit> vu2, VuWorkMemory vuWm) :
paraVu(vu2),
vecRegion(vuWm) {
@ -198,9 +198,9 @@ namespace cosmic::vu {
}
return {};
}
void VectorUnit::establishVif(u16 conTops[2], Optional<gs::GifBridge> gif) {
void VectorUnit::establishVif(u16 conTops[2], Wrapper<gs::GifBridge> gif) {
for (u8 top{}; top < 2; top++)
vifTops[top] = Optional(conTops[top]);
vifTops[top] = Wrapper(conTops[top]);
if (gif)
vu1Gif = gif;

View File

@ -81,7 +81,7 @@ namespace cosmic::vu {
class VectorUnit {
public:
VectorUnit() = delete;
VectorUnit(Optional<VectorUnit> vu2, VuWorkMemory vuWm);
VectorUnit(Wrapper<VectorUnit> vu2, VuWorkMemory vuWm);
void resetVu();
void softwareReset();
@ -103,7 +103,7 @@ namespace cosmic::vu {
VuReg acc;
alignas(32) std::array<VuIntReg, 16> intsRegs;
void establishVif(u16 conTops[2], Optional<gs::GifBridge> gif);
void establishVif(u16 conTops[2], Wrapper<gs::GifBridge> gif);
// P register: Used by EFU to store the result - waitp could be used to stall the execution
// while EFU doesn't finish the previous calculation
u32 vuPc{};
@ -113,7 +113,7 @@ namespace cosmic::vu {
VuStatus status;
VuIntPipeline intPipeline;
Optional<VectorUnit> paraVu;
Wrapper<VectorUnit> paraVu;
void pushIntPipe(u8 ir, u8 fir);
void finishStallPipeTask(bool isDiv);
@ -199,7 +199,7 @@ namespace cosmic::vu {
i64 trigger;
bool isDirty;
} clock;
Optional<u16> vifTops[2];
Optional<gs::GifBridge> vu1Gif;
Wrapper<u16> vifTops[2];
Wrapper<gs::GifBridge> vu1Gif;
};
}

View File

@ -2,7 +2,7 @@
#include <vu/vecu.h>
namespace cosmic::vu {
VifMalice::VifMalice(Optional<VectorUnit> vector, VifGifInterconnector card) :
VifMalice::VifMalice(Wrapper<VectorUnit> vector, VifGifInterconnector card) :
vif2gif(card), vifVu(vector) {
tops[0] = {};

View File

@ -57,7 +57,7 @@ namespace cosmic::vu {
public:
VifMalice() = default;
VifMalice(VifMalice&) = delete;
VifMalice(Optional<VectorUnit> vector, VifGifInterconnector card);
VifMalice(Wrapper<VectorUnit> vector, VifGifInterconnector card);
void update(u32 cycles);
void resetVif();
@ -74,7 +74,7 @@ namespace cosmic::vu {
std::shared_ptr<console::IntCInfra> interrupts;
std::shared_ptr<mio::DmaController> dmac;
Optional<VectorUnit> vifVu;
Wrapper<VectorUnit> vifVu;
mio::DirectChannels vifId;
private:
u16 memMask{};

View File

@ -5,7 +5,7 @@ namespace cosmic::vu {
class VectorUnit;
class VuMicroExecutor {
public:
VuMicroExecutor(Optional<VectorUnit>& vu) : vuMicro(vu) {
VuMicroExecutor(Wrapper<VectorUnit>& vu) : vuMicro(vu) {
}
virtual u32 executeCode() = 0;
@ -14,6 +14,6 @@ namespace cosmic::vu {
virtual std::pair<u32, u32> fetchPcInst() = 0;
virtual ~VuMicroExecutor() = default;
protected:
Optional<VectorUnit> vuMicro;
Wrapper<VectorUnit> vuMicro;
};
}