mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-24 06:34:02 +00:00
new cli options
This commit is contained in:
parent
1f061db96b
commit
18dbd6af31
@ -23,9 +23,9 @@ git config --global user.email "dagenbrock@gmail.com"
|
||||
|
||||
|
||||
## SOME NOTES ON SETTING UP GITLAB RUNNER TO BUILD ON WINDOWS
|
||||
# Based on: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/windows.md
|
||||
|
||||
## STEP 1 - Install Gitlab Runner
|
||||
# https://docs.gitlab.com/runner/install/windows.html
|
||||
# Download from page above, run CMD prompt as Administrator and then run the runner exe in there
|
||||
|
||||
## STEP 2 - Register it with your server
|
||||
@ -36,19 +36,18 @@ gitlab-ci-multi-runner-windows-386.exe register
|
||||
# enter gitlab url
|
||||
# enter gitlab runner token
|
||||
# enter tag of "windows"
|
||||
gitlab-runner.exe register -n \
|
||||
--url http://centralserv.gotgeeks.com/ci \
|
||||
--registration-token UqGC2qvJmvU1QBK3mx4b \
|
||||
gitlab-runner-windows-386.exe register -n \
|
||||
--url http://yourgitlab.com/ci \
|
||||
--registration-token UqGC2qvJmU1QBK3mx4b \
|
||||
--executor shell \
|
||||
--description "WinBuild"
|
||||
--tag-list "windows"
|
||||
|
||||
gitlab-ci-multi-runner-windows-386.exe -n --url http://centralserv.gotgeeks.com/ci --registration-token 5a1f60647cf7fe3eb5c7fa87e59bf7 --executor shell --description "WinDork10" --tag-list "windows,win32"
|
||||
|
||||
## STEP 3 - Install Service
|
||||
# Note the use of ".\IEUser" to indicate local account!
|
||||
gitlab-ci-multi-runner-windows-386.exe install --user .\IEUser --password Passw0rd!
|
||||
gitlab-ci-multi-runner-windows-386.exe install --user .\Builder --password Bu1ld3r!
|
||||
gitlab-runner-windows-386.exe install --user .\builder --password builder
|
||||
|
||||
## STEP 4 - Start service
|
||||
gitlab-ci-multi-runner-windows-386.exe start
|
||||
|
@ -4,7 +4,7 @@
|
||||
OBJECTS1 = adb.o clock.o config.o debug.o dis.o engine_c.o scc.o iwm.o \
|
||||
joystick_driver.o moremem.o paddles.o parallel.o printer.o sim65816.o \
|
||||
smartport.o sound.o sound_driver.o video.o scc_socket_driver.o glog.o \
|
||||
imagewriter.o scc_imagewriter.o scc_llap.o
|
||||
imagewriter.o scc_imagewriter.o scc_llap.o options.o
|
||||
ATOBJ = atbridge/aarp.o atbridge/atbridge.o atbridge/elap.o atbridge/llap.o atbridge/port.o
|
||||
PCAPOBJ = atbridge/pcap_delay.o
|
||||
TFEOBJ = tfe/tfe.o tfe/tfearch.o tfe/tfesupp.o
|
||||
|
12
src/config.c
12
src/config.c
@ -45,6 +45,9 @@
|
||||
typedef unsigned int mode_t;
|
||||
#endif
|
||||
|
||||
static const char parse_log_prefix_file[] = "Option set [file]:";
|
||||
|
||||
|
||||
extern int Verbose;
|
||||
extern word32 g_vbl_count;
|
||||
extern Iwm iwm;
|
||||
@ -720,9 +723,7 @@ config_parse_option(char *buf, int pos, int len, int line)
|
||||
}
|
||||
|
||||
// find "name" as first contiguous string
|
||||
glogf("...parse_option: line %d, len:%d \"%s\"", line, len, &buf[pos]);
|
||||
|
||||
// printf("...parse_option: line %d, %p,%p = %s (%s) len:%d\n", line, &buf[pos], buf, &buf[pos], buf, len);
|
||||
glogf("%s line %d, len:%d \"%s\"", parse_log_prefix_file, line, len, &buf[pos]);
|
||||
|
||||
nameptr = &buf[pos];
|
||||
while(pos < len) {
|
||||
@ -1639,7 +1640,7 @@ insert_disk(int slot, int drive, const char *name, int ejected, int force_size,
|
||||
nibs = len;
|
||||
}
|
||||
if(size != 35*len) {
|
||||
glogf("Disk 5.25 error: size is %d, not 140K. Will try to mount anyway", size, 35*len);
|
||||
glogf("Warning - Disk 5.25 error: size is %d, not 140K. Will try to mount anyway", size, 35*len);
|
||||
}
|
||||
for(i = 0; i < 35; i++) {
|
||||
iwm_move_to_track(dsk, 4*i);
|
||||
@ -1651,8 +1652,7 @@ insert_disk(int slot, int drive, const char *name, int ejected, int force_size,
|
||||
unix_pos = dsk->image_start;
|
||||
size = dsk->image_size;
|
||||
if(size != 800*1024) {
|
||||
fatal_printf("Disk 3.5 error: size is %d, not 800K. "
|
||||
"Will try to mount anyway\n", size);
|
||||
glogf("Warning - Disk 3.5 error: size is %d, not 800K. Will try to mount anyway", size, 35*len);
|
||||
}
|
||||
disk_set_num_tracks(dsk, 2*80);
|
||||
for(i = 0; i < 2*80; i++) {
|
||||
|
@ -371,3 +371,6 @@ STRUCT(Emustate_word32list) {
|
||||
#define JOYSTICK_TYPE_NATIVE_2 3
|
||||
#define JOYSTICK_TYPE_NONE 4 // OG Added Joystick None
|
||||
#define NB_JOYSTICK_TYPE 5
|
||||
|
||||
// starting window x/y position if Undefined
|
||||
#define WINDOWPOS_UNDEFINED 0xFFFFFFFF
|
||||
|
16
src/dis.c
16
src/dis.c
@ -40,7 +40,6 @@ extern word32 stop_run_at;
|
||||
extern int Verbose;
|
||||
extern int Halt_on;
|
||||
|
||||
extern int g_testing_enabled;
|
||||
extern int g_fullscreen;
|
||||
extern int g_config_control_panel;
|
||||
|
||||
@ -358,11 +357,7 @@ do_debug_intfc()
|
||||
if(got_num) {
|
||||
engine.kpc = (a2bank<<16) + (a2&0xffff);
|
||||
}
|
||||
if(ret_val == 'G' && g_testing_enabled) {
|
||||
do_gen_test(got_num, a2);
|
||||
} else {
|
||||
do_go();
|
||||
}
|
||||
do_go();
|
||||
list_kpc = engine.kpc;
|
||||
break;
|
||||
case 'q':
|
||||
@ -482,15 +477,6 @@ show_toolset_tables(word32 a2bank, word32 addr)
|
||||
fclose(toolfile);
|
||||
}
|
||||
|
||||
|
||||
#ifndef TEST65
|
||||
void
|
||||
do_gen_test(int got_num, int base_seed)
|
||||
{
|
||||
/* dummy */
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
set_bp(word32 addr)
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ joystick_init()
|
||||
|
||||
// Check that there is a joystick device
|
||||
if(joyGetNumDevs() <= 0) {
|
||||
printf("No joystick hardware detected\n");
|
||||
glog("No joystick hardware detected");
|
||||
g_joystick_native_type1 = -1;
|
||||
g_joystick_native_type2 = -1;
|
||||
return;
|
||||
@ -190,7 +190,7 @@ joystick_init()
|
||||
}
|
||||
|
||||
if (g_joystick_native_type1<0 && g_joystick_native_type2 <0) {
|
||||
printf ("No joystick is attached\n");
|
||||
glog("No joystick is attached");
|
||||
return;
|
||||
}
|
||||
|
||||
|
274
src/options.c
Normal file
274
src/options.c
Normal file
@ -0,0 +1,274 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "options.h"
|
||||
#include "glog.h"
|
||||
|
||||
#include "defc.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// Halts on bad reads. Sets flags via engine_s.s:set_halt_act() function
|
||||
extern int g_halt_on_bad_read; // defined in sim65816.c
|
||||
// Ignore bad memory accesses.
|
||||
extern int g_ignore_bad_acc; // defined in sim65816.c
|
||||
// Ignore red alert halts.
|
||||
extern int g_ignore_halts; // defined in sim65816.c
|
||||
// Size of RAM memory expansion card in bytes (default = 8*1024*1024 = 8MB)
|
||||
extern int g_mem_size_exp; // defined in sim65816.c
|
||||
// Implemented in display drivers (not SDL2 though) ?
|
||||
extern int g_screen_redraw_skip_amt; // defined in video.c, implemented in various driver files
|
||||
|
||||
// Using simple dhires color map
|
||||
extern int g_use_dhr140; // defined in video.c
|
||||
// Force B/W hires modes
|
||||
extern int g_use_bw_hires; // defined in video.c
|
||||
// Set starting X/Y positions
|
||||
extern int g_startx; // defined in video.c
|
||||
extern int g_starty; // defined in video.c
|
||||
// Enable Dagen's scanline simulator (SDL2)
|
||||
extern int g_scanline_simulator; // defined in sim65816.c
|
||||
// Ethernet (interface?)
|
||||
extern int g_ethernet; // defined in sim65816.c
|
||||
// Enable and set port for Dagen's debugger
|
||||
extern int g_dbg_enable_port; // defined in debug.c
|
||||
// Set preferred audio frequency
|
||||
extern int g_preferred_rate; // defined in sound_driver.c, implemented in various driver files
|
||||
// Enable/disable audio
|
||||
extern int g_audio_enable; // defined in sound.c
|
||||
// Start in fullscreen mode
|
||||
extern int g_fullscreen; // defined in adb.c, because weird driver writing for x
|
||||
|
||||
// DEPRECATED: force bit depth (15/16/24) for X-Windows, might still work.
|
||||
extern int g_force_depth; // defined in sim65816.c
|
||||
// DEPRECATED: Use X shared memory (MIT-SHM)
|
||||
extern int g_use_shmem; // defined in all the various drivers
|
||||
// DEPRECATED: Set DISPLAY environment variable for X-Windows
|
||||
extern char g_display_env[512]; // defined in sim65816.c
|
||||
// DEPRECATED: Set VERBOSE flags for one or more subsystems as defined below
|
||||
extern int Verbose; // defined in sim65816.c
|
||||
// #define VERBOSE_DISK 0x001
|
||||
// #define VERBOSE_IRQ 0x002
|
||||
// #define VERBOSE_CLK 0x004
|
||||
// #define VERBOSE_SHADOW 0x008
|
||||
// #define VERBOSE_IWM 0x010
|
||||
// #define VERBOSE_DOC 0x020
|
||||
// #define VERBOSE_ADB 0x040
|
||||
// #define VERBOSE_SCC 0x080
|
||||
// #define VERBOSE_TEST 0x100
|
||||
// #define VERBOSE_VIDEO 0x200
|
||||
// #define VERBOSE_MAC
|
||||
// This is deprecated because it is not well-defined or supported
|
||||
// It should still work and some sort of system should be put in place
|
||||
// to extend and fix this, or take it out.
|
||||
|
||||
|
||||
extern const char *g_config_gsplus_name_list[];
|
||||
extern char g_config_gsplus_screenshot_dir[];
|
||||
extern char *final_arg;
|
||||
|
||||
static const char parse_log_prefix[] = "Option set [CLI]:";
|
||||
|
||||
// this is here because we need to flip a bit to force B/W modes
|
||||
extern int g_cur_a2_stat;
|
||||
|
||||
void help_exit(); // displays the cli help text and exits with 1
|
||||
|
||||
int parse_cli_options(int argc, char **argv) {
|
||||
int i;
|
||||
int tmp1;
|
||||
int skip_amt;
|
||||
char *final_arg = 0;
|
||||
|
||||
|
||||
for(i = 1; i < argc; i++) {
|
||||
if( (!strcmp("-?", argv[i])) || (!strcmp("-h", argv[i])) || (!strcmp("-help", argv[i]))) {
|
||||
help_exit();
|
||||
} else if(!strcmp("-badrd", argv[i])) {
|
||||
glogf("%s Halting on bad reads", parse_log_prefix);
|
||||
g_halt_on_bad_read = 2;
|
||||
} else if(!strcmp("-fullscreen", argv[i])) {
|
||||
glogf("%s Starting emulator in fullscreen", parse_log_prefix);
|
||||
g_fullscreen = 1;
|
||||
} else if(!strcmp("-noignbadacc", argv[i])) {
|
||||
glogf("%s Not ignoring bad memory accesses", parse_log_prefix);
|
||||
g_ignore_bad_acc = 0;
|
||||
} else if(!strcmp("-noignhalt", argv[i])) {
|
||||
glogf("%s Not ignoring code red halts", parse_log_prefix);
|
||||
g_ignore_halts = 0;
|
||||
} else if(!strcmp("-mem", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-mem' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
g_mem_size_exp = strtol(argv[i+1], 0, 0) & 0x00ff0000;
|
||||
glogf("%s Using %d as memory size", parse_log_prefix, g_mem_size_exp);
|
||||
i++;
|
||||
} else if(!strcmp("-skip", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-skip' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
skip_amt = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d as skip_amt", parse_log_prefix, skip_amt);
|
||||
g_screen_redraw_skip_amt = skip_amt;
|
||||
i++;
|
||||
} else if(!strcmp("-audio", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-audio' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d as audio enable val", parse_log_prefix, tmp1);
|
||||
g_audio_enable = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-arate", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-arate' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d as preferred audio rate", parse_log_prefix, tmp1);
|
||||
g_preferred_rate = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-v", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-v' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Setting Verbose = 0x%03x", parse_log_prefix, tmp1);
|
||||
Verbose = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-display", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-display' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
glogf("%s Using %s as display", parse_log_prefix, argv[i+1]);
|
||||
sprintf(g_display_env, "DISPLAY=%s", argv[i+1]);
|
||||
putenv(&g_display_env[0]);
|
||||
i++;
|
||||
} else if(!strcmp("-noshm", argv[i])) {
|
||||
glogf("%s Not using X shared memory", parse_log_prefix);
|
||||
g_use_shmem = 0;
|
||||
} else if(!strcmp("-joystick", argv[i])) {
|
||||
glogf("%s Ignoring -joystick option", parse_log_prefix);
|
||||
} else if(!strcmp("-dhr140", argv[i])) {
|
||||
glogf("%s Using simple dhires color map", parse_log_prefix);
|
||||
g_use_dhr140 = 1;
|
||||
} else if(!strcmp("-bw", argv[i])) {
|
||||
glogf("%s Forcing black-and-white hires modes", parse_log_prefix);
|
||||
g_cur_a2_stat |= ALL_STAT_COLOR_C021;
|
||||
g_use_bw_hires = 1;
|
||||
} else if(!strcmp("-scanline", argv[i])) {
|
||||
glogf("%s Enable scanline simulation", parse_log_prefix);
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-scanline' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
if (tmp1 > 100) { tmp1 = 100; }
|
||||
if (tmp1 < 0) { tmp1 = 0; }
|
||||
glogf("%s Setting scanline simulator darkness to %d%%", parse_log_prefix, tmp1);
|
||||
g_scanline_simulator = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-enet", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-enet' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d as ethernet enable val", parse_log_prefix, tmp1);
|
||||
g_ethernet = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-x", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-x' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d as x val", parse_log_prefix, tmp1);
|
||||
g_startx = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-y", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-y' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d as y val", parse_log_prefix, tmp1);
|
||||
g_starty = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-config", argv[i])) { // Config file passed
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-config' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
glogf("%s Using %s as configuration file", parse_log_prefix, argv[i+1]);
|
||||
|
||||
g_config_gsplus_name_list[0] = argv[i+1]; // overwrite default list with passed item as sole option
|
||||
g_config_gsplus_name_list[1] = 0; // terminate string array
|
||||
i++;
|
||||
} else if (!strcmp("-ssdir", argv[i])) { // screenshot directory passed
|
||||
strcpy(g_config_gsplus_screenshot_dir, argv[i+1]);
|
||||
struct stat path_stat;
|
||||
stat(g_config_gsplus_screenshot_dir, &path_stat); // (weakly) validate path
|
||||
if (!S_ISDIR(path_stat.st_mode)) {
|
||||
strcpy(g_config_gsplus_screenshot_dir, "./");
|
||||
}
|
||||
glogf("%s Using %s for screenshot path", parse_log_prefix, g_config_gsplus_screenshot_dir);
|
||||
i++;
|
||||
} else if(!strcmp("-debugport", argv[i])) { // Debug port passed
|
||||
if((i+1) >= argc) {
|
||||
glogf("%s Error, option '-debugport' missing argument", parse_log_prefix);
|
||||
exit(1);
|
||||
}
|
||||
g_dbg_enable_port = strtol(argv[i+1], 0, 0);
|
||||
glogf("%s Using %d for debug port", parse_log_prefix, g_dbg_enable_port);
|
||||
i++;
|
||||
} else {
|
||||
if ((i == (argc - 1)) && (strncmp("-", argv[i], 1) != 0)) {
|
||||
final_arg = argv[i];
|
||||
} else {
|
||||
glogf("%s Error, bad option: %s for debug port", parse_log_prefix, argv[i]);
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void help_exit() {
|
||||
printf(" USAGE: \n\n");
|
||||
printf(" ./gsplus # simple - uses default config.txt\n");
|
||||
printf(" ./gsplus -config games_hds.gsp # set custom config file\n\n");
|
||||
printf(" You need to supply your own Apple IIgs Firmware ROM image.\n");
|
||||
printf(" Press F4 when running gsplus to enter config menu and select ROM image location.\n");
|
||||
printf(" Or copy the ROM image to the gsplus directory.\n");
|
||||
printf(" It will search for: \"ROM\", \"ROM.01\", \"ROM.03\" \n\n\n");
|
||||
printf(" Other command line options: \n\n");
|
||||
printf(" -badrd Halt on bad reads\n");
|
||||
printf(" -noignbadacc Don’t ignore bad memory accesses\n");
|
||||
printf(" -noignhalt Don’t ignore code red halts\n");
|
||||
printf(" -test Allow testing\n");
|
||||
printf(" -joystick Ignore joystick option\n");
|
||||
printf(" -bw Force B/W modes\n");
|
||||
printf(" -dhr140 Use simple double-hires color map\n");
|
||||
printf(" -fullscreen Attempt to start emulator in fullscreen\n");
|
||||
printf(" -mem value Set memory size to value\n");
|
||||
printf(" -skip value Set skip_amt to value\n");
|
||||
printf(" -audio value Set audio enable to value\n");
|
||||
printf(" -arate value Set preferred audio rate to value\n");
|
||||
printf(" -enet value Set ethernet to value\n");
|
||||
printf(" -config value Set config file to value\n");
|
||||
printf(" -debugport value Set debugport to value\n");
|
||||
printf(" -ssdir value Set screenshot save directory to value\n");
|
||||
printf(" -scanline value Enable scanline simulator at value %%\n");
|
||||
printf(" -x value Open emulator window at x value\n");
|
||||
printf(" -y value Open emulator window at y value\n");
|
||||
printf(" -v value Set verbose flags to value\n\n");
|
||||
printf(" Note: The final argument, if not a flag, will be tried as a mountable device.\n\n");
|
||||
exit(1);
|
||||
}
|
7
src/options.h
Normal file
7
src/options.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int parse_cli_options(int argc, char **argv);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -47,9 +47,6 @@ void x_full_screen(int do_full);
|
||||
void clipboard_paste(void);
|
||||
int clipboard_get_char(void);
|
||||
|
||||
/* test65.c */
|
||||
void do_gen_test(int got_num, int base_seed);
|
||||
|
||||
|
||||
/* engine.s and engine_c.c */
|
||||
void fixed_memory_ptrs_init();
|
||||
|
@ -59,7 +59,10 @@ extern char g_config_gsplus_screenshot_dir[];
|
||||
int screenshot_index = 0; // allows us to save time by not scanning from 0 each time
|
||||
char screenshot_filename[256];
|
||||
|
||||
extern int g_fullscreen; // only checked at start if set via CLI, otherwise it's set via function call x_full_screen()
|
||||
extern int g_scanline_simulator;
|
||||
extern int g_startx;
|
||||
extern int g_starty;
|
||||
extern int g_screen_depth;
|
||||
extern int g_quit_sim_now;
|
||||
extern int g_border_sides_refresh_needed;
|
||||
@ -295,16 +298,28 @@ void dev_video_init_sdl() {
|
||||
|
||||
// Create an application window with the following settings:
|
||||
char window_title[32];
|
||||
sprintf(window_title, "GSplus v%-6s", g_gsplus_version_str),
|
||||
sprintf(window_title, "GSplus v%-6s", g_gsplus_version_str);
|
||||
int startx,starty = SDL_WINDOWPOS_UNDEFINED;
|
||||
if (g_startx != WINDOWPOS_UNDEFINED) { startx = g_startx; }
|
||||
if (g_starty != WINDOWPOS_UNDEFINED) { starty = g_starty; }
|
||||
int more_flags = 0;
|
||||
// check for CLI fullscreen
|
||||
if (g_fullscreen) {
|
||||
more_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow(
|
||||
window_title, // window title (GSport vX.X)
|
||||
SDL_WINDOWPOS_UNDEFINED, // initial x position
|
||||
SDL_WINDOWPOS_UNDEFINED, // initial y position
|
||||
// SDL_WINDOWPOS_UNDEFINED, // initial x position
|
||||
// SDL_WINDOWPOS_UNDEFINED, // initial y position
|
||||
startx, starty,
|
||||
BASE_WINDOW_WIDTH, // width, in pixels
|
||||
X_A2_WINDOW_HEIGHT, // height, in pixels
|
||||
SDL_WINDOW_OPENGL // flags - see below
|
||||
| more_flags
|
||||
);
|
||||
|
||||
|
||||
// Check that the window was successfully created
|
||||
if (window == NULL) {
|
||||
// In the case that the window could not be made...
|
||||
@ -337,13 +352,16 @@ void dev_video_init_sdl() {
|
||||
|
||||
SDL_SetTextureBlendMode(overlay_texture, SDL_BLENDMODE_BLEND);
|
||||
overlay_pixels = malloc(BASE_WINDOW_WIDTH*X_A2_WINDOW_HEIGHT*sizeof(Uint32));
|
||||
Uint32 pixelARGB = 0x33000000; // default "low grey"
|
||||
if (overlay_pixels) {
|
||||
|
||||
if (g_scanline_simulator > 0) {
|
||||
pixelARGB = (int)(g_scanline_simulator*2.56) << 24;
|
||||
}
|
||||
for (int y=0; y<X_A2_WINDOW_HEIGHT; y++) {
|
||||
for (int x=0; x<BASE_WINDOW_WIDTH; x++) {
|
||||
|
||||
if (y%2 == 1) {
|
||||
overlay_pixels[(y*BASE_WINDOW_WIDTH)+x] = 0x30000000;
|
||||
overlay_pixels[(y*BASE_WINDOW_WIDTH)+x] = 0x33000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -355,6 +373,7 @@ void dev_video_init_sdl() {
|
||||
dstrect.h = X_A2_WINDOW_HEIGHT;
|
||||
int pitch = BASE_WINDOW_WIDTH;
|
||||
|
||||
|
||||
// UPDATE A RECT OF THE APPLE II SCREEN TEXTURE
|
||||
SDL_UpdateTexture(overlay_texture, &dstrect, overlay_pixels, pitch*sizeof(Uint32) );
|
||||
|
||||
|
@ -178,7 +178,7 @@ sound_init_device_sdl()
|
||||
goto snd_error;
|
||||
g_playbuf_buffered = 0;
|
||||
|
||||
glogf("Sound shared memory size=%d", SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE);
|
||||
glogf("SDL2 sound shared memory size=%d", SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE);
|
||||
|
||||
g_sound_shm_addr = malloc(SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE);
|
||||
memset(g_sound_shm_addr,0,SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE);
|
||||
|
195
src/sim65816.c
195
src/sim65816.c
@ -27,6 +27,7 @@
|
||||
#include "imagewriter.h"
|
||||
#include "debug.h"
|
||||
#include "glog.h"
|
||||
#include "options.h"
|
||||
|
||||
extern const char *g_config_gsplus_name_list[];
|
||||
extern char g_config_gsplus_screenshot_dir[];
|
||||
@ -132,7 +133,6 @@ int g_screen_depth = 8;
|
||||
int g_scanline_simulator = 0;
|
||||
|
||||
extern int g_screen_redraw_skip_amt;
|
||||
extern int g_use_shmem;
|
||||
extern int g_use_dhr140;
|
||||
extern int g_use_bw_hires;
|
||||
|
||||
@ -142,13 +142,14 @@ double g_fcycles_stop = 0.0;
|
||||
int halt_sim = 0;
|
||||
int enter_debug = 0;
|
||||
int g_rom_version = -1;
|
||||
|
||||
int g_user_halt_bad = 0;
|
||||
int g_halt_on_bad_read = 0;
|
||||
int g_ignore_bad_acc = 1;
|
||||
int g_ignore_halts = 1;
|
||||
|
||||
int g_code_red = 0;
|
||||
int g_code_yellow = 0;
|
||||
int g_use_alib = 0;
|
||||
int g_serial_type[2];
|
||||
int g_iw2_emul = 0;
|
||||
int g_serial_out_masking = 0;
|
||||
@ -180,7 +181,7 @@ int g_imagewriter_paper = 0;
|
||||
int g_imagewriter_banner = 0;
|
||||
|
||||
int g_config_iwm_vbl_count = 0;
|
||||
const char g_gsplus_version_str[] = "0.13"; // the "KS" special version
|
||||
const char g_gsplus_version_str[] = "0.14"; // skunkworks
|
||||
int g_pause=0; // OG Added pause
|
||||
|
||||
#define START_DCYCS (0.0)
|
||||
@ -207,7 +208,6 @@ int g_engine_scan_int = 0;
|
||||
int g_engine_doc_int = 0;
|
||||
|
||||
int g_testing = 0;
|
||||
int g_testing_enabled = 0;
|
||||
|
||||
#define MAX_FATAL_LOGS 20
|
||||
|
||||
@ -272,7 +272,6 @@ void sim65816_initglobals() {
|
||||
g_ignore_halts = 1;
|
||||
g_code_red = 0;
|
||||
g_code_yellow = 0;
|
||||
g_use_alib = 0;
|
||||
g_iw2_emul = 0;
|
||||
g_serial_out_masking = 0;
|
||||
//g_serial_modem[2] = { 0, 1 };
|
||||
@ -302,7 +301,6 @@ void sim65816_initglobals() {
|
||||
g_engine_doc_int = 0;
|
||||
|
||||
g_testing = 0;
|
||||
g_testing_enabled = 0;
|
||||
|
||||
g_debug_file_fd = -1;
|
||||
g_fatal_log = -1;
|
||||
@ -909,37 +907,6 @@ void banner() {
|
||||
printf("\x1b[37m GSplus v%s \x1b[0m \n\n", g_gsplus_version_str);
|
||||
}
|
||||
|
||||
void help_exit() {
|
||||
printf(" USAGE: \n\n");
|
||||
printf(" ./gsplus # simple - uses default config.txt\n");
|
||||
printf(" ./gsplus -config games_hds.gsp # set custom config file\n\n");
|
||||
printf(" You need to supply your own Apple IIgs Firmware ROM image.\n");
|
||||
printf(" Press F4 when running gsplus to enter config menu and select ROM image location.\n");
|
||||
printf(" Or copy the ROM image to the gsplus directory.\n");
|
||||
printf(" It will search for: \"ROM\", \"ROM.01\", \"ROM.03\" \n\n\n");
|
||||
printf(" Other command line options: \n\n");
|
||||
printf(" -badrd Halt on bad reads\n");
|
||||
printf(" -noignbadacc Don’t ignore bad memory accesses\n");
|
||||
printf(" -noignhalt Don’t ignore code red halts\n");
|
||||
printf(" -test Allow testing\n");
|
||||
printf(" -joystick Ignore joystick option\n");
|
||||
printf(" -bw Force B/W modes\n");
|
||||
printf(" -dhr140 Use simple double-hires color map\n");
|
||||
printf(" -mem value Set memory size to value\n");
|
||||
printf(" -skip value Set skip_amt to value\n");
|
||||
printf(" -audio value Set audio enable to value\n");
|
||||
printf(" -arate value Set preferred audio rate to value\n");
|
||||
printf(" -enet value Set ethernet to value\n");
|
||||
printf(" -config value Set config file to value\n");
|
||||
printf(" -debugport value Set debugport to value\n");
|
||||
printf(" -ssdir value Set screenshot save directory to value\n");
|
||||
printf(" -scanline Enable scanline simulator\n");
|
||||
printf(" -noscanline Disable scanline simulator (default)\n");
|
||||
printf(" -v value Set verbose flags to value\n\n");
|
||||
printf(" Note: The final argument, if not a flag, will be tried as a mountable device.\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int gsplusmain(int argc, char **argv) {
|
||||
int diff;
|
||||
int skip_amt;
|
||||
@ -947,160 +914,22 @@ int gsplusmain(int argc, char **argv) {
|
||||
int i;
|
||||
char *final_arg = 0;
|
||||
|
||||
|
||||
// just for fun
|
||||
banner();
|
||||
|
||||
// OG Restoring globals
|
||||
sim65816_initglobals();
|
||||
moremem_init();
|
||||
tmp1 = parse_cli_options(argc, argv);
|
||||
|
||||
|
||||
|
||||
// initialize ss dir to default value (current path)
|
||||
strcpy(g_config_gsplus_screenshot_dir, "./");
|
||||
|
||||
/* parse args */
|
||||
for(i = 1; i < argc; i++) {
|
||||
if( (!strcmp("-?", argv[i])) || (!strcmp("-h", argv[i])) || (!strcmp("-help", argv[i]))) {
|
||||
help_exit();
|
||||
} else if(!strcmp("-badrd", argv[i])) {
|
||||
printf("Halting on bad reads\n");
|
||||
g_halt_on_bad_read = 2;
|
||||
} else if(!strcmp("-noignbadacc", argv[i])) {
|
||||
printf("Not ignoring bad memory accesses\n");
|
||||
g_ignore_bad_acc = 0;
|
||||
} else if(!strcmp("-noignhalt", argv[i])) {
|
||||
printf("Not ignoring code red halts\n");
|
||||
g_ignore_halts = 0;
|
||||
} else if(!strcmp("-test", argv[i])) {
|
||||
printf("Allowing testing\n");
|
||||
g_testing_enabled = 1;
|
||||
} else if(!strcmp("-hpdev", argv[i])) {
|
||||
printf("Using /dev/audio\n");
|
||||
g_use_alib = 0;
|
||||
} else if(!strcmp("-alib", argv[i])) {
|
||||
printf("Using Aserver audio server\n");
|
||||
g_use_alib = 1;
|
||||
} else if(!strcmp("-24", argv[i])) {
|
||||
printf("Using 24-bit visual\n");
|
||||
g_force_depth = 24;
|
||||
} else if(!strcmp("-16", argv[i])) {
|
||||
printf("Using 16-bit visual\n");
|
||||
g_force_depth = 16;
|
||||
} else if(!strcmp("-15", argv[i])) {
|
||||
printf("Using 15-bit visual\n");
|
||||
g_force_depth = 15;
|
||||
} else if(!strcmp("-mem", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
g_mem_size_exp = strtol(argv[i+1], 0, 0) & 0x00ff0000;
|
||||
printf("Using %d as memory size\n", g_mem_size_exp);
|
||||
i++;
|
||||
} else if(!strcmp("-skip", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
skip_amt = strtol(argv[i+1], 0, 0);
|
||||
printf("Using %d as skip_amt\n", skip_amt);
|
||||
g_screen_redraw_skip_amt = skip_amt;
|
||||
i++;
|
||||
} else if(!strcmp("-audio", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
printf("Using %d as audio enable val\n", tmp1);
|
||||
g_audio_enable = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-arate", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
printf("Using %d as preferred audio rate\n", tmp1);
|
||||
g_preferred_rate = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-v", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
printf("Setting Verbose = 0x%03x\n", tmp1);
|
||||
Verbose = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-display", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("Using %s as display\n", argv[i+1]);
|
||||
sprintf(g_display_env, "DISPLAY=%s", argv[i+1]);
|
||||
putenv(&g_display_env[0]);
|
||||
i++;
|
||||
} else if(!strcmp("-noshm", argv[i])) {
|
||||
printf("Not using X shared memory\n");
|
||||
g_use_shmem = 0;
|
||||
} else if(!strcmp("-joystick", argv[i])) {
|
||||
printf("Ignoring -joystick option\n");
|
||||
} else if(!strcmp("-dhr140", argv[i])) {
|
||||
printf("Using simple dhires color map\n");
|
||||
g_use_dhr140 = 1;
|
||||
} else if(!strcmp("-bw", argv[i])) {
|
||||
printf("Forcing black-and-white hires modes\n");
|
||||
g_cur_a2_stat |= ALL_STAT_COLOR_C021;
|
||||
g_use_bw_hires = 1;
|
||||
} else if(!strcmp("-scanline", argv[i])) {
|
||||
g_scanline_simulator = 1;
|
||||
} else if(!strcmp("-noscanline", argv[i])) {
|
||||
g_scanline_simulator = 0;
|
||||
} else if(!strcmp("-enet", argv[i])) {
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
tmp1 = strtol(argv[i+1], 0, 0);
|
||||
printf("Using %d as ethernet enable val\n", tmp1);
|
||||
g_ethernet = tmp1;
|
||||
i++;
|
||||
} else if(!strcmp("-config", argv[i])) { // Config file passed
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("Using %s as configuration file\n", argv[i+1]);
|
||||
g_config_gsplus_name_list[0] = argv[i+1]; // overwrite default list with passed item as sole option
|
||||
g_config_gsplus_name_list[1] = 0; // terminate string array
|
||||
i++;
|
||||
} else if (!strcmp("-ssdir", argv[i])) { // screenshot directory passed
|
||||
strcpy(g_config_gsplus_screenshot_dir, argv[i+1]);
|
||||
struct stat path_stat;
|
||||
stat(g_config_gsplus_screenshot_dir, &path_stat); // (weakly) validate path
|
||||
if (!S_ISDIR(path_stat.st_mode)) {
|
||||
strcpy(g_config_gsplus_screenshot_dir, "./");
|
||||
}
|
||||
printf("USING SCREEN PATH: %s\n", g_config_gsplus_screenshot_dir);
|
||||
i++;
|
||||
} else if(!strcmp("-debugport", argv[i])) { // Debug port passed
|
||||
if((i+1) >= argc) {
|
||||
printf("Missing argument\n");
|
||||
exit(1);
|
||||
}
|
||||
g_dbg_enable_port = strtol(argv[i+1], 0, 0);
|
||||
printf("Debug port: %d\n", g_dbg_enable_port);
|
||||
i++;
|
||||
} else {
|
||||
if ((i == (argc - 1)) && (strncmp("-", argv[i], 1) != 0)) {
|
||||
final_arg = argv[i];
|
||||
} else {
|
||||
printf("Bad option: %s\n", argv[i]);
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// just for fun
|
||||
banner();
|
||||
|
||||
|
||||
check_engine_asm_defines();
|
||||
fixed_memory_ptrs_init();
|
||||
|
@ -103,9 +103,6 @@ int g_status_refresh_needed = 1;
|
||||
int g_vbl_border_color = 0;
|
||||
int g_border_last_vbl_changes = 0;
|
||||
|
||||
int g_use_dhr140 = 0;
|
||||
int g_use_bw_hires = 0;
|
||||
|
||||
int g_a2_new_all_stat[200];
|
||||
int g_a2_cur_all_stat[200];
|
||||
int g_new_a2_stat_cur_line = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user