Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Performance issues in various menus #28

Closed
Kodtiz3D opened this issue Aug 17, 2019 · 6 comments
Closed

Performance issues in various menus #28

Kodtiz3D opened this issue Aug 17, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@Kodtiz3D
Copy link

Kodtiz3D commented Aug 17, 2019

Describe the bug
In the Scripts menu, when scripts are on screen it tanks the FPS.

To Reproduce
Download the scripts from the Updater page with Extra - Scripts

Expected behavior
Consistent performance/FPS when idling and in navigating.

Console (please complete the following information):

  • 3DS
  • Luma 10.0.1
  • UM Version 3.1 Nightly (Commit hash unknown)
@Kodtiz3D Kodtiz3D added the bug Something isn't working label Aug 17, 2019
@SuperSaiyajinStackZ
Copy link
Member

This should be fixed with the Latest Commit : 8039cce

Can you test the latest Nightly and confirm that? :)

@Kodtiz3D
Copy link
Author

While performance has most certainly improved, the speed of the background is noticeably slower when compared to the main menu. Similar slowness also happens in the Filemenu screen. I also noticed significant slowdowns in the Playlist section of the Music Player Menu. This was tested using Nightly 5d154f1
I do not know if the slower BG speed is intentional or not but it is something I noticed.

@Epicpkmn11
Copy link
Member

Epicpkmn11 commented Aug 22, 2019

iirc VoltZ has it waiting 2 vblanks instead of one in lists currently to make the cursor usably slow (the 3DS doesn't have keysDownRepeat() like the DS), but this also slows the background, I assume that could be fixed by adding some kinda key wait variable like

// In a global scope
int keyDelay = 0;
---
// In the main loop (probably by wherever the vblank wait is)
if(keyDelay > 0) keyDelay--;
---
// When checking the key
if(held & KEY_DOWN && keyDelay == 0) {
    keyDelay = 3;
    // Other code
}

or you could do like libnds's keysDownRepeat https://github.com/devkitPro/libnds/blob/105d4943dbac8f2bd99a47b22cd3ed48f96af083/source/arm9/keys.c#L47

@Kodtiz3D
Copy link
Author

Makes sense. As for the performance in the Playlists, it's significantly lower than 30fps as I can see the individual frames. Or it's just jittery. Can't tell.

@Epicpkmn11
Copy link
Member

Epicpkmn11 commented Aug 22, 2019

The playlist screen is scanning the SD every frame, so that's why it's so slow
musicPlayerScreen.cpp (Line 537)

	if(dirChanged) {
		char startPath[PATH_MAX];
		getcwd(startPath, PATH_MAX);
		chdir("sdmc:/Universal-Manager/playlists/");
		getDirectoryContents(plsts);
		chdir(startPath);
	}

should be

	if(dirChanged) {
		dirChanged = false;
		char startPath[PATH_MAX];
		getcwd(startPath, PATH_MAX);
		chdir("sdmc:/Universal-Manager/playlists/");
		getDirectoryContents(plsts);
		chdir(startPath);
	}

@Kodtiz3D Kodtiz3D changed the title Severe performance issues in Scripts menu Performance issues in various menus Aug 22, 2019
@Kodtiz3D
Copy link
Author

Tested using Nightly ae8a0de
All screens with the performance issues are now fluid compared to the main menu, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants