summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/isobuilder.cpp26
-rw-r--r--lib/luacd.cpp30
2 files changed, 41 insertions, 15 deletions
diff --git a/lib/isobuilder.cpp b/lib/isobuilder.cpp
index 6ed8abd..80133b1 100644
--- a/lib/isobuilder.cpp
+++ b/lib/isobuilder.cpp
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: isobuilder.cpp,v 1.15 2004-11-27 21:47:56 pixel Exp $ */
+/* $Id: isobuilder.cpp,v 1.16 2004-12-17 11:48:41 pixel Exp $ */
#include "isobuilder.h"
@@ -526,7 +526,7 @@ int isobuilder::putdatas(Byte * _datas, size_t size, int smode, int n) {
return dsect;
}
-int isobuilder::createsector(Byte * datas, int smode, int n) {
+int isobuilder::createsector(Byte * datas, int smode, int n, int FN, int CN, int SM, int CI) {
Byte dsector[2352];
int rsector;
if (n >= 0)
@@ -543,11 +543,11 @@ int isobuilder::createsector(Byte * datas, int smode, int n) {
if ((smode == MODE2_FORM1) || (smode == MODE2_FORM2)) {
// Mode 2 Form 2 would be odd, but well....
- dsector[16] = dsector[20] = 0; // File Number
- dsector[17] = dsector[21] = 0; // Channel Number
- dsector[18] = dsector[22] = sub_EOR | sub_EOF | 8 |
- (smode == MODE2_FORM2 ? 32 : 0);
- dsector[19] = dsector[23] = 0; // Coding Info
+ dsector[16] = dsector[20] = FN < 0 ? 0 : FN; // File Number
+ dsector[17] = dsector[21] = CN < 0 ? 0 : CN; // Channel Number
+ dsector[18] = dsector[22] = SM < 0 ? (sub_EOR | sub_EOF | 8 |
+ (smode == MODE2_FORM2 ? 32 : 0)) : SM;
+ dsector[19] = dsector[23] = CI < 0 ? 0 : CI; // Coding Info
}
if (smode != MODE_RAW) {
@@ -569,6 +569,18 @@ int isobuilder::createsector(Byte * datas, int smode, int n) {
return rsector;
}
+int isobuilder::createsector(Handle * file, int smode, int n, int FN, int CN, int SM, int CI) {
+ Byte dsector[2352];
+
+ if (smode < 0)
+ smode = dmode;
+
+ memset(dsector, 0, 2352);
+ file->read(dsector, sec_sizes[smode]);
+
+ return createsector(dsector, smode, n, FN, CN, SM, CI);
+}
+
void isobuilder::setEOF() {
sub_EOF = 128;
sub_EOR = 1;
diff --git a/lib/luacd.cpp b/lib/luacd.cpp
index c330921..a594f27 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.15 2004-11-27 21:47:56 pixel Exp $ */
+/* $Id: luacd.cpp,v 1.16 2004-12-17 11:48:41 pixel Exp $ */
#include "luacd.h"
@@ -1368,7 +1368,7 @@ struct lua_functypes_t isobuilder_methods[] = {
{ 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_CREATESECTOR, "createsector", 1, 3, {LUA_TABLE, 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 },
{ ISOBUILDER_SETBASICS, "setbasics", 1, 5, {LUA_OBJECT, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER, LUA_NUMBER} },
@@ -1447,6 +1447,7 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca
int r = 0, i;
Handle * h = 0;
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;
PVD * pvd;
@@ -1514,13 +1515,26 @@ int sLua_isobuilder::isobuilder_proceed(Lua * L, int n, isobuilder * iso, int ca
mode = L->tonumber(3);
if (n >= 3)
sector = L->tonumber(4);
- for (i = 0; i < 2352; i++) {
- L->push((lua_Number) i);
- L->gettable(2);
- datas[i] = L->tonumber();
- L->pop();
+ if (n >= 4)
+ FN = L->tonumber(5);
+ if (n >= 5)
+ CN = L->tonumber(6);
+ if (n >= 6)
+ SM = L->tonumber(7);
+ if (n >= 7)
+ CI = L->tonumber(8);
+ if (L->isobject(2)) {
+ h = (Handle *) LuaObject::getme(L, 2);
+ L->push((lua_Number) iso->createsector(h, mode, sector, FN, CN, SM, CI));
+ } else {
+ for (i = 0; i < 2352; i++) {
+ L->push((lua_Number) i);
+ L->gettable(2);
+ datas[i] = L->tonumber();
+ L->pop();
+ }
+ L->push((lua_Number) iso->createsector(datas, mode, sector, FN, CN, SM, CI));
}
- L->push((lua_Number) iso->createsector(datas, mode, sector));
r = 1;
break;
case ISOBUILDER_SETEOF: