No description
Find a file
xander-haj 91d771ecc4
add LR cycle limit config (#172)
when enabled, limits the the item cycle for L & R to 4 slots
2022-10-29 23:10:14 +02:00
.github Let workflows run manually 2022-09-28 13:26:40 +02:00
other Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
platform Update switch Makefile 2022-10-19 18:57:43 +02:00
saves/ref Initial version 2022-08-15 00:18:01 +02:00
snes Bottom part wasn't black in extend_y mode. 2022-10-20 14:08:57 +02:00
tables override armor palette (#163) 2022-10-21 02:52:15 +02:00
third_party Don't assume we can compile sse on non-windows 2022-10-26 21:07:09 +02:00
.gitignore Update .gitignore 2022-10-15 20:27:43 +02:00
ancilla.c Silence a bunch of warnings 2022-10-19 18:22:23 +02:00
ancilla.h Fix so super bomb won't return to the player on screen change (#126) 2022-10-08 00:51:09 +02:00
assets.h Put all assets into zelda3_assets.dat instead of .h files 2022-09-24 00:40:39 +02:00
attract.c Asset compiler now uses PNG-images as input 2022-10-12 16:34:54 +02:00
attract.h Display up to 240 lines instead of 224 2022-09-18 23:20:33 +02:00
audio.c Add MSUVolume (fixes #153) 2022-10-17 16:19:28 +02:00
audio.h Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
config.c add LR cycle limit config (#172) 2022-10-29 23:10:14 +02:00
config.h Gamepad buttons can now be remapped 2022-10-20 23:23:17 +02:00
dungeon.c Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
dungeon.h Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
ending.c Asset compiler now uses PNG-images as input 2022-10-12 16:34:54 +02:00
ending.h Remove other_modules.c 2022-09-04 13:01:24 +02:00
features.h add LR cycle limit config (#172) 2022-10-29 23:10:14 +02:00
glsl_shader.c A few changes for MSYS2 (#164) 2022-10-25 21:40:20 +02:00
glsl_shader.h OpenGL and GLSL Shader support 2022-10-14 22:23:43 +02:00
hud.c add LR cycle limit config (#172) 2022-10-29 23:10:14 +02:00
hud.h Can now assign items to L and R (#171) 2022-10-28 02:23:39 +02:00
LICENSE.txt Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
load_gfx.c Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
load_gfx.h Asset compiler now uses PNG-images as input 2022-10-12 16:34:54 +02:00
main.c Gamepad buttons can now be remapped 2022-10-20 23:23:17 +02:00
Makefile A few changes for MSYS2 (#164) 2022-10-25 21:40:20 +02:00
messaging.c Silence a bunch of warnings 2022-10-19 18:22:23 +02:00
messaging.h Show widescreen world map 2022-10-19 17:48:38 +02:00
misc.c Simplify PPU code / interactions 2022-10-01 21:05:41 +02:00
misc.h Initial version 2022-08-15 00:18:01 +02:00
nmi.c Silence more warnings 2022-10-19 18:57:30 +02:00
nmi.h Write directly to VRAM instead of through zelda_ppu_write 2022-10-01 21:46:10 +02:00
opengl.c Silence more warnings 2022-10-19 18:57:30 +02:00
overlord.c Migrate to C99 instead of C 2022-08-31 21:03:04 +02:00
overlord.h Move snes_regs.h 2022-09-04 01:06:05 +02:00
overworld.c Silence more warnings 2022-10-19 18:57:30 +02:00
overworld.h Move snes_regs.h 2022-09-04 01:06:05 +02:00
packages.config Merge pull request #7 from kageurufu/sdl_from_nuget 2022-08-31 03:24:03 +02:00
player.c Can now assign items to L and R (#171) 2022-10-28 02:23:39 +02:00
player.h Rename a function 2022-10-08 03:36:13 +02:00
player_oam.c Silence more warnings 2022-10-19 18:57:30 +02:00
player_oam.h Migrate to C99 instead of C 2022-08-31 21:03:04 +02:00
poly.c Migrate to C99 instead of C 2022-08-31 21:03:04 +02:00
poly.h Initial version 2022-08-15 00:18:01 +02:00
README.md Update tcc and sdl to latest versions (#160) 2022-10-20 14:13:31 +02:00
requirements.txt Add requirements.txt. Fixes #60 2022-09-12 19:42:11 +02:00
run_with_tcc.bat Update tcc and sdl to latest versions (#160) 2022-10-20 14:13:31 +02:00
select_file.c Asset compiler now uses PNG-images as input 2022-10-12 16:34:54 +02:00
select_file.h Initial version 2022-08-15 00:18:01 +02:00
spc_player.c Silence more warnings 2022-10-19 18:57:30 +02:00
spc_player.h Migrate to C99 instead of C 2022-08-31 21:03:04 +02:00
sprite.c Don't grab any absorbable under a rock with the hookshot (#126) 2022-10-18 04:56:48 +02:00
sprite.h Change a lot of places to use the oam helpers 2022-10-02 01:59:15 +02:00
sprite_main.c Silence a bunch of warnings 2022-10-19 18:22:23 +02:00
sprite_main.h Asset compiler now uses PNG-images as input 2022-10-12 16:34:54 +02:00
tagalong.c Asset compiler now uses PNG-images as input 2022-10-12 16:34:54 +02:00
tagalong.h Migrate to C99 instead of C 2022-08-31 21:03:04 +02:00
tile_detect.c Migrate to C99 instead of C 2022-08-31 21:03:04 +02:00
tile_detect.h Initial version 2022-08-15 00:18:01 +02:00
types.h Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
util.c Gamepad buttons can now be remapped 2022-10-20 23:23:17 +02:00
util.h Gamepad buttons can now be remapped 2022-10-20 23:23:17 +02:00
variables.h Bug with conveyor belt and mirror (#126) 2022-10-17 17:31:37 +02:00
zelda3.ini add LR cycle limit config (#172) 2022-10-29 23:10:14 +02:00
Zelda3.sln Add MSVC configuration to deploy all/only needed files 2022-09-28 12:28:03 +02:00
zelda3.vcxproj Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
zelda3.vcxproj.filters Opus MSU support and MSU Deluxe support 2022-10-17 00:43:32 +02:00
zelda_cpu_infra.c Silence a bunch of warnings 2022-10-19 18:22:23 +02:00
zelda_cpu_infra.h Clean up and refactor the emulator vs own state 2022-09-28 20:54:19 +02:00
zelda_rtl.c Silence a bunch of warnings 2022-10-19 18:22:23 +02:00
zelda_rtl.h Change some numbers into joypad constants 2022-10-22 12:57:16 +02:00

Zelda3

A reimplementation of Zelda 3.

Our discord server is: https://discord.gg/AJJbJAzNNJ

About

This is a reverse engineered clone of Zelda 3 - A Link to the Past.

It's around 70-80kLOC of C code, and reimplements all parts of the original game. The game is playable from start to end.

You need a copy of the ROM to extract game resources (levels, images). Then once that's done, the ROM is no longer needed.

It uses the PPU and DSP implementation from LakeSnes, but with lots of speed optimizations. Additionally, it can be configured to also run the original machine code side by side. Then the RAM state is compared after each frame, to verify that the C implementation is correct.

I got much assistance from spannerism's Zelda 3 JP disassembly and the other ones that documented loads of function names and variables.

Additional features

A bunch of features have been added that are not supported by the original game. Some of them are:

Support for pixel shaders.

Support for enhanced aspect ratios of 16:9 or 16:10.

Higher quality world map.

Support for MSU audio tracks.

Secondary item slot on button X (Hold X in inventory to select).

Switching current item with L/R keys.

Installing Python & libraries on Windows (required for asset extraction steps)

  1. Download Python installer and install
  2. Open the command prompt
  3. Upgrade pip & install pillow and pyyaml by typing python -m pip install --upgrade pip pillow pyyaml and hit enter
  4. Close the command prompt

Compiling on Windows with TCC (1mb Tiny C Compiler)

  1. Download the project by clicking "Code > Download ZIP" on the github page
  2. Extract the ZIP to your hard drive
  3. Place the USA rom named zelda3.sfc in the "\tables" subfolder
  4. Open the command prompt and navigate to that folder
  5. Extract resources by typing python extract_resources.py and hit enter
  6. Compile the extracted resources by typing python compile_resources.py and hit enter
  7. Close the command prompt
  8. Download TCC and extract to the "\third_party" subfolder
  9. Download SDL2 and extract to the "\third_party" subfolder
  10. Double-click run_with_tcc.bat in the main dir to create zelda3.exe in that same dir
  11. Configure with zelda3.ini in the main dir

Compiling on Windows with Visual Studio (4.5gb IDE and compiler)

Same Steps 1-7 above
8. Double-click Zelda3.sln
9. Change "debug" to "release" in the top dropdown
10. Choose "build > build Zelda3" in the menu to create zelda3.exe in the "/bin/release" subfolder
11. Configure with zelda3.ini in the main dir

Installing libraries on Linux/MacOS

  1. Open a terminal
  2. Install pip if not already installed
python3 -m ensurepip
  1. Clone the repo and cd into it
git clone https://github.com/snesrev/zelda3
cd zelda3
  1. Install requirements using pip
python3 -m pip install -r requirements.txt
  1. Install SDL2
  • Ubuntu/Debian sudo apt install libsdl2-dev
  • Fedora Linux sudo dnf in sdl2-devel
  • Arch Linux sudo pacman -S sdl2
  • macOS: brew install sdl2 (you can get homebrew here)

Compiling on Linux/MacOS

  1. Place your US ROM file named zelda3.sfc in zelda3/tables
  2. Compile
make
Advanced make usage ...
make -j$(nproc) # run on all core
make clean all  # clear gen+obj and rebuild
CC=clang make   # specify compiler

Nintendo Switch

You need DevKitPro and Atmosphere installed.

(dkp-)pacman -S git switch-dev switch-sdl2 switch-tools
cd platform/switch
make # Add -j$(nproc) to build using all cores ( Optional )
# You can test the build directly onto the switch ( Optional )
nxlink -s zelda3.nro

More Compilation Help

Look at the wiki at https://github.com/snesrev/zelda3/wiki for more help.

The ROM needs to be named zelda3.sfc and has to be from the US region with this exact SHA256 hash 66871d66be19ad2c34c927d6b14cd8eb6fc3181965b6e517cb361f7316009cfb

In case you're planning to move the executable to a different location, please include the file tables/zelda3_assets.dat.

Usage and controls

The game supports snapshots. The joypad input history is also saved in the snapshot. It's thus possible to replay a playthrough in turbo mode to verify that the game behaves correctly.

The game is run with ./zelda3 and takes an optional path to the ROM-file, which will verify for each frame that the C code matches the original behavior.

Button Key
Up Up arrow
Down Down arrow
Left Left arrow
Right Right arrow
Start Enter
Select Right shift
A X
B Z
X S
Y A
L C
R V

The keys can be reconfigured in zelda3.ini

Additionally, the following commands are available:

Key Action
Tab Turbo mode
W Fill health/magic
Shift+W Fill rupees/bombs/arrows
Ctrl+E Reset
P Pause (with dim)
Shift+P Pause (without dim)
Ctrl+Up Increase window size
Ctrl+Down Decrease window size
T Toggle replay turbo mode
O Set dungeon key to 1
K Clear all input history from the joypad log
L Stop replaying a shapshot
R Toggle between fast and slow renderer
F Display renderer performance
F1-F10 Load snapshot
Alt+Enter Toggle Fullscreen
Shift+F1-F10 Save snapshot
Ctrl+F1-F10 Replay the snapshot
1-9 run a dungeons playthrough snapshots
Ctrl+1-9 run a dungeons playthrough in turbo mode

License

This project is licensed under the MIT license. See 'LICENSE.txt' for details.