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:
@@ -25,6 +25,8 @@ This project is licensed under the GNU GPLv3. See LICENSE.md for details. Additi
|
||||
# Credits
|
||||
The following people contributed to Anemone3DS in some way. Without these people, Anemone3DS wouldn't exist, or wouldn't be as good as it is: [CONTRIBUTORS.md](CONTRIBUTORS.md)
|
||||
|
||||
Most of the icons under `romfs` are from the site [icons8.com](https://icons8.com) and are licensed under the [CC-BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/3.0/)
|
||||
|
||||
Special thanks go to these people who, whilst not directly contributing, helped immensely:
|
||||
* [Rinnegatamante](https://github.com/Rinnegatamante), whose code served as reference on theme installation.
|
||||
* [SteveIce10](https://github.com/SteveIce10), whose QR code in FBI was essential.
|
||||
|
||||
@@ -60,6 +60,7 @@ enum TextureID {
|
||||
TEXTURE_ARROW,
|
||||
TEXTURE_ARROW_SIDE,
|
||||
TEXTURE_SHUFFLE,
|
||||
TEXTURE_SHUFFLE_NO_BGM,
|
||||
TEXTURE_INSTALLED,
|
||||
TEXTURE_PREVIEW_ICON,
|
||||
TEXTURE_SORT,
|
||||
|
||||
@@ -71,6 +71,7 @@ typedef struct {
|
||||
bool is_zip;
|
||||
|
||||
bool in_shuffle;
|
||||
bool no_bgm_shuffle;
|
||||
bool installed;
|
||||
|
||||
json_int_t tp_download_id;
|
||||
|
||||
BIN
romfs/shuffle_no_bgm.png
Normal file
BIN
romfs/shuffle_no_bgm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 511 B |
@@ -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,6 +100,14 @@ 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);
|
||||
|
||||
if(current_theme->no_bgm_shuffle)
|
||||
{
|
||||
music = NULL;
|
||||
music_size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
music_size = load_data("/bgm.bcstm", *current_theme, &music);
|
||||
|
||||
if(music_size > BGM_MAX_SIZE)
|
||||
@@ -108,6 +116,7 @@ static Result install_theme_internal(Entry_List_s themes, int installmode)
|
||||
DEBUG("bgm too big\n");
|
||||
return MAKERESULT(RL_PERMANENT, RS_CANCELED, RM_APPLICATION, RD_TOO_LARGE);
|
||||
}
|
||||
}
|
||||
|
||||
shuffle_music_sizes[shuffle_count] = music_size;
|
||||
remake_file(fsMakePath(PATH_ASCII, bgm_cache_path), ArchiveThemeExt, BGM_MAX_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));
|
||||
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