Fix Win32 TFE build, add OS/2 ifdefs just in case...

This commit is contained in:
David Schmidt 2010-04-16 17:25:31 +00:00
parent b14d22ae62
commit 27173383be
12 changed files with 196 additions and 27 deletions

View File

@ -2,10 +2,7 @@
OBJECTS1 = adb.o clock.o config.o dis.o engine_c.o scc.o iwm.o \
joystick_driver.o moremem.o paddles.o sim65816.o smartport.o \
sound.o sound_driver.o video.o scc_socket_driver.o scc_windriver.o \
scc_macdriver.o
OBJECTS2 = tfe/tfe.o tfe/tfearch.o tfe/tfesupp.o tfe/uilib.o
sound.o sound_driver.o video.o scc_socket_driver.o
include vars
@ -18,6 +15,9 @@ PERL = perl
all: $(TARGET)
clean:
rm $(OBJECTS)
specials: 8inst_s 16inst_s 8size 16size 8inst_c 16inst_c size_c size_s
specials_clean:
@ -133,7 +133,7 @@ sound.o: sound.c defc.h defcomm.h iwm.h protos.h sound.h
sound_driver.o: sound_driver.c defc.h defcomm.h iwm.h protos.h sound.h
video.o: video.c defc.h defcomm.h iwm.h protos.h superhires.h kegsfont.h
tfe.o: tfe/tfe.c tfe/tfe.h tfe/tfe_protos.h
tfearch.o: tfe/tfearch.c tfe/tfearch.h tfe/tfe_protos.h
tfearch.o:arch/win32/tfearch.c tfe/tfearch.h tfe/tfe_protos.h
tfesupp.o: tfe/tfesupp.c tfe/tfesupp.h tfe/tfe_protos.h
uilib.o: tfe/uilib.c tfe/uilib.h tfe/tfe_protos.h
macdriver.o: macdriver.c defc.h defcomm.h iwm.h protos.h protos_macdriver.h

View File

@ -37,13 +37,8 @@
#ifndef lib_pcap_h
#define lib_pcap_h
#ifdef WIN32
/* RGJ Changed it to "pcap-stdinc.h" for AppleWin */
#include "pcap-stdinc.h"
#else /* WIN32 */
#include <sys/types.h>
#include <sys/time.h>
#endif /* WIN32 */
/* RGJ Changed it to "bpf.h" for AppleWin */
#include "bpf.h"

View File

@ -28,6 +28,11 @@
/* #define WPCAP */
#define WIN32_LEAN_AND_MEAN /* Tell windows we want less header gunk */
#define STRICT /* Tell Windows we want compile type checks */
#include <windows.h>
#include "pcap.h"
#include <assert.h>

View File

@ -71,7 +71,7 @@ void U_STACK_TRACE();
# include <libc.h>
#endif
#ifndef _WIN32
#if !defined(_WIN32) && !defined (__OS2__)
# include <unistd.h>
# include <sys/ioctl.h>
# include <sys/wait.h>

View File

@ -676,7 +676,7 @@ read_line(char *buf, int len)
{
int space_left;
int ret;
#ifndef _WIN32
#if !defined(_WIN32) && !defined (__OS2__)
int flags, flags_save;
/* Unix */
@ -697,6 +697,8 @@ read_line(char *buf, int len)
while(space_left > 0) {
#ifdef _WIN32
ret = win_nonblock_read_stdin(0, buf, 1);
#elif defined(__OS2__)
#else
/* Unix */
ret = read(0, buf, 1);
@ -722,7 +724,7 @@ read_line(char *buf, int len)
}
buf = &buf[ret];
}
#ifndef _WIN32
#if !defined(_WIN32) && !defined (__OS2__)
(void)fcntl(0, F_SETFL, flags_save);
#endif

166
src/os2driver.c Normal file
View File

@ -0,0 +1,166 @@
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 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
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
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.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "defc.h"
#include "protos.h"
extern int Verbose;
extern int g_warp_pointer;
extern int g_screen_depth;
extern int g_force_depth;
int g_screen_mdepth = 0;
extern int g_quit_sim_now;
int g_use_shmem = 1;
int g_has_focus = 0;
int g_auto_repeat_on = -1;
extern Kimage g_mainwin_kimage;
int g_main_height = 0;
int g_win_capslock_down = 0;
extern int g_border_sides_refresh_needed;
extern int g_border_special_refresh_needed;
extern int g_status_refresh_needed;
extern int g_lores_colors[];
extern int g_cur_a2_stat;
extern int g_a2vid_palette;
extern int g_installed_full_superhires_colormap;
extern int g_screen_redraw_skip_amt;
extern word32 g_a2_screen_buffer_changed;
int
win_nonblock_read_stdin(int fd, char *bufptr, int len)
{
}
void
x_dialog_create_kegs_conf(const char *str)
{
}
int
x_show_alert(int is_fatal, const char *str)
{
return 0;
}
int
main(int argc, char **argv)
{
printf("In OS/2 main...\n");
// Call kegsmain
return kegsmain(argc, argv);
}
void
check_input_events()
{
}
void
x_update_color(int col_num, int red, int green, int blue, word32 rgb)
{
}
void
x_update_physical_colormap()
{
}
void
show_xcolor_array()
{
}
void
xdriver_end()
{
printf("OS/2 driver_end\n");
}
void
x_get_kimage(Kimage *kimage_ptr)
{
return;
}
void
dev_video_init()
{
printf("Preparing graphics system\n");
}
void
x_redraw_status_lines()
{
}
void
x_push_kimage(Kimage *kimage_ptr, int destx, int desty, int srcx, int srcy,
int width, int height)
{
}
void
x_push_done()
{
}
void
x_auto_repeat_on(int must)
{
}
void
x_auto_repeat_off(int must)
{
}
void
x_hide_pointer(int do_hide)
{
}
void
x_full_screen(int do_full)
{
return;
}

View File

@ -199,7 +199,7 @@ scc_socket_open_outgoing(int port, double dcycs)
sa_in.sin_port = htons(23);
hostentptr = gethostbyname(&scc_ptr->modem_cmd_str[0]);
if(hostentptr == 0) {
#ifdef _WIN32
#if defined(_WIN32) || defined (__OS2__)
fatal_printf("Lookup host %s failed\n",
&scc_ptr->modem_cmd_str[0]);
#else
@ -244,7 +244,7 @@ scc_socket_make_nonblock(int port, double dcycs)
Scc *scc_ptr;
SOCKET sockfd;
int ret;
#ifdef _WIN32
#if defined(_WIN32) || defined (__OS2__)
u_long flags;
#else
int flags;
@ -253,7 +253,7 @@ scc_socket_make_nonblock(int port, double dcycs)
scc_ptr = &(scc_stat[port]);
sockfd = scc_ptr->sockfd;
#ifdef _WIN32
#if defined(_WIN32) || defined (__OS2__)
flags = 1;
ret = ioctlsocket(sockfd, FIONBIO, &flags);
if(ret != 0) {
@ -362,7 +362,7 @@ scc_accept_socket(int port, double dcycs)
flags = 0;
ret = 0;
#ifndef _WIN32
#if !defined(_WIN32) && !defined(__OS2__)
/* For Linux, we need to set O_NONBLOCK on the rdwrfd */
flags = fcntl(rdwrfd, F_GETFL, 0);
if(flags == -1) {
@ -655,7 +655,7 @@ void
scc_socket_empty_writebuf(int port, double dcycs)
{
#ifdef SCC_SOCKETS
# ifndef _WIN32
# if !defined(_WIN32) && !defined(__OS2__)
struct sigaction newact, oldact;
# endif
Scc *scc_ptr;
@ -741,7 +741,7 @@ scc_socket_empty_writebuf(int port, double dcycs)
scc_ptr->out_char_dcycs = dcycs;
}
# ifdef _WIN32
#if defined(_WIN32) || defined (__OS2__)
ret = send(rdwrfd, &(scc_ptr->out_buf[rdptr]), len, 0);
# else
/* ignore SIGPIPE around writes to the socket, so we */

View File

@ -275,7 +275,7 @@ sound_init_general()
size = SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE;
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC)
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC) && !defined(__OS2__)
shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
if(shmid < 0) {
printf("sound_init: shmget ret: %d, errno: %d\n", shmid,
@ -306,7 +306,7 @@ sound_init_general()
fflush(stdout);
#if !defined(MAC) && !defined(_WIN32) && !defined(__CYGWIN__)
#if !defined(MAC) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__OS2__)
/* prepare pipe so parent can signal child each other */
/* pipe[0] = read side, pipe[1] = write end */
ret = pipe(&g_pipe_fd[0]);
@ -358,9 +358,10 @@ sound_init_general()
#else
# ifdef MAC
macsnd_init(shmaddr);
# else
# elif defined (_WIN32)
/* windows */
win32snd_init(shmaddr);
# elif defined (__OS2__)
# endif
#endif /* _WIN32 */

View File

@ -23,7 +23,7 @@
const char rcsid_sound_h[] = "@(#)$KmKId: sound.h,v 1.17 2003-11-21 15:15:57-05 kentd Exp $";
#endif
#if !defined(_WIN32) && !defined(__CYGWIN__)
#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined (__OS2__)
# include <sys/ipc.h>
# include <sys/shm.h>
#endif

View File

@ -41,7 +41,6 @@
#include <ctype.h>
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <commctrl.h>
#include <commdlg.h>

View File

@ -1,6 +1,6 @@
TARGET = gsportmac
OBJECTS = $(OBJECTS1) macsnd_driver.o macdriver.o
OBJECTS = $(OBJECTS1) scc_macdriver.o macsnd_driver.o macdriver.o
CCOPTS = -O2 -DMAC
SUFFIX =
NAME = gsportmac

View File

@ -1,7 +1,8 @@
TARGET = gsportwin.exe
OBJECTS = $(OBJECTS1) win32snd_driver.o windriver.o
CCOPTS = -O2 -DKEGS_LITTLE_ENDIAN
TFEOBJ = tfe/tfe.o arch/win32/tfearch.o tfe/tfesupp.o
OBJECTS = $(OBJECTS1) $(TFEOBJ) scc_windriver.o win32snd_driver.o windriver.o
CCOPTS = -O2 -DKEGS_LITTLE_ENDIAN -DHAVE_TFE
SUFFIX = ".exe"
NAME = gsportwin