Mercurial > repos > blastem
comparison menu.c @ 1008:51885857c019
Removed assumptions that path separators are Unix style outside of Unix-only verions of functions
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 May 2016 21:39:43 -0700 |
parents | 4899d3ae37b3 |
children | 6c54d5a5c7c0 |
comparison
equal
deleted
inserted
replaced
1007:5165537244e2 | 1008:51885857c019 |
---|---|
193 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); | 193 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); |
194 if (!strcmp(buf, "..")) { | 194 if (!strcmp(buf, "..")) { |
195 size_t len = strlen(menu->curpath); | 195 size_t len = strlen(menu->curpath); |
196 while (len > 1) { | 196 while (len > 1) { |
197 --len; | 197 --len; |
198 if (menu->curpath[len] == '/') { | 198 if (is_path_sep(menu->curpath[len])) { |
199 menu->curpath[len] = 0; | 199 menu->curpath[len] = 0; |
200 break; | 200 break; |
201 } | 201 } |
202 } | 202 } |
203 } else { | 203 } else { |
204 char *tmp = menu->curpath; | 204 char *tmp = menu->curpath; |
205 char const *pieces[] = {menu->curpath, "/", buf}; | 205 char const *pieces[] = {menu->curpath, PATH_SEP, buf}; |
206 menu->curpath = alloc_concat_m(3, pieces); | 206 menu->curpath = alloc_concat_m(3, pieces); |
207 free(tmp); | 207 free(tmp); |
208 } | 208 } |
209 break; | 209 break; |
210 } | 210 } |
211 case 2: { | 211 case 2: { |
212 char buf[4096]; | 212 char buf[4096]; |
213 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); | 213 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); |
214 char const *pieces[] = {menu->curpath, "/", buf}; | 214 char const *pieces[] = {menu->curpath, PATH_SEP, buf}; |
215 gen->next_rom = alloc_concat_m(3, pieces); | 215 gen->next_rom = alloc_concat_m(3, pieces); |
216 m68k->should_return = 1; | 216 m68k->should_return = 1; |
217 break; | 217 break; |
218 } | 218 } |
219 case 3: { | 219 case 3: { |
234 char *buffer = malloc(SAVE_INFO_BUFFER_SIZE); | 234 char *buffer = malloc(SAVE_INFO_BUFFER_SIZE); |
235 char *cur = buffer; | 235 char *cur = buffer; |
236 if (gen->next_context && gen->next_context->save_dir) { | 236 if (gen->next_context && gen->next_context->save_dir) { |
237 char *end = buffer + SAVE_INFO_BUFFER_SIZE; | 237 char *end = buffer + SAVE_INFO_BUFFER_SIZE; |
238 char slotfile[] = "slot_0.gst"; | 238 char slotfile[] = "slot_0.gst"; |
239 char const * parts[3] = {gen->next_context->save_dir, "/", slotfile}; | 239 char const * parts[3] = {gen->next_context->save_dir, PATH_SEP, slotfile}; |
240 struct tm ltime; | 240 struct tm ltime; |
241 char *fname; | 241 char *fname; |
242 time_t modtime; | 242 time_t modtime; |
243 for (int i = 0; i < 10 && cur < end; i++) | 243 for (int i = 0; i < 10 && cur < end; i++) |
244 { | 244 { |
295 slotname = "quicksave.gst"; | 295 slotname = "quicksave.gst"; |
296 } else { | 296 } else { |
297 numslotname[5] = '0' + dst; | 297 numslotname[5] = '0' + dst; |
298 slotname = numslotname; | 298 slotname = numslotname; |
299 } | 299 } |
300 char const *parts[] = {gen->next_context->save_dir, "/", slotname}; | 300 char const *parts[] = {gen->next_context->save_dir, PATH_SEP, slotname}; |
301 char *gstpath = alloc_concat_m(3, parts); | 301 char *gstpath = alloc_concat_m(3, parts); |
302 uint32_t pc = load_gst(gen->next_context, gstpath); | 302 uint32_t pc = load_gst(gen->next_context, gstpath); |
303 free(gstpath); | 303 free(gstpath); |
304 gen->next_context->m68k->resume_pc = get_native_address_trans(gen->next_context->m68k, pc); | 304 gen->next_context->m68k->resume_pc = get_native_address_trans(gen->next_context->m68k, pc); |
305 } | 305 } |