Page Index Toggle Pages: 1
Topic Tools
Normal Topic Using SFMpqAPI and My progress in learning.. (Read 4494 times)
Bomber7
Peon
*
Offline


???

Posts: 5
Location: Right Behind you
Joined: Jul 3rd, 2007
Using SFMpqAPI and My progress in learning..
Nov 29th, 2007 at 2:30am
Post Tools
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.
  

I have more questions in one little finger then you have answers in all your body!
Back to top
 
IP Logged
 
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline


The source of all chaos

Posts: 125
Location: The Sea of Chaos
Joined: May 11th, 2002
Re: Using SFMpqAPI and My progress in learning..
Reply #1 - Nov 29th, 2007 at 9:36am
Post Tools
Show me a sample of what you are doing.
  

-ShadowFlare

"My mind is my power. My power is my mind.
When uncorrupted by other elements, my mind is my pure power."

"I am a darkness beyond blackest pitch, deeper than the deepest night.
I am the Sea of Chaos. The source of all chaos.
That is how you describe me...
I am... the Lord of Nightmares."
Back to top
WWW  
IP Logged
 
Bomber7
Peon
*
Offline


???

Posts: 5
Location: Right Behind you
Joined: Jul 3rd, 2007
Re: Using SFMpqAPI and My progress in learning..
Reply #2 - Jan 13th, 2008 at 10:33pm
Post Tools
Ok sorry it took so long to answer.
Code
Select All
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
Select All
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.
« Last Edit: Jan 14th, 2008 at 2:30am by Bomber7 »  

I have more questions in one little finger then you have answers in all your body!
Back to top
 
IP Logged
 
ShadowFlare
Administrator/Lord of Nightmares
*****
Offline


The source of all chaos

Posts: 125
Location: The Sea of Chaos
Joined: May 11th, 2002
Re: Using SFMpqAPI and My progress in learning..
Reply #3 - Jan 19th, 2008 at 7:27pm
Post Tools
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

"My mind is my power. My power is my mind.
When uncorrupted by other elements, my mind is my pure power."

"I am a darkness beyond blackest pitch, deeper than the deepest night.
I am the Sea of Chaos. The source of all chaos.
That is how you describe me...
I am... the Lord of Nightmares."
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools