Mercurial > repos > blastem
comparison util.c @ 1438:e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 23 Aug 2017 21:18:17 -0700 |
parents | 5ceb316c479a |
children | d82af64c94d2 |
comparison
equal
deleted
inserted
replaced
1437:da72344af3ff | 1438:e2bd03ed3190 |
---|---|
266 if (!lastdot || (lastslash && lastslash > lastdot)) { | 266 if (!lastdot || (lastslash && lastslash > lastdot)) { |
267 //no extension | 267 //no extension |
268 return NULL; | 268 return NULL; |
269 } | 269 } |
270 return strdup(lastdot+1); | 270 return strdup(lastdot+1); |
271 } | |
272 | |
273 char * path_dirname(char *path) | |
274 { | |
275 char *lastslash = NULL; | |
276 char *cur; | |
277 for (cur = path; *cur; cur++) | |
278 { | |
279 if (is_path_sep(*cur)) { | |
280 lastslash = cur; | |
281 } | |
282 } | |
283 if (!lastslash) { | |
284 return NULL; | |
285 } | |
286 char *dir = malloc(lastslash-path+1); | |
287 memcpy(dir, path, lastslash-path); | |
288 dir[lastslash-path] = 0; | |
289 | |
290 return dir; | |
271 } | 291 } |
272 | 292 |
273 uint32_t nearest_pow2(uint32_t val) | 293 uint32_t nearest_pow2(uint32_t val) |
274 { | 294 { |
275 uint32_t ret = 1; | 295 uint32_t ret = 1; |