wowserhq / stormjs Goto Github PK
View Code? Open in Web Editor NEWStormLib for Javascript, powered by Emscripten
License: MIT License
StormLib for Javascript, powered by Emscripten
License: MIT License
Let's define integration tests as: tests utilizing StormJS a la a consumer. We should include an MPQ with a few small files inside to use with these tests.
This ticket will track adding an API to open and close files contained in an MPQ. This will not cover finding or reading files.
The following StormLib
APIs will need wrappers added to EmStormLib
:
SFileOpenFileEx
SFileCloseFile
Is it possible to write file to mpq or edit an existing one? Or would I need to edit EmStormLib.cpp to add the binding?
This will take some effort, since we'll need a way to get Emscripten installed.
EmPtr
a simple base class and export as Ptr
EmVoidPtr
from EmPtr
and export as VoidPtr
EmUint32Ptr
from EmPtr
and export as Uint32Ptr
NULLPTR
export (a Ptr
instance set to nullptr
)This appears to be two issues:
Incorrect llseek behavior when seeking >= 2 ** 31
These lines in the emscripten FS layer do not play well with offsets beyond 2 ** 31
bytes.
var stream = SYSCALLS.getStreamFromFD(), offset_high = SYSCALLS.get(), offset_low = SYSCALLS.get(), result = SYSCALLS.get(), whence = SYSCALLS.get();
// NOTE: offset_high is unused - Emscripten's off_t is 32-bit
var offset = offset_low;
FS.llseek(stream, offset, whence);
offset_low
is read as a signed integer out of HEAP32
by SYSCALLS.get()
. As a result, the value wraps after exceeding 2,147,483,647
bytes, even though it's not surprising to seek past that limit when working with large files.
Runtime assert intersecting with incompatible types
This line in SBaseFileTable.cpp
fails, despite the values matching:
assert(pHeader->BlockTableSize64 <= (pHeader->dwBlockTableSize * sizeof(TMPQBlock)));
Presumably, some combination of the types of pHeader->BlockTableSize64
, pHeader->dwBlockTableSize
, and sizeof(TMPQBlock)
prevent the assert's equality comparison from returning true.
StormJS isn't terribly useful without the ability to read files out of an MPQ.
The following StormLib
APIs will need wrappers added to EmStormLib
:
SFileGetFileSize
SFileReadFile
SFileSetFilePointer
Depends on #5
Given an instance of File
, we should be able to retrieve the file name by accessing a name
getter.
Similar to EmBuf
, we'll probably want to add a EmStr
that's capable of receiving C-strings and marshaling them to JS.
The following StormLib
APIs will need wrappers added to EmStormLib
:
In order to support opening a merged view of the 12340 client MPQs, we need to support StormLib
's patching function.
The following StormLib
APIs will need wrappers added to EmStormLib
:
SFileOpenPatchArchive
Since StormJS APIs will be heavily utilized by the pipeline server, we should explore some options for benchmarking the performance of the library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.