[Scummvm-cvs-logs] CVS: tools compress_saga.c,NONE,1.1 compress_simon.c,NONE,1.1 compress_sword1.c,NONE,1.1 compress_sword2.c,NONE,1.1 .cvsignore,1.12,1.13 Makefile,1.42,1.43 Makefile.mingw,1.21,1.22 README,1.28,1.29 extract.h,1.15,1.16 saga2mp3.c,1.5,NONE simon2mp3.c,1.35,NONE sword1mp3.c,1.4,NONE sword2mp3.c,1.3,NONE
Max Horn
fingolfin at users.sourceforge.net
Thu Dec 23 17:18:10 CET 2004
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27990
Modified Files:
.cvsignore Makefile Makefile.mingw README extract.h
Added Files:
compress_saga.c compress_simon.c compress_sword1.c
compress_sword2.c
Removed Files:
saga2mp3.c simon2mp3.c sword1mp3.c sword2mp3.c
Log Message:
Started to rename our tools to be more consistent
--- NEW FILE: compress_saga.c ---
/* compress_saga - Compress SAGA engine digital sound files into
* MP3 and Ogg Vorbis format
* Copyright (C) 2004, Marcoen Hirschberg
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/tools/compress_saga.c,v 1.1 2004/12/24 01:16:52 fingolfin Exp $
*
*/
#include <stdio.h>
#include "extract.h"
typedef struct RECORD {
uint32 offset;
uint32 size;
} RECORD;
static CompressMode gCompMode = kMP3Mode;
#define RSC_TABLEINFO_SIZE 8
#define RSC_TABLEENTRY_SIZE 8
void sagaEncode(char *infile) {
FILE *res_file;
FILE *outputfile;
uint32 res_tbl_ct;
uint32 res_tbl_offset;
uint32 res_size;
uint32 outtable_offset;
uint32 t;
struct RECORD *table;
struct RECORD *outtable;
int length;
FILE *tempf;
char fbuf[2048];
const char *output;
size_t size;
bool audio;
char buf[8];
res_file = fopen(infile, "rb");
res_size = fileSize(res_file);
printf("filesize: %ul\n", res_size);
/*
* At the end of the resource file there are 2 values: one points to the
* beginning of the resource table the other gives the number of
* records in the table
*/
fseek(res_file, res_size - RSC_TABLEINFO_SIZE, SEEK_SET);
res_tbl_offset = readUint32LE(res_file);
res_tbl_ct = readUint32LE(res_file);
printf("tabel offset: %ul\nnumber of records: %ul\n", res_tbl_offset, res_tbl_ct);
if (res_tbl_offset != res_size - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * res_tbl_ct) {
printf("Something's wrong with your resource file..\n");
exit(2);
}
/* Go to beginning of the table */
fseek(res_file, res_tbl_offset, SEEK_SET);
table = malloc(res_tbl_ct * sizeof(struct RECORD));
outtable = malloc(res_tbl_ct * sizeof(struct RECORD));
/* Put offsets of all the records in a table */
for (t = 0; t < res_tbl_ct; t++) {
table[t].offset = readUint32LE(res_file);
table[t].size = readUint32LE(res_file);
printf("record: %ul, offset: %ul, size: %ul\n", t, table[t].offset, table[t].size);
if ((table[t].offset > res_size) ||
(table[t].size > res_size)) {
printf("The offset points outside the file!");
exit(2);
}
}
outputfile = fopen("out.res", "wb");
for (t = 0; t < res_tbl_ct; t++) {
audio = 0;
fseek(res_file, table[t].offset, SEEK_SET);
fread(buf, 1, 8, res_file);
if (memcmp(buf, "RIFF", 4) == 0) {
printf("Wave file: ");
audio = -1;
} else if (memcmp(buf, "FORM", 4) == 0) {
printf("XMIDI file: ");
} else if (memcmp(buf, "Ogg", 3) == 0) {
printf("Ogg file: ");
} else {
printf("unknown file: ");
}
length = table[t].size;
fseek(res_file, table[t].offset, SEEK_SET);
/* Copy the WAV data to a temporary file */
tempf = fopen(TEMP_WAV, "wb");
while (length > 0) {
size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : length, res_file);
if (size <= 0)
break;
length -= size;
fwrite(fbuf, 1, size, tempf);
}
fclose(tempf);
if (audio) {
/* Convert the WAV temp file to OGG/MP3 */
encodeAudio(TEMP_WAV, false, -1, tempEncoded, gCompMode);
output = tempEncoded;
} else {
output = TEMP_WAV;
}
tempf = fopen(output, "rb");
outtable[t].offset = ftell(outputfile);
printf("Offset: %ul, ", outtable[t].offset);
while ((size = fread(fbuf, 1, 2048, tempf)) > 0) {
fwrite(fbuf, 1, size, outputfile);
}
outtable[t].size = ftell(tempf);
printf("Size: %ul\n", outtable[t].size);
fclose(tempf);
}
outtable_offset = ftell(outputfile);
for (t = 0; t < res_tbl_ct; t++) {
writeUint32LE(outputfile, outtable[t].offset);
writeUint32LE(outputfile, outtable[t].size);
}
writeUint32LE(outputfile, outtable_offset);
writeUint32LE(outputfile, res_tbl_ct); /* Should be the same number of entries */
fclose(outputfile);
free(table);
free(outtable);
fclose(res_file);
printf("Done!\n");
}
void showhelp(char *exename) {
printf("\nUsage: %s <params> [<file> | mac]\n", exename);
printf("\nParams:\n");
printf("--mp3 encode to MP3 format (default)\n");
printf("--vorbis encode to Vorbis format\n");
printf("--flac encode to Flac format\n");
printf("(If one of these is specified, it must be the first parameter.)\n");
printf("\nMP3 mode params:\n");
printf("-b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%i)\n", minBitrDef);
printf("-B <rate> <rate> is the maximum VBR/ABR bitrate (default:%i)\n", maxBitrDef);
printf("--vbr LAME uses the VBR mode (default)\n");
printf("--abr LAME uses the ABR mode\n");
printf("-V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:%i)\n", vbrqualDef);
printf("-q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:%i)\n", algqualDef);
printf("--silent the output of LAME is hidden (default:disabled)\n");
printf("\nVorbis mode params:\n");
printf("-b <rate> <rate> is the nominal bitrate (default:unset)\n");
printf("-m <rate> <rate> is the minimum bitrate (default:unset)\n");
printf("-M <rate> <rate> is the maximum bitrate (default:unset)\n");
printf("-q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:%i)\n", oggqualDef);
printf("--silent the output of oggenc is hidden (default:disabled)\n");
printf("\nFlac mode params:\n");
printf("[params] optional Arguments passed to the Encoder\n");
printf(" recommended is: --best -b 1152\n");
printf("\n--help this help message\n");
printf("\n\nIf a parameter is not given the default value is used\n");
printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n");
exit(2);
}
int main(int argc, char *argv[]) {
int i;
if (argc < 2)
showhelp(argv[0]);
/* compression mode */
gCompMode = kMP3Mode;
i = 1;
if (strcmp(argv[1], "--mp3") == 0) {
gCompMode = kMP3Mode;
i++;
} else if (strcmp(argv[1], "--vorbis") == 0) {
gCompMode = kVorbisMode;
i++;
} else if (strcmp(argv[1], "--flac") == 0) {
gCompMode = kFlacMode;
i++;
}
switch (gCompMode) {
case kMP3Mode:
tempEncoded = TEMP_MP3;
process_mp3_parms(argc, argv, i);
break;
case kVorbisMode:
tempEncoded = TEMP_OGG;
process_ogg_parms(argc, argv, i);
break;
case kFlacMode:
tempEncoded = TEMP_FLAC;
process_flac_parms(argc, argv, i);
break;
}
i = argc - 1;
sagaEncode(argv[i]);
return (0);
}
--- NEW FILE: compress_simon.c ---
/* compress_simon - Compress Simon the Sorcerer 1/2 digital sound files into MP3-format
* Copyright (C) 2002, 2003 The ScummVM Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/tools/compress_simon.c,v 1.1 2004/12/24 01:16:52 fingolfin Exp $
*
*/
#include "extract.h"
static FILE *input, *output_idx, *output_snd;
static CompressMode gCompMode = kMP3Mode;
static char infile_base[256];
static void end(void)
{
int size;
char fbuf[2048];
char tmp[256];
const char *head;
switch (gCompMode) {
case kMP3Mode:
head = "mp3"; break;
case kVorbisMode:
head = "ogg"; break;
case kFlacMode:
head = "fla"; break;
default:
error("Unknown compression mode");
}
fclose(output_snd);
fclose(output_idx);
fclose(input);
sprintf(tmp, "%s%s", infile_base, head);
output_idx = fopen(tmp, "wb");
sprintf(tmp, "%sidx", infile_base);
input = fopen(tmp, "rb");
while ((size = fread(fbuf, 1, 2048, input)) > 0) {
fwrite(fbuf, 1, size, output_idx);
}
fclose(input);
sprintf(tmp, "%sdat", infile_base);
input = fopen(tmp, "rb");
while ((size = fread(fbuf, 1, 2048, input)) > 0) {
fwrite(fbuf, 1, size, output_idx);
}
fclose(input);
fclose(output_idx);
/* And some clean-up :-) */
sprintf(tmp, "%sidx", infile_base);
unlink(tmp);
sprintf(tmp, "%sdat", infile_base);
unlink(tmp);
unlink(TEMP_RAW);
unlink(tempEncoded);
unlink(TEMP_WAV);
exit(0);
}
static int get_offsets(uint32 filenums[], uint32 offsets[])
{
int i;
char buf[8];
for (i = 0;; i++) {
fread(buf, 1, 8, input);
if (!memcmp(buf, "Creative", 8) || !memcmp(buf, "RIFF", 4)) {
return i;
}
fseek(input, -8, SEEK_CUR);
offsets[i] = readUint32LE(input);
}
}
static int get_offsets_mac(uint32 filenums[], uint32 offsets[])
{
int i, size;
fseek(input, 0, SEEK_END);
size = ftell(input);
fseek(input, 0, SEEK_SET);
for (i = 1; i <= size / 6; i++) {
filenums[i] = readUint16BE(input);
offsets[i] = readUint32BE(input);
}
return(size/6);
}
static uint32 get_sound(uint32 offset)
{
FILE *f;
uint32 tot_size;
char outname[256];
int size;
char fbuf[2048];
char buf[8];
fseek(input, offset, SEEK_SET);
fread(buf, 1, 8, input);
if (!memcmp(buf, "Creative", 8)) {
printf("VOC found (pos = %d) :\n", offset);
fseek(input, 18, SEEK_CUR);
extractAndEncodeVOC(TEMP_RAW, input, gCompMode);
} else if (!memcmp(buf, "RIFF", 4)) {
printf("WAV found (pos = %d) :\n", offset);
extractAndEncodeWAV(TEMP_WAV, input, gCompMode);
} else {
error("Unexpected data at offset: %i", offset);
}
/* Append the converted data to the master output file */
sprintf(outname, tempEncoded);
f = fopen(outname, "rb");
tot_size = 0;
while ((size = fread(fbuf, 1, 2048, f)) > 0) {
tot_size += size;
fwrite(fbuf, 1, size, output_snd);
}
fclose(f);
return(tot_size);
}
void showhelp(char *exename)
{
printf("\nUsage: %s <params> [<file> | mac]\n", exename);
printf("\nParams:\n");
printf(" --mp3 encode to MP3 format (default)\n");
printf(" --vorbis encode to Vorbis format\n");
printf(" --flac encode to Flac format\n");
printf("(If one of these is specified, it must be the first parameter.)\n");
printf("\nMP3 mode params:\n");
printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%i)\n", minBitrDef);
printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%i)\n", maxBitrDef);
printf(" --vbr LAME uses the VBR mode (default)\n");
printf(" --abr LAME uses the ABR mode\n");
printf(" -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:%i)\n", vbrqualDef);
printf(" -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:%i)\n", algqualDef);
printf(" --silent the output of LAME is hidden (default:disabled)\n");
printf("\nVorbis mode params:\n");
printf(" -b <rate> <rate> is the nominal bitrate (default:unset)\n");
printf(" -m <rate> <rate> is the minimum bitrate (default:unset)\n");
printf(" -M <rate> <rate> is the maximum bitrate (default:unset)\n");
printf(" -q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:%i)\n", oggqualDef);
printf(" --silent the output of oggenc is hidden (default:disabled)\n");
printf("\nFlac mode params:\n");
printf(" [params] optional arguments passed directly to the encoder\n");
printf(" recommended is: --best -b 1152\n");
printf("\n --help this help message\n");
printf("\n\nIf a parameter is not given the default value is used\n");
printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n");
printf("Use the `mac' option instead of a filename if converting simon2mac sounds\n");
exit(2);
}
static void convert_pc(char *infile)
{
int i, n, size, num;
char tmp[256];
uint32 filenums[32768];
uint32 offsets[32768];
memccpy(infile_base, infile, '.', strlen(infile));
n = strlen(infile_base);
if (infile_base[n-1] == '.')
infile_base[n] = '\0';
else {
infile_base[n] = '.';
infile_base[n + 1] = '\0';
}
input = fopen(infile, "rb");
if (!input) {
printf("Cannot open file: %s\n", infile);
exit(-1);
}
sprintf(tmp, "%sidx", infile_base);
output_idx = fopen(tmp, "wb");
sprintf(tmp, "%sdat", infile_base);
output_snd = fopen(tmp, "wb");
num = get_offsets(filenums, offsets);
if (!num) {
printf("This does not seem to be a valid file\n");
exit(-1);
}
size = num*4;
writeUint32LE(output_idx, 0);
writeUint32LE(output_idx, size);
for (i = 1; i < num; i++) {
if (offsets[i] == offsets[i+1]) {
writeUint32LE(output_idx, size);
continue;
}
size += get_sound(offsets[i]);
if (i < num - 1)
writeUint32LE(output_idx, size);
}
}
static void convert_mac(void)
{
int i, size, num;
char tmp[256];
uint32 filenums[32768];
uint32 offsets[32768];
sprintf(infile_base, "simon2.");
input = fopen("voices.idx", "rb");
if (!input) {
printf("Cannot open file: %s\n", "voices.idx");
exit(-1);
}
sprintf(tmp, "%sidx", infile_base);
output_idx = fopen(tmp, "wb");
sprintf(tmp, "%sdat", infile_base);
output_snd = fopen(tmp, "wb");
num = get_offsets_mac(filenums, offsets);
if (!num) {
printf("This does not seem to be a valid file\n");
exit(-1);
}
size = num*4;
writeUint32LE(output_idx, 0);
writeUint32LE(output_idx, size);
for (i = 1; i < num; i++) {
if (filenums[i] == filenums[i+1] && offsets[i] == offsets[i+1]) {
writeUint32LE(output_idx, size);
continue;
}
if (filenums[i] != filenums[i-1]) {
sprintf(tmp, "voices%d.dat", filenums[i]);
if (input)
fclose(input);
input = fopen(tmp, "rb");
if (!input) {
printf("Cannot open file: %s\n", tmp);
exit(-1);
}
}
size += get_sound(offsets[i]);
if (i < num - 1)
writeUint32LE(output_idx, size);
}
}
int main(int argc, char *argv[])
{
int i;
if (argc < 2)
showhelp(argv[0]);
/* compression mode */
gCompMode = kMP3Mode;
i = 1;
if (strcmp(argv[1], "--mp3") == 0) {
gCompMode = kMP3Mode;
i++;
}
else if (strcmp(argv[1], "--vorbis") == 0) {
gCompMode = kVorbisMode;
i++;
}
else if (strcmp(argv[1], "--flac") == 0) {
gCompMode = kFlacMode;
i++;
}
switch (gCompMode) {
case kMP3Mode:
tempEncoded = TEMP_MP3;
process_mp3_parms(argc, argv, i);
break;
case kVorbisMode:
tempEncoded = TEMP_OGG;
process_ogg_parms(argc, argv, i);
break;
case kFlacMode:
tempEncoded = TEMP_FLAC;
process_flac_parms(argc, argv, i);
break;
}
i = argc - 1;
if (strcmp(argv[i], "mac") == 0) {
convert_mac();
} else {
convert_pc(argv[i]);
}
end();
return(0);
}
--- NEW FILE: compress_sword1.c ---
/* Scumm Tools
* Copyright (C) 2003 The ScummVM Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/tools/compress_sword1.c,v 1.1 2004/12/24 01:16:52 fingolfin Exp $
*
*/
#include "extract.h"
#define READ_BE_UINT32(x) \
((((uint8*)(x))[0] << 24) | (((uint8*)(x))[1] << 16) | (((uint8*)(x))[2] << 8) | (((uint8*)(x))[3] << 0))
#define TOTAL_TUNES 269
char tempOutName[16];
typedef struct {
char fileName[8];
bool missing; /* Some of the music files seem to have been removed from the game. */
/* Try and look for them, but don't warn if they are missing. */
} MusicFile;
MusicFile musicNames[TOTAL_TUNES] = {
{ "1M2", false },
{ "1M3", false },
{ "1M4", false },
{ "1M6", false },
{ "1M7", false },
{ "1M8", false },
{ "1M9", false },
{ "1M10", false },
{ "1M11", false },
{ "1M12", false },
{ "1M13", false },
{ "1M14", false },
{ "1M15", false },
{ "1M16", false },
{ "1M17", false },
{ "1M18", false },
{ "1M19", false },
{ "1M20", false },
{ "1M21", false },
{ "1M22", false },
{ "1M23", false },
{ "1M24", false },
{ "1M25", false },
{ "1M26", false },
{ "1M27", false },
{ "1M28", false },
{ "1M29", false },
{ "1M28A", false },
{ "1M30", false },
{ "1M31", false },
{ "1M32", false },
{ "1M34", false },
{ "1M35", false },
{ "2M1", false },
{ "2M2", false },
{ "2M4", false },
{ "2M5", false },
{ "2M6", false },
{ "2M7", false },
{ "2M8", false },
{ "2M9", false },
{ "2M10", false },
{ "2M11", false },
{ "2M12", false },
{ "2M13", false },
{ "2M14", false },
{ "2M15", false },
{ "2M16", false },
{ "2M17", false },
{ "2M18", false },
{ "2M19", false },
{ "2M20", false },
{ "2M21", false },
{ "2M22", false },
{ "2M23", false },
{ "2M24", false },
{ "2M25", false },
{ "2M26", false },
{ "2M27", false },
{ "2M28", false },
{ "2M29", false },
{ "2M30", false },
{ "2M31", false },
{ "2M32", false },
{ "2M33", false },
{ "1M28", false },
{ "2M24", false },
{ "2M6", false },
{ "1M25", false },
{ "2M38", false },
{ "2M39", false },
{ "2M40", false },
{ "3M1", false },
{ "3M2", false },
{ "3M3", false },
{ "3M4", false },
{ "1M28", false },
{ "2M26", false },
{ "3M7", false },
{ "3M8", false },
{ "3M9", true },
{ "3M10", false },
{ "2M13", false },
{ "3M12", false },
{ "3M13", false },
{ "3M14", false },
{ "2M9", false },
{ "3M17", false },
{ "3M18", false },
{ "3M19", false },
{ "3M20", false },
{ "3M21", false },
{ "3M22", false },
{ "3M24", false },
{ "3M26", false },
{ "3M27", false },
{ "2M26", false },
{ "3M29", false },
{ "3M30", false },
{ "3M32", false },
{ "3M33", false },
{ "2M13", false },
{ "4M3", false },
{ "4M4", false },
{ "4M5", false },
{ "4M6", false },
{ "4M8", false },
{ "4M9", false },
{ "4M10", false },
{ "4M11", false },
{ "4M12", false },
{ "4M13", false },
{ "4M14", false },
{ "4M15", false },
{ "4M17", false },
{ "4M18", false },
{ "4M19", false },
{ "4M20", false },
{ "4M21", false },
{ "4M22", false },
{ "4M24", false },
{ "4M25", false },
{ "4M28", false },
{ "4M29", false },
{ "4M31", false },
{ "4M32", false },
{ "5M1", false },
{ "5M2", true },
{ "5M3", false },
{ "5M4", false },
{ "5M5", false },
{ "5M6", false },
{ "5M8", false },
{ "5M9", false },
{ "5M10", false },
{ "5M11", false },
{ "5M12", false },
{ "5M13", false },
{ "5M14", false },
{ "5M17", false },
{ "5M22", true },
{ "5M23", false },
{ "5M24", false },
{ "2M3", false },
{ "6M1", false },
{ "6M2", false },
{ "6M3", false },
{ "6M4", false },
{ "6M5", false },
{ "6M6", false },
{ "6M7", false },
{ "6M8", false },
{ "6M12", true },
{ "2M6", false },
{ "5M1", false },
{ "6M15", false },
{ "7M1", false },
{ "7M2", false },
{ "7M4", false },
{ "7M5", false },
{ "7M6", false },
{ "7M7", false },
{ "7M8", false },
{ "7M11", false },
{ "7M14", false },
{ "7M15", false },
{ "5M18", false },
{ "6M11", false },
{ "7M17", false },
{ "7M18", false },
{ "7M19", false },
{ "7M20", false },
{ "7M21", false },
{ "7M22", false },
{ "7M23", false },
{ "7M28", false },
{ "7M30", false },
{ "7M31", false },
{ "7M32", false },
{ "7M33", false },
{ "7M34", false },
{ "8M1", false },
{ "8M2", false },
{ "8M4", false },
{ "8M7", false },
{ "8M10", false },
{ "8M11", false },
{ "8M12", false },
{ "8M13", false },
{ "8M14", false },
{ "8M15", false },
{ "8M16", false },
{ "8M18", false },
{ "8M19", false },
{ "8M20", false },
{ "8M21", false },
{ "8M22", false },
{ "8M24", false },
{ "8M26", false },
{ "8M28", false },
{ "8M29", false },
{ "8M30", false },
{ "8M31", false },
{ "8M37", true },
{ "8M38", false },
{ "8M39", false },
{ "8M40", false },
{ "8M41", false },
{ "9M1", false },
{ "9M2", false },
{ "9M3", false },
{ "9M5", false },
{ "9M6", false },
{ "9M7", false },
{ "9M8", false },
{ "9M9", false },
{ "9M10", false },
{ "9M11", false },
{ "9M13", false },
{ "9M14", false },
{ "9M15", false },
{ "9M17", false },
{ "9M18", false },
{ "9M19", false },
{ "9M20", false },
{ "9M21", false },
{ "9M22", false },
{ "9M23", false },
{ "9M24", false },
{ "9M25", false },
{ "10M1", false },
{ "10M2", false },
{ "10M3", false },
{ "10M4", false },
{ "11M1", false },
{ "11M3", false },
{ "11M4", false },
{ "11M7", false },
{ "11M8", false },
{ "11M9", true },
{ "12M1", false },
{ "11M2", false },
{ "SPM2", false },
{ "SPM3", false },
{ "SPM4", false },
{ "SPM5", false },
{ "SPM6", false },
{ "SCM1", false },
{ "SCM2", false },
{ "SCM3", false },
{ "SCM4", false },
{ "SCM5", false },
{ "SCM6", false },
{ "SCM7", false },
{ "SCM8", false },
{ "SCM11", false },
{ "RM3A", false },
{ "RM3B", false },
{ "SCM16", false },
{ "SCM1B", false },
{ "SPM6B", false },
{ "MARQUET", false },
{ "RM4", false },
{ "RM5", false },
{ "RM6", false },
{ "RM7", false },
{ "RM8", false },
{ "RM3C", false },
{ "RM3D", false }
};
void showhelp(char *exename) {
printf("\nUsage: %s <params>\n", exename);
printf("\nParams:\n");
printf(" --mp3 encode to MP3 format (default)\n");
printf(" --vorbis encode to Vorbis format\n");
printf(" --speech-only only encode speech clusters\n");
printf(" --music-only only encode music files\n");
printf(" (default: encode both)\n");
printf("(The above parameters have to be specified first)\n");
printf("\nMP3 mode params:\n");
printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR)\n");
printf(" (default:%i)\n", minBitrDef);
printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%i)\n", maxBitrDef);
printf(" --vbr LAME uses the VBR mode (default)\n");
printf(" --abr LAME uses the ABR mode\n");
printf(" -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:%i)\n", vbrqualDef);
printf(" -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:%i)\n", algqualDef);
printf(" --silent the output of LAME is hidden (default:disabled)\n");
printf("\nVorbis mode params:\n");
printf(" -b <rate> <rate> is the nominal bitrate (default:unset)\n");
printf(" -m <rate> <rate> is the minimum bitrate (default:unset)\n");
printf(" -M <rate> <rate> is the maximum bitrate (default:unset)\n");
printf(" -q <value> specifies the value (0 - 10) of VBR quality (10=best)\n");
printf(" (default:%i)\n", oggqualDef);
printf(" --silent the output of oggenc is hidden (default:disabled)\n");
printf("\n --help this help message\n");
printf("\nIf a parameter is not given the default value is used\n");
printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n");
printf("\nPlease run this tool from your BS1 main directory.\n");
printf("(The one with the subdirectories \"MUSIC\" and \"SPEECH\")\n");
exit(2);
}
int16 *uncompressSpeech(FILE *clu, uint32 idx, uint32 cSize, uint32 *returnSize) {
uint32 resSize, srcPos;
int16 *srcData, *dstData, *dstPos;
uint32 headerPos = 0;
int16 length, cnt;
uint8 *fBuf = (uint8*)malloc(cSize);
fseek(clu, idx, SEEK_SET);
assert(fread(fBuf, 1, cSize, clu) == cSize);
while ((READ_BE_UINT32(fBuf + headerPos) != 'data') && (headerPos < 100))
headerPos++;
if (headerPos < 100) {
resSize = TO_LE_32(*(uint32*)(fBuf + headerPos + 4)) >> 1;
srcData = (int16*)(fBuf + headerPos + 8);
dstData = (int16*)malloc(resSize * 2);
srcPos = 0;
dstPos = dstData;
cSize = (cSize - (headerPos + 8)) / 2;
while (srcPos < cSize) {
length = (int16)TO_LE_16(*(int16*)(srcData + srcPos));
srcPos++;
if (length < 0) {
length = -length;
for (cnt = 0; cnt < (uint16)length; cnt++)
*dstPos++ = srcData[srcPos];
srcPos++;
} else {
memcpy(dstPos, srcData + srcPos, length * 2);
dstPos += length;
srcPos += length;
}
}
free(fBuf);
*returnSize = resSize * 2;
return dstData;
} else {
free(fBuf);
error("Sound::uncompressSpeech(): DATA tag not found in wave header");
*returnSize = 0;
return NULL;
}
}
uint8 *convertData(uint8 *rawData, uint32 rawSize, CompressMode compMode, uint32 *resSize) {
FILE *temp;
uint8 *resBuf;
uint32 size;
temp = fopen(TEMP_RAW, "wb");
assert(fwrite(rawData, 1, rawSize, temp) == rawSize);
fclose(temp);
encodeAudio(TEMP_RAW, true, 11025, tempOutName, compMode);
temp = fopen(tempOutName, "rb");
fseek(temp, 0, SEEK_END);
*resSize = size = ftell(temp);
resBuf = (uint8*)malloc(size);
fseek(temp, 0, SEEK_SET);
fread(resBuf, 1, size, temp);
fclose(temp);
return resBuf;
}
void convertClu(FILE *clu, FILE *cl3, CompressMode compMode) {
uint32 *cowHeader;
uint32 numRooms;
uint32 numSamples;
uint32 cnt;
uint32 *cl3Index, *sampleIndex;
uint32 smpSize, mp3Size;
uint8 *smpData, *mp3Data;
uint32 headerSize = readUint32LE(clu);
assert(!(headerSize & 3));
cowHeader = (uint32*)malloc(headerSize);
for (cnt = 0; cnt < (headerSize / 4) - 1; cnt++)
cowHeader[cnt] = readUint32LE(clu);
assert(!(cowHeader[0] & 3));
numRooms = cowHeader[0] / 4;
assert(cowHeader[numRooms] == 0); /* This dword should be unused. */
/* The samples are divided into rooms and samples. We don't care about the room indexes at all. */
/* We simply copy them and go to the sample-index data. */
writeUint32LE(cl3, headerSize);
for (cnt = 0; cnt < numRooms; cnt++)
writeUint32LE(cl3, cowHeader[cnt]);
writeUint32LE(cl3, cowHeader[numRooms]);
numSamples = (((headerSize / 4) - numRooms) / 2) - 1;
for (cnt = 0; cnt < numSamples * 2; cnt++) {
/* This is where we'll put the sample index data later. */
writeUint32BE(cl3, 0xdeadbeefL);
}
cl3Index = (uint32*)malloc(numSamples * 8);
memset(cl3Index, 0, numSamples * 8);
sampleIndex = cowHeader + numRooms + 1;
/* This points to the sample index table. 8 bytes each (4 bytes size and then 4 bytes file index) */
printf("converting %d samples\n", numSamples);
for (cnt = 0; cnt < numSamples; cnt++) {
if (sampleIndex[cnt << 1] | sampleIndex[(cnt << 1) | 1]) {
printf("sample %5d: ", cnt);
smpData = (uint8*)uncompressSpeech(clu, sampleIndex[cnt << 1] + headerSize, sampleIndex[(cnt << 1) | 1], &smpSize);
if ((!smpData) || (!smpSize))
error("unable to handle speech sample %d!\n", cnt);
mp3Data = convertData(smpData, smpSize, compMode, &mp3Size);
cl3Index[cnt << 1] = ftell(cl3);
cl3Index[(cnt << 1) | 1] = mp3Size;
assert(fwrite(mp3Data, 1, mp3Size, cl3) == mp3Size);
free(smpData);
free(mp3Data);
} else {
cl3Index[cnt << 1] = cl3Index[(cnt << 1) | 1] = 0;
printf("sample %5d: skipped\n", cnt);
}
}
fseek(cl3, (numRooms + 2) * 4, SEEK_SET); /* Now write the sample index into the CL3 file */
for (cnt = 0; cnt < numSamples * 2; cnt++)
writeUint32LE(cl3, cl3Index[cnt]);
free(cl3Index);
free(cowHeader);
}
void compressSpeech(CompressMode compMode) {
FILE *clu, *cl3 = NULL;
int i;
char cluName[256], outName[256];
setRawAudioType(true, false, 16);
for (i = 1; i <= 2; i++) {
sprintf(cluName, "SPEECH/SPEECH%d.CLU", i);
clu = fopen(cluName, "rb");
if (!clu) {
printf("Unable to open \"SPEECH%d.CLU\".\n", i);
printf("Please copy the \"SPEECH.CLU\" from CD %d\nand rename it to \"SPEECH%d.CLU\".\n", i, i);
} else {
sprintf(outName, "SPEECH/SPEECH%d.%s", i, (compMode == kMP3Mode) ? ("CL3") : ("CLV"));
cl3 = fopen(outName, "wb");
if (!cl3) {
printf("Unable to create file \"%s\".\n", outName);
printf("Please make sure you've got write permission in this directory.\n");
} else {
printf("Converting CD %d...\n", i);
convertClu(clu, cl3, compMode);
}
}
if (clu)
fclose(clu);
if (cl3)
fclose(cl3);
}
unlink(TEMP_RAW);
unlink(tempOutName);
}
void compressMusic(CompressMode compMode) {
int i;
FILE *inf;
char fNameIn[256], fNameOut[256];
for (i = 0; i < TOTAL_TUNES; i++) {
sprintf(fNameIn, "MUSIC/%s.WAV", musicNames[i].fileName);
inf = fopen(fNameIn, "rb");
if (!inf) {
if (!musicNames[i].missing) {
printf("unable to open file \"%s\"\n", fNameIn);
}
} else {
fclose(inf);
sprintf(fNameOut, "MUSIC/%s.%s", musicNames[i].fileName, (compMode == kMP3Mode) ? "MP3" : "OGG");
printf("encoding file (%3d/%d) %s -> %s.%s\n", i + 1, TOTAL_TUNES, musicNames[i].fileName, musicNames[i].fileName, (compMode == kMP3Mode) ? "MP3" : "OGG");
encodeAudio(fNameIn, false, 0, fNameOut, compMode);
}
}
}
void processArgs(int argc, char *argv[], int i, CompressMode mode) {
/* HACK: the functions in extract-common expect the last argument to be a filename. */
/* As we don't expect one, we simply add a dummy argument to the list. */
char **args;
int cnt;
char dummyName[] = "dummy";
args = (char **)malloc((argc + 1) * sizeof(char *));
for (cnt = 0; cnt < argc; cnt++)
args[cnt] = argv[cnt];
args[argc] = dummyName;
if (mode == kMP3Mode)
process_mp3_parms(argc + 1, args, i);
else if (mode == kVorbisMode)
process_ogg_parms(argc + 1, args, i);
else
error("Unknown encoding method");
free(args);
}
void checkFilesExist(bool checkSpeech, bool checkMusic) {
int i;
FILE *testFile;
char fileName[256];
bool speechFound = false, musicFound = false;
if (checkSpeech) {
for (i = 1; i <= 2; i++) {
sprintf(fileName, "SPEECH/SPEECH%d.CLU", i);
testFile = fopen(fileName, "rb");
if (testFile){
speechFound = true;
fclose(testFile);
}
}
if (!speechFound) {
printf("Unable to find speech files.\n");
printf("Please copy the SPEECH.CLU files from Broken Sword CD1 and CD2\n");
printf("into the \"SPEECH\" subdirectory and rename them to\n");
printf("SPEECH1.CLU and SPEECH2.CLU\n\n");
printf("If your OS is case-sensitive, make sure the filenames\n");
printf("and directorynames are all upper-case.\n\n");
}
}
if (checkMusic) {
for (i = 0; i < 20; i++) { /* Check the first 20 music files */
sprintf(fileName, "MUSIC/%s.WAV", musicNames[i].fileName);
testFile = fopen(fileName, "rb");
if (testFile) {
musicFound = true;
fclose(testFile);
}
}
if (!musicFound) {
printf("Unable to find music files.\n");
printf("Please copy the music files from Broken Sword CD1 and CD2\n");
printf("into the \"MUSIC\" subdirectory.\n");
printf("If your OS is case-sensitive, make sure the filenames\n");
printf("and directorynames are all upper-case.\n");
}
}
if ((checkSpeech && (!speechFound)) || (checkMusic && (!musicFound))) {
printf("\nUse --help for more information\n");
exit(2);
}
}
int main(int argc, char *argv[]) {
CompressMode compMode = kMP3Mode;
int i = 1;
bool compMusic = true, compSpeech = true;
while (i < argc) {
if (!strcmp(argv[i], "--mp3"))
compMode = kMP3Mode;
else if (!strcmp(argv[i], "--vorbis"))
compMode = kVorbisMode;
else if (!strcmp(argv[i], "--speech-only"))
compMusic = false;
else if (!strcmp(argv[i], "--music-only"))
compSpeech = false;
else
break;
i++;
}
if (compMode == kMP3Mode)
strcpy(tempOutName, TEMP_MP3);
else
strcpy(tempOutName, TEMP_OGG);
processArgs(argc, argv, i, compMode);
/* Do a quick check to see if we can open any files at all */
checkFilesExist(compSpeech, compMusic);
if (compSpeech)
compressSpeech(compMode);
if (compMusic)
compressMusic(compMode);
return EXIT_SUCCESS;
}
--- NEW FILE: compress_sword2.c ---
/* compress_sword2 - Compress Broken Sword II sound clusters into MP3/Ogg Vorbis
* Copyright (C) 2002, 2003 The ScummVM Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/tools/compress_sword2.c,v 1.1 2004/12/24 01:16:52 fingolfin Exp $
*
*/
#include "extract.h"
#define TEMP_IDX "tempfile.idx"
#define TEMP_DAT "tempfile.dat"
static FILE *input, *output_idx, *output_snd;
static CompressMode gCompMode = kMP3Mode;
void showhelp(char *exename)
{
printf("\nUsage: %s <params> file.clu\n", exename);
printf("\nParams:\n");
printf(" --mp3 encode to MP3 format (default)\n");
printf(" --vorbis encode to Vorbis format\n");
printf(" --flac encode to Flac format\n");
printf("(If one of these is specified, it must be the first parameter.)\n");
printf("\nMP3 mode params:\n");
printf(" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:%i)\n", minBitrDef);
printf(" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%i)\n", maxBitrDef);
printf(" --vbr LAME uses the VBR mode (default)\n");
printf(" --abr LAME uses the ABR mode\n");
printf(" -V <value> specifies the value (0 - 9) of VBR quality (0=best) (default:%i)\n", vbrqualDef);
printf(" -q <value> specifies the MPEG algorithm quality (0-9; 0=best) (default:%i)\n", algqualDef);
printf(" --silent the output of LAME is hidden (default:disabled)\n");
printf("\nVorbis mode params:\n");
printf(" -b <rate> <rate> is the nominal bitrate (default:unset)\n");
printf(" -m <rate> <rate> is the minimum bitrate (default:unset)\n");
printf(" -M <rate> <rate> is the maximum bitrate (default:unset)\n");
printf(" -q <value> specifies the value (0 - 10) of VBR quality (10=best) (default:%i)\n", oggqualDef);
printf(" --silent the output of oggenc is hidden (default:disabled)\n");
printf("\nFlac mode params:\n");
printf(" [params] optional arguments passed directly to the encoder\n");
printf(" recommended is: --best -b 1152\n");
printf("\n --help this help message\n");
printf("\n\nIf a parameter is not given the default value is used\n");
printf("If using VBR mode for MP3 -b and -B must be multiples of 8; the maximum is 160!\n");
exit(2);
}
uint32 append_to_file(FILE *f1, const char *filename) {
FILE *f2;
uint32 length, orig_length;
size_t size;
char fbuf[2048];
f2 = fopen(filename, "rb");
if (!f2) {
printf("Can't open file %s for reading!\n", filename);
exit(-1);
}
orig_length = length = fileSize(f2);
while (length > 0) {
size = fread(fbuf, 1, length > sizeof(fbuf) ? sizeof(fbuf) : length, f2);
if (size <= 0)
break;
length -= size;
fwrite(fbuf, 1, size, f1);
}
fclose(f2);
return orig_length;
}
#define GetCompressedShift(n) ((n) >> 4)
#define GetCompressedSign(n) (((n) >> 3) & 1)
#define GetCompressedAmplitude(n) ((n) & 7)
int main(int argc, char *argv[]) {
char output_filename[40];
FILE *output, *f;
char *ptr;
int i, j;
uint32 indexSize;
uint32 totalSize;
uint32 length;
if (argc < 2)
showhelp(argv[0]);
i = 1;
if (strcmp(argv[1], "--mp3") == 0) {
gCompMode = kMP3Mode;
i++;
}
else if (strcmp(argv[1], "--vorbis") == 0) {
gCompMode = kVorbisMode;
i++;
} else if (strcmp(argv[1], "--flac") == 0) {
gCompMode = kFlacMode;
i++;
}
switch (gCompMode) {
case kMP3Mode:
tempEncoded = TEMP_MP3;
process_mp3_parms(argc, argv, i);
break;
case kVorbisMode:
tempEncoded = TEMP_OGG;
process_ogg_parms(argc, argv, i);
break;
case kFlacMode:
tempEncoded = TEMP_FLAC;
process_flac_parms(argc, argv, i);
break;
}
i = argc - 1;
input = fopen(argv[i], "rb");
if (!input) {
printf("Cannot open file: %s\n", argv[i]);
return EXIT_FAILURE;
}
indexSize = readUint32LE(input);
totalSize = 12 * (indexSize + 1);
if (readUint32BE(input) != 0xfff0fff0) {
printf("This doesn't look like a cluster file\n");
return EXIT_FAILURE;
}
output_idx = fopen(TEMP_IDX, "wb");
if (!output_idx) {
printf("Can't open file " TEMP_IDX " for writing!\n");
return EXIT_FAILURE;
}
output_snd = fopen(TEMP_DAT, "wb");
if (!output_snd) {
printf("Can't open file " TEMP_DAT " for writing!\n");
return EXIT_FAILURE;
}
writeUint32LE(output_idx, indexSize);
writeUint32BE(output_idx, 0xfff0fff0);
writeUint32BE(output_idx, 0xfff0fff0);
for (j = strlen(argv[i]) - 1; j >= 0; j--) {
if (argv[i][j] == '/' || argv[i][j] == '\\' || argv[i][j] == ':') {
j++;
break;
}
}
if (j < 0)
j = 0;
strncpy(output_filename, argv[i] + j, sizeof(output_filename) - 1);
output_filename[sizeof(output_filename) - 1] = 0;
ptr = output_filename + strlen(output_filename) - 1;
switch (gCompMode) {
case kMP3Mode:
*ptr = '3';
break;
case kVorbisMode:
*ptr = 'g';
break;
case kFlacMode:
*ptr = 'f';
break;
}
for (i = 0; i < indexSize; i++) {
uint32 pos;
uint32 enc_length;
fseek(input, 8 * (i + 1), SEEK_SET);
pos = readUint32LE(input);
length = readUint32LE(input);
if (pos != 0 && length != 0) {
uint16 prev;
f = fopen(TEMP_WAV, "wb");
if (!f) {
printf("Can't open file %s for writing!\n", TEMP_WAV);
return EXIT_FAILURE;
}
/*
* Our encoding function assumes that raw data means
* 8-bit data. Rather than going through the trouble of
* adding support for 16-bit data at various byte
* orders, let's just prepend a simple WAV header.
*/
writeUint32BE(f, 0x52494646); /* "RIFF" */
writeUint32LE(f, 2 * length + 36);
writeUint32BE(f, 0x57415645); /* "WAVE" */
writeUint32BE(f, 0x666d7420); /* "fmt " */
writeUint32LE(f, 16);
writeUint16LE(f, 1); /* PCM */
writeUint16LE(f, 1); /* mono */
writeUint32LE(f, 22050); /* sample rate */
writeUint32LE(f, 44100); /* bytes per second */
writeUint16LE(f, 2); /* basic block size */
writeUint16LE(f, 16); /* sample width */
writeUint32BE(f, 0x64617461); /* "data" */
writeUint32LE(f, 2 * length);
fseek(input, pos, SEEK_SET);
/*
* The first sample is stored uncompressed. Subsequent
* samples are stored as some sort of 8-bit delta.
*/
prev = readUint16LE(input);
writeUint16LE(f, prev);
for (j = 1; j < length; j++) {
byte data;
uint16 out;
data = readByte(input);
if (GetCompressedSign(data))
out = prev - (GetCompressedAmplitude(data) << GetCompressedShift(data));
else
out = prev + (GetCompressedAmplitude(data) << GetCompressedShift(data));
writeUint16LE(f, out);
prev = out;
}
fclose(f);
encodeAudio(TEMP_WAV, false, -1, tempEncoded, gCompMode);
enc_length = append_to_file(output_snd, tempEncoded);
writeUint32LE(output_idx, totalSize);
writeUint32LE(output_idx, length);
writeUint32LE(output_idx, enc_length);
totalSize = totalSize + enc_length;
} else {
writeUint32LE(output_idx, 0);
writeUint32LE(output_idx, 0);
writeUint32LE(output_idx, 0);
}
}
fclose(output_idx);
fclose(output_snd);
output = fopen(output_filename, "wb");
if (!output) {
printf("Can't open file %s for writing!\n", output_filename);
return EXIT_FAILURE;
}
append_to_file(output, TEMP_IDX);
append_to_file(output, TEMP_DAT);
fclose(output);
unlink(TEMP_DAT);
unlink(TEMP_IDX);
unlink(TEMP_MP3);
unlink(TEMP_OGG);
unlink(TEMP_FLAC);
unlink(TEMP_WAV);
return EXIT_SUCCESS;
}
Index: .cvsignore
===================================================================
RCS file: /cvsroot/scummvm/tools/.cvsignore,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- .cvsignore 21 Dec 2004 22:56:35 -0000 1.12
+++ .cvsignore 24 Dec 2004 01:16:52 -0000 1.13
@@ -1,17 +1,17 @@
+compress_saga
compress_san
+compress_scumm_sou
+compress_simon
+compress_sword1
+compress_sword2
convbdf
dekyra
descumm
desword2
-extract
kyra_unpak
loom_tg16_extract
md5table
mm_nes_extract
queenrebuild
rescumm
-saga2mp3
simon1decr
-simon2mp3
-sword1mp3
-sword2mp3
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/tools/Makefile,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- Makefile 21 Dec 2004 23:10:16 -0000 1.42
+++ Makefile 24 Dec 2004 01:16:52 -0000 1.43
@@ -22,17 +22,17 @@
desword2$(EXEEXT) \
dekyra$(EXEEXT) \
kyra_unpak$(EXEEXT) \
- extract$(EXEEXT) \
+ compress_scumm_sou$(EXEEXT) \
loom_tg16_extract$(EXEEXT) \
md5table$(EXEEXT) \
mm_nes_extract$(EXEEXT) \
queenrebuild$(EXEEXT) \
rescumm$(EXEEXT) \
simon1decr$(EXEEXT) \
- simon2mp3$(EXEEXT) \
- sword1mp3$(EXEEXT) \
- sword2mp3$(EXEEXT) \
- saga2mp3$(EXEEXT)
+ compress_simon$(EXEEXT) \
+ compress_sword1$(EXEEXT) \
+ compress_sword2$(EXEEXT) \
+ compress_saga$(EXEEXT)
all: $(TARGETS)
@@ -54,7 +54,7 @@
kyra_unpak$(EXEEXT): kyra_unpak.o util.o
$(CXX) $(LDFLAGS) -o $@ $+
-extract$(EXEEXT): extract.o extract-common.o util.o
+compress_scumm_sou$(EXEEXT): compress_scumm_sou.o extract-common.o util.o
$(CC) $(LDFLAGS) -o $@ $+
loom_tg16_extract$(EXEEXT): loom_tg16_extract.o
@@ -72,23 +72,23 @@
rescumm$(EXEEXT): rescumm.o util.o
$(CC) $(LDFLAGS) -o $@ $+
-saga2mp3$(EXEEXT): saga2mp3.o extract-common.o util.o
+compress_saga$(EXEEXT): compress_saga.o extract-common.o util.o
$(CC) $(LDFLAGS) -o $@ $+
simon1decr$(EXEEXT): simon1decr.o
$(CC) $(LDFLAGS) -o $@ $+
-simon2mp3$(EXEEXT): simon2mp3.o extract-common.o util.o
+compress_simon$(EXEEXT): compress_simon.o extract-common.o util.o
$(CC) $(LDFLAGS) -o $@ $+
-sword1mp3$(EXEEXT): sword1mp3.o extract-common.o util.o
+compress_sword1$(EXEEXT): compress_sword1.o extract-common.o util.o
$(CC) $(LDFLAGS) -o $@ $+
-sword2mp3$(EXEEXT): sword2mp3.o extract-common.o util.o
+compress_sword2$(EXEEXT): compress_sword2.o extract-common.o util.o
$(CC) $(LDFLAGS) -o $@ $+
descumm.o descumm6.o descumm-common.o descumm-tool.o: descumm.h util.h
-extract.o simon2mp3.o sword2mp3.o extract-common.o: util.h extract.h
+compress_saga.o compress_scumm_sou.o compress_simon.o compress_sword1.o compress_sword2.o extract-common.o: util.h extract.h
desword2.o md5table.o queenrebuild.o rescumm.o util.o: util.h
clean:
Index: Makefile.mingw
===================================================================
RCS file: /cvsroot/scummvm/tools/Makefile.mingw,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Makefile.mingw 7 Nov 2004 15:57:46 -0000 1.21
+++ Makefile.mingw 24 Dec 2004 01:16:52 -0000 1.22
@@ -8,23 +8,23 @@
install: all
mkdir -p $(SCUMMVMPATH)
mkdir -p $(SCUMMVMPATH)/tools
+ strip compress_saga.exe -o $(SCUMMVMPATH)/tools/compress_saga.exe
strip compress_san.exe -o $(SCUMMVMPATH)/tools/compress_san.exe
+ strip compress_scumm_sou.exe -o $(SCUMMVMPATH)/tools/compress_scumm_sou.exe
+ strip compress_simon.exe -o $(SCUMMVMPATH)/tools/compress_simon.exe
+ strip compress_sword1.exe -o $(SCUMMVMPATH)/tools/compress_sword1.exe
+ strip compress_sword2.exe -o $(SCUMMVMPATH)/tools/compress_sword2.exe
strip convbdf.exe -o $(SCUMMVMPATH)/tools/convbdf.exe
strip dekyra.exe -o $(SCUMMVMPATH)/tools/dekyra.exe
- strip kyra_unpak.exe -o $(SCUMMVMPATH)/tools/kyra_unpak.exe
strip descumm.exe -o $(SCUMMVMPATH)/tools/descumm.exe
strip desword2.exe -o $(SCUMMVMPATH)/tools/desword2.exe
- strip extract.exe -o $(SCUMMVMPATH)/tools/extract.exe
- strip md5table.exe -o $(SCUMMVMPATH)/tools/md5table.exe
+ strip kyra_unpak.exe -o $(SCUMMVMPATH)/tools/kyra_unpak.exe
strip loom_tg16_extract.exe -o $(SCUMMVMPATH)/tools/loom_tg16_extract.exe
+ strip md5table.exe -o $(SCUMMVMPATH)/tools/md5table.exe
strip mm_nes_extract.exe -o $(SCUMMVMPATH)/tools/mm_nes_extract.exe
strip queenrebuild.exe -o $(SCUMMVMPATH)/tools/queenrebuild.exe
strip rescumm.exe -o $(SCUMMVMPATH)/tools/rescumm.exe
- strip saga2mp3.exe -o $(SCUMMVMPATH)/tools/saga2mp3.exe
strip simon1decr.exe -o $(SCUMMVMPATH)/tools/simon1decr.exe
- strip simon2mp3.exe -o $(SCUMMVMPATH)/tools/simon2mp3.exe
- strip sword1mp3.exe -o $(SCUMMVMPATH)/tools/sword1mp3.exe
- strip sword2mp3.exe -o $(SCUMMVMPATH)/tools/sword2mp3.exe
cp COPYING $(SCUMMVMPATH)/tools/copying.txt
cp README $(SCUMMVMPATH)/tools/readme.txt
u2d $(SCUMMVMPATH)/tools/*.txt
Index: README
===================================================================
RCS file: /cvsroot/scummvm/tools/README,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- README 8 Dec 2004 22:35:53 -0000 1.28
+++ README 24 Dec 2004 01:16:52 -0000 1.29
@@ -8,7 +8,7 @@
Extraction Tools:
kyra_unpak
- Unpacks .PAK files from Kyrandia games
+ Unpacks .PAK files from Kyrandia games.
rescumm
Extracts Macintosh "single file" SCUMM games into their
@@ -18,30 +18,34 @@
format.
loom_tg16_extract
- Extracts data files from TG16 version of Loom
+ Extracts data files from TG16 version of Loom.
There is currently no support for this game in ScummVM!
mm_nes_extract
- Extracts data files from NES version of Maniac Mansion
+ Extracts data files from NES version of Maniac Mansion.
There is currently no support for this game in ScummVM!
Compression Tools:
- extract
+ compress_scumm_sou
Used to compress .sou files to .so3 (MP3), .sog (Vorbis),
- or .sof (FLAC)
+ or .sof (FLAC).
queenrebuild
Used to rebuild the datafile of Flight of the Amazon Queen,
to allow optional MP3/Ogg/FLAC compression.
- simon2mp3
+ compress_saga
+ Compress SAGA engine digital sound files into MP3 and Ogg
+ Vorbis format.
+
+ compress_simon
Compresses Simon voc/wav files to MP3/Ogg/FLAC.
- sword1mp3
+ compress_sword1
Used to compress Broken Sword 1's music and speech files
using mp3 or vorbis.
- sword2mp3
+ compress_sword2
Used to compress Broken Sword 2's music and speech .clu
files to .cl3 (MP3), .clg (Vorbis) or .clf (FLAC).
@@ -50,11 +54,11 @@
use lossy compression.
compress_san <inputfile> <inputdir> <outputdir>
- Compresses '.san' smush animation files. It uses lossless zlib
- for compressing FOBJ gfx chunks inside a san file.
+ Compresses '.san' smush animation files. It uses lossless
+ zlib for compressing FOBJ gfx chunks inside a san file.
It also can create a separate Ogg file with the audio track.
There are also temporary files *.tmp and *.wav which could
- be deleteed after finished compression.
+ be deleted after finished compression.
Example of usage:
compress_san opening.san uncomp comp
Index: extract.h
===================================================================
RCS file: /cvsroot/scummvm/tools/extract.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- extract.h 12 Oct 2004 18:49:07 -0000 1.15
+++ extract.h 24 Dec 2004 01:16:52 -0000 1.16
@@ -58,7 +58,7 @@
extern void encodeAudio(const char *inname, bool rawInput, int rawSamplerate, const char *outname, CompressMode compmode);
extern void setRawAudioType(bool isLittleEndian, bool isStereo, uint8 bitsPerSample);
/*
- * Stuff which is in extract.c / simon2mp3.c / sword2mp3.c
+ * Stuff which is in compress_scumm_sou.c / compress_simon.c / compress_sword2.c
*/
extern void showhelp(char *exename);
--- saga2mp3.c DELETED ---
--- simon2mp3.c DELETED ---
--- sword1mp3.c DELETED ---
--- sword2mp3.c DELETED ---
More information about the Scummvm-git-logs
mailing list