public String functionName(int code) {
    HLEModuleFunction func = getFunctionFromSyscallCode(code);
    if (func == null) {
      return null;
    }

    return func.getFunctionName();
  }
  private void installFunctionWithAnnotations(
      HLEFunction hleFunction, Method method, HLEModule hleModule) {
    HLEUnimplemented hleUnimplemented = method.getAnnotation(HLEUnimplemented.class);
    HLELogging hleLogging = method.getAnnotation(HLELogging.class);

    // Take the module default logging if no HLELogging has been
    // defined at the function level and if the function is not
    // unimplemented (which will produce it's own logging).
    if (hleLogging == null && hleUnimplemented == null) {
      HLELogging hleModuleLogging = method.getDeclaringClass().getAnnotation(HLELogging.class);
      if (hleModuleLogging != null) {
        // Take the module default logging
        hleLogging = hleModuleLogging;
      }
    }

    String moduleName = hleFunction.moduleName();
    String functionName = hleFunction.functionName();

    if (moduleName.length() == 0) {
      moduleName = hleModule.getName();
    }

    if (functionName.length() == 0) {
      functionName = method.getName();
    }

    HLEModuleFunction hleModuleFunction =
        new HLEModuleFunction(
            moduleName,
            functionName,
            hleModule,
            method,
            hleFunction.checkInsideInterrupt(),
            hleFunction.checkDispatchThreadEnabled());

    if (hleUnimplemented != null) {
      hleModuleFunction.setUnimplemented(true);
    }

    if (hleLogging != null) {
      hleModuleFunction.setLoggingLevel(hleLogging.level());
    }

    hleModule.installedHLEModuleFunctions.put(functionName, hleModuleFunction);

    addFunction(hleFunction.nid(), hleModuleFunction);
  }
 public void addFunction(int nid, HLEModuleFunction func) {
   int code = getSyscallFromNid(nid);
   if (code < syscallCodeToFunction.length && syscallCodeToFunction[code] != null) {
     if (func != syscallCodeToFunction[code]) {
       log.error(
           String.format(
               "Tried to register a second handler for NID 0x%08X called %s",
               nid, func.getFunctionName()));
     } else {
       func.setNid(nid);
       func.setSyscallCode(code);
     }
   } else {
     func.setNid(nid);
     func.setSyscallCode(code);
     addSyscallCodeToFunction(code, func);
   }
 }
 public void removeFunction(HLEModuleFunction func) {
   int syscallCode = func.getSyscallCode();
   if (syscallCode >= 0 && syscallCode < syscallCodeToFunction.length) {
     syscallCodeToFunction[syscallCode] = null;
   }
 }