Skip to content

Instantly share code, notes, and snippets.

View wwylele's full-sized avatar
🐟
Eating fish

Weiyi Wang wwylele

🐟
Eating fish
View GitHub Profile
@wwylele
wwylele / expressionSearch.cpp
Last active October 24, 2015 10:21
A stupid searcher for expressions containing specified numbers and resulting in specified number
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
using namespace std;
bool next_operatorPostion(int* operatorPostion,int numberCount){
int counter = numberCount-2;
while(1){

3DS CRO Information

AKA reference for citra CRO code.

wwylele: I am not a English native speaker, so there can be some strange words and sentences below. Suggestions for improvement are welcome.

Warning: CRO is still not completely understood, and there can be mistakes below. Please keep the sense of suspecting.

Terminology

Note: some terms are given by comparing the behavior with similar concept. They may be inaccurate, or even incorrect.

  • Module is a chunk of executable code and data. Modules can be linked to each other.
@wwylele
wwylele / config_block.py
Created November 22, 2016 18:21
3DS config savegame parser
# Python 3
import struct
import sys
import os
if len(sys.argv)<2:
print("No input file")
exit()
flen=os.path.getsize(sys.argv[1])
f=open(sys.argv[1], 'rb');
@wwylele
wwylele / bit_trie.cpp
Last active January 1, 2018 17:14
"Bit trie" a trie-like structure
#include <algorithm>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
/*
bit_trie
@wwylele
wwylele / main.c
Created March 13, 2018 11:15
shadow map sampling
#include <3ds.h>
#include <stdio.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
#include <3ds.h>
#include <stdio.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
@wwylele
wwylele / sample shader
Created April 24, 2018 08:44
sample shader
////////////////////////////////////////////////////////////////
/// Programmable Vertex Shader
#version 330 core
#extension GL_ARB_separate_shader_objects : enable // only presents for separable shader
struct pica_uniforms {
bool b[16];
uvec4 i[4];
vec4 f[96];
@wwylele
wwylele / main.c
Created May 5, 2018 01:29
primitive restart test
#include <3ds.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
@wwylele
wwylele / main.c
Created July 2, 2018 18:13
mipmap test
#include <3ds.h>
#include <citro3d.h>
#include <tex3ds.h>
#include <string.h>
#include <stdlib.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
@wwylele
wwylele / main.c
Created July 5, 2018 07:43
proctex mipmap test
#include <3ds.h>
#include <citro3d.h>
#include <tex3ds.h>
#include <string.h>
#include <stdlib.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \