Ejemplo n.º 1
0
int main(int argc, char *argv[]) {

#ifdef __SWITCH_DEBUG__
	socketInitializeDefault();
	nxlinkStdio();
#endif

	// Create our OSystem instance
	g_system = new OSystem_Switch();
	assert(g_system);

	// Pre initialize the backend
	((OSystem_Switch *)g_system)->init();

#ifdef DYNAMIC_MODULES
	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif

	// Invoke the actual ScummVM main entry point:
	int res = scummvm_main(argc, argv);

	// Free OSystem
	g_system->destroy();

#ifdef __SWITCH_DEBUG__
	socketExit();
#endif

	return res;
}
Ejemplo n.º 2
0
 void RetrieveToFile(std::string URL, std::string Path, std::function<void(double Done, double Total)> Callback)
 {
     socketInitializeDefault();
     FILE *f = fopen(Path.c_str(), "wb");
     if(f)
     {
         tmpcb = Callback;
         CURL *curl = curl_easy_init();
         curl_easy_setopt(curl, CURLOPT_URL, URL.c_str());
         curl_easy_setopt(curl, CURLOPT_USERAGENT, "Goldleaf");
         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
         curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlFileWrite);
         curl_easy_setopt(curl, CURLOPT_WRITEDATA, f);
         curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
         curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, CurlProgress);
         curl_easy_perform(curl);
         curl_easy_cleanup(curl);
     }
     fclose(f);
     socketExit();
 }
Ejemplo n.º 3
0
 std::string RetrieveContent(std::string URL, std::string MIMEType)
 {
     socketInitializeDefault();
     std::string cnt;
     CURL *curl = curl_easy_init();
     if(!MIMEType.empty())
     {
         curl_slist *headerdata = NULL;
         headerdata = curl_slist_append(headerdata, ("Content-Type: " + MIMEType).c_str());
         headerdata = curl_slist_append(headerdata, ("Accept: " + MIMEType).c_str());
         curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerdata);
     }
     curl_easy_setopt(curl, CURLOPT_URL, URL.c_str());
     curl_easy_setopt(curl, CURLOPT_USERAGENT, "Goldleaf");
     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
     curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlStrWrite);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, &cnt);
     curl_easy_perform(curl);
     curl_easy_cleanup(curl);
     socketExit();
     return cnt;
 }