mirror of
https://github.com/shadergz/cosmic-station.git
synced 2024-11-26 15:50:22 +00:00
EE
: Fixes the writeArr method
- The address was being calculated incorrectly, not accounting for the increment by 4
This commit is contained in:
parent
dd3d9b9d03
commit
d485e5fa77
@ -32,9 +32,10 @@ namespace cosmic::creeper {
|
||||
vMul = vu->vuGPRs[rad].uns[idx];
|
||||
}
|
||||
const auto vBase{vu->vuGPRs[mul].uns[idx]};
|
||||
volatile const f32 failure{1.};
|
||||
|
||||
// https://fobes.dev/ps2/detecting-emu-vu-floats
|
||||
if (vMul != 1.) {
|
||||
if (vMul != static_cast<u32>(failure)) {
|
||||
return vu->toSony754(vMul) * vu->toSony754(vBase);
|
||||
}
|
||||
vMul &= static_cast<u32>(~(0x8000));
|
||||
|
@ -48,7 +48,7 @@ namespace cosmic::ee {
|
||||
u32 fetchByAddress(u32 address);
|
||||
void invalidateExecRegion(u32 address);
|
||||
|
||||
u32 writeArr(u32 address, std::span<u32> dataBlk);
|
||||
u64 writeArr(u32 address, std::span<u32> dataBlk);
|
||||
const u8* first{reinterpret_cast<u8*>(1)};
|
||||
|
||||
template <typename T>
|
||||
|
@ -1,12 +1,41 @@
|
||||
#include <ee/ee_core.h>
|
||||
namespace cosmic::ee {
|
||||
u32 EeMipsCore::writeArr(u32 address, std::span<u32> dataBlk) {
|
||||
u32 count{};
|
||||
for (const auto value : dataBlk) {
|
||||
mipsWrite<u32>(address++, value);
|
||||
count++;
|
||||
template <typename T>
|
||||
struct RangedAddress {
|
||||
u32 base;
|
||||
RangedAddress(u32 addr) : base(addr) {
|
||||
}
|
||||
return count;
|
||||
u32 operator++(i32 inc) {
|
||||
auto before{base};
|
||||
base += sizeof(T);
|
||||
return before;
|
||||
}
|
||||
operator u32() const {
|
||||
return base;
|
||||
}
|
||||
};
|
||||
u64 EeMipsCore::writeArr(u32 address, std::span<u32> dataBlk) {
|
||||
u64 count{};
|
||||
RangedAddress<u32> addrW{address};
|
||||
|
||||
for (; (dataBlk.size() - count) >= 8; count += 8) {
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 0]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 1]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 2]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 3]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 4]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 5]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 6]);
|
||||
mipsWrite<u32>(addrW++, dataBlk[count + 7]);
|
||||
|
||||
}
|
||||
const std::span<u32> remain{
|
||||
&dataBlk[count],
|
||||
dataBlk.size() - count};
|
||||
for (const auto value : remain) {
|
||||
mipsWrite<u32>(addrW++, value);
|
||||
}
|
||||
return count + remain.size();
|
||||
}
|
||||
void EeMipsCore::setLoHi(i64 lo, i64 hi) {
|
||||
mulDivStorage[0] = lo & 0xffffffff;
|
||||
|
@ -28,22 +28,24 @@ namespace cosmic::vm {
|
||||
timers.resize(schedTimers.capacity());
|
||||
events.resize(schedEvents.capacity());
|
||||
|
||||
user->success("Scheduler initialized, number of available timers and events {}<>{}", schedTimers.size(), schedEvents.size());
|
||||
user->success("Scheduler initialized, "
|
||||
"number of available timers and events {}<>{}",
|
||||
schedTimers.capacity(), schedEvents.capacity());
|
||||
}
|
||||
void Scheduler::resetCycles() {
|
||||
// eeCycles.highClock = 0;
|
||||
// eeCycles.remain = 0;
|
||||
// eeCycles.cycles = 0;
|
||||
eeCycles = {};
|
||||
eeCycles.highClock = 0;
|
||||
eeCycles.remain = 0;
|
||||
eeCycles.cycles = 0;
|
||||
// eeCycles = {};
|
||||
|
||||
// busCycles.highClock = 0;
|
||||
// busCycles.remain = 0;
|
||||
// busCycles.cycles = 0;
|
||||
busCycles = {};
|
||||
// iopCycles.highClock = 0;
|
||||
// iopCycles.remain = 0;
|
||||
// iopCycles.cycles = 0;
|
||||
iopCycles = {};
|
||||
busCycles.highClock = 0;
|
||||
busCycles.remain = 0;
|
||||
busCycles.cycles = 0;
|
||||
// busCycles = {};
|
||||
iopCycles.highClock = 0;
|
||||
iopCycles.remain = 0;
|
||||
iopCycles.cycles = 0;
|
||||
// iopCycles = {};
|
||||
|
||||
nearestEventCycle = std::numeric_limits<u64>::max();
|
||||
std::list<EventSched> ee{};
|
||||
@ -111,7 +113,7 @@ namespace cosmic::vm {
|
||||
}
|
||||
EventSched eve{};
|
||||
eve.callback = invoke;
|
||||
auto result{schedEvents.size()};
|
||||
const auto result{schedEvents.size()};
|
||||
schedEvents.push_back(eve);
|
||||
|
||||
return result;
|
||||
@ -136,7 +138,7 @@ namespace cosmic::vm {
|
||||
timer.target = maxCycle;
|
||||
timer.lastUpdate = eeCycles.cycles;
|
||||
auto hasEvent{
|
||||
placeTickedTask(sid, maxCycle, std::make_pair(timers.size(), true))
|
||||
placeTickedTask(sid, maxCycle, std::make_pair(timers.size(), true), true)
|
||||
};
|
||||
if (!hasEvent)
|
||||
return {};
|
||||
|
@ -224,7 +224,8 @@ namespace cosmic::vu {
|
||||
}
|
||||
const i32 vuId{paraVu ? 1 : 0};
|
||||
|
||||
user->success("(VU{}) vcallms executed, previous microprogram at {}, new program at {}", vuId, oldPc, vuPc);
|
||||
user->success("(VU{}) vcallms executed, previous microprogram at {}, new program at {}",
|
||||
vuId, oldPc, vuPc);
|
||||
}
|
||||
u32 VectorUnit::getMemMask() const noexcept {
|
||||
u32 mask{};
|
||||
|
Loading…
Reference in New Issue
Block a user