Skip to content

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
  • 3
  • C · 82.89%
Upstream credited
Repository languagesC 82.89%13

Shares calculated from GitHub Linguist 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

GitHub · README · Language statistics

Overview

Why it exists

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

Best fit

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

Getting started

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

Repository references

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

Prerequisites and first run

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 ↗

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

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 ↗

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.

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.

Architecture

The components and their connections remain available as text. The diagram adds an interactive view.

System context Context
  1. Shared game and co-op code
  2. Platform interfaces
  3. Graphics backend
  4. Controller and audio backends
  5. Console runtime

Links verified in the repository.

Mermaid Interactive diagram (loads on open)

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

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_mods["Mods and UI"]
  node_lua["Lua Mod API"]
  node_mod_storage[("Mod Storage<br/>[mod_storage.cpp]")]
  node_djui["DJUI"]
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(("Player"))

node_player -->|"provides input"| node_controller
node_controller -->|"feeds controls"| node_game
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_controller -->|"notifies interactables"| node_djui
node_window -->|"dispatches keyboard events"| node_controller
node_switch_window -->|"opens text entry"| node_djui
node_new3ds_window -->|"handles text entry"| node_djui
node_switch_window -->|"selects backend"| node_render
node_new3ds_window -->|"owns frame lifecycle"| node_render


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
Links supported by code or README
13/23
Text version of the diagram
  • Shared game and co-op code → Platform interfaces
  • Platform interfaces → Graphics backend
  • Platform interfaces → Controller and audio backends
  • Graphics backend → Console runtime
  • Controller and audio backends → Console runtime
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.

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.

Type index

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.

File map
flowchart TD
  root["sm64coopdx-switch-N3DS"]
  f0["src/pc/platform/switch/switch_platform.c"]
  root --> f0
  f1["Makefile"]
  root --> f1
  f2["README.md"]
  root --> f2
  f3["extract_assets.py"]
  root --> f3
  f4["format.sh"]
  root --> f4
  f5["SDL2/SDL.h"]
  root --> f5
  f6["SDL2/SDL_opengl.h"]
  root --> f6
  f7["SDL2/SDL_opengles2.h"]
  root --> f7
  f8["actors/common0.c"]
  root --> f8
  f9["actors/common0.h"]
  root --> f9
  f10["actors/common0_geo.c"]
  root --> f10
  f11["actors/common1.c"]
  root --> f11
  f12["actors/common1.h"]
  root --> f12
  f13["actors/common1_geo.c"]
  root --> f13
  f14["actors/custom0.c"]
  root --> f14
  f15["actors/custom0.h"]
  root --> f15

Files to read 3

References