- a ton of cleanups
- re-enabling some tasedit functionality - stabilize emu during tasedit by disabling features - clarify/stabilize some basic tas stuff (interaction with reset/poweron) - remove a bunch of warnings
This commit is contained in:
parent
94a807d428
commit
79de2d8295
58
src/driver.h
58
src/driver.h
|
@ -154,42 +154,47 @@ void FCEUD_LoadStateFrom(void);
|
|||
//you may also need to maintain your own internal state
|
||||
void FCEUD_SetInput(bool fourscore, ESI port0, ESI port1, ESIFC fcexp);
|
||||
|
||||
//movie was recorded from poweron. the alternative is from a savestate (or from reset)
|
||||
#define MOVIE_FLAG_FROM_POWERON (1<<3)
|
||||
enum EMOVIE_FLAG
|
||||
{
|
||||
MOVIE_FLAG_NONE = 0,
|
||||
|
||||
//an ARCHAIC flag which means the movie was recorded from a soft reset.
|
||||
//WHY would you do this?? do not create any new movies with this flag
|
||||
#define MOVIE_FLAG_FROM_RESET (1<<1)
|
||||
//an ARCHAIC flag which means the movie was recorded from a soft reset.
|
||||
//WHY would you do this?? do not create any new movies with this flag
|
||||
MOVIE_FLAG_FROM_RESET = (1<<1),
|
||||
|
||||
MOVIE_FLAG_PAL = (1<<2),
|
||||
|
||||
#define MOVIE_FLAG_PAL (1<<2)
|
||||
//movie was recorded from poweron. the alternative is from a savestate (or from reset)
|
||||
MOVIE_FLAG_FROM_POWERON = (1<<3),
|
||||
|
||||
// set in newer version, used for old movie compatibility
|
||||
//TODO - only use this flag to print a warning that the sync might be bad
|
||||
//so that we can get rid of the sync hack code
|
||||
#define MOVIE_FLAG_NOSYNCHACK (1<<4)
|
||||
// set in newer version, used for old movie compatibility
|
||||
//TODO - only use this flag to print a warning that the sync might be bad
|
||||
//so that we can get rid of the sync hack code
|
||||
MOVIE_FLAG_NOSYNCHACK = (1<<4)
|
||||
};
|
||||
|
||||
#define MOVIE_MAX_METADATA 512
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int movie_version; // version of the movie format in the file
|
||||
uint32 num_frames;
|
||||
uint32 rerecord_count;
|
||||
bool poweron, reset, pal, nosynchack;
|
||||
int read_only;
|
||||
uint32 emu_version_used; // 9813 = 0.98.13
|
||||
char* metadata; // caller-supplied buffer to store metadata. can be NULL.
|
||||
int metadata_size; // size of the buffer pointed to by metadata
|
||||
MD5DATA md5_of_rom_used;
|
||||
bool md5_of_rom_used_present; // v1 movies don't have md5 info available
|
||||
std::string name_of_rom_used;
|
||||
int movie_version; // version of the movie format in the file
|
||||
uint32 num_frames;
|
||||
uint32 rerecord_count;
|
||||
bool poweron, pal, nosynchack;
|
||||
bool reset; //mbg 6/21/08 - this flag isnt used anymore.. but maybe one day we can scan it out of the first record in the movie file
|
||||
int read_only;
|
||||
uint32 emu_version_used; // 9813 = 0.98.13
|
||||
char* metadata; // caller-supplied buffer to store metadata. can be NULL.
|
||||
int metadata_size; // size of the buffer pointed to by metadata
|
||||
MD5DATA md5_of_rom_used;
|
||||
bool md5_of_rom_used_present; // v1 movies don't have md5 info available
|
||||
std::string name_of_rom_used;
|
||||
} MOVIE_INFO;
|
||||
|
||||
void FCEUI_SaveMovie(char *fname, uint8 flags);
|
||||
void FCEUI_LoadMovie(char *fname, bool read_only, int _stopframe);
|
||||
void FCEUI_SaveMovie(char *fname, EMOVIE_FLAG flags);
|
||||
void FCEUI_LoadMovie(char *fname, bool read_only, bool tasedit, int _stopframe);
|
||||
void FCEUI_MoviePlayFromBeginning(void);
|
||||
void FCEUI_StopMovie(void);
|
||||
//int FCEUI_IsMovieActive(void);
|
||||
bool FCEUI_MovieGetInfo(const std::string& fname, MOVIE_INFO* /* [in, out] */ info, bool skipFrameCount = false);
|
||||
char* FCEUI_MovieGetCurrentName(int addSlotNumber);
|
||||
void FCEUI_MovieToggleReadOnly(void);
|
||||
|
@ -348,7 +353,10 @@ bool FCEUD_PauseAfterPlayback();
|
|||
enum EFCEUI
|
||||
{
|
||||
FCEUI_STOPAVI, FCEUI_SAVESTATE, FCEUI_LOADSTATE,
|
||||
FCEUI_STOPMOVIE, FCEUI_RECORDMOVIE, FCEUI_PLAYMOVIE
|
||||
FCEUI_STOPMOVIE, FCEUI_RECORDMOVIE, FCEUI_PLAYMOVIE,
|
||||
FCEUI_OPENGAME, FCEUI_CLOSEGAME,
|
||||
FCEUI_TASEDIT,
|
||||
FCEUI_RESET, FCEUI_POWER,
|
||||
};
|
||||
|
||||
//checks whether an EFCEUI is valid right now
|
||||
|
|
|
@ -916,7 +916,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
}
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT:
|
||||
exitdebug:
|
||||
//exitdebug:
|
||||
DebuggerExit();
|
||||
break;
|
||||
case WM_MOVING:
|
||||
|
|
|
@ -685,7 +685,7 @@ int main(int argc,char *argv[])
|
|||
|
||||
if(GameInfo && MovieToLoad)
|
||||
{
|
||||
FCEUI_LoadMovie(MovieToLoad, replayReadOnlySetting!=0, replayStopFrameSetting!=0);
|
||||
FCEUI_LoadMovie(MovieToLoad, replayReadOnlySetting!=0, false, replayStopFrameSetting!=0);
|
||||
free(MovieToLoad);
|
||||
MovieToLoad = NULL;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ popupmenu[] =
|
|||
int LoadTableFile();
|
||||
void UnloadTableFile();
|
||||
void InputData(char *input);
|
||||
int GetMemViewData(int i);
|
||||
int GetMemViewData(uint32 i);
|
||||
void UpdateCaption();
|
||||
int UpdateCheatColorCallB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data); //mbg merge 6/29/06 - added arg
|
||||
int DeleteCheatCallB(char *name, uint32 a, uint8 v, int compare,int s,int type); //mbg merge 6/29/06 - added arg
|
||||
|
@ -168,8 +168,8 @@ void ApplyPatch(int addr,int size, uint8* data){
|
|||
tmp->last=undo_list;
|
||||
|
||||
for(i = 0;i < size;i++){
|
||||
tmp->data[i] = GetFileData(addr+i);
|
||||
WriteFileData(addr+i,data[i]);
|
||||
tmp->data[i] = GetFileData((uint32)addr+i);
|
||||
WriteFileData((uint32)addr+i,data[i]);
|
||||
}
|
||||
|
||||
undo_list=tmp;
|
||||
|
@ -185,7 +185,7 @@ void UndoLastPatch(){
|
|||
//while(tmp->next != 0){tmp=tmp->next;}; //traverse to the one before the last one
|
||||
|
||||
for(i = 0;i < tmp->size;i++){
|
||||
WriteFileData(tmp->addr+i,tmp->data[i]);
|
||||
WriteFileData((uint32)tmp->addr+i,tmp->data[i]);
|
||||
}
|
||||
|
||||
undo_list=undo_list->last;
|
||||
|
@ -197,7 +197,7 @@ void UndoLastPatch(){
|
|||
return;
|
||||
}
|
||||
|
||||
void FlushUndoBuffer(){
|
||||
static void FlushUndoBuffer(){
|
||||
struct UNDOSTRUCT *tmp;
|
||||
while(undo_list!= 0){
|
||||
tmp=undo_list;
|
||||
|
@ -210,14 +210,14 @@ void FlushUndoBuffer(){
|
|||
}
|
||||
|
||||
|
||||
int GetFileData(int offset){
|
||||
static int GetFileData(uint32 offset){
|
||||
if(offset < 16) return *((unsigned char *)&head+offset);
|
||||
if(offset < 16+PRGsize[0])return PRGptr[0][offset-16];
|
||||
if(offset < 16+PRGsize[0]+CHRsize[0])return CHRptr[0][offset-16-PRGsize[0]];
|
||||
return -1;
|
||||
}
|
||||
|
||||
int WriteFileData(int addr,int data){
|
||||
static int WriteFileData(uint32 addr,int data){
|
||||
if (addr < 16)MessageBox(hMemView,"Sorry", "Go bug bbit if you really want to edit the header.", MB_OK);
|
||||
if((addr >= 16) && (addr < PRGsize[0]+16)) *(uint8 *)(GetNesPRGPointer(addr-16)) = data;
|
||||
if((addr >= PRGsize[0]+16) && (addr < CHRsize[0]+PRGsize[0]+16)) *(uint8 *)(GetNesCHRPointer(addr-16-PRGsize[0])) = data;
|
||||
|
@ -225,7 +225,7 @@ int WriteFileData(int addr,int data){
|
|||
return 0;
|
||||
}
|
||||
|
||||
int GetRomFileSize(){ //todo: fix or remove this?
|
||||
static int GetRomFileSize(){ //todo: fix or remove this?
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ void UpdateCaption(){
|
|||
return;
|
||||
}
|
||||
|
||||
int GetMemViewData(int i){
|
||||
int GetMemViewData(uint32 i){
|
||||
if(EditingMode == 0)return GetMem(i);
|
||||
if(EditingMode == 1){
|
||||
i &= 0x3FFF;
|
||||
|
@ -484,7 +484,7 @@ void UpdateColorTable(){
|
|||
|
||||
for (j=0;j<nextBookmark;j++)
|
||||
{
|
||||
if((hexBookmarks[j].address >= CurOffset) && (hexBookmarks[j].address < CurOffset+DataAmount))
|
||||
if(((int)hexBookmarks[j].address >= CurOffset) && ((int)hexBookmarks[j].address < CurOffset+DataAmount))
|
||||
TextColorList[hexBookmarks[j].address - CurOffset] = RGB(0,0xCC,0);
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ void UpdateColorTable(){
|
|||
if(EditingMode == 2){
|
||||
if(cdloggerdata) {
|
||||
for(i = 0;i < DataAmount;i++){
|
||||
if((CurOffset+i >= 16) && (CurOffset+i < 16+PRGsize[0])) {
|
||||
if(((uint32)CurOffset+i >= 16) && ((uint32)CurOffset+i < 16+PRGsize[0])) {
|
||||
if((cdloggerdata[i+CurOffset-16]&3) == 3)TextColorList[i]=RGB(0,192,0);
|
||||
if((cdloggerdata[i+CurOffset-16]&3) == 1)TextColorList[i]=RGB(192,192,0);
|
||||
if((cdloggerdata[i+CurOffset-16]&3) == 2)TextColorList[i]=RGB(0,0,192);
|
||||
|
@ -518,7 +518,7 @@ void UpdateColorTable(){
|
|||
//mbg merge 6/29/06 - added argument
|
||||
int UpdateCheatColorCallB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data) {
|
||||
|
||||
if((a >= CurOffset) && (a < CurOffset+DataAmount)){
|
||||
if((a >= (uint32)CurOffset) && (a < (uint32)CurOffset+DataAmount)){
|
||||
if(s)TextColorList[a-CurOffset] = RGB(0,0,255);
|
||||
}
|
||||
return 1;
|
||||
|
@ -789,7 +789,7 @@ void AutoScrollFromCoord(int x,int y)
|
|||
GetScrollInfo(hMemView,SB_VERT,&si);
|
||||
si.nPos += y / 16;
|
||||
if (si.nPos < si.nMin) si.nPos = si.nMin;
|
||||
if ((si.nPos+si.nPage) > si.nMax) si.nPos = si.nMax-si.nPage;
|
||||
if ((si.nPos+(int)si.nPage) > si.nMax) si.nPos = si.nMax-si.nPage;
|
||||
CurOffset = si.nPos*16;
|
||||
SetScrollInfo(hMemView,SB_VERT,&si,TRUE);
|
||||
return;
|
||||
|
@ -802,7 +802,7 @@ void AutoScrollFromCoord(int x,int y)
|
|||
GetScrollInfo(hMemView,SB_VERT,&si);
|
||||
si.nPos -= (ClientHeight-y) / 16;
|
||||
if (si.nPos < si.nMin) si.nPos = si.nMin;
|
||||
if ((si.nPos+si.nPage) > si.nMax) si.nPos = si.nMax-si.nPage;
|
||||
if ((si.nPos+(int)si.nPage) > si.nMax) si.nPos = si.nMax-si.nPage;
|
||||
CurOffset = si.nPos*16;
|
||||
SetScrollInfo(hMemView,SB_VERT,&si,TRUE);
|
||||
return;
|
||||
|
@ -1373,7 +1373,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
if(!EditingText){
|
||||
for(j = 0;j < i;j++){
|
||||
str[0] = 0;
|
||||
sprintf(str,"%02X",GetMemViewData(j+CursorStartAddy));
|
||||
sprintf(str,"%02X",GetMemViewData((uint32)j+CursorStartAddy));
|
||||
strcat(pGlobal,str);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -5,8 +5,8 @@ void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset);
|
|||
|
||||
void ApplyPatch(int addr,int size, uint8* data);
|
||||
void UndoLastPatch();
|
||||
int GetFileData(int offset);
|
||||
int WriteFileData(int offset,int data);
|
||||
int GetFileData(uint32 offset);
|
||||
int WriteFileData(uint32 offset,int data);
|
||||
int GetRomFileSize();
|
||||
void FlushUndoBuffer();
|
||||
|
||||
|
|
|
@ -28,14 +28,9 @@
|
|||
HexBookmark hexBookmarks[64];
|
||||
int nextBookmark = 0;
|
||||
|
||||
/**
|
||||
* Finds the bookmark for a given address
|
||||
*
|
||||
* @param address The address to find.
|
||||
* @return The index of the bookmark at that address or -1 if there's no bookmark at that address.
|
||||
**/
|
||||
|
||||
|
||||
/// Finds the bookmark for a given address
|
||||
/// @param address The address to find.
|
||||
/// @return The index of the bookmark at that address or -1 if there's no bookmark at that address.
|
||||
int findBookmark(unsigned int address)
|
||||
{
|
||||
int i;
|
||||
|
@ -59,9 +54,7 @@ char bookmarkDescription[51] = {0};
|
|||
|
||||
BOOL CenterWindow(HWND hwndDlg);
|
||||
|
||||
/**
|
||||
* Callback function for the name bookmark dialog
|
||||
**/
|
||||
/// Callback function for the name bookmark dialog
|
||||
BOOL CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
|
@ -97,13 +90,10 @@ BOOL CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to add a new bookmark to the bookmark list.
|
||||
*
|
||||
* @param hwnd HWND of the FCEU window
|
||||
* @param address Address of the new bookmark
|
||||
* @return Returns 0 if everything's OK and an error flag otherwise.
|
||||
**/
|
||||
/// Attempts to add a new bookmark to the bookmark list.
|
||||
/// @param hwnd HWND of the FCEU window
|
||||
/// @param address Address of the new bookmark
|
||||
/// @return Returns 0 if everything's OK and an error flag otherwise.
|
||||
int addBookmark(HWND hwnd, unsigned int address)
|
||||
{
|
||||
// Enforce a maximum of 64 bookmarks
|
||||
|
@ -128,18 +118,14 @@ int addBookmark(HWND hwnd, unsigned int address)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a bookmark from the bookmark list
|
||||
*
|
||||
* @param index Index of the bookmark to remove
|
||||
**/
|
||||
/// Removes a bookmark from the bookmark list
|
||||
/// @param index Index of the bookmark to remove
|
||||
void removeBookmark(unsigned int index)
|
||||
{
|
||||
// TODO: Range checking
|
||||
|
||||
// At this point it's necessary to move the content of the bookmark list
|
||||
unsigned int i;
|
||||
for (i=index;i<nextBookmark - 1;i++)
|
||||
for (int i=index;i<nextBookmark - 1;i++)
|
||||
{
|
||||
hexBookmarks[i] = hexBookmarks[i+1];
|
||||
}
|
||||
|
@ -147,13 +133,10 @@ void removeBookmark(unsigned int index)
|
|||
--nextBookmark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds or removes a bookmark from a given address
|
||||
*
|
||||
* @param hwnd HWND of the emu window
|
||||
* @param address Address of the bookmark
|
||||
**/
|
||||
int toggleBookmark(HWND hwnd, unsigned int address)
|
||||
/// Adds or removes a bookmark from a given address
|
||||
/// @param hwnd HWND of the emu window
|
||||
/// @param address Address of the bookmark
|
||||
int toggleBookmark(HWND hwnd, uint32 address)
|
||||
{
|
||||
int val = findBookmark(address);
|
||||
|
||||
|
@ -169,11 +152,8 @@ int toggleBookmark(HWND hwnd, unsigned int address)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the bookmark menu in the hex window
|
||||
*
|
||||
* @param menu Handle of the bookmark menu
|
||||
**/
|
||||
/// Updates the bookmark menu in the hex window
|
||||
/// @param menu Handle of the bookmark menu
|
||||
void updateBookmarkMenus(HMENU menu)
|
||||
{
|
||||
int i;
|
||||
|
@ -203,13 +183,10 @@ void updateBookmarkMenus(HMENU menu)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address to scroll to if a given bookmark was activated
|
||||
*
|
||||
* @param bookmark Index of the bookmark
|
||||
* @return The address to scroll to or -1 if the bookmark index is invalid.
|
||||
**/
|
||||
int handleBookmarkMenu(unsigned int bookmark)
|
||||
/// Returns the address to scroll to if a given bookmark was activated
|
||||
/// @param bookmark Index of the bookmark
|
||||
/// @return The address to scroll to or -1 if the bookmark index is invalid.
|
||||
int handleBookmarkMenu(int bookmark)
|
||||
{
|
||||
if (bookmark < nextBookmark)
|
||||
{
|
||||
|
@ -219,16 +196,11 @@ int handleBookmarkMenu(unsigned int bookmark)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all bookmarks
|
||||
*
|
||||
* @param menu Handle of the bookmark menu
|
||||
**/
|
||||
/// Removes all bookmarks
|
||||
/// @param menu Handle of the bookmark menu
|
||||
void removeAllBookmarks(HMENU menu)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0;i<nextBookmark;i++)
|
||||
for (int i = 0;i<nextBookmark;i++)
|
||||
{
|
||||
RemoveMenu(menu, ID_FIRST_BOOKMARK + i, MF_BYCOMMAND);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define ID_FIRST_BOOKMARK 30
|
||||
|
||||
typedef struct
|
||||
|
@ -29,8 +31,8 @@ typedef struct
|
|||
extern HexBookmark hexBookmarks[64];
|
||||
extern int nextBookmark;
|
||||
|
||||
int toggleBookmark(HWND hwnd, unsigned int address);
|
||||
int toggleBookmark(HWND hwnd, uint32 address);
|
||||
void updateBookmarkMenus(HMENU menu);
|
||||
int handleBookmarkMenu(unsigned int bookmark);
|
||||
int handleBookmarkMenu(int bookmark);
|
||||
void removeAllBookmarks(HMENU menu);
|
||||
|
||||
|
|
|
@ -252,6 +252,18 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
bool tasedit = lParam?true:false;
|
||||
|
||||
//some of the controls are illogical with tasedit
|
||||
//remove them, and rename the window
|
||||
if(tasedit)
|
||||
{
|
||||
SetWindowText(hwndDlg,"Load TasEdit Movie");
|
||||
ShowWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg,IDC_CHECK_STOPMOVIE),SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg,IDC_EDIT_STOPFRAME),SW_HIDE);
|
||||
}
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHECK_READONLY, BM_SETCHECK, replayReadOnlySetting?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_CHECK_STOPMOVIE,BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
|
||||
|
@ -511,26 +523,6 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
return FALSE;
|
||||
};
|
||||
|
||||
/// Show movie replay dialog and replay the movie if necessary.
|
||||
void FCEUD_MovieReplayFrom(void)
|
||||
{
|
||||
replayReadOnlySetting = FCEUI_GetMovieToggleReadOnly();
|
||||
|
||||
char* fn = (char*)DialogBox(fceu_hInstance, "IDD_REPLAYINP", hAppWnd, ReplayDialogProc);
|
||||
|
||||
if(fn)
|
||||
{
|
||||
FCEUI_LoadMovie(fn, replayReadOnlySetting, replayStopFrameSetting);
|
||||
|
||||
free(fn);
|
||||
|
||||
pal_emulation = FCEUI_GetCurrentVidSystem(0,0);
|
||||
UpdateCheckedMenuItems();
|
||||
SetMainWindowStuff();
|
||||
RefreshThrottleFPS();
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateRecordDialog(HWND hwndDlg)
|
||||
{
|
||||
int enable=0;
|
||||
|
@ -720,9 +712,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the record movie dialog and record a movie.
|
||||
**/
|
||||
//Show the record movie dialog and record a movie.
|
||||
void FCEUD_MovieRecordTo()
|
||||
{
|
||||
struct CreateMovieParameters p;
|
||||
|
@ -749,7 +739,7 @@ void FCEUD_MovieRecordTo()
|
|||
free(p.szSavestateFilename);
|
||||
}
|
||||
|
||||
uint8 flags = 0;
|
||||
EMOVIE_FLAG flags = MOVIE_FLAG_NONE;
|
||||
if(p.recordFrom == 0) flags = MOVIE_FLAG_FROM_POWERON;
|
||||
FCEUI_SaveMovie(p.szFilename, flags);
|
||||
}
|
||||
|
@ -758,3 +748,29 @@ void FCEUD_MovieRecordTo()
|
|||
free(p.szFilename);
|
||||
}
|
||||
|
||||
|
||||
void Replay_LoadMovie(bool tasedit)
|
||||
{
|
||||
replayReadOnlySetting = FCEUI_GetMovieToggleReadOnly();
|
||||
|
||||
char* fn = (char*)DialogBoxParam(fceu_hInstance, "IDD_REPLAYINP", hAppWnd, ReplayDialogProc, (LPARAM)(tasedit?1:0));
|
||||
|
||||
if(fn)
|
||||
{
|
||||
FCEUI_LoadMovie(fn, replayReadOnlySetting, tasedit, replayStopFrameSetting);
|
||||
|
||||
free(fn);
|
||||
|
||||
//mbg 6/21/08 - i think this stuff has to get updated in case the movie changed the pal emulation flag
|
||||
pal_emulation = FCEUI_GetCurrentVidSystem(0,0);
|
||||
UpdateCheckedMenuItems();
|
||||
SetMainWindowStuff();
|
||||
RefreshThrottleFPS();
|
||||
}
|
||||
}
|
||||
|
||||
/// Show movie replay dialog and replay the movie if necessary.
|
||||
void FCEUD_MovieReplayFrom()
|
||||
{
|
||||
Replay_LoadMovie(false);
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
void Replay_LoadMovie(bool tasedit);
|
|
@ -148,6 +148,15 @@ BEGIN
|
|||
END
|
||||
END
|
||||
|
||||
TASEDITMENU MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "Save FM2", ID_FILE_SAVEFM2
|
||||
MENUITEM "&Open FM2", ID_FILE_OPENFM2
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -1162,35 +1171,36 @@ BEGIN
|
|||
RTEXT "Record From:",65498,9,27,43,8
|
||||
END
|
||||
|
||||
IDD_REPLAYINP DIALOGEX 0, 0, 300, 146
|
||||
IDD_REPLAYINP DIALOGEX 0, 0, 300, 164
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Replay input"
|
||||
CAPTION "Replay Movie"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",1,191,126,50,14
|
||||
GROUPBOX "",65497,3,0,293,122
|
||||
DEFPUSHBUTTON "OK",1,191,145,50,14
|
||||
GROUPBOX "",65497,3,0,293,140
|
||||
RTEXT "File:",65498,8,11,24,10,SS_CENTERIMAGE | NOT WS_GROUP
|
||||
COMBOBOX IDC_COMBO_FILENAME,35,10,257,128,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Cancel",2,245,126,50,14
|
||||
RTEXT "Length:",64397,10,55,59,8
|
||||
RTEXT "Frames:",65496,10,63,59,8
|
||||
RTEXT "Record Count:",65495,10,71,59,8
|
||||
EDITTEXT IDC_LABEL_LENGTH,76,55,59,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_FRAMES,76,63,59,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_UNDOCOUNT,76,70,59,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
CONTROL "Open &Read-Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,27,69,10
|
||||
RTEXT "ROM Used:",65493,10,87,59,8
|
||||
RTEXT "ROM Checksum:",65492,10,95,59,8
|
||||
EDITTEXT IDC_LABEL_ROMUSED,76,87,187,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_ROMCHECKSUM,76,95,155,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
RTEXT "Recorded From:",65491,10,79,59,8
|
||||
EDITTEXT IDC_LABEL_RECORDEDFROM,76,79,123,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
RTEXT "Emulator Used:",65490,10,111,59,8
|
||||
EDITTEXT IDC_LABEL_EMULATORUSED,76,111,155,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
RTEXT "Current ROM Sum:",65489,8,103,61,8
|
||||
EDITTEXT IDC_LABEL_CURRCHECKSUM,76,103,155,8,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
CONTROL "Pause movie at frame",IDC_CHECK_STOPMOVIE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,40,83,10
|
||||
EDITTEXT IDC_EDIT_STOPFRAME,119,38,35,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
PUSHBUTTON "Cancel",2,245,145,50,14
|
||||
RTEXT "Length:",64397,10,70,59,8
|
||||
RTEXT "Frames:",65496,10,78,59,8
|
||||
RTEXT "Record Count:",65495,10,86,59,8
|
||||
EDITTEXT IDC_LABEL_LENGTH,76,70,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_FRAMES,76,78,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_UNDOCOUNT,76,86,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
CONTROL "Open &Read-Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,36,69,10
|
||||
RTEXT "ROM Used:",65493,10,102,59,8
|
||||
RTEXT "ROM Checksum:",65492,10,110,59,8
|
||||
RTEXT "Recorded From:",65491,10,94,59,8
|
||||
RTEXT "Emulator Used:",65490,10,126,59,8
|
||||
RTEXT "Current ROM Sum:",65489,8,118,61,8
|
||||
CONTROL "Pause movie at frame",IDC_CHECK_STOPMOVIE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,49,83,10
|
||||
EDITTEXT IDC_EDIT_STOPFRAME,103,47,35,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
GROUPBOX "Parameters",IDC_STATIC,13,25,278,40
|
||||
EDITTEXT IDC_LABEL_RECORDEDFROM,76,94,123,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_ROMUSED,76,102,187,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_ROMCHECKSUM,76,110,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_CURRCHECKSUM,76,118,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
EDITTEXT IDC_LABEL_EMULATORUSED,76,126,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
|
||||
END
|
||||
|
||||
TASEDIT DIALOGEX 0, 0, 470, 349
|
||||
|
@ -1199,9 +1209,8 @@ CAPTION "TAS Editor"
|
|||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,273,296
|
||||
PUSHBUTTON "Hacky export as fm2",IDC_HACKYEXPORT,315,122,124,38
|
||||
PUSHBUTTON "Hacky truncate after current frame",IDC_HACKY1,313,31,124,38
|
||||
PUSHBUTTON "Hacky add 1000 frames",IDC_HACKY2,327,82,124,38
|
||||
PUSHBUTTON "Hacky add 1000 frames",IDC_HACKY2,313,73,124,38
|
||||
END
|
||||
|
||||
ASSEMBLER DIALOGEX 0, 0, 202, 135
|
||||
|
@ -1319,6 +1328,11 @@ BEGIN
|
|||
BOTTOMMARGIN, 74
|
||||
END
|
||||
|
||||
"IDD_REPLAYINP", DIALOG
|
||||
BEGIN
|
||||
BOTTOMMARGIN, 146
|
||||
END
|
||||
|
||||
"TASEDIT", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
|
|
|
@ -515,6 +515,9 @@
|
|||
#define ACCEL_CTRL_N 40136
|
||||
#define ACCEL_CTRL_C 40138
|
||||
#define MENU_HELP 40140
|
||||
#define ID_FILE_OOADFM2 40141
|
||||
#define ID_FILE_OPENFM2 40142
|
||||
#define ID_FILE_SAVEFM2 40143
|
||||
#define MW_ValueLabel2 65423
|
||||
#define MW_ValueLabel1 65426
|
||||
#define GUI_BOT_DEBUG 65436
|
||||
|
@ -524,8 +527,8 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||
#define _APS_NEXT_COMMAND_VALUE 40141
|
||||
#define _APS_NEXT_RESOURCE_VALUE 114
|
||||
#define _APS_NEXT_COMMAND_VALUE 40144
|
||||
#define _APS_NEXT_CONTROL_VALUE 1132
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "tasedit.h"
|
||||
#include "../../fceu.h"
|
||||
#include "fceu.h"
|
||||
#include "debugger.h"
|
||||
#include "../../movie.h"
|
||||
#include "../../utils/xstring.h"
|
||||
#include "replay.h"
|
||||
#include "movie.h"
|
||||
#include "utils/xstring.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -14,6 +16,8 @@ using namespace std;
|
|||
//http://forums.devx.com/archive/index.php/t-37234.html
|
||||
|
||||
HWND hwndTasEdit = 0;
|
||||
|
||||
static HMENU hmenu;
|
||||
static int lastCursor;
|
||||
static HWND hwndList, hwndHeader;
|
||||
static WNDPROC hwndHeader_oldWndproc;
|
||||
|
@ -366,6 +370,7 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
case WM_INITDIALOG:
|
||||
hwndList = GetDlgItem(hwndDlg,IDC_LIST1);
|
||||
InitDialog();
|
||||
SetMenu(hwndDlg,hmenu);
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
|
@ -410,14 +415,17 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
UpdateTasEdit();
|
||||
break;
|
||||
case IDC_HACKY2:
|
||||
//hacky1: delete all items after the current selection
|
||||
//hacky1: delete all items after the cur rent selection
|
||||
currMovieData.records.resize(currMovieData.records.size()+1000);
|
||||
currMovieData.clearRecordRange(currMovieData.records.size()-1000,1000);
|
||||
UpdateTasEdit();
|
||||
break;
|
||||
|
||||
case ID_FILE_OPENFM2:
|
||||
Replay_LoadMovie(true);
|
||||
break;
|
||||
|
||||
case IDC_HACKYEXPORT:
|
||||
//hackyexport: save an fm2
|
||||
case ID_FILE_SAVEFM2:
|
||||
Export();
|
||||
break;
|
||||
|
||||
|
@ -437,6 +445,9 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
void DoTasEdit()
|
||||
{
|
||||
if(!hmenu)
|
||||
hmenu = LoadMenu(fceu_hInstance,"TASEDITMENU");
|
||||
|
||||
lastCursor = -1;
|
||||
if(!hwndTasEdit)
|
||||
hwndTasEdit = CreateDialog(fceu_hInstance,"TASEDIT",NULL,WndprocTasEdit);
|
||||
|
|
|
@ -28,11 +28,8 @@ int CloseWave()
|
|||
return(FCEUI_EndWaveRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a Open File dialog and starts logging sound.
|
||||
*
|
||||
* @return Flag that indicates failure (0) or success (1).
|
||||
**/
|
||||
/// Shows a Open File dialog and starts logging sound.
|
||||
/// @return Flag that indicates failure (0) or success (1).
|
||||
bool CreateSoundSave()
|
||||
{
|
||||
const char filter[]="MS WAVE(*.wav)\0*.wav\0";
|
||||
|
|
|
@ -1,31 +1,29 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* File description: Everything relevant for the main window should go here. This
|
||||
* does not include functions relevant for dialog windows.
|
||||
**/
|
||||
// File description: Everything relevant for the main window should go here. This
|
||||
// does not include functions relevant for dialog windows.
|
||||
|
||||
#include "window.h"
|
||||
#include "main.h"
|
||||
#include "state.h" /* Save/Load state AS */
|
||||
#include "state.h"
|
||||
|
||||
#include "sound.h"
|
||||
#include "wave.h"
|
||||
|
@ -68,7 +66,6 @@ char *md5_asciistr(uint8 digest[16]);
|
|||
void SetAutoFirePattern(int onframes, int offframes);
|
||||
void SetAutoFireOffset(int offset);
|
||||
|
||||
void RestartMovieOrReset(unsigned int pow);
|
||||
int KeyboardSetBackgroundAccess(int on); //mbg merge 7/17/06 YECH had to add
|
||||
void SetJoystickBackgroundAccess(int background); //mbg merge 7/17/06 YECH had to add
|
||||
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
|
||||
|
@ -92,9 +89,7 @@ HWND pwindow;
|
|||
int EnableBackgroundInput = 0;
|
||||
int ismaximized = 0;
|
||||
|
||||
/**
|
||||
* Menu handle of the main menu.
|
||||
**/
|
||||
//Menu handle of the main menu.
|
||||
static HMENU fceumenu = 0;
|
||||
|
||||
static int tog = 0;
|
||||
|
@ -124,7 +119,7 @@ void CalcWindowSize(RECT *al)
|
|||
GetWindowLong(hAppWnd, GWL_STYLE),
|
||||
GetMenu(hAppWnd) != NULL,
|
||||
GetWindowLong(hAppWnd, GWL_EXSTYLE)
|
||||
);
|
||||
);
|
||||
|
||||
al->right -= al->left;
|
||||
al->left = 0;
|
||||
|
@ -132,11 +127,8 @@ void CalcWindowSize(RECT *al)
|
|||
al->top=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the menu items that should only be enabled if a game is loaded.
|
||||
*
|
||||
* @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
||||
**/
|
||||
/// Updates the menu items that should only be enabled if a game is loaded.
|
||||
/// @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
||||
void updateGameDependentMenus(unsigned int enable)
|
||||
{
|
||||
const int menu_ids[]= {
|
||||
|
@ -163,17 +155,15 @@ void updateGameDependentMenus(unsigned int enable)
|
|||
for (unsigned int i = 0; i < sizeof(menu_ids) / sizeof(*menu_ids); i++)
|
||||
{
|
||||
#ifndef _USE_SHARED_MEMORY_
|
||||
if(simpled[x] == MENU_BASIC_BOT)
|
||||
EnableMenuItem(fceumenu,menu_ids[i],MF_BYCOMMAND| MF_GRAYED);
|
||||
else
|
||||
if(simpled[x] == MENU_BASIC_BOT)
|
||||
EnableMenuItem(fceumenu,menu_ids[i],MF_BYCOMMAND| MF_GRAYED);
|
||||
else
|
||||
#endif
|
||||
EnableMenuItem(fceumenu, menu_ids[i], MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(fceumenu, menu_ids[i], MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates menu items which need to be checked or unchecked.
|
||||
**/
|
||||
//Updates menu items which need to be checked or unchecked.
|
||||
void UpdateCheckedMenuItems()
|
||||
{
|
||||
static int *polo[] = { &genie, &pal_emulation, &status_icon };
|
||||
|
@ -212,42 +202,39 @@ void UpdateCheckedMenuItems()
|
|||
MENU_AUTOFIRE_PATTERN_15,
|
||||
0};
|
||||
|
||||
int AutoFireOffsetIDs[] = {
|
||||
MENU_AUTOFIRE_OFFSET_1,
|
||||
MENU_AUTOFIRE_OFFSET_2,
|
||||
MENU_AUTOFIRE_OFFSET_3,
|
||||
MENU_AUTOFIRE_OFFSET_4,
|
||||
MENU_AUTOFIRE_OFFSET_5,
|
||||
MENU_AUTOFIRE_OFFSET_6,
|
||||
0};
|
||||
int AutoFireOffsetIDs[] = {
|
||||
MENU_AUTOFIRE_OFFSET_1,
|
||||
MENU_AUTOFIRE_OFFSET_2,
|
||||
MENU_AUTOFIRE_OFFSET_3,
|
||||
MENU_AUTOFIRE_OFFSET_4,
|
||||
MENU_AUTOFIRE_OFFSET_5,
|
||||
MENU_AUTOFIRE_OFFSET_6,
|
||||
0};
|
||||
|
||||
x = 0;
|
||||
x = 0;
|
||||
|
||||
while(AutoFirePatternIDs[x])
|
||||
{
|
||||
CheckMenuItem(fceumenu, AutoFirePatternIDs[x],
|
||||
AutoFirePatternIDs[x] == CheckedAutoFirePattern ? MF_CHECKED : MF_UNCHECKED);
|
||||
x++;
|
||||
}
|
||||
while(AutoFirePatternIDs[x])
|
||||
{
|
||||
CheckMenuItem(fceumenu, AutoFirePatternIDs[x],
|
||||
AutoFirePatternIDs[x] == CheckedAutoFirePattern ? MF_CHECKED : MF_UNCHECKED);
|
||||
x++;
|
||||
}
|
||||
|
||||
x = 0;
|
||||
x = 0;
|
||||
|
||||
while(AutoFireOffsetIDs[x])
|
||||
{
|
||||
CheckMenuItem(fceumenu, AutoFireOffsetIDs[x],
|
||||
AutoFireOffsetIDs[x] == CheckedAutoFireOffset ? MF_CHECKED : MF_UNCHECKED);
|
||||
x++;
|
||||
}
|
||||
while(AutoFireOffsetIDs[x])
|
||||
{
|
||||
CheckMenuItem(fceumenu, AutoFireOffsetIDs[x],
|
||||
AutoFireOffsetIDs[x] == CheckedAutoFireOffset ? MF_CHECKED : MF_UNCHECKED);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
**/
|
||||
/// 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);
|
||||
|
@ -305,16 +292,13 @@ void UpdateRMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int basei
|
|||
DrawMenuBar(hAppWnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to populate the recent directories and recent files arrays.
|
||||
*
|
||||
* @param addString String to add to the array.
|
||||
* @param bufferArray Array where the string will be added.
|
||||
* @param arrayLen Length of the bufferArray.
|
||||
* @param menu Menu handle of the main menu.
|
||||
* @param menuItem
|
||||
* @param baseID
|
||||
**/
|
||||
/// Helper function to populate the recent directories and recent files arrays.
|
||||
/// @param addString String to add to the array.
|
||||
/// @param bufferArray Array where the string will be added.
|
||||
/// @param arrayLen Length of the bufferArray.
|
||||
/// @param menu Menu handle of the main menu.
|
||||
/// @param menuItem
|
||||
/// @param baseID
|
||||
void UpdateRecentArray(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.
|
||||
|
@ -332,7 +316,7 @@ void UpdateRecentArray(const char* addString, char** bufferArray, unsigned int a
|
|||
|
||||
// Save pointer.
|
||||
tmp = bufferArray[x];
|
||||
|
||||
|
||||
for(y = x; y; y--)
|
||||
{
|
||||
// Move items down.
|
||||
|
@ -373,21 +357,15 @@ void UpdateRecentArray(const char* addString, char** bufferArray, unsigned int a
|
|||
UpdateRMenu(menu, bufferArray, menuItem, baseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a filename to the recent files list.
|
||||
*
|
||||
* @param filename Name of the file to add.
|
||||
**/
|
||||
/// Add a filename to the recent files list.
|
||||
/// @param filename Name of the file to add.
|
||||
void AddRecentFile(const char *filename)
|
||||
{
|
||||
UpdateRecentArray(filename, recent_files, MAX_NUMBER_OF_RECENT_FILES, recentmenu, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the main menu.
|
||||
*
|
||||
* @param hide_menu Flag to turn the main menu on (0) or off (1)
|
||||
**/
|
||||
/// Hides the main menu.
|
||||
///@param hide_menu Flag to turn the main menu on (0) or off (1)
|
||||
void HideMenu(unsigned int hide_menu)
|
||||
{
|
||||
if(hide_menu)
|
||||
|
@ -427,9 +405,7 @@ void HideFWindow(int h)
|
|||
SetWindowPos(hAppWnd, 0 ,0 ,0 ,0 ,0 ,SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the display status of the main menu.
|
||||
**/
|
||||
//Toggles the display status of the main menu.
|
||||
void ToggleHideMenu(void)
|
||||
{
|
||||
if(!fullscreen && (GameInfo || tog))
|
||||
|
@ -440,11 +416,8 @@ void ToggleHideMenu(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the display status of the main menu.
|
||||
*
|
||||
* TODO: We could get rid of this one.
|
||||
**/
|
||||
//Toggles the display status of the main menu.
|
||||
//TODO: We could get rid of this one.
|
||||
void FCEUD_HideMenuToggle(void)
|
||||
{
|
||||
ToggleHideMenu();
|
||||
|
@ -480,12 +453,9 @@ void ALoad(char *nameo)
|
|||
updateGameDependentMenus(GameInfo != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
/// 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";
|
||||
|
@ -571,111 +541,109 @@ void GetMouseData(uint32 (&md)[3])
|
|||
md[2] = ((mouseb == MK_LBUTTON) ? 1 : 0) | (( mouseb == MK_RBUTTON ) ? 2 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Message loop of the main window
|
||||
**/
|
||||
//Message loop of the main window
|
||||
LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
mouseb=wParam;
|
||||
goto proco;
|
||||
switch(msg)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
mouseb=wParam;
|
||||
goto proco;
|
||||
|
||||
case WM_MOVE: {
|
||||
case WM_MOVE: {
|
||||
RECT wrect;
|
||||
GetWindowRect(hWnd,&wrect);
|
||||
MainWindow_wndx = wrect.left;
|
||||
MainWindow_wndy = wrect.top;
|
||||
}
|
||||
}
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
mousex=LOWORD(lParam);
|
||||
mousey=HIWORD(lParam);
|
||||
}
|
||||
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_ERASEBKGND:
|
||||
if(xbsave)
|
||||
return(0);
|
||||
else
|
||||
goto proco;
|
||||
|
||||
case WM_PAINT:
|
||||
if(xbsave)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint(hWnd,&ps);
|
||||
FCEUD_BlitScreen(xbsave);
|
||||
EndPaint(hWnd,&ps);
|
||||
return(0);
|
||||
}
|
||||
goto proco;
|
||||
case WM_PAINT:
|
||||
if(xbsave)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint(hWnd,&ps);
|
||||
FCEUD_BlitScreen(xbsave);
|
||||
EndPaint(hWnd,&ps);
|
||||
return(0);
|
||||
}
|
||||
goto proco;
|
||||
|
||||
case WM_SIZE:
|
||||
if(!fullscreen && !changerecursive)
|
||||
switch(wParam)
|
||||
{
|
||||
case SIZE_MAXIMIZED: ismaximized = 1;SetMainWindowStuff();break;
|
||||
case SIZE_RESTORED: ismaximized = 0;SetMainWindowStuff();break;
|
||||
}
|
||||
break;
|
||||
case WM_SIZING:
|
||||
{
|
||||
RECT *wrect=(RECT *)lParam;
|
||||
RECT srect;
|
||||
case WM_SIZE:
|
||||
if(!fullscreen && !changerecursive)
|
||||
switch(wParam)
|
||||
{
|
||||
case SIZE_MAXIMIZED: ismaximized = 1;SetMainWindowStuff();break;
|
||||
case SIZE_RESTORED: ismaximized = 0;SetMainWindowStuff();break;
|
||||
}
|
||||
break;
|
||||
case WM_SIZING:
|
||||
{
|
||||
RECT *wrect=(RECT *)lParam;
|
||||
RECT srect;
|
||||
|
||||
int h=wrect->bottom-wrect->top;
|
||||
int w=wrect->right-wrect->left;
|
||||
int how = 0;
|
||||
int h=wrect->bottom-wrect->top;
|
||||
int w=wrect->right-wrect->left;
|
||||
int how = 0;
|
||||
|
||||
if(wParam == WMSZ_BOTTOM || wParam == WMSZ_TOP)
|
||||
how = 2;
|
||||
else if(wParam == WMSZ_LEFT || wParam == WMSZ_RIGHT)
|
||||
how = 1;
|
||||
else if(wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT
|
||||
|| wParam == WMSZ_TOPRIGHT || wParam == WMSZ_TOPLEFT)
|
||||
how = 3;
|
||||
if(how & 1)
|
||||
winsizemulx*= (double)w/winwidth;
|
||||
if(how & 2)
|
||||
winsizemuly*= (double)h/winheight;
|
||||
if(how & 1) FixWXY(0);
|
||||
else FixWXY(1);
|
||||
if(wParam == WMSZ_BOTTOM || wParam == WMSZ_TOP)
|
||||
how = 2;
|
||||
else if(wParam == WMSZ_LEFT || wParam == WMSZ_RIGHT)
|
||||
how = 1;
|
||||
else if(wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT
|
||||
|| wParam == WMSZ_TOPRIGHT || wParam == WMSZ_TOPLEFT)
|
||||
how = 3;
|
||||
if(how & 1)
|
||||
winsizemulx*= (double)w/winwidth;
|
||||
if(how & 2)
|
||||
winsizemuly*= (double)h/winheight;
|
||||
if(how & 1) FixWXY(0);
|
||||
else FixWXY(1);
|
||||
|
||||
CalcWindowSize(&srect);
|
||||
winwidth=srect.right;
|
||||
winheight=srect.bottom;
|
||||
wrect->right = wrect->left + srect.right;
|
||||
wrect->bottom = wrect->top + srect.bottom;
|
||||
}
|
||||
//sizchange=1;
|
||||
//break;
|
||||
goto proco;
|
||||
case WM_DISPLAYCHANGE:
|
||||
if(!fullscreen && !changerecursive)
|
||||
vchanged=1;
|
||||
goto proco;
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
UINT len;
|
||||
char *ftmp;
|
||||
CalcWindowSize(&srect);
|
||||
winwidth=srect.right;
|
||||
winheight=srect.bottom;
|
||||
wrect->right = wrect->left + srect.right;
|
||||
wrect->bottom = wrect->top + srect.bottom;
|
||||
}
|
||||
//sizchange=1;
|
||||
//break;
|
||||
goto proco;
|
||||
case WM_DISPLAYCHANGE:
|
||||
if(!fullscreen && !changerecursive)
|
||||
vchanged=1;
|
||||
goto proco;
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
UINT len;
|
||||
char *ftmp;
|
||||
|
||||
len=DragQueryFile((HDROP)wParam,0,0,0)+1; //mbg merge 7/17/06 changed (HANDLE) to (HDROP)
|
||||
if((ftmp=(char*)malloc(len))) //mbg merge 7/17/06 added cast
|
||||
{
|
||||
DragQueryFile((HDROP)wParam,0,ftmp,len); //mbg merge 7/17/06 changed (HANDLE) to (HDROP)
|
||||
ALoad(ftmp);
|
||||
free(ftmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
len=DragQueryFile((HDROP)wParam,0,0,0)+1; //mbg merge 7/17/06 changed (HANDLE) to (HDROP)
|
||||
if((ftmp=(char*)malloc(len))) //mbg merge 7/17/06 added cast
|
||||
{
|
||||
DragQueryFile((HDROP)wParam,0,ftmp,len); //mbg merge 7/17/06 changed (HANDLE) to (HDROP)
|
||||
ALoad(ftmp);
|
||||
free(ftmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
case WM_COMMAND:
|
||||
|
||||
if(HIWORD(wParam) == 0 || HIWORD(wParam) == 1)
|
||||
{
|
||||
|
@ -911,7 +879,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
case MENU_BASIC_BOT:
|
||||
CreateBasicBot();
|
||||
break;
|
||||
|
||||
|
||||
case MENU_DIRECTORIES:
|
||||
// Directories menu was selected
|
||||
ConfigDirectories();
|
||||
|
@ -959,12 +927,12 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
|
||||
case MENU_RESET:
|
||||
// The reset menu was selected
|
||||
RestartMovieOrReset(0);
|
||||
FCEUI_ResetNES();
|
||||
break;
|
||||
|
||||
case MENU_POWER:
|
||||
// The power menu was selected
|
||||
RestartMovieOrReset(1);
|
||||
FCEUI_PowerNES();
|
||||
break;
|
||||
|
||||
case MENU_SWITCH_DISK:
|
||||
|
@ -992,7 +960,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
// User selected the Open File menu => Show the file selection dialog
|
||||
LoadNewGamey(hWnd, 0);
|
||||
break;
|
||||
|
||||
|
||||
case ACCEL_CTRL_W:
|
||||
case MENU_CLOSE_FILE:
|
||||
// User selected the Close File menu => Close the game if necessary
|
||||
|
@ -1013,8 +981,8 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
FCEUD_LoadStateFrom();
|
||||
break;
|
||||
|
||||
//mbg merge 7/18/06 changed ID from 120
|
||||
//jeb rewrite 6/3/08 (for UI consistency)
|
||||
//mbg merge 7/18/06 changed ID from 120
|
||||
//jeb rewrite 6/3/08 (for UI consistency)
|
||||
case MENU_RECORD_WAV:
|
||||
loggingSound = CreateSoundSave();
|
||||
break;
|
||||
|
@ -1073,84 +1041,79 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
break;
|
||||
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
if(GameInfo && wParam == SC_SCREENSAVE && (goptions & GOO_DISABLESS))
|
||||
return(0);
|
||||
case WM_SYSCOMMAND:
|
||||
if(GameInfo && wParam == SC_SCREENSAVE && (goptions & GOO_DISABLESS))
|
||||
return(0);
|
||||
|
||||
if(wParam==SC_KEYMENU)
|
||||
{
|
||||
if(GameInfo && InputType[2]==SIFC_FKB && cidisabled)
|
||||
break;
|
||||
if(lParam == VK_RETURN || fullscreen || tog) break;
|
||||
}
|
||||
goto proco;
|
||||
case WM_SYSKEYDOWN:
|
||||
if(GameInfo && InputType[2]==SIFC_FKB && cidisabled)
|
||||
break; /* Hopefully this won't break DInput... */
|
||||
|
||||
if(fullscreen || tog)
|
||||
{
|
||||
if(wParam==VK_MENU)
|
||||
break;
|
||||
}
|
||||
if(wParam==VK_F10)
|
||||
{
|
||||
return 0;
|
||||
/*
|
||||
if(!moocow) FCEUD_PrintError("Iyee");
|
||||
if(!(lParam&0x40000000))
|
||||
FCEUI_ResetNES();
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
if(wParam == VK_RETURN)
|
||||
if(wParam==SC_KEYMENU)
|
||||
{
|
||||
if(!(lParam&(1<<30)))
|
||||
{
|
||||
UpdateCheckedMenuItems();
|
||||
changerecursive=1;
|
||||
if(!SetVideoMode(fullscreen^1))
|
||||
SetVideoMode(fullscreen);
|
||||
changerecursive=0;
|
||||
}
|
||||
break;
|
||||
if(GameInfo && InputType[2]==SIFC_FKB && cidisabled)
|
||||
break;
|
||||
if(lParam == VK_RETURN || fullscreen || tog) break;
|
||||
}
|
||||
goto proco;
|
||||
goto proco;
|
||||
case WM_SYSKEYDOWN:
|
||||
if(GameInfo && InputType[2]==SIFC_FKB && cidisabled)
|
||||
break; // Hopefully this won't break DInput...
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if(GameInfo)
|
||||
{
|
||||
/* Only disable command keys if a game is loaded(and the other
|
||||
conditions are right, of course). */
|
||||
if(InputType[2]==SIFC_FKB)
|
||||
{
|
||||
if(wParam==VK_SCROLL)
|
||||
if(fullscreen || tog)
|
||||
{
|
||||
cidisabled^=1;
|
||||
FCEUI_DispMessage("Family Keyboard %sabled.",cidisabled?"en":"dis");
|
||||
if(wParam==VK_MENU)
|
||||
break;
|
||||
}
|
||||
if(cidisabled)
|
||||
break; /* Hopefully this won't break DInput... */
|
||||
}
|
||||
}
|
||||
goto proco;
|
||||
case WM_CLOSE:
|
||||
case WM_DESTROY:
|
||||
case WM_QUIT:
|
||||
|
||||
if(wParam == VK_RETURN)
|
||||
{
|
||||
if(!(lParam&(1<<30)))
|
||||
{
|
||||
UpdateCheckedMenuItems();
|
||||
changerecursive=1;
|
||||
if(!SetVideoMode(fullscreen^1))
|
||||
SetVideoMode(fullscreen);
|
||||
changerecursive=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
goto proco;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if(GameInfo)
|
||||
{
|
||||
//Only disable command keys if a game is loaded(and the other conditions are right, of course).
|
||||
if(InputType[2]==SIFC_FKB)
|
||||
{
|
||||
if(wParam==VK_SCROLL)
|
||||
{
|
||||
cidisabled^=1;
|
||||
FCEUI_DispMessage("Family Keyboard %sabled.",cidisabled?"en":"dis");
|
||||
}
|
||||
if(cidisabled)
|
||||
break; // Hopefully this won't break DInput...
|
||||
}
|
||||
}
|
||||
goto proco;
|
||||
case WM_CLOSE:
|
||||
case WM_DESTROY:
|
||||
case WM_QUIT:
|
||||
DoFCEUExit();
|
||||
break;
|
||||
case WM_ACTIVATEAPP:
|
||||
if((BOOL)wParam)
|
||||
{
|
||||
nofocus=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
nofocus=1;
|
||||
}
|
||||
goto proco;
|
||||
case WM_ENTERMENULOOP:
|
||||
case WM_ACTIVATEAPP:
|
||||
if((BOOL)wParam)
|
||||
{
|
||||
nofocus=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
nofocus=1;
|
||||
}
|
||||
goto proco;
|
||||
case WM_ENTERMENULOOP:
|
||||
EnableMenuItem(fceumenu,MENU_RESET,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_RESET)?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(fceumenu,MENU_POWER,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_POWER)?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(fceumenu,MENU_TASEDIT,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_TASEDIT)?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(fceumenu,MENU_CLOSE_FILE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_CLOSEGAME)?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(fceumenu,MENU_RECENT_FILES,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_REPLAY_MOVIE,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));
|
||||
|
@ -1158,11 +1121,11 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
EnableMenuItem(fceumenu,MENU_LOAD_STATE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_LOADSTATE)?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(fceumenu,MENU_STOP_AVI,MF_BYCOMMAND | (FCEUI_AviIsRecording()?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(fceumenu,MENU_STOP_WAV,MF_BYCOMMAND | (loggingSound?MF_ENABLED:MF_GRAYED));
|
||||
default:
|
||||
proco:
|
||||
return DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
proco:
|
||||
return DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FixWXY(int pref)
|
||||
|
@ -1255,9 +1218,8 @@ void UpdateFCEUWindow(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys the main window
|
||||
**/
|
||||
|
||||
//Destroys the main window
|
||||
void ByebyeWindow()
|
||||
{
|
||||
SetMenu(hAppWnd, 0);
|
||||
|
@ -1265,11 +1227,8 @@ void ByebyeWindow()
|
|||
DestroyWindow(hAppWnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the main window.
|
||||
*
|
||||
* @return Flag that indicates failure (0) or success (1)
|
||||
**/
|
||||
/// reates the main window.
|
||||
/// @return Flag that indicates failure (0) or success (1)
|
||||
int CreateMainWindow()
|
||||
{
|
||||
WNDCLASSEX winclass;
|
||||
|
@ -1371,7 +1330,7 @@ void SetMainWindowStuff()
|
|||
srect.right,
|
||||
srect.bottom,
|
||||
SWP_SHOWWINDOW
|
||||
);
|
||||
);
|
||||
|
||||
winwidth = srect.right;
|
||||
winheight = srect.bottom;
|
||||
|
@ -1380,9 +1339,7 @@ void SetMainWindowStuff()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Flag that indicates failure (0) or success (1).
|
||||
**/
|
||||
/// @return Flag that indicates failure (0) or success (1).
|
||||
int GetClientAbsRect(LPRECT lpRect)
|
||||
{
|
||||
POINT point;
|
||||
|
@ -1411,11 +1368,7 @@ int GetClientAbsRect(LPRECT lpRect)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an Open File menu and starts recording an AVI
|
||||
*
|
||||
* TODO: Does this even work?
|
||||
**/
|
||||
//Shows an Open File menu and starts recording an AVI
|
||||
void FCEUD_AviRecordTo(void)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
|
@ -1428,7 +1381,7 @@ void FCEUD_AviRecordTo(void)
|
|||
extern char curMovieFilename[];
|
||||
strcpy(szChoice, curMovieFilename);
|
||||
char* dot = strrchr(szChoice,'.');
|
||||
|
||||
|
||||
if (dot)
|
||||
{
|
||||
*dot='\0';
|
||||
|
@ -1460,9 +1413,7 @@ void FCEUD_AviRecordTo(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop AVI recording
|
||||
**/
|
||||
//Stop AVI recording
|
||||
void FCEUD_AviStop(void)
|
||||
{
|
||||
FCEUI_AviEnd();
|
||||
|
@ -1470,7 +1421,6 @@ void FCEUD_AviStop(void)
|
|||
|
||||
void FCEUD_CmdOpen(void)
|
||||
{
|
||||
|
||||
LoadNewGamey(hAppWnd, 0);
|
||||
}
|
||||
|
||||
|
|
62
src/fceu.cpp
62
src/fceu.cpp
|
@ -565,36 +565,11 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
|
|||
|
||||
void FCEUI_CloseGame(void)
|
||||
{
|
||||
if(!FCEU_IsValidUI(FCEUI_CLOSEGAME))
|
||||
return;
|
||||
CloseGame();
|
||||
}
|
||||
|
||||
//resets or powers off the system, as specified
|
||||
//OR, if a movie is playing or recording, possibly reloads the movie according to funny rules.
|
||||
void RestartMovieOrReset(unsigned int do_power_off)
|
||||
{
|
||||
extern bool movie_readonly;
|
||||
extern char curMovieFilename[512];
|
||||
|
||||
if(FCEUMOV_Mode(MOVIEMODE_PLAY) || FCEUMOV_Mode(MOVIEMODE_RECORD) && movie_readonly)
|
||||
{
|
||||
FCEUI_LoadMovie(curMovieFilename, movie_readonly, 0);
|
||||
|
||||
if(FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(do_power_off)
|
||||
{
|
||||
FCEUI_PowerNES();
|
||||
}
|
||||
else
|
||||
{
|
||||
FCEUI_ResetNES();
|
||||
}
|
||||
}
|
||||
|
||||
void ResetNES(void)
|
||||
{
|
||||
FCEUMOV_AddCommand(FCEUNPCMD_RESET);
|
||||
|
@ -863,20 +838,39 @@ bool FCEU_IsValidUI(EFCEUI ui)
|
|||
{
|
||||
switch(ui)
|
||||
{
|
||||
case FCEUI_OPENGAME:
|
||||
case FCEUI_CLOSEGAME:
|
||||
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT)) return false;
|
||||
break;
|
||||
|
||||
case FCEUI_RECORDMOVIE:
|
||||
case FCEUI_PLAYMOVIE:
|
||||
if(!GameInfo) return false;
|
||||
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT)) return false;
|
||||
break;
|
||||
case FCEUI_STOPMOVIE:
|
||||
return FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD);
|
||||
case FCEUI_STOPAVI:
|
||||
return FCEUI_AviIsRecording();
|
||||
case FCEUI_SAVESTATE:
|
||||
case FCEUI_LOADSTATE:
|
||||
if(!GameInfo) return false;
|
||||
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT)) return false;
|
||||
break;
|
||||
|
||||
case FCEUI_STOPMOVIE:
|
||||
return FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD);
|
||||
|
||||
case FCEUI_STOPAVI:
|
||||
return FCEUI_AviIsRecording();
|
||||
|
||||
case FCEUI_TASEDIT:
|
||||
if(!GameInfo) return false;
|
||||
break;
|
||||
|
||||
case FCEUI_RESET:
|
||||
if(!GameInfo) return false;
|
||||
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT|MOVIEMODE_PLAY)) return false;
|
||||
break;
|
||||
|
||||
case FCEUI_POWER:
|
||||
if(!GameInfo) return false;
|
||||
if(!FCEUMOV_Mode(MOVIEMODE_INACTIVE)) return false;
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -580,12 +580,16 @@ void FCEUI_VSUniCoin(void)
|
|||
//Resets the NES
|
||||
void FCEUI_ResetNES(void)
|
||||
{
|
||||
if(!FCEU_IsValidUI(FCEUI_RESET))
|
||||
return;
|
||||
FCEU_QSimpleCommand(FCEUNPCMD_RESET);
|
||||
}
|
||||
|
||||
//Powers off the NES
|
||||
void FCEUI_PowerNES(void)
|
||||
{
|
||||
if(!FCEU_IsValidUI(FCEUI_POWER))
|
||||
return;
|
||||
FCEU_QSimpleCommand(FCEUNPCMD_POWER);
|
||||
}
|
||||
|
||||
|
|
102
src/movie.cpp
102
src/movie.cpp
|
@ -63,7 +63,7 @@ fstream* osRecordingMovie = 0;
|
|||
|
||||
int currFrameCounter;
|
||||
uint32 cur_input_display = 0;
|
||||
int pauseframe;
|
||||
int pauseframe = -1;
|
||||
bool movie_readonly = true;
|
||||
int input_display = 0;
|
||||
int frame_display = 0;
|
||||
|
@ -283,8 +283,6 @@ MovieData::MovieData()
|
|||
: version(MOVIE_VERSION)
|
||||
, emuVersion(FCEU_VERSION_NUMERIC)
|
||||
, palFlag(false)
|
||||
, poweronFlag(false)
|
||||
, resetFlag(false)
|
||||
, binaryFlag(false)
|
||||
, recordCount(1)
|
||||
, greenZoneCount(0)
|
||||
|
@ -308,10 +306,6 @@ void MovieData::installValue(std::string& key, std::string& val)
|
|||
installInt(val,recordCount);
|
||||
else if(key == "palFlag")
|
||||
installBool(val,palFlag);
|
||||
else if(key == "poweronFlag")
|
||||
installBool(val,poweronFlag);
|
||||
else if(key == "resetFlag")
|
||||
installBool(val,resetFlag);
|
||||
else if(key == "romFilename")
|
||||
romFilename = val;
|
||||
else if(key == "romChecksum")
|
||||
|
@ -346,8 +340,6 @@ int MovieData::dump(std::ostream *os, bool binary)
|
|||
*os << "emuVersion " << emuVersion << endl;
|
||||
*os << "recordCount " << recordCount << endl;
|
||||
*os << "palFlag " << (palFlag?1:0) << endl;
|
||||
*os << "poweronFlag " << (poweronFlag?1:0) << endl;
|
||||
*os << "resetFlag " << (resetFlag?1:0) << endl;
|
||||
*os << "romFilename " << romFilename << endl;
|
||||
*os << "romChecksum " << BytesToString(romChecksum.data,MD5DATA::size) << endl;
|
||||
*os << "guid " << guid.toString() << endl;
|
||||
|
@ -599,7 +591,6 @@ void FCEUMOV_EnterTasEdit()
|
|||
currMovieData = MovieData();
|
||||
currMovieData.guid.newGuid();
|
||||
currMovieData.palFlag = FCEUI_GetCurrentVidSystem(0,0)!=0;
|
||||
currMovieData.poweronFlag = true;
|
||||
currMovieData.romChecksum = GameInfo->MD5;
|
||||
currMovieData.romFilename = FileBase;
|
||||
|
||||
|
@ -608,6 +599,8 @@ void FCEUMOV_EnterTasEdit()
|
|||
|
||||
//todo - think about this
|
||||
//ResetInputTypes();
|
||||
//todo - maybe this instead
|
||||
//FCEUD_SetInput(currMovieData.fourscore,(ESI)currMovieData.ports[0],(ESI)currMovieData.ports[1],(ESIFC)currMovieData.ports[2]);
|
||||
|
||||
//pause the emulator
|
||||
FCEUI_SetEmulationPaused(1);
|
||||
|
@ -638,9 +631,9 @@ void MovieData::dumpSavestateTo(std::vector<char>* buf, int compressionLevel)
|
|||
}
|
||||
|
||||
//begin playing an existing movie
|
||||
void FCEUI_LoadMovie(char *fname, bool _read_only, int _pauseframe)
|
||||
void FCEUI_LoadMovie(char *fname, bool _read_only, bool tasedit, int _pauseframe)
|
||||
{
|
||||
if(!FCEU_IsValidUI(FCEUI_PLAYMOVIE))
|
||||
if(!tasedit && !FCEU_IsValidUI(FCEUI_PLAYMOVIE))
|
||||
return;
|
||||
|
||||
assert(fname);
|
||||
|
@ -667,19 +660,13 @@ void FCEUI_LoadMovie(char *fname, bool _read_only, int _pauseframe)
|
|||
poweron(true);
|
||||
}
|
||||
|
||||
//todo - if reset flag is set, will the poweron flag be set?
|
||||
//WE NEED TO LOAD A SAVESTATE
|
||||
if(!currMovieData.poweronFlag)
|
||||
if(currMovieData.savestate.size() != 0)
|
||||
{
|
||||
//and load the state
|
||||
bool success = MovieData::loadSavestateFrom(&currMovieData.savestate);
|
||||
if(!success) return;
|
||||
}
|
||||
|
||||
//TODO - handle reset flag
|
||||
//ResetNES();
|
||||
|
||||
|
||||
//if there is no savestate, we won't have this crucial piece of information at the start of the movie.
|
||||
//so, we have to include it with the movie
|
||||
if(currMovieData.palFlag)
|
||||
|
@ -691,17 +678,25 @@ void FCEUI_LoadMovie(char *fname, bool _read_only, int _pauseframe)
|
|||
FCEUD_SetInput(currMovieData.fourscore,(ESI)currMovieData.ports[0],(ESI)currMovieData.ports[1],(ESIFC)currMovieData.ports[2]);
|
||||
|
||||
//stuff that should only happen when we're ready to positively commit to the replay
|
||||
currFrameCounter = 0;
|
||||
pauseframe = _pauseframe;
|
||||
movie_readonly = _read_only;
|
||||
movieMode = MOVIEMODE_PLAY;
|
||||
if(tasedit)
|
||||
{
|
||||
currFrameCounter = 0;
|
||||
pauseframe = _pauseframe;
|
||||
|
||||
currMovieData.TryDumpIncremental();
|
||||
|
||||
if(movie_readonly)
|
||||
FCEU_DispMessage("Replay started Read-Only.");
|
||||
currMovieData.TryDumpIncremental();
|
||||
}
|
||||
else
|
||||
FCEU_DispMessage("Replay started Read+Write.");
|
||||
{
|
||||
currFrameCounter = 0;
|
||||
pauseframe = _pauseframe;
|
||||
movie_readonly = _read_only;
|
||||
movieMode = MOVIEMODE_PLAY;
|
||||
|
||||
if(movie_readonly)
|
||||
FCEU_DispMessage("Replay started Read-Only.");
|
||||
else
|
||||
FCEU_DispMessage("Replay started Read+Write.");
|
||||
}
|
||||
}
|
||||
|
||||
static void closeRecordingMovie()
|
||||
|
@ -715,10 +710,6 @@ static void closeRecordingMovie()
|
|||
|
||||
static void openRecordingMovie(const char* fname)
|
||||
{
|
||||
//fpRecordingMovie = FCEUD_UTF8fopen(fname, "wb");
|
||||
//if(!fpRecordingMovie)
|
||||
// FCEU_PrintError("Error opening movie output file: %s",fname);
|
||||
|
||||
osRecordingMovie = FCEUD_UTF8_fstream(fname, "wb");
|
||||
if(!osRecordingMovie)
|
||||
FCEU_PrintError("Error opening movie output file: %s",fname);
|
||||
|
@ -727,7 +718,8 @@ static void openRecordingMovie(const char* fname)
|
|||
|
||||
|
||||
//begin recording a new movie
|
||||
void FCEUI_SaveMovie(char *fname, uint8 flags)
|
||||
//TODO - BUG - the record-from-another-savestate doesnt work.
|
||||
void FCEUI_SaveMovie(char *fname, EMOVIE_FLAG flags)
|
||||
{
|
||||
if(!FCEU_IsValidUI(FCEUI_RECORDMOVIE))
|
||||
return;
|
||||
|
@ -744,8 +736,6 @@ void FCEUI_SaveMovie(char *fname, uint8 flags)
|
|||
currMovieData.guid.newGuid();
|
||||
|
||||
currMovieData.palFlag = FCEUI_GetCurrentVidSystem(0,0)!=0;
|
||||
currMovieData.poweronFlag = (flags & MOVIE_FLAG_FROM_POWERON)!=0;
|
||||
currMovieData.resetFlag = (flags & MOVIE_FLAG_FROM_RESET)!=0;
|
||||
currMovieData.romChecksum = GameInfo->MD5;
|
||||
currMovieData.romFilename = FileBase;
|
||||
currMovieData.fourscore = FCEUI_GetInputFourscore();
|
||||
|
@ -753,7 +743,7 @@ void FCEUI_SaveMovie(char *fname, uint8 flags)
|
|||
currMovieData.ports[1] = joyports[1].type;
|
||||
currMovieData.ports[2] = portFC.type;
|
||||
|
||||
if(currMovieData.poweronFlag)
|
||||
if(flags & MOVIE_FLAG_FROM_POWERON)
|
||||
{
|
||||
poweron(true);
|
||||
}
|
||||
|
@ -765,16 +755,6 @@ void FCEUI_SaveMovie(char *fname, uint8 flags)
|
|||
//we are going to go ahead and dump the header. from now on we will only be appending frames
|
||||
currMovieData.dump(osRecordingMovie, false);
|
||||
|
||||
//todo - think about this
|
||||
//ResetInputTypes();
|
||||
|
||||
//todo - think about this
|
||||
// trigger a reset
|
||||
if(flags & MOVIE_FLAG_FROM_RESET)
|
||||
{
|
||||
ResetNES(); // NOTE: this will write an FCEUNPCMD_RESET into the movie file
|
||||
}
|
||||
|
||||
movieMode = MOVIEMODE_RECORD;
|
||||
movie_readonly = false;
|
||||
|
||||
|
@ -790,7 +770,7 @@ void FCEUMOV_AddInputState()
|
|||
//(input recording is just like standard read+write movie recording with input taken from gamepad)
|
||||
//otherwise, it will come from the tasedit data.
|
||||
|
||||
if(movieMode == MOVIEMODE_PLAY)
|
||||
if(movieMode == MOVIEMODE_PLAY || movieMode == MOVIEMODE_TASEDIT)
|
||||
{
|
||||
//stop when we run out of frames
|
||||
if(currFrameCounter == currMovieData.records.size())
|
||||
|
@ -976,16 +956,6 @@ bool FCEUMOV_PostLoad(void)
|
|||
return load_successful;
|
||||
}
|
||||
|
||||
//int FCEUI_IsMovieActive(void)
|
||||
//{
|
||||
// //this is a lame method. we should change all the fceu code that uses it to call the
|
||||
// //IsRecording or IsPlaying methods
|
||||
// //return > 0 for recording, < 0 for playback
|
||||
// if(FCEUMOV_IsRecording()) return 1;
|
||||
// else if(FCEUMOV_IsPlaying()) return -1;
|
||||
// else return 0;
|
||||
//}
|
||||
|
||||
void FCEUI_MovieToggleFrameDisplay(void)
|
||||
{
|
||||
frame_display=!frame_display;
|
||||
|
@ -1030,7 +1000,7 @@ void FCEUI_MoviePlayFromBeginning(void)
|
|||
if (movieMode != MOVIEMODE_INACTIVE)
|
||||
{
|
||||
char *fname = strdup(curMovieFilename);
|
||||
FCEUI_LoadMovie(fname, true, 0);
|
||||
FCEUI_LoadMovie(fname, true, false, 0);
|
||||
FCEU_DispMessage("Movie is now Read-Only. Playing from beginning.");
|
||||
free(fname);
|
||||
}
|
||||
|
@ -1047,10 +1017,8 @@ bool FCEUI_MovieGetInfo(const std::string& fname, MOVIE_INFO* info, bool skipFra
|
|||
LoadFM2(md, fp, INT_MAX, skipFrameCount);
|
||||
delete fp;
|
||||
|
||||
|
||||
info->movie_version = md.version;
|
||||
info->poweron = md.poweronFlag;
|
||||
info->reset = md.resetFlag;
|
||||
info->poweron = md.savestate.size()==0;
|
||||
info->pal = md.palFlag;
|
||||
info->nosynchack = true;
|
||||
info->num_frames = md.records.size();
|
||||
|
@ -1064,6 +1032,18 @@ bool FCEUI_MovieGetInfo(const std::string& fname, MOVIE_INFO* info, bool skipFra
|
|||
}
|
||||
|
||||
|
||||
|
||||
//int FCEUI_IsMovieActive(void)
|
||||
//{
|
||||
// //this is a lame method. we should change all the fceu code that uses it to call the
|
||||
// //IsRecording or IsPlaying methods
|
||||
// //return > 0 for recording, < 0 for playback
|
||||
// if(FCEUMOV_IsRecording()) return 1;
|
||||
// else if(FCEUMOV_IsPlaying()) return -1;
|
||||
// else return 0;
|
||||
//}
|
||||
|
||||
|
||||
//struct MovieHeader
|
||||
//{
|
||||
//uint32 magic; // +0
|
||||
|
|
|
@ -115,8 +115,6 @@ public:
|
|||
int emuVersion;
|
||||
//todo - somehow force mutual exclusion for poweron and reset (with an error in the parser)
|
||||
bool palFlag;
|
||||
bool poweronFlag;
|
||||
bool resetFlag;
|
||||
MD5DATA romChecksum;
|
||||
std::string romFilename;
|
||||
std::vector<char> savestate;
|
||||
|
|
|
@ -340,15 +340,6 @@ bool FCEUSS_SaveMS(std::ostream* outstream, int compressionLevel)
|
|||
//do not save the movie state if we are in tasedit! that is a huge waste of time and space!
|
||||
if(!FCEUMOV_Mode(MOVIEMODE_TASEDIT))
|
||||
{
|
||||
//more stable? but we dont think the other one is unstable
|
||||
//memorystream mstemp;
|
||||
//int size = FCEUMOV_WriteState(&mstemp);
|
||||
//mstemp.sync();
|
||||
//os->put(7);
|
||||
//write32le(size, os);
|
||||
//os->write(mstemp.buf(),mstemp.size());
|
||||
//totalsize += 5+size;
|
||||
|
||||
os->seekp(5,std::ios::cur);
|
||||
int size = FCEUMOV_WriteState(os);
|
||||
os->seekp(-(size+5),std::ios::cur);
|
||||
|
|
Loading…
Reference in New Issue