Win32 - Recent Movie Menu added
This commit is contained in:
parent
a15469f103
commit
c771ac2d6d
|
@ -1,3 +1,4 @@
|
||||||
|
23-may-2009 - adelikat - win32 - Recent Movie Menu added
|
||||||
22-may-2009 - adelikat - win32 - "Disable screen saver" gui option now also diables the monitor powersave
|
22-may-2009 - adelikat - win32 - "Disable screen saver" gui option now also diables the monitor powersave
|
||||||
22-may-2009 - adelikat - win32 - Debugger - Step type functions now update other dialogs such as ppu, nametable, code/data, trace logger, etc.
|
22-may-2009 - adelikat - win32 - Debugger - Step type functions now update other dialogs such as ppu, nametable, code/data, trace logger, etc.
|
||||||
22-may-2009 - adelikat - win32 - Hex Editor - Save Rom As... menu option enabled and implemented
|
22-may-2009 - adelikat - win32 - Hex Editor - Save Rom As... menu option enabled and implemented
|
||||||
|
|
|
@ -113,6 +113,12 @@ static CFGSTRUCT fceuconfig[] = {
|
||||||
ACS(recent_lua[3]),
|
ACS(recent_lua[3]),
|
||||||
ACS(recent_lua[4]),
|
ACS(recent_lua[4]),
|
||||||
|
|
||||||
|
ACS(recent_movie[0]),
|
||||||
|
ACS(recent_movie[1]),
|
||||||
|
ACS(recent_movie[2]),
|
||||||
|
ACS(recent_movie[3]),
|
||||||
|
ACS(recent_movie[4]),
|
||||||
|
|
||||||
AC(gNoBGFillColor),
|
AC(gNoBGFillColor),
|
||||||
AC(ntsccol),AC(ntsctint),AC(ntschue),
|
AC(ntsccol),AC(ntsctint),AC(ntschue),
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ BEGIN
|
||||||
END
|
END
|
||||||
POPUP "&Movie"
|
POPUP "&Movie"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
MENUITEM "Recent", MENU_MOVIE_RECENT
|
||||||
MENUITEM "&Record Movie...", MENU_RECORD_MOVIE
|
MENUITEM "&Record Movie...", MENU_RECORD_MOVIE
|
||||||
MENUITEM "&Play Movie...", MENU_REPLAY_MOVIE
|
MENUITEM "&Play Movie...", MENU_REPLAY_MOVIE
|
||||||
MENUITEM "&Stop Movie", MENU_STOP_MOVIE
|
MENUITEM "&Stop Movie", MENU_STOP_MOVIE
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#define CLOSE_BUTTON 1
|
#define CLOSE_BUTTON 1
|
||||||
#define BUTTON_CLOSE 1
|
#define BUTTON_CLOSE 1
|
||||||
#define BTN_CLOSE 1
|
#define BTN_CLOSE 1
|
||||||
#define BTN_CANCEL 800
|
|
||||||
#define MENU_OPEN_FILE 100
|
#define MENU_OPEN_FILE 100
|
||||||
#define EDIT_ROMS 100
|
#define EDIT_ROMS 100
|
||||||
#define LBL_LOG_TEXT 100
|
#define LBL_LOG_TEXT 100
|
||||||
|
@ -202,7 +201,6 @@
|
||||||
#define IDC_DEBUGGER_ENABLE_SYMBOLIC 208
|
#define IDC_DEBUGGER_ENABLE_SYMBOLIC 208
|
||||||
#define BTN_NETMOO_CONNECT 250
|
#define BTN_NETMOO_CONNECT 250
|
||||||
#define MENU_HIDE_MENU 300
|
#define MENU_HIDE_MENU 300
|
||||||
//#define CHECK_SCREENSHOT_NAMES 300
|
|
||||||
#define COMBO_FILTER 300
|
#define COMBO_FILTER 300
|
||||||
#define IDC_EDIT_AUTHORINFO 300
|
#define IDC_EDIT_AUTHORINFO 300
|
||||||
#define IDC_LABEL_LENGTH 300
|
#define IDC_LABEL_LENGTH 300
|
||||||
|
@ -286,6 +284,7 @@
|
||||||
#define IDC_VIDEOCONFIG_NO8LIM 600
|
#define IDC_VIDEOCONFIG_NO8LIM 600
|
||||||
#define IDC_DEBUGGER_ROM_PATCHER 602
|
#define IDC_DEBUGGER_ROM_PATCHER 602
|
||||||
#define LIST_DEBUGGER_BOOKMARKS 701
|
#define LIST_DEBUGGER_BOOKMARKS 701
|
||||||
|
#define BTN_CANCEL 800
|
||||||
#define IDC_EDIT_OFFSET 1000
|
#define IDC_EDIT_OFFSET 1000
|
||||||
#define IDC_GAME_GENIE_CODE 1000
|
#define IDC_GAME_GENIE_CODE 1000
|
||||||
#define IDC_MEMVIEWFIND_WHAT 1000
|
#define IDC_MEMVIEWFIND_WHAT 1000
|
||||||
|
@ -681,6 +680,8 @@
|
||||||
#define MENU_VIEWSAVESLOTS 40350
|
#define MENU_VIEWSAVESLOTS 40350
|
||||||
#define ID_LUA_RECENT 40351
|
#define ID_LUA_RECENT 40351
|
||||||
#define MENU_LUA_RECENT 40352
|
#define MENU_LUA_RECENT 40352
|
||||||
|
#define ID_Menu40353 40353
|
||||||
|
#define MENU_MOVIE_RECENT 40354
|
||||||
#define IDC_DEBUGGER_ICONTRAY 55535
|
#define IDC_DEBUGGER_ICONTRAY 55535
|
||||||
#define MW_ValueLabel2 65423
|
#define MW_ValueLabel2 65423
|
||||||
#define MW_ValueLabel1 65426
|
#define MW_ValueLabel1 65426
|
||||||
|
@ -690,7 +691,7 @@
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 125
|
#define _APS_NEXT_RESOURCE_VALUE 125
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40353
|
#define _APS_NEXT_COMMAND_VALUE 40355
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1204
|
#define _APS_NEXT_CONTROL_VALUE 1204
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -79,12 +79,13 @@ using namespace std;
|
||||||
//********************************************************************************
|
//********************************************************************************
|
||||||
|
|
||||||
//Handles----------------------------------------------
|
//Handles----------------------------------------------
|
||||||
static HMENU fceumenu = 0; //Main menu.
|
static HMENU fceumenu = 0; //Main menu.
|
||||||
HWND pwindow; //Client Area
|
HWND pwindow; //Client Area
|
||||||
static HMENU recentmenu; //Recent Menu
|
static HMENU recentmenu; //Recent Menu
|
||||||
static HMENU recentluamenu; //Recent Lua Files Menu
|
static HMENU recentluamenu; //Recent Lua Files Menu
|
||||||
HMENU hfceuxcontext; //Handle to context menu
|
static HMENU recentmoviemenu; //Recent Movie Files Menu
|
||||||
HMENU hfceuxcontextsub; //Handle to context sub menu
|
HMENU hfceuxcontext; //Handle to context menu
|
||||||
|
HMENU hfceuxcontextsub; //Handle to context sub menu
|
||||||
|
|
||||||
//Extern variables-------------------------------------
|
//Extern variables-------------------------------------
|
||||||
extern bool movieSubtitles;
|
extern bool movieSubtitles;
|
||||||
|
@ -134,11 +135,16 @@ char *recent_files[] = { 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
|
||||||
const unsigned int MENU_FIRST_RECENT_FILE = 600;
|
const unsigned int MENU_FIRST_RECENT_FILE = 600;
|
||||||
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
|
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
|
||||||
|
|
||||||
//Lua Recent Menu ---------------------------------------
|
//Recent Lua Menu ----------------------------------------
|
||||||
char *recent_lua[] = {0,0,0,0,0};
|
char *recent_lua[] = {0,0,0,0,0};
|
||||||
const unsigned int LUA_FIRST_RECENT_FILE = 50000;
|
const unsigned int LUA_FIRST_RECENT_FILE = 50000;
|
||||||
const unsigned int MAX_NUMBER_OF_LUA_RECENT_FILES = sizeof(recent_lua)/sizeof(*recent_lua);
|
const unsigned int MAX_NUMBER_OF_LUA_RECENT_FILES = sizeof(recent_lua)/sizeof(*recent_lua);
|
||||||
|
|
||||||
|
//Recent Movie Menu -------------------------------------
|
||||||
|
char *recent_movie[] = {0,0,0,0,0};
|
||||||
|
const unsigned int MOVIE_FIRST_RECENT_FILE = 51000;
|
||||||
|
const unsigned int MAX_NUMBER_OF_MOVIE_RECENT_FILES = sizeof(recent_movie)/sizeof(*recent_movie);
|
||||||
|
|
||||||
//Exported variables ------------------------------------
|
//Exported variables ------------------------------------
|
||||||
|
|
||||||
int EnableBackgroundInput = 0;
|
int EnableBackgroundInput = 0;
|
||||||
|
@ -745,6 +751,123 @@ void AddRecentLuaFile(const char *filename)
|
||||||
UpdateRecentLuaArray(filename, recent_lua, MAX_NUMBER_OF_LUA_RECENT_FILES, recentluamenu, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
UpdateRecentLuaArray(filename, recent_lua, MAX_NUMBER_OF_LUA_RECENT_FILES, recentluamenu, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void UpdateMovieRMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int baseid)
|
||||||
|
{
|
||||||
|
MENUITEMINFO moo;
|
||||||
|
int x;
|
||||||
|
|
||||||
|
moo.cbSize = sizeof(moo);
|
||||||
|
moo.fMask = MIIM_SUBMENU | MIIM_STATE;
|
||||||
|
|
||||||
|
GetMenuItemInfo(GetSubMenu(fceumenu, 0), mitem, FALSE, &moo);
|
||||||
|
moo.hSubMenu = menu;
|
||||||
|
moo.fState = strs[0] ? MFS_ENABLED : MFS_GRAYED;
|
||||||
|
|
||||||
|
SetMenuItemInfo(GetSubMenu(fceumenu, 0), mitem, FALSE, &moo);
|
||||||
|
|
||||||
|
// Remove all recent files submenus
|
||||||
|
for(x = 0; x < MAX_NUMBER_OF_MOVIE_RECENT_FILES; x++)
|
||||||
|
{
|
||||||
|
RemoveMenu(menu, baseid + x, MF_BYCOMMAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recreate the menus
|
||||||
|
for(x = MAX_NUMBER_OF_MOVIE_RECENT_FILES - 1; x >= 0; x--)
|
||||||
|
{
|
||||||
|
// Skip empty strings
|
||||||
|
if(!strs[x])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string tmp = strs[x];
|
||||||
|
|
||||||
|
//clamp this string to 128 chars
|
||||||
|
if(tmp.size()>128)
|
||||||
|
tmp = tmp.substr(0,128);
|
||||||
|
|
||||||
|
moo.cbSize = sizeof(moo);
|
||||||
|
moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;
|
||||||
|
|
||||||
|
// Insert the menu item
|
||||||
|
moo.cch = tmp.size();
|
||||||
|
moo.fType = 0;
|
||||||
|
moo.wID = baseid + x;
|
||||||
|
moo.dwTypeData = (LPSTR)tmp.c_str();
|
||||||
|
InsertMenuItem(menu, 0, 1, &moo);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawMenuBar(hAppWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateRecentMovieArray(const char* addString, char** bufferArray, unsigned int arrayLen, HMENU menu, unsigned int menuItem, unsigned int baseId)
|
||||||
|
{
|
||||||
|
// Try to find out if the filename is already in the recent files list.
|
||||||
|
for(unsigned int x = 0; x < arrayLen; x++)
|
||||||
|
{
|
||||||
|
if(bufferArray[x])
|
||||||
|
{
|
||||||
|
if(!strcmp(bufferArray[x], addString)) // Item is already in list.
|
||||||
|
{
|
||||||
|
// If the filename is in the file list don't add it again.
|
||||||
|
// Move it up in the list instead.
|
||||||
|
|
||||||
|
int y;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
// Save pointer.
|
||||||
|
tmp = bufferArray[x];
|
||||||
|
|
||||||
|
for(y = x; y; y--)
|
||||||
|
{
|
||||||
|
// Move items down.
|
||||||
|
bufferArray[y] = bufferArray[y - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put item on top.
|
||||||
|
bufferArray[0] = tmp;
|
||||||
|
|
||||||
|
// Update the recent files menu
|
||||||
|
UpdateMovieRMenu(menu, bufferArray, menuItem, baseId);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The filename wasn't found in the list. That means we need to add it.
|
||||||
|
|
||||||
|
// If there's no space left in the recent files list, get rid of the last
|
||||||
|
// item in the list.
|
||||||
|
if(bufferArray[arrayLen - 1])
|
||||||
|
{
|
||||||
|
free(bufferArray[arrayLen - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the other items down.
|
||||||
|
for(unsigned int x = arrayLen - 1; x; x--)
|
||||||
|
{
|
||||||
|
bufferArray[x] = bufferArray[x - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the new item.
|
||||||
|
bufferArray[0] = (char*)malloc(strlen(addString) + 1); //mbg merge 7/17/06 added cast
|
||||||
|
strcpy(bufferArray[0], addString);
|
||||||
|
|
||||||
|
// Update the recent files menu
|
||||||
|
UpdateMovieRMenu(menu, bufferArray, menuItem, baseId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddRecentMovieFile(const char *filename)
|
||||||
|
{
|
||||||
|
UpdateRecentMovieArray(filename, recent_movie, MAX_NUMBER_OF_MOVIE_RECENT_FILES, recentmoviemenu, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Hides the main menu.
|
// Hides the main menu.
|
||||||
//@param hide_menu Flag to turn the main menu on (0) or off (1)
|
//@param hide_menu Flag to turn the main menu on (0) or off (1)
|
||||||
void HideMenu(unsigned int hide_menu)
|
void HideMenu(unsigned int hide_menu)
|
||||||
|
@ -1137,6 +1260,17 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
FCEU_LoadLuaCode(fname);
|
FCEU_LoadLuaCode(fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A menu item for the recent movie files menu was clicked.
|
||||||
|
if(wParam >= MOVIE_FIRST_RECENT_FILE && wParam <= MOVIE_FIRST_RECENT_FILE + MAX_NUMBER_OF_MOVIE_RECENT_FILES - 1)
|
||||||
|
{
|
||||||
|
char*& fname = recent_movie[wParam - MOVIE_FIRST_RECENT_FILE];
|
||||||
|
if(fname)
|
||||||
|
{
|
||||||
|
FCEUI_LoadMovie(fname, 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
{
|
{
|
||||||
//File Menu-------------------------------------------------------------
|
//File Menu-------------------------------------------------------------
|
||||||
|
@ -1681,6 +1815,7 @@ adelikat: Outsourced this to a remappable hotkey
|
||||||
EnableMenuItem(fceumenu,MENU_OPEN_FILE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_OPENGAME)?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu,MENU_OPEN_FILE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_OPENGAME)?MF_ENABLED:MF_GRAYED));
|
||||||
EnableMenuItem(fceumenu,MENU_RECORD_MOVIE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_RECORDMOVIE)?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu,MENU_RECORD_MOVIE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_RECORDMOVIE)?MF_ENABLED:MF_GRAYED));
|
||||||
EnableMenuItem(fceumenu,MENU_REPLAY_MOVIE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_PLAYMOVIE)?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu,MENU_REPLAY_MOVIE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_PLAYMOVIE)?MF_ENABLED:MF_GRAYED));
|
||||||
|
EnableMenuItem(fceumenu,MENU_MOVIE_RECENT,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_PLAYMOVIE)?MF_ENABLED:MF_GRAYED));
|
||||||
EnableMenuItem(fceumenu,MENU_STOP_MOVIE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_STOPMOVIE)?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu,MENU_STOP_MOVIE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_STOPMOVIE)?MF_ENABLED:MF_GRAYED));
|
||||||
EnableMenuItem(fceumenu,ID_FILE_PLAYMOVIEFROMBEGINNING,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_PLAYFROMBEGINNING)?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu,ID_FILE_PLAYMOVIEFROMBEGINNING,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_PLAYFROMBEGINNING)?MF_ENABLED:MF_GRAYED));
|
||||||
EnableMenuItem(fceumenu,MENU_SAVESTATE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_QUICKSAVE)?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu,MENU_SAVESTATE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_QUICKSAVE)?MF_ENABLED:MF_GRAYED));
|
||||||
|
@ -1836,10 +1971,12 @@ int CreateMainWindow()
|
||||||
|
|
||||||
recentmenu = CreateMenu();
|
recentmenu = CreateMenu();
|
||||||
recentluamenu = CreateMenu();
|
recentluamenu = CreateMenu();
|
||||||
|
recentmoviemenu = CreateMenu();
|
||||||
|
|
||||||
// Update recent files menu
|
// Update recent files menu
|
||||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||||
UpdateLuaRMenu(recentluamenu, recent_lua, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
UpdateLuaRMenu(recentluamenu, recent_lua, MENU_LUA_RECENT, LUA_FIRST_RECENT_FILE);
|
||||||
|
UpdateMovieRMenu(recentmoviemenu, recent_movie, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
|
||||||
|
|
||||||
updateGameDependentMenus(0);
|
updateGameDependentMenus(0);
|
||||||
if (MainWindow_wndx==-32000) MainWindow_wndx=0; //Just in case
|
if (MainWindow_wndx==-32000) MainWindow_wndx=0; //Just in case
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct CreateMovieParameters
|
||||||
|
|
||||||
extern char *recent_files[];
|
extern char *recent_files[];
|
||||||
extern char *recent_lua[];
|
extern char *recent_lua[];
|
||||||
|
extern char *recent_movie[];
|
||||||
extern HWND pwindow;
|
extern HWND pwindow;
|
||||||
|
|
||||||
void HideFWindow(int h);
|
void HideFWindow(int h);
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
extern void AddRecentMovieFile(const char *filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -749,6 +750,11 @@ void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
//Add to the recent movie menu
|
||||||
|
AddRecentMovieFile(fname);
|
||||||
|
#endif
|
||||||
|
|
||||||
LoadFM2(currMovieData, fp->stream, INT_MAX, false);
|
LoadFM2(currMovieData, fp->stream, INT_MAX, false);
|
||||||
LoadSubtitles(currMovieData);
|
LoadSubtitles(currMovieData);
|
||||||
delete fp;
|
delete fp;
|
||||||
|
|
Loading…
Reference in New Issue