It's working! Hooray!
This commit is contained in:
parent
a3496fe02e
commit
0b7d72ebdd
|
@ -189,11 +189,11 @@ if [ "x$ans" = "x1" -o "x$ans" = "x" ]; then
|
||||||
echo " * Standalone version"
|
echo " * Standalone version"
|
||||||
rm -f Rules.make
|
rm -f Rules.make
|
||||||
ln -sf Rules.make.standalone Rules.make
|
ln -sf Rules.make.standalone Rules.make
|
||||||
rm -f sdl-instead
|
rm -f steed
|
||||||
ln -sf src/sdl-instead/sdl-instead sdl-instead
|
ln -sf src/sdl-instead/sdl-instead steed
|
||||||
echo "Ok. We are ready to build. Use these commands:"
|
echo "Ok. We are ready to build. Use these commands:"
|
||||||
echo " \$ make"
|
echo " \$ make"
|
||||||
echo " \$ ./sdl-instead"
|
echo " \$ ./steed"
|
||||||
elif [ "x$ans" = "x2" ]; then
|
elif [ "x$ans" = "x2" ]; then
|
||||||
echo -n "Enter prefix path [/usr/local]: "
|
echo -n "Enter prefix path [/usr/local]: "
|
||||||
read ans
|
read ans
|
||||||
|
@ -223,7 +223,7 @@ elif [ "x$ans" = "x2" ]; then
|
||||||
echo "Ok. We are ready to build and install. Use these commands:"
|
echo "Ok. We are ready to build and install. Use these commands:"
|
||||||
echo " \$ make"
|
echo " \$ make"
|
||||||
echo " \$ sudo make install"
|
echo " \$ sudo make install"
|
||||||
echo " \$ sdl-instead"
|
echo " \$ steed"
|
||||||
else
|
else
|
||||||
echo "Huh!!! Wrong answer."
|
echo "Huh!!! Wrong answer."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
src/sdl-instead/sdl-instead
|
|
|
@ -21,12 +21,10 @@ sdl-instead$(EXE): $(OBJ) $(RESOURCES)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
$(INSTALLD) $(BIN)
|
$(INSTALLD) $(BIN)
|
||||||
$(INSTALLB) sdl-instead$(EXE) $(BIN)/sdl-instead$(EXE)
|
$(INSTALLB) sdl-instead$(EXE) $(BIN)/steed$(EXE)
|
||||||
$(LN) sdl-instead$(EXE) $(BIN)/instead$(EXE)
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(RM) $(BIN)/sdl-instead$(EXE)
|
$(RM) $(BIN)/steed$(EXE)
|
||||||
$(RM) $(BIN)/instead$(EXE)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -f *.o sdl-instead$(EXE)
|
$(RM) -f *.o sdl-instead$(EXE)
|
||||||
|
|
|
@ -46,21 +46,64 @@ char *start_idf_sw = NULL;
|
||||||
extern int unpack(const char *zipfilename, const char *where);
|
extern int unpack(const char *zipfilename, const char *where);
|
||||||
extern char zip_game_dirname[];
|
extern char zip_game_dirname[];
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_url (const char *url, const char *outfile)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
static SoupSession *session;
|
||||||
|
SoupMessage *msg;
|
||||||
|
const char *header;
|
||||||
|
|
||||||
|
session = soup_session_sync_new_with_options (
|
||||||
|
SOUP_SESSION_SSL_CA_FILE, NULL,
|
||||||
|
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
|
||||||
|
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_COOKIE_JAR,
|
||||||
|
SOUP_SESSION_USER_AGENT, "get ",
|
||||||
|
SOUP_SESSION_ACCEPT_LANGUAGE_AUTO, TRUE,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
|
||||||
|
msg = soup_message_new (SOUP_METHOD_GET, url);
|
||||||
|
soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
|
||||||
|
|
||||||
|
soup_session_send_message (session, msg);
|
||||||
|
|
||||||
|
name = soup_message_get_uri (msg)->path;
|
||||||
|
|
||||||
|
if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
|
||||||
|
header = soup_message_headers_get_one (msg->response_headers,
|
||||||
|
"Location");
|
||||||
|
if (header) {
|
||||||
|
SoupURI *uri;
|
||||||
|
char *uri_string;
|
||||||
|
uri = soup_uri_new_with_base (soup_message_get_uri (msg), header);
|
||||||
|
uri_string = soup_uri_to_string (uri, FALSE);
|
||||||
|
get_url (uri_string,outfile);
|
||||||
|
g_free (uri_string);
|
||||||
|
soup_uri_free (uri);
|
||||||
|
}
|
||||||
|
} else if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
|
||||||
|
//FILE * temp = fopen(outfile,"w");
|
||||||
|
//fwrite (msg->response_body->data, 1, msg->response_body->length, temp);
|
||||||
|
int fd = open (outfile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
|
write (fd, msg->response_body->data, msg->response_body->length);
|
||||||
|
close (fd);
|
||||||
|
//fclose(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int setup_zip(const char *file, char *p)
|
static int setup_zip(const char *file, char *p)
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p) return -1;
|
||||||
return -1;
|
|
||||||
#ifdef _USE_HTTP
|
#ifdef _USE_HTTP
|
||||||
SoupSession * soup_session = soup_session_sync_new ();
|
SoupURI * parsed = soup_uri_new (file);
|
||||||
SoupMessage * msg;
|
if (parsed){
|
||||||
int fd;
|
char * outfile = game_tmp_path();
|
||||||
if (soup_uri_new (file)){
|
strcat(outfile,"/temp_download.zip");
|
||||||
msg = soup_message_new ("GET", file);
|
get_url(file,outfile);
|
||||||
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) return -2;
|
file = outfile;
|
||||||
sprintf(file,"%s/temp_download.zip",p);
|
|
||||||
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
|
||||||
write (fd, msg->response_body, msg->response_body->length);
|
|
||||||
}
|
}
|
||||||
|
soup_uri_free (parsed);
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr,"Trying to install: %s\n", file);
|
fprintf(stderr,"Trying to install: %s\n", file);
|
||||||
if (unpack(file, p)) {
|
if (unpack(file, p)) {
|
||||||
|
|
Loading…
Reference in a new issue