mirror of
https://github.com/digarok/gsplus.git
synced 2026-04-26 14:17:44 +00:00
Merge branch 'experimental' into 'win32_host'
# Conflicts: # src/host_fst.c
This commit is contained in:
@@ -130,6 +130,7 @@ package-win32:
|
||||
- cp /bin/cyggcc_s-1.dll .
|
||||
- cp /bin/cygstdc++-6.dll .
|
||||
- cp /bin/cygwin1.dll .
|
||||
- cp /bin/cygfreetype-6.dll .
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
@@ -142,6 +143,7 @@ package-win32:
|
||||
- cyggcc_s-1.dll
|
||||
- cygstdc++-6.dll
|
||||
- cygwin1.dll
|
||||
- cygfreetype-6.dll .
|
||||
|
||||
|
||||
build-win-sdl:
|
||||
@@ -168,6 +170,7 @@ package-win-sdl:
|
||||
- cp /bin/cyggcc_s-1.dll .
|
||||
- cp /bin/cygstdc++-6.dll .
|
||||
- cp /bin/cygwin1.dll .
|
||||
- cp /bin/cygfreetype-6.dll .
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
@@ -180,3 +183,4 @@ package-win-sdl:
|
||||
- cyggcc_s-1.dll
|
||||
- cygstdc++-6.dll
|
||||
- cygwin1.dll
|
||||
- cygfreetype-6.dll
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+24
-25
@@ -3,21 +3,21 @@
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2014 by GSport contributors
|
||||
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#ifdef HAVE_TFE
|
||||
#include "tfe/tfesupp.h"
|
||||
#include "tfe/protos_tfe.h"
|
||||
#include "tfe/protos_tfe.h"
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER
|
||||
@@ -575,8 +575,7 @@ config_init()
|
||||
// Find the configuration file
|
||||
g_config_gsplus_name[0] = 0;
|
||||
can_create = 1;
|
||||
setup_gsplus_file(&g_config_gsplus_name[0], sizeof(g_config_gsplus_name), 0,
|
||||
can_create, &g_config_gsplus_name_list[0]);
|
||||
setup_gsplus_file(&g_config_gsplus_name[0], sizeof(g_config_gsplus_name), 0, can_create, &g_config_gsplus_name_list[0]);
|
||||
|
||||
config_parse_config_gsplus_file();
|
||||
}
|
||||
@@ -656,9 +655,9 @@ cfg_iwreset()
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_TFE
|
||||
void
|
||||
void
|
||||
cfg_get_tfe_name()
|
||||
{
|
||||
{
|
||||
int i = 0;
|
||||
char *ppname = NULL;
|
||||
char *ppdes = NULL;
|
||||
@@ -679,9 +678,9 @@ cfg_get_tfe_name()
|
||||
else
|
||||
{
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
cfg_printf("ERROR: Install/Enable WinPcap for Ethernet Support!!");
|
||||
cfg_printf("ERROR: Install/Enable WinPcap for Ethernet Support!!");
|
||||
#else
|
||||
cfg_printf("ERROR: Install/Enable LibPcap for Ethernet Support!!");
|
||||
cfg_printf("ERROR: Install/Enable LibPcap for Ethernet Support!!");
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
@@ -726,8 +725,9 @@ config_parse_option(char *buf, int pos, int len, int line)
|
||||
}
|
||||
|
||||
// find "name" as first contiguous string
|
||||
printf("...parse_option: line %d, %p,%p = %s (%s) len:%d\n", line,
|
||||
&buf[pos], buf, &buf[pos], buf, len);
|
||||
gloghead(); printf("...parse_option: line %d, len:%d \"%s\"\n", line, len, &buf[pos]);
|
||||
|
||||
// printf("...parse_option: line %d, %p,%p = %s (%s) len:%d\n", line, &buf[pos], buf, &buf[pos], buf, len);
|
||||
|
||||
nameptr = &buf[pos];
|
||||
while(pos < len) {
|
||||
@@ -921,8 +921,7 @@ config_load_roms()
|
||||
if(*names_ptr == 0) {
|
||||
continue;
|
||||
}
|
||||
setup_gsplus_file(&g_cfg_tmp_path[0], CFG_PATH_MAX, 1, 0,
|
||||
names_ptr);
|
||||
setup_gsplus_file(&g_cfg_tmp_path[0], CFG_PATH_MAX, 1, 0, names_ptr);
|
||||
if(g_cfg_tmp_path[0] != 0) {
|
||||
file = fopen(&(g_cfg_tmp_path[0]), "rb");
|
||||
if(!file) {
|
||||
@@ -2556,7 +2555,7 @@ cfg_file_init()
|
||||
// Just use g_cfg_file_def_name
|
||||
strncpy(&g_cfg_tmp_path[0], g_cfg_file_def_name, CFG_PATH_MAX);
|
||||
}
|
||||
|
||||
|
||||
cfg_get_base_path(&g_cfg_file_curpath[0], &g_cfg_tmp_path[0], 0);
|
||||
g_cfg_dirlist.invalid = 1;
|
||||
}
|
||||
@@ -2631,7 +2630,7 @@ cfg_dirent_sortfn(const void *obj1, const void *obj2)
|
||||
#if defined(MAC) || defined(_WIN32)
|
||||
// OG
|
||||
ret = 0;
|
||||
// ret = strcasecmp(direntptr1->name, direntptr2->name);
|
||||
// ret = strcasecmp(direntptr1->name, direntptr2->name);
|
||||
#else
|
||||
ret = strcmp(direntptr1->name, direntptr2->name);
|
||||
#endif
|
||||
@@ -2804,7 +2803,7 @@ cfg_inspect_maybe_insert_file(char *filename, int should_boot)
|
||||
/*
|
||||
Take a look at a file. Based on its size, guess a slot/drive to insert it into.
|
||||
Used for blind operations like dragging/dropping files.
|
||||
Optionally boot from that slot.
|
||||
Optionally boot from that slot.
|
||||
*/
|
||||
int rc = 0;
|
||||
int slot = 0;
|
||||
@@ -2819,7 +2818,7 @@ Optionally boot from that slot.
|
||||
}
|
||||
if (slot > 0)
|
||||
{
|
||||
insert_disk(slot,0,filename,0,0,0,-1);
|
||||
insert_disk(slot,0,filename,0,0,0,-1);
|
||||
printf("Inserted disk in slot %d, drive 1. Filename: %s\n", slot, filename);
|
||||
if (should_boot) {
|
||||
g_temp_boot_slot = slot;
|
||||
@@ -3340,7 +3339,7 @@ config_control_panel()
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SDL
|
||||
/*If user enters the Virtual Imagewriter control panel, flag it so we can
|
||||
/*If user enters the Virtual Imagewriter control panel, flag it so we can
|
||||
automatically apply changes on exit.*/
|
||||
if(menuptr == g_cfg_imagewriter_menu)
|
||||
{
|
||||
|
||||
+9
-3
@@ -12,7 +12,6 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "defc.h"
|
||||
#include "gsos.h"
|
||||
@@ -24,7 +23,14 @@
|
||||
#include <sys/paths.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef __linux__
|
||||
#include <sys/xattr.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(WIN_SDL)
|
||||
#include <io.h>
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
|
||||
@@ -2498,4 +2504,4 @@ void host_fst(void) {
|
||||
engine.acc = acc;
|
||||
if (acc) SEC();
|
||||
else CLC();
|
||||
}
|
||||
}
|
||||
+64
-30
@@ -31,6 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <libgen.h> // just for basename :P
|
||||
#include <string.h>
|
||||
#include "defc.h"
|
||||
#ifdef HAVE_ICON // Currently a flag because not supported outside of SDL builds. Looking at full solution.
|
||||
#include "icongs.h"
|
||||
@@ -53,7 +54,7 @@ int kb_shift_control_state = 0;
|
||||
void x_take_screenshot(); // screenshot stuff
|
||||
int g_screenshot_requested = 0; // DB to know if we want to save a screenshot
|
||||
extern char g_config_gsplus_name[];
|
||||
extern char *g_config_gsplus_screenshot_dir;
|
||||
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];
|
||||
|
||||
@@ -422,6 +423,14 @@ check_input_events_sdl()
|
||||
SDL_Quit();
|
||||
my_exit(1);
|
||||
break;
|
||||
case SDL_DROPFILE:
|
||||
{
|
||||
char *file = event.drop.file;
|
||||
cfg_inspect_maybe_insert_file(file, 0);
|
||||
SDL_free(file);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -573,32 +582,6 @@ x_dialog_create_gsport_conf(const char *str)
|
||||
config_write_config_gsplus_file();
|
||||
}
|
||||
|
||||
char *g_clipboard;
|
||||
size_t g_clipboard_pos;
|
||||
|
||||
void clipboard_paste(void) {
|
||||
char *clipboard;
|
||||
if (SDL_HasClipboardText()) {
|
||||
clipboard = SDL_GetClipboardText();
|
||||
if (g_clipboard) {
|
||||
free(g_clipboard);
|
||||
g_clipboard_pos = 0;
|
||||
}
|
||||
g_clipboard = strdup(clipboard);
|
||||
free(clipboard);
|
||||
}
|
||||
}
|
||||
|
||||
int clipboard_get_char() {
|
||||
if (!g_clipboard)
|
||||
return 0;
|
||||
if (g_clipboard[g_clipboard_pos] == '\n')
|
||||
g_clipboard_pos++;
|
||||
if (g_clipboard[g_clipboard_pos] == '\0')
|
||||
return 0;
|
||||
return g_clipboard[g_clipboard_pos++] | 0x80;
|
||||
}
|
||||
|
||||
void x_full_screen(int do_full) {
|
||||
if (do_full) {
|
||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
@@ -616,12 +599,13 @@ int file_exists(char *fname){
|
||||
}
|
||||
}
|
||||
|
||||
// This tries to determine the next screenshot name.
|
||||
// It uses the config name as the basename.
|
||||
void make_next_screenshot_filename()
|
||||
{
|
||||
char filepart[256];
|
||||
char filename[256];
|
||||
|
||||
|
||||
int available_filename = 0;
|
||||
while (!available_filename) {
|
||||
char *bn = basename(g_config_gsplus_name);
|
||||
@@ -637,7 +621,6 @@ void make_next_screenshot_filename()
|
||||
} else {
|
||||
sprintf(filename, "%s/%s%04d.png",g_config_gsplus_screenshot_dir,filepart,screenshot_index);
|
||||
}
|
||||
|
||||
screenshot_index++;
|
||||
if (!file_exists(filename)) {
|
||||
available_filename = 1;
|
||||
@@ -650,7 +633,8 @@ void make_next_screenshot_filename()
|
||||
// workaround is this horrible hack of saving the bmp -> load bmp -> save png
|
||||
void x_take_screenshot() {
|
||||
make_next_screenshot_filename();
|
||||
printf("Screenshot! ---> %s\n", screenshot_filename);
|
||||
gloghead();
|
||||
printf("Taking screenshot - %s\n", screenshot_filename);
|
||||
SDL_Surface *sshot = SDL_CreateRGBSurface(0, BASE_WINDOW_WIDTH, X_A2_WINDOW_HEIGHT, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
|
||||
SDL_LockSurface(sshot);
|
||||
int read = SDL_RenderReadPixels(renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
|
||||
@@ -690,6 +674,56 @@ void x_release_kimage(Kimage* kimage_ptr) { }
|
||||
int x_calc_ratio(float x,float y) { return 1; }
|
||||
|
||||
|
||||
static char *g_clipboard = NULL;
|
||||
static size_t g_clipboard_pos = 0;
|
||||
|
||||
void clipboard_paste(void) {
|
||||
|
||||
char *cp;
|
||||
|
||||
if (g_clipboard) {
|
||||
free(g_clipboard);
|
||||
g_clipboard = NULL;
|
||||
g_clipboard_pos = 0;
|
||||
}
|
||||
|
||||
cp = SDL_GetClipboardText();
|
||||
if (!cp) return;
|
||||
|
||||
g_clipboard = strdup(cp);
|
||||
g_clipboard_pos = 0;
|
||||
|
||||
SDL_free(cp);
|
||||
}
|
||||
|
||||
int clipboard_get_char(void) {
|
||||
char c;
|
||||
|
||||
if (!g_clipboard)
|
||||
return 0;
|
||||
|
||||
/* skip utf-8 characters. */
|
||||
do {
|
||||
c = g_clipboard[g_clipboard_pos++];
|
||||
} while (c & 0x80);
|
||||
|
||||
/* windows -- skip the \n in \r\n. */
|
||||
if (c == '\r' && g_clipboard[g_clipboard_pos] == '\n')
|
||||
g_clipboard_pos++;
|
||||
|
||||
/* everybody else -- convert \n to \r */
|
||||
if (c == '\n') c = '\r';
|
||||
|
||||
if (c == 0) {
|
||||
free(g_clipboard);
|
||||
g_clipboard = NULL;
|
||||
g_clipboard_pos = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return c | 0x80;
|
||||
}
|
||||
|
||||
void x_set_mask_and_shift(word32 x_mask, word32 *mask_ptr, int *shift_left_ptr, int *shift_right_ptr) { return; }
|
||||
void x_update_color(int col_num, int red, int green, int blue, word32 rgb) { }
|
||||
void x_update_physical_colormap() { }
|
||||
|
||||
+10
-9
@@ -29,7 +29,7 @@
|
||||
#include "glog.h"
|
||||
|
||||
extern const char *g_config_gsplus_name_list[];
|
||||
extern char *g_config_gsplus_screenshot_dir;
|
||||
extern char g_config_gsplus_screenshot_dir[];
|
||||
#ifdef UNDER_CE
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
@@ -946,6 +946,10 @@ gsplusmain(int argc, char **argv)
|
||||
sim65816_initglobals();
|
||||
moremem_init();
|
||||
|
||||
printf("FOOOAAA\n" );
|
||||
// initialize ss dir to default value (current path)
|
||||
strcpy(g_config_gsplus_screenshot_dir, "./");
|
||||
|
||||
/* parse args */
|
||||
for(i = 1; i < argc; i++) {
|
||||
if(!strcmp("-badrd", argv[i])) {
|
||||
@@ -1055,11 +1059,11 @@ gsplusmain(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
printf("Using %s as configuration file\n", argv[i+1]);
|
||||
g_config_gsplus_name_list[0] = argv[i+1]; // super dangerous ?
|
||||
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
|
||||
g_config_gsplus_screenshot_dir = argv[i+1];
|
||||
strcpy(g_config_gsplus_screenshot_dir, argv[i+1]);
|
||||
struct stat path_stat;
|
||||
int ret = stat(g_config_gsplus_screenshot_dir, &path_stat); // (weakly) validate path
|
||||
if (!S_ISDIR(path_stat.st_mode)) {
|
||||
@@ -1308,9 +1312,7 @@ gsport_expand_path(char *out_ptr, const char *in_ptr, int maxlen)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setup_gsplus_file(char *outname, int maxlen, int ok_if_missing,
|
||||
int can_create_file, const char **name_ptr)
|
||||
void setup_gsplus_file(char *outname, int maxlen, int ok_if_missing, int can_create_file, const char **name_ptr)
|
||||
{
|
||||
char local_path[256];
|
||||
struct stat stat_buf;
|
||||
@@ -1329,7 +1331,7 @@ setup_gsplus_file(char *outname, int maxlen, int ok_if_missing,
|
||||
while(*cur_name_ptr) {
|
||||
strcpy(outname, &(local_path[0]));
|
||||
strncat(outname, *cur_name_ptr, 255-strlen(outname));
|
||||
if(!ok_if_missing) {
|
||||
if(!ok_if_missing) { // ??
|
||||
gloghead(); printf("Trying '%s'\n", outname);
|
||||
}
|
||||
ret = stat(outname, &stat_buf);
|
||||
@@ -1382,8 +1384,7 @@ setup_gsplus_file(char *outname, int maxlen, int ok_if_missing,
|
||||
|
||||
// But clear out the fatal_printfs first
|
||||
clear_fatal_logs();
|
||||
setup_gsplus_file(outname, maxlen, ok_if_missing,
|
||||
can_create_file, name_ptr);
|
||||
setup_gsplus_file(outname, maxlen, ok_if_missing, can_create_file, name_ptr);
|
||||
// It's one-level of recursion--it cannot loop since we
|
||||
// clear can_create_file.
|
||||
// If it returns, then there was succes and we should get out
|
||||
|
||||
Reference in New Issue
Block a user