MCPcopy Create free account
hub / github.com/TheOfficialFloW/VitaShell / openSettingsMenu

Function openSettingsMenu

settings.c:148–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148void openSettingsMenu() {
149 settings_menu.status = SETTINGS_MENU_OPENING;
150 settings_menu.entry_sel = 0;
151 settings_menu.option_sel = 0;
152
153 // Get current theme
154 if (theme_name)
155 free(theme_name);
156
157 readConfig("ux0:VitaShell/theme/theme.txt", theme_entries, sizeof(theme_entries) / sizeof(ConfigEntry));
158
159 // Get theme index in main tab
160 int theme_index = -1;
161
162 int i;
163 for (i = 0; i < (sizeof(main_settings) / sizeof(SettingsMenuOption)); i++) {
164 if (main_settings[i].name == VITASHELL_SETTINGS_THEME) {
165 theme_index = i;
166 break;
167 }
168 }
169
170 // Find all themes
171 if (theme_index >= 0) {
172 SceUID dfd = sceIoDopen("ux0:VitaShell/theme");
173 if (dfd >= 0) {
174 theme_count = 0;
175 theme = 0;
176
177 int res = 0;
178
179 do {
180 SceIoDirent dir;
181 memset(&dir, 0, sizeof(SceIoDirent));
182
183 res = sceIoDread(dfd, &dir);
184 if (res > 0) {
185 if (SCE_S_ISDIR(dir.d_stat.st_mode)) {
186 if (theme_name && strcasecmp(dir.d_name, theme_name) == 0)
187 theme = theme_count;
188
189 strncpy(theme_options[theme_count], dir.d_name, MAX_THEME_LENGTH);
190 theme_count++;
191 }
192 }
193 } while (res > 0 && theme_count < MAX_THEMES);
194
195 sceIoDclose(dfd);
196
197 main_settings[theme_index].options = theme_options;
198 main_settings[theme_index].n_options = theme_count;
199 main_settings[theme_index].value = &theme;
200 }
201 }
202
203 changed = 0;
204}
205

Callers 1

fileBrowserMenuCtrlFunction · 0.85

Calls 1

readConfigFunction · 0.85

Tested by

no test coverage detected