Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ryujinx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tartifless
Ryujinx
Commits
391f57bd
Commit
391f57bd
authored
2 months ago
by
Evan Husted
Browse files
Options
Downloads
Patches
Plain Diff
misc: Headless: Inherit main input config
parent
fd2b5a7f
No related branches found
Branches containing commit
Tags
Canary-1.2.414
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Ryujinx/Headless/HeadlessRyujinx.cs
+23
-9
23 additions, 9 deletions
src/Ryujinx/Headless/HeadlessRyujinx.cs
src/Ryujinx/Headless/Options.cs
+33
-2
33 additions, 2 deletions
src/Ryujinx/Headless/Options.cs
with
56 additions
and
11 deletions
src/Ryujinx/Headless/HeadlessRyujinx.cs
+
23
−
9
View file @
391f57bd
...
...
@@ -162,6 +162,11 @@ namespace Ryujinx.Headless
}
ReloadConfig
();
if
(
option
.
InheritConfig
)
{
option
.
InheritMainConfigInput
(
originalArgs
,
ConfigurationState
.
Instance
);
}
_virtualFileSystem
=
VirtualFileSystem
.
CreateInstance
();
_libHacHorizonManager
=
new
LibHacHorizonManager
();
...
...
@@ -224,15 +229,7 @@ namespace Ryujinx.Headless
_enableKeyboard
=
option
.
EnableKeyboard
;
_enableMouse
=
option
.
EnableMouse
;
static
void
LoadPlayerConfiguration
(
string
inputProfileName
,
string
inputId
,
PlayerIndex
index
)
{
InputConfig
inputConfig
=
HandlePlayerConfiguration
(
inputProfileName
,
inputId
,
index
);
if
(
inputConfig
!=
null
)
{
_inputConfiguration
.
Add
(
inputConfig
);
}
}
LoadPlayerConfiguration
(
option
.
InputProfile1Name
,
option
.
InputId1
,
PlayerIndex
.
Player1
);
LoadPlayerConfiguration
(
option
.
InputProfile2Name
,
option
.
InputId2
,
PlayerIndex
.
Player2
);
...
...
@@ -244,7 +241,6 @@ namespace Ryujinx.Headless
LoadPlayerConfiguration
(
option
.
InputProfile8Name
,
option
.
InputId8
,
PlayerIndex
.
Player8
);
LoadPlayerConfiguration
(
option
.
InputProfileHandheldName
,
option
.
InputIdHandheld
,
PlayerIndex
.
Handheld
);
if
(
_inputConfiguration
.
Count
==
0
)
{
return
;
...
...
@@ -306,6 +302,24 @@ namespace Ryujinx.Headless
}
_inputManager
.
Dispose
();
return
;
void
LoadPlayerConfiguration
(
string
inputProfileName
,
string
inputId
,
PlayerIndex
index
)
{
if
(
index
==
PlayerIndex
.
Handheld
&&
_inputConfiguration
.
Count
>
0
)
{
Logger
.
Info
?.
Print
(
LogClass
.
Configuration
,
"Skipping handheld configuration as there are already other players configured."
);
return
;
}
InputConfig
inputConfig
=
option
.
InheritedInputConfigs
[
index
]
??
HandlePlayerConfiguration
(
inputProfileName
,
inputId
,
index
);
if
(
inputConfig
!=
null
)
{
_inputConfiguration
.
Add
(
inputConfig
);
}
}
}
private
static
void
SetupProgressHandler
()
...
...
This diff is collapsed.
Click to expand it.
src/Ryujinx/Headless/Options.cs
+
33
−
2
View file @
391f57bd
...
...
@@ -154,10 +154,39 @@ namespace Ryujinx.Headless
return
;
bool
NeedsOverride
(
string
argKey
)
=>
originalArgs
.
None
(
arg
=>
arg
.
TrimStart
(
'-'
).
EqualsIgnoreCase
(
OptionName
(
argKey
)));
}
public
void
InheritMainConfigInput
(
string
[]
originalArgs
,
ConfigurationState
configurationState
)
{
Dictionary
<
PlayerIndex
,
(
string
InputId
,
string
InputProfileName
)>
indicesToProperties
=
new
()
{
{
PlayerIndex
.
Handheld
,
(
nameof
(
InputIdHandheld
),
nameof
(
InputProfileHandheldName
))
},
{
PlayerIndex
.
Player1
,
(
nameof
(
InputId1
),
nameof
(
InputProfile1Name
))
},
{
PlayerIndex
.
Player2
,
(
nameof
(
InputId2
),
nameof
(
InputProfile2Name
))
},
{
PlayerIndex
.
Player3
,
(
nameof
(
InputId3
),
nameof
(
InputProfile3Name
))
},
{
PlayerIndex
.
Player4
,
(
nameof
(
InputId4
),
nameof
(
InputProfile4Name
))
},
{
PlayerIndex
.
Player5
,
(
nameof
(
InputId5
),
nameof
(
InputProfile5Name
))
},
{
PlayerIndex
.
Player6
,
(
nameof
(
InputId6
),
nameof
(
InputProfile6Name
))
},
{
PlayerIndex
.
Player7
,
(
nameof
(
InputId7
),
nameof
(
InputProfile7Name
))
},
{
PlayerIndex
.
Player8
,
(
nameof
(
InputId8
),
nameof
(
InputProfile8Name
))
}
};
foreach
((
PlayerIndex
playerIndex
,
(
string
id
,
string
profile
))
in
indicesToProperties
)
{
if
(
NeedsOverride
(
id
)
&&
NeedsOverride
(
profile
))
{
configurationState
.
Hid
.
InputConfig
.
Value
.
FindFirst
(
x
=>
x
.
PlayerIndex
==
playerIndex
)
.
IfPresent
(
ic
=>
InheritedInputConfigs
[
playerIndex
]
=
ic
);
}
}
string
OptionName
(
string
propertyName
)
=>
typeof
(
Options
)!.
GetProperty
(
propertyName
)!.
GetCustomAttribute
<
OptionAttribute
>()!.
LongName
;
return
;
bool
NeedsOverride
(
string
argKey
)
=>
originalArgs
.
None
(
arg
=>
arg
.
TrimStart
(
'-'
).
EqualsIgnoreCase
(
OptionName
(
argKey
)));
}
private
static
string
OptionName
(
string
propertyName
)
=>
typeof
(
Options
)!.
GetProperty
(
propertyName
)!.
GetCustomAttribute
<
OptionAttribute
>()!.
LongName
;
// General
...
...
@@ -391,5 +420,7 @@ namespace Ryujinx.Headless
[
Value
(
0
,
MetaName
=
"input"
,
HelpText
=
"Input to load."
,
Required
=
true
)]
public
string
InputPath
{
get
;
set
;
}
public
SafeDictionary
<
PlayerIndex
,
InputConfig
>
InheritedInputConfigs
=
new
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment