Skip to content

DX Song Search DTAFunction #40

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jnackmclain
Copy link
Contributor

This adds a new DTAFunction for use by a new commit of rb3dx hmxmilohax/rock-band-3-deluxe#1180

This takes a string input given by the on screen virtual keyboard
String can be for song name, or artist name

The function does as the current rb3e web html song jumping function does
First, dx jumps to the top of the list and resorts to song name
Then each song in the song cache is probed for song name and artist metadata

We prioritize exact matches first, and if no exact matches are found, we search if the string is contained in the metadata
there is no "fuzzy" matching, strictly exact match, or contains.

once we find a match, we resort the song list to either be by song name, or by artist, and jump to the song that was found.

It is MUCH faster than what DX previously did. Let me know thoughts. Thanks.

Here is a preview of the function in action:

dx_song_search.mp4

@jnackmclain
Copy link
Contributor Author

Realized there already helpfully exists MusicLibrarySelectHeading
so added that for artist find, so it jumps to the heading instead of first found song

artist_header.mp4

ExecuteDTA(PORT_ROCKCENTRALGATEWAY, "{{music_library get view_settings_provider} select_setting 1}");
{
char buf[64];
sprintf(buf, "{{music_library get view_settings_provider} select_setting_option %d}", matchedByTitle);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line of code can potentially blow up the stack

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more to buffer as per your rec

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm now

int *start;
int *end;
int unk1;
} song_list_vector;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct layout might cause issues on Wii, as Backbone's modifications to STLPort define a different layout for std::vector's members.

int unk1;
} song_list_vector;

static song_list_vector dta_song_list = { 0 };
Copy link

@DarkRTA DarkRTA May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably go on the stack and be recreated every time. as of right now deleting a song will cause a use-after-free next time you search.

i'm not familiar enough with this codebase to give any specific guidance here so im deferring to @InvoxiPlayGames

Copy link

@DarkRTA DarkRTA May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out this isnt a uaf since its just a vector of song ids, but it should prob be fixed anyway as it'll have song ids that no longer exist after deleting a song

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants