-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* + First proof of concept for calling arbitrary Omsi functions from c# * Pain and suffering... The calling convention is wrong because nobody in there right mind would use borland fastcall. * + Some untested assembly and bindings for TProgMan.MakeVehicle() * The assembly now works as expected, but I don't have the right pointer to the vehicle list which causes a crash when the function is called. + Rewrote most of the assembly; calling convention translation is tested working + Updated c# plugin to use the OmsiHookInvoker library * Build script changes * Refactoring * Not really much closer to it working; but I now know why it's broken. + Added TTempRVListCreate + Added TProgManPlaceRandomBus + Pain and suffering * It finally works + V2 of BorlandFastcall which accounts for Delphi trying to clean up the stack; any Delphi method can be called remotely now * Functional proof of concept for PlaceRandomBus * Refactored a bunch of the RPC stuff + Added OmsiRemoteMethods class for RPC + Added AllocateString method to create Delphi AnsiStrings * Fixed WriteMemory() for strings * Plugin auto-clears it's log on startup * Plugin uses OmsiHook lib for RPC * Refactoring - Removed dead code from plugin - Removed old BorlandFastcall from OmsiHookInvoker * * Updated README * Updated docs * Updated NuGet package license * Exposed more parameters to the public API for PlaceRandomBus() * Refactoring * + Added link to docs in the README * Fixed some build issues * Fixed some issues with the docs * Update dotnet.yml * * Fixed project references * Update dotnet.yml Maybe this will fix it? * Update dotnet.yml Maybe?... * Update dotnet.yml who knows... * Changed msvc version to 142 * Update dotnet.yml Magic? * Update OmsiHook.csproj nuget pack couldn't find the readme when building in github actions... Screw it, don't build the nuget package then... * Update dotnet.yml Well I don't have unit tests anyway, so don't bother running them since dotnet won't compile it... * + Try to patch the GH actions Co-authored-by: Adam Mathieson <Adam@genav.ch>
- Loading branch information
1 parent
7d132a0
commit eb37368
Showing
29 changed files
with
1,175 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: DocFX | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Generate docs | ||
uses: nikeee/docfx-action@v1.0.0 | ||
with: | ||
args: OmsiHook/docfx.json | ||
|
||
# Publish generated site using GitHub Pages | ||
- uses: maxheld83/ghpages@master | ||
name: Publish Documentation on GitHub Pages | ||
env: | ||
BUILD_DIR: OmsiHook/_site # docfx's default output directory is _site | ||
GH_PAT: ${{ secrets.GH_PAT }} # See https://github.com/maxheld83/ghpages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace OmsiHook | ||
{ | ||
public class MemArray<T> : OmsiObject, IEnumerable<T>, ICollection<T>, IList<T> where T : struct | ||
{ | ||
private T[] arrayCache; | ||
|
||
public MemArray() : base() { } | ||
|
||
internal MemArray(Memory memory, int address) : base(memory, address) { } | ||
|
||
/// <summary> | ||
/// Call this method to initialise an OmsiObject if the two-parameter constructor wasn't used. | ||
/// </summary> | ||
/// <param name="memory"></param> | ||
/// <param name="address"></param> | ||
internal new void InitObject(Memory memory, int address) | ||
{ | ||
base.InitObject(memory, address); | ||
UpdateFromHook(); | ||
} | ||
|
||
/// <summary> | ||
/// Forces the cached contents of the MemArray to resynchronise with the hooked application. | ||
/// </summary> | ||
public void UpdateFromHook() | ||
{ | ||
arrayCache = Memory.ReadMemoryStructArray<T>(Address); | ||
} | ||
|
||
public int Count => arrayCache.Length; | ||
|
||
public bool IsReadOnly => true; | ||
|
||
public T this[int index] | ||
{ | ||
get => arrayCache[index]; | ||
set | ||
{ | ||
arrayCache[index] = value; | ||
Memory.WriteMemoryArrayItem(Address, value, index); | ||
} | ||
} | ||
|
||
public void Add(T item) => throw new NotImplementedException(); | ||
|
||
public void Clear() => throw new NotImplementedException(); | ||
|
||
public bool Contains(T item) => arrayCache.Contains(item); | ||
|
||
public void CopyTo(T[] array, int arrayIndex) => arrayCache.CopyTo(array, arrayIndex); | ||
|
||
public IEnumerator<T> GetEnumerator() => (IEnumerator<T>)arrayCache.GetEnumerator(); | ||
|
||
public bool Remove(T item) => throw new NotImplementedException(); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => arrayCache.GetEnumerator(); | ||
|
||
public int IndexOf(T item) => Array.IndexOf(arrayCache, item); | ||
|
||
public void Insert(int index, T item) => throw new NotImplementedException(); | ||
|
||
public void RemoveAt(int index) => throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.