Added diff against ScummVM SVN

This commit is contained in:
pelya
2010-10-26 10:56:27 +03:00
parent 03c577136f
commit fa8f6d4aaa
2 changed files with 611 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
To compile ScummVM add the ScummVM SVN to directory "scummvm" (or make a symlink to it),
apply the patch 'scummvm-trunk-53822.diff' to the SVN,
then from dir 'project/jni/application' execute commands
rm src

View File

@@ -0,0 +1,610 @@
Index: sound/rate_arm.cpp
===================================================================
--- sound/rate_arm.cpp (revision 53822)
+++ sound/rate_arm.cpp (working copy)
@@ -44,6 +44,8 @@
* other improvments over the original code were made.
*/
+#ifndef ANDROID
+
#include "sound/audiostream.h"
#include "sound/rate.h"
#include "sound/mixer.h"
@@ -467,3 +469,5 @@
}
} // End of namespace Audio
+
+#endif /* ANDROID */
Index: engines/sword25/util/lua/llex.cpp
===================================================================
--- engines/sword25/util/lua/llex.cpp (revision 53822)
+++ engines/sword25/util/lua/llex.cpp (working copy)
@@ -176,9 +176,13 @@
static void trydecpoint (LexState *ls, SemInfo *seminfo) {
/* format error: try to update decimal point separator */
+ char old = ls->decpoint;
+#ifdef ANDROID
+ ls->decpoint = '.';
+#else
struct lconv *cv = localeconv();
- char old = ls->decpoint;
ls->decpoint = (cv ? cv->decimal_point[0] : '.');
+#endif
buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */
if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
/* format error with correct decimal point: no more options */
Index: engines/sword25/util/pluto/pptest.lua
===================================================================
--- engines/sword25/util/pluto/pptest.lua (revision 53822)
+++ engines/sword25/util/pluto/pptest.lua (working copy)
@@ -1,168 +0,0 @@
--- $Id$
-
-require "pluto"
-
-permtable = { 1234 }
-
-perms = { [coroutine.yield] = 1, [permtable] = 2 }
-
-twithmt = {}
-setmetatable( twithmt, { __call = function() return 21 end } )
-
-function testfenv()
- return abc
-end
-
-setfenv(testfenv, { abc = 456 })
-
-function fa(i)
- local ia = i + 1
- return fb(ia)
-end
-
-function fb(i)
- local ib = i + 1
- ib = ib + fc(ib)
- return ib
-end
-
-function fc(i)
- local ic = i + 1
- coroutine.yield()
- return ic*2
-end
-
-function func()
- return 4
-end
-
-thr = coroutine.create(fa)
-coroutine.resume(thr, 2)
-
-testtbl = { a = 2, [2] = 4 }
-
-function funcreturningclosure(n)
- return function()
- return n
- end
-end
-
-function nestedfunc(n)
- return (function(m) return m+2 end)(n+3)
-end
-
-testloopa = {}
-testloopb = { testloopa = testloopa }
-testloopa.testloopb = testloopb
-
-sharedref = {}
-refa = {sharedref = sharedref}
-refb = {sharedref = sharedref}
-
-sptable = { a = 3 }
-
-setmetatable(sptable, {
- __persist = function(tbl)
- local a = tbl.a
- return function()
- return { a = a+3 }
- end
- end
-})
-
-literaludata = boxinteger(71)
-
-function booleanpersist(udata)
- local b = unboxboolean(udata)
- return function()
- return boxboolean(b)
- end
-end
-
-function makecounter()
- local a = 0
- return {
- inc = function() a = a + 1 end,
- cur = function() return a end
- }
-end
-
-function uvinthreadfunc()
- local a = 1
- local b = function()
- a = a+1
- coroutine.yield()
- a = a+1
- end
- a = a+1
- b()
- a = a+1
- return a
-end
-
-uvinthread = coroutine.create(uvinthreadfunc)
-coroutine.resume(uvinthread)
-
-niinmt = { a = 3 }
-setmetatable(niinmt, {__newindex = function(key, val) end })
-
-
-
-
-local function GenerateObjects()
- local Table = {}
-
- function Table:Func()
- return { Table, self }
- end
-
- function uvcycle()
- return Table:Func()
- end
-end
-
-GenerateObjects()
-
-
-
-function debuginfo(foo)
- foo = foo + foo
- return debug.getlocal(1,1)
-end
-
-rootobj = {
- testfalse = false,
- testtrue = true,
- testseven = 7,
- testfoobar = "foobar",
- testfuncreturnsfour = func,
- testnil = nil,
- testthread = thr,
- testperm = permtable,
- testmt = twithmt,
- testtbl = testtbl,
- testfenv = testfenv,
- testclosure = funcreturningclosure(11),
- testnilclosure = funcreturningclosure(nil),
- testnest = nestedfunc,
- testludata = createludata(),
- testlooptable = testloopa,
- testsharedrefa = refa,
- testsharedrefb = refb,
- testsptable = sptable,
- testliteraludata = literaludata,
- testspudata1 = boxboolean(true),
- testspudata2 = boxboolean(false),
- testsharedupval = makecounter(),
- testuvinthread = uvinthread,
- testniinmt = niinmt,
- testuvcycle = uvcycle,
- testdebuginfo = debuginfo
-}
-
-buf = pluto.persist(perms, rootobj)
-
-onerror()
-outfile = io.open("test.plh", "wb")
-outfile:write(buf)
-outfile:close()
Index: engines/sword25/util/pluto/pptest.cpp
===================================================================
--- engines/sword25/util/pluto/pptest.cpp (revision 53822)
+++ engines/sword25/util/pluto/pptest.cpp (working copy)
@@ -1,95 +0,0 @@
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-
-static int LUAF_createludata(lua_State *L)
-{
- lua_pushlightuserdata(L, (void*)321);
- return 1;
-}
-
-/* A userdata that may be literally persisted */
-static int LUAF_boxinteger(lua_State *L)
-{
- /* num */
- int* ptr = lua_newuserdata(L, sizeof(int));
- /* num udata */
- *ptr = luaL_checkint(L, 1);
- lua_newtable(L);
- /* num udata mt */
- lua_pushstring(L, "__persist");
- /* num udata mt "__persist" */
- lua_pushboolean(L, 1);
- /* num udata mt "__persist" true */
- lua_rawset(L, 3);
- /* num udata mt */
- lua_setmetatable(L, 2);
- /* num udata */
- return 1;
-}
-
-static int LUAF_boxboolean(lua_State *L)
-{
- /* bool */
- char* ptr = lua_newuserdata(L, sizeof(char));
- /* bool udata */
- *ptr = lua_toboolean(L, 1);
- lua_newtable(L);
- /* num udata mt */
- lua_pushstring(L, "__persist");
- /* num udata mt "__persist" */
- lua_getglobal(L, "booleanpersist");
- /* num udata mt "__persist" booleanpersist */
- lua_rawset(L, 3);
- /* num udata mt */
- lua_setmetatable(L, 2);
- /* num udata */
- return 1;
-}
-
-static int LUAF_unboxboolean(lua_State *L)
-{
- /* udata */
- lua_pushboolean(L, *(char*)lua_touserdata(L, 1));
- /* udata bool */
- return 1;
-}
-
-static int LUAF_onerror(lua_State *L)
-{
-
- const char* str = 0;
- if(lua_gettop(L) != 0)
- {
- str = lua_tostring(L, -1);
- printf("%s\n",str);
- }
- return 0;
-}
-
-int main()
-{
- lua_State* L = lua_open();
-
- luaL_openlibs(L);
- lua_settop(L, 0);
-
- lua_register(L, "createludata", LUAF_createludata);
- lua_register(L, "boxinteger", LUAF_boxinteger);
- lua_register(L, "boxboolean", LUAF_boxboolean);
- lua_register(L, "unboxboolean", LUAF_unboxboolean);
- lua_register(L, "onerror", LUAF_onerror);
-
- lua_pushcfunction(L, LUAF_onerror);
- luaL_loadfile(L, "pptest.lua");
- lua_pcall(L,0,0,1);
-
- lua_close(L);
-
- return 0;
-}
Index: engines/sword25/util/pluto/puptest.lua
===================================================================
--- engines/sword25/util/pluto/puptest.lua (revision 53822)
+++ engines/sword25/util/pluto/puptest.lua (working copy)
@@ -1,93 +0,0 @@
--- $Id$
-
-require "pluto"
-
-permtable = { 1234 }
-
-perms = { [1] = coroutine.yield, [2] = permtable }
-
-function testcounter(counter)
- local a = counter.cur()
- counter.inc()
- return counter.cur() == a+1
-end
-
-function testuvinthread(func)
- local success, result = coroutine.resume(func)
- return success and result == 5
-end
-
-
-function test(rootobj)
- local passed = 0
- local total = 0
- local dotest = function(name,cond)
- total = total+1
- if cond then
- print(name, " PASSED")
- passed = passed + 1
- else
- print(name, "* FAILED")
- end
- end
-
-
- dotest("Boolean FALSE ", rootobj.testfalse == false)
- dotest("Boolean TRUE ", rootobj.testtrue == true)
- dotest("Number 7 ", rootobj.testseven == 7)
- dotest("String 'foobar' ", rootobj.testfoobar == "foobar")
- dotest("Func returning 4 ", rootobj.testfuncreturnsfour() == 4)
- dotest("Nil value ", rootobj.testnil == nil)
- dotest("Thread resume ", coroutine.resume(rootobj.testthread) == true,14)
- dotest("Table ", rootobj.testtbl.a == 2 and rootobj.testtbl[2] == 4);
- dotest("Permanent table ", rootobj.testperm == permtable)
- dotest("Table metatable ", rootobj.testmt() == 21)
- dotest("Function env ", rootobj.testfenv() == 456)
- dotest("Lua closure ", rootobj.testclosure() == 11)
- dotest("Nil in closure ", rootobj.testnilclosure() == nil)
- dotest("Nested func ", rootobj.testnest(1) == 6)
- dotest("Light userdata ", checkludata(rootobj.testludata))
- dotest("Looped tables ",
- rootobj.testlooptable.testloopb.testloopa ==
- rootobj.testlooptable)
- dotest("Shared reference ", rootobj.testsharedrefa.sharedref ==
- rootobj.testsharedrefb.sharedref)
- dotest("Identical tables ", rootobj.testsharedrefa ~=
- rootobj.testsharedrefb)
- dotest("Table special persist", rootobj.testsptable.a == 6)
- dotest("Udata literal persist",
- unboxinteger(rootobj.testliteraludata) == 71)
- dotest("Udata special persist",
- unboxboolean(rootobj.testspudata1) == true and
- unboxboolean(rootobj.testspudata2) == false)
- dotest("Shared upvalues ",
- testcounter(rootobj.testsharedupval))
- dotest("Open upvalues ",
- testuvinthread(rootobj.testuvinthread))
- dotest("Upvalue cycles ",
- rootobj.testuvcycle()[1] == rootobj.testuvcycle()[2])
- dotest("__newindex metamethod", rootobj.testniinmt.a == 3)
- dotest("Debug info ", (rootobj.testdebuginfo(2)) == "foo")
- print()
- if passed == total then
- print("All tests passed.")
- else
- print(passed .. "/" .. total .. " tests passed.")
- end
-end
-
-infile, err = io.open("test.plh", "rb")
-if infile == nil then
- error("While opening: " .. (err or "no error"))
-end
-
-buf, err = infile:read("*a")
-if buf == nil then
- error("While reading: " .. (err or "no error"))
-end
-
-infile:close()
-
-rootobj = pluto.unpersist(perms, buf)
-
-test(rootobj)
Index: engines/sword25/util/pluto/puptest.cpp
===================================================================
--- engines/sword25/util/pluto/puptest.cpp (revision 53822)
+++ engines/sword25/util/pluto/puptest.cpp (working copy)
@@ -1,81 +0,0 @@
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-
-static int LUAF_checkludata(lua_State *L)
-{
- lua_pushboolean(L, lua_touserdata(L, -1) == (void*)321);
- return 1;
-}
-
-static int LUAF_unboxinteger(lua_State *L)
-{
- lua_pushnumber(L, *((int*)lua_touserdata(L, -1)));
- return 1;
-}
-
-static int LUAF_unboxboolean(lua_State *L)
-{
- /* udata */
- lua_pushboolean(L, *(char*)lua_touserdata(L, 1));
- /* udata bool */
- return 1;
-}
-
-static int LUAF_boxboolean(lua_State *L)
-{
- /* bool */
- char* ptr = lua_newuserdata(L, sizeof(char));
- /* bool udata */
- *ptr = lua_toboolean(L, 1);
- lua_newtable(L);
- /* num udata mt */
- lua_pushstring(L, "__persist");
- /* num udata mt "__persist" */
- lua_getglobal(L, "booleanpersist");
- /* num udata mt "__persist" booleanpersist */
- lua_rawset(L, 3);
- /* num udata mt */
- lua_setmetatable(L, 2);
- /* num udata */
- return 1;
-}
-
-static int LUAF_onerror(lua_State *L)
-{
-
- const char* str = 0;
- if(lua_gettop(L) != 0)
- {
- str = lua_tostring(L, -1);
- printf("%s\n",str);
- }
- return 0;
-}
-
-int main()
-{
- lua_State* L = lua_open();
-
- luaL_openlibs(L);
- lua_settop(L, 0);
-
- lua_register(L, "checkludata", LUAF_checkludata);
- lua_register(L, "unboxinteger", LUAF_unboxinteger);
- lua_register(L, "boxboolean", LUAF_boxboolean);
- lua_register(L, "unboxboolean", LUAF_unboxboolean);
- lua_register(L, "onerror", LUAF_onerror);
-
- lua_pushcfunction(L, LUAF_onerror);
- luaL_loadfile(L, "puptest.lua");
- lua_pcall(L,0,0,1);
-
- lua_close(L);
-
- return 0;
-}
Index: graphics/scaler/hq2x.cpp
===================================================================
--- graphics/scaler/hq2x.cpp (revision 53822)
+++ graphics/scaler/hq2x.cpp (working copy)
@@ -23,6 +23,7 @@
*
*/
+#ifndef ANDROID
#include "graphics/scaler/intern.h"
#ifdef USE_NASM
@@ -1969,3 +1970,4 @@
}
#endif // Assembly version
+#endif /* ANDROID */
Index: graphics/scaler/hq3x.cpp
===================================================================
--- graphics/scaler/hq3x.cpp (revision 53822)
+++ graphics/scaler/hq3x.cpp (working copy)
@@ -23,6 +23,7 @@
*
*/
+#ifndef ANDROID
#include "graphics/scaler/intern.h"
#ifdef USE_NASM
@@ -2946,3 +2947,4 @@
}
#endif // Assembly version
+#endif /* ANDROID */
Index: backends/fs/posix/posix-fs.cpp
===================================================================
--- backends/fs/posix/posix-fs.cpp (revision 53822)
+++ backends/fs/posix/posix-fs.cpp (working copy)
@@ -245,4 +245,18 @@
return StdioStream::makeFromPath(getPath().c_str(), true);
}
+AbstractFSNode *POSIXFilesystemNode::makeNode(const Common::String &path) const {
+ return new POSIXFilesystemNode(path);
+}
+
+POSIXFilesystemNode::POSIXFilesystemNode() : _isDirectory(false), _isValid(false) {}
+
+bool POSIXFilesystemNode::exists() const { return access(_path.c_str(), F_OK) == 0; }
+Common::String POSIXFilesystemNode::getDisplayName() const { return _displayName; }
+Common::String POSIXFilesystemNode::getName() const { return _displayName; }
+Common::String POSIXFilesystemNode::getPath() const { return _path; }
+bool POSIXFilesystemNode::isDirectory() const { return _isDirectory; }
+bool POSIXFilesystemNode::isReadable() const { return access(_path.c_str(), R_OK) == 0; }
+bool POSIXFilesystemNode::isWritable() const { return access(_path.c_str(), W_OK) == 0; }
+
#endif //#if defined(UNIX)
Index: backends/fs/posix/posix-fs-factory.cpp
===================================================================
--- backends/fs/posix/posix-fs-factory.cpp (revision 53822)
+++ backends/fs/posix/posix-fs-factory.cpp (working copy)
@@ -24,7 +24,10 @@
#if defined(UNIX)
#include "backends/fs/posix/posix-fs-factory.h"
-#include "backends/fs/posix/posix-fs.cpp"
+#include "backends/fs/posix/posix-fs.h"
+#ifndef ANDROID
+#include "backends/fs/posix/posix-fs.cpp" // TODO: ugly hack
+#endif
AbstractFSNode *POSIXFilesystemFactory::makeRootFileNode() const {
return new POSIXFilesystemNode("/");
Index: backends/fs/posix/posix-fs.h
===================================================================
--- backends/fs/posix/posix-fs.h (revision 53822)
+++ backends/fs/posix/posix-fs.h (working copy)
@@ -44,14 +44,12 @@
bool _isDirectory;
bool _isValid;
- virtual AbstractFSNode *makeNode(const Common::String &path) const {
- return new POSIXFilesystemNode(path);
- }
+ virtual AbstractFSNode *makeNode(const Common::String &path) const;
/**
* Plain constructor, for internal use only (hence protected).
*/
- POSIXFilesystemNode() : _isDirectory(false), _isValid(false) {}
+ POSIXFilesystemNode();
public:
/**
@@ -61,13 +59,13 @@
*/
POSIXFilesystemNode(const Common::String &path);
- virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; }
- virtual Common::String getDisplayName() const { return _displayName; }
- virtual Common::String getName() const { return _displayName; }
- virtual Common::String getPath() const { return _path; }
- virtual bool isDirectory() const { return _isDirectory; }
- virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
- virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
+ virtual bool exists() const;
+ virtual Common::String getDisplayName() const;
+ virtual Common::String getName() const;
+ virtual Common::String getPath() const;
+ virtual bool isDirectory() const;
+ virtual bool isReadable() const;
+ virtual bool isWritable() const;
virtual AbstractFSNode *getChild(const Common::String &n) const;
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;