Skip to content

Commit

Permalink
readded rpa checks but removed script-poemgame from loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePotatoGuy committed Feb 25, 2024
1 parent f2fdbe0 commit 3bdf312
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 6 deletions.
74 changes: 74 additions & 0 deletions Monika After Story/game/overrides.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ python early in mas_overrides:

import renpy
import renpy.savelocation as savelocation
import renpy.parser as parser


def verify_data_override(data, signatures, check_verifying=True):
Expand Down Expand Up @@ -66,3 +67,76 @@ python early in mas_overrides:
savelocation.init = savelocation_init_override


def parser_report_parser_errors_override():
"""
This override is actually for something unrelated.
We need to prevent scripts.rpa code from being loaded, but there's
no way to override script loading code since by the time THIS script
is loaded (and override set), the scripts.rpa contents are already
queued to be loaded later.
This specific function is called before the init scripts start running
so this is the last place we can remove the scripts rpa stuff we dont
want.
"""
for index, initcode in reversed(list(enumerate(renpy.game.script.initcode))):
init_lvl, obj = initcode

try:
if obj.filename == "script-poemgame.rpyc":
renpy.game.script.initcode.pop(index)
except:
pass

# non-override code below

parser.release_deferred_errors()

if not parser.parse_errors:
return False

full_text = ""

f, error_fn = renpy.error.open_error_file("errors.txt", "w")
with f:
f.write("\ufeff") # BOM

print("I'm sorry, but errors were detected in your script. Please correct the", file=f)
print("errors listed below, and try again.", file=f)
print("", file=f)

for i in parser.parse_errors:

full_text += i
full_text += "\n\n"

if not isinstance(i, str):
i = str(i, "utf-8", "replace")

print("", file=f)
print(i, file=f)

try:
print("")
print(i)
except Exception:
pass

print("", file=f)
print("Ren'Py Version:", renpy.version, file=f)
print(str(time.ctime()), file=f)

renpy.display.error.report_parse_errors(full_text, error_fn)

try:
if renpy.game.args.command == "run": # type: ignore
renpy.exports.launch_editor([ error_fn ], 1, transient=True)
except Exception:
pass

return True

parser.report_parse_errors = parser_report_parser_errors_override


12 changes: 6 additions & 6 deletions Monika After Story/game/splash.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
##
## Before load, check to be sure that the archive files were found.
## If not, display an error message and quit.
# init -100 python:
# #Check for each archive needed
# for archive in ['audio','images','scripts','fonts']:
# if not archive in config.archives:
# #If one is missing, throw an error and chlose
# renpy.error("DDLC archive files not found in /game folder. Check installation and try again.")
init -100 python:
#Check for each archive needed
for archive in ['audio','images', 'scripts', 'fonts']:
if not archive in config.archives:
#If one is missing, throw an error and chlose
renpy.error("DDLC archive files not found in /game folder. Check installation and try again.")

## First, a disclaimer declaring this is a mod is shown, then there is a
## check for the original DDLC assets in the install folder. If those are
Expand Down

0 comments on commit 3bdf312

Please sign in to comment.