mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 04:36:23 +02:00
Replace DllImport
usage with LibraryImport
(#4084)
* Replace usage of `DllImport` with `LibraryImport` * Mark methods as `partial` * Marshalling * More `partial` & marshalling * More `partial` and marshalling * More partial and marshalling * Update GdiPlusHelper to LibraryImport * Unicorn * More Partial * Marshal * Specify EntryPoint * Specify EntryPoint * Change GlobalMemoryStatusEx to LibraryImport * Change RegisterClassEx to LibraryImport * Define EntryPoints * Update Ryujinx.Ava/Ui/Controls/Win32NativeInterop.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Graphics.Nvdec.FFmpeg/Native/FFmpegApi.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Move return mashal * Remove calling convention specification * Remove calling conventions * Update Ryujinx.Common/SystemInfo/WindowsSystemInfo.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx/Modules/Updater/Updater.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * Update Ryujinx.Ava/Modules/Updater/Updater.cs Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Mary-nyan <thog@protonmail.com>
This commit is contained in:
parent
f4d731ae20
commit
0fbcd630bc
30 changed files with 308 additions and 299 deletions
|
@ -4,7 +4,7 @@ using Ryujinx.Common;
|
|||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.GraphicsDriver;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.System;
|
||||
using Ryujinx.Common.SystemInterop;
|
||||
using Ryujinx.Common.SystemInfo;
|
||||
using Ryujinx.Modules;
|
||||
using Ryujinx.SDL2.Common;
|
||||
|
@ -23,7 +23,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Ryujinx
|
||||
{
|
||||
class Program
|
||||
partial class Program
|
||||
{
|
||||
public static double WindowScaleFactor { get; private set; }
|
||||
|
||||
|
@ -35,17 +35,17 @@ namespace Ryujinx
|
|||
|
||||
private const string X11LibraryName = "libX11";
|
||||
|
||||
[DllImport(X11LibraryName)]
|
||||
private extern static int XInitThreads();
|
||||
[LibraryImport(X11LibraryName)]
|
||||
private static partial int XInitThreads();
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern int MessageBoxA(IntPtr hWnd, string text, string caption, uint type);
|
||||
[LibraryImport("user32.dll", SetLastError = true)]
|
||||
public static partial int MessageBoxA(IntPtr hWnd, [MarshalAs(UnmanagedType.LPStr)] string text, [MarshalAs(UnmanagedType.LPStr)] string caption, uint type);
|
||||
|
||||
[DllImport("libc", SetLastError = true)]
|
||||
static extern int setenv(string name, string value, int overwrite);
|
||||
[LibraryImport("libc", SetLastError = true)]
|
||||
private static partial int setenv([MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string value, int overwrite);
|
||||
|
||||
[DllImport("libc")]
|
||||
static extern IntPtr getenv(string name);
|
||||
[LibraryImport("libc")]
|
||||
private static partial IntPtr getenv([MarshalAs(UnmanagedType.LPStr)] string name);
|
||||
|
||||
private const uint MB_ICONWARNING = 0x30;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public class GlRenderer : RendererWidgetBase
|
||||
public partial class GlRenderer : RendererWidgetBase
|
||||
{
|
||||
private GraphicsDebugLevel _glLogLevel;
|
||||
|
||||
|
@ -74,14 +74,14 @@ namespace Ryujinx.Ui
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[DllImport("libgdk-3-0.dll")]
|
||||
private static extern IntPtr gdk_win32_window_get_handle(IntPtr d);
|
||||
[LibraryImport("libgdk-3-0.dll")]
|
||||
private static partial IntPtr gdk_win32_window_get_handle(IntPtr d);
|
||||
|
||||
[DllImport("libgdk-3.so.0")]
|
||||
private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
|
||||
[LibraryImport("libgdk-3.so.0")]
|
||||
private static partial IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
|
||||
|
||||
[DllImport("libgdk-3.so.0")]
|
||||
private static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkWindow);
|
||||
[LibraryImport("libgdk-3.so.0")]
|
||||
private static partial IntPtr gdk_x11_window_get_xid(IntPtr gdkWindow);
|
||||
|
||||
private static FramebufferFormat GetGraphicsMode()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Ryujinx.Ui.Helper
|
|||
public delegate void UpdateBoundsCallbackDelegate(Window window);
|
||||
|
||||
[SupportedOSPlatform("macos")]
|
||||
static class MetalHelper
|
||||
static partial class MetalHelper
|
||||
{
|
||||
private const string LibObjCImport = "/usr/lib/libobjc.A.dylib";
|
||||
|
||||
|
@ -104,31 +104,31 @@ namespace Ryujinx.Ui.Helper
|
|||
return metalLayer;
|
||||
}
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static unsafe extern IntPtr sel_registerName(byte* data);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static unsafe partial IntPtr sel_registerName(byte* data);
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static unsafe extern IntPtr objc_getClass(byte* data);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static unsafe partial IntPtr objc_getClass(byte* data);
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static extern void objc_msgSend(IntPtr receiver, Selector selector);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector);
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static extern void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static extern void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static extern void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||
|
||||
[DllImport(LibObjCImport)]
|
||||
private static extern void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||
[LibraryImport(LibObjCImport)]
|
||||
private static partial void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||
|
||||
[DllImport(LibObjCImport, EntryPoint = "objc_msgSend")]
|
||||
private static extern IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||
[LibraryImport(LibObjCImport, EntryPoint = "objc_msgSend")]
|
||||
private static partial IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||
|
||||
[DllImport("libgdk-3.0.dylib")]
|
||||
private static extern IntPtr gdk_quartz_window_get_nsview(IntPtr gdkWindow);
|
||||
[LibraryImport("libgdk-3.0.dylib")]
|
||||
private static partial IntPtr gdk_quartz_window_get_nsview(IntPtr gdkWindow);
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ using Ryujinx.Audio.Integration;
|
|||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.System;
|
||||
using Ryujinx.Common.SystemInterop;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.GAL.Multithreading;
|
||||
using Ryujinx.Graphics.OpenGL;
|
||||
|
|
|
@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public class VKRenderer : RendererWidgetBase
|
||||
public partial class VKRenderer : RendererWidgetBase
|
||||
{
|
||||
public NativeWindowBase NativeWindow { get; private set; }
|
||||
private UpdateBoundsCallbackDelegate _updateBoundsCallback;
|
||||
|
@ -44,14 +44,14 @@ namespace Ryujinx.Ui
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[DllImport("libgdk-3-0.dll")]
|
||||
private static extern IntPtr gdk_win32_window_get_handle(IntPtr d);
|
||||
[LibraryImport("libgdk-3-0.dll")]
|
||||
private static partial IntPtr gdk_win32_window_get_handle(IntPtr d);
|
||||
|
||||
[DllImport("libgdk-3.so.0")]
|
||||
private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
|
||||
[LibraryImport("libgdk-3.so.0")]
|
||||
private static partial IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
|
||||
|
||||
[DllImport("libgdk-3.so.0")]
|
||||
private static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkWindow);
|
||||
[LibraryImport("libgdk-3.so.0")]
|
||||
private static partial IntPtr gdk_x11_window_get_xid(IntPtr gdkWindow);
|
||||
|
||||
protected override bool OnConfigureEvent(EventConfigure evnt)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue