From 0aee98b006ba2973072c88e09223a7425540ce45 Mon Sep 17 00:00:00 2001 From: shinydoofy Date: Wed, 15 Apr 2009 03:40:08 +0000 Subject: [PATCH] SDL: fixed input issue and making Lua optional again --- SConstruct | 26 ++++++++++++++------------ changelog.txt | 1 + src/SConscript | 4 +++- src/drivers/videolog/SConscript | 1 - src/input.cpp | 6 ++++++ 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/SConstruct b/SConstruct index 876f4335..a9b66884 100644 --- a/SConstruct +++ b/SConstruct @@ -8,6 +8,7 @@ opts.AddOptions( BoolOption('OPENGL', 'Enable OpenGL support', 1), BoolOption('LSB_FIRST', 'Least signficant byte first (non-PPC)', 1), BoolOption('DEBUG', 'Build with debugging symbols', 0), + BoolOption('LUA', 'Enable Lua support', 1), BoolOption('NEWPPU', 'Enable new PPU core', 0), BoolOption('CREATE_AVI', 'Enable avi creation support (SDL only)', 0), BoolOption('LOGO', 'Enable a logoscreen when creating avis (SDL only)', '1') @@ -56,12 +57,12 @@ else: if not conf.CheckLib('z', autoadd=1): print 'Did not find libz or z.lib, exiting!' Exit(1) - lua51 = conf.CheckLib('lua5.1', autoadd=1) - lua = conf.CheckLib('lua', autoadd=1) - if lua == 0 and lua51 == 0: - print 'Did not find liblua5.1, liblua, lua.lib or lua5.1.lib, exiting!' - Exit(1) - + if env['LUA']: + lua51 = conf.CheckLib('lua5.1', autoadd=1) + lua = conf.CheckLib('lua', autoadd=1) + if lua == 0 and lua51 == 0: + print 'Did not find liblua5.1, liblua, lua.lib or lua5.1.lib, compiling anyway!' + env['LUA'] = 0 ### Search for zenity if we're not in windows if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin': @@ -102,12 +103,13 @@ else: conf.env.Append(CPPDEFINES = ['PSS_STYLE=1']) # parse SDL cflags/libs env.ParseConfig('sdl-config --cflags --libs') - # parse liblua cflags - if lua51: - env.Append(CPPPATH = ['/usr/local/include/lua5.1', '/usr/include/lua5.1']) - if lua: - env.Append(CPPPATH = ['/usr/local/include/lua', '/usr/include/lua']) - env.Append(CPPDEFINES=["_S9XLUA_H"]) + if env['LUA']: + # parse liblua cflags + if lua51: + env.Append(CPPPATH = ['/usr/local/include/lua5.1', '/usr/include/lua5.1']) + if lua: + env.Append(CPPPATH = ['/usr/local/include/lua', '/usr/include/lua']) + env.Append(CPPDEFINES=["_S9XLUA_H"]) env = conf.Finish() if sys.byteorder == 'little' or env['PLATFORM'] == 'win32': diff --git a/changelog.txt b/changelog.txt index 332cddf4..5aa67eab 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,4 @@ +15-apr-2009 - shinydoofy - sdl - Lua is optional again, fixed the real issue 14-apr-2009 - punkrockguy - sdl - LUA is NO longer optional, so the SConscripts have been updated to reflect that change. This fixes the mysterious non-working input issue. 12-apr-2009 - shinydoofy - sdl - implemented saving/loading a savestate from a specific file on Alt+S/L 11-apr-2009 - shinydoofy - sdl - implemented starting an FM2 movie on Alt+R diff --git a/src/SConscript b/src/SConscript index b387626b..11de3a73 100644 --- a/src/SConscript +++ b/src/SConscript @@ -12,7 +12,6 @@ file.cpp filter.cpp ines.cpp input.cpp -lua-engine.cpp netplay.cpp nsf.cpp oldmovie.cpp @@ -41,6 +40,9 @@ mappers Import('env') Export('env') +if env['LUA']: + file_list.append('lua-engine.cpp') + if env['CREATE_AVI']: subdirs.append('drivers/videolog') diff --git a/src/drivers/videolog/SConscript b/src/drivers/videolog/SConscript index c753ad4d..b8554746 100644 --- a/src/drivers/videolog/SConscript +++ b/src/drivers/videolog/SConscript @@ -6,7 +6,6 @@ rgbtorgb.cpp Import('env') if env['LOGO']: - env.Append(LIBS = ["gd"]) env.Append(CCFLAGS = "-DHAVE_GD") for x in range(len(my_list)): diff --git a/src/input.cpp b/src/input.cpp index 1b10d39c..dccacecd 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -202,6 +202,9 @@ static void UpdateGP(int w, void *data, int arg) joy[2]= FCEU_LuaUsingJoypad(2) ? (FCEU_LuaReadJoypad(2) | (*(uint32 *)joyports[0].ptr >> 16)) : *(uint32 *)joyports[0].ptr >> 16; if (FCEU_LuaReadJoypadFalse(2)) joy[2] &= FCEU_LuaReadJoypadFalse(2); + #else // without this, there seems to be no input at all without Lua + joy[0] = *(uint32 *)joyports[0].ptr;; + joy[2] = *(uint32 *)joyports[0].ptr >> 16; #endif } else @@ -215,6 +218,9 @@ static void UpdateGP(int w, void *data, int arg) joy[3]= FCEU_LuaUsingJoypad(3) ? (FCEU_LuaReadJoypad(3) | (*(uint32 *)joyports[1].ptr >> 24)) : *(uint32 *)joyports[1].ptr >> 24; if (FCEU_LuaReadJoypadFalse(3)) joy[3] &= FCEU_LuaReadJoypadFalse(3); + #else // same goes for the other two pads + joy[1] = *(uint32 *)joyports[1].ptr >> 8; + joy[3] = *(uint32 *)joyports[1].ptr >> 24; #endif }