Parcourir la source

Installer: Added kernel data extractor. Already implemented for items.

Iñigo Valentin il y a 3 ans
Parent
commit
5248647b04

+ 177 - 0
V-Gears-Installer/include/Characters.h

@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+/**
+ * Table of English characters.
+ */
+static const unsigned char ENGLISH_CHARS[256] = {
+    // 0  1     2     3     4     5     6     7     8     9     A     B     C     D     E     F
+    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, // 0x00 - 0x0F
+    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, // 0x10 - 0x1F
+    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, // 0x20 - 0x2F
+    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, // 0x30 - 0x3F
+    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, // 0x40 - 0x4F
+    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 - 0x5F
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x60 - 0x6F
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x70 - 0x7F
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 - 0x8F
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x90 - 0x9F
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 - 0xAF
+    0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB0 - 0xBF
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 - 0xCF
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD0 - 0xDF
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 - 0xEF
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 - 0xFF
+};
+
+/**
+ *  First table of Japanese characters.
+ */
+static const unsigned short japanese_chars[256] = {
+    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
+    0xD030, 0x7030, 0xD330, 0x7330, 0xD630, 0x7630, 0xD930, 0x0000, 0xDC30, 0x7C30, 0xAC30, 0x4C30, 0xAE30, 0x4E30, 0xB030, 0x5030, // 0x00 - 0x0F
+    0xB230, 0x5230, 0xB430, 0x5430, 0xB630, 0x5630, 0xB830, 0x5830, 0xBA30, 0x5A30, 0xBC30, 0x5C30, 0xBE30, 0x5E30, 0xC030, 0x6030, // 0x10 - 0x1F
+    0x0000, 0x0000, 0xC530, 0x0000, 0xC730, 0x6730, 0xC930, 0x6930, 0x0000, 0xD130, 0x7130, 0xD430, 0x0000, 0xD730, 0x7730, 0xDA30, // 0x20 - 0x2F
+    0x0000, 0xDD30, 0x0000, 0x3000, 0x3100, 0x3200, 0x3300, 0x3400, 0x3500, 0x3600, 0x3700, 0x3800, 0x3900, 0x0130, 0x0230, 0x2000, // 0x30 - 0x3F
+    0xCF30, 0x6F30, 0xD230, 0x7230, 0xD530, 0x7530, 0xD830, 0x7830, 0xDB30, 0x7B30, 0xAB30, 0x4B30, 0xAD30, 0x4D30, 0xAF30, 0x4F30, // 0x40 - 0x4F
+    0xB130, 0x5130, 0xB330, 0x5330, 0xB530, 0x5530, 0xB730, 0x5730, 0xB930, 0x5930, 0xBB30, 0x5B30, 0xBD30, 0x5D30, 0xBF30, 0x5F30, // 0x50 - 0x5F
+    0xC130, 0x6130, 0xC430, 0x6430, 0xC630, 0x6630, 0xC830, 0x6830, 0xA630, 0x4630, 0xA230, 0x4230, 0xA430, 0x4430, 0xA830, 0x4830, // 0x60 - 0x6F
+    0xAA30, 0x4A30, 0xCA30, 0x6A30, 0xCB30, 0x6B30, 0x0000, 0x6C30, 0xCD30, 0x6D30, 0xCE30, 0x6E30, 0xDE30, 0x7E30, 0xDF30, 0x7F30, // 0x70 - 0x7F
+    0xE030, 0x8030, 0xE130, 0x8130, 0xE230, 0x8230, 0xE930, 0x8930, 0xEA30, 0x8A30, 0xEB30, 0x8B30, 0xEC30, 0x8C30, 0xED30, 0x8D30, // 0x80 - 0x8F
+    0xE430, 0x8430, 0xE630, 0x0000, 0x0000, 0x8830, 0xEF30, 0x8F30, 0xF330, 0x9330, 0x0000, 0x9230, 0xC330, 0x6330, 0xE330, 0x8330, // 0x90 - 0x9F
+    0xE530, 0x8530, 0xE730, 0x8730, 0xA130, 0x4130, 0xA330, 0x0000, 0xA530, 0x0000, 0xA730, 0x4730, 0x0000, 0x4930, 0x01FF, 0x1FFF, // 0xA0 - 0xAF
+    0x0E30, 0x0F30, 0x0000, 0x0000, 0x4100, 0x4200, 0x4300, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900, 0x4A00, 0x4B00, 0x4C00, // 0xB0 - 0xBF
+    0x4D00, 0x4E00, 0x4F00, 0x5000, 0x5100, 0x5200, 0x5300, 0x5400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFB30, 0x0000, // 0xC0 - 0xCF
+    0xFC30, 0x7E00, 0x2620, 0x0000, 0x0000, 0x0000, 0x0000, 0x1030, 0x1130, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C30, 0x0D30, 0x08FF, // 0xD0 - 0xDF
+    0x09FF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0D00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
+};
+
+/**
+ * Second table of Japanese characters.
+ */
+static const unsigned short JAPANESE_CHARS_FA[256] = {
+    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2759, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
+    0x0672, 0x7F4F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3478, 0x4466, 0x8364, 0x0000, 0x0000, 0x0000, // 0x20 - 0x2F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x666B, 0x5E79, 0x0000, 0x0000, 0xA898, 0x0000, 0x176C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
+    0x885B, 0x0000, 0x7D54, 0x0000, 0xD552, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6297, 0x0000, 0x0000, 0x0000, 0x0854, 0x0000, // 0x40 - 0x4F
+    0x0000, 0x0000, 0x0E66, 0x0000, 0x0000, 0x9C62, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x004E, 0x0000, 0x0580, // 0x50 - 0x5F
+    0x0000, 0x0000, 0x857F, 0x0000, 0x0000, 0x0000, 0x9950, 0x6856, 0x0000, 0x549B, 0xD56C, 0x0000, 0x0000, 0x0000, 0x0000, 0xFA51, // 0x60 - 0x6F
+    0x0163, 0xF876, 0x4B62, 0x0000, 0xBA78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB965, 0x4C88, 0x0000, // 0x70 - 0x7F
+    0x9A5B, 0x0000, 0x0000, 0x4D52, 0x1F77, 0x0000, 0x9A89, 0x1752, 0x8C5F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xDE56, 0x0000, // 0x80 - 0x8F
+    0x9A7D, 0x7565, 0x0000, 0x0000, 0x0000, 0x0000, 0x3E5C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0882, 0x0000, 0x0000, // 0x90 - 0x9F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3E5F, 0x0000, 0x0000, 0x0000, 0x4266, 0x0000, 0x0000, 0x2662, 0x0000, // 0xA0 - 0xAF
+    0x0000, 0x0000, 0x0000, 0x0000, 0xB751, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA8C, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
+    0xCD53, 0x0000, 0xEE76, 0x0000, 0x0000, 0x9B52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7551, 0x0000, 0x0000, 0x0000, // 0xC0 - 0xCF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
+};
+
+/**
+ * Third table of Japanese characters.
+ */
+static const unsigned short JAPANESE_CHARS_FB[256] = {
+    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
+    0x0000, 0x0000, 0xB182, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0B4E, 0x0000, 0x6551, 0x4851, 0x0D4E, 0x505B, 0x9B4F, 0x4B5C, // 0x00 - 0x0F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E96, 0x0000, 0x0000, 0xE890, 0x0000, 0x3458, 0x0000, 0xF24E, 0x9395, 0x0000, 0x0000, // 0x10 - 0x1F
+    0x5096, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x554F, 0x0000, 0x9965, 0x0000, 0x0A4E, 0x0000, 0x8B4E, 0x0000, 0x0000, // 0x20 - 0x2F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6559, 0x0000, 0x0000, 0x0000, 0x1D52, 0x5167, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
+    0x0000, 0x0000, 0xCA8E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xBA87, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
+    0x0000, 0x7751, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB672, 0x4B61, 0x0000, // 0x60 - 0x6F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B95, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x70 - 0x7F
+    0x0000, 0x0C54, 0x1F90, 0x4590, 0x0000, 0x0000, 0x0000, 0x0000, 0x7354, 0x0000, 0x0000, 0x0000, 0x0D50, 0x0000, 0x0000, 0x0000, // 0x80 - 0x8F
+    0x0000, 0xBA4E, 0xCA4E, 0x0000, 0x0000, 0x535F, 0x0000, 0x0000, 0xDB98, 0xE54E, 0x1659, 0x0000, 0x0000, 0x0000, 0xAB8E, 0x0000, // 0x90 - 0x9F
+    0xCB65, 0x0000, 0x0000, 0x0000, 0x5F6A, 0xB068, 0x0000, 0x8970, 0xB065, 0x214E, 0x2C67, 0x1B54, 0x0000, 0x8551, 0x5C4F, 0x668B, // 0xA0 - 0xAF
+    0x7972, 0x0000, 0x0000, 0x0000, 0x747A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB38D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7795, 0x0000, 0x0000, 0x5458, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B89, // 0xC0 - 0xCF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4351, 0x0000, 0x0000, 0x0000, 0x427D, 0x0000, 0x0000, 0x0D54, 0x0000, 0x0000, // 0xD0 - 0xDF
+    0x0000, 0x1062, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
+};
+
+/**
+ * Fourth table of Japanese characters.
+ */
+static const unsigned short JAPANESE_CHARS_FC[256] = {
+    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
+    0x0000, 0x0000, 0x188A, 0x0000, 0x7890, 0x6A75, 0x5788, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F
+    0x9358, 0xC35F, 0x0000, 0x0000, 0x0000, 0x0000, 0x5390, 0x0000, 0x0000, 0x0000, 0x0000, 0xFB5D, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x884E, 0x0000, 0x3D84, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x20 - 0x2F
+    0xE565, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE353, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x296E, 0x0000, 0x0000, 0x0000, 0x0000, 0x708D, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
+    0x0000, 0x0000, 0x7153, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x008A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
+    0x3159, 0x5765, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x60 - 0x6F
+    0x0000, 0x0000, 0xBC62, 0x0000, 0x0000, 0x0000, 0x5965, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x70 - 0x7F
+    0x0000, 0x0000, 0x0000, 0x0000, 0xC253, 0xE577, 0x5E80, 0x0000, 0xD54E, 0x2552, 0xC696, 0xE14F, 0x2875, 0x0000, 0x0000, 0x0000, // 0x80 - 0x8F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE965, 0x0000, 0x0000, 0x0000, 0x0000, 0x718A, 0x305E, 0x0000, 0x0000, 0x0000, // 0x90 - 0x9F
+    0x0000, 0xF258, 0x6E6D, 0x0000, 0xA052, 0x0000, 0x047D, 0x0000, 0x3C79, 0x5F67, 0x0000, 0x3775, 0x0000, 0x0000, 0x0000, 0xCB7A, // 0xA0 - 0xAF
+    0x0000, 0xFA4F, 0x0000, 0x0000, 0x0000, 0xC179, 0x0000, 0x0000, 0x1250, 0x114F, 0x0000, 0x0000, 0x0000, 0xA952, 0x0000, 0x0000, // 0xB0 - 0xBF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xAC8A, 0x0000, 0x0000, 0xF167, 0x0000, 0x0000, // 0xC0 - 0xCF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
+};
+
+/**
+ * Fifth table of Japanese characters.
+ */
+static const unsigned short JAPANESE_CHARS_FD[256] = {
+    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
+    0x0000, 0x1D4F, 0x0000, 0xA263, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F
+    0xE682, 0x0000, 0xF056, 0x0000, 0x0000, 0x0000, 0x0000, 0xA25B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
+    0x0000, 0x2B59, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB88C, 0x1F67, 0x0000, 0x0000, 0x0000, 0x0000, 0xDD4F, 0x2F5E, // 0x20 - 0x2F
+    0x0000, 0x0000, 0x0000, 0x1154, 0x0000, 0x0000, 0x7289, 0x0000, 0x216B, 0x0000, 0x207D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB78C, 0x0000, 0x0000, 0x0000, 0x7C5E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x8179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
+    0x0000, 0x975E, 0x0000, 0x0000, 0x0000, 0xCA7D, 0x1478, 0x0000, 0x0000, 0x8766, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x60 - 0x6F
+    0xC599, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x70 - 0x7F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFD88, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x80 - 0x8F
+    0x0000, 0x0000, 0x3293, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5453, 0x0000, 0x0000, // 0x90 - 0x9F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x3181, 0x0000, 0x8D8E, 0x0000, 0x0000, 0x0000, 0x0000, 0x3052, 0x0000, 0x0000, 0x0000, 0x0000, // 0xA0 - 0xAF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
+    0x9F52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5291, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xC0 - 0xCF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
+};
+
+/**
+ * Sixth table of Japanese characters.
+ */
+static const unsigned short JAPANESE_CHARS_FE[256] = {
+    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
+    0x0000, 0x0000, 0x0000, 0x667D, 0x0000, 0x0000, 0x0000, 0xAD65, 0x0000, 0x0000, 0xB96C, 0x0000, 0xD550, 0x585B, 0x0000, 0x0000, // 0x00 - 0x0F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B4F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x20 - 0x2F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9758, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
+    0x0000, 0x0000, 0x0000, 0xB48C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4256, 0xF158, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB54F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x60 - 0x6F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1D8B, 0x0000, 0x0000, 0x0000, 0xA14F, 0x206B, 0xC45B, 0xD95F, // 0x70 - 0x7F
+    0x0000, 0x944E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xA65E, 0x0000, 0x0000, 0x0000, 0x0000, 0x988A, // 0x80 - 0x8F
+    0x0000, 0x0000, 0x298F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x668A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x90 - 0x9F
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7272, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xA0 - 0xAF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xC079, 0x0000, 0xFD8E, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3B52, // 0xC0 - 0xCF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
+};

+ 7 - 0
V-Gears-Installer/include/DataInstaller.h

@@ -25,6 +25,7 @@
 #include "FieldTextWriter.h"
 #include "ModelsAndAnimationsDb.h"
 #include "ScopedLgp.h"
+#include "KernelFile.h"
 #include "SpawnPointDb.h"
 
 // TODO: Separate classes in files.
@@ -36,6 +37,7 @@ typedef std::map<u16, SpawnPointDb> FieldSpawnPointsMap;
 
 typedef std::map<u16, float> FieldScaleFactorMap;
 
+
 /**
  * The data installer.
  */
@@ -238,6 +240,11 @@ class DataInstaller{
          */
         std::unique_ptr<ScopedLgp> fields_lgp_;
 
+        /**
+         * BIN/GZ Kernel files.
+         */
+        std::unique_ptr<KernelFile> kernel_bin_;
+
         /**
          * LGP archive with texture data.
          */

+ 909 - 0
V-Gears-Installer/include/KernelFile.h

@@ -0,0 +1,909 @@
+/*
+ * Copyright (C) 2022 The V-Gears Team
+ *
+ * This file is part of V-Gears
+ *
+ * V-Gears is free software: you can redistribute it and/or modify it under
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, version 3.0 (GPLv3) of the License.
+ *
+ * V-Gears is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#pragma once
+
+#include <tinyxml.h>
+#include "common/BinGZipFile.h"
+#include "common/TypeDefine.h"
+#include "Characters.h"
+
+class KernelFile{
+
+    public:
+
+        enum KERNEL_SECTIONS{
+
+            /**
+             * Command data section in KERNEL.BIN.
+             */
+            KERNEL_COMMAND_DATA = 0,
+
+            /**
+             * Attack data section in KERNEL.BIN.
+             */
+            KERNEL_ATTACK_DATA,
+
+            /**
+             * Battle and growth data section in KERNEL.BIN.
+             */
+            KERNEL_BATTLE_AND_GROWTH_DATA,
+
+            /**
+             * Initialization data section in KERNEL.BIN.
+             */
+            KERNEL_INITIALIZATION_DATA,
+
+            /**
+             * Item data section in KERNEL.BIN.
+             */
+            KERNEL_ITEM_DATA,
+
+            /**
+             * Weapon data section in KERNEL.BIN.
+             */
+            KERNEL_WEAPON_DATA,
+
+            /**
+             * Armor data section in KERNEL.BIN.
+             */
+            KERNEL_ARMOR_DATA,
+
+            /**
+             * Accessory data section in KERNEL.BIN.
+             */
+            KERNEL_ACCESSORY_DATA,
+
+            /**
+             * Materia data section in KERNEL.BIN.
+             */
+            KERNEL_MATERIA_DATA,
+
+            /**
+             * Command descriptions section in KERNEL.BIN.
+             */
+            KERNEL_COMMAND_DESCRIPTIONS,
+
+            /**
+             * Magic descriptions section in KERNEL.BIN.
+             */
+            KERNEL_MAGIC_DESCRIPTIONS,
+
+            /**
+             * Item descriptions section in KERNEL.BIN.
+             */
+            KERNEL_ITEM_DESCRIPTIONS,
+
+            /**
+             * Weapon descriptions section in KERNEL.BIN.
+             */
+            KERNEL_WEAPON_DESCRIPTIONS,
+
+            /**
+             * Armor descriptions section in KERNEL.BIN.
+             */
+            KERNEL_ARMOR_DESCRIPTIONS,
+
+            /**
+             * Accessory descriptions section in KERNEL.BIN.
+             */
+            KERNEL_ACCESSORY_DESCRIPTIONS,
+
+            /**
+             * Materia descriptions section in KERNEL.BIN.
+             */
+            KERNEL_MATERIA_DESCRIPTIONS,
+
+            /**
+             * Key Item descriptions section in KERNEL.BIN.
+             */
+            KERNEL_KEY_ITEM_DESCRIPTIONS,
+
+            /**
+             * Command Names section in KERNEL.BIN.
+             */
+            KERNEL_COMMAND_NAMES,
+
+            /**
+             * Magic Names section in KERNEL.BIN.
+             */
+            KERNEL_MAGIC_NAMES,
+
+            /**
+             * Item Names section in KERNEL.BIN.
+             */
+            KERNEL_ITEM_NAMES,
+
+            /**
+             * Weapon Names section in KERNEL.BIN.
+             */
+            KERNEL_WEAPON_NAMES,
+
+            /**
+             * Armor Names section in KERNEL.BIN.
+             */
+            KERNEL_ARMOR_NAMES,
+
+            /**
+             * Accessory Names section in KERNEL.BIN.
+             */
+            KERNEL_ACCESSORY_NAMES,
+
+            /**
+             * Materia Names section in KERNEL.BIN.
+             */
+            KERNEL_MATERIA_NAMES,
+
+            /**
+             * Key Item Names section in KERNEL.BIN.
+             */
+            KERNEL_KEY_ITEM_NAMES,
+
+            /**
+             * Battle and Battle-Screen Text section in KERNEL.BIN.
+             */
+            KERNEL_BATTLE_AND_BATTLE_SCREEN_TEXT,
+
+            /**
+             * Summon Attack Names section in KERNEL.BIN.
+             */
+            KERNEL_SUMMON_ATTACK_NAMES
+
+
+        };
+
+        enum ELEMENT{
+
+            /**
+             * Fire element.
+             */
+            FIRE = 0,
+
+
+            /**
+             * Ice element.
+             */
+            ICE,
+
+
+            /**
+             * Bolt element.
+             */
+            BOLT,
+
+
+            /**
+             * Earth element.
+             */
+            EARTH,
+
+
+            /**
+             * Poison element.
+             */
+            POISON,
+
+
+            /**
+             * Gravity element.
+             */
+            GRAVITY,
+
+
+            /**
+             * Water element.
+             */
+            WATER,
+
+
+            /**
+             * Wind element.
+             */
+            WIND,
+
+
+            /**
+             * Holy element.
+             */
+            HOLY,
+
+
+            /**
+             * Restorative element.
+             */
+            RESTORATIVE,
+
+
+            /**
+             * Cut element.
+             */
+            CUT,
+
+
+            /**
+             * Hit element.
+             */
+            HIT,
+
+
+            /**
+             * Punch element.
+             */
+            PUNCH,
+
+
+            /**
+             * Shoot element.
+             */
+            SHOOT,
+
+
+            /**
+             * Shout element.
+             */
+            SHOUT,
+
+
+            /**
+             * Hidden element.
+             */
+            HIDDEN,
+        };
+
+        /**
+         * List of target selection options.
+         */
+        struct Target{
+
+            /**
+             * The target can be selected.
+             *
+             * If the target of the attack is selectable, at least between some subset of possible
+             * targets, this must be true.
+             */
+            bool selection_enabled;
+
+            /**
+             * The default target is an enemy.
+             *
+             * When true, the cursor starts in an enemy row. When false, it starts in the ally row.
+             * It may or may not be possible to change it.
+             */
+            bool default_enemy;
+
+            /**
+             * The default target is a group.
+             *
+             * When true, the cursor starts will all the members of a row selected. When false, it
+             * starts with only one target selected. It may or may not be possible to change it.
+             */
+            bool default_multiple;
+
+            /**
+             * The target group can be changed.
+             *
+             * When true, the target cannot be changed between enemies and allies. In this case
+             * {@see default_enemy} will determine the group that can be targeted.
+             */
+            bool fixed_row;
+
+            /**
+             * The command is short ranged.
+             *
+             * When true, if the target or the caster is not in the front of their row, the target
+             * will take half damage. Also, when true, an enemy covered by another enemy can't be
+             * targeted.
+             */
+            bool short_range;
+
+            /**
+             * Targets all, enemies and allies.
+             *
+             * When true, all allies and enemies are targets, and the selection can't be changed.
+             */
+            bool all_rows;
+
+            /**
+             * The target is random.
+             *
+             * When multiple targets are selected, one will be selected at random to be the
+             * receiving target. Cursor will cycle among all viable targets.
+             */
+            bool random;
+
+        };
+
+        /**
+         * Determines what an item affects on when used from the menu.
+         */
+        struct TargetCondition{
+
+            /**
+             * The item affects a party member or group HP.
+             */
+            bool party_hp;
+
+            /**
+             * The item affects a party member or group MP.
+             */
+            bool party_mp;
+
+            /**
+             * The item affects a party member or group status.
+             */
+            bool party_status;
+        };
+
+        /**
+         * List of altered status.
+         */
+        enum STATUS{
+
+            /**
+             * The character is dead.
+             */
+            DEATH = 0,
+
+            /**
+             * The character has critical HP.
+             */
+            NEAR_DEATH,
+
+            /**
+             * The character is asleep.
+             */
+            SLEEP,
+
+            /**
+             * The character is poisoned.
+             */
+            POISONED,
+
+            /**
+             * The character is sad.
+             */
+            SADNESS,
+
+            /**
+             * The character is furious.
+             */
+            FURY,
+
+            /**
+             * The character is confused.
+             */
+            CONFU,
+
+            /**
+             * The character is silenced.
+             */
+            SILENCE,
+
+            /**
+             * The character is slow.
+             */
+            HASTE,
+
+            /**
+             * The character is
+             */
+            SLOW,
+
+            /**
+             * The character is stopped.
+             */
+            STOP,
+
+            /**
+             * The character is a frog.
+             */
+            FROG,
+
+            /**
+             * The character is small.
+             */
+            SMALL,
+
+            /**
+             * The character is going to be petrified.
+             */
+            SLOW_NUMB,
+
+            /**
+             * The character is petrified.
+             */
+            PETRIFY,
+
+            /**
+             * The character is regenerating health.
+             */
+            REGEN,
+
+            /**
+             * The character has a physical barrier.
+             */
+            BARRIER,
+
+            /**
+             * The character has a magical barrier
+             */
+            M_BARRIER,
+
+            /**
+             * The character reflects magical attacks.
+             */
+            REFLECT,
+
+            /**
+             * The character has dual status.
+             *
+             * @todo What does it do.
+             */
+            DUAL,
+
+            /**
+             * The character has a shield.
+             */
+            SHIELD,
+
+            /**
+             * The character has a death sentence.
+             */
+            D_SENTENCE,
+
+            /**
+             * The character is being manipulated.
+             */
+            MANIPULATE,
+
+            /**
+             * The character is berserk.
+             */
+            BERSERK,
+
+            /**
+             * The character is invincible.
+             */
+            PEERLESS,
+
+            /**
+             * The character is paralyzed.
+             */
+            PARALYSIS,
+
+            /**
+             * The character is blinded.
+             */
+            DARKNESS,
+
+            /**
+             * The character has dual drain.
+             */
+            DUAL_DRAIN,
+
+            /**
+             * The character has deathforce.
+             */
+            DEATHFORCE,
+
+            /**
+             * The character has resist.
+             */
+            RESIST,
+
+            /**
+             * Cait' Sith lucky girl mode.
+             */
+            LUCKY_GIRL,
+
+            /**
+             * The character is imprisioned.
+             */
+            IMPRISONED
+        };
+
+        /**
+         * How a status effect modifier attack or item can act.
+         */
+        enum STATUS_EFFECT{
+
+            /**
+             * Inflicts status changes.
+             */
+            INFLICT = 0,
+
+            /**
+             * Cures status changes.
+             */
+            CURE = 1,
+
+            /**
+             * Toggles status changes.
+             *
+             * If the target doesn't have the status change, inflict it. If the target already has
+             * the status change, cure it.
+             */
+            TOGGLE = 2
+        };
+
+        struct StatusEffect{
+
+            /**
+             * The list of status to inflict or cure.
+             */
+            std::vector<int> status;
+
+            /**
+             * The chance of landing a status effect (out of 63).
+             */
+            u16 chance;
+
+            /**
+             * The status change mode.
+             */
+            STATUS_EFFECT mode;
+
+        };
+
+        /**
+         * Data for each items
+         *
+         * As found in KERNEL.BIN, file 4, in order, up to special. Members after special are not
+         * found literally in KERNEL.BIN, but are derived from other members or found in other
+         * files of the kernel (text files).
+         */
+        struct ItemData{
+
+            /**
+             * Unknown data (Always 0XFFFF). 4 bytes.
+             */
+            u32 unknown_0;
+
+            /**
+             * Unknown data (Always 0XFFFF). 4 bytes.
+             */
+            u32 unknown_1;
+
+            /**
+             * Camera movement ID. 2 bytes.
+             *
+             * Used for items useable in battle, determines the camera movement.
+             */
+            u16 camera;
+
+            /**
+             * Item restrictions. 2 bytes.
+             *
+             * Contains bits indicating if the item is {@see selleable}, {@see useable_battle} and
+             * {@see useable_menu}.
+             */
+            u16 restrict_raw;
+
+            /**
+             * Targeting mode. 1 byte.
+             *
+             * See {@see target} and {@TargetModes} for more information.
+             */
+            u8 target_raw;
+
+            /**
+             * Item effect ID. 1 byte.
+             *
+             * Used for animation in battle.
+             */
+            u8 effect;
+
+            /**
+             * Damage formula. 1 byte.
+             *
+             * This byte is divided into two nybbles (four bits). Upper nybble determines what
+             * considerations are made in calculating damage such as physical/magical, allowing
+             * criticals, how to calculate accuracy, etc. There are also three sets of known
+             * formulae that are paired with the upper nybble values. These are selected in the
+             * Lower Nybble and determine how to calculate pre-defense damage
+             */
+            u8 damage_raw;
+
+            /**
+             * The item power. 1 byte.
+             *
+             * Used for damage/healing calculation.
+             */
+            u8 power;
+
+            /**
+             * Item affected condition when used in menu. 1 byte.
+             *
+             * See {@condition} and {@ItemCondition} for more information.
+             */
+            u8 condition_raw;
+
+            /**
+             * Information about status change mode and chance. 1 bytes.
+             */
+            u8 status_change_raw;
+
+            /**
+             * Special flags. 1 byte.
+             *
+             * @tod Document and retrieve with info from
+             * https://wiki.ffrtt.ru/index.php?title=FF7/Battle/Attack_Special_Effects
+             */
+            u8 additional_effects_raw;
+
+            /**
+             * Special flags. 1 byte.
+             *
+             * @todop Document and retrieve with info from
+             * https://wiki.ffrtt.ru/index.php?title=FF7/Item_data
+             */
+            u8 additional_effects_mod_raw;
+
+            /**
+             * Information about what status can be inflicted or cured.  4 bytes.
+             */
+            u32 status_raw;
+
+            /**
+             * Information about the item elements. 2 bytes.
+             */
+            u16 element_raw;
+
+            /**
+             * Special flags. 2 bytes.
+             *
+             * @todo document and parse with info from
+             * https://wiki.ffrtt.ru/index.php?title=FF7/Battle/Special_Attack_Flags
+             */
+            u16 special_raw;
+
+            /**
+             * Item ID.
+             *
+             * Not actually in the item file data, it's the order at which it appears.
+             */
+            int id;
+
+            /**
+             * Item name.
+             *
+             * Not found in the same file as the rest of the data, but on file 19.
+             */
+            std::string name;
+
+            /**
+             * Item description.
+             *
+             * Not found in the same file as the rest of the data, but on file 11.
+             */
+            std::string description;
+
+            /**
+             * Indicates if the item can be sold.
+             *
+             * True if the bit 0 in {@see restrict_raw} is 0.
+             */
+            bool sellable;
+
+            /**
+             * Indicates if the item can be used in battle.
+             *
+             * True if the bit 2 in {@see restrict_raw} is 0.
+             */
+            bool useable_battle;
+
+            /**
+             * Indicates if the item can be used in the menu.
+             *
+             * True if the bit 4 in {@see restrict_raw} is 0.
+             */
+            bool useable_menu;
+
+            /**
+             * Target selection mode.
+             *
+             * Derived from {@see target_raw}.
+             */
+            Target target;
+
+            /**
+             * The damage formula.
+             *
+             * It's the upper nybble in {@see damage_raw}.
+             */
+            u8 damage_formula;
+
+            /**
+             * The damage modifier.
+             *
+             * It's the lower nybble in {@see damage_raw}.
+             */
+            u8 damage_modifier;
+
+            /**
+             * What the item affects when.
+             *
+             * Derived from {@see condition_raw}.
+             */
+            TargetCondition condition;
+
+            /**
+             * Status effects.
+             *
+             * Derived from {@see status_change_raw} and {@see status_raw}.
+             */
+            StatusEffect status;
+
+            /**
+             * Elements of the item.
+             *
+             * Derived from {@see element_raw}.
+             */
+            std::vector<int> elements;
+
+        };
+
+        KernelFile(std::string path): kernel_(path){}
+
+        ~KernelFile(){}
+
+        int ReadItems(){
+
+            // Empty the item list
+            items_.clear();
+
+            //kernel_ = BinGZipFile(folder_path + "/KERNEL.BIN");
+            //BinGZipFile kernel_ = BinGZipFile(folder_path + "/KERNEL.BIN");
+            //std::cout << "KERNEL FILES " << kernel_.GetNumberOfFiles() << "\n";
+            File items_file = kernel_.ExtractGZip(KERNEL_ITEM_DATA);
+            File items_name_file = kernel_.ExtractGZip(KERNEL_ITEM_NAMES);
+            File items_desc_file = kernel_.ExtractGZip(KERNEL_ITEM_DESCRIPTIONS);
+            int name_offset = 0;
+            int desc_offset = 0;
+            int item_count = 0;
+
+            std::cout <<
+              "|  ID | cam | sel | bat | men | tar | eff | dmg | pow | con | sch | eff | efm | sta | elm |  spe  |\n";
+
+            for (int i = 0; i < 128; i ++){
+
+                ItemData data;
+
+                // From the current name file offset, read 16 bytes.
+                // This is the pointer to the offset for the item name.
+                // Start reading there until 0xFF is found.
+                data.name = "";
+                u8 ch = 1;
+                name_offset = items_name_file.readU16LE();
+                while (ch != 0xFF){
+                    ch = items_name_file.GetU8(name_offset);
+                    if (ch != 0xFF) data.name += ENGLISH_CHARS[ch];
+                    name_offset ++;
+                }
+
+                // For descriptions, do the same as for names.
+                data.description = "";
+                ch = 1;
+                desc_offset = items_desc_file.readU16LE();
+                while (ch != 0xFF){
+                    ch = items_desc_file.GetU8(desc_offset);
+                    if (ch != 0xFF){
+                        // Warning: If the char is 0xF9, special function!
+                        // the next byte (in bits, aaoooooo) means to read aa data at offset oooooo.
+                        // This is to compress information in the kernel.
+                        if (ch == 0xF9){
+                            // Get how much to read, two upper bits of the next byte.
+                            // Multiply by 2 and add 4. That's just how it is.
+                            u8 comp_size = (items_desc_file.GetU8(desc_offset + 1) >> 6) * 2 + 4;
+                            // Get new offset, lower six bits of the next byte.
+                            // The offset goes backwards from the position of the 0xF9 byte.
+                            u8 comp_offset = items_desc_file.GetU8(desc_offset + 1) & 63;
+
+                            for (int i = 0; i < comp_size; i ++){
+                                data.description += ENGLISH_CHARS[
+                                  items_desc_file.GetU8(desc_offset - 1 - comp_offset + i)
+                                ];
+                            }
+                            desc_offset ++;
+                        }
+                        else{
+                            data.description += ENGLISH_CHARS[ch];
+                        }
+                    }
+                    desc_offset ++;
+                }
+
+                // If the item doesn't have a name, it means all items have been read.
+                // break the loop.
+                if ("" == data.name) break;
+
+                // Read data from the item data section.
+                data.unknown_0 = items_file.readU32LE();
+                //std::cout << "1st read " << data.unknown_0 << "\n";
+                data.unknown_1 = items_file.readU32LE();
+                data.camera = items_file.readU16LE();
+                data.restrict_raw = items_file.readU16LE();
+                data.target_raw = items_file.readU8();
+                data.effect = items_file.readU8();
+                data.damage_raw = items_file.readU8();
+                data.power = items_file.readU8();
+                data.condition_raw = items_file.readU8();
+                data.status_change_raw = items_file.readU8();
+                data.additional_effects_raw = items_file.readU8();
+                data.additional_effects_mod_raw = items_file.readU8();
+                data.status_raw = items_file.readU32LE();
+                data.element_raw = items_file.readU16LE();
+                data.special_raw = items_file.readU16LE();
+
+                // Derive data from the read data.
+                data.id = i;
+                data.sellable = !(data.restrict_raw & (1 << 0));
+                data.useable_battle = !(data.restrict_raw & (2 << 0));
+                data.useable_menu = !(data.restrict_raw & (4 << 0));
+
+                // Add to the list of items.
+                items_.push_back(data);
+                item_count ++;
+
+                printf(
+                  "| %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %3d | %5d | ",
+                  i, data.camera,
+                  data.sellable, data.useable_battle, data.useable_menu, data.target_raw,
+                  data.effect, data.damage_raw, data.power, data.condition_raw, data.status_change_raw,
+                  data.additional_effects_raw, data.additional_effects_mod_raw, data.status, data.element_raw, data.special_raw
+                );
+                std::cout << data.name << ": " << data.description << std::endl;
+
+
+            }
+
+            std::cout << "READ ITEMS END" << std::endl;
+            return item_count;
+        }
+
+        void WriteItems(std::string file){
+            std::cout << "WRITE ITEMS START" << std::endl;
+            TiXmlDocument xml;
+            std::unique_ptr<TiXmlElement> container(new TiXmlElement("items"));
+            for (ItemData item : items_){
+                std::unique_ptr<TiXmlElement> xml_item(new TiXmlElement("item"));
+                xml_item->SetAttribute("id", item.id);
+                xml_item->SetAttribute("name", item.name);
+                xml_item->SetAttribute("description", item.description);
+                xml_item->SetAttribute("sell", item.sellable);
+                xml_item->SetAttribute("battle", item.useable_battle);
+                xml_item->SetAttribute("menu", item.useable_menu);
+                xml_item->SetAttribute("effect", item.effect);
+                xml_item->SetAttribute("dmg_formula", item.damage_formula);
+                xml_item->SetAttribute("dmg_modifier", item.damage_modifier);
+                xml_item->SetAttribute("power", item.power);
+                container->LinkEndChild(xml_item.release());
+
+            }
+            xml.LinkEndChild(container.release());
+            xml.SaveFile(file);
+            std::cout << "WRITE ITEMS END" << std::endl;
+        }
+
+    private:
+
+        std::vector<ItemData> items_;
+
+
+        BinGZipFile kernel_;
+
+        //BinGZipFile kernel_2_;*/
+
+};

+ 1 - 1
V-Gears-Installer/include/common/BinGZipFile.h

@@ -97,4 +97,4 @@ class BinGZipFile : public File{
          * The number of files in the archive.
          */
         u32 file_count_;
-    };
+};

+ 8 - 2
V-Gears-Installer/src/DataInstaller.cpp

@@ -92,9 +92,15 @@ int DataInstaller::Progress(){
             progress_step_num_elements_ = 1;
             iterator_counter_ = 0;
             fields_lgp_ = std::make_unique<ScopedLgp>(
-              application_.getRoot(), input_dir_ + "field/flevel.lgp",
-              "LGP", "FFVIIFields"
+              application_.getRoot(), input_dir_ + "field/flevel.lgp", "LGP", "FFVIIFields"
             );
+            kernel_bin_ = std::make_unique<KernelFile>(input_dir_ += "kernel/KERNEL.BIN");
+            if (kernel_bin_->ReadItems() > 0){
+                CreateDir("game");
+                kernel_bin_->WriteItems(output_dir_ + "game/items.xml");
+            }
+            //exit(0);
+
             installation_state_ = SPAWN_POINTS_AND_SCALE_FACTORS_INIT;
             // TODO: DEBUG:
             //installation_state_ = CONVERT_FIELDS;

+ 1 - 159
V-Gears-Installer/src/FieldTextWriter.cpp

@@ -16,169 +16,11 @@
 #include <iostream>
 
 #include "FieldTextWriter.h"
+#include "Characters.h"
 #include "common/VGearsStringUtil.h"
 
 
-/**
- * Table of English characters.
- */
-static const unsigned char ENGLISH_CHARS[256] = {
-    // 0  1     2     3     4     5     6     7     8     9     A     B     C     D     E     F
-    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, // 0x00 - 0x0F
-    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, // 0x10 - 0x1F
-    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, // 0x20 - 0x2F
-    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, // 0x30 - 0x3F
-    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, // 0x40 - 0x4F
-    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x50 - 0x5F
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x60 - 0x6F
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x70 - 0x7F
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 - 0x8F
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x90 - 0x9F
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 - 0xAF
-    0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB0 - 0xBF
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 - 0xCF
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD0 - 0xDF
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 - 0xEF
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 - 0xFF
-};
-
-/**
- *  First table of Japanese characters.
- */
-static const unsigned short japanese_chars[256] = {
-    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
-    0xD030, 0x7030, 0xD330, 0x7330, 0xD630, 0x7630, 0xD930, 0x0000, 0xDC30, 0x7C30, 0xAC30, 0x4C30, 0xAE30, 0x4E30, 0xB030, 0x5030, // 0x00 - 0x0F
-    0xB230, 0x5230, 0xB430, 0x5430, 0xB630, 0x5630, 0xB830, 0x5830, 0xBA30, 0x5A30, 0xBC30, 0x5C30, 0xBE30, 0x5E30, 0xC030, 0x6030, // 0x10 - 0x1F
-    0x0000, 0x0000, 0xC530, 0x0000, 0xC730, 0x6730, 0xC930, 0x6930, 0x0000, 0xD130, 0x7130, 0xD430, 0x0000, 0xD730, 0x7730, 0xDA30, // 0x20 - 0x2F
-    0x0000, 0xDD30, 0x0000, 0x3000, 0x3100, 0x3200, 0x3300, 0x3400, 0x3500, 0x3600, 0x3700, 0x3800, 0x3900, 0x0130, 0x0230, 0x2000, // 0x30 - 0x3F
-    0xCF30, 0x6F30, 0xD230, 0x7230, 0xD530, 0x7530, 0xD830, 0x7830, 0xDB30, 0x7B30, 0xAB30, 0x4B30, 0xAD30, 0x4D30, 0xAF30, 0x4F30, // 0x40 - 0x4F
-    0xB130, 0x5130, 0xB330, 0x5330, 0xB530, 0x5530, 0xB730, 0x5730, 0xB930, 0x5930, 0xBB30, 0x5B30, 0xBD30, 0x5D30, 0xBF30, 0x5F30, // 0x50 - 0x5F
-    0xC130, 0x6130, 0xC430, 0x6430, 0xC630, 0x6630, 0xC830, 0x6830, 0xA630, 0x4630, 0xA230, 0x4230, 0xA430, 0x4430, 0xA830, 0x4830, // 0x60 - 0x6F
-    0xAA30, 0x4A30, 0xCA30, 0x6A30, 0xCB30, 0x6B30, 0x0000, 0x6C30, 0xCD30, 0x6D30, 0xCE30, 0x6E30, 0xDE30, 0x7E30, 0xDF30, 0x7F30, // 0x70 - 0x7F
-    0xE030, 0x8030, 0xE130, 0x8130, 0xE230, 0x8230, 0xE930, 0x8930, 0xEA30, 0x8A30, 0xEB30, 0x8B30, 0xEC30, 0x8C30, 0xED30, 0x8D30, // 0x80 - 0x8F
-    0xE430, 0x8430, 0xE630, 0x0000, 0x0000, 0x8830, 0xEF30, 0x8F30, 0xF330, 0x9330, 0x0000, 0x9230, 0xC330, 0x6330, 0xE330, 0x8330, // 0x90 - 0x9F
-    0xE530, 0x8530, 0xE730, 0x8730, 0xA130, 0x4130, 0xA330, 0x0000, 0xA530, 0x0000, 0xA730, 0x4730, 0x0000, 0x4930, 0x01FF, 0x1FFF, // 0xA0 - 0xAF
-    0x0E30, 0x0F30, 0x0000, 0x0000, 0x4100, 0x4200, 0x4300, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900, 0x4A00, 0x4B00, 0x4C00, // 0xB0 - 0xBF
-    0x4D00, 0x4E00, 0x4F00, 0x5000, 0x5100, 0x5200, 0x5300, 0x5400, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFB30, 0x0000, // 0xC0 - 0xCF
-    0xFC30, 0x7E00, 0x2620, 0x0000, 0x0000, 0x0000, 0x0000, 0x1030, 0x1130, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C30, 0x0D30, 0x08FF, // 0xD0 - 0xDF
-    0x09FF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0D00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
-};
-
-/**
- * Second table of Japanese characters.
- */
-static const unsigned short JAPANESE_CHARS_FA[256] = {
-    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2759, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
-    0x0672, 0x7F4F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3478, 0x4466, 0x8364, 0x0000, 0x0000, 0x0000, // 0x20 - 0x2F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x666B, 0x5E79, 0x0000, 0x0000, 0xA898, 0x0000, 0x176C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
-    0x885B, 0x0000, 0x7D54, 0x0000, 0xD552, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6297, 0x0000, 0x0000, 0x0000, 0x0854, 0x0000, // 0x40 - 0x4F
-    0x0000, 0x0000, 0x0E66, 0x0000, 0x0000, 0x9C62, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x004E, 0x0000, 0x0580, // 0x50 - 0x5F
-    0x0000, 0x0000, 0x857F, 0x0000, 0x0000, 0x0000, 0x9950, 0x6856, 0x0000, 0x549B, 0xD56C, 0x0000, 0x0000, 0x0000, 0x0000, 0xFA51, // 0x60 - 0x6F
-    0x0163, 0xF876, 0x4B62, 0x0000, 0xBA78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB965, 0x4C88, 0x0000, // 0x70 - 0x7F
-    0x9A5B, 0x0000, 0x0000, 0x4D52, 0x1F77, 0x0000, 0x9A89, 0x1752, 0x8C5F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xDE56, 0x0000, // 0x80 - 0x8F
-    0x9A7D, 0x7565, 0x0000, 0x0000, 0x0000, 0x0000, 0x3E5C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0882, 0x0000, 0x0000, // 0x90 - 0x9F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3E5F, 0x0000, 0x0000, 0x0000, 0x4266, 0x0000, 0x0000, 0x2662, 0x0000, // 0xA0 - 0xAF
-    0x0000, 0x0000, 0x0000, 0x0000, 0xB751, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA8C, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
-    0xCD53, 0x0000, 0xEE76, 0x0000, 0x0000, 0x9B52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7551, 0x0000, 0x0000, 0x0000, // 0xC0 - 0xCF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
-};
-
-/**
- * Third table of Japanese characters.
- */
-static const unsigned short JAPANESE_CHARS_FB[256] = {
-    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
-    0x0000, 0x0000, 0xB182, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0B4E, 0x0000, 0x6551, 0x4851, 0x0D4E, 0x505B, 0x9B4F, 0x4B5C, // 0x00 - 0x0F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8E96, 0x0000, 0x0000, 0xE890, 0x0000, 0x3458, 0x0000, 0xF24E, 0x9395, 0x0000, 0x0000, // 0x10 - 0x1F
-    0x5096, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x554F, 0x0000, 0x9965, 0x0000, 0x0A4E, 0x0000, 0x8B4E, 0x0000, 0x0000, // 0x20 - 0x2F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6559, 0x0000, 0x0000, 0x0000, 0x1D52, 0x5167, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
-    0x0000, 0x0000, 0xCA8E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xBA87, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
-    0x0000, 0x7751, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB672, 0x4B61, 0x0000, // 0x60 - 0x6F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B95, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x70 - 0x7F
-    0x0000, 0x0C54, 0x1F90, 0x4590, 0x0000, 0x0000, 0x0000, 0x0000, 0x7354, 0x0000, 0x0000, 0x0000, 0x0D50, 0x0000, 0x0000, 0x0000, // 0x80 - 0x8F
-    0x0000, 0xBA4E, 0xCA4E, 0x0000, 0x0000, 0x535F, 0x0000, 0x0000, 0xDB98, 0xE54E, 0x1659, 0x0000, 0x0000, 0x0000, 0xAB8E, 0x0000, // 0x90 - 0x9F
-    0xCB65, 0x0000, 0x0000, 0x0000, 0x5F6A, 0xB068, 0x0000, 0x8970, 0xB065, 0x214E, 0x2C67, 0x1B54, 0x0000, 0x8551, 0x5C4F, 0x668B, // 0xA0 - 0xAF
-    0x7972, 0x0000, 0x0000, 0x0000, 0x747A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB38D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7795, 0x0000, 0x0000, 0x5458, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B89, // 0xC0 - 0xCF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4351, 0x0000, 0x0000, 0x0000, 0x427D, 0x0000, 0x0000, 0x0D54, 0x0000, 0x0000, // 0xD0 - 0xDF
-    0x0000, 0x1062, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
-};
-
-/**
- * Fourth table of Japanese characters.
- */
-static const unsigned short JAPANESE_CHARS_FC[256] = {
-    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
-    0x0000, 0x0000, 0x188A, 0x0000, 0x7890, 0x6A75, 0x5788, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F
-    0x9358, 0xC35F, 0x0000, 0x0000, 0x0000, 0x0000, 0x5390, 0x0000, 0x0000, 0x0000, 0x0000, 0xFB5D, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x884E, 0x0000, 0x3D84, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x20 - 0x2F
-    0xE565, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE353, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x296E, 0x0000, 0x0000, 0x0000, 0x0000, 0x708D, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
-    0x0000, 0x0000, 0x7153, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x008A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
-    0x3159, 0x5765, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x60 - 0x6F
-    0x0000, 0x0000, 0xBC62, 0x0000, 0x0000, 0x0000, 0x5965, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x70 - 0x7F
-    0x0000, 0x0000, 0x0000, 0x0000, 0xC253, 0xE577, 0x5E80, 0x0000, 0xD54E, 0x2552, 0xC696, 0xE14F, 0x2875, 0x0000, 0x0000, 0x0000, // 0x80 - 0x8F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xE965, 0x0000, 0x0000, 0x0000, 0x0000, 0x718A, 0x305E, 0x0000, 0x0000, 0x0000, // 0x90 - 0x9F
-    0x0000, 0xF258, 0x6E6D, 0x0000, 0xA052, 0x0000, 0x047D, 0x0000, 0x3C79, 0x5F67, 0x0000, 0x3775, 0x0000, 0x0000, 0x0000, 0xCB7A, // 0xA0 - 0xAF
-    0x0000, 0xFA4F, 0x0000, 0x0000, 0x0000, 0xC179, 0x0000, 0x0000, 0x1250, 0x114F, 0x0000, 0x0000, 0x0000, 0xA952, 0x0000, 0x0000, // 0xB0 - 0xBF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xAC8A, 0x0000, 0x0000, 0xF167, 0x0000, 0x0000, // 0xC0 - 0xCF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
-};
 
-/**
- * Fifth table of Japanese characters.
- */
-static const unsigned short JAPANESE_CHARS_FD[256] = {
-    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
-    0x0000, 0x1D4F, 0x0000, 0xA263, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F
-    0xE682, 0x0000, 0xF056, 0x0000, 0x0000, 0x0000, 0x0000, 0xA25B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
-    0x0000, 0x2B59, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB88C, 0x1F67, 0x0000, 0x0000, 0x0000, 0x0000, 0xDD4F, 0x2F5E, // 0x20 - 0x2F
-    0x0000, 0x0000, 0x0000, 0x1154, 0x0000, 0x0000, 0x7289, 0x0000, 0x216B, 0x0000, 0x207D, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB78C, 0x0000, 0x0000, 0x0000, 0x7C5E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x8179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
-    0x0000, 0x975E, 0x0000, 0x0000, 0x0000, 0xCA7D, 0x1478, 0x0000, 0x0000, 0x8766, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x60 - 0x6F
-    0xC599, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x70 - 0x7F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFD88, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x80 - 0x8F
-    0x0000, 0x0000, 0x3293, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5453, 0x0000, 0x0000, // 0x90 - 0x9F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x3181, 0x0000, 0x8D8E, 0x0000, 0x0000, 0x0000, 0x0000, 0x3052, 0x0000, 0x0000, 0x0000, 0x0000, // 0xA0 - 0xAF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
-    0x9F52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5291, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xC0 - 0xCF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
-};
-
-/**
- * Sixth table of Japanese characters.
- */
-static const unsigned short JAPANESE_CHARS_FE[256] = {
-    // 0    1       2       3       4       5       6       7       8       9       A       B       C       D       E       F
-    0x0000, 0x0000, 0x0000, 0x667D, 0x0000, 0x0000, 0x0000, 0xAD65, 0x0000, 0x0000, 0xB96C, 0x0000, 0xD550, 0x585B, 0x0000, 0x0000, // 0x00 - 0x0F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x10 - 0x1F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8B4F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x20 - 0x2F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x9758, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x30 - 0x3F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x40 - 0x4F
-    0x0000, 0x0000, 0x0000, 0xB48C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4256, 0xF158, 0x0000, 0x0000, 0x0000, 0x0000, // 0x50 - 0x5F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xB54F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x60 - 0x6F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1D8B, 0x0000, 0x0000, 0x0000, 0xA14F, 0x206B, 0xC45B, 0xD95F, // 0x70 - 0x7F
-    0x0000, 0x944E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xA65E, 0x0000, 0x0000, 0x0000, 0x0000, 0x988A, // 0x80 - 0x8F
-    0x0000, 0x0000, 0x298F, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x668A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x90 - 0x9F
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7272, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xA0 - 0xAF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xC079, 0x0000, 0xFD8E, 0x0000, 0x0000, 0x0000, // 0xB0 - 0xBF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3B52, // 0xC0 - 0xCF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xD0 - 0xDF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xE0 - 0xEF
-    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0xF0 - 0xFF
-};
 
 void FieldTextWriter::Begin(std::string file_name){
     data_.clear();

+ 1 - 1
V-Gears-Installer/src/ScopedLgp.cpp

@@ -27,4 +27,4 @@ ScopedLgp::ScopedLgp(Ogre::Root* root, std::string full_path, std::string type,
 ScopedLgp::~ScopedLgp(){
      if (root_)
          Ogre::ResourceGroupManager::getSingleton().removeResourceLocation(full_path_, group_);
- }
+}

+ 11 - 1
V-Gears/include/common/File.h

@@ -146,6 +146,16 @@ class File{
          */
         u32 readU32LE();
 
+        /**
+         * Checks the current offset of the file.
+         *
+         * Default is 0. Can be set on instantiation with {@see
+         * File(const File* file, u32 offset, u32 length)} or {@see
+         * File(const u8* buffer, u32 offset, u32 length)} and advanced with
+         * {@see readU8}, {@see readU16LE} or {@see readU32LE}
+         */
+        u32 GetCurrentOffset();
+
     protected:
 
         /**
@@ -161,7 +171,7 @@ class File{
          * File(const u8* buffer, u32 offset, u32 length)} and advanced with
          * {@see readU8}, {@see readU16LE} or {@see readU32LE}
          */
-        u32 offset_;
+        u32 offset_ = 0;
 
         /**
          * The file buffer.

+ 13 - 4
V-Gears/src/common/File.cpp

@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 
+#include <iostream>
 #include <cassert>
 #include <string.h>
 #include "common/File.h"
@@ -22,7 +23,8 @@
 File::File(const Ogre::String& file):
   file_name_(file),
   buffer_(nullptr),
-  buffer_size_(0)
+  buffer_size_(0),
+  offset_(0)
 {
     LOG_TRIVIAL("Loading file: " + file_name_ + "\n");
     buffer_size_ = FileSystem::GetFileSize(file_name_);
@@ -34,24 +36,27 @@ File::File(const Ogre::String& file):
 
 File::File(const File* file, u32 offset, u32 length):
   buffer_(nullptr),
-  buffer_size_(length)
+  buffer_size_(length),
+  offset_(offset)
 {
     assert(file != nullptr);
 
     file_name_ = file->GetFileName();
 
     buffer_ = (u8 *) malloc(sizeof(u8) * buffer_size_);
-    file->GetFileBuffer(buffer_, offset, buffer_size_);
+    file->GetFileBuffer(buffer_, offset_, buffer_size_);
 }
 
 File::File(const u8* buffer, u32 offset, u32 length):
   file_name_("BUFFER"),
   buffer_(nullptr),
-  buffer_size_(length)
+  buffer_size_(length),
+  offset_(offset)
 {
     assert(buffer != nullptr);
     buffer_ = (u8*) malloc(sizeof(u8) * buffer_size_);
     memcpy(buffer_, buffer + offset, buffer_size_);
+    std::cout << "New file from buffer. Size " << length << " Offset: " << offset << "/" << offset_ << "\n";
 }
 
 File::File(const File* file){
@@ -111,3 +116,7 @@ u32 File::readU32LE(){
     offset_ += 4;
     return data;
 }
+
+u32 File::GetCurrentOffset(){
+    return offset_;
+}