Setting Up and Compiling the Newer Sources

From NSMBW Modding Database
Jump to navigation Jump to search

Here are the tutorials to set up and compile the NewerSMBW source code, along with a few questions regarding the NewerSMBW source code.
If you get "permission denied" or "read-only filesystem" errors, see this here.

The estimated time to set up and compile the NewerSMBW source code may take between 30 minutes and 3 hours, depending on your computer specs, knowledge with the terminal, internet connection speed, etc.

macOS

Credits and Release Information

Original tutorial by Tempus, and heavily edited by User:9211tr. Updated/working as of 2020.

This has been tested on macOS 10.15 Catalina. It should also work on OS X 10.9 Mavericks up to macOS 10.14 Mojave, or (but untested) on any version later than 10.15 Catalina.


Installing GCC

Install Xcode via the Mac App Store (if you're on an earlier macOS version {below 10.15 Catalina}, you may have to go online and download the latest version of Xcode for whichever earlier macOS version you have). Open Xcode once it's finished installing, read all the license agreements that pops up and agree to it.


Installing CMake, GNU "SED", and GNU "WGET"

Open the terminal (if you haven't already) and type: cd /

Install the package manager, "Homebrew". Go to its website: https://brew.sh, copy the install command, and paste/enter it into the terminal. Then once it's finished installing, type:

brew install cmake
brew install gnu-sed
brew install wget


Installing devkitPPC

Open the terminal (if you haven't already) and type:

wget -O devkitPPC.tar.xz https://github.com/devkitPro/buildscripts/releases/download/devkitPPC_r35/devkitPPC_r35-osx.tar.xz

Afterwards, in the terminal, type:

tar -xvf devkitPPC.tar.xz -C /
rm devkitPPC.tar.xz

Or you can manually download devkitPPC here: https://github.com/devkitPro/buildscripts/releases
And manually extract the devkitPPC .tar.xz file to the / directory.


Installing PyElfTools/PyYAML

Open the terminal (if you haven't already) and type:

easy_install pyelftools
easy_install pyyaml

NOTE: If you get an 'yaml.h' file not found fatal error (usually if you're on macOS 10.15 Catalina), you may have to install the libyaml package, remove the easy_install PyYAML .egg reference file, and reinstall PyYAML. In the terminal, type:

brew install libyaml
ls /Library/Python/2.7/site-packages
rm /Library/Python/2.7/site-packages/<EggFile>

(where <EggFile> is the name of the PyYAML .egg reference file, for example, PyYAML-5.2-py2.7-macosx-10.15-x86_64.egg).


Downloading the NewerSMBW Sources

Open the terminal (if you haven't already) and type:

svn co https://github.com/Newer-Team/NewerSMBW/tree/no-translations /NewerSMBW-no-translations

Or you can manually download the NewerSMBW Sources here: https://github.com/Newer-Team/NewerSMBW/tree/no-translations
And download the .zip file and extract it to the / directory.

NOTE: If you get an error saying The subversion command line tools are no longer provided by Xcode (usually if you're on macOS 10.15 Catalina), you may have to install the subversion (SVN) package with "Homebrew" instead. In the terminal, type:

brew install svn

More information about this error here.


Downloading and Patching Clang/LLVM (rev. 184655)

Open the terminal (if you haven't already) and type:

svn co -r 184655 http://llvm.org/svn/llvm-project/llvm/trunk /llvm
svn co -r 184655 http://llvm.org/svn/llvm-project/cfe/trunk /llvm/tools/clang
svn co -r 184655 http://llvm.org/svn/llvm-project/compiler-rt/trunk /llvm/projects/compiler-rt
cd /llvm/tools/clang
patch -p0 -i /NewerSMBW-no-translations/ClangPatches/clang_cw_patches_r184655.diff

mkdir /NewerSMBW-LLVM
mkdir /llvm/build
cd /llvm/build


Compiling Clang/LLVM (rev. 184655)

Open the terminal (if you haven't already) and type:

cmake -DLLVM_DEFAULT_TARGET_TRIPLE=powerpc-unknown-unknown-unknown -DPYTHON_EXECUTABLE=/usr/bin/python -DLLVM_TARGETS_TO_BUILD="PowerPC" -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/NewerSMBW-LLVM" /llvm
make
make install
cd /
rm -r /llvm

cd /NewerSMBW-no-translations/Kamek
mv src/heapbar.S src/heapbar2.S
gsed -e '129d' src/heapbar2.S > src/heapbar.S
rm src/heapbar2.S
mkdir processed
mkdir NewerASM


NOTE: If you get an error saying Undefined symbols for architecture x86_64: "___msan_allocated_memory" and/or Undefined symbols for architecture x86_64: "___msan_unpoison", you might want to type these commands:

gsed -i 's/__msan_unpoison/\/\/__msan_unpoison/' /llvm/lib/Support/Compression.cpp
gsed -i 's/__msan_allocated_memory/\/\/__msan_allocated_memory/' /llvm/lib/Support/Allocator.cpp

to fix the errors. More information about these errors here.

Additionally, if you get an 'netinet/ip_mroute.h' file not found fatal error, you'll need to do modifications to 3 of the LLVM compiler-rt source files to fix this error. Open the terminal (if you haven't already) and type:

chmod 775 /llvm/projects/compiler-rt/lib/sanitizer_common
chmod 777 /llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
chmod 777 /llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
chmod 777 /llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h


1: Open /llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc with the text editor and replace this text:

#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_MAC
  _(SIOCGETSGCNT, WRITE, struct_sioc_sg_req_sz);

with

#if (SANITIZER_LINUX && !SANITIZER_ANDROID)
  _(SIOCGETSGCNT, WRITE, struct_sioc_sg_req_sz);


2: Open /llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc with the text editor and:

Remove the text #include <netinet/ip_mroute.h>, then replace this text

#if !SANITIZER_ANDROID
  unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);

with

#if !SANITIZER_ANDROID && !SANITIZER_MAC
  unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);

Afterwards, replace this text

#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_MAC
  unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT;

with

#if (SANITIZER_LINUX && !SANITIZER_ANDROID)
  unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT;


3: Open /llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h with the text editor and:

Replace this text

#if !SANITIZER_ANDROID
  extern unsigned struct_sioc_sg_req_sz;

with

#if !SANITIZER_ANDROID && !SANITIZER_MAC
  extern unsigned struct_sioc_sg_req_sz;

Afterwards, replace this text

#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_MAC
  extern unsigned IOCTL_SIOCGETSGCNT;

with

#if (SANITIZER_LINUX && !SANITIZER_ANDROID)
  extern unsigned IOCTL_SIOCGETSGCNT;


More information about this error here.


Compiling NewerSMBW

At any time, open the terminal (if you haven't already) and type:

sudo -i
cd /NewerSMBW-no-translations/Kamek
python tools/mapfile_tool.py
python tools/kamek.py NewerProjectKP.yaml --show-cmd --no-rels --use-clang --gcc-type=/devkitPPC/bin/powerpc-eabi --llvm-path=/NewerSMBW-LLVM/bin


Finishing

This will output a number of .bin files into the NewerASM folder. You'll need to rename them to their NewerSMBW readable names, so open the terminal (if you haven't already) and type:

cd /NewerSMBW-no-translations/Kamek/NewerASM
wget https://raw.githubusercontent.com/9211tr/NewerSrcSetupScriptsWSLandLinux/master/RenameNewerBinFiles.sh
chmod +x RenameNewerBinFiles.sh

Once you're done with that, at any time, simply type in the terminal:

sudo -i
cd /NewerSMBW-no-translations/Kamek/NewerASM
./RenameNewerBinFiles.sh

and then go into the renamed folder in the NewerASM folder, then drag the renamed .bin files into your /NewerRes folder in your NewerSMBW game patch folder and test your mods out! If you want to automate the process further, take a look at the makeNewerKP file in the /NewerSMBW-no-translations/Kamek folder in the text editor. Change the commands at the top to match the ones in the code block in the Compiling NewerSMBW section, and change the directory paths below to output directly to your test folder destination. You can integrate the script with WIT (Wiimms ISO Tools), Dolphin Emulator, or with RiiFS to get ultra speedy testing runs.


Debian/Ubuntu Linux

Credits and Release Information

Original tutorial by Grop, and heavily edited by User:9211tr + slightly edited by User:RedStoneMatt. Updated/working as of 2020.

Debian 9.13.0 (or earlier) / Ubuntu 17.04 (or earlier) is needed, versions above that use GLIBC 2.25 or later, and that's incompatible with LLVM (as it results in compilation errors when compiling LLVM).

Also, you'll need to use the 64-bit (x86-64 or AMD64) version of Debian/Ubuntu Linux, since some of the necessary tools/programs needed for compiling NewerSMBW are no longer compatible with the 32-bit (i386 or i686) version.


Preparing apt-get

If you're on Ubuntu 17.04 only, you'll need to do some changes to the apt-get sources to prevent errors (more information here). Open the terminal (if you haven't already) and type: nano /etc/apt/sources.list

Go to line #2 of the file (using the arrow keys) and paste this code:

# EOL upgrade sources.list
# Required
deb http://old-releases.ubuntu.com/ubuntu/ zesty main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ zesty-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ zesty-security main restricted universe multiverse

Then exit and save your changes. Afterwards, in the terminal, type:

cd /
apt-get update -y
apt-get upgrade -y

and restart your Ubuntu Linux computer.

If you get an error saying Could not get lock /var/lib/dpkg/lock - open when trying to run apt-get upgrade -y, just simply type this command: rm /var/lib/dpkg/lock and the error should be gone.


Installing GCC

Open the terminal (if you haven't already) and type:

cd /
apt-get install -y gcc
apt-get install -y make


Installing CMake

Open the terminal (if you haven't already) and type:

apt-get install -y cmake


Installing Subversion (SVN)

Open the terminal (if you haven't already) and type:

apt-get install -y subversion


Installing devkitPPC

Open the terminal (if you haven't already) and type:

wget -O devkitPPC.tar.xz https://github.com/devkitPro/buildscripts/releases/download/devkitPPC_r35/devkitPPC_r35-linux.tar.xz

Afterwards, in the terminal, type:

tar -xvf devkitPPC.tar.xz -C /
rm devkitPPC.tar.xz

Or you can manually download devkitPPC here: https://github.com/devkitPro/buildscripts/releases
And manually extract the devkitPPC .tar.xz file to the / directory.


Installing PyElfTools/PyYAML

Open the terminal (if you haven't already) and type:

apt-get install -y python-pip
pip install pyelftools
pip install pyyaml


Downloading the NewerSMBW Sources

Open the terminal (if you haven't already) and type:

svn co https://github.com/Newer-Team/NewerSMBW/tree/no-translations /NewerSMBW-no-translations

Or you can manually download the NewerSMBW Sources here: https://github.com/Newer-Team/NewerSMBW/tree/no-translations
And download the .zip file and extract it to the / directory.



Downloading and Patching Clang/LLVM (rev. 184655)

Open the terminal (if you haven't already) and type:

svn co -r 184655 http://llvm.org/svn/llvm-project/llvm/trunk /llvm
svn co -r 184655 http://llvm.org/svn/llvm-project/cfe/trunk /llvm/tools/clang
svn co -r 184655 http://llvm.org/svn/llvm-project/compiler-rt/trunk /llvm/projects/compiler-rt
cd /llvm/tools/clang
patch -p0 -i /NewerSMBW-no-translations/ClangPatches/clang_cw_patches_r184655.diff

mkdir /NewerSMBW-LLVM
mkdir /llvm/build
cd /llvm/build


Compiling Clang/LLVM (rev. 184655)

Open the terminal (if you haven't already) and type:

cmake -DLLVM_DEFAULT_TARGET_TRIPLE=powerpc-unknown-unknown-unknown -DPYTHON_EXECUTABLE=/usr/bin/python -DLLVM_TARGETS_TO_BUILD="PowerPC" -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/NewerSMBW-LLVM" /llvm
make
make install
cd /
rm -r /llvm

cd /NewerSMBW-no-translations/Kamek
mv src/heapbar.S src/heapbar2.S
sed -e '129d' src/heapbar2.S > src/heapbar.S
rm src/heapbar2.S
mkdir processed
mkdir NewerASM


Compiling NewerSMBW

At any time, open the terminal (if you haven't already) and type:

su
cd /NewerSMBW-no-translations/Kamek
python tools/mapfile_tool.py
python tools/kamek.py NewerProjectKP.yaml --show-cmd --no-rels --use-clang --gcc-type=/devkitPPC/bin/powerpc-eabi --llvm-path=/NewerSMBW-LLVM/bin

NOTE: If you're on Ubuntu, make sure to use sudo -i instead, as su doesn't work on Ubuntu.


Finishing

This will output a number of .bin files into the NewerASM folder. You'll need to rename them to their NewerSMBW readable names, so open the terminal (if you haven't already) and type:

cd /NewerSMBW-no-translations/Kamek/NewerASM
wget https://raw.githubusercontent.com/9211tr/NewerSrcSetupScriptsWSLandLinux/master/RenameNewerBinFiles.sh
chmod +x RenameNewerBinFiles.sh

Once you're done with that, at any time, simply type in the terminal (and again, if you're on Ubuntu, make sure to use sudo -i instead, as su doesn't work on Ubuntu):

su
cd /NewerSMBW-no-translations/Kamek/NewerASM
./RenameNewerBinFiles.sh

and then go into the renamed folder in the NewerASM folder, then drag the renamed .bin files into your /NewerRes folder in your NewerSMBW game patch folder and test your mods out! If you want to automate the process further, take a look at the makeNewerKP file in the /NewerSMBW-no-translations/Kamek folder in the text editor. Change the commands at the top to match the ones in the code block in the Compiling NewerSMBW section, and change the directory paths below to output directly to your test folder destination. You can integrate the script with WIT (Wiimms ISO Tools), Dolphin Emulator, or with RiiFS to get ultra speedy testing runs.


Windows 7 or later

Credits and Release Information

Original tutorial by User:RedStoneMatt, and heavily edited by User:9211tr. Updated/working as of 2020.

This has also been tested on Windows 10. It should also work on Windows 8, 8.1, or (but untested) on any version later than Windows 10.

Requirements

- Windows 7 or later

- Python 2.7.x (download here, and click on "Latest Python 2 Release")

- An internet connection

Tutorial

Step 1

If you're on a 32-bit Windows OS (x32 or x86), download the Windows x86 .msi installer file of Python 2.7.x. Otherwise if you're on a 64-bit Windows OS (x64 or x86-64), download the Windows x86-64 .msi installer file of Python 2.7.x.

Once you're done downloading the .msi installer file, follow the install instructions.


Step 2

You need to upgrade "pip" (which is the Python package manager), and install PyElfTools/PyYAML. Open the Windows Command Prompt (if you haven't already) and type:

cd C:\Python27
python -m pip install --upgrade pip
python -m pip install pyelftools
python -m pip install pyyaml


Step 3

Download this already-prepared .zip file of the NewerSMBW sources and extract it to C:\NewerSMBW-no-translations. Right-click on and edit the makeNewerKP.bat file (in the C:\NewerSMBW-no-translations\Kamek folder) and replace all occurrences of python with C:\Python27\python.exe.


Step 4

To compile NewerSMBW at any time, simply click on the makeNewerKP.bat file (in the C:\NewerSMBW-no-translations\Kamek folder). Once the compilation is finished and no syntax errors (or whatever errors) occurred, you're all done. Your compiled NewerSMBW .bin files will be automatically renamed to their NewerSMBW readable names, and will be located at the C:\NewerSMBW-no-translations\Kamek\Build folder.


Windows 10 WSL subsystem

Credits and Release Information

Tutorial by User:9211tr. Updated/working as of 2020.


Requirements

- Windows 10 Anniversary Update BUILD 14393.0 Version 1607 or later

- The 64-bit (x64 or x86-64) version of Windows 10 + an x64-based processor on your computer, as the WSL subsystem requires this in order for it to enable, install, and work. It WILL NOT work on the 32-bit (x32 or x86) version of Windows 10 and/or an x86-based processor on your computer

- An internet connection

- At least 22 GB of free disk space

HINT: To tell if your Windows 10 computer is 64-bit, running Anniversary Update BUILD 14393.0 Version 1607 or later, and on an x64-based processor, go to the Start Menu --> Settings --> System --> About:

Windows10About.png

If you're below build 14393.0 Version 1607, then I'd suggest you update your computer to the latest build.


Tutorial


Installing/Enabling the WSL subsystem:

Step 1

Go to Start Menu --> Settings --> Update & Security --> For Developers. Set it to Developer Mode.


Step 2

Go to the Cortana Menu (the circle icon near the Start Menu icon), or if you're on a later build of Windows 10, the search box near the Start Menu icon. Type Turn Windows features on or off. Check the box that says Windows Subsystem for Linux and click OK. Once you're done enabling the WSL subsystem, restart your computer.


Step 3

After restarting, we'll need to install the WSL subsystem (the installation may take about 10 minutes to complete):


Method 1: Windows Store (installs a much improved version of the WSL subsystem, recommended)

NOTE: You need the Windows 10 Fall Creators Update, build 16215.0 or later, in order to use this method, or it won't work.

Go to: https://aka.ms/wslstore, and the Microsoft Store should appear:
Windows10WSLstore1.png

You'll get to choose 6 (or probably more, if you're reading this in the future) different Linux distros for the WSL subsystem. Choose Ubuntu (not any other distro), in order for everything to work out properly, but don't download that distro, since that distro is a later version of Ubuntu (this is important and as I said before: Ubuntu 17.04 {or earlier} is needed, versions above that use GLIBC 2.25 or later, and that's incompatible with LLVM {as it results in compilation errors when compiling LLVM}).

Scroll down and click Related, look for and choose the Ubuntu 16.04 LTS distro. If it's not shown, go here. Once you select the Ubuntu 16.04 LTS distro, hit Get to download it. When it's finished downloading, hit Launch (you can also choose to pin it to the Start Menu if you like): Windows10WSLstore2.png
Windows10WSLstore3.png

After hitting Launch, it'll say that it's installing.


Method 2: Command-line (installs a legacy version of the WSL subsystem)

NOTE: This method is not recommended as it installs a legacy version of the WSL subsystem, but if you're not using the Windows 10 Fall Creators Update, build 16215.0 or later, then this is the only method that will work.

Go to the Cortana Menu, or if you're on a later build of Windows 10, the search box near the Start Menu icon. Type bash to install the WSL subsystem.

If you get an error after typing bash, saying Windows Subsystem for Linux has no installed distributions, either:

  • You go to the Cortana Menu, or if you're on a later build of Windows 10, the search box. Type instead lxrun /install and hopefully, you shouldn't have any errors.
  • You have the Windows 10 Fall Creators Update, build 16215.0 or later installed, and should instead use the Windows Store method.

Read the license agreement, and if you accept it, type y (for "Yes", to accept), and it will install.


Step 4

If you're getting WslRegisterDistribution failed with error: 0x80080005 and 0x80080005 Server execution failed errors with the Ubuntu 16.04 LTS distro, then try launching it again and see if it installs successfully. If it doesn't, restart your computer and reinstall the Ubuntu 16.04 LTS distro.

Once it's successfully installed, it will ask you for what the username should be called. Just type root in all lowercase, and for the password (IF PROMPTED), that's all up to you.

Now type exit to exit out of the WSL subsystem. If you get an error saying that the root username already exists, then close the WSL subsystem by hitting Ctrl-C on the keyboard, don't enter in a username.

Go to the Cortana Menu, or if you're on a later build of Windows 10, the search box near the Start Menu icon. Type bash to launch the WSL subsystem.
Normally, if the root username already exists, it will instead use that username, but if it still prompts you to enter in the username, then you have no choice but to use a different username.

Type the commands:

apt-get update -y
apt-get upgrade -y
exit

to update the current utilities/packages in the WSL subsystem.

Go to the Cortana Menu, or if you're on a later build of Windows 10, the search box near the Start Menu icon. Type bash to launch the WSL subsystem, then type: cd /


Setting up and Compiling the NewerSMBW sources:

Step 1

Type in:

sh <(wget -O - https://raw.githubusercontent.com/9211tr/NewerSrcSetupScriptsWSLandLinux/master/NewerSMBWSrcSetup_WindowsWSL.sh)

And it'll prompt you on what you want to do. Type install or simply i and hit ENTER on your keyboard. It should start installing, so find something to do in the meantime, unless if you have the patience to watch the screen and wait until the script is finished running. The script installs everything automatically, so there's no need for you to install anything manually.


Step 2

Once the installation is finished, it'll do a TEST compile on the NewerSMBW sources (to see if everything was installed and done properly) and once that's finished and no syntax errors (or whatever errors) occurred, you're all done.

To compile NewerSMBW at any time, simply type in the commands:

cd /
./newersmbw_compile.sh --autorename

The --autorename option isn't required, but with the --autorename option, your compiled NewerSMBW .bin files will be automatically renamed to their NewerSMBW readable names.


Step 3

You'll need to go into the folder of where the WSL subsystem files are located. If you installed the WSL subsystem via the Windows Store method, then the folder is: C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc\LocalState\rootfs
If you installed it via the Command-line method, then the folder is: C:\Users\%USERNAME%\AppData\Local\lxss\rootfs

Go to the NewerSMBW-no-translations\Kamek\NewerASM folder, or if you used the --autorename option: NewerSMBW-no-translations\Kamek\NewerASM\renamed folder. You should see all the DLCode/DLRelocs/System .bin files for US(NTSC)/EU(PAL)/JP(JPN) v1 and v2, if no syntax errors (or whatever errors occurred) when compiling the NewerSMBW sources.

Then drag the .bin files into your /NewerRes folder in your NewerSMBW game patch folder and test your mods out! If you want to automate the process further, take a look at the makeNewerKP file in the NewerSMBW-no-translations\Kamek folder in the text editor. Change the commands at the top to match the ones in the code block in Step 2 of this tutorial, and change the directory paths below to output directly to your test folder destination. You can integrate the script with WIT (Wiimms ISO Tools), Dolphin Emulator, or with RiiFS to get ultra speedy testing runs.

NOTE: If you haven't used the --autorename option, you'll need to manually rename the .bin files to their NewerSMBW readable names before you drag them into the /NewerRes folder.


Windows 10 (Newer Super Mario All-Stars Revived and NSMBWer only)

Credits and Release Information

Original tutorial by User:Nin0 2257, and heavily edited by User:9211tr. Updated/working as of 2020.

This has been tested on Windows 10 Pro Version 1903 64-bit, and Windows 10 Home Version 2004 64-bit.
Also, both Newer Super Mario All-Stars Revived (NSMASR) and NSMBWer have their own files for Riivolution and are incompatible with the files from NewerSMBW, including its object files, layout files, etc.


Requirements

- Windows 10 or later

- Python 3.4.x or later (download here, and click on "Latest Python 3 Release", if you need to use Python 3.4.x, scroll down on the "Stable Releases" section and go to "Python 3.4.4")

- PyLauncher (download here, needed for some programs requiring Python 2.7.x and some requiring Python 3.4.x when it comes to NewerSMBW modding)

- get-pip for Python 3.4.x (download here, needed only for installing the latest supported version of "pip" for Python 3.4.x {which is "pip" version 19.1.1})

- devkitPPC r33 or earlier (download here)

- An internet connection

- The NSMASR sources by User:H1dd3nM1nd (CLF78), or the NSMBWer sources by User:Danster64 (download the .zip file of the NSMASR sources here, or the .zip file of the NSMBWer sources here)

NSMASR.png
NSMBWer.png


Tutorial

Step 1

For Python, download the Windows x86 .msi installer file (if you're on a 32-bit Windows OS {x32 or x86}), or the Windows x86-64 .msi installer file (if you're on a 64-bit Windows OS {x64 or x86-64}).

For PyLauncher, download the launchwin-1.0.1.6.msi installer file (if you're on a 32-bit Windows OS {x32 or x86}), or the launchwin-1.0.1.6.amd64.msi installer file (if you're on a 64-bit Windows OS {x64 or x86-64}).

Once you're done downloading the .msi installer files, follow the install instructions. For devkitPPC, download the devkitPPC_r33-win32.tar.xz file (if you're on a 32-bit Windows OS {x32 or x86}), or the devkitPPC_r33-win64.tar.xz file (if you're on a 64-bit Windows OS {x64 or x86-64}).


Step 2

If you're on Python 3.4.x only, you need to upgrade "pip" (which is the Python package manager) to the latest supported version for Python 3.4.x (which is "pip" version 19.1.1). Place the get-pip.py file into the C:\Python34 folder. Open the Windows Command Prompt (if you haven't already) and type:

cd C:\Python34
python get-pip.py

If you're on Python 3.5 or later, you can simply upgrade "pip" to the latest version by typing python -m pip install --upgrade pip

After upgrading, install PyElfTools/PyYAML. In the Windows Command Prompt, type:

python -m pip install pyelftools
python -m pip install pyyaml


Step 3

Extract the NSMASR or NSMBWer .zip file to C:\. The folder for the NSMASR sources should be called NSMASR-Code-master, and the folder for the NSMBWer sources should be called NSMBWer-master. Then extract the devkitPPC .tar.xz file to the Kamek\tools folder of the NSMASR or NSMBWer sources folder, as shown below:

Move devkitPPC.png


Step 4

Create a folder called processed, in the Kamek folder of the NSMASR or NSMBWer sources folder.
For NSMASR only, copy the soundPlayer.yaml file (in the Kamek folder, if the file exists) into the processed folder, as shown below:

Processed folder.png
Copy soundPlayer.yaml.png
SoundPlayer.yaml.png

NOTE: In earlier revisions of the NSMASR sources, it wasn't copied into the folder automatically, so it had to be done manually. User:H1dd3nM1nd (CLF78) said he copied the contents inside the soundPlayer.yaml file into another one, so the problem may already be fixed in later revisions of the NSMASR sources.


Step 5

Right-click on and edit the - Build -.bat file in the Kamek folder of the NSMASR or NSMBWer sources folder. You can either edit the path to your own Dolphin Emulator game path (marked in the first picture below), or in the :rename section of the file, change the goto move part to goto end to stop it from moving your compiled .bin files altogether (marked in the second picture below):

Move build.png
End without moving.png

If you have multiple Python versions, make sure that the - Build -.bat file uses Python 3.4.x or later. If you have PyLauncher and your standard Python version is 2.7.x, you can simply replace all occurrences of python (in the - Build -.bat file) to py -3.

For NSMASR only, download the CodeWarrior files:

and place them into the Kamek\tools folder of the NSMASR sources folder. Then replace all occurrences of --mw-path="C:\Program Files (x86)\Freescale\CW for MPC55xx and MPC56xx 2.10\PowerPC_EABI_Tools\Command_Line_Tools" (in the - Build -.bat file) to --mw-path=tools.

When you're done editing the - Build -.bat file, save your changes. To compile NSMASR or NSMBWer at any time, click on the - Build -.bat file (in the Kamek folder of the NSMASR or NSMBWer sources folder). Once the compilation is finished and no syntax errors (or whatever errors) occurred, you're all done. Your compiled .bin files will be automatically renamed to their readable names, and will be located at the Kamek\NewerASM folder (in the NSMASR sources folder), or the Kamek\Build folder (in the NSMBWer sources folder).


Questions

1: How do I resolve the "permission denied" and "read-only filesystem" errors whenever I type a command in the terminal?

Type sudo <command> for every command in the tutorial, and enter password when prompted. Even better, you can simply type su in the terminal to circumvent all sudo commands, so you won't have to type sudo <command> everytime. If you're on Ubuntu Linux or macOS, su doesn't work, so you'll need to type sudo -i instead.

NOTE: If no text is shown when typing the password, it does not mean it's not working, the text is hidden so in case if anyone is watching the computer screen behind your back, they won't see your password.


If you're on macOS and still getting "permission denied" errors, even after typing sudo -i, this is due to Apple's System Integrity Protection (SIP) in OS X 10.11 El Capitan and later. You'll need to enter into recovery mode to disable it. To enter recovery mode:
1: If you have multiple internal hard drive partitions/volumes alongside your macOS partition/volume, you'll need to go into System Preferences (the gear icon in the dock, which is at the bottom of the screen), and click Startup Disk.
2: Click the lock to make changes and select the disk where your macOS partition/volume is, then restart your Mac.
3: As soon as when your Mac starts up, hold down Command-R on the keyboard until the Apple logo shows up, to enter recovery mode.
4: In recovery mode, go to Utilities --> Terminal. In the terminal, type csrutil disable, then restart your Mac to exit out of recovery mode.


If you're on macOS and also are getting a "read-only filesystem" error, this is due to macOS 10.15 Catalina having a separate read-only volume (for the / directory and critical system files) alongside the writable, user data volume. You'll need to disable Apple's System Integrity Protection (SIP), first, following the steps above. Afterwards, open the terminal (if you haven't already) and type mount -uw /, to make the / directory writable again.

This change will automatically be reverted when you restart your Mac. For it to be permanent (at least whenever you start the terminal), when the terminal is open (and you've clicked on the terminal window), go to Terminal --> Preferences... --> Profile --> Shell. Under the Startup section in the terminal preferences window, check the box that says Run Command and Run inside shell. In the text box, type the command sudo mount -uw /, and exit the terminal preferences window. Now everytime you start up the terminal, you'll always be able to modify the / directory.


2: (Windows 10 WSL subsystem only) Can I uninstall the NewerSMBW sources?

Yes, run the script via the command:

sh <(wget -O - https://raw.githubusercontent.com/9211tr/NewerSrcSetupScriptsWSLandLinux/master/NewerSMBWSrcSetup_WindowsWSL.sh)

and type uninstall or simply u and it'll remove it, among the other tools/compilers/etc.

NOTE: This will remove everything in the NewerSMBW sources folder, so make sure you backup any source files/etc. from the NewerSMBW sources folder before uninstalling it.


3: (Windows 10 WSL subsystem only) Can I reinstall the NewerSMBW sources?

Uninstall it, FIRST (see question #2), and then install it back again.


4: Can I have multiple folders for the NewerSMBW sources?

NOTE: If you're on Ubuntu Linux or macOS, make sure to use sudo -i instead, as su doesn't work on Ubuntu or macOS. Also if you're on macOS, make sure to use gsed, for the GNU "SED" (stream editor application) instead, not sed, because sed on macOS is a script editor application, not the GNU "SED" (stream editor application).

Yes, copy the existing folder by typing the commands:

su
cd /
cp -r NewerSMBW-no-translations <NewFolderName>

Or if you need an unmodified and fresh copy, you can simply redownload it by typing these commands:

su
cd /
svn co https://github.com/Newer-Team/NewerSMBW/tree/no-translations <NewFolderName>
mv <NewFolderName>/Kamek/src/heapbar.S <NewFolderName>/Kamek/src/heapbar2.S
sed -e '129d' <NewFolderName>/Kamek/src/heapbar2.S > <NewFolderName>/Kamek/src/heapbar.S
rm <NewFolderName>/Kamek/src/heapbar2.S
mkdir <NewFolderName>/Kamek/processed
mkdir <NewFolderName>/Kamek/NewerASM

(where <NewFolderName> is the folder name of the copy of the NewerSMBW sources folder).
NOTE: Do not have <NewFolderName> as NewerSMBW-no-translations or your current NewerSMBW sources will be OVERWRITTEN.


Copying the RenameNewerBinFiles.sh file (for Debian/Ubuntu Linux and macOS only)


Type these commands in the terminal:

cd <NewFolderName>/Kamek/NewerASM
wget https://raw.githubusercontent.com/9211tr/NewerSrcSetupScriptsWSLandLinux/master/RenameNewerBinFiles.sh
chmod +x RenameNewerBinFiles.sh


Copying the newersmbw_compile.sh file (for Windows 10 WSL subsystem only)


Type this command in the WSL subsystem:

cp newersmbw_compile.sh <NewFileName>

(where <NewFileName> is the file name of the copy of the newersmbw_compile.sh file).

Then you'll need to modify the copy of the file with a text editor that supports the Unix (LF) line feed format (I would recommend PSPad if you don't have one), then replace the text NewerSMBW-no-translations with <NewFolderName> and save the changes.

Now in the WSL subsystem, type: chmod +x <NewFileName>
If you want to compile the NewerSMBW sources easily, type: ./<NewFileName>