win32-support funny languages for opening roms, through drag&drop, at least.
This commit is contained in:
parent
385dd471d1
commit
601b1ad867
|
@ -365,7 +365,7 @@ void OpenProject()
|
|||
LoadProject(nameo);
|
||||
}
|
||||
}
|
||||
bool LoadProject(char* fullname)
|
||||
bool LoadProject(const char* fullname)
|
||||
{
|
||||
// try to load project
|
||||
if (project.load(fullname))
|
||||
|
|
|
@ -14,7 +14,7 @@ void UpdateTasEditor();
|
|||
|
||||
void NewProject();
|
||||
void OpenProject();
|
||||
bool LoadProject(char* fullname);
|
||||
bool LoadProject(const char* fullname);
|
||||
bool SaveProject();
|
||||
bool SaveProjectAs();
|
||||
void SaveCompact();
|
||||
|
|
|
@ -158,7 +158,7 @@ bool TASEDITOR_PROJECT::save(const char* different_name, bool save_binary, bool
|
|||
return false;
|
||||
}
|
||||
}
|
||||
bool TASEDITOR_PROJECT::load(char* fullname)
|
||||
bool TASEDITOR_PROJECT::load(const char* fullname)
|
||||
{
|
||||
bool load_all = true;
|
||||
EMUFILE_FILE ifs(fullname, "rb");
|
||||
|
@ -275,7 +275,7 @@ bool TASEDITOR_PROJECT::load(char* fullname)
|
|||
return true;
|
||||
}
|
||||
|
||||
void TASEDITOR_PROJECT::RenameProject(char* new_fullname, bool filename_is_correct)
|
||||
void TASEDITOR_PROJECT::RenameProject(const char* new_fullname, bool filename_is_correct)
|
||||
{
|
||||
projectFile = new_fullname;
|
||||
char drv[512], dir[512], name[512], ext[512]; // For getting the filename
|
||||
|
|
|
@ -40,9 +40,9 @@ public:
|
|||
void update();
|
||||
|
||||
bool save(const char* different_name = 0, bool save_binary = true, bool save_markers = true, bool save_bookmarks = true, bool save_greenzone = true, bool save_history = true, bool save_piano_roll = true, bool save_selection = true);
|
||||
bool load(char* fullname);
|
||||
bool load(const char* fullname);
|
||||
|
||||
void RenameProject(char* new_fullname, bool filename_is_correct);
|
||||
void RenameProject(const char* new_fullname, bool filename_is_correct);
|
||||
|
||||
std::string GetProjectFile();
|
||||
std::string GetProjectName();
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//http://www.nubaria.com/en/blog/?p=289
|
||||
|
||||
// File description: Everything relevant for the main window should go here. This
|
||||
// does not include functions relevant for dialog windows.
|
||||
|
||||
|
@ -1009,7 +1011,7 @@ void CloseGame()
|
|||
}
|
||||
}
|
||||
|
||||
bool ALoad(char *nameo, char* innerFilename)
|
||||
bool ALoad(const char *nameo, char* innerFilename)
|
||||
{
|
||||
int oldPaused = EmulationPaused;
|
||||
|
||||
|
@ -1374,13 +1376,14 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
case WM_DROPFILES:
|
||||
{
|
||||
UINT len;
|
||||
char *ftmp;
|
||||
|
||||
len=DragQueryFile((HDROP)wParam,0,0,0)+1;
|
||||
if((ftmp=(char*)malloc(len)))
|
||||
len=DragQueryFileW((HDROP)wParam,0,0,0)+1;
|
||||
wchar_t* wftmp;
|
||||
wftmp=new wchar_t[len];
|
||||
{
|
||||
DragQueryFile((HDROP)wParam,0,ftmp,len);
|
||||
string fileDropped = ftmp;
|
||||
DragQueryFileW((HDROP)wParam,0,wftmp,len);
|
||||
std::string fileDropped = wcstombs(wftmp);
|
||||
delete[] wftmp;
|
||||
//adelikat: Drag and Drop only checks file extension, the internal functions are responsible for file error checking
|
||||
|
||||
//-------------------------------------------------------
|
||||
|
@ -1441,8 +1444,8 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
if (GameInfo && !(fileDropped.find(".fm2") == string::npos))
|
||||
{
|
||||
//.fm2 is at the end of the filename so that must be the extension
|
||||
FCEUI_LoadMovie(ftmp, 1, false); //We are convinced it is a movie file, attempt to load it
|
||||
FCEUX_LoadMovieExtras(ftmp);
|
||||
FCEUI_LoadMovie(fileDropped.c_str(), 1, false); //We are convinced it is a movie file, attempt to load it
|
||||
FCEUX_LoadMovieExtras(fileDropped.c_str());
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------
|
||||
|
@ -1456,11 +1459,11 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
{
|
||||
//.fm3 is at the end of the filename so that must be the extension
|
||||
extern bool EnterTasEditor();
|
||||
extern bool LoadProject(char* fullname);
|
||||
extern bool LoadProject(const char* fullname);
|
||||
extern bool AskSaveProject();
|
||||
if (EnterTasEditor()) //We are convinced it is a TAS Editor project file, attempt to load in TAS Editor
|
||||
if (AskSaveProject()) // in case there's unsaved project
|
||||
LoadProject(ftmp);
|
||||
LoadProject(fileDropped.c_str());
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------
|
||||
|
@ -1482,7 +1485,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
#ifdef _S9XLUA_H
|
||||
else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4))
|
||||
{
|
||||
FCEU_LoadLuaCode(ftmp);
|
||||
FCEU_LoadLuaCode(fileDropped.c_str());
|
||||
UpdateLuaConsole(fileDropped.c_str());
|
||||
}
|
||||
#endif
|
||||
|
@ -1500,10 +1503,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
//-------------------------------------------------------
|
||||
else
|
||||
{
|
||||
ALoad(ftmp);
|
||||
free(ftmp);
|
||||
ALoad(fileDropped.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void ByebyeWindow();
|
|||
void DoTimingConfigFix();
|
||||
int CreateMainWindow();
|
||||
void UpdateCheckedMenuItems();
|
||||
bool ALoad(char* nameo, char* innerFilename=0);
|
||||
bool ALoad(const char* nameo, char* innerFilename=0);
|
||||
void LoadNewGamey(HWND hParent, const char *initialdir);
|
||||
int BrowseForFolder(HWND hParent, const char *htext, char *buf);
|
||||
void SetMainWindowStuff();
|
||||
|
|
|
@ -20,9 +20,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "emufile.h"
|
||||
|
||||
#include <vector>
|
||||
#include "emufile.h"
|
||||
#include "utils/xstring.h"
|
||||
|
||||
bool EMUFILE::readAllBytes(std::vector<u8>* dstbuf, const std::string& fname)
|
||||
{
|
||||
|
@ -59,6 +59,24 @@ size_t EMUFILE_MEMORY::_fread(const void *ptr, size_t bytes){
|
|||
return todo;
|
||||
}
|
||||
|
||||
void EMUFILE_FILE::open(const char* fname, const char* mode)
|
||||
{
|
||||
fp = fopen(fname,mode);
|
||||
if(!fp)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
std::wstring wfname = mbstowcs((std::string)fname);
|
||||
std::wstring wfmode = mbstowcs((std::string)mode);
|
||||
fp = _wfopen(wfname.c_str(),wfmode.c_str());
|
||||
#endif
|
||||
if(!fp)
|
||||
failbit = true;
|
||||
}
|
||||
this->fname = fname;
|
||||
strcpy(this->mode,mode);
|
||||
}
|
||||
|
||||
|
||||
void EMUFILE_FILE::truncate(s32 length)
|
||||
{
|
||||
::fflush(fp);
|
||||
|
|
|
@ -268,14 +268,7 @@ protected:
|
|||
char mode[16];
|
||||
|
||||
private:
|
||||
void open(const char* fname, const char* mode)
|
||||
{
|
||||
fp = fopen(fname,mode);
|
||||
if(!fp)
|
||||
failbit = true;
|
||||
this->fname = fname;
|
||||
strcpy(this->mode,mode);
|
||||
}
|
||||
void open(const char* fname, const char* mode);
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in New Issue