From 8ef73a3f3207d31cd7df0d1a20373bf905d60f9d Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 21 Nov 2016 18:02:12 +1100 Subject: [PATCH] Add Recent Roms --- Source/Android/Bridge/JavaBridge.cpp | 10 ++++++++++ Source/Android/Bridge/JavaBridge.h | 1 + Source/Android/Bridge/jniBridge.cpp | 11 +++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Android/Bridge/JavaBridge.cpp b/Source/Android/Bridge/JavaBridge.cpp index cb933730f..9d25c38cd 100644 --- a/Source/Android/Bridge/JavaBridge.cpp +++ b/Source/Android/Bridge/JavaBridge.cpp @@ -156,4 +156,14 @@ void JavaBridge::EmulationStopped(void) } } +void JavaBridge::RecentRomsUpdated(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + if (env) + { + jmethodID midRRecentRomsUpdated = env->GetStaticMethodID(m_GalleryActivityClass, "RecentRomsUpdated", "()V"); + env->CallStaticVoidMethod(m_GalleryActivityClass, midRRecentRomsUpdated); + } +} + #endif \ No newline at end of file diff --git a/Source/Android/Bridge/JavaBridge.h b/Source/Android/Bridge/JavaBridge.h index f8ef3cd45..26d720a17 100644 --- a/Source/Android/Bridge/JavaBridge.h +++ b/Source/Android/Bridge/JavaBridge.h @@ -20,6 +20,7 @@ public: void RomListReset(void); void RomListAddItem(const char * FullFileName, const char * FileName, const char * GoodName, uint32_t TextColor ); void RomListLoaded(void); + void RecentRomsUpdated(void); //Notification void DisplayError(const char * Message); diff --git a/Source/Android/Bridge/jniBridge.cpp b/Source/Android/Bridge/jniBridge.cpp index 85f42ed7e..cde41fd29 100644 --- a/Source/Android/Bridge/jniBridge.cpp +++ b/Source/Android/Bridge/jniBridge.cpp @@ -120,7 +120,7 @@ void AddRecentRom(const char * ImagePath) RecentGames.push_back(RecentGame); } - //See if the dir is already in the list if so then move it to the top of the list + //See if the game is already in the list if so then move it to the top of the list strlist::iterator iter; for (iter = RecentGames.begin(); iter != RecentGames.end(); iter++) { @@ -141,6 +141,12 @@ void AddRecentRom(const char * ImagePath) { UISettingsSaveStringIndex(File_RecentGameFileIndex, i, *iter); } + + if (g_JavaBridge) + { + WriteTrace(TraceUserInterface, TraceDebug, "calling RecentRomsUpdated"); + g_JavaBridge->RecentRomsUpdated(); + } WriteTrace(TraceUserInterface, TraceDebug, "Done"); } @@ -156,6 +162,7 @@ void GameCpuRunning(void * /*NotUsed*/) { AddRecentRom(FileLoc.c_str()); } + g_System->RefreshGameSettings(); } else { @@ -254,7 +261,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveBool(JNIEnv* e EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveDword(JNIEnv* env, jclass cls, int Type, int Value) { - WriteTrace(TraceUserInterface, TraceDebug, "Saving %d value: 0x%X",Type,Value); + WriteTrace(TraceUserInterface, TraceDebug, "Saving %d value: 0x%X", Type, Value); g_Settings->SaveDword((SettingID)Type, Value); CSettings::FlushSettings(g_Settings); WriteTrace(TraceUserInterface, TraceDebug, "Saved");