Skip to content

Commit

Permalink
Version 2.4: Allow loading movies without their external cast files
Browse files Browse the repository at this point in the history
Always check file headers instead of preloading
  • Loading branch information
n0samu committed Dec 21, 2023
1 parent 00584cc commit e962949
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
Binary file modified DirectorCastRipper.dir
Binary file not shown.
17 changes: 3 additions & 14 deletions Export.ls
Original file line number Diff line number Diff line change
Expand Up @@ -449,19 +449,13 @@ on movieFilePath
return the moviePath & the movieName
end
on canLoad dirFile
-- preLoadMovie returns 0 if the file is successfully loaded
-- This also works for cast files in Director 11 and below, but sadly not 11.5 or 12
return preLoadMovie(dirFile) = 0 and unLoadMovie(dirFile) = 0
end
on linkMovie movieFilePath
set linkedMember = member "Linked"
set linkedMovieSprite = sprite "Linked"
set errMsg = "The specified movie file could not be loaded:" && Files.getFilename(movieFilePath)
set the visible of linkedMovieSprite to False
if not canLoad(movieFilePath) then
if not Files.isValidDirFile(movieFilePath) then
Logging.errorMsg(errMsg)
return VOID
end if
Expand All @@ -470,8 +464,7 @@ on linkMovie movieFilePath
set the sound of linkedMember to False
set the scriptsEnabled of linkedMember to False
set the fileName of linkedMember = movieFilePath
set isValid = preLoadMember(linkedMember)
if not isValid then
if not the loaded of linkedMember then
Logging.errorMsg(errMsg)
return VOID
end if
Expand All @@ -481,11 +474,7 @@ end
on linkCast castFilePath
set linkedCast = castLib "Linked"
-- Since preLoadMovie doesn't work anymore in Dir11.5+, check the file header instead
-- This isn't as reliable but it's better than nothing
if Utils.directorVersion() < 11.5 then set isValid = canLoad(castFilePath)
else set isValid = Files.isValidDirFile(castFilePath)
if not isValid then
if not Files.isValidDirFile(castFilePath) then
set msg = "The specified cast file could not be loaded:" && Files.getFilename(castFilePath)
Logging.errorMsg(msg)
return VOID
Expand Down

0 comments on commit e962949

Please sign in to comment.