Skip to content

Commit

Permalink
Allow a message box to be displayed, per-patch, before the patching p…
Browse files Browse the repository at this point in the history
…rocess

 begins.
  • Loading branch information
icculus committed May 18, 2005
1 parent 3a20ac6 commit 4137801
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion mojopatch.c
Expand Up @@ -48,7 +48,7 @@
* This is to prevent incompatible builds of the program from (mis)processing
* a patchfile.
*/
#define VERSION "0.0.5" VER_EXT_ZLIB
#define VERSION "0.0.6" VER_EXT_ZLIB

#define DEFAULT_PATCHFILENAME "default.mojopatch"

Expand Down Expand Up @@ -77,6 +77,7 @@ typedef struct
char *readmedata;
char renamedir[STATIC_STRING_SIZE];
char titlebar[STATIC_STRING_SIZE];
char startupmsg[STATIC_STRING_SIZE];
} PatchHeader;

typedef enum
Expand Down Expand Up @@ -353,6 +354,7 @@ static int serialize_header(SerialArchive *ar, PatchHeader *h, int *legitEOF)
if (serialize_asciz_string(ar, &h->readmedata))
if (serialize_static_string_if_empty(ar, h->renamedir))
if (serialize_static_string_if_empty(ar, h->titlebar))
if (serialize_static_string_if_empty(ar, h->startupmsg))
return(flush_archive(ar));

return(0);
Expand Down Expand Up @@ -2148,6 +2150,7 @@ static int process_patch_header(SerialArchive *ar, PatchHeader *h)
header_log("Readme: \"%s\".", h->readmefname);
header_log("Renamedir: \"%s\".", h->renamedir);
header_log("UI titlebar: \"%s\".", h->titlebar);
header_log("Startup msg: \"%s\".", h->startupmsg);

/* Fill in a default titlebar if needed. */
if (*h->titlebar == '\0')
Expand All @@ -2165,6 +2168,10 @@ static int process_patch_header(SerialArchive *ar, PatchHeader *h)

ui_title(h->titlebar);

/* show a message box before starting... */
if (*(h->startupmsg))
ui_msgbox(h->startupmsg);

if (!info_only())
{
if (!chdir_by_identifier(h->product, h->identifier))
Expand Down Expand Up @@ -2302,6 +2309,8 @@ static int do_usage(const char *argv0)
_log(" --append (creation appends to existing patchfile)");
_log(" --alwaysadd (put ADDs instead of PATCHs into the patchfile)");
_log(" --quietonsuccess (Don't do msgbox on successful finish)");
_log(" --startupmsg (msgbox text to show at startup)");
_log(" --ui (UI driver to use for this run)");
_log(" --readme (README filename to display/install)");
_log(" --renamedir (What patched dir should be called)");
_log(" --zliblevel (compression, 0-9: 0 == fastest, 9 == best)");
Expand Down Expand Up @@ -2387,6 +2396,8 @@ static int parse_cmdline(int argc, char **argv)
make_static_string(header.renamedir, argv[++i]);
else if (strcmp(argv[i], "--titlebar") == 0)
make_static_string(header.titlebar, argv[++i]);
else if (strcmp(argv[i], "--startupmsg") == 0)
make_static_string(header.startupmsg, argv[++i]);
else if (strcmp(argv[i], "--ui") == 0)
i++; /* (really handled elsewhere.) Just skip ui driver name. */
else if (strcmp(argv[i], "--zliblevel") == 0)
Expand Down

0 comments on commit 4137801

Please sign in to comment.