From 07c79ea1a1b015c8c8f5ea4bb4b8b5c2aaf6f4b9 Mon Sep 17 00:00:00 2001
From: Pixel <pixel@nobis-crew.org>
Date: Tue, 9 Jun 2009 18:42:24 -0700
Subject: Adding dvdmode to the dirtree object.

---
 includes/isobuilder.h |  2 ++
 lib/isobuilder.cpp    | 12 +++++++-----
 lib/luacd.cpp         |  9 ++++++++-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/includes/isobuilder.h b/includes/isobuilder.h
index 16a3a4d..88ab91a 100644
--- a/includes/isobuilder.h
+++ b/includes/isobuilder.h
@@ -63,12 +63,14 @@ class isobuilder : public Base {
         DirTree * Child();
         DirTree * Brother();
         DirTree * Find(const String &);
+        void setdvdmode();
       private:
         int buildpath_r(int * n, Byte * data, int size, int current_level, int level_to_dump, bool bigendian) throw (GeneralException);
         int maxlevel(int current_level = 1);
         DirTree * father, * child, * brother;
         bool dir;
         int node;
+        bool dvdmode;
     };
       isobuilder(Handle * w, int mode = MODE2_FORM1);
       ~isobuilder();
diff --git a/lib/isobuilder.cpp b/lib/isobuilder.cpp
index 9bec34c..d3d9e1b 100644
--- a/lib/isobuilder.cpp
+++ b/lib/isobuilder.cpp
@@ -88,6 +88,8 @@ isobuilder::DirTree::DirTree(isobuilder::DirTree * _father, bool _dir) : mode(-1
 
     if (!father)
         return;
+    
+    dvdmode = father->dvdmode;
 
     creation = father->creation;
 
@@ -99,6 +101,10 @@ isobuilder::DirTree::DirTree(isobuilder::DirTree * _father, bool _dir) : mode(-1
     }
 }
 
+isobuilder::DirTree::setdvdmode() {
+    dvdmode = true;
+}
+
 isobuilder::DirTree::~DirTree() {
     while (child) {
         delete child;
@@ -266,10 +272,6 @@ int isobuilder::DirTree::buildentry(Byte * buffer, int spaceleft, bool put_xa) {
 
     memset(pbuf, 0, 256);
 
-    if (name == "BM2.ELF") {
-        printm(M_INFO, "GRON");
-    }
-
     if (name == ".") {
         N = 1;
         pbuf[0] = 0;
@@ -279,7 +281,7 @@ int isobuilder::DirTree::buildentry(Byte * buffer, int spaceleft, bool put_xa) {
     } else {
         strcpy(pbuf, name.to_charp());
         N = name.strlen();
-        if (!dir) {
+        if ((!dir) && !dvdmode) {
             N += 2;
             strcat(pbuf, ";1");
         }
diff --git a/lib/luacd.cpp b/lib/luacd.cpp
index 881f5ae..6855b9a 100644
--- a/lib/luacd.cpp
+++ b/lib/luacd.cpp
@@ -1126,6 +1126,7 @@ enum DirTree_methods_t {
     DIRTREE_FROMDIR,
     DIRTREE_SETBASICSXA,
     DIRTREE_FIND,
+    DIRTREE_SETDVDMODE,
 };
 
 enum DirTree_functions_t {
@@ -1136,8 +1137,9 @@ struct lua_functypes_t DirTree_methods[] = {
     { DIRTREE_INDEX,       "index",       1, 1, { BLUA_STRING } },
     { DIRTREE_NEWINDEX,    "newindex",    2, 2, { BLUA_STRING, BLUA_ANY } },
     { DIRTREE_FROMDIR,     "fromdir",     1, 1, { BLUA_OBJECT } },
-    { DIRTREE_SETBASICSXA, "setbasicsxa", 0, 0, 0 },
+    { DIRTREE_SETBASICSXA, "setbasicsxa", 0, 0, { } },
     { DIRTREE_FIND,        "find",        1, 1, { BLUA_STRING } },
+    { DIRTREE_SETDVDMODE,  "setdvdmode",  0, 0, { } },
     { -1, 0, 0, 0, 0 }
 };
 
@@ -1153,6 +1155,7 @@ class sLua_DirTree : public Base {
     DECLARE_METHOD(DirTree, DIRTREE_FROMDIR);
     DECLARE_METHOD(DirTree, DIRTREE_SETBASICSXA);
     DECLARE_METHOD(DirTree, DIRTREE_FIND);
+    DECLARE_METHOD(DirTree, DIRTREE_SETDVDMODE);
 
     DECLARE_FUNCTION(DirTree, DIRTREE_NEWDIRTREE);
   private:
@@ -1169,6 +1172,7 @@ void LuaDirTree::pushmembers(Lua * L) {
     PUSH_METHOD(DirTree, DIRTREE_FROMDIR);
     PUSH_METHOD(DirTree, DIRTREE_SETBASICSXA);
     PUSH_METHOD(DirTree, DIRTREE_FIND);
+    PUSH_METHOD(DirTree, DIRTREE_SETDVDMODE);
 }
 
 void LuaDirTree::pushstatics(Lua * L) throw (GeneralException) {
@@ -1204,6 +1208,9 @@ int sLua_DirTree::DirTree_proceed(Lua * L, int n, DirTree * dir, int caller) {
             L->push();
         }
         break;
+    case DIRTREE_SETDVDMODE:
+        dir->setdvdmode();
+        break;
     case DIRTREE_INDEX:
         key = L->tostring(2);
         r = 1;
-- 
cgit v1.2.3