Endless Paradigm

Full Version: [PSP] [Source code] Simple Popstation GUI v3.00 beta
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Unfortunately, this is written in VB6, so won't work in .NET.

You can write it up yourself if you want.
ZiNgA BuRgA Wrote:Unfortunately, this is written in VB6, so won't work in .NET.

You can write it up yourself if you want.


i did 90% of it already.   only thing is the  eboot to iso extract

if its not compressed then it works, but if compression is used, then it writes all zero's.
pka4916 Wrote:
ZiNgA BuRgA Wrote:Unfortunately, this is written in VB6, so won't work in .NET.

You can write it up yourself if you want.


i did 90% of it already.   only thing is the  eboot to iso extract

if its not compressed then it works, but if compression is used, then it writes all zero's.
Are you referring to my code or yours?  Mine works fine extracting ISOs, as far as it works on my computer.

If it's yours, are you using zlib correctly?
in vb6 it works fine, in .net it isn't working

Visual Basic Code
'The code

        intFF2 = FreeFile()
        FileOpen(intFF2, strISO, OpenMode.Binary)

        'get data
        Dim bytBuff(16 * 2352 - 1) As Byte
        Dim bytBuffC(lngISOIndex_Length(lngCnt) - 1) As Byte


        Dim lngRtn As Integer 'return from zlib
        Dim ZS As Z_STREAM_S

        Dim intUpdCnt As Short
        Const UPDATE_FREQ As Short = 32 'every 1MB

        For lngCnt = 0 To lngNumIndexes - 1
            Seek(intFF, lngPSARHead + &H100001 + lngISOIndex_Offset(lngCnt))

            intUpdCnt = intUpdCnt + 1
            If intUpdCnt >= UPDATE_FREQ Then
                System.Windows.Forms.Application.DoEvents()
                If bConvertCancel Then
                    bConvertCancel = False
                    ExtractISOFromEBOOT = CANCELLED_TEXT
                    GoTo exitFunction
                End If
                intUpdCnt = 0
            End If


'  TODO:    inflate Not WORKING

            'check if block is compressed
            If lngISOIndex_Length(lngCnt) = 16 * 2352 Then
                FileGet(intFF, bytBuff)   **this one is working for uncompressed ****
            Else 'decompress the data
                ReDim bytBuffC(lngISOIndex_Length(lngCnt) - 1)
                FileGet(intFF, bytBuffC)
                With ZS
                    .zalloc = 0
                    .zfree = 0
                    .opaque = 0
                    .avail_in = 0
                    .next_in = 0

                    inflateInit2(ZS, -15, "1.1.3", Len(ZS))  **** I think this is the problem ***
                    .avail_in = lngISOIndex_Length(lngCnt)
                    .next_in = VarPtr(bytBuffC(0))
                    .avail_out = 16 * 2352
                    .next_out = VarPtr(bytBuff(0))

                End With

                If inflate(VarPtr(ZS), 0) < 0 Then
                    ExtractISOFromEBOOT = "zlib inflate failed!"
                    GoTo exitFunction
                Else
                    inflate(VarPtr(ZS), 0)
                End If
                'Output size should be 16*2352
                inflateEnd(VarPtr(ZS))

            End If
            FilePut(intFF2, bytBuff)
        Next

        FileClose(intFF)
        FileClose(intFF2)

Hmm, I don't really know .NET, but have you referenced zlib properly?  In VB6, you use Declare Function ____ Lib "zlib.dll" to declare an API function.
Since I'm guessing that the compiler isn't complaining, I'm presuming you've referenced zlib correctly.

I'm guessing the problem is that things aren't being passed by reference/value properly.  Does .NET have the VarPtr() function?
You may need to double-check your API declaration to make sure that everything is passed by value or reference where appropriate.

If you're really stuck, unfortunately, I can't help much (since I don't really know .NET).  I'd recommend looking for some zlib handling for .NET examples - they should help you figure out what's needed.

Anyways, best of luck on your project, pka4916!  I'm glad you've decided to use my code :)
ZiNgA BuRgA Wrote:Anyways, best of luck on your project, pka4916!  I'm glad you've decided to use my code :)

your welcome, I love your program and I added the multidisc part in there too..
got everything to work except the unpack part.

I created a new Varptr procedure and that one is working fine.. I think.

but it doesn't put anything into the .next_out part
it's only writing 0's into bytBuff(0).

I am assuming that the inflateinit2  is the decompression part???
and do I need the 1.1.3 for the Zlib version in it?


Visual Basic Code
   inflateInit2(ZS, -15, "1.1.3", Len(ZS))  **** I think this is the problem ***
                    .avail_in = lngISOIndex_Length(lngCnt)
                    .next_in = VarPtr(bytBuffC(0))
                    .avail_out = 16 * 2352
                    .next_out = VarPtr(bytBuff(0))

pka4916 Wrote:I created a new Varptr procedure and that one is working fine.. I think.
In VB6, VarPtr, I think, is a language construct - you can't really just make your own.

VarPtr returns the pointer to a variable.  Kinda like the & operator in C/C++.  I don't know what .NET uses - you'll have to look into how to retrieve a pointer to a variable.

Also, thanks for the compliments :)  Good luck.
ZiNgA BuRgA Wrote:
pka4916 Wrote:I created a new Varptr procedure and that one is working fine.. I think.
In VB6, VarPtr, I think, is a language construct - you can't really just make your own.

VarPtr returns the pointer to a variable.  Kinda like the & operator in C/C++.  I don't know what .NET uses - you'll have to look into how to retrieve a pointer to a variable.

Also, thanks for the compliments :)  Good luck.


This is how it's done in VB.net

Visual Basic Code
 Public Function VarPtr(ByVal o As Object) As Integer
    Dim GC As System.Runtime.InteropServices.GCHandle =   System.Runtime.InteropServices.GCHandle.Alloc(o,System.Runtime.InteropServices.GCHandleType.Pinned)
     Return GC.AddrOfPinnedObject.ToInt32
  End Function



when I compare vb and and vb.net

bytbuffC has data in both and is also the exact same data
bytbuff has only data in vb6 and not vb.net

When I look at the ZS  at that point

I see that the numbers are way off for some of the variables.

guess I need to know what is filling bytbuff ??

Lol, I totally didn't see your post, pka4916... Erk

I came in here to edit a few of your posts to test my new syntax highlighter.

Anyways, if, by some odd reason, you manage to read this, from the looks of your declare, VarPtr is returning the pointer to an Object rather than a variable.  In VB6 (and I suspect in .NET) Objects are actually stored as pointers.

I'm still betting that it's the fact that you can't get a pointer to the buffer.
bytbuffC will have data, cause it's the input you're feeding into zlib.
bytbuff is the output you're getting from zlib, so will initially be empty.
If, after running the function, bytBuff is still empty, it means that zlib isn't doing any decompression.  So it's a pointer issue still.
So simple and goood
Pages: 1 2 3 4
Reference URL's