Giter Site home page Giter Site logo

aboood40091 / sm64-port Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sm64-port/sm64-port

62.0 9.0 3.0 19.07 MB

A port of https://www.github.com/n64decomp/sm64 for modern devices.

Home Page: https://discord.gg/7bcNTPK

Makefile 0.13% Assembly 0.95% Shell 0.01% C++ 6.75% C 91.03% JavaScript 0.02% Python 0.66% Dockerfile 0.01% GLSL 0.44%

sm64-port's Introduction

Super Mario 64 Port

  • This repo contains a full decompilation of Super Mario 64 (J), (U), (E), and (SH).
  • Naming and documentation of the source code and data structures are in progress.
  • Beyond Nintendo 64, it can also target Linux, Windows and the Wii U natively.

This repo does not include all assets necessary for compiling the game. A prior copy of the game is required to extract the assets.

Building native executables

Wii U

  1. Follow the instructions in the ProgrammingOnTheU tutorial to get the prerequisites for your building system: https://github.com/yawut/ProgrammingOnTheU.
  • For Windows, you will mainly be using MSYS2.
  1. Install git, make, python3 and SDL2 using pacman: (dkp-)pacman -S git make python3 wiiu-sdl2.
  2. Clone the repo: git clone https://github.com/aboood40091/sm64-port.git, which will create a directory sm64-port and then enter it cd sm64-port.
  • Make sure TARGET_WII_U is set to 1 in the Makefile. (TARGET_WII_U ?= 1)
  1. Place a Super Mario 64 ROM called baserom.<VERSION>.z64 into the repository's root directory for asset extraction, where VERSION can be us, jp, or eu.
  2. Run make to build. Qualify the version through make VERSION=<VERSION>. Add -j4 to improve build speed (hardware dependent based on the amount of CPU cores available).
  3. The executable binary will be located at build/<VERSION>_wiiu/sm64.<VERSION>.f3dex2e.rpx.
  4. You can then proceed to install the RPX to the home menu or as a homebrew app in the Homebrew Launcher.

Linux

  1. Install prerequisites (Ubuntu): sudo apt install -y git build-essential pkg-config libusb-1.0-0-dev libsdl2-dev.
  2. Clone the repo: git clone https://github.com/aboood40091/sm64-port.git, which will create a directory sm64-port and then enter it cd sm64-port.
  • Make sure TARGET_WII_U is set to 0 in the Makefile. (TARGET_WII_U ?= 0)
  1. Place a Super Mario 64 ROM called baserom.<VERSION>.z64 into the repository's root directory for asset extraction, where VERSION can be us, jp, or eu.
  2. Run make to build. Qualify the version through make VERSION=<VERSION>. Add -j4 to improve build speed (hardware dependent based on the amount of CPU cores available).
  3. The executable binary will be located at build/<VERSION>_pc/sm64.<VERSION>.f3dex2e.

Windows

  1. Install and update MSYS2, following all the directions listed on https://www.msys2.org/.
  2. From the start menu, launch MSYS2 MinGW and install required packages depending on your machine (do NOT launch "MSYS2 MSYS"):
  • 64-bit: Launch "MSYS2 MinGW 64-bit" and install: pacman -S git make python3 mingw-w64-x86_64-gcc
  • 32-bit (will also work on 64-bit machines): Launch "MSYS2 MinGW 32-bit" and install: pacman -S git make python3 mingw-w64-i686-gcc
  • Do NOT by mistake install the package called simply gcc.
  1. The MSYS2 terminal has a current working directory that initially is C:\msys64\home\<username> (home directory). At the prompt, you will see the current working directory in yellow. ~ is an alias for the home directory. You can change the current working directory to My Documents by entering cd /c/Users/<username>/Documents.
  2. Clone the repo: git clone https://github.com/aboood40091/sm64-port.git, which will create a directory sm64-port and then enter it cd sm64-port.
  • Make sure TARGET_WII_U is set to 0 in the Makefile. (TARGET_WII_U ?= 0)
  1. Place a Super Mario 64 ROM called baserom.<VERSION>.z64 into the repository's root directory for asset extraction, where VERSION can be us, jp, or eu.
  2. Run make to build. Qualify the version through make VERSION=<VERSION>. Add -j4 to improve build speed (hardware dependent based on the amount of CPU cores available).
  3. The executable binary will be located at build/<VERSION>_pc/sm64.<VERSION>.f3dex2e.exe inside the repository.

Troubleshooting

  1. If you get make: gcc: command not found or make: gcc: No such file or directory although the packages did successfully install, you probably launched the wrong MSYS2. Read the instructions again. The terminal prompt should contain "MINGW32" or "MINGW64" in purple text, and NOT "MSYS".
  2. If you get Failed to open baserom.us.z64! you failed to place the baserom in the repository. You can write ls to list the files in the current working directory. If you are in the sm64-port directory, make sure you see it here.
  3. If you get make: *** No targets specified and no makefile found. Stop., you are not in the correct directory. Make sure the yellow text in the terminal ends with sm64-port. Use cd <dir> to enter the correct directory. If you write ls you should see all the project files, including Makefile if everything is correct.
  4. If you get any error, be sure MSYS2 packages are up to date by executing pacman -Syu and pacman -Su. If the MSYS2 window closes immediately after opening it, restart your computer.
  5. When you execute gcc -v, be sure you see Target: i686-w64-mingw32 or Target: x86_64-w64-mingw32. If you see Target: x86_64-pc-msys, you either opened the wrong MSYS start menu entry or installed the incorrect gcc package.
  6. When switching between building for other platforms, run make -C tools clean first to allow for the tools to recompile on the new platform. This also helps when switching between shells like WSL and MSYS2.

For help with building the Wii U version, do not hesitate to join the ForTheUsers Discord Server linked below.

Debugging

The code can be debugged using gdb. On Linux install the gdb package and execute gdb <executable>. On MSYS2 install by executing pacman -S winpty gdb and execute winpty gdb <executable>. The winpty program makes sure the keyboard works correctly in the terminal. Also consider changing the -mwindows compile flag to -mconsole to be able to see stdout/stderr as well as be able to press Ctrl+C to interrupt the program. In the Makefile, make sure you compile the sources using -g rather than -O2 to include debugging symbols. See any online tutorial for how to use gdb.
For the Wii U port, you can log using WHB, which will log to both the console's native OSReport and Udp.

ROM building

It is possible to build N64 ROMs as well with this repository. See https://github.com/n64decomp/sm64 for instructions.

Project Structure

sm64
├── actors: object behaviors, geo layout, and display lists
├── asm: handwritten assembly code, rom header
│   └── non_matchings: asm for non-matching sections
├── assets: animation and demo data
│   ├── anims: animation data
│   └── demos: demo data
├── bin: C files for ordering display lists and textures
├── build: output directory
├── data: behavior scripts, misc. data
├── doxygen: documentation infrastructure
├── enhancements: example source modifications
├── include: header files
├── levels: level scripts, geo layout, and display lists
├── lib: SDK library code
├── rsp: audio and Fast3D RSP assembly code
├── sound: sequences, sound samples, and sound banks
├── src: C source code for game
│   ├── audio: audio code
│   ├── buffers: stacks, heaps, and task buffers
│   ├── engine: script processing engines and utils
│   ├── game: behaviors and rest of game source
│   ├── goddard: Mario intro screen
│   ├── menu: title screen and file, act, and debug level selection menus
│   └── pc: port code, audio and video renderer
├── text: dialog, level names, act names
├── textures: skybox and generic texture data
└── tools: build tools

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Run clang-format on your code to ensure it meets the project's coding standards.

Official Discord: https://discord.gg/7bcNTPK
ForTheUsers Discord: https://discord.gg/F2PKpEj

sm64-port's People

Contributors

aboood40091 avatar nadiaholmquist avatar garyodernichts avatar mountainflaw avatar ahouts avatar vaguerant avatar v10lator avatar ariahiro64 avatar baosen avatar bramhaag avatar jan200101 avatar mkst avatar matt-kempster avatar niansa avatar

Stargazers

 avatar Scruffy avatar Luigi Mario avatar Bryce avatar Alex Kautz avatar  avatar Blitz En avatar  avatar Somnus avatar  avatar JakeBritten avatar  avatar Steven-Souza avatar  avatar red avatar hanamalloc avatar Special Newbie - (Cris) avatar  avatar Matt Greer avatar Bailey Fox avatar  avatar Martin Uhrin avatar Andrew Aydie avatar Anthony Rey avatar  avatar Anchorwave avatar  avatar Lázaro Vieira avatar  avatar  avatar Alejo Gastélum avatar  avatar  avatar paulloedu avatar  avatar  avatar  avatar  avatar Dave Richer avatar Gabriel Morazán avatar  avatar August avatar Tyler Jaacks avatar Raghav Vivek avatar  avatar Andrew Lee avatar Thomas Hine avatar  avatar Amber Brault avatar Hans avatar deejay87 avatar Zenseii avatar Christopher Lee avatar Rowan avatar Louis de Fromont avatar JDJG avatar Emerald the Fox avatar バク avatar Rafael Moura avatar  avatar James Surine avatar  avatar

Watchers

James Cloos avatar deejay87 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sm64-port's Issues

I got this issue when building src/game/memory.c:810:10: fatal error: coreinit/cache.h: No such file or directory

this is the full error I know it's my fault but I don't really know what to do I would love to get some help.
src/game/memory.c:810:10: fatal error: coreinit/cache.h: No such file or directory
810 | #include <coreinit/cache.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:915: build/us_wiiu/src/game/memory.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from src/game/obj_behaviors.c:825:
src/game/behaviors/bowling_ball.inc.c: In function 'bhv_free_bowling_ball_roll_loop':
src/game/behaviors/bowling_ball.inc.c:269:5: warning: 'and' of mutually exclusive equal-tests is always 0
269 | if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
| ^~

Strugging to set up the build environment

Hi!

I'm trying to build this SM64 port so I can run it on my Wii U. I'm currently using Microsofts Ubuntu terminal, so for all I know, this is a fully-featured Ubuntu terminal.

I've followed the installation guide on how to build for Wii U on Linux, but I'm getting this error when I'm trying to run the makefile:

$ make VERSION=us
make: gcc: Command not found
make: *** [Makefile:66: n64graphics] Error 127
Traceback (most recent call last):
  File "./extract_assets.py", line 292, in <module>
    main()
  File "./extract_assets.py", line 162, in main
    subprocess.check_call(
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-s', '-C', 'tools/', 'n64graphics', 'skyconv', 'mio0', 'aifc_decode']' returned non-zero exit status 2.
Makefile:209: *** Failed to extract assets.  Stop.

However, I can confirm that powerpc-eabi-gcc is installed in /opt/devkitpro/devkitPPC/bin/powerpc-eabi-gcc. I've tried to create an alias for it, so I can just run the command gcc, but I'm getting the same error. Any idea what's wrong?

Garbled text on EU builds

Would love to report this upstream but can't manage to compile the PC version so I'm only able to report it here. If anyone is able to recreate this on the PC version please report upstream.

VID_20200818_095209.zip

error building

$ make TARGET_WII_U=1
==== Build Options ====
Version: us
Microcode: f3dex2e
Target: sm64.us
Compare ROM: no
Build Matching: no

Building tools...
/opt/devkitpro/msys2/usr/bin/../lib/gcc/x86_64-pc-msys/11.3.0/../../../../x86_64
-pc-msys/bin/ld: audiofile/libaudiofile.a: error adding symbols: archive has no
index; run ranlib to add one
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:78: tabledesign] Error 1
Makefile:293: *** Failed to build tools. Stop.

Build failing on Ubuntu 20

Hi.

Thanks very much for this - great effort. Unfortunately, I am having issues building in Ubuntu 20. I am using the latest build from this repo.
I have set up the build environment according to all the relevant instructions, and the build starts with no problems, but I am getting the following message during the build:

powerpc-eabi-gcc -c -O2 -I include -I build/us_wiiu -I build/us_wiiu/include -I src -I . -D_LANGUAGE_C -DVERSION_US -DNON_MATCHING -DAVOID_UB -DTARGET_WII_U -ffunction-sections -DESPRESSO -mcpu=750 -meabi -mhard-float -ffast-math -D__WIIU__ -D__WUT__ -I/opt/devkitpro/portlibs/wiiu/include -I/opt/devkitpro/portlibs/ppc/include -I/opt/wut/include -DNO_SEGMENTED_MEMORY  -DWIDESCREEN -DF3DEX_GBI_2E -fno-strict-aliasing -fwrapv -o build/us_wiiu/bin/cave.o bin/cave.c
src/pc/gfx/gfx_whb_window.c:5:10: fatal error: coreinit/foreground.h: No such file or directory
    5 | #include <coreinit/foreground.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:860: build/us_wiiu/src/pc/gfx/gfx_whb_window.o] Error 1

I am guessing that I am missing or are using a wrong dependancy but am not sure what I should be checking. Thanks very much!

On Linux it gives the error: 'isnan' was not decleared in this scope. SOLVED!!!!

Hello everyone, the latest version of SM64 on Linux it gives me this error:

In file included from audiofile.cpp:6036:0: 
audiofile.cpp: In function 'bool _af_pcm_format_ok(AudioFormat*)': audiofile.cpp:6042:28: error: 'isnan' was not declared in this scope
 assert(!isnan(f->pcm.slope))
___________________________^ 
audiofile.cpp:6042:28: note: suggested alternative: 

In file included from audiofile.cpp:5006:0: 

/home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_7/include/c++/5.5.0/cmath:648:5: note. std::isnan
___________________________________________________________________________________isnan(_Tp __ x)
___________________________________________________________________________________^
                                                                                                                                                                                                                                                                                      
Makefile:7: recipe for target 'audiofile.o' failed
 
make[1]: *** [audiofile.o] Error 1 
Makefile:53: recipe for target 'audiofile/libaudiofile.a' failed make: *** [audiofile/libaudiofile.a] Error 2 
Makefile:216: *** Failed to build tools.

Any Ideas?

PS: On windows side I can build without troubles....

can't setup environment

OS: ubuntu 20.10 beta

I installed everything and etc and got this

Makefile:89: *** "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro". Stop.

a few hours of googling later I notice the error tells me how to fix it and I question my life choices

so I run

export DEVKITPRO=/opt/devkitpro/

and I still get the same error so I tried with sudo also didn't work then I reboot also didn't work so now I'm here

building returns Makefile.split:152: build/us_wiiu/level_rules.mk: No such file or directory powerpc-eabi-cpp -P -DVERSION_US -I . -o build/us_wiiu/level_rules.mk levels/level_rules.mk cc1: fatal error: opening output file build/us_wiiu/level_rules.mk: No such file or directory compilation terminated. make: *** [build/us_wiiu/level_rules.mk] Error 1

Makefile.split:152: build/us_wiiu/level_rules.mk: No such file or directory
powerpc-eabi-cpp -P -DVERSION_US -I . -o build/us_wiiu/level_rules.mk levels/level_rules.mk
cc1: fatal error: opening output file build/us_wiiu/level_rules.mk: No such file or directory
compilation terminated.
make: *** [build/us_wiiu/level_rules.mk] Error 1

Cannot install mingw gcc

I followed the tutorial and installed devkitPro on Windows, setup Fling repo, and installed all the dependencies.
I am unable to install mingw-w64-i686-gcc.

MINGW64 ~
$ pacman -S mingw-w64-i686-gcc
error: target not found: mingw-w64-i686-gcc

Thanks for any advice.

Allow for Virtual Console Style Controller Customization.

I know that we can already switch the functions of the X and B buttons, but wouldn't it be possible to remap other buttons trough the sm64config.txt? For example, what if I wanted the ZR button to act like the Z button instead of the R button? Or what if wanted the D-Pad to act like the C-Buttons instead of the Analog Stick? Would that be possible? Thanks for reading.

Not enough memory

Hello
I have build and everything seem's ok but when i try to install i have this error : "not enough memory"
Thanks

Found : it's the second rpx on the list :)

KPADShutdown not defined

When compiling for Wii U, I get this error:

Compiling: src/pc/gfx/gfx_gx2_window.cpp -> build/eu_wiiu/src/pc/gfx/gfx_gx2_window.o
src/pc/gfx/gfx_gx2_window.cpp: In function 'void gfx_gx2_window_exit_callback()':
src/pc/gfx/gfx_gx2_window.cpp:80:5: error: 'KPADShutdown' was not declared in this scope; did you mean 'WPADShutdown'?
   80 |     KPADShutdown();
      |     ^~~~~~~~~~~~
      |     WPADShutdown
Makefile:905: recipe for target 'build/eu_wiiu/src/pc/gfx/gfx_gx2_window.o' failed
make: *** [build/eu_wiiu/src/pc/gfx/gfx_gx2_window.o] Error 1

Changing KPADShutdown to WPADShutdown solves the problem and the game compiles and runs fine, but I'm not sure if I've introduced bugs to the controls by doing that.

60 FPS patch failed to apply

When running ./tools/apply_patch.sh enhancements/60fps.patch the following errors occur:

Do you wish to apply the patch 'enhancements/60fps.patch'? [Y/N] y
patching file include/types.h
Hunk #1 succeeded at 117 (offset -1 lines).
Hunk #2 FAILED at 132.
Hunk #3 succeeded at 246 (offset -1 lines).
1 out of 3 hunks FAILED -- saving rejects to file include/types.h.rej
patching file src/engine/graph_node.h
patching file src/engine/surface_collision.c
patching file src/engine/surface_load.c
Hunk #2 succeeded at 384 (offset 24 lines).
patching file src/game/camera.c
patching file src/game/camera.h
patching file src/game/envfx_bubbles.c
patching file src/game/envfx_snow.c
patching file src/game/envfx_snow.h
patching file src/game/hud.c
patching file src/game/ingame_menu.c
patching file src/game/level_geo.c
patching file src/game/object_helpers.c
Hunk #1 succeeded at 1549 (offset -5 lines).
patching file src/game/paintings.c
patching file src/game/rendering_graph_node.c
Hunk #19 FAILED at 675.
Hunk #24 FAILED at 891.
Hunk #25 FAILED at 1004.
Hunk #31 succeeded at 1135 with fuzz 1.
Hunk sm64-port#33 succeeded at 1280 with fuzz 2.
Hunk sm64-port#34 succeeded at 1295 (offset 4 lines).
Hunk sm64-port#35 succeeded at 1308 (offset 4 lines).
3 out of 35 hunks FAILED -- saving rejects to file src/game/rendering_graph_node.c.rej
patching file src/game/screen_transition.c
Hunk #4 FAILED at 236.
1 out of 4 hunks FAILED -- saving rejects to file src/game/screen_transition.c.rej
patching file src/menu/intro_geo.c
patching file src/pc/gfx/gfx_dxgi.cpp
patching file src/pc/gfx/gfx_glx.c
patching file src/pc/gfx/gfx_sdl2.c
patching file src/pc/gfx/gfx_whb_window.c
Hunk #1 succeeded at 55 (offset 3 lines).
patching file src/pc/pc_main.c
Hunk #1 succeeded at 79 (offset 1 line).
Hunk #2 succeeded at 117 (offset 1 line).

.exe not found

i builded the port and the name was us.wiiu even though i never did the wiiu steps now i have a build but no exe

Failed to compile in Linux for WiiU

When trying to compile the Wii U version in Linux, I get the following errors:

Compiling: src/pc/gfx/gfx_gx2_window.cpp -> build/us_wiiu/src/pc/gfx/gfx_gx2_window.o
src/pc/gfx/gfx_gx2_window.cpp: In function 'void gfx_gx2_window_exit_callback()':
src/pc/gfx/gfx_gx2_window.cpp:80:5: error: 'KPADShutdown' was not declared in this scope; did you mean 'WPADShutdown'?
80 | KPADShutdown();
| ^~~~~~~~~~~~
| WPADShutdown
src/pc/gfx/gfx_gx2_window.cpp: In function 'bool gfx_gx2_window_foreground_acquire_callback()':
src/pc/gfx/gfx_gx2_window.cpp:283:58: error: invalid conversion from 'int' to 'GX2SurfaceUse' [-fpermissive]
283 | g_depth_buffer.surface.use = GX2_SURFACE_USE_TEXTURE | GX2_SURFACE_USE_DEPTH_BUFFER;
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
make: *** [Makefile:906: build/us_wiiu/src/pc/gfx/gfx_gx2_window.o] Error 1

I see that the file src/pc/gfx/gfx_gx2_window.cpp was updated 2 days ago, so I guess a recent change breaks it. I was able to compile the code some time ago.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.