diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/config-manager.cpp | 2 | ||||
-rw-r--r-- | common/endian.h | 20 | ||||
-rw-r--r-- | common/iff_container.h | 96 | ||||
-rw-r--r-- | common/quicktime.cpp | 74 | ||||
-rw-r--r-- | common/scummsys.h | 5 | ||||
-rw-r--r-- | common/winexe_ne.cpp | 2 | ||||
-rw-r--r-- | common/winexe_pe.cpp | 2 |
7 files changed, 90 insertions, 111 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index c8c0999a25..77c918dcae 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -120,7 +120,7 @@ void ConfigManager::addDomain(const Common::String &domainName, const ConfigMana if (domainName == kApplicationDomain) { _appDomain = domain; #ifdef ENABLE_KEYMAPPER - } else if (domain == kKeymapperDomain) { + } else if (domainName == kKeymapperDomain) { _keymapperDomain = domain; #endif } else if (domain.contains("gameid")) { diff --git a/common/endian.h b/common/endian.h index 32f92fd02c..e6c39d3a4c 100644 --- a/common/endian.h +++ b/common/endian.h @@ -141,27 +141,13 @@ /** * A wrapper macro used around four character constants, like 'DATA', to - * ensure portability. Typical usage: MKID_BE('DATA'). + * ensure portability. Typical usage: MKTAG('D','A','T','A'). * * Why is this necessary? The C/C++ standard does not define the endianess to * be used for character constants. Hence if one uses multi-byte character * constants, a potential portability problem opens up. - * - * Fortunately, a semi-standard has been established: On almost all systems - * and compilers, multi-byte character constants are encoded using the big - * endian convention (probably in analogy to the encoding of string constants). - * Still some systems differ. This is why we provide the MKID_BE macro. If - * you wrap your four character constants with it, the result will always be - * BE encoded, even on systems which differ from the default BE encoding. - * - * For the latter systems we provide the INVERSE_MKID override. */ -#if defined(INVERSE_MKID) -#define MKID_BE(a) SWAP_CONSTANT_32(a) - -#else -# define MKID_BE(a) ((uint32)(a)) -#endif +#define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) // Functions for reading/writing native Integers, // this transparently handles the need for alignment @@ -331,8 +317,6 @@ #elif defined(SCUMM_BIG_ENDIAN) - #define MKID_BE(a) ((uint32)(a)) - #define READ_BE_UINT16(a) READ_UINT16(a) #define READ_BE_UINT32(a) READ_UINT32(a) diff --git a/common/iff_container.h b/common/iff_container.h index 16d4826238..01fc8017a9 100644 --- a/common/iff_container.h +++ b/common/iff_container.h @@ -35,111 +35,111 @@ namespace Common { typedef uint32 IFF_ID; -#define ID_FORM MKID_BE('FORM') +#define ID_FORM MKTAG('F','O','R','M') /* EA IFF 85 group identifier */ -#define ID_CAT MKID_BE('CAT ') +#define ID_CAT MKTAG('C','A','T',' ') /* EA IFF 85 group identifier */ -#define ID_LIST MKID_BE('LIST') +#define ID_LIST MKTAG('L','I','S','T') /* EA IFF 85 group identifier */ -#define ID_PROP MKID_BE('PROP') +#define ID_PROP MKTAG('P','R','O','P') /* EA IFF 85 group identifier */ -#define ID_END MKID_BE('END ') +#define ID_END MKTAG('E','N','D',' ') /* unofficial END-of-FORM identifier (see Amiga RKM Devices Ed.3 page 376) */ -#define ID_ILBM MKID_BE('ILBM') +#define ID_ILBM MKTAG('I','L','B','M') /* EA IFF 85 raster bitmap form */ -#define ID_DEEP MKID_BE('DEEP') +#define ID_DEEP MKTAG('D','E','E','P') /* Chunky pixel image files (Used in TV Paint) */ -#define ID_RGB8 MKID_BE('RGB8') +#define ID_RGB8 MKTAG('R','G','B','8') /* RGB image forms, Turbo Silver (Impulse) */ -#define ID_RGBN MKID_BE('RGBN') +#define ID_RGBN MKTAG('R','G','B','N') /* RGB image forms, Turbo Silver (Impulse) */ -#define ID_PBM MKID_BE('PBM ') +#define ID_PBM MKTAG('P','B','M',' ') /* 256-color chunky format (DPaint 2 ?) */ -#define ID_ACBM MKID_BE('ACBM') +#define ID_ACBM MKTAG('A','C','B','M') /* Amiga Contiguous Bitmap (AmigaBasic) */ -#define ID_8SVX MKID_BE('8SVX') +#define ID_8SVX MKTAG('8','S','V','X') /* Amiga 8 bits voice */ /* generic */ -#define ID_FVER MKID_BE('FVER') +#define ID_FVER MKTAG('F','V','E','R') /* AmigaOS version string */ -#define ID_JUNK MKID_BE('JUNK') +#define ID_JUNK MKTAG('J','U','N','K') /* always ignore this chunk */ -#define ID_ANNO MKID_BE('ANNO') +#define ID_ANNO MKTAG('A','N','N','O') /* EA IFF 85 Generic Annotation chunk */ -#define ID_AUTH MKID_BE('AUTH') +#define ID_AUTH MKTAG('A','U','T','H') /* EA IFF 85 Generic Author chunk */ -#define ID_CHRS MKID_BE('CHRS') +#define ID_CHRS MKTAG('C','H','R','S') /* EA IFF 85 Generic character string chunk */ -#define ID_NAME MKID_BE('NAME') +#define ID_NAME MKTAG('N','A','M','E') /* EA IFF 85 Generic Name of art, music, etc. chunk */ -#define ID_TEXT MKID_BE('TEXT') +#define ID_TEXT MKTAG('T','E','X','T') /* EA IFF 85 Generic unformatted ASCII text chunk */ -#define ID_copy MKID_BE('(c) ') +#define ID_copy MKTAG('(','c',')',' ') /* EA IFF 85 Generic Copyright text chunk */ /* ILBM chunks */ -#define ID_BMHD MKID_BE('BMHD') +#define ID_BMHD MKTAG('B','M','H','D') /* ILBM BitmapHeader */ -#define ID_CMAP MKID_BE('CMAP') +#define ID_CMAP MKTAG('C','M','A','P') /* ILBM 8bit RGB colormap */ -#define ID_GRAB MKID_BE('GRAB') +#define ID_GRAB MKTAG('G','R','A','B') /* ILBM "hotspot" coordiantes */ -#define ID_DEST MKID_BE('DEST') +#define ID_DEST MKTAG('D','E','S','T') /* ILBM destination image info */ -#define ID_SPRT MKID_BE('SPRT') +#define ID_SPRT MKTAG('S','P','R','T') /* ILBM sprite identifier */ -#define ID_CAMG MKID_BE('CAMG') +#define ID_CAMG MKTAG('C','A','M','G') /* Amiga viewportmodes */ -#define ID_BODY MKID_BE('BODY') +#define ID_BODY MKTAG('B','O','D','Y') /* ILBM image data */ -#define ID_CRNG MKID_BE('CRNG') +#define ID_CRNG MKTAG('C','R','N','G') /* color cycling */ -#define ID_CCRT MKID_BE('CCRT') +#define ID_CCRT MKTAG('C','C','R','T') /* color cycling */ -#define ID_CLUT MKID_BE('CLUT') +#define ID_CLUT MKTAG('C','L','U','T') /* Color Lookup Table chunk */ -#define ID_DPI MKID_BE('DPI ') +#define ID_DPI MKTAG('D','P','I',' ') /* Dots per inch chunk */ -#define ID_DPPV MKID_BE('DPPV') +#define ID_DPPV MKTAG('D','P','P','V') /* DPaint perspective chunk (EA) */ -#define ID_DRNG MKID_BE('DRNG') +#define ID_DRNG MKTAG('D','R','N','G') /* DPaint IV enhanced color cycle chunk (EA) */ -#define ID_EPSF MKID_BE('EPSF') +#define ID_EPSF MKTAG('E','P','S','F') /* Encapsulated Postscript chunk */ -#define ID_CMYK MKID_BE('CMYK') +#define ID_CMYK MKTAG('C','M','Y','K') /* Cyan, Magenta, Yellow, & Black color map (Soft-Logik) */ -#define ID_CNAM MKID_BE('CNAM') +#define ID_CNAM MKTAG('C','N','A','M') /* Color naming chunk (Soft-Logik) */ -#define ID_PCHG MKID_BE('PCHG') +#define ID_PCHG MKTAG('P','C','H','G') /* Line by line palette control information (Sebastiano Vigna) */ -#define ID_PRVW MKID_BE('PRVW') +#define ID_PRVW MKTAG('P','R','V','W') /* A mini duplicate ILBM used for preview (Gary Bonham) */ -#define ID_XBMI MKID_BE('XBMI') +#define ID_XBMI MKTAG('X','B','M','I') /* eXtended BitMap Information (Soft-Logik) */ -#define ID_CTBL MKID_BE('CTBL') +#define ID_CTBL MKTAG('C','T','B','L') /* Newtek Dynamic Ham color chunk */ -#define ID_DYCP MKID_BE('DYCP') +#define ID_DYCP MKTAG('D','Y','C','P') /* Newtek Dynamic Ham chunk */ -#define ID_SHAM MKID_BE('SHAM') +#define ID_SHAM MKTAG('S','H','A','M') /* Sliced HAM color chunk */ -#define ID_ABIT MKID_BE('ABIT') +#define ID_ABIT MKTAG('A','B','I','T') /* ACBM body chunk */ -#define ID_DCOL MKID_BE('DCOL') +#define ID_DCOL MKTAG('D','C','O','L') /* unofficial direct color */ -#define ID_DPPS MKID_BE('DPPS') +#define ID_DPPS MKTAG('D','P','P','S') /* ? */ -#define ID_TINY MKID_BE('TINY') +#define ID_TINY MKTAG('T','I','N','Y') /* ? */ -#define ID_DPPV MKID_BE('DPPV') +#define ID_DPPV MKTAG('D','P','P','V') /* ? */ /* 8SVX chunks */ -#define ID_VHDR MKID_BE('VHDR') +#define ID_VHDR MKTAG('V','H','D','R') /* 8SVX Voice8Header */ diff --git a/common/quicktime.cpp b/common/quicktime.cpp index 32662d77f2..207a2dd5e3 100644 --- a/common/quicktime.cpp +++ b/common/quicktime.cpp @@ -74,10 +74,10 @@ bool QuickTimeParser::parseFile(const Common::String &filename) { if (_resFork->hasResFork()) { // Search for a 'moov' resource - Common::MacResIDArray idArray = _resFork->getResIDArray(MKID_BE('moov')); + Common::MacResIDArray idArray = _resFork->getResIDArray(MKTAG('m', 'o', 'o', 'v')); if (!idArray.empty()) - _fd = _resFork->getResource(MKID_BE('moov'), idArray[0]); + _fd = _resFork->getResource(MKTAG('m', 'o', 'o', 'v'), idArray[0]); if (_fd) { atom.size = _fd->size(); @@ -137,32 +137,32 @@ void QuickTimeParser::init() { void QuickTimeParser::initParseTable() { static const ParseTable p[] = { - { &QuickTimeParser::readDefault, MKID_BE('dinf') }, - { &QuickTimeParser::readLeaf, MKID_BE('dref') }, - { &QuickTimeParser::readDefault, MKID_BE('edts') }, - { &QuickTimeParser::readELST, MKID_BE('elst') }, - { &QuickTimeParser::readHDLR, MKID_BE('hdlr') }, - { &QuickTimeParser::readDefault, MKID_BE('mdat') }, - { &QuickTimeParser::readMDHD, MKID_BE('mdhd') }, - { &QuickTimeParser::readDefault, MKID_BE('mdia') }, - { &QuickTimeParser::readDefault, MKID_BE('minf') }, - { &QuickTimeParser::readMOOV, MKID_BE('moov') }, - { &QuickTimeParser::readMVHD, MKID_BE('mvhd') }, - { &QuickTimeParser::readLeaf, MKID_BE('smhd') }, - { &QuickTimeParser::readDefault, MKID_BE('stbl') }, - { &QuickTimeParser::readSTCO, MKID_BE('stco') }, - { &QuickTimeParser::readSTSC, MKID_BE('stsc') }, - { &QuickTimeParser::readSTSD, MKID_BE('stsd') }, - { &QuickTimeParser::readSTSS, MKID_BE('stss') }, - { &QuickTimeParser::readSTSZ, MKID_BE('stsz') }, - { &QuickTimeParser::readSTTS, MKID_BE('stts') }, - { &QuickTimeParser::readTKHD, MKID_BE('tkhd') }, - { &QuickTimeParser::readTRAK, MKID_BE('trak') }, - { &QuickTimeParser::readLeaf, MKID_BE('udta') }, - { &QuickTimeParser::readLeaf, MKID_BE('vmhd') }, - { &QuickTimeParser::readCMOV, MKID_BE('cmov') }, - { &QuickTimeParser::readWAVE, MKID_BE('wave') }, - { &QuickTimeParser::readESDS, MKID_BE('esds') }, + { &QuickTimeParser::readDefault, MKTAG('d', 'i', 'n', 'f') }, + { &QuickTimeParser::readLeaf, MKTAG('d', 'r', 'e', 'f') }, + { &QuickTimeParser::readDefault, MKTAG('e', 'd', 't', 's') }, + { &QuickTimeParser::readELST, MKTAG('e', 'l', 's', 't') }, + { &QuickTimeParser::readHDLR, MKTAG('h', 'd', 'l', 'r') }, + { &QuickTimeParser::readDefault, MKTAG('m', 'd', 'a', 't') }, + { &QuickTimeParser::readMDHD, MKTAG('m', 'd', 'h', 'd') }, + { &QuickTimeParser::readDefault, MKTAG('m', 'd', 'i', 'a') }, + { &QuickTimeParser::readDefault, MKTAG('m', 'i', 'n', 'f') }, + { &QuickTimeParser::readMOOV, MKTAG('m', 'o', 'o', 'v') }, + { &QuickTimeParser::readMVHD, MKTAG('m', 'v', 'h', 'd') }, + { &QuickTimeParser::readLeaf, MKTAG('s', 'm', 'h', 'd') }, + { &QuickTimeParser::readDefault, MKTAG('s', 't', 'b', 'l') }, + { &QuickTimeParser::readSTCO, MKTAG('s', 't', 'c', 'o') }, + { &QuickTimeParser::readSTSC, MKTAG('s', 't', 's', 'c') }, + { &QuickTimeParser::readSTSD, MKTAG('s', 't', 's', 'd') }, + { &QuickTimeParser::readSTSS, MKTAG('s', 't', 's', 's') }, + { &QuickTimeParser::readSTSZ, MKTAG('s', 't', 's', 'z') }, + { &QuickTimeParser::readSTTS, MKTAG('s', 't', 't', 's') }, + { &QuickTimeParser::readTKHD, MKTAG('t', 'k', 'h', 'd') }, + { &QuickTimeParser::readTRAK, MKTAG('t', 'r', 'a', 'k') }, + { &QuickTimeParser::readLeaf, MKTAG('u', 'd', 't', 'a') }, + { &QuickTimeParser::readLeaf, MKTAG('v', 'm', 'h', 'd') }, + { &QuickTimeParser::readCMOV, MKTAG('c', 'm', 'o', 'v') }, + { &QuickTimeParser::readWAVE, MKTAG('w', 'a', 'v', 'e') }, + { &QuickTimeParser::readESDS, MKTAG('e', 's', 'd', 's') }, { 0, 0 } }; @@ -186,7 +186,7 @@ int QuickTimeParser::readDefault(MOVatom atom) { // Some QuickTime videos with resource forks have mdat chunks // that are of size 0. Adjust it so it's the correct size. - if (a.type == MKID_BE('mdat') && a.size == 0) + if (a.type == MKTAG('m', 'd', 'a', 't') && a.size == 0) a.size = _fd->size(); } @@ -259,16 +259,16 @@ int QuickTimeParser::readCMOV(MOVatom atom) { #ifdef USE_ZLIB // Read in the dcom atom _fd->readUint32BE(); - if (_fd->readUint32BE() != MKID_BE('dcom')) + if (_fd->readUint32BE() != MKTAG('d', 'c', 'o', 'm')) return -1; - if (_fd->readUint32BE() != MKID_BE('zlib')) { + if (_fd->readUint32BE() != MKTAG('z', 'l', 'i', 'b')) { warning("Unknown cmov compression type"); return -1; } // Read in the cmvd atom uint32 compressedSize = _fd->readUint32BE() - 12; - if (_fd->readUint32BE() != MKID_BE('cmvd')) + if (_fd->readUint32BE() != MKTAG('c', 'm', 'v', 'd')) return -1; uint32 uncompressedSize = _fd->readUint32BE(); @@ -293,7 +293,7 @@ int QuickTimeParser::readCMOV(MOVatom atom) { _fd = new Common::MemoryReadStream(uncompressedData, uncompressedSize, DisposeAfterUse::YES); // Read the contents of the uncompressed data - MOVatom a = { MKID_BE('moov'), 0, uncompressedSize }; + MOVatom a = { MKTAG('m', 'o', 'o', 'v'), 0, uncompressedSize }; int err = readDefault(a); // Assign the file handle back to the original handle @@ -462,14 +462,14 @@ int QuickTimeParser::readHDLR(MOVatom atom) { debug(0, "ctype= %s (0x%08lx)", tag2str(ctype), (long)ctype); debug(0, "stype= %s", tag2str(type)); - if (ctype == MKID_BE('mhlr')) // MOV + if (ctype == MKTAG('m', 'h', 'l', 'r')) // MOV debug(0, "MOV detected"); else if (ctype == 0) debug(0, "MPEG-4 detected"); - if (type == MKID_BE('vide')) + if (type == MKTAG('v', 'i', 'd', 'e')) st->codec_type = CODEC_TYPE_VIDEO; - else if (type == MKID_BE('soun')) + else if (type == MKTAG('s', 'o', 'u', 'n')) st->codec_type = CODEC_TYPE_AUDIO; _fd->readUint32BE(); // component manufacture @@ -685,7 +685,7 @@ int QuickTimeParser::readWAVE(MOVatom atom) { if (atom.size > (1 << 30)) return -1; - if (st->sampleDescs[0]->codecTag == MKID_BE('QDM2')) // Read extradata for QDM2 + if (st->sampleDescs[0]->codecTag == MKTAG('Q', 'D', 'M', '2')) // Read extradata for QDM2 st->extradata = _fd->readStream(atom.size - 8); else if (atom.size > 8) return readDefault(atom); diff --git a/common/scummsys.h b/common/scummsys.h index 86493dd7b0..6554c70163 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -243,11 +243,6 @@ // You need to set this manually if necessary // #define SCUMM_NEED_ALIGNMENT - #if defined(__DECCXX) // Assume alpha architecture - #define INVERSE_MKID - #define SCUMM_NEED_ALIGNMENT - #endif - // Very BAD hack following, used to avoid triggering an assert in uClibc dingux library // "toupper" when pressing keyboard function keys. #if defined(DINGUX) diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp index 24e51f1c9e..844127b0e1 100644 --- a/common/winexe_ne.cpp +++ b/common/winexe_ne.cpp @@ -95,7 +95,7 @@ bool NEResources::loadFromCompressedEXE(const String &fileName) { return false; // First part of the signature - if (file.readUint32BE() != MKID_BE('SZDD')) + if (file.readUint32BE() != MKTAG('S','Z','D','D')) return false; // Second part of the signature diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp index 456093f5b4..17db004bfc 100644 --- a/common/winexe_pe.cpp +++ b/common/winexe_pe.cpp @@ -78,7 +78,7 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream) { stream->seek(peOffset); - if (stream->readUint32BE() != MKID_BE('PE\0\0')) + if (stream->readUint32BE() != MKTAG('P','E',0,0)) return false; stream->skip(2); |