Added command line option to start in fullscreen mode.
This commit is contained in:
parent
4f46befaff
commit
8e9adf91de
4 changed files with 108 additions and 5 deletions
|
|
@ -48,7 +48,7 @@ uint64_t timer_read()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
int c, d;
|
int c, d;
|
||||||
|
|
@ -59,7 +59,7 @@ int main()
|
||||||
install_int_ex(onesec, BPS_TO_TIMER(1));
|
install_int_ex(onesec, BPS_TO_TIMER(1));
|
||||||
midi_init();
|
midi_init();
|
||||||
|
|
||||||
initpc();
|
initpc(argc, argv);
|
||||||
|
|
||||||
d = romset;
|
d = romset;
|
||||||
for (c = 0; c < ROM_MAX; c++)
|
for (c = 0; c < ROM_MAX; c++)
|
||||||
|
|
|
||||||
|
|
@ -478,3 +478,4 @@ void onesec();
|
||||||
|
|
||||||
void resetpc_cad();
|
void resetpc_cad();
|
||||||
|
|
||||||
|
extern int start_in_fullscreen;
|
||||||
|
|
|
||||||
18
src/pc.c
18
src/pc.c
|
|
@ -36,6 +36,7 @@
|
||||||
#include "vid_voodoo.h"
|
#include "vid_voodoo.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
|
||||||
|
int start_in_fullscreen = 0;
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
|
|
||||||
int cdrom_enabled;
|
int cdrom_enabled;
|
||||||
|
|
@ -189,9 +190,10 @@ void pc_reset()
|
||||||
// video_init();
|
// video_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initpc()
|
void initpc(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
int c;
|
||||||
// allegro_init();
|
// allegro_init();
|
||||||
get_executable_name(pcempath,511);
|
get_executable_name(pcempath,511);
|
||||||
pclog("executable_name = %s\n", pcempath);
|
pclog("executable_name = %s\n", pcempath);
|
||||||
|
|
@ -199,6 +201,20 @@ void initpc()
|
||||||
*p=0;
|
*p=0;
|
||||||
pclog("path = %s\n", pcempath);
|
pclog("path = %s\n", pcempath);
|
||||||
|
|
||||||
|
for (c = 1; c < argc; c++)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(argv[c], "--help"))
|
||||||
|
{
|
||||||
|
printf("PCem command line options :\n\n");
|
||||||
|
printf("-fullscreen - start in fullscreen mode\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
else if (!strcasecmp(argv[c], "--fullscreen"))
|
||||||
|
{
|
||||||
|
start_in_fullscreen = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
mouse_init();
|
mouse_init();
|
||||||
joystick_init();
|
joystick_init();
|
||||||
|
|
|
||||||
88
src/win.c
88
src/win.c
|
|
@ -391,6 +391,77 @@ void get_registry_key_map()
|
||||||
pclog("Done preparing!\n");
|
pclog("Done preparing!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char **argv;
|
||||||
|
static int argc;
|
||||||
|
static char *argbuf;
|
||||||
|
|
||||||
|
static void process_command_line()
|
||||||
|
{
|
||||||
|
char *cmdline;
|
||||||
|
int argc_max;
|
||||||
|
int i, q;
|
||||||
|
|
||||||
|
cmdline = GetCommandLine();
|
||||||
|
i = strlen(cmdline) + 1;
|
||||||
|
argbuf = malloc(i);
|
||||||
|
memcpy(argbuf, cmdline, i);
|
||||||
|
|
||||||
|
argc = 0;
|
||||||
|
argc_max = 64;
|
||||||
|
argv = malloc(sizeof(char *) * argc_max);
|
||||||
|
if (!argv)
|
||||||
|
{
|
||||||
|
free(argbuf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
/* parse commandline into argc/argv format */
|
||||||
|
while (argbuf[i])
|
||||||
|
{
|
||||||
|
while (argbuf[i] == ' ')
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (argbuf[i])
|
||||||
|
{
|
||||||
|
if ((argbuf[i] == '\'') || (argbuf[i] == '"'))
|
||||||
|
{
|
||||||
|
q = argbuf[i++];
|
||||||
|
if (!argbuf[i])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
q = 0;
|
||||||
|
|
||||||
|
argv[argc++] = &argbuf[i];
|
||||||
|
|
||||||
|
if (argc >= argc_max)
|
||||||
|
{
|
||||||
|
argc_max += 64;
|
||||||
|
argv = realloc(argv, sizeof(char *) * argc_max);
|
||||||
|
if (!argv)
|
||||||
|
{
|
||||||
|
free(argbuf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((argbuf[i]) && ((q) ? (argbuf[i] != q) : (argbuf[i] != ' ')))
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (argbuf[i])
|
||||||
|
{
|
||||||
|
argbuf[i] = 0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
pclog("Arg %i - %s\n",argc-1,argv[argc-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
argv[argc] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hThisInstance,
|
int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
LPSTR lpszArgument,
|
LPSTR lpszArgument,
|
||||||
|
|
@ -403,6 +474,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
int c, d;
|
int c, d;
|
||||||
LARGE_INTEGER qpc_freq;
|
LARGE_INTEGER qpc_freq;
|
||||||
|
|
||||||
|
process_command_line();
|
||||||
|
|
||||||
hinstance=hThisInstance;
|
hinstance=hThisInstance;
|
||||||
/* The Window structure */
|
/* The Window structure */
|
||||||
wincl.hInstance = hThisInstance;
|
wincl.hInstance = hThisInstance;
|
||||||
|
|
@ -470,7 +543,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
ghwnd=hwnd;
|
ghwnd=hwnd;
|
||||||
|
|
||||||
initpc();
|
initpc(argc, argv);
|
||||||
|
|
||||||
vid_apis[0][vid_api].init(ghwnd);
|
vid_apis[0][vid_api].init(ghwnd);
|
||||||
|
|
||||||
|
|
@ -569,6 +642,19 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
// ShowCursor(TRUE);
|
// ShowCursor(TRUE);
|
||||||
|
|
||||||
|
if (start_in_fullscreen)
|
||||||
|
{
|
||||||
|
startblit();
|
||||||
|
mouse_close();
|
||||||
|
vid_apis[0][vid_api].close();
|
||||||
|
video_fullscreen = 1;
|
||||||
|
vid_apis[1][vid_api].init(ghwnd);
|
||||||
|
mouse_init();
|
||||||
|
leave_fullscreen_flag = 0;
|
||||||
|
endblit();
|
||||||
|
device_force_redraw();
|
||||||
|
}
|
||||||
|
|
||||||
/* Run the message loop. It will run until GetMessage() returns 0 */
|
/* Run the message loop. It will run until GetMessage() returns 0 */
|
||||||
while (!quited)
|
while (!quited)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue