Post: File Downloader Code (For SPRX)
07-24-2017, 10:30 PM #1
Tustin
Balls of Steel
(adsbygoogle = window.adsbygoogle || []).push({}); I wrote this code with the intention of making a auto updater for Lexicon a while back but ran into problems with file permissions so it was never used. Figured someone here could find it useful for something. You need to add this code to your sprx project, and then create a listening server in whatever language you want to serve the file.


C++ code: (I can't remember if the progress bar thing worked properly or not)



Server code (written in PHP =Z):



This is a basic example that will help you get started. Although if you want to modify this any further you probably want to do some research on socket programming before messing with this.
Last edited by Tustin ; 07-24-2017 at 10:34 PM.

The following 2 users say thank you to Tustin for this useful post:

PhucedMODZ, Smoulougde
08-01-2017, 03:30 PM #11
PhucedMODZ
Do a barrel roll!
Originally posted by Tustin View Post
I wrote this code with the intention of making a auto updater for Lexicon a while back but ran into problems with file permissions so it was never used. Figured someone here could find it useful for something. You need to add this code to your sprx project, and then create a listening server in whatever language you want to serve the file.


C++ code: (I can't remember if the progress bar thing worked properly or not)



Server code (written in PHP =Z):



This is a basic example that will help you get started. Although if you want to modify this any further you probably want to do some research on socket programming before messing with this.


nice work tustin, nice to see something new
08-01-2017, 05:51 PM #12
Smoulougde
S.P.E.C.I.A.L
Originally posted by Tustin View Post
Sorry, ignore what I said about the response header/body. For some reason when I replied earlier I was thinking this was using HTTP requests. The buffer size should be a length of bytes you're comfortable storing at one time. Setting it to 1024 (or 1 KB) should be sufficient. That basically means the socket will read 1 KB of your file each time and store that in the file.


Mmmh, when i put the function in prx.cpp in int main() like this > You must login or register to view this content.
I launch my game, and the game freez (i lokked the GTA;sprx placed in tmp, and it's blank. 0Ko). Where i must put the function DownloadFile in my sprx ?
Last edited by Smoulougde ; 08-01-2017 at 06:43 PM.
08-01-2017, 08:20 PM #13
Tustin
Balls of Steel
Originally posted by Smoulougde View Post
Mmmh, when i put the function in prx.cpp in int main() like this > You must login or register to view this content.
I launch my game, and the game freez (i lokked the GTA;sprx placed in tmp, and it's blank. 0Ko). Where i must put the function DownloadFile in my sprx ?

I'm pretty sure you need to create a separate thread to be able to use sockets. If you do that and it still freezes, make sure the port is correct on both your server and your client. Also make sure that the port is open on your server and that there isn't a firewall blocking it. Although keep in mind that trying to overwrite a sprx might not work for you as that's the problem I had with this code. I couldn't give my SPRX permissions to delete/rename other SPRX files for some reason so overwriting your current one might not work either.
08-01-2017, 09:13 PM #14
Smoulougde
S.P.E.C.I.A.L
Originally posted by Tustin View Post
I'm pretty sure you need to create a separate thread to be able to use sockets. If you do that and it still freezes, make sure the port is correct on both your server and your client. Also make sure that the port is open on your server and that there isn't a firewall blocking it. Although keep in mind that trying to overwrite a sprx might not work for you as that's the problem I had with this code. I couldn't give my SPRX permissions to delete/rename other SPRX files for some reason so overwriting your current one might not work either.


Ok I understand, but for example I can download a .txt file from the site and write it without permission problem as it is not an SPRX, if I understand well, the only worry is the fact that it is a SPRX so i need one function/bypass for erase the SPRX, right ?
08-01-2017, 09:16 PM #15
Tustin
Balls of Steel
Originally posted by Smoulougde View Post
Ok I understand, but for example I can download a .txt file from the site and write it without permission problem as it is not an SPRX, if I understand well, the only worry is the fact that it is a SPRX so i need one function/bypass for erase the SPRX, right ?

Yes exactly. You could use this for a menu configuration system or something like that. The error I was running into: You must login or register to view this content.. I explained in that thread of a way around it but it's not an automatic solution.
08-01-2017, 11:20 PM #16
Smoulougde
S.P.E.C.I.A.L
Originally posted by Tustin View Post
Yes exactly. You could use this for a menu configuration system or something like that. The error I was running into: You must login or register to view this content.. I explained in that thread of a way around it but it's not an automatic solution.


Ok i see, i will try with .ini / txt files for see if my coding is good or not Winky Winky
Else i asked a gopro if he knows something about this, because (i'm not sure) but in his sprx for gta5, there is an auto updater.
08-19-2017, 05:57 PM #17
Originally posted by Tustin View Post
I'm pretty sure you need to create a separate thread to be able to use sockets. If you do that and it still freezes, make sure the port is correct on both your server and your client. Also make sure that the port is open on your server and that there isn't a firewall blocking it. Although keep in mind that trying to overwrite a sprx might not work for you as that's the problem I had with this code. I couldn't give my SPRX permissions to delete/rename other SPRX files for some reason so overwriting your current one might not work either.


just chmod 777 your sprx with a C++ code ? Smile
08-19-2017, 06:53 PM #18
Tustin
Balls of Steel
Originally posted by LAN View Post
just chmod 777 your sprx with a C++ code ? Smile

Tried it and it gave the same error I got when I tried unlinking the sprx too.
08-20-2017, 12:55 AM #19
Tustin
Balls of Steel
Originally posted by NoRecess
Wasn't this on the limbo menu a few years ago?

I'm not totally sure what the Limo menu is

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo