Metal Gear
0 of 0

File information

Last updated

Original upload

Created by

Kaz

Uploaded by

kazzublox

Virus scan

Safe to use

Tags for this mod

About this mod

Fixes the loop in the ending music being cut off early.

Permissions and credits
The music loop table in GOG.com's release of Metal Gear is calculated through the following code in the executable:
#define NUM_SAMPLES 23976 // 48000 Hz stereo
#define NUM_CHANNELS 2
#define BITS 32
#define CALC_SECONDS(sec) (DWORD)((NUM_SAMPLES * NUM_CHANNELS * (BITS / 8)) * sec)

struct BGMLoop {
DWORD start; // where the loop starts
DWORD end; // where the loop ends, and repeats (going back to start time)
};

const BGMLoop gBGMLoopTable[BGM_MAX_COUNT] = {
{ 0x0,                    0xFFFFFFFF              },
{ 0x0,                    0xFFFFFFFF              },
{ 0x0,                    CALC_SECONDS(38.71772)  },
{ CALC_SECONDS(7.482485), CALC_SECONDS(100.28829) },
{ 0x0,                    CALC_SECONDS(31.233234) },
{ CALC_SECONDS(3.20921),  CALC_SECONDS(19.212213) },
{ 0x0,                    0xFFFFFFFF              },
{ 0x0,                    CALC_SECONDS(12.873874) },
{ CALC_SECONDS(1.33834),  CALC_SECONDS(33.374375) },
{ CALC_SECONDS(9.353354), CALC_SECONDS(29.906657) },
{ 0x0,                    0xFFFFFFFF              }, // five unused BGM entries!
{ 0x0,                    0xFFFFFFFF              },
{ 0x0,                    0xFFFFFFFF              },
{ 0x0,                    0xFFFFFFFF              },
{ 0x0,                    0xFFFFFFFF              }
};

As you can see, when the ending music plays, the music cuts off early; THIS is why:
{ CALC_SECONDS(9.353354), CALC_SECONDS(29.906657) },
It literally is set to loop very earlier than intended! Why? Who knows. This is easily fixable by simply altering the end value to a more proper time, and the patch aims to do just that for user convenience. NOTE: is in xdelta format.

Required EXE SHA1 hashes: 1589D48438D14FC4191DE867AFCDE332153FB8DD (original EXE) or 4357D7ED77D8FDB23DE0C881E8F77DE796A8E430 (hotfix update EXE, use the alternate patch.)