Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix readme formatting #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

CrepeGoat
Copy link

  • realigned headers
  • specified bash formatting for CL code blocks
  • changed indentation/spacing for bullets & code blocks to a more widely-compliant markdown format

@CrepeGoat CrepeGoat mentioned this pull request Oct 25, 2023
MaikelChan pushed a commit to MaikelChan/sm64 that referenced this pull request Oct 30, 2024
* cleanup & optimization

* optimize 3ds menu

- Prevent redrawing the bottom screen if it doesn't change

- Remove redundant clear of bottom screen

* comment unused code

* generalize multi-viewport support

- Add better multi-viewport support
- Minor documentation updates

* Optimize Sound

- Updated documentation
- Moved communication between Thread5 and 3DS sound thread to cover relevant code more tightly

* Further Tweaks

- Improved documentation
- Improved ViewportClearMode
- Fix regression causing bottom screen to not be updated when moving the 3D slider
- Fixed being able to change AA and resolution while 3D is enabled
- Improved separation of duties in menu system
- Only clear depth buffer of main screen(s) each frame, instead of all buffers.

* Update Documentation

* Increase CPU1 Time Limit

This was recently reduced to 70 by another commit, but 80 is faster on my branch/system.

* More Optimization

- Updated .gitignore
- Restored proper OPT_FLAGS behavior in Makefile. Hard-coded flags are a no-no.
- Updated naming and documentation
- Thread5 is no longer forced to wait for the Sound Thread in all instances. Currently, only  Level Update is implemented. Blocking is reduced and performance is quite a bit better during gameplay.

* Optimize Title Screen

### Implemented Thread5 Block Reduction in all CALL_LOOP targets:
* level_select_menu.c
* file_select.c
* star_select.c

### Cleaned up Thread5 Block Reduction with ternary operator.

* Simplify Audio and Improve Rendering

## Improved Audio System
- Improved naming and documentation
- Vastly simplified 3DS audio code while maintaining (improving?) performance
- Removed some outdated 3DS-only code in external.c
- Fixed a race condition causing the audio thread to sometimes hang on game exit

## Optimized Screen Clearing and Rendering

- Disabled depth test for bottom-screen menu objects.
- Created a set of color conversion macros.
- On 3DS, the system no longer uses the emulated rendering system to clear the framebuffer and Z buffer (except in goddard).
- Refined the system for determining viewport clearing to allow buffer clear requests to be accumulated over a frame and cleared after.
- Viewport settings are now accessed through functions instead of global variables. Want to move these to gfx_rapi eventually.
- Removed Viewport distinction between right and left eye views, as it is no longer necessary.
- removed now-obsolete multi_viewport.c

* Make Audio Bufs Volatile

## sDspBuffers is now volatile, as it is shared between CPUs. This improves performance and reduces popping, as audio buffers are no longer erroneously discarded.

* Mitigate Redundant Copying

## Moved buffer size to a #define
## Audio data is now synthesized directly into the DSP Buffer when possible
## Audio thread now waits for the DSP Buffer to be ready before playing, which should eliminate dropped audio buffers.
## update gitignore

* Fix Unnecessary Wait

Reduce wasted time in level_script_execute

* Optimize clear_viewport

## Applied the same optimizations as in clear_frame_buffer

* Optimize Volatility

## Audio data buffers are no longer volatile; only the metadata

* Update Documentation

* Fix Nonexistent Race Condition

## Fixed a race condition where, if the DSP outruns the audio thread, and if the audio thread does not directly write the sound buffer, the DSP could play old data for a very short time. This is impossible with the current partial copy system, but the new code is still more correct.

* Make Allocation Sizes Clearer

* Improve Parameter Naming

* Fix Type Redefinition

## 3DS libraries must all be imported within a type redefinition guard, as shown in audio_3ds_threading.h.
## Renamed __type replacements to __3ds_type to better reflect their origin

* Clean Up aInterleave()

## aInterleave appears to be a relic of C-to-C source optimization
## Improved documentation

* Remove Misleading Comment

* Prep for Patch Updates

## Added some functionality that will be required by the 60fps patch

* Fix Patches

## Fixed patches
## Added a bit of code to gfx_citro3d.c to allow the 60fps patch to function with native clear code

* Fix EU Build

* Optimize Mixer

## Modified synthesis.c
- Fixed ordering on DMEM_ADDR defines.
- Improved documentation and naming.
- Split synthesis_process_note(s) into multiple versions: one for N64, and two for non-N64. The original version was extremely difficult to read and work with due to the maze of preprocessor directives.
- Added support for Enhanced RSPA Emulation (see mixer.c heading for more info).
- Documented most of synthesis_process_note(s). The US-non-N64 version has been rearranged for best readability.
- Added some profiling info (will clean up before merge).

## Modified level_script.c
- Added commented-out 3DS sleeps.

## Modified mixer.c (RSP Audio Emulation)
- Removed all functional code and moved it to different files inside of the mixer_implementations directory. This file now selects one of those other files at build-time.

## Modified mixer.h
- Added Enhanced RSPA Emulation build-time toggle to bypass some inefficiencies that were necessary on N64, but unnecessary in emulation.
- Improved documentation.

## Created mixer_neon.c, mixer_sse41.c, mixer_reference.c, mixer_3ds.c
- These files contain complete RSPA implementations.

## Created mixer_3ds.c
- Contains an RSPA implementation optimized for 3DS.
- Added additional clamping functions. On 3DS, it's significantly faster to break clamping into two steps, which causes GCC to use conditional math instead of conditional branches.
- Rewrote aEnvMixerImpl and aMixImpl for better 3DS performance and readability.

## Created profiler_3ds.c, profiler_3ds.h
- Used as a quick-and-dirty 3DS-specific profiling system intended for use with a debugger.
- Can be enabled or disabled at build time with a one-line edit to the header file.
- History sizes can be configured.
- Notably, does not use any 3DS includes, and thus does not destroy your type definitions.

## Modified audio_3ds_threading.h
- Added support for the 3DS threadsleep function, which can be enabled/disabled at compile time.
- Renamed some stuff to be more consistent.

## Modified audio_3ds.c
- Now uses the 3DS sleep function in audio_3ds_threading.h when appropriate.
- Now uses the profiler.

### Files with updated documentation only
- controller_3ds.c
- gfx_3ds.h

* Re-add lower volume clamping

Accidentally left this disabled in the last commit. It seems to work fine disabled, but I'll air on the side of caution since I cannot technically confirm.

* Fix documentation

* Implement 3DS SIMD32 Mixer

## Modified mixer.c
- Added a developer note and support for mixer_3ds_simd32.c

## Created mixer_3ds_simd32.c
- A version of mixer_3ds.c which uses SIMD32 instructions for performance improvements. Unfortunately, they have turned out less useful than planned.

### Compiler Guards
- Added compilation guards to some other mixer implementations to quiet down IntelliSense.

* Add Check for Saturating Arithmetic Instructions

## Also added some commented lines in the Makefile for debugging and a comment in mixer.c

* Clean Up Profiler

* Remove Dated TODO

* Misc Fixes

- Update README.md
- Improve Makefile's handling of new audio flags

* Update 60fps Patch

* Update fps.patch

* Fix Race Condition

- Fixed a race condition where Thread5 could outrun the sound thread, causing a deadlock
- Fixed a build error with the EU version
- Removed a redundant syncronization variable from audio_3ds_threading.h
- Re-enabled sleep functions in level_script.c

* More Aggressively Avoid Intermediate Audio Copies

## Modified profiler_3ds.h, profiler_3ds.c
- Added _3DS to all header symbols to avoid potential name conflicts
## Modified audio_3ds.h, audio_3ds.c, synthesis.c
- The check for direct DSP buffer copying is now done at the latest possible point, rather than at the start of an audio frame, slightly increasing average performance.

* Use Enhanced RSPA Emulation on EU

- Updated documentation
- EU version now partially uses Enhanced RSPA Emulation and fully uses 3DS Copy Buffer Bypass.

* Remove Debug Variable

Was accidentally left in

* Fix Single-Threaded Audio

Single-threaded audio now runs on Thread5 instead of creating a Thread that shares CPU0. Also moved some code around.

* Update Formatting

* Remove Debug Volatile

* Fix DISABLE_AUDIO Build Flag

- Fixed various preprocessor directives related to the DISABLE_AUDIO flag
- Added a Null Mixer to save space if audio is disabled at compile-time.

* Update Thread Synchronization

- Thread synchronization variables have been reconsidered and renamed
- Removed some redundant values related to synchronization
- Fixed a bug causing the 3DS sleep func to be tied to the profiler

* Minor Optimizations and Cleanup

* More Optimization

- Optimized aAdpcmDec
- Optimized aMix
- Removed some commented code

* Update Profiler

- Exposed and used profiler_init()
- Added missing profile step 13 in audio code
- Adjusted snoop interval

* SIMD32 Usage and Misc Optimizations

## Now uses ARMv6k SIMD32 for ADPCM Decode and Resample
## Now forces some loops to unroll a specified amount of times
## Improved documentation

* Cleanup

## Updated some comments
## Improved some formatting
## Added some more relevant loop unrolling
## Updated mixer_3ds.c to be in-line with mixer_3ds_simd32.c

* Misc Fixes and Improvements

## Modified profiler_3ds.c, profiler_3ds.h
- Completely reworked, now featuring multiple modes of logging.

## Modified audio_3ds_threading.h
- Enabled N3DS sleep function
- Defined N3DS CPU time limits here instead of magic numbers
- Created an enum specifying which CPU the audio runs on, and a variable to hold it

## Modified audio_3ds.c, gfx_3ds.c
- Using the changes from audio_3ds_threading.h, the game now detects lid closure and home menu presses properly. Slowdown in the home menu is fixed, and the game no longer runs with the lid closed.

* Disable Profiler

* Update Comment

* Add Build Flag for Accurate Audio Math

## Build flag AUDIO_USE_ACCURATE_MATH added, which is off by default, allowing 3DS audio to use the more accurate rounding present in the original RSPA.
## Improved documentation in the README

* Add Build Tip to README

* Add Padding for Patch Compatibility

* Update Patches

## All three supported patches now apply correctly in any order

* Remove Misleading Comment

* Remove Jump Table Comments
These are no longer really necessary.

* Add EOF Newlines

## Also moved an import in profiler_3ds.h to be inside the dedupe guard and adjusted layout slightly

* Move audio_game_loop_tick Call When Appropriate

Moved audio_game_loop_tick to be in the correct location when building for Non-3DS or with audio disabled.

* Fix EU Audio

* Remove Outdated Comment

* Update Patches

* Improve Formatting

* Fix Debounce for PAL

* Fix Debounce

- Debounce is no longer altered by the draw function
- Debounce is now handled in a more logical location
- Altered some naming and scoping

* Update Patches

* Improve APT Hook Handle

- Now easier to read
- Now prints error/success messages

* Fix Patches

* Rename Function

- audio_3ds_play_internal is more descriptive than _fast.

* Remove 3DS Screen Clear Workarounds

## Fixes credits.
## These workarounds are not particularly necessary anymore.
## Performance is still above master, as the screen is no longer cleared twice each frame.

* Remove Unnecessary Comment

This comment previously fixed a patch conflict, but it is no longer necessary.

* Fix Patches

* Minor Optimizations and Readability

- Reverted aEnvMixerImpl to its old array-based format. It is slightly faster, because vols being a 2D array reduces the ASM file by 10 lines.
- Removed manual unroll compiler directives on aEnvMixer because not unrolling is actually slightly faster
- Improved documentation

* Fix Silent Audio Regression

Fixed a regression causing AUDIO_USE_ACCURATE_MATH to produce silence

* Fix Comment

* Make -o3 default on N3DS

OPT_CFLAGS are no longer ignored, so let's use O3 by default on 3DS instead of O2

* Remove Optimization Recommendations

-o3 is now default in the Makefile, so it can be removed from the readme.

* Disable Frameskip By Default

Also made N3DS frameskip an affirmative flag, e.g. "ENABLE_" rather than "DIASBLE_"

* Add Performance Documentation

* Performance Comment Improvements

* Add Missing Mnemonic

* Outline Rate Check

The rate check in aEnvMixer is now outlined, improving performance but bloating code and making readability go nuclear.

Also re-ordered some macros to flow logically.

* Fix Popping Audio with Accurate Math

Re-added a missing clamp16 to both 3DS mixers, fixing audio pops when AUDIO_USE_ACCURATE_MATH was set.

* Re-add Accidentally Removed Credit

* Add Developer Note

* Remove EnvMixer Clamp Define

It was only necessary for testing.

* Remove Unused #include

* Speed Up DSP Cache Flush

This took forever to find.

- Replaced DSP_FlushDataCache with svcFlushProcessDataCache. DSP_FlushDataCache slows down the higher AppCpuTimeLimit is set, but svcFlushProcessDataCache stays fast and works perfectly. This saves 1 to 5 milliseconds per frame on the audio thread, and reduces judder substantially.
- Improved the profiler. It can now print the circular log into a string, good for printing VERY SLOWLY over GDB remote debug.
- Improved documentation for profiler

* Fix o2DS Compatibility

* Avoid Setting AppCpuTimeLimit When Not Applicable

Thread5 audio and new 3DS will no longer alter AppCpuTimeLimit when sleeping.

* Fix Debug Print

* Fix Theoretical Infinite Loop

No longer wait infinitely for synchronous audio. It never actually mattered, because synchronous audio would always be finished, but this logic is superior.

* Catch APT Hooks With All Audio CPUs

Improved logic dictates that we should catch all events. Also improved logging.

* Make App Suspend Counter Non-Atomic

- This variable is entirely local to Thread5. No need for atomicity.
- Added a status variable to audio_3ds_threading.h.
- Updated documentation.

This may have fixed the random slowdown after sleep/suspend, but I am unsure.

* Use Sleep Macro Everywhere

* fix .cia builds

- cia builds no longer crash on boot, thanks to the change to template.rsf.
- Thread creation now attempts to set priorities for both threads
- Thread creation now prints additional information

* Fix random crash when closing lid

Previously, closing the lid had a chance to crash the game, or rather, for it to hang indefinitely. While I still do not know the exact cause, I am quite certain that it was related to the APT hook handler's loop that waited for the audio thread to finish. I'm not sure why it failed, but it did, and now it's gone.

- Added a function to audio_3ds.h that can set the volume of the NDSP directly. This is used in the APT hook handler.
- Added a struct for interacting with the NDSP mix parameters.

* Finish NdspMix

NdspMix now contains proper names for all settings.

* Fix Build Errors

Fixed a typing error for svcFlushProcessDataCache and fixed a goof with some fprintf calls.

* Fix warnings from profiler_3ds

- profiler_3ds.c no longer throws warnings when the profiler is disabled.
- Fixed useless range check on unsigned variable in profiler_3ds.c
- Silenced a warning for an unused variable in profiler_3ds/profiler_3ds_snoop_impl

* Update patches

* Profiler Adjustments and Various Optimizations

- Removed audio thread profiling hooks because the audio thread is finished.
- Added detailed main-thread profiling, currently only correct in single-threaded mode.
- Optimized vertex and triangle processing somewhat in gfx_pc.c

* Explicitly use Float Constant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants