Welcome, Guest. Please Login
Back to main page
  News:
Welcome to the ShadowFlare's Realm Forums.  New registrations are by request only.  To be considered for a new forum account, send an e-mail with the user name and display name you want and the reason you want to register.
  Home SFRealm HelpSearchLogin  
 
Pages: 1
Send Topic Print
Using SFMpqAPI and My progress in learning.. (Read 4366 times)
Bomber7
Peon
*
Offline

???

Posts: 5
Right Behind you
Gender: male
Using SFMpqAPI and My progress in learning..
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.
Back to top
 
 

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

The source of all
chaos

Posts: 125
The Sea of Chaos
Re: Using SFMpqAPI and My progress in learning..
Reply #1 - Nov 29th, 2007, 9:36am
 
Show me a sample of what you are doing.
Back to top
 
 

-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."
WWW 46431561 ShadowFlareSFR   IP Logged
Bomber7
Peon
*
Offline

???

Posts: 5
Right Behind you
Gender: male
Re: Using SFMpqAPI and My progress in learning..
Reply #2 - 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.
Back to top
 
« Last Edit: Jan 14th, 2008, 2:30am by Bomber7 »  

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

The source of all
chaos

Posts: 125
The Sea of Chaos
Re: Using SFMpqAPI and My progress in learning..
Reply #3 - 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.
Back to top
 
 

-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."
WWW 46431561 ShadowFlareSFR   IP Logged
Pages: 1
Send Topic Print