Skip to content

Instantly share code, notes, and snippets.

View ajc2's full-sized avatar
🐌

Alex Craik ajc2

🐌
View GitHub Profile
@ajc2
ajc2 / qrinfo.org
Last active February 21, 2023 01:02
PTC QRs and SD File Handling

PTC QRs and SD File Handling

Abstract

PTC uses two systems for import and export of files. SD files are generated when an PTC file is exported to the SD card. They simply consist of a header on top of internal PTC file formats. The intended purpose of SD files is to store metadata and a hash so the file can be validated and converted into a QR set. QR sets are used for distributing and importing PTC files by scanning them with the DSi/3DS camera. The information contained in the SD file wrapper is not stored literally in the QR data stream; it is used for validation and processed into a different format. Because QR codes have an upper bound on data storage, a PTC file has to be split into frames in a specific method; these frames are then converted into QR codes.

Note: All multibyte integers (like sizes) are little-endian. All literal byte values in this document (e.g. 50 54) are written in hexadecimal.

SD File Header

Files exported to SD card consist of a SD file header, and then the conte

@ajc2
ajc2 / sbapi-sbs.js
Created September 16, 2019 10:04
Fixed sbapi-sbs.js for SB4 mincompat check
// SBAPI for SBS
// By 12Me21 and MasterR3C0RD, 2019
// sb4 key fix by snail_
var keyregex = /\b3*([A-HJ-NP-TV-Z1-9]{1,8})\b/g;
function sanitize(text){
return text.replace(/&/g,"&amp;").replace(/</g,"&lt;");
}
@ajc2
ajc2 / README.md
Last active June 4, 2018 21:42
SCRIPT-8
@ajc2
ajc2 / covfefeify_explanation.md
Last active April 12, 2018 07:25
A description of a PPCG answer.

Explanation time!

I'm also in the mood to write a long, detailed explanation. SmileBASIC is fairly obscure, so hopefully someone learns from it. This is an explanation to this answer on PPCG.

The vowel list

V$="AEIOUY

I store the list of which letters are vowels in a string named V$; there is no "is this a vowel" builtin, and I refer to this list three times, so it's best to store it.

Taking input