Jump to content
  • Announcements

    • AndalayBay

      SSL Installed   05/29/2018

      Second IP obtained. The issues with IPv6 have also been fixed, but we can't switch to HTTPS until we switch forum software. We can't switch to HTTPS without a current license with IPS.
Sign in to follow this  
Schtearn

[RELz] SKSEQuasiDebugLogTest

Recommended Posts

Ah, okay. I'll take a look at his definition of byte. That's weird that it doesn't yet support LZMA2, are you using the latest version of the library? And do you have some test archives? Not sure what I should be testing this go around. :)

Share this post


Link to post
Share on other sites

Heh, thanks- but don't bother testing yet- unless you can get hold of a file with an lzma extension. A rare beast, at least on Windows. :P 

	for(unsigned i = 0; i <= size; i++)
	srcFile[i] = reinterpret_cast<Byte>(&f[i]);

The above code is causing the warning- but doing this kind of stuff without std:stream and the like is generally frowned upon. :(

Share this post


Link to post
Share on other sites

Looking at his sparse docs, it looks like you may be missing a pointer level. This is what they have:

Byte **outBuffer,         /* pointer to pointer to output buffer (allocated with allocMain) */

Granted, he's not all that clear and examples would help. Have you tried passing it an array of C-strings? That seems to be what he's trying to get at (why an array of strings, I don't understand).

Share this post


Link to post
Share on other sites

Sorry for the delay, just uninstalled VS2015 in favour of 2017 on the other machine.

Using his example at the bottom of LzmaLib.c, it looks to be okay as long as one supplies a byte array. Sure, a warning occurs on the conversion from char to byte- but the size values of the passed structures check out.

Incredibuild has been included in VS for sometime now- would it make any difference to projects like this, I wonder?

Share this post


Link to post
Share on other sites

Where do see an example? The copy I have doesn't have any comments in it other than for the bitwise operators. It's possible we're looking at different things. I grabbed my copy of the SDK from here: https://www.7-zip.org/sdk.html

Is that the right place?

Not sure a distributed compilation would be of much use here, that's designed for larger codebases such as an OS or game engine; things that take a while to build. :)

Share this post


Link to post
Share on other sites

See his suggestion.

This is how the function is called:

MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
  const unsigned char *props, size_t propsSize)
{
  ELzmaStatus status;
  return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc);
}

 

Share this post


Link to post
Share on other sites

Let's backtrack to this post: :)

		for(unsigned i = 0; i <= size; i++)
		srcFile[i] = reinterpret_cast<Byte>(&f[i]);
//produces
Warning    C4302    'reinterpret_cast': truncation from 'FILE *' to 'Byte'    SKSEView

This is before any of Igor's code is invoked.

FILE is this:

    typedef struct _iobuf
    {
        void* _Placeholder;
    } FILE;

But am reading file in as 

_wfopen_s(&f , tempDest, L"rb, ccs=UTF-8")

Can't see anything in the definition of FILE that would want it to necessarily partition the stream into BYTE sized chunks, but as everything appears to be working in the UTF-8 encoding- perhaps ignore the warning for now?

Share this post


Link to post
Share on other sites

Are you making your own FILE struct or are you using the one from stdio.h? Also, you could try doing static_cast and seeing if that makes a difference. It isn't always clear which cast is the proper one so I normally just stick to C-style casting, even if it's considered bad form. :)

Share this post


Link to post
Share on other sites
Posted (edited)

Doesn't like static_cast at all. :shrug: And is the conversion of (&f) rather than (f) actually going to work in any case?

We aren't supposed to be accessing the _iobuf FILE * member like that at all if it were a text file. But as it's binary, should we care- except if the file happens not to be UTF-8- in which case there has to be a check for the UTF-8 BOM.

Edited by Schtearn

Share this post


Link to post
Share on other sites

Hang on, try this:

srcFile[i] = reinterpret_cast<Byte *>(f[i]);

Or similar. The key is to cast it to the Byte pointer. :)

Pointers can be really confusing. Sometimes it takes a lot of trial and error to get the right combination.

For a binary file, you want to make sure you pass binary as the open mode (b in C or std::ios_base::binary for C++ IO streams).

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks, but doesn't work- Edit: if the cast doesn't work when 7z is implemented, we'll have to think of another way. :)

Edit2::facepalm: Oh dear- wrong variable- no conversion required!

                       for(unsigned i = 0; i <= size; i++)
                        srcFile[i] = where[i];

 

Edited by Schtearn

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks. I believe the includes issue has largely been resolved- but there are still a few minor irritations remaining. :P

...

Just a little backstep from this for a little while as, well folks are not easy to contact.

Posted on Igor's Forum about 7z- but the non-response probably means poring over the code and choosing the functions which suit, before a bump.

Similarly IanPatt hasn't responded to the PM at gmail- he may either not be attending it, or has allocated resources to something else altogether. Or perhaps the task of retrieving a variable name, even with a good toolset, is still a complex one.

Edited by Schtearn

Share this post


Link to post
Share on other sites

Yes, lzma1803.7z. thanks.  Just for fun some of the dsp files in the 7-zip section were built with no problem. And also used a cool script with the makefiles. :D

But we put all that interesting stuff aside for the moment in order to plough through the stodgy CPP stuff. :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×