Initial commit
This commit is contained in:
182
devtools/create_project/scripts/installer.vbs
Normal file
182
devtools/create_project/scripts/installer.vbs
Normal file
@@ -0,0 +1,182 @@
|
||||
'
|
||||
' ScummVM - Graphic Adventure Engine
|
||||
'
|
||||
' ScummVM is the legal property of its developers, whose names
|
||||
' are too numerous to list here. Please refer to the COPYRIGHT
|
||||
' file distributed with this source distribution.
|
||||
'
|
||||
' 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, version 2
|
||||
' of the License.
|
||||
'
|
||||
' 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.
|
||||
'
|
||||
'/
|
||||
|
||||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
' This script calls the iscc tool to generate a Inno Setup Windows installer for ScummVM
|
||||
'
|
||||
' It tries to read the Inno Setup installation folder from the registry and then calls the
|
||||
' command line script compiler to create the installer.
|
||||
'
|
||||
' This is called from the postbuild.cmd batch file
|
||||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
'================================================================
|
||||
' TODO: Reduce duplication with revision.vbs script
|
||||
' (ReadRegistryKey and ParseCommandLine are identical)
|
||||
'================================================================
|
||||
|
||||
Option Explicit
|
||||
|
||||
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
|
||||
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
' Folders
|
||||
Dim rootFolder : rootFolder = ""
|
||||
Dim targetFolder : targetFolder = ""
|
||||
|
||||
' Parse our command line arguments
|
||||
If ParseCommandLine() Then
|
||||
CreateInstaller()
|
||||
End If
|
||||
|
||||
'////////////////////////////////////////////////////////////////
|
||||
'// Installer creation
|
||||
'////////////////////////////////////////////////////////////////
|
||||
Sub CreateInstaller()
|
||||
' Get inno installation folder
|
||||
Dim innoPath : innoPath = GetInnoPath()
|
||||
If (innoPath = "") Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Build command line
|
||||
Dim commandLine : commandLine = """" & innoPath & "\iscc.exe"" /Qp" & _
|
||||
" /O""" & targetFolder & """" & _
|
||||
" """ & rootFolder & "\dists\win32\scummvm.iss"""
|
||||
|
||||
Dim oExec: Set oExec = WshShell.Exec(commandline)
|
||||
If Err.Number <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Error running iscc.exe!"
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Wait till the application is finished ...
|
||||
Dim ostdOut : Set oStdOut = oExec.StdOut
|
||||
Do While oExec.Status = 0
|
||||
If Not ostdOut.AtEndOfStream Then
|
||||
Wscript.StdErr.WriteLine ostdOut.ReadAll
|
||||
End If
|
||||
|
||||
WScript.Sleep 100
|
||||
Loop
|
||||
|
||||
If oExec.ExitCode <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Error while creating installer!"
|
||||
Exit Sub
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Function GetInnoPath()
|
||||
' Get the directory where Inno Setup (should) reside(s)
|
||||
Dim sInno
|
||||
|
||||
' First, try with 32-bit architecture
|
||||
sInno = ReadRegistryKey("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1", "InstallLocation", 32)
|
||||
|
||||
If sInno = "" Or IsNull(sInno) Then
|
||||
' No 32-bit version of Inno Setup installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
|
||||
sInno = ReadRegistryKey("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1", "InstallLocation", 64)
|
||||
End If
|
||||
|
||||
' Check if Inno Setup is present
|
||||
If sInno = "" Then
|
||||
Wscript.StdErr.WriteLine "Inno Setup not installed!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
GetInnoPath = sInno
|
||||
End Function
|
||||
|
||||
'////////////////////////////////////////////////////////////////
|
||||
'// Utilities
|
||||
'////////////////////////////////////////////////////////////////
|
||||
Function ParseCommandLine()
|
||||
ParseCommandLine = True
|
||||
|
||||
If Wscript.Arguments.Count <> 2 Then
|
||||
Wscript.StdErr.WriteLine "[Error] Invalid number of arguments (was: " & Wscript.Arguments.Count & ", expected: 2)"
|
||||
|
||||
ParseCommandLine = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Get our arguments
|
||||
rootFolder = Wscript.Arguments.Item(0)
|
||||
targetFolder = Wscript.Arguments.Item(1)
|
||||
|
||||
' Check that the folders are valid
|
||||
If Not FSO.FolderExists(rootFolder) Then
|
||||
Wscript.StdErr.WriteLine "[Error] Invalid root folder (" & rootFolder & ")"
|
||||
|
||||
ParseCommandLine = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not FSO.FolderExists(targetFolder) Then
|
||||
Wscript.StdErr.WriteLine "[Error] Invalid target folder (" & targetFolder & ")"
|
||||
|
||||
ParseCommandLine = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Set absolute paths
|
||||
rootFolder = FSO.GetAbsolutePathName(rootFolder)
|
||||
targetFolder = FSO.GetAbsolutePathName(targetFolder)
|
||||
End Function
|
||||
|
||||
Function ReadRegistryKey(shive, subkey, valuename, architecture)
|
||||
Dim hiveKey, objCtx, objLocator, objServices, objReg, Inparams, Outparams
|
||||
|
||||
' First, get the Registry Provider for the requested architecture
|
||||
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
|
||||
objCtx.Add "__ProviderArchitecture", architecture ' Must be 64 of 32
|
||||
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
|
||||
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
|
||||
Set objReg = objServices.Get("StdRegProv")
|
||||
|
||||
' Check the hive and give it the right value
|
||||
Select Case shive
|
||||
Case "HKCR", "HKEY_CLASSES_ROOT"
|
||||
hiveKey = &h80000000
|
||||
Case "HKCU", "HKEY_CURRENT_USER"
|
||||
hiveKey = &H80000001
|
||||
Case "HKLM", "HKEY_LOCAL_MACHINE"
|
||||
hiveKey = &h80000002
|
||||
Case "HKU", "HKEY_USERS"
|
||||
hiveKey = &h80000003
|
||||
Case "HKCC", "HKEY_CURRENT_CONFIG"
|
||||
hiveKey = &h80000005
|
||||
Case "HKDD", "HKEY_DYN_DATA" ' Only valid for Windows 95/98
|
||||
hiveKey = &h80000006
|
||||
Case Else
|
||||
MsgBox "Hive not valid (ReadRegistryKey)"
|
||||
End Select
|
||||
|
||||
Set Inparams = objReg.Methods_("GetStringValue").Inparameters
|
||||
Inparams.Hdefkey = hiveKey
|
||||
Inparams.Ssubkeyname = subkey
|
||||
Inparams.Svaluename = valuename
|
||||
Set Outparams = objReg.ExecMethod_("GetStringValue", Inparams,,objCtx)
|
||||
|
||||
ReadRegistryKey = Outparams.SValue
|
||||
End Function
|
||||
65
devtools/create_project/scripts/postbuild.cmd
Normal file
65
devtools/create_project/scripts/postbuild.cmd
Normal file
@@ -0,0 +1,65 @@
|
||||
@echo off
|
||||
|
||||
REM ---------------------------------------------------------------
|
||||
REM -- Post-Build Script
|
||||
REM ---------------------------------------------------------------
|
||||
REM
|
||||
REM Copy engine data and required dlls to the
|
||||
REM output folder and optionally create an installer
|
||||
REM
|
||||
REM Expected parameters
|
||||
REM Root folder
|
||||
REM Output folder
|
||||
REM SDL version
|
||||
REM Libs folder
|
||||
REM Installer ("1" to build, "0" to skip)
|
||||
|
||||
if "%~1"=="" goto error_root
|
||||
if "%~2"=="" goto error_output
|
||||
if "%~3"=="" goto error_sdl
|
||||
if "%~4"=="" goto error_libs
|
||||
if "%~5"=="" goto error_installer
|
||||
|
||||
echo Copying data files
|
||||
echo.
|
||||
|
||||
xcopy /F /Y "%~4/%~3.dll" "%~2" 1>NUL 2>&1
|
||||
xcopy /F /Y "%~4/WinSparkle.dll" "%~2" 1>NUL 2>&1
|
||||
xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_default.zip" "%~2" 1>NUL 2>&1
|
||||
xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_small.zip" "%~2" 1>NUL 2>&1
|
||||
|
||||
|
||||
if "%~5"=="0" goto done
|
||||
|
||||
echo Running installer script
|
||||
echo.
|
||||
@call cscript "%~1/devtools/create_project/scripts/installer.vbs" "%~1" "%~2" 1>NUL
|
||||
if not %errorlevel% == 0 goto error_script
|
||||
goto done
|
||||
|
||||
:error_root
|
||||
echo Invalid root folder (%~1)!
|
||||
goto done
|
||||
|
||||
:error_output
|
||||
echo Invalid output folder (%~2)!
|
||||
goto done
|
||||
|
||||
:error_sdl
|
||||
echo Invalid SDL parameter (was: %~3, allowed: SDL, SDL2)!
|
||||
goto done
|
||||
|
||||
:error_libs
|
||||
echo Invalid libs folder (%~4)!
|
||||
goto done
|
||||
|
||||
:error_installer
|
||||
echo Invalid installer parameter. Should be "0" or "1" (was %~5)!
|
||||
goto done
|
||||
|
||||
:error_script:
|
||||
echo An error occurred while running the installer script!
|
||||
goto done
|
||||
|
||||
:done
|
||||
exit /B0
|
||||
33
devtools/create_project/scripts/prebuild.cmd
Normal file
33
devtools/create_project/scripts/prebuild.cmd
Normal file
@@ -0,0 +1,33 @@
|
||||
@echo off
|
||||
|
||||
REM ---------------------------------------------------------------
|
||||
REM -- Pre-Build Script
|
||||
REM ---------------------------------------------------------------
|
||||
REM
|
||||
REM Generate file with revision number
|
||||
REM
|
||||
REM Expected parameters
|
||||
REM Root folder (the source root folder)
|
||||
REM Target folder (the build output folder, will be used to copy internal_revision.h)
|
||||
|
||||
if "%~1"=="" goto error_root
|
||||
if "%~2"=="" goto error_target
|
||||
|
||||
REM Run the revision script
|
||||
@call cscript "%~1/devtools/create_project/scripts/revision.vbs" "%~1" "%~2" 1>NUL
|
||||
if not %errorlevel% == 0 goto error_script
|
||||
goto done
|
||||
|
||||
:error_root
|
||||
echo Invalid root folder (%~1)!
|
||||
goto done
|
||||
|
||||
:error_target
|
||||
echo Invalid target folder (%~2)!
|
||||
goto done
|
||||
|
||||
:error_script:
|
||||
echo An error occurred while running the revision script!
|
||||
|
||||
:done
|
||||
exit /B0
|
||||
505
devtools/create_project/scripts/revision.vbs
Normal file
505
devtools/create_project/scripts/revision.vbs
Normal file
@@ -0,0 +1,505 @@
|
||||
'
|
||||
' ScummVM - Graphic Adventure Engine
|
||||
'
|
||||
' ScummVM is the legal property of its developers, whose names
|
||||
' are too numerous to list here. Please refer to the COPYRIGHT
|
||||
' file distributed with this source distribution.
|
||||
'
|
||||
' 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, version 2
|
||||
' of the License.
|
||||
'
|
||||
' 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.
|
||||
'
|
||||
' Based off OpenTTD determineversion.vbs (released under GPL version 2)
|
||||
'
|
||||
'/
|
||||
|
||||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
' This script tries to determine a revision number based on the current working tree
|
||||
' by trying revision control tools in the following order:
|
||||
' - git (with hg-git detection)
|
||||
' - mercurial
|
||||
' - TortoiseSVN
|
||||
' - SVN
|
||||
'
|
||||
' It then writes a new header file to be included during build, with the revision
|
||||
' information, the current branch, the revision control system (when not git) and
|
||||
' a flag when the tree is dirty.
|
||||
'
|
||||
' This is called from the prebuild.cmd batch file
|
||||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
Option Explicit
|
||||
|
||||
' Working copy check priority:
|
||||
' True: TortoiseSVN -> SVN -> Git -> Hg
|
||||
' False: Git -> Hg -> TortoiseSVN -> SVN
|
||||
Dim prioritySVN: prioritySVN = False
|
||||
|
||||
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
|
||||
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
' Folders
|
||||
Dim rootFolder : rootFolder = ""
|
||||
Dim targetFolder : targetFolder = ""
|
||||
|
||||
' Info variables
|
||||
Dim tool : tool = ""
|
||||
Dim branch : branch = "trunk"
|
||||
Dim revision : revision = ""
|
||||
Dim modified : modified = False
|
||||
|
||||
' Parse our command line arguments
|
||||
If ParseCommandLine() Then
|
||||
' Determine the revision and update the props file with the revision numbers
|
||||
DetermineRevision()
|
||||
End If
|
||||
|
||||
'////////////////////////////////////////////////////////////////
|
||||
'// Revision checking
|
||||
'////////////////////////////////////////////////////////////////
|
||||
Sub DetermineRevision()
|
||||
Wscript.StdErr.WriteLine "Determining current revision:"
|
||||
|
||||
' Set the current directory to the root folder
|
||||
WshShell.CurrentDirectory = rootFolder
|
||||
|
||||
' Try until we find a proper working copy
|
||||
If (prioritySVN) Then
|
||||
If Not DetermineTortoiseSVNVersion() Then
|
||||
If Not DetermineSVNVersion() Then
|
||||
If Not DetermineGitVersion() Then
|
||||
If Not DetermineHgVersion() Then
|
||||
Wscript.StdErr.WriteLine "Could not determine the current revision, skipping..."
|
||||
OutputRevisionHeader ""
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If Not DetermineGitVersion() Then
|
||||
If Not DetermineHgVersion() Then
|
||||
If Not DetermineTortoiseSVNVersion() Then
|
||||
If Not DetermineSVNVersion() Then
|
||||
Wscript.StdErr.WriteLine "Could not determine the current revision, skipping..."
|
||||
OutputRevisionHeader ""
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim outputInfo : outputInfo = "Found revision " & revision & " on branch " & branch
|
||||
|
||||
' Setup our revision string
|
||||
Dim revisionString : revisionString = revision
|
||||
|
||||
If (modified) Then
|
||||
revisionString = revisionString & "-dirty"
|
||||
outputInfo = outputInfo & " (dirty)"
|
||||
End If
|
||||
|
||||
' If we are not on trunk, add the branch name to the revision string
|
||||
If (branch <> "trunk" And branch <> "master" And branch <> "") Then
|
||||
revisionString = revisionString & "(" & branch & ")"
|
||||
End If
|
||||
|
||||
' Add the DVCS name at the end (when not git)
|
||||
If (tool <> "git") Then
|
||||
revisionString = revisionString & "-" & tool
|
||||
outputInfo = outputInfo & " using " & tool
|
||||
End If
|
||||
|
||||
Wscript.StdErr.WriteLine outputInfo & vbCrLf
|
||||
|
||||
OutputRevisionHeader revisionString
|
||||
End Sub
|
||||
|
||||
' Output revision header file
|
||||
Sub OutputRevisionHeader(str)
|
||||
FSO.CopyFile rootFolder & "\\base\\internal_revision.h.in", targetFolder & "\\internal_revision.h.tmp"
|
||||
FindReplaceInFile targetFolder & "\\internal_revision.h.tmp", "@REVISION@", str
|
||||
CompareFileAndReplace targetFolder & "\\internal_revision.h.tmp", targetFolder & "\\internal_revision.h"
|
||||
End Sub
|
||||
|
||||
Function DetermineTortoiseSVNVersion()
|
||||
Err.Clear
|
||||
On Error Resume Next
|
||||
DetermineTortoiseSVNVersion = False
|
||||
Wscript.StdErr.Write " TortoiseSVN... "
|
||||
tool = "svn"
|
||||
|
||||
' Get the directory where TortoiseSVN (should) reside(s)
|
||||
Dim sTortoise
|
||||
|
||||
' First, try with 32-bit architecture
|
||||
sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 32)
|
||||
|
||||
If sTortoise = "" Or IsNull(sTortoise) Then
|
||||
' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
|
||||
sTortoise = ReadRegistryKey("HKLM", "SOFTWARE\TortoiseSVN", "Directory", 64)
|
||||
End If
|
||||
|
||||
' Check if Tortoise is present
|
||||
If sTortoise = "" Then
|
||||
Wscript.StdErr.WriteLine "TortoiseSVN not installed!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' If TortoiseSVN is installed, try to get the revision number
|
||||
Dim SubWCRev : Set SubWCRev = WScript.CreateObject("SubWCRev.object")
|
||||
SubWCRev.GetWCInfo rootFolder, 0, 0
|
||||
|
||||
' Check if this is a working copy
|
||||
If Not SubWCRev.IsSvnItem Then
|
||||
Wscript.StdErr.WriteLine "Not a working copy!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
revision = SubWCRev.Revision
|
||||
|
||||
' Check for modifications
|
||||
If SubWCRev.HasModifications Then modified = True
|
||||
|
||||
If revision = "" Then
|
||||
Wscript.StdErr.WriteLine "No revision found!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
DetermineTortoiseSVNVersion = True
|
||||
End Function
|
||||
|
||||
Function DetermineSVNVersion()
|
||||
Err.Clear
|
||||
On Error Resume Next
|
||||
DetermineSVNVersion = False
|
||||
Wscript.StdErr.Write " SVN... "
|
||||
tool = "svn"
|
||||
|
||||
' Set the environment to English
|
||||
WshShell.Environment("PROCESS")("LANG") = "en"
|
||||
|
||||
' Do we have subversion installed? Check immediately whether we've got a modified WC.
|
||||
Dim oExec: Set oExec = WshShell.Exec("svnversion " & rootFolder)
|
||||
If Err.Number <> 0 Then
|
||||
Wscript.StdErr.WriteLine "SVN not installed!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
WScript.Sleep 100
|
||||
Loop
|
||||
|
||||
Dim line: line = OExec.StdOut.ReadLine()
|
||||
If line = "exported" Then
|
||||
Wscript.StdErr.WriteLine "Not a working copy!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If InStr(line, "M") Then
|
||||
modified = True
|
||||
End If
|
||||
|
||||
' And use svn info to get the correct revision and branch information.
|
||||
Set oExec = WshShell.Exec("svn info " & rootFolder)
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Wscript.StdErr.WriteLine "No revision found!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Do
|
||||
line = OExec.StdOut.ReadLine()
|
||||
If InStr(line, "Last Changed Rev") Then
|
||||
revision = Mid(line, 19)
|
||||
End If
|
||||
Loop While Not OExec.StdOut.atEndOfStream
|
||||
|
||||
If revision = 0 Then
|
||||
Wscript.StdErr.WriteLine "No revision found!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
DetermineSVNVersion = True
|
||||
End Function
|
||||
|
||||
Function DetermineGitVersion()
|
||||
Err.Clear
|
||||
On Error Resume Next
|
||||
DetermineGitVersion = False
|
||||
Dim line
|
||||
Wscript.StdErr.Write " Git... "
|
||||
tool = "git"
|
||||
|
||||
' First check if we have both a .git & .hg folders (in case hg-git has been set up to have the git folder at the working copy level)
|
||||
If FSO.FolderExists(rootFolder & "/.git") And FSO.FolderExists(rootFolder & "/.hg") Then
|
||||
Wscript.StdErr.WriteLine "Mercurial clone with git repository in tree!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Set the environment to English
|
||||
WshShell.Environment("PROCESS")("LANG") = "en"
|
||||
|
||||
' Detect if we are using msysgit that has a cmd script in the path instead of an exe...
|
||||
Dim gitPath : gitPath = "git "
|
||||
Dim oExec : Set oExec = WshShell.Exec("git")
|
||||
If Err.Number <> 0 Then
|
||||
gitPath = "git.cmd "
|
||||
End If
|
||||
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec(gitPath & "rev-parse --verify HEAD")
|
||||
If Err.Number <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Git not installed!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
WScript.Sleep 100
|
||||
Loop
|
||||
|
||||
If oExec.ExitCode <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Error parsing git revision!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Get the version hash
|
||||
Dim hash : hash = oExec.StdOut.ReadLine()
|
||||
|
||||
' Make sure index is in sync with disk
|
||||
Set oExec = WshShell.Exec(gitPath & "update-index --refresh --unmerged")
|
||||
If Err.Number = 0 Then
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
WScript.Sleep 100
|
||||
Loop
|
||||
End If
|
||||
|
||||
Set oExec = WshShell.Exec(gitPath & "diff-index --quiet HEAD " & rootFolder)
|
||||
If oExec.ExitCode <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Error parsing git revision!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
WScript.Sleep 100
|
||||
Loop
|
||||
|
||||
If oExec.ExitCode = 1 Then
|
||||
modified = True
|
||||
End If
|
||||
|
||||
' Get branch name
|
||||
Set oExec = WshShell.Exec(gitPath & "symbolic-ref HEAD")
|
||||
If Err.Number = 0 Then
|
||||
line = oExec.StdOut.ReadLine()
|
||||
line = Mid(line, InStrRev(line, "/") + 1)
|
||||
If line <> "master" Then
|
||||
branch = line
|
||||
End If
|
||||
End If
|
||||
|
||||
' Get revision description
|
||||
Set oExec = WshShell.Exec(gitPath & "describe --match desc/*")
|
||||
If Err.Number = 0 Then
|
||||
line = oExec.StdOut.ReadLine()
|
||||
line = Mid(line, InStr(line, "-") + 1)
|
||||
If line <> "" Then
|
||||
revision = line
|
||||
End If
|
||||
End If
|
||||
|
||||
' Fallback to abbreviated revision number if needed
|
||||
If revision = "" Then
|
||||
revision = Mid(hash, 1, 7)
|
||||
End If
|
||||
|
||||
DetermineGitVersion = True
|
||||
End Function
|
||||
|
||||
Function DetermineHgVersion()
|
||||
Err.Clear
|
||||
On Error Resume Next
|
||||
DetermineHgVersion = False
|
||||
Wscript.StdErr.Write " Mercurial... "
|
||||
tool = "hg"
|
||||
|
||||
Err.Clear
|
||||
Dim oExec: Set oExec = WshShell.Exec("hg parents --template ""{rev}:{node|short}""")
|
||||
If Err.Number <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Mercurial not installed!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
WScript.Sleep 100
|
||||
Loop
|
||||
|
||||
If oExec.ExitCode <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Error parsing mercurial revision!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Dim info : info = Split(OExec.StdOut.ReadLine(), ":")
|
||||
Dim version : version = info(0)
|
||||
Dim hash : hash = info(1)
|
||||
|
||||
Set oExec = WshShell.Exec("hg status " & rootFolder)
|
||||
If Err.Number <> 0 Then
|
||||
Wscript.StdErr.WriteLine "Error parsing mercurial revision!"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Check for modifications
|
||||
Do
|
||||
line = OExec.StdOut.ReadLine()
|
||||
If Len(line) > 0 And Mid(line, 1, 1) <> "?" Then
|
||||
modified = True
|
||||
Exit Do
|
||||
End If
|
||||
Loop While Not OExec.StdOut.atEndOfStream
|
||||
|
||||
' Check for branch
|
||||
Set oExec = WshShell.Exec("hg branch")
|
||||
If Err.Number = 0 Then
|
||||
line = OExec.StdOut.ReadLine()
|
||||
If line <> "default" Then
|
||||
branch = line
|
||||
End If
|
||||
End If
|
||||
|
||||
' Check for SVN clone
|
||||
Set oExec = WshShell.Exec("hg log -f -l 1 --template ""{svnrev}\n"" --cwd " & rootFolder)
|
||||
If Err.Number = 0 Then
|
||||
revision = Mid(OExec.StdOut.ReadLine(), 7)
|
||||
revision = Mid(revision, 1, InStr(revision, ")") - 1)
|
||||
tool = "svn-hg"
|
||||
End If
|
||||
|
||||
' Fallback to abbreviated revision number
|
||||
If revision = "" Then
|
||||
revision = version & "(" & hash & ")"
|
||||
End If
|
||||
|
||||
DetermineHgVersion = True
|
||||
End Function
|
||||
|
||||
'////////////////////////////////////////////////////////////////
|
||||
'// Utilities
|
||||
'////////////////////////////////////////////////////////////////
|
||||
Function ParseCommandLine()
|
||||
ParseCommandLine = True
|
||||
|
||||
If Wscript.Arguments.Count <> 2 Then
|
||||
Wscript.StdErr.WriteLine "[Error] Invalid number of arguments (was: " & Wscript.Arguments.Count & ", expected: 2)"
|
||||
|
||||
ParseCommandLine = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Get our arguments
|
||||
rootFolder = Wscript.Arguments.Item(0)
|
||||
targetFolder = Wscript.Arguments.Item(1)
|
||||
|
||||
' Check that the folders are valid
|
||||
If Not FSO.FolderExists(rootFolder) Then
|
||||
Wscript.StdErr.WriteLine "[Error] Invalid root folder (" & rootFolder & ")"
|
||||
|
||||
ParseCommandLine = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not FSO.FolderExists(targetFolder) Then
|
||||
Wscript.StdErr.WriteLine "[Error] Invalid target folder (" & targetFolder & ")"
|
||||
|
||||
ParseCommandLine = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Set absolute paths
|
||||
rootFolder = FSO.GetAbsolutePathName(rootFolder)
|
||||
targetFolder = FSO.GetAbsolutePathName(targetFolder)
|
||||
End Function
|
||||
|
||||
Function ReadRegistryKey(shive, subkey, valuename, architecture)
|
||||
Dim hiveKey, objCtx, objLocator, objServices, objReg, Inparams, Outparams
|
||||
|
||||
' First, get the Registry Provider for the requested architecture
|
||||
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
|
||||
objCtx.Add "__ProviderArchitecture", architecture ' Must be 64 of 32
|
||||
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
|
||||
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
|
||||
Set objReg = objServices.Get("StdRegProv")
|
||||
|
||||
' Check the hive and give it the right value
|
||||
Select Case shive
|
||||
Case "HKCR", "HKEY_CLASSES_ROOT"
|
||||
hiveKey = &h80000000
|
||||
Case "HKCU", "HKEY_CURRENT_USER"
|
||||
hiveKey = &H80000001
|
||||
Case "HKLM", "HKEY_LOCAL_MACHINE"
|
||||
hiveKey = &h80000002
|
||||
Case "HKU", "HKEY_USERS"
|
||||
hiveKey = &h80000003
|
||||
Case "HKCC", "HKEY_CURRENT_CONFIG"
|
||||
hiveKey = &h80000005
|
||||
Case "HKDD", "HKEY_DYN_DATA" ' Only valid for Windows 95/98
|
||||
hiveKey = &h80000006
|
||||
Case Else
|
||||
MsgBox "Hive not valid (ReadRegistryKey)"
|
||||
End Select
|
||||
|
||||
Set Inparams = objReg.Methods_("GetStringValue").Inparameters
|
||||
Inparams.Hdefkey = hiveKey
|
||||
Inparams.Ssubkeyname = subkey
|
||||
Inparams.Svaluename = valuename
|
||||
Set Outparams = objReg.ExecMethod_("GetStringValue", Inparams,,objCtx)
|
||||
|
||||
ReadRegistryKey = Outparams.SValue
|
||||
End Function
|
||||
|
||||
Sub FindReplaceInFile(filename, to_find, replacement)
|
||||
Dim file, data
|
||||
Set file = FSO.OpenTextFile(filename, 1, 0, 0)
|
||||
data = file.ReadAll
|
||||
file.Close
|
||||
data = Replace(data, to_find, replacement)
|
||||
Set file = FSO.CreateTextFile(filename, -1, 0)
|
||||
file.Write data
|
||||
file.Close
|
||||
End Sub
|
||||
|
||||
Sub CompareFileAndReplace(src_filename, dst_filename)
|
||||
Dim file, src_data, dst_data
|
||||
Set file = FSO.OpenTextFile(src_filename, 1, 0, 0)
|
||||
src_data = file.ReadAll
|
||||
file.Close
|
||||
If Not FSO.FileExists(dst_filename) Then
|
||||
FSO.CopyFile src_filename, dst_filename, True
|
||||
Else
|
||||
Set file = FSO.OpenTextFile(dst_filename, 1, 0, 0)
|
||||
dst_data = file.ReadAll
|
||||
file.Close
|
||||
If StrComp(src_data, dst_data, vbBinaryCompare) <> 0 Then
|
||||
' Files are different, overwrite the destination
|
||||
FSO.CopyFile src_filename, dst_filename, True
|
||||
End If
|
||||
End If
|
||||
' Remove temporary source
|
||||
FSO.DeleteFile src_filename
|
||||
End Sub
|
||||
150
devtools/create_project/scripts/scummvm.natvis
Normal file
150
devtools/create_project/scripts/scummvm.natvis
Normal file
@@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Debug visualizers for a few common ScummVM types for Visual Studio 2012 and up.
|
||||
|
||||
To use, copy this file into Documents\Visual Studio 20xx\Visualizers.
|
||||
-->
|
||||
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" MenuName="Add to Image Watch"/>
|
||||
|
||||
<Type Name="Graphics::Surface">
|
||||
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
|
||||
</Type>
|
||||
|
||||
<Type Name="Graphics::Surface">
|
||||
<Expand>
|
||||
<Synthetic Name="[type]">
|
||||
<DisplayString>UINT8</DisplayString>
|
||||
</Synthetic>
|
||||
<Item Name="[channels]" Condition="format.bytesPerPixel==1">1</Item>
|
||||
<Item Name="[channels]" Condition="format.bytesPerPixel==2">2</Item>
|
||||
<Synthetic Name="[channels]" Condition="format.bytesPerPixel==3">
|
||||
<DisplayString>RGB</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[channels]" Condition="format.bytesPerPixel==4">
|
||||
<DisplayString>RGBA</DisplayString>
|
||||
</Synthetic>
|
||||
<Item Name="[width]">w</Item>
|
||||
<Item Name="[height]">h</Item>
|
||||
<Item Name="[stride]">pitch</Item>
|
||||
<Item Name="[data]">pixels</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::Array<*>">
|
||||
<DisplayString>{{ size={_size} }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[size]">_size</Item>
|
||||
<Item Name="[capacity]">_capacity</Item>
|
||||
<ArrayItems>
|
||||
<Size>_size</Size>
|
||||
<ValuePointer>_storage</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::HashMap<*,*,*,*>">
|
||||
<DisplayString>{{ size={_size} }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[size]">_size</Item>
|
||||
<Item Name="[capacity]">_mask + 1</Item>
|
||||
<Item Name="[deleted]">_deleted</Item>
|
||||
<CustomListItems MaxItemsPerView="5000" ExcludeView="Test">
|
||||
<Variable Name="ctr" InitialValue="0" />
|
||||
<Size>_size</Size>
|
||||
<Loop>
|
||||
<Break Condition="ctr > _mask" />
|
||||
<Item Condition="_storage[ctr] > 1" Name="[{_storage[ctr]->_key}]">*_storage[ctr],view(MapHelper)</Item>
|
||||
<Exec>ctr++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::HashMap<*,*,*,*>::Node" IncludeView="MapHelper">
|
||||
<DisplayString>{_value}</DisplayString>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::HashMap<*,*,*,*>::IteratorImpl<*>">
|
||||
<DisplayString>{_hashmap->_storage[_idx],na}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[ptr]">_hashmap->_storage[_idx]</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::List<*>">
|
||||
<DisplayString Condition="&_anchor == _anchor._next">{{ empty }}</DisplayString>
|
||||
<DisplayString Condition="&_anchor != _anchor._next">{{ non-empty }}</DisplayString>
|
||||
<Expand>
|
||||
<CustomListItems Condition="&_anchor != _anchor._next">
|
||||
<Variable Name="head" InitialValue="&_anchor"/>
|
||||
<Variable Name="iter" InitialValue="_anchor._next"/>
|
||||
<Loop>
|
||||
<Break Condition="iter == head"/>
|
||||
<Item>((Common::ListInternal::Node<$T1>*)iter)->_data</Item>
|
||||
<Exec>iter = iter->_next</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::ListInternal::Node<*>">
|
||||
<DisplayString>{_data}</DisplayString>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::ListInternal::Iterator<*>">
|
||||
<AlternativeType Name="Common::ListInternal::ConstIterator<*>" />
|
||||
<DisplayString>{((Common::ListInternal::Node<$T1>*)_node)->_data}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[ptr]">((Common::ListInternal::Node<$T1>*)_node)->_data</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::String">
|
||||
<DisplayString>{_str,na}</DisplayString>
|
||||
<StringView>_str,na</StringView>
|
||||
<Expand>
|
||||
<Item Name="[size]">_size</Item>
|
||||
<Item Condition="_str != _storage" Name="[capacity]">_extern._capacity</Item>
|
||||
<Item Condition="_str != _storage && _extern._refCount != 0" Name="[refCount]">*_extern._refCount</Item>
|
||||
<ArrayItems>
|
||||
<Size>_size</Size>
|
||||
<ValuePointer>_str</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::U32String">
|
||||
<DisplayString>{_str,s32}</DisplayString>
|
||||
<StringView>_str,s32</StringView>
|
||||
<Expand>
|
||||
<Item Name="[size]">_size</Item>
|
||||
<Item Condition="_str != _storage" Name="[capacity]">_extern._capacity</Item>
|
||||
<Item Condition="_str != _storage && _extern._refCount != 0" Name="[refCount]">*_extern._refCount</Item>
|
||||
<ArrayItems>
|
||||
<Size>_size</Size>
|
||||
<ValuePointer>_str</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::WeakPtr<*>">
|
||||
<DisplayString Condition="_pointer == 0">nullptr</DisplayString>
|
||||
<DisplayString Condition="_pointer != 0">{*_pointer}</DisplayString>
|
||||
<Expand>
|
||||
<Item Condition="_pointer != 0" Name="[ptr]">_pointer</Item>
|
||||
<Item Condition="_tracker != 0" Name="[refCount]">_tracker->_strongRefCount</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Common::SharedPtr<*>">
|
||||
<DisplayString Condition="_pointer == 0">nullptr</DisplayString>
|
||||
<DisplayString Condition="_pointer != 0">{*_pointer}</DisplayString>
|
||||
<Expand>
|
||||
<Item Condition="_pointer != 0" Name="[ptr]">_pointer</Item>
|
||||
<Item Condition="_tracker != 0" Name="[refCount]">_tracker->_strongRefCount</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
||||
Reference in New Issue
Block a user