aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.common5
-rw-r--r--backends/midi/adlib.cpp4
-rw-r--r--backends/wince/screen.cpp2
-rw-r--r--backends/wince/smartphone.cpp2
-rw-r--r--common/engine.cpp43
-rw-r--r--common/engine.h6
-rw-r--r--common/gameDetector.cpp3
-rw-r--r--common/main.cpp2
-rwxr-xr-xdists/debian/prepare2
-rw-r--r--gui/console.cpp4
-rw-r--r--gui/launcher.cpp4
-rw-r--r--scumm/dialogs.cpp4
-rw-r--r--scumm/imuse.cpp28
13 files changed, 80 insertions, 29 deletions
diff --git a/Makefile.common b/Makefile.common
index e6d08c648d..9a74dc12f3 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -58,6 +58,11 @@ CPPFLAGS:= $(DEFINES) $(INCLUDES)
# Include the build instructions for all modules
-include $(addsuffix /module.mk,$(MODULES))
+# Make engine.o depend on all other object files. This way if anything is
+# changed, it causes engine.cpp to be recompiled. This in turn ensures that
+# the build date in gScummVMBuildDate is correct.
+common/engine.o: $(OBJS)
+
# HACK temporary fix to get compilation on OS X (and possibly others) working again
OBJS:=common/engine.o $(OBJS)
diff --git a/backends/midi/adlib.cpp b/backends/midi/adlib.cpp
index 9483c14b44..cbbeb59b7e 100644
--- a/backends/midi/adlib.cpp
+++ b/backends/midi/adlib.cpp
@@ -872,11 +872,11 @@ void MidiDriver_ADLIB::close() {
uint i;
for (i = 0; i < ARRAYSIZE(_voices); ++i) {
if (_voices [i]._part)
- mc_off (&_voices [i]);
+ mc_off(&_voices [i]);
}
// Detach the premix callback handler
- _mixer->setupPremix (0, 0);
+ _mixer->setupPremix(0, 0);
// Turn off the OPL emulation
// YM3812Shutdown();
diff --git a/backends/wince/screen.cpp b/backends/wince/screen.cpp
index a0459882f6..5432ecbbcb 100644
--- a/backends/wince/screen.cpp
+++ b/backends/wince/screen.cpp
@@ -819,7 +819,7 @@ void drawBlankGameSelection() {
void drawVideoDevice() {
char info[100];
- sprintf(info, "Video device : %s %s - CVS %s PPC %s", gfx_device_name[_gfx_device], gfx_device_options_name[_gfx_option], SCUMMVM_VERSION, getBuildDate());
+ sprintf(info, "Video device : %s %s - CVS %s PPC %s", gfx_device_name[_gfx_device], gfx_device_options_name[_gfx_option], gScummVMVersion, getBuildDate());
drawString(info, 10, 0, 2, 1);
/*
printString(video_device, 10, 270, 2, 0);
diff --git a/backends/wince/smartphone.cpp b/backends/wince/smartphone.cpp
index c20d6bce67..0f1c507004 100644
--- a/backends/wince/smartphone.cpp
+++ b/backends/wince/smartphone.cpp
@@ -653,7 +653,7 @@ void doPaint() {
DrawText(hDC, TEXT("http://www.scummvm.org"), -1, &rcClient, DT_CENTER | DT_SINGLELINE);
rcClient.left = 0;
rcClient.top = 90;
- DrawText(hDC, TEXT(SCUMMVM_VERSION), -1, &rcClient, DT_CENTER | DT_SINGLELINE);
+ DrawText(hDC, TEXT(gScummVMVersion), -1, &rcClient, DT_CENTER | DT_SINGLELINE);
rcClient.left = 0;
rcClient.top = 110;
DrawText(hDC, TEXT("http://arisme.free.fr"), -1, &rcClient, DT_CENTER | DT_SINGLELINE);
diff --git a/common/engine.cpp b/common/engine.cpp
index b00a3594b3..0600f3a0d8 100644
--- a/common/engine.cpp
+++ b/common/engine.cpp
@@ -25,6 +25,49 @@
#include "timer.h"
#include "sound/mixer.h"
+/*
+ * Version string and build date string. These can be used by anything that
+ * wants to display this information to the user (e.g. about dialog).
+ *
+ * Note: it would be very nice if we could instead of (or in addition to) the
+ * build date present a date which corresponds to the date our source files
+ * were last changed. To understand the difference, imagine that a user
+ * makes a checkout of CVS on January 1, then after a week compiles it
+ * (e.g. after doing a 'make clean'). The build date then will say January 8
+ * even though the files were last changed on January 1.
+ *
+ * Another problem is that __DATE__/__TIME__ depend on the local time zone.
+ *
+ * It's clear that such a "last changed" date would be much more useful to us
+ * for feedback purposes. After all, when somebody files a bug report, we
+ * don't care about the build date, we want to know which date their checkout
+ * was made. This is even more important now since anon CVS lags a few
+ * days behind developer CVS.
+ *
+ * So, how could we implement this? At least on unix systems, a special script
+ * could do it. Basically, that script would run over all .cpp/.h files and
+ * parse the CVS 'Header' keyword we have in our file headers.
+ * That line contains a date/time in GMT. Now, the script just has to collect
+ * all these times and find the latest. This time then would be inserted into
+ * a header file or so (common/date.h ?) which engine.cpp then could
+ * include and put into a global variable analog to gScummVMBuildDate.
+ *
+ * Drawback: scanning all source/header files will be rather slow. Also, this
+ * only works on systems which can run powerful enough scripts (so I guess
+ * Visual C++ would be out of the game here? don't know VC enough to be sure).
+ *
+ * Another approach would be to somehow get CVS to update a global file
+ * (e.g. LAST_CHANGED) whenever any checkins are made. That would be
+ * faster and work w/o much "logic" on the client side, in particular no
+ * scripts have to be run. The problem with this is that I am not even
+ * sure it's actually possible! Modifying files during commit time is trivial
+ * to setup, but I have no idea if/how one can also change files which are not
+ * currently being commit'ed.
+ */
+const char *gScummVMVersion = "0.5.0pre-cvs";
+const char *gScummVMBuildDate = __DATE__ " " __TIME__;
+const char *gScummVMFullVersion = "ScummVM 0.5.0pre-cvs (" __DATE__ " " __TIME__ ")";
+
/* FIXME - BIG HACK for MidiEmu */
OSystem *g_system = 0;
SoundMixer *g_mixer = 0;
diff --git a/common/engine.h b/common/engine.h
index 462de8180c..f9d7fb9902 100644
--- a/common/engine.h
+++ b/common/engine.h
@@ -24,9 +24,9 @@
#include "scummsys.h"
#include "system.h"
-#define SCUMMVM_VERSION "0.5.0pre-cvs"
-#define SCUMMVM_CVS "2003-07-xx"
-
+extern const char *gScummVMVersion; // e.g. "0.4.1"
+extern const char *gScummVMBuildDate; // e.g. "2003-06-24"
+extern const char *gScummVMFullVersion; // e.g. "ScummVM 0.4.1 (2003-06-24)"
enum GameId {
GID_SCUMM_FIRST = 1,
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 88c9db6023..feef3aa2dc 100644
--- a/common/gameDetector.cpp
+++ b/common/gameDetector.cpp
@@ -437,8 +437,7 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
break;
case 'v':
CHECK_OPTION();
- printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " "
- __TIME__ "\n");
+ printf("%s\n", gScummVMFullVersion);
exit(1);
case 'w':
_saveconfig = true;
diff --git a/common/main.cpp b/common/main.cpp
index 07a93a46a3..ef5b2fe1a0 100644
--- a/common/main.cpp
+++ b/common/main.cpp
@@ -178,7 +178,7 @@ int main(int argc, char *argv[]) {
// Read the config file
g_config = new Config(scummhome, "scummvm");
- g_config->set("versioninfo", SCUMMVM_VERSION);
+ g_config->set("versioninfo", gScummVMVersion);
// Parse the command line information
detector._saveconfig = false;
diff --git a/dists/debian/prepare b/dists/debian/prepare
index dbf8a93abc..64d64db47c 100755
--- a/dists/debian/prepare
+++ b/dists/debian/prepare
@@ -1,5 +1,5 @@
#! /bin/sh
-VER=`sed -n -e 's/ CVS//' -e 's/^#define SCUMMVM_VERSION "\(.*\)"/\1/p' common/engine.h``date +%Y%m%d`
+VER=`sed -n -e 's/ CVS//' -e 's/^const char \*gScummVMVersion = "\(.*\)"/\1/p' common/engine.cpp``date +%Y%m%d`
sed "s/@VERSION@/$VER/g" debian/changelog.in > debian/changelog
diff --git a/gui/console.cpp b/gui/console.cpp
index c52c54a823..48a370c82c 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -66,8 +66,8 @@ ConsoleDialog::ConsoleDialog(NewGui *gui, int _realWidth)
_scrollBar->setTarget(this);
// Display greetings & prompt
- print("ScummVM "SCUMMVM_VERSION" (" SCUMMVM_CVS ")\n");
- print("Console is ready\n");
+ print(gScummVMFullVersion);
+ print("\nConsole is ready\n");
_promptStartPos = _promptEndPos = -1;
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index f25f383377..af821404f5 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -175,9 +175,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector)
: Dialog(gui, 0, 0, 320, 200), _detector(detector) {
// Show game name
- new StaticTextWidget(this, 10, 8, 300, kLineHeight,
- "ScummVM "SCUMMVM_VERSION " (" SCUMMVM_CVS ")",
- kTextAlignCenter);
+ new StaticTextWidget(this, 10, 8, 300, kLineHeight, gScummVMFullVersion, kTextAlignCenter);
// Add three buttons at the bottom
addButton(1 * (_w - kButtonWidth) / 6, _h - 24, "Quit", kQuitCmd, 'Q');
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index b6b7c1c1be..08a6babf33 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -580,8 +580,8 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
AboutDialog::AboutDialog(NewGui *gui, Scumm *scumm)
: ScummDialog(gui, scumm, 30, 20, 260, 124) {
addButton((_w - kButtonWidth)/2, 100, queryCustomString(23), kCloseCmd, 'C'); // Close dialog - FIXME
- new StaticTextWidget(this, 10, 10, 240, 16, "ScummVM " SCUMMVM_VERSION " (" SCUMMVM_CVS ")", kTextAlignCenter);
- new StaticTextWidget(this, 10, 20, 240, 16, "(built on " __DATE__ ")", kTextAlignCenter);
+ new StaticTextWidget(this, 10, 10, 240, 16, gScummVMFullVersion, kTextAlignCenter);
+// new StaticTextWidget(this, 10, 20, 240, 16, "(built on " __DATE__ ")", kTextAlignCenter);
new StaticTextWidget(this, 10, 30, 240, 16, "http://www.scummvm.org", kTextAlignCenter);
new StaticTextWidget(this, 10, 50, 240, 16, "SCUMM Games (c) LucasArts", kTextAlignCenter);
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index cacf2048bc..00721d01f9 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -1104,32 +1104,38 @@ int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi) {
void IMuseInternal::initMidiDriver (MidiDriver *midi) {
// Open MIDI driver
- midi->property (MidiDriver::PROP_OLD_ADLIB, _old_adlib_instruments ? 1 : 0);
+ midi->property(MidiDriver::PROP_OLD_ADLIB, _old_adlib_instruments ? 1 : 0);
int result = midi->open();
if (result)
error("IMuse initialization - %s", MidiDriver::getErrorName(result));
// In case we have an MT-32 attached.
- initMT32 (midi);
+ initMT32(midi);
// Connect to the driver's timer
- midi->setTimerCallback (midi, &IMuseInternal::midiTimerCallback);
+ midi->setTimerCallback(midi, &IMuseInternal::midiTimerCallback);
}
void IMuseInternal::initMT32 (MidiDriver *midi) {
byte buffer[32] = "\x41\x10\x16\x12\x00\x00\x00 ";
+ char info[256] = "ScummVM ";
+ int len;
+
+ // Compute version string (truncated to 20 chars max.)
+ strcat(info, gScummVMVersion);
+ len = strlen(info);
+ if (len > 20)
+ len = 20;
// Reset the MT-32
- memcpy (&buffer[4], "\x7f\x00\x00\x01\x00", 5);
- midi->sysEx (buffer, 9);
+ memcpy(&buffer[4], "\x7f\x00\x00\x01\x00", 5);
+ midi->sysEx(buffer, 9);
// Display a welcome message on MT-32 displays.
- memcpy (&buffer[4], "\x20\x00\x00", 3);
- memcpy (&buffer[7], " ", 20);
- memcpy (buffer + 7 + (20 - strlen ("ScummVM " SCUMMVM_VERSION)) / 2,
- "ScummVM " SCUMMVM_VERSION,
- strlen ("ScummVM " SCUMMVM_VERSION));
+ memcpy(&buffer[4], "\x20\x00\x00", 3);
+ memcpy(&buffer[7], " ", 20);
+ memcpy(buffer + 7 + (20 - len) / 2, info, len);
byte checksum = 0;
for (int i = 4; i < 27; ++i)
checksum -= buffer[i];
@@ -1163,7 +1169,7 @@ void IMuseInternal::handleDeferredCommands (MidiDriver *midi) {
if (!ptr->time_left)
continue;
if (ptr->time_left <= advance) {
- doCommand (ptr->a, ptr->b, ptr->c, ptr->d, ptr->e, ptr->f, 0, 0);
+ doCommand(ptr->a, ptr->b, ptr->c, ptr->d, ptr->e, ptr->f, 0, 0);
ptr->time_left = advance;
}
ptr->time_left -= advance;