Skip to content

Commit 289d4d1

Browse files
committed
add missing cmdline option and documentation for quicksave screenshot format
git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45868 379a1393-f5fb-40a0-bcee-ef074d9b53f7
1 parent b458697 commit 289d4d1

File tree

4 files changed

+60
-2
lines changed

4 files changed

+60
-2
lines changed

vice/doc/vice.texi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3155,7 +3155,7 @@ system/window manager. Mappings using @code{<Alt>} or
31553155
@item @code{scpu-speed-switch-toggle}
31563156
@tab Toggle SCPU Speed switch
31573157
@item @code{screenshot-quicksave}
3158-
@tab Quiksave screenshot
3158+
@tab Quicksave screenshot
31593159
@item @code{settings-default}
31603160
@tab Restore default settings
31613161
@item @code{settings-dialog}
@@ -18098,6 +18098,12 @@ Specify the action to take when the CPU encounters a 'JAM' opcode
1809818098
Specify the system file search path
1809918099
(@code{Directory}).
1810018100

18101+
@findex -quicksaveformat
18102+
@item -quicksaveformat <Format>
18103+
Specify the format of the quicksave screenshot
18104+
(@code{QuicksaveScreenshotFormat})
18105+
(png, gif ,bmp, iff, pcx, ppm, 4bt, artstudio, koala, minipaint).
18106+
1810118107
@end table
1810218108

1810318109
@subsection Common resources
@@ -18170,6 +18176,10 @@ String specifying the filename of a screenshot file that will be written when th
1817018176
@item ExitScreenshotName1
1817118177
String specifying the filename of a screenshot file that will be written when the emulator exits. (x128)
1817218178

18179+
@vindex QuicksaveScreenshotFormat
18180+
@item QuicksaveScreenshotFormat
18181+
String specifying the format of the quicksave screenshot (png, gif ,bmp, iff, pcx, ppm, 4bt, artstudio, koala, minipaint)
18182+
1817318183
@vindex SaveResourcesOnExit
1817418184
@item SaveResourcesOnExit
1817518185
Boolean specifying whether the emulator should save changed settings

vice/src/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
*/
3232

33-
/* #define DEBUG_MAIN */
33+
#define DEBUG_MAIN
3434

3535
#include "vice.h"
3636

@@ -59,6 +59,7 @@
5959
#include "main.h"
6060
#include "mainlock.h"
6161
#include "resources.h"
62+
#include "screenshot.h"
6263
#include "sysfile.h"
6364
#include "types.h"
6465
#include "uiapi.h"
@@ -344,13 +345,19 @@ int main_program(int argc, char **argv)
344345
return -1;
345346
}
346347

348+
/* KLUDGES: this should really get fixed properly, so it can go into the
349+
regular init function(s) */
347350
DBG(("main:early gfxoutput init"));
348351
gfxoutput_early_init((int)help_requested);
349352
gfxoutput_resources_init();
350353
if (gfxoutput_cmdline_options_init() < 0) {
351354
init_cmdline_options_fail("gfxoutput");
352355
return -1;
353356
}
357+
if (screenshot_cmdline_options_init() < 0) {
358+
init_cmdline_options_fail("screenshot");
359+
return -1;
360+
}
354361
DBG(("main:early gfxoutput init done"));
355362

356363
/* Set factory defaults. */

vice/src/screenshot.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <time.h>
3737
#include <sys/time.h>
3838

39+
#include "cmdline.h"
3940
#include "gfxoutput.h"
4041
#include "lib.h"
4142
#include "log.h"
@@ -404,12 +405,51 @@ static resource_string_t resources_string[] = {
404405
RESOURCE_STRING_LIST_END
405406
};
406407

408+
static int quicksave_set_func(const char *value, void *extra_param)
409+
{
410+
char *s;
411+
int i = 0;;
412+
if (value == NULL) {
413+
return -1;
414+
}
415+
s = lib_strdup(value);
416+
while(s[i] != 0) {
417+
s[i] = toupper(s[i]);
418+
i++;
419+
}
420+
i = resources_set_string("QuicksaveScreenshotFormat", s);
421+
lib_free(s);
422+
return i;
423+
}
424+
425+
static cmdline_option_t cmdline_options[] =
426+
{
427+
{ "-quicksaveformat", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS,
428+
quicksave_set_func, NULL, "QuicksaveScreenshotFormat", NULL,
429+
"<Format>",
430+
/* KLUDGES: this should really be generated at runtime */
431+
"Specify format of quicksave screenshots ("
432+
#ifdef HAVE_PNG
433+
"png, "
434+
#endif
435+
#ifdef HAVE_GIF
436+
"gif ,"
437+
#endif
438+
"bmp, iff, pcx, ppm, 4bt, artstudio, koala, minipaint)"
439+
},
440+
CMDLINE_LIST_END
441+
};
407442

408443
int screenshot_resources_init(void)
409444
{
410445
return resources_register_string(resources_string);
411446
}
412447

448+
int screenshot_cmdline_options_init(void)
449+
{
450+
return cmdline_register_options(cmdline_options);
451+
}
452+
413453

414454
/** \brief Callback for vsync_on_vsync_do()
415455
*

vice/src/screenshot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const char *screenshot_get_quickscreenshot_format(void);
147147
char *screenshot_create_datetime_string(void);
148148
char *screenshot_create_quickscreenshot_filename(const char *format);
149149
int screenshot_resources_init(void);
150+
int screenshot_cmdline_options_init(void);
150151
void screenshot_ui_auto_screenshot(void);
151152

152153
#ifdef FEATURE_CPUMEMHISTORY

0 commit comments

Comments
 (0)