<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AuroraWright</id>
	<title>3dbrew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.3dbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=AuroraWright"/>
	<link rel="alternate" type="text/html" href="https://www.3dbrew.org/wiki/Special:Contributions/AuroraWright"/>
	<updated>2026-04-16T06:52:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=21265</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=21265"/>
		<updated>2020-05-31T01:25:44Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
&lt;br /&gt;
The original emulator builds include support for all these three platforms, not specific to just the included ROM platform. However, releases intended for NES games have a red menu, optional switching between the two controllers, a different X button mapping (B instead of menu), optional [[Download Play]] support, and [http://s27.postimg.org/60v4yuw8z/IMG_20140921_001103.jpg a never used multi-rom support]; while Game Boy versions have a green theme and optional 3D border.&lt;br /&gt;
&lt;br /&gt;
Early builds (of Ambassador NES games at least) did not support savestates.&lt;br /&gt;
&lt;br /&gt;
The emulator officially used for Pokemon games removes savestate support in favor of a Link Cable &amp;quot;implementation&amp;quot; involving hooking the games&#039; network functions according to the patch files. ([https://gbatemp.net/attachments/vc-wireless-link-patch-documentation-txt.72966/ Partial documentation of the patch format])&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Emulation speed in FPS (always 0x3C in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Preset ID (varies for each game). A full list of know Preset IDs (shared by WiiU/SNESC/Switch SNES emulators) can be found [https://docs.google.com/spreadsheets/d/1PbIPVA4NpFEXs1zk249aR3FSuBTY3r-ajpTq3dP3GnQ here]&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then optionally followed by the PCM audio files, by the SDD-1 decompressed graphics data (the emulator doesn&#039;t properly emulate the chip, presumably because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no separate setting fields for individual cart features, and it appears that the emulator has &amp;quot;game presets&amp;quot; stored in its own code, which determine the game-specific settings (such as the expansion chip, and presumably the presence of SRAM), selectable via the preset ID in the header. Each official VC release has [https://docs.google.com/spreadsheets/d/1PbIPVA4NpFEXs1zk249aR3FSuBTY3r-ajpTq3dP3GnQ/edit#gid=490971147 a different preset ID]. The supported SNES expansion chips are: DSP1, C4 and DSP2.  &lt;br /&gt;
&lt;br /&gt;
A similar structure can be found on the Wii U, SNES Classic and Switch Mini emulator [https://gist.github.com/anpage/c1085055db0242ea3c7558dab56712a5]&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer and related structures are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| Must be 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to array of config descriptors&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of config descriptors &amp;lt;&amp;lt; 4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Config descriptor====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| If 1, then this config descriptor is used. If 0, and the following value is not 0, then the GBA VC load fails outright (causes result 0xC900464F). Otherwise, this config descriptor is skipped.&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset to config&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Size of config (unused by the function that parses this, which hardcodes the config size (0x324) to memcpy)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Padding&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Config====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below for supported values and [[ARM7_Registers#ARM7_SAVE_MODE|here]] for details)&lt;br /&gt;
|-&lt;br /&gt;
| 0x00E&lt;br /&gt;
| 0x2&lt;br /&gt;
| Sleep mode button combo (utilizes the same bit masks as the [[HID_Registers#HID_PAD|HID_PAD register]], with flipped bits).&amp;lt;br/&amp;gt;If the GBA title supports a button-combo based sleep mode and it&#039;s set here, Agbbg spoofs this combo when closing the 3DS&#039; lid to enter proper sleep mode.&lt;br /&gt;
|-&lt;br /&gt;
| 0x010&lt;br /&gt;
| 0x10&lt;br /&gt;
| Flash and EEPROM configuration (see the target registers [[ARM7_Registers|here]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k for &amp;lt; 256 Mbit titles&lt;br /&gt;
* 0x1: EEPROM 8k for 256 Mbit titles&lt;br /&gt;
* 0x2: EEPROM 64k for &amp;lt; 256 Mbit titles&lt;br /&gt;
* 0x3: EEPROM 64k for 256 Mbit titles&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 256k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD (also see below). The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame on SD===&lt;br /&gt;
A NAND savegame copied to the SD by process9 is identical to its counterpart on the NAND partition, save for the CMAC. For SD copies on retail units, the CMAC is recalculated as the AES-CMAC of the (SHA256 hash of (&amp;quot;CTR-SIGN&amp;quot; + AGB TitleID (little endian) + SHA256 hash of (&amp;quot;CTR-SAV0&amp;quot; + SHA256 hash of (0x30..0x200 + the entire save itself)))), using keyslot 0x30 set up with the keyY from movable.sed. For SD copies on devkit units, the CMAC is recalculated using the SHA256 hash of 0x30..0x200 + the entire save itself, using a different key from process9 .rodata.&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20336</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20336"/>
		<updated>2017-09-22T11:50:02Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: Fix SRAM size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS). The emulator build includes support for all these three platforms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Emulation speed in FPS (always 0x3C in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Game preset ID? (varies for each game). Incremental, started with 0x10XX values in old releases, newest ones have 0x11XX (with XX being back to low values).&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then optionally followed by the PCM audio files, by the SDD-1 decompressed graphics data (presumably the emulator doesn&#039;t properly emulate the chip because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no setting fields for specific cart features, and it appears that the emulator has &amp;quot;game presets&amp;quot; stored in its own code, which determine the cart expansion chip and probably more game-specific settings. Each official VC release has a different preset ID in the header.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: EEPROM 8k (?)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: EEPROM 64k (?)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 256k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20313</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20313"/>
		<updated>2017-09-15T21:58:32Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS). The emulator build includes support for all these three platforms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Emulation speed in FPS (always 0x3C in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Game preset ID? (varies for each game). Incremental, started with 0x10XX values in old releases, newest ones have 0x11XX (with XX being back to low values).&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then optionally followed by the PCM audio files, by the SDD-1 decompressed graphics data (presumably the emulator doesn&#039;t properly emulate the chip because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no setting fields for specific cart features, and it appears that the emulator has &amp;quot;game presets&amp;quot; stored in its own code, which determine the cart expansion chip and probably more game-specific settings. Each official VC release has a different preset ID in the header.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: EEPROM 8k (?)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: EEPROM 64k (?)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20311</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20311"/>
		<updated>2017-09-14T15:28:57Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS). The emulator build includes support for all these three platforms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x3C&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Game preset ID? (varies for each game). Incremental, started with 0x10XX values in old releases, newest ones have 0x11XX (with XX being back to low values).&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then optionally followed by the PCM audio files, by the SDD-1 decompressed graphics data (presumably the emulator doesn&#039;t properly emulate the chip because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no setting fields for specific cart features, and it appears that the emulator has &amp;quot;game presets&amp;quot; stored in its own code, which determine the cart expansion chip and probably more game-specific settings. Each official VC release has a different preset ID in the header.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: EEPROM 8k (?)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: EEPROM 64k (?)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20310</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20310"/>
		<updated>2017-09-14T15:19:00Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS). The emulator build includes support for all these three platforms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
The file begins with a header (all values are little-endian):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x3C&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size. 0 if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Game preset ID? (varies for each game). Incremental, started with 0x10XX values in old releases, newest ones have 0x11XX (with XX being back to low values).&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then followed by the PCM audio files, optionally by the SDD-1 decompressed graphics data (presumably the emulator doesn&#039;t properly emulate the chip because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no specific setting fields for games, and it appears that there are &amp;quot;game presets&amp;quot; stored in the emulator code, which determines the cart expansion chip and probably more game-specific settings. Each official VC release has a different preset ID in the header.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata contains:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: EEPROM 8k (?)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: EEPROM 64k (?)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20309</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20309"/>
		<updated>2017-09-14T15:15:13Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: Add SNES VC documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several types of VC titles: NES/GB/GBC VC titles, SNES VC titles, GameGear VC titles and GBA VC titles.&lt;br /&gt;
Except for GBA VC, the games are ran using emulators.&lt;br /&gt;
&lt;br /&gt;
=NES/GB/GBC VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS). The emulator build includes support for all these three platforms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=SNES VC=&lt;br /&gt;
An emulator application + VC ROM in the NCCH [[RomFS]] (among other things in the RomFS).&lt;br /&gt;
SNES VC titles are New 3DS exclusive.&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/shader/&amp;quot; This directory contains .shbin GPU shaders used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/caravel.bcsar&amp;quot; This file contains audio used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/ctrl_change.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/data.bin&amp;quot; This file contains the ROM and other data. See below for documentation.&lt;br /&gt;
* &amp;quot;rom:/ErrorMessage.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/KTR-XXXX.icn&amp;quot; Copy of the SMDH of the game.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/nnfont_RectDrawerShader.shbin&amp;quot; GPU shader.&lt;br /&gt;
* &amp;quot;rom:/VCM.arc&amp;quot; This file contains graphics used by the emulator app.&lt;br /&gt;
&lt;br /&gt;
===data.bin structure===&lt;br /&gt;
All header values are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000100&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 0x4&lt;br /&gt;
| File size&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000030&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000050&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the ROM (always 0x00000060 in official VC)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| End of the ROM&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of the footer region (presumably an index for the PCM audio samples). Matches end of file/file size if PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Start of decompressed SDD-1 graphics data region. Matches end of file/file size if no SDD-1 chip is present&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x8&lt;br /&gt;
| Product ID (KTR-XXXX), determines filenames in savedata&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x3C&lt;br /&gt;
|-&lt;br /&gt;
| 0x31&lt;br /&gt;
| 0x3&lt;br /&gt;
| ROM size&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x35&lt;br /&gt;
| 0x3&lt;br /&gt;
| Size of the converted PCM audio samples region (starting after ROM). 0 is PCM data is missing&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x39&lt;br /&gt;
| 0x2&lt;br /&gt;
| Footer region size&lt;br /&gt;
|-&lt;br /&gt;
| 0x3B&lt;br /&gt;
| 0x2&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x3D&lt;br /&gt;
| 0x2&lt;br /&gt;
| Game preset ID? (varies for each game). Incremental, started with 0x10XX values in old releases, newest ones have 0x11XX (with XX being back to low values).&lt;br /&gt;
|-&lt;br /&gt;
| 0x3F&lt;br /&gt;
| 0x1&lt;br /&gt;
| Always 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x1&lt;br /&gt;
| Sound volume&lt;br /&gt;
|-&lt;br /&gt;
| 0x41&lt;br /&gt;
| 0x1&lt;br /&gt;
| ROM type (0x15 == HiROM/0x14 == LoROM)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42&lt;br /&gt;
| 0xE&lt;br /&gt;
| Always 0&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000003&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x00000001&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The 0x60 header is followed by the SNES ROM, often altered to replace audio samples with pointers to external PCM audio files converted from the game, presumably to speed up emulation (these pointers can be found by looking for &amp;quot;PCMF&amp;quot; in the ROM, as seen on [https://github.com/Plombo/vcromclaim/blob/master/snesrestore.py Wii VC]).&lt;br /&gt;
The ROM is then followed by the PCM audio files, optionally by the SDD-1 decompressed graphics data (presumably the emulator doesn&#039;t properly emulate the chip because of hardware constraints) and by a footer which appears to be an index for the PCM audio data.&lt;br /&gt;
There are no specific setting fields for games, and it appears that there are &amp;quot;game presets&amp;quot; stored in the emulator code, which determines the cart expansion chip and probably more game-specific settings. Each official VC release has a different preset ID in the header.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;KTR-XXXX.cfg&amp;quot;: Appears to contain the &amp;quot;preset ID&amp;quot; and possibly more game/save information.&lt;br /&gt;
* &amp;quot;KTR-XXXX.vea&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;KTR-XXXX.ves&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
&lt;br /&gt;
Filenames are determined in the ROM header.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: EEPROM 8k (?)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: EEPROM 64k (?)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x4&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20308</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20308"/>
		<updated>2017-09-12T14:18:57Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_?_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_LO?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_HI?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;arm7_save_cfg_t&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_CFG&amp;lt;/code&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This is the first code that will be run after execution begins. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). This doesn&#039;t seem to start execution by itself.&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (64k EEPROM, a 512k Flash chip model, and SRAM are all that have been used officially; several other 512k Flash chip models, two 1 Mbit Flash chip models and 8k EEPROM are also supported). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC &#039;&#039;?&#039;&#039;===&lt;br /&gt;
These registers may be used to control a real-time clock. To set or read the data here, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the RTC can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_CFG===&lt;br /&gt;
This is copied from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;. It presumably configures details about storage, such as IDs, and likely allows enabling the RTC for games which need it. Format of this data is unknown, and slightly difficult to determine without some hardware poking.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash 512k/Flash 1Mbit (the 2 512k banks are contiguous in memory). &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt; must be set to 1 before reading memory here, and restored to its previous value afterwards&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20307</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20307"/>
		<updated>2017-09-12T14:17:07Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_?_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_LO?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_HI?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;arm7_save_cfg_t&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_CFG&amp;lt;/code&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This is the first code that will be run after execution begins. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). This doesn&#039;t seem to start execution by itself.&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (64k EEPROM, a 512k Flash chip model, and SRAM are all that have been used officially; several other 512k Flash chip models, two Flash 1 Mbit chips models and 8k EEPROM are also supported). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC &#039;&#039;?&#039;&#039;===&lt;br /&gt;
These registers may be used to control a real-time clock. To set or read the data here, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the RTC can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_CFG===&lt;br /&gt;
This is copied from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;. It presumably configures details about storage, such as IDs, and likely allows enabling the RTC for games which need it. Format of this data is unknown, and slightly difficult to determine without some hardware poking.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash 512k/Flash 1Mbit (the 2 512k banks are contiguous in memory). &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt; must be set to 1 before reading memory here, and restored to its previous value afterwards&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20304</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20304"/>
		<updated>2017-09-12T00:51:58Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: EEPROM 8k (?)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: EEPROM 64k (?)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE results in no save chip and nothing being saved to NAND.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20303</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20303"/>
		<updated>2017-09-11T13:43:38Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: Fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: ? (neither SRAM nor Flash, possibly nothing or some kind of EEPROM)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: ? (neither SRAM nor Flash, possibly nothing or some kind of EEPROM)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE seems to result in no save chip.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20302</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20302"/>
		<updated>2017-09-11T13:40:18Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* 0x0: EEPROM 8k&lt;br /&gt;
* 0x1: ? (neither SRAM nor Flash, possibly nothing or some kind of EEPROM)&lt;br /&gt;
* 0x2: EEPROM 64k&lt;br /&gt;
* 0x3: ? (neither SRAM nor Flash, possibly nothing or some kind of EEPROM)&lt;br /&gt;
* 0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
* 0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
* 0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
* 0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
* 0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
* 0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
* 0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
* 0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
* 0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
* 0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
* 0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE seem to result in no save chip.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20301</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20301"/>
		<updated>2017-09-11T13:38:48Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: /* Footer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
0x0: EEPROM 8k&lt;br /&gt;
0x1: ? (neither SRAM nor Flash, possibly nothing or some kind of EEPROM)&lt;br /&gt;
0x2: EEPROM 64k&lt;br /&gt;
0x3: ? (neither SRAM nor Flash, possibly nothing or some kind of EEPROM)&lt;br /&gt;
0x4: Flash 512k (Atmel, ID: 0x3D1F) + RTC&lt;br /&gt;
0x5: Flash 512k (Atmel, ID: 0x3D1F)&lt;br /&gt;
0x6: Flash 512k (SST, ID: 0xD4BF) + RTC&lt;br /&gt;
0x7: Flash 512k (SST, ID: 0xD4BF)&lt;br /&gt;
0x8: Flash 512k (Panasonic, ID: 0x1B32) + RTC&lt;br /&gt;
0x9: Flash 512k (Panasonic, ID: 0x1B32)&lt;br /&gt;
0xA: Flash 1Mbit (Macronix, ID: 0x09C2) + RTC&lt;br /&gt;
0xB: Flash 1Mbit (Macronix, ID: 0x09C2)&lt;br /&gt;
0xC: Flash 1Mbit (Sanyo, ID: 0x1362) + RTC&lt;br /&gt;
0xD: Flash 1Mbit (Sanyo, ID: 0x1362)&lt;br /&gt;
0xE: SRAM/FRAM 128k&lt;br /&gt;
&lt;br /&gt;
Everything above 0xE seem to result in no save chip.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20297</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20297"/>
		<updated>2017-09-09T01:08:59Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: Add EEPROM 8k&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* EEPROM 8k: 0x0&lt;br /&gt;
* EEPROM 64k (various sizes, IDs specified in footer?): 0x2&lt;br /&gt;
* SRAM/FRAM (128k): 0xE&lt;br /&gt;
* Flash (512k): 0x9&lt;br /&gt;
* Flash (512k) and RTC: 0x8&lt;br /&gt;
* Flash (1Mbit): 0xB (not implemented in AGB_FIRM, save persists until reboot)&lt;br /&gt;
* Flash (1Mbit) and RTC: 0xA (not implemented in AGB_FIRM, save persists until reboot)&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20294</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20294"/>
		<updated>2017-09-08T20:15:54Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: Fix save chips memory mapping (verified with memory dump)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_?_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_LO?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_HI?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;arm7_save_cfg_t&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_CFG&amp;lt;/code&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This is the first code that will be run after execution begins. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). This doesn&#039;t seem to start execution by itself.&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (EEPROM, 512k flash, and SRAM are all that have been used officially; 1 Mbit flash is supported but not implemented in AGB_FIRM). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC &#039;&#039;?&#039;&#039;===&lt;br /&gt;
These registers may be used to control a real-time clock. To set or read the data here, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the RTC can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_CFG===&lt;br /&gt;
This is copied from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;. It presumably configures details about storage, such as IDs, and likely allows enabling the RTC for games which need it. Format of this data is unknown, and slightly difficult to determine without some hardware poking.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash 512k/Flash 1Mbit (the 2 512k banks are contiguous in memory). &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt; must be set to 1 before reading memory here, and restored to its previous value afterwards&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20293</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20293"/>
		<updated>2017-09-08T18:01:42Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_?_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_LO?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_HI?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;arm7_save_cfg_t&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_CFG&amp;lt;/code&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This is the first code that will be run after execution begins. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). This doesn&#039;t seem to start execution by itself.&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (EEPROM, 512k flash, and SRAM are all that have been used officially; 1 Mbit flash is supported but not implemented in AGB_FIRM). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC &#039;&#039;?&#039;&#039;===&lt;br /&gt;
These registers may be used to control a real-time clock. To set or read the data here, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the RTC can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_CFG===&lt;br /&gt;
This is copied from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;. It presumably configures details about storage, such as IDs, and likely allows enabling the RTC for games which need it. Format of this data is unknown, and slightly difficult to determine without some hardware poking.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; → Flash 1Mbit (the 2 512k banks are contiguous in memory)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080C0000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash 512k (&amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt; must be set to 1 before reading memory here, and restored to its previous value afterwards)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20292</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20292"/>
		<updated>2017-09-08T17:59:52Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: 1Mbit save location information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_?_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_LO?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_HI?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;arm7_save_cfg_t&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_CFG&amp;lt;/code&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This is the first code that will be run after execution begins. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). This doesn&#039;t seem to start execution by itself.&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (EEPROM, 512k flash, and SRAM are all that have been used officially; 1 Mbit flash is supported but not implemented in AGB_FIRM). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC &#039;&#039;?&#039;&#039;===&lt;br /&gt;
These registers may be used to control a real-time clock. To set or read the data here, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the RTC can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_CFG===&lt;br /&gt;
This is copied from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;. It presumably configures details about storage, such as IDs, and likely allows enabling the RTC for games which need it. Format of this data is unknown, and slightly difficult to determine without some hardware poking.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080C0000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash (&amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt; must be set to 1 before reading memory here, and restored to its previous value afterwards)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08080000&amp;lt;/code&amp;gt; → Flash 1Mbit (the 2 512k banks are contiguous in memory)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20287</id>
		<title>ARM7 Registers</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=ARM7_Registers&amp;diff=20287"/>
		<updated>2017-09-04T16:33:10Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The 3DS utilizes an onboard ARM7 core to handle &amp;lt;code&amp;gt;TWL_FIRM&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt;&#039;s ARM7 requirements. This is due to the fact that much of the hardware used by both ARM7 and ARM9 is (evidently) not physically hooked up to ARM11. Thus, ARM11 cannot simply emulate ARM7.&lt;br /&gt;
&lt;br /&gt;
ARM7 has the GBA BIOS implemented in hardware. The BIOS is completely identical to the original GBA BIOS. The system is booted silently by calling &amp;lt;code&amp;gt;SWI 0x1&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;RegisterRamReset&amp;lt;/code&amp;gt;), followed by jumping to the code that does &amp;lt;code&amp;gt;SWI 0x0&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;SoftReset&amp;lt;/code&amp;gt;) to finish booting. The boot splash is still in BIOS, however, and can be seen by calling or replacing one of the previous interrupts with &amp;lt;code&amp;gt;SWI 0x26&amp;lt;/code&amp;gt; (a.k.a. &amp;lt;code&amp;gt;HardReset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Registers==&lt;br /&gt;
ARM9 interfaces with the ARM7 through the following registers:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type&lt;br /&gt;
! Address&lt;br /&gt;
! Name&lt;br /&gt;
! Size (bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u8&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018000&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 1 &lt;br /&gt;
|-&lt;br /&gt;
| Code&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018080&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_CODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018100&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_MODE&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_?_CNT&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u16&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018108&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_CNT?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018110&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018114&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018118&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_LO?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;u32&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x1001811C&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_RTC_HI?&amp;lt;/code&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;arm7_save_cfg_t&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;0x10018120&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;ARM7_SAVE_CFG&amp;lt;/code&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===ARM7_CNT===&lt;br /&gt;
This seems to control the mode of the ARM7. 1 = TWL, 2 = GBA.&lt;br /&gt;
&lt;br /&gt;
===ARM7_CODE===&lt;br /&gt;
This is the first code that will be run after execution begins. &amp;lt;code&amp;gt;TwlProcess9&amp;lt;/code&amp;gt; uses this to put ARM7 in a loop (TWL), and to set the &amp;lt;code&amp;gt;POSTFLG&amp;lt;/code&amp;gt; and branch to more copied code (GBA). This doesn&#039;t seem to start execution by itself.&lt;br /&gt;
&lt;br /&gt;
Reading uninitialized data in this 32-byte region leads to both screens displaying solid green (exception), and the CPU locking up.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_MODE===&lt;br /&gt;
This tells the save storage emulation hardware which device type to emulate (EEPROM, 512k flash, and SRAM are all that have been used officially; 1 Mbit flash is supported but not implemented in AGB_FIRM). This comes directly from the [[3DS_Virtual_Console#Footer|ROM footer]].&lt;br /&gt;
&lt;br /&gt;
===ARM7_RTC &#039;&#039;?&#039;&#039;===&lt;br /&gt;
These registers may be used to control a real-time clock. To set or read the data here, first &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;&#039;s bit 15 is waited on. Next &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; is set to zero. &lt;br /&gt;
&lt;br /&gt;
For a write: the two registers are written, a 1 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, and it is waited on the same as before. Afterwards if bit 14 is not set in &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, the value was set successfully.&lt;br /&gt;
&lt;br /&gt;
For a read: a 2 is written to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt;, it&#039;s waited on again. Afterwards, if bit 14 is not set, the RTC can be read. Presumably the hardware can be re-enabled by writing a zero to &amp;lt;code&amp;gt;ARM7_RTC_CNT&amp;lt;/code&amp;gt; at this point, but &amp;lt;code&amp;gt;AGB_FIRM&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
&lt;br /&gt;
===ARM7_SAVE_CFG===&lt;br /&gt;
This is copied from rom footer + &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;. It presumably configures details about storage, such as IDs, and likely allows enabling the RTC for games which need it. Format of this data is unknown, and slightly difficult to determine without some hardware poking.&lt;br /&gt;
&lt;br /&gt;
==Memory map==&lt;br /&gt;
The virtual memory mapping for the ARM7 is the same as for the [[Memory_layout#TWL_FIRM_Userland_Memory|other core]]. However, it has additional internal memory mapped to it. Interestingly enough, much of this memory seems to lie within ARM9&#039;s own internal memory.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;0x08060000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03800000&amp;lt;/code&amp;gt;, ARM7 WRAM (64KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080B0000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x03000000&amp;lt;/code&amp;gt;, GBA IWRAM (32KiB)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x080C0000&amp;lt;/code&amp;gt; → EEPROM/SRAM/Flash (&amp;lt;code&amp;gt;0x10018104&amp;lt;/code&amp;gt; must be set to 1 before reading memory here, and restored to its previous value afterwards)&lt;br /&gt;
* &amp;lt;code&amp;gt;0x01FFC000&amp;lt;/code&amp;gt; → &amp;lt;code&amp;gt;0x01000000&amp;lt;/code&amp;gt;, ARM9 ITCM under TWL (16KiB)&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20286</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20286"/>
		<updated>2017-09-04T16:02:36Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* EEPROM (various sizes, IDs specified in footer): 0x2&lt;br /&gt;
* SRAM/FRAM (128k): 0xE&lt;br /&gt;
* Flash (512k): 0x9&lt;br /&gt;
* Flash (512k) and RTC: 0x8&lt;br /&gt;
* Flash (1Mbit) : 0xB (not implemented in AGB_FIRM, save persists until reboot)&lt;br /&gt;
* Flash (1Mbit) and RTC : 0xA (not implemented in AGB_FIRM, save persists until reboot)&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20285</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20285"/>
		<updated>2017-09-04T16:02:19Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* EEPROM (various sizes, IDs specified in footer): 0x2&lt;br /&gt;
* SRAM/FRAM (128k): 0xE&lt;br /&gt;
* Flash (512k): 0x9&lt;br /&gt;
* Flash (512k) and RTC: 0x8&lt;br /&gt;
* Flash (1Mbit) : 0xB (not implemented in AGB_FIRM, save persists until reboot)&lt;br /&gt;
* Flash (1Mbit) : 0xA (not implemented in AGB_FIRM, save persists until reboot)&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20281</id>
		<title>3DS Virtual Console</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=3DS_Virtual_Console&amp;diff=20281"/>
		<updated>2017-09-03T21:52:18Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There&#039;s two types of VC titles: regular VC titles, and dedicated GBA VC titles.&lt;br /&gt;
&lt;br /&gt;
=Regular VC=&lt;br /&gt;
Regular VC titles: an emulator application + VC ROM in the NCCH [[RomFS]](among other things in the RomFS). The emulator build includes support for all supported VC platfms, not specific to just the included ROM platform.&lt;br /&gt;
&lt;br /&gt;
This emulator includes GBA support, however the GBA emulation for this this is somewhat slow. This was presumably implemented before AGB_FIRM was.&lt;br /&gt;
&lt;br /&gt;
Unlike Wii VC, the 3DS VC ROMs for NES use [http://pastebin.com/KLeWt2W3 the &amp;quot;TNES&amp;quot; header].&lt;br /&gt;
&lt;br /&gt;
==RomFS==&lt;br /&gt;
* &amp;quot;rom:/rom/&amp;quot; This directory contains the ROM file(s). Filenames used under here don&#039;t matter: the filename is determined by the emulator app by doing a directory read.&lt;br /&gt;
* &amp;quot;rom:/shaders/&amp;quot; This directory contains GPU shaders used by the emulator app: .shbin, .csdr, and .obj.&lt;br /&gt;
* &amp;quot;rom:/VCM/&amp;quot; This directory contains graphics, audio, and text used by the emulator app.&lt;br /&gt;
* &amp;quot;rom:/agb.bin&amp;quot; GBA BIOS.&lt;br /&gt;
* &amp;quot;rom:/buildtime.txt&amp;quot; Emulator app build timestamp.&lt;br /&gt;
* &amp;quot;rom:/config.ini&amp;quot; Emulator configuration .ini, contains sections for all supported 3DS VC platforms.&lt;br /&gt;
* &amp;quot;rom:/&amp;lt;rom_name&amp;gt;.patch&amp;quot; rom_name = filename from the rom directory. This .ini contains patches for the ROM.&lt;br /&gt;
* &amp;quot;rom:/shader.shbin&amp;quot; GPU shader.&lt;br /&gt;
&lt;br /&gt;
==Savedata==&lt;br /&gt;
The savedata can contain:&lt;br /&gt;
* &amp;quot;rsm1.dat&amp;quot;: Same format as the below rsm2.dat. Probably used for the &amp;quot;restore-point&amp;quot;.&lt;br /&gt;
* &amp;quot;rsm2.dat&amp;quot;: Current emulator save-state, for storing/loading state at VC-title launch/exit.&lt;br /&gt;
* &amp;quot;sav.dat&amp;quot;: The actual savedata used by the emulated ROM.&lt;br /&gt;
* &amp;quot;SecureValue&amp;quot;: The random number used by [[Anti Savegame Restore]]. No known version of the emulator implements both savestates and secure value.&lt;br /&gt;
Overwriting sav.dat with 0xFF-bytes doesn&#039;t have any affect on the actual emulator. Doing that with most of the rsm*.dat data doesn&#039;t crash anything.&lt;br /&gt;
&lt;br /&gt;
=GBA VC=&lt;br /&gt;
GBA VC is run by [[FIRM|AGB_FIRM]]. RomFS isn&#039;t used for GBA VC titles, but can be found empty within GBA VC titles. The NCCH [[ExeFS]] contains the same files as a normal application. The [[ExeFS]]:/.code contains the GBA VC ROM followed by a 0x360 byte long footer.&lt;br /&gt;
&lt;br /&gt;
===Footer===&lt;br /&gt;
All values in the GBA VC footer are little-endian.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x004&lt;br /&gt;
|  0x4&lt;br /&gt;
|  GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x008&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save type (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x020&lt;br /&gt;
| 0x4&lt;br /&gt;
| LCD ghosting (01-FF, lower values equal more ghosting)&lt;br /&gt;
|-&lt;br /&gt;
| 0x024&lt;br /&gt;
| 0x300&lt;br /&gt;
| Video LUT (black to full, rgbrgbrgb...)?,&amp;lt;br/&amp;gt;three different types of this data have been observed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x338&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x344&lt;br /&gt;
| 0x4&lt;br /&gt;
| GBA ROM Filesize&lt;br /&gt;
|-&lt;br /&gt;
| 0x350&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &#039;.CAA&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x35A&lt;br /&gt;
| 0x2&lt;br /&gt;
| High two bytes of GBA ROM file size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Save types:&lt;br /&gt;
* EEPROM (various sizes, IDs specified in footer): 0x2&lt;br /&gt;
* SRAM/FRAM (128k): 0xE&lt;br /&gt;
* Flash (512k): 0x9&lt;br /&gt;
* Flash (512k) and RTC: 0x8&lt;br /&gt;
&lt;br /&gt;
Support for 1m-flash chips is not implemented in AGB_FIRM.&lt;br /&gt;
&lt;br /&gt;
===NAND Savegame===&lt;br /&gt;
AGB_FIRM saves its active save memory to NAND on exit, this is then immediately picked up by NATIVE_FIRM on reboot by checking [[CONFIG_Registers#CFG_BOOTENV|CFG_BOOTENV]]. From there, this is verified and copied out to SD. The savegame format is as follows:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  START&lt;br /&gt;
!  SIZE&lt;br /&gt;
!  DESCRIPTION&lt;br /&gt;
|-&lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x4&lt;br /&gt;
|  Magic (&#039;.SAV&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xC&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| AES-CMAC of the SHA256 hash of 0x30..0x200 + the entire save itself, keyslot 0x24, keyY from process9 .rodata&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x10&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x40&lt;br /&gt;
| Always 0x1&lt;br /&gt;
|-&lt;br /&gt;
| 0x34&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of times saved (unused?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| AGB TitleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x10&lt;br /&gt;
| SD card CID from the console the save was made on (verified on load)&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save start addr (always 0x200)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 0x4&lt;br /&gt;
| Save size&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 0x8&lt;br /&gt;
| Always 0xFF (?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x64&lt;br /&gt;
| 0x4&lt;br /&gt;
| See [[ARM7_Registers|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 0x198&lt;br /&gt;
| Always 0xFF&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
	<entry>
		<id>https://www.3dbrew.org/w/index.php?title=Flash_Filesystem&amp;diff=18644</id>
		<title>Flash Filesystem</title>
		<link rel="alternate" type="text/html" href="https://www.3dbrew.org/w/index.php?title=Flash_Filesystem&amp;diff=18644"/>
		<updated>2016-11-24T17:15:51Z</updated>

		<summary type="html">&lt;p&gt;AuroraWright: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Nintendo 3DS has a 1GB NAND Flash chip. Due to the NCSD header, the actual used size of the Old3DS NAND is 0x3AF00000-bytes(943MiB). On New3DS, the actual NAND size and the total size used by the partitions, is 0x4D800000-bytes(1240MiB).&lt;br /&gt;
&lt;br /&gt;
===Format===&lt;br /&gt;
Reading of the flash chip is possible through pinouts on the motherboard and has been performed successfully but the data is encrypted and can&#039;t be understood without first decrypting it.&lt;br /&gt;
&lt;br /&gt;
===Region Changing===&lt;br /&gt;
See [https://gist.github.com/yellows8/f15be7a51c38cea14f2c here].&lt;br /&gt;
&lt;br /&gt;
===Redirection to SD card===&lt;br /&gt;
See [[NAND_Redirection]].&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&lt;br /&gt;
The NAND file system is encrypted using [[AES|AES-CTR]]. The TWL regions of NAND use the TWL NAND [[AES|keyslot]], while the CTR regions use the CTR NAND [[AES|keyslots]]. The keyslot used for each partition is determined by the NCSD partition FS type and encryption type. The TWL/CTR NAND regions are specified by the NCSD header. The first 0x0B100000 bytes of NAND is encrypted with the TWL keyslot, however before 0x00012E00 only the MBR partition table is encrypted with the TWL keyslot. That region contains the TWL partitions listed below.&lt;br /&gt;
&lt;br /&gt;
The New3DS CTRNAND partition uses a [[AES|keyslot]] separate from the Old3DS one.&lt;br /&gt;
&lt;br /&gt;
Note that re-encrypting a NAND image alone from another 3DS for use on a different 3DS is not enough to use that NAND image on a different 3DS: certain files in the &amp;quot;nand&amp;quot; partition would need modified/replaced as well.&lt;br /&gt;
&lt;br /&gt;
===NAND structure===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Old3DS&lt;br /&gt;
!  New3DS&lt;br /&gt;
!  Partition name&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  NCSD partition FS type&lt;br /&gt;
!  NCSD partition encryption type&lt;br /&gt;
!  NCSD partition index&lt;br /&gt;
!  [[AES_Registers|AES]] engine keyslot&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x0&lt;br /&gt;
|  0x200&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|  [[NCSD]] header, this contains the offsets/sizes of the below CTR-NAND partitions. This block also contains the TWL-NAND MBR partition table.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x00000000&lt;br /&gt;
|  0x0B100000&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x00&lt;br /&gt;
|  0x03&lt;br /&gt;
|  TWL NAND region&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
| &lt;br /&gt;
| 0x00012C00&lt;br /&gt;
| 0x200&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
| See below.&lt;br /&gt;
| Console-unique encrypted New3DS key-storage, see below.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  twln&lt;br /&gt;
|  0x00012E00&lt;br /&gt;
|  0x08FB5200&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
| &lt;br /&gt;
|  0x03&lt;br /&gt;
|  TWL-NAND FAT16 File System. (DSi)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  twlp&lt;br /&gt;
|  0x09011A00&lt;br /&gt;
|  0x020B6600&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
| &lt;br /&gt;
|  0x03&lt;br /&gt;
|  TWL-NAND PHOTO FAT12 File System. (DSi)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x0B100000&lt;br /&gt;
|  0x00030000&lt;br /&gt;
|  0x04&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x07&lt;br /&gt;
|  By default this partition is empty(only contains 0x00/0xFF bytes since it was never written to), when AGB_FIRM was never launched. This contains the AGB_FIRM GBA savegame.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  firm0&lt;br /&gt;
|  0x0B130000&lt;br /&gt;
|  0x00400000&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x06&lt;br /&gt;
|  [[FIRM|Firmware]] partition.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  firm1&lt;br /&gt;
|  0x0B530000&lt;br /&gt;
|  0x00400000&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x06&lt;br /&gt;
|  [[FIRM|Firmware]] partition.(Backup partition, same as above)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  &lt;br /&gt;
|  0x0B930000&lt;br /&gt;
|  0x2F5D0000&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x02&lt;br /&gt;
|  0x04&lt;br /&gt;
|  0x04&lt;br /&gt;
|  CTR-NAND partition. (3DS)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  nand&lt;br /&gt;
|  0x0B95CA00&lt;br /&gt;
|  0x2F3E3600&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  0x04&lt;br /&gt;
|  CTR-NAND FAT16 File System.&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  &lt;br /&gt;
|  0x0B930000&lt;br /&gt;
|  0x41ED0000&lt;br /&gt;
|  0x01&lt;br /&gt;
|  0x03&lt;br /&gt;
|  0x04&lt;br /&gt;
|  0x05&lt;br /&gt;
|  CTR-NAND partition. (New3DS)&lt;br /&gt;
|-&lt;br /&gt;
|  style=&amp;quot;background: red&amp;quot; | No&lt;br /&gt;
|  style=&amp;quot;background: green&amp;quot; | Yes&lt;br /&gt;
|  nand&lt;br /&gt;
|  0x0B95AE00&lt;br /&gt;
|  0x41D2D200&lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  &lt;br /&gt;
|  0x05&lt;br /&gt;
|  CTR-NAND FAT16 File System. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
3DS TWL NAND FAT partitions has FAT volume name &amp;quot;TWL&amp;quot;, for CTR FAT partitions this is &amp;quot;CTR&amp;quot;. The offset/size for TWL partitions are stored in the MBR partition table, while the CTR partition table info is stored in the NAND NCSD header. Sector0 in the CTR-NAND partition contains a MBR partition table for the nand FAT16 filesystem, and the MBR signature at +0x1fe.&lt;br /&gt;
&lt;br /&gt;
NAND sectors which were never written to before only contain plaintext 0x00 or 0xFF bytes.&lt;br /&gt;
&lt;br /&gt;
None of the NAND partitions are normally accessible from the ARM11, except for twlp. CTR/TWL NAND FS can only be accessed when the exheader access control descriptor for those are enabled. Normally the CTR/TWL NAND descriptors are never enabled for retail ARM11 [[NCCH#CXI|CXI]] processes. The ARM11 can only access &amp;quot;nand:/rw/&amp;quot; mounted as the nandrw [[FS:OpenArchive|archive]], and &amp;quot;nand:/ro/&amp;quot; mounted as the nandro archive below.&lt;br /&gt;
&lt;br /&gt;
==== 0x4000 ====&lt;br /&gt;
On some 3DS systems(such as 3DS XL), there&#039;s a plaintext FAT16 boot record located at NAND offset 0x4000. This block does not exist for launch-day 3DS systems. This is the only plaintext block for this &amp;quot;partition&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== 0x12C00 ====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Offset&lt;br /&gt;
!  Size&lt;br /&gt;
!  Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x10&lt;br /&gt;
| Normal-key for keyslot 0x11, used for generating the rest of the New3DS keyslots&#039; keyX by decrypting various data with AES-ECB. With [[9.6.0-24|9.6.0-X]] this is only used for generating the keyX for keyslots 0x15 and 0x18.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x10&lt;br /&gt;
| [[9.6.0-24|9.6.0-X]]: Additional normal-key for keyslot 0x11, used for generating the keyX for keyslots 0x16 and 0x19..0x1F.&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x1E0&lt;br /&gt;
| Not yet used as of New3DS FIRM [[9.6.0-24|9.6.0-X]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This 0x200-byte sector contains New3DS keys, this entire sector is encrypted with a console-unique keyX+keyY. The keyX+keyY for this is generated by the New3DS [[FIRM|arm9bin-loader]]. Once the arm9bin-loader finishes decrypting this data, the keyX+keyY in the keyslot are then cleared, then the memory used for generating the keydata is disabled(after it finishes using it for TWL key init).&lt;br /&gt;
&lt;br /&gt;
This entire sector is encrypted with AES-ECB, the entire plaintext sector is identical for all retail and dev New3DS systems (differing between the two).&lt;br /&gt;
&lt;br /&gt;
=CTR partition=&lt;br /&gt;
The structure of [[nand/title]] appears to be exactly the same as [[SD Filesystem|SD]], except savegames are stored under the [[System SaveData|nand/data/&amp;lt;ID0&amp;gt;/sysdata]] directory instead.&lt;br /&gt;
The sub-directory name under [[nand/data]] is the SHA256 hash over the [[nand/private/movable.sed|movable.sed]] keyY. This nand/data/&amp;lt;ID0&amp;gt; directory is the NAND equivalent of the &amp;quot;sdmc/Nintendo 3DS/&amp;lt;ID0&amp;gt;/&amp;lt;ID1&amp;gt;&amp;quot; directory, however the data contained here is stored in cleartext. The movable.sed keyY is only used for AES MACs for nand/data/&amp;lt;ID0&amp;gt;. The nand/data/&amp;lt;ID0&amp;gt;/extdata directory contains the shared [[extdata]], and is structured exactly the same way as SD extdata.&lt;br /&gt;
&lt;br /&gt;
 nand&lt;br /&gt;
 ├── __journal.nn_&lt;br /&gt;
 ├── [[nand/data|data]]&lt;br /&gt;
 │   └── &amp;lt;ID0&amp;gt;&lt;br /&gt;
 │       ├── [[Extdata|extdata]]          &lt;br /&gt;
 │       └── [[System SaveData|sysdata]]&lt;br /&gt;
 ├── [[Title Database|dbs]]&lt;br /&gt;
 ├── [[nand/fixdata|fixdata]]&lt;br /&gt;
 │   └── [[nand/fixdata/sysdata|sysdata]]&lt;br /&gt;
 ├── private&lt;br /&gt;
 │   └── [[nand/private/movable.sed|movable.sed]]&lt;br /&gt;
 ├── [[nand/ro|ro]]&lt;br /&gt;
 ├── [[nand/rw|rw]]&lt;br /&gt;
 ├── [[nand/ticket|ticket]] (This directory is empty since tickets are stored in [[Title Database|ticket.db]])&lt;br /&gt;
 ├── [[Title Data Structure|title]]&lt;br /&gt;
 └── [[nand/tmp|tmp]] (This is usually empty, even when installation for a system update still needs [[AMNet:FinishInstallToMedia|finalized]])&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;ro&amp;quot; and &amp;quot;rw&amp;quot; directories are accessible through the &amp;quot;nandrw&amp;quot; and &amp;quot;nandro&amp;quot; [[FS:OpenArchive|archives]], respectively. Their contents are as follows:&lt;br /&gt;
&lt;br /&gt;
 ro&lt;br /&gt;
 ├── [[nandro/private|private]]&lt;br /&gt;
 ├── [[nandro/shared|shared]]&lt;br /&gt;
 └── [[nandro/sys|sys]]&lt;br /&gt;
     ├── [[nandro/sys/HWCAL0.dat|HWCAL0.dat]]&lt;br /&gt;
     └── [[nandro/sys/HWCAL1.dat|HWCAL1.dat]]&lt;br /&gt;
 rw&lt;br /&gt;
 ├── [[nandrw/shared|shared]]&lt;br /&gt;
 └── [[nandrw/sys|sys]]&lt;br /&gt;
     ├── [[nandrw/sys/lgy.log|lgy.log]] (This is written to by [[FIRM|TWL_FIRM]] when errors occur, this is equivalent to native.log)&lt;br /&gt;
     ├── [[nandrw/sys/LocalFriendCodeSeed_B|LocalFriendCodeSeed_B]]&lt;br /&gt;
     ├── [[nandrw/sys/native.log|native.log]] (This is written to by [[ErrDisp]])&lt;br /&gt;
     ├── [[nandrw/sys/rand_seed|rand_seed]]&lt;br /&gt;
     ├── [[nandrw/sys/SecureInfo_A|SecureInfo_A]]&lt;br /&gt;
     └── [[nandrw/sys/updater.log|updater.log]]&lt;br /&gt;
&lt;br /&gt;
=TWL partition=&lt;br /&gt;
The structure of these TWL partitions is mostly the same as DSi, except tickets are stored in the CTR FAT FS. The twlp partition is exactly the same as DSi.&lt;br /&gt;
The structure of [[twln/title]] is exactly the same as CTR NAND/SD, except the .cmd file is a cleartext file.(This is likely a dummy file) The data directory under system titles&#039; /title directory does not exist, this likely only exists for DSiWare.&lt;br /&gt;
The directory names titleID-High used under [[twln/title]] is from DSi.&lt;br /&gt;
&lt;br /&gt;
 twln&lt;br /&gt;
 ├── [[twln/import/|import]]&lt;br /&gt;
 ├── [[twln/shared1/|shared1]]&lt;br /&gt;
 ├── [[twln/shared2/|shared2]]&lt;br /&gt;
 │   └── [[twln/shared2/0000|0000]]&lt;br /&gt;
 ├── [[twln/sys|sys]]&lt;br /&gt;
 │   ├── [[twln/sys/TWLFontTable.dat|TWLFontTable.dat]]&lt;br /&gt;
 │   └── [[twln/sys/log/|log]]&lt;br /&gt;
 │       ├── [[twln/sys/log/inspect.log|inspect.log]]&lt;br /&gt;
 │       └── [[twln/sys/log/product.log|product.log]]&lt;br /&gt;
 ├── [[twln/ticket/|ticket]]&lt;br /&gt;
 ├── [[twln/title/|title]]&lt;br /&gt;
 └── [[twln/tmp/|tmp]]&lt;br /&gt;
&lt;br /&gt;
 twlp&lt;br /&gt;
 └── [[twlp/photo/|photo]]&lt;/div&gt;</summary>
		<author><name>AuroraWright</name></author>
	</entry>
</feed>