Added legal headers, fixed various warnings
svn-id: r29014
This commit is contained in:
parent
924a9074fb
commit
893c42c3d8
10 changed files with 214 additions and 16 deletions
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
// AsciiCptCompile.cpp
|
||||
//
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "KmpSearch.h"
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __KmpSearch__
|
||||
#define __KmpSearch__
|
||||
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TextFile.h"
|
||||
|
||||
TextFile::TextFile(char *name) {
|
||||
TextFile::TextFile(const char *name) {
|
||||
FILE *inf = fopen(name, "r");
|
||||
if (!inf) {
|
||||
printf("Unable to open file %s\n", name);
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __TextFile__
|
||||
#define __TextFile__
|
||||
|
||||
|
@ -8,7 +30,7 @@
|
|||
|
||||
class TextFile {
|
||||
public:
|
||||
TextFile(char *name);
|
||||
TextFile(const char *name);
|
||||
~TextFile(void);
|
||||
char *giveLine(uint32 num);
|
||||
int32 findLine(KmpSearch *kmp, uint32 fromLine = 0);
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cpthelp.h"
|
||||
#include "textfile.h"
|
||||
|
@ -163,7 +185,7 @@ void processTurntabs(FILE *inf, CptObj *destArr) {
|
|||
free(resBuf);
|
||||
}
|
||||
|
||||
void processBins(FILE *inf, CptObj *destArr, char *typeName, char *objName, uint8 cTypeId) {
|
||||
void processBins(FILE *inf, CptObj *destArr, const char *typeName, const char *objName, uint8 cTypeId) {
|
||||
char line[1024];
|
||||
dofgets(line, 1024, inf);
|
||||
assert(lineMatchSection(line, typeName));
|
||||
|
@ -478,9 +500,8 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
|
|||
fwrite(&tmp, 2, 1, debOutf);
|
||||
tmp = 0;
|
||||
fwrite(&tmp, 2, 1, debOutf);
|
||||
printf("reset destination: %d\n", ftell(debOutf));
|
||||
printf("reset destination: %ld\n", ftell(debOutf));
|
||||
for (int cnt = 0; cnt < 6; cnt++) {
|
||||
uint16 diff[8192];
|
||||
uint16 diffPos = 0;
|
||||
sprintf(inName, "reset.%03d", gameVers[cnt]);
|
||||
FILE *resDiff = fopen(inName, "rb");
|
||||
|
@ -504,7 +525,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
|
|||
printf("diff v0.0%03d: 2 * 2 * %d\n", gameVers[cnt], diffPos);
|
||||
}
|
||||
} else {
|
||||
printf("Creating CPT file with Dummy reset data @ %d\n", ftell(debOutf));
|
||||
printf("Creating CPT file with Dummy reset data @ %ld\n", ftell(debOutf));
|
||||
uint16 resetFields16 = 4;
|
||||
fwrite(&resetFields16, 2, 1, debOutf);
|
||||
uint32 blah = 8;
|
||||
|
@ -524,8 +545,8 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
|
|||
fwrite(cptSize + 1, 1, 4, resOutf);
|
||||
|
||||
printf("%d diffs\n", diffNo);
|
||||
printf("%d Compacts in total\n", numCpts);
|
||||
printf("%ld Compacts in total\n", numCpts);
|
||||
printf("max strlen = %d\n", maxStrl);
|
||||
printf("raw size = 2 * %d\n", binSize);
|
||||
printf("raw size = 2 * %ld\n", binSize);
|
||||
printf("max cptlen = %d\n", maxCptl);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cpthelp.h"
|
||||
|
||||
|
@ -5,7 +27,7 @@ void assertEmpty(CptObj *cpt) {
|
|||
assert((cpt->len == 0) && (cpt->data == NULL) && (cpt->dbgName == NULL) && (cpt->type == 0));
|
||||
}
|
||||
|
||||
uint16 getInfo(char *line, char *type, char *nameDest) {
|
||||
uint16 getInfo(const char *line, const char *type, char *nameDest) {
|
||||
assert(*line == '\t');
|
||||
line++;
|
||||
assert(!memcmp(line, type, strlen(type)));
|
||||
|
@ -32,7 +54,7 @@ void dofgets(char *dest, int len, FILE *inf) {
|
|||
dest++;
|
||||
}
|
||||
|
||||
bool lineMatchSection(char *line, char *sec) {
|
||||
bool lineMatchSection(const char *line, const char *sec) {
|
||||
if (memcmp(line, "SECTION::", 9))
|
||||
return false;
|
||||
if (memcmp(line + 9, sec, strlen(sec)))
|
||||
|
@ -40,13 +62,13 @@ bool lineMatchSection(char *line, char *sec) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool isEndOfSection(char *line) {
|
||||
bool isEndOfSection(const char *line) {
|
||||
if (strcmp(line, "SECTION::ENDS"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isEndOfObject(char *line, char *type, uint16 id) {
|
||||
bool isEndOfObject(const char *line, const char *type, uint16 id) {
|
||||
if (*line != '\t')
|
||||
return false;
|
||||
line++;
|
||||
|
|
|
@ -1,8 +1,30 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
void assertEmpty(CptObj *cpt);
|
||||
uint16 getInfo(char *line, char *type, char *nameDest);
|
||||
uint16 getInfo(const char *line, const char *type, char *nameDest);
|
||||
void dofgets(char *dest, int len, FILE *inf);
|
||||
bool lineMatchSection(char *line, char *sec);
|
||||
bool isEndOfSection(char *line);
|
||||
bool isEndOfObject(char *line, char *type, uint16 id);
|
||||
bool lineMatchSection(const char *line, const char *sec);
|
||||
bool isEndOfSection(const char *line);
|
||||
bool isEndOfObject(const char *line, const char *type, uint16 id);
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM Tools
|
||||
* Copyright (C) 2007 The ScummVM project
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TextFile.h"
|
||||
#include "KmpSearch.h"
|
||||
|
|
|
@ -23,6 +23,7 @@ typedef signed long int32;
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct CptObj {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue