Compare commits

...

15 Commits

Author SHA1 Message Date
Tom Rothamel f49a04468b Merge pull request #2017 from wchill/py3_ints
[Py3] Make Python 3 integer related changes
2019-10-09 19:30:49 -04:00
Tom Rothamel d337e47e1f Fix changelog. 2019-10-07 21:05:29 -04:00
Tom Rothamel d10d81647b Fix changelog typo. 2019-10-07 20:52:27 -04:00
Tom Rothamel e7708c23fb Merge pull request #2030 from Andykl/fix-dynamic-image
Fix dynamic image
2019-10-07 20:13:05 -04:00
Andy_kl cc45453f4a More correct clear target on prefix change 2019-10-08 03:11:48 +03:00
Andy_kl 4dba39c57a More correct comment 2019-10-08 00:16:09 +03:00
Andy_kl c570d96458 Remove debug print 2019-10-08 00:07:04 +03:00
Andy_kl 0888c1ae1c Set target back if changing the prefix refers to the same image. 2019-10-08 00:04:27 +03:00
Andy_kl 9222ca20c6 Do not lose target after lock 2019-10-07 23:34:11 +03:00
Andy_kl 4ad03d0f98 Set _duplicatable flag before first targeting 2019-10-07 23:31:40 +03:00
Tom Rothamel de33e805d4 Revert glGet of FBO.
This prevents having to query the GPU, which would force a thread
synchronization in a multithreaded GPU driver.
2019-10-06 13:35:04 -04:00
Eric Ahn f452540ad0 Add version check and define the long type if needed 2019-10-02 16:15:02 -07:00
Eric Ahn 2b65a69611 Import the int builtin as long 2019-10-02 15:48:04 -07:00
Eric Ahn 8c37264d84 Remove long constants and use new octal syntax 2019-10-02 15:40:53 -07:00
Eric Ahn 8ab711722c Fix integer division and remove long type 2019-10-02 15:24:42 -07:00
8 changed files with 52 additions and 42 deletions
+15 -12
View File
@@ -28,10 +28,17 @@ init python in distribute:
import struct
import stat
import shutil
import sys
import threading
from renpy import six
from zipfile import crc32
# Since the long type doesn't exist on py3, define it here
if six.PY3:
long = int
zlib.Z_DEFAULT_COMPRESSION = 5
class ZipFile(zipfile.ZipFile):
@@ -156,9 +163,9 @@ init python in distribute:
zi.create_system = 3
if xbit:
zi.external_attr = long(0100755) << 16
zi.external_attr = long(0o100755) << 16
else:
zi.external_attr = long(0100644) << 16
zi.external_attr = long(0o100644) << 16
self.zipfile.write_with_info(zi, path)
@@ -170,7 +177,7 @@ init python in distribute:
zi.date_time = self.get_date_time(path)
zi.compress_type = zipfile.ZIP_STORED
zi.create_system = 3
zi.external_attr = (long(0040755) << 16) | 0x10
zi.external_attr = (long(0o040755) << 16) | 0x10
self.zipfile.write_with_info(zi, path)
@@ -201,9 +208,9 @@ init python in distribute:
info.type = tarfile.DIRTYPE
if xbit:
info.mode = 0755
info.mode = 0o755
else:
info.mode = 0644
info.mode = 0o644
info.uid = 1000
info.gid = 1000
@@ -267,7 +274,7 @@ init python in distribute:
def mkdir(self, path):
if not os.path.isdir(path):
os.makedirs(path, 0755)
os.makedirs(path, 0o755)
def __init__(self, path):
self.path = path
@@ -282,9 +289,9 @@ init python in distribute:
shutil.copy2(path, fn)
if xbit:
os.chmod(fn, 0755)
os.chmod(fn, 0o755)
else:
os.chmod(fn, 0644)
os.chmod(fn, 0o644)
def add_directory(self, name, path):
fn = os.path.join(self.path, name)
@@ -396,7 +403,3 @@ init python in distribute:
for i in parallel_threads:
if i.done:
i.done()
+18 -11
View File
@@ -55,6 +55,13 @@ import math
import exceptions
import string
import array
from renpy import six
# Since the long type doesn't exist on py3, define it here
if six.PY3:
long = int
sha1, sha256, sha512, md5 = None, None, None, None
@@ -85,8 +92,8 @@ IMAGE_OS2_SIGNATURE_LE = 0x454C
IMAGE_VXD_SIGNATURE = 0x454C
IMAGE_NT_SIGNATURE = 0x00004550
IMAGE_NUMBEROF_DIRECTORY_ENTRIES= 16
IMAGE_ORDINAL_FLAG = 0x80000000L
IMAGE_ORDINAL_FLAG64 = 0x8000000000000000L
IMAGE_ORDINAL_FLAG = 0x80000000
IMAGE_ORDINAL_FLAG64 = long(0x8000000000000000)
OPTIONAL_HEADER_MAGIC_PE = 0x10b
OPTIONAL_HEADER_MAGIC_PE_PLUS = 0x20b
@@ -169,7 +176,7 @@ section_characteristics = [
('IMAGE_SCN_MEM_SHARED', 0x10000000),
('IMAGE_SCN_MEM_EXECUTE', 0x20000000),
('IMAGE_SCN_MEM_READ', 0x40000000),
('IMAGE_SCN_MEM_WRITE', 0x80000000L) ]
('IMAGE_SCN_MEM_WRITE', 0x80000000) ]
SECTION_CHARACTERISTICS = dict([(e[1], e[0]) for e in
section_characteristics]+section_characteristics)
@@ -816,7 +823,7 @@ class Structure:
for key in keys:
val = getattr(self, key)
if isinstance(val, int) or isinstance(val, long):
if isinstance(val, six.integer_types):
val_str = '0x%-8X' % (val)
if key == 'TimeDateStamp' or key == 'dwTimeStamp':
try:
@@ -1557,7 +1564,7 @@ class PE:
'Normal values are never larger than 0x10, the value is: 0x%x' %
self.OPTIONAL_HEADER.NumberOfRvaAndSizes )
for i in xrange(int(0x7fffffffL & self.OPTIONAL_HEADER.NumberOfRvaAndSizes)):
for i in xrange(int(0x7fffffff & self.OPTIONAL_HEADER.NumberOfRvaAndSizes)):
if len(self.__data__[offset:]) == 0:
break
@@ -2355,13 +2362,13 @@ class PE:
return None
#resource.NameIsString = (resource.Name & 0x80000000L) >> 31
resource.NameOffset = resource.Name & 0x7FFFFFFFL
resource.NameOffset = resource.Name & 0x7FFFFFFF
resource.__pad = resource.Name & 0xFFFF0000L
resource.Id = resource.Name & 0x0000FFFFL
resource.__pad = resource.Name & 0xFFFF0000
resource.Id = resource.Name & 0x0000FFFF
resource.DataIsDirectory = (resource.OffsetToData & 0x80000000L) >> 31
resource.OffsetToDirectory = resource.OffsetToData & 0x7FFFFFFFL
resource.DataIsDirectory = (resource.OffsetToData & 0x80000000) >> 31
resource.OffsetToDirectory = resource.OffsetToData & 0x7FFFFFFF
return resource
@@ -2683,7 +2690,7 @@ class PE:
raw_data[varword_offset+2:varword_offset+4], 0)
varword_offset += 4
if isinstance(word1, (int, long)) and isinstance(word1, (int, long)):
if isinstance(word1, six.integer_types):
var_struct.entry = {var_string: '0x%04x 0x%04x' % (word1, word2)}
var_offset = self.dword_align(
+3 -3
View File
@@ -835,9 +835,9 @@ init -1500 python in updater:
info.gname = "renpy"
if xbit or directory:
info.mode = 0777
info.mode = 0o777
else:
info.mode = 0666
info.mode = 0o666
if info.isreg():
with open(path, "rb") as f:
@@ -1090,7 +1090,7 @@ init -1500 python in updater:
umask = os.umask(0)
os.umask(umask)
os.chmod(new_path, 0777 & (~umask))
os.chmod(new_path, 0o777 & (~umask))
except:
pass
+9 -7
View File
@@ -229,7 +229,7 @@ def get_ordered_image_attributes(tag, attributes=(), sort=None):
for attr in attrcount:
if attr not in rv:
l.append((attrtotalpos[attr] / attrcount[attr], sort(attr), attr))
l.append((attrtotalpos[attr] // attrcount[attr], sort(attr), attr))
l.sort()
for i in l:
@@ -558,12 +558,6 @@ class DynamicImage(renpy.display.core.Displayable):
self.name = name
if scope is not None:
self.find_target(scope)
self._uses_scope = True
else:
self._uses_scope = False
if isinstance(name, basestring) and ("[prefix_" in name):
self._duplicatable = True
@@ -572,6 +566,12 @@ class DynamicImage(renpy.display.core.Displayable):
if ("[prefix_" in i):
self._duplicatable = True
if scope is not None:
self.find_target(scope)
self._uses_scope = True
else:
self._uses_scope = False
def _scope(self, scope, update):
return self.find_target(scope, update)
@@ -613,6 +613,7 @@ class DynamicImage(renpy.display.core.Displayable):
if (prefix != self.style.prefix) and self._duplicatable:
self.target = None
self.raw_target = None
super(DynamicImage, self).set_style_prefix(prefix, root)
@@ -685,6 +686,7 @@ class DynamicImage(renpy.display.core.Displayable):
rv = self._copy(args)
rv.target = None
rv.raw_target = None
# This does not set _duplicatable, since it should always remain the
# same.
return rv
+2 -2
View File
@@ -310,11 +310,11 @@ def draw_special(what, dest, x, y):
ramp = "\x00" * 256
for i in xrange(0, ramplen):
ramp += chr(255 * i / ramplen)
ramp += chr(255 * i // ramplen)
ramp += "\xff" * 256
step = int( what.operation_complete * (256 + ramplen) )
step = int(what.operation_complete * (256 + ramplen))
ramp = ramp[step:step+256]
renpy.display.module.imageblend(
+1 -4
View File
@@ -95,9 +95,6 @@ class FboRtt(Rtt):
to render the texture.
"""
cdef GLint old_fbo
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &old_fbo);
try:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo)
@@ -110,7 +107,7 @@ class FboRtt(Rtt):
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, w, h, 0)
finally:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fbo)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, root_fbo)
def get_size_limit(self, dimension):
+1 -1
View File
@@ -116,7 +116,7 @@ def save_dump(roots, log):
size = 1
elif isinstance(o, (str, unicode)):
size = len(o) / 40 + 1
size = len(o) // 40 + 1
elif isinstance(o, (tuple, list)):
size = 1
+3 -2
View File
@@ -25,7 +25,8 @@ Dynamic images can now include "[prefix_]" everywhere, and especially when
``add`` has been used to add a dynamic image to buttons, drags, and similar
focusable objects.
Creator-defined statements may now take if statements as children.
Creator-defined screen language statements may now take ``if``
statements as children.
The drag and drop system has been improved to better interact with updated
screens.
@@ -344,7 +345,7 @@ take a zorder argument.
Ren'Py will now play a mono sound file with the same volume as a stereo
sound file, rather than sending half the energy to each ear.
The new :func:`config.load_failed_label` specifies a label that is jumped
The new :var:`config.load_failed_label` specifies a label that is jumped
to when a load fails because Ren'Py can no longer find the current statement.
This makes it possible to a game to implement its own recovery mechanism.