[Scummvm-cvs-logs] scummvm master -> 39902452a2d659ac6eddde2febdfddbebd7c771d
waltervn
waltervn at users.sourceforge.net
Fri Mar 4 21:16:34 CET 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f96e93047a SCI: Use BE string handling for Mac games.
39902452a2 SCI: Fix reg_t ASCII printing in debugger for BE.
Commit: f96e93047a6407eeb5c9e59825e55648f74c6a3d
https://github.com/scummvm/scummvm/commit/f96e93047a6407eeb5c9e59825e55648f74c6a3d
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2011-03-04T12:12:00-08:00
Commit Message:
SCI: Use BE string handling for Mac games.
Changed paths:
engines/sci/engine/kmisc.cpp
engines/sci/engine/kstring.cpp
engines/sci/engine/seg_manager.cpp
engines/sci/sci.cpp
engines/sci/sci.h
engines/sci/util.cpp
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 6d7c458..5b0d93a 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -299,10 +299,7 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
if (ref.isRaw) {
- if (g_sci->getPlatform() == Common::kPlatformAmiga)
- return make_reg(0, (int16)READ_BE_UINT16(ref.raw)); // Amiga versions are BE
- else
- return make_reg(0, (int16)READ_LE_UINT16(ref.raw));
+ return make_reg(0, (int16)READ_SCI1ENDIAN_UINT16(ref.raw));
} else {
if (ref.skipByte)
error("Attempt to peek memory at odd offset %04X:%04X", PRINT_REG(argv[1]));
@@ -323,10 +320,7 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
error("Attempt to poke memory reference %04x:%04x to %04x:%04x", PRINT_REG(argv[2]), PRINT_REG(argv[1]));
return s->r_acc;
}
- if (g_sci->getPlatform() == Common::kPlatformAmiga)
- WRITE_BE_UINT16(ref.raw, argv[2].offset); // Amiga versions are BE
- else
- WRITE_LE_UINT16(ref.raw, argv[2].offset);
+ WRITE_SCI1ENDIAN_UINT16(ref.raw, argv[2].offset); // Amiga versions are BE
} else {
if (ref.skipByte)
error("Attempt to poke memory at odd offset %04X:%04X", PRINT_REG(argv[1]));
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index df77b8e..730f7af 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -113,7 +113,7 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
reg_t &tmp = dest_r.reg[offset / 2];
bool oddOffset = offset & 1;
- if (g_sci->getPlatform() == Common::kPlatformAmiga)
+ if (g_sci->isBE())
oddOffset = !oddOffset;
if (!oddOffset) {
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index f30f3ce..c75ceab 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -602,8 +602,8 @@ static inline char getChar(const SegmentRef &ref, uint offset) {
warning("Attempt to read character from non-raw data");
bool oddOffset = offset & 1;
- if (g_sci->getPlatform() == Common::kPlatformAmiga)
- oddOffset = !oddOffset; // Amiga versions are BE
+ if (g_sci->isBE())
+ oddOffset = !oddOffset;
return (oddOffset ? val.offset >> 8 : val.offset & 0xff);
}
@@ -617,8 +617,8 @@ static inline void setChar(const SegmentRef &ref, uint offset, byte value) {
val->segment = 0;
bool oddOffset = offset & 1;
- if (g_sci->getPlatform() == Common::kPlatformAmiga)
- oddOffset = !oddOffset; // Amiga versions are BE
+ if (g_sci->isBE())
+ oddOffset = !oddOffset;
if (oddOffset)
val->offset = (val->offset & 0x00ff) | (value << 8);
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 89a81dc..3dfa5e0 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -777,6 +777,16 @@ bool SciEngine::isCD() const {
return _gameDescription->flags & ADGF_CD;
}
+bool SciEngine::isBE() const{
+ switch(_gameDescription->platform) {
+ case Common::kPlatformAmiga:
+ case Common::kPlatformMacintosh:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool SciEngine::hasMacIconBar() const {
return _resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1 &&
(getGameId() == GID_KQ6 || getGameId() == GID_FREDDYPHARKAS);
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index aea5712..9155db0 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -238,6 +238,7 @@ public:
Common::Platform getPlatform() const;
bool isDemo() const;
bool isCD() const;
+ bool isBE() const;
bool hasMacIconBar() const;
inline ResourceManager *getResMan() const { return _resMan; }
diff --git a/engines/sci/util.cpp b/engines/sci/util.cpp
index 8f6576c..408fd9d 100644
--- a/engines/sci/util.cpp
+++ b/engines/sci/util.cpp
@@ -31,14 +31,14 @@
namespace Sci {
uint16 READ_SCI1ENDIAN_UINT16(const void *ptr) {
- if (g_sci->getPlatform() == Common::kPlatformAmiga && getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_LATE)
+ if (g_sci->isBE() && getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_LATE)
return READ_BE_UINT16(ptr);
else
return READ_LE_UINT16(ptr);
}
void WRITE_SCI1ENDIAN_UINT16(void *ptr, uint16 val) {
- if (g_sci->getPlatform() == Common::kPlatformAmiga && getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_LATE)
+ if (g_sci->isBE() && getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_LATE)
WRITE_BE_UINT16(ptr, val);
else
WRITE_LE_UINT16(ptr, val);
Commit: 39902452a2d659ac6eddde2febdfddbebd7c771d
https://github.com/scummvm/scummvm/commit/39902452a2d659ac6eddde2febdfddbebd7c771d
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2011-03-04T12:12:00-08:00
Commit Message:
SCI: Fix reg_t ASCII printing in debugger for BE.
Changed paths:
engines/sci/console.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index f3c3657..de0cfe2 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3767,11 +3767,16 @@ int Console::printObject(reg_t pos) {
return 0;
}
+static void printChar(byte c) {
+ if (c < 32 || c >= 127)
+ c = '.';
+ debugN("%c", c);
+}
+
void Console::hexDumpReg(const reg_t *data, int len, int regsPerLine, int startOffset, bool isArray) {
// reg_t version of Common::hexdump
assert(1 <= regsPerLine && regsPerLine <= 8);
int i;
- byte c;
int offset = startOffset;
while (len >= regsPerLine) {
debugN("%06x: ", offset);
@@ -3780,14 +3785,13 @@ void Console::hexDumpReg(const reg_t *data, int len, int regsPerLine, int startO
}
debugN(" |");
for (i = 0; i < regsPerLine; i++) {
- c = data[i].toUint16() & 0xff;
- if (c < 32 || c >= 127)
- c = '.';
- debugN("%c", c);
- c = data[i].toUint16() >> 8;
- if (c < 32 || c >= 127)
- c = '.';
- debugN("%c", c);
+ if (g_sci->isBE()) {
+ printChar(data[i].toUint16() >> 8);
+ printChar(data[i].toUint16() & 0xff);
+ } else {
+ printChar(data[i].toUint16() & 0xff);
+ printChar(data[i].toUint16() >> 8);
+ }
}
debugN("|\n");
data += regsPerLine;
@@ -3807,14 +3811,13 @@ void Console::hexDumpReg(const reg_t *data, int len, int regsPerLine, int startO
}
debugN(" |");
for (i = 0; i < len; i++) {
- c = data[i].toUint16() & 0xff;
- if (c < 32 || c >= 127)
- c = '.';
- debugN("%c", c);
- c = data[i].toUint16() >> 8;
- if (c < 32 || c >= 127)
- c = '.';
- debugN("%c", c);
+ if (g_sci->isBE()) {
+ printChar(data[i].toUint16() >> 8);
+ printChar(data[i].toUint16() & 0xff);
+ } else {
+ printChar(data[i].toUint16() & 0xff);
+ printChar(data[i].toUint16() >> 8);
+ }
}
for (; i < regsPerLine; i++)
debugN(" ");
More information about the Scummvm-git-logs
mailing list