Ticket #8371: dekyra_v2.patch
File dekyra_v2.patch, 2.5 KB (added by , 20 years ago) |
---|
-
.cpp
old new 113 113 fread(chunkName, sizeof(uint8) * 4, 1, script); 114 114 chunkName[4] = '\0'; 115 115 // check name of chunk 116 if (!strcmp((char*)chunkName, "FORM")) { 116 if (!strcmp((char*)chunkName, "FORM")) { 117 117 // FreeKyra swaps the size I only read it in BigEndian :) 118 _chunks[kForm]._size = readUint32BE(script); 118 _chunks[kForm]._size = readUint32BE(script); 119 119 } else if (!strcmp((char*)chunkName, "TEXT")) { 120 120 uint32 text_size = readUint32BE(script); 121 121 text_size += text_size % 2 != 0 ? 1 : 0; 122 122 123 123 _chunks[kText]._data = _scriptFile + ftell(script); 124 _chunks[kText]._size = TO_BE_16(*((uint16*) _chunks[kText]._data)) >> 1;125 _chunks[kText]._additional = _chunks[kText]._data + (_chunks[kText]._size << 1); 124 _chunks[kText]._size = TO_BE_16(*((uint16*)(_chunks[kText]._data))) >> 1; 125 _chunks[kText]._additional = _chunks[kText]._data + (_chunks[kText]._size << 1); 126 126 fseek(script, text_size, SEEK_CUR); 127 127 } else if (!strcmp((char*)chunkName, "DATA")) { 128 128 _chunks[kData]._size = readUint32BE(script); … … 135 135 chunkName[8] = '\0'; 136 136 if (!strcmp((char*)chunkName, "EMC2ORDR")) { 137 137 _chunks[kEmc2Ordr]._size = readUint32BE(script) >> 1; 138 _chunks[kEmc2Ordr]._data = _scriptFile + ftell(script); 138 _chunks[kEmc2Ordr]._data = _scriptFile + ftell(script); 139 139 fseek(script, _chunks[kEmc2Ordr]._size * 2, SEEK_CUR); 140 140 } else { 141 141 // any unkown chunk or problems with seeking through the file … … 156 156 } 157 157 uint32 startoffset = TO_BE_16(((uint16*)_chunks[kText]._data)[pos]); 158 158 printf("Index: %d Offset: %d:\n", pos, startoffset); 159 /*uint32 endoffset = TO_BE_16(((uint16*)_chunks[kText]._data)[pos+1]);160 printf("\nstartoffset = %d, endoffset = %d\n\n", startoffset, endoffset);161 for (; startoffset < endoffset; ++startoffset) {162 printf("%c", *(char*)(_chunks[kText]._additional + startoffset));163 }164 printf("\n");*/165 159 printf("%d(%d) : %s\n", pos, startoffset, (char*)(_chunks[kText]._data + startoffset)); 166 160 } 167 161 } … … 227 221 }; 228 222 229 223 static OpcodeDesc opcodeDesc[] = { 230 { 0x68, " 0x68", "int" }224 { 0x68, "o1_0x68", "int" } 231 225 }; 232 226 233 227 if ((uint32)script >= _chunks[kEmc2Ordr]._size || script < 0) { … … 252 246 253 247 uint8 _currentCommand = 0; 254 248 uint8 _argument = 0; 255 _currentPos = (TO_BE_16(((uint16*)_chunks[kEmc2Ordr]._data)[script]) << 1) + 2;249 _currentPos = TO_BE_16(((uint16*)_chunks[kEmc2Ordr]._data)[script]) << 1; 256 250 uint8* script_start = _chunks[kData]._data; 257 251 bool gotArgument = true; 258 252