Dealt with bug 2746888. LUA now CDs to folder of LUA file on load. Added working Windows CD code, and test *NIX CD code. *NIX code still needs to be confirmed.
This commit is contained in:
parent
0613eb2163
commit
1f70280225
|
@ -94,6 +94,7 @@ void FCEU_UpdateInput(void);
|
|||
void InitializeInput(void);
|
||||
void FCEU_UpdateBot(void);
|
||||
extern void (*PStrobe[2])(void);
|
||||
void FCEUD_SetInput(bool fourscore, bool microphone, ESI port0, ESI port1, ESIFC fcexp);
|
||||
|
||||
//called from PPU on scanline events.
|
||||
extern void InputScanlineHook(uint8 *bg, uint8 *spr, uint32 linets, int final);
|
||||
|
|
|
@ -12,10 +12,16 @@
|
|||
|
||||
#ifdef __linux
|
||||
#include <unistd.h>
|
||||
#define SetCurrentDir chdir
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
#define SetCurrentDir _chdir
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "fceu.h"
|
||||
#include "video.h"
|
||||
|
@ -4590,6 +4596,14 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) {
|
|||
luaScriptName = strdup(filename);
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(__linux)
|
||||
std::string getfilepath = filename;
|
||||
|
||||
getfilepath = getfilepath.substr(0,getfilepath.find_last_of("/\\") + 1);
|
||||
|
||||
SetCurrentDir(getfilepath.c_str());
|
||||
#endif
|
||||
|
||||
//stop any lua we might already have had running
|
||||
FCEU_LuaStop();
|
||||
|
||||
|
|
Loading…
Reference in New Issue