Mercurial > repos > blastem
comparison menu.c @ 1674:c362f2c7766a
Moved fake virtual root stuff to get_dir_list from legacy menu so it can be used in new UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 03 Jan 2019 23:30:17 -0800 |
parents | 3629366616da |
children | bdd83b47d78a |
comparison
equal
deleted
inserted
replaced
1673:ab3b465c052c | 1674:c362f2c7766a |
---|---|
132 if (menu->state) { | 132 if (menu->state) { |
133 uint32_t dst = menu->latch << 16 | value; | 133 uint32_t dst = menu->latch << 16 | value; |
134 switch (address >> 2) | 134 switch (address >> 2) |
135 { | 135 { |
136 case 0: { | 136 case 0: { |
137 #if _WIN32 | |
138 //handle virtual "drives" directory | |
139 if (menu->curpath[0] == PATH_SEP[0]) { | |
140 char drivestrings[4096]; | |
141 if (sizeof(drivestrings) >= GetLogicalDriveStrings(sizeof(drivestrings), drivestrings)) { | |
142 for (char *cur = drivestrings; *cur; cur += strlen(cur) + 1) | |
143 { | |
144 dst = copy_dir_entry_to_guest(dst, m68k, cur, 1); | |
145 } | |
146 } | |
147 //terminate list | |
148 uint8_t *dest = get_native_pointer(dst, (void **)m68k->mem_pointers, &m68k->options->gen); | |
149 if (dest) { | |
150 *dest = dest[1] = 0; | |
151 } | |
152 break; | |
153 } | |
154 #endif | |
155 size_t num_entries; | 137 size_t num_entries; |
156 dir_entry *entries = get_dir_list(menu->curpath, &num_entries); | 138 dir_entry *entries = get_dir_list(menu->curpath, &num_entries); |
157 if (entries) { | 139 if (entries) { |
158 sort_dir_list(entries, num_entries); | 140 sort_dir_list(entries, num_entries); |
159 } else { | 141 } else { |
161 entries = malloc(sizeof(dir_entry)); | 143 entries = malloc(sizeof(dir_entry)); |
162 entries->name = strdup(".."); | 144 entries->name = strdup(".."); |
163 entries->is_dir = 1; | 145 entries->is_dir = 1; |
164 num_entries = 1; | 146 num_entries = 1; |
165 } | 147 } |
166 #ifdef _WIN32 | |
167 if (menu->curpath[1] == ':' && !menu->curpath[2]) { | |
168 //Add fake .. entry to allow navigation to virtual "drives" directory | |
169 dst = copy_dir_entry_to_guest(dst, m68k, "..", 1); | |
170 } | |
171 #endif | |
172 uint32_t num_exts; | 148 uint32_t num_exts; |
173 char **ext_list = get_extension_list(config, &num_exts); | 149 char **ext_list = get_extension_list(config, &num_exts); |
174 for (size_t i = 0; dst && i < num_entries; i++) | 150 for (size_t i = 0; dst && i < num_entries; i++) |
175 { | 151 { |
176 if (num_exts && !entries[i].is_dir) { | 152 if (num_exts && !entries[i].is_dir) { |