aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/utility
diff options
context:
space:
mode:
authorFilippos Karapetis2014-12-03 01:43:51 +0200
committerFilippos Karapetis2014-12-03 01:43:51 +0200
commitbb31c435bf6502f4e1f94b3de9f046c054031a98 (patch)
tree5efd773292431e2bbf134d90e63d5771424dbdeb /engines/zvision/utility
parent10444ef5683f420f08cfc276349a5771dd0d04e5 (diff)
downloadscummvm-rg350-bb31c435bf6502f4e1f94b3de9f046c054031a98.tar.gz
scummvm-rg350-bb31c435bf6502f4e1f94b3de9f046c054031a98.tar.bz2
scummvm-rg350-bb31c435bf6502f4e1f94b3de9f046c054031a98.zip
ZVISION: Remove more dead code, and move some debugger functions
Diffstat (limited to 'engines/zvision/utility')
-rw-r--r--engines/zvision/utility/utility.cpp176
-rw-r--r--engines/zvision/utility/utility.h66
2 files changed, 0 insertions, 242 deletions
diff --git a/engines/zvision/utility/utility.cpp b/engines/zvision/utility/utility.cpp
index 517c89afbd..2388fe826e 100644
--- a/engines/zvision/utility/utility.cpp
+++ b/engines/zvision/utility/utility.cpp
@@ -32,25 +32,6 @@
namespace ZVision {
-void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile) {
- Common::File f;
- if (!f.open(sourceFile)) {
- return;
- }
-
- byte *buffer = new byte[f.size()];
- f.read(buffer, f.size());
-
- Common::DumpFile dumpFile;
- dumpFile.open(destFile);
-
- dumpFile.write(buffer, f.size());
- dumpFile.flush();
- dumpFile.close();
-
- delete[] buffer;
-}
-
void trimCommentsAndWhiteSpace(Common::String *string) {
for (int i = string->size() - 1; i >= 0; i--) {
if ((*string)[i] == '#') {
@@ -76,161 +57,4 @@ void tryToDumpLine(const Common::String &key,
}
}
-void dumpEveryResultAction(const Common::String &destFile) {
- Common::HashMap<Common::String, byte> count;
- Common::HashMap<Common::String, bool> fileAlreadyUsed;
-
- Common::DumpFile output;
- output.open(destFile);
-
- // Find scr files
- Common::ArchiveMemberList list;
- SearchMan.listMatchingMembers(list, "*.scr");
-
- for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) {
- Common::SeekableReadStream *stream = (*iter)->createReadStream();
-
- Common::String line = stream->readLine();
- trimCommentsAndWhiteSpace(&line);
-
- while (!stream->eos()) {
- if (line.matchString("*:add*", true)) {
- tryToDumpLine("add", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:animplay*", true)) {
- tryToDumpLine("animplay", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:animpreload*", true)) {
- tryToDumpLine("animpreload", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:animunload*", true)) {
- tryToDumpLine("animunload", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:attenuate*", true)) {
- tryToDumpLine("attenuate", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:assign*", true)) {
- tryToDumpLine("assign", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:change_location*", true)) {
- tryToDumpLine("change_location", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:crossfade*", true) && !fileAlreadyUsed["add"]) {
- tryToDumpLine("crossfade", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:debug*", true)) {
- tryToDumpLine("debug", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:delay_render*", true)) {
- tryToDumpLine("delay_render", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:disable_control*", true)) {
- tryToDumpLine("disable_control", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:disable_venus*", true)) {
- tryToDumpLine("disable_venus", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:display_message*", true)) {
- tryToDumpLine("display_message", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:dissolve*", true)) {
- tryToDumpLine("dissolve", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:distort*", true)) {
- tryToDumpLine("distort", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:enable_control*", true)) {
- tryToDumpLine("enable_control", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:flush_mouse_events*", true)) {
- tryToDumpLine("flush_mouse_events", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:inventory*", true)) {
- tryToDumpLine("inventory", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:kill*", true)) {
- tryToDumpLine("kill", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:menu_bar_enable*", true)) {
- tryToDumpLine("menu_bar_enable", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:music*", true)) {
- tryToDumpLine("music", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:pan_track*", true)) {
- tryToDumpLine("pan_track", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:playpreload*", true)) {
- tryToDumpLine("playpreload", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:preferences*", true)) {
- tryToDumpLine("preferences", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:quit*", true)) {
- tryToDumpLine("quit", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:random*", true)) {
- tryToDumpLine("random", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:region*", true)) {
- tryToDumpLine("region", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:restore_game*", true)) {
- tryToDumpLine("restore_game", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:rotate_to*", true)) {
- tryToDumpLine("rotate_to", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:save_game*", true)) {
- tryToDumpLine("save_game", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:set_partial_screen*", true)) {
- tryToDumpLine("set_partial_screen", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:set_screen*", true)) {
- tryToDumpLine("set_screen", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:set_venus*", true)) {
- tryToDumpLine("set_venus", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:stop*", true)) {
- tryToDumpLine("stop", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:streamvideo*", true)) {
- tryToDumpLine("streamvideo", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:syncsound*", true)) {
- tryToDumpLine("syncsound", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:timer*", true)) {
- tryToDumpLine("timer", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:ttytext*", true)) {
- tryToDumpLine("ttytext", line, &count, &fileAlreadyUsed, output);
- } else if (line.matchString("*:universe_music*", true)) {
- tryToDumpLine("universe_music", line, &count, &fileAlreadyUsed, output);
- }
-
- line = stream->readLine();
- trimCommentsAndWhiteSpace(&line);
- }
-
- for (Common::HashMap<Common::String, bool>::iterator fileUsedIter = fileAlreadyUsed.begin(); fileUsedIter != fileAlreadyUsed.end(); ++fileUsedIter) {
- fileUsedIter->_value = false;
- }
- }
-
- output.close();
-}
-
-Common::String getFileName(const Common::String &fullPath) {
- Common::StringTokenizer tokenizer(fullPath, "/\\");
- Common::String token;
- while (!tokenizer.empty()) {
- token = tokenizer.nextToken();
- }
-
- return token;
-}
-
-void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Common::String &outputFile) {
- Common::File file;
- if (!file.open(inputFile))
- return;
-
- Audio::AudioStream *audioStream = makeRawZorkStream(inputFile, engine);
-
- Common::DumpFile output;
- output.open(outputFile);
-
- output.writeUint32BE(MKTAG('R', 'I', 'F', 'F'));
- output.writeUint32LE(file.size() * 2 + 36);
- output.writeUint32BE(MKTAG('W', 'A', 'V', 'E'));
- output.writeUint32BE(MKTAG('f', 'm', 't', ' '));
- output.writeUint32LE(16);
- output.writeUint16LE(1);
- uint16 numChannels;
- if (audioStream->isStereo()) {
- numChannels = 2;
- output.writeUint16LE(2);
- } else {
- numChannels = 1;
- output.writeUint16LE(1);
- }
- output.writeUint32LE(audioStream->getRate());
- output.writeUint32LE(audioStream->getRate() * numChannels * 2);
- output.writeUint16LE(numChannels * 2);
- output.writeUint16LE(16);
- output.writeUint32BE(MKTAG('d', 'a', 't', 'a'));
- output.writeUint32LE(file.size() * 2);
- int16 *buffer = new int16[file.size()];
- audioStream->readBuffer(buffer, file.size());
- output.write(buffer, file.size() * 2);
-
- delete[] buffer;
-}
-
} // End of namespace ZVision
diff --git a/engines/zvision/utility/utility.h b/engines/zvision/utility/utility.h
index 0741cc044c..0ca26b968d 100644
--- a/engines/zvision/utility/utility.h
+++ b/engines/zvision/utility/utility.h
@@ -34,15 +34,6 @@ namespace ZVision {
class ZVision;
/**
- * Opens the sourceFile utilizing Common::File (aka SearchMan) and writes the
- * contents to destFile. destFile is created in the working directory
- *
- * @param sourceFile The 'file' you want the contents of
- * @param destFile The name of the file where the content will be written to
- */
-void writeFileContentsToFile(const Common::String &sourceFile, const Common::String &destFile);
-
-/**
* Removes any line comments using '#' as a sequence start.
* Then removes any trailing and leading 'whitespace' using String::trim()
* Note: String::trim uses isspace() to determine what is whitespace and what is not.
@@ -51,63 +42,6 @@ void writeFileContentsToFile(const Common::String &sourceFile, const Common::Str
*/
void trimCommentsAndWhiteSpace(Common::String *string);
-/**
- * Searches through all the .scr files and dumps 'numberOfExamplesPerType' examples of each type of ResultAction
- * ZVision::initialize() must have been called before this function can be used.
- *
- * @param destFile Where to write the examples
- */
-void dumpEveryResultAction(const Common::String &destFile);
-
-/**
- * Removes all duplicate entries from container. Relative order will be preserved.
- *
- * @param container The Array to remove duplicate entries from
- */
-template<class T>
-void removeDuplicateEntries(Common::Array<T> &container) {
- // Length of modified array
- uint newLength = 1;
- uint j;
-
- for (uint i = 1; i < container.size(); i++) {
- for (j = 0; j < newLength; j++) {
- if (container[i] == container[j]) {
- break;
- }
- }
-
- // If none of the values in index[0..j] of container are the same as array[i],
- // then copy the current value to corresponding new position in array
- if (j == newLength) {
- container[newLength++] = container[i];
- }
- }
-
- // Actually remove the unneeded space
- while (container.size() < newLength) {
- container.pop_back();
- }
-}
-
-/**
- * Gets the name of the file (including extension). Forward or back slashes
- * are interpreted as directory changes
- *
- * @param fullPath A full or partial path to the file. Ex: folderOne/folderTwo/file.txt
- * @return The name of the file without any preceding directories. Ex: file.txt
- */
-Common::String getFileName(const Common::String &fullPath);
-
-/**
- * Converts a ZVision .RAW file to a .WAV
- * The .WAV will be created in the working directory and will overwrite any existing file
- *
- * @param inputFile The path to the input .RAW file
- * @param outputFile The name of the output .WAV file
- */
-void convertRawToWav(const Common::String &inputFile, ZVision *engine, const Common::String &outputFile);
-
} // End of namespace ZVision
#endif