Shuffle without bgm (#157)
* add ability to shuffle without bgm press B twice * add license thingy for icons8, and thanks for their amazing icons
This commit is contained in:
@@ -42,6 +42,7 @@ void init_screens(void)
|
||||
pp2d_load_texture_png(TEXTURE_ARROW, "romfs:/arrow.png");
|
||||
pp2d_load_texture_png(TEXTURE_ARROW_SIDE, "romfs:/arrow_side.png");
|
||||
pp2d_load_texture_png(TEXTURE_SHUFFLE, "romfs:/shuffle.png");
|
||||
pp2d_load_texture_png(TEXTURE_SHUFFLE_NO_BGM, "romfs:/shuffle_no_bgm.png");
|
||||
pp2d_load_texture_png(TEXTURE_INSTALLED, "romfs:/installed.png");
|
||||
pp2d_load_texture_png(TEXTURE_PREVIEW_ICON, "romfs:/preview.png");
|
||||
pp2d_load_texture_png(TEXTURE_SORT, "romfs:/sort.png");
|
||||
@@ -478,8 +479,11 @@ void draw_interface(Entry_List_s* list, Instructions_s instructions)
|
||||
|
||||
pp2d_draw_wtext(list->entry_size+6, vertical_offset + 16, 0.55, 0.55, font_color, name);
|
||||
|
||||
if(current_entry->in_shuffle)
|
||||
if(current_entry->no_bgm_shuffle)
|
||||
pp2d_draw_texture_blend(TEXTURE_SHUFFLE_NO_BGM, 320-24-4, vertical_offset, font_color);
|
||||
else if(current_entry->in_shuffle)
|
||||
pp2d_draw_texture_blend(TEXTURE_SHUFFLE, 320-24-4, vertical_offset, font_color);
|
||||
|
||||
if(current_entry->installed)
|
||||
pp2d_draw_texture_blend(TEXTURE_INSTALLED, 320-24-4, vertical_offset + 22, font_color);
|
||||
|
||||
|
||||
@@ -286,9 +286,24 @@ static void change_selected(Entry_List_s * list, int change_value)
|
||||
static void toggle_shuffle(Entry_List_s * list)
|
||||
{
|
||||
Entry_s * current_entry = &list->entries[list->selected_entry];
|
||||
if(current_entry->in_shuffle) list->shuffle_count--;
|
||||
else list->shuffle_count++;
|
||||
current_entry->in_shuffle = !current_entry->in_shuffle;
|
||||
if(current_entry->in_shuffle)
|
||||
{
|
||||
if(current_entry->no_bgm_shuffle)
|
||||
{
|
||||
current_entry->in_shuffle = false;
|
||||
current_entry->no_bgm_shuffle = false;
|
||||
list->shuffle_count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_entry->no_bgm_shuffle = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
current_entry->in_shuffle = true;
|
||||
list->shuffle_count++;
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -100,13 +100,22 @@ static Result install_theme_internal(Entry_List_s themes, int installmode)
|
||||
{
|
||||
char bgm_cache_path[26] = {0};
|
||||
sprintf(bgm_cache_path, "/BgmCache_%.2i.bin", shuffle_count);
|
||||
music_size = load_data("/bgm.bcstm", *current_theme, &music);
|
||||
|
||||
if(music_size > BGM_MAX_SIZE)
|
||||
if(current_theme->no_bgm_shuffle)
|
||||
{
|
||||
free(music);
|
||||
DEBUG("bgm too big\n");
|
||||
return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_TOO_LARGE);
|
||||
music = NULL;
|
||||
music_size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
music_size = load_data("/bgm.bcstm", *current_theme, &music);
|
||||
|
||||
if(music_size > BGM_MAX_SIZE)
|
||||
{
|
||||
free(music);
|
||||
DEBUG("bgm too big\n");
|
||||
return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_TOO_LARGE);
|
||||
}
|
||||
}
|
||||
|
||||
shuffle_music_sizes[shuffle_count] = music_size;
|
||||
@@ -116,8 +125,11 @@ static Result install_theme_internal(Entry_List_s themes, int installmode)
|
||||
FSUSER_OpenFile(&bgm_cache_handle, ArchiveThemeExt, fsMakePath(PATH_ASCII, bgm_cache_path), FS_OPEN_WRITE, 0);
|
||||
|
||||
padded = calloc(BGM_MAX_SIZE, sizeof(char));
|
||||
memcpy(padded, music, music_size);
|
||||
free(music);
|
||||
if(!current_theme->no_bgm_shuffle)
|
||||
{
|
||||
memcpy(padded, music, music_size);
|
||||
free(music);
|
||||
}
|
||||
|
||||
FSFILE_Write(bgm_cache_handle, NULL, 0, padded, BGM_MAX_SIZE, FS_WRITE_FLUSH);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user