@HLELogging(level = "info") @HLEFunction(nid = 0x1575D64B, version = 620) public int sceAtracLowLevelInitDecoder( @CheckArgument("checkAtracID") int atID, TPointer32 paramsAddr) { int numberOfChannels = paramsAddr.getValue(0); int outputChannels = paramsAddr.getValue(4); int sourceBufferLength = paramsAddr.getValue(8); if (log.isDebugEnabled()) { log.debug( String.format( "sceAtracLowLevelInitDecoder values at %s: numberOfChannels=%d, outputChannels=%d, sourceBufferLength=0x%08X", paramsAddr, numberOfChannels, outputChannels, sourceBufferLength)); } AtracID id = atracIDs[atID]; int result = 0; id.setChannels(numberOfChannels); id.setOutputChannels(outputChannels); id.setSourceBufferLength(sourceBufferLength); // TODO How to find out the codingMode for AT3 audio? Assume STEREO, not JOINT_STEREO result = id.getCodec().init(sourceBufferLength, numberOfChannels, outputChannels, 0); id.setCodecInitialized(); return result; }
// sceKernelGetMemoryBlockAddr (internal name) @HLEFunction(nid = 0xDB83A952, version = 352) public int SysMemUserForUser_DB83A952(int uid, TPointer32 addr) { SysMemInfo info = blockList.get(uid); if (info == null) { log.warn( String.format("SysMemUserForUser_DB83A952 uid=0x%X, addr=%s: unknown uid", uid, addr)); return SceKernelErrors.ERROR_KERNEL_UNKNOWN_UID; } addr.setValue(info.addr); return 0; }
@HLEFunction(nid = 0x0C116E1B, version = 620) public int sceAtracLowLevelDecode( @CheckArgument("checkAtracID") int atID, TPointer sourceAddr, TPointer32 sourceBytesConsumedAddr, TPointer samplesAddr, TPointer32 sampleBytesAddr) { AtracID id = atracIDs[atID]; ICodec codec = id.getCodec(); if (log.isTraceEnabled()) { log.trace( String.format( "sceAtracLowLevelDecode input:%s", Utilities.getMemoryDump(sourceAddr.getAddress(), id.getSourceBufferLength()))); } int sourceBytesConsumed = 0; int bytesPerSample = id.getOutputChannels() << 1; int result = codec.decode(sourceAddr.getAddress(), id.getSourceBufferLength(), samplesAddr.getAddress()); if (log.isDebugEnabled()) { log.debug(String.format("sceAtracLowLevelDecode codec returned 0x%08X", result)); } if (result < 0) { log.info(String.format("sceAtracLowLevelDecode codec returning 0x%08X", result)); return result; } sourceBytesConsumed = result > 0 ? id.getSourceBufferLength() : 0; sampleBytesAddr.setValue(codec.getNumberOfSamples() * bytesPerSample); // Consume a part of the Atrac3 source buffer sourceBytesConsumedAddr.setValue(sourceBytesConsumed); Modules.ThreadManForUserModule.hleKernelDelayThread(atracDecodeDelay, false); return 0; }