Mercurial > repos > blastem
comparison 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 |
comparison
equal
deleted
inserted
replaced
883:9f149f0e98b7 | 884:252dfd29831d |
---|---|
62 } | 62 } |
63 JNIEnv *env = SDL_AndroidGetJNIEnv(); | 63 JNIEnv *env = SDL_AndroidGetJNIEnv(); |
64 if ((*env)->PushLocalFrame(env, 8) < 0) { | 64 if ((*env)->PushLocalFrame(env, 8) < 0) { |
65 return NULL; | 65 return NULL; |
66 } | 66 } |
67 | 67 |
68 jclass Environment = (*env)->FindClass(env, "android/os/Environment"); | 68 jclass Environment = (*env)->FindClass(env, "android/os/Environment"); |
69 jmethodID getExternalStorageDirectory = | 69 jmethodID getExternalStorageDirectory = |
70 (*env)->GetStaticMethodID(env, Environment, "getExternalStorageDirectory", "()Ljava/io/File;"); | 70 (*env)->GetStaticMethodID(env, Environment, "getExternalStorageDirectory", "()Ljava/io/File;"); |
71 jobject file = (*env)->CallStaticObjectMethod(env, Environment, getExternalStorageDirectory); | 71 jobject file = (*env)->CallStaticObjectMethod(env, Environment, getExternalStorageDirectory); |
72 if (!file) { | 72 if (!file) { |
73 goto cleanup; | 73 goto cleanup; |
74 } | 74 } |
75 | 75 |
76 jmethodID getAbsolutePath = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, file), | 76 jmethodID getAbsolutePath = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, file), |
77 "getAbsolutePath", "()Ljava/lang/String;"); | 77 "getAbsolutePath", "()Ljava/lang/String;"); |
78 jstring path = (*env)->CallObjectMethod(env, file, getAbsolutePath); | 78 jstring path = (*env)->CallObjectMethod(env, file, getAbsolutePath); |
79 | 79 |
80 char const *tmp = (*env)->GetStringUTFChars(env, path, NULL); | 80 char const *tmp = (*env)->GetStringUTFChars(env, path, NULL); |
81 ret = strdup(tmp); | 81 ret = strdup(tmp); |
82 (*env)->ReleaseStringUTFChars(env, path, tmp); | 82 (*env)->ReleaseStringUTFChars(env, path, tmp); |
83 | 83 |
84 cleanup: | 84 cleanup: |
85 (*env)->PopLocalFrame(env, NULL); | 85 (*env)->PopLocalFrame(env, NULL); |
86 return ret; | 86 return ret; |
87 } | 87 } |
88 #endif | 88 #endif |
171 menu->curpath[len] = 0; | 171 menu->curpath[len] = 0; |
172 break; | 172 break; |
173 } | 173 } |
174 } | 174 } |
175 } else { | 175 } else { |
176 char *pieces[] = {menu->curpath, "/", buf}; | 176 char *tmp = menu->curpath; |
177 char const *pieces[] = {menu->curpath, "/", buf}; | |
177 menu->curpath = alloc_concat_m(3, pieces); | 178 menu->curpath = alloc_concat_m(3, pieces); |
178 free(pieces[0]); | 179 free(tmp); |
179 } | 180 } |
180 break; | 181 break; |
181 } | 182 } |
182 case 2: { | 183 case 2: { |
183 char buf[4096]; | 184 char buf[4096]; |
184 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); | 185 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); |
185 char *pieces[] = {menu->curpath, "/", buf}; | 186 char const *pieces[] = {menu->curpath, "/", buf}; |
186 gen->next_rom = alloc_concat_m(3, pieces); | 187 gen->next_rom = alloc_concat_m(3, pieces); |
187 m68k->should_return = 1; | 188 m68k->should_return = 1; |
188 break; | 189 break; |
189 } | 190 } |
190 default: | 191 default: |