예제 #1
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);
        }
예제 #2
0
        private static int Param(ServiceCtx Context)
        {
            long InputPosition  = Context.Request.GetBufferType0x21().Position;
            long OutputPosition = Context.Request.GetBufferType0x22().Position;

            NvMapParam Args = AMemoryHelper.Read <NvMapParam>(Context.Memory, InputPosition);

            NvMapHandle Map = GetNvMap(Context, Args.Handle);

            if (Map == null)
            {
                Context.Device.Log.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);
            }

            AMemoryHelper.Write(Context.Memory, OutputPosition, Args);

            return(NvResult.Success);
        }