diff --git a/src/Bindgen/Generator.cs b/src/Bindgen/Generator.cs index 15aaf03..de4ce32 100644 --- a/src/Bindgen/Generator.cs +++ b/src/Bindgen/Generator.cs @@ -430,12 +430,20 @@ private string GenerateFunction(CppFunction function, out string output) { var paramPointerCount = 0; string paramType = ConvertCppTypeToCSharp(functionName, parameter.Name, parameter.Type, ref paramPointerCount, out _); - paramType = AppendPointer(paramType, paramPointerCount); string paramName = MapName(parameter.Name); + bool isArray = options.DetectArray(function.Name, parameter.Name); if (paramPointerCount > 0) { - isUnsafe = true; + if (paramPointerCount == 1 && IsSimpleRef(function, paramName, paramType) && !isArray) + { + paramType = "ref " + paramType; + } + else + { + isUnsafe = true; + paramType = AppendPointer(paramType, paramPointerCount); + } } parameters.Add($"{paramType} {paramName}"); @@ -443,9 +451,9 @@ private string GenerateFunction(CppFunction function, out string output) if (function.Flags.HasFlag(CppFunctionFlags.Variadic)) { + // FIXME: Use something real for varargs // https://github.com/dotnet/runtime/issues/48796 - // parameters.Add("__arglist"); - Console.WriteLine($"- Unsupported function param: {functionName} (variadic)"); + parameters.Add("IntPtr args"); } string parametersString = string.Join(", ", parameters); @@ -644,22 +652,27 @@ private static bool IsNotPrimitive(string identifier) return identifier[0].ToString().ToLower() != identifier[0].ToString(); } - private static bool IsNotArray(CppFunction fn, CppParameter param) + private static bool IsSimpleRef(CppFunction fn, string name, string type) { - var name = param.Name; + if (type.Contains("void") || type.Contains("delegate") || type == "byte") + { + return false; + } + var baseName = name.EndsWith("s") ? name.Substring(0, name.Length - 1) : name; - var possibleSuffixes = new List { "Count", "Length", "sCount", "sLength" }; + var possibleSuffixes = new List { "Count", "sCount", "Length", "sLength", "Size", "sSize", "Len", "sLen" }; foreach (var p in fn.Parameters) { foreach (var suffix in possibleSuffixes) { - if (p.Name == baseName + suffix) + if (p.Name == baseName + suffix || p.Name == suffix.ToLower()) { return false; // It's an array } } } + return true; // It's not an array } diff --git a/src/Bindgen/GeneratorOptions.cs b/src/Bindgen/GeneratorOptions.cs index db7580a..b23e248 100644 --- a/src/Bindgen/GeneratorOptions.cs +++ b/src/Bindgen/GeneratorOptions.cs @@ -11,7 +11,8 @@ public struct GeneratorOptions public string[] SystemIncludeFolders = { }; public string[] IncludeFolders = { }; public string[] Defines = { }; - public Func TransformType = (parent, name, type) => type; + public Func TransformType = (parent, name, type) => null; + public Func DetectArray = (parent, name) => false; public Dictionary ExistingTypes = new(); public GeneratorOptions() diff --git a/src/Raylib.NET.Bindgen/Program.cs b/src/Raylib.NET.Bindgen/Program.cs index 555cb7c..d1aa9ac 100644 --- a/src/Raylib.NET.Bindgen/Program.cs +++ b/src/Raylib.NET.Bindgen/Program.cs @@ -31,6 +31,25 @@ var options = new GeneratorOptions { + DetectArray = (string parent, string name) => { + if (parent == "rlGenTextureMipmaps") { + return true; + } + + if (parent == "rlMultMatrixf") { + return true; + } + + if (parent == "rlSetShader") { + return true; + } + + if (parent.StartsWith("Unload")) { + return true; + } + + return false; + }, TransformType = (string parent, string name, string type) => type switch { diff --git a/src/Raylib.NET/Raygui.cs b/src/Raylib.NET/Raygui.cs index 95fcb97..ca9d31c 100644 --- a/src/Raylib.NET/Raygui.cs +++ b/src/Raylib.NET/Raygui.cs @@ -216,7 +216,7 @@ public static unsafe partial class Raygui /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiScrollPanel(Vector4 bounds, string text, Vector4 content, Vector2* scroll, Vector4* view); + public static partial int GuiScrollPanel(Vector4 bounds, string text, Vector4 content, ref Vector2 scroll, ref Vector4 view); /// /// Label control @@ -244,63 +244,63 @@ public static unsafe partial class Raygui /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiToggle(Vector4 bounds, string text, NativeBool* active); + public static partial int GuiToggle(Vector4 bounds, string text, ref NativeBool active); /// /// Toggle Group control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiToggleGroup(Vector4 bounds, string text, int* active); + public static partial int GuiToggleGroup(Vector4 bounds, string text, ref int active); /// /// Toggle Slider control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiToggleSlider(Vector4 bounds, string text, int* active); + public static partial int GuiToggleSlider(Vector4 bounds, string text, ref int active); /// /// Check Box control, returns true when active /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiCheckBox(Vector4 bounds, string text, NativeBool* @checked); + public static partial int GuiCheckBox(Vector4 bounds, string text, ref NativeBool @checked); /// /// Combo Box control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiComboBox(Vector4 bounds, string text, int* active); + public static partial int GuiComboBox(Vector4 bounds, string text, ref int active); /// /// Dropdown Box control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiDropdownBox(Vector4 bounds, string text, int* active, NativeBool editMode); + public static partial int GuiDropdownBox(Vector4 bounds, string text, ref int active, NativeBool editMode); /// /// Spinner control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiSpinner(Vector4 bounds, string text, int* value, int minValue, int maxValue, NativeBool editMode); + public static partial int GuiSpinner(Vector4 bounds, string text, ref int value, int minValue, int maxValue, NativeBool editMode); /// /// Value Box control, updates input text with numbers /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiValueBox(Vector4 bounds, string text, int* value, int minValue, int maxValue, NativeBool editMode); + public static partial int GuiValueBox(Vector4 bounds, string text, ref int value, int minValue, int maxValue, NativeBool editMode); /// /// Value box control for float values /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiValueBoxFloat(Vector4 bounds, string text, string textValue, float* value, NativeBool editMode); + public static partial int GuiValueBoxFloat(Vector4 bounds, string text, string textValue, ref float value, NativeBool editMode); /// /// Text Box control, updates input text @@ -314,21 +314,21 @@ public static unsafe partial class Raygui /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiSlider(Vector4 bounds, string textLeft, string textRight, float* value, float minValue, float maxValue); + public static partial int GuiSlider(Vector4 bounds, string textLeft, string textRight, ref float value, float minValue, float maxValue); /// /// Slider Bar control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiSliderBar(Vector4 bounds, string textLeft, string textRight, float* value, float minValue, float maxValue); + public static partial int GuiSliderBar(Vector4 bounds, string textLeft, string textRight, ref float value, float minValue, float maxValue); /// /// Progress Bar control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiProgressBar(Vector4 bounds, string textLeft, string textRight, float* value, float minValue, float maxValue); + public static partial int GuiProgressBar(Vector4 bounds, string textLeft, string textRight, ref float value, float minValue, float maxValue); /// /// Status Bar control, shows info text @@ -349,14 +349,14 @@ public static unsafe partial class Raygui /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiGrid(Vector4 bounds, string text, float spacing, int subdivs, Vector2* mouseCell); + public static partial int GuiGrid(Vector4 bounds, string text, float spacing, int subdivs, ref Vector2 mouseCell); /// /// List View control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiListView(Vector4 bounds, string text, int* scrollIndex, int* active); + public static partial int GuiListView(Vector4 bounds, string text, ref int scrollIndex, ref int active); /// /// List View with extended parameters @@ -377,47 +377,47 @@ public static unsafe partial class Raygui /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiTextInputBox(Vector4 bounds, string title, string message, string buttons, string text, int textMaxSize, NativeBool* secretViewActive); + public static partial int GuiTextInputBox(Vector4 bounds, string title, string message, string buttons, string text, int textMaxSize, ref NativeBool secretViewActive); /// /// Color Picker control (multiple color controls) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiColorPicker(Vector4 bounds, string text, Color* color); + public static partial int GuiColorPicker(Vector4 bounds, string text, ref Color color); /// /// Color Panel control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiColorPanel(Vector4 bounds, string text, Color* color); + public static partial int GuiColorPanel(Vector4 bounds, string text, ref Color color); /// /// Color Bar Alpha control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiColorBarAlpha(Vector4 bounds, string text, float* alpha); + public static partial int GuiColorBarAlpha(Vector4 bounds, string text, ref float alpha); /// /// Color Bar Hue control /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiColorBarHue(Vector4 bounds, string text, float* value); + public static partial int GuiColorBarHue(Vector4 bounds, string text, ref float value); /// /// Color Picker control that avoids conversion to RGB on each call (multiple color controls) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiColorPickerHSV(Vector4 bounds, string text, Vector3* colorHsv); + public static partial int GuiColorPickerHSV(Vector4 bounds, string text, ref Vector3 colorHsv); /// /// Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GuiColorPanelHSV(Vector4 bounds, string text, Vector3* colorHsv); + public static partial int GuiColorPanelHSV(Vector4 bounds, string text, ref Vector3 colorHsv); } diff --git a/src/Raylib.NET/Raylib.cs b/src/Raylib.NET/Raylib.cs index e00a829..9400e05 100644 --- a/src/Raylib.NET/Raylib.cs +++ b/src/Raylib.NET/Raylib.cs @@ -764,7 +764,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial void TraceLog(int logLevel, string text); + public static partial void TraceLog(int logLevel, string text, IntPtr args); /// /// Set the current threshold (minimum) log level @@ -834,7 +834,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial byte* LoadFileData(string fileName, int* dataSize); + public static unsafe partial byte* LoadFileData(string fileName, ref int dataSize); /// /// Unload file data allocated by LoadFileData() @@ -1037,28 +1037,28 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial byte* CompressData(byte* data, int dataSize, int* compDataSize); + public static unsafe partial byte* CompressData(byte* data, int dataSize, ref int compDataSize); /// /// Decompress data (DEFLATE algorithm), memory must be MemFree() /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial byte* DecompressData(byte* compData, int compDataSize, int* dataSize); + public static unsafe partial byte* DecompressData(byte* compData, int compDataSize, ref int dataSize); /// /// Encode data to Base64 string, memory must be MemFree() /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial string EncodeDataBase64(byte* data, int dataSize, int* outputSize); + public static unsafe partial string EncodeDataBase64(byte* data, int dataSize, ref int outputSize); /// /// Decode Base64 string data, memory must be MemFree() /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial byte* DecodeDataBase64(byte* data, int* outputSize); + public static unsafe partial byte* DecodeDataBase64(byte* data, ref int outputSize); /// /// Compute CRC32 hash code @@ -1107,7 +1107,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void SetAutomationEventList(AutomationEventList* list); + public static partial void SetAutomationEventList(ref AutomationEventList list); /// /// Set automation event internal base frame to start recording @@ -1464,14 +1464,14 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void UpdateCamera(Camera3D* camera, int mode); + public static partial void UpdateCamera(ref Camera3D camera, int mode); /// /// Update camera movement/rotation /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void UpdateCameraPro(Camera3D* camera, Vector3 movement, Vector3 rotation, float zoom); + public static partial void UpdateCameraPro(ref Camera3D camera, Vector3 movement, Vector3 rotation, float zoom); /// /// Set texture and rectangle to be used on shapes drawing @@ -1926,7 +1926,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial NativeBool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2* collisionPoint); + public static partial NativeBool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint); /// /// Get collision rectangle for two rectangles collision @@ -1954,14 +1954,14 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial Image LoadImageAnim(string fileName, int* frames); + public static partial Image LoadImageAnim(string fileName, ref int frames); /// /// Load image sequence from memory buffer /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial Image LoadImageAnimFromMemory(string fileType, byte* fileData, int dataSize, int* frames); + public static unsafe partial Image LoadImageAnimFromMemory(string fileType, byte* fileData, int dataSize, ref int frames); /// /// Load image from memory buffer, fileType refers to extension: i.e. '.png' @@ -2010,7 +2010,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial byte* ExportImageToMemory(Image image, string fileType, int* fileSize); + public static unsafe partial byte* ExportImageToMemory(Image image, string fileType, ref int fileSize); /// /// Export image as code file defining an array of bytes, returns true on success @@ -2122,175 +2122,175 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageFormat(Image* image, int newFormat); + public static partial void ImageFormat(ref Image image, int newFormat); /// /// Convert image to POT (power-of-two) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageToPOT(Image* image, Color fill); + public static partial void ImageToPOT(ref Image image, Color fill); /// /// Crop an image to a defined rectangle /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageCrop(Image* image, Vector4 crop); + public static partial void ImageCrop(ref Image image, Vector4 crop); /// /// Crop image depending on alpha value /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageAlphaCrop(Image* image, float threshold); + public static partial void ImageAlphaCrop(ref Image image, float threshold); /// /// Clear alpha channel to desired color /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageAlphaClear(Image* image, Color color, float threshold); + public static partial void ImageAlphaClear(ref Image image, Color color, float threshold); /// /// Apply alpha mask to image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageAlphaMask(Image* image, Image alphaMask); + public static partial void ImageAlphaMask(ref Image image, Image alphaMask); /// /// Premultiply alpha channel /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageAlphaPremultiply(Image* image); + public static partial void ImageAlphaPremultiply(ref Image image); /// /// Apply Gaussian blur using a box blur approximation /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageBlurGaussian(Image* image, int blurSize); + public static partial void ImageBlurGaussian(ref Image image, int blurSize); /// /// Apply custom square convolution kernel to image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageKernelConvolution(Image* image, float* kernel, int kernelSize); + public static unsafe partial void ImageKernelConvolution(ref Image image, float* kernel, int kernelSize); /// /// Resize image (Bicubic scaling algorithm) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageResize(Image* image, int newWidth, int newHeight); + public static partial void ImageResize(ref Image image, int newWidth, int newHeight); /// /// Resize image (Nearest-Neighbor scaling algorithm) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageResizeNN(Image* image, int newWidth, int newHeight); + public static partial void ImageResizeNN(ref Image image, int newWidth, int newHeight); /// /// Resize canvas and fill with color /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageResizeCanvas(Image* image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); + public static partial void ImageResizeCanvas(ref Image image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); /// /// Compute all mipmap levels for a provided image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageMipmaps(Image* image); + public static partial void ImageMipmaps(ref Image image); /// /// Dither image data to 16bpp or lower (Floyd-Steinberg dithering) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDither(Image* image, int rBpp, int gBpp, int bBpp, int aBpp); + public static partial void ImageDither(ref Image image, int rBpp, int gBpp, int bBpp, int aBpp); /// /// Flip image vertically /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageFlipVertical(Image* image); + public static partial void ImageFlipVertical(ref Image image); /// /// Flip image horizontally /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageFlipHorizontal(Image* image); + public static partial void ImageFlipHorizontal(ref Image image); /// /// Rotate image by input angle in degrees (-359 to 359) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageRotate(Image* image, int degrees); + public static partial void ImageRotate(ref Image image, int degrees); /// /// Rotate image clockwise 90deg /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageRotateCW(Image* image); + public static partial void ImageRotateCW(ref Image image); /// /// Rotate image counter-clockwise 90deg /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageRotateCCW(Image* image); + public static partial void ImageRotateCCW(ref Image image); /// /// Modify image color: tint /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageColorTint(Image* image, Color color); + public static partial void ImageColorTint(ref Image image, Color color); /// /// Modify image color: invert /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageColorInvert(Image* image); + public static partial void ImageColorInvert(ref Image image); /// /// Modify image color: grayscale /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageColorGrayscale(Image* image); + public static partial void ImageColorGrayscale(ref Image image); /// /// Modify image color: contrast (-100 to 100) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageColorContrast(Image* image, float contrast); + public static partial void ImageColorContrast(ref Image image, float contrast); /// /// Modify image color: brightness (-255 to 255) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageColorBrightness(Image* image, int brightness); + public static partial void ImageColorBrightness(ref Image image, int brightness); /// /// Modify image color: replace color /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageColorReplace(Image* image, Color color, Color replace); + public static partial void ImageColorReplace(ref Image image, Color color, Color replace); /// /// Load color data from image as a Color array (RGBA - 32bit) @@ -2304,7 +2304,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial Color* LoadImagePalette(Image image, int maxPaletteSize, int* colorCount); + public static unsafe partial Color* LoadImagePalette(Image image, int maxPaletteSize, ref int colorCount); /// /// Unload color data loaded with LoadImageColors() @@ -2339,77 +2339,77 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageClearBackground(Image* dst, Color color); + public static partial void ImageClearBackground(ref Image dst, Color color); /// /// Draw pixel within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawPixel(Image* dst, int posX, int posY, Color color); + public static partial void ImageDrawPixel(ref Image dst, int posX, int posY, Color color); /// /// Draw pixel within an image (Vector version) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawPixelV(Image* dst, Vector2 position, Color color); + public static partial void ImageDrawPixelV(ref Image dst, Vector2 position, Color color); /// /// Draw line within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawLine(Image* dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); + public static partial void ImageDrawLine(ref Image dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); /// /// Draw line within an image (Vector version) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawLineV(Image* dst, Vector2 start, Vector2 end, Color color); + public static partial void ImageDrawLineV(ref Image dst, Vector2 start, Vector2 end, Color color); /// /// Draw a line defining thickness within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawLineEx(Image* dst, Vector2 start, Vector2 end, int thick, Color color); + public static partial void ImageDrawLineEx(ref Image dst, Vector2 start, Vector2 end, int thick, Color color); /// /// Draw a filled circle within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color color); + public static partial void ImageDrawCircle(ref Image dst, int centerX, int centerY, int radius, Color color); /// /// Draw a filled circle within an image (Vector version) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawCircleV(Image* dst, Vector2 center, int radius, Color color); + public static partial void ImageDrawCircleV(ref Image dst, Vector2 center, int radius, Color color); /// /// Draw circle outline within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawCircleLines(Image* dst, int centerX, int centerY, int radius, Color color); + public static partial void ImageDrawCircleLines(ref Image dst, int centerX, int centerY, int radius, Color color); /// /// Draw circle outline within an image (Vector version) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawCircleLinesV(Image* dst, Vector2 center, int radius, Color color); + public static partial void ImageDrawCircleLinesV(ref Image dst, Vector2 center, int radius, Color color); /// /// Draw rectangle within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawRectangle(Image* dst, int posX, int posY, int width, int height, Color color); + public static partial void ImageDrawRectangle(ref Image dst, int posX, int posY, int width, int height, Color color); /// /// Draw rectangle within an image (Vector version) @@ -2423,70 +2423,70 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawRectangleRec(Image* dst, Vector4 rec, Color color); + public static partial void ImageDrawRectangleRec(ref Image dst, Vector4 rec, Color color); /// /// Draw rectangle lines within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawRectangleLines(Image* dst, Vector4 rec, int thick, Color color); + public static partial void ImageDrawRectangleLines(ref Image dst, Vector4 rec, int thick, Color color); /// /// Draw triangle within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawTriangle(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); + public static partial void ImageDrawTriangle(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); /// /// Draw triangle with interpolated colors within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawTriangleEx(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); + public static partial void ImageDrawTriangleEx(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); /// /// Draw triangle outline within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawTriangleLines(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); + public static partial void ImageDrawTriangleLines(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); /// /// Draw a triangle fan defined by points within an image (first vertex is the center) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawTriangleFan(Image* dst, Vector2* points, int pointCount, Color color); + public static unsafe partial void ImageDrawTriangleFan(ref Image dst, Vector2* points, int pointCount, Color color); /// /// Draw a triangle strip defined by points within an image /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawTriangleStrip(Image* dst, Vector2* points, int pointCount, Color color); + public static unsafe partial void ImageDrawTriangleStrip(ref Image dst, Vector2* points, int pointCount, Color color); /// /// Draw a source image within a destination image (tint applied to source) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDraw(Image* dst, Image src, Vector4 srcRec, Vector4 dstRec, Color tint); + public static partial void ImageDraw(ref Image dst, Image src, Vector4 srcRec, Vector4 dstRec, Color tint); /// /// Draw text (using default font) within an image (destination) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawText(Image* dst, string text, int posX, int posY, int fontSize, Color color); + public static partial void ImageDrawText(ref Image dst, string text, int posX, int posY, int fontSize, Color color); /// /// Draw text (custom sprite font) within an image (destination) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void ImageDrawTextEx(Image* dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint); + public static partial void ImageDrawTextEx(ref Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint); /// /// Load texture from file into GPU memory (VRAM) @@ -2563,7 +2563,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void GenTextureMipmaps(Texture* texture); + public static partial void GenTextureMipmaps(ref Texture texture); /// /// Set texture scaling filter mode @@ -2941,28 +2941,28 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GetCodepoint(string text, int* codepointSize); + public static partial int GetCodepoint(string text, ref int codepointSize); /// /// Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GetCodepointNext(string text, int* codepointSize); + public static partial int GetCodepointNext(string text, ref int codepointSize); /// /// Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial int GetCodepointPrevious(string text, int* codepointSize); + public static partial int GetCodepointPrevious(string text, ref int codepointSize); /// /// Encode one codepoint into UTF-8 byte array (array length returned as parameter) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial string CodepointToUTF8(int codepoint, int* utf8Size); + public static partial string CodepointToUTF8(int codepoint, ref int utf8Size); /// /// Copy one string to another, returns bytes copied @@ -2990,7 +2990,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static partial string TextFormat(string text); + public static partial string TextFormat(string text, IntPtr args); /// /// Get a piece of a text string @@ -3032,7 +3032,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void TextAppend(string text, string append, int* position); + public static partial void TextAppend(string text, string append, ref int position); /// /// Find first text occurrence within a string @@ -3347,7 +3347,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void UploadMesh(Mesh* mesh, NativeBool dynamic); + public static partial void UploadMesh(ref Mesh mesh, NativeBool dynamic); /// /// Update mesh vertex data in GPU for a specific buffer index @@ -3375,7 +3375,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void DrawMeshInstanced(Mesh mesh, Material material, Matrix4x4* transforms, int instances); + public static partial void DrawMeshInstanced(Mesh mesh, Material material, ref Matrix4x4 transforms, int instances); /// /// Compute mesh bounding box limits @@ -3389,7 +3389,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void GenMeshTangents(Mesh* mesh); + public static partial void GenMeshTangents(ref Mesh mesh); /// /// Export mesh data to file, returns true on success @@ -3487,7 +3487,7 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial Material* LoadMaterials(string fileName, int* materialCount); + public static unsafe partial Material* LoadMaterials(string fileName, ref int materialCount); /// /// Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) @@ -3515,21 +3515,21 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void SetMaterialTexture(Material* material, int mapType, Texture texture); + public static partial void SetMaterialTexture(ref Material material, int mapType, Texture texture); /// /// Set material for a mesh /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void SetModelMeshMaterial(Model* model, int meshId, int materialId); + public static partial void SetModelMeshMaterial(ref Model model, int meshId, int materialId); /// /// Load model animations from file /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial ModelAnimation* LoadModelAnimations(string fileName, int* animCount); + public static unsafe partial ModelAnimation* LoadModelAnimations(string fileName, ref int animCount); /// /// Update model animation pose (CPU) @@ -3816,14 +3816,14 @@ public static unsafe partial class Raylib /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void WaveCrop(Wave* wave, int initFrame, int finalFrame); + public static partial void WaveCrop(ref Wave wave, int initFrame, int finalFrame); /// /// Convert wave data to desired format /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void WaveFormat(Wave* wave, int sampleRate, int sampleSize, int channels); + public static partial void WaveFormat(ref Wave wave, int sampleRate, int sampleSize, int channels); /// /// Load samples data from wave as a 32bit float data array diff --git a/src/Raylib.NET/Raymath.cs b/src/Raylib.NET/Raymath.cs index 5ca4176..94dd8f4 100644 --- a/src/Raylib.NET/Raymath.cs +++ b/src/Raylib.NET/Raymath.cs @@ -432,7 +432,7 @@ public static unsafe partial class Raymath /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void Vector3OrthoNormalize(Vector3* v1, Vector3* v2); + public static partial void Vector3OrthoNormalize(ref Vector3 v1, ref Vector3 v2); /// /// Transforms a Vector3 by a given Matrix @@ -985,7 +985,7 @@ public static unsafe partial class Raymath /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void QuaternionToAxisAngle(Vector4 q, Vector3* outAxis, float* outAngle); + public static partial void QuaternionToAxisAngle(Vector4 q, ref Vector3 outAxis, ref float outAngle); /// /// Get the quaternion equivalent to Euler angles @@ -1022,5 +1022,5 @@ public static unsafe partial class Raymath /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void MatrixDecompose(Matrix4x4 mat, Vector3* translation, Vector4* rotation, Vector3* scale); + public static partial void MatrixDecompose(Matrix4x4 mat, ref Vector3 translation, ref Vector4 rotation, ref Vector3 scale); } diff --git a/src/Raylib.NET/Rlgl.cs b/src/Raylib.NET/Rlgl.cs index fde2abd..6e1823c 100644 --- a/src/Raylib.NET/Rlgl.cs +++ b/src/Raylib.NET/Rlgl.cs @@ -796,14 +796,14 @@ public static unsafe partial class Rlgl /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void rlDrawRenderBatch(RenderBatch* batch); + public static partial void rlDrawRenderBatch(ref RenderBatch batch); /// /// Set the active render batch for rlgl (NULL for default internal) /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void rlSetRenderBatchActive(RenderBatch* batch); + public static partial void rlSetRenderBatchActive(ref RenderBatch batch); /// /// Update and draw internal render batch @@ -957,7 +957,7 @@ public static unsafe partial class Rlgl /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial void rlGetGlTextureFormats(int format, uint* glInternalFormat, uint* glFormat, uint* glType); + public static partial void rlGetGlTextureFormats(int format, ref uint glInternalFormat, ref uint glFormat, ref uint glType); /// /// Get name string for pixel format diff --git a/src/Raylib.NET/Rres.cs b/src/Raylib.NET/Rres.cs index 86dd738..199dea9 100644 --- a/src/Raylib.NET/Rres.cs +++ b/src/Raylib.NET/Rres.cs @@ -52,7 +52,7 @@ public static unsafe partial class Rres /// [LibraryImport(LIBRARY, StringMarshalling = StringMarshalling.Utf8)] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] - public static unsafe partial ResourceChunkInfo* rresLoadResourceChunkInfoAll(string fileName, uint* chunkCount); + public static unsafe partial ResourceChunkInfo* rresLoadResourceChunkInfoAll(string fileName, ref uint chunkCount); /// /// Load central directory resource chunk from file