Skip to content
Table of contents

sm64coopdx-switch-N3DS: Keeping a port behind platform interfaces

This fork explores Switch and New 3DS targets for sm64coopdx. Shared game and co-op code sit above platform-specific graphics, audio and input. The platform probe is a smaller executable with a narrower purpose than the full game.

Hardware and graphics Fork
  • Updated
  • 4
  • C · 82.89%
unittest Upstream credited
Documented components
2Explore modules
Source documents
6Read the instructions
Repository languagesC 82.89%13

Shares calculated from GitHub Linguist bytes.

C82.89%
82.89%26,541,138 bytes
C++10.86%
10.86%3,478,712 bytes
Lua4%
4%1,281,479 bytes
Python1.44%
1.44%460,864 bytes
Language%Bytes
C82.89%26,541,138
C++10.86%3,478,712
Lua4%1,281,479
Python1.44%460,864
Assembly0.49%156,333
Shell0.13%42,404
7 more languages
Pawn0.11%34,727
Go Template0.04%11,678
Makefile0.03%9,211
Dockerfile0%1,534
Linker Script0%257
PHP0%200
BitBake0%59

1. Overview

1.1. Why it exists

Low-level C systems port optimizing multi-threaded networking and memory layout for embedded handheld consoles.

1.2. Best fit

Co-op multiplayer emulation and custom embedded gaming on Switch & N3DS.

2. Use cases

Unofficial Nintendo Switch homebrew port of sm64coopdx online co-op, with an early New 3DS target; you supply the ROM.

Use-case diagram for sm64coopdx-switch-N3DS: Install with your own ROM; Join a public CoopNet lobby; Play over local wireless; Enter a lobby password; Build and package the NRO; Build the New 3DS targetsm64coopdx-switch-N3DSInstall with your own ROMJoin a public CoopNet lobbyPlay over local wirelessEnter a lobby passwordBuild and package the NROBuild the New 3DS targetSwitch playerPort developer«system»CoopNet lobby service
People on the left, external systems on the right; each oval is a use case backed by the files cited below.
Install with your own ROM
Switch player

docs/SWITCH_INSTALL.md: extract the release ZIP to the SD card root, add a US ROM as switch/sm64coopdx/baserom.us.z64 matching sm64.us.sha1, and launch sm64coopdx.nro in full application mode.

Join a public CoopNet lobby
Switch playerCoopNet lobby service

The Switch build sends its genuine NRO fingerprint and lists lobbies in the sm64coop-android namespace, as described in docs/switch.md; the client code is under src/pc/network/coopnet.

Play over local wireless
Switch player

src/pc/network/socket/socket_ldn.c adds a local wireless transport and src/pc/djui/djui_panel_ldn_browser.c lists nearby sessions.

Enter a lobby password
Switch playerCoopNet lobby service

Private-lobby passwords use the in-game keypad in src/pc/djui/djui_panel_switch_text_entry.c instead of the native Switch keyboard.

Build and package the NRO
Port developer

In the devkitpro/devkita64 Docker image, make -f Makefile.switch-sdmc SWITCH_COOPNET=1 switch-nro builds the NRO and switch-dist checks the header and hashes and writes the release ZIP; build-switch-game.yml runs ROM-free portability gates in CI.

Build the New 3DS target
Port developer

Makefile.new3ds builds a platform shell and Makefile.new3ds-game the full engine with a Citro3D renderer and NDSP audio; docs/new3ds-port.md says gameplay on hardware is not verified yet.

2.1. Scenario: Play co-op online from a Switch

  1. Extract the sm64coopdx Switch release ZIP to the SD card root, creating switch/sm64coopdx/.
  2. Copy your own US ROM to switch/sm64coopdx/baserom.us.z64.
  3. Hold R while starting a game to open the Homebrew Menu in full application mode, then launch SM64CoopDX.
  4. Open the join menu, pick a public CoopNet lobby and type its password on the in-game keypad if it is private.
  5. If something fails, read startup.log, coopnet.log and exception.log under switch/sm64coopdx/logs/.

Files readREADME.mddocs/SWITCH_INSTALL.mddocs/switch.mddocs/new3ds-port.mdMakefile.switch-sdmc.github/workflows/build-switch-game.ymlsrc/pc/network/socket/socket_ldn.csrc/pc/djui/djui_panel_ldn_browser.csrc/pc/djui/djui_panel_switch_text_entry.c

3. Getting started

These commands come from the repository documentation. They were not run during this review.

4. Repository references

Excerpts from the repository’s guides, in their original language. Links open the inspected source revision.

Prerequisites and first run

4.1. Requirements

docs/SWITCH_INSTALL.md

  • A homebrew-capable Nintendo Switch with a current Homebrew Menu setup.
  • The SM64CoopDX Switch distribution ZIP.
  • Your own legally obtained North American Super Mario 64 ROM matching the SHA-1 recorded in sm64.us.sha1 in the source repository. The ROM is copyrighted data and is not included in the distribution. Do not download, upload, or redistribute it.
Read the full instructions ↗

4.2. Install

docs/SWITCH_INSTALL.md

  1. Shut down the Switch before removing its SD card, or use a safe USB/FTP transfer method.
  2. Extract the distribution ZIP directly to the root of the SD card. It creates switch/sm64coopdx/.
  3. Copy your ROM to switch/sm64coopdx/baserom.us.z64.
  4. Confirm this layout:
  5. Put the SD card back in the Switch and start the Homebrew Menu in full application mode. With common Atmosphere setups, hold R while launching an installed game until Homebrew Menu opens. Album/applet mode has less memory and is not recommended.
  6. Launch SM64CoopDX.
Read the full instructions ↗
Operations and troubleshooting

4.3. Updating

docs/SWITCH_INSTALL.md

Replace sm64coopdx.nro, icon.jpg, and lang/ with the files from the new distribution. Keep your private baserom.us.z64, mods, saves, configuration, and logs.
Read the full instructions ↗

4.4. Troubleshooting and logs

docs/SWITCH_INSTALL.md

  • If startup reports a missing or invalid ROM, verify its filename, region, and SHA-1.
  • If the game freezes or runs out of memory, confirm it was launched in full application mode rather than Album/applet mode.
  • Private-lobby passwords use the in-game Switch keypad; that flow should not open the native software keyboard.
  • Switch public discovery uses the Android lobby list. It will not show lobbies published only in the desktop namespace.
  • If a particular server rejects the Switch build, share switch-coopnet-identity.txt with that server’s operator; do not replace the genuine hash with another executable’s identity.
  • Runtime diagnostics are written under switch/sm64coopdx/logs/, including startup.log, coopnet.log, checkpoints, and exception.log. When sharing diagnostics, remove lobby passwords, TURN credentials, and other private information first.
Read the full instructions ↗
Source documentation

6 documents read from 6 candidates.

5. Features and components 2

Shared runtime and backends
src/pc separates controller, audio, graphics, networking and platform code. Porting work can replace a backend while keeping shared game behavior. Build flags and target makefiles determine which implementations are linked.
The platform probe
Makefile.switch-platform compiles a probe with Switch lifecycle, input and crash-log code, then packages an NRO using devkitPro tools. Its source list is deliberately smaller than the full game’s build.

6. Architecture

Expand a component to follow its connections, or explore the full diagram.

System components Context
Mermaid Interactive diagram

System overview of the components and connections verified in the repository.

Static architecture view for sm64coopdx-switch-N3DS
Static preview. The interactive diagram replaces it after Mermaid loads.
flowchart LR
node_player(("Player"))

subgraph group_mods["Mods and UI"]
  node_lua["Lua Mod API"]
  node_mod_storage[("Mod Storage<br/>[mod_storage.cpp]")]
  node_djui["DJUI"]
end

subgraph group_runtime["Game Runtime"]
  node_game["Game Runtime<br/>[main.c]"]
  node_game_init["Game Initialization<br/>[main.c]"]
  node_gameplay["Gameplay World<br/>[types.h]"]
  node_render["Rendering<br/>[pc_main.h]"]
  node_lighting["Lighting Engine"]
  node_audio["Audio Runtime"]
end

subgraph group_multiplayer["Shared Play"]
  node_network["Multiplayer Sync"]
  node_coopnet["CoopNet"]
  node_local_wireless["Local Wireless"]
end

subgraph group_platform["Platform I/O"]
  node_config["Game Configuration<br/>[configfile.h]"]
  node_controller["Controller Input<br/>[controller_sdl.c]"]
  node_window["Window Manager"]
  node_switch_window["Switch Backend"]
  node_new3ds_window["New 3DS Backend"]
end

subgraph group_assets["Game Content"]
  node_rom_assets["ROM Asset Loading<br/>[rom_assets.h]"]
  node_actor_models["Character Assets<br/>[model.inc.c]"]
  node_level_content["Level Content<br/>[scripts.c]"]
end

node_player -->|"provides input"| node_controller
node_game -->|"initializes"| node_game_init
node_game -.->|"updates"| node_gameplay
node_gameplay -.->|"synchronizes world"| node_network
node_network -->|"supports online play"| node_coopnet
node_network -->|"supports local play"| node_local_wireless
node_gameplay -.->|"presents"| node_render
node_render -.->|"uses lighting"| node_lighting
node_game -->|"coordinates audio"| node_audio
node_game -.->|"loads assets"| node_rom_assets
node_actor_models -->|"queues assets"| node_rom_assets
node_level_content -.->|"defines levels"| node_gameplay
node_lua -->|"reads and writes"| node_mod_storage
node_mod_storage -->|"returns values"| node_lua
node_mod_storage -.->|"uses filesystem settings"| node_config
node_controller -->|"reads bindings"| node_config
node_window -->|"dispatches keyboard events"| node_controller
group_platform --> group_runtime
group_platform --> group_mods
class node_game,node_game_init,node_gameplay,node_render,node_lighting,node_audio toneBlue
class node_network,node_coopnet,node_local_wireless toneAmber
class node_lua,node_mod_storage,node_djui toneMint
class node_config,node_controller,node_window,node_switch_window,node_new3ds_window toneRose
class node_rom_assets,node_actor_models,node_level_content,node_player toneIndigo

A Super Mario 64 PC port centred on online multiplayer, shared-world interactions and Lua modding, with Switch and New 3DS backends. Input reaches the game runtime, which coordinates gameplay, rendering and audio while platform adapters own their frame and text-input boundaries.

Components
21
Connections
23
Evidence-backed links
13/23
Text version of the diagram

The diagram merges parallel links between groups, so it shows 19 of 23. Full list:

  • Player → Controller Input (provides input)
  • Controller Input → Game Runtime (feeds controls)
  • Game Runtime → Game Initialization (initializes)
  • Game Runtime → Gameplay World (updates)
  • Gameplay World → Multiplayer Sync (synchronizes world)
  • Multiplayer Sync → CoopNet (supports online play)
  • Multiplayer Sync → Local Wireless (supports local play)
  • Gameplay World → Rendering (presents)
  • Rendering → Lighting Engine (uses lighting)
  • Game Runtime → Audio Runtime (coordinates audio)
  • Game Runtime → ROM Asset Loading (loads assets)
  • Character Assets → ROM Asset Loading (queues assets)
  • Level Content → Gameplay World (defines levels)
  • Lua Mod API → Mod Storage (reads and writes)
  • Mod Storage → Lua Mod API (returns values)
  • Mod Storage → Game Configuration (uses filesystem settings)
  • Controller Input → Game Configuration (reads bindings)
  • Controller Input → DJUI (notifies interactables)
  • Window Manager → Controller Input (dispatches keyboard events)
  • Switch Backend → DJUI (opens text entry)
  • New 3DS Backend → DJUI (handles text entry)
  • Switch Backend → Rendering (selects backend)
  • New 3DS Backend → Rendering (owns frame lifecycle)
Follow one path through the code

Read the probe’s SOURCES list before interpreting a successful build. It exercises selected platform modules; it does not establish that every game subsystem, graphics path or co-op session works on the console.

7. Technical dossier

Built from the source at commit 567fd71 (3601 files). Each item comes from a pattern match in the code, so open the linked file before relying on it.

7.1. Layers and modules

Folders are sorted into layers by name, from the user interface down to data access. Because the sorting uses names only, the diagram says nothing about calls between layers.

Mermaid Layered view
flowchart TB
  subgraph L_presentation["Presentation"]
    direction TB
    presentation_0["assets/anims<br/>193 files"]
  end
  subgraph L_interface["Entry points and API"]
    direction TB
    interface_0["tools<br/>49 files"]
    interface_1["bin<br/>28 files"]
    interface_2["tools/switch<br/>16 files"]
    interface_3["tools/sdk-tools<br/>14 files"]
    interface_more["+19"]
  end
  subgraph L_application["Application services"]
    direction TB
    application_0["engine<br/>18 files"]
    application_1["pc/gfx<br/>2 files"]
  end
  subgraph L_domain["Domain and business rules"]
    direction TB
    domain_0["game/behaviors<br/>226 files"]
    domain_1["game<br/>113 files"]
    domain_2["levels/castle_inside<br/>58 files"]
    domain_3["levels/bbh<br/>47 files"]
    domain_more["+170"]
  end
  subgraph L_infrastructure["Data and infrastructure"]
    direction TB
    infrastructure_0["pc/network<br/>79 files"]
    infrastructure_1["data<br/>55 files"]
    infrastructure_2["pc/platform<br/>47 files"]
    infrastructure_3["src<br/>19 files"]
    infrastructure_more["+8"]
  end
  subgraph L_core["Core source"]
    direction TB
    core_0["pc/djui<br/>135 files"]
    core_1["docs/lua<br/>76 files"]
    core_2["levels/ttm<br/>67 files"]
    core_3["levels/wf<br/>67 files"]
    core_more["+203"]
  end
  subgraph L_tests["Tests"]
    direction TB
    tests_0["tools<br/>11 files"]
  end
  subgraph L_hosting["Build, CI and hosting"]
    direction TB
    hosting_0[".github<br/>8 files"]
    hosting_1["scripts<br/>5 files"]
    hosting_2["tools<br/>5 files"]
    hosting_3["(root)<br/>2 files"]
    hosting_more["+1"]
  end
  L_presentation ~~~ L_interface
  L_interface ~~~ L_application
  L_application ~~~ L_domain
  L_domain ~~~ L_infrastructure
  L_infrastructure ~~~ L_core
  L_core ~~~ L_tests
  L_core ~~~ L_hosting
Modules and their main layer
ModuleLayerFilesTypesExtensions
game/behaviorsDomain and business rules22613.c
assets/animsPresentation1930.c
pc/djuiCore source14047.c .h
gameDomain and business rules113101.h .c
levels/rrCore source990.c .h
docs/luaCore source970.c .lua .tex
levels/ttmCore source930.c .h
levels/lllCore source900.c .h
levels/wfCore source900.c .h
levels/castle_insideDomain and business rules890.c .h
levels/bitfsCore source840.c .h
levels/bitsCore source840.c .h
pc/networkData and infrastructure7920.c .h
levels/bbhDomain and business rules730.c .h

223 smaller modules are not shown.

7.2. C4 model

From system context to code declarations. Each level reflects the available source evidence.

UML 1 · System context
1 · System context

The widest C4 view: who uses the project and which outside systems and data stores it relies on. Rendered with uml-mcp.

PlantUML source
@startuml
!include <C4/C4_Context>
LAYOUT_LEFT_RIGHT()
Person(P_cli, "CLI user")
System(SYS, "sm64coopdx-switch-N3DS", "This fork explores Switch and New 3DS targets for sm64coopdx")
System_Ext(E0, "Open data portal (CKAN)")
Rel(P_cli, SYS, "Uses")
Rel(SYS, E0, "Calls")
@enduml
UML 2 · Containers
2 · Containers

One level closer: the parts that run separately inside the project, their main language and how calls flow between them. Rendered with uml-mcp.

PlantUML source
@startuml
!include <C4/C4_Container>
LAYOUT_LEFT_RIGHT()
Person(P_cli, "CLI user")
System_Boundary(SYS, "sm64coopdx-switch-N3DS") {
  Container(C0, "new3ds-shell", "Docker")
  Container(C1, "new3ds-integration", "Docker")
  Container(C2, "new3ds-full-3dsx", "Docker")
  Container(C3, "switch-portability", "Docker")
  Container(C4, "switch-full-nro", "Docker")
}
System_Ext(E0, "Open data portal (CKAN)")
Rel(P_cli, C0, "Uses")
Rel(C0, E0, "Calls")
@enduml
UML 3 · Components and layers
3 · Components and layers

Modules grouped by source-layer classification. Boundaries show organization, not runtime isolation or call relationships. Rendered with uml-mcp.

PlantUML source
@startuml
!include <C4/C4_Component>
LAYOUT_TOP_DOWN()
System_Boundary(SYS, "sm64coopdx-switch-N3DS") {
Boundary(L0, "Presentation", "layer") {
Component(M0_0, "assets/anims", "C", "193 files")
}
Boundary(L1, "Entry points and API", "layer") {
Component(M1_0, "tools", "Python, C, .sh", "49 files")
Component(M1_1, "bin", "C", "28 files")
Component(M1_2, "tools/switch", "Python, C, .sh", "16 files")
Component(M1_3, "tools/sdk-tools", "C, C/C++", "14 files")
Component(M1_4, "docs/lua", ".lua", "12 files")
Component(M1_5, "tools/new3ds", ".sh, Python, C/C++", "10 files")
Component(M1_6, "tools/ido5.3_recomp", "C/C++, C, C++", "6 files")
Component(M1_7, "tools/n64graphics_ci_dir", "C, C/C++", "6 files")
Component(M1_more, "+15 modules", "", "")
}
Boundary(L2, "Application services", "layer") {
Component(M2_0, "engine", "C/C++, C, C++", "18 files")
Component(M2_1, "pc/gfx", "C, C/C++", "2 files")
}
Boundary(L3, "Domain and business rules", "layer") {
Component(M3_0, "game/behaviors", "C", "226 files")
Component(M3_1, "game", "C/C++, C", "113 files")
Component(M3_2, "levels/castle_inside", "C", "58 files")
Component(M3_3, "levels/bbh", "C", "47 files")
Component(M3_4, "levels/hmc", "C", "39 files")
Component(M3_5, "levels/lll", "C", "35 files")
Component(M3_6, "levels/rr", "C", "35 files")
Component(M3_7, "levels/bits", "C", "32 files")
Component(M3_more, "+166 modules", "", "")
}
Boundary(L4, "Data and infrastructure", "layer") {
Component(M4_0, "pc/network", "C, C/C++", "79 files")
Component(M4_1, "data", "C++, C/C++, C", "55 files")
Component(M4_2, "pc/platform", "C, C/C++", "47 files")
Component(M4_3, "src", "C, C/C++", "19 files")
Component(M4_4, "lua/include", "C/C++, C++", "5 files")
Component(M4_5, "pc/mods", "C/C++, C, C++", "4 files")
Component(M4_6, "docs/lua", "C, .lua", "2 files")
Component(M4_7, "pc/djui", "C, C/C++", "2 files")
Component(M4_more, "+4 modules", "", "")
}
Boundary(L5, "Core source", "layer") {
Component(M5_0, "pc/djui", "C, C/C++", "135 files")
Component(M5_1, "levels/ttm", "C, C/C++", "67 files")
Component(M5_2, "levels/wf", "C, C/C++", "67 files")
Component(M5_3, "actors", "C, C/C++", "66 files")
Component(M5_4, "docs/lua", "C, .lua, C/C++", "64 files")
Component(M5_5, "levels/rr", "C, C/C++", "64 files")
Component(M5_6, "levels/lll", "C, C/C++", "55 files")
Component(M5_7, "levels/bitfs", "C, C/C++", "53 files")
Component(M5_more, "+198 modules", "", "")
}
Boundary(L6, "Tests", "layer") {
Component(M6_0, "tools", "Python, C, C++", "11 files")
}
Boundary(L7, "Build, CI and hosting", "layer") {
Component(M7_0, ".github", ".yml, .md, .yaml", "8 files")
Component(M7_1, "scripts", ".sh", "5 files")
Component(M7_2, "tools", "Makefile", "5 files")
Component(M7_3, "(root)", "Dockerfile, Makefile", "2 files")
Component(M7_4, "docker", "Dockerfile", "2 files")
}
}
@enduml
UML 4 · Code
4 · Code

Selected declarations, fields and methods grouped by source file. No inheritance or call edges are inferred. Rendered with uml-mcp.

PlantUML source
@startuml
skinparam backgroundColor transparent
skinparam shadowing false
skinparam roundCorner 10
skinparam defaultFontName Arial
skinparam defaultFontSize 13
skinparam ArrowColor #4e6070
skinparam ArrowFontColor #3d4f5f
skinparam titleFontSize 14
skinparam actorBorderColor #006a62
skinparam actorBackgroundColor #e9f3f4
skinparam usecaseBorderColor #006a62
skinparam usecaseBackgroundColor #e9f3f4
skinparam componentBorderColor #006a62
skinparam componentBackgroundColor #e9f3f4
skinparam interfaceBorderColor #006a62
skinparam interfaceBackgroundColor #ffffff
skinparam nodeBorderColor #4e6070
skinparam nodeBackgroundColor #f4f8fb
skinparam databaseBorderColor #006a62
skinparam databaseBackgroundColor #ffffff
skinparam cloudBorderColor #4e6070
skinparam cloudBackgroundColor #f0f5fa
skinparam artifactBorderColor #006a62
skinparam artifactBackgroundColor #ffffff
skinparam rectangleBorderColor #b0c2d3
skinparam activityBorderColor #006a62
skinparam activityBackgroundColor #e9f3f4
skinparam partitionBorderColor #b0c2d3
skinparam stereotypeCBackgroundColor #ffffff
top to bottom direction
hide empty members
package "sm64coopdx-switch-N3DS" {
package "tools/audiofile/audiofile.cpp" as F0 {
class "_AFfilehandle" as T0_0 {
  copyTracksFromSetup()
  copyInstrumentsFromSetup()
  copyMiscellaneousFromSetup()
  getVersion()
  readInit()
  writeInit()
}
class "AIFFFile" as T0_1 {
  recognizeAIFF()
  recognizeAIFFC()
  completeSetup()
  getVersion()
  readInit()
  writeInit()
}
class "WAVEFile" as T0_2 {
  recognize()
  completeSetup()
  readInit()
  writeInit()
  update()
  isInstrumentParameterValid()
}
class "Module" as T0_3 {
  setSink()
  setSource()
  inChunk()
  setInChunk()
  outChunk()
  setOutChunk()
}
class "ModuleState" as T0_4 {
  isDirty()
  setDirty()
  setup()
  reset()
  sync()
  numModules()
}
}
package "src/pc/utils/json.hpp" as F1 {
class "binary_writer" as T1_0 {
  write_bson()
  write_cbor()
  write_msgpack()
  write_ubjson()
  calc_bson_entry_header_size()
  write_bson_entry_header()
}
class "binary_reader" as T1_1 {
  parse_bson_internal()
  get_bson_cstr()
  parse_bson_element_internal()
  parse_bson_element_list()
  parse_bson_array()
  parse_cbor_internal()
}
class "json_sax_dom_callback_parser" as T1_2 {
  null()
  boolean()
  number_integer()
  number_unsigned()
  number_float()
  string()
}
}
package "tools/asm_processor/asm-processor.py" as F2 {
class "Section" as T2_0 {
  from_parts()
  lookup_str()
  add_str()
  is_rel()
  header_to_bin()
  late_init()
}
}
package "data/dynos.cpp.h" as F3 {
class "String" as T3_0 {
  Add()
  Remove()
  RemoveAll()
  Clear()
  Find()
  FindLast()
}
}
package "tools/switch/coopnet_identity.py" as F4 {
class "NroAssetInfo" as T4_0 {
  nro_size
  aset_offset
  icon_offset
  icon_size
  icon_sha256
}
}
package "include/types.h" as F5 {
class "AnimInfo" as T5_0 {
  curAnim
  prevAnimPtr
  animID
  prevAnimID
  animFrame
  prevAnimFrame
  prevAnimFrameTimestamp
  animFrameAccelAssist
}
class "Animation" as T5_1 {
  flags
  animYTransDivisor
  startFrame
  loopStart
  loopEnd
  unusedBoneCount
  values
  index
}
class "AnimationTable" as T5_2 {
  count
  anims
  _guard1
  prev
  next
  parent
  children
  georef
}
class "Controller" as T5_3 {
  port
  stickX
  stickY
  stickMag
  rawStickX
  rawStickY
  extStickX
  extStickY
}
}
package "src/game/hardcoded.h" as F6 {
class "BehaviorDialogs" as T6_0 {
  BobombBuddyBob1Dialog
  BobombBuddyBob2Dialog
  BobombBuddyOther1Dialog
  BobombBuddyOther2Dialog
  Bowser1DefeatedDialog
  Bowser1Dialog
  Bowser2DefeatedDialog
  Bowser2Dialog
}
class "BehaviorTrajectories" as T6_1 {
  KoopaBobTrajectory
  KoopaThiTrajectory
  UnagiTrajectory
  Unagi2Trajectory
  SnowmanHeadTrajectory
  RacingPenguinTrajectory
  BowlingBallBobTrajectory
  BowlingBallBob2Trajectory
}
class "BehaviorValues" as T6_2 {
  KoopaBobAgility
  KoopaCatchupAgility
  KoopaThiAgility
  RacingPenguinBigHeight
  RacingPenguinBigRadius
  RacingPenguinHeight
  RacingPenguinRadius
  ToadStar1Requirement
}
}
package "src/game/ingame_menu.c" as F7 {
class "CachedChar" as T7_0 {
  sDialogOffsetPos
  sDialogRotationPos
  sDialogZoomPos
  sDialogOffset
  sDialogOffsetPrev
  sDialogScale
  sDialogScalePrev
  sDialogRotation
}
}
package "src/game/camera.h" as F8 {
class "CameraTrigger" as T8_0 {
  area
  event
  centerX
  centerY
  centerZ
  boundsX
  boundsY
  boundsZ
}
}
package "src/game/object_helpers.h" as F9 {
class "ChainSegment" as T9_0 {
  posX
  posY
  posZ
  pitch
  yaw
  roll
  flags
  model
}
}
package "src/game/characters.h" as F10 {
class "Character" as T10_0 {
  type
  name
  hudHead
  hudHeadTexture
  cameraHudHead
  modelId
  capModelId
  capMetalModelId
}
}
package "src/game/level_update.h" as F11 {
class "CreditsEntry" as T11_0 {
  gCurrCreditsEntry
  gMarioStates
  gMarioState
  sCurrPlayMode
  sTransitionTimer
  gChangeLevel
  gChangeActNum
  gDelayedInitSound
}
}
package "src/game/game_init.h" as F12 {
class "DemoInput" as T12_0 {
  timer
  rawStickX
  rawStickY
  buttonMask
  gControllers
  gControllerStatuses
  gControllerPads
  gGameVblankQueue
}
}
}
@enduml

7.3. Data flow

The calls from the GitDiagram graph, in the order you meet them from the entry points. GitDiagram generates the graph with AI; the file paths it cites were checked against the repository tree.

Mermaid Sequence diagram
sequenceDiagram
  autonumber
  participant P0 as Window Manager
  participant P1 as Controller Input
  participant P2 as Switch Backend
  participant P3 as DJUI
  participant P4 as Rendering
  participant P5 as New 3DS Backend
  participant P6 as Character Assets
  participant P7 as ROM Asset Loading
  participant P8 as Level Content
  participant P9 as Gameplay World
  participant P10 as Player
  participant P11 as Game Runtime
  participant P12 as Game Configuration
  participant P13 as Lighting Engine
  participant P14 as Multiplayer Sync
  participant P15 as Game Initialization
  P0->>P1: dispatches keyboard events
  P2->>P3: opens text entry
  P2->>P4: selects backend
  P5->>P3: handles text entry
  P5->>P4: owns frame lifecycle
  P6->>P7: queues assets
  P8--)P9: defines levels
  P10->>P1: provides input
  P1->>P11: feeds controls
  P1->>P12: reads bindings
  P1->>P3: notifies interactables
  P4--)P13: uses lighting
  P9--)P14: synchronizes world
  P9--)P4: presents
  P11->>P15: initializes
  P11--)P9: updates
Steps as text
  1. Window Manager to Controller Input dispatches keyboard events
  2. Switch Backend to DJUI opens text entry
  3. Switch Backend to Rendering selects backend
  4. New 3DS Backend to DJUI handles text entry
  5. New 3DS Backend to Rendering owns frame lifecycle
  6. Character Assets to ROM Asset Loading queues assets
  7. Level Content to Gameplay World defines levels
  8. Player to Controller Input provides input
  9. Controller Input to Game Runtime feeds controls
  10. Controller Input to Game Configuration reads bindings
  11. Controller Input to DJUI notifies interactables
  12. Rendering to Lighting Engine uses lighting
  13. Gameplay World to Multiplayer Sync synchronizes world
  14. Gameplay World to Rendering presents
  15. Game Runtime to Game Initialization initializes
  16. Game Runtime to Gameplay World updates
  17. Game Runtime to Audio Runtime coordinates audio
  18. Game Runtime to ROM Asset Loading loads assets
  19. Multiplayer Sync to CoopNet supports online play
  20. Multiplayer Sync to Local Wireless supports local play
  21. Lua Mod API to Mod Storage reads and writes
  22. Mod Storage to Lua Mod API returns values
  23. Mod Storage to Game Configuration uses filesystem settings

7.4. Public interface

Outside code can use everything listed here. The project also declares 914 public types.

Command line 32

Entry points

Public headers 88

include/GL/eglew.h include/GL/glew.h include/GL/glxew.h include/GL/wglew.h include/PR/abi.h include/PR/gbi.h include/PR/gbi_extension.h include/PR/gs2dex.h include/PR/gu.h include/PR/libaudio.h

7.5. Private interface

These names are internal by the language’s conventions: a leading underscore, private, static or pub(crate).

static (file-local) function
3775
anonymous namespace
3
underscore helper
1

7.6. Services

7.7. Entities and data model 762

Mermaid Entity class diagram
classDiagram
  direction LR
  class E0["NroAssetInfo"] {
    +int nro_size
    +int aset_offset
    +int icon_offset
    +int icon_size
    +str icon_sha256
  }
  class E1["AnimInfo"] {
    +struct curAnim
    +struct prevAnimPtr
    +s16 animID
    +s16 prevAnimID
    +s16 animFrame
    +s16 prevAnimFrame
  }
  class E2["Animation"] {
    +s16 flags
    +s16 animYTransDivisor
    +s16 startFrame
    +s16 loopStart
    +s16 loopEnd
    +s16 unusedBoneCount
  }
  class E3["AnimationTable"] {
    +u32 count
    +struct anims
    +uintptr_t _guard1
    +struct prev
    +struct next
    +struct parent
  }
  class E4["BehaviorDialogs"] {
    +enum BobombBuddyBob1Dialog
    +enum BobombBuddyBob2Dialog
    +enum BobombBuddyOther1Dialog
    +enum BobombBuddyOther2Dialog
    +enum Bowser1DefeatedDialog
    +enum Bowser1Dialog
  }
  class E5["BehaviorTrajectories"] {
    +Trajectory KoopaBobTrajectory
    +Trajectory KoopaThiTrajectory
    +Trajectory UnagiTrajectory
    +Trajectory Unagi2Trajectory
    +Trajectory SnowmanHeadTrajectory
    +Trajectory RacingPenguinTrajectory
  }
  class E6["BehaviorValues"] {
    +f32 KoopaBobAgility
    +f32 KoopaCatchupAgility
    +f32 KoopaThiAgility
    +f32 RacingPenguinBigHeight
    +f32 RacingPenguinBigRadius
    +f32 RacingPenguinHeight
  }
  class E7["CachedChar"] {
    +static sDialogOffsetPos
    +static sDialogRotationPos
    +static sDialogZoomPos
    +static sDialogOffset
    +static sDialogOffsetPrev
    +static sDialogScale
  }
  class E8["CameraTrigger"] {
    +s8 area
    +CameraEvent event
    +s16 centerX
    +s16 centerY
    +s16 centerZ
    +s16 boundsX
  }
  class E9["ChainSegment"] {
    +f32 posX
    +f32 posY
    +f32 posZ
    +s16 pitch
    +s16 yaw
    +s16 roll
  }
  E1 --> E2 : curAnim
  E1 --> E2 : prevAnimPtr
  E3 --> E2 : anims

An arrow links a field to the entity its type names.

EntityKindFirst fields
NroAssetInfoRecord or interfacenro_size, aset_offset, icon_offset, icon_size, icon_sha256
AnimInfoData structcurAnim, prevAnimPtr, animID, prevAnimID, animFrame, prevAnimFrame, prevAnimFrameTimestamp, animFrameAccelAssist
AnimationData structflags, animYTransDivisor, startFrame, loopStart, loopEnd, unusedBoneCount, values, index
AnimationTableData structcount, anims, _guard1, prev, next, parent, children, georef
BehaviorDialogsData structBobombBuddyBob1Dialog, BobombBuddyBob2Dialog, BobombBuddyOther1Dialog, BobombBuddyOther2Dialog, Bowser1DefeatedDialog, Bowser1Dialog, Bowser2DefeatedDialog, Bowser2Dialog
BehaviorTrajectoriesData structKoopaBobTrajectory, KoopaThiTrajectory, UnagiTrajectory, Unagi2Trajectory, SnowmanHeadTrajectory, RacingPenguinTrajectory, BowlingBallBobTrajectory, BowlingBallBob2Trajectory
BehaviorValuesData structKoopaBobAgility, KoopaCatchupAgility, KoopaThiAgility, RacingPenguinBigHeight, RacingPenguinBigRadius, RacingPenguinHeight, RacingPenguinRadius, ToadStar1Requirement
CachedCharData structsDialogOffsetPos, sDialogRotationPos, sDialogZoomPos, sDialogOffset, sDialogOffsetPrev, sDialogScale, sDialogScalePrev, sDialogRotation
Show 6 more entities
CameraTriggerData structarea, event, centerX, centerY, centerZ, boundsX, boundsY, boundsZ
ChainSegmentData structposX, posY, posZ, pitch, yaw, roll, flags, model
CharacterData structtype, name, hudHead, hudHeadTexture, cameraHudHead, modelId, capModelId, capMetalModelId
ControllerData structport, stickX, stickY, stickMag, rawStickX, rawStickY, extStickX, extStickY
CreditsEntryData structgCurrCreditsEntry, gMarioStates, gMarioState, sCurrPlayMode, sTransitionTimer, gChangeLevel, gChangeActNum, gDelayedInitSound
DemoInputData structtimer, rawStickX, rawStickY, buttonMask, gControllers, gControllerStatuses, gControllerPads, gGameVblankQueue

7.8. Business logic

Once UI code and the services and entities above are set aside, these classes have the most methods.

_AFfilehandle Entry points and API, 34 methods
copyTracksFromSetup, copyInstrumentsFromSetup, copyMiscellaneousFromSetup, getVersion, readInit, writeInit
binary_writer Core source, 30 methods
write_bson, write_cbor, write_msgpack, write_ubjson, calc_bson_entry_header_size, write_bson_entry_header
AIFFFile Entry points and API, 27 methods
recognizeAIFF, recognizeAIFFC, completeSetup, getVersion, readInit, writeInit
WAVEFile Entry points and API, 27 methods
recognize, completeSetup, readInit, writeInit, update, isInstrumentParameterValid
binary_reader Core source, 26 methods
parse_bson_internal, get_bson_cstr, parse_bson_element_internal, parse_bson_element_list, parse_bson_array, parse_cbor_internal
json_sax_dom_callback_parser Core source, 13 methods
null, boolean, number_integer, number_unsigned, number_float, string
Section Entry points and API, 12 methods
from_parts, lookup_str, add_str, is_rel, header_to_bin, late_init
Module Entry points and API, 17 methods
setSink, setSource, inChunk, setInChunk, outChunk, setOutChunk
ModuleState Entry points and API, 16 methods
isDirty, setDirty, setup, reset, sync, numModules
String Data and infrastructure, 15 methods
Add, Remove, RemoveAll, Clear, Find, FindLast

7.9. Database and persistence

Tables and collections 2

for of

7.10. External integrations

HTTP clients

libcurl

Hosts named in the code

7.11. CI/CD pipeline

6 GitHub Actions workflows, 9 jobs. Each box is a job; double-bordered boxes publish or deploy, and arrows follow needs.

Mermaid Pipeline flow
flowchart LR
  subgraph wf0["Build New 3DS CoopNet"]
    direction LR
    wf0_build_new3ds_coopnet[["devkitARM / CoopNet compile-only<br/>ubuntu-latest"]]
  end
  subgraph wf1["Build New 3DS Port"]
    direction LR
    wf1_build_new3ds_shell[["devkitARM / shell + platform smoke<br/>ubuntu-latest"]]
    wf1_build_new3ds_integration["devkitARM / shared integration compile<br/>ubuntu-latest"]
    wf1_build_new3ds_game["devkitARM / full CoopDX .3dsx + CIA<br/>ubuntu-latest"]
  end
  subgraph wf2["Switch CoopNet Full NRO"]
    direction LR
    wf2_full_nro["Full Horizon CoopNet NRO<br/>ubuntu-latest"]
  end
  subgraph wf3["Switch CoopNet Port CI"]
    direction LR
    wf3_coopnet_portability["CoopNet Horizon portability<br/>ubuntu-latest"]
  end
  subgraph wf4["Switch CI"]
    direction LR
    wf4_portability[["Horizon portability gates<br/>ubuntu-latest"]]
    wf4_full_nro["Full Horizon game NRO<br/>ubuntu-latest"]
  end
  subgraph wf5["Switch crash logger CI"]
    direction LR
    wf5_compile["compile<br/>ubuntu-latest"]
  end
  t0(["manual run"])
  t1(["push · pull request · manual run"])
  t2(["push · manual run"])
  t0 --> wf0_build_new3ds_coopnet
  t1 --> wf1_build_new3ds_shell
  wf1_build_new3ds_shell --> wf1_build_new3ds_integration
  wf1_build_new3ds_integration --> wf1_build_new3ds_game
  t2 --> wf2_full_nro
  t1 --> wf3_coopnet_portability
  t1 --> wf4_portability
  wf4_portability --> wf4_full_nro
  t1 --> wf5_compile
Workflows, triggers, jobs and targets
WorkflowTriggersJobsPublishes to
Build New 3DS CoopNet
.github/workflows/build-new3ds-coopnet.yml
manual run
  • devkitARM / CoopNet compile-only ubuntu-latest
    Checkout · Install 3DS libraries · Add devkitARM to PATH · Build libjuice and CoopNet for New 3DS · Compile integration smoke with CoopNet enabled · Upload CoopNet dependency artifacts
—
Build New 3DS Port
.github/workflows/build-new3ds.yml
push, pull request, manual run
  • devkitARM / shell + platform smoke ubuntu-latest
    Checkout · Install 3DS libraries · Add devkitARM to PATH · Cross-compile New 3DS shell and platform smoke · Upload New 3DS shell artifacts
  • devkitARM / shared integration compile ← build-new3ds-shell ubuntu-latest
    Checkout · Install 3DS libraries · Add devkitARM to PATH · Run New 3DS hardware stability regressions · Compile shared engine + DynOS integration objects
  • devkitARM / full CoopDX .3dsx + CIA ← build-new3ds-integration ubuntu-latest
    Checkout · Install required 3DS portlibs · Add devkitARM to PATH · Detect private baserom source · Fetch and verify private US baserom · Build full New 3DS application
—
Switch CoopNet Full NRO
.github/workflows/build-switch-coopnet-full.yml
push, manual run
  • Full Horizon CoopNet NRO ubuntu-latest
    Checkout · Add devkitA64 to PATH · Install asset pipeline dependencies · Detect private baserom source · Fetch and verify private US baserom · Enable Switch-only size optimization
—
Switch CoopNet Port CI
.github/workflows/build-switch-coopnet.yml
push, pull request, manual run
  • CoopNet Horizon portability ubuntu-latest
    Checkout · Add devkitA64 to PATH · Report toolchain · Cross-build libjuice 1.6.2 · Link standalone libjuice ICE probe · Cross-build CoopNet
—
Switch CI
.github/workflows/build-switch-game.yml
push, pull request, manual run
  • Horizon portability gates ubuntu-latest
    Checkout · Add devkitA64 to PATH · Run Switch portability gates · Validate probe outputs · Upload portability diagnostics
  • Full Horizon game NRO ← portability ubuntu-latest
    Checkout · Add devkitA64 to PATH · Install asset pipeline dependencies · Detect private baserom source · Fetch and verify private US baserom · Build full Switch NRO
—
Switch crash logger CI
.github/workflows/switch-crash-logging.yml
push, pull request, manual run
  • compile ubuntu-latest
    Checkout · Add devkitA64 to PATH · Validate Switch toolchain · Validate ROM asset overlay generation · Cross-compile fixed ROM-present path · Validate SD layout target
—

7.12. Deployment

Mermaid Deployment diagram
flowchart LR
  repo[("GitHub repository")]
  ci[["GitHub Actions<br/>6 workflows"]]
  image["Docker image<br/>FROM ubuntu:jammy"]
  subgraph compose["Docker Compose"]
    svc_new3ds_shell["new3ds-shell"]
    svc_new3ds_integration["new3ds-integration"]
    svc_new3ds_full_3dsx["new3ds-full-3dsx"]
    svc_switch_portability["switch-portability"]
    svc_switch_full_nro["switch-full-nro"]
  end
  repo -->|"push or pull request"| ci
  ci -->|"docker build"| image
  image -->|"docker compose up"| compose
UML Deployment
Deployment

The outer node is where the code runs. Each base image points to what it builds, solid arrows lead to databases and dashed ones to outside services. Rendered with uml-mcp.

PlantUML source
@startuml
skinparam backgroundColor transparent
skinparam shadowing false
skinparam roundCorner 10
skinparam defaultFontName Arial
skinparam defaultFontSize 13
skinparam ArrowColor #4e6070
skinparam ArrowFontColor #3d4f5f
skinparam titleFontSize 14
skinparam actorBorderColor #006a62
skinparam actorBackgroundColor #e9f3f4
skinparam usecaseBorderColor #006a62
skinparam usecaseBackgroundColor #e9f3f4
skinparam componentBorderColor #006a62
skinparam componentBackgroundColor #e9f3f4
skinparam interfaceBorderColor #006a62
skinparam interfaceBackgroundColor #ffffff
skinparam nodeBorderColor #4e6070
skinparam nodeBackgroundColor #f4f8fb
skinparam databaseBorderColor #006a62
skinparam databaseBackgroundColor #ffffff
skinparam cloudBorderColor #4e6070
skinparam cloudBackgroundColor #f0f5fa
skinparam artifactBorderColor #006a62
skinparam artifactBackgroundColor #ffffff
skinparam rectangleBorderColor #b0c2d3
skinparam activityBorderColor #006a62
skinparam activityBackgroundColor #e9f3f4
skinparam partitionBorderColor #b0c2d3
skinparam stereotypeCBackgroundColor #ffffff
node "Docker Compose" as H {
  node "new3ds-shell" as N0 <<container>>
  node "new3ds-integration" as N1 <<container>>
  node "new3ds-full-3dsx" as N2 <<container>>
  node "switch-portability" as N3 <<container>>
  node "switch-full-nro" as N4 <<container>>
}
artifact "FROM ubuntu:jammy" as IMG0
IMG0 ..> N0 : builds
artifact "FROM devkitpro/devkitarm:latest" as IMG1
IMG1 ..> N0 : builds
artifact "FROM devkitpro/devkita64:latest" as IMG2
IMG2 ..> N0 : builds
cloud "Console network stack (libnx/…" as E0
N0 ..> E0
cloud "Open data portal (CKAN)" as E1
N0 ..> E1
@enduml

Where it runs

Compose services

new3ds-shell new3ds-integration new3ds-full-3dsx switch-portability switch-full-nro

Docker base images

ubuntu:jammy devkitpro/devkitarm:latest devkitpro/devkita64:latest

7.13. Security

Environment variables 3

The page lists names without their values and underlines the ones that look like secrets.

LINENOISE_ASSUME_TTY LINENOISE_COLS TERM

7.14. Testing

Test files
11
Source files
3711
Test cases, about
33
Unit tests
11

No measured coverage report in the analyzed sources.

Where the tests are

tools/switch/tests 10 tools/new3ds/tests 1

Nothing found for: Stack and dependencies, Monitoring.

8. Types and file structure

938 declared types, with 12 in the base-relationship overview.

Type diagram
classDiagram
direction TB
class td46db2c67d89["SwitchMainThreadContext"] {
  <<struct>>
}
class t8aa16fcaf4e8["BehaviorTableEntry"] {
  <<struct>>
}
class t967c531c3987["BinFile"] {
  Grow()
  Size()
  Offset()
  EoF()
}
class t600bad59e95a["Array"] {
  Array()
  Resize()
  Add()
  Remove()
}
class t0f95fccc28fc["String"] {
  String()
  Add()
  Remove()
  RemoveAll()
}
class t86e8898abb40["NoCopy"] {
  NoCopy()
}
class t5781fa224570["TexData"] {
  <<struct>>
}
class t2525940954f7["AnimData"] {
  <<struct>>
}
class t47b9608239dd["DataNode"] {
  <<struct>>
}
class tdd2833761514["DataNodes"] {
  Find()
  FindExact()
}
class ta18b7a1fb439["GfxContext"] {
  <<struct>>
}
class t4d433eaff897["GfxData"] {
  <<struct>>
}
t86e8898abb40 <|-- t5781fa224570
t86e8898abb40 <|-- t2525940954f7
t86e8898abb40 <|-- t47b9608239dd
t86e8898abb40 <|-- t4d433eaff897

Unresolved bases remain labelled; full signatures are not reconstructed.

9. Reference

3589 / 3589 eligible files read (4720 in the tree); 0 oversized, 0 failed reads and 509 syntax diagnostics.

What the scan covers

Known dependency/build folders, credential files and binaries are excluded. The scan covers READMEs, recognized manifests and parser-supported source files.

Linguist statistics cover the whole repository and may include other languages.

11. Files to read 3

12. Glossary

Repository

The versioned source files, configuration, and history of a project.

README

The repository’s entry document, usually covering its purpose and initial setup.

Dependency

A library, tool, or service that another component needs to build or run.

HTTP

A request-and-response protocol used by browsers and web services. A method, path, headers, and optional body describe a request.

Session

State kept across related requests, often to track a signed-in user. Authentication and permission checks remain separate concerns.

Container

An isolated process environment created from an image. Persistent data needs storage outside the container’s disposable filesystem.

Published port

A host port mapped to a service’s container port. Publishing a port can expose that service beyond its container network.

CLI

A text interface in which commands and arguments select operations. Exit codes let scripts detect success or failure.

Build

The steps that turn source files and dependencies into a runnable program or distributable artifact.

GPU

A processor designed for parallel workloads, including graphics rendering and many numerical operations.

Shader

A program executed at a stage of a graphics or compute pipeline, for example to transform vertices or calculate pixel colors.

Backend

An implementation behind a shared interface. Depending on context, it can mean a server-side service or a graphics, input, or storage implementation.

Firmware

Software running on a device or microcontroller to control its hardware and communication.

Fork

A separate repository derived from another project. A change in a fork is not automatically a change in the upstream project.

13. References

  1. antoinebou12. (2026, November 5). sm64coopdx-switch-N3DS. [Software repository] github.com.
  2. antoinebou12. (2026, November 5). sm64coopdx-switch-N3DS: README. [Repository documentation] github.com.
  3. antoinebou12. (2026, November 5). Makefile.switch-platform. [Source file] github.com.
  4. antoinebou12. (2026, November 5). src/pc/platform/switch/switch_platform.c. [Source file] github.com.
  5. antoinebou12. (2026, November 5). Makefile.new3ds. [Source file] github.com.
  6. Boucher, A. (2026, September 2). Handheld streaming and homebrew — Artemis-Switch, moonlight-N3DS, sm64coopdx-switch. [Project article] antoineboucher.info.
  7. Boucher, A. (2026, October 20). Porting sm64coopdx to Switch and New 3DS: keep the platform boundary small. [Project article] antoineboucher.info.
  8. Boucher, A. (2026, October 23). sm64coopdx-switch-N3DS: Keeping a port behind platform interfaces. [Project article] antoineboucher.info.
  9. Boucher, A. (2026, September 2). sm64coopdx-switch. [Project article] antoineboucher.info.

Sources without a publication date show the date they were last checked, November 5, 2026. File links retain the inspected revision where available.