When Tomodachi Life: Living the Dream was announced, I started playing the original Tomodachi Life for the 3DS.
![]() |
|---|
And you know, it's surprisingly easy to mod your 3DS. It's also surprisingly easy to mod 3DS games. Lots of read only data is stored in a game's ROMFS - a file system that contains compressed assets that you can access pretty easily with a few specially made tools. My go to was the Kuriimu suite for texture replacement, and MSBT Editor for text editing. Together, it really doesn't take a top dog to make asset replacement mods, especially with all the guides online.
I took a particular interest in messing around with MSBT files - on the surface, they're just massive dictionaries for text that appears in dialogue and UI. However, MSBT files are also capable of storing attribute blocks alongside text entries. Most games use this as limited metadata for dialogue and et cetera, but it turns out Tomodachi Life stores a good chunk of variables that alter game behaviour in these easily patchable MSBT files. You'll see what I mean in a second.
This is a snippet of what the MSBT file for clothing names looks like under MSBT Editor:1
# messages/Clothes/ArcBase/Body_Name.msbt
---
label: bd_suits
attribute: 0x010001010101A8160000030001000101010C0D070346505A640000000000000000010000000000000000010058514333540F2F5B0000000000000000808800008288000001FFFF
---
suit
---
label: bd_sailor
attribute: 0x020001010000881300000100020001010003020C0D3232323200000000000100000100010000000000010000300A212A37454B5A0002000000000000848800008688000001FFFF
---
schoolgirl uniform
---
label: bd_cowboy
attribute: 0x03000101010168100000040001000101000607040B323232320000000000000000000100000100000000000012253341464B545B0000000000000000888800008A88000001FFFF
---
cowboy duds
In MSBT Editor, attribute blocks appear as huge chunks of hex data... not very useful :4 However,
each subfolder like Clothes comes with an attribute definition file like Clothes.msbp.
# messages/Clothes/Clothes.msbp
Attribute Definitions (ATI1/ALB1/ALI1)
======================================
FileID [Int16][0]
RegionJP [Enum][2] {Disable,Enable}
RegionUS [Enum][3] {Disable,Enable}
RegionEU [Enum][4] {Disable,Enable}
RegionKR [Enum][5] {Disable,Enable}
Price [UInt32][6]
Type [Enum][10] {Type_Male,Type_Female,Type_Unisex,Type_Uniform,Type_Special}
...
Armed with this information, I threw together a quick C program that turns this soup of little endian values into a nice, readable, labelled TOML file.
# Body_Name.toml
[bd_suits]
FileID = 1
RegionJP = 1
RegionUS = 1
RegionEU = 1
RegionKR = 1
Price = 5800
Type = 3
... (and more!)
You can already see some useful information: the suit has file ID 1 (used in the texture filenames), is available in every region, and costs $58.00! There's actually a lot of data in these attributes. Here's some stuff I was able to find in other MSBT files:
- Price of basically everything in the game
- Attributes of certain items - like whether a shirt is "cozy", or a dish is "spicy"
- Hunger filling level and eating sound of food2
- Speed and length of lines of a song
- Rate and timing of the activities Miis do in their apartments3
Basically, the modding pawssibilities are endless! You have much more control over custom items even if you're limited to LayeredFS asset replacements.
An additonal cool thing I found that I couldn't leave in the footnotes is that the
Song.msbpattributes, combined with the fact that the pitch and length of notes are actually defined in the MSBT files (see below the first line of the Ballad song), means you can essentially make any custom song you want!
# message/Song/ArcBase/Ballad.msbt
---
label: NewText_00
attribute: 0x900332000000A2000403020201000000000000000000000100010000000000000000000000000000A4030000A8030000AC030000B0030000B4030000B80300003000
---
{{LenAdjust_First val="2"}}
{{LenAdjust_Second val="2"}}
{{LenAdjust_SecondLast val="1"}}
{{LenAdjust_Last val="5"}}
{{Song_WordStretch mode="Whole_Word"}}
{{Pitch_Mod_Rate val="77"}}
{{SongNote buffer="0" pitch="C4" length="2"}}
{{SongNote buffer="1" pitch="C4" length="2"}}
{{SongNote buffer="2" pitch="C4" length="2"}}
{{SongNote buffer="3" pitch="C4" length="2"}}
{{SongNote buffer="5" pitch="C4" length="1"}}
{{SongNote buffer="6" pitch="A#3" length="1"}}
{{Pitch_Mod_Width val="8"}}
{{SongNote buffer="7" pitch="D#4" length="5"}}
I am yet to find, unfortunately, the MIDI data of the backing tracks that play during the songs - it looks like they're not stored with the rest of the music in the game.
But that's not all!!....
If you check out the GameBanana page for Tomodachi Life, almost every single mod uses LayeredFS to replace some text file or image or 3D model. But there's two mods out there that aren't like the others, one of which I'm specifically interested in.
![]() |
|---|
| The Gay Mod |
The Gay Mod is probably, like, the biggest mod out there for Tomodachi Life. Everyone's
heard of it. Everyone uses it. It makes every Mii in the game bisexual, and un-gender locks
every single relationship related feature, from the Compatibilty Tester to houses and
makin' babies. And so you go to press download, because you love gay people, and when you extract the
mod you notice - hang on, it's just one file?? code.ips?? What?
what is an IPS file?
You see, somewhere within that ROM of the game exists a chunk of code labelled code.bin.
I'll give you three guesses as to its contents. The code.bin contains the compiled machine code
of the game's logic; it's the part that gets executed when you press Tomodachi Life on your beautiful
modded 3DS home screen.
An IPS file (some guess it stands for Internal Patching System) is just a way to slap your
own bytes on top of the code.bin to patch it into your own modded version of the ROM.
It's not a crazy file format - the entire specification
is here. It's a simple, bare bones way to patch any binary ever. And it's how code mods for
3DS games work!
And so, this marks the second round of throwing together a shitty C program to assist me in barking up probably the wrong tree. Using my little IPS viewing tool, we can now take a peek at what the Gay Mod is actually doing.
# code.ips
PATCH
offset: 0x232A34
length: 0x18
5C 11 99 E5 39 16 D1 E5 81 10 85 E0 07 1C 81 E2 FE 20 D1 E1 01 00 72 E3
offset: 0x23D260
length: 0x4
00 F0 20 E3
offset: 0x23D3DC
length: 0x4
00 F0 20 E3
offset: 0x2686FC
length: 0x4
00 F0 20 E3
offset: 0x26875C
length: 0x4
... (and MUCH more)
All code.ips files start with a magic PATCH signature,
followed by a sequence of patch hunks (proper terminology).
Each hunk consists of a 3 byte offset,4, 2 byte length and a slurry
of machine code.
What is this machine code? Good question. The main 3DS processor is part of the ARM11 family, with the ARMv6 instruction set.[citation needed] This is actually entirely backwards compatible with ARM32, so, using your favourite disassembler, we can actually sniff at what the Gay Mod is doing.
Being careful to align the hunks to the 4 byte grid of instructions (no, this didn't take me a whole day to figure out), we can now start to see some pretty nifty assembly code.
# code.bin
PATCH
offset: 0x232A34
length: 0x18
ldr r1, [r9, #0x15c]
ldrb r1, [r1, #0x639]
add r1, r5, r1, lsl #1
add r1, r1, #0x700
ldrsh r2, [r1, #0xe]
cmn r2, #1
offset: 0x23D260
length: 0x4
nop
offset: 0x23D3DC
length: 0x4
nop
... (and much, much more)
What does it do? Great question!
decomping the Gay Mod
I figured there was no way I was getting something useful from the code.ips
without comparing it to what was there in the first place.
(I was right. Without the context of the code around it, no dog stands a chance
at deciphering assembly. Not even Ghidra.)
...And I know I was smug about it before, but it turns out finding and cracking open that code.bin
file is a little harder than it sounds. To put a long, long story of trial and error short:
- Dump the CIA5 of your very, very legal Tomodachi Life ROM from the cartridge which you own. Legally.
- Use CTRTool to extract the NCCH data in the cartridge.
- Extract the EXEFS (executable file system which contains the ROMFS) from the NCCH.
This outputs a tough little
exefs.binfile that you can extract into a folder... a folder which contains, curiously, a file labelledcode.bin!
We can't (or at least I couldn't) actually do anything with the code.bin yet. I used
a wonderful, glorious, beautiful tool named ctr-elf
to turn the code.bin into an ELF file, linked and labelled and wrapped nice and tight in
a bow which Ghidra6 - my poison of choice - accepted graciously as an ARMv8
executable.
From there, we can use the code.ips file as intended to patch the code.bin
and create a second, modded ELF! And now theoretically, the rest of the project
lies solely in comparing Tomodachi Life and Tomodachi Life (Gay Edition)..
my head hurts and C needs to die
So, Ghidra, what have you got for us?

Oh :4
At the very least, it's a continuous piece of code. There is a clear and intentional control flow, and functions are neatly defined and I can finally spot some assembly patterns typical of compiled programs. The sad part is a lot of Ghidra's type inferrences come out messy, incorrect or undefined, which is how you end up with horrendous blocks like this:
*(char *)(*(int *)((int)uVar6 + 0x15c) + 0x658) != '\0' // gesundheit?
No matter the state of the code though, I 100% don't have enough knowledge of
3DS modding to be able to tell the purpose of an isolated function. Even helpfully
labelled as FUN_00556104 😔. So here comes our next disgustingly produced C tool!
I don't know how to use gdb, and for some reason, I haven't learned. I ended up instead
making a tool I affectionately titled the Internal Patching Ballistic Missile
which nukes a certain memory address with an infinite loop. Essentially, when the program crashes,
it means I reached the part of code I'm interested in. As primitive and stupid as this is,
it helped me assign purposes to functions! For example, the FUN_00556104 I mentioned before is
responsible for choosing a Mii's crush when they want to confess to somebody! From there,
you can start to look at the assembly another way 🐶
// patched
61ec ldr r0,[r9,#0x0]=>local_38
61f0 ldr r1,[r9,#local_34]
61f4 cmp r0,r1
61f8 movlt r1,#0x0
61fc movge r1,#0x1
6200 nop
6204 cpy r2,r4
6208 nop
620c ldr r0,[r7,#0x0]=>DAT_00acb60c
6210 nop
6214 nop
// unpatched
61ec ldr r0,[r8,#0x0]=>DAT_00acb5c0
61f0 cpy r1,r4
61f4 add r0,r0,#0x1e4000
61f8 add r0,r0,#0xdc0
61fc bl FUN_00539594
6200 ldr r0,[r0,#0xec]
6204 cpy r2,r4
6208 cmp r0,#0x0
620c ldr r0,[r7,#0x0]=>DAT_00acb60c
6210 movne r1,#0x1
6214 moveq r1,#0x0
Nevertheless, it's still difficult work, and - you're going to be disappointed in me - it's still in progress. Pride is postponed 💔. But I've written up absolutely everything I know so far about the Gay Mod-related functions over here, so anybody can drop in if they wish :]
todo!
Hopefully I get my hands on some more sophisticated debugging tools, so that I can actually do things like interface with memory or replicate the cheat engine workflow I had with Kirby Air Ride, and make horizontal progress (because sincerely, hacking at a Ghidra decomp of ONE (1) function is just chasing my own tail).
This whole dive into 3DS code mods started because I hate it when my Miis change out of their
outfit on their own accord at random, and I wanted to stop it. I figured understanding the only
complex code mod out there would give me some insight into the structure of the game, or at least
be a teach-a-dog-to-fish moment, you know?
At the very least, I now know where the checks that happen when you open the game (deciding problems,
positioning Miis and importantly, changing clothes) are called from. I should get some mileage
out of that..
This is also technically my first technical writeup on the Shrublog! Chronologically, it might not be, since I intended to retroactively publish some details on my past endeavours, but I hope you enjoyed my very first attempt - catch you later!
-
This is a filepath in the ROMFS of Tomodachi Life that I dumped using Azahar.
messageis the directory that contains MSBT files, and obviouslyClothesis the relevant section for clothing item names and descriptions.ArcBasecontains the actual text displayed on screen, whereasArcVoiceis a duplicate that contains phonetic spellings in case the Mii TTS pronounces text incorrectly, sort of how you can set pronunciations for names in-game.Body_Name.msbtis the set of names of clothing items that go on the body. You'll find that the*_Name.msbtfiles are generally the "main" files that contain attribute definitions, even though there are other files likeBody_Desc.msbtandBody_Attr.msbtconcerned with body clothing. < -
Someone requested an Infinite Stomach mod which I made by setting the hunger values of every single food item to 0. <
-
This is how the Wake Mii Up mod works! <
-
Because of this 3 byte offset, IPS files can only patch binaries up to 2047 Mb in size. Unfortunate oversight, I know. This is why somebody created the wonderfully upgraded BPS file specification, which is slightly more complicated but way more versatile and future proof. The other code mod, the Time Travel mod actually uses a BPS file, likely because a
code.ipsandcode.bpscan coexist in the mod folder without conflicting each other. < -
Not that one. We will be seeing the NSA soon, however. <
-
There they are! What a gem of open source. <

