Skip to content

Commit

Permalink
Pushing audio to 2nd CPU (OS Core) (n64decomp#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkst authored Sep 17, 2020
1 parent c686ca4 commit d9d0b7d
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 138 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ A prior copy of the game is required to extract the assets.
## Changes vs. Vanilla 3DS Port

- Based off [Refresh 11](https://github.com/sm64-port/sm64-port/commit/9214dddabcce4723d9b6cda2ebccbac209f6447d)
- Audio running on 2nd CPU core; better performance on O3DS
- Naive frame-skip if frame takes longer than 33.3ms (1 / 30 FPS) to render
- Disable by building with `DISABLE_N3DS_FRAMESKIP=1`
- Configurable controls via `sm64config.txt`
- Use [this](https://codepen.io/benoitcaron/full/abNZrbP) online editor from [BenoitCaron](https://github.com/BenoitCaron).
- GFX_POOL_SIZE [fix](https://github.com/aboood40091/sm64-port/commit/6ae4f4687ed234291ac1e572b75d65191ca9f364) (support 60 FPS on 32bit platforms)
Expand All @@ -16,6 +19,10 @@ A prior copy of the game is required to extract the assets.
- Experimental Stereo 3D support; add build flag `ENABLE_N3DS_3D_MODE=1` to try it out
- Support injection of [SMDH](https://www.3dbrew.org/wiki/SMDH) file into the .3dsx
- Change the `icon.png` in the base of this repository before building.
- Patches updated for 3DS:
- [60 FPS](enhancements/60fps.patch)
- [Puppycam](enhancements/puppycam.patch)
- [Show FPS](enhancements/fps.patch)

## Building

Expand Down
16 changes: 8 additions & 8 deletions enhancements/60fps.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ index 2d49d06..31cb72f 100644
gSPDisplayList(displayListIter++, &intro_seg7_dl_0700B3A0);
gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW);
diff --git a/src/pc/gfx/gfx_citro3d.c b/src/pc/gfx/gfx_citro3d.c
index affdf08..42e86b8 100644
index fbad0f6..0d1d6c1 100644
--- a/src/pc/gfx/gfx_citro3d.c
+++ b/src/pc/gfx/gfx_citro3d.c
@@ -810,7 +810,7 @@ static void gfx_citro3d_init(void)
Expand Down Expand Up @@ -1942,10 +1942,10 @@ index 4fd5c43..7897c6b 100644
Uint32 elapsed = SDL_GetTicks() - last_time;

diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c
index fba2ba0..0c92f3d 100644
index 43bedb4..b3224b6 100644
--- a/src/pc/pc_main.c
+++ b/src/pc/pc_main.c
@@ -80,6 +80,25 @@ void send_display_list(struct SPTask *spTask) {
@@ -81,6 +81,25 @@ void send_display_list(struct SPTask *spTask) {
#define SAMPLES_LOW 528
#endif

Expand All @@ -1971,15 +1971,15 @@ index fba2ba0..0c92f3d 100644
void produce_one_frame(void) {
gfx_start_frame();
game_loop_one_iteration();
@@ -93,6 +112,11 @@ void produce_one_frame(void) {
@@ -94,6 +113,11 @@ void produce_one_frame(void) {
audio_api->play((u8 *)audio_buffer, 2 * num_audio_samples * 4);

#endif
gfx_end_frame();
+
+ gfx_start_frame();
+ patch_interpolations();
+ send_display_list(gGfxSPTask);
+ gfx_end_frame();
}

#ifdef TARGET_WEB
#ifdef TARGET_N3DS
LightEvent_Wait(&s_event_main);
#endif
17 changes: 6 additions & 11 deletions enhancements/fps.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/game/game_init.c b/src/game/game_init.c
index 3ce5f2d..a102e6f 100644
index 0e1d914..fbfa95e 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -59,6 +59,24 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
@@ -63,6 +63,24 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
u16 gDemoInputListID = 0;
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check

Expand All @@ -27,20 +27,15 @@ index 3ce5f2d..a102e6f 100644
/**
* Initializes the Reality Display Processor (RDP).
* This function initializes settings such as texture filtering mode,
@@ -639,12 +657,12 @@ void game_loop_one_iteration(void) {
@@ -652,7 +670,7 @@ void game_loop_one_iteration(void) {
LightEvent_Signal(&s_event_audio);
#endif
osContStartReadData(&gSIEventMesgQueue);
}
-
audio_game_loop_tick();
config_gfx_pool();
read_controller_inputs();
levelCommandAddr = level_script_execute(levelCommandAddr);
display_and_vsync();
-
+ render_fps();

// when debug info is enabled, print the "BUF %d" information.
if (gShowDebugText) {
// subtract the end of the gfx pool with the display list to obtain the
diff --git a/src/pc/ultra_reimplementation.c b/src/pc/ultra_reimplementation.c
index 2b28ea8..541b419 100644
--- a/src/pc/ultra_reimplementation.c
Expand Down
Loading

0 comments on commit d9d0b7d

Please sign in to comment.