mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add some comments for sceAtrac
This commit is contained in:
parent
7b8fb33ebc
commit
066a2e2182
1 changed files with 14 additions and 1 deletions
|
@ -427,6 +427,12 @@ u32 sceAtracGetAtracID(int codecType)
|
||||||
return atracID;
|
return atracID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PSP allow games to add stream data to a temp buf, the buf size is given by "atracBufSize "here.
|
||||||
|
// "first.offset" means how many bytes the temp buf has been written,
|
||||||
|
// and "first.writableBytes" means how many bytes the temp buf is allowed to write
|
||||||
|
// (We always have "first.offset + first.writableBytes = atracBufSize").
|
||||||
|
// We only reset the temp buf when games call sceAtracGetStreamDataInfo,
|
||||||
|
// because that function would tell games how to add the left stream data.
|
||||||
u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd)
|
u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd)
|
||||||
{
|
{
|
||||||
INFO_LOG(HLE, "sceAtracAddStreamData(%i, %08x)", atracID, bytesToAdd);
|
INFO_LOG(HLE, "sceAtracAddStreamData(%i, %08x)", atracID, bytesToAdd);
|
||||||
|
@ -738,6 +744,9 @@ u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoopStartSa
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Games call this function to get some info for add more stream data,
|
||||||
|
// such as where the data read from, where the data add to,
|
||||||
|
// and how many bytes are allowed to add.
|
||||||
u32 sceAtracGetStreamDataInfo(int atracID, u32 writeAddr, u32 writableBytesAddr, u32 readOffsetAddr)
|
u32 sceAtracGetStreamDataInfo(int atracID, u32 writeAddr, u32 writableBytesAddr, u32 readOffsetAddr)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(HLE, "sceAtracGetStreamDataInfo(%i, %08x, %08x, %08x)", atracID, writeAddr, writableBytesAddr, readOffsetAddr);
|
DEBUG_LOG(HLE, "sceAtracGetStreamDataInfo(%i, %08x, %08x, %08x)", atracID, writeAddr, writableBytesAddr, readOffsetAddr);
|
||||||
|
@ -745,8 +754,10 @@ u32 sceAtracGetStreamDataInfo(int atracID, u32 writeAddr, u32 writableBytesAddr,
|
||||||
if (!atrac) {
|
if (!atrac) {
|
||||||
//return -1;
|
//return -1;
|
||||||
} else {
|
} else {
|
||||||
|
// reset the temp buf for adding more stream data
|
||||||
atrac->first.writableBytes = std::min(atrac->first.filesize - atrac->first.size, atrac->atracBufSize);
|
atrac->first.writableBytes = std::min(atrac->first.filesize - atrac->first.size, atrac->atracBufSize);
|
||||||
atrac->first.offset = 0;
|
atrac->first.offset = 0;
|
||||||
|
|
||||||
if (Memory::IsValidAddress(writeAddr))
|
if (Memory::IsValidAddress(writeAddr))
|
||||||
Memory::Write_U32(atrac->first.addr, writeAddr);
|
Memory::Write_U32(atrac->first.addr, writeAddr);
|
||||||
if (Memory::IsValidAddress(writableBytesAddr))
|
if (Memory::IsValidAddress(writableBytesAddr))
|
||||||
|
@ -887,10 +898,12 @@ int __AtracSetContext(Atrac *atrac, u32 buffer, u32 bufferSize)
|
||||||
|
|
||||||
int _AtracSetData(Atrac *atrac, u32 buffer, u32 bufferSize)
|
int _AtracSetData(Atrac *atrac, u32 buffer, u32 bufferSize)
|
||||||
{
|
{
|
||||||
atrac->atracBufSize = bufferSize;
|
|
||||||
if (atrac->first.size > atrac->first.filesize)
|
if (atrac->first.size > atrac->first.filesize)
|
||||||
atrac->first.size = atrac->first.filesize;
|
atrac->first.size = atrac->first.filesize;
|
||||||
atrac->first.fileoffset = atrac->first.size;
|
atrac->first.fileoffset = atrac->first.size;
|
||||||
|
|
||||||
|
// got the size of temp buf, and calculate writableBytes and offset
|
||||||
|
atrac->atracBufSize = bufferSize;
|
||||||
atrac->first.writableBytes = (u32)std::max((int)bufferSize - (int)atrac->first.size, 0);
|
atrac->first.writableBytes = (u32)std::max((int)bufferSize - (int)atrac->first.size, 0);
|
||||||
atrac->first.offset = atrac->first.size;
|
atrac->first.offset = atrac->first.size;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue