You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a function loadBuffer(buffer) to load Module data from an existing Buffer (useful for game engines that preload resources)
Still some things pending in this PR that I can't do without asking you:
The parse function of the tracker classes require the use of Uint8Array data, otherwise the function fails. Potential solution: Maybe a force cast can be done to the argument
The user has to set-up the 'format' and 'player' properties first before calling it. Maybe I can accept the format as argument to set it up
loadBuffer can be reused in load
I have also put these as TODO in the code that will need to be removed
To forgo the need for the user to explicitly set the format and player properties before calling loadBuffer, we could maybe add an identify function to each of the format-specific player classes. Eg.
Screamtracker.prototype.identify(buffer)
which would return a boolean value depending on whether the contents of the buffer look like a S3M module - probably just by checking the file signature.
loadBuffer could then call identify for each format-specific class to autodetect the format contained within the buffer, and set the format and player properties accordingly.
This would probably be a more robust way for detecting the file type also for load as currently it just makes a guess based on the provided URL. One advantage with the current method is, however, that it can be done already before the XHR.
The identify function could be useful, but I feel relying on auto-detection for basically user-supplied data is a bad idea, as there could be false detections.
Perhaps the format argument can be made optional. If it is set, just assign the correct tracker class instance. Maybe another argument to prevent replacing the player property. If not set, we can try and guess using the identify methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a function
loadBuffer(buffer)to load Module data from an existing Buffer (useful for game engines that preload resources)Still some things pending in this PR that I can't do without asking you:
parsefunction of the tracker classes require the use ofUint8Arraydata, otherwise the function fails. Potential solution: Maybe a force cast can be done to the argumentloadBuffercan be reused inloadI have also put these as TODO in the code that will need to be removed