Skip to content

Instantly share code, notes, and snippets.

// Parses a dies irae "script" extracted from memory and dumps the content text
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define and &&
#define or ||
#ifndef NULL
hoshizora no memoria
The output of https://github.com/akerou/fvp/releases/tag/v1.0 is already clean. Just delete the beginning bits and end bits of the file that constitute non-content text, and use a regex (like "【.*") with a text editor's find/replace to delete all lines that are just a dialogue box name (geany, notepad++, akelpad, etc)
realta nua
Use https://tlwiki.org/?title=Tools#KiriKiri2.2FKAG3 to extract the script data from each route's vanilla executable. Yes, the executable. Follow the instructions in
dies irae
Use a HxD's memory editing feature. Search malie.exe's memory space to find the start of the script in RAM (it's encoded in little endian UTF-16) and extract it by copy pasting. Trust me, it's way easier than decrypting and decompressing the script.
This file has been truncated, but you can view the full file.
format: XXXX,4786,4786,20000,名詞,固有名詞,一般,*,*,*,,XXXX,XXXX,,XXXX,,固,*,*,*,*,,,,,*,*,*,*,*
format, comcat to lex.tsv
ああ
ああさ
ああ無情
あい
あいえ
あいおい損害保険
あいか
@wareya
wareya / extract.py
Created May 12, 2017 21:01
script dumper (insertion not supported) for magical charming and maybe other bgi/ethornell games
#!/usr/bin/env python
# attempts to parse the BGI stack language version Magical Charming uses, in order to extract content text
#
from sys import argv, exit
from mmap import mmap
from struct import unpack, iter_unpack
#documented (poorly) by bgiop.py
@wareya
wareya / unarc.cpp
Created May 12, 2017 22:16
extract buriko arc20 archives (raw data only)
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
void fread_or_die(void * a, size_t b, size_t c, FILE * d)
{
size_t got = fread(a, b, c, d);
@wareya
wareya / muramasa.py
Created May 14, 2017 23:30
outputs content text from muramasa's script files
# krkr line counter script
#
# How to run:
#
# (1) Organize game scripts into directories one level below where this script resides.
# (2) Run the script, size data is printed to standard out
#
# Script output is in the following format:
# <script_name> <line_count> <size_in_bytes>
#
@wareya
wareya / mjo.cpp
Last active May 18, 2017 18:21
Dumps a .mjo file (binary script for Katahane) to a human-readable plaintext script. Furigana format 《かな》〈漢字〉
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
uint8_t key[1024] = {
0x00,0x00,0x00,0x00,0x96,0x30,0x07,0x77,0x2c,0x61,0x0e,0xee,0xba,0x51,0x09,0x99,
0x19,0xc4,0x6d,0x07,0x8f,0xf4,0x6a,0x70,0x35,0xa5,0x63,0xe9,0xa3,0x95,0x64,0x9e,
0x32,0x88,0xdb,0x0e,0xa4,0xb8,0xdc,0x79,0x1e,0xe9,0xd5,0xe0,0x88,0xd9,0xd2,0x97,
@wareya
wareya / extensionfinder.cpp
Last active May 19, 2017 16:37
guesses extensions for some files
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
@wareya
wareya / autoxorfinder.cpp
Last active May 19, 2017 17:02
attempts to automatically find 1-byte xor ciphers for files that originally had lots of 00-bytes and unmask them
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
@wareya
wareya / decompress.py
Created May 19, 2017 17:47
(teardown of someone else's extractor) decompress the contents of whatever .ks.scn files are considered (mdf?)
import sys
import os
import zlib
import glob
for arg in sys.argv[1:]:
for file in glob.glob(arg):
if os.path.splitext(file)[1].lower() == '.scn':
if not os.access(os.path.splitext(file)[0] + '.psb', os.F_OK):
data = open(arg, 'rb').read()