Beispiel #1
0
  @HLEFunction(nid = 0x0BF608FB, version = 150)
  public int sceGeRestoreContext(TPointer contextAddr) {
    if (ExternalGE.isActive()) {
      return ExternalGE.restoreContext(contextAddr.getAddress());
    }

    VideoEngine.getInstance().hleRestoreContext(contextAddr.getAddress());

    return 0;
  }
Beispiel #2
0
  @HLEFunction(nid = 0x438A385A, version = 150)
  public int sceGeSaveContext(TPointer contextAddr) {
    if (ExternalGE.isActive()) {
      return ExternalGE.saveContext(contextAddr.getAddress());
    }

    VideoEngine.getInstance().hleSaveContext(contextAddr.getAddress());

    return 0;
  }
Beispiel #3
0
  @HLEFunction(nid = 0xE0D68148, version = 150)
  public int sceGeListUpdateStallAddr(
      @CheckArgument("checkListId") int id, @CanBeNull TPointer stallAddr) {
    synchronized (this) {
      PspGeList list = allGeLists[id];
      if (list.getStallAddr() != stallAddr.getAddress()) {
        list.setStallAddr(stallAddr.getAddress());
        Modules.sceDisplayModule.setGeDirty(true);
      }
    }

    return 0;
  }
Beispiel #4
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;
  }
Beispiel #5
0
  public int hleGeListEnQueue(
      TPointer listAddr,
      @CanBeNull TPointer stallAddr,
      int cbid,
      @CanBeNull TPointer argAddr,
      int saveContextAddr,
      boolean enqueueHead) {
    pspGeListOptParam optParams = null;
    int stackAddr = 0;
    if (argAddr.isNotNull()) {
      optParams = new pspGeListOptParam();
      optParams.read(argAddr);
      stackAddr = optParams.stackAddr;
      if (log.isDebugEnabled()) {
        log.debug(String.format("hleGeListEnQueue optParams=%s", optParams));
      }
    }

    if (Modules.SysMemUserForUserModule.hleKernelGetCompiledSdkVersion() >= 0x02000000) {
      boolean isBusy;
      if (ExternalGE.isActive()) {
        isBusy = ExternalGE.hasDrawList(listAddr.getAddress(), stackAddr);
      } else {
        isBusy = VideoEngine.getInstance().hasDrawList(listAddr.getAddress(), stackAddr);
      }
      if (isBusy) {
        log.warn(
            String.format(
                "hleGeListEnQueue can't enqueue duplicate list address %s, stack 0x%08X",
                listAddr, stackAddr));
        return SceKernelErrors.ERROR_BUSY;
      }
    }

    int result;
    synchronized (this) {
      PspGeList list = listFreeQueue.poll();
      if (list == null) {
        log.warn("hleGeListEnQueue no more free list available!");
        if (log.isDebugEnabled()) {
          for (int i = 0; i < NUMBER_GE_LISTS; i++) {
            log.debug(String.format("List#%d: %s", i, allGeLists[i]));
          }
        }
        return SceKernelErrors.ERROR_OUT_OF_MEMORY;
      }

      list.init(listAddr.getAddress(), stallAddr.getAddress(), cbid, optParams);
      list.setSaveContextAddr(saveContextAddr);
      if (enqueueHead) {
        // Send the list to the VideoEngine at the head of the queue.
        list.startListHead();
      } else {
        // Send the list to the VideoEngine before triggering the display (setting GE dirty)
        list.startList();
      }
      Modules.sceDisplayModule.setGeDirty(true);
      result = list.id;
    }

    if (log.isDebugEnabled()) {
      log.debug(String.format("hleGeListEnQueue returning 0x%X", result));
    }

    return result;
  }