Fixed Lua drag-n-drop loading
This commit is contained in:
parent
4369eb775e
commit
7574f1a5ca
|
@ -1378,8 +1378,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
UINT len;
|
UINT len;
|
||||||
|
|
||||||
len=DragQueryFileW((HDROP)wParam,0,0,0)+1;
|
len=DragQueryFileW((HDROP)wParam,0,0,0)+1;
|
||||||
wchar_t* wftmp;
|
wchar_t* wftmp = new wchar_t[len];
|
||||||
wftmp=new wchar_t[len];
|
|
||||||
{
|
{
|
||||||
DragQueryFileW((HDROP)wParam,0,wftmp,len);
|
DragQueryFileW((HDROP)wParam,0,wftmp,len);
|
||||||
std::string fileDropped = wcstombs(wftmp);
|
std::string fileDropped = wcstombs(wftmp);
|
||||||
|
@ -1482,13 +1481,22 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
//Check if Lua file
|
//Check if Lua file
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
#ifdef _S9XLUA_H
|
#ifdef _S9XLUA_H
|
||||||
else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4))
|
else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4))
|
||||||
{
|
{
|
||||||
|
// HACK because luaL_loadfile doesn't work with multibyte paths
|
||||||
|
char *ftmp;
|
||||||
|
len = DragQueryFile((HDROP)wParam, 0, 0, 0) + 1;
|
||||||
|
if ((ftmp=(char*)malloc(len)))
|
||||||
|
{
|
||||||
|
DragQueryFile((HDROP)wParam, 0, ftmp, len);
|
||||||
|
fileDropped = ftmp;
|
||||||
|
free(ftmp);
|
||||||
|
}
|
||||||
FCEU_LoadLuaCode(fileDropped.c_str());
|
FCEU_LoadLuaCode(fileDropped.c_str());
|
||||||
UpdateLuaConsole(fileDropped.c_str());
|
UpdateLuaConsole(fileDropped.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
//Check if Ram Watch file
|
//Check if Ram Watch file
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue