* disabled changing PPU/PAL/input_type when Taseditor is engaged

* Tasedit: File->Recent projects
* enhanced Reload hotkey (Ctrl-F1), now it loads last ROM or last TAS Editor project
This commit is contained in:
ansstuff 2011-12-07 19:07:09 +00:00
parent 51c7544b13
commit 5d3994c969
11 changed files with 663 additions and 487 deletions

View File

@ -89,6 +89,7 @@ extern int TasEdit_undo_levels;
extern int TASEdit_autosave_period;
extern bool TASEdit_jump_to_undo;
extern int TASEdit_last_export_type;
extern char* recent_projects[];
//window positions and sizes:
extern int ChtPosX,ChtPosY;
@ -164,6 +165,17 @@ static CFGSTRUCT fceuconfig[] = {
ACS(ramWatchRecent[3]),
ACS(ramWatchRecent[4]),
ACS(recent_projects[0]),
ACS(recent_projects[1]),
ACS(recent_projects[2]),
ACS(recent_projects[3]),
ACS(recent_projects[4]),
ACS(recent_projects[5]),
ACS(recent_projects[6]),
ACS(recent_projects[7]),
ACS(recent_projects[8]),
ACS(recent_projects[9]),
AC(gNoBGFillColor),
AC(ntsccol),AC(ntsctint),AC(ntschue),

View File

@ -1274,6 +1274,16 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
UpdateFourscoreState(hwndDlg);
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
// disable changing fourscore and ports
EnableWindow(GetDlgItem(hwndDlg, CHECK_ENABLE_FOURSCORE), false);
EnableWindow(GetDlgItem(hwndDlg, CHECK_ENABLE_MICROPHONE), false);
EnableWindow(GetDlgItem(hwndDlg, COMBO_PAD1), false);
EnableWindow(GetDlgItem(hwndDlg, COMBO_PAD2), false);
EnableWindow(GetDlgItem(hwndDlg, COMBO_FAM), false);
}
break;
case WM_CLOSE:

View File

@ -70,7 +70,7 @@ static struct
{ EMUCMD_SCRIPT_RELOAD, SCAN_L | CMD_KEY_SHIFT, },
{ EMUCMD_OPENROM, SCAN_O | CMD_KEY_CTRL, },
{ EMUCMD_CLOSEROM, SCAN_W | CMD_KEY_CTRL, },
{ EMUCMD_RELOADROM, SCAN_R | CMD_KEY_CTRL | CMD_KEY_SHIFT , },
{ EMUCMD_RELOAD, SCAN_F1 | CMD_KEY_CTRL , },
{ EMUCMD_MISC_UNDOREDOSAVESTATE, SCAN_Z | CMD_KEY_CTRL, },
{ EMUCMD_MISC_TOGGLEFULLSCREEN, SCAN_ENTER | CMD_KEY_ALT, },
{ EMUCMD_TASEDIT_REWIND, SCAN_GRAVE, },

View File

@ -140,7 +140,7 @@ int TableFileLoaded;
int MemView_wndx, MemView_wndy;
int MemFind_wndx, MemFind_wndy;
int MemViewSizeX=625,MemViewSizeY=242;
int MemViewSizeX = 580, MemViewSizeY = 248;
static RECT newMemViewRect;
static char chartable[256];
@ -1716,7 +1716,7 @@ void DoMemView() {
hMemView = CreateWindowEx(0,"MEMVIEW","Memory Editor",
//WS_OVERLAPPEDWINDOW|WS_CLIPSIBLINGS, /* Style */
WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_THICKFRAME|WS_VSCROLL,
CW_USEDEFAULT,CW_USEDEFAULT,625,242, /* X,Y ; Width, Height */
CW_USEDEFAULT,CW_USEDEFAULT,580,248, /* X,Y ; Width, Height */
NULL,NULL,fceu_hInstance,NULL );
ShowWindow (hMemView, SW_SHOW) ;
UpdateCaption();

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,8 @@ void RedrawTasedit();
void RedrawWindowCaption();
void ToggleJoypadBit(int column_index, int row_index, UINT KeyFlags);
void OpenProject();
bool LoadProject(char* fullname);
void LoadRecentProject(int slot);
bool SaveProject();
bool SaveProjectAs();
bool AskSaveProject();
@ -49,3 +51,6 @@ bool PasteInsert();
void GotFocus();
void LostFocus();
void UpdateRecentProjectsMenu();
void UpdateRecentProjectsArray(const char* addString);
void RemoveRecentProject(unsigned int which);

View File

@ -1,5 +1,6 @@
//Implementation file of TASEdit Project class
#include "taseditproj.h"
#include "utils/xstring.h"
extern MARKERS markers;
extern BOOKMARKS bookmarks;
@ -12,6 +13,7 @@ extern TASEDIT_LIST tasedit_list;
extern TASEDIT_SELECTION selection;
extern void FCEU_printf(char *format, ...);
extern void FCEU_PrintError(char *format, ...);
extern bool SaveProject();
extern void RedrawWindowCaption();
@ -24,9 +26,9 @@ TASEDIT_PROJECT::TASEDIT_PROJECT()
void TASEDIT_PROJECT::init()
{
// init new project
projectName="";
fm2FileName="";
projectFile="";
projectFile = "";
projectName = "";
fm2FileName = "";
reset();
}
@ -47,7 +49,7 @@ void TASEDIT_PROJECT::update()
}
bool TASEDIT_PROJECT::saveProject()
bool TASEDIT_PROJECT::save()
{
std::string PFN = GetProjectFile();
if (PFN.empty()) return false;
@ -68,17 +70,20 @@ bool TASEDIT_PROJECT::saveProject()
this->reset();
return true;
}
extern bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader);
bool TASEDIT_PROJECT::LoadProject(std::string PFN)
bool TASEDIT_PROJECT::load(char* fullname)
{
const char* filename = PFN.c_str();
EMUFILE_FILE ifs(fullname, "rb");
EMUFILE_FILE ifs(filename, "rb");
if(ifs.fail())
{
FCEU_PrintError("Error opening %s!", fullname);
return false;
}
FCEU_printf("\nLoading TASEdit project %s\n", filename);
FCEU_printf("\nLoading TAS Editor project %s...\n", fullname);
bool error;
extern bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader);
if (LoadFM2(currMovieData, &ifs, ifs.size(), false))
{
LoadSubtitles(currMovieData);
@ -144,33 +149,34 @@ bool TASEDIT_PROJECT::LoadProject(std::string PFN)
playback.reset();
recorder.reset();
screenshot_display.reset();
reset();
RenameProject(fullname);
return true;
}
void TASEDIT_PROJECT::RenameProject(char* new_fullname)
{
projectFile = new_fullname;
char drv[512], dir[512], name[512], ext[512]; // For getting the filename
splitpath(new_fullname, drv, dir, name, ext);
projectName = name;
std::string thisfm2name = name;
thisfm2name.append(".fm2");
fm2FileName = thisfm2name;
}
// -----------------------------------------------------------------
std::string TASEDIT_PROJECT::GetProjectName()
{
return projectName;
}
void TASEDIT_PROJECT::SetProjectName(std::string e)
{
projectName = e;
}
std::string TASEDIT_PROJECT::GetFM2Name()
{
return fm2FileName;
}
void TASEDIT_PROJECT::SetFM2Name(std::string e)
{
fm2FileName = e;
}
std::string TASEDIT_PROJECT::GetProjectFile()
{
return projectFile;
}
void TASEDIT_PROJECT::SetProjectFile(std::string e)
std::string TASEDIT_PROJECT::GetProjectName()
{
projectFile = e;
return projectName;
}
std::string TASEDIT_PROJECT::GetFM2Name()
{
return fm2FileName;
}
void TASEDIT_PROJECT::SetProjectChanged()

View File

@ -26,17 +26,14 @@ public:
void reset();
void update();
bool saveProject();
bool LoadProject(std::string PFN);
bool save();
bool load(char* fullname);
bool Export2FM2(std::string filename); //creates a fm2 out of header, comments, subtitles, and main branch input log, return false if any errors occur
void RenameProject(char* new_fullname);
std::string GetProjectName();
void SetProjectName(std::string e);
std::string GetFM2Name();
void SetFM2Name(std::string e);
std::string GetProjectFile();
void SetProjectFile(std::string e);
std::string GetProjectName();
std::string GetFM2Name();
void SetProjectChanged();
bool GetProjectChanged();
@ -49,11 +46,8 @@ private:
bool changed;
int next_save_shedule;
std::string projectName; //The TASEdit Project's name
std::string fm2FileName; //The main branch ilog file (todo rename more appropriately)
std::string projectFile; //The TASEdit Project's filename (For saving purposes) //adelikat: TODO: why the hell is this different from project name??!
std::vector<std::string> inputlogs; //List of associated .ilog files
std::vector<std::string> comments;
std::vector<std::string> subtitles;
std::string projectFile; // full path
std::string projectName; // file name only
std::string fm2FileName; // same as projectName but with .fm2 extension instead of .tas
};

View File

@ -90,9 +90,9 @@ using namespace std;
//Handles----------------------------------------------
static HMENU fceumenu = 0; //Main menu.
HWND pwindow; //Client Area
static HMENU recentmenu; //Recent Menu
static HMENU recentluamenu; //Recent Lua Files Menu
static HMENU recentmoviemenu; //Recent Movie Files Menu
HMENU recentmenu; //Recent Menu
HMENU recentluamenu; //Recent Lua Files Menu
HMENU recentmoviemenu; //Recent Movie Files Menu
HMENU hfceuxcontext; //Handle to context menu
HMENU hfceuxcontextsub; //Handle to context sub menu
HWND MainhWnd; //Main FCEUX(Parent) window Handle. Dialogs should use GetMainHWND() to get this
@ -146,7 +146,7 @@ void OpenRamWatch();
void SaveSnapshotAs();
//Recent Menu Strings ------------------------------------
char *recent_files[] = { 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
char *recent_files[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const unsigned int MENU_FIRST_RECENT_FILE = 600;
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
@ -157,12 +157,12 @@ extern INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, L
extern void UpdateLuaConsole(const char* fname);
//Recent Lua Menu ----------------------------------------
char *recent_lua[] = {0,0,0,0,0};
char *recent_lua[] = { 0, 0, 0, 0, 0 };
const unsigned int LUA_FIRST_RECENT_FILE = 50000;
const unsigned int MAX_NUMBER_OF_LUA_RECENT_FILES = sizeof(recent_lua)/sizeof(*recent_lua);
//Recent Movie Menu -------------------------------------
char *recent_movie[] = {0,0,0,0,0};
char *recent_movie[] = { 0, 0, 0, 0, 0 };
const unsigned int MOVIE_FIRST_RECENT_FILE = 51000;
const unsigned int MAX_NUMBER_OF_MOVIE_RECENT_FILES = sizeof(recent_movie)/sizeof(*recent_movie);
@ -197,7 +197,6 @@ void SetMainWindowText()
SetWindowText(hAppWnd, FCEU_NAME_AND_VERSION);
}
bool HasRecentFiles()
{
for (int x = 0; x < MAX_NUMBER_OF_RECENT_FILES; x++)
@ -205,7 +204,6 @@ bool HasRecentFiles()
if (recent_files[x])
return true;
}
return false;
}
@ -606,7 +604,6 @@ void RemoveRecentItem(unsigned int which, char**bufferArray, const unsigned int
bufferArray[MAX-1] = 0; //Clear out the last item since it is empty now no matter what
}
/// Updates recent files / recent directories menu
/// @param menu Menu handle of the main window's menu
/// @param strs Strings to add to the menu
@ -747,6 +744,23 @@ void AddRecentFile(const char *filename)
UpdateRecentArray(filename, recent_files, MAX_NUMBER_OF_RECENT_FILES, recentmenu, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
}
void LoadRecentRom(int slot)
{
char*& fname = recent_files[slot];
if(fname)
{
if (!ALoad(fname))
{
int result = MessageBox(hAppWnd, "Remove from list?", "Could Not Open Recent File", MB_YESNO);
if (result == IDYES)
{
RemoveRecentItem(slot, recent_files, MAX_NUMBER_OF_RECENT_FILES);
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
}
}
}
}
void UpdateLuaRMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int baseid)
{
MENUITEMINFO moo;
@ -1523,26 +1537,14 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
wParam &= 0xFFFF;
// A menu item from the recent files menu was clicked.
if(wParam >= MENU_FIRST_RECENT_FILE && wParam <= MENU_FIRST_RECENT_FILE + MAX_NUMBER_OF_RECENT_FILES - 1)
if(wParam >= MENU_FIRST_RECENT_FILE && wParam < MENU_FIRST_RECENT_FILE + MAX_NUMBER_OF_RECENT_FILES)
{
char*& fname = recent_files[wParam - MENU_FIRST_RECENT_FILE];
if(fname)
{
if (!ALoad(fname))
{
int result = MessageBox(hWnd,"Remove from list?", "Could Not Open Recent File", MB_YESNO);
if (result == IDYES)
{
RemoveRecentItem((wParam - MENU_FIRST_RECENT_FILE), recent_files, MAX_NUMBER_OF_RECENT_FILES);
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
}
}
}
LoadRecentRom(wParam - MENU_FIRST_RECENT_FILE);
}
// A menu item for the recent lua files menu was clicked.
#ifdef _S9XLUA_H
if(wParam >= LUA_FIRST_RECENT_FILE && wParam <= LUA_FIRST_RECENT_FILE + MAX_NUMBER_OF_LUA_RECENT_FILES - 1)
if(wParam >= LUA_FIRST_RECENT_FILE && wParam < LUA_FIRST_RECENT_FILE + MAX_NUMBER_OF_LUA_RECENT_FILES)
{
char*& fname = recent_lua[wParam - LUA_FIRST_RECENT_FILE];
if(fname)
@ -1563,7 +1565,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
#endif
// A menu item for the recent movie files menu was clicked.
if(wParam >= MOVIE_FIRST_RECENT_FILE && wParam <= MOVIE_FIRST_RECENT_FILE + MAX_NUMBER_OF_MOVIE_RECENT_FILES - 1)
if(wParam >= MOVIE_FIRST_RECENT_FILE && wParam < MOVIE_FIRST_RECENT_FILE + MAX_NUMBER_OF_MOVIE_RECENT_FILES)
{
char*& fname = recent_movie[wParam - MOVIE_FIRST_RECENT_FILE];
if(fname)
@ -2271,7 +2273,12 @@ adelikat: Outsourced this to a remappable hotkey
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));
EnableMenuItem(fceumenu,ID_FILE_CLOSELUAWINDOWS,MF_BYCOMMAND | (LuaConsoleHWnd?MF_ENABLED:MF_GRAYED));
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
EnableMenuItem(fceumenu, MENU_PAL, false);
EnableMenuItem(fceumenu, ID_NEWPPU, false);
EnableMenuItem(fceumenu, ID_OLDPPU, false);
}
CheckMenuItem(fceumenu, ID_NEWPPU, newppu ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_OLDPPU, !newppu ? MF_CHECKED : MF_UNCHECKED);

View File

@ -764,11 +764,11 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_FRAMEADV_SKIPLAG, EMUCMDTYPE_MISC, FA_SkipLag, 0, 0, "Frame Adv.-Skip Lag", 0},
{ EMUCMD_OPENROM, EMUCMDTYPE_TOOL, OpenRom, 0, 0, "Open ROM", 0},
{ EMUCMD_CLOSEROM, EMUCMDTYPE_TOOL, CloseRom, 0, 0, "Close ROM", 0},
{ EMUCMD_RELOADROM, EMUCMDTYPE_TOOL, ReloadRom, 0, 0, "Reload ROM", 0},
{ EMUCMD_RELOAD, EMUCMDTYPE_TOOL, ReloadRom, 0, 0, "Reload ROM or TAS Editor Project", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_DISPLAY_MOVIESUBTITLES, EMUCMDTYPE_MISC, MovieSubtitleToggle,0,0,"Toggle Movie Subtitles", 0},
{ EMUCMD_MISC_UNDOREDOSAVESTATE, EMUCMDTYPE_MISC, UndoRedoSavestate, 0,0,"Undo/Redo Savestate", 0},
{ EMUCMD_MISC_TOGGLEFULLSCREEN, EMUCMDTYPE_MISC, ToggleFullscreen, 0, 0, "Toggle Fullscreen", 0},
{ EMUCMD_TOOL_OPENRAMWATCH, EMUCMDTYPE_TOOL, LaunchRamWatch, 0, 0, "Open Ram Watch", EMUCMDFLAG_TASEDIT},
{ EMUCMD_TOOL_OPENRAMWATCH, EMUCMDTYPE_TOOL, LaunchRamWatch, 0, 0, "Open Ram Watch", EMUCMDFLAG_TASEDIT },
{ EMUCMD_TOOL_OPENRAMSEARCH, EMUCMDTYPE_TOOL, LaunchRamSearch, 0, 0, "Open Ram Search", 0},
{ EMUCMD_TOOL_RAMSEARCHLT, EMUCMDTYPE_TOOL, RamSearchOpLT, 0, 0, "Ram Search - Less Than", 0},
{ EMUCMD_TOOL_RAMSEARCHGT, EMUCMDTYPE_TOOL, RamSearchOpGT, 0, 0, "Ram Search - Greater Than", 0},
@ -776,7 +776,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_TOOL_RAMSEARCHGTE, EMUCMDTYPE_TOOL, RamSearchOpGTE, 0, 0, "Ram Search - Greater Than or Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHEQ, EMUCMDTYPE_TOOL, RamSearchOpEQ, 0, 0, "Ram Search - Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHNE, EMUCMDTYPE_TOOL, RamSearchOpNE, 0, 0, "Ram Search - Not Equal", 0},
{ EMUCMD_TASEDIT_REWIND, EMUCMDTYPE_MISC, TaseditRewindOn, TaseditRewindOff, 0, "Rewind Frame (TASEditor-only)", EMUCMDFLAG_TASEDIT},
{ EMUCMD_TASEDIT_REWIND, EMUCMDTYPE_MISC, TaseditRewindOn, TaseditRewindOff, 0, "Rewind Frame (TAS Editor only)", EMUCMDFLAG_TASEDIT },
{ EMUCMD_RERECORD_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_MovieToggleRerecordDisplay, 0, 0, "Toggle Rerecord Display", EMUCMDFLAG_TASEDIT },
};
@ -1112,11 +1112,17 @@ static void CloseRom(void)
static void ReloadRom(void)
{
#ifdef WIN32
char*& fname = recent_files[0];
if(fname)
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
{
ALoad(fname);
}
// load most recent project
extern void LoadRecentProject(int slot);
LoadRecentProject(0);
} else
{
// load most recent ROM
extern void LoadRecentRom(int slot);
LoadRecentRom(0);
}
#endif
}

View File

@ -217,7 +217,7 @@ enum EMUCMD
//Currently only windows (but sdl could easily add onto these)
EMUCMD_OPENROM,
EMUCMD_CLOSEROM,
EMUCMD_RELOADROM,
EMUCMD_RELOAD,
//-----------------------------
EMUCMD_MISC_DISPLAY_MOVIESUBTITLES,
EMUCMD_MISC_UNDOREDOSAVESTATE,