Skip to content

Instantly share code, notes, and snippets.

@nathan130200
nathan130200 / PCSX2 - Memory Addresses.md
Last active May 2, 2026 15:00
PCSX2 - Memory Addresses

God of War 2 (CRC: 2F123FD8): Power Orbs (UINT32): 0x0071AFFC

The Punisher (CRC: BC204346): Money to Buy Upgrades (UINT32): 0x01B426D0


* PS2 EE uses little endian byte order.

@nathan130200
nathan130200 / XmlParser.cs
Created January 18, 2026 22:31
Basic XML parser using SAX-like events.
public delegate void StartElementHandler(string name, IReadOnlyDictionary<string, string> attributes);
public delegate void EndElementHandler(string name);
public delegate void CharacterDataHandler(string content);
public delegate void CommentHandler(string data);
public delegate void ProcessingInstructionHandler(string target, string data);
public class XmlParser(Encoding? encoding = default)
{
static readonly UTF8Encoding s_DefaultEncoding = new(false, true);
@nathan130200
nathan130200 / ! README.md
Last active November 30, 2025 22:31
Basic XML parser implementation on top of expat.

XML Parser

Basic XML parsing using libexpat bindings for .NET |

  • Its optimized for memory usage, if you don't listen for any SAX-like events (Start/end tag, comment, etc) will not produce any string from handlers.
  • You can really reset parser internal state.
  • Don't need check end tag because expat already does.
  • Use its internal string pooling (maybe add NameTable would be useful too?).
  • No unsafe operations (fixed pointers, etc). All marshaling using a "safe" context.
  • Library name hints for multiple platforms. Eg: VCPKG compiles as libexpat.dll, other compilers will produce expat.dll instead, same for Unix (so) and Mac systems (dylib)
@nathan130200
nathan130200 / Analysis of bind_server_info.md
Last active October 23, 2026 18:05
Analysis of bind_server_info query in warface dedicated servers.
  1. See master_server_resource attribute is empty before bind. So we need to lock an MS to Dedi:

[2025-10-23T09:51:17.848-03] [COnlineChannel] Setting MasterServer pve_2 (pve) as current

<iq to='k01.warface.servers' id='uid00000004' type='get' from='dedicated@warface/pve:63011' xmlns='jabber:client'>
	<query xmlns='urn:cryonline:k01'>
		<setserver server='DC-63011' host='DESKTOP-75JEN6A' port='63011' node='127.0.0.1' mission_key='' status='5' version='1.22400.5519.45100' mode='pvp_pve' session_id='' cpu_usage='0' memory_usage='699' load_average='0' region_id='global' master_server_resource='' build_type='--profile'/>
	</query>
@nathan130200
nathan130200 / Program.cs
Last active October 8, 2025 00:47
Codigo fonte do app pra testar a latência do boosteroid.
using Spectre.Console;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Net.NetworkInformation;
Console.Title = "BOOSTEROID - PING TEST";
List<Entry> hosts = [];
{
@nathan130200
nathan130200 / Xml.cs
Created August 26, 2024 20:41
C# helper methods & types to manage XML Linq Elements in .NET
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Linq;
namespace Jabber;
public static partial class Xml
@nathan130200
nathan130200 / jid.cpp
Created May 22, 2024 21:38
JID parser & management.
#include "jid.h"
#include "xmpp.h"
#include <sstream>
using namespace std;
Jid::Jid()
{
}
@nathan130200
nathan130200 / Program.cs
Last active November 26, 2023 22:21
Java's UUID implementation in C#
using System.Text;
var sampleInput = "TestUuid/.NET";
var expcetedUUIDStr = "e0198edc-d96b-3d2f-83ee-9a0614f93187";
var uuidInstance = Uuid.FromName(Encoding.UTF8.GetBytes(sampleInput));
var currentUUIDStr = uuidInstance.ToString();
// test readonly array
var buf1 = uuidInstance.ToByteArray();
var buf = uuidInstance.ToByteArray();
@nathan130200
nathan130200 / xcloud_custom.user.js
Created September 13, 2022 18:38
Xcloud on browser - Set game video to fill browser area.
// ==UserScript==
// @name Fill Xcloud Video Screen
// @author FRNathan13
// @match https://www.xbox.com/pt-BR/play/launch/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=xbox.com
// @grant none
// @version 1.0
// ==/UserScript==
(function() {
@nathan130200
nathan130200 / MinecraftUtil.cs
Last active August 5, 2022 13:51
T4 templates for stream I/O + Minecraft stream I/O utilities.
using System.Runtime.CompilerServices;
using System.Text;
namespace CraftDedicatedServer;
public static class Util
{
const int SEGMENT_BITS = 0x7f;
const int CONTINUE_BIT = 0x80;
const int MAX_STRING_LEN = short.MaxValue - 3;