Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions workspace/all/common/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void CFG_defaults(NextUISettings *cfg)
.thumbRadius = CFG_DEFAULT_THUMBRADIUS,
.gameArtWidth = CFG_DEFAULT_GAMEARTWIDTH,
.showFolderNamesAtRoot = CFG_DEFAULT_SHOWFOLDERNAMESATROOT,
.collateSubfolders = CFG_DEFAULT_COLLATESUBFOLDERS,
.inputPromptStyle = CFG_DEFAULT_INPUT_PROMPT_STYLE,
.paletteName = CFG_DEFAULT_PALETTE_NAME,
.customColors = {CFG_DEFAULT_COLOR1, CFG_DEFAULT_COLOR2, CFG_DEFAULT_COLOR3,
Expand All @@ -57,6 +58,9 @@ void CFG_defaults(NextUISettings *cfg)
.showRecents = CFG_DEFAULT_SHOWRECENTS,
.showTools = CFG_DEFAULT_SHOWTOOLS,
.showCollections = CFG_DEFAULT_SHOWCOLLECTIONS,
.showCollectionsPromotion = CFG_DEFAULT_SHOWCOLLECTIONSPROMOTION,
.sortCollectionsEntries = CFG_DEFAULT_SORTCOLLECTIONSENTRIES,
.useCollectionsNestedMap = CFG_DEFAULT_USECOLLECTIONSNESTEDMAP,
.showGameArt = CFG_DEFAULT_SHOWGAMEART,
.gameSwitcherScaling = CFG_DEFAULT_GAMESWITCHERSCALING,
.defaultView = CFG_DEFAULT_VIEW,
Expand Down Expand Up @@ -280,6 +284,21 @@ void CFG_init(FontLoad_callback_t cb, ColorSet_callback_t ccb)
CFG_setShowCollections((bool)temp_value);
continue;
}
if (sscanf(line, "collectionspromotion=%i", &temp_value) == 1)
{
CFG_setShowCollectionsPromotion((bool)temp_value);
continue;
}
if (sscanf(line, "collectionsentriessort=%i", &temp_value) == 1)
{
CFG_setSortCollectionsEntries((bool)temp_value);
continue;
}
if (sscanf(line, "usecollectionsnestedmap=%i", &temp_value) == 1)
{
CFG_setUseCollectionsNestedMap((bool)temp_value);
continue;
}
if (sscanf(line, "gameart=%i", &temp_value) == 1)
{
CFG_setShowGameArt((bool)temp_value);
Expand All @@ -295,6 +314,11 @@ void CFG_init(FontLoad_callback_t cb, ColorSet_callback_t ccb)
CFG_setShowFolderNamesAtRoot((bool)temp_value);
continue;
}
if (sscanf(line, "collateSubfolders=%i", &temp_value) == 1)
{
CFG_setCollateSubfolders((bool)temp_value);
continue;
}
if (sscanf(line, "suspendTimeout=%i", &temp_value) == 1)
{
CFG_setSuspendTimeoutSecs(temp_value);
Expand Down Expand Up @@ -386,6 +410,11 @@ void CFG_init(FontLoad_callback_t cb, ColorSet_callback_t ccb)
CFG_setShowQuickswitcherUI(temp_value);
continue;
}
if (sscanf(line, "quickSwitcherUiGames=%i", &temp_value) == 1)
{
CFG_setShowQuickswitcherUIGames(temp_value);
continue;
}
if (sscanf(line, "wifiDiagnostics=%i", &temp_value) == 1)
{
CFG_setWifiDiagnostics(temp_value);
Expand Down Expand Up @@ -699,6 +728,17 @@ void CFG_setShowFolderNamesAtRoot(bool show)
CFG_sync();
}

bool CFG_getCollateSubfolders(void)
{
return settings.collateSubfolders;
}

void CFG_setCollateSubfolders(bool show)
{
settings.collateSubfolders = show;
CFG_sync();
}

uint32_t CFG_getScreenTimeoutSecs(void)
{
return settings.screenTimeoutSecs;
Expand Down Expand Up @@ -842,6 +882,39 @@ void CFG_setShowCollections(bool show)
CFG_sync();
}

bool CFG_getShowCollectionsPromotion(void)
{
return settings.showCollectionsPromotion;
}

void CFG_setShowCollectionsPromotion(bool show)
{
settings.showCollectionsPromotion = show;
CFG_sync();
}

bool CFG_getSortCollectionsEntries(void)
{
return settings.sortCollectionsEntries;
}

void CFG_setSortCollectionsEntries(bool show)
{
settings.sortCollectionsEntries = show;
CFG_sync();
}

bool CFG_getUseCollectionsNestedMap(void)
{
return settings.useCollectionsNestedMap;
}

void CFG_setUseCollectionsNestedMap(bool show)
{
settings.useCollectionsNestedMap = show;
CFG_sync();
}

bool CFG_getShowGameArt(void)
{
return settings.showGameArt;
Expand Down Expand Up @@ -992,6 +1065,17 @@ void CFG_setShowQuickswitcherUI(bool on)
CFG_sync();
}

bool CFG_getShowQuickswitcherUIGames(void)
{
return settings.showQuickSwitcherUiGames;
}

void CFG_setShowQuickswitcherUIGames(bool on)
{
settings.showQuickSwitcherUiGames = on;
CFG_sync();
}

bool CFG_getWifiDiagnostics(void)
{
return settings.wifiDiagnostics;
Expand Down Expand Up @@ -1392,6 +1476,18 @@ void CFG_get(const char *key, char *value)
else if (strcmp(key, "collections") == 0)
{
sprintf(value, "%i", CFG_getShowCollections());
}
else if (strcmp(key, "collectionspromotion") == 0)
{
sprintf(value, "%i", CFG_getShowCollectionsPromotion());
}
else if (strcmp(key, "collectionsentriessort") == 0)
{
sprintf(value, "%i", CFG_getSortCollectionsEntries());
}
else if (strcmp(key, "usecollectionsnestedmap") == 0)
{
sprintf(value, "%i", CFG_getUseCollectionsNestedMap());
}
else if (strcmp(key, "gameart") == 0)
{
Expand All @@ -1401,6 +1497,10 @@ void CFG_get(const char *key, char *value)
{
sprintf(value, "%i", CFG_getShowFolderNamesAtRoot());
}
else if (strcmp(key, "collateSubfolders") == 0)
{
sprintf(value, "%i", CFG_getCollateSubfolders());
}
else if (strcmp(key, "screentimeout") == 0)
{
sprintf(value, "%i", CFG_getScreenTimeoutSecs());
Expand Down Expand Up @@ -1469,6 +1569,10 @@ void CFG_get(const char *key, char *value)
{
sprintf(value, "%i", (int)(CFG_getShowQuickswitcherUI()));
}
else if (strcmp(key, "quickSwitcherUiGames") == 0)
{
sprintf(value, "%i", (int)(CFG_getShowQuickswitcherUIGames()));
}
else if (strcmp(key, "wifiDiagnostics") == 0)
{
sprintf(value, "%i", (int)(CFG_getWifiDiagnostics()));
Expand Down Expand Up @@ -1621,8 +1725,12 @@ void CFG_sync(void)
fprintf(file, "recents=%i\n", settings.showRecents);
fprintf(file, "tools=%i\n", settings.showTools);
fprintf(file, "collections=%i\n", settings.showCollections);
fprintf(file, "collectionspromotion=%i\n", settings.showCollectionsPromotion);
fprintf(file, "collectionsentriessort=%i\n", settings.sortCollectionsEntries);
fprintf(file, "usecollectionsnestedmap=%i\n", settings.useCollectionsNestedMap);
fprintf(file, "gameart=%i\n", settings.showGameArt);
fprintf(file, "showfoldernamesatroot=%i\n", settings.showFolderNamesAtRoot);
fprintf(file, "collateSubfolders=%i\n", settings.collateSubfolders);
fprintf(file, "screentimeout=%i\n", settings.screenTimeoutSecs);
fprintf(file, "suspendTimeout=%i\n", settings.suspendTimeoutSecs);
fprintf(file, "powerOffProtection=%i\n", settings.powerOffProtection);
Expand All @@ -1641,6 +1749,7 @@ void CFG_sync(void)
fprintf(file, "wifi=%i\n", settings.wifi);
fprintf(file, "defaultView=%i\n", settings.defaultView);
fprintf(file, "quickSwitcherUi=%i\n", settings.showQuickSwitcherUi);
fprintf(file, "quickSwitcherUiGames=%i\n", settings.showQuickSwitcherUiGames);
fprintf(file, "wifiDiagnostics=%i\n", settings.wifiDiagnostics);
fprintf(file, "bluetooth=%i\n", settings.bluetooth);
fprintf(file, "btDiagnostics=%i\n", settings.bluetoothDiagnostics);
Expand Down Expand Up @@ -1695,6 +1804,9 @@ void CFG_print(void)
printf("\t\"recents\": %i,\n", settings.showRecents);
printf("\t\"tools\": %i,\n", settings.showTools);
printf("\t\"collections\": %i,\n", settings.showCollections);
printf("\t\"collectionspromotion\": %i,\n", settings.showCollectionsPromotion);
printf("\t\"collectionsentriessort\": %i,\n", settings.sortCollectionsEntries);
printf("\t\"usecollectionsnestedmap\": %i,\n", settings.useCollectionsNestedMap);
printf("\t\"gameart\": %i,\n", settings.showGameArt);
printf("\t\"showfoldernamesatroot\": %i,\n", settings.showFolderNamesAtRoot);
printf("\t\"screentimeout\": %i,\n", settings.screenTimeoutSecs);
Expand All @@ -1715,6 +1827,7 @@ void CFG_print(void)
printf("\t\"wifi\": %i,\n", settings.wifi);
printf("\t\"defaultView\": %i,\n", settings.defaultView);
printf("\t\"quickSwitcherUi\": %i,\n", settings.showQuickSwitcherUi);
printf("\t\"quickSwitcherUiGames\": %i,\n", settings.showQuickSwitcherUiGames);
printf("\t\"wifiDiagnostics\": %i,\n", settings.wifiDiagnostics);
printf("\t\"bluetooth\": %i,\n", settings.bluetooth);
printf("\t\"btDiagnostics\": %i,\n", settings.bluetoothDiagnostics);
Expand Down
25 changes: 25 additions & 0 deletions workspace/all/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,15 @@ typedef struct
bool showRecents;
bool showTools;
bool showCollections;
bool showCollectionsPromotion;
bool sortCollectionsEntries;
bool useCollectionsNestedMap;
bool showGameArt;
bool showFolderNamesAtRoot;
bool collateSubfolders;
bool romsUseFolderBackground;
bool showQuickSwitcherUi;
bool showQuickSwitcherUiGames;
int defaultView;

// Mute switch
Expand Down Expand Up @@ -223,8 +228,12 @@ typedef struct
#define CFG_DEFAULT_SHOWMENUTRANSITIONS TRANSITION_SNAPPY
#define CFG_DEFAULT_SHOWRECENTS true
#define CFG_DEFAULT_SHOWCOLLECTIONS true
#define CFG_DEFAULT_SHOWCOLLECTIONSPROMOTION true
#define CFG_DEFAULT_SORTCOLLECTIONSENTRIES true
#define CFG_DEFAULT_USECOLLECTIONSNESTEDMAP false
#define CFG_DEFAULT_SHOWGAMEART true
#define CFG_DEFAULT_SHOWFOLDERNAMESATROOT true
#define CFG_DEFAULT_COLLATESUBFOLDERS false
#define CFG_DEFAULT_GAMESWITCHERSCALING GFX_SCALE_FULLSCREEN
#define CFG_DEFAULT_SCREENTIMEOUTSECS 60
#define CFG_DEFAULT_SUSPENDTIMEOUTSECS 30
Expand All @@ -241,6 +250,7 @@ typedef struct
#define CFG_DEFAULT_WIFI false
#define CFG_DEFAULT_VIEW SCREEN_GAMELIST
#define CFG_DEFAULT_SHOWQUICKWITCHERUI true
#define CFG_DEFAULT_SHOWQUICKWITCHERUIGAMES true
#define CFG_DEFAULT_WIFI_DIAG false
#define CFG_DEFAULT_SHOWTOOLS true
#define CFG_DEFAULT_BLUETOOTH false
Expand Down Expand Up @@ -356,6 +366,15 @@ void CFG_setShowTools(bool show);
// Show/hide collections in the main menu.
bool CFG_getShowCollections(void);
void CFG_setShowCollections(bool show);
// Show/hide collections promotion in the main menu.
bool CFG_getShowCollectionsPromotion(void);
void CFG_setShowCollectionsPromotion(bool show);
// Sort collections entries for roms.
bool CFG_getSortCollectionsEntries(void);
void CFG_setSortCollectionsEntries(bool show);
// Use Nested Collections map.txt for roms.
bool CFG_getUseCollectionsNestedMap(void);
void CFG_setUseCollectionsNestedMap(bool show);
// Show/hide game art in the main menu.
bool CFG_getShowGameArt(void);
void CFG_setShowGameArt(bool show);
Expand Down Expand Up @@ -399,6 +418,9 @@ void CFG_setGameArtWidth(double zeroToOne);
// Show/hide folder names at root directory.
bool CFG_getShowFolderNamesAtRoot(void);
void CFG_setShowFolderNamesAtRoot(bool show);
// Collate subfolders within merged platform folders.
bool CFG_getCollateSubfolders(void);
void CFG_setCollateSubfolders(bool show);
// WiFi on/off (if available)
bool CFG_getWifi(void);
void CFG_setWifi(bool on);
Expand All @@ -408,6 +430,9 @@ void CFG_setDefaultView(int view);
// Quick switcher UI painting on/off
bool CFG_getShowQuickswitcherUI(void);
void CFG_setShowQuickswitcherUI(bool on);
// Quick switcher UI Games painting on/off
bool CFG_getShowQuickswitcherUIGames(void);
void CFG_setShowQuickswitcherUIGames(bool on);
// WiFi diagnostic logging on/off
bool CFG_getWifiDiagnostics(void);
void CFG_setWifiDiagnostics(bool on);
Expand Down
Loading