Homebrew Question How can I modify (and decrypt), the Nintendo switch firmware/OS?

FrenchCheese

Member
OP
Newcomer
Joined
Dec 30, 2019
Messages
6
Trophies
0
Age
27
XP
45
Country
Canada
Hi, (sorry if this is in the wrong spot)


I have a personal project which involves modifying the Nintendo switch OS/firmware.


I downloaded the firmware online from a website, and opened in notepad++. But obviously, the firmware would be encrypted. I tried using hactool to decrypt it, but I can’t seem to get it to work. I need a way(or some guidance) to be able to read, and modify the Nintendo switch firmware/OS.


Any help would be great.


Thanks,

French
 

Boydy86

Well-Known Member
Member
Joined
Jun 3, 2019
Messages
107
Trophies
0
Age
38
XP
304
Country
United Kingdom
ChoiDujour
Converts Nintendo Switch firmware update packages to installable images/files that can be transferred to the device itself
 

FrenchCheese

Member
OP
Newcomer
Joined
Dec 30, 2019
Messages
6
Trophies
0
Age
27
XP
45
Country
Canada
From what I understand, non compiled code is code in a format meant for programmers, and compiled code is in a format meant for CPUs?

I'm really new to a lot of these things and don't really know much about them, I just need some help starting out.

Thanks,
French
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,260
Trophies
3
XP
12,014
Country
Poland
From what I understand, non compiled code is code in a format meant for programmers, and compiled code is in a format meant for CPUs?

I'm really new to a lot of these things and don't really know much about them, I just need some help starting out.

Thanks,
French
Yes, and Horizon OS consists only of compiled code. And this compiled code is hash checked, so any direct changes to FW can result in error, in worst case soft brick. So first learn what is disassembling and you need to have very good understanding of platform machine code to do anything that you probably want to accomplish. Easier way is to use Atmosphere as base for what you want to do, because it has many security measures and big library that makes easier to understand Switch and apply custom stuff - or maybe you can even help with development of CFW.
 

FrenchCheese

Member
OP
Newcomer
Joined
Dec 30, 2019
Messages
6
Trophies
0
Age
27
XP
45
Country
Canada
I suppose I should probably share my intention for the firmware.

I know this would be very hard, and perhaps unrealistic, but I wanted to see if I could modify the Nintendo switch firmware to run on the raspberry PI. I know there would be tons of errors (if it's even possible) but I still wanted to try.
 

Homlet

Well-Known Member
Member
Joined
Feb 28, 2020
Messages
589
Trophies
0
XP
2,502
Country
France
I suppose I should probably share my intention for the firmware.

I know this would be very hard, and perhaps unrealistic, but I wanted to see if I could modify the Nintendo switch firmware to run on the raspberry PI. I know there would be tons of errors (if it's even possible) but I still wanted to try.
It sounds like you have you have no experience with programming, so I wouldn't bother trying that. You'd need the source code to compile it to different CPU architecture, and even then it'd be much more than you can handle. If you want to have fun with the switch, I'd recommend making simple homebrew apps with libnx
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,260
Trophies
3
XP
12,014
Country
Poland
I suppose I should probably share my intention for the firmware.

I know this would be very hard, and perhaps unrealistic, but I wanted to see if I could modify the Nintendo switch firmware to run on the raspberry PI. I know there would be tons of errors (if it's even possible) but I still wanted to try.
First you would need to disassemble whole OS. Disassembling even Kernel is a big feat that can take years. And on top of that you need implement different programs. This is way too unrealistic for one person that doesn't have any experience with porting OS. If you will make your linux distro running on Raspberry from scratch, you can be proud. Horizon is many times higher level, because many engineers worked on it to be as hard as its possible to reverse engineer OS without compromising performance.
 
  • Like
Reactions: FrenchCheese

FrenchCheese

Member
OP
Newcomer
Joined
Dec 30, 2019
Messages
6
Trophies
0
Age
27
XP
45
Country
Canada
Thank you all for you responses,
I had figured that this project might not be possible, and already accepted that I wouldn't be able to do this, and instead use something like an emulator for the PI.
That being said, from what I read about compiled code, it said that it could be written in C/C++. I'm fairly certain you can't, but just to be sure, is their any way to modify compiled code?

Thanks for your replies, I don't really have any experience in programming, and I just wanted to know what was possible.
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,260
Trophies
3
XP
12,014
Country
Poland
That being said, from what I read about compiled code, it said that it could be written in C/C++.

Yes, to get machine code you need first write code in compiled language or/and Assembler. C/C++ are compiled languages.
To get Assembler code you need to put machine code through process called disassembling. To get C code, you need to go through decompiling. Automatic decompiling is always not perfect and if compiled code is stripped from useful for RE informations, decompiled code has multiple errors (milion is the low bar with good amount of debug informations for part of OS), so you need to fix all of them based on disassembled code or write from scratch whole code based on disassembled code.
Still this would probably require writing at least 1 GB of pure code.
 
Last edited by masagrator,

Dracari

Well-Known Member
Member
Joined
Apr 5, 2009
Messages
1,985
Trophies
1
XP
2,465
Country
United States
Dont take this as me trying to be a Arsehole but trying to layout what kind of work you'd be facing.

i'd doubt it'd be possible, for not just the Vastly Worlds apart SoC's between say a Pi4 and the Switch (OG/"Redbox"/Mariko/Lite), and that theres no 100% open source documentation of the GPU as far as i know on the Pi 4's VideoCore VI, (hell its only recent w/ Pi's they've got a Neutered version of Vulkan, and while i have no idea if the switch relies on something like OpenGL, then that's going to make your life More a living hell as the Pi4 GPU drivers openly support OpenGL ES (which the version it supports is compliant to OpenGL 2.0 standards but it's a stripped down version of the full API)

i think you have the idea of what you aim for mistaken, if the aim was to run HorizonOS and therefore Switch games, your better off working on porting Atmosphere, and you would haveto write drivers (or i guess for Horizon, sysmodules?) for the GPU, BCM2711 (the SoC and sound) and account for going from the TegraX1 to the BCM2711's Cortex-A72 ARMv8 CPU, Not to ment even Write code to handle Joycons and keeping them as 1 Controller w/ as little input as possible.

(edit: not to mention this would likely only be feasible on the Pi4 4GB Model and running on Bare Metal w/o the underlying RaspbianOS as there's no Pi4 model w/ More memory than the switch.)

not to mention all this? would limit itself to Legally? Homebrew, otherwise, own cart dumps converted to ESPs/ eShop ESP Dumps. as there's likely no way to interface the Switch's gamecart reader over the Pi's GPIO in a timely fashion (i mean they cant even Drive a Floppy drive properly as a drop in replacement and those require stupid fast timings. ((for relevance look into something like FlashFloppy))

now if the Pi4 shared the same SoC? that'd take a Chunk of the extremely hard work work with "Possible" benefits off your back, the only things they share is just they both run an Arm based SoC,
 
Last edited by Dracari, , Reason: i've had to edit a few times allready feeling like im having an r/ihadastroke day...

Dracari

Well-Known Member
Member
Joined
Apr 5, 2009
Messages
1,985
Trophies
1
XP
2,465
Country
United States
@Dracari Switch supports OpenGL, OpenGL ES2 and ES3.

Still doesn't change a fact this is absurd task.
Agreed, sounds like they have the best of intentions on thier own part but way way above their skillset for likely wont go past a PoC. much less before Big N coming down and screaming "You Stop that baaad. .. " as for the API support, i think thats down more less to the limited choice What the Pi4 has, and what games and even homebrew uses/used and the high incompatibility this'd bring about.
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,250
Trophies
4
Location
Space
XP
13,803
Country
Norway
Yes, to get machine code you need first write code in compiled language or/and Assembler. C/C++ are compiled languages.
To get Assembler code you need to put machine code through process called disassembling. To get C code, you need to go through decompiling. Automatic decompiling is always not perfect and if compiled code is stripped from useful for RE informations, decompiled code has multiple errors (milion is the low bar with good amount of debug informations for part of OS), so you need to fix all of them based on disassembled code or write from scratch whole code based on disassembled code.
Still this would probably require writing at least 1 GB of pure code.
C/C++ decompilers are pretty much not a thing, from what I've seen they just produce a .c file with functions and variables filled in (usually with random strings since debug symbols are usually not included) but completely devoid of any C code, instead using inline assembly, so they are only marginally more advanced than a disassembler and you still need to know asm. I wouldn't even call them decompilers, that's giving them too much credit.

I suppose I should probably share my intention for the firmware.

I know this would be very hard, and perhaps unrealistic, but I wanted to see if I could modify the Nintendo switch firmware to run on the raspberry PI. I know there would be tons of errors (if it's even possible) but I still wanted to try.
Even the pros in the scene are nowhere near the level of understanding needed to do something like that. They may both be ARM based platforms, but that's about the only similarities they share. The firmware makes use of a lot of Tegra specific functionality, and hardware specific to the Switch console. It will probably never be reverse engineered to the point where modifying it to run on other systems is possible, the best we might get is a hypervisor similar to Nintendont on Wii and Wii U or Wine on Linux which sits between the hardware/kernel and software and translates function and hardware calls where possible or emulates certain parts when that's not possible.
 
Last edited by The Real Jdbye,
  • Like
Reactions: Dracari

FrenchCheese

Member
OP
Newcomer
Joined
Dec 30, 2019
Messages
6
Trophies
0
Age
27
XP
45
Country
Canada
Thanks for your reply's. I figured this would be something far out of my skill set(afer all, Nintendo is a company with tons of developers and someone would have done it before me), but I wanted to see what would make it so difficult, and what the next best solution would be.

I hadn't really considered driver support, as I had found out that Nintendo used the free BSD kernel and figured they might have used the Raspberry Pi version for their base. Although, either way they would still need diffrent drivers, so that would be an issue.

As for hardware support, I had actually asked on the RBP forum (before realizing how hard software would be) how to connect the joy-con rails, coming to the conclusion that Soldering the ribbon cable end to a wire that connects to the GPio pins would be the best/only option(and doing something similar with cartridge reader). I don't think I'm allowed to leave a link yet, but it was entitled 'connecting joy-con rails to Raspberry Pi', if youre intrested.

Assuming I'd try the decompiler anyway, knowing it probably wont work/be too complex, then realize just how much I'm in over my head, and settle with a custom firmware to figure out how to port (assuming they built it from the ground up and didn't find a way to decompile it); Is there a firmware that's similar in apperance and function to the switch OS? And would I be able to go online without being banned?

Either way, I do understand how absurdly complicated and next-to-impossible this project would be, and that's why I asked, to see what was possible. Thanks.
 

Dracari

Well-Known Member
Member
Joined
Apr 5, 2009
Messages
1,985
Trophies
1
XP
2,465
Country
United States
Is there a firmware that's similar in appearance and function to the switch OS? And would I be able to go online without being banned?
like it pretty much still is on the 3DS side, there's no 100% super guaranteed way to Prevent a ban. if by this your referring to a modified switch, both SX-OS and Atmosphere "look" like Normal Horizon. but going online w/o incognito applied is the fastest way to earn a ban.

there's a fine line between Ambition and "Crazy talk" ideals, and sadly your goal what you wanted to try, again just isn't feesable even if you implement a wine-like Layer to emulate basically what isn't available both software n Tegra specific hardware calls, there's going to be too much overhead to make it any more feesable w/ even the 4GB Pi4. and no telling if/when we'll see any new RaspberryPi hardware revisions with a decent enough bump in spec to make this possible.

if your trying to say recreate Horizon's Appearance however on the Pi, the closest GUI you could skin will be EmulationStation.

Though best of luck in future endeavors!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    Tandem even
  • The Real Jdbye @ The Real Jdbye:
    i think i heard of that, it's a good idea, shouldn't need a dedicated GPU just to run a LLM or video upscaling
  • The Real Jdbye @ The Real Jdbye:
    even the nvidia shield tv has AI video upscaling
  • The Real Jdbye @ The Real Jdbye:
    LLMs can be run on cpu anyway but it's quite slow
  • BakerMan @ BakerMan:
    Have you ever been beaten by a wet spaghetti noodle by your girlfriend because she has a twin sister, and you got confused and fucked her dad?
  • Psionic Roshambo @ Psionic Roshambo:
    I had a girlfriend who had a twin sister and they would mess with me constantly.... Until one chipped a tooth then finally I could tell them apart.... Lol
  • Psionic Roshambo @ Psionic Roshambo:
    They would have the same hair style the same clothes everything... Really messed with my head lol
  • Psionic Roshambo @ Psionic Roshambo:
    @The Real Jdbye, I could see AMD trying to pull off the CPU GPU tandem thing, would be a way to maybe close the gap a bit with Nvidia. Plus it would kinda put Nvidia at a future disadvantage since Nvidia can't make X86/64 CPUs? Intel and AMD licensing issues... I wonder how much that has held back innovation.
  • The Real Jdbye @ The Real Jdbye:
    i don't think nvidia wants to get in the x64 cpu market anyways
  • The Real Jdbye @ The Real Jdbye:
    you've seen how much intel is struggling getting into the gpu market
  • The Real Jdbye @ The Real Jdbye:
    and nvidia is already doing ARM
  • The Real Jdbye @ The Real Jdbye:
    i don't think they want to take more focus away from their gpus
  • Psionic Roshambo @ Psionic Roshambo:
    Yeah I think Nvidia s future lays in AI GPU acceleration stuff if they can get that going it's going to be super interesting in the long term
  • Psionic Roshambo @ Psionic Roshambo:
    AI assisted game creation might become a thing
  • Psionic Roshambo @ Psionic Roshambo:
    At least that's something I think would be pretty cool.
  • Psionic Roshambo @ Psionic Roshambo:
    Don some VR glasses and gloves and talk to the computer and paint entire worlds
  • Psionic Roshambo @ Psionic Roshambo:
    "OK Cortana I want that mountain a little taller and more snow on top, and I would like some random ancient pine forest around the bottom"
  • Psionic Roshambo @ Psionic Roshambo:
    "Now we need a spring fed river flowing down the north side and add some wild life appropriate for the biome"
  • Psionic Roshambo @ Psionic Roshambo:
    Many TBs of assets and the programming of something like that is going to be tough but I think it's something we might see in 20 years maybe sooner
  • The Real Jdbye @ The Real Jdbye:
    @Psionic Roshambo AI assisted game creation is kinda already here, there was recently that AI that can turn any 2D image into a fully modeled 3D object, it's not perfect, but it's a starting point, beats starting from zero
  • The Real Jdbye @ The Real Jdbye:
    before that there was one to generate a fully modeled scene from a 2D image
  • The Real Jdbye @ The Real Jdbye:
    but most recently, there was one that actually generates a working unity scene with terrain and textures already set up that you can import right into unity, that's a huge time saver right there
  • The Real Jdbye @ The Real Jdbye:
    and using LLMs to generate NPC dialogue and even dynamically generated quests is something i'm sure is already happening
  • The Real Jdbye @ The Real Jdbye:
    will just take some time for games made using those things to be completed and released
    The Real Jdbye @ The Real Jdbye: will just take some time for games made using those things to be completed and released