Building SM64 for Nintendo Switch from sm64ex-alo Repository

Hi, I hope the next steps help to somebody, first forgive my bad English, is no my native language.

After the project «n64decomp» finished lots of forks emerged. One of them is the SM 64 PC Port which have as aim to be a port of n64decomp for modern devices.

Some of these ports was for the Switch console and become real on the fork fgsfdsfgs that fork seems to be staled, Now @AloXado320 have resumed the work with the repository AloUltraExt and add some features and converged the latest code with latest refresh from the decomp project.

Switch Building Process

If you read the guide:

https://github.com/fgsfdsfgs/sm64pc/wiki/Compiling-for-Nintendo-Switch

The steps are loosely explained, but they don’t work well for me, so I decided read a lot of documentation and the official SM64 thread completely.

I choose to use for this set of instructions the MSYS environment, which for me is easy to setup and as it is an enclosed environment which is not affected by other software on your computer, I mainly use Windows, but as MINGW is a Cygwin environment I think the steps could be easy extrapolated to Linux environments.

First you need Install a MSYS environment:
The latest instructions for install the MSYS environment are on https://gbatemp.net/threads/install-msys-environment.652234/ if you don't have one working, use them.

After you have the MSYS environment working you need to install DevKitPro
For that you can follow the instructions on the tutorial https://gbatemp.net/threads/setup-a-devkitpro-environment-on-windows.652238/

Now you can start the building process:
First install the prerequisites


In a MinGW64 shell (or MinGW32 if you have a Windows 32 bit edition, why will you do today?). Be sure the prompt shows MINGW64 or MINGW32 if not you started the wrong shell, close it and open the right one.
a.png
b.png


Please execute the next command, several times until you get the message "there is nothing to do", you can be asked to restarts the MINGW64 environment few times:
pacman -Syuu --needed --noconfirm

Then execute the next commands:

Code:
pacman -Syuu --needed --noconfirm base-devel git make mercurial python3 subversion unzip autoconf automake libtool pkg-config autoconf-wrapper mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-glew mingw-w64-x86_64-SDL2 mingw-w64-x86_64-toolchain mingw-w64-x86_64-SDL switch-dev devkitA64 dkp-toolchain-vars libnx switch-tools switch-mesa switch-libdrm_nouveau switch-sdl2

Once the installation end, verify the MSYS2 database again:

pacman -Syuu --needed --noconfirm

Clone the repository, using the --recursive option in order to clone all the trees.

Code:
cd ~/
git clone --recursive https://github.com/AloUltraExt/sm64ex-alo

The repository is cloned to a subfolder of the "Home" directory of MinGWXX Shell, on the prompt "~" means your home directory.

You need copy a legal copy of the original ROM in the cloned directory, it must be in "Big Endian" format.

For each version (jp/us/eu/sh) for which you want to build an executable, put an existing ROM at ./baserom.<VERSION>.z64 for asset extraction.

By example, for US version:
./baserom.us.z64
that file should have this Checksums:
MD5: 20b854b239203baf6c961b850a4a51a2 *baserom.us.z64
SHA: 9bef1128717f958171a4afac3ed78ee2bb4e86ce *baserom.us.z64
SHA256: 17ce077343c6133f8c9f2d6d6d9a4ab62c8cd2aa57c40aea1f490b4c8bb21d91 *baserom.us.z64

copy the file to the path c:\msys64\home\<USERNAME>\sm64ex-alo

If your ROM isn't on Big Endian format, use https://hack64.net/tools/swapper.php to convert it.

Now the environment is ready to build Switch version using any combination of the options you like, by example:
Code:
cd ~/sm64ex-alo
make TARGET_SWITCH=1 BETTERCAMERA=1 NODRAWINGDISTANCE=1 TEXTURE_FIX=1 HIGH_FPS_PC=1

Will activate a better camera handling, enable the drawing of far objects on the game, Fixes some texture related bugs (by example smoke), AND 60 FPS patch.
sadly the actual repo is not so compatible with multiple cores, so please do not use -j parameter.
After the process ends the NRO is on the build subfolder.
Code:
Build succeeded.
==== Build Details ====
File:           build/us_nx/sm64.us.f3dex2e.nro
Version:        us
Target:         Nintendo Switch



Additional Note: For Build Windows version you can run the command without the TARGET_SWITCH=1 parameter.

BUILD OPTIONS
Build optionDefaultPossible valuesDescription
AUDIO_APISDL2SDL2Select audio backend. There's only one right now.
BETTERCAMERA00, 1If 1, build with analog camera support (uses Puppycam).
CHEATS_ACTIONS10, 1Enable cheats
COMMAND_LINE_OPTIONS10, 1Enable Command Line Options
CONTROLLER_APISDL2SDL2Specify list of controller backends to use. There's only one right now.
DEBUG00, 1If 1, build with debug symbols and default optimization level. Otherwise build with -O2. 1 simple debug compile, 2 max debug compile
DISCORDRPC00, 1If 1, enable Discord Rich Presence support. Only works on x86_64.
DISCORDRPC00, 1Enable Discord Rich Presence
EXT_DEBUG_MENU00, 1Menú para opciones de depuración simples
EXT_OPTIONS_MENU10, 1If 1, enable Options menu. Accessed from the Pause menu by pressing R.
EXTENDED_BOUNDS00, 1Enable extended bounds
EXTERNAL_DATA00, 1If 1, load textures and soundbanks from external files. Allows you to use texture packs. The default data is copied to a res folder next to the produced executable. (En Switch va en la carpeta raíz), para PC no lo genera
GODDARD_MFACE10, 1Enable Goddard (Mario Face)
HIGH_FPS_PC00, 1Enable 60 fps interpolation
MOUSE_ACTIONS00, 1Soporte para el ratón para versiones de escritorio, solo funciona en modos SDL, se está trabajando aún en el modo DirectX.
NODRAWINGDISTANCE00, 1If 1, build with disabled draw distance (every object is active at all times). May affect gameplay.
OSX_BUILD00, 1If 1, build for OSX.
PORT_MOP_OBJS00, 1Parche de más objetos creado por Kaze
PORT_MOP_OBJS00, 1Kaze MOP Objects Port, disabled by default
QOL_FEATURES00, 1Mejora de Características
QOL_FIXES00, 1Mejoras de Calidad de vida
QOL_REDONE10, 1Quality of life redone files
RENDER_APIGLGL, GL_LEGACY, D3D11, D3D12Select rendering backend to use. GL corresponds to OpenGL 2.1 (gfx_opengl.c), GL_LEGACY corresponds to OpenGL 1.3 (gfx_opengl_legacy.c). Direct3D backends will also force WINDOW_API to DXGI.
RM2C00, 1Accept RM2C level folder output https://github.com/AloXado320/rom-manager-2-c
RUMBLE_FEEDBACK10, 1Enable rumble functions (Originally in Shindou)
TARGET_BITS32, 64,TARGET_BITS=n appends some compiler flags for an n-bit build. If the value is empty, the option does nothing, assuming your native toolchain will set everything up by itself. Use this only if you're having trouble otherwise.
TARGET_RPI00, 1If 1, select optimal settings for Raspberry PI hardware. See the main article (https://github.com/sm64pc/sm64pc/wiki/Helper-compiling-script-for-Raspberry-Pi) on that.
TARGET_WEB00, 1If 1, build Emscripten version. See the main article (https://github.com/sm64pc/sm64pc/wiki/Compiling-for-the-web) on that.
TEXTSAVES00, 1If 1, use INI-based save format instead of binary EEPROM dumps. Experimental.
TEXTURE_FIX00, 1If 1, enable various texture-related bugfixes (e.g. fixes the smoke texture).
VANILLA_CHECKS10, 1Enable level vanilla checks
VERSIONusus, eu, jp, shWhich ROM to use. The selected ROM has to be in the repo folder with the name baserom.$VERSION.z64. sh is currently broken.
WINDOW_APISDL2SDL2, DXGISelect windowing backend. GL renderers force SDL2 and D3D renderers force DXGI for now, so you don't need to specify this.
WINDOWS_BUILD0, 1If 1, build for Windows. Usually set automatically if building on Windows.
WINDOWS_CONSOLE00, 1If 1, append -mconsole to Windows CFLAGS, making a console window appear while the game is running. Can be useful for debugging purposes.

Use nsp-forwarder.n8.io to create a customized Forwarder. Now supporting Atmosphère > 1.8.0


Troubleshooting
  • If you get the error gcc: command not found or make: gcc: No such file or directory you did not install all needed packages or run the wrong Shell, be sure of running «MINGW32» or «MINGW64» and what that is pointed on the prompt in purple.
  • If the ROM is missing or wrong format/version you get the error Failed to open baserom.us.z64! Verify the correct ROM at the c:\msys64\home\<username>\sm64ex-alo folder.
  • If you get the error make: *** No targets specified and no makefile found. Stop. You are on the wrong folder the last make command should be run from c:\msys64\home\<username>\sm64ex folder.
  • Be sure of get the responses Target: i686-w64-mingw32 or Target: x86_64-w64-mingw32 when you run the command gcc -v if else other is shown on screen you install the wrong gcc package or you are on the «MSYS» shell, remember the process should be run on «MINGW32» or «MINGW64» shells.
 
Last edited by impeeza,

JLJ9

New Member
Newbie
Joined
Apr 12, 2024
Messages
2
Trophies
0
Age
22
XP
19
Country
United States
Having a problem right during build, unsure what is causing it. Followed all steps to a T.

Traceback (most recent call last):
File "C:/msys64/home/livin/sm64ex-alo/extract_assets.py", line 301, in <module>
main() if __name__ == "__main__" else None
^^^^^^
File "C:/msys64/home/livin/sm64ex-alo/extract_assets.py", line 243, in main
subprocess.run(
File "C:/msys64/mingw64/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:/msys64/mingw64/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:/msys64/mingw64/lib/python3.11/subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Makefile:430: *** Failed to extract assets from US ROM. Stop.

Rom is correct, setup environment correctly, even tried running MSYS2 MINGW64 as admin and repeated steps again to see if that could be a potential issue.

gonna delete everything, and reinstall MSYS2 and devkit again aswell, I installed devkit through MYSYS2 gonna try it through standalone as it wasnt working when following the previous tutorial.

If anybody can please help, if I come to a resolution I will update.
 

Attachments

  • Screenshot (1).png
    Screenshot (1).png
    51.1 KB · Views: 59

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
8,215
Trophies
4
Age
46
Location
At my chair.
XP
28,206
Country
Colombia
Having a problem right during build, unsure what is causing it. Followed all steps to a T.

Traceback (most recent call last):
File "C:/msys64/home/livin/sm64ex-alo/extract_assets.py", line 301, in <module>
main() if __name__ == "__main__" else None
^^^^^^
File "C:/msys64/home/livin/sm64ex-alo/extract_assets.py", line 243, in main
subprocess.run(
File "C:/msys64/mingw64/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:/msys64/mingw64/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:/msys64/mingw64/lib/python3.11/subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Makefile:430: *** Failed to extract assets from US ROM. Stop.

Rom is correct, setup environment correctly, even tried running MSYS2 MINGW64 as admin and repeated steps again to see if that could be a potential issue.

gonna delete everything, and reinstall MSYS2 and devkit again aswell, I installed devkit through MYSYS2 gonna try it through standalone as it wasnt working when following the previous tutorial.

If anybody can please help, if I come to a resolution I will update.
You are missing the step where you need to copy a legally aquiered ROM to the repo folder:
You need copy a legal copy of the original ROM in the cloned directory, it must be in "Big Endian" formatted and called:

./baserom.us.z64

copy the file to the path c:\msys64\home\<USERNAME>\sm64ex-alo

If your ROM isn't on Big Endian format, use https://hack64.net/tools/swapper.php to convert it.

You must be sure the $PATH variable include the mingwXX binaries.
Post automatically merged:

I forgot to put the checksum of the needed ROMs:

sm64.us.z64 sha1: 9bef1128717f958171a4afac3ed78ee2bb4e86ce
sha256: 17ce077343c6133f8c9f2d6d6d9a4ab62c8cd2aa57c40aea1f490b4c8bb21d91
MD5: 20b854b239203baf6c961b850a4a51a2


sm64.jp.z64 sha1: 8a20a5c83d6ceb0f0506cfc9fa20d8f438cafe51
sm64.eu.z64 sha1: 4ac5721683d0e0b6bbb561b58a71740845dceea9
 
Last edited by impeeza,

JLJ9

New Member
Newbie
Joined
Apr 12, 2024
Messages
2
Trophies
0
Age
22
XP
19
Country
United States
so i pulled out the ol' cartridge dumper and im still not understanding why there is a bug extracting my official, legal, super legit, cartridge dumped right from warios house, waluigi's taco stand, super mario bros super show paisanos rom. It worked when creating a pc build,not understanding why it wouldnt work here, unfortunately I havent got the best of luck when it comes to doing things like these as the pc port took several tries to compile.

its okay though gonna just delete everything and try again as I dont know what could be the problem extracting the rom,mario gave it to me himself so im at a loss for words.


Sorry for my humor ,thank you for your help though.
 
  • Like
Reactions: impeeza

iamse7en

New Member
Newbie
Joined
Jul 1, 2024
Messages
1
Trophies
0
Age
44
XP
5
Country
United States
Do you know if it's possible to build the coop version for Switch? Preferably sm64coopdx (Coop Deluxe) version, but I'd even take original djoslin0 fork. Could I try it by following your guide, but then looking at their guide to build for Windows as well?
 

EmmaQF

Member
Newcomer
Joined
May 5, 2020
Messages
8
Trophies
0
Age
23
XP
107
Country
Brazil
Hey I wanna build the Mario 64 decompilation on switch but with the super Mario 64 plus mod and other cheats .I can’t find any tutorials on how to do that and if it’s even possible .Anyone can help me ? Just to be sure I'm not interest in links or ways to pirate the game this is not why I'm here
 
  • Like
Reactions: impeeza

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
8,215
Trophies
4
Age
46
Location
At my chair.
XP
28,206
Country
Colombia
Hey I wanna build the Mario 64 decompilation on switch but with the super Mario 64 plus mod and other cheats .I can’t find any tutorials on how to do that and if it’s even possible .Anyone can help me ? Just to be sure I'm not interest in links or ways to pirate the game this is not why I'm here
for now is not working, keep looking
 

impeeza

¡Kabito!
OP
Member
Joined
Apr 5, 2011
Messages
8,215
Trophies
4
Age
46
Location
At my chair.
XP
28,206
Country
Colombia
@treemandan @EmmaQF , Instructions has been updated thanks to @jnackmclain who create a PR on the sm64ex-alo repository with the changes needed to the code build with latest DevKitPro and LibNX.

you need you commit the PR#67 and now the code build again.


For now, as october 2024, the repository needs you commit a PR in order to be able to build Switch version, this PR update the includes and correct a function name to match some changes on LibNX and DevKitPro libraries, for that you need to run this commands:

Code:
git fetch origin pull/67/head
git checkout -b pullrequest FETCH_HEAD
 

Sticky94

New Member
Newbie
Joined
Oct 10, 2024
Messages
4
Trophies
0
Age
30
XP
34
Country
United States
Glad you guys are keeping the switch port alive! I'm here in need of help with this build tutorial. It seems that I'm getting same error as these guys even with the new commit. Made sure to follow everything thoroughly on a fresh window's install. (No worries needed to factory reset anyway...)

HASH256 matches the ROM needed. (Made a backup of my own cartridge of course)
 

Attachments

  • help - Copy.png
    help - Copy.png
    66.5 KB · Views: 10
Last edited by Sticky94,

The_Chaotician

Hoist the Colours!
Member
Joined
Feb 9, 2017
Messages
222
Trophies
0
XP
1,648
Country
United Kingdom
Glad you guys are keeping the switch port alive! I'm here in need of help with this build tutorial. It seems that I'm getting same error as these guys even with the new commit. Made sure to follow everything thoroughly on a fresh window's install. (No worries needed to factory reset anyway...)

HASH256 matches the ROM needed. (Made a backup of my own cartridge of course)
Also getting this error - @impeeza - any ideas?
 

treemandan

Member
Newcomer
Joined
Jul 1, 2024
Messages
6
Trophies
0
Age
36
XP
34
Country
Australia
@treemandan @EmmaQF , Instructions has been updated thanks to @jnackmclain who create a PR on the sm64ex-alo repository with the changes needed to the code build with latest DevKitPro and LibNX.

you need you commit the PR#67 and now the code build again.
Good stuff for getting to the bottom of this!

Also getting this error - @impeeza - any ideas?
This happened to me also and I couldn't figure out how to get it to work, there must be something wrong with the rom dumper.
However I got past this step by using a different dumper to extract the assets out of the rom somewhere else, once that completed successfully I then copied the assets over to the working folder to and followed Impeeza's steps again. because it seems to skip the rom dump process if the assets are already dumped
 

The_Chaotician

Hoist the Colours!
Member
Joined
Feb 9, 2017
Messages
222
Trophies
0
XP
1,648
Country
United Kingdom
Good stuff for getting to the bottom of this!


This happened to me also and I couldn't figure out how to get it to work, there must be something wrong with the rom dumper.
However I got past this step by using a different dumper to extract the assets out of the rom somewhere else, once that completed successfully I then copied the assets over to the working folder to and followed Impeeza's steps again. because it seems to skip the rom dump process if the assets are already dumped
Any chance you can share a link to the dumper that works?
 

The_Chaotician

Hoist the Colours!
Member
Joined
Feb 9, 2017
Messages
222
Trophies
0
XP
1,648
Country
United Kingdom
I messed around with sm64pcBuilder2 until I got it to produce the assets
So...

I got MSYS to compile ONCE, with no changes and no need to copy the assets over from sm64pcBuilder2. Then...

Nothing. Getting the same error as those above. The one time i did get it to work, i started with a completely fresh install of MSYS and DevKitPro. Interestingly, when i copied the assests over from sm64pcBuilder2 this time, i get a new error:

$ make TARGET_SWITCH=1 BETTERCAMERA=1 NODRAWINGDISTANCE=1 TEXTURE_FIX=1 EXT_OPTIONS_MENU=1 EXTERNAL_DATA=1 QOL_FIXES=1 QOL_FEATURES=1 EXT_DEBUG_MENU=1 PORT_MOP_OBJS=1
Building tools...
aarch64-none-elf-g++.exe: error: unrecognized command-line option '-municode'; did you mean '-Wunicode'?
make[1]: *** [Makefile:66: armips] Error 1
Makefile:467: *** Failed to build tools. Stop.

The reason im still trying with this is that iwant to use the HD model and texture packs with the enhancements the alo build provides. I have a working version of the original fgsfds build with all of these features, but i want to be sure im not missing anything.

Any ideas?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Xdqwerty @ Xdqwerty:
    good night
    +2
  • kijetesantakalu042 @ kijetesantakalu042:
    I need a lobotomy
  • JollyBaker @ JollyBaker:
    FIRE IN THE HOLE
  • SylverReZ @ SylverReZ:
    @JollyBaker, When's the BakerMan name coming back?
    +1
  • chrisrlink @ chrisrlink:
    i have an odd question for the UK members (bit political but informative) how is Homosexuality precieved across the pond? I mean is it as bad here with laws being passed etc etc?
    +1
  • JollyBaker @ JollyBaker:
    @SylverReZ February (the name change cooldown is 2 months hence why I was SpookyBaker during November)
    +1
  • The Real Jdbye @ The Real Jdbye:
    @chrisrlink i don't live in UK but it's definitely not illegal there
    +1
  • The Real Jdbye @ The Real Jdbye:
    US and china are kinda the only ones doing that as far as 1st world countries go afaik
    +1
  • SylverReZ @ SylverReZ:
    @chrisrlink, Homosexuality is not illegal there from what I know. Only countries like the USA and China, or other countries that don't support LGBT rights or human rights most of the time that often result in conflict.
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Nothing wrong with homosexuality. NOTHING. I'm not one among their numbers, but I would never treat someone poorly if they were. Welcome to the world, people!!!
    +2
  • Scarlet @ Scarlet:
    You do still get stereotyping and some homophobia along with racism in the UK, but it doesn't seem quite as overt as what you see coming out of the states.
    +1
  • Scarlet @ Scarlet:
    I feel like those spewing hate at least understand they're in the minority here, and that does limit how open it can really be.
    +1
  • Veho @ Veho:
    Gaaaaaaay.
  • Veho @ Veho:
    Looks like America is turning into Iran so it's going to be a difficult decade or so for all minorities.
  • ZeroT21 @ ZeroT21:
    Murica is cooked
  • BigOnYa @ BigOnYa:
    Not sure why people think the USA does not allow gay-ness, its prevalent here and accepted openly in most states. https://en.m.wikipedia.org/wiki/Same-sex_marriage_in_the_United_States
  • Veho @ Veho:
    I wouldn't consider the current state of the law as permanent. Abortion access was prevalent in most states too... until it wasn't.
  • Veho @ Veho:
    The hysteria is currently focused on trans rights but don't think gay rights aren't close to the chopping block.
  • BigOnYa @ BigOnYa:
    Abortion is still legal in most states, only banned/restricted in 10/50 states. And the issues with trans rights are the Republicans want to ban anyone under age 18 from having sex changes, and stop trans people from competing in sports whereas a born male cannot compete with females. But yea with Trump, who knows what he will pull.
  • Veho @ Veho:
    Trump isn't really interested in anything past making money (and evading prison) so he will push for whatever nets him the most bribes. It's what the people he puts into power will pull that is the real problem.
    +1
  • Veho @ Veho:
    And now for something completely different: https://i.imgur.com/5LNC1Kc.mp4
    +1
  • K3Nv2 @ K3Nv2:
    Ti's the warm up your car for 20 minutes and waste gas season
    +1
  • BigOnYa @ BigOnYa:
    I'm thankful to have a garage, esp when its snow covered outside.
  • K3Nv2 @ K3Nv2:
    Still gotta shovel the outside and fall on your ass
    K3Nv2 @ K3Nv2: Still gotta shovel the outside and fall on your ass