From 8871e4ca37ae147715dc957904686dd4add82d77 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 2 Nov 2005 21:34:01 +0000 Subject: Adding DVD support, and updating zlib. --- lib/luacd.cpp | 94 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'lib/luacd.cpp') diff --git a/lib/luacd.cpp b/lib/luacd.cpp index 9e1e698..82c72cd 100644 --- a/lib/luacd.cpp +++ b/lib/luacd.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: luacd.cpp,v 1.18 2005-02-12 22:56:17 pixel Exp $ */ +/* $Id: luacd.cpp,v 1.19 2005-11-02 21:34:02 pixel Exp $ */ #include "luacd.h" @@ -37,10 +37,10 @@ enum cdutils_methods_t { CDUTILS_GUESSTYPE, CDUTILS_SECTORSEEK, CDUTILS_READSECTOR, - CDUTILS_READDATAS, + CDUTILS_READdata, CDUTILS_READFILE, CDUTILS_WRITESECTOR, - CDUTILS_WRITEDATAS, + CDUTILS_WRITEdata, CDUTILS_WRITEFILE, CDUTILS_GETISOINFOS, CDUTILS_GETPTINFOS, @@ -69,10 +69,10 @@ struct lua_functypes_t cdutils_methods[] = { { CDUTILS_GUESSTYPE, "guessmode", 0, 1, {LUA_NUMBER} }, { CDUTILS_SECTORSEEK, "sectorseek", 1, 1, {LUA_NUMBER} }, { CDUTILS_READSECTOR, "readsector", 0, 2, {LUA_NUMBER, LUA_NUMBER} }, - { CDUTILS_READDATAS, "readdatas", 1, 3, {LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, + { CDUTILS_READdata, "readdata", 1, 3, {LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, { CDUTILS_READFILE, "readfile", 2, 4, {LUA_OBJECT, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, { CDUTILS_WRITESECTOR, "writesector", 1, 3, {LUA_TABLE, LUA_NUMBER, LUA_NUMBER} }, - { CDUTILS_WRITEDATAS, "writedatas", 2, 4, {LUA_TABLE, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, + { CDUTILS_WRITEdata, "writedata", 2, 4, {LUA_TABLE, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, { CDUTILS_WRITEFILE, "writefile", 1, 4, {LUA_OBJECT, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, { CDUTILS_GETISOINFOS, "getisoinfos", 0, 0, 0 }, { CDUTILS_GETPTINFOS, "getptinfos", 0, 0, 0 }, @@ -104,10 +104,10 @@ class sLua_cdutils : public Base { DECLARE_METHOD(cdutils, CDUTILS_GUESSTYPE); DECLARE_METHOD(cdutils, CDUTILS_SECTORSEEK); DECLARE_METHOD(cdutils, CDUTILS_READSECTOR); - DECLARE_METHOD(cdutils, CDUTILS_READDATAS); + DECLARE_METHOD(cdutils, CDUTILS_READdata); DECLARE_METHOD(cdutils, CDUTILS_READFILE); DECLARE_METHOD(cdutils, CDUTILS_WRITESECTOR); - DECLARE_METHOD(cdutils, CDUTILS_WRITEDATAS); + DECLARE_METHOD(cdutils, CDUTILS_WRITEdata); DECLARE_METHOD(cdutils, CDUTILS_WRITEFILE); DECLARE_METHOD(cdutils, CDUTILS_GETISOINFOS); DECLARE_METHOD(cdutils, CDUTILS_GETPTINFOS); @@ -140,10 +140,10 @@ void Luacdutils::pushmembers(Lua * L) { PUSH_METHOD(cdutils, CDUTILS_GUESSTYPE); PUSH_METHOD(cdutils, CDUTILS_SECTORSEEK); PUSH_METHOD(cdutils, CDUTILS_READSECTOR); - PUSH_METHOD(cdutils, CDUTILS_READDATAS); + PUSH_METHOD(cdutils, CDUTILS_READdata); PUSH_METHOD(cdutils, CDUTILS_READFILE); PUSH_METHOD(cdutils, CDUTILS_WRITESECTOR); - PUSH_METHOD(cdutils, CDUTILS_WRITEDATAS); + PUSH_METHOD(cdutils, CDUTILS_WRITEdata); PUSH_METHOD(cdutils, CDUTILS_WRITEFILE); PUSH_METHOD(cdutils, CDUTILS_GETISOINFOS); PUSH_METHOD(cdutils, CDUTILS_GETPTINFOS); @@ -230,7 +230,7 @@ void Luacdutils::pushstatics(Lua * L) throw (GeneralException) { int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { int r = 0, sect = -1, mode = GUESS, size = -1, i; Handle * h; - Byte sdatas[2352], * datas; + Byte sdata[2352], * data; String path; cdutils::DirEntry * dir, * bdir, * adir, pdir; bool invalid = false, eof = false; @@ -258,31 +258,31 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { sect = L->tonumber(2); if (n == 2) mode = L->tonumber(3); - size = cd->read_sector(sdatas, mode, sect); + size = cd->read_sector(sdata, mode, sect); L->newtable(); for (i = 0; i < size; i++) { L->push((lua_Number) i); - L->push((lua_Number) sdatas[i]); + L->push((lua_Number) sdata[i]); L->settable(); } r = 1; break; - case CDUTILS_READDATAS: + case CDUTILS_READdata: size = L->tonumber(2); if (n >= 2) sect = L->tonumber(3); if (n == 3) mode = L->tonumber(3); - datas = (Byte *) malloc(size); - cd->read_datas(datas, size, mode, sect); + data = (Byte *) malloc(size); + cd->read_data(data, size, mode, sect); L->newtable(); for (i = 0; i < size; i++) { L->push((lua_Number) i); - L->push((lua_Number) datas[i]); + L->push((lua_Number) data[i]); L->settable(); } r = 1; - free(datas); + free(data); break; case CDUTILS_READFILE: h = (Handle *) LuaObject::getme(L, 2); @@ -301,27 +301,27 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { for (i = 0; i < 2352; i++) { L->push((lua_Number) i); L->gettable(2); - sdatas[i] = L->tonumber(); + sdata[i] = L->tonumber(); L->pop(); } - cd->write_sector(datas, mode, sect); + cd->write_sector(data, mode, sect); break; - case CDUTILS_WRITEDATAS: + case CDUTILS_WRITEdata: size = L->tonumber(3); if (n >= 3) sect = L->tonumber(4); if (n == 4) mode = L->tonumber(5); - datas = (Byte *) malloc(size); + data = (Byte *) malloc(size); for (i = 0; i < size; i++) { L->push((lua_Number) i); L->gettable(2); - sdatas[i] = L->tonumber(); + sdata[i] = L->tonumber(); L->pop(); } - cd->write_datas(datas, size, mode, sect); - free(datas); + cd->write_data(data, size, mode, sect); + free(data); break; case CDUTILS_WRITEFILE: h = (Handle *) LuaObject::getme(L, 2); @@ -343,7 +343,7 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { break; case CDUTILS_FINDPATH: path = L->tostring(2); - bdir = cd->find_path(&datas, path); + bdir = cd->find_path(&data, path); if ((bdir) && bdir->R) { dir = (cdutils::DirEntry *) malloc(bdir->R); memcpy(dir, bdir, bdir->R); @@ -357,11 +357,11 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { L->push(); } r = 1; - free(datas); + free(data); break; case CDUTILS_FINDPARENT: path = L->tostring(2); - bdir = cd->find_parent(&datas, path); + bdir = cd->find_parent(&data, path); if ((bdir) && bdir->R) { dir = (cdutils::DirEntry *) malloc(bdir->R); memcpy(dir, bdir, bdir->R); @@ -375,12 +375,12 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { L->push(); } r = 1; - free(datas); + free(data); break; case CDUTILS_FINDDIRENTRY: adir = (cdutils::DirEntry *) LuaObject::getme(L, 2); path = L->tostring(3); - bdir = cd->find_dir_entry(&datas, adir, path); + bdir = cd->find_dir_entry(&data, adir, path); if ((bdir) && bdir->R) { dir = (cdutils::DirEntry *) malloc(bdir->R); memcpy(dir, bdir, bdir->R); @@ -394,7 +394,7 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { L->push(); } r = 1; - free(datas); + free(data); break; case CDUTILS_NEWCDFILE: if (L->istable(2)) { @@ -432,7 +432,7 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { case CDUTILS_UPDATESECTOR: path = L->tostring(2); pdir = cd->find_parent(path); - dir = cd->find_path(&datas, path); + dir = cd->find_path(&data, path); switch (caller) { case CDUTILS_UPDATESIZE: dir->Size = tolittle((Uint32) L->tonumber(3)); @@ -443,8 +443,8 @@ int sLua_cdutils::cdutils_proceed(Lua * L, int n, cdutils * cd, int caller) { dir->BESector = tobig((Uint32) L->tonumber(3)); break; } - cd->write_datas(datas, pdir.Size, GUESS, pdir.Sector); - free(datas); + cd->write_data(data, pdir.Size, GUESS, pdir.Sector); + free(data); break; case CDUTILS_CREATESECTOR: mode = L->tonumber(2); @@ -1343,7 +1343,7 @@ enum isobuilder_methods_t { ISOBUILDER_FOREWORD_ARRAY, ISOBUILDER_GETDISPSECT, ISOBUILDER_PUTFILE, - ISOBUILDER_PUTDATAS, + ISOBUILDER_PUTdata, ISOBUILDER_CREATESECTOR, ISOBUILDER_SETEOF, ISOBUILDER_CLEAREOF, @@ -1367,7 +1367,7 @@ struct lua_functypes_t isobuilder_methods[] = { { ISOBUILDER_FOREWORD_ARRAY, "foreword_array", 1, 2, {LUA_TABLE, LUA_NUMBER} }, { ISOBUILDER_GETDISPSECT, "getdispsect", 0, 0, 0}, { ISOBUILDER_PUTFILE, "putfile", 1, 3, {LUA_OBJECT, LUA_NUMBER, LUA_NUMBER} }, - { ISOBUILDER_PUTDATAS, "putdatas", 2, 4, {LUA_TABLE, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, + { ISOBUILDER_PUTdata, "putdata", 2, 4, {LUA_TABLE, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, { ISOBUILDER_CREATESECTOR, "createsector", 1, 7, {LUA_TABLE | LUA_OBJECT, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} }, { ISOBUILDER_SETEOF, "setEOF", 0, 0, 0 }, { ISOBUILDER_CLEAREOF, "clearEOF", 0, 0, 0 }, @@ -1394,7 +1394,7 @@ class sLua_isobuilder : public Base { DECLARE_METHOD(isobuilder, ISOBUILDER_FOREWORD_ARRAY); DECLARE_METHOD(isobuilder, ISOBUILDER_GETDISPSECT); DECLARE_METHOD(isobuilder, ISOBUILDER_PUTFILE); - DECLARE_METHOD(isobuilder, ISOBUILDER_PUTDATAS); + DECLARE_METHOD(isobuilder, ISOBUILDER_PUTdata); DECLARE_METHOD(isobuilder, ISOBUILDER_CREATESECTOR); DECLARE_METHOD(isobuilder, ISOBUILDER_SETEOF); DECLARE_METHOD(isobuilder, ISOBUILDER_CLEAREOF); @@ -1422,7 +1422,7 @@ void Luaisobuilder::pushmembers(Lua * L) { PUSH_METHOD(isobuilder, ISOBUILDER_FOREWORD_ARRAY); PUSH_METHOD(isobuilder, ISOBUILDER_GETDISPSECT); PUSH_METHOD(isobuilder, ISOBUILDER_PUTFILE); - PUSH_METHOD(isobuilder, ISOBUILDER_PUTDATAS); + PUSH_METHOD(isobuilder, ISOBUILDER_PUTdata); PUSH_METHOD(isobuilder, ISOBUILDER_CREATESECTOR); PUSH_METHOD(isobuilder, ISOBUILDER_SETEOF); PUSH_METHOD(isobuilder, ISOBUILDER_CLEAREOF); @@ -1449,7 +1449,7 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca int mode = -1, sector = -1, rootsize = 1, ptsize = 1, nvd = 1, rootsect = -1, nsects = -1; int FN = -1, CN = -1, SM = -1, CI = -1; size_t size; - Byte datas[2352 * 16], * p; + Byte data[2352 * 16], * p; PVD * pvd; DirTree * dirt, * rdir; direntry * dire = 0; @@ -1475,10 +1475,10 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca for (i = 0; i < 16 * 2352; i++) { L->push((lua_Number) i); L->gettable(2); - datas[i] = L->tonumber(); + data[i] = L->tonumber(); L->pop(); } - iso->foreword(datas, mode); + iso->foreword(data, mode); break; case ISOBUILDER_GETDISPSECT: L->push((lua_Number) iso->getdispsect()); @@ -1493,7 +1493,7 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca L->push((lua_Number) iso->putfile(h, mode, sector)); r = 1; break; - case ISOBUILDER_PUTDATAS: + case ISOBUILDER_PUTdata: size = L->tonumber(3); if (n >= 3) mode = L->tonumber(4); @@ -1506,7 +1506,7 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca p[i] = L->tonumber(); L->pop(); } - L->push((lua_Number) iso->putdatas(p, size, mode, sector)); + L->push((lua_Number) iso->putdata(p, size, mode, sector)); r = 1; free(p); break; @@ -1530,10 +1530,10 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca for (i = 0; i < 2352; i++) { L->push((lua_Number) i); L->gettable(2); - datas[i] = L->tonumber(); + data[i] = L->tonumber(); L->pop(); } - L->push((lua_Number) iso->createsector(datas, mode, sector, FN, CN, SM, CI)); + L->push((lua_Number) iso->createsector(data, mode, sector, FN, CN, SM, CI)); } r = 1; break; @@ -1620,7 +1620,7 @@ int sLua_isobuilder::isobuilder_proceed_statics(Lua * L, int n, int caller) { Handle * h; int mode = MODE2_FORM1; cdutils * cd; - Byte datas[2048]; + Byte data[2048]; PVD * pvd; switch (caller) { @@ -1658,11 +1658,11 @@ int sLua_isobuilder::isobuilder_proceed_statics(Lua * L, int n, int caller) { for (i = 0; i < 2048; i++) { L->push((lua_Number) i); L->gettable(1); - datas[i] = L->tonumber(); + data[i] = L->tonumber(); L->pop(); } pvd = (PVD *) malloc(sizeof(PVD)); - *pvd = isobuilder::createpvd(datas); + *pvd = isobuilder::createpvd(data); { LuaPVD t(pvd); t.pushdestruct(L); -- cgit v1.2.3