mirror of
https://github.com/wiidev/usbloadergx.git
synced 2025-02-18 04:16:20 +01:00
*Changed to download files under their real filename
*Small change to the download request function, added filename reading
This commit is contained in:
parent
12e42498dc
commit
d3d2055583
File diff suppressed because one or more lines are too long
2
gui.pnps
2
gui.pnps
@ -1 +1 @@
|
|||||||
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="true"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="true"></e><e p="gui\source\patches" x="false"></e><e p="gui\source\themes" x="false"></e></ViewState></pd>
|
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="true"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisk" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="true"></e><e p="gui\source\patches" x="false"></e><e p="gui\source\themes" x="false"></e></ViewState></pd>
|
@ -99,7 +99,7 @@ bool ShutdownWC24() {
|
|||||||
return onlinefix;
|
return onlinefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 network_request(const char * request) {
|
s32 network_request(const char * request, char * filename) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
|
|
||||||
@ -122,6 +122,24 @@ s32 network_request(const char * request) {
|
|||||||
/* HTTP request OK? */
|
/* HTTP request OK? */
|
||||||
if (!strstr(buf, "HTTP/1.1 200 OK"))
|
if (!strstr(buf, "HTTP/1.1 200 OK"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if(filename)
|
||||||
|
{
|
||||||
|
/* Get filename */
|
||||||
|
ptr = strstr(buf, "filename=\"");
|
||||||
|
|
||||||
|
if(ptr)
|
||||||
|
{
|
||||||
|
ptr += sizeof("filename=\"")-1;
|
||||||
|
|
||||||
|
for(cnt = 0; ptr[cnt] != '\r' && ptr[cnt] != '\n' && ptr[cnt] != '"'; cnt++)
|
||||||
|
{
|
||||||
|
filename[cnt] = ptr[cnt];
|
||||||
|
filename[cnt+1] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Retrieve content size */
|
/* Retrieve content size */
|
||||||
ptr = strstr(buf, "Content-Length:");
|
ptr = strstr(buf, "Content-Length:");
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
@ -156,7 +174,7 @@ s32 network_read(u8 *buf, u32 len) {
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Download request
|
* Download request
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
s32 download_request(const char * url) {
|
s32 download_request(const char * url, char * filename) {
|
||||||
|
|
||||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||||
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
||||||
@ -190,7 +208,7 @@ s32 download_request(const char * url) {
|
|||||||
char header[strlen(path)+strlen(domain)+strlen(url)+100];
|
char header[strlen(path)+strlen(domain)+strlen(url)+100];
|
||||||
sprintf(header, "GET %s HTTP/1.1\r\nHost: %s\r\nReferer: %s\r\nConnection: close\r\n\r\n", path, domain, url);
|
sprintf(header, "GET %s HTTP/1.1\r\nHost: %s\r\nReferer: %s\r\nConnection: close\r\n\r\n", path, domain, url);
|
||||||
|
|
||||||
s32 filesize = network_request(header);
|
s32 filesize = network_request(header, filename);
|
||||||
|
|
||||||
return filesize;
|
return filesize;
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Network Operations
|
* Network Operations
|
||||||
* for USB Loader GX
|
* for USB Loader GX
|
||||||
*
|
*
|
||||||
* HTTP operations
|
* HTTP operations
|
||||||
* Written by dhewg/bushing modified by dimok
|
* Written by dhewg/bushing modified by dimok
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef _NETWORKOPS_H_
|
#ifndef _NETWORKOPS_H_
|
||||||
#define _NETWORKOPS_H_
|
#define _NETWORKOPS_H_
|
||||||
|
|
||||||
#define NETWORKBLOCKSIZE 5*1024 //5KB
|
#define NETWORKBLOCKSIZE 5*1024 //5KB
|
||||||
|
|
||||||
void Initialize_Network(void);
|
void Initialize_Network(void);
|
||||||
bool IsNetworkInit(void);
|
bool IsNetworkInit(void);
|
||||||
char * GetNetworkIP(void);
|
char * GetNetworkIP(void);
|
||||||
char * GetIncommingIP(void);
|
char * GetIncommingIP(void);
|
||||||
bool ShutdownWC24();
|
bool ShutdownWC24();
|
||||||
s32 network_request(const char * request);
|
s32 network_request(const char * request, char * filename);
|
||||||
s32 network_read(u8 *buf, u32 len);
|
s32 network_read(u8 *buf, u32 len);
|
||||||
s32 download_request(const char * url);
|
s32 download_request(const char * url, char * filename = NULL);
|
||||||
void CloseConnection();
|
void CloseConnection();
|
||||||
int CheckUpdate();
|
int CheckUpdate();
|
||||||
|
|
||||||
void HaltNetworkThread();
|
void HaltNetworkThread();
|
||||||
void ResumeNetworkWait();
|
void ResumeNetworkWait();
|
||||||
void ResumeNetworkThread();
|
void ResumeNetworkThread();
|
||||||
void InitNetworkThread();
|
void InitNetworkThread();
|
||||||
void ShutdownNetworkThread();
|
void ShutdownNetworkThread();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user