void AddRecentRom(const char * ImagePath) { if (ImagePath == NULL) { return; } WriteTrace(TraceUserInterface, TraceDebug, "Start (ImagePath: %s)",ImagePath); //Get Information about the stored rom list size_t MaxRememberedFiles = UISettingsLoadDword(File_RecentGameFileCount); strlist RecentGames; size_t i; for (i = 0; i < MaxRememberedFiles; i++) { stdstr RecentGame = UISettingsLoadStringIndex(File_RecentGameFileIndex, i); if (RecentGame.empty()) { break; } RecentGames.push_back(RecentGame); } //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++) { if (_stricmp(ImagePath, iter->c_str()) != 0) { continue; } RecentGames.erase(iter); break; } RecentGames.push_front(ImagePath); if (RecentGames.size() > MaxRememberedFiles) { RecentGames.pop_back(); } for (i = 0, iter = RecentGames.begin(); iter != RecentGames.end(); iter++, i++) { UISettingsSaveStringIndex(File_RecentGameFileIndex, i, *iter); } if (g_JavaBridge) { WriteTrace(TraceUserInterface, TraceDebug, "calling RecentRomsUpdated"); g_JavaBridge->RecentRomsUpdated(); } WriteTrace(TraceUserInterface, TraceDebug, "Done"); }
void CNotificationImp::AddRecentDir(const char * RomDir) { //Validate the passed string if (HIWORD(RomDir) == NULL) { return; } //Get Information about the stored rom list size_t MaxRememberedDirs = UISettingsLoadDword(Directory_RecentGameDirCount); strlist RecentDirs; size_t i; for (i = 0; i < MaxRememberedDirs; i++) { stdstr RecentDir = UISettingsLoadStringIndex(Directory_RecentGameDirIndex, i); if (RecentDir.empty()) { break; } RecentDirs.push_back(RecentDir); } //See if the dir is already in the list if so then move it to the top of the list strlist::iterator iter; for (iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++) { if (_stricmp(RomDir, iter->c_str()) != 0) { continue; } RecentDirs.erase(iter); break; } RecentDirs.push_front(RomDir); if (RecentDirs.size() > MaxRememberedDirs) { RecentDirs.pop_back(); } for (i = 0, iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++, i++) { UISettingsSaveStringIndex(Directory_RecentGameDirIndex, i, *iter); } }
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_UISettingsLoadStringIndex(JNIEnv* env, jclass cls, jint Type, jint Index) { return env->NewStringUTF(UISettingsLoadStringIndex((UISettingID)Type, Index).c_str()); }