Skip to content

Instantly share code, notes, and snippets.

View malayli's full-sized avatar

Digifox (Malik Alayli) malayli

  • Digital Fox
  • Tokyo, Japan
View GitHub Profile
Reference:
https://blog.jacobstechtavern.com/p/why-is-task-running-on-main-thread
A Task will normally run on the thread it was instantiated from.
- Tasks normally start running straight away on the thread on which they are defined.
This means if they are started on the main thread, they should run on the main thread.
- await functions act as a suspension point, where work might leave the main actor and execute on another thread.
/*---------------------------------------------------------------------------------
snes pad demo
-- alekmaul
---------------------------------------------------------------------------------*/
#include <snes.h>
@malayli
malayli / gist:598d4635f18d6315e024e77199af4b80
Last active December 12, 2023 10:04
Build PVSnesLib on Apple M3 Max
1) Install mandatory tools
brew update
brew install gcc@12
brew install doxygen
brew install gnu-sed
2) Edit .zprofile
vi ~/.zprofile
3) Add this line to .zprofile
@malayli
malayli / VgmToItConversion.md
Last active August 18, 2023 10:26
Sega Master System's VGM to IT Conversion

Sega Master System's VGM to IT Conversion

Convert VGM file to MIDI file

  • Download vgm2mid.exe
  • Open vgm2mid.exe
  • Add directory
  • Select a file
  • Click on Open
  • Click on Convert all
.include "hdr.asm"
.accu 16
.index 16
.16bit
.define __bubbleSortPerson_locals 0
.SECTION ".text_0x0" SUPERFREE
bubbleSortPerson:
.ifgr __bubbleSortPerson_locals 0
tsa
sec
@malayli
malayli / mode7.c
Last active May 5, 2023 05:09
Super NES Mode 7 Rotation
#include <snes.h>
extern char levelIntro1Patterns, levelIntro1Patterns_end;
extern char levelIntro1Palette;
extern char levelIntro1Map, levelIntro1Map_end;
u8 angle;
u16 sx, sy; // current coordinates
void setMode7_HdmaPerspective() {
@malayli
malayli / swiftAndKotlinProblem01.swift
Last active September 22, 2025 16:53
Swift Problems
// Swift
class Class1 {
var class2: Class2?
init(class2: Class2) {
self.class2 = class2
}
deinit {
@malayli
malayli / Convert SPC file to IT file
Last active August 5, 2022 21:06
SNES Music Conversion for PVSnesLib
1) Convert SPC file to IT file
./spc2it music.spc -r 128
Download link: https://github.com/uyjulian/spc2it/releases/tag/v0.4.0
2) Open music.it with OpenMPT
https://openmpt.org/
#include <snes.h>
// ROM
const u16 oamAddressOrigin = 0x6000;
const u16 oamAddressDelta = 0x10;
const u16 spriteSize8 = 32;
const u16 spriteSize16 = 64;
// RAM
// A sprite or a set of sprites
// Note: source can contain more than one sprite
typedef struct Sprite {
char *source;
u16 address;
u16 size;
} Sprite;
// A person on the screen composed by 8x8 sprites and 16x16 sprites
typedef struct Person {