Skip to content

Instantly share code, notes, and snippets.

View superctr's full-sized avatar
😵
I hate github's new layout

superctr superctr

😵
I hate github's new layout
View GitHub Profile
// note: setting SSG-EG to 100 to enable AM is not supported in old versions of ctrmml/mdsdrv
// please set this to 0 for compatibility
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include <regex>
#include <map>
@superctr
superctr / sc_src.c
Created May 20, 2020 15:56
unpacker for Software Creations .SRC files
#include <stdio.h>
#include <string.h>
// decompression tool for Software Creations source code
// created by ctr
// using data from "edit_sfx.com"
//---------------------------------------------------------------------------
// The tables could be modified to retarget the code to a different assembler
// > at beginning of line starts a multi line comment until <
@superctr
superctr / qsound.md
Last active May 31, 2020 14:09
qsound register description

CPS2 QSound DSP Register Description

Channel Registers (00-7F)

Bank (x0, x8)

This sets the upper 8 bits of the sample address (bit 16-23). The most significant bit (bit 15) must be set to 1. Keep in mind the bank number is not affected by the sample address.

Note:

The bank register address is aligned so that the first register 0x00 affects channel 15, 0x08 channel 0, and so on.

Address (x1, x9)

This sets the sample address.

Note:

Always set this register when starting sample playback, as this register is also used to track the current position of the sample.

@superctr
superctr / iirc.c
Last active December 20, 2017 21:29
IIR low pass cutoff calculator
/*
Calculate filter constant for a single pole low pass IIR filter
given cut off freq and the sample rate.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc,char *argv[])
{
if(argc<2)
@superctr
superctr / extraheader.xsc
Last active March 19, 2017 11:57
add VGM extra header
ADR $BC
OVERWRITE 44
ADR $100
; Chip ID
; | Multiplication factor (plus 0x80)
; | | |
OVERWRITE 0C 00 00 00 00 00 00 00 04 00 00 00 01 12 00 80 81
; chip id table
;"SN76496" = 00
@echo off
rem forfiles /m *_trimmed.vgm /c "cmd /c echo @file"
del *_optimized_optimized.vgm
forfiles /m *_trimmed.vgm /c "cmd /c vgm_sro @file"
forfiles /m *_trimmed_optimized.vgm /c "cmd /c vgm_cmp @file"
@superctr
superctr / opl2to4.c
Last active December 8, 2016 09:55
opl2to4
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
/*
convert opl2 commands to opl4 commands
*/
void cni(uint8_t** dest, void* src, int size)