Skip to content

Instantly share code, notes, and snippets.

View Atari2's full-sized avatar
💭
Looking for ideas honestly

Alessio Atari2

💭
Looking for ideas honestly
View GitHub Profile
@Atari2
Atari2 / italian_cpp.h
Last active October 9, 2021 22:25
italian_cpp.h
#define per for
#define se if
#define altrimenti else
#define costante const
#define mutabile mutable
#define intero int
#define reale float
#define doppio double
#define mentre while
#define fai do
@Atari2
Atari2 / lsnes_build.sh
Last active May 8, 2024 10:33
lsnes build script
# dependencies I had to install:
# sudo apt install libgcrypt20-dev
# sudo apt install portaudio19-dev
# sudo apt install libwxgtk3.0-gtk3-dev
# sudo apt install libswscale-dev
# keep in mind you also need lua, boost and curl-config
# which can be installed with:
# sudo apt-get install lua5.4
# sudo apt-get install liblua5.4-dev
@Atari2
Atari2 / zsnes_build.ps1
Last active December 4, 2022 16:23
zsnes windows build script
try {
$vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationpath
Import-Module (Get-ChildItem $vsPath -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x86'
} catch {
Write-Output "Failed to enter VS Dev Shell: $_"
Exit 1
}
try {
@Atari2
Atari2 / Common.h
Last active May 18, 2022 11:18
Common utilities in a header file.
#pragma once
#include <array>
#include <bit>
#include <concepts>
#include <cstdint>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#ifdef BACKTRACE_AVAILABLE
@Atari2
Atari2 / .clang-format
Last active May 18, 2022 11:14
.clang-format personal style configuration (requires clang-format 14 or newer)
AccessModifierOffset: 0
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
@Atari2
Atari2 / pcg.asm
Last active June 4, 2022 18:41
PCG PoC for the SNES using XSH-RR with 16-bit state and 8-bit output.
!state_const = $5621
!state = $0123 ; some freeram
!multiplier = $12 ; keep this 1 byte only
!increment = $02AB
lorom
org $008000
baseaddr:
lda #$80
sta $2100
@Atari2
Atari2 / ExampleUsage.cpp
Created June 11, 2022 21:35
Include binary blobs inside your C++ executable. (works on GCC)
#include "IncBinTest.h"
#include <cstdio>
// imagine that somewhere in your directory there's a file called test.bin
// this will a create test_data() function that returns an instance of incbin_data.
DEF_INCBIN(test, ".bin")
int main()
{
auto ptr = test_data();
printf("%p %d\n", ptr.ptr, ptr.size);
@Atari2
Atari2 / downloadSMWCSection.py
Created January 19, 2023 21:16
downloadSMWCSection
import requests
import os
from bs4 import BeautifulSoup
import time
import re
import logging
import shutil
from urllib.parse import unquote_plus
logger = logging.Logger(name='Errors', level=logging.ERROR)
@Atari2
Atari2 / COMPILE_COMMANDS.md
Last active February 15, 2023 11:55
msvc module bug undefined object

Steps to reproduce the bug:

  • First open a VS developer shell using Visual Studio Version 17.5.0 Preview 6.0
  • Compile first with cl /nologo /std:c++latest /EHsc main.cpp compilation should succeed.
  • Compile again with cl /nologo /std:c++latest /EHsc /DMODULES mod.ixx main.cpp you will now see an error like
C:\Users\anon\dev\TestInclude.h(13): error C2079: 'storage<Object>::value' uses undefined class 'Object'
main.cpp(8): note: see reference to class template instantiation 'storage<Object>' being compiled