[Scummvm-git-logs] scummvm branch-2-9 -> 2ac2d854d9ce756e677c728befc29e22af2e0eb7

bluegr noreply at scummvm.org
Sun Nov 17 21:14:44 UTC 2024


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1bce1cedae SCUMM: Avoid memset for initializing non-trivial types
53b604c4da SCI: Add Japanese version of KQ7 - bug #15497
2ac2d854d9 SCUMM: fix invalid mem access (bug no. 15507)


Commit: 1bce1cedae3ad734713f9041f645c3cc1f4bd914
    https://github.com/scummvm/scummvm/commit/1bce1cedae3ad734713f9041f645c3cc1f4bd914
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2024-11-17T23:13:52+02:00

Commit Message:
SCUMM: Avoid memset for initializing non-trivial types

player_nes.cpp:130: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'class Scumm::APUe::Square'; use assignment or value-initialization instead [-Wclass-memaccess]
player_nes.cpp: In member function 'void Scumm::APUe::Square::Reset()':
player_nes.cpp:130:15: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'class Scumm::APUe::Square'; use assignment or value-initialization instead [-Wclass-memaccess]
  130 |         memset(this, 0, sizeof(*this));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
player_nes.cpp:104:7: note: 'class Scumm::APUe::Square' declared here
  104 | class Square : public SoundGen {
      |       ^~~~~~

Changed paths:
    engines/scumm/players/player_nes.cpp


diff --git a/engines/scumm/players/player_nes.cpp b/engines/scumm/players/player_nes.cpp
index c97d6c448c2..d145c2fa083 100644
--- a/engines/scumm/players/player_nes.cpp
+++ b/engines/scumm/players/player_nes.cpp
@@ -91,12 +91,12 @@ class SoundGen {
 protected:
 	byte wavehold = 0;
 	uint32 freq = 0;	// short
-	uint32 CurD = 0;
+	uint32 CurD = 1;
 
 public:
-	byte Timer;
-	int32 Pos;
-	uint32 Cycles;	// short
+	byte Timer = 0;
+	int32 Pos = 0;
+	uint32 Cycles = 1;	// short
 
 	inline byte GetTimer() const { return Timer; }
 };
@@ -105,7 +105,7 @@ class Square : public SoundGen {
 protected:
 	byte volume = 0, envelope = 0, duty = 0, swpspeed = 0, swpdir = 0, swpstep = 0, swpenab = 0;
 	byte Vol = 0;
-	byte EnvCtr = 0, Envelope = 0, BendCtr = 0;
+	byte EnvCtr = 1, Envelope = 0, BendCtr = 1;
 	bool Enabled = 0, ValidFreq = 0, Active = 0;
 	bool EnvClk = 0, SwpClk = 0;
 
@@ -127,10 +127,7 @@ static const int8 Duties[4][8] = {
 };
 
 void Square::Reset() {
-	memset(this, 0, sizeof(*this));
-	Cycles = 1;
-	EnvCtr = 1;
-	BendCtr = 1;
+	*this = Square();
 }
 
 void Square::CheckActive() {
@@ -259,8 +256,7 @@ static const int8 TriDuty[32] = {
 };
 
 void Triangle::Reset() {
-	memset(this, 0, sizeof(*this));
-	Cycles = 1;
+	*this = Triangle();
 }
 
 void Triangle::CheckActive() {
@@ -343,7 +339,7 @@ class Noise : public SoundGen {
 protected:
 	byte volume = 0, envelope = 0, datatype = 0;
 	byte Vol = 0;
-	byte EnvCtr = 0, Envelope = 0;
+	byte EnvCtr = 1, Envelope = 0;
 	bool Enabled = false;
 	bool EnvClk = false;
 
@@ -361,11 +357,7 @@ static const uint32 NoiseFreq[16] = {
 };
 
 void Noise::Reset() {
-	memset(this, 0, sizeof(*this));
-	CurD = 1;
-	Cycles = 1;
-	EnvCtr = 1;
-
+	*this = Noise();
 }
 
 void Noise::Write(int Reg, byte Val) {


Commit: 53b604c4da884321b8d056b5af50563b135eb73e
    https://github.com/scummvm/scummvm/commit/53b604c4da884321b8d056b5af50563b135eb73e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-11-17T23:13:54+02:00

Commit Message:
SCI: Add Japanese version of KQ7 - bug #15497

Changed paths:
    engines/sci/detection_tables.h


diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index c73e07fa137..78f68c50861 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -2564,6 +2564,34 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		AD_LISTEND},
 		Common::ES_ESP, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO_KQ7 },
 
+	// King's Quest 7 - Japanese DOS (from m-kiewitz) - bug #15497
+	// VERSION file reports "2.00"
+	// This version features only Japanese. There is no option to change the language.
+	// Chapter intro titles are still in English.
+	{"kq7", "", {
+		{"resource.000", 0, "5e2f38ebf13188d5724e02254bfe0e4d", 90064291},
+		{"resource.map", 0, "ba6a4523df6f5bd321bcfb8ae55a66c1", 19177},
+		{"resource.aud", 0, "78ba3c42efc9451baa5af1da8e289d4f", 220633894},
+		{"avi/91.rbt", 0, "cc68d78315156f2d6a71b2b00eca90ea", 24701699},
+		{"avi/911.rbt", 0, "10250547c9f0767df37f726f335c1415", 8781594},
+		{"avi/912.rbt", 0, "c4cbebcaa58f6ab364a40896502271e8", 1373456},
+		AD_LISTEND},
+		Common::JA_JPN, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO_KQ7 },
+
+	// King's Quest 7 - Japanese Windows (from m-kiewitz) - bug #15497
+	// VERSION file reports "2.00"
+	// This version features only Japanese. There is no option to change the language.
+	// Chapter intro titles are still in English.
+	{"kq7", "", {
+		{"resource.000", 0, "5e2f38ebf13188d5724e02254bfe0e4d", 90064291},
+		{"resource.map", 0, "ba6a4523df6f5bd321bcfb8ae55a66c1", 19177},
+		{"resource.aud", 0, "78ba3c42efc9451baa5af1da8e289d4f", 220633894},
+		{"avi/e208x11.avi", 0, "11b0f6994a6cea61ce4efe047c84553d", 2014412},
+		{"avi/int08x11.avi", 0, "1e3e1448901ebbaa88071740f1a1e31e", 22547356},
+		{"avi/e108x11.avi", 0, "8daba53eeb77756c434bf52237e39b3b", 9991834},
+		AD_LISTEND},
+		Common::JA_JPN, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO_KQ7 },
+
 	// King's Quest 7 - Russian Windows (SoftClub official translation)
 	// VERSION file reports "2.1b", provided by trcpman in Trac #11302.
 	// This version is Windows-only. It does not include a DOS interpreter and


Commit: 2ac2d854d9ce756e677c728befc29e22af2e0eb7
    https://github.com/scummvm/scummvm/commit/2ac2d854d9ce756e677c728befc29e22af2e0eb7
Author: athrxx (athrxx at scummvm.org)
Date: 2024-11-17T23:13:54+02:00

Commit Message:
SCUMM: fix invalid mem access (bug no. 15507)

Changed paths:
    engines/scumm/string.cpp
    engines/scumm/string_v7.cpp


diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index c3ec348aab4..b7edea54a92 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -450,7 +450,8 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
 			oldy = _charset->getFontHeight();
 			_charset->setCurID(*buffer++);
 			buffer += 2;
-			memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
+			if (_charset->getCurID() != -1)
+				memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
 			_nextTop -= _charset->getFontHeight() - oldy;
 			break;
 		default:
@@ -1016,7 +1017,7 @@ void ScummEngine::displayDialog() {
 	else
 		_charset->setCurID(_string[0].charset);
 
-	if (_game.version >= 5)
+	if (_game.version >= 5 && _charset->getCurID() != -1)
 		memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4);
 
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
@@ -1236,7 +1237,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
 	VirtScreen *vs = findVirtScreen(_charset->_top);
 	bool shadowModeFlag = (vs && vs->number == kMainVirtScreen);
 
-	if (_game.version >= 5)
+	if (_game.version >= 5 && _charset->getCurID() != -1)
 		memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], _game.id == GID_DIG ? sizeof(_charsetColorMap) : 4);
 
 	fontHeight = _charset->getFontHeight();
diff --git a/engines/scumm/string_v7.cpp b/engines/scumm/string_v7.cpp
index e463d4fbb13..6b6ac4199f0 100644
--- a/engines/scumm/string_v7.cpp
+++ b/engines/scumm/string_v7.cpp
@@ -466,7 +466,7 @@ void ScummEngine_v7::drawBlastTexts() {
 
 		_charset->setCurID(_blastTextQueue[i].charset);
 
-		if (_game.version == 7)
+		if (_game.version == 7 && _charset->getCurID() != -1)
 			memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], _game.id == GID_DIG ? sizeof(_charsetColorMap) : 4);
 
 		if (bt.flags & kStyleWordWrap) {
@@ -653,7 +653,7 @@ void ScummEngine_v7::displayDialog() {
 		_charset->_center = _string[0].center;
 	}
 
-	if (_game.version == 7)
+	if (_game.version == 7 && _charset->getCurID() != -1)
 		memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], _game.id == GID_DIG ? sizeof(_charsetColorMap) : 4);
 
 	if (usingOldSystem && a && a->_charset) {




More information about the Scummvm-git-logs mailing list