devinacker / exhal Goto Github PK
View Code? Open in Web Editor NEWCompression and decompression tools for NES, SNES, and Game Boy games by HAL Laboratory
License: MIT License
Compression and decompression tools for NES, SNES, and Game Boy games by HAL Laboratory
License: MIT License
Is there any reason why pack() might not be thread-safe? PInvoking pack() multiple times in parallel (with separate buffers for each call) results in access violation exceptions:
// PInvoke signature
[DllImport("compress.dll", EntryPoint = "pack", CallingConvention = CallingConvention.Cdecl)]
public static extern int Pack(byte[] unpacked, int inputsize, byte[] packed, int fast);
// Create random test buffers
byte[][] testBuffers = new byte[16][];
var rand = new Random();
for (int i = 0; i < 16; i++)
{
testBuffers[i] = new byte[4096];
rand.NextBytes(testBuffers[i]);
}
// Create output buffers
byte[][] outputBuffers = new byte[16][];
for (int i = 0; i < 16; i++)
outputBuffers[i] = new byte[64 * 1024];
// Run pack() in parallel
Parallel.For(0, 16, i =>
{
int index = i;
int packedSize = Pack(testBuffers[index], 4096, outputBuffers[index], 1);
});
// Program crashes with "A first chance exception of type 'System.AccessViolationException' occurred"
It seems that pack() otherwise works fine in serial.
Check out this notes: http://romhack.github.io/doc/halCompression/
Or directly this tool: https://github.com/romhack/kirbyLzRle/
You could consider your code revision for better compression ratio.
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.