forked from MeloNX/MeloNX
WIP
This commit is contained in:
parent
89777c18f1
commit
f18307af51
@ -35,7 +35,7 @@
|
|||||||
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build13" />
|
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build13" />
|
||||||
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.3" />
|
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.3" />
|
||||||
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
||||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.28.1-build28" />
|
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
|
||||||
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
|
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
|
||||||
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
||||||
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
|
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
|
||||||
@ -51,4 +51,4 @@
|
|||||||
<PackageVersion Include="System.Management" Version="8.0.0" />
|
<PackageVersion Include="System.Management" Version="8.0.0" />
|
||||||
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
|
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -5,6 +5,37 @@
|
|||||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> -->
|
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> -->
|
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> -->
|
||||||
|
|
||||||
|
<!-- OpenGL ES 2.0 -->
|
||||||
|
<uses-feature android:glEsVersion="0x00020000" />
|
||||||
|
|
||||||
|
<!-- Touchscreen support -->
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.touchscreen"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
|
<!-- Game controller support -->
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.bluetooth"
|
||||||
|
android:required="false" />
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.gamepad"
|
||||||
|
android:required="false" />
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.usb.host"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
|
<!-- External mouse input events -->
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.type.pc"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
|
<!-- Allow access to the vibrator -->
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<!-- if you want to capture audio, uncomment this. -->
|
||||||
|
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
|
||||||
|
|
||||||
<!-- permissions needed for using the internet or an embedded WebKit browser -->
|
<!-- permissions needed for using the internet or an embedded WebKit browser -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
|
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package org.libsdl.app;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
public class BorealisHandler extends Handler {
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
super.handleMessage(msg);
|
|
||||||
switch (msg.what) {
|
|
||||||
case 0:
|
|
||||||
Window window = ((Activity)msg.obj).getWindow();
|
|
||||||
WindowManager.LayoutParams lp = window.getAttributes();
|
|
||||||
lp.screenBrightness = msg.arg1 / 255.0f;
|
|
||||||
if (lp.screenBrightness < 0.04) lp.screenBrightness = 0.04f;
|
|
||||||
window.setAttributes(lp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -277,6 +277,7 @@ public class HIDDeviceManager {
|
|||||||
0x044f, // Thrustmaster
|
0x044f, // Thrustmaster
|
||||||
0x045e, // Microsoft
|
0x045e, // Microsoft
|
||||||
0x0738, // Mad Catz
|
0x0738, // Mad Catz
|
||||||
|
0x0b05, // ASUS
|
||||||
0x0e6f, // PDP
|
0x0e6f, // PDP
|
||||||
0x0f0d, // Hori
|
0x0f0d, // Hori
|
||||||
0x10f5, // Turtle Beach
|
0x10f5, // Turtle Beach
|
||||||
@ -285,6 +286,7 @@ public class HIDDeviceManager {
|
|||||||
0x24c6, // PowerA
|
0x24c6, // PowerA
|
||||||
0x2dc8, // 8BitDo
|
0x2dc8, // 8BitDo
|
||||||
0x2e24, // Hyperkin
|
0x2e24, // Hyperkin
|
||||||
|
0x3537, // GameSir
|
||||||
};
|
};
|
||||||
|
|
||||||
if (usbInterface.getId() == 0 &&
|
if (usbInterface.getId() == 0 &&
|
||||||
@ -358,6 +360,12 @@ public class HIDDeviceManager {
|
|||||||
private void initializeBluetooth() {
|
private void initializeBluetooth() {
|
||||||
Log.d(TAG, "Initializing Bluetooth");
|
Log.d(TAG, "Initializing Bluetooth");
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 31 /* Android 12 */ &&
|
||||||
|
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH_CONNECT, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH_CONNECT");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ &&
|
if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ &&
|
||||||
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
|
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
|
||||||
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
|
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
|
||||||
@ -583,7 +591,13 @@ public class HIDDeviceManager {
|
|||||||
} else {
|
} else {
|
||||||
flags = 0;
|
flags = 0;
|
||||||
}
|
}
|
||||||
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
|
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
|
||||||
|
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
|
||||||
|
intent.setPackage(mContext.getPackageName());
|
||||||
|
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
|
||||||
|
} else {
|
||||||
|
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
||||||
HIDDeviceOpenResult(deviceID, false);
|
HIDDeviceOpenResult(deviceID, false);
|
||||||
|
@ -1,125 +0,0 @@
|
|||||||
package org.libsdl.app;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.Network;
|
|
||||||
import android.net.NetworkCapabilities;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.net.wifi.WifiInfo;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.os.BatteryManager;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
public class PlatformUtils {
|
|
||||||
public static boolean isBatterySupported() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
Intent batteryIntent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
|
||||||
return batteryIntent != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getBatteryLevel() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
Intent batteryIntent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
|
||||||
if (batteryIntent == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int level = batteryIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
|
|
||||||
int scale = batteryIntent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
|
||||||
|
|
||||||
if (level >= 0 && scale > 0) {
|
|
||||||
return (level * 100) / scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isBatteryCharging() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
|
|
||||||
Intent batteryStatus = context.registerReceiver(null, filter);
|
|
||||||
|
|
||||||
int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
|
|
||||||
return status == BatteryManager.BATTERY_STATUS_CHARGING ||
|
|
||||||
status == BatteryManager.BATTERY_STATUS_FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isEthernetConnected() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
Network[] networks = connectivityManager.getAllNetworks();
|
|
||||||
for (Network network : networks) {
|
|
||||||
NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(network);
|
|
||||||
if (capabilities != null && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isWifiSupported() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
|
||||||
return wifiManager != null && wifiManager.isWifiEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isWifiConnected() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
NetworkInfo wifiInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
|
||||||
return wifiInfo != null && wifiInfo.isConnected();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWifiSignalStrength() {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
|
||||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
|
||||||
return wifiInfo.getRssi();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void openBrowser(String url) {
|
|
||||||
Context context = SDLActivity.getContext();
|
|
||||||
|
|
||||||
Uri webpage = Uri.parse(url);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, webpage);
|
|
||||||
if (intent.resolveActivity(context.getPackageManager()) != null) {
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getSystemScreenBrightness(Context context) {
|
|
||||||
ContentResolver contentResolver = context.getContentResolver();
|
|
||||||
return Settings.System.getInt(contentResolver,
|
|
||||||
Settings.System.SCREEN_BRIGHTNESS, 125) * 1.0f / 255.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BorealisHandler borealisHandler = null;
|
|
||||||
|
|
||||||
public static void setAppScreenBrightness(Activity activity, float value) {
|
|
||||||
Message message = Message.obtain();
|
|
||||||
message.obj = activity;
|
|
||||||
message.arg1 = (int)(value * 255);
|
|
||||||
message.what = 0;
|
|
||||||
if(borealisHandler != null) borealisHandler.sendMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getAppScreenBrightness(Activity activity) {
|
|
||||||
Window window = activity.getWindow();
|
|
||||||
WindowManager.LayoutParams lp = window.getAttributes();
|
|
||||||
if (lp.screenBrightness < 0) return getSystemScreenBrightness(activity);
|
|
||||||
return lp.screenBrightness;
|
|
||||||
}
|
|
||||||
}
|
|
@ -38,6 +38,10 @@ public class SDL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
|
public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
|
||||||
|
loadLibrary(libraryName, mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
|
||||||
|
|
||||||
if (libraryName == null) {
|
if (libraryName == null) {
|
||||||
throw new NullPointerException("No library name provided.");
|
throw new NullPointerException("No library name provided.");
|
||||||
@ -53,10 +57,10 @@ public class SDL {
|
|||||||
// To use ReLinker, just add it as a dependency. For more information, see
|
// To use ReLinker, just add it as a dependency. For more information, see
|
||||||
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
|
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
|
||||||
//
|
//
|
||||||
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
|
Class<?> relinkClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
|
||||||
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
|
Class<?> relinkListenerClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
|
||||||
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
|
Class<?> contextClass = context.getClassLoader().loadClass("android.content.Context");
|
||||||
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
|
Class<?> stringClass = context.getClassLoader().loadClass("java.lang.String");
|
||||||
|
|
||||||
// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
|
// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
|
||||||
// they've changed during updates.
|
// they've changed during updates.
|
||||||
@ -66,7 +70,7 @@ public class SDL {
|
|||||||
|
|
||||||
// Actually load the library!
|
// Actually load the library!
|
||||||
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
|
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
|
||||||
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
|
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
|
||||||
}
|
}
|
||||||
catch (final Throwable e) {
|
catch (final Throwable e) {
|
||||||
// Fall back
|
// Fall back
|
||||||
|
@ -91,7 +91,7 @@ public class SDLActivity extends AppCompatActivity implements View.OnSystemUiVis
|
|||||||
| InputDevice.SOURCE_CLASS_POSITION
|
| InputDevice.SOURCE_CLASS_POSITION
|
||||||
| InputDevice.SOURCE_CLASS_TRACKBALL);
|
| InputDevice.SOURCE_CLASS_TRACKBALL);
|
||||||
|
|
||||||
if (s2 != 0) cls += "Some_Unkown";
|
if (s2 != 0) cls += "Some_Unknown";
|
||||||
|
|
||||||
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
|
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ public class SDLActivity extends AppCompatActivity implements View.OnSystemUiVis
|
|||||||
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
|
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
|
||||||
s2 &= ~FLAG_TAINTED;
|
s2 &= ~FLAG_TAINTED;
|
||||||
|
|
||||||
if (s2 != 0) src += " Some_Unkown";
|
if (s2 != 0) src += " Some_Unknown";
|
||||||
|
|
||||||
Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
|
Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
|
||||||
}
|
}
|
||||||
@ -276,14 +276,14 @@ public class SDLActivity extends AppCompatActivity implements View.OnSystemUiVis
|
|||||||
// "SDL2_mixer",
|
// "SDL2_mixer",
|
||||||
// "SDL2_net",
|
// "SDL2_net",
|
||||||
// "SDL2_ttf",
|
// "SDL2_ttf",
|
||||||
"main"
|
// "main"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the .so
|
// Load the .so
|
||||||
public void loadLibraries() {
|
public void loadLibraries() {
|
||||||
for (String lib : getLibraries()) {
|
for (String lib : getLibraries()) {
|
||||||
SDL.loadLibrary(lib);
|
SDL.loadLibrary(lib, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,8 +997,8 @@ public class SDLActivity extends AppCompatActivity implements View.OnSystemUiVis
|
|||||||
/* No valid hint, nothing is explicitly allowed */
|
/* No valid hint, nothing is explicitly allowed */
|
||||||
if (!is_portrait_allowed && !is_landscape_allowed) {
|
if (!is_portrait_allowed && !is_landscape_allowed) {
|
||||||
if (resizable) {
|
if (resizable) {
|
||||||
/* All orientations are allowed */
|
/* All orientations are allowed, respecting user orientation lock setting */
|
||||||
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
|
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
|
||||||
} else {
|
} else {
|
||||||
/* Fixed window and nothing specified. Get orientation from w/h of created window */
|
/* Fixed window and nothing specified. Get orientation from w/h of created window */
|
||||||
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||||
@ -1007,8 +1007,8 @@ public class SDLActivity extends AppCompatActivity implements View.OnSystemUiVis
|
|||||||
/* At least one orientation is allowed */
|
/* At least one orientation is allowed */
|
||||||
if (resizable) {
|
if (resizable) {
|
||||||
if (is_portrait_allowed && is_landscape_allowed) {
|
if (is_portrait_allowed && is_landscape_allowed) {
|
||||||
/* hint allows both landscape and portrait, promote to full sensor */
|
/* hint allows both landscape and portrait, promote to full user */
|
||||||
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
|
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
|
||||||
} else {
|
} else {
|
||||||
/* Use the only one allowed "orientation" */
|
/* Use the only one allowed "orientation" */
|
||||||
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
|
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
|
||||||
|
@ -546,13 +546,15 @@ class SDLHapticHandler {
|
|||||||
if (haptic == null) {
|
if (haptic == null) {
|
||||||
InputDevice device = InputDevice.getDevice(deviceIds[i]);
|
InputDevice device = InputDevice.getDevice(deviceIds[i]);
|
||||||
Vibrator vib = device.getVibrator();
|
Vibrator vib = device.getVibrator();
|
||||||
if (vib.hasVibrator()) {
|
if (vib != null) {
|
||||||
haptic = new SDLHaptic();
|
if (vib.hasVibrator()) {
|
||||||
haptic.device_id = deviceIds[i];
|
haptic = new SDLHaptic();
|
||||||
haptic.name = device.getName();
|
haptic.device_id = deviceIds[i];
|
||||||
haptic.vib = vib;
|
haptic.name = device.getName();
|
||||||
mHaptics.add(haptic);
|
haptic.vib = vib;
|
||||||
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
|
mHaptics.add(haptic);
|
||||||
|
SDLControllerManager.nativeAddHaptic(haptic.device_id, haptic.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -139,12 +139,12 @@ private extension Ryujinx {
|
|||||||
args.append(config.gamepath)
|
args.append(config.gamepath)
|
||||||
|
|
||||||
// Starts with vulkan
|
// Starts with vulkan
|
||||||
args.append("--graphics-backend")
|
// args.append("--graphics-backend")
|
||||||
args.append("Vulkan")
|
// args.append("Vulkan")
|
||||||
|
|
||||||
args.append(contentsOf: ["--memory-manager-mode", config.memoryManagerMode])
|
args.append(contentsOf: ["--memory-manager-mode", config.memoryManagerMode])
|
||||||
|
|
||||||
// args.append(contentsOf: ["--exclusive-fullscreen", String(true)])
|
args.append(contentsOf: ["--exclusive-fullscreen", String(true)])
|
||||||
// args.append(contentsOf: ["--exclusive-fullscreen-width", "\(Int(UIScreen.main.bounds.width))"])
|
// args.append(contentsOf: ["--exclusive-fullscreen-width", "\(Int(UIScreen.main.bounds.width))"])
|
||||||
// args.append(contentsOf: ["--exclusive-fullscreen-height", "\(Int(UIScreen.main.bounds.height))"])
|
// args.append(contentsOf: ["--exclusive-fullscreen-height", "\(Int(UIScreen.main.bounds.height))"])
|
||||||
// We don't need this. Ryujinx should handle it fine :3
|
// We don't need this. Ryujinx should handle it fine :3
|
||||||
|
@ -35,8 +35,16 @@ extension SDLLib {
|
|||||||
let SdlInitFlags: uint = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO
|
let SdlInitFlags: uint = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO
|
||||||
|
|
||||||
let sym_SDL_Init = dlsym(handle, "SDL_Init")
|
let sym_SDL_Init = dlsym(handle, "SDL_Init")
|
||||||
typealias SDL_Init = @convention(c) (uint) -> ()
|
typealias SDL_Init = @convention(c) (uint) -> (Int32)
|
||||||
let f_SDL_Init = unsafeBitCast(sym_SDL_Init, to: SDL_Init.self)
|
let f_SDL_Init = unsafeBitCast(sym_SDL_Init, to: SDL_Init.self)
|
||||||
f_SDL_Init(SdlInitFlags)
|
let result = f_SDL_Init(SdlInitFlags)
|
||||||
|
logger.info("SDL_Init result: \(result)")
|
||||||
|
|
||||||
|
// void SDL_LogSetAllPriority(SDL_LogPriority priority);
|
||||||
|
|
||||||
|
let sym_SDL_LogSetAllPriority = dlsym(handle, "SDL_LogSetAllPriority")
|
||||||
|
typealias SDL_LogSetAllPriority = @convention(c) (Int32) -> ()
|
||||||
|
let f_SDL_LogSetAllPriority = unsafeBitCast(sym_SDL_LogSetAllPriority, to: SDL_LogSetAllPriority.self)
|
||||||
|
f_SDL_LogSetAllPriority(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using Ryujinx.SDL2.Common;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using static Ryujinx.Audio.Integration.IHardwareDeviceDriver;
|
using static Ryujinx.Audio.Integration.IHardwareDeviceDriver;
|
||||||
using static SDL2.SDL;
|
using static SDL2.SDL;
|
||||||
@ -23,7 +24,7 @@ namespace Ryujinx.Audio.Backends.SDL2
|
|||||||
// TODO: Add this to SDL2-CS
|
// TODO: Add this to SDL2-CS
|
||||||
// NOTE: We use a DllImport here because of marshaling issue for spec.
|
// NOTE: We use a DllImport here because of marshaling issue for spec.
|
||||||
#pragma warning disable SYSLIB1054
|
#pragma warning disable SYSLIB1054
|
||||||
[DllImport("SDL2.framework/SDL2")]
|
[DllImport("SDL2")]
|
||||||
private static extern int SDL_GetDefaultAudioInfo(IntPtr name, out SDL_AudioSpec spec, int isCapture);
|
private static extern int SDL_GetDefaultAudioInfo(IntPtr name, out SDL_AudioSpec spec, int isCapture);
|
||||||
#pragma warning restore SYSLIB1054
|
#pragma warning restore SYSLIB1054
|
||||||
|
|
||||||
|
@ -321,7 +321,14 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
// Make process DPI aware for proper window sizing on high-res screens.
|
// Make process DPI aware for proper window sizing on high-res screens.
|
||||||
ForceDpiAware.Windows();
|
ForceDpiAware.Windows();
|
||||||
|
|
||||||
Silk.NET.Core.Loader.SearchPathContainer.Platform = Silk.NET.Core.Loader.UnderlyingPlatform.MacOS;
|
if (PlatformInfo.IsBionic)
|
||||||
|
{
|
||||||
|
Silk.NET.Core.Loader.SearchPathContainer.Platform = Silk.NET.Core.Loader.UnderlyingPlatform.Android;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Silk.NET.Core.Loader.SearchPathContainer.Platform = Silk.NET.Core.Loader.UnderlyingPlatform.MacOS;
|
||||||
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, $"Start Emu Test 4");
|
Logger.Info?.Print(LogClass.Application, $"Start Emu Test 4");
|
||||||
Version = ReleaseInformation.GetVersion();
|
Version = ReleaseInformation.GetVersion();
|
||||||
@ -332,7 +339,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
Console.Title = $"Ryujinx Console {Version} (Headless SDL2)";
|
Console.Title = $"Ryujinx Console {Version} (Headless SDL2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 1");
|
|
||||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS() || OperatingSystem.IsLinux() || PlatformInfo.IsBionic)
|
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS() || OperatingSystem.IsLinux() || PlatformInfo.IsBionic)
|
||||||
{
|
{
|
||||||
AutoResetEvent invoked = new(false);
|
AutoResetEvent invoked = new(false);
|
||||||
@ -340,7 +346,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
// MacOS must perform SDL polls from the main thread.
|
// MacOS must perform SDL polls from the main thread.
|
||||||
SDL2Driver.MainThreadDispatcher = action =>
|
SDL2Driver.MainThreadDispatcher = action =>
|
||||||
{
|
{
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 3");
|
|
||||||
invoked.Reset();
|
invoked.Reset();
|
||||||
|
|
||||||
WindowBase.QueueMainThreadAction(() =>
|
WindowBase.QueueMainThreadAction(() =>
|
||||||
@ -354,7 +359,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 2");
|
|
||||||
var result = Parser.Default.ParseArguments<Options>(args)
|
var result = Parser.Default.ParseArguments<Options>(args)
|
||||||
.WithParsed(options =>
|
.WithParsed(options =>
|
||||||
{
|
{
|
||||||
@ -1149,13 +1153,11 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
static void Load(Options option)
|
static void Load(Options option)
|
||||||
{
|
{
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 4");
|
|
||||||
if (_virtualFileSystem == null)
|
if (_virtualFileSystem == null)
|
||||||
{
|
{
|
||||||
_virtualFileSystem = VirtualFileSystem.CreateInstance();
|
_virtualFileSystem = VirtualFileSystem.CreateInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 5");
|
|
||||||
if (_libHacHorizonManager == null)
|
if (_libHacHorizonManager == null)
|
||||||
{
|
{
|
||||||
_libHacHorizonManager = new LibHacHorizonManager();
|
_libHacHorizonManager = new LibHacHorizonManager();
|
||||||
@ -1165,7 +1167,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
_libHacHorizonManager.InitializeSystemClients();
|
_libHacHorizonManager.InitializeSystemClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 6");
|
|
||||||
if (_contentManager == null)
|
if (_contentManager == null)
|
||||||
{
|
{
|
||||||
_contentManager = new ContentManager(_virtualFileSystem);
|
_contentManager = new ContentManager(_virtualFileSystem);
|
||||||
@ -1186,7 +1187,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
_inputManager = new InputManager(new SDL2KeyboardDriver(), new SDL2GamepadDriver());
|
_inputManager = new InputManager(new SDL2KeyboardDriver(), new SDL2GamepadDriver());
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 7");
|
|
||||||
GraphicsConfig.EnableShaderCache = true;
|
GraphicsConfig.EnableShaderCache = true;
|
||||||
|
|
||||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS())
|
if (OperatingSystem.IsMacOS() || OperatingSystem.IsIOS())
|
||||||
@ -1198,6 +1198,12 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (PlatformInfo.IsBionic)
|
||||||
|
// {
|
||||||
|
// option.GraphicsBackend = GraphicsBackend.OpenGl;
|
||||||
|
// Logger.Warning?.Print(LogClass.Application, "Set OpenGL in test purpose!");
|
||||||
|
// }
|
||||||
|
|
||||||
IGamepad gamepad;
|
IGamepad gamepad;
|
||||||
|
|
||||||
if (option.ListInputIds)
|
if (option.ListInputIds)
|
||||||
@ -1225,7 +1231,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 8");
|
|
||||||
if (option.InputPath == null)
|
if (option.InputPath == null)
|
||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, "Please provide a file to load");
|
Logger.Error?.Print(LogClass.Application, "Please provide a file to load");
|
||||||
@ -1233,7 +1238,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 9");
|
|
||||||
if (option.InputPath == "MiiMaker") {
|
if (option.InputPath == "MiiMaker") {
|
||||||
string contentPath = _contentManager.GetInstalledContentPath(0x0100000000001009, StorageId.BuiltInSystem, NcaContentType.Program);
|
string contentPath = _contentManager.GetInstalledContentPath(0x0100000000001009, StorageId.BuiltInSystem, NcaContentType.Program);
|
||||||
|
|
||||||
@ -1270,16 +1274,24 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup logging level
|
// Setup logging level
|
||||||
Logger.SetEnable(LogLevel.Debug, option.LoggingEnableDebug);
|
// Logger.SetEnable(LogLevel.Debug, option.LoggingEnableDebug);
|
||||||
Logger.SetEnable(LogLevel.Stub, !option.LoggingDisableStub);
|
// Logger.SetEnable(LogLevel.Stub, !option.LoggingDisableStub);
|
||||||
Logger.SetEnable(LogLevel.Info, !option.LoggingDisableInfo);
|
// Logger.SetEnable(LogLevel.Info, !option.LoggingDisableInfo);
|
||||||
Logger.SetEnable(LogLevel.Warning, !option.LoggingDisableWarning);
|
// Logger.SetEnable(LogLevel.Warning, !option.LoggingDisableWarning);
|
||||||
Logger.SetEnable(LogLevel.Error, option.LoggingEnableError);
|
// Logger.SetEnable(LogLevel.Error, option.LoggingEnableError);
|
||||||
Logger.SetEnable(LogLevel.Trace, option.LoggingEnableTrace);
|
// Logger.SetEnable(LogLevel.Trace, option.LoggingEnableTrace);
|
||||||
Logger.SetEnable(LogLevel.Guest, !option.LoggingDisableGuest);
|
// Logger.SetEnable(LogLevel.Guest, !option.LoggingDisableGuest);
|
||||||
Logger.SetEnable(LogLevel.AccessLog, option.LoggingEnableFsAccessLog);
|
// Logger.SetEnable(LogLevel.AccessLog, option.LoggingEnableFsAccessLog);
|
||||||
|
|
||||||
|
Logger.SetEnable(LogLevel.Debug, true);
|
||||||
|
Logger.SetEnable(LogLevel.Stub, true);
|
||||||
|
Logger.SetEnable(LogLevel.Info, true);
|
||||||
|
Logger.SetEnable(LogLevel.Warning, true);
|
||||||
|
Logger.SetEnable(LogLevel.Error, true);
|
||||||
|
Logger.SetEnable(LogLevel.Trace, false);
|
||||||
|
Logger.SetEnable(LogLevel.Guest, false);
|
||||||
|
Logger.SetEnable(LogLevel.AccessLog, true);
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 10");
|
|
||||||
if (!option.DisableFileLog)
|
if (!option.DisableFileLog)
|
||||||
{
|
{
|
||||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||||
@ -1289,7 +1301,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 11");
|
|
||||||
// Setup graphics configuration
|
// Setup graphics configuration
|
||||||
GraphicsConfig.EnableShaderCache = !option.DisableShaderCache;
|
GraphicsConfig.EnableShaderCache = !option.DisableShaderCache;
|
||||||
GraphicsConfig.EnableTextureRecompression = option.EnableTextureRecompression;
|
GraphicsConfig.EnableTextureRecompression = option.EnableTextureRecompression;
|
||||||
@ -1298,13 +1309,10 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
GraphicsConfig.ShadersDumpPath = option.GraphicsShadersDumpPath;
|
GraphicsConfig.ShadersDumpPath = option.GraphicsShadersDumpPath;
|
||||||
GraphicsConfig.EnableMacroHLE = !option.DisableMacroHLE;
|
GraphicsConfig.EnableMacroHLE = !option.DisableMacroHLE;
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 12");
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 13");
|
|
||||||
LoadApplication(option);
|
LoadApplication(option);
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Starting emu Test 14");
|
|
||||||
if (_userChannelPersistence.PreviousIndex == -1 || !_userChannelPersistence.ShouldRestart)
|
if (_userChannelPersistence.PreviousIndex == -1 || !_userChannelPersistence.ShouldRestart)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -186,6 +186,12 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WindowHandle = SDL_GetWindowFromID(1);
|
// WindowHandle = SDL_GetWindowFromID(1);
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"Ryujinx Window {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}");
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"Width {Width}");
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"Height {Height}");
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"DefaultFlags {DefaultFlags}");
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"FullscreenFlag {FullscreenFlag}");
|
||||||
|
Logger.Info?.Print(LogClass.Application, $"GetWindowFlags {GetWindowFlags()}");
|
||||||
WindowHandle = SDL_CreateWindow($"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}", 0, 0, Width, Height, DefaultFlags | FullscreenFlag | GetWindowFlags());
|
WindowHandle = SDL_CreateWindow($"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}", 0, 0, Width, Height, DefaultFlags | FullscreenFlag | GetWindowFlags());
|
||||||
|
|
||||||
if (WindowHandle == IntPtr.Zero)
|
if (WindowHandle == IntPtr.Zero)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user