diff options
| author | Ac_K <Acoustik666@gmail.com> | 2023-01-08 13:13:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-08 12:13:39 +0000 |
| commit | 550747eac6c0f6da14070c8b6d208bde6f1d1eb9 (patch) | |
| tree | 1be203777156dae17a4221589c852c638b273d94 /Ryujinx.Horizon.Generators | |
| parent | 3ffceab1fb220c13f5982de599d788f2e3e7cc47 (diff) | |
Horizon: Impl Prepo, Fixes bugs, Clean things (#4220)
* Horizon: Impl Prepo, Fixes bugs, Clean things
* remove ToArray()
* resultCode > status
* Remove old services
* Addresses gdkchan's comments and more cleanup
* Addresses Gdkchan's feedback 2
* Reorganize services, make sure service are loaded before guest
Co-Authored-By: gdkchan <5624669+gdkchan@users.noreply.github.com>
* Create interfaces for lm and sm
Co-authored-by: gdkchan <5624669+gdkchan@users.noreply.github.com>
Diffstat (limited to 'Ryujinx.Horizon.Generators')
| -rw-r--r-- | Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs b/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs index a66d57a3..332e04d1 100644 --- a/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs +++ b/Ryujinx.Horizon.Generators/Hipc/HipcGenerator.cs @@ -123,44 +123,51 @@ namespace Ryujinx.Horizon.Generators.Hipc { string[] args = new string[method.ParameterList.Parameters.Count]; - int index = 0; - - foreach (var parameter in method.ParameterList.Parameters) + if (args.Length == 0) { - string canonicalTypeName = GetCanonicalTypeNameWithGenericArguments(compilation, parameter.Type); - CommandArgType argType = GetCommandArgType(compilation, parameter); - - string arg; + generator.AppendLine($"{{ {commandId}, new CommandHandler({method.Identifier.Text}, Array.Empty<CommandArg>()) }},"); + } + else + { + int index = 0; - if (argType == CommandArgType.Buffer) + foreach (var parameter in method.ParameterList.Parameters) { - string bufferFlags = GetFirstAttributeAgument(compilation, parameter, TypeBufferAttribute, 0); - string bufferFixedSize = GetFirstAttributeAgument(compilation, parameter, TypeBufferAttribute, 1); + string canonicalTypeName = GetCanonicalTypeNameWithGenericArguments(compilation, parameter.Type); + CommandArgType argType = GetCommandArgType(compilation, parameter); + + string arg; - if (bufferFixedSize != null) + if (argType == CommandArgType.Buffer) + { + string bufferFlags = GetFirstAttributeAgument(compilation, parameter, TypeBufferAttribute, 0); + string bufferFixedSize = GetFirstAttributeAgument(compilation, parameter, TypeBufferAttribute, 1); + + if (bufferFixedSize != null) + { + arg = $"new CommandArg({bufferFlags}, {bufferFixedSize})"; + } + else + { + arg = $"new CommandArg({bufferFlags})"; + } + } + else if (argType == CommandArgType.InArgument || argType == CommandArgType.OutArgument) { - arg = $"new CommandArg({bufferFlags}, {bufferFixedSize})"; + string alignment = GetTypeAlignmentExpression(compilation, parameter.Type); + + arg = $"new CommandArg(CommandArgType.{argType}, Unsafe.SizeOf<{canonicalTypeName}>(), {alignment})"; } else { - arg = $"new CommandArg({bufferFlags})"; + arg = $"new CommandArg(CommandArgType.{argType})"; } - } - else if (argType == CommandArgType.InArgument || argType == CommandArgType.OutArgument) - { - string alignment = GetTypeAlignmentExpression(compilation, parameter.Type); - arg = $"new CommandArg(CommandArgType.{argType}, Unsafe.SizeOf<{canonicalTypeName}>(), {alignment})"; - } - else - { - arg = $"new CommandArg(CommandArgType.{argType})"; + args[index++] = arg; } - args[index++] = arg; + generator.AppendLine($"{{ {commandId}, new CommandHandler({method.Identifier.Text}, {string.Join(", ", args)}) }},"); } - - generator.AppendLine($"{{ {commandId}, new CommandHandler({method.Identifier.Text}, {string.Join(", ", args)}) }},"); } } |
