aboutsummaryrefslogtreecommitdiff
path: root/devtools/create_bladerunner
diff options
context:
space:
mode:
authorThanasis Antoniou2019-07-10 13:58:05 +0300
committerThanasis Antoniou2019-07-10 13:59:31 +0300
commitf2f91fa773b737e1315489cd1f775e5c23f5515a (patch)
tree2fb44f7f6f73a276d639b966cdbfe6f289f378c8 /devtools/create_bladerunner
parent78912960947d619511f4d37e95815a1dd9c6c4cb (diff)
downloadscummvm-rg350-f2f91fa773b737e1315489cd1f775e5c23f5515a.tar.gz
scummvm-rg350-f2f91fa773b737e1315489cd1f775e5c23f5515a.tar.bz2
scummvm-rg350-f2f91fa773b737e1315489cd1f775e5c23f5515a.zip
DEVTOOLS: BLADERUNNER: Improved command line for TRE, FON, AUD libs
Diffstat (limited to 'devtools/create_bladerunner')
-rw-r--r--devtools/create_bladerunner/subtitles/fontCreator/fonFileLib.py69
-rw-r--r--devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/audFileLib.py49
-rw-r--r--devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/treFileLib.py61
3 files changed, 105 insertions, 74 deletions
diff --git a/devtools/create_bladerunner/subtitles/fontCreator/fonFileLib.py b/devtools/create_bladerunner/subtitles/fontCreator/fonFileLib.py
index 835cdb55c0..c66b5fdc74 100644
--- a/devtools/create_bladerunner/subtitles/fontCreator/fonFileLib.py
+++ b/devtools/create_bladerunner/subtitles/fontCreator/fonFileLib.py
@@ -52,9 +52,8 @@ if (not osLibFound) \
from struct import *
-my_module_version = "0.80"
-my_module_name = "fonFileLib"
-
+MY_MODULE_VERSION = "0.80"
+MY_MODULE_NAME = "fonFileLib"
class FonHeader:
maxEntriesInTableOfDetails = -1 # this is probably always the number of entries in table of details, but it won't work for the corrupted TAHOMA18.FON file
@@ -259,33 +258,49 @@ class fonFile:
#
if __name__ == '__main__':
# main()
- print "[Debug] Running %s as main module" % (my_module_name)
- # assumes a file of name TAHOMA24.FON in same directory
- inFONFile = None
- #inFONFileName = 'TAHOMA24.FON' # USED IN CREDIT END-TITLES and SCORERS BOARD AT POLICE STATION
- #inFONFileName = 'TAHOMA18.FON' # USED IN CREDIT END-TITLES
- #inFONFileName = '10PT.FON' # BLADE RUNNER UNUSED FONT?
- #inFONFileName = 'KIA6PT.FON' # BLADE RUNNER MAIN FONT
- inFONFileName = 'SUBTLS_E.FON' # Subtitles font custom
-
errorFound = False
- try:
- print "[Info] Opening %s" % (inFONFileName)
- inFONFile = open(os.path.join('.',inFONFileName), 'rb')
- except:
+ # By default assumes a file of name SUBTLS_E.FON in same directory
+ # otherwise tries to use the first command line argument as input file
+ # 'TAHOMA24.FON' # USED IN CREDIT END-TITLES and SCORERS BOARD AT POLICE STATION
+ # 'TAHOMA18.FON' # USED IN CREDIT END-TITLES
+ # '10PT.FON' # BLADE RUNNER UNUSED FONT - Probably font for reporting system errors
+ # 'KIA6PT.FON' # BLADE RUNNER MAIN FONT
+ # 'SUBTLS_E.FON' # OUR EXTRA FONT USED FOR SUBTITLES
+ inFONFile = None
+ inFONFileName = 'SUBTLS_E.FON' # Subtitles font custom
+
+ if len(sys.argv[1:]) > 0 \
+ and os.path.isfile(os.path.join('.', sys.argv[1])) \
+ and len(sys.argv[1]) >= 5 \
+ and sys.argv[1][-3:].upper() == 'FON':
+ inFONFileName = sys.argv[1]
+ print "[Info] Attempting to use %s as input FON file..." % (inFONFileName)
+ elif os.path.isfile(os.path.join('.', inFONFileName)):
+ print "[Info] Using default %s as input FON file..." % (inFONFileName)
+ else:
+ print "[Error] No valid input file argument was specified and default input file %s is missing." % (inFONFileName)
errorFound = True
- print "[Error] Unexpected event:", sys.exc_info()[0]
- raise
+
if not errorFound:
- allOfFonFileInBuffer = inFONFile.read()
- fonFileInstance = fonFile()
- if (fonFileInstance.loadFonFile(allOfFonFileInBuffer, len(allOfFonFileInBuffer), inFONFileName)):
- print "[Info] Font file (FON) was loaded successfully!"
- fonFileInstance.outputFonToPNG()
- else:
- print "[Error] Error while loading Font file (FON)!"
- inFONFile.close()
+ try:
+ print "[Info] Opening %s" % (inFONFileName)
+ inFONFile = open(os.path.join('.',inFONFileName), 'rb')
+ except:
+ errorFound = True
+ print "[Error] Unexpected event:", sys.exc_info()[0]
+ raise
+ if not errorFound:
+ allOfFonFileInBuffer = inFONFile.read()
+ fonFileInstance = fonFile(True)
+ if fonFileInstance.m_traceModeEnabled:
+ print "[Debug] Running %s (%s) as main module" % (MY_MODULE_NAME, MY_MODULE_VERSION)
+ if (fonFileInstance.loadFonFile(allOfFonFileInBuffer, len(allOfFonFileInBuffer), inFONFileName)):
+ print "[Info] Font file (FON) was loaded successfully!"
+ fonFileInstance.outputFonToPNG()
+ else:
+ print "[Error] Error while loading Font file (FON)!"
+ inFONFile.close()
else:
#debug
- #print "[Debug] Running %s imported from another module" % (my_module_name)
+ #print "[Debug] Running %s imported from another module" % (MY_MODULE_NAME)
pass \ No newline at end of file
diff --git a/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/audFileLib.py b/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/audFileLib.py
index 3c72521c0d..60dc3d6ab8 100644
--- a/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/audFileLib.py
+++ b/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/audFileLib.py
@@ -372,32 +372,43 @@ class audFile:
#
if __name__ == '__main__':
# main()
- # (by default) assumes a file of name 000000.AUD in same directory
+ errorFound = False
+ # By default assumes a file of name 000000.AUD in same directory
# otherwise tries to use the first command line argument as input file
inAUDFile = None
inAUDFileName = '00000000.AUD'
+
if len(sys.argv[1:]) > 0 \
and os.path.isfile(os.path.join('.', sys.argv[1])) \
- and len(sys.argv[1]) > 5 \
- and sys.argv[1][-3:] == 'AUD':
+ and len(sys.argv[1]) >= 5 \
+ and sys.argv[1][-3:].upper() == 'AUD':
inAUDFileName = sys.argv[1]
- print "[Info] Using %s as input AUD file..." % (inAUDFileName)
-
- errorFound = False
- try:
- inAUDFile = open(os.path.join('.', inAUDFileName), 'rb')
- except:
+ print "[Info] Attempting to use %s as input AUD file..." % (inAUDFileName)
+ elif os.path.isfile(os.path.join('.', inAUDFileName)):
+ print "[Info] Using default %s as input AUD file..." % (inAUDFileName)
+ else:
+ print "[Error] No valid input file argument was specified and default input file %s is missing." % (inAUDFileName)
errorFound = True
- print "[Error] Unexpected event:", sys.exc_info()[0]
- raise
- if not errorFound:
- allOfAudFileInBuffer = inAUDFile.read()
- audFileInstance = audFile(True)
- if audFileInstance.m_traceModeEnabled:
- print "[Debug] Running %s (%s) as main module" % (MY_MODULE_NAME, MY_MODULE_VERSION)
- audFileInstance.loadAudFile(allOfAudFileInBuffer, len(allOfAudFileInBuffer), inAUDFileName)
- audFileInstance.export_as_wav(allOfAudFileInBuffer, './tmp.wav')
- inAUDFile.close()
+
+ if not errorFound:
+ try:
+ print "[Info] Opening %s" % (inAUDFileName)
+ inAUDFile = open(os.path.join('.', inAUDFileName), 'rb')
+ except:
+ errorFound = True
+ print "[Error] Unexpected event:", sys.exc_info()[0]
+ raise
+ if not errorFound:
+ allOfAudFileInBuffer = inAUDFile.read()
+ audFileInstance = audFile(True)
+ if audFileInstance.m_traceModeEnabled:
+ print "[Debug] Running %s (%s) as main module" % (MY_MODULE_NAME, MY_MODULE_VERSION)
+ if audFileInstance.loadAudFile(allOfAudFileInBuffer, len(allOfAudFileInBuffer), inAUDFileName):
+ print "[Info] Audio file (AUD) loaded successfully!"
+ audFileInstance.export_as_wav(allOfAudFileInBuffer, './tmp.wav')
+ else:
+ print "[Error] Error while loading Audio file (AUD)!"
+ inAUDFile.close()
else:
#debug
#print "[Debug] Running %s (%s) imported from another module" % (MY_MODULE_NAME, MY_MODULE_VERSION)
diff --git a/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/treFileLib.py b/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/treFileLib.py
index 18a23ba5f0..a76673ef0c 100644
--- a/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/treFileLib.py
+++ b/devtools/create_bladerunner/subtitles/quotesSpreadsheetCreator/treFileLib.py
@@ -110,13 +110,14 @@ class treFile:
# This works ok.
#
allTextsFound = treBytesBuff[currOffset:].split('\x00')
- ## check "problematic" character cases:
- if self.m_traceModeEnabled:
- if currOffset == 5982 or currOffset == 6050 or currOffset == 2827 or currOffset == 2880:
- print "[Debug] Offs: %d\tFound String: %s" % ( currOffset,''.join(allTextsFound[0]) )
+ ### check "problematic" character cases:
+ ##if self.m_traceModeEnabled:
+ ## if currOffset == 5982 or currOffset == 6050 or currOffset == 2827 or currOffset == 2880:
+ ## print "[Debug] Offs: %d\tFound String: %s" % ( currOffset,''.join(allTextsFound[0]) )
(theId, stringOfIdx) = self.stringEntriesLst[idx]
self.stringEntriesLst[idx] = (theId, ''.join(allTextsFound[0]))
- #print "[Debug] ID: %d\tFound String: %s" % ( theId,''.join(allTextsFound[0]) )
+ if self.m_traceModeEnabled:
+ print "[Trace] ID: %d\tFound String: %s" % ( theId,''.join(allTextsFound[0]) )
return True
except:
print "[Error] Loading Text Resource %s failed!" % (self.simpleTextResourceFileName)
@@ -129,38 +130,42 @@ class treFile:
#
if __name__ == '__main__':
# main()
- # (by default) assumes a file of name ACTORS.TRE in same directory
+ errorFound = False
+ # By default assumes a file of name ACTORS.TRE in same directory
# otherwise tries to use the first command line argument as input file
inTREFile = None
inTREFileName = 'ACTORS.TRE'
if len(sys.argv[1:]) > 0 \
and os.path.isfile(os.path.join('.', sys.argv[1])) \
- and len(sys.argv[1]) > 5 \
- and sys.argv[1][-3:] == 'TRE':
+ and len(sys.argv[1]) >= 5 \
+ and sys.argv[1][-3:].upper() == 'TRE':
inTREFileName = sys.argv[1]
- print "[Info] Using %s as input TRE file..." % (inTREFileName)
-
- errorFound = False
-
- try:
- print "[Info] Opening %s" % (inTREFileName)
- inTREFile = open(os.path.join('.',inTREFileName), 'rb')
- except:
+ print "[Info] Attempting to use %s as input TRE file..." % (inTREFileName)
+ elif os.path.isfile(os.path.join('.', inTREFileName)):
+ print "[Info] Using default %s as input TRE file..." % (inTREFileName)
+ else:
+ print "[Error] No valid input file argument was specified and default input file %s is missing." % (inTREFileName)
errorFound = True
- print "[Error] Unexpected event: ", sys.exc_info()[0]
- raise
+
if not errorFound:
- allOfTreFileInBuffer = inTREFile.read()
- treFileInstance = treFile(True)
- if treFileInstance.m_traceModeEnabled:
- print "[Debug] Running %s (%s) as main module" % (MY_MODULE_NAME, MY_MODULE_VERSION)
-
- if (treFileInstance.loadTreFile(allOfTreFileInBuffer, len(allOfTreFileInBuffer, inTREFileName))):
- print "[Info] Text Resource file loaded successfully!"
- else:
- print "[Error] Error while loading Text Resource file!"
- inTREFile.close()
+ try:
+ print "[Info] Opening %s" % (inTREFileName)
+ inTREFile = open(os.path.join('.',inTREFileName), 'rb')
+ except:
+ errorFound = True
+ print "[Error] Unexpected event: ", sys.exc_info()[0]
+ raise
+ if not errorFound:
+ allOfTreFileInBuffer = inTREFile.read()
+ treFileInstance = treFile(True)
+ if treFileInstance.m_traceModeEnabled:
+ print "[Debug] Running %s (%s) as main module" % (MY_MODULE_NAME, MY_MODULE_VERSION)
+ if treFileInstance.loadTreFile(allOfTreFileInBuffer, len(allOfTreFileInBuffer), inTREFileName):
+ print "[Info] Text Resource file loaded successfully!"
+ else:
+ print "[Error] Error while loading Text Resource file!"
+ inTREFile.close()
else:
#debug
#print "[Debug] Running %s (%s) imported from another module" % (MY_MODULE_NAME, MY_MODULE_VERSION)