Improved v3 support

This commit is contained in:
yoshizf
2003-09-21 15:04:14 +00:00
parent 12c59112ef
commit 0e33db7ed7
5 changed files with 150 additions and 52 deletions
+33 -1
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/blocks.h,v 1.4 2003/09/21 06:47:15 aquadran Exp $
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/blocks.h,v 1.5 2003/09/21 15:04:14 yoshizf Exp $
*
*/
@@ -135,3 +135,35 @@ enum {
SPK,
ROL
};
enum {
b0R = 200,
b0S,
b0N,
b0C,
b0O,
RO,
HD,
BX,
PA,
BM,
OI,
OC,
NL,
SL,
EX,
EN,
LC,
LS,
SC,
CO,
LE,
FO,
LF,
CC,
SP,
SA,
SO,
RN
};
+33 -20
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.cpp,v 1.9 2003/09/21 06:47:15 aquadran Exp $
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.cpp,v 1.10 2003/09/21 15:04:14 yoshizf Exp $
*
*/
@@ -142,9 +142,8 @@ int Resource::searchOldBlocks(BlockTable *_blockTable, File& _input, int index,
_input.seek(size, SEEK_SET);
return index;
}
}
curpos = _input.pos();
}
@@ -830,16 +829,16 @@ int Resource::parseBlocks(char *blockName, BlockTable *_blockTable, File& _input
int Resource::parseOldBlocks(char *blockName, BlockTable *_blockTable, File& _input, int index, int level) {
int numFiles, offset, number;
int numFiles, offset, number, bufindex;
strcpy(_blockTable[index].blockDescription, oldBlocksInfo[_blockTable[index].blockTypeID].description);
strcpy(_blockTable[index].blockDescription, oldBlocksInfo[_blockTable[index].blockTypeID - 200].description);
switch(_blockTable[index].blockTypeID) {
case 200: // 0R
case 201: // OS
case 202: // ON
case 203: // OC
case b0R:
case b0S:
case b0N:
case b0C:
numFiles = _input.readUint16LE();
_blockTable[index].numFiles = numFiles;
@@ -852,19 +851,19 @@ int Resource::parseOldBlocks(char *blockName, BlockTable *_blockTable, File& _in
index++;
break;
case 204: // 00
case b0O:
numFiles = _input.readUint16LE();
_blockTable[index].numFiles = numFiles;
for (int i=0; i<numFiles; i++) {
_input.readByte(); // Owner of object
}
_input.seek(_blockTable[index].blockSize + _blockTable[index].offset, SEEK_SET);
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
index++;
break;
case 205: // RO
case RO:
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
index++;
level++;
@@ -873,7 +872,7 @@ int Resource::parseOldBlocks(char *blockName, BlockTable *_blockTable, File& _in
break;
case 206: // HD
case HD:
_blockTable[index].width = _input.readUint16LE();
_blockTable[index].height = _input.readUint16LE();
_blockTable[index].localObjects = _input.readUint16LE();
@@ -881,11 +880,26 @@ int Resource::parseOldBlocks(char *blockName, BlockTable *_blockTable, File& _in
index++;
break;
case 207: // BX
case 208:
case 209:
case 210:
case 212:
case LE:
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
bufindex = index;
index++;
level++;
index = searchOldBlocks(_blockTable, _input, index, level, _blockTable[index-1].blockSize + _blockTable[index-1].offset);
_input.seek(_blockTable[bufindex].offset + _blockTable[bufindex].blockSize, SEEK_SET);
break;
case LF:
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
_input.seek(2, SEEK_CUR);
bufindex = index;
index++;
level++;
index = searchOldBlocks(_blockTable, _input, index, level, _blockTable[index-1].blockSize + _blockTable[index-1].offset);
_input.seek(_blockTable[bufindex].offset + _blockTable[bufindex].blockSize, SEEK_SET);
break;
default:
_gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
_input.seek(_blockTable[index].blockSize + _blockTable[index].offset, SEEK_SET);
index++;
@@ -912,12 +926,11 @@ int Resource::getBlockType(char *tag) {
int Resource::getOldBlockType(char *tag) {
for (int i=0; i<12; i++) {
for (int i=0; i<28; i++) {
if(strstr(tag, oldBlocksInfo[i].name)) {
return oldBlocksInfo[i].id;
}
}
return -1;
}
+29 -13
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.h,v 1.3 2003/09/18 20:50:56 yoshizf Exp $
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.h,v 1.4 2003/09/21 15:04:14 yoshizf Exp $
*
*/
@@ -178,18 +178,34 @@ const struct blockInfo blocksInfo[] = {
};
const struct blockInfo oldBlocksInfo[] = {
{200, "0R", "Directory of Rooms"},
{201, "0S", ""},
{202, "0N", ""},
{203, "0C", ""},
{204, "0O", "Directory of Objects"},
{205, "RO", ""},
{206, "HD", ""},
{207, "BX", ""},
{208, "PA", ""},
{209, "BM", ""},
{210, "OI", ""},
{211, "OC", ""}
{200, "0R", "Directory of Rooms", 0, "", 18},
{201, "0S", "", 0, "", 19},
{202, "0N", "", 0, "", 47},
{203, "0C", "", 0, "", 14},
{204, "0O", "Directory of Objects", 0, "", 17},
{205, "RO", "", 0, "", 38},
{206, "HD", "", 0, "", 35},
{207, "BX", "", 0, "", 4},
{208, "PA", "", 0, "", 34},
{209, "BM", "", 0, "", 37},
{210, "OI", "", 0, "", 33},
{211, "OC", "", 0, "", 41},
{212, "NL", "", 0, "", 41},
{213, "SL", "", 0, "", 47},
{214, "EX", "", 0, "", 22},
{215, "EN", "", 0, "", 21},
{216, "LC", "", 0, "", 47},
{217, "LS", "", 0, "", 41},
{218, "SC", "", 0, "", 41},
{219, "CO", "", 0, "", 11},
{220, "LE", "LucasArts Entertainment Company Files", 0, "", 6},
{221, "FO", "", 0, "", 44},
{222, "LF", "", 0, "", 58},
{223, "CC", "", 0, "", 12},
{224, "SP", "", 0, "", 47},
{225, "SA", "", 0, "", 40},
{226, "SO", "", 0, "", 59},
{227, "RN", "", 0, "", 47}
};
class Resource {
+25 -12
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.cpp,v 1.9 2003/09/21 00:45:16 yoshizf Exp $
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.cpp,v 1.10 2003/09/21 15:04:14 yoshizf Exp $
*
*/
@@ -68,12 +68,14 @@ void ScummEX::getFileType(const char *filename) {
return;
}
tag = _input.readUint16LE();
tag = 0;
_input.read(&tag, 2);
switch(tag) {
case 21040: // OR
case 20306: // RO
case 20050: // RN
_input.seek(0, SEEK_SET);
_resource->searchOldBlocks(_blockTable, _input);
return;
@@ -81,11 +83,8 @@ void ScummEX::getFileType(const char *filename) {
}
_input.close();
_encbyte = 0x69;
_input.open(filename, 1, _encbyte);
_input.read(&tag, 4);
switch (tag) {
@@ -98,13 +97,22 @@ void ScummEX::getFileType(const char *filename) {
_input.seek(0, SEEK_SET);
_resource->searchBlocks(_blockTable, _input);
return;
default:
_gui->SetTitle("ScummEX");
_gui->DisableToolbarTool(ID_Close);
_gui->DisableToolbarTool(ID_FileInfo);
_gui->DisplayDialog("Unknown file type!", "Error");
}
tag = 0;
_input.read(&tag, 2);
switch(tag) {
case 17740: // LE
_input.seek(0, SEEK_SET);
_resource->searchOldBlocks(_blockTable, _input);
return;
}
_gui->SetTitle("ScummEX");
_gui->DisableToolbarTool(ID_Close);
_gui->DisableToolbarTool(ID_FileInfo);
_gui->DisplayDialog("Unknown file type!", "Error");
}
void ScummEX::Descumm() {
@@ -362,6 +370,11 @@ void ScummEX::UpdateInfosFromTree(int blockid) {
case ENCD:
case EXCD:
case VERB:
case LS:
case SC:
case EN:
case EX:
case OC:
_gui->SetButton(_blockTable[blockid].blockTypeID);
break;
+30 -6
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.cpp,v 1.6 2003/09/21 06:47:15 aquadran Exp $
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.cpp,v 1.7 2003/09/21 15:04:14 yoshizf Exp $
*
*/
@@ -373,6 +373,11 @@ void GUI_wxWindows::SetButton(int blocktype) {
case ENCD:
case EXCD:
case VERB:
case LS:
case SC:
case EN:
case EX:
case OC:
SpecButton1->SetLabel("Decompile Script");
SpecButton1->Show(TRUE);
SpecButton1->Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
@@ -388,12 +393,12 @@ void GUI_wxWindows::add_tree_elements(char *itemName, int blockid, int level, in
assert(level <= 10);
itemid = iter[level] = tree->AppendItem(iter[level-1], itemName, -1, -1, new TreeItemData(blockid, type));
if (blocksInfo[type].iconid != 0) {
tree->SetItemImage(itemid, blocksInfo[type].iconid);
tree->SetItemImage(itemid, blocksInfo[type].iconid, wxTreeItemIcon_Selected);
if (type < 200) {
tree->SetItemImage(itemid, blocksInfo[type].iconid);
tree->SetItemImage(itemid, blocksInfo[type].iconid, wxTreeItemIcon_Selected);
} else {
tree->SetItemImage(itemid, 47);
tree->SetItemImage(itemid, 47, wxTreeItemIcon_Selected);
tree->SetItemImage(itemid, oldBlocksInfo[type-200].iconid);
tree->SetItemImage(itemid, oldBlocksInfo[type-200].iconid, wxTreeItemIcon_Selected);
}
if (blockid == 1) {
@@ -865,27 +870,33 @@ void MainWindow::OnSelChanged(wxTreeEvent& event) {
case LECF:
case LABN:
case LB83:
case LE:
bigIconBitmap = wxBitmap(xpm_6_big);
break;
case LOFF:
case OFFS:
case FO:
bigIconBitmap = wxBitmap(xpm_44_big);
break;
case LFLF:
case LF:
bigIconBitmap = wxBitmap(xpm_58_big);
break;
case ROOM:
case RO:
bigIconBitmap = wxBitmap(xpm_38_big);
break;
case RMHD:
case HD:
bigIconBitmap = wxBitmap(xpm_35_big);
break;
case CYCL:
case CC:
bigIconBitmap = wxBitmap(xpm_12_big);
break;
@@ -898,10 +909,12 @@ void MainWindow::OnSelChanged(wxTreeEvent& event) {
case APAL:
case NPAL:
case XPAL:
case PA:
bigIconBitmap = wxBitmap(xpm_34_big);
break;
case BOXD:
case BX:
bigIconBitmap = wxBitmap(xpm_4_big);
break;
@@ -910,24 +923,32 @@ void MainWindow::OnSelChanged(wxTreeEvent& event) {
break;
case SCAL:
case SA:
bigIconBitmap = wxBitmap(xpm_40_big);
break;
case RMIM:
case BM:
bigIconBitmap = wxBitmap(xpm_37_big);
break;
case EXCD:
case EX:
bigIconBitmap = wxBitmap(xpm_22_big);
break;
case ENCD:
case EN:
bigIconBitmap = wxBitmap(xpm_21_big);
break;
case NLSC:
case SCRP:
case LSCR:
case OC:
case NL:
case LS:
case SC:
bigIconBitmap = wxBitmap(xpm_41_big);
break;
@@ -936,6 +957,7 @@ void MainWindow::OnSelChanged(wxTreeEvent& event) {
case iMUS:
case cus2:
case IMC:
case SO:
bigIconBitmap = wxBitmap(xpm_59_big);
break;
@@ -963,6 +985,7 @@ void MainWindow::OnSelChanged(wxTreeEvent& event) {
break;
case OBIM:
case OI:
bigIconBitmap = wxBitmap(xpm_33_big);
break;
@@ -1063,6 +1086,7 @@ void MainWindow::OnSelChanged(wxTreeEvent& event) {
break;
case COST:
case CO:
bigIconBitmap = wxBitmap(xpm_11_big);
break;