From 913939d48e882d2b4b2673fabd008212f12b675e Mon Sep 17 00:00:00 2001 From: Sean Maas Date: Wed, 27 Dec 2023 11:37:01 -0500 Subject: [PATCH] Clean up and flesh out readme --- .github/pull_request_template.md | 2 +- .gitignore | 1 - Makefile | 39 +++++++++++--------------- README.md | 48 ++++++++++++++++++++++---------- src/memory.cpp | 2 +- src/rdp.cpp | 2 +- 6 files changed, 54 insertions(+), 40 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fbd127e..1a639b8 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1 +1 @@ -While I appreciate anyone who wants to contribute, my goal with this project is to challenge myself and not to review code. I feel guilty rejecting a change that someone spent time on, but I also don't feel great accepting changes that I didn't ask for. For this reason, I've decided to stop accepting pull requests. You're of course still free to do anything with the code that's allowed by the license, but if you submit a pull request it will likely be ignored. I hope this is understandable! +Pull requests are not accepted for this project; see the contributing section of the readme for more details. diff --git a/.gitignore b/.gitignore index b0df277..474390a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ /rokuyon.nro pif_rom.bin rokuyon.ini -/VS2022 diff --git a/Makefile b/Makefile index cd4e772..12991af 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -NAME := rokuyon -BUILD := build -SOURCES := src src/desktop -ARGS := -O3 -flto -std=c++11 -DLOG_LEVEL=0 -LIBS := $(shell pkg-config --libs portaudio-2.0) -INCLUDES := $(shell pkg-config --cflags portaudio-2.0) +NAME := rokuyon +BUILD := build +SRCS := src src/desktop +ARGS := -O3 -flto -std=c++11 -DLOG_LEVEL=0 +LIBS := $(shell pkg-config --libs portaudio-2.0) +INCS := $(shell pkg-config --cflags portaudio-2.0) APPNAME := rokuyon PKGNAME := com.hydra.rokuyon @@ -12,10 +12,10 @@ DESTDIR ?= /usr ifeq ($(OS),Windows_NT) ARGS += -static -DWINDOWS LIBS += $(shell wx-config-static --libs std,gl) -lole32 -lsetupapi -lwinmm - INCLUDES += $(shell wx-config-static --cxxflags std,gl) + INCS += $(shell wx-config-static --cxxflags std,gl) else LIBS += $(shell wx-config --libs std,gl) - INCLUDES += $(shell wx-config --cxxflags std,gl) + INCS += $(shell wx-config --cxxflags std,gl) ifeq ($(shell uname -s),Darwin) ARGS += -DMACOS LIBS += -headerpad_max_install_names @@ -25,9 +25,9 @@ else endif endif -CPPFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp)) -HFILES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.h)) -OFILES := $(patsubst %.cpp,$(BUILD)/%.o,$(CPPFILES)) +CPPFILES := $(foreach dir,$(SRCS),$(wildcard $(dir)/*.cpp)) +HFILES := $(foreach dir,$(SRCS),$(wildcard $(dir)/*.h)) +OFILES := $(patsubst %.cpp,$(BUILD)/%.o,$(CPPFILES)) all: $(NAME) @@ -64,24 +64,19 @@ uninstall: endif endif -switch: - $(MAKE) -f Makefile.switch - $(NAME): $(OFILES) g++ -o $@ $(ARGS) $^ $(LIBS) $(BUILD)/%.o: %.cpp $(HFILES) $(BUILD) - g++ -c -o $@ $(ARGS) $(INCLUDES) $< + g++ -c -o $@ $(ARGS) $(INCS) $< $(BUILD): - for dir in $(SOURCES); \ - do \ - mkdir -p $(BUILD)/$$dir; \ - done + for dir in $(SRCS); do mkdir -p $(BUILD)/$$dir; done + +switch: + $(MAKE) -f Makefile.switch clean: -ifneq ($(strip $(DEVKITPRO)),) - $(MAKE) -f Makefile.switch clean -endif + if [ -d "build-switch" ]; then $(MAKE) -f Makefile.switch clean; fi rm -rf $(BUILD) rm -f $(NAME) diff --git a/README.md b/README.md index d8852ac..3788786 100644 --- a/README.md +++ b/README.md @@ -2,28 +2,48 @@ An experimental N64 emulator ### Overview -My main goal with rokuyon is to learn about the Nintendo 64 hardware so I can write homebrew like [sodium64](https://github.com/Hydr8gon/sodium64). If it ends up being more than that... I wouldn't mind making a modern, accurate N64 emulator with built-in software/hardware rendering and no messy plugins. +My main goal with rokuyon is to learn about the N64's hardware so I can write homebrew like +[sodium64](https://github.com/Hydr8gon/sodium64). If it ends up being more than that, I wouldn't mind making a modern, +accurate N64 emulator with built-in software/hardware rendering and no messy plugins. ### Downloads -rokuyon is available for Linux, macOS, Windows, and Switch. Automatic builds are provided via GitHub Actions; you can download them on the [releases page](https://github.com/Hydr8gon/rokuyon/releases). +rokuyon is available for Windows, macOS, Linux, and Switch. The latest builds are automatically provided via GitHub +Actions, and can be downloaded from the [releases page](https://github.com/Hydr8gon/rokuyon/releases). ### Usage -Although still in early stages, rokuyon should be plug-and-play with any NTSC ROMs in big-endian format. Performance will be bad and there will be plenty of issues. At this stage, rokuyon should be considered a curiosity and not a dedicated emulator for playing games. +No setup is required to run things in rokuyon, but right now it only supports NTSC ROMs in big-endian format. Save types +are not automatically detected, and must be manually selected in the file menu to work. Performance will be bad without +a powerful CPU, and you'll probably encounter plenty of emulation issues. At this stage, rokuyon should be considered a +curiosity and not a dedicated emulator for playing games. ### Contributing -While I appreciate anyone who wants to contribute, my goal with this project is to challenge myself and not to review code. I feel guilty rejecting a change that someone spent time on, but I also don't feel great accepting changes that I didn't ask for. For this reason, I've decided to stop accepting pull requests. You're of course still free to do anything with the code that's allowed by the license, but if you submit a pull request it will likely be ignored. I hope this is understandable! +This is a personal project, and I've decided to not review or accept pull requests for it. If you want to help, you can +test things and report issues or provide feedback. If you can afford it, you can also donate to motivate me and allow me +to spend more time on things like this. Nothing is mandatory, and I appreciate any interest in my projects, even if +you're just a user! -### References -* [n64dev](https://github.com/mikeryan/n64dev) - A collection of useful materials for initial research -* [N64brew Wiki](https://n64brew.dev/wiki/Main_Page) - Extensive and organized documentation of the whole system -* [libdragon](https://github.com/DragonMinded/libdragon) - An open-source N64 SDK with good examples of using the hardware +### Building +**Windows:** Install [MSYS2](https://www.msys2.org) and run the command +`pacman -Syu mingw-w64-x86_64-{gcc,pkg-config,wxWidgets,portaudio,jbigkit} make` to get dependencies. Navigate to the +project root directory and run `make -j$(nproc)` to start building. + +**macOS/Linux:** On the target system, install [wxWidgets](https://www.wxwidgets.org) and +[PortAudio](https://www.portaudio.com). This can be done with the [Homebrew](https://brew.sh) package manager on macOS, +or a built-in package manager on Linux. Run `make -j$(nproc)` in the project root directory to start building. + +**Switch:** Install [devkitPro](https://devkitpro.org/wiki/Getting_Started) and its `switch-dev` package. Run +`make switch -j$(nproc)` in the project root directory to start building. + +### Hardware References +* [N64brew Wiki](https://n64brew.dev/wiki/Main_Page) - Extensive documentation of both hardware and software * [RSP Vector Instructions](https://emudev.org/2020/03/28/RSP.html) - Detailed information on how vector opcodes work -* [RCP Documentation](https://dragonminded.com/n64dev/Reality%20Coprocessor.pdf) - Nice reference for a subset of RDP functionality -* [RDP Triangle Command Guide](https://docs.google.com/document/d/17ddEo61V0suXbSkKP5mY97QxgUnB-QfAjuBIsPiLWko) - Covers everything related to RDP triangles -* [N64 bilinear filter (3-point)](https://www.shadertoy.com/view/Ws2fWV) - Reference implementation of the N64's texture filter -* [dgb-n64](https://github.com/Dillonb/n64) - Provides details of the FLASH interface, since it isn't documented -* Hardware tests - I'll probably be testing things myself as I go along +* [RCP Documentation](https://dragonminded.com/n64dev/Reality%20Coprocessor.pdf) - Nice reference for a subset of RDP +functionality +* [RDP Triangle Command Guide](https://docs.google.com/document/d/17ddEo61V0suXbSkKP5mY97QxgUnB-QfAjuBIsPiLWko) - Covers +everything related to RDP triangles +* [n64-systemtest](https://github.com/lemmy-64/n64-systemtest) - Comprehensive tests that target all parts of the system +* [n64dev](https://github.com/mikeryan/n64dev) - A collection of useful documents and source code ### Other Links * [Hydra's Lair](https://hydr8gon.github.io) - Blog where I may or may not write about things -* [Discord Server](https://discord.gg/JbNz7y4) - Place to chat about my projects and stuff +* [Discord Server](https://discord.gg/JbNz7y4) - A place to chat about my projects and stuff diff --git a/src/memory.cpp b/src/memory.cpp index 30dbe02..de08181 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -382,7 +382,7 @@ template void Memory::write(uint32_t address, T value) void Memory::writeFlash(uint32_t value) { - // Handle a FLASH register write based on the command byte + // Handle a FLASH register write based on https://github.com/Dillonb/n64 switch (uint8_t command = value >> 24) { case 0xD2: // Execute diff --git a/src/rdp.cpp b/src/rdp.cpp index 91d4c9a..0ee95a8 100644 --- a/src/rdp.cpp +++ b/src/rdp.cpp @@ -368,7 +368,7 @@ uint32_t RDP::getTexel(Tile &tile, int s, int t, bool rect) s -= tile.sBase; t -= tile.tBase; - // Fall back to nearest sampling when appropriate + // Fall back to nearest sampling, or filter based on https://www.shadertoy.com/view/Ws2fWV if (!Settings::texFilter || !texFilter || cycleType >= COPY_MODE) return getRawTexel(tile, s >> 5, t >> 5);