Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Warp Terminal - Active Tab Contrast Patch
=========================================
Patches the WGSL rect shader embedded in warp.exe to increase contrast
between active and inactive tabs in dark mode.
Problem:
Warp's dark mode renders the active tab only ~4% brighter than inactive
Here's a bit of context. In the 90s, my father used an obscure statistics software named PCSM for his research. He has results of some studies stored in PCSM. He's now a few years away from retirement, and he doesn't want this data to be wasted.
Unfortunately, it uses a proprietary format so we can't directly access the file.
The software itself can be launched in DosBox, but it uses piracy protection based on a dongle plugged on the parallel port. I have the dongle, but no computer has a parallel port nowadays so it's useless.
What I want you is to find a way inside the software. I've already done some probing, and as far as I can tell it's based on a Pascal virtual machine (P-code) with some native routines for specialized stuff, such as reading
DECLARE SUB RotateXZ (p AS ANY, mcos!, msin!)
DECLARE SUB ToScreen (p AS ANY)
DECLARE SUB TranslateZ (p AS ANY, dz!)
DECLARE SUB DrawLine (p1 AS ANY, p2 AS ANY)
DECLARE SUB Project (p AS ANY)
DECLARE SUB SleepMS (ms!)
CONST W% = 320
CONST H% = 200
' Turbo Basic (Borland 1987) version of rotating cube
' ESC to quit
W% = 320
H% = 200
NBPOINTS% = 8
SCREEN 1
CLS
class Profiler : CorProfilerCallback3Base
{
// The default base implementation would just check that iCorProfilerInfoVersion matches the expected version for CorProfilerCallback3Base,
// and otherwise return an error code
public override HResult ValidateTargetRuntime(int iCorProfilerInfoVersion)
{
return HResult.S_OK; // I want to ignore the validation logic performed by Silhouette
}
public override HResult Initialize() // No more iCorProfilerInfoVersion here
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace InspectClipboard;
internal class Program
{
[STAThread]
static void Main(string[] args)
using JetBrains.Rd.Reflection;
namespace ParseHashMap;
public class Program
{
private static int _counter;
static void Main(string[] args)
{
namespace ConsoleApp1;
internal unsafe class Program
{
private struct StructWithFixedBuffer
{
public StructWithFixedBuffer()
{
}
using System.Runtime.CompilerServices;
using Silhouette;
using System.Runtime.InteropServices;
using System.Xml.Linq;
namespace JitProfiler;
internal unsafe class CorProfiler : CorProfilerCallback4Base
{
private const string FileName = @"G:\JetBrains\jit_profiler.txt";
var MODULES = new ActiveXObject("Scripting.Dictionary");
var n; // undefined
MODULES.Add(n, "Test value");
var keys = new VBArray(MODULES.Keys()).toArray();
WScript.Echo("Array length: " + keys.length);
WScript.Echo("Key at index 0: " + (keys[0] === undefined ? "undefined" : keys[0]));
WScript.Echo("Is index 0 enumerable? " + (keys.hasOwnProperty(0) ? "Yes" : "No"));