diff --git a/src/driver.h b/src/driver.h index d7f0463d..8c4834cd 100644 --- a/src/driver.h +++ b/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 diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index 9b9148d8..523530cc 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -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: diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 4e70c67a..b495672e 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -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; } diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 6b986f7f..bf7b06bf 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -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= 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 { diff --git a/src/drivers/win/memview.h b/src/drivers/win/memview.h index 209c4002..d14ad92e 100644 --- a/src/drivers/win/memview.h +++ b/src/drivers/win/memview.h @@ -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(); diff --git a/src/drivers/win/memviewsp.cpp b/src/drivers/win/memviewsp.cpp index 029031e0..1cda5cae 100644 --- a/src/drivers/win/memviewsp.cpp +++ b/src/drivers/win/memviewsp.cpp @@ -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;iright -= 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); } diff --git a/src/fceu.cpp b/src/fceu.cpp index 2cac622b..9ca1ce6c 100644 --- a/src/fceu.cpp +++ b/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; } diff --git a/src/input.cpp b/src/input.cpp index 6e9b8e37..4053bf58 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -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); } diff --git a/src/movie.cpp b/src/movie.cpp index b74441ad..01860b72 100644 --- a/src/movie.cpp +++ b/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* 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 diff --git a/src/movie.h b/src/movie.h index 83557b48..76facdfb 100644 --- a/src/movie.h +++ b/src/movie.h @@ -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 savestate; diff --git a/src/state.cpp b/src/state.cpp index 94b9573d..ec524dc6 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -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);