Cleaned up some code.
This commit is contained in:
parent
e163d2cd87
commit
62efccb998
|
@ -31,16 +31,16 @@
|
|||
**/
|
||||
static CFGSTRUCT fceuconfig[] = {
|
||||
|
||||
ACS(rfiles[0]),
|
||||
ACS(rfiles[1]),
|
||||
ACS(rfiles[2]),
|
||||
ACS(rfiles[3]),
|
||||
ACS(rfiles[4]),
|
||||
ACS(rfiles[5]),
|
||||
ACS(rfiles[6]),
|
||||
ACS(rfiles[7]),
|
||||
ACS(rfiles[8]),
|
||||
ACS(rfiles[9]),
|
||||
ACS(recent_files[0]),
|
||||
ACS(recent_files[1]),
|
||||
ACS(recent_files[2]),
|
||||
ACS(recent_files[3]),
|
||||
ACS(recent_files[4]),
|
||||
ACS(recent_files[5]),
|
||||
ACS(recent_files[6]),
|
||||
ACS(recent_files[7]),
|
||||
ACS(recent_files[8]),
|
||||
ACS(recent_files[9]),
|
||||
|
||||
ACS(rdirs[0]),
|
||||
ACS(rdirs[1]),
|
||||
|
|
Binary file not shown.
|
@ -4,8 +4,18 @@
|
|||
//
|
||||
#define GUI_BOT_CLOSE 1
|
||||
#define GUI_BOT_VALUES 2
|
||||
#define MENU_OPEN_FILE 100
|
||||
#define MENU_CLOSE_FILE 101
|
||||
#define IDI_ICON1 101
|
||||
#define IDI_ICON2 102
|
||||
#define MENU_RECENT_FILES 102
|
||||
#define MENU_SAVE_STATE 110
|
||||
#define MENU_LOAD_STATE 111
|
||||
#define MENU_RECORD_MOVIE 141
|
||||
#define MENU_REPLAY_MOVIE 142
|
||||
#define MENU_STOP_MOVIE 143
|
||||
#define MENU_RECORD_AVI 151
|
||||
#define MENU_STOP_AVI 152
|
||||
#define GUI_BOT_A_1 1000
|
||||
#define GUI_BOT_B_1 1001
|
||||
#define GUI_BOT_SELECT_1 1002
|
||||
|
@ -141,7 +151,7 @@
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40013
|
||||
#define _APS_NEXT_COMMAND_VALUE 40023
|
||||
#define _APS_NEXT_CONTROL_VALUE 1117
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* Show an Save File dialog and save a savegame state to the selected file.
|
||||
**/
|
||||
void FCEUD_SaveStateAs(void)
|
||||
{
|
||||
const char filter[] = "FCE Ultra Save State(*.fc?)\0*.fc?\0";
|
||||
|
@ -13,16 +16,23 @@ void FCEUD_SaveStateAs(void)
|
|||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||
|
||||
if(GetSaveFileName(&ofn))
|
||||
{
|
||||
FCEUI_SaveState(nameo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an Open File dialog and load a savegame state from the selected file.
|
||||
**/
|
||||
void FCEUD_LoadStateFrom(void)
|
||||
{
|
||||
const char filter[]="FCE Ultra Save State(*.fc?)\0*.fc?\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
// Create and show an Open File dialog.
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
ofn.hInstance=fceu_hInstance;
|
||||
|
@ -32,7 +42,11 @@ void FCEUD_LoadStateFrom(void)
|
|||
ofn.lpstrFile=nameo;
|
||||
ofn.nMaxFile=256;
|
||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
|
||||
|
||||
if(GetOpenFileName(&ofn))
|
||||
{
|
||||
// Load save state if a file was selected.
|
||||
FCEUI_LoadState(nameo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,13 @@ extern char *md5_asciistr(uint8 digest[16]);
|
|||
extern FCEUGI *GameInfo;
|
||||
extern int EnableRewind;
|
||||
|
||||
// Contains recent file strings
|
||||
char *recent_files[] = { 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
|
||||
char *rdirs[10]={0,0,0,0,0,0,0,0,0,0};
|
||||
|
||||
const unsigned int MENU_FIRST_RECENT_FILE = 600;
|
||||
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
|
||||
|
||||
void DSMFix(UINT msg)
|
||||
{
|
||||
switch(msg)
|
||||
|
@ -50,13 +57,22 @@ static int EnableBackgroundInput=0;
|
|||
void ShowCursorAbs(int w)
|
||||
{
|
||||
static int stat = 0;
|
||||
|
||||
if(w)
|
||||
{
|
||||
if(stat==-1) {stat++; ShowCursor(1);}
|
||||
if(stat == -1)
|
||||
{
|
||||
stat++;
|
||||
ShowCursor(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(stat==0) {stat--; ShowCursor(0);}
|
||||
if(stat==0)
|
||||
{
|
||||
stat--;
|
||||
ShowCursor(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +84,11 @@ void CalcWindowSize(RECT *al)
|
|||
al->top=0;
|
||||
al->bottom=totallines*winsizemuly;
|
||||
|
||||
AdjustWindowRectEx(al,GetWindowLong(hAppWnd,GWL_STYLE),GetMenu(hAppWnd)!=NULL,GetWindowLong(hAppWnd,GWL_EXSTYLE));
|
||||
AdjustWindowRectEx(al,
|
||||
GetWindowLong(hAppWnd,GWL_STYLE),
|
||||
GetMenu(hAppWnd) != NULL,
|
||||
GetWindowLong(hAppWnd,GWL_EXSTYLE)
|
||||
);
|
||||
|
||||
al->right-=al->left;
|
||||
al->left=0;
|
||||
|
@ -76,10 +96,9 @@ void CalcWindowSize(RECT *al)
|
|||
al->top=0;
|
||||
}
|
||||
|
||||
|
||||
void RedoMenuGI(FCEUGI *gi)
|
||||
{
|
||||
int simpled[]={101,111,110,200,201,204,203,141,142,143,151,152,300,40003,40028, 0};
|
||||
int simpled[]={101,111,110,200,201,204,203,141,142,143,151,152,40120,300,40003,40028, 0};
|
||||
int x;
|
||||
|
||||
x = 0;
|
||||
|
@ -148,11 +167,19 @@ void UpdateMenu(void)
|
|||
}
|
||||
|
||||
static HMENU recentmenu, recentdmenu;
|
||||
char *rfiles[10]={0,0,0,0,0,0,0,0,0,0};
|
||||
char *rdirs[10]={0,0,0,0,0,0,0,0,0,0};
|
||||
|
||||
void UpdateRMenu(HMENU menu, char **strs, int mitem, int baseid)
|
||||
/**
|
||||
* Updates recent files / recent directories menu
|
||||
*
|
||||
* @param menu Menu handle of the main window's menu
|
||||
* @param strs Strings to add to the menu
|
||||
* @param mitem Menu ID of the recent files / directory menu
|
||||
* @param baseid Menu ID of the first subitem
|
||||
**/
|
||||
void UpdateRMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int baseid)
|
||||
{
|
||||
// UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||
|
||||
MENUITEMINFO moo;
|
||||
int x;
|
||||
|
||||
|
@ -165,57 +192,110 @@ void UpdateRMenu(HMENU menu, char **strs, int mitem, int baseid)
|
|||
|
||||
SetMenuItemInfo(GetSubMenu(fceumenu, 0), mitem, FALSE, &moo);
|
||||
|
||||
for(x=0;x<10;x++)
|
||||
// Remove all recent files submenus
|
||||
for(x = 0; x < MAX_NUMBER_OF_RECENT_FILES; x++)
|
||||
{
|
||||
RemoveMenu(menu, baseid + x, MF_BYCOMMAND);
|
||||
for(x=9;x>=0;x--)
|
||||
}
|
||||
|
||||
// Recreate the menus
|
||||
for(x = MAX_NUMBER_OF_RECENT_FILES - 1; x >= 0; x--)
|
||||
{
|
||||
char tmp[128 + 5];
|
||||
if(!strs[x]) continue;
|
||||
|
||||
// Skip empty strings
|
||||
if(!strs[x])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
moo.cbSize = sizeof(moo);
|
||||
moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE;
|
||||
|
||||
// Fill in the menu text.
|
||||
if(strlen(strs[x]) < 128)
|
||||
{
|
||||
sprintf(tmp, "&%d. %s", ( x + 1 ) % 10, strs[x]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "&%d. %s", ( x + 1 ) % 10, strs[x] + strlen( strs[x] ) - 127);
|
||||
}
|
||||
|
||||
// Insert the menu item
|
||||
moo.cch = strlen(tmp);
|
||||
moo.fType = 0;
|
||||
moo.wID = baseid + x;
|
||||
moo.dwTypeData = tmp;
|
||||
InsertMenuItem(menu, 0, 1, &moo);
|
||||
}
|
||||
|
||||
DrawMenuBar(hAppWnd);
|
||||
}
|
||||
|
||||
void AddRecent(char *fn)
|
||||
/**
|
||||
* Add a filename to the recent files list.
|
||||
*
|
||||
* @param filename Name of the file to add.
|
||||
**/
|
||||
void AddRecent(const char *filename)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x=0;x<10;x++)
|
||||
if(rfiles[x])
|
||||
if(!strcmp(rfiles[x],fn)) // Item is already in list.
|
||||
// Try to find out if the filename is already in the recent files list.
|
||||
for( x = 0; x < MAX_NUMBER_OF_RECENT_FILES; x++)
|
||||
{
|
||||
if(recent_files[x])
|
||||
{
|
||||
if(!strcmp(recent_files[x], filename)) // 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;
|
||||
|
||||
tmp=rfiles[x]; // Save pointer.
|
||||
for(y=x;y;y--)
|
||||
rfiles[y]=rfiles[y-1]; // Move items down.
|
||||
// Save pointer.
|
||||
tmp = recent_files[x];
|
||||
|
||||
rfiles[0]=tmp; // Put item on top.
|
||||
UpdateRMenu(recentmenu, rfiles, 102, 600);
|
||||
return;
|
||||
for(y = x; y; y--)
|
||||
{
|
||||
// Move items down.
|
||||
recent_files[y] = recent_files[y - 1];
|
||||
}
|
||||
|
||||
if(rfiles[9]) free(rfiles[9]);
|
||||
for(x=9;x;x--) rfiles[x]=rfiles[x-1];
|
||||
rfiles[0]=(char*)malloc(strlen(fn)+1); //mbg merge 7/17/06 added cast
|
||||
strcpy(rfiles[0],fn);
|
||||
UpdateRMenu(recentmenu, rfiles, 102, 600);
|
||||
// Put item on top.
|
||||
recent_files[0] = tmp;
|
||||
|
||||
// Update the recent files menu
|
||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||
|
||||
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(recent_files[MAX_NUMBER_OF_RECENT_FILES - 1])
|
||||
{
|
||||
free(recent_files[MAX_NUMBER_OF_RECENT_FILES - 1]);
|
||||
}
|
||||
|
||||
// Move the other items down.
|
||||
for(x = MAX_NUMBER_OF_RECENT_FILES - 1; x; x--)
|
||||
{
|
||||
recent_files[x] = recent_files[x - 1];
|
||||
}
|
||||
|
||||
// Add the new item.
|
||||
recent_files[0] = (char*)malloc(strlen(filename) + 1); //mbg merge 7/17/06 added cast
|
||||
strcpy(recent_files[0], filename);
|
||||
|
||||
// Update the recent files menu
|
||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||
}
|
||||
|
||||
void AddRecentDir(char *fn)
|
||||
|
@ -321,12 +401,21 @@ static void ALoad(char *nameo)
|
|||
RedoMenuGI(GameInfo);
|
||||
}
|
||||
|
||||
void LoadNewGamey(HWND hParent, char *initialdir)
|
||||
/**
|
||||
* Shows an Open File dialog and opens the ROM if the user selects a ROM file.
|
||||
*
|
||||
* @param hParent Handle of the main window
|
||||
* @param initialdir Directory that's pre-selected in the Open File dialog.
|
||||
**/
|
||||
void LoadNewGamey(HWND hParent, const char *initialdir)
|
||||
{
|
||||
const char filter[] = "All usable files(*.nes,*.nsf,*.fds,*.unf,*.zip,*.gz)\0*.nes;*.nsf;*.fds;*.unf;*.zip;*.gz\0All non-compressed usable files(*.nes,*.nsf,*.fds,*.unf)\0*.nes;*.nsf;*.fds;*.unf\0All files (*.*)\0*.*\0";
|
||||
char nameo[2048];
|
||||
|
||||
// Create the Open File dialog
|
||||
OPENFILENAME ofn;
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
|
||||
ofn.lStructSize=sizeof(ofn);
|
||||
ofn.hInstance=fceu_hInstance;
|
||||
ofn.lpstrTitle="FCE Ultra Open File...";
|
||||
|
@ -337,26 +426,38 @@ void LoadNewGamey(HWND hParent, char *initialdir)
|
|||
ofn.nMaxFile=256;
|
||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; //OFN_EXPLORER|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK;
|
||||
ofn.lpstrInitialDir = initialdir ? initialdir : gfsdir;
|
||||
|
||||
// Show the Open File dialog
|
||||
if(GetOpenFileName(&ofn))
|
||||
{
|
||||
char *tmpdir;
|
||||
char *tmpdir = (char *)malloc( ofn.nFileOffset + 1 ); //mbg merge 7/17/06 added cast
|
||||
|
||||
if((tmpdir=(char *)malloc(ofn.nFileOffset+1))) //mbg merge 7/17/06 added cast
|
||||
if(tmpdir)
|
||||
{
|
||||
// Get the directory from the filename
|
||||
strncpy(tmpdir, ofn.lpstrFile, ofn.nFileOffset);
|
||||
tmpdir[ofn.nFileOffset]=0;
|
||||
|
||||
// Add the directory to the list of recent directories
|
||||
AddRecentDir(tmpdir);
|
||||
|
||||
if(!initialdir) // Prevent setting the File->Open default
|
||||
// Prevent setting the File->Open default
|
||||
// directory when a "Recent Directory" is selected.
|
||||
if(!initialdir)
|
||||
{
|
||||
if(gfsdir)
|
||||
{
|
||||
free(gfsdir);
|
||||
}
|
||||
|
||||
gfsdir = tmpdir;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(tmpdir);
|
||||
}
|
||||
}
|
||||
|
||||
ALoad(nameo);
|
||||
}
|
||||
}
|
||||
|
@ -403,27 +504,37 @@ void DoPPUView();//mbg merge 7/19/06 yech had to add
|
|||
|
||||
void MapInput(void);
|
||||
|
||||
/**
|
||||
* Message loop of the main window
|
||||
**/
|
||||
LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
DSMFix(msg);
|
||||
switch(msg) {
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
mouseb=wParam;
|
||||
goto proco;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
mousex=LOWORD(lParam);
|
||||
mousey=HIWORD(lParam);
|
||||
}
|
||||
goto proco;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if(xbsave)
|
||||
return(0);
|
||||
else goto proco;
|
||||
case WM_PAINT:if(xbsave)
|
||||
else
|
||||
goto proco;
|
||||
|
||||
case WM_PAINT:
|
||||
if(xbsave)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint(hWnd,&ps);
|
||||
|
@ -432,6 +543,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
return(0);
|
||||
}
|
||||
goto proco;
|
||||
|
||||
case WM_SIZE:
|
||||
if(!fullscreen && !changerecursive)
|
||||
switch(wParam)
|
||||
|
@ -490,16 +602,24 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
||||
if(!(wParam>>16))
|
||||
{
|
||||
wParam &= 0xFFFF;
|
||||
if(wParam>=600 && wParam<=609) // Recent files
|
||||
|
||||
// A menu item from the recent files menu was clicked.
|
||||
if(wParam >= MENU_FIRST_RECENT_FILE && wParam <= MENU_FIRST_RECENT_FILE + MAX_NUMBER_OF_RECENT_FILES - 1)
|
||||
{
|
||||
if(rfiles[wParam-600]) ALoad(rfiles[wParam-600]);
|
||||
if(recent_files[wParam - MENU_FIRST_RECENT_FILE])
|
||||
{
|
||||
ALoad(recent_files[wParam - MENU_FIRST_RECENT_FILE]);
|
||||
}
|
||||
}
|
||||
else if(wParam >= 700 && wParam <= 709) // Recent dirs
|
||||
{
|
||||
// TODO: Do menu items 700 - 709 even exist?
|
||||
if(rdirs[wParam-700])
|
||||
LoadNewGamey(hWnd, rdirs[wParam - 700]);
|
||||
}
|
||||
|
@ -663,21 +783,31 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
//case 204:ConfigAddCheat(hWnd);break; //mbg merge TODO 7/17/06 - had to remove this
|
||||
//mbg merge TODO 7/17/06 - had to remove this
|
||||
//case 205:CreateMemWatch(hWnd);break;
|
||||
case 100:
|
||||
|
||||
case MENU_OPEN_FILE:
|
||||
// User selected the Open File menu => Show the file selection dialog
|
||||
LoadNewGamey(hWnd, 0);
|
||||
break;
|
||||
case 101:if(GameInfo)
|
||||
|
||||
case MENU_CLOSE_FILE:
|
||||
// User selected the Close File menu => Close the game if necessary
|
||||
if(GameInfo)
|
||||
{
|
||||
#ifdef FCEUDEF_DEBUGGER
|
||||
//KillDebugger(); //mbg merge 7/18/06 removed as part of old debugger
|
||||
#endif
|
||||
FCEUI_CloseGame();
|
||||
GameInfo=0;
|
||||
RedoMenuGI(GameInfo);
|
||||
}
|
||||
break;
|
||||
case 110:FCEUD_SaveStateAs();break;
|
||||
case 111:FCEUD_LoadStateFrom();break;
|
||||
|
||||
case MENU_SAVE_STATE:
|
||||
// Save state as menu was selected
|
||||
FCEUD_SaveStateAs();
|
||||
break;
|
||||
|
||||
case MENU_LOAD_STATE:
|
||||
// Load state from menu was selected
|
||||
FCEUD_LoadStateFrom();
|
||||
break;
|
||||
|
||||
case 40120: //mbg merge 7/18/06 changed ID from 120
|
||||
{
|
||||
|
@ -702,12 +832,30 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
break;
|
||||
case 130:DoFCEUExit();break;
|
||||
|
||||
case 141:FCEUD_MovieRecordTo();break;
|
||||
case 142:FCEUD_MovieReplayFrom();break;
|
||||
case 143:FCEUI_StopMovie();break;
|
||||
case MENU_RECORD_MOVIE:
|
||||
// Record movie menu was selected
|
||||
FCEUD_MovieRecordTo();
|
||||
break;
|
||||
|
||||
case 151:FCEUD_AviRecordTo();break;
|
||||
case 152:FCEUD_AviStop();break;
|
||||
case MENU_REPLAY_MOVIE:
|
||||
// Replay movie menu was selected
|
||||
FCEUD_MovieReplayFrom();
|
||||
break;
|
||||
|
||||
case MENU_STOP_MOVIE:
|
||||
// Stop movie menu was selected
|
||||
FCEUI_StopMovie();
|
||||
break;
|
||||
|
||||
case MENU_RECORD_AVI:
|
||||
// Record AVI menu was selected
|
||||
FCEUD_AviRecordTo();
|
||||
break;
|
||||
|
||||
case MENU_STOP_AVI:
|
||||
// Stop AVI menu was selected
|
||||
FCEUD_AviStop();
|
||||
break;
|
||||
|
||||
case 400:ShowAboutBox();break;
|
||||
case 401:MakeLogWindow();break;
|
||||
|
@ -931,11 +1079,12 @@ int CreateMainWindow(void)
|
|||
winclass.hIconSm=LoadIcon(fceu_hInstance, "ICON_1");
|
||||
winclass.hCursor=LoadCursor(NULL, IDC_ARROW);
|
||||
winclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH); //mbg merge 7/17/06 added cast
|
||||
//winclass.lpszMenuName="FCEUMENU";
|
||||
winclass.lpszClassName="FCEULTRA";
|
||||
|
||||
if(!RegisterClassEx(&winclass))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AdjustWindowRectEx(&tmp,WS_OVERLAPPEDWINDOW,1,0);
|
||||
|
||||
|
@ -944,7 +1093,8 @@ int CreateMainWindow(void)
|
|||
recentmenu=CreateMenu();
|
||||
recentdmenu = CreateMenu();
|
||||
|
||||
UpdateRMenu(recentmenu, rfiles, 102, 600);
|
||||
// Update recent files menu
|
||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||
UpdateRMenu(recentdmenu, rdirs, 103, 700);
|
||||
|
||||
RedoMenuGI(NULL);
|
||||
|
@ -953,8 +1103,11 @@ int CreateMainWindow(void)
|
|||
WS_OVERLAPPEDWINDOW|WS_CLIPSIBLINGS, /* Style */
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,256,240, /* X,Y ; Width, Height */
|
||||
NULL,fceumenu,fceu_hInstance,NULL );
|
||||
|
||||
DragAcceptFiles(hAppWnd, 1);
|
||||
|
||||
SetMainWindowStuff();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -975,6 +1128,7 @@ int SetMainWindowStuff(void)
|
|||
else
|
||||
{
|
||||
RECT srect;
|
||||
|
||||
if(WindowXC!=(1<<30))
|
||||
{
|
||||
/* Subtracting and adding for if(eoptions&EO_USERFORCE) below. */
|
||||
|
@ -991,12 +1145,15 @@ int SetMainWindowStuff(void)
|
|||
}
|
||||
|
||||
CalcWindowSize(&srect);
|
||||
|
||||
SetWindowPos(hAppWnd,HWND_TOP,tmp.left,tmp.top,srect.right,srect.bottom,SWP_SHOWWINDOW);
|
||||
|
||||
winwidth=srect.right;
|
||||
winheight=srect.bottom;
|
||||
|
||||
ShowWindow(hAppWnd, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1924,17 +2081,21 @@ static BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
|||
return FALSE;
|
||||
};
|
||||
|
||||
/**
|
||||
* Show movie replay dialog and replay the movie if necessary.
|
||||
**/
|
||||
void FCEUD_MovieReplayFrom(void)
|
||||
{
|
||||
char* fn;
|
||||
|
||||
|
||||
|
||||
fn = (char*)DialogBox(fceu_hInstance, "IDD_REPLAYINP", hAppWnd, ReplayDialogProc);
|
||||
|
||||
if(fn)
|
||||
{
|
||||
FCEUI_LoadMovie(fn, ReplayDialogReadOnlyStatus, ReplayDialogStopFrame);
|
||||
|
||||
free(fn);
|
||||
|
||||
palyo = FCEUI_GetCurrentVidSystem(0,0);
|
||||
UpdateMenu();
|
||||
FixFL();
|
||||
|
@ -2144,13 +2305,14 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void FCEUD_MovieRecordTo(void)
|
||||
/**
|
||||
* Show the record movie dialog and record a movie.
|
||||
**/
|
||||
void FCEUD_MovieRecordTo()
|
||||
{
|
||||
struct CreateMovieParameters p;
|
||||
p.szFilename = FCEUI_MovieGetCurrentName(0);
|
||||
|
||||
|
||||
|
||||
if(DialogBoxParam(fceu_hInstance, "IDD_RECORDINP", hAppWnd, RecordDialogProc, (LPARAM)&p))
|
||||
{
|
||||
// turn WCHAR into UTF8
|
||||
|
@ -2164,6 +2326,7 @@ void FCEUD_MovieRecordTo(void)
|
|||
FCEUI_LoadState(p.szSavestateFilename);
|
||||
{
|
||||
extern int loadStateFailed;
|
||||
|
||||
if(loadStateFailed)
|
||||
{
|
||||
char str [1024];
|
||||
|
@ -2171,15 +2334,24 @@ void FCEUD_MovieRecordTo(void)
|
|||
FCEUD_PrintError(str);
|
||||
}
|
||||
}
|
||||
|
||||
free(p.szSavestateFilename);
|
||||
}
|
||||
|
||||
FCEUI_SaveMovie(p.szFilename, (p.recordFrom==0) ? MOVIE_FLAG_FROM_POWERON : ((p.recordFrom==1) ? MOVIE_FLAG_FROM_RESET : 0), meta);
|
||||
FCEUI_SaveMovie(
|
||||
p.szFilename,
|
||||
(p.recordFrom == 0) ? MOVIE_FLAG_FROM_POWERON : ((p.recordFrom == 1) ? MOVIE_FLAG_FROM_RESET : 0),
|
||||
meta);
|
||||
}
|
||||
|
||||
free(p.szFilename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an Open File menu and starts recording an AVI
|
||||
*
|
||||
* TODO: Does this even work?
|
||||
**/
|
||||
void FCEUD_AviRecordTo(void)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
|
@ -2190,7 +2362,12 @@ void FCEUD_AviRecordTo(void)
|
|||
extern char curMovieFilename[];
|
||||
strcpy(szChoice, curMovieFilename);
|
||||
char* dot = strrchr(szChoice,'.');
|
||||
if(dot) *dot='\0';
|
||||
|
||||
if (dot)
|
||||
{
|
||||
*dot='\0';
|
||||
}
|
||||
|
||||
strcat(szChoice, ".avi");
|
||||
}
|
||||
else
|
||||
|
@ -2199,8 +2376,6 @@ void FCEUD_AviRecordTo(void)
|
|||
sprintf(szChoice, "%s.avi", FileBase);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// avi record file browser
|
||||
memset(&ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
|
@ -2212,12 +2387,16 @@ void FCEUD_AviRecordTo(void)
|
|||
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
|
||||
|
||||
if(GetSaveFileName(&ofn))
|
||||
{
|
||||
FCEUI_AviBegin(szChoice);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop AVI recording
|
||||
**/
|
||||
void FCEUD_AviStop(void)
|
||||
{
|
||||
FCEUI_AviEnd();
|
||||
|
|
|
@ -127,10 +127,14 @@ int FCEUMOV_ShouldPause(void)
|
|||
int suppressMovieStop=0;
|
||||
int movieConvertOffset1=0, movieConvertOffset2=0,movieConvertOK=0,movieSyncHackOn=0;
|
||||
|
||||
/**
|
||||
* Stop movie playback.
|
||||
**/
|
||||
static void StopPlayback(void)
|
||||
{
|
||||
if(suppressMovieStop)
|
||||
return;
|
||||
|
||||
resetDMCacc = movieSyncHackOn = 0;
|
||||
fclose(slots[-1 - current]);
|
||||
current = 0;
|
||||
|
@ -211,13 +215,21 @@ void MovieFlushHeader(void)
|
|||
fseek(fp, loc, SEEK_SET);
|
||||
}
|
||||
|
||||
static void StopRecording(void)
|
||||
/**
|
||||
* Stop movie recording
|
||||
**/
|
||||
void StopRecording(void)
|
||||
{
|
||||
if(suppressMovieStop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
resetDMCacc = movieSyncHackOn = 0;
|
||||
|
||||
DoEncode(0,0,1); /* Write a dummy timestamp value so that the movie will keep
|
||||
"playing" after user input has stopped. */
|
||||
|
||||
// finish header
|
||||
MovieFlushHeader();
|
||||
|
||||
|
@ -226,13 +238,24 @@ static void StopRecording(void)
|
|||
fclose(slots[current - 1]);
|
||||
MovieStatus[current - 1] = 1;
|
||||
current = 0;
|
||||
|
||||
FCEU_DispMessage("Movie recording stopped.");
|
||||
}
|
||||
|
||||
void FCEUI_StopMovie(void)
|
||||
/**
|
||||
* Stop movie recording or movie playback.
|
||||
**/
|
||||
void FCEUI_StopMovie()
|
||||
{
|
||||
if(current < 0) StopPlayback();
|
||||
if(current > 0) StopRecording();
|
||||
if(current < 0)
|
||||
{
|
||||
StopPlayback();
|
||||
}
|
||||
|
||||
if(current > 0)
|
||||
{
|
||||
StopRecording();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MSVC
|
||||
|
|
|
@ -647,6 +647,7 @@ void FCEUI_LoadState(char *fname)
|
|||
information expected in newer save states, desynchronization won't occur(at least not
|
||||
from this ;)).
|
||||
*/
|
||||
|
||||
if(FCEUSS_Load(fname))
|
||||
{
|
||||
if(FCEUnetplay)
|
||||
|
@ -661,14 +662,21 @@ void FCEUI_LoadState(char *fname)
|
|||
fclose(fp);
|
||||
FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn);
|
||||
}
|
||||
else fclose(fp);
|
||||
else
|
||||
{
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
unlink(fn);
|
||||
}
|
||||
|
||||
free(fn);
|
||||
}
|
||||
}
|
||||
else loadStateFailed=1;
|
||||
|
||||
else
|
||||
{
|
||||
loadStateFailed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void FCEU_DrawSaveStates(uint8 *XBuf)
|
||||
|
|
Loading…
Reference in New Issue