mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Update to kwdb 0.0.20240415000
Quite some new functions and constants.
This commit is contained in:
parent
f854e94349
commit
b7f16900ed
9 changed files with 193 additions and 39 deletions
|
@ -1159,6 +1159,37 @@ def llChar(code):
|
|||
return u'' if code == 0 else u'\uFFFD'
|
||||
return unichr(code)
|
||||
|
||||
def InternalGetAlg(alg):
|
||||
hash = None
|
||||
if alg == u'md5':
|
||||
hash = hashlib.md5()
|
||||
elif alg == u'sha1':
|
||||
hash = hashlib.sha1()
|
||||
elif alg == u'sha224':
|
||||
hash = hashlib.sha224()
|
||||
elif alg == u'sha256':
|
||||
hash = hashlib.sha256()
|
||||
elif alg == u'sha384':
|
||||
hash = hashlib.sha384()
|
||||
elif alg == u'sha512':
|
||||
hash = hashlib.sha512()
|
||||
return hash
|
||||
|
||||
def llComputeHash(data, alg):
|
||||
data = bytewrap(uniwrap(fs(data)).encode('utf8'))
|
||||
alg = fs(alg)
|
||||
hash = InternalGetAlg(alg if alg != u'md5_sha1' else u'md5')
|
||||
if hash is None:
|
||||
raise ELSLCantCompute # spews error
|
||||
hash.update(data)
|
||||
ret = hash.hexdigest()
|
||||
if alg == u'md5_sha1':
|
||||
# md5_sha1 consists of concatenating the MD5 and the SHA-1
|
||||
hash = InternalGetAlg(u'sha1')
|
||||
hash.update(data)
|
||||
ret += hash.hexdigest()
|
||||
return ret.decode('utf8')
|
||||
|
||||
def llCos(f):
|
||||
f = ff(f)
|
||||
if math.isinf(f):
|
||||
|
@ -1308,19 +1339,7 @@ def llHMAC(pwd, data, alg):
|
|||
pwd = bytewrap(uniwrap(fs(pwd)).encode('utf8'))
|
||||
data = bytewrap(uniwrap(fs(data)).encode('utf8'))
|
||||
alg = fs(alg)
|
||||
hash = None
|
||||
if alg == u'md5':
|
||||
hash = hashlib.md5()
|
||||
elif alg == u'sha1':
|
||||
hash = hashlib.sha1()
|
||||
elif alg == u'sha224':
|
||||
hash = hashlib.sha224()
|
||||
elif alg == u'sha256':
|
||||
hash = hashlib.sha256()
|
||||
elif alg == u'sha384':
|
||||
hash = hashlib.sha384()
|
||||
elif alg == u'sha512':
|
||||
hash = hashlib.sha512()
|
||||
hash = InternalGetAlg(alg)
|
||||
if hash is None:
|
||||
raise ELSLCantCompute # spews error
|
||||
# Calculate the HMAC here, to avoid requiring yet another module
|
||||
|
@ -1536,6 +1555,12 @@ def llListFindList(lst, elems):
|
|||
return i
|
||||
return -1
|
||||
|
||||
def llListFindListNext(src, test, n):
|
||||
src = fl(src)
|
||||
test = fl(test)
|
||||
n = fi(n)
|
||||
raise eLSLCantCompute # TODO: Implement llListFindListNext
|
||||
|
||||
def llListFindStrided(src, test, start, end, stride):
|
||||
src = fl(src)
|
||||
test = fl(test)
|
||||
|
|
|
@ -325,6 +325,12 @@ def llGetLinkName(link):
|
|||
return NULL_KEY
|
||||
raise ELSLCantCompute
|
||||
|
||||
def llGetLinkSitFlags(link):
|
||||
link = fi(link)
|
||||
if link > 256 or (link < 0 and link != -4):
|
||||
return 0
|
||||
raise ELSLCantCompute
|
||||
|
||||
def llGetObjectLinkKey(id, link):
|
||||
# TODO: Investigate behaviour with invalid key, invalid link etc.
|
||||
raise ELSLCantCompute
|
||||
|
@ -355,4 +361,10 @@ def llGetVisualParams(id, params):
|
|||
# return [u""] * len(params)
|
||||
raise ELSLCantCompute
|
||||
|
||||
def llIsFriend(id):
|
||||
id = fk(id)
|
||||
if not cond(id):
|
||||
return 0
|
||||
raise ELSLCantCompute
|
||||
|
||||
# TODO: Add more predictable functions.
|
||||
|
|
|
@ -113,16 +113,18 @@ primParamsTypes = \
|
|||
, 42: 'sfff' # 42=PRIM_PROJECTOR
|
||||
, 43: 'i' # 43=PRIM_CLICK_ACTION
|
||||
, 44: 'iffi' # 44=PRIM_REFLECTION_PROBE
|
||||
# GLTF parameters admit an empty string in any of the places except the
|
||||
# first integer (face number). We're not prepared to deal with that.
|
||||
# , 45: 'isvvf' # 45=PRIM_GLTF_NORMAL
|
||||
# , 46: 'isvvfv' # 46=PRIM_GLTF_EMISSIVE
|
||||
# , 47: 'isvvfff' # 47=PRIM_GLTF_METALLIC_ROUGHNESS
|
||||
# , 48: 'isvvfvfifi' # 48=PRIM_GLTF_BASE_COLOR
|
||||
, 45: 'i*' # 45=PRIM_GLTF_NORMAL
|
||||
, 46: 'i*' # 46=PRIM_GLTF_EMISSIVE
|
||||
, 47: 'i*' # 47=PRIM_GLTF_METALLIC_ROUGHNESS
|
||||
, 48: 'i*' # 48=PRIM_GLTF_BASE_COLOR
|
||||
# GLTF parameters admit an empty string in any of the places. We're not
|
||||
# prepared to deal with that.
|
||||
# , 45: 'svvf' # 45=PRIM_GLTF_NORMAL
|
||||
# , 46: 'svvfv' # 46=PRIM_GLTF_EMISSIVE
|
||||
# , 47: 'svvfff' # 47=PRIM_GLTF_METALLIC_ROUGHNESS
|
||||
# , 48: 'svvfvfifi' # 48=PRIM_GLTF_BASE_COLOR
|
||||
, 45: '*' # 45=PRIM_GLTF_NORMAL
|
||||
, 46: '*' # 46=PRIM_GLTF_EMISSIVE
|
||||
, 47: '*' # 47=PRIM_GLTF_METALLIC_ROUGHNESS
|
||||
, 48: '*' # 48=PRIM_GLTF_BASE_COLOR
|
||||
, 49: 's' # 49=PRIM_RENDER_MATERIAL
|
||||
, 50: 'i' # 50=PRIM_SIT_FLAGS
|
||||
}
|
||||
|
||||
# llGetPrimitiveParams parameters with arguments. F=face, L=link.
|
||||
|
@ -137,6 +139,11 @@ primParamsArgs = \
|
|||
, 36: 'F' # PRIM_SPECULAR
|
||||
, 37: 'F' # PRIM_NORMAL
|
||||
, 38: 'F' # PRIM_ALPHA_MODE
|
||||
, 45: 'F' # PRIM_GLTF_NORMAL
|
||||
, 46: 'F' # PRIM_GLTF_EMISSIVE
|
||||
, 47: 'F' # PRIM_GLTF_METALLIC_ROUGHNESS
|
||||
, 48: 'F' # PRIM_GLTF_BASE_COLOR
|
||||
, 49: 'F' # PRIM_RENDER_MATERIAL
|
||||
}
|
||||
|
||||
# llGetPrimMediaParams and llGetLinkMedia return types
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue