forked from Otorhin/Ren2Switch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenpy.patch
1869 lines (1627 loc) · 57.7 KB
/
renpy.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -Naur b/module/ffmedia.c a/module/ffmedia.c
--- b/module/ffmedia.c 2023-06-01 05:43:51.000000000 +0300
+++ a/module/ffmedia.c 2023-08-02 03:17:51.825550300 +0300
@@ -10,10 +10,6 @@
#include <stdlib.h>
-#ifndef _WIN32
-#define USE_POSIX_MEMALIGN
-#endif
-
/* Should a mono channel be split into two equal stero channels (true) or
* should the energy be split onto two stereo channels with 1/2 the energy
* (false).
@@ -289,11 +285,7 @@
}
if (sqe->pixels) {
-#ifndef USE_POSIX_MEMALIGN
SDL_free(sqe->pixels);
-#else
- free(sqe->pixels);
-#endif
}
av_free(sqe);
}
@@ -867,16 +859,7 @@
rv->pitch += ROW_ALIGNMENT - (rv->pitch % ROW_ALIGNMENT);
}
-#ifndef USE_POSIX_MEMALIGN
rv->pixels = SDL_calloc(rv->pitch * rv->h, 1);
-#else
- if (posix_memalign(&rv->pixels, ROW_ALIGNMENT, rv->pitch * rv->h)) {
- av_free(rv);
- return NULL;
- }
- memset(rv->pixels, 0, rv->pitch * rv->h);
-#endif
-
rv->format = sample->format;
rv->next = NULL;
rv->pts = pts;
@@ -986,11 +969,7 @@
ms->surface_queue_size -= 1;
if (sqe->pixels) {
-#ifndef USE_POSIX_MEMALIGN
SDL_free(sqe->pixels);
-#else
- free(sqe->pixels);
-#endif
}
av_free(sqe);
diff -Naur b/renpy/__init__.py a/renpy/__init__.py
--- b/renpy/__init__.py 2023-05-17 07:58:53.000000000 +0300
+++ a/renpy/__init__.py 2023-08-03 20:23:08.950932300 +0300
@@ -23,7 +23,6 @@
# order.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
-from typing import Any
# Initial import of the __main__ module. This gets replaced in renpy.py
# whatever that module has been imported as.
@@ -66,7 +65,6 @@
import os
import copy
import types
-import site
from collections import namedtuple
################################################################################
@@ -85,7 +83,7 @@
version_name = version_dict["version_name"]
version = version_dict["version"]
-official = official and getattr(site, "renpy_build_official", False)
+official = False
VersionTuple = namedtuple("VersionTuple", ["major", "minor", "patch", "commit"])
version_tuple = VersionTuple(*(int(i) for i in version.split(".")))
@@ -119,6 +117,7 @@
android = False
ios = False
emscripten = False
+switch = False
# Should we enable experimental features and debugging?
experimental = "RENPY_EXPERIMENTAL" in os.environ
@@ -172,13 +171,15 @@
android = True
elif sys.platform == 'emscripten' or "RENPY_EMSCRIPTEN" in os.environ:
emscripten = True
+elif sys.platform == 'horizon':
+ switch = True
else:
linux = True
arch = os.environ.get("RENPY_PLATFORM", "unknown-unknown-unknown").rpartition("-")[2]
# A flag that's true if we're on a smartphone or tablet-like platform.
-mobile = android or ios or emscripten
+mobile = android or ios or emscripten or switch
# A flag that's set to true if the game directory is bundled inside a mac app.
macapp = False
@@ -420,7 +421,8 @@
import renpy.curry
import renpy.color
import renpy.easy
- import renpy.encryption
+ if not switch:
+ import renpy.encryption
import renpy.execution
import renpy.lexer
import renpy.loadsave
@@ -617,6 +619,11 @@
returned.
"""
+ if switch:
+ _otrhlibnx.commitsave()
+ _otrhlibnx.restartprogram()
+ return
+
if mobile:
raise Exception("Reloading is not supported on mobile platforms.")
diff -Naur b/renpy/arguments.py a/renpy/arguments.py
--- b/renpy/arguments.py 2023-02-15 08:18:38.000000000 +0300
+++ a/renpy/arguments.py 2023-08-02 04:08:53.893476700 +0300
@@ -36,12 +36,6 @@
import renpy
-try:
- import site
- site._renpy_argv_emulation() # type: ignore
-except Exception:
- pass
-
# A map from command name to a (function, flag) tuple. The flag is true if the
# function will parse command line arguments, and false otherwise.
commands = { }
diff -Naur b/renpy/ast.py a/renpy/ast.py
--- b/renpy/ast.py 2023-04-19 06:37:46.000000000 +0300
+++ a/renpy/ast.py 2023-08-02 03:58:22.938340300 +0300
@@ -29,8 +29,6 @@
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-from typing import Optional, Any
-
import renpy
import hashlib
diff -Naur b/renpy/audio/androidhw.py a/renpy/audio/androidhw.py
--- b/renpy/audio/androidhw.py 2023-06-08 02:55:48.000000000 +0300
+++ a/renpy/audio/androidhw.py 1970-01-01 03:00:00.000000000 +0300
@@ -1,217 +0,0 @@
-# Copyright 2004-2023 Tom Rothamel <[email protected]>
-#
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge,
-# publish, distribute, sublicense, and/or sell copies of the Software,
-# and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
-from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-
-
-
-import renpy
-import jnius # type: ignore
-
-from renpy.audio.audio import MusicContext
-
-VideoPlayer = jnius.autoclass("org.renpy.android.VideoPlayer")
-
-
-class AndroidVideoChannel(object):
-
- def __init__(self, name, file_prefix="", file_suffix="", default_loop=None):
-
- # A list of queued filenames.
- self.queue = [ ]
-
- # The filename that's currently playing.
- self.filename = None
-
- # The videoplayer that's currently playing.
- self.player = None
-
- # The name assigned to this channel. This is used to look up
- # information about the channel in the MusicContext object.
- self.name = name
-
- # The name of the mixer this channel uses. Set below, as there's
- # no good default.
- self.mixer = None
-
- # The time the music in this channel was last changed.
- self.last_changed = 0
-
- # The callback that is called if the queue becomes empty.
- self.callback = None
-
- # Ignored.
- self.synchro_start = False
- self.wait_stop = False
- self.loop = [ ]
-
- # A prefix and suffix that are used to create the full filenames.
- self.file_prefix = file_prefix
- self.file_suffix = file_suffix
-
- if default_loop is None:
- # By default, should we loop the music?
- self.default_loop = True
- # Was this set explicitly?
- self.default_loop_set = False
-
- else:
- self.default_loop = default_loop
- self.default_loop_set = True
-
- def get_context(self):
- """
- Returns the MusicContext corresponding to this channel, taken from
- the context object. Allocates a MusicContext if none exists.
- """
-
- mcd = renpy.game.context().music
-
- rv = mcd.get(self.name)
- if rv is None:
- rv = mcd[self.name] = MusicContext()
-
- return rv
-
- context = property(get_context)
-
- def copy_context(self):
- """
- Copies the MusicContext associated with this channel, updates the
- ExecutionContext to point to the copy, and returns the copy.
- """
-
- mcd = renpy.game.context().music
-
- ctx = self.get_context().copy()
- mcd[self.name] = ctx
- return ctx
-
- def start(self):
- """
- Starts playing the first video in the queue.
- """
-
- if not self.queue:
- return
-
- filename = self.queue.pop(0)
-
- with renpy.loader.load(filename, directory="audio") as f:
- real_fn = f.name
- base = getattr(f, "base", -1)
- length = getattr(f, "length", -1)
-
- self.filename = filename
- self.player = VideoPlayer(real_fn, base, length)
-
- def stop(self):
-
- if self.player is not None:
- self.player.stop()
- self.player = None
-
- self.filename = None
-
- def get_playing(self):
-
- if self.player is None:
- return None
-
- if self.player.isPlaying():
- return self.filename
-
- def periodic(self):
-
- # This should be set from something that checks to see if our
- # mixer is muted.
- force_stop = self.context.force_stop
-
- if force_stop:
- self.dequeue()
- self.stop()
- return
-
- if self.get_playing():
- return
-
- if self.queue:
- self.start()
-
- def dequeue(self, even_tight=False):
- """
- Clears the queued music, except for a first item that has
- not been started.
- """
-
- if self.get_playing():
- self.queue = [ ]
- else:
- self.queue = self.queue[:1]
-
- def interact(self):
- """
- Called (mostly) once per interaction.
- """
-
- self.periodic()
-
- def fadeout(self, secs):
- """
- Causes the playing music to be faded out for the given number
- of seconds. Also clears any queued music.
- """
-
- self.stop()
- self.queue = [ ]
-
- def enqueue(self, filenames, loop=True, synchro_start=False, fadein=0, tight=None, relative_volume=1.0):
- self.queue.extend(filenames)
-
- def set_volume(self, volume):
- pass
-
- def get_pos(self):
- pass
-
- def set_pan(self, pan, delay):
- pass
-
- def set_secondary_volume(self, volume, delay):
- pass
-
- def pause(self):
- if self.player is not None:
- self.player.pause()
-
- def unpause(self):
- if self.player is not None:
- self.player.unpause()
-
- def reload(self):
- return
-
- def read_video(self):
- return None
-
- def video_ready(self):
- return 1
diff -Naur b/renpy/audio/audio.py a/renpy/audio/audio.py
--- b/renpy/audio/audio.py 2023-06-08 02:55:48.000000000 +0300
+++ a/renpy/audio/audio.py 2023-08-22 03:40:53.817637195 +0300
@@ -27,9 +27,6 @@
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-
-from future.utils import raise_
-
import time
import pygame_sdl2 # @UnusedImport
import os
@@ -790,20 +787,6 @@
return renpysound.video_ready(self.number)
-# Use unconditional imports so these files get compiled during the build
-# process.
-
-
-try:
- from renpy.audio.androidhw import AndroidVideoChannel
-except Exception:
- pass
-
-try:
- from renpy.audio.ioshw import IOSVideoChannel
-except Exception:
- pass
-
# A list of channels we know about.
all_channels = [ ]
@@ -880,12 +863,7 @@
if not force and not renpy.game.context().init_phase and (" " not in name):
raise Exception("Can't register channel outside of init phase.")
- if renpy.android and renpy.config.hw_video and name == "movie":
- c = AndroidVideoChannel(name, default_loop=loop, file_prefix=file_prefix, file_suffix=file_suffix)
- elif renpy.ios and renpy.config.hw_video and name == "movie":
- c = IOSVideoChannel(name, default_loop=loop, file_prefix=file_prefix, file_suffix=file_suffix)
- else:
- c = Channel(name, loop, stop_on_mute, tight, file_prefix, file_suffix, buffer_queue, movie=movie, framedrop=framedrop)
+ c = Channel(name, loop, stop_on_mute, tight, file_prefix, file_suffix, buffer_queue, movie=movie, framedrop=framedrop)
c.mixer = mixer
@@ -1053,6 +1031,9 @@
def quit(): # @ReservedAssignment
+ if renpy.switch:
+ return
+
global periodic_thread_quit
global pcm_ok
@@ -1219,7 +1200,7 @@
exc = periodic_exc
periodic_exc = None
- raise_(exc[0], exc[1], exc[2])
+ raise exc[0], exc[1], exc[2]
run_periodic = True
periodic_condition.notify()
diff -Naur b/renpy/audio/ioshw.py a/renpy/audio/ioshw.py
--- b/renpy/audio/ioshw.py 2023-06-08 02:55:48.000000000 +0300
+++ a/renpy/audio/ioshw.py 1970-01-01 03:00:00.000000000 +0300
@@ -1,196 +0,0 @@
-from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
-from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-
-
-
-import renpy
-import pyobjus # type: ignore
-
-from renpy.audio.audio import MusicContext
-
-VideoPlayer = pyobjus.autoclass("VideoPlayer")
-
-
-class IOSVideoChannel(object):
-
- def __init__(self, name, file_prefix="", file_suffix="", default_loop=None):
-
- # A list of queued filenames.
- self.queue = [ ]
-
- # The filename that's currently playing.
- self.filename = None
-
- # The videoplayer that's currently playing.
- self.player = None
-
- # The name assigned to this channel. This is used to look up
- # information about the channel in the MusicContext object.
- self.name = name
-
- # The name of the mixer this channel uses. Set below, as there's
- # no good default.
- self.mixer = None
-
- # The time the music in this channel was last changed.
- self.last_changed = 0
-
- # The callback that is called if the queue becomes empty.
- self.callback = None
-
- # Ignored.
- self.synchro_start = False
- self.wait_stop = False
- self.loop = [ ]
-
- # A prefix and suffix that are used to create the full filenames.
- self.file_prefix = file_prefix
- self.file_suffix = file_suffix
-
- if default_loop is None:
- # By default, should we loop the music?
- self.default_loop = True
- # Was this set explicitly?
- self.default_loop_set = False
-
- else:
- self.default_loop = default_loop
- self.default_loop_set = True
-
- def get_context(self):
- """
- Returns the MusicContext corresponding to this channel, taken from
- the context object. Allocates a MusicContext if none exists.
- """
-
- mcd = renpy.game.context().music
-
- rv = mcd.get(self.name)
- if rv is None:
- rv = mcd[self.name] = MusicContext()
-
- return rv
-
- context = property(get_context)
-
- def copy_context(self):
- """
- Copies the MusicContext associated with this channel, updates the
- ExecutionContext to point to the copy, and returns the copy.
- """
-
- mcd = renpy.game.context().music
-
- ctx = self.get_context().copy()
- mcd[self.name] = ctx
- return ctx
-
- def start(self):
- """
- Starts playing the first video in the queue.
- """
-
- if not self.queue:
- return
-
- filename = self.queue.pop(0)
- with renpy.loader.load(filename, directory="audio") as f:
- real_fn = f.name
-
- self.filename = filename
- self.player = VideoPlayer.alloc().initWithFile_(real_fn)
-
- def stop(self):
-
- if self.player is not None:
- self.player.stop()
- self.player = None
-
- self.filename = None
-
- def get_playing(self):
-
- if self.player is None:
- return None
-
- if self.player.isPlaying():
- return self.filename
-
- def periodic(self):
-
- # This should be set from something that checks to see if our
- # mixer is muted.
- force_stop = self.context.force_stop
-
- if force_stop:
- self.dequeue()
- self.stop()
- return
-
- if self.player:
- self.player.periodic()
-
- if self.get_playing():
- return
-
- if self.queue:
- self.start()
-
- def dequeue(self, even_tight=False):
- """
- Clears the queued music, except for a first item that has
- not been started.
- """
-
- if self.get_playing():
- self.queue = [ ]
- else:
- self.queue = self.queue[:1]
-
- def interact(self):
- """
- Called (mostly) once per interaction.
- """
-
- self.periodic()
-
- def fadeout(self, secs):
- """
- Causes the playing music to be faded out for the given number
- of seconds. Also clears any queued music.
- """
-
- self.stop()
- self.queue = [ ]
-
- def enqueue(self, filenames, loop=True, synchro_start=False, fadein=0, tight=None, relative_volume=1.0):
- self.queue.extend(filenames)
-
- def pause(self):
- if self.player is not None:
- self.player.pause()
-
- def unpause(self):
- if self.player is not None:
- self.player.unpause()
-
- def set_volume(self, volume):
- pass
-
- def get_pos(self):
- pass
-
- def set_pan(self, pan, delay):
- pass
-
- def set_secondary_volume(self, volume, delay):
- pass
-
- def reload(self):
- return
-
- def read_video(self):
- return None
-
- def video_ready(self):
- return 1
diff -Naur b/renpy/bootstrap.py a/renpy/bootstrap.py
--- b/renpy/bootstrap.py 2023-05-06 04:20:29.000000000 +0300
+++ a/renpy/bootstrap.py 2023-09-01 00:40:04.344179857 +0300
@@ -22,8 +22,6 @@
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-from typing import Optional
-
import os
import sys
import subprocess
@@ -231,6 +229,11 @@
if args.command == "run" and not renpy.mobile:
import renpy.display.presplash # @Reimport
renpy.display.presplash.start(basedir, gamedir)
+ if renpy.switch:
+ import _otrhlibnx
+ import renpy.display.presplash
+ renpy.display.presplash.start_switch(gamedir)
+ _otrhlibnx.startboost()
# Ditto for the Ren'Py module.
try:
@@ -266,11 +269,14 @@
if renpy.android:
renpy.config.logdir = os.environ['ANDROID_PUBLIC']
+ elif renpy.switch:
+ renpy.config.logdir = "save:/Logs/"
else:
renpy.config.logdir = basedir
if not os.path.exists(renpy.config.logdir):
os.makedirs(renpy.config.logdir, 0o777)
+ log = renpy.log.open("log", developer=False, append=False)
renpy.main.main()
@@ -281,6 +287,11 @@
except renpy.game.UtterRestartException:
+ if renpy.switch:
+ import _otrhlibnx
+ _otrhlibnx.restartprogram()
+ return
+
# On an UtterRestart, reload Ren'Py.
renpy.reload_all()
@@ -289,7 +300,17 @@
except renpy.game.QuitException as e:
exit_status = e.status
+ if renpy.switch:
+ import _otrhlibnx
+ _otrhlibnx.commitsave()
+
if e.relaunch:
+
+ if renpy.switch:
+ import _otrhlibnx
+ _otrhlibnx.restartprogram()
+ return
+
if hasattr(sys, "renpy_executable"):
subprocess.Popen([sys.renpy_executable] + sys.argv[1:]) # type: ignore
else:
@@ -308,6 +329,10 @@
finally:
+ if renpy.switch:
+ os._exit(0)
+ return
+
if "RENPY_SHUTDOWN_TRACE" in os.environ:
enable_trace(int(os.environ["RENPY_SHUTDOWN_TRACE"]))
@@ -322,5 +347,5 @@
# Prevent subprocess from throwing errors while trying to run it's
# __del__ method during shutdown.
- if not renpy.emscripten:
+ if not (renpy.emscripten):
subprocess.Popen.__del__ = popen_del # type: ignore
diff -Naur b/renpy/character.py a/renpy/character.py
--- b/renpy/character.py 2023-05-22 17:50:43.000000000 +0300
+++ a/renpy/character.py 2023-08-02 03:58:31.428415300 +0300
@@ -24,8 +24,6 @@
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-from typing import Any, Literal
-
import renpy
import re
diff -Naur b/renpy/common/00compat.rpy a/renpy/common/00compat.rpy
--- b/renpy/common/00compat.rpy 2023-05-29 08:50:24.000000000 +0300
+++ a/renpy/common/00compat.rpy 2023-08-22 03:41:31.797627760 +0300
@@ -208,7 +208,6 @@
if version <= (7, 3, 5):
config.side_image_requires_attributes = False
config.window_functions_set_auto = False
- config.hw_video = True
config.who_what_sub_compat = 0
if version <= (7, 4, 0):
diff -Naur b/renpy/common/00keymap.rpy a/renpy/common/00keymap.rpy
--- b/renpy/common/00keymap.rpy 2023-04-12 06:37:21.000000000 +0300
+++ a/renpy/common/00keymap.rpy 2023-09-04 23:17:53.465141998 +0300
@@ -152,31 +152,30 @@
profile_once = [ 'K_F8' ],
memory_profile = [ 'K_F7' ],
+ quick_save = [ 'K_F5' ],
+ quick_load = [ 'K_F6' ]
+
)
config.default_keymap = { k : _list(v) for k, v in config.keymap.items() }
config.keymap = { k : _keymap_list(v) for k, v in config.keymap.items() }
config.pad_bindings = {
+ "pad_lefttrigger_pos" : [ "dismiss", "button_select", "bar_activate", "bar_deactivate", ],
"pad_leftshoulder_press" : [ "rollback", ],
- "pad_lefttrigger_pos" : [ "rollback", ],
- "pad_back_press" : [ "rollback", ],
-
- "repeat_pad_leftshoulder_press" : [ "rollback", ],
- "repeat_pad_lefttrigger_pos" : [ "rollback", ],
- "repeat_pad_back_press" : [ "rollback", ],
+ "pad_back_press" : [ "game_menu", ],
- "pad_guide_press" : [ "game_menu", ],
+ "pad_righttrigger_pos" : [ "dismiss", "button_select", "bar_activate", "bar_deactivate" ],
+ "pad_rightshoulder_press" : [ "toggle_skip", ],
"pad_start_press" : [ "game_menu", ],
"pad_y_press" : [ "hide_windows", ],
+ "pad_x_press" : [ "toggle_skip", ],
+ "pad_b_press" : [ "dismiss", "button_select", "bar_activate", "bar_deactivate" ],
+ "pad_a_press" : [ "rollback", ],
- "pad_rightshoulder_press" : [ "rollforward", ],
- "repeat_pad_rightshoulder_press" : [ "rollforward", ],
-
- "pad_righttrigger_pos" : [ "dismiss", "button_select", "bar_activate", "bar_deactivate" ],
- "pad_a_press" : [ "dismiss", "button_select", "bar_activate", "bar_deactivate"],
- "pad_b_press" : [ "button_alternate" ],
+ "pad_leftstick_press" : [ "quick_save", ],
+ "pad_rightstick_press" : [ "quick_load", ],
"pad_dpleft_press" : [ "focus_left", "bar_left", "viewport_leftarrow" ],
"pad_leftx_neg" : [ "focus_left", "bar_left", "viewport_leftarrow" ],
@@ -445,6 +444,8 @@
performance = ToggleScreen("_performance"),
accessibility = ToggleScreen("_accessibility"),
bubble_editor = bubble.ToggleShown(),
+ quick_save = QuickSave(),
+ quick_load = QuickLoad(),
)
config.underlay = [ _default_keymap ]
diff -Naur b/renpy/common/00sync.rpy a/renpy/common/00sync.rpy
--- b/renpy/common/00sync.rpy 2023-05-29 19:21:17.000000000 +0300
+++ a/renpy/common/00sync.rpy 2023-08-03 17:47:11.636260700 +0300
@@ -315,7 +315,7 @@
def upload():
- if not config.has_sync:
+ if not config.has_sync or renpy.switch:
return
if not renpy.call_screen("sync_confirm"):
@@ -404,7 +404,7 @@
def download():
- if not config.has_sync:
+ if not config.has_sync or renpy.switch:
return
# Get and check the sync id.
diff -Naur b/renpy/common/00updater.rpy a/renpy/common/00updater.rpy
--- b/renpy/common/00updater.rpy 2023-02-14 07:50:20.000000000 +0300
+++ a/renpy/common/00updater.rpy 2023-08-03 14:22:05.624752900 +0300
@@ -28,7 +28,7 @@
import threading
import traceback
import os
- import urllib.parse as urlparse
+ #import urllib.parse as urlparse
import json
import subprocess
import hashlib
@@ -38,7 +38,6 @@
import zlib
import codecs
import io
- import future.utils
def urlopen(url):
import requests
@@ -783,7 +782,7 @@
raise UpdateError(_("Could not verify update signature."))
if "monkeypatch" in self.updates:
- future.utils.exec_(self.updates["monkeypatch"], globals(), globals())
+ exec(self.updates["monkeypatch"], globals(), globals())
def add_dlc_state(self, name):
url = urlparse.urljoin(self.url, self.updates[name]["json_url"])
diff -Naur b/renpy/compat/__init__.py a/renpy/compat/__init__.py
--- b/renpy/compat/__init__.py 2023-06-08 02:56:04.000000000 +0300
+++ a/renpy/compat/__init__.py 2023-08-03 16:54:30.048632700 +0300
@@ -58,8 +58,6 @@
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
-import future.standard_library
-import future.utils
import builtins
import io
@@ -69,14 +67,9 @@
python_open = open
################################################################################
-# Alias the Python 3 standard library.
-
-future.standard_library.install_aliases()
-
-################################################################################
# Determine if this is Python2.
-PY2 = future.utils.PY2
+PY2 = True
################################################################################
# Make open mimic Python 3.
@@ -104,9 +97,50 @@
strict_error = codecs.lookup_error("strict")
codecs.register_error("python_strict", strict_error)
-if PY2:
- surrogateescape_error = codecs.lookup_error("surrogateescape")
- codecs.register_error("strict", surrogateescape_error)
+def replace_surrogate_decode(mybytes):
+ decoded = []
+ for ch in mybytes:
+ if isinstance(ch, int):
+ code = ch
+ else:
+ code = ord(ch)
+ if 0x80 <= code <= 0xFF:
+ decoded.append(_unichr(0xDC00 + code))
+ elif code <= 0x7F:
+ decoded.append(_unichr(code))
+ else:
+ raise NotASurrogateError
+ return str().join(decoded)
+
+
+def replace_surrogate_encode(mystring):
+ decoded = []
+ for ch in mystring:
+ code = ord(ch)
+ if not 0xD800 <= code <= 0xDCFF:
+ raise NotASurrogateError
+ if 0xDC00 <= code <= 0xDC7F:
+ decoded.append(_unichr(code - 0xDC00))
+ elif code <= 0xDCFF:
+ decoded.append(_unichr(code - 0xDC00))
+ else:
+ raise NotASurrogateError
+ return str().join(decoded)
+
+def surrogateescape_handler(exc):
+ mystring = exc.object[exc.start:exc.end]
+ try:
+ if isinstance(exc, UnicodeDecodeError):
+ decoded = replace_surrogate_decode(mystring)
+ elif isinstance(exc, UnicodeEncodeError):
+ decoded = replace_surrogate_encode(mystring)
+ else:
+ raise exc
+ except NotASurrogateError:
+ raise exc
+ return (decoded, exc.end)
+
+codecs.register_error("strict", surrogateescape_handler)
import renpy
renpy.update_path()
@@ -114,24 +148,29 @@
################################################################################
# String (text and binary) types and functions.
-basestring = future.utils.string_types
+basestring = basestring
pystr = str
-unicode = future.utils.text_type
+unicode = unicode
# This tries to help pylance get the types right.
-str = builtins.str; globals()["str"] = future.utils.text_type
+str = builtins.str; globals()["str"] = unicode
-bord = future.utils.bord
+bord = ord
if PY2:
bchr = chr # type: ignore
else:
def bchr(i): # type: (int) -> bytes
return bytes([i])
-tobytes = future.utils.tobytes
-from future.builtins import chr
+def tobytes(s):
+ if isinstance(s, unicode):
+ return s.encode('latin-1')
+ else:
+ return ''.join(s)
+
+chr = unichr
################################################################################
# Dictionary views.
@@ -181,7 +220,7 @@
################################################################################
# Chance the default for subprocess.Popen.
-if PY2:
+if PY2 and not sys.platform == 'horizon':
import subprocess
class Popen(subprocess.Popen):
def __init__(self, *args, **kwargs):
diff -Naur b/renpy/config.py a/renpy/config.py
--- b/renpy/config.py 2023-05-22 17:50:43.000000000 +0300
+++ a/renpy/config.py 2023-08-03 20:03:32.198552700 +0300
@@ -26,8 +26,6 @@
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
from renpy.compat import PY2, basestring, bchr, bord, chr, open, pystr, range, round, str, tobytes, unicode # *
-from typing import Optional, List
-
import collections