示例#1
0
  @HLEFunction(nid = 0xB287BD61, version = 150)
  public int sceGeDrawSync(@CheckArgument("checkMode") int mode) {
    if (mode == 0 && IntrManager.getInstance().isInsideInterrupt()) {
      log.debug("sceGeDrawSync (mode==0) cannot be called inside an interrupt handler!");
      return SceKernelErrors.ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
    }

    // no synchronization on "this" required because we are not accessing
    // local data, only list information from the VideoEngine.
    int result = 0;
    if (mode == 0) {
      PspGeList lastList;
      if (ExternalGE.isActive()) {
        lastList = ExternalGE.getLastDrawList();
      } else {
        lastList = VideoEngine.getInstance().getLastDrawList();
      }

      if (lastList != null) {
        blockCurrentThreadOnList(lastList, new HLEAfterDrawSyncAction());
      } else {
        if (log.isDebugEnabled()) {
          log.debug("sceGeDrawSync all lists completed, not waiting");
        }
        hleGeAfterDrawSyncAction();
        Modules.ThreadManForUserModule.hleRescheduleCurrentThread();
      }
    } else if (mode == 1) {
      PspGeList currentList;
      if (ExternalGE.isActive()) {
        currentList = ExternalGE.getFirstDrawList();
      } else {
        currentList = VideoEngine.getInstance().getFirstDrawList();
      }
      if (currentList != null) {
        result = currentList.status;
      }
      if (log.isDebugEnabled()) {
        log.debug(String.format("sceGeDrawSync mode=%d, returning %d", mode, result));
      }
    }

    return result;
  }
示例#2
0
  @HLEFunction(nid = 0x03444EB4, version = 150)
  public int sceGeListSync(
      @CheckArgument("checkListId") int id, @CheckArgument("checkMode") int mode) {
    if (mode == 0 && IntrManager.getInstance().isInsideInterrupt()) {
      log.debug("sceGeListSync (mode==0) cannot be called inside an interrupt handler!");
      return SceKernelErrors.ERROR_KERNEL_CANNOT_BE_CALLED_FROM_INTERRUPT;
    }

    PspGeList list = null;
    boolean blockCurrentThread = false;
    int result;
    synchronized (this) {
      list = allGeLists[id];
      if (log.isDebugEnabled()) {
        log.debug(String.format("sceGeListSync on list: %s", list));
      }

      if (list.isReset()) {
        throw new SceKernelErrorException(SceKernelErrors.ERROR_INVALID_ID);
      }

      if (mode == 0 && !list.isDone()) {
        result = 0;
        blockCurrentThread = true;
      } else {
        result = list.status;
      }
    }

    // Block the current thread outside of the synchronized block
    if (blockCurrentThread) {
      blockCurrentThreadOnList(list, null);
    }

    return result;
  }