MCPcopy Create free account
hub / github.com/TASEmulators/fceux / UpdateRW_RMenu

Function UpdateRW_RMenu

src/drivers/win/ramwatch.cpp:255–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255void UpdateRW_RMenu(HMENU menu, unsigned int mitem, unsigned int baseid)
256{
257 MENUITEMINFO moo;
258 int x;
259
260 moo.cbSize = sizeof(moo);
261 moo.fMask = MIIM_SUBMENU | MIIM_STATE;
262
263 GetMenuItemInfo(GetSubMenu(ramwatchmenu, 0), mitem, FALSE, &moo);
264 moo.hSubMenu = menu;
265 moo.fState = strlen(rw_recent_files[0]) ? MFS_ENABLED : MFS_GRAYED;
266
267 SetMenuItemInfo(GetSubMenu(ramwatchmenu, 0), mitem, FALSE, &moo);
268
269 // Remove all recent files submenus
270 for(x = 0; x < MAX_RECENT_WATCHES; x++)
271 {
272 RemoveMenu(menu, baseid + x, MF_BYCOMMAND);
273 }
274
275 // Recreate the menus
276 for(x = MAX_RECENT_WATCHES - 1; x >= 0; x--)
277 {
278 char tmp[128 + 5];
279
280 // Skip empty strings
281 if(!strlen(rw_recent_files[x]))
282 {
283 continue;
284 }
285
286 moo.cbSize = sizeof(moo);
287 moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;
288
289 // Fill in the menu text.
290 if(strlen(rw_recent_files[x]) < 128)
291 {
292 sprintf(tmp, "&%d. %s", ( x + 1 ) % 10, rw_recent_files[x]);
293 }
294 else
295 {
296 sprintf(tmp, "&%d. %s", ( x + 1 ) % 10, rw_recent_files[x] + strlen( rw_recent_files[x] ) - 127);
297 }
298
299 // Insert the menu item
300 moo.cch = strlen(tmp);
301 moo.fType = 0;
302 moo.wID = baseid + x;
303 moo.dwTypeData = tmp;
304 InsertMenuItem(menu, 0, 1, &moo);
305 }
306
307 // I don't think one function shall do so many things in a row
308// WriteRecentRWFiles(); // write recent menu to ini
309}
310
311void UpdateRWRecentArray(const char* addString, unsigned int arrayLen, HMENU menu, unsigned int menuItem, unsigned int baseId)
312{

Callers 2

UpdateRWRecentArrayFunction · 0.85
RamWatchProcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected