diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-08-23 21:18:17 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-08-23 21:18:17 -0700 |
commit | facf0dd0e1606223da276bbf3984c55ca84e83d9 (patch) | |
tree | 1034b38f7f86d1f9a6de1ae7ae1d8cbef01d2930 /util.c | |
parent | f46eaaf8651d2c763de76ce82999d9d7e1230719 (diff) |
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -270,6 +270,26 @@ char *path_extension(char *path) return strdup(lastdot+1); } +char * path_dirname(char *path) +{ + char *lastslash = NULL; + char *cur; + for (cur = path; *cur; cur++) + { + if (is_path_sep(*cur)) { + lastslash = cur; + } + } + if (!lastslash) { + return NULL; + } + char *dir = malloc(lastslash-path+1); + memcpy(dir, path, lastslash-path); + dir[lastslash-path] = 0; + + return dir; +} + uint32_t nearest_pow2(uint32_t val) { uint32_t ret = 1; |