Skip to content

Instantly share code, notes, and snippets.

API Design: Coroutines APIs (Janurary-2017)

I am currently dealing with a lot of libraries at work. Both third party as well as libraries written or being currently in process of being written by me. I absolutely love writing and working with libraries. Especially if they present or bring me to either a new or different approach to solve a problem. Or at least provide a different view.

Over time I noticed however that quite regulary we had to decide that we cannot use a third party library. Often it is the usual reason.

@flamewing
flamewing / dma-macros.asm
Last active October 23, 2024 19:31
Some improved DMA macros, and a couple new DMA macros, for the Mega Drive
dmaSource function addr,((addr>>1)&$7FFFFF)
dmaLength function length,((length>>1)&$7FFF)
dmaCommLength function length,(($9400|((length&$FF00)>>8))<<16)|($9300|(length&$FF))
dmaCommSrcLow function source,(($9600|((source&$FF00)>>8))<<16)|($9500|(source&$FF))
dmaCommSrcHigh function source,$9700|(((source&$FF0000)>>16)&$7F)
; Tells the VDP to copy a region of 68k memory to VRAM or CRAM or VSRAM.
dma68kToVDP macro src,dest,length,type,bswap
if MOMPASS>1
if ((src)&1)<>0
@flamewing
flamewing / m68k_opt.md
Last active September 1, 2024 02:44
Some peephole optimizations for M68000
@d7samurai
d7samurai / .readme.md
Last active November 17, 2024 13:00
Minimal D3D11

Minimal D3D11

Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup + basic rendering primer and API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~200 LOC. No modern C++, OOP or (other) obscuring cruft. View on YouTube

hollowcube

Also check out Minimal D3D11 part 2, reconfigured for instanced rendering and with a smaller, tighter, simplified overall code structure, or Minimal D3D11 part 3, with shadowmapping + showcasing a range of alternative setup and rendering techniques.

@mmozeiko
mmozeiko / ods.c
Created April 16, 2019 19:20
Example how to capture OutputDebugString on Windows
#include <windows.h>
#include <intrin.h>
#define Assert(x) do { if (!(x)) __debugbreak(); } while (0)
static struct
{
DWORD process_id;
char data[4096 - sizeof(DWORD)];
}* ods_buffer;
@WillSams
WillSams / m68k_dev_setup.sh
Last active October 23, 2022 18:06
Setup for Motorola 68000 (Sega, Neo Geo) Cross Compiler on Windows-based System
#!/bin/bash
echo "==================================================================="
echo
echo " My m68000 Development Setup "
echo " You may be prompted by UAC for credentials to complete the install "
echo
echo " Pre-req: Latest 64-bit MSYS2 from http://www.msys2.org/ "
echo
echo " Howto: Use 'wget' to download the raw version of this script "
This file has been truncated, but you can view the full file.
//
// +-------------------------------------------------------------------------+
// | This file was generated by The Interactive Disassembler (IDA) |
// | Copyright (c) 2019 Hex-Rays, <[email protected]> |
// +-------------------------------------------------------------------------+
//
//
// This file should be used in the following way:
// - reload executable into IDA with using switch -c
// - use File, Load IDC file and load this file.
@valinet
valinet / README.md
Last active October 8, 2024 23:34
Get dark command windows all the time in Windows

Case study: Get dark command windows all the time in Windows

TL;DR

  1. Make a copy conhost.exe from System32.
  2. Open it with a hex editor (I use HxD).
  3. In HxD, go to Search - Find - Hex-values.
  4. Search for 881d9e530a004885c07477ff15b32e08009084c0.
  5. In Windows 10 version 2004, replace ff15b32e0800 with 909090909090. If using Windows 10 version 20H2, replace ff15b32e08009084 with 9090909090909090.
  6. Save file and copy it back to System32 (take ownership of original conhost.exe in order to replace it).
  7. Profit!