ShadowFlare's Realm
http://sfsrealm.hopto.org/cgi-bin/yabb2/YaBB.pl
ShadowFlare's Realm Forums >> Program Development >> Using SFMpqAPI and My progress in learning..
http://sfsrealm.hopto.org/cgi-bin/yabb2/YaBB.pl?num=1196307031

Message started by Bomber7 on Nov 29th, 2007, 2:30am

Title: Using SFMpqAPI and My progress in learning..
Post by Bomber7 on Nov 29th, 2007, 2:30am

So far I'm pretty sure I understand some of the functions and their purpose. However I'm having a few problems and GetLastError always returns 0. First I tries opening an mpq. That returned true, so I assume that means it worked. Then I tried opening a file in that mpq, that also returned true. However whenever I tried to use that file in a function, and I gave the same 'filehandle' as I gave the opening of the file, it crashes. I found that it only worked with a handle of 0. So I set it to 0 and tried to read from the file. I'm stuck there. It always returns false. Someone please help me, I'd really like to figure out how to use this properly.

Title: Re: Using SFMpqAPI and My progress in learning..
Post by ShadowFlare on Nov 29th, 2007, 9:36am

Show me a sample of what you are doing.

Title: Re: Using SFMpqAPI and My progress in learning..
Post by Bomber7 on Jan 13th, 2008, 10:33pm

Ok sorry it took so long to answer.

Code:

Dim Nor() As Byte
Private Sub Command1_Click()
Narg = SFileOpenArchive(FPATH, 3, 0, 0)
Text1.Text = Str(Narg)
End Sub

Private Sub Command2_Click()
Nag = SFileOpenFile("Tx.txt", 0)
Text2.Text = Str(Nag)

End Sub

Private Sub Command3_Click()
'Nasg = SFileReadFile(0, Nor(0), 20, 0, ByVal 0&)
Nasg = SFileReadFile(0, Nor(0), 20, 0, 1)
Text3.Text = Str(Nasg)
End Sub

Private Sub Command4_Click()
Dim narm As Long
narm = SFileGetFileSize(0, MAX)
Text4.Text = Str(narm)
End Sub

Private Sub Command5_Click()
Dim Nemme(999) As FILELISTENTRY
nfe = SFileListFiles(0, "(listfile)", Nemme(0), 0)
Text5.Text = Str(nfe)
End Sub

Private Sub Command6_Click()
nagmseogf = GetLastError()

Text6.Text = nagmseogf 'Str(nagmseogf)
End Sub

Private Sub Form_Load()
ReDim Nor(20) As Byte
End Sub

Private Sub Text1_Change()

End Sub

Thats the VB code that doesn't work. (See above for problem)

Also I'm trying to get it to work in C++. Can someone please tell me whats wrong with this code?

Code:
int _tmain()
{
     BOOL Nar;
     char Lom[66] = "C:\\Documents and Settings\\gat\\Desktop\\Prog\\SEE\\New Folder\\Fat.mpq";
     cout << "Test\n";
     //Nar = false;
     //Nar = SFileOpenArchive("C:\\Documents and Settings\\gat\\Desktop\\Prog\\SEE\\New Folder\\Fat.mpq",9,0,&Meg);
     Nar = SFileOpenArchive(Lom,0,MOAU_OPEN_EXISTING,&Meg);//SFILE_OPEN_HARD_DISK_FILE
     //cout << "O!" << GetLastError();
     DisplayErro();
     //if (Nar) {cout << "Lol";} else {cout << "moose\n";}
     return 0;
}
The error I get when I use GetLastError() is 1701013878 which matches none of the error codes.

Title: Re: Using SFMpqAPI and My progress in learning..
Post by ShadowFlare on Jan 19th, 2008, 7:27pm

The last parameter on SFileOpenArchive and SFileOpenFile are what give you the handles.  If you don't pass a variable to that parameter, it won't work.

ShadowFlare's Realm » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.