Giter Club home page Giter Club logo

win-vcmp-dotnet's Introduction

win-vcmp-dotnet

A modified version of vcmp-dotnet to support Windows and with some fixes and improvements.

vcmp-dotnet

vcmp-dotnet is a collection of softwares that allow you to script Vice City: Multiplayer servers in any language that supports targeting CoreCLR (C#, F# and VB.Net for example).

This readme file is currently oriented towards the native API binding and may be updated when the wrapper module is released.

Changes/Fixes

  • Fix GetPlayerName, GetPlayerIP, GetPlayerUid methods
  • Fix incorrect CoreClr path for windows version of .NET Core

Planned features

  • Implementing a full API wrapper
  • Implementing crash handler system

Compiling

Requirements

  • Visual Studio 2019
  • .NET Core 2.0 (Runtime and SDK) or newer
  • .NET Stantard 2.0 (Runtime and SDK) or newer

Locations

Project Solutions/Projects location
Host plugin /loader/build/dotnet-vcmp.sln
Native bindings interoperability library /interop/Fleka.DotnetVcmp.Interop.csproj
small WIP API wrapper library /wrapper/Fleka.DotnetVcmp.csproj

Usage

dotnet.json

You need to have a file called dotnet.json in your server's root.

This is a list of keys the file must contain:

Key Description
clr.runtime-directory The directory that contains libcoreclr.so/coreclr.dll.
clr.server-executable The path to the server binary.
clr.assemblies-directory The path to your .NET managed assemblies.
clr.native-image-assemblies-directory Same as the above but for native image assemblies.
clr.native-dll-search-directories The directory to search for dynamic libraries.
app-domain.friendly-name The friendly name of the default AppDomain.

Here is an example dotnet.json file:

{
    "clr": {
        "runtime-directory": "C:/Program Files/dotnet/shared/Microsoft.NETCore.App/3.0.0",
        "server-executable": "./server64.exe",
        "assemblies-directory": "./dotnet-assemblies",
        "native-image-assemblies-directory": "",
        "native-dll-search-directories": ["C:/libs"]
    },
    "app-domain": {
        "friendly-name": "Example dotnet-vcmp configuration"
    }
}

Interoperability DLL

You need to place Fleka.DotnetVcmp.Interop.dll in your assemblies directory. Add Fleka.DotnetVcmp.Interop library to your project.

From managed code

The interoperability DLL executes an entry point with the following signature:

void EntryPointDelegate(PluginFunctions pluginFunctions, ref PluginCallbacks pluginCallbacks)

To designate a function as the entry point, add [Fleka.DotnetVcmp.Interop.EntryPoint] before its definition.

IMPORTANT

Assigning a function to pluginCallbacks will not increase its reference count. If you are passing a collectable function (such as a lambda), you must keep a reference to it elsewhere as well.

Hello world

Compile this C# code into a .NET managed DLL (with Fleka.DotnetVcmp.Interop as a dependency) and place both of them in your assemblies directory.

public static class MyTestApp {
    private static Fleka.DotnetVcmp.Interop.PluginFunctions _pluginFunctions;

    [Fleka.DotnetVcmp.Interop.EntryPoint]
    public static void MyEntryPoint(Fleka.DotnetVcmp.Interop.PluginFunctions pluginFunctions, ref Fleka.DotnetVcmp.Interop.PluginCallbacks pluginCallbacks) {
        _pluginFunctions = pluginFunctions;

        pluginCallbacks.OnServerInitialize = OnServerInitialize;
    }

    internal static byte OnServerInitialize() {
        _pluginFunctions.LogMessage("%s", "Hello world");

        return 1;
    }
}

Downloads

win-vcmp-dotnet's People

Contributors

ahmed605 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.