Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile
@jbevain
jbevain / ReferenceRemovalProjectHook.cs
Created November 26, 2014 13:15
Project Generation Hook to remove references to Boo.Lang and UnityScript assemblies
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class ReferenceRemovalProjectHook
{
@jbevain
jbevain / README.md
Last active December 5, 2025 20:37
pdb2mdb for Visual Studio 2015

The Visual Studio Tools for Unity are able to convert .NET debug symbol files (namely pdb files) to debug symbols files that are understood by Unity's scripting engine (namely .dll.mdb files) when importing both the .dll and the .pdb in the Assets folder.

If you prefer to handle the conversion yourself you need to call a tool named pdb2mdb on the .dll associated with the .pdb:

pdb2mdb MyLibrary.dll

Will produce a MyLibrary.dll.mdb usable on Unity if MyLibrary.pdb is present.

// Use in a .NET console project
// Set <PublishAot>true</PublishAot> and <AllowUnsafeBlocks>true</AllowUnsafeBlocks> in the .csproj
// Run dotnet publish
// Create service: sc create MyService binPath= "C:\full\path\to\Release\net9.0\win-x64\publish\WatchTemp.exe"
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
class Service : IDisposable
{
#:package Raylib-cs@7.0.2
// Ported from https://github.com/raysan5/raylib-games/blob/master/classics/src/arkanoid.c
// Sample game developed by Marc Palau and Ramon Santamaria
// Copyright (c) 2015 Ramon Santamaria (@raysan5)
using System.Numerics;
using Raylib_cs;
using static Raylib_cs.Raylib;
"""
LLDB pretty printer for NativeAOT
Add to ~/.lldbinit:
command script import {path-to-lldb-nativeaot}/NativeAOT.py
"""
import lldb
// dotnet publish
// sc create TempWatcher binPath= "C:\tmp\WatchTemp\bin\Release\net9.0\win-x64\publish\WatchTemp.exe"
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
class Service : IDisposable
{
public static string Name = "TempWatcher";
const string path = @"c:\temp";

I'm not a completionist. I have little interest in getting all the achievements in a game and my interest for a game usually drops after I finish it.

However, there's one game that I have been playing for a long time, and where I only have one missing achievement on Xbox, and that is Rayman Legends. I've finished the game, I've replayed all levels multiple times, and my entire family is still playing it together. If you don't have a soft spot for Rayman, it's probably because you were not 12 and French when it came out. But Rayman Legends is a great platformer, it's still absolutely gorgeous, and it plays great. My last missing achievement is reaching level 11 in Rayman Legends.

Rayman Legends

To get to level 11 and get 100% achievements in Rayman Legends is a bit of a grind.

unsafe class Program
{
static void Main()
{
IO io = new(42);
IOPtr ioPtr = new(&io);
Settings(ioPtr);
Console.WriteLine(io.Foo);
}

For our Visual Studio Code extension, we implemented a debug adapter for our Unity debugger.

Part of the job is translating data structures from our debugger (say a UnityThread), to a DAP Thread. We're using a library that uses List<T> to represent collections.

I originally wrote:

UnityThread[] threads = ...;
List<DAPThread> dapThreads = threads.Select(CreateDAPThread).ToList();
@jbevain
jbevain / brittle.cs
Last active December 18, 2024 00:29
using System.Runtime.InteropServices;
unsafe class Program
{
static void Main()
{
ReadOnlySpan<byte> name = stackalloc byte[]
{
(byte)'J',
(byte)'b',