Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AtracDecodeDataRemainFrameHack #18396

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Compatibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "Fontltn12Hack", &flags_.Fontltn12Hack);
CheckSetting(iniFile, gameID, "LoadCLUTFromCurrentFrameOnly", &flags_.LoadCLUTFromCurrentFrameOnly);
CheckSetting(iniFile, gameID, "ForceUMDReadSpeed", &flags_.ForceUMDReadSpeed);
CheckSetting(iniFile, gameID, "AtracDecodeDataRemainFrameHack", &flags_.AtracDecodeDataRemainFrameHack);
}

void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) {
Expand Down
1 change: 1 addition & 0 deletions Core/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct CompatFlags {
bool Fontltn12Hack;
bool LoadCLUTFromCurrentFrameOnly;
bool ForceUMDReadSpeed;
bool AtracDecodeDataRemainFrameHack;
};

struct VRCompat {
Expand Down
8 changes: 5 additions & 3 deletions Core/HLE/sceAtrac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1380,8 +1380,11 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32
if (Memory::IsValidAddress(finishFlagAddr))
Memory::Write_U32(finish, finishFlagAddr);
// On error, no remaining frame value is written.
if (ret == 0 && Memory::IsValidAddress(remainAddr))
if (ret == 0 && Memory::IsValidAddress(remainAddr)){
if (PSP_CoreParameter().compat.flags().AtracDecodeDataRemainFrameHack && remains > 0)
remains--;
Memory::Write_U32(remains, remainAddr);
}
}
DEBUG_LOG(ME, "%08x=sceAtracDecodeData(%i, %08x, %08x[%08x], %08x[%08x], %08x[%d])", ret, atracID, outAddr,
numSamplesAddr, numSamples,
Expand Down Expand Up @@ -1531,7 +1534,6 @@ static u32 sceAtracGetLoopStatus(int atracID, u32 loopNumAddr, u32 statusAddr) {
ERROR_LOG(ME, "sceAtracGetLoopStatus(%i, %08x, %08x): no data", atracID, loopNumAddr, statusAddr);
return ATRAC_ERROR_NO_DATA;
} else {
DEBUG_LOG(ME, "sceAtracGetLoopStatus(%i, %08x, %08x)", atracID, loopNumAddr, statusAddr);
if (Memory::IsValidAddress(loopNumAddr))
Memory::Write_U32(atrac->loopNum_, loopNumAddr);
// return audio's loopinfo in at3 file
Expand All @@ -1542,7 +1544,7 @@ static u32 sceAtracGetLoopStatus(int atracID, u32 loopNumAddr, u32 statusAddr) {
Memory::Write_U32(0, statusAddr);
}
}
return 0;
return hleLogDebug(ME, 0);
}

static u32 sceAtracGetInternalErrorInfo(int atracID, u32 errorAddr) {
Expand Down
9 changes: 8 additions & 1 deletion assets/compat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1645,4 +1645,11 @@ SYPH04036 = true # Prototype?
ULES00590 = true
ULJM05075 = true
#Sengoku Musou 3Z Special DLC see #9993
ULJM06024 = true
ULJM06024 = true

[AtracDecodeDataRemainFrameHack]
#Return less than 1 RemainFrame in sceAtracDecodeData to get valid data,then psp will call sceAtracAddStreamData and sceAtracGetStreamDataInfo.

# Kaitou Apricot see #15233
ULJM05276 = true
NPJH50167 = true