Exemple #1
0
        private NvInternalResult Param(ref NvMapParam arguments)
        {
            NvMapHandle map = GetMapFromHandle(Owner, arguments.Handle);

            if (map == null)
            {
                Logger.Warning?.Print(LogClass.ServiceNv, $"Invalid handle 0x{arguments.Handle:x8}!");

                return(NvInternalResult.InvalidInput);
            }

            switch (arguments.Param)
            {
            case NvMapHandleParam.Size:  arguments.Result = map.Size;   break;

            case NvMapHandleParam.Align: arguments.Result = map.Align;  break;

            case NvMapHandleParam.Heap:  arguments.Result = 0x40000000; break;

            case NvMapHandleParam.Kind:  arguments.Result = map.Kind;   break;

            case NvMapHandleParam.Compr: arguments.Result = 0;          break;

            // Note: Base is not supported and returns an error.
            // Any other value also returns an error.
            default: return(NvInternalResult.InvalidInput);
            }

            return(NvInternalResult.Success);
        }
Exemple #2
0
        private static int Param(ServiceCtx context)
        {
            long inputPosition  = context.Request.GetBufferType0x21().Position;
            long outputPosition = context.Request.GetBufferType0x22().Position;

            NvMapParam args = MemoryHelper.Read <NvMapParam>(context.Memory, inputPosition);

            NvMapHandle map = GetNvMap(context, args.Handle);

            if (map == null)
            {
                Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{args.Handle:x8}!");

                return(NvResult.InvalidInput);
            }

            switch ((NvMapHandleParam)args.Param)
            {
            case NvMapHandleParam.Size:  args.Result = map.Size;   break;

            case NvMapHandleParam.Align: args.Result = map.Align;  break;

            case NvMapHandleParam.Heap:  args.Result = 0x40000000; break;

            case NvMapHandleParam.Kind:  args.Result = map.Kind;   break;

            case NvMapHandleParam.Compr: args.Result = 0;          break;

            // Note: Base is not supported and returns an error.
            // Any other value also returns an error.
            default: return(NvResult.InvalidInput);
            }

            MemoryHelper.Write(context.Memory, outputPosition, args);

            return(NvResult.Success);
        }