12-27-2019 (wasnt in git)
This commit is contained in:
parent
357c896b6f
commit
28db59ee93
|
@ -32,7 +32,7 @@ SetColor(RGBA(0,255,0,255),DOWNLOAD_SELECTOR);
|
||||||
SetColor(RGBA(128,0,128,255),DOWNLOAD_KEYBOARD_OUTLINE);
|
SetColor(RGBA(128,0,128,255),DOWNLOAD_KEYBOARD_OUTLINE);
|
||||||
}
|
}
|
||||||
void Yellow(){
|
void Yellow(){
|
||||||
SetColor(RGBA(128,128,0,255),DOWNLOAD_BACKGROUND);
|
SetColor(RGBA(255,255,0,255),DOWNLOAD_BACKGROUND);
|
||||||
SetColor(RGBA(255,255,255,255),DOWNLOAD_TEXTBOX_BACKGROUND);
|
SetColor(RGBA(255,255,255,255),DOWNLOAD_TEXTBOX_BACKGROUND);
|
||||||
SetColor(RGBA(255,255,255,255),DOWNLOAD_FOREGROUND_NO_SELECTOR);
|
SetColor(RGBA(255,255,255,255),DOWNLOAD_FOREGROUND_NO_SELECTOR);
|
||||||
SetColor(RGBA(0,0,255,255),DOWNLOAD_FOREGROUND_SELECTOR);
|
SetColor(RGBA(0,0,255,255),DOWNLOAD_FOREGROUND_SELECTOR);
|
||||||
|
|
|
@ -10,7 +10,29 @@ int monthnew=11;int daynew=15;int yearnew=2019;
|
||||||
int downloadnotlist=1; //1 download 0 list
|
int downloadnotlist=1; //1 download 0 list
|
||||||
int coldate=0;//0 is month 1 is day 2 is year
|
int coldate=0;//0 is month 1 is day 2 is year
|
||||||
GRRLIB_ttfFont* myFont;
|
GRRLIB_ttfFont* myFont;
|
||||||
|
static size_t
|
||||||
|
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||||
|
{
|
||||||
|
dlf* S=((dlf*)userp);
|
||||||
|
size_t realsize = size * nmemb;
|
||||||
|
DLFhandler(S,realsize);
|
||||||
|
/* struct MemoryStruct *mem = (struct MemoryStruct *)userp;
|
||||||
|
|
||||||
|
char *ptr = realloc(mem->memory, mem->size + realsize + 1);
|
||||||
|
if(ptr == NULL) {
|
||||||
|
|
||||||
|
printf("not enough memory (realloc returned NULL)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mem->memory = ptr;
|
||||||
|
memcpy(&(mem->memory[mem->size]), contents, realsize);
|
||||||
|
mem->size += realsize;
|
||||||
|
mem->memory[mem->size] = 0;
|
||||||
|
*/
|
||||||
|
fwrite(contents,size,nmemb,S->fp);
|
||||||
|
return realsize;
|
||||||
|
}
|
||||||
int willtry=0;
|
int willtry=0;
|
||||||
int videos=-1;
|
int videos=-1;
|
||||||
ir_t ir;
|
ir_t ir;
|
||||||
|
@ -116,6 +138,7 @@ static int older_progress(void* p,
|
||||||
double dltotal, double dlnow,
|
double dltotal, double dlnow,
|
||||||
double ultotal, double ulnow)
|
double ultotal, double ulnow)
|
||||||
{
|
{
|
||||||
|
dlf* ser = ((dlf*)p);
|
||||||
char what2[256];
|
char what2[256];
|
||||||
double percent = (dlnow / dltotal) * 100;
|
double percent = (dlnow / dltotal) * 100;
|
||||||
int realp = (int)percent;
|
int realp = (int)percent;
|
||||||
|
@ -126,9 +149,14 @@ static int older_progress(void* p,
|
||||||
|
|
||||||
sprintf(what2,"%i%%",realp);
|
sprintf(what2,"%i%%",realp);
|
||||||
GRRLIB_FillScreen(GetColor(DOWNLOAD_BACKGROUND));
|
GRRLIB_FillScreen(GetColor(DOWNLOAD_BACKGROUND));
|
||||||
|
char filenamersr[1008];
|
||||||
|
sprintf(filenamersr,"%s",ser->fnam);
|
||||||
|
if(ser->fileid > 0){
|
||||||
|
sprintf(filenamersr,"%s.%i",filenamersr,ser->fileid);
|
||||||
|
}
|
||||||
int x = 320-(((int)GRRLIB_WidthTTF (myFont, what2,72)) / 2);
|
int x = 320-(((int)GRRLIB_WidthTTF (myFont, what2,72)) / 2);
|
||||||
GRRLIB_PrintfTTF(x, 192, myFont, what2, 72, GetColor(DOWNLOAD_PROGRESSVAL));
|
GRRLIB_PrintfTTF(x, 192, myFont, what2, 72, GetColor(DOWNLOAD_PROGRESSVAL));
|
||||||
|
GRRLIB_PrintfTTF(32, 32, myFont, filenamersr, 24, GetColor(DOWNLOAD_PROGRESSVAL));
|
||||||
GRRLIB_Rectangle(268,192+120,104,32, GetColor(DOWNLOAD_PROGRESSBAR_BACKGROUND),1);
|
GRRLIB_Rectangle(268,192+120,104,32, GetColor(DOWNLOAD_PROGRESSBAR_BACKGROUND),1);
|
||||||
GRRLIB_Rectangle(270,192+125,realp,22, GetColor(DOWNLOAD_PROGRESSBAR_FOREGROUND),1);
|
GRRLIB_Rectangle(270,192+125,realp,22, GetColor(DOWNLOAD_PROGRESSBAR_FOREGROUND),1);
|
||||||
|
|
||||||
|
@ -905,8 +933,10 @@ int Download(char* url, char* file) {
|
||||||
CURL* curl;
|
CURL* curl;
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
int ret=1;
|
int ret=1;
|
||||||
FILE *f = fopen(file,"wb");
|
dlf dr;
|
||||||
|
dr.fp =fopen(file,"wb");
|
||||||
|
sprintf(dr.fnam,"%s",file);
|
||||||
|
dr.fileid=0;
|
||||||
|
|
||||||
curl_easy_setopt(curl,CURLOPT_URL,url);
|
curl_easy_setopt(curl,CURLOPT_URL,url);
|
||||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
|
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
|
||||||
|
@ -917,12 +947,15 @@ curl_easy_setopt(curl,CURLOPT_URL,url);
|
||||||
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, older_progress);
|
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, older_progress);
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA,f);
|
curl_easy_setopt(curl, CURLOPT_PRIVATE,(void*)&dr);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void*)&dr);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA,(void*)&dr);
|
||||||
curl_easy_setopt(curl,CURLOPT_FAILONERROR,1L);
|
curl_easy_setopt(curl,CURLOPT_FAILONERROR,1L);
|
||||||
curl_easy_perform(curl);
|
curl_easy_perform(curl);
|
||||||
long int bytes =ftell(f);
|
long int bytes =ftell(dr.fp);
|
||||||
fclose(f);
|
fclose(dr.fp);
|
||||||
if(bytes==0){
|
if(bytes==0 && dr.fileid==0){
|
||||||
unlink(file);
|
unlink(file);
|
||||||
ret=0;
|
ret=0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
int irmode=0;
|
int irmode=0;
|
||||||
|
void DLFhandler(dlf* dl,size_t real){
|
||||||
|
//max fat32 is 4,294,967,000 just to be safe
|
||||||
|
size_t bytesnow = ftell(dl->fp) + real;
|
||||||
|
|
||||||
|
if(bytesnow >= (size_t)4294967000){
|
||||||
|
dl->fileid++;
|
||||||
|
char nam[1008];
|
||||||
|
|
||||||
|
sprintf(nam,"%s.%i",dl->fnam,dl->fileid);
|
||||||
|
freopen(nam,"wb",dl->fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
int UsingIRFeatures(){
|
int UsingIRFeatures(){
|
||||||
return irmode;
|
return irmode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,19 @@
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <grrlib.h>
|
#include <grrlib.h>
|
||||||
#include "FreeMonoBold_ttf.h"
|
#include "FreeMonoBold_ttf.h"
|
||||||
|
|
||||||
|
typedef struct dlf{
|
||||||
|
FILE* fp;
|
||||||
|
char fnam[1000];
|
||||||
|
int fileid;
|
||||||
|
|
||||||
|
}dlf;
|
||||||
|
void DLFhandler(dlf* dl,size_t real);
|
||||||
void OpenPlaylistFile(char* playlist);
|
void OpenPlaylistFile(char* playlist);
|
||||||
char* OpenFile(char* fname);
|
char* OpenFile(char* fname);
|
||||||
char* OpenPlaylistVideoFile(char* playlist,char* video);
|
char* OpenPlaylistVideoFile(char* playlist,char* video);
|
||||||
|
|
Loading…
Reference in New Issue