Permalink
Browse files

Ported a BOSS launch code from WB291(svn).

  • Loading branch information...
1 parent e31b566 commit 6ba14ce16d7944411a1751a484c4759d95a8aea4 @valda committed Nov 6, 2010
Showing with 58 additions and 39 deletions.
  1. +21 −13 Mopy/basher.py
  2. +37 −26 Mopy/bosh.py
View
@@ -11083,7 +11083,8 @@ def Execute(self,event,extraArgs=None):
cwd = bolt.Path.getcwd()
exePath.head.setcwd()
progress = balt.Progress(_("Executing BOSS"))
- if settings.get('bash.mods.autoGhost') and not bosh.configHelpers.bossVersion:
+ version = bosh.configHelpers.bossVersion
+ if settings.get('bash.mods.autoGhost') and not version:
progress(0.05,_("Processing... deghosting mods"))
ghosted = []
for root, dirs, files in os.walk(bosh.dirs['mods'].s):
@@ -11101,16 +11102,21 @@ def Execute(self,event,extraArgs=None):
bosh.modInfos.mtimes.clear()
settings['bosh.modInfos.resetMTimes'] = bosh.modInfos.lockTimes = lockTimesActive
lockTimesActive = True
- if settings['BOSS.AlwaysUpdate'] or wx.GetKeyState(85):
- exeArgs += ('-u',) # Update - BOSS version 1.6+
- if wx.GetKeyState(82) and wx.GetKeyState(wx.WXK_SHIFT):
- exeArgs += ('-r 2',) # Revert level 2 - BOSS version 1.6+
- elif wx.GetKeyState(82):
- exeArgs += ('-r 1',) # Revert level 1 - BOSS version 1.6+
- if wx.GetKeyState(83):
- exeArgs += ('-s',) # Silent Mode - BOSS version 1.6+
- if wx.GetKeyState(86):
- exeArgs += ('-V-',) # Disable version parsing - BOSS version 1.6+
+ if version >= 1:
+ if settings['BOSS.AlwaysUpdate'] or wx.GetKeyState(85):
+ exeArgs += ('-u',) # Update - BOSS version 1.6+
+ if wx.GetKeyState(82) and wx.GetKeyState(wx.WXK_SHIFT):
+ exeArgs += ('-r 2',) # Revert level 2 - BOSS version 1.6+
+ elif wx.GetKeyState(82):
+ exeArgs += ('-r 1',) # Revert level 1 - BOSS version 1.6+
+ if wx.GetKeyState(83):
+ exeArgs += ('-s',) # Silent Mode - BOSS version 1.6+
+ if version in [1, 393217]:
+ if wx.GetKeyState(86):
+ exeArgs += ('-V-',) # Disable version parsing - syntax BOSS version 1.6 - 1.6.1
+ elif version >= 393218:
+ if wx.GetKeyState(86) or wx.GetKeyState(78):
+ exeArgs += ('-n',) # Disable version parsing - syntax BOSS version 1.6.2+
progress(0.05,_("Processing... launching BOSS."))
try:
os.spawnv(os.P_WAIT,exePath.s,exeArgs)
@@ -11434,9 +11440,11 @@ def InitStatusBar():
# _("Launch Tes4LODGen")))
configHelpers = bosh.ConfigHelpers()
configHelpers.refresh()
- BashStatusBar.buttons.append( #BOSS -- will u
+ if configHelpers.bossVersion > 0: version = 1
+ else: version = 0
+ BashStatusBar.buttons.append( #BOSS --
App_BOSS(
- (bosh.dirs['app'].join('Data\\BOSS-F.bat'),bosh.dirs['app'].join('Data\\BOSS.exe'))[configHelpers.bossVersion],
+ (bosh.dirs['app'].join('Data\\BOSS-F.bat'),bosh.dirs['app'].join('Data\\BOSS.exe'))[version],
Image(r'images/Boss'+bosh.inisettings['iconSize']+'.png'),
_("Launch BOSS")))
if bosh.inisettings['showmodelingtoollaunchers']:
View
@@ -11307,16 +11307,26 @@ class ConfigHelpers:
def __init__(self):
"""Initialialize."""
#--Boss Master List or if that doesn't exist use the taglist
+ #version:
+ #>1.6.2 = 393218
+ # 1.6.1 = 393217
+ # 1.6 = 1
+ #<1.6 = 0
+ try:
+ import win32api
+ self.bossVersion = win32api.GetFileVersionInfo(dirs['mods'].join('BOSS.exe').s, '\\')[u'FileVersionLS']
+ except: #any version prior to 1.6.1 will fail and hence set to None and then try to set based on masterlist path.
+ self.bossVersion = None
self.bossMasterPath = dirs['mods'].join('BOSS//masterlist.txt')
- if not self.bossMasterPath.exists():
- self.bossMasterPath = dirs['mods'].join('masterlist.txt')
- self.bossVersion = 0
+ if self.bossVersion == None:
if not self.bossMasterPath.exists():
- self.bossVersion = 1 # in case the BOSS masterlist hasn't yet been created but BOSS.exe exists.
- self.bossMasterPath = dirs['patches'].join('taglist.txt')
- else: self.bossVersion = 1
+ self.bossMasterPath = dirs['mods'].join('masterlist.txt')
+ self.bossVersion = 0
+ if not self.bossMasterPath.exists():
+ self.bossVersion = 1 # in case the BOSS masterlist hasn't yet been created but BOSS.exe exists.
+ self.bossMasterPath = dirs['patches'].join('taglist.txt')
+ else: self.bossVersion = 1
self.bossUserPath = dirs['mods'].join('BOSS//userlist.txt')
- if not self.bossUserPath.exists(): self.bossUserPath = None
self.bossMasterTime = 0
self.bossUserTime = 0
self.bossMasterTags = {}
@@ -11330,25 +11340,26 @@ def refresh(self):
reFcomSwitch = re.compile('^[<>]')
reComment = re.compile(r'^\\.*')
reMod = re.compile(r'(^[_[(\w!].*?\.es[pm]$)',re.I)
- if path.mtime != mtime:
- tags.clear()
- ins = path.open('r')
- mod = None
- reBashTags = re.compile(r'%\s+{{BASH:([^}]+)}')
- for line in ins:
- line = reFcomSwitch.sub('',line)
- line = reComment.sub('',line)
- maMod = reMod.match(line)
- maBashTags = reBashTags.match(line)
- if maMod:
- mod = maMod.group(1)
- elif maBashTags and mod:
- modTags = maBashTags.group(1).split(',')
- modTags = map(string.strip,modTags)
- tags[GPath(mod)] = tuple(modTags)
- ins.close()
- self.bossMasterTime = path.mtime
- if userpath:
+ if path.exists():
+ if path.mtime != mtime:
+ tags.clear()
+ ins = path.open('r')
+ mod = None
+ reBashTags = re.compile(r'%\s+{{BASH:([^}]+)}')
+ for line in ins:
+ line = reFcomSwitch.sub('',line)
+ line = reComment.sub('',line)
+ maMod = reMod.match(line)
+ maBashTags = reBashTags.match(line)
+ if maMod:
+ mod = maMod.group(1)
+ elif maBashTags and mod:
+ modTags = maBashTags.group(1).split(',')
+ modTags = map(string.strip,modTags)
+ tags[GPath(mod)] = tuple(modTags)
+ ins.close()
+ self.bossMasterTime = path.mtime
+ if userpath.exists():
if userpath.mtime != utime:
ins = userpath.open('r')
mod = None

4 comments on commit 6ba14ce

@Sativarg

Too bad this does not effect the BOSS lag I was having. My search_and_replace_Basher.py still works though

#---------------------------------------------------------------
#           Name: search_and_replace_Basher.py
#         Author: Kevin Harris edited by Sativarg
#  Last Modified: 11/05/2010
#    Description: helps my system deal with 
#                 Wrye Flash NV loading BOSS
#---------------------------------------------------------------

import os
import sys
import fileinput

textToSearchFor   = 'os.spawnv(os.P_WAIT,exePath.s,exeArgs)'
textToReplaceWith = 'os.spawnv(os.P_NOWAIT,exePath.s,exeArgs)'
fileToSearch      = 'basher.py'


oldFileName  = 'old_' + fileToSearch
tempFileName = 'temp_' + fileToSearch

# If there's already an 'old_' prefixed backup file there from
# a previous run, remove it...
if os.path.isfile( oldFileName ):
    os.remove( oldFileName )

tempFile = open( tempFileName, 'w' )

for line in fileinput.input( fileToSearch ):
    tempFile.write( line.replace( textToSearchFor, textToReplaceWith ) )

tempFile.close()

# Rename the original file by prefixing it with 'old_'
os.rename( fileToSearch, oldFileName )

# Rename the temporary file to what the original was named...
os.rename( tempFileName, fileToSearch )
@Sativarg

UPDATE: OK I see this is not actually ported correctly to from oblivion
SourceForge.net Repository - [oblivionworks] Revision 655 - http://oblivionworks.svn.sourceforge.net/viewvc/oblivionworks?view=revision&revision=655
I am seeing that there is no more (os.P_WAIT,exePath.s,exeArgs) and it has
in deed been changed as below.

11554 os.spawnv(os.P_NOWAIT,exePath.s,exeArgs) # from r655

But here is the line from the New Vegas port and I see now what keeps me
lagging

11122 os.spawnv(os.P_WAIT,exePath.s,exeArgs) # from here

@Sativarg

Update 2
I just got better informed by Gaticus so sorry if I've been bugging you

Comment By: Gaticus (gaticus)
Date: 2010-11-07 05:35

Message:
Flash would not include those changes yet. Give it time :)
It wouldn't be wise for him to incorporate changes that aren't even
finalized.

@valda
Owner
valda commented on 6ba14ce Nov 7, 2010

My god, I was overlooking that commit.
That was taken in right away, so please try.
Thank you very much!

Please sign in to comment.