-
-
Notifications
You must be signed in to change notification settings - Fork 285
Add dinput override #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add dinput override #1495
Changes from all commits
f3f1043
577e656
f9b0efe
e23ea01
c1ea4cb
8540fbf
22d2058
bb5a936
1a4916a
95650fd
24dd513
f288941
5a5f397
7d550e5
cd8d241
f23663e
d04aea5
9b4fe2c
ee3f74e
654d49b
bea008e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,25 +208,16 @@ public static void applySystemTweaks(Context context, WineInfo wineInfo) { | |
| } | ||
|
|
||
| public static void overrideWinComponentDlls(Context context, Container container, String identifier, boolean useNative) { | ||
| final String dllOverridesKey = "Software\\Wine\\DllOverrides"; | ||
| File userRegFile = new File(container.getRootDir(), ".wine/user.reg"); | ||
|
|
||
| try (WineRegistryEditor registryEditor = new WineRegistryEditor(userRegFile)) { | ||
| JSONObject wincomponentsJSONObject = new JSONObject(FileUtils.readString(context, "wincomponents/wincomponents.json")); | ||
| JSONArray dlnames = wincomponentsJSONObject.getJSONArray(identifier); | ||
| for (int i = 0; i < dlnames.length(); i++) { | ||
| String dlname = dlnames.getString(i); | ||
| if (useNative) { | ||
| registryEditor.setStringValue(dllOverridesKey, dlname, "native,builtin"); | ||
| } | ||
| else registryEditor.removeValue(dllOverridesKey, dlname); | ||
| } | ||
| applyDllOverrides(registryEditor, wincomponentsJSONObject, identifier, useNative); | ||
| } | ||
| catch (JSONException e) {} | ||
| } | ||
|
|
||
| public static void overrideWinComponentDlls(Context context, Container container, String wincomponents) { | ||
| final String dllOverridesKey = "Software\\Wine\\DllOverrides"; | ||
| File userRegFile = new File(container.getRootDir(), ".wine/user.reg"); | ||
| Iterator<String[]> oldWinComponentsIter = new KeyValueSet(container.getExtra("wincomponents", Container.FALLBACK_WINCOMPONENTS)).iterator(); | ||
|
|
||
|
|
@@ -242,21 +233,33 @@ public static void overrideWinComponentDlls(Context context, Container container | |
| String identifier = wincomponent[0]; | ||
| boolean useNative = wincomponent[1].equals("1"); | ||
|
|
||
| JSONArray dlnames = wincomponentsJSONObject.getJSONArray(identifier); | ||
| for (int i = 0; i < dlnames.length(); i++) { | ||
| String dlname = dlnames.getString(i); | ||
| if (useNative) { | ||
| registryEditor.setStringValue(dllOverridesKey, dlname, "native,builtin"); | ||
| } | ||
| else registryEditor.removeValue(dllOverridesKey, dlname); | ||
| } | ||
| applyDllOverrides(registryEditor, wincomponentsJSONObject, identifier, useNative); | ||
| } | ||
| } | ||
| catch (JSONException e) { | ||
| Log.e("WineUtils", "Failed to override win component dlls: " + e); | ||
| } | ||
| } | ||
|
|
||
| private static void applyDllOverrides(WineRegistryEditor registryEditor, JSONObject wincomponentsJSONObject, String identifier, boolean useNative) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both functions above would need to be edited so moved logic for both wrappers to have same logic path, just in case both of the wrapper funcitons are used, so the logic would be in same place, just in case someone needs to edit this later then logic is in one place so safe to edit for both logic paths. |
||
| final String dllOverridesKey = "Software\\Wine\\DllOverrides"; | ||
| try { | ||
| JSONArray dlnames = wincomponentsJSONObject.getJSONArray(identifier); | ||
| for (int i = 0; i < dlnames.length(); i++) { | ||
| String dlname = dlnames.getString(i); | ||
| if (useNative) { | ||
| registryEditor.setStringValue(dllOverridesKey, dlname, "native,builtin"); | ||
| } | ||
| else if ( dlname.equals("dinput") || dlname.equals("dinput8")) { | ||
| registryEditor.setStringValue(dllOverridesKey, dlname, "builtin,native"); | ||
| } | ||
| else registryEditor.removeValue(dllOverridesKey, dlname); | ||
| } | ||
| } catch (JSONException e) { | ||
| Log.e("WineUtils", "Failed to apply DLL overrides for identifier: " + identifier, e); | ||
| } | ||
| } | ||
|
|
||
| public static void setWinComponentRegistryKeys(File systemRegFile, String identifier, boolean useNative) { | ||
| if (identifier.equals("directsound")) { | ||
| try (WineRegistryEditor registryEditor = new WineRegistryEditor(systemRegFile)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is old gamenative installed and after update new keyvalue pair in the cfg appears, then old config would get corrupter if accessing with positional itterator. With the fix old configs are compatible with adding new keyvalue pairs without breaking 👌