Skip to content

Commit

Permalink
2.1.0.5
Browse files Browse the repository at this point in the history
* Corrected :
- Better stability on downloaded images (Some never download :S and miss
in the MIX)
* Added :
- Dynamique Handle to API server, now I can force the server to ask (for
the futur when we have a fallback server ;) or country based server )
- Lot's of new Picto media (Nb of player, Notes, Classification, Editor,
Developer, Genre) -> Beta it can change soon.
- Added 3 news MIX Template for Bigshot Theme with these new picto (1 is
directly on local, the 2 other are on the repository, you can download
them directly from UXS)
* WARNING Added things that can "broke" you existing MIX Template
- You need to put the full Xpath to the Source_Value node (exemple :
Game need to start by 'Data/jeu/' and System by 'Data/systeme
[id="%IDSYSTEM%"]')
- The CENTER/LEFT/RIGHT/UP/DOWN function in Target_TopLeftX,
Target_TopLeftY (and other) now take the "origin" point of the picture
(default are TopLeft corner of the Picture)
- You can now use Target_OriginPicX and Target_OriginPicY to fixe the
origin point of the picture. So now to center a picture you need to put
:
<Target_TopLeftX>CENTER</Target_TopLeftX>
<Target_OriginPicX>CENTER</Target_OriginPicX>
<Target_TopLeftY>CENTER</Target_TopLeftY>
<Target_OriginPicY>CENTER</Target_OriginPicY>
(The Origin point of the picture will be the center, and we center this
origin point to the final picture)
  • Loading branch information
Universal-Rom-Tools committed Jan 31, 2017
1 parent 43070ad commit 358d974
Show file tree
Hide file tree
Showing 45 changed files with 485 additions and 1,649 deletions.
2 changes: 1 addition & 1 deletion Include/_Hash.au3
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,4 @@ Func _SHA1ForFile($sFile)

Return SetError(0, 0, $sSHA1)

EndFunc ;==>_SHA1ForFile
EndFunc ;==>_SHA1ForFile
335 changes: 335 additions & 0 deletions Include/_Hash.au3.Backup.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
; #FUNCTION# ;===============================================================================
;
; Name...........: _MD5ForFile
; Description ...: Calculates MD5 value for the specific file.
; Syntax.........: _MD5ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns MD5 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - MD5Init function or call to it failed.
; |5 - MD5Update function or call to it failed.
; |6 - MD5Final function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _MD5ForFile($sFile)

Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)

If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf

Local $hFile = $a_hCall[0]

$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)

If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf

DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)

Local $hFileMappingObject = $a_hCall[0]

$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)

If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf

Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)

Local $tMD5_CTX = DllStructCreate("dword i[2];" & _
"dword buf[4];" & _
"ubyte in[64];" & _
"ubyte digest[16]")

DllCall("advapi32.dll", "none", "MD5Init", "ptr", DllStructGetPtr($tMD5_CTX))

If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf

DllCall("advapi32.dll", "none", "MD5Update", _
"ptr", DllStructGetPtr($tMD5_CTX), _
"ptr", $pFile, _
"dword", $iBufferSize)

If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(5, 0, "")
EndIf

DllCall("advapi32.dll", "none", "MD5Final", "ptr", DllStructGetPtr($tMD5_CTX))

If @error Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(6, 0, "")
EndIf

DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)

Local $sMD5 = Hex(DllStructGetData($tMD5_CTX, "digest"))

Return SetError(0, 0, $sMD5)

EndFunc ;==>_MD5ForFile

; #FUNCTION# ;===============================================================================
;
; Name...........: _CRC32ForFile
; Description ...: Calculates CRC32 value for the specific file.
; Syntax.........: _CRC32ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns CRC32 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - RtlComputeCrc32 function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _CRC32ForFile($sFile)

Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)

If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf

Local $hFile = $a_hCall[0]

$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)

If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf

DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)

Local $hFileMappingObject = $a_hCall[0]

$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)

If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf

Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)

Local $a_iCall = DllCall("ntdll.dll", "dword", "RtlComputeCrc32", _
"dword", 0, _
"ptr", $pFile, _
"int", $iBufferSize)

If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf

DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)

Local $iCRC32 = $a_iCall[0]

Return SetError(0, 0, Hex($iCRC32))

EndFunc ;==>_CRC32ForFile

; #FUNCTION# ;===============================================================================
;
; Name...........: _SHA1ForFile
; Description ...: Calculates SHA1 value for the specific file.
; Syntax.........: _SHA1ForFile ($sFile)
; Parameters ....: $sFile - Full path to the file to process.
; Return values .: Success - Returns SHA1 value in form of hex string
; - Sets @error to 0
; Failure - Returns empty string and sets @error:
; |1 - CreateFile function or call to it failed.
; |2 - CreateFileMapping function or call to it failed.
; |3 - MapViewOfFile function or call to it failed.
; |4 - CryptAcquireContext function or call to it failed.
; |5 - CryptCreateHash function or call to it failed.
; |6 - CryptHashData function or call to it failed.
; |7 - CryptGetHashParam function or call to it failed.
; Author ........: trancexx
;
;==========================================================================================
Func _SHA1ForFile($sFile)

Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _
"wstr", $sFile, _
"dword", 0x80000000, _ ; GENERIC_READ
"dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE
"ptr", 0, _
"dword", 3, _ ; OPEN_EXISTING
"dword", 0, _ ; SECURITY_ANONYMOUS
"ptr", 0)

If @error Or $a_hCall[0] = -1 Then
Return SetError(1, 0, "")
EndIf

Local $hFile = $a_hCall[0]

$a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _
"hwnd", $hFile, _
"dword", 0, _ ; default security descriptor
"dword", 2, _ ; PAGE_READONLY
"dword", 0, _
"dword", 0, _
"ptr", 0)

If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)
Return SetError(2, 0, "")
EndIf

DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)

Local $hFileMappingObject = $a_hCall[0]

$a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _
"hwnd", $hFileMappingObject, _
"dword", 4, _ ; FILE_MAP_READ
"dword", 0, _
"dword", 0, _
"dword", 0)

If @error Or Not $a_hCall[0] Then
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(3, 0, "")
EndIf

Local $pFile = $a_hCall[0]
Local $iBufferSize = FileGetSize($sFile)

Local $a_iCall = DllCall("advapi32.dll", "int", "CryptAcquireContext", _
"ptr*", 0, _
"ptr", 0, _
"ptr", 0, _
"dword", 1, _ ; PROV_RSA_FULL
"dword", 0xF0000000) ; CRYPT_VERIFYCONTEXT

If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
Return SetError(4, 0, "")
EndIf

Local $hContext = $a_iCall[1]

$a_iCall = DllCall("advapi32.dll", "int", "CryptCreateHash", _
"ptr", $hContext, _
"dword", 0x00008004, _ ; CALG_SHA1
"ptr", 0, _ ; nonkeyed
"dword", 0, _
"ptr*", 0)

If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(5, 0, "")
EndIf

Local $hHashSHA1 = $a_iCall[5]

$a_iCall = DllCall("advapi32.dll", "int", "CryptHashData", _
"ptr", $hHashSHA1, _
"ptr", $pFile, _
"dword", $iBufferSize, _
"dword", 0)

If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptDestroyHash", "ptr", $hHashSHA1)
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(6, 0, "")
EndIf

Local $tOutSHA1 = DllStructCreate("byte[20]")

$a_iCall = DllCall("advapi32.dll", "int", "CryptGetHashParam", _
"ptr", $hHashSHA1, _
"dword", 2, _ ; HP_HASHVAL
"ptr", DllStructGetPtr($tOutSHA1), _
"dword*", 20, _
"dword", 0)

If @error Or Not $a_iCall[0] Then
DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)
DllCall("advapi32.dll", "int", "CryptDestroyHash", "ptr", $hHashSHA1)
DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)
Return SetError(7, 0, "")
EndIf

DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile)
DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject)

DllCall("advapi32.dll", "int", "CryptDestroyHash", "ptr", $hHashSHA1)

Local $sSHA1 = Hex(DllStructGetData($tOutSHA1, 1))

DllCall("advapi32.dll", "int", "CryptReleaseContext", "ptr", $hContext, "dword", 0)

Return SetError(0, 0, $sSHA1)

EndFunc ;==>_SHA1ForFile
Loading

0 comments on commit 358d974

Please sign in to comment.