Misc Horizon Linux - Running Switch Games Natively on ARM64 Linux

Joom

 ❤❤❤
OP
Member
Joined
Jan 8, 2016
Messages
6,041
Trophies
1
Location
US
Website
mogbox.net
XP
6,026
Country
United States
Kinda surprised this hasn't made its round here yet. Over at Reddit, u/kentjhall has announced a rather ambitious project. They're patching the ARM64 Linux kernel in order to be able to play Switch games natively. So far, the first commercial game they've got running is Puyo Puyo Tetris. If this project gets further traction, this is going to be huge.

From their post:
What?
Over the past while, I’ve worked on-and-off in my free time patching the arm64 Linux kernel to run Nintendo Switch games natively, i.e. by taking many of the Switch’s “Horizon” OS system calls and implementing their behavior using Linux’s existing facilities for memory management, scheduling, synchronization, etc.

Why?
Well my original thought was merely that I wanted to run Switch games on my MacBook—given that they’re powered by the same arm64 architecture, you should be able to run a Switch game’s machine code right on the CPU, no x86 translation layer needed. I was hoping to be able to achieve this entirely in user-space by attaching (via ptrace) to a process executing the Switch game’s code, and trapping any system calls to the tracer process. But if I recall, this quickly proved infeasible without OS support for various reasons to do with a Switch program’s use of system registers. If I’d have to poke around the OS anyway, I figured I might as well just handle everything within the kernel—then I’d just virtualize said OS under macOS.

Patching arm64 Linux means that you get Linux’s vast hardware driver support for free, so not only can it be virtualized on Apple silicon Macs, but it can run bare-metal on any arm64 hardware which supports Linux—even on lower-end hardware, given that there’s no need to emulate the CPU. This should offer a good deal of flexibility in the future for running Switch games, and hopefully will prove a useful option for game preservation.

Note that this is not an attempt to accurately recreate the Horizon OS, nor is it particularly intended to run on an actual Switch, as (I believe) is the case is for the Mesosphere project (though you probably could, I’m aware that the Switch can run Android at least). Rather, Horizon Linux is my attempt to enable Switch games to run on any arm64 hardware.

How?
In addition to OS support in handling Horizon system calls, a Switch program needs to be able to communicate with a number of system services that handle things like input, audio, graphics, etc. Rather than reinvent the wheel, I figured the easiest approach would be to take the open-source yuzu emulator and gut out the things I didn’t need (namely, kernel / CPU emulation), essentially keeping only the system services, GPU emulation, and app loader. This necessitated a custom system call interface to interface with kernel, and a custom Linux binary format for the loader to work with. I also decided (perhaps unnecessarily) to deviate from yuzu’s model and have each system service run persistently in it’s own thread, which made my reorganization considerably more involved.

The custom Linux kernel is called “Horizon Linux”, and the yuzu hack-job is called “mizu”. Mizu is intended to run as a systemd service under Horizon Linux.

Source
Horizon Linux on GitHub
 

Jayro

MediCat USB Dev
Developer
Joined
Jul 23, 2012
Messages
12,474
Trophies
4
Location
WA State
Website
ko-fi.com
XP
15,855
Country
United States
Wow, this is really cool. I'd love to see this come along and eventually see switch games on more ARM64 devices. Especially ARM-based SBCs.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • K3N1 @ K3N1:
    Get your $800 8k capable ps6 and your $5,000 8k compatible TV today!
  • ZeroT21 @ ZeroT21:
    I had wanted a sony bravia xr i saw last , still at $>7k
  • K3N1 @ K3N1:
    I've seen 50" oleds floating around for $800 but for a main TV oled still doesn't sound that good cause burn ins
  • ZeroT21 @ ZeroT21:
    led have much more heat i suppose if they can cause burn in, or is the fragile parts used to make them on purpose
  • K3N1 @ K3N1:
    Isn't lcd different from led
  • K3N1 @ K3N1:
    Or oled more burn in prone to qled
  • ZeroT21 @ ZeroT21:
    the newer led variation are just much smaller
  • Veho @ Veho:
    LCD is different from LED and OLED.
  • Veho @ Veho:
    LCD/TFT don't emit light on their own, they just filter color they have to have a backlight. LED/OLED panels emit light.
  • Veho @ Veho:
    Backlight can be one giant light panel with a diffusor, but recently there's mini/micro LED backlighting, where you can control the light level for smaller areas of the screen, to get better contrast and color range.
  • ZeroT21 @ ZeroT21:
    yeah, lots of lcd panel tech usually have the dead backlight issue making owners think it's completely dead
  • Veho @ Veho:
    And those backlights can get burn-in themselves.
  • ZeroT21 @ ZeroT21:
    i fixed my previous tv twice already, 1st time was power supply defect and 2nd was dead backlight, just ordered some parts after butchering it open
  • ZeroT21 @ ZeroT21:
    so easy compared to the time i had to work on my sony trinitron, gud times :rofl2:
  • K3N1 @ K3N1:
    It's just weird that the only way it'll display a picture is through my Nvidia shield menu won't come on at all
  • ZeroT21 @ ZeroT21:
    if your tv lasted you 5 yrs, i'd say it has served it's purpose
  • K3N1 @ K3N1:
    2017 model hopefully it lasts tell summer
  • ZeroT21 @ ZeroT21:
    time to retire it, get a new fling
  • ZeroT21 @ ZeroT21:
    or like my friends, buy 1 every time there is a world cup:whip:
  • K3N1 @ K3N1:
    Web os hasn't been bad really
  • ZeroT21 @ ZeroT21:
    I never bothered with those ''smart functions'', used a beelink mini pc instead
  • K3N1 @ K3N1:
    Doesn't really bother me two shield devices all I need
  • TheZander @ TheZander:
    my ps4 is only getting network errors whenever i try to use the browser
  • ZeroT21 @ ZeroT21:
    @TheZander clear your browser cache and cookies, then restart your browser
    ZeroT21 @ ZeroT21: @TheZander clear your browser cache and cookies, then restart your browser