Post Reply 
[PSP] [Source code] Simple Popstation GUI v3.00 beta
Author Message
ZiNgA BuRgA
Smart Alternative

Posts: 17,047.4430
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 444.6674
Offline
Post: #21
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
Unfortunately, this is written in VB6, so won't work in .NET.

You can write it up yourself if you want.
09/01/2008 08:35 PM
Visit this user's website Find all posts by this user Quote this message in a reply
pka4916
Neophitic Presence

Posts: 5.1711
Threads: 0
Joined: 22nd Dec 2007
Reputation: 0
E-Pigs: 0.5000
Offline
Post: #22
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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.
09/01/2008 10:30 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,047.4430
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 444.6674
Offline
Post: #23
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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?
10/01/2008 04:49 AM
Visit this user's website Find all posts by this user Quote this message in a reply
pka4916
Neophitic Presence

Posts: 5.1711
Threads: 0
Joined: 22nd Dec 2007
Reputation: 0
E-Pigs: 0.5000
Offline
Post: #24
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
in vb6 it works fine, in .net it isn't working

Visual Basic Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'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)

(This post was last modified: 23/01/2008 04:14 AM by ZiNgA BuRgA.)
10/01/2008 09:44 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,047.4430
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 444.6674
Offline
Post: #25
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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 :)
10/01/2008 07:58 PM
Visit this user's website Find all posts by this user Quote this message in a reply
pka4916
Neophitic Presence

Posts: 5.1711
Threads: 0
Joined: 22nd Dec 2007
Reputation: 0
E-Pigs: 0.5000
Offline
Post: #26
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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))

(This post was last modified: 23/01/2008 04:13 AM by ZiNgA BuRgA.)
10/01/2008 09:32 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,047.4430
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 444.6674
Offline
Post: #27
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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 post was last modified: 11/01/2008 05:11 AM by ZiNgA BuRgA.)
11/01/2008 05:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
pka4916
Neophitic Presence

Posts: 5.1711
Threads: 0
Joined: 22nd Dec 2007
Reputation: 0
E-Pigs: 0.5000
Offline
Post: #28
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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 ??

(This post was last modified: 23/01/2008 04:13 AM by ZiNgA BuRgA.)
11/01/2008 09:55 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,047.4430
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 444.6674
Offline
Post: #29
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
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.
23/01/2008 04:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply
yanhui
Neophitic Presence

Posts: 1.1749
Threads: 0
Joined: 26th Aug 2008
Reputation: 0
E-Pigs: 0.5110
Offline
Post: #30
RE: [PSP] [Source code] Simple Popstation GUI v3.00 beta
So simple and goood
26/08/2008 07:42 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: