Skip to content

Commit

Permalink
Fix dmac regression
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jan 20, 2025
1 parent eba460f commit a2d436b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Core/HLE/AtracCtx2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "Core/HW/Atrac3Standalone.h"

// Convenient command line:
// Windows\x64\debug\PPSSPPHeadless.exe --root pspautotests/tests/../ --compare --timeout=5 --new-atrac --graphics=software pspautotests/tests/audio/atrac/decode.prx

// Windows\x64\debug\PPSSPPHeadless.exe --root pspautotests/tests/../ -o --compare --timeout=30 --graphics=software pspautotests/tests/audio/atrac/... --ignore pspautotests/tests/audio/atrac/second/resetting.prx --ignore pspautotests/tests/audio/atrac/second/replay.prx
//
// See the big comment in sceAtrac.cpp for an overview of the different modes of operation.
//
// Test cases
Expand Down
3 changes: 1 addition & 2 deletions Core/HLE/sceAtrac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,8 @@ static int sceAtracReinit(int at3Count, int at3plusCount) {

// This seems to deinit things. Mostly, it cause a reschedule on next deinit (but -1, -1 does not.)
if (at3Count == 0 && at3plusCount == 0) {
INFO_LOG(Log::ME, "sceAtracReinit(%d, %d): deinit", at3Count, at3plusCount);
atracInited = false;
return hleDelayResult(0, "atrac reinit", 200);
return hleDelayResult(hleLogSuccessInfoI(Log::ME, 0, "deinit"), "atrac reinit", 200);
}

// First, ATRAC3+. These IDs seem to cost double (probably memory.)
Expand Down
18 changes: 10 additions & 8 deletions Core/HLE/sceDmac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void __DmacDoState(PointerWrap &p) {
Do(p, dmacMemcpyDeadline);
}

static void __DmacMemcpy(u32 dst, u32 src, u32 size, int *delay) {
static int __DmacMemcpy(u32 dst, u32 src, u32 size) {
bool skip = false;
if (Memory::IsVRAMAddress(src) || Memory::IsVRAMAddress(dst)) {
skip = gpu->PerformMemoryCopy(dst, src, size);
Expand All @@ -65,7 +65,9 @@ static void __DmacMemcpy(u32 dst, u32 src, u32 size, int *delay) {
// Approx. 225 MiB/s or 235929600 B/s, so let's go with 236 B/us.
int delayUs = size / 236;
dmacMemcpyDeadline = CoreTiming::GetTicks() + usToCycles(delayUs);
*delay = delayUs;
return delayUs;
} else {
return 0;
}
}

Expand All @@ -87,9 +89,9 @@ static u32 sceDmacMemcpy(u32 dst, u32 src, u32 size) {
// Might matter for overlapping copies.
}

int delay = 0;
__DmacMemcpy(dst, src, size, &delay);
return hleDelayResult(hleLogDebug(Log::HLE, 0), "dmac-memcpy", delay);
int delay = __DmacMemcpy(dst, src, size);
int result = hleLogDebug(Log::HLE, 0);
return delay ? hleDelayResult(result, "dmac-memcpy", delay) : delay;
}

static u32 sceDmacTryMemcpy(u32 dst, u32 src, u32 size) {
Expand All @@ -107,9 +109,9 @@ static u32 sceDmacTryMemcpy(u32 dst, u32 src, u32 size) {
return hleLogDebug(Log::HLE, SCE_KERNEL_ERROR_BUSY, "busy");
}

int delay = 0;
__DmacMemcpy(dst, src, size, &delay);
return hleDelayResult(hleLogDebug(Log::HLE, 0), "dmac-try-copy", delay);
int delay = __DmacMemcpy(dst, src, size);
int result = hleLogDebug(Log::HLE, 0);
return delay ? hleDelayResult(result, "dmac-memcpy", delay) : delay;
}

const HLEFunction sceDmac[] = {
Expand Down

0 comments on commit a2d436b

Please sign in to comment.