Exemplo n.º 1
0
  // 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;
  }
Exemplo n.º 2
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;
  }