Mercurial > repos > blastem
diff menu.c @ 884:252dfd29831d
Selecting a second game from the menu now works
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 13 Nov 2015 22:56:59 -0800 |
parents | 75453bf2ffac |
children | f7da9b4df0e7 |
line wrap: on
line diff
--- a/menu.c Fri Nov 13 19:15:37 2015 -0800 +++ b/menu.c Fri Nov 13 22:56:59 2015 -0800 @@ -64,23 +64,23 @@ if ((*env)->PushLocalFrame(env, 8) < 0) { return NULL; } - + jclass Environment = (*env)->FindClass(env, "android/os/Environment"); - jmethodID getExternalStorageDirectory = + jmethodID getExternalStorageDirectory = (*env)->GetStaticMethodID(env, Environment, "getExternalStorageDirectory", "()Ljava/io/File;"); jobject file = (*env)->CallStaticObjectMethod(env, Environment, getExternalStorageDirectory); if (!file) { goto cleanup; } - + jmethodID getAbsolutePath = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, file), "getAbsolutePath", "()Ljava/lang/String;"); jstring path = (*env)->CallObjectMethod(env, file, getAbsolutePath); - + char const *tmp = (*env)->GetStringUTFChars(env, path, NULL); ret = strdup(tmp); (*env)->ReleaseStringUTFChars(env, path, tmp); - + cleanup: (*env)->PopLocalFrame(env, NULL); return ret; @@ -173,16 +173,17 @@ } } } else { - char *pieces[] = {menu->curpath, "/", buf}; + char *tmp = menu->curpath; + char const *pieces[] = {menu->curpath, "/", buf}; menu->curpath = alloc_concat_m(3, pieces); - free(pieces[0]); + free(tmp); } break; } case 2: { char buf[4096]; copy_string_from_guest(m68k, dst, buf, sizeof(buf)); - char *pieces[] = {menu->curpath, "/", buf}; + char const *pieces[] = {menu->curpath, "/", buf}; gen->next_rom = alloc_concat_m(3, pieces); m68k->should_return = 1; break;