~ubuntu-branches/ubuntu/utopic/fceux/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/use_system_lua.patch

  • Committer: Package Import Robot
  • Author(s): Joe Nahmias
  • Date: 2014-03-02 19:22:04 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140302192204-9f0aehi5stfnhn7d
Tags: 2.2.2+dfsg0-1
* Imported Upstream version 2.2.2
  + remove patches merged upstream; refresh remaining
  + remove windows compiled help files and non-free Visual C files
* Use C++11 standard static assertion functionality
* fix upstream installation of support files
* New patch 0004-ignore-missing-windows-help-CHM-file.patch
* update d/copyright for new, renamed, deleted files
* d/control: bump std-ver to 3.9.5, no changes needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Use system Lua 5.1 instead of bundled version
2
 
 FCEUX not only has a bundled version of Lua 5.1, it relies on being able
3
 
 to access internal data structures in the Lua library which were never meant
4
 
 to be accessed from outside, and do thus not provide a stable API, and FCEUX
5
 
 would then potentially need to be rebuilt from source when a new version of
6
 
 Lua 5.1 is released (if any).
7
 
 This patch removes the optimization in FCEUX that was relying on being able
8
 
 to access these data structures, and links it against the system-installed
9
 
 version of the lua library..
10
 
 
11
 
Author: Alexander Toresson <alexander.toresson@gmail.com>
12
 
Author: Joe Nahmias <jello@debian.org>
13
 
 
14
 
--- fceux.orig/SConstruct
15
 
+++ fceux/SConstruct
16
 
@@ -43,7 +43,7 @@
17
 
   env['LSB_FIRST'] = 0
18
 
 
19
 
 # Default compiler flags:
20
 
-env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare', '-Isrc/lua/src'])
21
 
+env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare'])
22
 
 
23
 
 if os.environ.has_key('PLATFORM'):
24
 
   env.Replace(PLATFORM = os.environ['PLATFORM'])
25
 
@@ -77,7 +77,7 @@
26
 
   env['LIBS'] = ['wsock32'];
27
 
 
28
 
 if env['PLATFORM'] == 'win32':
29
 
-  env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx", "drivers/win/lua/include"])
30
 
+  env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx"])
31
 
   env.Append(CPPDEFINES = ["PSS_STYLE=2", "WIN32", "_USE_SHARED_MEMORY_", "NETWORK", "FCEUDEF_DEBUGGER", "NOMINMAX", "NEED_MINGW_HACKS", "_WIN32_IE=0x0600"])
32
 
   env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32", "htmlhelp"])
33
 
 else:
34
 
@@ -126,6 +126,7 @@
35
 
       env.Append(CCFLAGS = ["-DLUA_USE_LINUX"])
36
 
     lua_available = False
37
 
     if conf.CheckLib('lua5.1'):
38
 
+      env.Append(CCFLAGS = ["-I/usr/include/lua5.1"])
39
 
       env.Append(LINKFLAGS = ["-ldl", "-llua5.1"])
40
 
       lua_available = True
41
 
     elif conf.CheckLib('lua'):
42
 
--- fceux.orig/src/lua-engine.cpp
43
 
+++ fceux/src/lua-engine.cpp
44
 
@@ -53,7 +53,6 @@
45
 
 #include <lua.h>
46
 
 #include <lauxlib.h>
47
 
 #include <lualib.h>
48
 
-#include <lstate.h>
49
 
 #ifdef WIN32
50
 
        int iuplua_open(lua_State * L);
51
 
        int iupcontrolslua_open(lua_State * L);
52
 
@@ -1157,17 +1156,10 @@
53
 
 
54
 
                if (lua_isfunction(L, -1))
55
 
                {
56
 
-                       // since the scriptdata can be very expensive to load
57
 
-                       // (e.g. the registered save function returned some huge tables)
58
 
-                       // check the number of parameters the registered load function expects
59
 
-                       // and don't bother loading the parameters it wouldn't receive anyway
60
 
-                       int numParamsExpected = (L->top - 1)->value.gc->cl.l.p->numparams; // NOTE: if this line crashes, that means your Lua headers are out of sync with your Lua lib
61
 
-                       if(numParamsExpected) numParamsExpected--; // minus one for the savestate number we always pass in
62
 
-
63
 
                        int prevGarbage = lua_gc(L, LUA_GCCOUNT, 0);
64
 
 
65
 
                        lua_pushinteger(L, savestateNumber);
66
 
-                       saveData.LoadRecord(L, LUA_DATARECORDKEY, numParamsExpected);
67
 
+                       saveData.LoadRecord(L, LUA_DATARECORDKEY, (unsigned int) -1);
68
 
                        int n = lua_gettop(L) - 1;
69
 
 
70
 
                        int ret = lua_pcall(L, n, 0, 0);