ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sat Oct 23, 2021 5:42 pm

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 23, 2021 5:09 pm 

Joined: Sat Jul 31, 2021 9:48 am
Posts: 4
Anyone know where the respective code is in source? also need any links or anything that'll further my understanding of this comtype.


Top
   
PostPosted: Thu Sep 23, 2021 11:24 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1267
https://github.com/mistydemeo/quickbms/ ... nz.c#L1035


Top
   
PostPosted: Sat Sep 25, 2021 12:52 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12549
XMemDecompress is part of the Xbox SDK (xcompress.lib) but there is also an open source version that is compatible (even if not supporting all the various features).

This is the code:
Code:
    #define MYALLOC_ZEROES 16

    XMEMDECOMPRESSION_CONTEXT ctx = NULL;
    HRESULT hr;

    hr = XMemCreateDecompressionContext(XMEMCODEC_DEFAULT, NULL, 0, &ctx);
    if(hr != S_OK) exit(1);

    SIZE_T ret = out_size;
    hr = XMemDecompress(ctx, out, &ret, in, in_size + MYALLOC_ZEROES);
    if(hr != S_OK) exit(1);

    XMemDestroyDecompressionContext(ctx);


Probably you want to understand what are those MYALLOC_ZEROES... long story short the API is bugged and the only way to make it working correctly was to allocate 16 additional zeroes in the input file and therefore specifying a bigger input size. Failure to do so will result in random errors of the API. Yeah misteries...

By the way, the unxmemlzx function in unz.c of quickbms is really magical. It's an all-in-one beast able to work with all the known types of xmem inputs and formats.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited