mirror of https://github.com/digarok/gsplus.git
uhm
This commit is contained in:
parent
b3ad34bdff
commit
d9dde67041
|
@ -1,9 +1,9 @@
|
|||
# GSport configuration file
|
||||
|
||||
s5d1 =
|
||||
s5d2 =
|
||||
|
||||
s6d1 =
|
||||
s6d2 =
|
||||
|
||||
s7d1 = NoBoot.po
|
||||
# GSport configuration file
|
||||
|
||||
s5d1 =
|
||||
s5d2 =
|
||||
|
||||
s6d1 =
|
||||
s6d2 =
|
||||
|
||||
s7d1 = NoBoot.po
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
@echo off
|
||||
REM
|
||||
REM GSport - Windows startup batch file
|
||||
REM
|
||||
|
||||
SET GSPORT_HOME=%CD%\
|
||||
set CYGWIN=nodosfilewarning
|
||||
|
||||
:add_classpath
|
||||
SET CWD=%CD%
|
||||
if "%GSPORT_PATH_SET%" == "1" goto start
|
||||
set GSPORT_PATH_SET=1
|
||||
PATH=%PATH%;%GSPORT_HOME
|
||||
|
||||
:start
|
||||
GSport.exe
|
||||
@echo off
|
||||
REM
|
||||
REM GSport - Windows startup batch file
|
||||
REM
|
||||
|
||||
SET GSPORT_HOME=%CD%\
|
||||
set CYGWIN=nodosfilewarning
|
||||
|
||||
:add_classpath
|
||||
SET CWD=%CD%
|
||||
if "%GSPORT_PATH_SET%" == "1" goto start
|
||||
set GSPORT_PATH_SET=1
|
||||
PATH=%PATH%;%GSPORT_HOME
|
||||
|
||||
:start
|
||||
GSport.exe
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,76 +1,76 @@
|
|||
# GSport OS/2 makefile
|
||||
|
||||
TARGET = gsport.exe
|
||||
|
||||
OBJECTS1 = dirport.obj adb.obj clock.obj dis.obj engine_c.obj scc.obj \
|
||||
iwm.obj joystick_driver.obj moremem.obj paddles.obj \
|
||||
sim65816.obj smartport.obj sound.obj \
|
||||
video.obj config.obj scc_socket_os2.obj os2driver.obj os2snd_driver.obj
|
||||
|
||||
{..\..}.c.obj:
|
||||
@echo " Compile::C++ Compiler "
|
||||
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
|
||||
|
||||
{src\}.c.obj:
|
||||
@echo " Compile::C++ Compiler "
|
||||
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
|
||||
|
||||
.c.obj:
|
||||
@echo " Compile::C++ Compiler "
|
||||
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
|
||||
|
||||
$(TARGET): $(OBJECTS1)
|
||||
@echo " Link::Linker "
|
||||
icc.exe @<<
|
||||
/B" /de /pmtype:pm /st:196608 "
|
||||
/Fe$(TARGET)
|
||||
so32dll.lib
|
||||
tcp32dll.lib
|
||||
$(OBJECTS1)
|
||||
<<
|
||||
rc gsportos2.rc $(TARGET)
|
||||
echo done
|
||||
|
||||
clean:
|
||||
- rm $(OBJECTS1)
|
||||
- rm $(TARGET)
|
||||
- rm gsportos2.res
|
||||
- rm ../../size_s.h
|
||||
- rm ../../size_c.h
|
||||
- rm ../../8size_s.h
|
||||
- rm ../../16size_s.h
|
||||
- rm ../../8inst_s.h
|
||||
- rm ../../8inst_c.h
|
||||
- rm ../../16inst_s.h
|
||||
- rm ../../16inst_c.h
|
||||
|
||||
../../size_c.h:
|
||||
call make_size.cmd
|
||||
|
||||
../../8inst_c.h:
|
||||
call make_inst.cmd
|
||||
|
||||
# dependency stuff
|
||||
dirport.obj: src/dirport.c src/dirport.h
|
||||
adb.obj: ../../adb.c ../../adb.h ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
engine_c.obj: ../../engine_c.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../protos_engine_c.h ../../size_c.h ../../op_routs.h ../../defs_instr.h ../../8inst_c.h ../../16inst_c.h
|
||||
clock.obj: ..\..\clock.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
compile_time.obj: ../../compile_time.c
|
||||
config.obj: ../../config.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../config.h
|
||||
dis.obj: ../../dis.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../disas.h
|
||||
scc.obj: ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h
|
||||
scc_socket_driver.obj: ../../scc_socket_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h
|
||||
scc_socket_os2.obj: scc_socket_os2.c
|
||||
iwm.obj: ../../iwm.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../iwm_35_525.h
|
||||
joystick_driver.obj: ../../joystick_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
moremem.obj: ../../moremem.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
paddles.obj: ../../paddles.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
parallel.obj: ../../parallel.c ../../defc.h
|
||||
printer.obj: ../../printer.cpp
|
||||
sim65816.obj: ../../sim65816.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
smartport.obj: ../../smartport.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
sound.obj: ../../sound.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
sound_driver.obj: ../../sound_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../sound.h
|
||||
video.obj: ../../video.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../superhires.h ../../gsportfont.h
|
||||
os2driver.obj: os2driver.c gsportos2.h ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
os2snd_driver.obj: os2snd_driver.c
|
||||
# GSport OS/2 makefile
|
||||
|
||||
TARGET = gsport.exe
|
||||
|
||||
OBJECTS1 = dirport.obj adb.obj clock.obj dis.obj engine_c.obj scc.obj \
|
||||
iwm.obj joystick_driver.obj moremem.obj paddles.obj \
|
||||
sim65816.obj smartport.obj sound.obj \
|
||||
video.obj config.obj scc_socket_os2.obj os2driver.obj os2snd_driver.obj
|
||||
|
||||
{..\..}.c.obj:
|
||||
@echo " Compile::C++ Compiler "
|
||||
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
|
||||
|
||||
{src\}.c.obj:
|
||||
@echo " Compile::C++ Compiler "
|
||||
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
|
||||
|
||||
.c.obj:
|
||||
@echo " Compile::C++ Compiler "
|
||||
icc.exe /DTCPV40HDRS /DBSD_SELECT /Dinline= /I..\.. /Ss /Q /Ti /Gm /G4 /Ft- /C %s
|
||||
|
||||
$(TARGET): $(OBJECTS1)
|
||||
@echo " Link::Linker "
|
||||
icc.exe @<<
|
||||
/B" /de /pmtype:pm /st:196608 "
|
||||
/Fe$(TARGET)
|
||||
so32dll.lib
|
||||
tcp32dll.lib
|
||||
$(OBJECTS1)
|
||||
<<
|
||||
rc gsportos2.rc $(TARGET)
|
||||
echo done
|
||||
|
||||
clean:
|
||||
- rm $(OBJECTS1)
|
||||
- rm $(TARGET)
|
||||
- rm gsportos2.res
|
||||
- rm ../../size_s.h
|
||||
- rm ../../size_c.h
|
||||
- rm ../../8size_s.h
|
||||
- rm ../../16size_s.h
|
||||
- rm ../../8inst_s.h
|
||||
- rm ../../8inst_c.h
|
||||
- rm ../../16inst_s.h
|
||||
- rm ../../16inst_c.h
|
||||
|
||||
../../size_c.h:
|
||||
call make_size.cmd
|
||||
|
||||
../../8inst_c.h:
|
||||
call make_inst.cmd
|
||||
|
||||
# dependency stuff
|
||||
dirport.obj: src/dirport.c src/dirport.h
|
||||
adb.obj: ../../adb.c ../../adb.h ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
engine_c.obj: ../../engine_c.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../protos_engine_c.h ../../size_c.h ../../op_routs.h ../../defs_instr.h ../../8inst_c.h ../../16inst_c.h
|
||||
clock.obj: ..\..\clock.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
compile_time.obj: ../../compile_time.c
|
||||
config.obj: ../../config.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../config.h
|
||||
dis.obj: ../../dis.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../disas.h
|
||||
scc.obj: ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h
|
||||
scc_socket_driver.obj: ../../scc_socket_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../scc.h
|
||||
scc_socket_os2.obj: scc_socket_os2.c
|
||||
iwm.obj: ../../iwm.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../iwm_35_525.h
|
||||
joystick_driver.obj: ../../joystick_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
moremem.obj: ../../moremem.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
paddles.obj: ../../paddles.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
parallel.obj: ../../parallel.c ../../defc.h
|
||||
printer.obj: ../../printer.cpp
|
||||
sim65816.obj: ../../sim65816.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
smartport.obj: ../../smartport.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
sound.obj: ../../sound.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
sound_driver.obj: ../../sound_driver.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../sound.h
|
||||
video.obj: ../../video.c ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h ../../superhires.h ../../gsportfont.h
|
||||
os2driver.obj: os2driver.c gsportos2.h ../../scc.c ../../defc.h ../../defcomm.h ../../iwm.h ../../protos.h
|
||||
os2snd_driver.obj: os2snd_driver.c
|
||||
|
|
|
@ -1,44 +1,46 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
MRESULT EXPENTRY MyWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
|
||||
VOID os2_abort(HWND hwndFrame, HWND hwndClient);
|
||||
|
||||
#define MSGBOXID 1001
|
||||
|
||||
#define ID_WINDOW 256
|
||||
|
||||
#define ID_OPTIONS 257
|
||||
#define ID_OPTION1 258
|
||||
#define ID_OPTION2 259
|
||||
#define ID_OPTION3 260
|
||||
|
||||
#define ID_EXITPROG 261
|
||||
|
||||
#define IDS_HELLO 262
|
||||
#define IDS_1 263
|
||||
#define IDS_2 264
|
||||
#define IDS_3 265
|
||||
|
||||
#define ID_BITMAP 266 /* For testing backgrounds - can be removed once video works */
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
MRESULT EXPENTRY MyWindowProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
|
||||
VOID os2_abort(HWND hwndFrame, HWND hwndClient);
|
||||
|
||||
#define MSGBOXID 1001
|
||||
|
||||
#define ID_WINDOW 256
|
||||
|
||||
#define ID_OPTIONS 257
|
||||
#define ID_OPTION1 258
|
||||
#define ID_OPTION2 259
|
||||
#define ID_OPTION3 260
|
||||
|
||||
#define ID_EXITPROG 261
|
||||
|
||||
#define IDS_HELLO 262
|
||||
#define IDS_1 263
|
||||
#define IDS_2 264
|
||||
#define IDS_3 265
|
||||
|
||||
#define ID_BITMAP 266 /* For testing backgrounds - can be removed once video works */
|
||||
|
|
|
@ -1,48 +1,49 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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 <os2.h>
|
||||
#include "gsportos2.h"
|
||||
|
||||
ICON ID_WINDOW gsportos2.ico
|
||||
|
||||
BITMAP ID_BITMAP gsportos2.bmp
|
||||
|
||||
MENU ID_WINDOW PRELOAD
|
||||
BEGIN
|
||||
SUBMENU "~Options", ID_OPTIONS
|
||||
BEGIN
|
||||
MENUITEM "Option ~1\tCtrl+A", ID_OPTION1, MIS_TEXT
|
||||
MENUITEM "Option ~2\tCtrl+B", ID_OPTION2, MIS_TEXT
|
||||
MENUITEM "Option ~3\tCtrl+C", ID_OPTION3, MIS_TEXT
|
||||
END
|
||||
END
|
||||
|
||||
ACCELTABLE ID_WINDOW PRELOAD
|
||||
BEGIN
|
||||
VK_F3, ID_EXITPROG, VIRTUALKEY
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD
|
||||
BEGIN
|
||||
IDS_HELLO, "Hello"
|
||||
END
|
||||
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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 <os2.h>
|
||||
#include "gsportos2.h"
|
||||
|
||||
ICON ID_WINDOW gsportos2.ico
|
||||
|
||||
BITMAP ID_BITMAP gsportos2.bmp
|
||||
|
||||
MENU ID_WINDOW PRELOAD
|
||||
BEGIN
|
||||
SUBMENU "~Options", ID_OPTIONS
|
||||
BEGIN
|
||||
MENUITEM "Option ~1\tCtrl+A", ID_OPTION1, MIS_TEXT
|
||||
MENUITEM "Option ~2\tCtrl+B", ID_OPTION2, MIS_TEXT
|
||||
MENUITEM "Option ~3\tCtrl+C", ID_OPTION3, MIS_TEXT
|
||||
END
|
||||
END
|
||||
|
||||
ACCELTABLE ID_WINDOW PRELOAD
|
||||
BEGIN
|
||||
VK_F3, ID_EXITPROG, VIRTUALKEY
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD
|
||||
BEGIN
|
||||
IDS_HELLO, "Hello"
|
||||
END
|
||||
|
|
|
@ -1,76 +1,76 @@
|
|||
/*
|
||||
|
||||
make_inst.cmd:
|
||||
|
||||
Translation of the make_inst perl script and makefile to rexx for OS/2
|
||||
|
||||
8inst_s.h: instable.h
|
||||
$(PERL) make_inst s 8 instable.h > 8inst_s.h
|
||||
|
||||
16inst_s.h: instable.h
|
||||
$(PERL) make_inst s 16 instable.h > 16inst_s.h
|
||||
|
||||
8inst_c.h: instable.h
|
||||
$(PERL) make_inst c 8 instable.h > 8inst_c.h
|
||||
|
||||
16inst_c.h: instable.h
|
||||
$(PERL) make_inst c 16 instable.h > 16inst_c.h
|
||||
|
||||
*/
|
||||
|
||||
count = 0;
|
||||
|
||||
FileNameIn = "..\..\instable.h"
|
||||
FileNameOut8s = "..\..\8inst_s.h"
|
||||
FileNameOut8c = "..\..\8inst_c.h"
|
||||
FileNameOut16s = "..\..\16inst_s.h"
|
||||
FileNameOut16c = "..\..\16inst_c.h"
|
||||
|
||||
DEL FileNameOut8s
|
||||
DEL FileNameOut8c
|
||||
DEL FileNameOut16s
|
||||
DEL FileNameOut16c
|
||||
crud = STREAM(FileNameIn,"C","open read")
|
||||
crud = STREAM(FileNameOut8s,"C","open write")
|
||||
crud = STREAM(FileNameOut8c,"C","open write")
|
||||
crud = STREAM(FileNameOut16s,"C","open write")
|
||||
crud = STREAM(FileNameOut16c,"C","open write")
|
||||
|
||||
Do while (STREAM(FileNameIn,"S") = "READY")
|
||||
line = LINEIN(FileNameIn);
|
||||
|
||||
SymPos = POS("_SYM",line)
|
||||
if (SymPos > 0) Then
|
||||
Do
|
||||
if POS("inst",line) > 0 Then
|
||||
Do
|
||||
if (count > 0) Then
|
||||
Do
|
||||
crud = LINEOUT(FileNameOut8c," break;");
|
||||
crud = LINEOUT(FileNameOut16c," break;");
|
||||
End
|
||||
newline = "case 0x"SUBSTR(line,SymPos-2,2)": "SUBSTR(line,SymPos+4)
|
||||
crud = LINEOUT(FileNameOut8c, newline);
|
||||
crud = LINEOUT(FileNameOut16c, newline);
|
||||
count = count + 1;
|
||||
End
|
||||
Else
|
||||
Do
|
||||
crud = LINEOUT(FileNameOut8s,SUBSTR(line,1,SymPos)" . "8" . "SUBSTR(line,SymPos+4));
|
||||
crud = LINEOUT(FileNameOut16s,SUBSTR(line,1,SymPos)" . "16" . "SUBSTR(line,SymPos+4));
|
||||
End
|
||||
End
|
||||
Else
|
||||
Do
|
||||
crud = LINEOUT(FileNameOut8c,line);
|
||||
crud = LINEOUT(FileNameOut8s,line);
|
||||
crud = LINEOUT(FileNameOut16c,line);
|
||||
crud = LINEOUT(FileNameOut16s,line);
|
||||
End
|
||||
End
|
||||
say "Lines read: "Count
|
||||
crud = STREAM(FileNameIn,"C","close")
|
||||
crud = STREAM(FileNameOut8s,"C","close")
|
||||
crud = STREAM(FileNameOut8c,"C","close")
|
||||
crud = STREAM(FileNameOut16s,"C","close")
|
||||
crud = STREAM(FileNameOut16c,"C","close")
|
||||
/*
|
||||
|
||||
make_inst.cmd:
|
||||
|
||||
Translation of the make_inst perl script and makefile to rexx for OS/2
|
||||
|
||||
8inst_s.h: instable.h
|
||||
$(PERL) make_inst s 8 instable.h > 8inst_s.h
|
||||
|
||||
16inst_s.h: instable.h
|
||||
$(PERL) make_inst s 16 instable.h > 16inst_s.h
|
||||
|
||||
8inst_c.h: instable.h
|
||||
$(PERL) make_inst c 8 instable.h > 8inst_c.h
|
||||
|
||||
16inst_c.h: instable.h
|
||||
$(PERL) make_inst c 16 instable.h > 16inst_c.h
|
||||
|
||||
*/
|
||||
|
||||
count = 0;
|
||||
|
||||
FileNameIn = "..\..\instable.h"
|
||||
FileNameOut8s = "..\..\8inst_s.h"
|
||||
FileNameOut8c = "..\..\8inst_c.h"
|
||||
FileNameOut16s = "..\..\16inst_s.h"
|
||||
FileNameOut16c = "..\..\16inst_c.h"
|
||||
|
||||
DEL FileNameOut8s
|
||||
DEL FileNameOut8c
|
||||
DEL FileNameOut16s
|
||||
DEL FileNameOut16c
|
||||
crud = STREAM(FileNameIn,"C","open read")
|
||||
crud = STREAM(FileNameOut8s,"C","open write")
|
||||
crud = STREAM(FileNameOut8c,"C","open write")
|
||||
crud = STREAM(FileNameOut16s,"C","open write")
|
||||
crud = STREAM(FileNameOut16c,"C","open write")
|
||||
|
||||
Do while (STREAM(FileNameIn,"S") = "READY")
|
||||
line = LINEIN(FileNameIn);
|
||||
|
||||
SymPos = POS("_SYM",line)
|
||||
if (SymPos > 0) Then
|
||||
Do
|
||||
if POS("inst",line) > 0 Then
|
||||
Do
|
||||
if (count > 0) Then
|
||||
Do
|
||||
crud = LINEOUT(FileNameOut8c," break;");
|
||||
crud = LINEOUT(FileNameOut16c," break;");
|
||||
End
|
||||
newline = "case 0x"SUBSTR(line,SymPos-2,2)": "SUBSTR(line,SymPos+4)
|
||||
crud = LINEOUT(FileNameOut8c, newline);
|
||||
crud = LINEOUT(FileNameOut16c, newline);
|
||||
count = count + 1;
|
||||
End
|
||||
Else
|
||||
Do
|
||||
crud = LINEOUT(FileNameOut8s,SUBSTR(line,1,SymPos)" . "8" . "SUBSTR(line,SymPos+4));
|
||||
crud = LINEOUT(FileNameOut16s,SUBSTR(line,1,SymPos)" . "16" . "SUBSTR(line,SymPos+4));
|
||||
End
|
||||
End
|
||||
Else
|
||||
Do
|
||||
crud = LINEOUT(FileNameOut8c,line);
|
||||
crud = LINEOUT(FileNameOut8s,line);
|
||||
crud = LINEOUT(FileNameOut16c,line);
|
||||
crud = LINEOUT(FileNameOut16s,line);
|
||||
End
|
||||
End
|
||||
say "Lines read: "Count
|
||||
crud = STREAM(FileNameIn,"C","close")
|
||||
crud = STREAM(FileNameOut8s,"C","close")
|
||||
crud = STREAM(FileNameOut8c,"C","close")
|
||||
crud = STREAM(FileNameOut16s,"C","close")
|
||||
crud = STREAM(FileNameOut16c,"C","close")
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
/*
|
||||
|
||||
make_inst.cmd:
|
||||
|
||||
Translation of the make_size perl script and makefile to rexx for OS/2
|
||||
|
||||
size_c.h: size_tab.h
|
||||
$(PERL) make_size c size_tab.h > size_c.h
|
||||
|
||||
size_s.h: size_tab.h
|
||||
$(PERL) make_size s size_tab.h > size_s.h
|
||||
|
||||
8size_s.h: size_tab.h
|
||||
$(PERL) make_size 8 size_tab.h > 8size_s.h
|
||||
|
||||
16size_s.h: size_tab.h
|
||||
$(PERL) make_size 16 size_tab.h > 16size_s.h
|
||||
|
||||
*/
|
||||
|
||||
FileNameIn = "..\..\size_tab.h"
|
||||
FileNameOuts = "..\..\size_s.h"
|
||||
FileNameOutc = "..\..\size_c.h"
|
||||
FileNameOut8 = "..\..\8size_s.h"
|
||||
FileNameOut16 = "..\..\16size_s.h"
|
||||
|
||||
DEL FileNameOuts
|
||||
DEL FileNameOutc
|
||||
DEL FileNameOut8
|
||||
DEL FileNameOut16
|
||||
crud = STREAM(FileNameIn,"C","open read")
|
||||
crud = STREAM(FileNameOuts,"C","open write")
|
||||
crud = STREAM(FileNameOutc,"C","open write")
|
||||
crud = STREAM(FileNameOut8,"C","open write")
|
||||
crud = STREAM(FileNameOut16,"C","open write")
|
||||
|
||||
Do while (STREAM(FileNameIn,"S") = "READY")
|
||||
line = LINEIN(FileNameIn);
|
||||
|
||||
SymPos = POS("_SYM",line)
|
||||
if (SymPos > 0) Then
|
||||
Do
|
||||
newline = " .byte 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOuts, newline);
|
||||
newline = " 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOutc, newline);
|
||||
newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 8 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOut8, newline);
|
||||
newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 16 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOut16, newline);
|
||||
End
|
||||
Else if (POS(".block",line) > 0) Then
|
||||
Do
|
||||
crud = LINEOUT(FileNameOuts, "");
|
||||
crud = LINEOUT(FileNameOutc, "");
|
||||
crud = LINEOUT(FileNameOut8, line);
|
||||
crud = LINEOUT(FileNameOut16, line);
|
||||
End
|
||||
Else
|
||||
Do
|
||||
crud = LINEOUT(FileNameOuts, line);
|
||||
crud = LINEOUT(FileNameOutc, line);
|
||||
crud = LINEOUT(FileNameOut8, line);
|
||||
crud = LINEOUT(FileNameOut16, line);
|
||||
End
|
||||
End
|
||||
crud = STREAM(FileNameIn,"C","close")
|
||||
crud = STREAM(FileNameOuts,"C","close")
|
||||
crud = STREAM(FileNameOutc,"C","close")
|
||||
crud = STREAM(FileNameOut8,"C","close")
|
||||
crud = STREAM(FileNameOut16,"C","close")
|
||||
/*
|
||||
|
||||
make_inst.cmd:
|
||||
|
||||
Translation of the make_size perl script and makefile to rexx for OS/2
|
||||
|
||||
size_c.h: size_tab.h
|
||||
$(PERL) make_size c size_tab.h > size_c.h
|
||||
|
||||
size_s.h: size_tab.h
|
||||
$(PERL) make_size s size_tab.h > size_s.h
|
||||
|
||||
8size_s.h: size_tab.h
|
||||
$(PERL) make_size 8 size_tab.h > 8size_s.h
|
||||
|
||||
16size_s.h: size_tab.h
|
||||
$(PERL) make_size 16 size_tab.h > 16size_s.h
|
||||
|
||||
*/
|
||||
|
||||
FileNameIn = "..\..\size_tab.h"
|
||||
FileNameOuts = "..\..\size_s.h"
|
||||
FileNameOutc = "..\..\size_c.h"
|
||||
FileNameOut8 = "..\..\8size_s.h"
|
||||
FileNameOut16 = "..\..\16size_s.h"
|
||||
|
||||
DEL FileNameOuts
|
||||
DEL FileNameOutc
|
||||
DEL FileNameOut8
|
||||
DEL FileNameOut16
|
||||
crud = STREAM(FileNameIn,"C","open read")
|
||||
crud = STREAM(FileNameOuts,"C","open write")
|
||||
crud = STREAM(FileNameOutc,"C","open write")
|
||||
crud = STREAM(FileNameOut8,"C","open write")
|
||||
crud = STREAM(FileNameOut16,"C","open write")
|
||||
|
||||
Do while (STREAM(FileNameIn,"S") = "READY")
|
||||
line = LINEIN(FileNameIn);
|
||||
|
||||
SymPos = POS("_SYM",line)
|
||||
if (SymPos > 0) Then
|
||||
Do
|
||||
newline = " .byte 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOuts, newline);
|
||||
newline = " 0x"SUBSTR(line,SymPos+5,1)", /* "SUBSTR(line,SymPos-2,2)" */ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOutc, newline);
|
||||
newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 8 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOut8, newline);
|
||||
newline = " .word inst"SUBSTR(line,SymPos-2,2)" . 16 . /*"SUBSTR(line,SymPos+5,1)"*/ "SUBSTR(line,SymPos+6)
|
||||
crud = LINEOUT(FileNameOut16, newline);
|
||||
End
|
||||
Else if (POS(".block",line) > 0) Then
|
||||
Do
|
||||
crud = LINEOUT(FileNameOuts, "");
|
||||
crud = LINEOUT(FileNameOutc, "");
|
||||
crud = LINEOUT(FileNameOut8, line);
|
||||
crud = LINEOUT(FileNameOut16, line);
|
||||
End
|
||||
Else
|
||||
Do
|
||||
crud = LINEOUT(FileNameOuts, line);
|
||||
crud = LINEOUT(FileNameOutc, line);
|
||||
crud = LINEOUT(FileNameOut8, line);
|
||||
crud = LINEOUT(FileNameOut16, line);
|
||||
End
|
||||
End
|
||||
crud = STREAM(FileNameIn,"C","close")
|
||||
crud = STREAM(FileNameOuts,"C","close")
|
||||
crud = STREAM(FileNameOutc,"C","close")
|
||||
crud = STREAM(FileNameOut8,"C","close")
|
||||
crud = STREAM(FileNameOut16,"C","close")
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,22 +1,23 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
int g_preferred_rate = 48000;
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
int g_preferred_rate = 48000;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/* scc_socket_driver.c */
|
||||
void scc_socket_init(int port)
|
||||
{}
|
||||
|
||||
void scc_socket_change_params(int port)
|
||||
{}
|
||||
|
||||
void scc_socket_empty_writebuf(int port, double dcycs)
|
||||
{}
|
||||
|
||||
void scc_socket_fill_readbuf(int port, int space_left, double dcycs)
|
||||
{}
|
||||
/* scc_socket_driver.c */
|
||||
void scc_socket_init(int port)
|
||||
{}
|
||||
|
||||
void scc_socket_change_params(int port)
|
||||
{}
|
||||
|
||||
void scc_socket_empty_writebuf(int port, double dcycs)
|
||||
{}
|
||||
|
||||
void scc_socket_fill_readbuf(int port, int space_left, double dcycs)
|
||||
{}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,85 +1,84 @@
|
|||
/*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef VICE_DIRPORT_H
|
||||
#define VICE_DIRPORT_H
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef _A_VOLID
|
||||
#define _A_VOLID 0
|
||||
#endif
|
||||
|
||||
#ifndef _A_NORMAL
|
||||
#define _A_NORMAL FILE_NORMAL
|
||||
#endif
|
||||
|
||||
#ifndef _A_RDONLY
|
||||
#define _A_RDONLY FILE_READONLY
|
||||
#endif
|
||||
|
||||
#ifndef _A_HIDDEN
|
||||
#define _A_HIDDEN FILE_HIDDEN
|
||||
#endif
|
||||
|
||||
#ifndef _A_SYSTEM
|
||||
#define _A_SYSTEM FILE_SYSTEM
|
||||
#endif
|
||||
|
||||
#ifndef _A_SUBDIR
|
||||
#define _A_SUBDIR FILE_DIRECTORY
|
||||
#endif
|
||||
|
||||
#ifndef _A_ARCH
|
||||
#define _A_ARCH FILE_ARCHIVED
|
||||
#endif
|
||||
|
||||
#define _A_ANY FILE_NORMAL | FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED
|
||||
|
||||
#ifndef EPERM
|
||||
#define EPERM EDOM // Operation not permitted = Domain Error
|
||||
#endif
|
||||
|
||||
#define dirent _FILEFINDBUF3
|
||||
#define d_name achName /* For struct dirent portability */
|
||||
#define d_size cbFile
|
||||
|
||||
#define mkdir(name, mode) mkdir(name)
|
||||
|
||||
#ifndef WATCOM_COMPILE
|
||||
#define S_ISDIR(mode) ((mode) & S_IFDIR)
|
||||
|
||||
typedef struct _DIR {
|
||||
struct dirent buffer;
|
||||
HDIR handle;
|
||||
APIRET ulrc;
|
||||
} DIR;
|
||||
|
||||
extern DIR *opendir(char *path);
|
||||
extern struct dirent *readdir(DIR *dirp);
|
||||
extern int closedir(DIR *dirp);
|
||||
#endif
|
||||
|
||||
#endif /* DIRPORT__H */
|
||||
|
||||
/*
|
||||
* This file is part of VICE, the Versatile Commodore Emulator.
|
||||
* See README for copyright notice.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef VICE_DIRPORT_H
|
||||
#define VICE_DIRPORT_H
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef _A_VOLID
|
||||
#define _A_VOLID 0
|
||||
#endif
|
||||
|
||||
#ifndef _A_NORMAL
|
||||
#define _A_NORMAL FILE_NORMAL
|
||||
#endif
|
||||
|
||||
#ifndef _A_RDONLY
|
||||
#define _A_RDONLY FILE_READONLY
|
||||
#endif
|
||||
|
||||
#ifndef _A_HIDDEN
|
||||
#define _A_HIDDEN FILE_HIDDEN
|
||||
#endif
|
||||
|
||||
#ifndef _A_SYSTEM
|
||||
#define _A_SYSTEM FILE_SYSTEM
|
||||
#endif
|
||||
|
||||
#ifndef _A_SUBDIR
|
||||
#define _A_SUBDIR FILE_DIRECTORY
|
||||
#endif
|
||||
|
||||
#ifndef _A_ARCH
|
||||
#define _A_ARCH FILE_ARCHIVED
|
||||
#endif
|
||||
|
||||
#define _A_ANY FILE_NORMAL | FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED
|
||||
|
||||
#ifndef EPERM
|
||||
#define EPERM EDOM // Operation not permitted = Domain Error
|
||||
#endif
|
||||
|
||||
#define dirent _FILEFINDBUF3
|
||||
#define d_name achName /* For struct dirent portability */
|
||||
#define d_size cbFile
|
||||
|
||||
#define mkdir(name, mode) mkdir(name)
|
||||
|
||||
#ifndef WATCOM_COMPILE
|
||||
#define S_ISDIR(mode) ((mode) & S_IFDIR)
|
||||
|
||||
typedef struct _DIR {
|
||||
struct dirent buffer;
|
||||
HDIR handle;
|
||||
APIRET ulrc;
|
||||
} DIR;
|
||||
|
||||
extern DIR *opendir(char *path);
|
||||
extern struct dirent *readdir(DIR *dirp);
|
||||
extern int closedir(DIR *dirp);
|
||||
#endif
|
||||
|
||||
#endif /* DIRPORT__H */
|
||||
|
|
|
@ -1,302 +1,304 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements AARP, a necessary protocol for ELAP communication. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include "../defc.h"
|
||||
#include "atbridge.h"
|
||||
#include "elap.h"
|
||||
#include "port.h"
|
||||
#include "elap_defs.h"
|
||||
#include "aarp.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#elif __linux__
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
struct amt_entry_t
|
||||
{
|
||||
struct at_addr_t protocol;
|
||||
struct ether_addr_t hardware;
|
||||
|
||||
struct amt_entry_t* next;
|
||||
};
|
||||
|
||||
typedef struct amt_entry_t* amt_t;
|
||||
|
||||
static amt_t amt = 0;
|
||||
|
||||
static unsigned int retry_count;
|
||||
static clock_t retry_timer;
|
||||
|
||||
|
||||
void aarp_init()
|
||||
{
|
||||
aarp_retry_reset();
|
||||
}
|
||||
|
||||
void aarp_shutdown()
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
while (entry)
|
||||
{
|
||||
struct amt_entry_t* next = entry->next;
|
||||
free(entry);
|
||||
entry = next;
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
static void aarp_send_packet(enum AARP_FUNCTION function, const struct at_addr_t* source_at_addr, const struct at_addr_t* dest_at_addr, const struct ether_addr_t* dest_hw_addr)
|
||||
{
|
||||
if (source_at_addr && dest_at_addr && dest_hw_addr)
|
||||
{
|
||||
struct aarp_header_t response;
|
||||
response.hardware_type = htons(AARP_HARDWARE_ETHER);
|
||||
response.protocol_type = htons(AARP_PROTOCOL_TYPE);
|
||||
response.hw_addr_len = AARP_HW_ADDR_LEN;
|
||||
response.protocol_addr_len = AARP_PROTOCOL_ADDR_LEN;
|
||||
response.function = htons(function);
|
||||
|
||||
memcpy(&response.source_proto_addr.addr, source_at_addr, sizeof(response.source_proto_addr.addr));
|
||||
response.source_proto_addr.addr.network = htons(response.source_proto_addr.addr.network);
|
||||
response.source_proto_addr.zero = 0x00;
|
||||
|
||||
memcpy(&response.dest_proto_addr.addr, dest_at_addr, sizeof(response.dest_proto_addr.addr));
|
||||
response.dest_proto_addr.addr.network = htons(response.dest_proto_addr.addr.network);
|
||||
response.dest_proto_addr.zero = 0x00;
|
||||
|
||||
memcpy(response.source_hw_addr.mac, elap_get_mac()->mac, sizeof(response.source_hw_addr.mac));
|
||||
|
||||
memcpy(response.dest_hw_addr.mac, &dest_hw_addr->mac, sizeof(response.dest_hw_addr.mac));
|
||||
|
||||
if (dest_hw_addr == &HW_ZERO)
|
||||
elap_send(&HW_APPLETALK_BROADCAST, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
|
||||
else
|
||||
elap_send(&response.dest_hw_addr, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
|
||||
}
|
||||
}
|
||||
|
||||
void aarp_probe(const struct at_addr_t* addr)
|
||||
{
|
||||
if (addr)
|
||||
{
|
||||
aarp_send_packet(AARP_FUNCTION_PROBE, addr, addr, &HW_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
static void aarp_request(const struct at_addr_t* addr)
|
||||
{
|
||||
if (addr)
|
||||
{
|
||||
aarp_send_packet(AARP_FUNCTION_REQUEST, atbridge_get_addr(), addr, &HW_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
static struct amt_entry_t* amt_lookup_entry_hardware(const struct ether_addr_t* hardware)
|
||||
{
|
||||
if (hardware)
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
while (entry)
|
||||
{
|
||||
if (memcmp(&entry->hardware, hardware, sizeof(entry->hardware)) == 0)
|
||||
return entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct amt_entry_t* amt_lookup_entry_protocol(const struct at_addr_t* protocol)
|
||||
{
|
||||
if (protocol)
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
while (entry)
|
||||
{
|
||||
if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0)
|
||||
return entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void amt_delete_entry_protocol(const struct at_addr_t* protocol)
|
||||
{
|
||||
if (protocol)
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
struct amt_entry_t* previous = amt;
|
||||
while (entry)
|
||||
{
|
||||
if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0)
|
||||
{
|
||||
previous->next = entry->next;
|
||||
free(entry);
|
||||
break;
|
||||
}
|
||||
previous = entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void amt_add(const struct at_addr_t* protocol, const struct ether_addr_t* hardware)
|
||||
{
|
||||
// Does an entry matching one of the protocol or hardware addresses exist? If so, update it.
|
||||
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
|
||||
if (entry)
|
||||
{
|
||||
memcpy(&entry->hardware, hardware, sizeof(entry->hardware));
|
||||
return;
|
||||
}
|
||||
|
||||
entry = amt_lookup_entry_hardware(hardware);
|
||||
if (entry)
|
||||
{
|
||||
memcpy(&entry->protocol, protocol, sizeof(entry->protocol));
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, add a new entry.
|
||||
entry = (struct amt_entry_t*)malloc(sizeof(struct amt_entry_t));
|
||||
memcpy(&entry->hardware, hardware, sizeof(entry->hardware));
|
||||
memcpy(&entry->protocol, protocol, sizeof(entry->protocol));
|
||||
entry->next = amt;
|
||||
amt = entry;
|
||||
}
|
||||
|
||||
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol)
|
||||
{
|
||||
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
|
||||
if (entry)
|
||||
{
|
||||
aarp_retry_reset();
|
||||
return (const struct ether_addr_t*)&entry->hardware;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The AMT doesn't have this protocol address so issue a request at no more than the AARP_PROBE_INTERVAL period.
|
||||
if (((clock() - retry_timer) >= (AARP_REQUEST_INTERVAL * CLOCKS_PER_SEC / 1000)) &&
|
||||
(retry_count > 0))
|
||||
{
|
||||
aarp_request(protocol);
|
||||
|
||||
retry_count--;
|
||||
retry_timer = clock();
|
||||
|
||||
//atbridge_printf("AARP request count %d timer %d.\n", retry_count, retry_timer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware)
|
||||
{
|
||||
struct amt_entry_t* entry = amt_lookup_entry_hardware(hardware);
|
||||
if (entry)
|
||||
return (const struct at_addr_t*)&entry->protocol;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool aarp_retry()
|
||||
{
|
||||
return retry_count > 0;
|
||||
}
|
||||
|
||||
void aarp_retry_reset()
|
||||
{
|
||||
retry_count = AARP_REQUEST_COUNT;
|
||||
retry_timer = clock();
|
||||
}
|
||||
|
||||
void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware)
|
||||
{
|
||||
amt_add(protocol, hardware);
|
||||
}
|
||||
|
||||
bool aarp_address_used(const struct at_addr_t* protocol)
|
||||
{
|
||||
// reference 2-8
|
||||
if (protocol)
|
||||
{
|
||||
// Check for reserved node numbers, per reference 3-9.
|
||||
if (protocol->node == 0x00 || protocol->node == 0xfe || protocol->node == 0xff)
|
||||
return true;
|
||||
|
||||
// Look for the address in the AMT. If it's there, another node is using this address.
|
||||
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
|
||||
if (entry)
|
||||
return true;
|
||||
|
||||
// Try a probe. If this address is in use, another node will reply with an AARP RESPONSE packet.
|
||||
// Return true to advise the caller that the address is not known to be in use. The caller should
|
||||
// retry aarp_try_address() every 200 ms (AARP_PROBE_INTERVAL) and 10 times (AARP_PROBE_COUNT),
|
||||
// per the AARP protocol definition, before choosing this address.
|
||||
aarp_probe(protocol);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
void aarp_handle_packet(const struct aarp_header_t* aarp)
|
||||
{
|
||||
if (aarp &&
|
||||
aarp->hardware_type == AARP_HARDWARE_ETHER &&
|
||||
aarp->protocol_type == AARP_PROTOCOL_TYPE &&
|
||||
aarp->hw_addr_len == AARP_HW_ADDR_LEN &&
|
||||
aarp->protocol_addr_len == AARP_PROTOCOL_ADDR_LEN)
|
||||
{
|
||||
switch (aarp->function)
|
||||
{
|
||||
case AARP_FUNCTION_REQUEST:
|
||||
if (((aarp->dest_proto_addr.addr.network == atbridge_get_net()) ||
|
||||
(aarp->dest_proto_addr.addr.network == 0x00 /* reference 4-6 */)) &&
|
||||
(aarp->dest_proto_addr.addr.node == atbridge_get_node()))
|
||||
{
|
||||
// Generate a response for the AARP request.
|
||||
aarp_send_packet(AARP_FUNCTION_RESPONSE, &aarp->dest_proto_addr.addr, &aarp->source_proto_addr.addr, &aarp->source_hw_addr);
|
||||
}
|
||||
break;
|
||||
case AARP_FUNCTION_RESPONSE:
|
||||
aarp_glean(&aarp->source_proto_addr.addr, &aarp->source_hw_addr);
|
||||
aarp_glean(&aarp->dest_proto_addr.addr, &aarp->dest_hw_addr);
|
||||
break;
|
||||
case AARP_FUNCTION_PROBE:
|
||||
// AMT entry aging, method 2, reference 2-11
|
||||
amt_delete_entry_protocol(&aarp->dest_proto_addr.addr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements AARP, a necessary protocol for ELAP communication. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include "../defc.h"
|
||||
#include "atbridge.h"
|
||||
#include "elap.h"
|
||||
#include "port.h"
|
||||
#include "elap_defs.h"
|
||||
#include "aarp.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#elif __linux__
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
struct amt_entry_t
|
||||
{
|
||||
struct at_addr_t protocol;
|
||||
struct ether_addr_t hardware;
|
||||
|
||||
struct amt_entry_t* next;
|
||||
};
|
||||
|
||||
typedef struct amt_entry_t* amt_t;
|
||||
|
||||
static amt_t amt = 0;
|
||||
|
||||
static unsigned int retry_count;
|
||||
static clock_t retry_timer;
|
||||
|
||||
|
||||
void aarp_init()
|
||||
{
|
||||
aarp_retry_reset();
|
||||
}
|
||||
|
||||
void aarp_shutdown()
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
while (entry)
|
||||
{
|
||||
struct amt_entry_t* next = entry->next;
|
||||
free(entry);
|
||||
entry = next;
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
static void aarp_send_packet(enum AARP_FUNCTION function, const struct at_addr_t* source_at_addr, const struct at_addr_t* dest_at_addr, const struct ether_addr_t* dest_hw_addr)
|
||||
{
|
||||
if (source_at_addr && dest_at_addr && dest_hw_addr)
|
||||
{
|
||||
struct aarp_header_t response;
|
||||
response.hardware_type = htons(AARP_HARDWARE_ETHER);
|
||||
response.protocol_type = htons(AARP_PROTOCOL_TYPE);
|
||||
response.hw_addr_len = AARP_HW_ADDR_LEN;
|
||||
response.protocol_addr_len = AARP_PROTOCOL_ADDR_LEN;
|
||||
response.function = htons(function);
|
||||
|
||||
memcpy(&response.source_proto_addr.addr, source_at_addr, sizeof(response.source_proto_addr.addr));
|
||||
response.source_proto_addr.addr.network = htons(response.source_proto_addr.addr.network);
|
||||
response.source_proto_addr.zero = 0x00;
|
||||
|
||||
memcpy(&response.dest_proto_addr.addr, dest_at_addr, sizeof(response.dest_proto_addr.addr));
|
||||
response.dest_proto_addr.addr.network = htons(response.dest_proto_addr.addr.network);
|
||||
response.dest_proto_addr.zero = 0x00;
|
||||
|
||||
memcpy(response.source_hw_addr.mac, elap_get_mac()->mac, sizeof(response.source_hw_addr.mac));
|
||||
|
||||
memcpy(response.dest_hw_addr.mac, &dest_hw_addr->mac, sizeof(response.dest_hw_addr.mac));
|
||||
|
||||
if (dest_hw_addr == &HW_ZERO)
|
||||
elap_send(&HW_APPLETALK_BROADCAST, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
|
||||
else
|
||||
elap_send(&response.dest_hw_addr, &SNAP_AARP, sizeof(struct aarp_header_t), (byte*)&response);
|
||||
}
|
||||
}
|
||||
|
||||
void aarp_probe(const struct at_addr_t* addr)
|
||||
{
|
||||
if (addr)
|
||||
{
|
||||
aarp_send_packet(AARP_FUNCTION_PROBE, addr, addr, &HW_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
static void aarp_request(const struct at_addr_t* addr)
|
||||
{
|
||||
if (addr)
|
||||
{
|
||||
aarp_send_packet(AARP_FUNCTION_REQUEST, atbridge_get_addr(), addr, &HW_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
static struct amt_entry_t* amt_lookup_entry_hardware(const struct ether_addr_t* hardware)
|
||||
{
|
||||
if (hardware)
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
while (entry)
|
||||
{
|
||||
if (memcmp(&entry->hardware, hardware, sizeof(entry->hardware)) == 0)
|
||||
return entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct amt_entry_t* amt_lookup_entry_protocol(const struct at_addr_t* protocol)
|
||||
{
|
||||
if (protocol)
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
while (entry)
|
||||
{
|
||||
if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0)
|
||||
return entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void amt_delete_entry_protocol(const struct at_addr_t* protocol)
|
||||
{
|
||||
if (protocol)
|
||||
{
|
||||
struct amt_entry_t* entry = amt;
|
||||
struct amt_entry_t* previous = amt;
|
||||
while (entry)
|
||||
{
|
||||
if (memcmp(&entry->protocol, protocol, sizeof(entry->protocol)) == 0)
|
||||
{
|
||||
previous->next = entry->next;
|
||||
free(entry);
|
||||
break;
|
||||
}
|
||||
previous = entry;
|
||||
entry = entry->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void amt_add(const struct at_addr_t* protocol, const struct ether_addr_t* hardware)
|
||||
{
|
||||
// Does an entry matching one of the protocol or hardware addresses exist? If so, update it.
|
||||
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
|
||||
if (entry)
|
||||
{
|
||||
memcpy(&entry->hardware, hardware, sizeof(entry->hardware));
|
||||
return;
|
||||
}
|
||||
|
||||
entry = amt_lookup_entry_hardware(hardware);
|
||||
if (entry)
|
||||
{
|
||||
memcpy(&entry->protocol, protocol, sizeof(entry->protocol));
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, add a new entry.
|
||||
entry = (struct amt_entry_t*)malloc(sizeof(struct amt_entry_t));
|
||||
memcpy(&entry->hardware, hardware, sizeof(entry->hardware));
|
||||
memcpy(&entry->protocol, protocol, sizeof(entry->protocol));
|
||||
entry->next = amt;
|
||||
amt = entry;
|
||||
}
|
||||
|
||||
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol)
|
||||
{
|
||||
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
|
||||
if (entry)
|
||||
{
|
||||
aarp_retry_reset();
|
||||
return (const struct ether_addr_t*)&entry->hardware;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The AMT doesn't have this protocol address so issue a request at no more than the AARP_PROBE_INTERVAL period.
|
||||
if (((clock() - retry_timer) >= (AARP_REQUEST_INTERVAL * CLOCKS_PER_SEC / 1000)) &&
|
||||
(retry_count > 0))
|
||||
{
|
||||
aarp_request(protocol);
|
||||
|
||||
retry_count--;
|
||||
retry_timer = clock();
|
||||
|
||||
//atbridge_printf("AARP request count %d timer %d.\n", retry_count, retry_timer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware)
|
||||
{
|
||||
struct amt_entry_t* entry = amt_lookup_entry_hardware(hardware);
|
||||
if (entry)
|
||||
return (const struct at_addr_t*)&entry->protocol;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool aarp_retry()
|
||||
{
|
||||
return retry_count > 0;
|
||||
}
|
||||
|
||||
void aarp_retry_reset()
|
||||
{
|
||||
retry_count = AARP_REQUEST_COUNT;
|
||||
retry_timer = clock();
|
||||
}
|
||||
|
||||
void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware)
|
||||
{
|
||||
amt_add(protocol, hardware);
|
||||
}
|
||||
|
||||
bool aarp_address_used(const struct at_addr_t* protocol)
|
||||
{
|
||||
// reference 2-8
|
||||
if (protocol)
|
||||
{
|
||||
// Check for reserved node numbers, per reference 3-9.
|
||||
if (protocol->node == 0x00 || protocol->node == 0xfe || protocol->node == 0xff)
|
||||
return true;
|
||||
|
||||
// Look for the address in the AMT. If it's there, another node is using this address.
|
||||
struct amt_entry_t* entry = amt_lookup_entry_protocol(protocol);
|
||||
if (entry)
|
||||
return true;
|
||||
|
||||
// Try a probe. If this address is in use, another node will reply with an AARP RESPONSE packet.
|
||||
// Return true to advise the caller that the address is not known to be in use. The caller should
|
||||
// retry aarp_try_address() every 200 ms (AARP_PROBE_INTERVAL) and 10 times (AARP_PROBE_COUNT),
|
||||
// per the AARP protocol definition, before choosing this address.
|
||||
aarp_probe(protocol);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
void aarp_handle_packet(const struct aarp_header_t* aarp)
|
||||
{
|
||||
if (aarp &&
|
||||
aarp->hardware_type == AARP_HARDWARE_ETHER &&
|
||||
aarp->protocol_type == AARP_PROTOCOL_TYPE &&
|
||||
aarp->hw_addr_len == AARP_HW_ADDR_LEN &&
|
||||
aarp->protocol_addr_len == AARP_PROTOCOL_ADDR_LEN)
|
||||
{
|
||||
switch (aarp->function)
|
||||
{
|
||||
case AARP_FUNCTION_REQUEST:
|
||||
if (((aarp->dest_proto_addr.addr.network == atbridge_get_net()) ||
|
||||
(aarp->dest_proto_addr.addr.network == 0x00 /* reference 4-6 */)) &&
|
||||
(aarp->dest_proto_addr.addr.node == atbridge_get_node()))
|
||||
{
|
||||
// Generate a response for the AARP request.
|
||||
aarp_send_packet(AARP_FUNCTION_RESPONSE, &aarp->dest_proto_addr.addr, &aarp->source_proto_addr.addr, &aarp->source_hw_addr);
|
||||
}
|
||||
break;
|
||||
case AARP_FUNCTION_RESPONSE:
|
||||
aarp_glean(&aarp->source_proto_addr.addr, &aarp->source_hw_addr);
|
||||
aarp_glean(&aarp->dest_proto_addr.addr, &aarp->dest_hw_addr);
|
||||
break;
|
||||
case AARP_FUNCTION_PROBE:
|
||||
// AMT entry aging, method 2, reference 2-11
|
||||
amt_delete_entry_protocol(&aarp->dest_proto_addr.addr);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,39 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
struct at_addr_t;
|
||||
struct aarp_header_t;
|
||||
struct ether_addr_t;
|
||||
|
||||
void aarp_init();
|
||||
void aarp_shutdown();
|
||||
|
||||
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol);
|
||||
const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware);
|
||||
|
||||
bool aarp_retry();
|
||||
void aarp_retry_reset();
|
||||
|
||||
void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware);
|
||||
|
||||
bool aarp_address_used(const struct at_addr_t* protocol);
|
||||
|
||||
void aarp_handle_packet(const struct aarp_header_t* aarp);
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
struct at_addr_t;
|
||||
struct aarp_header_t;
|
||||
struct ether_addr_t;
|
||||
|
||||
void aarp_init();
|
||||
void aarp_shutdown();
|
||||
|
||||
const struct ether_addr_t* aarp_request_hardware(const struct at_addr_t* protocol);
|
||||
const struct at_addr_t* aarp_request_protocol(const struct ether_addr_t* hardware);
|
||||
|
||||
bool aarp_retry();
|
||||
void aarp_retry_reset();
|
||||
|
||||
void aarp_glean(const struct at_addr_t* protocol, const struct ether_addr_t* hardware);
|
||||
|
||||
bool aarp_address_used(const struct at_addr_t* protocol);
|
||||
|
||||
void aarp_handle_packet(const struct aarp_header_t* aarp);
|
||||
|
|
|
@ -1,137 +1,139 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
typedef byte at_node_t;
|
||||
static const at_node_t at_broadcast_node = 0xFF;
|
||||
|
||||
typedef word16 at_network_t;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct at_addr_t
|
||||
{
|
||||
at_network_t network;
|
||||
at_node_t node;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
enum LAP_TYPES { /* reference C-6 */
|
||||
LAP_DDP_SHORT = 0x01,
|
||||
LAP_DDP_LONG = 0x02
|
||||
};
|
||||
|
||||
enum DDP_SOCKETS { /* reference C-7 */
|
||||
DDP_SOCKET_INVALID_00 = 0x00,
|
||||
DDP_SOCKET_RTMP = 0x01,
|
||||
DDP_SOCKET_NIS = 0x02,
|
||||
DDP_SOCKET_ECHO = 0x04,
|
||||
DDP_SOCKET_ZIS = 0x06,
|
||||
DDP_SOCKET_INVALID_FF = 0xFF,
|
||||
};
|
||||
|
||||
enum DDP_TYPES { /* reference C-6 */
|
||||
DDP_TYPE_INVALID = 0x00,
|
||||
DDP_TYPE_RTMP = 0x01,
|
||||
DDP_TYPE_NBP = 0x02,
|
||||
DDP_TYPE_ATP = 0x03,
|
||||
DDP_TYPE_AEP = 0x04,
|
||||
DDP_TYPE_RTMP_REQUEST = 0x05,
|
||||
DDP_TYPE_ZIP = 0x06,
|
||||
DDP_TYPE_ADSP = 0x07,
|
||||
DDP_TYPE_RESERVED_08 = 0x08,
|
||||
DDP_TYPE_RESERVED_09 = 0x09,
|
||||
DDP_TYPE_RESERVED_0A = 0x0A,
|
||||
DDP_TYPE_RESERVED_0B = 0x0B,
|
||||
DDP_TYPE_RESERVED_0C = 0x0C,
|
||||
DDP_TYPE_RESERVED_0D = 0x0D,
|
||||
DDP_TYPE_RESERVED_0E = 0x0E,
|
||||
DDP_TYPE_RESERVED_0F = 0x0F
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct DDP_LONG
|
||||
{
|
||||
byte length[2];
|
||||
word16 checksum;
|
||||
at_network_t dest_net;
|
||||
at_network_t source_net;
|
||||
at_node_t dest_node;
|
||||
at_node_t source_node;
|
||||
byte dest_socket;
|
||||
byte source_socket;
|
||||
byte type;
|
||||
};
|
||||
|
||||
struct DDP_SHORT
|
||||
{
|
||||
byte length[2];
|
||||
byte dest_socket;
|
||||
byte source_socket;
|
||||
byte type;
|
||||
};
|
||||
|
||||
enum RTMP_FUNCTIONS { /* reference C-8*/
|
||||
RTMP_FUNCTION_REQUEST = 0x01,
|
||||
RTMP_FUNCTION_RDR_SPLIT = 0x02,
|
||||
RTMP_FUNCTION_RDR_NO_SPLIT = 0x03
|
||||
};
|
||||
|
||||
struct rtmp_request_t
|
||||
{
|
||||
byte function;
|
||||
};
|
||||
|
||||
struct rtmp_nonextended_data_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte id_length;
|
||||
at_node_t node;
|
||||
word16 zero;
|
||||
byte delimiter;
|
||||
};
|
||||
|
||||
struct rtmp_nonextended_response_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte id_length;
|
||||
at_node_t node;
|
||||
};
|
||||
|
||||
struct rtmp_extended_data_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte id_length;
|
||||
at_node_t node;
|
||||
};
|
||||
|
||||
struct rtmp_nonextended_tuple_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte distance;
|
||||
};
|
||||
|
||||
struct rtmp_extended_tuple_t
|
||||
{
|
||||
at_network_t range_start;
|
||||
byte distance;
|
||||
at_network_t range_end;
|
||||
byte delimiter;
|
||||
};
|
||||
|
||||
static const byte RTMP_TUPLE_DELIMITER = 0x82;
|
||||
#pragma pack(pop)
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
typedef byte at_node_t;
|
||||
static const at_node_t at_broadcast_node = 0xFF;
|
||||
|
||||
typedef word16 at_network_t;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct at_addr_t
|
||||
{
|
||||
at_network_t network;
|
||||
at_node_t node;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
enum LAP_TYPES { /* reference C-6 */
|
||||
LAP_DDP_SHORT = 0x01,
|
||||
LAP_DDP_LONG = 0x02
|
||||
};
|
||||
|
||||
enum DDP_SOCKETS { /* reference C-7 */
|
||||
DDP_SOCKET_INVALID_00 = 0x00,
|
||||
DDP_SOCKET_RTMP = 0x01,
|
||||
DDP_SOCKET_NIS = 0x02,
|
||||
DDP_SOCKET_ECHO = 0x04,
|
||||
DDP_SOCKET_ZIS = 0x06,
|
||||
DDP_SOCKET_INVALID_FF = 0xFF,
|
||||
};
|
||||
|
||||
enum DDP_TYPES { /* reference C-6 */
|
||||
DDP_TYPE_INVALID = 0x00,
|
||||
DDP_TYPE_RTMP = 0x01,
|
||||
DDP_TYPE_NBP = 0x02,
|
||||
DDP_TYPE_ATP = 0x03,
|
||||
DDP_TYPE_AEP = 0x04,
|
||||
DDP_TYPE_RTMP_REQUEST = 0x05,
|
||||
DDP_TYPE_ZIP = 0x06,
|
||||
DDP_TYPE_ADSP = 0x07,
|
||||
DDP_TYPE_RESERVED_08 = 0x08,
|
||||
DDP_TYPE_RESERVED_09 = 0x09,
|
||||
DDP_TYPE_RESERVED_0A = 0x0A,
|
||||
DDP_TYPE_RESERVED_0B = 0x0B,
|
||||
DDP_TYPE_RESERVED_0C = 0x0C,
|
||||
DDP_TYPE_RESERVED_0D = 0x0D,
|
||||
DDP_TYPE_RESERVED_0E = 0x0E,
|
||||
DDP_TYPE_RESERVED_0F = 0x0F
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct DDP_LONG
|
||||
{
|
||||
byte length[2];
|
||||
word16 checksum;
|
||||
at_network_t dest_net;
|
||||
at_network_t source_net;
|
||||
at_node_t dest_node;
|
||||
at_node_t source_node;
|
||||
byte dest_socket;
|
||||
byte source_socket;
|
||||
byte type;
|
||||
};
|
||||
|
||||
struct DDP_SHORT
|
||||
{
|
||||
byte length[2];
|
||||
byte dest_socket;
|
||||
byte source_socket;
|
||||
byte type;
|
||||
};
|
||||
|
||||
enum RTMP_FUNCTIONS { /* reference C-8*/
|
||||
RTMP_FUNCTION_REQUEST = 0x01,
|
||||
RTMP_FUNCTION_RDR_SPLIT = 0x02,
|
||||
RTMP_FUNCTION_RDR_NO_SPLIT = 0x03
|
||||
};
|
||||
|
||||
struct rtmp_request_t
|
||||
{
|
||||
byte function;
|
||||
};
|
||||
|
||||
struct rtmp_nonextended_data_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte id_length;
|
||||
at_node_t node;
|
||||
word16 zero;
|
||||
byte delimiter;
|
||||
};
|
||||
|
||||
struct rtmp_nonextended_response_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte id_length;
|
||||
at_node_t node;
|
||||
};
|
||||
|
||||
struct rtmp_extended_data_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte id_length;
|
||||
at_node_t node;
|
||||
};
|
||||
|
||||
struct rtmp_nonextended_tuple_t
|
||||
{
|
||||
at_network_t net;
|
||||
byte distance;
|
||||
};
|
||||
|
||||
struct rtmp_extended_tuple_t
|
||||
{
|
||||
at_network_t range_start;
|
||||
byte distance;
|
||||
at_network_t range_end;
|
||||
byte delimiter;
|
||||
};
|
||||
|
||||
static const byte RTMP_TUPLE_DELIMITER = 0x82;
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -1,426 +1,428 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module is the "heart" of the bridge and provides the connection between the ELAP and LLAP ports. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../defc.h"
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
#include "atbridge.h"
|
||||
#include "port.h"
|
||||
#include "elap.h"
|
||||
#include "llap.h"
|
||||
#include "aarp.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#elif __linux__
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
extern struct packet_port_t elap_port;
|
||||
|
||||
static bool diagnostics = false;
|
||||
static bool sent_rtmp_request = false;
|
||||
|
||||
static struct at_addr_t local_address = { 0, 0 };
|
||||
|
||||
static const at_network_t NET_STARTUP_LOW = 0xFF00;
|
||||
static const at_network_t NET_STARTUP_HIGH = 0xFFFE;
|
||||
static const at_node_t NODE_STARTUP_LOW = 0x01;
|
||||
static const at_node_t NODE_STARTUP_HIGH = 0xFE;
|
||||
|
||||
static void send_rtmp_request();
|
||||
|
||||
bool atbridge_init()
|
||||
{
|
||||
// If the GS reboots, we may try to reinitialize the bridge. If this is the case, keep the old address and AMT.
|
||||
if (local_address.network == 0)
|
||||
{
|
||||
// Obtain a provisional node address and startup range network.
|
||||
//
|
||||
// This isn't correct for an extended network (like ELAP) but works adequately on small networks.
|
||||
// The bridge should follow the complicated process on page 4-9 to obtain the network and node number.
|
||||
srand((unsigned int)time(0));
|
||||
local_address.network = (at_network_t)((double)rand()/RAND_MAX * (NET_STARTUP_HIGH - NET_STARTUP_LOW) + NET_STARTUP_LOW);
|
||||
local_address.node = (at_node_t)((double)rand()/RAND_MAX + (NODE_STARTUP_HIGH - NODE_STARTUP_LOW) + 0x01);
|
||||
|
||||
aarp_init();
|
||||
llap_init();
|
||||
if (!elap_init())
|
||||
{
|
||||
atbridge_shutdown();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void atbridge_shutdown()
|
||||
{
|
||||
llap_shutdown();
|
||||
elap_shutdown();
|
||||
aarp_shutdown();
|
||||
}
|
||||
|
||||
void atbridge_set_diagnostics(bool enabled)
|
||||
{
|
||||
diagnostics = enabled;
|
||||
}
|
||||
|
||||
bool atbridge_get_diagnostics()
|
||||
{
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
void atbridge_printf(const char *fmt, ...)
|
||||
{
|
||||
if (atbridge_get_diagnostics())
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
const struct at_addr_t* atbridge_get_addr()
|
||||
{
|
||||
return &local_address;
|
||||
}
|
||||
|
||||
const at_network_t atbridge_get_net()
|
||||
{
|
||||
return local_address.network;
|
||||
}
|
||||
|
||||
const at_node_t atbridge_get_node()
|
||||
{
|
||||
return local_address.node;
|
||||
}
|
||||
|
||||
void atbridge_set_net(at_network_t net)
|
||||
{
|
||||
local_address.network = net;
|
||||
}
|
||||
|
||||
void atbridge_set_node(at_node_t node)
|
||||
{
|
||||
local_address.node = node;
|
||||
}
|
||||
|
||||
bool atbridge_address_used(const struct at_addr_t* addr)
|
||||
{
|
||||
if (!sent_rtmp_request)
|
||||
send_rtmp_request();
|
||||
return aarp_address_used(addr);
|
||||
}
|
||||
|
||||
/* Calculate a DDP checksum, per Apple's documented algorithm in 4-17 of "Inside AppleTalk". */
|
||||
static word16 get_checksum(size_t size, byte data[])
|
||||
{
|
||||
word16 cksum = 0;
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
cksum += data[i];
|
||||
cksum = (cksum << 1) | ((cksum & 0x8000) >> 15); // roll left
|
||||
}
|
||||
if (cksum == 0)
|
||||
cksum = 0xffff;
|
||||
return cksum;
|
||||
}
|
||||
|
||||
static void calculate_checksum(struct packet_t* packet)
|
||||
{
|
||||
if (packet && packet->data && (packet->size >= sizeof(struct DDP_LONG)) && (packet->type == LAP_DDP_LONG))
|
||||
{
|
||||
struct DDP_LONG* header = (struct DDP_LONG*)(packet->data);
|
||||
header->checksum = htons(get_checksum(
|
||||
packet->size - offsetof(struct DDP_LONG, dest_net),
|
||||
(byte*)&header->dest_net));
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert a long-form DDP header to a short-form header. This function only converts the headers. */
|
||||
static word16 convert_ddp_header_to_short(const struct DDP_LONG* in, struct DDP_SHORT* out)
|
||||
{
|
||||
word16 size;
|
||||
|
||||
if (!in || !out)
|
||||
return 0;
|
||||
|
||||
size = ((in->length[0] & 0x3) << 8) + (in->length[1]) - (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT));
|
||||
|
||||
out->length[0] = (size >> 8) & 0x03;
|
||||
out->length[1] = size & 0xff;
|
||||
|
||||
out->dest_socket = in->dest_socket;
|
||||
out->source_socket = in->source_socket;
|
||||
|
||||
out->type = in->type;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Convert a short-form DDP header to a long-form header. ELAP requires long-form, but LLAP often uses short-form. */
|
||||
/* This function only converts the headers. */
|
||||
static word16 convert_ddp_header_to_long(const struct at_addr_t dest, const struct at_addr_t source, const struct DDP_SHORT* in, struct DDP_LONG* out)
|
||||
{
|
||||
word16 size;
|
||||
|
||||
if (!in || !out)
|
||||
return 0;
|
||||
|
||||
size = ((in->length[0] & 0x3) << 8) + (in->length[1]) + (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT));
|
||||
out->length[0] = (size >> 8) & 0x03;
|
||||
out->length[1] = size & 0xff;
|
||||
|
||||
out->checksum = 0x0000; /* 0x0000 == no checksum calculated, reference 4-17 */
|
||||
|
||||
if (dest.network)
|
||||
out->dest_net = dest.network;
|
||||
else
|
||||
out->dest_net = atbridge_get_net();
|
||||
out->dest_net = (at_network_t)htons(out->dest_net);
|
||||
|
||||
if (source.network)
|
||||
out->source_net = source.network;
|
||||
else
|
||||
out->source_net = atbridge_get_net();
|
||||
out->source_net = (at_network_t)htons(out->source_net);
|
||||
|
||||
out->dest_node = dest.node;
|
||||
out->source_node = source.node;
|
||||
|
||||
out->dest_socket = in->dest_socket;
|
||||
out->source_socket = in->source_socket;
|
||||
|
||||
out->type = in->type;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Convert a short-form DDP packet to a long-form packet. */
|
||||
/* This function converts an entire packet, not just the header. */
|
||||
static void convert_ddp_packet_to_long(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_SHORT) && packet->data && (packet->size >= sizeof(struct DDP_SHORT)))
|
||||
{
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data;
|
||||
|
||||
const size_t payload_size = packet->size - sizeof(struct DDP_SHORT);
|
||||
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_LONG));
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)data;
|
||||
|
||||
const word16 size = convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long);
|
||||
packet->dest.network = ntohs(header_long->dest_net);
|
||||
packet->source.network = ntohs(header_long->source_net);
|
||||
|
||||
memcpy(data + sizeof(struct DDP_LONG), packet->data + sizeof(struct DDP_SHORT), payload_size);
|
||||
|
||||
packet->type = LAP_DDP_LONG;
|
||||
packet->size = size;
|
||||
|
||||
// Replace the original short-form packet data.
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
|
||||
calculate_checksum(packet);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert a long-form DDP packet to short-form. */
|
||||
static void convert_ddp_packet_to_short(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
|
||||
{
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
|
||||
|
||||
const size_t payload_size = packet->size - sizeof(struct DDP_LONG);
|
||||
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_SHORT));
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)data;
|
||||
|
||||
const word16 size = convert_ddp_header_to_short(header_long, header_short);
|
||||
|
||||
memcpy(data + sizeof(struct DDP_SHORT), packet->data + sizeof(struct DDP_LONG), payload_size);
|
||||
|
||||
packet->type = LAP_DDP_SHORT;
|
||||
packet->size = size;
|
||||
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
}
|
||||
}
|
||||
|
||||
/*static void convert_rtmp_to_extended(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_SHORT) && packet->data)
|
||||
{
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data;
|
||||
if (header_short->type != DDP_TYPE_RTMP || header_short->dest_socket != DDP_SOCKET_RTMP)
|
||||
return;
|
||||
|
||||
struct rtmp_nonextended_data_t* in = (struct rtmp_nonextended_data_t*)(packet->data + sizeof(struct DDP_SHORT));
|
||||
|
||||
// Construct a new long-form DDP packet header.
|
||||
size_t size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_extended_data_t);
|
||||
byte* data = (byte*)malloc(size);
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)data;
|
||||
convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long);
|
||||
|
||||
struct rtmp_extended_data_t* out = (struct rtmp_extended_data_t*)(data + sizeof(struct DDP_LONG));
|
||||
out->net = in->net;
|
||||
out->id_length = in->id_length;
|
||||
out->node = in->node;
|
||||
|
||||
// Copy the routing tuples.
|
||||
struct rtmp_nonextended_tuple_t* in_tuple = (struct rtmp_nonextended_tuple_t*)(packet->data + sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_data_t));
|
||||
struct rtmp_extended_tuple_t* out_tuple = (struct rtmp_extended_tuple_t*)(data + size);
|
||||
while ((byte*)in_tuple < (packet->data + packet->size))
|
||||
{
|
||||
size += sizeof(struct rtmp_extended_tuple_t);
|
||||
realloc(data, size);
|
||||
out_tuple->range_start = in_tuple->net;
|
||||
out_tuple->distance = in_tuple->distance | 0x80;
|
||||
out_tuple->range_end = in_tuple->net;
|
||||
out_tuple->delimiter = RTMP_TUPLE_DELIMITER;
|
||||
in_tuple++;
|
||||
}
|
||||
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
packet->size = size;
|
||||
packet->type = LAP_DDP_LONG;
|
||||
}
|
||||
}*/
|
||||
|
||||
static void convert_rtmp_to_nonextended(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
|
||||
{
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
|
||||
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP)
|
||||
return;
|
||||
|
||||
struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG));
|
||||
|
||||
size_t size = sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_response_t);
|
||||
byte* data = (byte*)malloc(size);
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)data;
|
||||
convert_ddp_header_to_short(header_long, header_short);
|
||||
header_short->length[0] = (size >> 8) & 0x03;
|
||||
header_short->length[1] = size & 0xff;
|
||||
|
||||
struct rtmp_nonextended_response_t* out = (struct rtmp_nonextended_response_t*)(data + sizeof(struct DDP_SHORT));
|
||||
out->net = in->net;
|
||||
out->id_length = in->id_length;
|
||||
out->node = in->node;
|
||||
|
||||
/*rtmp_extended_tuple_t* in_tuple = (rtmp_extended_tuple_t*)(packet->data + sizeof(DDP_LONG) + sizeof(rtmp_extended_data_t));
|
||||
rtmp_nonextended_tuple_t* out_tuple = (rtmp_nonextended_tuple_t*)(data + size);
|
||||
while ((byte*)in_tuple < (packet->data + packet->size))
|
||||
{
|
||||
size += sizeof(rtmp_nonextended_tuple_t);
|
||||
realloc(data, size);
|
||||
out_tuple->net = in_tuple->range_start;
|
||||
out_tuple->distance = in_tuple->distance & 0x7f;
|
||||
in_tuple++;
|
||||
}*/
|
||||
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
packet->size = size;
|
||||
packet->type = LAP_DDP_SHORT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Learn our network number from RTMP packets. */
|
||||
/* "Inside AppleTalk", section 4-8, describes this approach for non-extended networks.
|
||||
Technically, we probably should be doing the more complicated extended network approach (also on 4-8),
|
||||
but the easy approach using RTMP seems adequate for now. */
|
||||
static void glean_net_from_rtmp(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
|
||||
{
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
|
||||
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP)
|
||||
return;
|
||||
|
||||
struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG));
|
||||
|
||||
atbridge_set_net(ntohs(in->net));
|
||||
}
|
||||
}
|
||||
|
||||
static void send_rtmp_request()
|
||||
{
|
||||
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
|
||||
packet->type = LAP_DDP_LONG;
|
||||
packet->dest.network = atbridge_get_net();
|
||||
packet->dest.node = 255;
|
||||
packet->source.network = atbridge_get_net();
|
||||
packet->source.node = atbridge_get_node();
|
||||
packet->next = 0;
|
||||
packet->size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_request_t);
|
||||
packet->data = (byte*)malloc(packet->size);
|
||||
|
||||
struct DDP_LONG* header = (struct DDP_LONG*)packet->data;
|
||||
header->type = DDP_TYPE_RTMP_REQUEST;
|
||||
header->source_net = htons(packet->source.network);
|
||||
header->source_node = packet->source.node;
|
||||
header->source_socket = DDP_SOCKET_RTMP;
|
||||
header->dest_net = htons(packet->dest.network);
|
||||
header->dest_node = packet->dest.node;
|
||||
header->dest_socket = DDP_SOCKET_RTMP;
|
||||
header->length[0] = (packet->size >> 8) & 0x03;
|
||||
header->length[1] = packet->size & 0xff;
|
||||
|
||||
struct rtmp_request_t* request = (struct rtmp_request_t*)(packet->data + sizeof(struct DDP_LONG));
|
||||
request->function = RTMP_FUNCTION_REQUEST;
|
||||
|
||||
calculate_checksum(packet);
|
||||
|
||||
elap_enqueue_out(packet);
|
||||
sent_rtmp_request = true;
|
||||
}
|
||||
|
||||
void atbridge_process()
|
||||
{
|
||||
elap_process();
|
||||
//llap_process();
|
||||
|
||||
struct packet_t* packet = elap_dequeue_in();
|
||||
if (packet)
|
||||
{
|
||||
glean_net_from_rtmp(packet);
|
||||
convert_rtmp_to_nonextended(packet);
|
||||
// The GS should understand long-form DDP, but converting to short-form ought to slightly improve performance (fewer bytes for the GS to process).
|
||||
convert_ddp_packet_to_short(packet);
|
||||
llap_enqueue_out(packet);
|
||||
}
|
||||
packet = llap_dequeue_in();
|
||||
if (packet)
|
||||
{
|
||||
// ELAP does not support short-form DDP, so convert such packets to long-form.
|
||||
convert_ddp_packet_to_long(packet);
|
||||
elap_enqueue_out(packet);
|
||||
}
|
||||
}
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module is the "heart" of the bridge and provides the connection between the ELAP and LLAP ports. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../defc.h"
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
#include "atbridge.h"
|
||||
#include "port.h"
|
||||
#include "elap.h"
|
||||
#include "llap.h"
|
||||
#include "aarp.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#elif __linux__
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
extern struct packet_port_t elap_port;
|
||||
|
||||
static bool diagnostics = false;
|
||||
static bool sent_rtmp_request = false;
|
||||
|
||||
static struct at_addr_t local_address = { 0, 0 };
|
||||
|
||||
static const at_network_t NET_STARTUP_LOW = 0xFF00;
|
||||
static const at_network_t NET_STARTUP_HIGH = 0xFFFE;
|
||||
static const at_node_t NODE_STARTUP_LOW = 0x01;
|
||||
static const at_node_t NODE_STARTUP_HIGH = 0xFE;
|
||||
|
||||
static void send_rtmp_request();
|
||||
|
||||
bool atbridge_init()
|
||||
{
|
||||
// If the GS reboots, we may try to reinitialize the bridge. If this is the case, keep the old address and AMT.
|
||||
if (local_address.network == 0)
|
||||
{
|
||||
// Obtain a provisional node address and startup range network.
|
||||
//
|
||||
// This isn't correct for an extended network (like ELAP) but works adequately on small networks.
|
||||
// The bridge should follow the complicated process on page 4-9 to obtain the network and node number.
|
||||
srand((unsigned int)time(0));
|
||||
local_address.network = (at_network_t)((double)rand()/RAND_MAX * (NET_STARTUP_HIGH - NET_STARTUP_LOW) + NET_STARTUP_LOW);
|
||||
local_address.node = (at_node_t)((double)rand()/RAND_MAX + (NODE_STARTUP_HIGH - NODE_STARTUP_LOW) + 0x01);
|
||||
|
||||
aarp_init();
|
||||
llap_init();
|
||||
if (!elap_init())
|
||||
{
|
||||
atbridge_shutdown();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void atbridge_shutdown()
|
||||
{
|
||||
llap_shutdown();
|
||||
elap_shutdown();
|
||||
aarp_shutdown();
|
||||
}
|
||||
|
||||
void atbridge_set_diagnostics(bool enabled)
|
||||
{
|
||||
diagnostics = enabled;
|
||||
}
|
||||
|
||||
bool atbridge_get_diagnostics()
|
||||
{
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
void atbridge_printf(const char *fmt, ...)
|
||||
{
|
||||
if (atbridge_get_diagnostics())
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
const struct at_addr_t* atbridge_get_addr()
|
||||
{
|
||||
return &local_address;
|
||||
}
|
||||
|
||||
const at_network_t atbridge_get_net()
|
||||
{
|
||||
return local_address.network;
|
||||
}
|
||||
|
||||
const at_node_t atbridge_get_node()
|
||||
{
|
||||
return local_address.node;
|
||||
}
|
||||
|
||||
void atbridge_set_net(at_network_t net)
|
||||
{
|
||||
local_address.network = net;
|
||||
}
|
||||
|
||||
void atbridge_set_node(at_node_t node)
|
||||
{
|
||||
local_address.node = node;
|
||||
}
|
||||
|
||||
bool atbridge_address_used(const struct at_addr_t* addr)
|
||||
{
|
||||
if (!sent_rtmp_request)
|
||||
send_rtmp_request();
|
||||
return aarp_address_used(addr);
|
||||
}
|
||||
|
||||
/* Calculate a DDP checksum, per Apple's documented algorithm in 4-17 of "Inside AppleTalk". */
|
||||
static word16 get_checksum(size_t size, byte data[])
|
||||
{
|
||||
word16 cksum = 0;
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
cksum += data[i];
|
||||
cksum = (cksum << 1) | ((cksum & 0x8000) >> 15); // roll left
|
||||
}
|
||||
if (cksum == 0)
|
||||
cksum = 0xffff;
|
||||
return cksum;
|
||||
}
|
||||
|
||||
static void calculate_checksum(struct packet_t* packet)
|
||||
{
|
||||
if (packet && packet->data && (packet->size >= sizeof(struct DDP_LONG)) && (packet->type == LAP_DDP_LONG))
|
||||
{
|
||||
struct DDP_LONG* header = (struct DDP_LONG*)(packet->data);
|
||||
header->checksum = htons(get_checksum(
|
||||
packet->size - offsetof(struct DDP_LONG, dest_net),
|
||||
(byte*)&header->dest_net));
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert a long-form DDP header to a short-form header. This function only converts the headers. */
|
||||
static word16 convert_ddp_header_to_short(const struct DDP_LONG* in, struct DDP_SHORT* out)
|
||||
{
|
||||
word16 size;
|
||||
|
||||
if (!in || !out)
|
||||
return 0;
|
||||
|
||||
size = ((in->length[0] & 0x3) << 8) + (in->length[1]) - (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT));
|
||||
|
||||
out->length[0] = (size >> 8) & 0x03;
|
||||
out->length[1] = size & 0xff;
|
||||
|
||||
out->dest_socket = in->dest_socket;
|
||||
out->source_socket = in->source_socket;
|
||||
|
||||
out->type = in->type;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Convert a short-form DDP header to a long-form header. ELAP requires long-form, but LLAP often uses short-form. */
|
||||
/* This function only converts the headers. */
|
||||
static word16 convert_ddp_header_to_long(const struct at_addr_t dest, const struct at_addr_t source, const struct DDP_SHORT* in, struct DDP_LONG* out)
|
||||
{
|
||||
word16 size;
|
||||
|
||||
if (!in || !out)
|
||||
return 0;
|
||||
|
||||
size = ((in->length[0] & 0x3) << 8) + (in->length[1]) + (sizeof(struct DDP_LONG) - sizeof(struct DDP_SHORT));
|
||||
out->length[0] = (size >> 8) & 0x03;
|
||||
out->length[1] = size & 0xff;
|
||||
|
||||
out->checksum = 0x0000; /* 0x0000 == no checksum calculated, reference 4-17 */
|
||||
|
||||
if (dest.network)
|
||||
out->dest_net = dest.network;
|
||||
else
|
||||
out->dest_net = atbridge_get_net();
|
||||
out->dest_net = (at_network_t)htons(out->dest_net);
|
||||
|
||||
if (source.network)
|
||||
out->source_net = source.network;
|
||||
else
|
||||
out->source_net = atbridge_get_net();
|
||||
out->source_net = (at_network_t)htons(out->source_net);
|
||||
|
||||
out->dest_node = dest.node;
|
||||
out->source_node = source.node;
|
||||
|
||||
out->dest_socket = in->dest_socket;
|
||||
out->source_socket = in->source_socket;
|
||||
|
||||
out->type = in->type;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Convert a short-form DDP packet to a long-form packet. */
|
||||
/* This function converts an entire packet, not just the header. */
|
||||
static void convert_ddp_packet_to_long(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_SHORT) && packet->data && (packet->size >= sizeof(struct DDP_SHORT)))
|
||||
{
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data;
|
||||
|
||||
const size_t payload_size = packet->size - sizeof(struct DDP_SHORT);
|
||||
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_LONG));
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)data;
|
||||
|
||||
const word16 size = convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long);
|
||||
packet->dest.network = ntohs(header_long->dest_net);
|
||||
packet->source.network = ntohs(header_long->source_net);
|
||||
|
||||
memcpy(data + sizeof(struct DDP_LONG), packet->data + sizeof(struct DDP_SHORT), payload_size);
|
||||
|
||||
packet->type = LAP_DDP_LONG;
|
||||
packet->size = size;
|
||||
|
||||
// Replace the original short-form packet data.
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
|
||||
calculate_checksum(packet);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert a long-form DDP packet to short-form. */
|
||||
static void convert_ddp_packet_to_short(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
|
||||
{
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
|
||||
|
||||
const size_t payload_size = packet->size - sizeof(struct DDP_LONG);
|
||||
byte* data = (byte*)malloc(payload_size + sizeof(struct DDP_SHORT));
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)data;
|
||||
|
||||
const word16 size = convert_ddp_header_to_short(header_long, header_short);
|
||||
|
||||
memcpy(data + sizeof(struct DDP_SHORT), packet->data + sizeof(struct DDP_LONG), payload_size);
|
||||
|
||||
packet->type = LAP_DDP_SHORT;
|
||||
packet->size = size;
|
||||
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
}
|
||||
}
|
||||
|
||||
/*static void convert_rtmp_to_extended(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_SHORT) && packet->data)
|
||||
{
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)packet->data;
|
||||
if (header_short->type != DDP_TYPE_RTMP || header_short->dest_socket != DDP_SOCKET_RTMP)
|
||||
return;
|
||||
|
||||
struct rtmp_nonextended_data_t* in = (struct rtmp_nonextended_data_t*)(packet->data + sizeof(struct DDP_SHORT));
|
||||
|
||||
// Construct a new long-form DDP packet header.
|
||||
size_t size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_extended_data_t);
|
||||
byte* data = (byte*)malloc(size);
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)data;
|
||||
convert_ddp_header_to_long(packet->dest, packet->source, header_short, header_long);
|
||||
|
||||
struct rtmp_extended_data_t* out = (struct rtmp_extended_data_t*)(data + sizeof(struct DDP_LONG));
|
||||
out->net = in->net;
|
||||
out->id_length = in->id_length;
|
||||
out->node = in->node;
|
||||
|
||||
// Copy the routing tuples.
|
||||
struct rtmp_nonextended_tuple_t* in_tuple = (struct rtmp_nonextended_tuple_t*)(packet->data + sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_data_t));
|
||||
struct rtmp_extended_tuple_t* out_tuple = (struct rtmp_extended_tuple_t*)(data + size);
|
||||
while ((byte*)in_tuple < (packet->data + packet->size))
|
||||
{
|
||||
size += sizeof(struct rtmp_extended_tuple_t);
|
||||
realloc(data, size);
|
||||
out_tuple->range_start = in_tuple->net;
|
||||
out_tuple->distance = in_tuple->distance | 0x80;
|
||||
out_tuple->range_end = in_tuple->net;
|
||||
out_tuple->delimiter = RTMP_TUPLE_DELIMITER;
|
||||
in_tuple++;
|
||||
}
|
||||
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
packet->size = size;
|
||||
packet->type = LAP_DDP_LONG;
|
||||
}
|
||||
}*/
|
||||
|
||||
static void convert_rtmp_to_nonextended(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
|
||||
{
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
|
||||
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP)
|
||||
return;
|
||||
|
||||
struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG));
|
||||
|
||||
size_t size = sizeof(struct DDP_SHORT) + sizeof(struct rtmp_nonextended_response_t);
|
||||
byte* data = (byte*)malloc(size);
|
||||
struct DDP_SHORT* header_short = (struct DDP_SHORT*)data;
|
||||
convert_ddp_header_to_short(header_long, header_short);
|
||||
header_short->length[0] = (size >> 8) & 0x03;
|
||||
header_short->length[1] = size & 0xff;
|
||||
|
||||
struct rtmp_nonextended_response_t* out = (struct rtmp_nonextended_response_t*)(data + sizeof(struct DDP_SHORT));
|
||||
out->net = in->net;
|
||||
out->id_length = in->id_length;
|
||||
out->node = in->node;
|
||||
|
||||
/*rtmp_extended_tuple_t* in_tuple = (rtmp_extended_tuple_t*)(packet->data + sizeof(DDP_LONG) + sizeof(rtmp_extended_data_t));
|
||||
rtmp_nonextended_tuple_t* out_tuple = (rtmp_nonextended_tuple_t*)(data + size);
|
||||
while ((byte*)in_tuple < (packet->data + packet->size))
|
||||
{
|
||||
size += sizeof(rtmp_nonextended_tuple_t);
|
||||
realloc(data, size);
|
||||
out_tuple->net = in_tuple->range_start;
|
||||
out_tuple->distance = in_tuple->distance & 0x7f;
|
||||
in_tuple++;
|
||||
}*/
|
||||
|
||||
free(packet->data);
|
||||
packet->data = data;
|
||||
packet->size = size;
|
||||
packet->type = LAP_DDP_SHORT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Learn our network number from RTMP packets. */
|
||||
/* "Inside AppleTalk", section 4-8, describes this approach for non-extended networks.
|
||||
Technically, we probably should be doing the more complicated extended network approach (also on 4-8),
|
||||
but the easy approach using RTMP seems adequate for now. */
|
||||
static void glean_net_from_rtmp(struct packet_t* packet)
|
||||
{
|
||||
if (packet && (packet->type == LAP_DDP_LONG) && packet->data)
|
||||
{
|
||||
struct DDP_LONG* header_long = (struct DDP_LONG*)packet->data;
|
||||
if (header_long->type != DDP_TYPE_RTMP || header_long->dest_socket != DDP_SOCKET_RTMP)
|
||||
return;
|
||||
|
||||
struct rtmp_extended_data_t* in = (struct rtmp_extended_data_t*)(packet->data + sizeof(struct DDP_LONG));
|
||||
|
||||
atbridge_set_net(ntohs(in->net));
|
||||
}
|
||||
}
|
||||
|
||||
static void send_rtmp_request()
|
||||
{
|
||||
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
|
||||
packet->type = LAP_DDP_LONG;
|
||||
packet->dest.network = atbridge_get_net();
|
||||
packet->dest.node = 255;
|
||||
packet->source.network = atbridge_get_net();
|
||||
packet->source.node = atbridge_get_node();
|
||||
packet->next = 0;
|
||||
packet->size = sizeof(struct DDP_LONG) + sizeof(struct rtmp_request_t);
|
||||
packet->data = (byte*)malloc(packet->size);
|
||||
|
||||
struct DDP_LONG* header = (struct DDP_LONG*)packet->data;
|
||||
header->type = DDP_TYPE_RTMP_REQUEST;
|
||||
header->source_net = htons(packet->source.network);
|
||||
header->source_node = packet->source.node;
|
||||
header->source_socket = DDP_SOCKET_RTMP;
|
||||
header->dest_net = htons(packet->dest.network);
|
||||
header->dest_node = packet->dest.node;
|
||||
header->dest_socket = DDP_SOCKET_RTMP;
|
||||
header->length[0] = (packet->size >> 8) & 0x03;
|
||||
header->length[1] = packet->size & 0xff;
|
||||
|
||||
struct rtmp_request_t* request = (struct rtmp_request_t*)(packet->data + sizeof(struct DDP_LONG));
|
||||
request->function = RTMP_FUNCTION_REQUEST;
|
||||
|
||||
calculate_checksum(packet);
|
||||
|
||||
elap_enqueue_out(packet);
|
||||
sent_rtmp_request = true;
|
||||
}
|
||||
|
||||
void atbridge_process()
|
||||
{
|
||||
elap_process();
|
||||
//llap_process();
|
||||
|
||||
struct packet_t* packet = elap_dequeue_in();
|
||||
if (packet)
|
||||
{
|
||||
glean_net_from_rtmp(packet);
|
||||
convert_rtmp_to_nonextended(packet);
|
||||
// The GS should understand long-form DDP, but converting to short-form ought to slightly improve performance (fewer bytes for the GS to process).
|
||||
convert_ddp_packet_to_short(packet);
|
||||
llap_enqueue_out(packet);
|
||||
}
|
||||
packet = llap_dequeue_in();
|
||||
if (packet)
|
||||
{
|
||||
// ELAP does not support short-form DDP, so convert such packets to long-form.
|
||||
convert_ddp_packet_to_long(packet);
|
||||
elap_enqueue_out(packet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +1,49 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/**
|
||||
ATBridge is a limited function AppleTalk bridge that allows GSPort to connect to an
|
||||
EtherTalk network. The bridge has two ports, one the emulated LocalTalk port and the
|
||||
other an EtherTalk Phase II port.
|
||||
|
||||
Due to timing requirements of LocalTalk, it is not reasonable to transparently bridge
|
||||
LLAP traffic to ELAP. For example, implementing the lapENQ/lapACK LLAP control packets
|
||||
requires AARP queries on the ELAP port, which can't be reasonably done within the 200us
|
||||
LLAP interframe gap. So, we must implement the local bridge functionality detailed
|
||||
in "Inside AppleTalk", including AARP, RTMP, ZIP, and DDP routing.
|
||||
**/
|
||||
#include "atalk.h"
|
||||
|
||||
bool atbridge_init();
|
||||
void atbridge_shutdown();
|
||||
void atbridge_process();
|
||||
|
||||
void atbridge_set_diagnostics(bool enabled);
|
||||
bool atbridge_get_diagnostics();
|
||||
void atbridge_printf(const char *fmt, ...);
|
||||
|
||||
const struct at_addr_t* atbridge_get_addr();
|
||||
const at_network_t atbridge_get_net();
|
||||
const at_node_t atbridge_get_node();
|
||||
void atbridge_set_net(at_network_t net);
|
||||
void atbridge_set_node(at_node_t node);
|
||||
bool atbridge_address_used(const struct at_addr_t* addr);
|
||||
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/**
|
||||
ATBridge is a limited function AppleTalk bridge that allows GSPort to connect to an
|
||||
EtherTalk network. The bridge has two ports, one the emulated LocalTalk port and the
|
||||
other an EtherTalk Phase II port.
|
||||
|
||||
Due to timing requirements of LocalTalk, it is not reasonable to transparently bridge
|
||||
LLAP traffic to ELAP. For example, implementing the lapENQ/lapACK LLAP control packets
|
||||
requires AARP queries on the ELAP port, which can't be reasonably done within the 200us
|
||||
LLAP interframe gap. So, we must implement the local bridge functionality detailed
|
||||
in "Inside AppleTalk", including AARP, RTMP, ZIP, and DDP routing.
|
||||
**/
|
||||
#include "atalk.h"
|
||||
|
||||
bool atbridge_init();
|
||||
void atbridge_shutdown();
|
||||
void atbridge_process();
|
||||
|
||||
void atbridge_set_diagnostics(bool enabled);
|
||||
bool atbridge_get_diagnostics();
|
||||
void atbridge_printf(const char *fmt, ...);
|
||||
|
||||
const struct at_addr_t* atbridge_get_addr();
|
||||
const at_network_t atbridge_get_net();
|
||||
const at_node_t atbridge_get_node();
|
||||
void atbridge_set_net(at_network_t net);
|
||||
void atbridge_set_node(at_node_t node);
|
||||
bool atbridge_address_used(const struct at_addr_t* addr);
|
||||
|
||||
|
|
|
@ -1,108 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\arch\win32\pcap.h" />
|
||||
<ClInclude Include="aarp.h" />
|
||||
<ClInclude Include="atalk.h" />
|
||||
<ClInclude Include="atbridge.h" />
|
||||
<ClInclude Include="elap.h" />
|
||||
<ClInclude Include="elap_defs.h" />
|
||||
<ClInclude Include="llap.h" />
|
||||
<ClInclude Include="pcap_delay.h" />
|
||||
<ClInclude Include="port.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="aarp.c" />
|
||||
<ClCompile Include="atbridge.c" />
|
||||
<ClCompile Include="elap.c" />
|
||||
<ClCompile Include="llap.c" />
|
||||
<ClCompile Include="pcap_delay.c" />
|
||||
<ClCompile Include="port.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>atbridge</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\arch\win32\pcap.h" />
|
||||
<ClInclude Include="aarp.h" />
|
||||
<ClInclude Include="atalk.h" />
|
||||
<ClInclude Include="atbridge.h" />
|
||||
<ClInclude Include="elap.h" />
|
||||
<ClInclude Include="elap_defs.h" />
|
||||
<ClInclude Include="llap.h" />
|
||||
<ClInclude Include="pcap_delay.h" />
|
||||
<ClInclude Include="port.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="aarp.c" />
|
||||
<ClCompile Include="atbridge.c" />
|
||||
<ClCompile Include="elap.c" />
|
||||
<ClCompile Include="llap.c" />
|
||||
<ClCompile Include="pcap_delay.c" />
|
||||
<ClCompile Include="port.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>atbridge</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="llap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atbridge.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="elap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\pcap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="port.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="aarp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="elap_defs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atalk.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pcap_delay.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="llap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="atbridge.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="elap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="port.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="aarp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pcap_delay.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="llap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atbridge.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="elap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\pcap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="port.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="aarp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="elap_defs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atalk.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pcap_delay.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="llap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="atbridge.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="elap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="port.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="aarp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pcap_delay.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,398 +1,400 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements the ELAP port of the bridge. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../defc.h"
|
||||
#include "atbridge.h"
|
||||
#include "elap.h"
|
||||
#include "port.h"
|
||||
#include "aarp.h"
|
||||
#include "elap_defs.h"
|
||||
#include "pcap_delay.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <Windows.h>
|
||||
#include <NspAPI.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#include <IPHlpApi.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <netinet/in.h>
|
||||
#include <netpacket/packet.h>
|
||||
#endif
|
||||
|
||||
extern int g_ethernet_interface;
|
||||
|
||||
static pcap_t* pcap_session;
|
||||
|
||||
static struct packet_port_t elap_port;
|
||||
static struct ether_addr_t HW_LOCAL;
|
||||
|
||||
/*static void dump_device_list(pcap_if_t* devices)
|
||||
{
|
||||
int i = 0;
|
||||
for(pcap_if_t* device = devices; device; device = device->next)
|
||||
{
|
||||
printf("%d. %s", ++i, device->name);
|
||||
if (device->description)
|
||||
printf(" (%s)\n", device->description);
|
||||
else
|
||||
printf(" (No description available)\n");
|
||||
}
|
||||
}*/
|
||||
|
||||
static void elap_clone_host_mac(pcap_if_t* device)
|
||||
{
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
#ifdef WIN32
|
||||
////
|
||||
// Extract the device GUID, which Windows uses to identify the device.
|
||||
char* name = device->name;
|
||||
while (name && *name != '{')
|
||||
name++;
|
||||
size_t guidLen = strlen(name);
|
||||
|
||||
////
|
||||
// Find and copy the device MAC address.
|
||||
ULONG size = sizeof(IP_ADAPTER_ADDRESSES) * 15;
|
||||
IP_ADAPTER_ADDRESSES* addresses = malloc(size);
|
||||
|
||||
ULONG result = GetAdaptersAddresses(AF_UNSPEC,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
|
||||
|
||||
if (result == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
// The addresses buffer is too small. Allocate a bigger buffer.
|
||||
free(addresses);
|
||||
addresses = malloc(size);
|
||||
result = GetAdaptersAddresses(AF_UNSPEC,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
|
||||
}
|
||||
|
||||
if (result == NO_ERROR)
|
||||
{
|
||||
// Search for the desired adapter address.
|
||||
IP_ADAPTER_ADDRESSES* current = addresses;
|
||||
while (current)
|
||||
{
|
||||
if (current->PhysicalAddressLength == ETHER_ADDR_LEN && memcmp(current->AdapterName, name, guidLen) == 0)
|
||||
{
|
||||
memcpy(&HW_LOCAL.mac, ¤t->PhysicalAddress, sizeof(HW_LOCAL.mac));
|
||||
break;
|
||||
}
|
||||
current = current->Next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
halt_printf("ATBridge: Failed to find host MAC address (%d).", result);
|
||||
}
|
||||
|
||||
free(addresses);
|
||||
#else
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements the ELAP port of the bridge. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../defc.h"
|
||||
#include "atbridge.h"
|
||||
#include "elap.h"
|
||||
#include "port.h"
|
||||
#include "aarp.h"
|
||||
#include "elap_defs.h"
|
||||
#include "pcap_delay.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <Windows.h>
|
||||
#include <NspAPI.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#include <IPHlpApi.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <netinet/in.h>
|
||||
#include <netpacket/packet.h>
|
||||
#endif
|
||||
|
||||
extern int g_ethernet_interface;
|
||||
|
||||
static pcap_t* pcap_session;
|
||||
|
||||
static struct packet_port_t elap_port;
|
||||
static struct ether_addr_t HW_LOCAL;
|
||||
|
||||
/*static void dump_device_list(pcap_if_t* devices)
|
||||
{
|
||||
int i = 0;
|
||||
for(pcap_if_t* device = devices; device; device = device->next)
|
||||
{
|
||||
printf("%d. %s", ++i, device->name);
|
||||
if (device->description)
|
||||
printf(" (%s)\n", device->description);
|
||||
else
|
||||
printf(" (No description available)\n");
|
||||
}
|
||||
}*/
|
||||
|
||||
static void elap_clone_host_mac(pcap_if_t* device)
|
||||
{
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
#ifdef WIN32
|
||||
////
|
||||
// Extract the device GUID, which Windows uses to identify the device.
|
||||
char* name = device->name;
|
||||
while (name && *name != '{')
|
||||
name++;
|
||||
size_t guidLen = strlen(name);
|
||||
|
||||
////
|
||||
// Find and copy the device MAC address.
|
||||
ULONG size = sizeof(IP_ADAPTER_ADDRESSES) * 15;
|
||||
IP_ADAPTER_ADDRESSES* addresses = malloc(size);
|
||||
|
||||
ULONG result = GetAdaptersAddresses(AF_UNSPEC,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
|
||||
|
||||
if (result == ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
// The addresses buffer is too small. Allocate a bigger buffer.
|
||||
free(addresses);
|
||||
addresses = malloc(size);
|
||||
result = GetAdaptersAddresses(AF_UNSPEC,
|
||||
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER, NULL, addresses, &size);
|
||||
}
|
||||
|
||||
if (result == NO_ERROR)
|
||||
{
|
||||
// Search for the desired adapter address.
|
||||
IP_ADAPTER_ADDRESSES* current = addresses;
|
||||
while (current)
|
||||
{
|
||||
if (current->PhysicalAddressLength == ETHER_ADDR_LEN && memcmp(current->AdapterName, name, guidLen) == 0)
|
||||
{
|
||||
memcpy(&HW_LOCAL.mac, ¤t->PhysicalAddress, sizeof(HW_LOCAL.mac));
|
||||
break;
|
||||
}
|
||||
current = current->Next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
halt_printf("ATBridge: Failed to find host MAC address (%d).", result);
|
||||
}
|
||||
|
||||
free(addresses);
|
||||
#else
|
||||
#ifdef AF_PACKET
|
||||
struct pcap_addr* address;
|
||||
for (address = device->addresses; address != 0; address = address->next)
|
||||
if (address->addr->sa_family == AF_PACKET)
|
||||
{
|
||||
struct sockaddr_ll* ll = (struct sockaddr_ll*)address->addr;
|
||||
memcpy(&HW_LOCAL.mac, ll->sll_addr, sizeof(HW_LOCAL.mac));
|
||||
}
|
||||
struct pcap_addr* address;
|
||||
for (address = device->addresses; address != 0; address = address->next)
|
||||
if (address->addr->sa_family == AF_PACKET)
|
||||
{
|
||||
struct sockaddr_ll* ll = (struct sockaddr_ll*)address->addr;
|
||||
memcpy(&HW_LOCAL.mac, ll->sll_addr, sizeof(HW_LOCAL.mac));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct ether_addr_t* elap_get_mac()
|
||||
{
|
||||
return &HW_LOCAL;
|
||||
}
|
||||
|
||||
bool elap_init()
|
||||
{
|
||||
port_init(&elap_port);
|
||||
|
||||
memcpy(&HW_LOCAL, &HW_LOCAL_DEFAULT, sizeof(HW_LOCAL));
|
||||
|
||||
pcap_if_t* device;
|
||||
pcap_if_t* alldevs;
|
||||
int i = 0;
|
||||
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
// Load the PCAP library.
|
||||
if (!pcapdelay_load())
|
||||
{
|
||||
halt_printf("ATBridge: PCAP not available.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Retrieve the device list.
|
||||
if(pcapdelay_findalldevs(&alldevs, errbuf) == -1)
|
||||
{
|
||||
atbridge_printf("ATBridge: Error enumerating PCAP devices: %s\n", errbuf);
|
||||
return false;
|
||||
}
|
||||
//dump_device_list(alldevs);
|
||||
|
||||
// Jump to the selected adapter.
|
||||
for (device = alldevs, i = 0; i < g_ethernet_interface; device = device->next, i++);
|
||||
if (!device)
|
||||
{
|
||||
halt_printf("ATBridge: PCAP device not found. Check interface number in settings.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clone the MAC address of the underlying interface. In certain configurations (e.g. Windows with an MS Loopback
|
||||
// interface), the interface, even in promiscous mode, filters foreign MAC addresses.
|
||||
elap_clone_host_mac(device);
|
||||
|
||||
// Open the adapter,
|
||||
if ((pcap_session = pcapdelay_open_live(device->name, // name of the device
|
||||
65536, // portion of the packet to capture.
|
||||
// 65536 grants that the whole packet will be captured on all the MACs.
|
||||
1, // promiscuous mode (nonzero means promiscuous)
|
||||
1, // read timeout
|
||||
errbuf // error buffer
|
||||
)) == NULL)
|
||||
{
|
||||
halt_printf("ATBridge: Unable to open the adapter. Pcap does not support %s.\n", device->name);
|
||||
pcapdelay_freealldevs(alldevs);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct ether_addr_t* elap_get_mac()
|
||||
{
|
||||
return &HW_LOCAL;
|
||||
}
|
||||
|
||||
bool elap_init()
|
||||
{
|
||||
port_init(&elap_port);
|
||||
|
||||
memcpy(&HW_LOCAL, &HW_LOCAL_DEFAULT, sizeof(HW_LOCAL));
|
||||
|
||||
pcap_if_t* device;
|
||||
pcap_if_t* alldevs;
|
||||
int i = 0;
|
||||
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
// Load the PCAP library.
|
||||
if (!pcapdelay_load())
|
||||
{
|
||||
halt_printf("ATBridge: PCAP not available.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Retrieve the device list.
|
||||
if(pcapdelay_findalldevs(&alldevs, errbuf) == -1)
|
||||
{
|
||||
atbridge_printf("ATBridge: Error enumerating PCAP devices: %s\n", errbuf);
|
||||
return false;
|
||||
}
|
||||
//dump_device_list(alldevs);
|
||||
|
||||
// Jump to the selected adapter.
|
||||
for (device = alldevs, i = 0; i < g_ethernet_interface; device = device->next, i++);
|
||||
if (!device)
|
||||
{
|
||||
halt_printf("ATBridge: PCAP device not found. Check interface number in settings.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clone the MAC address of the underlying interface. In certain configurations (e.g. Windows with an MS Loopback
|
||||
// interface), the interface, even in promiscous mode, filters foreign MAC addresses.
|
||||
elap_clone_host_mac(device);
|
||||
|
||||
// Open the adapter,
|
||||
if ((pcap_session = pcapdelay_open_live(device->name, // name of the device
|
||||
65536, // portion of the packet to capture.
|
||||
// 65536 grants that the whole packet will be captured on all the MACs.
|
||||
1, // promiscuous mode (nonzero means promiscuous)
|
||||
1, // read timeout
|
||||
errbuf // error buffer
|
||||
)) == NULL)
|
||||
{
|
||||
halt_printf("ATBridge: Unable to open the adapter. Pcap does not support %s.\n", device->name);
|
||||
pcapdelay_freealldevs(alldevs);
|
||||
return false;
|
||||
}
|
||||
|
||||
// The device must support Ethernet because the bridge "speaks" EtherTalk.
|
||||
if (pcapdelay_datalink(pcap_session) == DLT_EN10MB)
|
||||
{
|
||||
pcapdelay_setnonblock(pcap_session, 1, errbuf);
|
||||
|
||||
atbridge_printf("ATBridge: AppleTalk bridging using network device '%s' with Ethernet address %.2X:%.2X:%.2X:%.2X:%.2X:%.2X.\n",
|
||||
device->description, HW_LOCAL.mac[0], HW_LOCAL.mac[1], HW_LOCAL.mac[2], HW_LOCAL.mac[3], HW_LOCAL.mac[4], HW_LOCAL.mac[5]);
|
||||
|
||||
pcapdelay_freealldevs(alldevs);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pcapdelay_close(pcap_session);
|
||||
pcap_session = 0;
|
||||
halt_printf("ATBridge: Selected network device %s must support Ethernet.\n", device->description);
|
||||
pcapdelay_freealldevs(alldevs);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void elap_shutdown()
|
||||
{
|
||||
port_shutdown(&elap_port);
|
||||
if (pcap_session)
|
||||
{
|
||||
pcapdelay_close(pcap_session);
|
||||
pcap_session = 0;
|
||||
}
|
||||
pcapdelay_unload();
|
||||
}
|
||||
|
||||
void elap_enqueue_out(struct packet_t* packet)
|
||||
{
|
||||
enqueue_packet(&elap_port.out, packet);
|
||||
}
|
||||
|
||||
struct packet_t* elap_dequeue_in()
|
||||
{
|
||||
return dequeue(&elap_port.in);
|
||||
}
|
||||
|
||||
void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[])
|
||||
{
|
||||
if (pcap_session && dest && discriminator)
|
||||
{
|
||||
// Allocate heap space for the frame.
|
||||
const size_t frame_size = sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t) + size;
|
||||
u_char* frame_data;
|
||||
size_t pad = 0;
|
||||
if (frame_size < ETHER_MIN_SIZE)
|
||||
pad = ETHER_MIN_SIZE - frame_size;
|
||||
frame_data = (u_char*)malloc(frame_size + pad);
|
||||
|
||||
// Build the 802.3 header.
|
||||
struct ethernet_header_t* ether = (struct ethernet_header_t*)frame_data;
|
||||
memcpy(ether->dest.mac, dest, sizeof(ether->dest.mac));
|
||||
memcpy(ether->source.mac, HW_LOCAL.mac, sizeof(ether->source.mac));
|
||||
ether->length = htons(frame_size - sizeof(struct ethernet_header_t));
|
||||
|
||||
// Build the 802.2 header.
|
||||
struct snap_header_t* snap = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t));
|
||||
snap->dsap = SNAP_DSAP;
|
||||
snap->ssap = SNAP_SSAP;
|
||||
snap->control = SNAP_CONTROL;
|
||||
memcpy(&snap->discriminator, discriminator, sizeof(snap->discriminator));
|
||||
|
||||
// Add the data payload.
|
||||
struct snap_header_t* payload = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t));
|
||||
memcpy(payload, data, size);
|
||||
|
||||
// Add padding to meet minimum Ethernet frame size.
|
||||
if (pad > 0)
|
||||
memset(frame_data + frame_size, 0, pad);
|
||||
|
||||
pcapdelay_sendpacket(pcap_session, frame_data, frame_size + pad);
|
||||
}
|
||||
}
|
||||
|
||||
static bool elap_send_one_queued()
|
||||
{
|
||||
// Attempt to send one packet out the host network interface.
|
||||
struct packet_t* packet = queue_peek(&elap_port.out);
|
||||
if (packet)
|
||||
{
|
||||
// Find the MAC address.
|
||||
const struct ether_addr_t* dest;
|
||||
if (packet->dest.node == at_broadcast_node)
|
||||
dest = &HW_APPLETALK_BROADCAST;
|
||||
else
|
||||
dest = aarp_request_hardware(&packet->dest);
|
||||
|
||||
// Send it.
|
||||
if (dest)
|
||||
{
|
||||
elap_send(dest, &SNAP_APPLETALK, packet->size, packet->data);
|
||||
|
||||
dequeue(&elap_port.out);
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
// AARP does not have the needed hardware address. Give AARP time to obtain the address and keep the current packet.
|
||||
if (!aarp_retry())
|
||||
{
|
||||
// However, if AARP has reached the retry limit, the packet is undeliverable. Discard the packet and move on.
|
||||
atbridge_printf("ATBridge: AARP failed to find MAC address for network %d node %d. Dropping packet.\n", packet->dest.network, packet->dest.node);
|
||||
aarp_retry_reset();
|
||||
dequeue(&elap_port.out);
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static void elap_send_all_queued()
|
||||
{
|
||||
while (elap_send_one_queued());
|
||||
}
|
||||
|
||||
static bool elap_receive_one()
|
||||
{
|
||||
if (!pcap_session)
|
||||
return false;
|
||||
|
||||
struct pcap_pkthdr header;
|
||||
const u_char* packet = pcapdelay_next(pcap_session, &header);
|
||||
if (packet)
|
||||
{
|
||||
// Receive and process one packet from the host network interface.
|
||||
////
|
||||
|
||||
// Check the Ethernet 802.3 header.
|
||||
const struct ethernet_header_t* ether = (struct ethernet_header_t*)packet;
|
||||
if (header.len > sizeof(struct ethernet_header_t) &&
|
||||
ntohs(ether->length) <= ETHER_MAX_SIZE &&
|
||||
ntohs(ether->length) > sizeof(struct snap_header_t) &&
|
||||
(memcmp(ðer->source, &HW_LOCAL, sizeof(ether->source)) != 0) && /* Ignore packets sent from our node. */
|
||||
(memcmp(ðer->dest, &HW_LOCAL, sizeof(ether->dest)) == 0 || /* Accept packets destined for our node ... */
|
||||
memcmp(ðer->dest, &HW_APPLETALK_BROADCAST, sizeof(ether->dest)) == 0 /* ... or for broadcast. */)
|
||||
)
|
||||
{
|
||||
// Check the 802.2 SNAP header.
|
||||
const struct snap_header_t* snap = (struct snap_header_t*)(packet + sizeof(struct ethernet_header_t));
|
||||
if (snap->dsap == SNAP_DSAP &&
|
||||
snap->ssap == SNAP_SSAP &&
|
||||
snap->control == SNAP_CONTROL)
|
||||
{
|
||||
if (memcmp(&snap->discriminator, &SNAP_APPLETALK, sizeof(snap->discriminator)) == 0)
|
||||
{
|
||||
// Handle an AppleTalk packet.
|
||||
const size_t payload_size = ntohs(ether->length) - sizeof(struct snap_header_t);
|
||||
const u_char* payload = packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t);
|
||||
|
||||
byte* copy = (byte*)malloc(payload_size);
|
||||
memcpy(copy, payload, payload_size);
|
||||
|
||||
// ELAP does not support short-form DDP, so this must be a long-form DDP packet.
|
||||
struct at_addr_t source, dest;
|
||||
if (payload_size >= sizeof(struct DDP_LONG))
|
||||
{
|
||||
// Extract the protocol address from the header.
|
||||
//
|
||||
// ELAP really shouldn't be looking at the header for the next level of the protocol stack,
|
||||
// but this is a convenient place to glean addresses for the AMT, a process that needs both
|
||||
// hardware and protocol addresses.
|
||||
struct DDP_LONG* header = (struct DDP_LONG*)copy;
|
||||
dest.network = (at_network_t)ntohs(header->dest_net);
|
||||
source.network = (at_network_t)ntohs(header->source_net);
|
||||
dest.node = header->dest_node;
|
||||
source.node = header->source_node;
|
||||
|
||||
enqueue(&elap_port.in, dest, source, LAP_DDP_LONG, payload_size, copy);
|
||||
|
||||
aarp_glean(&source, ðer->source);
|
||||
}
|
||||
else
|
||||
atbridge_printf("ATBridge: Dropping invalid short ELAP frame.\n");
|
||||
}
|
||||
else if (memcmp(&snap->discriminator, &SNAP_AARP, sizeof(snap->discriminator)) == 0)
|
||||
{
|
||||
// Handle an AARP packet.
|
||||
struct aarp_header_t* aarp = (struct aarp_header_t*)(packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t));
|
||||
aarp->dest_proto_addr.addr.network = ntohs(aarp->dest_proto_addr.addr.network);
|
||||
aarp->source_proto_addr.addr.network = ntohs(aarp->source_proto_addr.addr.network);
|
||||
aarp->function = ntohs(aarp->function);
|
||||
aarp->hardware_type = ntohs(aarp->hardware_type);
|
||||
aarp->protocol_type = ntohs(aarp->protocol_type);
|
||||
aarp_handle_packet(aarp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static void elap_receive_all()
|
||||
{
|
||||
while (elap_receive_one());
|
||||
}
|
||||
|
||||
void elap_process()
|
||||
{
|
||||
elap_receive_all();
|
||||
elap_send_all_queued();
|
||||
{
|
||||
pcapdelay_setnonblock(pcap_session, 1, errbuf);
|
||||
|
||||
atbridge_printf("ATBridge: AppleTalk bridging using network device '%s' with Ethernet address %.2X:%.2X:%.2X:%.2X:%.2X:%.2X.\n",
|
||||
device->description, HW_LOCAL.mac[0], HW_LOCAL.mac[1], HW_LOCAL.mac[2], HW_LOCAL.mac[3], HW_LOCAL.mac[4], HW_LOCAL.mac[5]);
|
||||
|
||||
pcapdelay_freealldevs(alldevs);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pcapdelay_close(pcap_session);
|
||||
pcap_session = 0;
|
||||
halt_printf("ATBridge: Selected network device %s must support Ethernet.\n", device->description);
|
||||
pcapdelay_freealldevs(alldevs);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void elap_shutdown()
|
||||
{
|
||||
port_shutdown(&elap_port);
|
||||
if (pcap_session)
|
||||
{
|
||||
pcapdelay_close(pcap_session);
|
||||
pcap_session = 0;
|
||||
}
|
||||
pcapdelay_unload();
|
||||
}
|
||||
|
||||
void elap_enqueue_out(struct packet_t* packet)
|
||||
{
|
||||
enqueue_packet(&elap_port.out, packet);
|
||||
}
|
||||
|
||||
struct packet_t* elap_dequeue_in()
|
||||
{
|
||||
return dequeue(&elap_port.in);
|
||||
}
|
||||
|
||||
void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[])
|
||||
{
|
||||
if (pcap_session && dest && discriminator)
|
||||
{
|
||||
// Allocate heap space for the frame.
|
||||
const size_t frame_size = sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t) + size;
|
||||
u_char* frame_data;
|
||||
size_t pad = 0;
|
||||
if (frame_size < ETHER_MIN_SIZE)
|
||||
pad = ETHER_MIN_SIZE - frame_size;
|
||||
frame_data = (u_char*)malloc(frame_size + pad);
|
||||
|
||||
// Build the 802.3 header.
|
||||
struct ethernet_header_t* ether = (struct ethernet_header_t*)frame_data;
|
||||
memcpy(ether->dest.mac, dest, sizeof(ether->dest.mac));
|
||||
memcpy(ether->source.mac, HW_LOCAL.mac, sizeof(ether->source.mac));
|
||||
ether->length = htons(frame_size - sizeof(struct ethernet_header_t));
|
||||
|
||||
// Build the 802.2 header.
|
||||
struct snap_header_t* snap = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t));
|
||||
snap->dsap = SNAP_DSAP;
|
||||
snap->ssap = SNAP_SSAP;
|
||||
snap->control = SNAP_CONTROL;
|
||||
memcpy(&snap->discriminator, discriminator, sizeof(snap->discriminator));
|
||||
|
||||
// Add the data payload.
|
||||
struct snap_header_t* payload = (struct snap_header_t*)(frame_data + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t));
|
||||
memcpy(payload, data, size);
|
||||
|
||||
// Add padding to meet minimum Ethernet frame size.
|
||||
if (pad > 0)
|
||||
memset(frame_data + frame_size, 0, pad);
|
||||
|
||||
pcapdelay_sendpacket(pcap_session, frame_data, frame_size + pad);
|
||||
}
|
||||
}
|
||||
|
||||
static bool elap_send_one_queued()
|
||||
{
|
||||
// Attempt to send one packet out the host network interface.
|
||||
struct packet_t* packet = queue_peek(&elap_port.out);
|
||||
if (packet)
|
||||
{
|
||||
// Find the MAC address.
|
||||
const struct ether_addr_t* dest;
|
||||
if (packet->dest.node == at_broadcast_node)
|
||||
dest = &HW_APPLETALK_BROADCAST;
|
||||
else
|
||||
dest = aarp_request_hardware(&packet->dest);
|
||||
|
||||
// Send it.
|
||||
if (dest)
|
||||
{
|
||||
elap_send(dest, &SNAP_APPLETALK, packet->size, packet->data);
|
||||
|
||||
dequeue(&elap_port.out);
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
// AARP does not have the needed hardware address. Give AARP time to obtain the address and keep the current packet.
|
||||
if (!aarp_retry())
|
||||
{
|
||||
// However, if AARP has reached the retry limit, the packet is undeliverable. Discard the packet and move on.
|
||||
atbridge_printf("ATBridge: AARP failed to find MAC address for network %d node %d. Dropping packet.\n", packet->dest.network, packet->dest.node);
|
||||
aarp_retry_reset();
|
||||
dequeue(&elap_port.out);
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static void elap_send_all_queued()
|
||||
{
|
||||
while (elap_send_one_queued());
|
||||
}
|
||||
|
||||
static bool elap_receive_one()
|
||||
{
|
||||
if (!pcap_session)
|
||||
return false;
|
||||
|
||||
struct pcap_pkthdr header;
|
||||
const u_char* packet = pcapdelay_next(pcap_session, &header);
|
||||
if (packet)
|
||||
{
|
||||
// Receive and process one packet from the host network interface.
|
||||
////
|
||||
|
||||
// Check the Ethernet 802.3 header.
|
||||
const struct ethernet_header_t* ether = (struct ethernet_header_t*)packet;
|
||||
if (header.len > sizeof(struct ethernet_header_t) &&
|
||||
ntohs(ether->length) <= ETHER_MAX_SIZE &&
|
||||
ntohs(ether->length) > sizeof(struct snap_header_t) &&
|
||||
(memcmp(ðer->source, &HW_LOCAL, sizeof(ether->source)) != 0) && /* Ignore packets sent from our node. */
|
||||
(memcmp(ðer->dest, &HW_LOCAL, sizeof(ether->dest)) == 0 || /* Accept packets destined for our node ... */
|
||||
memcmp(ðer->dest, &HW_APPLETALK_BROADCAST, sizeof(ether->dest)) == 0 /* ... or for broadcast. */)
|
||||
)
|
||||
{
|
||||
// Check the 802.2 SNAP header.
|
||||
const struct snap_header_t* snap = (struct snap_header_t*)(packet + sizeof(struct ethernet_header_t));
|
||||
if (snap->dsap == SNAP_DSAP &&
|
||||
snap->ssap == SNAP_SSAP &&
|
||||
snap->control == SNAP_CONTROL)
|
||||
{
|
||||
if (memcmp(&snap->discriminator, &SNAP_APPLETALK, sizeof(snap->discriminator)) == 0)
|
||||
{
|
||||
// Handle an AppleTalk packet.
|
||||
const size_t payload_size = ntohs(ether->length) - sizeof(struct snap_header_t);
|
||||
const u_char* payload = packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t);
|
||||
|
||||
byte* copy = (byte*)malloc(payload_size);
|
||||
memcpy(copy, payload, payload_size);
|
||||
|
||||
// ELAP does not support short-form DDP, so this must be a long-form DDP packet.
|
||||
struct at_addr_t source, dest;
|
||||
if (payload_size >= sizeof(struct DDP_LONG))
|
||||
{
|
||||
// Extract the protocol address from the header.
|
||||
//
|
||||
// ELAP really shouldn't be looking at the header for the next level of the protocol stack,
|
||||
// but this is a convenient place to glean addresses for the AMT, a process that needs both
|
||||
// hardware and protocol addresses.
|
||||
struct DDP_LONG* header = (struct DDP_LONG*)copy;
|
||||
dest.network = (at_network_t)ntohs(header->dest_net);
|
||||
source.network = (at_network_t)ntohs(header->source_net);
|
||||
dest.node = header->dest_node;
|
||||
source.node = header->source_node;
|
||||
|
||||
enqueue(&elap_port.in, dest, source, LAP_DDP_LONG, payload_size, copy);
|
||||
|
||||
aarp_glean(&source, ðer->source);
|
||||
}
|
||||
else
|
||||
atbridge_printf("ATBridge: Dropping invalid short ELAP frame.\n");
|
||||
}
|
||||
else if (memcmp(&snap->discriminator, &SNAP_AARP, sizeof(snap->discriminator)) == 0)
|
||||
{
|
||||
// Handle an AARP packet.
|
||||
struct aarp_header_t* aarp = (struct aarp_header_t*)(packet + sizeof(struct ethernet_header_t) + sizeof(struct snap_header_t));
|
||||
aarp->dest_proto_addr.addr.network = ntohs(aarp->dest_proto_addr.addr.network);
|
||||
aarp->source_proto_addr.addr.network = ntohs(aarp->source_proto_addr.addr.network);
|
||||
aarp->function = ntohs(aarp->function);
|
||||
aarp->hardware_type = ntohs(aarp->hardware_type);
|
||||
aarp->protocol_type = ntohs(aarp->protocol_type);
|
||||
aarp_handle_packet(aarp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static void elap_receive_all()
|
||||
{
|
||||
while (elap_receive_one());
|
||||
}
|
||||
|
||||
void elap_process()
|
||||
{
|
||||
elap_receive_all();
|
||||
elap_send_all_queued();
|
||||
}
|
||||
|
|
|
@ -1,36 +1,38 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** ELAP port of the AppleTalk Bridge **/
|
||||
|
||||
bool elap_init();
|
||||
void elap_shutdown();
|
||||
void elap_process();
|
||||
|
||||
struct packet_t;
|
||||
|
||||
void elap_enqueue_out(struct packet_t* packet);
|
||||
struct packet_t* elap_dequeue_in();
|
||||
|
||||
struct ether_addr_t;
|
||||
struct snap_discriminator_t;
|
||||
|
||||
void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[]);
|
||||
|
||||
const struct ether_addr_t* elap_get_mac();
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** ELAP port of the AppleTalk Bridge **/
|
||||
|
||||
bool elap_init();
|
||||
void elap_shutdown();
|
||||
void elap_process();
|
||||
|
||||
struct packet_t;
|
||||
|
||||
void elap_enqueue_out(struct packet_t* packet);
|
||||
struct packet_t* elap_dequeue_in();
|
||||
|
||||
struct ether_addr_t;
|
||||
struct snap_discriminator_t;
|
||||
|
||||
void elap_send(const struct ether_addr_t* dest, const struct snap_discriminator_t* discriminator, size_t size, byte data[]);
|
||||
|
||||
const struct ether_addr_t* elap_get_mac();
|
||||
|
|
|
@ -1,117 +1,119 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/* Ethernet addresses are 6 bytes */
|
||||
#define ETHER_ADDR_LEN 6
|
||||
|
||||
static const word16 ETHER_MAX_SIZE = 0x5DC;
|
||||
static const word16 ETHER_MIN_SIZE = 60;
|
||||
static const byte SNAP_DSAP = 0xAA;
|
||||
static const byte SNAP_SSAP = 0xAA;
|
||||
static const byte SNAP_CONTROL = 0x03;
|
||||
|
||||
#define OUI_APPLETALK_1 0x08
|
||||
#define OUI_APPLETALK_2 0x00
|
||||
#define OUI_APPLETALK_3 0x07
|
||||
#define TYPE_APPLETALK_1 0x80
|
||||
#define TYPE_APPLETALK_2 0x9B
|
||||
|
||||
#define OUI_AARP_1 0x00
|
||||
#define OUI_AARP_2 0x00
|
||||
#define OUI_AARP_3 0x00
|
||||
#define TYPE_AARP_1 0x80
|
||||
#define TYPE_AARP_2 0xF3
|
||||
|
||||
static const byte AARP_HARDWARE_ETHER = 0x01;
|
||||
static const word16 AARP_PROTOCOL_TYPE = 0x809B;
|
||||
static const byte AARP_HW_ADDR_LEN = 6;
|
||||
static const byte AARP_PROTOCOL_ADDR_LEN = 4;
|
||||
enum AARP_FUNCTION
|
||||
{
|
||||
AARP_FUNCTION_REQUEST = 0x01,
|
||||
AARP_FUNCTION_RESPONSE = 0x02,
|
||||
AARP_FUNCTION_PROBE = 0x03
|
||||
};
|
||||
|
||||
// reference C-4
|
||||
static const long AARP_PROBE_INTERVAL = 200; /* milliseconds */
|
||||
static const unsigned int AARP_PROBE_COUNT = 10;
|
||||
|
||||
// reference 2-9 and 3-9, optional and at developer discretion
|
||||
static const long AARP_REQUEST_INTERVAL = 200; /* milliseconds */
|
||||
static const unsigned int AARP_REQUEST_COUNT = 10;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct ether_addr_t
|
||||
{
|
||||
byte mac[ETHER_ADDR_LEN];
|
||||
};
|
||||
|
||||
/* Ethernet 802.2/802.3/SNAP header */
|
||||
struct ethernet_header_t
|
||||
{
|
||||
// 802.3 header
|
||||
struct ether_addr_t dest;
|
||||
struct ether_addr_t source;
|
||||
word16 length;
|
||||
};
|
||||
|
||||
struct snap_discriminator_t
|
||||
{
|
||||
byte oui[3];
|
||||
byte type[2];
|
||||
};
|
||||
|
||||
struct snap_header_t
|
||||
{
|
||||
// 802.2 header
|
||||
byte dsap;
|
||||
byte ssap;
|
||||
byte control;
|
||||
|
||||
// SNAP header
|
||||
struct snap_discriminator_t discriminator;
|
||||
};
|
||||
|
||||
struct protocol_addr_t
|
||||
{
|
||||
byte zero; // Reference C-4 and 3-11: The protocol address is four bytes with the high byte zero.
|
||||
struct at_addr_t addr;
|
||||
};
|
||||
|
||||
struct aarp_header_t
|
||||
{
|
||||
word16 hardware_type;
|
||||
word16 protocol_type;
|
||||
byte hw_addr_len;
|
||||
byte protocol_addr_len;
|
||||
word16 function;
|
||||
struct ether_addr_t source_hw_addr;
|
||||
struct protocol_addr_t source_proto_addr;
|
||||
struct ether_addr_t dest_hw_addr;
|
||||
struct protocol_addr_t dest_proto_addr;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static const struct ether_addr_t HW_APPLETALK_BROADCAST = {{ 0x09, 0x00, 0x07, 0xff, 0xff, 0xff }};
|
||||
static const struct ether_addr_t HW_LOCAL_DEFAULT = {{0x02 /* unicast, locally administered */, 'A', '2', 'G', 'S', 0x00}};
|
||||
//static const struct ether_addr_t HW_LOCAL = {{ 0x02 /* unicast, locally administered */, 0x00, 0x4c, 0x4f, 0x4f, 0x50 }};
|
||||
static const struct ether_addr_t HW_ZERO = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
|
||||
static const struct snap_discriminator_t SNAP_APPLETALK = {{ OUI_APPLETALK_1, OUI_APPLETALK_2, OUI_APPLETALK_3}, {TYPE_APPLETALK_1, TYPE_APPLETALK_2 }};
|
||||
static const struct snap_discriminator_t SNAP_AARP = {{ OUI_AARP_1, OUI_AARP_2, OUI_AARP_3}, {TYPE_AARP_1, TYPE_AARP_2 }};
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/* Ethernet addresses are 6 bytes */
|
||||
#define ETHER_ADDR_LEN 6
|
||||
|
||||
static const word16 ETHER_MAX_SIZE = 0x5DC;
|
||||
static const word16 ETHER_MIN_SIZE = 60;
|
||||
static const byte SNAP_DSAP = 0xAA;
|
||||
static const byte SNAP_SSAP = 0xAA;
|
||||
static const byte SNAP_CONTROL = 0x03;
|
||||
|
||||
#define OUI_APPLETALK_1 0x08
|
||||
#define OUI_APPLETALK_2 0x00
|
||||
#define OUI_APPLETALK_3 0x07
|
||||
#define TYPE_APPLETALK_1 0x80
|
||||
#define TYPE_APPLETALK_2 0x9B
|
||||
|
||||
#define OUI_AARP_1 0x00
|
||||
#define OUI_AARP_2 0x00
|
||||
#define OUI_AARP_3 0x00
|
||||
#define TYPE_AARP_1 0x80
|
||||
#define TYPE_AARP_2 0xF3
|
||||
|
||||
static const byte AARP_HARDWARE_ETHER = 0x01;
|
||||
static const word16 AARP_PROTOCOL_TYPE = 0x809B;
|
||||
static const byte AARP_HW_ADDR_LEN = 6;
|
||||
static const byte AARP_PROTOCOL_ADDR_LEN = 4;
|
||||
enum AARP_FUNCTION
|
||||
{
|
||||
AARP_FUNCTION_REQUEST = 0x01,
|
||||
AARP_FUNCTION_RESPONSE = 0x02,
|
||||
AARP_FUNCTION_PROBE = 0x03
|
||||
};
|
||||
|
||||
// reference C-4
|
||||
static const long AARP_PROBE_INTERVAL = 200; /* milliseconds */
|
||||
static const unsigned int AARP_PROBE_COUNT = 10;
|
||||
|
||||
// reference 2-9 and 3-9, optional and at developer discretion
|
||||
static const long AARP_REQUEST_INTERVAL = 200; /* milliseconds */
|
||||
static const unsigned int AARP_REQUEST_COUNT = 10;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct ether_addr_t
|
||||
{
|
||||
byte mac[ETHER_ADDR_LEN];
|
||||
};
|
||||
|
||||
/* Ethernet 802.2/802.3/SNAP header */
|
||||
struct ethernet_header_t
|
||||
{
|
||||
// 802.3 header
|
||||
struct ether_addr_t dest;
|
||||
struct ether_addr_t source;
|
||||
word16 length;
|
||||
};
|
||||
|
||||
struct snap_discriminator_t
|
||||
{
|
||||
byte oui[3];
|
||||
byte type[2];
|
||||
};
|
||||
|
||||
struct snap_header_t
|
||||
{
|
||||
// 802.2 header
|
||||
byte dsap;
|
||||
byte ssap;
|
||||
byte control;
|
||||
|
||||
// SNAP header
|
||||
struct snap_discriminator_t discriminator;
|
||||
};
|
||||
|
||||
struct protocol_addr_t
|
||||
{
|
||||
byte zero; // Reference C-4 and 3-11: The protocol address is four bytes with the high byte zero.
|
||||
struct at_addr_t addr;
|
||||
};
|
||||
|
||||
struct aarp_header_t
|
||||
{
|
||||
word16 hardware_type;
|
||||
word16 protocol_type;
|
||||
byte hw_addr_len;
|
||||
byte protocol_addr_len;
|
||||
word16 function;
|
||||
struct ether_addr_t source_hw_addr;
|
||||
struct protocol_addr_t source_proto_addr;
|
||||
struct ether_addr_t dest_hw_addr;
|
||||
struct protocol_addr_t dest_proto_addr;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static const struct ether_addr_t HW_APPLETALK_BROADCAST = {{ 0x09, 0x00, 0x07, 0xff, 0xff, 0xff }};
|
||||
static const struct ether_addr_t HW_LOCAL_DEFAULT = {{0x02 /* unicast, locally administered */, 'A', '2', 'G', 'S', 0x00}};
|
||||
//static const struct ether_addr_t HW_LOCAL = {{ 0x02 /* unicast, locally administered */, 0x00, 0x4c, 0x4f, 0x4f, 0x50 }};
|
||||
static const struct ether_addr_t HW_ZERO = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
|
||||
static const struct snap_discriminator_t SNAP_APPLETALK = {{ OUI_APPLETALK_1, OUI_APPLETALK_2, OUI_APPLETALK_3}, {TYPE_APPLETALK_1, TYPE_APPLETALK_2 }};
|
||||
static const struct snap_discriminator_t SNAP_AARP = {{ OUI_AARP_1, OUI_AARP_2, OUI_AARP_3}, {TYPE_AARP_1, TYPE_AARP_2 }};
|
||||
|
|
|
@ -1,332 +1,334 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements the LLAP port of the bridge. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../defc.h"
|
||||
#include "atbridge.h"
|
||||
#include "port.h"
|
||||
#include "llap.h"
|
||||
|
||||
typedef enum {
|
||||
LLAP_DDP_SHORT = 0x01,
|
||||
LLAP_DDP_LONG = 0x02,
|
||||
LLAP_ENQ = 0x81,
|
||||
LLAP_ACK = 0x82,
|
||||
LLAP_RTS = 0x84,
|
||||
LLAP_CTS = 0x85
|
||||
} LLAP_TYPES;
|
||||
|
||||
const unsigned int LLAP_PACKET_MAX = 603 /* bytes */;
|
||||
const unsigned int LLAP_PACKET_MIN = 3 /* bytes */;
|
||||
const double LLAP_IDG = 400 /* microseconds */;
|
||||
const double LLAP_IFG = 200 /* microseconds */;
|
||||
const double GAP_TOLERANCE = 4.0;
|
||||
|
||||
static struct packet_port_t llap_port;
|
||||
|
||||
typedef enum {
|
||||
DIALOG_READY,
|
||||
DIALOG_GOT_CTS,
|
||||
DIALOG_WAIT_IDG
|
||||
} DIALOG_STATE;
|
||||
static DIALOG_STATE dialog_state;
|
||||
static double dialog_end_dcycs;
|
||||
static double last_frame_dcycs;
|
||||
|
||||
void llap_init()
|
||||
{
|
||||
dialog_state = DIALOG_READY;
|
||||
last_frame_dcycs = 0;
|
||||
port_init(&llap_port);
|
||||
}
|
||||
|
||||
void llap_shutdown()
|
||||
{
|
||||
port_shutdown(&llap_port);
|
||||
}
|
||||
|
||||
|
||||
/** Queue one data packet out from the bridge's LLAP port and into the guest. **/
|
||||
void llap_enqueue_out(struct packet_t* packet)
|
||||
{
|
||||
// Generate the RTS.
|
||||
struct packet_t* rts = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
rts->source.network = packet->source.network;
|
||||
rts->source.node = packet->source.node;
|
||||
rts->dest.network = packet->dest.network;
|
||||
rts->dest.node = packet->dest.node;
|
||||
rts->size = 0;
|
||||
rts->data = 0;
|
||||
rts->type = LLAP_RTS;
|
||||
enqueue_packet(&llap_port.out, rts);
|
||||
|
||||
// Enqueue the data.
|
||||
enqueue_packet(&llap_port.out, packet);
|
||||
}
|
||||
|
||||
struct packet_t* llap_dequeue_in()
|
||||
{
|
||||
return dequeue(&llap_port.in);
|
||||
}
|
||||
|
||||
static void llap_dump_packet(size_t size, byte data[])
|
||||
{
|
||||
if (size < LLAP_PACKET_MIN)
|
||||
atbridge_printf("LLAP short packet.\n");
|
||||
else if (size > LLAP_PACKET_MAX)
|
||||
atbridge_printf("LLAP long packet.\n");
|
||||
else
|
||||
{
|
||||
at_node_t dest = data[0];
|
||||
at_node_t source = data[1];
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
const char* typeName = 0;
|
||||
switch (type)
|
||||
{
|
||||
case LLAP_DDP_SHORT:
|
||||
typeName = "DDP (short)";
|
||||
break;
|
||||
case LLAP_DDP_LONG:
|
||||
typeName = "DDP (long)";
|
||||
break;
|
||||
case LLAP_ENQ:
|
||||
typeName = "lapENQ";
|
||||
break;
|
||||
case LLAP_ACK:
|
||||
typeName = "lapACK";
|
||||
break;
|
||||
case LLAP_RTS:
|
||||
typeName = "lapRTS";
|
||||
break;
|
||||
case LLAP_CTS:
|
||||
typeName = "lapCTS";
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeName)
|
||||
atbridge_printf("LLAP[%d->%d] %s: %d bytes.\n", source, dest, typeName, size);
|
||||
else
|
||||
atbridge_printf("LLAP[%d->%d] %x: %d bytes.\n", source, dest, type, size);
|
||||
|
||||
/*for (size_t i = 0; i < size; i++)
|
||||
atbridge_printf("%02x ", data[i]);
|
||||
atbridge_printf("\n");*/
|
||||
}
|
||||
}
|
||||
|
||||
/** Reply to a control packet from the GS **/
|
||||
static void llap_reply_control(at_node_t dest, at_node_t source, LLAP_TYPES type)
|
||||
{
|
||||
struct at_addr_t dest_addr = { 0, dest };
|
||||
struct at_addr_t source_addr = { 0, source };
|
||||
|
||||
// Insert control packets at the head of the queue contrary to normal FIFO queue operation
|
||||
// to ensure that control frames arrive in the intended order.
|
||||
insert(&llap_port.out, dest_addr, source_addr, type, 0, 0);
|
||||
}
|
||||
|
||||
/** Accept a data packet from the GS. **/
|
||||
static void llap_handle_data(size_t size, byte data[])
|
||||
{
|
||||
at_node_t dest = data[0];
|
||||
at_node_t source = data[1];
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
const size_t data_size = size - 3;
|
||||
byte* data_copy = (byte*)malloc(data_size);
|
||||
memcpy(data_copy, data + 3, data_size);
|
||||
|
||||
struct at_addr_t dest_addr = { 0, dest };
|
||||
struct at_addr_t source_addr = { 0, source };
|
||||
enqueue(&llap_port.in, dest_addr, source_addr, type, data_size, data_copy);
|
||||
}
|
||||
|
||||
/** Accept a control packet from the GS. **/
|
||||
static void llap_handle_control(size_t size, byte data[])
|
||||
{
|
||||
at_node_t dest = data[0];
|
||||
at_node_t source = data[1];
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
struct at_addr_t addr = { atbridge_get_net(), dest };
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case LLAP_ENQ:
|
||||
// Require the GS to take a valid "client" address not known to be in use.
|
||||
if (dest > 127 || dest == 0 || atbridge_address_used(&addr))
|
||||
llap_reply_control(source, dest, LLAP_ACK);
|
||||
break;
|
||||
case LLAP_ACK:
|
||||
break;
|
||||
case LLAP_RTS:
|
||||
if (dest != at_broadcast_node)
|
||||
// The GS is trying to make a directed transmission. Provide the required RTS/CTS handshake.
|
||||
// Note that broadcast packets do not require a CTS.
|
||||
llap_reply_control(source, dest, LLAP_CTS);
|
||||
break;
|
||||
case LLAP_CTS:
|
||||
// The GS sent a CTS. If the bridge has pending data, prepare to deliver the packet.
|
||||
dialog_state = DIALOG_GOT_CTS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Occassionally, we receive an invalid packet from the GS. I'm unsure if this is due to a bug in GS/OS
|
||||
or, more likely, a bug in the SCC emulation. Regardless, when such a thing does occur, discard the
|
||||
current, corrupted dialog. Link errors are routine in real LocalTalk networks, and LocalTalk will recover.
|
||||
**/
|
||||
static void llap_reset_dialog()
|
||||
{
|
||||
dialog_state = DIALOG_READY;
|
||||
last_frame_dcycs = 0;
|
||||
|
||||
// Discard packets until the queue is either empty or the next dialog starts (and dialogs begin with an RTS).
|
||||
while (true)
|
||||
{
|
||||
struct packet_t* packet = queue_peek(&llap_port.out);
|
||||
|
||||
if (packet && (packet->type != LLAP_RTS))
|
||||
{
|
||||
packet = dequeue(&llap_port.out);
|
||||
if (packet->data)
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Transfer (send) one LLAP packet from the GS. **/
|
||||
void llap_enqueue_in(double dcycs, size_t size, byte data[])
|
||||
{
|
||||
atbridge_printf("<%0.0f> TX: ", dcycs);
|
||||
llap_dump_packet(size, data);
|
||||
|
||||
if (size < LLAP_PACKET_MIN)
|
||||
atbridge_printf("ATBridge: Dropping LLAP short packet.\n");
|
||||
else if (size > LLAP_PACKET_MAX)
|
||||
atbridge_printf("ATBridge: Dropping LLAP long packet.\n");
|
||||
else
|
||||
{
|
||||
last_frame_dcycs = dcycs;
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case LLAP_DDP_SHORT:
|
||||
case LLAP_DDP_LONG:
|
||||
llap_handle_data(size, data);
|
||||
break;
|
||||
case LLAP_ENQ:
|
||||
case LLAP_ACK:
|
||||
case LLAP_RTS:
|
||||
case LLAP_CTS:
|
||||
llap_handle_control(size, data);
|
||||
break;
|
||||
default:
|
||||
// Intentionally check for valid types and ingore packets with invalid types.
|
||||
// Sometimes, the bridge gets invalid packets from the GS, which tends to break the bridge.
|
||||
atbridge_printf("ATBridge: Dropping LLAP packet with invalid type.\n");
|
||||
llap_reset_dialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Transfer (receive) one LLAP packet to the GS. **/
|
||||
void llap_dequeue_out(double dcycs, size_t* size, byte* data[])
|
||||
{
|
||||
*size = 0;
|
||||
|
||||
// The LocalTalk protocol requires a minimum 400us gap between dialogs (called the IDG).
|
||||
// If necessary, wait for the IDG.
|
||||
if (dialog_state == DIALOG_WAIT_IDG)
|
||||
{
|
||||
if ((dcycs - dialog_end_dcycs) >= LLAP_IDG)
|
||||
// The IDG is done.
|
||||
dialog_state = DIALOG_READY;
|
||||
else
|
||||
// Continue waiting for the IDG.
|
||||
return;
|
||||
}
|
||||
// The LocalTalk protocols requires a maximum 200us gap between frames within a dialog (called the IFG).
|
||||
// If we exceed the IFG, the bridge must be stuck in an incomplete or corrupt dialog. In this case,
|
||||
// discard the current dialog and try again.
|
||||
if ((dialog_state != DIALOG_READY) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IFG)))
|
||||
{
|
||||
llap_reset_dialog();
|
||||
atbridge_printf("ATBridge: Dialog reset due to IFG violation.\n");
|
||||
}
|
||||
|
||||
struct packet_t* packet = queue_peek(&llap_port.out);
|
||||
|
||||
if ((dialog_state == DIALOG_READY) && (packet) && !(packet->type & 0x80) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IDG)))
|
||||
{
|
||||
llap_reset_dialog();
|
||||
packet = queue_peek(&llap_port.out);
|
||||
atbridge_printf("ATBridge: Dialog reset due to IDG violation.\n");
|
||||
}
|
||||
|
||||
if (packet &&
|
||||
((packet->type & 0x80) || /* Pass along control frames without waiting for a CTS. */
|
||||
(!(packet->type & 0x80) && (packet->dest.node == at_broadcast_node) && (dialog_state == DIALOG_READY)) || /* Pass along broadcast frames, which don't wait for CTS frames. */
|
||||
(!(packet->type & 0x80) && (packet->dest.node != at_broadcast_node) && (dialog_state == DIALOG_GOT_CTS)))) /* Pass along directed frames only after receiving a CTS handshake. */
|
||||
{
|
||||
dequeue(&llap_port.out);
|
||||
|
||||
// Prepend the LLAP header.
|
||||
*size = packet->size + 3 + 2;
|
||||
*data = (byte*)malloc(*size);
|
||||
(*data)[0] = packet->dest.node;
|
||||
(*data)[1] = packet->source.node;
|
||||
(*data)[2] = packet->type;
|
||||
|
||||
// Insert the data into the new LLAP packet.
|
||||
if (*size)
|
||||
memcpy((*data) + 3, packet->data, packet->size);
|
||||
|
||||
// Fake a frame check sequence (FCS). Since our SCC emulation doesn't actually
|
||||
// check the FCS, the value of the FCS doesn't matter.
|
||||
(*data)[packet->size + 3 + 0] = 0xff;
|
||||
(*data)[packet->size + 3 + 1] = 0xff;
|
||||
|
||||
atbridge_printf("<%0.0f> RX: ", dcycs);
|
||||
llap_dump_packet(*size, *data);
|
||||
|
||||
if (packet->type & 0x80)
|
||||
dialog_state = DIALOG_READY;
|
||||
else
|
||||
{
|
||||
// This was the last packet in the dialog.
|
||||
dialog_state = DIALOG_WAIT_IDG;
|
||||
dialog_end_dcycs = dcycs;
|
||||
}
|
||||
|
||||
last_frame_dcycs = dcycs;
|
||||
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
}
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements the LLAP port of the bridge. **/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../defc.h"
|
||||
#include "atbridge.h"
|
||||
#include "port.h"
|
||||
#include "llap.h"
|
||||
|
||||
typedef enum {
|
||||
LLAP_DDP_SHORT = 0x01,
|
||||
LLAP_DDP_LONG = 0x02,
|
||||
LLAP_ENQ = 0x81,
|
||||
LLAP_ACK = 0x82,
|
||||
LLAP_RTS = 0x84,
|
||||
LLAP_CTS = 0x85
|
||||
} LLAP_TYPES;
|
||||
|
||||
const unsigned int LLAP_PACKET_MAX = 603 /* bytes */;
|
||||
const unsigned int LLAP_PACKET_MIN = 3 /* bytes */;
|
||||
const double LLAP_IDG = 400 /* microseconds */;
|
||||
const double LLAP_IFG = 200 /* microseconds */;
|
||||
const double GAP_TOLERANCE = 4.0;
|
||||
|
||||
static struct packet_port_t llap_port;
|
||||
|
||||
typedef enum {
|
||||
DIALOG_READY,
|
||||
DIALOG_GOT_CTS,
|
||||
DIALOG_WAIT_IDG
|
||||
} DIALOG_STATE;
|
||||
static DIALOG_STATE dialog_state;
|
||||
static double dialog_end_dcycs;
|
||||
static double last_frame_dcycs;
|
||||
|
||||
void llap_init()
|
||||
{
|
||||
dialog_state = DIALOG_READY;
|
||||
last_frame_dcycs = 0;
|
||||
port_init(&llap_port);
|
||||
}
|
||||
|
||||
void llap_shutdown()
|
||||
{
|
||||
port_shutdown(&llap_port);
|
||||
}
|
||||
|
||||
|
||||
/** Queue one data packet out from the bridge's LLAP port and into the guest. **/
|
||||
void llap_enqueue_out(struct packet_t* packet)
|
||||
{
|
||||
// Generate the RTS.
|
||||
struct packet_t* rts = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
rts->source.network = packet->source.network;
|
||||
rts->source.node = packet->source.node;
|
||||
rts->dest.network = packet->dest.network;
|
||||
rts->dest.node = packet->dest.node;
|
||||
rts->size = 0;
|
||||
rts->data = 0;
|
||||
rts->type = LLAP_RTS;
|
||||
enqueue_packet(&llap_port.out, rts);
|
||||
|
||||
// Enqueue the data.
|
||||
enqueue_packet(&llap_port.out, packet);
|
||||
}
|
||||
|
||||
struct packet_t* llap_dequeue_in()
|
||||
{
|
||||
return dequeue(&llap_port.in);
|
||||
}
|
||||
|
||||
static void llap_dump_packet(size_t size, byte data[])
|
||||
{
|
||||
if (size < LLAP_PACKET_MIN)
|
||||
atbridge_printf("LLAP short packet.\n");
|
||||
else if (size > LLAP_PACKET_MAX)
|
||||
atbridge_printf("LLAP long packet.\n");
|
||||
else
|
||||
{
|
||||
at_node_t dest = data[0];
|
||||
at_node_t source = data[1];
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
const char* typeName = 0;
|
||||
switch (type)
|
||||
{
|
||||
case LLAP_DDP_SHORT:
|
||||
typeName = "DDP (short)";
|
||||
break;
|
||||
case LLAP_DDP_LONG:
|
||||
typeName = "DDP (long)";
|
||||
break;
|
||||
case LLAP_ENQ:
|
||||
typeName = "lapENQ";
|
||||
break;
|
||||
case LLAP_ACK:
|
||||
typeName = "lapACK";
|
||||
break;
|
||||
case LLAP_RTS:
|
||||
typeName = "lapRTS";
|
||||
break;
|
||||
case LLAP_CTS:
|
||||
typeName = "lapCTS";
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeName)
|
||||
atbridge_printf("LLAP[%d->%d] %s: %d bytes.\n", source, dest, typeName, size);
|
||||
else
|
||||
atbridge_printf("LLAP[%d->%d] %x: %d bytes.\n", source, dest, type, size);
|
||||
|
||||
/*for (size_t i = 0; i < size; i++)
|
||||
atbridge_printf("%02x ", data[i]);
|
||||
atbridge_printf("\n");*/
|
||||
}
|
||||
}
|
||||
|
||||
/** Reply to a control packet from the GS **/
|
||||
static void llap_reply_control(at_node_t dest, at_node_t source, LLAP_TYPES type)
|
||||
{
|
||||
struct at_addr_t dest_addr = { 0, dest };
|
||||
struct at_addr_t source_addr = { 0, source };
|
||||
|
||||
// Insert control packets at the head of the queue contrary to normal FIFO queue operation
|
||||
// to ensure that control frames arrive in the intended order.
|
||||
insert(&llap_port.out, dest_addr, source_addr, type, 0, 0);
|
||||
}
|
||||
|
||||
/** Accept a data packet from the GS. **/
|
||||
static void llap_handle_data(size_t size, byte data[])
|
||||
{
|
||||
at_node_t dest = data[0];
|
||||
at_node_t source = data[1];
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
const size_t data_size = size - 3;
|
||||
byte* data_copy = (byte*)malloc(data_size);
|
||||
memcpy(data_copy, data + 3, data_size);
|
||||
|
||||
struct at_addr_t dest_addr = { 0, dest };
|
||||
struct at_addr_t source_addr = { 0, source };
|
||||
enqueue(&llap_port.in, dest_addr, source_addr, type, data_size, data_copy);
|
||||
}
|
||||
|
||||
/** Accept a control packet from the GS. **/
|
||||
static void llap_handle_control(size_t size, byte data[])
|
||||
{
|
||||
at_node_t dest = data[0];
|
||||
at_node_t source = data[1];
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
struct at_addr_t addr = { atbridge_get_net(), dest };
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case LLAP_ENQ:
|
||||
// Require the GS to take a valid "client" address not known to be in use.
|
||||
if (dest > 127 || dest == 0 || atbridge_address_used(&addr))
|
||||
llap_reply_control(source, dest, LLAP_ACK);
|
||||
break;
|
||||
case LLAP_ACK:
|
||||
break;
|
||||
case LLAP_RTS:
|
||||
if (dest != at_broadcast_node)
|
||||
// The GS is trying to make a directed transmission. Provide the required RTS/CTS handshake.
|
||||
// Note that broadcast packets do not require a CTS.
|
||||
llap_reply_control(source, dest, LLAP_CTS);
|
||||
break;
|
||||
case LLAP_CTS:
|
||||
// The GS sent a CTS. If the bridge has pending data, prepare to deliver the packet.
|
||||
dialog_state = DIALOG_GOT_CTS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Occassionally, we receive an invalid packet from the GS. I'm unsure if this is due to a bug in GS/OS
|
||||
or, more likely, a bug in the SCC emulation. Regardless, when such a thing does occur, discard the
|
||||
current, corrupted dialog. Link errors are routine in real LocalTalk networks, and LocalTalk will recover.
|
||||
**/
|
||||
static void llap_reset_dialog()
|
||||
{
|
||||
dialog_state = DIALOG_READY;
|
||||
last_frame_dcycs = 0;
|
||||
|
||||
// Discard packets until the queue is either empty or the next dialog starts (and dialogs begin with an RTS).
|
||||
while (true)
|
||||
{
|
||||
struct packet_t* packet = queue_peek(&llap_port.out);
|
||||
|
||||
if (packet && (packet->type != LLAP_RTS))
|
||||
{
|
||||
packet = dequeue(&llap_port.out);
|
||||
if (packet->data)
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Transfer (send) one LLAP packet from the GS. **/
|
||||
void llap_enqueue_in(double dcycs, size_t size, byte data[])
|
||||
{
|
||||
atbridge_printf("<%0.0f> TX: ", dcycs);
|
||||
llap_dump_packet(size, data);
|
||||
|
||||
if (size < LLAP_PACKET_MIN)
|
||||
atbridge_printf("ATBridge: Dropping LLAP short packet.\n");
|
||||
else if (size > LLAP_PACKET_MAX)
|
||||
atbridge_printf("ATBridge: Dropping LLAP long packet.\n");
|
||||
else
|
||||
{
|
||||
last_frame_dcycs = dcycs;
|
||||
LLAP_TYPES type = (LLAP_TYPES)(data[2]);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case LLAP_DDP_SHORT:
|
||||
case LLAP_DDP_LONG:
|
||||
llap_handle_data(size, data);
|
||||
break;
|
||||
case LLAP_ENQ:
|
||||
case LLAP_ACK:
|
||||
case LLAP_RTS:
|
||||
case LLAP_CTS:
|
||||
llap_handle_control(size, data);
|
||||
break;
|
||||
default:
|
||||
// Intentionally check for valid types and ingore packets with invalid types.
|
||||
// Sometimes, the bridge gets invalid packets from the GS, which tends to break the bridge.
|
||||
atbridge_printf("ATBridge: Dropping LLAP packet with invalid type.\n");
|
||||
llap_reset_dialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Transfer (receive) one LLAP packet to the GS. **/
|
||||
void llap_dequeue_out(double dcycs, size_t* size, byte* data[])
|
||||
{
|
||||
*size = 0;
|
||||
|
||||
// The LocalTalk protocol requires a minimum 400us gap between dialogs (called the IDG).
|
||||
// If necessary, wait for the IDG.
|
||||
if (dialog_state == DIALOG_WAIT_IDG)
|
||||
{
|
||||
if ((dcycs - dialog_end_dcycs) >= LLAP_IDG)
|
||||
// The IDG is done.
|
||||
dialog_state = DIALOG_READY;
|
||||
else
|
||||
// Continue waiting for the IDG.
|
||||
return;
|
||||
}
|
||||
// The LocalTalk protocols requires a maximum 200us gap between frames within a dialog (called the IFG).
|
||||
// If we exceed the IFG, the bridge must be stuck in an incomplete or corrupt dialog. In this case,
|
||||
// discard the current dialog and try again.
|
||||
if ((dialog_state != DIALOG_READY) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IFG)))
|
||||
{
|
||||
llap_reset_dialog();
|
||||
atbridge_printf("ATBridge: Dialog reset due to IFG violation.\n");
|
||||
}
|
||||
|
||||
struct packet_t* packet = queue_peek(&llap_port.out);
|
||||
|
||||
if ((dialog_state == DIALOG_READY) && (packet) && !(packet->type & 0x80) && (last_frame_dcycs != 0) && ((dcycs - last_frame_dcycs) >= (GAP_TOLERANCE*LLAP_IDG)))
|
||||
{
|
||||
llap_reset_dialog();
|
||||
packet = queue_peek(&llap_port.out);
|
||||
atbridge_printf("ATBridge: Dialog reset due to IDG violation.\n");
|
||||
}
|
||||
|
||||
if (packet &&
|
||||
((packet->type & 0x80) || /* Pass along control frames without waiting for a CTS. */
|
||||
(!(packet->type & 0x80) && (packet->dest.node == at_broadcast_node) && (dialog_state == DIALOG_READY)) || /* Pass along broadcast frames, which don't wait for CTS frames. */
|
||||
(!(packet->type & 0x80) && (packet->dest.node != at_broadcast_node) && (dialog_state == DIALOG_GOT_CTS)))) /* Pass along directed frames only after receiving a CTS handshake. */
|
||||
{
|
||||
dequeue(&llap_port.out);
|
||||
|
||||
// Prepend the LLAP header.
|
||||
*size = packet->size + 3 + 2;
|
||||
*data = (byte*)malloc(*size);
|
||||
(*data)[0] = packet->dest.node;
|
||||
(*data)[1] = packet->source.node;
|
||||
(*data)[2] = packet->type;
|
||||
|
||||
// Insert the data into the new LLAP packet.
|
||||
if (*size)
|
||||
memcpy((*data) + 3, packet->data, packet->size);
|
||||
|
||||
// Fake a frame check sequence (FCS). Since our SCC emulation doesn't actually
|
||||
// check the FCS, the value of the FCS doesn't matter.
|
||||
(*data)[packet->size + 3 + 0] = 0xff;
|
||||
(*data)[packet->size + 3 + 1] = 0xff;
|
||||
|
||||
atbridge_printf("<%0.0f> RX: ", dcycs);
|
||||
llap_dump_packet(*size, *data);
|
||||
|
||||
if (packet->type & 0x80)
|
||||
dialog_state = DIALOG_READY;
|
||||
else
|
||||
{
|
||||
// This was the last packet in the dialog.
|
||||
dialog_state = DIALOG_WAIT_IDG;
|
||||
dialog_end_dcycs = dcycs;
|
||||
}
|
||||
|
||||
last_frame_dcycs = dcycs;
|
||||
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,39 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
struct packet_t;
|
||||
|
||||
/** LLAP port of the AppleTalk Bridge **/
|
||||
|
||||
void llap_init();
|
||||
void llap_shutdown();
|
||||
|
||||
/** Send one LLAP packet from the GS
|
||||
*/
|
||||
void llap_enqueue_in(double dcycs, size_t size, byte data[]);
|
||||
|
||||
/** Receive one LLAP packet from the world to the GS and return the size
|
||||
*/
|
||||
void llap_dequeue_out(double dcycs, size_t* size, byte* data[]);
|
||||
|
||||
|
||||
void llap_enqueue_out(struct packet_t* packet);
|
||||
struct packet_t* llap_dequeue_in();
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
struct packet_t;
|
||||
|
||||
/** LLAP port of the AppleTalk Bridge **/
|
||||
|
||||
void llap_init();
|
||||
void llap_shutdown();
|
||||
|
||||
/** Send one LLAP packet from the GS
|
||||
*/
|
||||
void llap_enqueue_in(double dcycs, size_t size, byte data[]);
|
||||
|
||||
/** Receive one LLAP packet from the world to the GS and return the size
|
||||
*/
|
||||
void llap_dequeue_out(double dcycs, size_t* size, byte* data[]);
|
||||
|
||||
|
||||
void llap_enqueue_out(struct packet_t* packet);
|
||||
struct packet_t* llap_dequeue_in();
|
||||
|
|
|
@ -1,171 +1,173 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2014 by Peter Neubauer
|
||||
|
||||
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 <stdbool.h>
|
||||
#include "pcap_delay.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
static HMODULE module = NULL;
|
||||
#elif __linux__
|
||||
#include <dlfcn.h>
|
||||
static void* module = 0;
|
||||
#endif
|
||||
|
||||
|
||||
bool pcapdelay_load()
|
||||
{
|
||||
if (!pcapdelay_is_loaded())
|
||||
{
|
||||
#ifdef WIN32
|
||||
module = LoadLibrary("wpcap.dll");
|
||||
#elif __linux__
|
||||
module = dlopen("libpcap.so", RTLD_LAZY);
|
||||
#endif
|
||||
}
|
||||
return pcapdelay_is_loaded();
|
||||
}
|
||||
|
||||
bool pcapdelay_is_loaded()
|
||||
{
|
||||
#ifdef WIN32
|
||||
return module != NULL;
|
||||
#elif __linux__
|
||||
return module != 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pcapdelay_unload()
|
||||
{
|
||||
if (pcapdelay_is_loaded())
|
||||
{
|
||||
#ifdef WIN32
|
||||
FreeLibrary(module);
|
||||
module = NULL;
|
||||
#elif __linux__
|
||||
dlclose(module);
|
||||
module = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*PFNVOID)();
|
||||
|
||||
static PFNVOID delay_load(const char* proc, PFNVOID* ppfn)
|
||||
{
|
||||
if (pcapdelay_load() && proc && ppfn && !*ppfn)
|
||||
{
|
||||
#ifdef WIN32
|
||||
*ppfn = (PFNVOID)GetProcAddress(module, proc);
|
||||
#elif __linux__
|
||||
*ppfn = (PFNVOID)dlsym(module, proc);
|
||||
#endif
|
||||
}
|
||||
if (ppfn)
|
||||
return *ppfn;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pcapdelay_freealldevs(pcap_if_t* a0)
|
||||
{
|
||||
typedef void (*PFN)(pcap_if_t*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_freealldevs", (PFNVOID*)&pfn)))
|
||||
(*pfn)(a0);
|
||||
}
|
||||
|
||||
pcap_t* pcapdelay_open_live(const char* a0, int a1, int a2, int a3, char* a4)
|
||||
{
|
||||
typedef pcap_t* (*PFN)(const char*, int, int, int, char*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_open_live", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2, a3, a4);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pcapdelay_close(pcap_t* a0)
|
||||
{
|
||||
typedef void (*PFN)(pcap_t*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_close", (PFNVOID*)&pfn)))
|
||||
(*pfn)(a0);
|
||||
}
|
||||
|
||||
int pcapdelay_findalldevs(pcap_if_t** a0, char* a1)
|
||||
{
|
||||
typedef int (*PFN)(pcap_if_t**, char*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_findalldevs", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_datalink(pcap_t* a0)
|
||||
{
|
||||
typedef int(*PFN)(pcap_t*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_datalink", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_setnonblock(pcap_t* a0, int a1, char* a2)
|
||||
{
|
||||
typedef int(*PFN)(pcap_t*, int, char*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_setnonblock", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_sendpacket(pcap_t* a0, u_char* a1, int a2)
|
||||
{
|
||||
typedef int(*PFN)(pcap_t*, u_char*, int);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_sendpacket", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
const u_char* pcapdelay_next(pcap_t* a0, struct pcap_pkthdr* a1)
|
||||
{
|
||||
typedef const u_char*(*PFN)(pcap_t*, struct pcap_pkthdr*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_next", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_dispatch(pcap_t* a0, int a1, pcap_handler a2, u_char* a3)
|
||||
{
|
||||
typedef const int(*PFN)(pcap_t *, int, pcap_handler, u_char *);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_dispatch", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2, a3);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2014 by Peter Neubauer
|
||||
|
||||
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 <stdbool.h>
|
||||
#include "pcap_delay.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
static HMODULE module = NULL;
|
||||
#elif __linux__
|
||||
#include <dlfcn.h>
|
||||
static void* module = 0;
|
||||
#endif
|
||||
|
||||
|
||||
bool pcapdelay_load()
|
||||
{
|
||||
if (!pcapdelay_is_loaded())
|
||||
{
|
||||
#ifdef WIN32
|
||||
module = LoadLibrary("wpcap.dll");
|
||||
#elif __linux__
|
||||
module = dlopen("libpcap.so", RTLD_LAZY);
|
||||
#endif
|
||||
}
|
||||
return pcapdelay_is_loaded();
|
||||
}
|
||||
|
||||
bool pcapdelay_is_loaded()
|
||||
{
|
||||
#ifdef WIN32
|
||||
return module != NULL;
|
||||
#elif __linux__
|
||||
return module != 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pcapdelay_unload()
|
||||
{
|
||||
if (pcapdelay_is_loaded())
|
||||
{
|
||||
#ifdef WIN32
|
||||
FreeLibrary(module);
|
||||
module = NULL;
|
||||
#elif __linux__
|
||||
dlclose(module);
|
||||
module = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*PFNVOID)();
|
||||
|
||||
static PFNVOID delay_load(const char* proc, PFNVOID* ppfn)
|
||||
{
|
||||
if (pcapdelay_load() && proc && ppfn && !*ppfn)
|
||||
{
|
||||
#ifdef WIN32
|
||||
*ppfn = (PFNVOID)GetProcAddress(module, proc);
|
||||
#elif __linux__
|
||||
*ppfn = (PFNVOID)dlsym(module, proc);
|
||||
#endif
|
||||
}
|
||||
if (ppfn)
|
||||
return *ppfn;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pcapdelay_freealldevs(pcap_if_t* a0)
|
||||
{
|
||||
typedef void (*PFN)(pcap_if_t*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_freealldevs", (PFNVOID*)&pfn)))
|
||||
(*pfn)(a0);
|
||||
}
|
||||
|
||||
pcap_t* pcapdelay_open_live(const char* a0, int a1, int a2, int a3, char* a4)
|
||||
{
|
||||
typedef pcap_t* (*PFN)(const char*, int, int, int, char*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_open_live", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2, a3, a4);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pcapdelay_close(pcap_t* a0)
|
||||
{
|
||||
typedef void (*PFN)(pcap_t*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_close", (PFNVOID*)&pfn)))
|
||||
(*pfn)(a0);
|
||||
}
|
||||
|
||||
int pcapdelay_findalldevs(pcap_if_t** a0, char* a1)
|
||||
{
|
||||
typedef int (*PFN)(pcap_if_t**, char*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_findalldevs", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_datalink(pcap_t* a0)
|
||||
{
|
||||
typedef int(*PFN)(pcap_t*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_datalink", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_setnonblock(pcap_t* a0, int a1, char* a2)
|
||||
{
|
||||
typedef int(*PFN)(pcap_t*, int, char*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_setnonblock", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_sendpacket(pcap_t* a0, u_char* a1, int a2)
|
||||
{
|
||||
typedef int(*PFN)(pcap_t*, u_char*, int);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_sendpacket", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
const u_char* pcapdelay_next(pcap_t* a0, struct pcap_pkthdr* a1)
|
||||
{
|
||||
typedef const u_char*(*PFN)(pcap_t*, struct pcap_pkthdr*);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_next", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcapdelay_dispatch(pcap_t* a0, int a1, pcap_handler a2, u_char* a3)
|
||||
{
|
||||
typedef const int(*PFN)(pcap_t *, int, pcap_handler, u_char *);
|
||||
static PFN pfn = 0;
|
||||
if ((pfn = (PFN)delay_load("pcap_dispatch", (PFNVOID*)&pfn)))
|
||||
return (*pfn)(a0, a1, a2, a3);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,48 +1,50 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
/*
|
||||
This interface provides a thin, delay-loaded wrapper around the PCAP library so that
|
||||
you may start GSport without intalling PCAP. Of course, some features that require
|
||||
PCAP won't be available.
|
||||
|
||||
This wrapper provides a subset of the available PCAP APIs necessary for ATBridge.
|
||||
Feel free to extend the wrapper.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#include "../arch/win32/pcap.h"
|
||||
#elif __linux__
|
||||
#include <pcap.h>
|
||||
#elif __APPLE__
|
||||
#include <pcap/pcap.h>
|
||||
#endif
|
||||
|
||||
bool pcapdelay_load();
|
||||
bool pcapdelay_is_loaded();
|
||||
void pcapdelay_unload();
|
||||
|
||||
void pcapdelay_freealldevs(pcap_if_t *);
|
||||
pcap_t* pcapdelay_open_live(const char *, int, int, int, char *);
|
||||
void pcapdelay_close(pcap_t *);
|
||||
int pcapdelay_findalldevs(pcap_if_t **, char *);
|
||||
int pcapdelay_datalink(pcap_t *);
|
||||
int pcapdelay_setnonblock(pcap_t *, int, char *);
|
||||
int pcapdelay_sendpacket(pcap_t *p, u_char *buf, int size);
|
||||
const u_char* pcapdelay_next(pcap_t *, struct pcap_pkthdr *);
|
||||
int pcapdelay_dispatch(pcap_t *, int, pcap_handler, u_char *);
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
/*
|
||||
This interface provides a thin, delay-loaded wrapper around the PCAP library so that
|
||||
you may start GSport without intalling PCAP. Of course, some features that require
|
||||
PCAP won't be available.
|
||||
|
||||
This wrapper provides a subset of the available PCAP APIs necessary for ATBridge.
|
||||
Feel free to extend the wrapper.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#include "../arch/win32/pcap.h"
|
||||
#elif __linux__
|
||||
#include <pcap.h>
|
||||
#elif __APPLE__
|
||||
#include <pcap/pcap.h>
|
||||
#endif
|
||||
|
||||
bool pcapdelay_load();
|
||||
bool pcapdelay_is_loaded();
|
||||
void pcapdelay_unload();
|
||||
|
||||
void pcapdelay_freealldevs(pcap_if_t *);
|
||||
pcap_t* pcapdelay_open_live(const char *, int, int, int, char *);
|
||||
void pcapdelay_close(pcap_t *);
|
||||
int pcapdelay_findalldevs(pcap_if_t **, char *);
|
||||
int pcapdelay_datalink(pcap_t *);
|
||||
int pcapdelay_setnonblock(pcap_t *, int, char *);
|
||||
int pcapdelay_sendpacket(pcap_t *p, u_char *buf, int size);
|
||||
const u_char* pcapdelay_next(pcap_t *, struct pcap_pkthdr *);
|
||||
int pcapdelay_dispatch(pcap_t *, int, pcap_handler, u_char *);
|
||||
|
|
|
@ -1,139 +1,141 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements queues for storing and transferring packets within the bridge. **/
|
||||
|
||||
#include "../defc.h"
|
||||
#include "atalk.h"
|
||||
#include "port.h"
|
||||
|
||||
void port_init(struct packet_port_t* port)
|
||||
{
|
||||
if (port)
|
||||
{
|
||||
queue_init(&port->in);
|
||||
queue_init(&port->out);
|
||||
}
|
||||
}
|
||||
|
||||
void port_shutdown(struct packet_port_t* port)
|
||||
{
|
||||
if (port)
|
||||
{
|
||||
queue_shutdown(&port->in);
|
||||
queue_shutdown(&port->out);
|
||||
}
|
||||
}
|
||||
|
||||
void queue_init(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue)
|
||||
{
|
||||
queue->head = queue->tail = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void queue_shutdown(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue)
|
||||
{
|
||||
struct packet_t* packet = dequeue(queue);
|
||||
while (packet)
|
||||
{
|
||||
if (packet->data)
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
packet = dequeue(queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[])
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
packet->dest.network = dest.network;
|
||||
packet->dest.node = dest.node;
|
||||
packet->source.network = source.network;
|
||||
packet->source.node = source.node;
|
||||
packet->type = type;
|
||||
packet->size = size;
|
||||
packet->data = data;
|
||||
enqueue_packet(queue, packet);
|
||||
}
|
||||
|
||||
void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet)
|
||||
{
|
||||
packet->next = 0;
|
||||
|
||||
if (queue->tail)
|
||||
queue->tail->next = packet;
|
||||
else
|
||||
queue->head = packet;
|
||||
queue->tail = packet;
|
||||
}
|
||||
|
||||
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[])
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
packet->dest.network = dest.network;
|
||||
packet->dest.node = dest.node;
|
||||
packet->source.network = source.network;
|
||||
packet->source.node = source.node;
|
||||
packet->type = type;
|
||||
packet->size = size;
|
||||
packet->data = data;
|
||||
insert_packet(queue, packet);
|
||||
}
|
||||
|
||||
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet)
|
||||
{
|
||||
packet->next = queue->head;
|
||||
queue->head = packet;
|
||||
if (!queue->tail)
|
||||
queue->tail = queue->head;
|
||||
}
|
||||
|
||||
struct packet_t* dequeue(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue && queue->head)
|
||||
{
|
||||
struct packet_t* packet = queue->head;
|
||||
if (queue->tail == queue->head)
|
||||
queue->tail = queue->head = 0;
|
||||
else
|
||||
queue->head = packet->next;
|
||||
return packet;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct packet_t* queue_peek(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue)
|
||||
return queue->head;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/** This module implements queues for storing and transferring packets within the bridge. **/
|
||||
|
||||
#include "../defc.h"
|
||||
#include "atalk.h"
|
||||
#include "port.h"
|
||||
|
||||
void port_init(struct packet_port_t* port)
|
||||
{
|
||||
if (port)
|
||||
{
|
||||
queue_init(&port->in);
|
||||
queue_init(&port->out);
|
||||
}
|
||||
}
|
||||
|
||||
void port_shutdown(struct packet_port_t* port)
|
||||
{
|
||||
if (port)
|
||||
{
|
||||
queue_shutdown(&port->in);
|
||||
queue_shutdown(&port->out);
|
||||
}
|
||||
}
|
||||
|
||||
void queue_init(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue)
|
||||
{
|
||||
queue->head = queue->tail = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void queue_shutdown(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue)
|
||||
{
|
||||
struct packet_t* packet = dequeue(queue);
|
||||
while (packet)
|
||||
{
|
||||
if (packet->data)
|
||||
free(packet->data);
|
||||
free(packet);
|
||||
packet = dequeue(queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[])
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
packet->dest.network = dest.network;
|
||||
packet->dest.node = dest.node;
|
||||
packet->source.network = source.network;
|
||||
packet->source.node = source.node;
|
||||
packet->type = type;
|
||||
packet->size = size;
|
||||
packet->data = data;
|
||||
enqueue_packet(queue, packet);
|
||||
}
|
||||
|
||||
void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet)
|
||||
{
|
||||
packet->next = 0;
|
||||
|
||||
if (queue->tail)
|
||||
queue->tail->next = packet;
|
||||
else
|
||||
queue->head = packet;
|
||||
queue->tail = packet;
|
||||
}
|
||||
|
||||
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[])
|
||||
{
|
||||
if (!queue)
|
||||
return;
|
||||
|
||||
struct packet_t* packet = (struct packet_t*)malloc(sizeof(struct packet_t));
|
||||
packet->dest.network = dest.network;
|
||||
packet->dest.node = dest.node;
|
||||
packet->source.network = source.network;
|
||||
packet->source.node = source.node;
|
||||
packet->type = type;
|
||||
packet->size = size;
|
||||
packet->data = data;
|
||||
insert_packet(queue, packet);
|
||||
}
|
||||
|
||||
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet)
|
||||
{
|
||||
packet->next = queue->head;
|
||||
queue->head = packet;
|
||||
if (!queue->tail)
|
||||
queue->tail = queue->head;
|
||||
}
|
||||
|
||||
struct packet_t* dequeue(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue && queue->head)
|
||||
{
|
||||
struct packet_t* packet = queue->head;
|
||||
if (queue->tail == queue->head)
|
||||
queue->tail = queue->head = 0;
|
||||
else
|
||||
queue->head = packet->next;
|
||||
return packet;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct packet_t* queue_peek(struct packet_queue_t* queue)
|
||||
{
|
||||
if (queue)
|
||||
return queue->head;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,58 +1,60 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
struct packet_t
|
||||
{
|
||||
struct at_addr_t dest;
|
||||
struct at_addr_t source;
|
||||
byte type;
|
||||
size_t size;
|
||||
byte* data;
|
||||
struct packet_t* next;
|
||||
};
|
||||
|
||||
struct packet_queue_t
|
||||
{
|
||||
struct packet_t* head;
|
||||
struct packet_t* tail;
|
||||
};
|
||||
|
||||
void queue_init(struct packet_queue_t* queue);
|
||||
void queue_shutdown(struct packet_queue_t* queue);
|
||||
|
||||
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
|
||||
void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet);
|
||||
|
||||
struct packet_t* dequeue(struct packet_queue_t* queue);
|
||||
struct packet_t* queue_peek(struct packet_queue_t* queue);
|
||||
|
||||
// Insert the packet at the head of the queue, contrary to normal FIFO operation.
|
||||
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
|
||||
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet);
|
||||
|
||||
|
||||
|
||||
struct packet_port_t
|
||||
{
|
||||
struct packet_queue_t in;
|
||||
struct packet_queue_t out;
|
||||
};
|
||||
|
||||
void port_init(struct packet_port_t* port);
|
||||
void port_shutdown(struct packet_port_t* port);
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013-2014 by Peter Neubauer
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
struct packet_t
|
||||
{
|
||||
struct at_addr_t dest;
|
||||
struct at_addr_t source;
|
||||
byte type;
|
||||
size_t size;
|
||||
byte* data;
|
||||
struct packet_t* next;
|
||||
};
|
||||
|
||||
struct packet_queue_t
|
||||
{
|
||||
struct packet_t* head;
|
||||
struct packet_t* tail;
|
||||
};
|
||||
|
||||
void queue_init(struct packet_queue_t* queue);
|
||||
void queue_shutdown(struct packet_queue_t* queue);
|
||||
|
||||
void enqueue(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
|
||||
void enqueue_packet(struct packet_queue_t* queue, struct packet_t* packet);
|
||||
|
||||
struct packet_t* dequeue(struct packet_queue_t* queue);
|
||||
struct packet_t* queue_peek(struct packet_queue_t* queue);
|
||||
|
||||
// Insert the packet at the head of the queue, contrary to normal FIFO operation.
|
||||
void insert(struct packet_queue_t* queue, struct at_addr_t dest, struct at_addr_t source, byte type, size_t size, byte data[]);
|
||||
void insert_packet(struct packet_queue_t* queue, struct packet_t* packet);
|
||||
|
||||
|
||||
|
||||
struct packet_port_t
|
||||
{
|
||||
struct packet_queue_t in;
|
||||
struct packet_queue_t out;
|
||||
};
|
||||
|
||||
void port_init(struct packet_port_t* port);
|
||||
void port_shutdown(struct packet_port_t* port);
|
||||
|
|
50
src/clock.c
50
src/clock.c
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
@ -29,7 +31,7 @@
|
|||
#endif
|
||||
|
||||
extern int Verbose;
|
||||
extern word32 g_vbl_count; // OG change int to word32
|
||||
extern word32 g_vbl_count; // OG change int to word32
|
||||
extern int g_rom_version;
|
||||
extern int g_config_gsport_update_needed;
|
||||
|
||||
|
@ -108,7 +110,7 @@ micro_sleep(double dtime)
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
Sleep((DWORD)(dtime * 1000));
|
||||
Sleep((DWORD)(dtime * 1000));
|
||||
#else
|
||||
Timer.tv_sec = 0;
|
||||
Timer.tv_usec = (dtime * 1000000.0);
|
||||
|
@ -141,13 +143,13 @@ clk_bram_set(int bram_num, int offset, int val)
|
|||
g_bram[bram_num][offset] = val;
|
||||
}
|
||||
|
||||
|
||||
extern void x_clk_setup_bram_version();
|
||||
|
||||
|
||||
extern void x_clk_setup_bram_version();
|
||||
|
||||
void
|
||||
clk_setup_bram_version()
|
||||
{
|
||||
x_clk_setup_bram_version();
|
||||
x_clk_setup_bram_version();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -204,29 +206,29 @@ update_cur_time()
|
|||
time_t cur_time;
|
||||
unsigned int secs, secs2;
|
||||
|
||||
|
||||
#ifdef UNDER_CE // OG Not supported on WIndows CE
|
||||
/*
|
||||
SYSTEMTIME stime;
|
||||
FILETIME ftime;
|
||||
GetLocalTime(&stime);
|
||||
SystemTimeToFileTime(&stime,&ftime);
|
||||
cur_time = ftime.dwLowDateTime;
|
||||
*/
|
||||
cur_time = time(0);
|
||||
|
||||
secs=0;
|
||||
secs2=0;
|
||||
|
||||
#else
|
||||
|
||||
#ifdef UNDER_CE // OG Not supported on WIndows CE
|
||||
/*
|
||||
SYSTEMTIME stime;
|
||||
FILETIME ftime;
|
||||
GetLocalTime(&stime);
|
||||
SystemTimeToFileTime(&stime,&ftime);
|
||||
cur_time = ftime.dwLowDateTime;
|
||||
*/
|
||||
cur_time = time(0);
|
||||
|
||||
secs=0;
|
||||
secs2=0;
|
||||
|
||||
#else
|
||||
cur_time = time(0);
|
||||
|
||||
/* Figure out the timezone (effectively) by diffing two times. */
|
||||
/* this is probably not right for a few hours around daylight savings*/
|
||||
/* time transition */
|
||||
secs2 = (unsigned int)mktime(gmtime(&cur_time));
|
||||
secs2 = (unsigned int)mktime(gmtime(&cur_time));
|
||||
tm_ptr = localtime(&cur_time);
|
||||
secs = (unsigned int)mktime(tm_ptr);
|
||||
secs = (unsigned int)mktime(tm_ptr);
|
||||
|
||||
#ifdef MAC
|
||||
/* Mac OS X's mktime function modifies the tm_ptr passed in for */
|
||||
|
@ -241,7 +243,7 @@ update_cur_time()
|
|||
secs += 3600;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
/* add in secs to make date based on Apple Jan 1, 1904 instead of */
|
||||
/* Unix's Jan 1, 1970 */
|
||||
/* So add in 66 years and 17 leap year days (1904 is a leap year) */
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
114
src/config.c
114
src/config.c
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
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
|
||||
|
@ -97,17 +99,17 @@ extern char* g_printer_font_courier;
|
|||
extern char* g_printer_font_script;
|
||||
extern char* g_printer_font_ocra;
|
||||
extern int g_printer_timeout;
|
||||
|
||||
|
||||
extern int g_imagewriter;
|
||||
extern int g_imagewriter_dpi;
|
||||
extern char* g_imagewriter_output;
|
||||
extern int g_imagewriter_multipage;
|
||||
extern int g_imagewriter_timeout;
|
||||
extern char* g_imagewriter_fixed_font;
|
||||
extern char* g_imagewriter_prop_font;
|
||||
extern char* g_imagewriter_prop_font;
|
||||
extern int g_imagewriter_paper;
|
||||
extern int g_imagewriter_banner;
|
||||
|
||||
extern int g_imagewriter_banner;
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
extern int g_win_show_console_request;
|
||||
extern int g_win_status_debug_request;
|
||||
|
@ -197,14 +199,14 @@ Cfg_menu g_cfg_disk_menu[] = {
|
|||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
// OG Use define instead of const for joystick_types
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
|
||||
// OG Use define instead of const for joystick_types
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
|
||||
Cfg_menu g_cfg_joystick_menu[] = {
|
||||
{ "Joystick Configuration", g_cfg_joystick_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Joystick Emulation,"TOSTRING(JOYSTICK_TYPE_KEYPAD)",Keypad Joystick,"TOSTRING(JOYSTICK_TYPE_MOUSE)",Mouse Joystick,"TOSTRING(JOYSTICK_TYPE_NATIVE_1)",Native Joystick 1,"
|
||||
TOSTRING(JOYSTICK_TYPE_NATIVE_2)",Native Joystick 2,"TOSTRING(JOYSTICK_TYPE_NONE)",No Joystick", KNMP(g_joystick_type), CFGTYPE_INT },
|
||||
{ "Joystick Emulation,"TOSTRING(JOYSTICK_TYPE_KEYPAD)",Keypad Joystick,"TOSTRING(JOYSTICK_TYPE_MOUSE)",Mouse Joystick,"TOSTRING(JOYSTICK_TYPE_NATIVE_1)",Native Joystick 1,"
|
||||
TOSTRING(JOYSTICK_TYPE_NATIVE_2)",Native Joystick 2,"TOSTRING(JOYSTICK_TYPE_NONE)",No Joystick", KNMP(g_joystick_type), CFGTYPE_INT },
|
||||
{ "Joystick Scale X,0x100,Standard,0x119,+10%,0x133,+20%,"
|
||||
"0x150,+30%,0xb0,-30%,0xcd,-20%,0xe7,-10%",
|
||||
KNMP(g_joystick_scale_factor_x), CFGTYPE_INT },
|
||||
|
@ -287,7 +289,7 @@ Cfg_menu g_cfg_ethernet_menu[] = {
|
|||
};
|
||||
#ifdef HAVE_SDL
|
||||
Cfg_menu g_cfg_printer_menu[] = {
|
||||
{ "Virtual Epson Configuration", g_cfg_printer_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Virtual Epson Configuration", g_cfg_printer_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Virtual Printer Type,0,Epson LQ",
|
||||
KNMP(g_printer), CFGTYPE_INT },
|
||||
{ "Printer DPI,60,60x60 dpi,180,180x180 dpi,360,360x360 dpi",
|
||||
|
@ -313,36 +315,36 @@ Cfg_menu g_cfg_printer_menu[] = {
|
|||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Cfg_menu g_cfg_imagewriter_menu[] = {
|
||||
{ "Virtual ImageWriter Configuration", g_cfg_imagewriter_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Virtual Printer Type,0,ImageWriter II,1,ImageWriter LQ",
|
||||
KNMP(g_imagewriter), CFGTYPE_INT },
|
||||
Cfg_menu g_cfg_imagewriter_menu[] = {
|
||||
{ "Virtual ImageWriter Configuration", g_cfg_imagewriter_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ "Virtual Printer Type,0,ImageWriter II,1,ImageWriter LQ",
|
||||
KNMP(g_imagewriter), CFGTYPE_INT },
|
||||
{ "Paper Size,0,US Letter (8.5x11in),1,US Legal (8.5x14in),2,ISO A4 (210 x 297mm),3,ISO B5 (176 x 250mm),4,Wide Fanfold (14 x 11in),5,Ledger (11 x 17in),6,ISO A3 (297 x 420mm)",
|
||||
KNMP(g_imagewriter_paper), CFGTYPE_INT },
|
||||
{ "Printer DPI,360,360x360 dpi (Best for 8-bit software),720,720x720 dpi (Best for GS/OS & IW LQ Modes),1440,1440x1440 dpi",
|
||||
KNMP(g_imagewriter_dpi), CFGTYPE_INT },
|
||||
KNMP(g_imagewriter_paper), CFGTYPE_INT },
|
||||
{ "Printer DPI,360,360x360 dpi (Best for 8-bit software),720,720x720 dpi (Best for GS/OS & IW LQ Modes),1440,1440x1440 dpi",
|
||||
KNMP(g_imagewriter_dpi), CFGTYPE_INT },
|
||||
{ "Banner Printing (Limited To 144x144 dpi Output),0,Banner Printing Off,3,3 Pages Long,4,4 Pages Long,5,5 Pages Long,6,6 Pages Long,7,7 Pages Long,8,8 Pages Long,9,9 Pages Long,10,10 Pages Long",
|
||||
KNMP(g_imagewriter_banner), CFGTYPE_INT },
|
||||
{ "Printer Output Type,bmp,Windows Bitmap,ps,Postscript (B&W),colorps,Postscript (Color),printer,Direct to host printer,text,Text file",
|
||||
KNMP(g_imagewriter_output), CFGTYPE_STR },
|
||||
{ "Multipage Files? (PS and Direct to Host Only),0,No,1,Yes",
|
||||
KNMP(g_imagewriter_multipage), CFGTYPE_INT },
|
||||
{ "Printer Timeout,0,Never,2,2 sec.,15,15 sec.,30,30 sec.,60, 1 min.",
|
||||
KNMP(g_imagewriter_timeout), CFGTYPE_INT },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "ImageWriter Fonts", 0, 0, 0, 0 },
|
||||
{ "-----------------", 0, 0, 0, 0 },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Fixed Width Font", KNMP(g_imagewriter_fixed_font), CFGTYPE_FILE },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Proportional Font", KNMP(g_imagewriter_prop_font), CFGTYPE_FILE },
|
||||
KNMP(g_imagewriter_banner), CFGTYPE_INT },
|
||||
{ "Printer Output Type,bmp,Windows Bitmap,ps,Postscript (B&W),colorps,Postscript (Color),printer,Direct to host printer,text,Text file",
|
||||
KNMP(g_imagewriter_output), CFGTYPE_STR },
|
||||
{ "Multipage Files? (PS and Direct to Host Only),0,No,1,Yes",
|
||||
KNMP(g_imagewriter_multipage), CFGTYPE_INT },
|
||||
{ "Printer Timeout,0,Never,2,2 sec.,15,15 sec.,30,30 sec.,60, 1 min.",
|
||||
KNMP(g_imagewriter_timeout), CFGTYPE_INT },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
{ "ImageWriter Fonts", 0, 0, 0, 0 },
|
||||
{ "-----------------", 0, 0, 0, 0 },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Fixed Width Font", KNMP(g_imagewriter_fixed_font), CFGTYPE_FILE },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Proportional Font", KNMP(g_imagewriter_prop_font), CFGTYPE_FILE },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "", 0, 0, 0, 0 },
|
||||
{ "Back to Main Config", g_cfg_main_menu, 0, 0, CFGTYPE_MENU },
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
Cfg_menu g_cfg_devel_menu[] = {
|
||||
{ "Developer Options", g_cfg_devel_menu, 0, 0, CFGTYPE_MENU },
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
|
@ -2256,9 +2258,9 @@ cfg_parse_menu(Cfg_menu *menuptr, int menu_pos, int highlight_pos, int change)
|
|||
defval = -1;
|
||||
curstr = 0;
|
||||
if(type == CFGTYPE_INT) {
|
||||
iptr = (int*)menuptr->ptr; // OG Added cast
|
||||
iptr = (int*)menuptr->ptr; // OG Added cast
|
||||
curval = *iptr;
|
||||
iptr = (int*)menuptr->defptr; // OG Added cast
|
||||
iptr = (int*)menuptr->defptr; // OG Added cast
|
||||
defval = *iptr;
|
||||
if(curval == defval) {
|
||||
g_cfg_opt_buf[3] = 'D'; /* checkmark */
|
||||
|
@ -2570,10 +2572,10 @@ cfg_file_add_dirent(Cfg_listhdr *listhdrptr, const char *nameptr, int is_dir,
|
|||
inc_amt = MAX(64, listhdrptr->max);
|
||||
inc_amt = MIN(inc_amt, 1024);
|
||||
listhdrptr->max += inc_amt;
|
||||
listhdrptr->direntptr = (Cfg_dirent*)realloc(listhdrptr->direntptr,
|
||||
listhdrptr->direntptr = (Cfg_dirent*)realloc(listhdrptr->direntptr,
|
||||
listhdrptr->max * sizeof(Cfg_dirent));
|
||||
}
|
||||
ptr = (char*)malloc(namelen+1+is_dir); // OG Added cast
|
||||
ptr = (char*)malloc(namelen+1+is_dir); // OG Added cast
|
||||
strncpy(ptr, nameptr, namelen+1);
|
||||
if(is_dir) {
|
||||
strcat(ptr, "/");
|
||||
|
@ -2599,10 +2601,10 @@ cfg_dirent_sortfn(const void *obj1, const void *obj2)
|
|||
/* Called by qsort to sort directory listings */
|
||||
direntptr1 = (const Cfg_dirent *)obj1;
|
||||
direntptr2 = (const Cfg_dirent *)obj2;
|
||||
#if defined(MAC) || defined(_WIN32)
|
||||
// OG
|
||||
ret = 0;
|
||||
// ret = strcasecmp(direntptr1->name, direntptr2->name);
|
||||
#if defined(MAC) || defined(_WIN32)
|
||||
// OG
|
||||
ret = 0;
|
||||
// ret = strcasecmp(direntptr1->name, direntptr2->name);
|
||||
#else
|
||||
ret = strcmp(direntptr1->name, direntptr2->name);
|
||||
#endif
|
||||
|
@ -3042,7 +3044,7 @@ cfg_file_update_ptr(char *str)
|
|||
char *newstr;
|
||||
int len;
|
||||
len = strlen(str) + 1;
|
||||
newstr = (char*)malloc(len);
|
||||
newstr = (char*)malloc(len);
|
||||
memcpy(newstr, str, len);
|
||||
if(g_cfg_file_strptr) {
|
||||
if(*g_cfg_file_strptr) {
|
||||
|
@ -3415,12 +3417,12 @@ config_control_panel()
|
|||
g_full_refresh_needed = -1;
|
||||
g_a2_screen_buffer_changed = -1;
|
||||
}
|
||||
|
||||
void x_clk_setup_bram_version()
|
||||
{
|
||||
if(g_rom_version < 3) {
|
||||
g_bram_ptr = (&g_bram[0][0]); // ROM 01
|
||||
} else {
|
||||
g_bram_ptr = (&g_bram[1][0]); // ROM 03
|
||||
}
|
||||
}
|
||||
|
||||
void x_clk_setup_bram_version()
|
||||
{
|
||||
if(g_rom_version < 3) {
|
||||
g_bram_ptr = (&g_bram[0][0]); // ROM 01
|
||||
} else {
|
||||
g_bram_ptr = (&g_bram[1][0]); // ROM 03
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
|
||||
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
|
||||
|
|
104
src/defc.h
104
src/defc.h
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
@ -21,15 +23,15 @@
|
|||
|
||||
#include "defcomm.h"
|
||||
|
||||
// OG redirect printf to console
|
||||
#ifdef ACTIVEGS
|
||||
#include <stdio.h>
|
||||
extern "C" int outputInfo(const char* format,...);
|
||||
extern "C" int fOutputInfo(FILE*,const char* format,...);
|
||||
#define printf outputInfo
|
||||
#define fprintf fOutputInfo
|
||||
#endif
|
||||
|
||||
// OG redirect printf to console
|
||||
#ifdef ACTIVEGS
|
||||
#include <stdio.h>
|
||||
extern "C" int outputInfo(const char* format,...);
|
||||
extern "C" int fOutputInfo(FILE*,const char* format,...);
|
||||
#define printf outputInfo
|
||||
#define fprintf fOutputInfo
|
||||
#endif
|
||||
|
||||
#define STRUCT(a) typedef struct _ ## a a; struct _ ## a
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
@ -83,45 +85,45 @@ void U_STACK_TRACE();
|
|||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef UNDER_CE // OG CE SPecific
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef UNDER_CE // OG CE SPecific
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
// OG Adding support for open
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
extern int errno;
|
||||
extern int open(const char* name,int,...);
|
||||
extern int read(int,char*,int);
|
||||
extern int close(int);
|
||||
extern int write( int fd, const void *buffer, unsigned int count );
|
||||
extern int lseek(int,int,int);
|
||||
struct stat { int st_size; };
|
||||
extern int stat(const char* name, struct stat*);
|
||||
extern int fstat(int, struct stat*);
|
||||
#define O_RDWR 1
|
||||
#define O_BINARY 2
|
||||
#define O_RDONLY 4
|
||||
#define O_WRONLY 8
|
||||
#define O_CREAT 16
|
||||
#define O_TRUNC 32
|
||||
#define EAGAIN 11
|
||||
#define EINTR 4
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// OG Adding support for open
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
extern int errno;
|
||||
extern int open(const char* name,int,...);
|
||||
extern int read(int,char*,int);
|
||||
extern int close(int);
|
||||
extern int write( int fd, const void *buffer, unsigned int count );
|
||||
extern int lseek(int,int,int);
|
||||
struct stat { int st_size; };
|
||||
extern int stat(const char* name, struct stat*);
|
||||
extern int fstat(int, struct stat*);
|
||||
#define O_RDWR 1
|
||||
#define O_BINARY 2
|
||||
#define O_RDONLY 4
|
||||
#define O_WRONLY 8
|
||||
#define O_CREAT 16
|
||||
#define O_TRUNC 32
|
||||
#define EAGAIN 11
|
||||
#define EINTR 4
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HPUX
|
||||
# include <machine/inline.h> /* for GET_ITIMER */
|
||||
#endif
|
||||
|
@ -361,10 +363,10 @@ STRUCT(Emustate_word32list) {
|
|||
|
||||
#include "iwm.h"
|
||||
#include "protos.h"
|
||||
// OG Added define for joystick
|
||||
#define JOYSTICK_TYPE_KEYPAD 0
|
||||
#define JOYSTICK_TYPE_MOUSE 1
|
||||
#define JOYSTICK_TYPE_NATIVE_1 2
|
||||
#define JOYSTICK_TYPE_NATIVE_2 3
|
||||
#define JOYSTICK_TYPE_NONE 4 // OG Added Joystick None
|
||||
#define NB_JOYSTICK_TYPE 5
|
||||
// OG Added define for joystick
|
||||
#define JOYSTICK_TYPE_KEYPAD 0
|
||||
#define JOYSTICK_TYPE_MOUSE 1
|
||||
#define JOYSTICK_TYPE_NATIVE_1 2
|
||||
#define JOYSTICK_TYPE_NATIVE_2 3
|
||||
#define JOYSTICK_TYPE_NONE 4 // OG Added Joystick None
|
||||
#define NB_JOYSTICK_TYPE 5
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
@ -35,8 +37,8 @@
|
|||
|
||||
|
||||
#define HALT_EVENT 0x10
|
||||
#define HALT_WANTTOQUIT 0x20 // OG : added WANTTOQUIT event
|
||||
#define HALT_WANTTOBRK 0x40 // OG : added WANTTOBRK event
|
||||
#define HALT_WANTTOQUIT 0x20 // OG : added WANTTOQUIT event
|
||||
#define HALT_WANTTOBRK 0x40 // OG : added WANTTOBRK event
|
||||
|
||||
#define MAX_BREAK_POINTS 0x20
|
||||
|
||||
|
@ -148,11 +150,11 @@
|
|||
|
||||
#define BORDER_WIDTH 32
|
||||
|
||||
//#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560))
|
||||
//#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560))
|
||||
|
||||
// OG Eff_border_widht == border side in A2 mode
|
||||
#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560)/2)
|
||||
|
||||
// OG Eff_border_widht == border side in A2 mode
|
||||
#define EFF_BORDER_WIDTH (BORDER_WIDTH + (640-560)/2)
|
||||
|
||||
/* BASE_MARGIN_BOTTOM+MARGIN_TOP must equal 62. There are 262 scan lines */
|
||||
/* at 60Hz (15.7KHz line rate) and so we just make 62 border lines */
|
||||
#define BASE_MARGIN_TOP 32
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
20
src/dis.c
20
src/dis.c
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
@ -61,8 +63,8 @@ char *line_ptr;
|
|||
int mode,old_mode;
|
||||
int got_num;
|
||||
|
||||
// OG replaced by HALT_WANTTOQUIT
|
||||
//int g_quit_sim_now = 0;
|
||||
// OG replaced by HALT_WANTTOQUIT
|
||||
//int g_quit_sim_now = 0;
|
||||
|
||||
int
|
||||
get_num()
|
||||
|
@ -177,9 +179,9 @@ do_debug_intfc()
|
|||
g_fullscreen = 0;
|
||||
x_full_screen(0);
|
||||
|
||||
// OG use HALT_WANTTOQUIT instead of g_quit_sim_now
|
||||
if (halt_sim&HALT_WANTTOQUIT)
|
||||
{
|
||||
// OG use HALT_WANTTOQUIT instead of g_quit_sim_now
|
||||
if (halt_sim&HALT_WANTTOQUIT)
|
||||
{
|
||||
printf("Exiting immediately\n");
|
||||
return;
|
||||
}
|
||||
|
@ -863,15 +865,15 @@ do_debug_unix()
|
|||
}
|
||||
if(load) {
|
||||
if(a1bank >= 0xe0 && a1bank < 0xe2) {
|
||||
ret = read(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len);
|
||||
ret = read(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len);
|
||||
} else {
|
||||
ret = read(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len);
|
||||
ret = read(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len);
|
||||
}
|
||||
} else {
|
||||
if(a1bank >= 0xe0 && a1bank < 0xe2) {
|
||||
ret = write(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len);
|
||||
ret = write(fd,(char*)&g_slow_memory_ptr[((a1bank & 1)<<16)+a1],len);
|
||||
} else {
|
||||
ret = write(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len);
|
||||
ret = write(fd,(char*)&g_memory_ptr[(a1bank << 16) + a1],len);
|
||||
}
|
||||
}
|
||||
printf("Read/write: addr %06x for %04x bytes, ret: %x bytes\n",
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
@ -583,8 +585,8 @@ get_memory16_c(word32 addr, int cycs)
|
|||
double fcycs;
|
||||
|
||||
fcycs = 0;
|
||||
return get_memory_c(addr, (int)fcycs) +
|
||||
(get_memory_c(addr+1, (int)fcycs) << 8);
|
||||
return get_memory_c(addr, (int)fcycs) +
|
||||
(get_memory_c(addr+1, (int)fcycs) << 8);
|
||||
}
|
||||
|
||||
word32
|
||||
|
@ -593,9 +595,9 @@ get_memory24_c(word32 addr, int cycs)
|
|||
double fcycs;
|
||||
|
||||
fcycs = 0;
|
||||
return get_memory_c(addr, (int)fcycs) +
|
||||
(get_memory_c(addr+1, (int)fcycs) << 8) +
|
||||
(get_memory_c(addr+2, (int)fcycs) << 16);
|
||||
return get_memory_c(addr, (int)fcycs) +
|
||||
(get_memory_c(addr+1, (int)fcycs) << 8) +
|
||||
(get_memory_c(addr+2, (int)fcycs) << 16);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -748,11 +750,11 @@ fixed_memory_ptrs_init()
|
|||
/* set g_slow_memory_ptr, g_rom_fc_ff_ptr, g_dummy_memory1_ptr, */
|
||||
/* and rom_cards_ptr */
|
||||
|
||||
// OG Filled allocated ptr parameter to free the memory
|
||||
g_slow_memory_ptr = memalloc_align(128*1024, 0, (void**)&g_slow_memory_ptr_allocated);
|
||||
g_dummy_memory1_ptr = memalloc_align(256, 1024, (void**)&g_dummy_memory1_ptr_allocated);
|
||||
g_rom_fc_ff_ptr = memalloc_align(256*1024, 512, (void**)&g_rom_fc_ff_ptr_allocated);
|
||||
g_rom_cards_ptr = memalloc_align(16*256, 256, (void**)&g_rom_cards_ptr_allocated);
|
||||
// OG Filled allocated ptr parameter to free the memory
|
||||
g_slow_memory_ptr = memalloc_align(128*1024, 0, (void**)&g_slow_memory_ptr_allocated);
|
||||
g_dummy_memory1_ptr = memalloc_align(256, 1024, (void**)&g_dummy_memory1_ptr_allocated);
|
||||
g_rom_fc_ff_ptr = memalloc_align(256*1024, 512, (void**)&g_rom_fc_ff_ptr_allocated);
|
||||
g_rom_cards_ptr = memalloc_align(16*256, 256, (void**)&g_rom_cards_ptr_allocated);
|
||||
|
||||
#if 0
|
||||
printf("g_memory_ptr: %08x, dummy_mem: %08x, slow_mem_ptr: %08x\n",
|
||||
|
@ -766,22 +768,22 @@ fixed_memory_ptrs_init()
|
|||
#endif
|
||||
}
|
||||
|
||||
// OG added fixed_memory_ptrs_shut
|
||||
void fixed_memory_ptrs_shut()
|
||||
{
|
||||
|
||||
free(g_slow_memory_ptr_allocated);
|
||||
free(g_dummy_memory1_ptr_allocated);
|
||||
free(g_rom_fc_ff_ptr_allocated);
|
||||
free(g_rom_cards_ptr_allocated);
|
||||
g_slow_memory_ptr=g_slow_memory_ptr_allocated= NULL;
|
||||
g_dummy_memory1_ptr = g_dummy_memory1_ptr_allocated = NULL;
|
||||
g_rom_fc_ff_ptr = g_rom_fc_ff_ptr_allocated = NULL;
|
||||
// OG added fixed_memory_ptrs_shut
|
||||
void fixed_memory_ptrs_shut()
|
||||
{
|
||||
|
||||
free(g_slow_memory_ptr_allocated);
|
||||
free(g_dummy_memory1_ptr_allocated);
|
||||
free(g_rom_fc_ff_ptr_allocated);
|
||||
free(g_rom_cards_ptr_allocated);
|
||||
g_slow_memory_ptr=g_slow_memory_ptr_allocated= NULL;
|
||||
g_dummy_memory1_ptr = g_dummy_memory1_ptr_allocated = NULL;
|
||||
g_rom_fc_ff_ptr = g_rom_fc_ff_ptr_allocated = NULL;
|
||||
// g_rom_cards_ptr = g_rom_cards_ptr = NULL; // a mistake?
|
||||
g_rom_cards_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
word32
|
||||
get_itimer()
|
||||
{
|
||||
|
@ -909,7 +911,7 @@ get_remaining_operands(word32 addr, word32 opcode, word32 psr, Fplus *fplus_ptr)
|
|||
if((addr & 0xfffff0) == 0x00c700) { \
|
||||
if(addr == 0xc700) { \
|
||||
FINISH(RET_C700, 0); \
|
||||
} else if(addr == 0xc70a) { \
|
||||
} else if(addr == 0xc70a) { \
|
||||
FINISH(RET_C70A, 0); \
|
||||
} else if(addr == 0xc70d) { \
|
||||
FINISH(RET_C70D, 0); \
|
||||
|
|
1116
src/fbdriver.c
1116
src/fbdriver.c
File diff suppressed because it is too large
Load Diff
|
@ -1,36 +1,36 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2012 for Windows Desktop
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsport", "gsport.vcxproj", "{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B} = {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}
|
||||
{E810477A-E004-4308-A58A-21393213EF89} = {E810477A-E004-4308-A58A-21393213EF89}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tfe", "tfe\tfe.vcxproj", "{E810477A-E004-4308-A58A-21393213EF89}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "atbridge", "atbridge\atbridge.vcxproj", "{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.Build.0 = Release|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.Build.0 = Release|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2012 for Windows Desktop
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsport", "gsport.vcxproj", "{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B} = {2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}
|
||||
{E810477A-E004-4308-A58A-21393213EF89} = {E810477A-E004-4308-A58A-21393213EF89}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tfe", "tfe\tfe.vcxproj", "{E810477A-E004-4308-A58A-21393213EF89}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "atbridge", "atbridge\atbridge.vcxproj", "{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}.Release|Win32.Build.0 = Release|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E810477A-E004-4308-A58A-21393213EF89}.Release|Win32.Build.0 = Release|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2C88133A-7CB8-4C03-AF4D-4ECFC6F8500B}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,203 +1,203 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>gsport</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_TFE;HAVE_ATBRIDGE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<ErrorReporting>Prompt</ErrorReporting>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_ATBRIDGE;HAVE_TFE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<ErrorReporting>Prompt</ErrorReporting>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="16inst_c.h" />
|
||||
<ClInclude Include="8inst_c.h" />
|
||||
<ClInclude Include="adb.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="defc.h" />
|
||||
<ClInclude Include="defcomm.h" />
|
||||
<ClInclude Include="defs.h" />
|
||||
<ClInclude Include="defs_instr.h" />
|
||||
<ClInclude Include="disas.h" />
|
||||
<ClInclude Include="gsportfont.h" />
|
||||
<CustomBuild Include="instable.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_inst c 8 instable.h > 8inst_c.h
|
||||
perl make_inst c 16 instable.h > 16inst_c.h
|
||||
perl make_inst s 8 instable.h > 8inst_s.h
|
||||
perl make_inst s 16 instable.h > 16inst_s.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_inst c 8 instable.h > 8inst_c.h
|
||||
perl make_inst c 16 instable.h > 16inst_c.h
|
||||
perl make_inst s 8 instable.h > 8inst_s.h
|
||||
perl make_inst s 16 instable.h > 16inst_s.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="scc_llap.h" />
|
||||
<ClInclude Include="win_keymap.h" />
|
||||
<ClInclude Include="iwm.h" />
|
||||
<ClInclude Include="iwm_35_525.h" />
|
||||
<ClInclude Include="op_routs.h" />
|
||||
<ClInclude Include="printer.h" />
|
||||
<ClInclude Include="printer_charmaps.h" />
|
||||
<ClInclude Include="imagewriter.h" />
|
||||
<ClInclude Include="iw_charmaps.h" />
|
||||
<ClInclude Include="prodos.h" />
|
||||
<ClInclude Include="prodos_protos.h" />
|
||||
<ClInclude Include="protos.h" />
|
||||
<ClInclude Include="protos_engine_c.h" />
|
||||
<ClInclude Include="protos_macdriver.h" />
|
||||
<ClInclude Include="protos_macsnd_driver.h" />
|
||||
<ClInclude Include="protos_windriver.h" />
|
||||
<ClInclude Include="protos_xdriver.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="scc.h" />
|
||||
<ClInclude Include="size_c.h" />
|
||||
<CustomBuild Include="size_tab.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_size c size_tab.h > size_c.h
|
||||
perl make_size s size_tab.h > size_s.h
|
||||
perl make_size 8 size_tab.h > 8size_s.h
|
||||
perl make_size 16 size_tab.h > 16size_s.h
|
||||
perl make_size c size_tab.h > size_c.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_size c size_tab.h > size_c.h
|
||||
perl make_size s size_tab.h > size_s.h
|
||||
perl make_size 8 size_tab.h > 8size_s.h
|
||||
perl make_size 16 size_tab.h > 16size_s.h
|
||||
perl make_size c size_tab.h > size_c.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="sound.h" />
|
||||
<ClInclude Include="superhires.h" />
|
||||
<ClInclude Include="support.h" />
|
||||
<ClInclude Include="tfe\protos_tfe.h" />
|
||||
<ClInclude Include="winresource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="adb.c" />
|
||||
<ClCompile Include="clock.c" />
|
||||
<ClCompile Include="compile_time.c" />
|
||||
<ClCompile Include="config.c" />
|
||||
<ClCompile Include="dis.c" />
|
||||
<ClCompile Include="engine_c.c" />
|
||||
<ClCompile Include="iwm.c" />
|
||||
<ClCompile Include="joystick_driver.c" />
|
||||
<ClCompile Include="moremem.c" />
|
||||
<ClCompile Include="paddles.c" />
|
||||
<ClCompile Include="parallel.c" />
|
||||
<ClCompile Include="printer.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_imagewriter.c" />
|
||||
<ClCompile Include="imagewriter.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc.c" />
|
||||
<ClCompile Include="scc_llap.c" />
|
||||
<ClCompile Include="scc_socket_driver.c" />
|
||||
<ClCompile Include="scc_windriver.c" />
|
||||
<ClCompile Include="sim65816.c" />
|
||||
<ClCompile Include="smartport.c" />
|
||||
<ClCompile Include="sound.c" />
|
||||
<ClCompile Include="sound_driver.c" />
|
||||
<ClCompile Include="video.c" />
|
||||
<ClCompile Include="win32snd_driver.c" />
|
||||
<ClCompile Include="win_console.c" />
|
||||
<ClCompile Include="win_generic.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="win32.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0B4E527A-DB50-4B5F-9B08-303ABAF7356A}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>gsport</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_TFE;HAVE_ATBRIDGE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<ErrorReporting>Prompt</ErrorReporting>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN_SOUND;GSPORT_LITTLE_ENDIAN;HAVE_ATBRIDGE;HAVE_TFE;TOGGLE_STATUS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<ErrorReporting>Prompt</ErrorReporting>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>IPHLPAPI.lib;Winmm.lib;Ws2_32.lib;Shlwapi.lib;$(SolutionDir)$(Configuration)\tfe.lib;;$(SolutionDir)$(Configuration)\atbridge.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="16inst_c.h" />
|
||||
<ClInclude Include="8inst_c.h" />
|
||||
<ClInclude Include="adb.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="defc.h" />
|
||||
<ClInclude Include="defcomm.h" />
|
||||
<ClInclude Include="defs.h" />
|
||||
<ClInclude Include="defs_instr.h" />
|
||||
<ClInclude Include="disas.h" />
|
||||
<ClInclude Include="gsportfont.h" />
|
||||
<CustomBuild Include="instable.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_inst c 8 instable.h > 8inst_c.h
|
||||
perl make_inst c 16 instable.h > 16inst_c.h
|
||||
perl make_inst s 8 instable.h > 8inst_s.h
|
||||
perl make_inst s 16 instable.h > 16inst_s.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_inst c 8 instable.h > 8inst_c.h
|
||||
perl make_inst c 16 instable.h > 16inst_c.h
|
||||
perl make_inst s 8 instable.h > 8inst_s.h
|
||||
perl make_inst s 16 instable.h > 16inst_s.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">8inst_c.h 16inst_c.h 8inst_s.h 16inst_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="scc_llap.h" />
|
||||
<ClInclude Include="win_keymap.h" />
|
||||
<ClInclude Include="iwm.h" />
|
||||
<ClInclude Include="iwm_35_525.h" />
|
||||
<ClInclude Include="op_routs.h" />
|
||||
<ClInclude Include="printer.h" />
|
||||
<ClInclude Include="printer_charmaps.h" />
|
||||
<ClInclude Include="imagewriter.h" />
|
||||
<ClInclude Include="iw_charmaps.h" />
|
||||
<ClInclude Include="prodos.h" />
|
||||
<ClInclude Include="prodos_protos.h" />
|
||||
<ClInclude Include="protos.h" />
|
||||
<ClInclude Include="protos_engine_c.h" />
|
||||
<ClInclude Include="protos_macdriver.h" />
|
||||
<ClInclude Include="protos_macsnd_driver.h" />
|
||||
<ClInclude Include="protos_windriver.h" />
|
||||
<ClInclude Include="protos_xdriver.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="scc.h" />
|
||||
<ClInclude Include="size_c.h" />
|
||||
<CustomBuild Include="size_tab.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">perl make_size c size_tab.h > size_c.h
|
||||
perl make_size s size_tab.h > size_s.h
|
||||
perl make_size 8 size_tab.h > 8size_s.h
|
||||
perl make_size 16 size_tab.h > 16size_s.h
|
||||
perl make_size c size_tab.h > size_c.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">perl make_size c size_tab.h > size_c.h
|
||||
perl make_size s size_tab.h > size_s.h
|
||||
perl make_size 8 size_tab.h > 8size_s.h
|
||||
perl make_size 16 size_tab.h > 16size_s.h
|
||||
perl make_size c size_tab.h > size_c.h</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">size_c.h size_s.h 8size_s.h 16size_s.h</Outputs>
|
||||
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="sound.h" />
|
||||
<ClInclude Include="superhires.h" />
|
||||
<ClInclude Include="support.h" />
|
||||
<ClInclude Include="tfe\protos_tfe.h" />
|
||||
<ClInclude Include="winresource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="adb.c" />
|
||||
<ClCompile Include="clock.c" />
|
||||
<ClCompile Include="compile_time.c" />
|
||||
<ClCompile Include="config.c" />
|
||||
<ClCompile Include="dis.c" />
|
||||
<ClCompile Include="engine_c.c" />
|
||||
<ClCompile Include="iwm.c" />
|
||||
<ClCompile Include="joystick_driver.c" />
|
||||
<ClCompile Include="moremem.c" />
|
||||
<ClCompile Include="paddles.c" />
|
||||
<ClCompile Include="parallel.c" />
|
||||
<ClCompile Include="printer.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_imagewriter.c" />
|
||||
<ClCompile Include="imagewriter.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc.c" />
|
||||
<ClCompile Include="scc_llap.c" />
|
||||
<ClCompile Include="scc_socket_driver.c" />
|
||||
<ClCompile Include="scc_windriver.c" />
|
||||
<ClCompile Include="sim65816.c" />
|
||||
<ClCompile Include="smartport.c" />
|
||||
<ClCompile Include="sound.c" />
|
||||
<ClCompile Include="sound_driver.c" />
|
||||
<ClCompile Include="video.c" />
|
||||
<ClCompile Include="win32snd_driver.c" />
|
||||
<ClCompile Include="win_console.c" />
|
||||
<ClCompile Include="win_generic.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="win32.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,217 +1,217 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="16inst_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="8inst_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="adb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defcomm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defs_instr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="disas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gsportfont.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iwm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iwm_35_525.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="op_routs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="printer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="printer_charmaps.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imagewriter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iw_charmaps.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="prodos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="prodos_protos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_engine_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_macdriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_macsnd_driver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_windriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_xdriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="scc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="size_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sound.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="superhires.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="winresource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tfe\protos_tfe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="win_keymap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="scc_llap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="adb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="clock.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="compile_time.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="config.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dis.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine_c.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="iwm.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="joystick_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="moremem.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="paddles.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_socket_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_windriver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sim65816.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="smartport.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sound.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sound_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="video.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win32snd_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win_console.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win_generic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="parallel.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="printer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_imagewriter.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="imagewriter.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_llap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="size_tab.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="instable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="win32.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="16inst_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="8inst_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="adb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defcomm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defs_instr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="disas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gsportfont.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iwm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iwm_35_525.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="op_routs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="printer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="printer_charmaps.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imagewriter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iw_charmaps.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="prodos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="prodos_protos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_engine_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_macdriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_macsnd_driver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_windriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protos_xdriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="scc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="size_c.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sound.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="superhires.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="winresource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tfe\protos_tfe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="win_keymap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="scc_llap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="adb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="clock.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="compile_time.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="config.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dis.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine_c.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="iwm.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="joystick_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="moremem.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="paddles.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_socket_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_windriver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sim65816.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="smartport.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sound.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sound_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="video.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win32snd_driver.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win_console.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="win_generic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="parallel.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="printer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_imagewriter.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="imagewriter.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="scc_llap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="size_tab.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="instable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="win32.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
418
src/gsport32.rc
418
src/gsport32.rc
|
@ -1,209 +1,209 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource."
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_GSPORT32 MENU
|
||||
BEGIN
|
||||
POPUP "&Emulator"
|
||||
BEGIN
|
||||
MENUITEM "&Set Disk Configuration\tALT-F1", ID_FILE_DISK
|
||||
MENUITEM "Send CTRL Reset\tCTRL-BREAK", ID_FILE_SENDRESET
|
||||
MENUITEM "Reboot\tCTRL-ALT-BREAK", ID_FILE_SENDREBOOT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Flush Printer", ID_FILE_FLUSHPRINTER
|
||||
MENUITEM "Toggle &Joystick", ID_FILE_JOYSTICK
|
||||
MENUITEM "Toggle Debug Statistics", ID_FILE_DEBUGSTAT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit\tALT-F4", ID_FILE_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "Key Commands", ID_HELP_KEY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About", ID_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDC_GSPORT32 BITMAP "wintoolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_ACCEL ACCELERATORS
|
||||
BEGIN
|
||||
VK_F1, ID_FILE_DISK, VIRTKEY, ALT, NOINVERT
|
||||
VK_F4, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDC_GSPORT32 ICON "gsport32.ico"
|
||||
GSPORT32_ICON ICON "gsport32.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 207, 82
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,78,61,50,14
|
||||
LTEXT "GSport: GS Emulator.\nBased on KEGS by Kent Dickey\nWindows Port by Chea Chee Keong\n\nThis software is free for non-commercial use.",IDC_STATIC,38,7,162,45,NOT WS_GROUP
|
||||
ICON "GSPORT32_ICON",IDC_STATIC,7,7,20,20
|
||||
END
|
||||
|
||||
IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Disk Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,161,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14
|
||||
LTEXT "S5D1",IDC_STATIC,19,46,19,8
|
||||
EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14
|
||||
LTEXT "S5D2",IDC_STATIC,19,62,19,8
|
||||
EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14
|
||||
LTEXT "S6D1",IDC_STATIC,19,80,19,8
|
||||
EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14
|
||||
LTEXT "S6D2",IDC_STATIC,19,98,19,8
|
||||
EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14
|
||||
LTEXT "S7D1",IDC_STATIC,19,118,19,8
|
||||
EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14
|
||||
LTEXT "S7D2",IDC_STATIC,19,137,19,8
|
||||
EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14
|
||||
GROUPBOX "Disk settings",IDC_STATIC,7,7,254,148
|
||||
LTEXT "Configure your disk images for each drive. Disk image formats supported\nare *.2MG,*.PO and *.DSK. ",IDC_STATIC,19,20,234,16
|
||||
END
|
||||
|
||||
IDD_SPEEDDIALOG DIALOG 0, 0, 240, 129
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Speed Control"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "1 MHz",IDC_SLOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,41,51,13
|
||||
CONTROL "2.5 MHz",IDC_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,55,43,13
|
||||
CONTROL "As fast as possible",IDC_FASTEST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,69,74,13
|
||||
CONTROL "Custom (MHz)",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,83,69,13
|
||||
EDITTEXT IDC_EDITCUSTOM,117,83,79,13,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,133,107,50,15
|
||||
PUSHBUTTON "Cancel",IDCANCEL,183,107,50,15
|
||||
GROUPBOX "Speed Control",IDC_STATIC,7,7,226,96,WS_GROUP
|
||||
LTEXT "Adjust the speed of your emulator by selecting the appropriate speed control",IDC_STATIC,46,19,181,19,NOT WS_GROUP
|
||||
ICON IDC_GSPORT32,IDC_STATIC,14,19,21,20
|
||||
END
|
||||
|
||||
IDD_GSPORT32_KEY DIALOGEX 0, 0, 186, 172
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Help About Key Commands"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,151,50,14
|
||||
LTEXT "GSport Key Commands",IDC_STATIC,7,7,82,10
|
||||
LTEXT "Alt/F1\t\tOpen-Apple\nF2\t\tClose-Apple\nF7\t\tToggle Fast Disk Emulation\nF8\t\tToggle Mouse Pointer\n\t\tDisplay\n",IDC_STATIC,21,25,151,42
|
||||
LTEXT "F11\t\tToggle Fullscreen Display\nF12\t\tReset\nCtrl-Alt-Break\tReboot Emulator\nCtrl-Alt-Esc\tControl-Panel\nCtrl-Break\tReset Emulator",IDC_STATIC,21,66,141,50
|
||||
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | WS_DISABLED | WS_BORDER,7,17,172,1
|
||||
LTEXT "For more information, please consult the readme.gsport file",IDC_STATIC,21,124,144,19
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_DISK "Disk Configuration"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_SPEED_1MHZ "Set Speed to 1 Mhz"
|
||||
ID_SPEED_2MHZ "Set Speed to 2.5 Mhz"
|
||||
ID_SPEED_FMHZ "Set Speed to as fast as possible"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource."
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_GSPORT32 MENU
|
||||
BEGIN
|
||||
POPUP "&Emulator"
|
||||
BEGIN
|
||||
MENUITEM "&Set Disk Configuration\tALT-F1", ID_FILE_DISK
|
||||
MENUITEM "Send CTRL Reset\tCTRL-BREAK", ID_FILE_SENDRESET
|
||||
MENUITEM "Reboot\tCTRL-ALT-BREAK", ID_FILE_SENDREBOOT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Flush Printer", ID_FILE_FLUSHPRINTER
|
||||
MENUITEM "Toggle &Joystick", ID_FILE_JOYSTICK
|
||||
MENUITEM "Toggle Debug Statistics", ID_FILE_DEBUGSTAT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit\tALT-F4", ID_FILE_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "Key Commands", ID_HELP_KEY
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About", ID_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDC_GSPORT32 BITMAP "wintoolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_ACCEL ACCELERATORS
|
||||
BEGIN
|
||||
VK_F1, ID_FILE_DISK, VIRTKEY, ALT, NOINVERT
|
||||
VK_F4, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDC_GSPORT32 ICON "gsport32.ico"
|
||||
GSPORT32_ICON ICON "gsport32.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT_DIALOG DIALOGEX 0, 0, 207, 82
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,78,61,50,14
|
||||
LTEXT "GSport: GS Emulator.\nBased on KEGS by Kent Dickey\nWindows Port by Chea Chee Keong\n\nThis software is free for non-commercial use.",IDC_STATIC,38,7,162,45,NOT WS_GROUP
|
||||
ICON "GSPORT32_ICON",IDC_STATIC,7,7,20,20
|
||||
END
|
||||
|
||||
IDD_DLG_DISKCONF DIALOGEX 0, 0, 268, 182
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Disk Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,150,161,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,203,161,50,14
|
||||
LTEXT "S5D1",IDC_STATIC,19,46,19,8
|
||||
EDITTEXT IDC_EDIT_S5D1,43,42,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D1,203,42,50,14
|
||||
LTEXT "S5D2",IDC_STATIC,19,62,19,8
|
||||
EDITTEXT IDC_EDIT_S5D2,43,60,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S5D2,203,60,50,14
|
||||
LTEXT "S6D1",IDC_STATIC,19,80,19,8
|
||||
EDITTEXT IDC_EDIT_S6D1,43,77,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D1,203,77,50,14
|
||||
LTEXT "S6D2",IDC_STATIC,19,98,19,8
|
||||
EDITTEXT IDC_EDIT_S6D2,43,95,156,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S6D2,203,96,50,14
|
||||
LTEXT "S7D1",IDC_STATIC,19,118,19,8
|
||||
EDITTEXT IDC_EDIT_S7D1,43,115,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D1,203,115,50,14
|
||||
LTEXT "S7D2",IDC_STATIC,19,137,19,8
|
||||
EDITTEXT IDC_EDIT_S7D2,43,135,155,14,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
|
||||
PUSHBUTTON "Browse",IDC_BTN_S7D2,203,135,50,14
|
||||
GROUPBOX "Disk settings",IDC_STATIC,7,7,254,148
|
||||
LTEXT "Configure your disk images for each drive. Disk image formats supported\nare *.2MG,*.PO and *.DSK. ",IDC_STATIC,19,20,234,16
|
||||
END
|
||||
|
||||
IDD_SPEEDDIALOG DIALOG 0, 0, 240, 129
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Speed Control"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "1 MHz",IDC_SLOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,41,51,13
|
||||
CONTROL "2.5 MHz",IDC_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,55,43,13
|
||||
CONTROL "As fast as possible",IDC_FASTEST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,69,74,13
|
||||
CONTROL "Custom (MHz)",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,45,83,69,13
|
||||
EDITTEXT IDC_EDITCUSTOM,117,83,79,13,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,133,107,50,15
|
||||
PUSHBUTTON "Cancel",IDCANCEL,183,107,50,15
|
||||
GROUPBOX "Speed Control",IDC_STATIC,7,7,226,96,WS_GROUP
|
||||
LTEXT "Adjust the speed of your emulator by selecting the appropriate speed control",IDC_STATIC,46,19,181,19,NOT WS_GROUP
|
||||
ICON IDC_GSPORT32,IDC_STATIC,14,19,21,20
|
||||
END
|
||||
|
||||
IDD_GSPORT32_KEY DIALOGEX 0, 0, 186, 172
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Help About Key Commands"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,151,50,14
|
||||
LTEXT "GSport Key Commands",IDC_STATIC,7,7,82,10
|
||||
LTEXT "Alt/F1\t\tOpen-Apple\nF2\t\tClose-Apple\nF7\t\tToggle Fast Disk Emulation\nF8\t\tToggle Mouse Pointer\n\t\tDisplay\n",IDC_STATIC,21,25,151,42
|
||||
LTEXT "F11\t\tToggle Fullscreen Display\nF12\t\tReset\nCtrl-Alt-Break\tReboot Emulator\nCtrl-Alt-Esc\tControl-Panel\nCtrl-Break\tReset Emulator",IDC_STATIC,21,66,141,50
|
||||
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | WS_DISABLED | WS_BORDER,7,17,172,1
|
||||
LTEXT "For more information, please consult the readme.gsport file",IDC_STATIC,21,124,144,19
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_DISK "Disk Configuration"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_SPEED_1MHZ "Set Speed to 1 Mhz"
|
||||
ID_SPEED_2MHZ "Set Speed to 2.5 Mhz"
|
||||
ID_SPEED_FMHZ "Set Speed to as fast as possible"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
4514
src/imagewriter.cpp
4514
src/imagewriter.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,316 +1,318 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 - 2011 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 The DOSBox Team
|
||||
*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modified for the GSport emulator by Christopher G. Mason 02/2014
|
||||
Extensively rewritten to provide full emulation of the Apple ImageWriter II
|
||||
printer.
|
||||
|
||||
Information used to write this emulator was provided by
|
||||
Apple's "ImageWriter II Technical Reference Manual"
|
||||
ISBN# 0-201-17766-8
|
||||
|
||||
Apple's "ImageWriter LQ Reference Manual"
|
||||
ISBN# 0-201-17751-X
|
||||
*/
|
||||
|
||||
#if !defined __IMAGEWRITER_H
|
||||
#define __IMAGEWRITER_H
|
||||
#ifdef __cplusplus
|
||||
#ifdef C_LIBPNG
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#include "SDL.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#endif // HAVE_SDL
|
||||
|
||||
#if defined (WIN32)
|
||||
#include <windows.h>
|
||||
#include <winspool.h>
|
||||
#endif
|
||||
|
||||
#define STYLE_PROP 0x01
|
||||
#define STYLE_CONDENSED 0x02
|
||||
#define STYLE_BOLD 0x04
|
||||
#define STYLE_DOUBLESTRIKE 0x08
|
||||
#define STYLE_DOUBLEWIDTH 0x10
|
||||
#define STYLE_ITALICS 0x20
|
||||
#define STYLE_UNDERLINE 0x40
|
||||
#define STYLE_SUPERSCRIPT 0x80
|
||||
#define STYLE_SUBSCRIPT 0x100
|
||||
#define STYLE_HALFHEIGHT 0x200
|
||||
|
||||
#define SCORE_NONE 0x00
|
||||
#define SCORE_SINGLE 0x01
|
||||
#define SCORE_DOUBLE 0x02
|
||||
#define SCORE_SINGLEBROKEN 0x05
|
||||
#define SCORE_DOUBLEBROKEN 0x06
|
||||
|
||||
#define QUALITY_DRAFT 0x01
|
||||
#define QUALITY_LQ 0x02
|
||||
|
||||
#define COLOR_BLACK 7<<5
|
||||
typedef unsigned Bitu;
|
||||
typedef signed Bits;
|
||||
typedef unsigned char Bit8u;
|
||||
typedef signed char Bit8s;
|
||||
typedef unsigned short Bit16u;
|
||||
typedef signed short Bit16s;
|
||||
typedef unsigned long Bit32u;
|
||||
typedef signed long Bit32s;
|
||||
typedef double Real64;
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned __int64 Bit64u;
|
||||
typedef signed __int64 Bit64s;
|
||||
#else
|
||||
typedef unsigned long long int Bit64u;
|
||||
typedef signed long long int Bit64s;
|
||||
#endif
|
||||
enum IWTypeface
|
||||
{
|
||||
fixed = 0,
|
||||
prop = 1
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Bitu codepage;
|
||||
const Bit16u* map;
|
||||
} IWCHARMAP;
|
||||
|
||||
|
||||
class Imagewriter {
|
||||
public:
|
||||
|
||||
Imagewriter (Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char* output, bool multipageOutput);
|
||||
virtual ~Imagewriter();
|
||||
|
||||
// Process one character sent to virtual printer
|
||||
void printChar(Bit8u ch);
|
||||
|
||||
// Hard Reset (like switching printer off and on)
|
||||
void resetPrinterHard();
|
||||
|
||||
// Set Autofeed value
|
||||
void setAutofeed(bool feed);
|
||||
|
||||
// Get Autofeed value
|
||||
bool getAutofeed();
|
||||
|
||||
// True if printer is unable to process more data right now (do not use printChar)
|
||||
bool isBusy();
|
||||
|
||||
// True if the last sent character was received
|
||||
bool ack();
|
||||
|
||||
// Manual formfeed
|
||||
void formFeed();
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
// Returns true if the current page is blank
|
||||
bool isBlank();
|
||||
#endif // HAVE_SDL
|
||||
|
||||
private:
|
||||
|
||||
// Resets the printer to the factory settings
|
||||
void resetPrinter();
|
||||
|
||||
// Clears page. If save is true, saves the current page to a bitmap
|
||||
void newPage(bool save, bool resetx);
|
||||
|
||||
// Closes a multipage document
|
||||
void finishMultipage();
|
||||
|
||||
// Output current page
|
||||
void outputPage();
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
// used to fill the color "sub-pallettes"
|
||||
void FillPalette(Bit8u redmax, Bit8u greenmax, Bit8u bluemax, Bit8u colorID,
|
||||
SDL_Palette* pal);
|
||||
|
||||
// Checks if given char belongs to a command and process it. If false, the character
|
||||
// should be printed
|
||||
bool processCommandChar(Bit8u ch);
|
||||
|
||||
// Reload font. Must be called after changing dpi, style or cpi
|
||||
void updateFont();
|
||||
|
||||
// Reconfigures printer parameters after changing soft-switches with ESC Z and ESC D
|
||||
void updateSwitch();
|
||||
|
||||
// Overprints a slash over zero if softswitch B-1 is set
|
||||
void slashzero(Bit16u penX, Bit16u penY);
|
||||
|
||||
// Blits the given glyph on the page surface. If add is true, the values of bitmap are
|
||||
// added to the values of the pixels in the page
|
||||
void blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, bool add);
|
||||
|
||||
// Draws an anti-aliased line from (fromx, y) to (tox, y). If broken is true, gaps are included
|
||||
void drawLine(Bitu fromx, Bitu tox, Bitu y, bool broken);
|
||||
|
||||
// Setup the bitGraph structure
|
||||
void setupBitImage(Bit8u dens, Bit16u numCols);
|
||||
|
||||
// Process a character that is part of bit image. Must be called iff bitGraph.remBytes > 0.
|
||||
void printBitGraph(Bit8u ch);
|
||||
|
||||
// Copies the codepage mapping from the constant array to CurMap
|
||||
void selectCodepage(Bit16u cp);
|
||||
|
||||
// Prints out a byte using ASCII85 encoding (only outputs something every four bytes). When b>255, closes the ASCII85 string
|
||||
void fprintASCII85(FILE* f, Bit16u b);
|
||||
|
||||
// Returns value of the num-th pixel (couting left-right, top-down) in a safe way
|
||||
Bit8u getPixel(Bit32u num);
|
||||
Bit8u getxyPixel(Bit32u x,Bit32u y);
|
||||
|
||||
FT_Library FTlib; // FreeType2 library used to render the characters
|
||||
|
||||
SDL_Surface* page; // Surface representing the current page
|
||||
FT_Face curFont; // The font currently used to render characters
|
||||
Bit8u color;
|
||||
Bit8u switcha; //Imagewriter softswitch A
|
||||
Bit8u switchb; //Imagewriter softswitch B
|
||||
|
||||
Real64 curX, curY; // Position of the print head (in inch)
|
||||
|
||||
Bit16u dpi; // dpi of the page
|
||||
Bit16u ESCCmd; // ESC-command that is currently processed
|
||||
bool ESCSeen; // True if last read character was an ESC (0x1B)
|
||||
bool FSSeen; // True if last read character was an FS (0x1C) (IBM commands)
|
||||
Bit8u numParam, neededParam; // Numbers of parameters already read/needed to process command
|
||||
|
||||
Bit8u params[20]; // Buffer for the read params
|
||||
Bit16u style; // Style of font (see STYLE_* constants)
|
||||
Real64 cpi, actcpi; // CPI value set by program and the actual one (taking in account font types)
|
||||
Bit8u score; // Score for lines (see SCORE_* constants)
|
||||
Bit8u verticalDot; // Vertical dot shift for Imagewriter LQ modes
|
||||
|
||||
Real64 topMargin, bottomMargin, rightMargin, leftMargin; // Margins of the page (in inch)
|
||||
Real64 pageWidth, pageHeight; // Size of page (in inch)
|
||||
Real64 defaultPageWidth, defaultPageHeight; // Default size of page (in inch)
|
||||
Real64 lineSpacing; // Size of one line (in inch)
|
||||
|
||||
Real64 horiztabs[32]; // Stores the set horizontal tabs (in inch)
|
||||
Bit8u numHorizTabs; // Number of configured tabs
|
||||
|
||||
Real64 verttabs[16]; // Stores the set vertical tabs (in inch)
|
||||
Bit8u numVertTabs; // Number of configured tabs
|
||||
|
||||
Bit8u curCharTable; // Currently used char table und charset
|
||||
Bit8u printQuality; // Print quality (see QUALITY_* constants)
|
||||
Bit8u printRes; // Graphics resolution
|
||||
IWTypeface LQtypeFace; // Typeface used in LQ printing mode
|
||||
|
||||
Real64 extraIntraSpace; // Extra space between two characters (set by program, in inch)
|
||||
|
||||
bool charRead; // True if a character was read since the printer was last initialized
|
||||
bool autoFeed; // True if a LF should automatically added after a CR
|
||||
bool printUpperContr; // True if the upper command characters should be printed
|
||||
|
||||
struct bitGraphicParams // Holds information about printing bit images
|
||||
{
|
||||
Bit16u horizDens, vertDens; // Density of image to print (in dpi)
|
||||
bool adjacent; // Print adjacent pixels? (ignored)
|
||||
Bit8u bytesColumn; // Bytes per column
|
||||
Bit16u remBytes; // Bytes left to read before image is done
|
||||
Bit8u column[6]; // Bytes of the current and last column
|
||||
Bit8u readBytesColumn; // Bytes read so far for the current column
|
||||
} bitGraph;
|
||||
|
||||
Bit8u densk, densl, densy, densz; // Image density modes used in ESC K/L/Y/Z commands
|
||||
|
||||
Bit16u curMap[256]; // Currently used ASCII => Unicode mapping
|
||||
Bit16u charTables[4]; // Charactertables
|
||||
|
||||
Real64 definedUnit; // Unit used by some ESC/P2 commands (negative => use default)
|
||||
|
||||
bool multipoint; // If multipoint mode is enabled
|
||||
Real64 multiPointSize; // Point size of font in multipoint mode
|
||||
Real64 multicpi; // CPI used in multipoint mode
|
||||
|
||||
Real64 hmi; // Horizontal motion index (in inch; overrides CPI settings)
|
||||
|
||||
Bit16u numPrintAsChar; // Number of bytes to print as characters (even when normally control codes)
|
||||
|
||||
#if defined (WIN32)
|
||||
HDC printerDC; // Win32 printer device
|
||||
#endif
|
||||
int port; // SCC Port
|
||||
|
||||
#endif // HAVE_SDL
|
||||
Bit8u msb; // MSB mode
|
||||
|
||||
char* output; // Output method selected by user
|
||||
void* outputHandle; // If not null, additional pages will be appended to the given handle
|
||||
bool multipageOutput; // If true, all pages are combined to one file/print job etc. until the "eject page" button is pressed
|
||||
Bit16u multiPageCounter; // Current page (when printing multipages)
|
||||
|
||||
Bit8u ASCII85Buffer[4]; // Buffer used in ASCII85 encoding
|
||||
Bit8u ASCII85BufferPos; // Position in ASCII85 encode buffer
|
||||
Bit8u ASCII85CurCol; // Columns printed so far in the current lines
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//Interfaces to C code
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 - 2011 by GSport contributors
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 The DOSBox Team
|
||||
*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
Modified for the GSport emulator by Christopher G. Mason 02/2014
|
||||
Extensively rewritten to provide full emulation of the Apple ImageWriter II
|
||||
printer.
|
||||
|
||||
Information used to write this emulator was provided by
|
||||
Apple's "ImageWriter II Technical Reference Manual"
|
||||
ISBN# 0-201-17766-8
|
||||
|
||||
Apple's "ImageWriter LQ Reference Manual"
|
||||
ISBN# 0-201-17751-X
|
||||
*/
|
||||
|
||||
#if !defined __IMAGEWRITER_H
|
||||
#define __IMAGEWRITER_H
|
||||
#ifdef __cplusplus
|
||||
#ifdef C_LIBPNG
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#include "SDL.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#endif // HAVE_SDL
|
||||
|
||||
#if defined (WIN32)
|
||||
#include <windows.h>
|
||||
#include <winspool.h>
|
||||
#endif
|
||||
|
||||
#define STYLE_PROP 0x01
|
||||
#define STYLE_CONDENSED 0x02
|
||||
#define STYLE_BOLD 0x04
|
||||
#define STYLE_DOUBLESTRIKE 0x08
|
||||
#define STYLE_DOUBLEWIDTH 0x10
|
||||
#define STYLE_ITALICS 0x20
|
||||
#define STYLE_UNDERLINE 0x40
|
||||
#define STYLE_SUPERSCRIPT 0x80
|
||||
#define STYLE_SUBSCRIPT 0x100
|
||||
#define STYLE_HALFHEIGHT 0x200
|
||||
|
||||
#define SCORE_NONE 0x00
|
||||
#define SCORE_SINGLE 0x01
|
||||
#define SCORE_DOUBLE 0x02
|
||||
#define SCORE_SINGLEBROKEN 0x05
|
||||
#define SCORE_DOUBLEBROKEN 0x06
|
||||
|
||||
#define QUALITY_DRAFT 0x01
|
||||
#define QUALITY_LQ 0x02
|
||||
|
||||
#define COLOR_BLACK 7<<5
|
||||
typedef unsigned Bitu;
|
||||
typedef signed Bits;
|
||||
typedef unsigned char Bit8u;
|
||||
typedef signed char Bit8s;
|
||||
typedef unsigned short Bit16u;
|
||||
typedef signed short Bit16s;
|
||||
typedef unsigned long Bit32u;
|
||||
typedef signed long Bit32s;
|
||||
typedef double Real64;
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned __int64 Bit64u;
|
||||
typedef signed __int64 Bit64s;
|
||||
#else
|
||||
typedef unsigned long long int Bit64u;
|
||||
typedef signed long long int Bit64s;
|
||||
#endif
|
||||
enum IWTypeface
|
||||
{
|
||||
fixed = 0,
|
||||
prop = 1
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Bitu codepage;
|
||||
const Bit16u* map;
|
||||
} IWCHARMAP;
|
||||
|
||||
|
||||
class Imagewriter {
|
||||
public:
|
||||
|
||||
Imagewriter (Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char* output, bool multipageOutput);
|
||||
virtual ~Imagewriter();
|
||||
|
||||
// Process one character sent to virtual printer
|
||||
void printChar(Bit8u ch);
|
||||
|
||||
// Hard Reset (like switching printer off and on)
|
||||
void resetPrinterHard();
|
||||
|
||||
// Set Autofeed value
|
||||
void setAutofeed(bool feed);
|
||||
|
||||
// Get Autofeed value
|
||||
bool getAutofeed();
|
||||
|
||||
// True if printer is unable to process more data right now (do not use printChar)
|
||||
bool isBusy();
|
||||
|
||||
// True if the last sent character was received
|
||||
bool ack();
|
||||
|
||||
// Manual formfeed
|
||||
void formFeed();
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
// Returns true if the current page is blank
|
||||
bool isBlank();
|
||||
#endif // HAVE_SDL
|
||||
|
||||
private:
|
||||
|
||||
// Resets the printer to the factory settings
|
||||
void resetPrinter();
|
||||
|
||||
// Clears page. If save is true, saves the current page to a bitmap
|
||||
void newPage(bool save, bool resetx);
|
||||
|
||||
// Closes a multipage document
|
||||
void finishMultipage();
|
||||
|
||||
// Output current page
|
||||
void outputPage();
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
// used to fill the color "sub-pallettes"
|
||||
void FillPalette(Bit8u redmax, Bit8u greenmax, Bit8u bluemax, Bit8u colorID,
|
||||
SDL_Palette* pal);
|
||||
|
||||
// Checks if given char belongs to a command and process it. If false, the character
|
||||
// should be printed
|
||||
bool processCommandChar(Bit8u ch);
|
||||
|
||||
// Reload font. Must be called after changing dpi, style or cpi
|
||||
void updateFont();
|
||||
|
||||
// Reconfigures printer parameters after changing soft-switches with ESC Z and ESC D
|
||||
void updateSwitch();
|
||||
|
||||
// Overprints a slash over zero if softswitch B-1 is set
|
||||
void slashzero(Bit16u penX, Bit16u penY);
|
||||
|
||||
// Blits the given glyph on the page surface. If add is true, the values of bitmap are
|
||||
// added to the values of the pixels in the page
|
||||
void blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, bool add);
|
||||
|
||||
// Draws an anti-aliased line from (fromx, y) to (tox, y). If broken is true, gaps are included
|
||||
void drawLine(Bitu fromx, Bitu tox, Bitu y, bool broken);
|
||||
|
||||
// Setup the bitGraph structure
|
||||
void setupBitImage(Bit8u dens, Bit16u numCols);
|
||||
|
||||
// Process a character that is part of bit image. Must be called iff bitGraph.remBytes > 0.
|
||||
void printBitGraph(Bit8u ch);
|
||||
|
||||
// Copies the codepage mapping from the constant array to CurMap
|
||||
void selectCodepage(Bit16u cp);
|
||||
|
||||
// Prints out a byte using ASCII85 encoding (only outputs something every four bytes). When b>255, closes the ASCII85 string
|
||||
void fprintASCII85(FILE* f, Bit16u b);
|
||||
|
||||
// Returns value of the num-th pixel (couting left-right, top-down) in a safe way
|
||||
Bit8u getPixel(Bit32u num);
|
||||
Bit8u getxyPixel(Bit32u x,Bit32u y);
|
||||
|
||||
FT_Library FTlib; // FreeType2 library used to render the characters
|
||||
|
||||
SDL_Surface* page; // Surface representing the current page
|
||||
FT_Face curFont; // The font currently used to render characters
|
||||
Bit8u color;
|
||||
Bit8u switcha; //Imagewriter softswitch A
|
||||
Bit8u switchb; //Imagewriter softswitch B
|
||||
|
||||
Real64 curX, curY; // Position of the print head (in inch)
|
||||
|
||||
Bit16u dpi; // dpi of the page
|
||||
Bit16u ESCCmd; // ESC-command that is currently processed
|
||||
bool ESCSeen; // True if last read character was an ESC (0x1B)
|
||||
bool FSSeen; // True if last read character was an FS (0x1C) (IBM commands)
|
||||
Bit8u numParam, neededParam; // Numbers of parameters already read/needed to process command
|
||||
|
||||
Bit8u params[20]; // Buffer for the read params
|
||||
Bit16u style; // Style of font (see STYLE_* constants)
|
||||
Real64 cpi, actcpi; // CPI value set by program and the actual one (taking in account font types)
|
||||
Bit8u score; // Score for lines (see SCORE_* constants)
|
||||
Bit8u verticalDot; // Vertical dot shift for Imagewriter LQ modes
|
||||
|
||||
Real64 topMargin, bottomMargin, rightMargin, leftMargin; // Margins of the page (in inch)
|
||||
Real64 pageWidth, pageHeight; // Size of page (in inch)
|
||||
Real64 defaultPageWidth, defaultPageHeight; // Default size of page (in inch)
|
||||
Real64 lineSpacing; // Size of one line (in inch)
|
||||
|
||||
Real64 horiztabs[32]; // Stores the set horizontal tabs (in inch)
|
||||
Bit8u numHorizTabs; // Number of configured tabs
|
||||
|
||||
Real64 verttabs[16]; // Stores the set vertical tabs (in inch)
|
||||
Bit8u numVertTabs; // Number of configured tabs
|
||||
|
||||
Bit8u curCharTable; // Currently used char table und charset
|
||||
Bit8u printQuality; // Print quality (see QUALITY_* constants)
|
||||
Bit8u printRes; // Graphics resolution
|
||||
IWTypeface LQtypeFace; // Typeface used in LQ printing mode
|
||||
|
||||
Real64 extraIntraSpace; // Extra space between two characters (set by program, in inch)
|
||||
|
||||
bool charRead; // True if a character was read since the printer was last initialized
|
||||
bool autoFeed; // True if a LF should automatically added after a CR
|
||||
bool printUpperContr; // True if the upper command characters should be printed
|
||||
|
||||
struct bitGraphicParams // Holds information about printing bit images
|
||||
{
|
||||
Bit16u horizDens, vertDens; // Density of image to print (in dpi)
|
||||
bool adjacent; // Print adjacent pixels? (ignored)
|
||||
Bit8u bytesColumn; // Bytes per column
|
||||
Bit16u remBytes; // Bytes left to read before image is done
|
||||
Bit8u column[6]; // Bytes of the current and last column
|
||||
Bit8u readBytesColumn; // Bytes read so far for the current column
|
||||
} bitGraph;
|
||||
|
||||
Bit8u densk, densl, densy, densz; // Image density modes used in ESC K/L/Y/Z commands
|
||||
|
||||
Bit16u curMap[256]; // Currently used ASCII => Unicode mapping
|
||||
Bit16u charTables[4]; // Charactertables
|
||||
|
||||
Real64 definedUnit; // Unit used by some ESC/P2 commands (negative => use default)
|
||||
|
||||
bool multipoint; // If multipoint mode is enabled
|
||||
Real64 multiPointSize; // Point size of font in multipoint mode
|
||||
Real64 multicpi; // CPI used in multipoint mode
|
||||
|
||||
Real64 hmi; // Horizontal motion index (in inch; overrides CPI settings)
|
||||
|
||||
Bit16u numPrintAsChar; // Number of bytes to print as characters (even when normally control codes)
|
||||
|
||||
#if defined (WIN32)
|
||||
HDC printerDC; // Win32 printer device
|
||||
#endif
|
||||
int port; // SCC Port
|
||||
|
||||
#endif // HAVE_SDL
|
||||
Bit8u msb; // MSB mode
|
||||
|
||||
char* output; // Output method selected by user
|
||||
void* outputHandle; // If not null, additional pages will be appended to the given handle
|
||||
bool multipageOutput; // If true, all pages are combined to one file/print job etc. until the "eject page" button is pressed
|
||||
Bit16u multiPageCounter; // Current page (when printing multipages)
|
||||
|
||||
Bit8u ASCII85Buffer[4]; // Buffer used in ASCII85 encoding
|
||||
Bit8u ASCII85BufferPos; // Position in ASCII85 encode buffer
|
||||
Bit8u ASCII85CurCol; // Columns printed so far in the current lines
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//Interfaces to C code
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
typedef unsigned char Bit8u;
|
||||
#endif
|
||||
|
||||
void imagewriter_init(int pdpi, int ppaper, int banner, char* poutput, bool mpage);
|
||||
void imagewriter_loop(Bit8u pchar);
|
||||
void imagewriter_close();
|
||||
void imagewriter_feed();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void imagewriter_init(int pdpi, int ppaper, int banner, char* poutput, bool mpage);
|
||||
void imagewriter_loop(Bit8u pchar);
|
||||
void imagewriter_close();
|
||||
void imagewriter_feed();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
118
src/iwm.c
118
src/iwm.c
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
@ -22,7 +24,7 @@
|
|||
#include "defc.h"
|
||||
|
||||
extern int Verbose;
|
||||
extern word32 g_vbl_count; // OG change int to word32
|
||||
extern word32 g_vbl_count; // OG change int to word32
|
||||
extern int g_c036_val_speed;
|
||||
|
||||
const byte phys_to_dos_sec[] = {
|
||||
|
@ -175,24 +177,24 @@ iwm_init()
|
|||
iwm_reset();
|
||||
}
|
||||
|
||||
// OG Added shut function to IWM
|
||||
// Free the memory, and more important free the open handle onto the disk
|
||||
void
|
||||
iwm_shut()
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
eject_disk(&iwm.drive525[i]);
|
||||
eject_disk(&iwm.drive35[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < MAX_C7_DISKS; i++) {
|
||||
eject_disk(&iwm.smartport[i]);
|
||||
}
|
||||
|
||||
from_disk_byte_valid = 0;
|
||||
}
|
||||
|
||||
// OG Added shut function to IWM
|
||||
// Free the memory, and more important free the open handle onto the disk
|
||||
void
|
||||
iwm_shut()
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
eject_disk(&iwm.drive525[i]);
|
||||
eject_disk(&iwm.drive35[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < MAX_C7_DISKS; i++) {
|
||||
eject_disk(&iwm.smartport[i]);
|
||||
}
|
||||
|
||||
from_disk_byte_valid = 0;
|
||||
}
|
||||
|
||||
void
|
||||
iwm_reset()
|
||||
{
|
||||
|
@ -235,19 +237,19 @@ draw_iwm_status(int line, char *buf)
|
|||
flag[apple35_sel][iwm.drive_select] = "*";
|
||||
}
|
||||
|
||||
#ifdef ACTIVEGS // OG Pass monitoring info
|
||||
{
|
||||
extern void ki_loading(int _motorOn,int _slot,int _drive, int _curtrack);
|
||||
int curtrack=0;
|
||||
if (apple35_sel)
|
||||
curtrack = iwm.drive35[iwm.drive_select].cur_qtr_track ;
|
||||
else
|
||||
curtrack = iwm.drive525[iwm.drive_select].cur_qtr_track >> 2 ;
|
||||
|
||||
ki_loading(g_iwm_motor_on,apple35_sel?5:6,iwm.drive_select+1,curtrack);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ACTIVEGS // OG Pass monitoring info
|
||||
{
|
||||
extern void ki_loading(int _motorOn,int _slot,int _drive, int _curtrack);
|
||||
int curtrack=0;
|
||||
if (apple35_sel)
|
||||
curtrack = iwm.drive35[iwm.drive_select].cur_qtr_track ;
|
||||
else
|
||||
curtrack = iwm.drive525[iwm.drive_select].cur_qtr_track >> 2 ;
|
||||
|
||||
ki_loading(g_iwm_motor_on,apple35_sel?5:6,iwm.drive_select+1,curtrack);
|
||||
}
|
||||
#endif
|
||||
|
||||
sprintf(buf, "s6d1:%2d%s s6d2:%2d%s s5d1:%2d/%d%s "
|
||||
"s5d2:%2d/%d%s fast_disk_emul:%d,%d c036:%02x",
|
||||
iwm.drive525[0].cur_qtr_track >> 2, flag[0][0],
|
||||
|
@ -347,7 +349,7 @@ iwm_vbl_update(int doit_3_persec)
|
|||
int i;
|
||||
|
||||
if(iwm.motor_on && iwm.motor_off) {
|
||||
if((word32)iwm.motor_off_vbl_count <= g_vbl_count) {
|
||||
if((word32)iwm.motor_off_vbl_count <= g_vbl_count) {
|
||||
printf("Disk timer expired, drive off: %08x\n",
|
||||
g_vbl_count);
|
||||
iwm.motor_on = 0;
|
||||
|
@ -581,9 +583,9 @@ iwm525_phase_change(int drive, int phase)
|
|||
int half_track = qtr_track >> 1;
|
||||
|
||||
delta = 0;
|
||||
if (iwm.iwm_phase[(half_track + 1) & 3])
|
||||
if (iwm.iwm_phase[(half_track + 1) & 3])
|
||||
delta += 2;
|
||||
if (iwm.iwm_phase[(half_track + 3) & 3])
|
||||
if (iwm.iwm_phase[(half_track + 3) & 3])
|
||||
delta -= 2;
|
||||
|
||||
qtr_track += delta;
|
||||
|
@ -754,12 +756,12 @@ iwm_do_action35(double dcycs)
|
|||
break;
|
||||
case 0x0d: /* eject disk */
|
||||
eject_disk(dsk);
|
||||
#ifdef ACTIVEGS // OG : pass eject info to the Control (ActiveX specific)
|
||||
{
|
||||
extern void ejectDisk(int slot,int disk);
|
||||
ejectDisk(dsk->disk_525?6:5,dsk->drive+1);
|
||||
}
|
||||
#endif
|
||||
#ifdef ACTIVEGS // OG : pass eject info to the Control (ActiveX specific)
|
||||
{
|
||||
extern void ejectDisk(int slot,int disk);
|
||||
ejectDisk(dsk->disk_525?6:5,dsk->drive+1);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 0x02:
|
||||
case 0x07:
|
||||
|
@ -1669,24 +1671,24 @@ disk_track_to_unix(Disk *dsk, int qtr_track, byte *outbuf)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if(disk_525)
|
||||
{
|
||||
// OG
|
||||
// Add support for .nib file
|
||||
if (dsk->image_type!=DSK_TYPE_NIB)
|
||||
if(disk_525)
|
||||
{
|
||||
// OG
|
||||
// Add support for .nib file
|
||||
if (dsk->image_type!=DSK_TYPE_NIB)
|
||||
return iwm_denib_track525(dsk, trk, qtr_track, outbuf);
|
||||
else
|
||||
{
|
||||
int len = trk->track_len;
|
||||
byte* trk_ptr = trk->nib_area+1;
|
||||
byte* nib_ptr = outbuf;
|
||||
for(i = 0; i < len; i += 2)
|
||||
{
|
||||
*nib_ptr++ = *trk_ptr;
|
||||
trk_ptr+=2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len = trk->track_len;
|
||||
byte* trk_ptr = trk->nib_area+1;
|
||||
byte* nib_ptr = outbuf;
|
||||
for(i = 0; i < len; i += 2)
|
||||
{
|
||||
*nib_ptr++ = *trk_ptr;
|
||||
trk_ptr+=2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
return iwm_denib_track35(dsk, trk, qtr_track, outbuf);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSport - an Apple //gs Emulator
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2013 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
1124
src/osxdriver.c
1124
src/osxdriver.c
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
4240
src/printer.cpp
4240
src/printer.cpp
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 - 2014 by GSport contributors
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
116
src/resource
116
src/resource
|
@ -1,58 +1,58 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by gsport32.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_GSPORT32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_GSPORT32_KEY 106
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
#define IDC_EDIT_S5D2 10052
|
||||
#define IDC_EDIT_S6D1 10061
|
||||
#define IDC_EDIT_S6D2 10062
|
||||
#define IDC_EDIT_S7D1 10071
|
||||
#define IDC_EDIT_S7D2 10072
|
||||
#define IDC_BTN_S5D1 11051
|
||||
#define IDC_BTN_S5D2 11052
|
||||
#define IDC_BTN_S6D1 11061
|
||||
#define IDC_BTN_S6D2 11062
|
||||
#define IDC_BTN_S7D1 11071
|
||||
#define IDC_BTN_S7D2 11072
|
||||
#define ID_HELP_ABOUT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_DISK 40003
|
||||
#define ID_FILE_SENDRESET 40004
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_FILE_SEND_REBOOT 40014
|
||||
#define ID_Menu 40015
|
||||
#define ID_EMULATOR_FLUSHPRINTER 40016
|
||||
#define ID_FILE_FLUSHPRINTER 40017
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_FMHZ 50003
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 116
|
||||
#define _APS_NEXT_COMMAND_VALUE 40018
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by gsport32.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_GSPORT32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_GSPORT32_KEY 106
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
#define IDC_EDIT_S5D2 10052
|
||||
#define IDC_EDIT_S6D1 10061
|
||||
#define IDC_EDIT_S6D2 10062
|
||||
#define IDC_EDIT_S7D1 10071
|
||||
#define IDC_EDIT_S7D2 10072
|
||||
#define IDC_BTN_S5D1 11051
|
||||
#define IDC_BTN_S5D2 11052
|
||||
#define IDC_BTN_S6D1 11061
|
||||
#define IDC_BTN_S6D2 11062
|
||||
#define IDC_BTN_S7D1 11071
|
||||
#define IDC_BTN_S7D2 11072
|
||||
#define ID_HELP_ABOUT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_DISK 40003
|
||||
#define ID_FILE_SENDRESET 40004
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_FILE_SEND_REBOOT 40014
|
||||
#define ID_Menu 40015
|
||||
#define ID_EMULATOR_FLUSHPRINTER 40016
|
||||
#define ID_FILE_FLUSHPRINTER 40017
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_FMHZ 50003
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 116
|
||||
#define _APS_NEXT_COMMAND_VALUE 40018
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
114
src/resource.h
114
src/resource.h
|
@ -1,57 +1,57 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by gsport32.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_GSPORT32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_GSPORT32_KEY 106
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
#define IDC_EDIT_S5D2 10052
|
||||
#define IDC_EDIT_S6D1 10061
|
||||
#define IDC_EDIT_S6D2 10062
|
||||
#define IDC_EDIT_S7D1 10071
|
||||
#define IDC_EDIT_S7D2 10072
|
||||
#define IDC_BTN_S5D1 11051
|
||||
#define IDC_BTN_S5D2 11052
|
||||
#define IDC_BTN_S6D1 11061
|
||||
#define IDC_BTN_S6D2 11062
|
||||
#define IDC_BTN_S7D1 11071
|
||||
#define IDC_BTN_S7D2 11072
|
||||
#define ID_HELP_ABOUT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_DISK 40003
|
||||
#define ID_FILE_SENDRESET 40004
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_FMHZ 50003
|
||||
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 111
|
||||
#define _APS_NEXT_COMMAND_VALUE 40013
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by gsport32.rc
|
||||
//
|
||||
#define IDD_ABOUT_DIALOG 101
|
||||
#define IDC_GSPORT32 102
|
||||
#define IDR_TOOLBAR 103
|
||||
#define IDD_DLG_DISKCONF 104
|
||||
#define IDR_ACCEL 105
|
||||
#define IDD_GSPORT32_KEY 106
|
||||
#define ID_TOOLBAR 5000
|
||||
#define ID_STATUSBAR 5001
|
||||
#define IDC_EDIT_S5D1 10051
|
||||
#define IDC_EDIT_S5D2 10052
|
||||
#define IDC_EDIT_S6D1 10061
|
||||
#define IDC_EDIT_S6D2 10062
|
||||
#define IDC_EDIT_S7D1 10071
|
||||
#define IDC_EDIT_S7D2 10072
|
||||
#define IDC_BTN_S5D1 11051
|
||||
#define IDC_BTN_S5D2 11052
|
||||
#define IDC_BTN_S6D1 11061
|
||||
#define IDC_BTN_S6D2 11062
|
||||
#define IDC_BTN_S7D1 11071
|
||||
#define IDC_BTN_S7D2 11072
|
||||
#define ID_HELP_ABOUT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_DISK 40003
|
||||
#define ID_FILE_SENDRESET 40004
|
||||
#define ID_FILE_JOYSTICK 40005
|
||||
#define ID_FILE_DEBUGSTAT 40006
|
||||
#define ID_FILE_SENDREBOOT 40007
|
||||
#define ID_FILE_FULLSCREEN 40012
|
||||
#define ID_FILE_SPEED 40013
|
||||
#define ID_HELP_KEY 40014
|
||||
#define ID_SPEED_1MHZ 50001
|
||||
#define ID_SPEED_2MHZ 50002
|
||||
#define ID_SPEED_FMHZ 50003
|
||||
|
||||
#define IDD_SPEEDDIALOG 117
|
||||
#define IDC_SLOW 1007
|
||||
#define IDC_CUSTOM 1008
|
||||
#define IDC_EDITCUSTOM 1009
|
||||
#define IDC_NORMAL 1010
|
||||
#define IDC_FASTEST 1011
|
||||
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 111
|
||||
#define _APS_NEXT_COMMAND_VALUE 40013
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
108
src/scc.c
108
src/scc.c
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
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
|
||||
|
@ -54,7 +56,7 @@ extern int g_appletalk_turbo;
|
|||
Scc scc_stat[2];
|
||||
|
||||
int g_baud_table[] = {
|
||||
110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400
|
||||
110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400
|
||||
};
|
||||
|
||||
static char* wr_names[] = {
|
||||
|
@ -114,7 +116,7 @@ scc_init()
|
|||
scc_ptr->rx_event_pending = 0;
|
||||
scc_ptr->tx_event_pending = 0;
|
||||
scc_ptr->char_size = 8;
|
||||
scc_ptr->baud_rate = 115200;
|
||||
scc_ptr->baud_rate = 115200;
|
||||
scc_ptr->telnet_mode = 0;
|
||||
scc_ptr->telnet_iac = 0;
|
||||
scc_ptr->out_char_dcycs = 0.0;
|
||||
|
@ -367,37 +369,37 @@ scc_regen_clocks(int port)
|
|||
scc_ptr->tx_dcycs = tx_dcycs * tx_char_size;
|
||||
scc_ptr->rx_dcycs = rx_dcycs * rx_char_size;
|
||||
|
||||
switch (scc_ptr->state) {
|
||||
case 1: /* socket */
|
||||
scc_socket_change_params(port);
|
||||
break;
|
||||
case 2: /* real serial ports */
|
||||
switch (scc_ptr->state) {
|
||||
case 1: /* socket */
|
||||
scc_socket_change_params(port);
|
||||
break;
|
||||
case 2: /* real serial ports */
|
||||
#ifdef MAC
|
||||
scc_serial_mac_change_params(port);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
scc_serial_win_change_params(port);
|
||||
#endif
|
||||
break;
|
||||
case 3: /* localtalk */
|
||||
if (g_appletalk_turbo)
|
||||
{
|
||||
// If the user has selected AppleTalk "turbo" mode, increase the baud
|
||||
// rate to be as fast as possible, limited primarily by the ability of
|
||||
// the emulated GS to handle data.
|
||||
scc_ptr->baud_rate = 0;
|
||||
scc_ptr->br_dcycs = 1;
|
||||
scc_ptr->tx_dcycs = 1;
|
||||
scc_ptr->rx_dcycs = 1;
|
||||
}
|
||||
break;
|
||||
case 4: /* Imagewriter */
|
||||
scc_ptr->baud_rate = 0;
|
||||
scc_ptr->tx_dcycs = tx_dcycs * 1.2; //Somehow this speeds up serial transfer without overrunning the buffer
|
||||
scc_ptr->rx_dcycs = rx_dcycs * 1.2;
|
||||
break;
|
||||
break;
|
||||
case 3: /* localtalk */
|
||||
if (g_appletalk_turbo)
|
||||
{
|
||||
// If the user has selected AppleTalk "turbo" mode, increase the baud
|
||||
// rate to be as fast as possible, limited primarily by the ability of
|
||||
// the emulated GS to handle data.
|
||||
scc_ptr->baud_rate = 0;
|
||||
scc_ptr->br_dcycs = 1;
|
||||
scc_ptr->tx_dcycs = 1;
|
||||
scc_ptr->rx_dcycs = 1;
|
||||
}
|
||||
break;
|
||||
case 4: /* Imagewriter */
|
||||
scc_ptr->baud_rate = 0;
|
||||
scc_ptr->tx_dcycs = tx_dcycs * 1.2; //Somehow this speeds up serial transfer without overrunning the buffer
|
||||
scc_ptr->rx_dcycs = rx_dcycs * 1.2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -416,9 +418,9 @@ scc_port_init(int port)
|
|||
state = scc_serial_win_init(port);
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
state = scc_imagewriter_init(port);
|
||||
break;
|
||||
case 2:
|
||||
state = scc_imagewriter_init(port);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -455,15 +457,15 @@ scc_try_to_empty_writebuf(int port, double dcycs)
|
|||
|
||||
case 1:
|
||||
scc_socket_empty_writebuf(port, dcycs);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// When we're doing LocalTalk, the write buffer gets emptied at the end of the frame and does not use this function.
|
||||
break;
|
||||
|
||||
case 4:
|
||||
scc_imagewriter_empty_writebuf(port, dcycs);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// When we're doing LocalTalk, the write buffer gets emptied at the end of the frame and does not use this function.
|
||||
break;
|
||||
|
||||
case 4:
|
||||
scc_imagewriter_empty_writebuf(port, dcycs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,21 +511,21 @@ scc_try_fill_readbuf(int port, double dcycs)
|
|||
|
||||
case 1:
|
||||
scc_socket_fill_readbuf(port, space_left, dcycs);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// LLAP deals with packets, and we only allow one packet in the read buffer at a time.
|
||||
// If the buffer is empty, try to fill it with another packet.
|
||||
if (g_appletalk_bridging && (space_used_before_rx == 0) && (scc_ptr->rx_queue_depth == 0) && !(scc_ptr->sdlc_eof))
|
||||
{
|
||||
scc_llap_fill_readbuf(port, space_left, dcycs);
|
||||
//scc_maybe_rx_event(port, dcycs);
|
||||
scc_ptr->sdlc_eof = 0;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
scc_imagewriter_fill_readbuf(port, space_left, dcycs);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// LLAP deals with packets, and we only allow one packet in the read buffer at a time.
|
||||
// If the buffer is empty, try to fill it with another packet.
|
||||
if (g_appletalk_bridging && (space_used_before_rx == 0) && (scc_ptr->rx_queue_depth == 0) && !(scc_ptr->sdlc_eof))
|
||||
{
|
||||
scc_llap_fill_readbuf(port, space_left, dcycs);
|
||||
//scc_maybe_rx_event(port, dcycs);
|
||||
scc_ptr->sdlc_eof = 0;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
scc_imagewriter_fill_readbuf(port, space_left, dcycs);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,159 +1,161 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2013 - 2014 by GSport contributors
|
||||
Originally authored by Christopher Mason
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/* This is an interface between the SCC emulation and the Virtual Imagewriter. */
|
||||
|
||||
#include "defc.h"
|
||||
#include "scc.h"
|
||||
#include "imagewriter.h"
|
||||
extern Scc scc_stat[2];
|
||||
extern word32 g_vbl_count;
|
||||
|
||||
extern int g_imagewriter;
|
||||
extern int g_imagewriter_dpi;
|
||||
extern char* g_imagewriter_output;
|
||||
extern int g_imagewriter_multipage;
|
||||
extern int g_imagewriter_timeout;
|
||||
extern int g_imagewriter_paper;
|
||||
extern int g_imagewriter_banner;
|
||||
|
||||
word32 imagewriter_vbl_count = 0;
|
||||
int imagewriter_port_block = 0;
|
||||
int iw_scc_write = 0;
|
||||
|
||||
int scc_imagewriter_init(int port)
|
||||
{
|
||||
Scc *scc_ptr;
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
imagewriter_init(g_imagewriter_dpi,g_imagewriter_paper,g_imagewriter_banner,g_imagewriter_output,g_imagewriter_multipage);
|
||||
scc_ptr->state = 4;
|
||||
return 4;
|
||||
}
|
||||
|
||||
/** Transfer data from Imagewriter to the SCC **/
|
||||
void scc_imagewriter_fill_readbuf(int port, int space_left, double dcycs)
|
||||
{
|
||||
if (iw_scc_write)
|
||||
{
|
||||
size_t bytes_read;
|
||||
size_t i;
|
||||
byte data[9];
|
||||
if (g_imagewriter == 1)
|
||||
{
|
||||
//Imagewriter LQ self ID string. Tell machine we have a color ribbon and sheet feeder installed.
|
||||
data[0] = 0; //Start bit
|
||||
data[1] ='L'; //Printer type is Imagewriter LQ
|
||||
data[2] ='Q'; //(cont)
|
||||
data[3] ='1'; //15 inch carriage width
|
||||
data[4] ='C'; //Color ribbon installed
|
||||
data[5] ='F'; //Sheet feeder installed, no envelope attachment
|
||||
data[6] ='1'; //Number of sheet feeder bins
|
||||
data[7] = 0x0D; //CR terminates string
|
||||
data[8] = 0; //Stop bit
|
||||
bytes_read = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Imagewriter II self ID string. Tell machine we have a color ribbon and sheet feeder installed.
|
||||
data[0] = 0; //Start bit
|
||||
data[1] ='I'; //Printer type is Imagewriter II
|
||||
data[2] ='W'; //(cont)
|
||||
data[3] ='1'; //10 inch carriage width
|
||||
data[4] ='0'; //(cont)
|
||||
data[5] ='C'; //Color ribbon installed
|
||||
data[6] ='F'; //Sheet feeder installed
|
||||
data[7] = 0; //Stop bit
|
||||
bytes_read = 8;
|
||||
}
|
||||
for(i = 0; i < bytes_read; i++) {
|
||||
scc_add_to_readbuf(port, data[i], dcycs);
|
||||
}
|
||||
iw_scc_write = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Transfer data from the SCC to the Imagewriter. **/
|
||||
void scc_imagewriter_empty_writebuf(int port, double dcycs)
|
||||
{
|
||||
Scc* scc_ptr;
|
||||
|
||||
int rdptr;
|
||||
int wrptr;
|
||||
int len;
|
||||
int done;
|
||||
//int ret;
|
||||
unsigned long bytes_written;
|
||||
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
done = 0;
|
||||
while(!done) {
|
||||
rdptr = scc_ptr->out_rdptr;
|
||||
wrptr = scc_ptr->out_wrptr;
|
||||
if(rdptr == wrptr) {
|
||||
//printf("...rdptr == wrptr\n");
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
len = wrptr - rdptr;
|
||||
if(len < 0) {
|
||||
len = SCC_OUTBUF_SIZE - rdptr;
|
||||
}
|
||||
if(len > 32) {
|
||||
len = 32;
|
||||
}
|
||||
if(len <= 0) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
bytes_written = 1;
|
||||
imagewriter_port_block = 1;
|
||||
imagewriter_loop(scc_ptr->out_buf[rdptr]);
|
||||
imagewriter_vbl_count = g_vbl_count+(g_imagewriter_timeout*60);
|
||||
imagewriter_port_block = 0;
|
||||
//printf("Write Imagewriter ret: %d, bytes_written:%d, len:%d\n", ret,
|
||||
//(int)bytes_written, len);
|
||||
|
||||
if (bytes_written == 0) {
|
||||
done = 1;
|
||||
break;
|
||||
} else {
|
||||
rdptr = rdptr + bytes_written;
|
||||
if(rdptr >= SCC_OUTBUF_SIZE) {
|
||||
rdptr = rdptr - SCC_OUTBUF_SIZE;
|
||||
}
|
||||
scc_ptr->out_rdptr = rdptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//This function handles the automatic timeout of the virtual printer if an
|
||||
//application doesn't send a form feed at the end of the page. It also
|
||||
//allows multipage mode Postscript and native printer documents to
|
||||
//print somewhat how a regular application would.
|
||||
void imagewriter_update()
|
||||
{
|
||||
if (imagewriter_port_block != 1 && imagewriter_vbl_count != 0 && g_vbl_count >= imagewriter_vbl_count)
|
||||
{
|
||||
printf("Calling imagewriter_update and flushing!\n");
|
||||
imagewriter_feed();
|
||||
imagewriter_vbl_count = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013 - 2014 by GSport contributors
|
||||
Originally authored by Christopher Mason
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
/* This is an interface between the SCC emulation and the Virtual Imagewriter. */
|
||||
|
||||
#include "defc.h"
|
||||
#include "scc.h"
|
||||
#include "imagewriter.h"
|
||||
extern Scc scc_stat[2];
|
||||
extern word32 g_vbl_count;
|
||||
|
||||
extern int g_imagewriter;
|
||||
extern int g_imagewriter_dpi;
|
||||
extern char* g_imagewriter_output;
|
||||
extern int g_imagewriter_multipage;
|
||||
extern int g_imagewriter_timeout;
|
||||
extern int g_imagewriter_paper;
|
||||
extern int g_imagewriter_banner;
|
||||
|
||||
word32 imagewriter_vbl_count = 0;
|
||||
int imagewriter_port_block = 0;
|
||||
int iw_scc_write = 0;
|
||||
|
||||
int scc_imagewriter_init(int port)
|
||||
{
|
||||
Scc *scc_ptr;
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
imagewriter_init(g_imagewriter_dpi,g_imagewriter_paper,g_imagewriter_banner,g_imagewriter_output,g_imagewriter_multipage);
|
||||
scc_ptr->state = 4;
|
||||
return 4;
|
||||
}
|
||||
|
||||
/** Transfer data from Imagewriter to the SCC **/
|
||||
void scc_imagewriter_fill_readbuf(int port, int space_left, double dcycs)
|
||||
{
|
||||
if (iw_scc_write)
|
||||
{
|
||||
size_t bytes_read;
|
||||
size_t i;
|
||||
byte data[9];
|
||||
if (g_imagewriter == 1)
|
||||
{
|
||||
//Imagewriter LQ self ID string. Tell machine we have a color ribbon and sheet feeder installed.
|
||||
data[0] = 0; //Start bit
|
||||
data[1] ='L'; //Printer type is Imagewriter LQ
|
||||
data[2] ='Q'; //(cont)
|
||||
data[3] ='1'; //15 inch carriage width
|
||||
data[4] ='C'; //Color ribbon installed
|
||||
data[5] ='F'; //Sheet feeder installed, no envelope attachment
|
||||
data[6] ='1'; //Number of sheet feeder bins
|
||||
data[7] = 0x0D; //CR terminates string
|
||||
data[8] = 0; //Stop bit
|
||||
bytes_read = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Imagewriter II self ID string. Tell machine we have a color ribbon and sheet feeder installed.
|
||||
data[0] = 0; //Start bit
|
||||
data[1] ='I'; //Printer type is Imagewriter II
|
||||
data[2] ='W'; //(cont)
|
||||
data[3] ='1'; //10 inch carriage width
|
||||
data[4] ='0'; //(cont)
|
||||
data[5] ='C'; //Color ribbon installed
|
||||
data[6] ='F'; //Sheet feeder installed
|
||||
data[7] = 0; //Stop bit
|
||||
bytes_read = 8;
|
||||
}
|
||||
for(i = 0; i < bytes_read; i++) {
|
||||
scc_add_to_readbuf(port, data[i], dcycs);
|
||||
}
|
||||
iw_scc_write = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Transfer data from the SCC to the Imagewriter. **/
|
||||
void scc_imagewriter_empty_writebuf(int port, double dcycs)
|
||||
{
|
||||
Scc* scc_ptr;
|
||||
|
||||
int rdptr;
|
||||
int wrptr;
|
||||
int len;
|
||||
int done;
|
||||
//int ret;
|
||||
unsigned long bytes_written;
|
||||
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
done = 0;
|
||||
while(!done) {
|
||||
rdptr = scc_ptr->out_rdptr;
|
||||
wrptr = scc_ptr->out_wrptr;
|
||||
if(rdptr == wrptr) {
|
||||
//printf("...rdptr == wrptr\n");
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
len = wrptr - rdptr;
|
||||
if(len < 0) {
|
||||
len = SCC_OUTBUF_SIZE - rdptr;
|
||||
}
|
||||
if(len > 32) {
|
||||
len = 32;
|
||||
}
|
||||
if(len <= 0) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
bytes_written = 1;
|
||||
imagewriter_port_block = 1;
|
||||
imagewriter_loop(scc_ptr->out_buf[rdptr]);
|
||||
imagewriter_vbl_count = g_vbl_count+(g_imagewriter_timeout*60);
|
||||
imagewriter_port_block = 0;
|
||||
//printf("Write Imagewriter ret: %d, bytes_written:%d, len:%d\n", ret,
|
||||
//(int)bytes_written, len);
|
||||
|
||||
if (bytes_written == 0) {
|
||||
done = 1;
|
||||
break;
|
||||
} else {
|
||||
rdptr = rdptr + bytes_written;
|
||||
if(rdptr >= SCC_OUTBUF_SIZE) {
|
||||
rdptr = rdptr - SCC_OUTBUF_SIZE;
|
||||
}
|
||||
scc_ptr->out_rdptr = rdptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//This function handles the automatic timeout of the virtual printer if an
|
||||
//application doesn't send a form feed at the end of the page. It also
|
||||
//allows multipage mode Postscript and native printer documents to
|
||||
//print somewhat how a regular application would.
|
||||
void imagewriter_update()
|
||||
{
|
||||
if (imagewriter_port_block != 1 && imagewriter_vbl_count != 0 && g_vbl_count >= imagewriter_vbl_count)
|
||||
{
|
||||
printf("Calling imagewriter_update and flushing!\n");
|
||||
imagewriter_feed();
|
||||
imagewriter_vbl_count = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013 - 2014 by GSport contributors
|
||||
Originally authored by Peter Neubauer
|
||||
|
||||
|
@ -162,4 +164,4 @@ void scc_llap_fill_readbuf(int port, int space_left, double dcycs)
|
|||
void scc_llap_empty_writebuf(int port, double dcycs)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2013 by GSport contributors
|
||||
Originally authored by Peter Neubauer
|
||||
|
||||
|
@ -23,4 +25,4 @@ void scc_llap_shutdown();
|
|||
void scc_llap_update();
|
||||
void scc_llap_fill_readbuf(int port, int space_left, double dcycs);
|
||||
void scc_llap_empty_writebuf(int port, double dcycs);
|
||||
void scc_llap_set_node(byte val);
|
||||
void scc_llap_set_node(byte val);
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
@ -27,10 +29,10 @@
|
|||
#include <stdlib.h>
|
||||
#ifndef UNDER_CE //OG
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __CYGWIN__
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
extern Scc scc_stat[2];
|
||||
extern int g_serial_modem[];
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
@ -25,7 +27,7 @@
|
|||
#include "scc.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <Windows.h>
|
||||
#include <Windows.h>
|
||||
#include <NspAPI.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
||||
|
@ -34,7 +36,7 @@ void check_wave_error(int res, char *str);
|
|||
|
||||
#define NUM_WAVE_HEADERS 8
|
||||
|
||||
//HWAVEOUT g_wave_handle = NULL; // OG Default value must be set
|
||||
//HWAVEOUT g_wave_handle = NULL; // OG Default value must be set
|
||||
//WAVEHDR g_wavehdr[NUM_WAVE_HEADERS];
|
||||
|
||||
extern int g_audio_enable;
|
||||
|
@ -93,123 +95,123 @@ win32snd_init(word32 *shmaddr)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void sdl_send_audio(word32 *ptr, int size, int real_samps) {
|
||||
|
||||
/* code */
|
||||
//printf(" sdl_s_a %d\t 0x%08x ",size, &ptr);
|
||||
int i;
|
||||
for (i=0; i<size; i++) {
|
||||
if (real_samps) {
|
||||
bptr[g_sdlsnd_write_idx++] = ptr[i];
|
||||
} else {
|
||||
bptr[g_sdlsnd_write_idx++] = 0;
|
||||
}
|
||||
if (g_sdlsnd_write_idx>g_sdlsnd_buflen) {
|
||||
g_sdlsnd_write_idx=0;
|
||||
}
|
||||
}
|
||||
g_playbuf_buffered += size;
|
||||
|
||||
}
|
||||
|
||||
void handle_sdl_snd(void *userdata, Uint8 *stream, int len) {
|
||||
/* Only play if we have data left */
|
||||
/* if ( g_playbuf_buffered == 0) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
for(int i = 0; i < len; ++i) {
|
||||
if(g_playbuf_buffered <= 0) {
|
||||
stream[i] = 0;
|
||||
} else {
|
||||
stream[i] = bptr[g_sdlsnd_read_idx++];
|
||||
if(g_sdlsnd_read_idx == g_sdlsnd_buflen)
|
||||
g_sdlsnd_read_idx = 0;
|
||||
g_playbuf_buffered--;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
/* Mix as much data as possible */
|
||||
len = ( len > g_playbuf_buffered ? g_playbuf_buffered : len );
|
||||
//len = ( g_sdlsnd_read_idx+len < g_sdlsnd_buflen ? len : g_sdlsnd_read_idx+len);
|
||||
SDL_memset(stream, 0, len);
|
||||
if (g_sdlsnd_read_idx+len < g_sdlsnd_buflen) {
|
||||
SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], len);
|
||||
g_sdlsnd_read_idx += len;
|
||||
g_playbuf_buffered -= len;
|
||||
} else {
|
||||
/*
|
||||
int top_len = 0;
|
||||
top_len = g_sdlsnd_buflen - g_sdlsnd_read_idx;
|
||||
SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], top_len);
|
||||
g_sdlsnd_read_idx = 0;
|
||||
g_playbuf_buffered -= top_len;
|
||||
// SDL_memcpy (stream+top_len, bptr[g_sdlsnd_read_idx], len-top_len);
|
||||
g_sdlsnd_read_idx += len-top_len;
|
||||
g_playbuf_buffered -= len-top_len;
|
||||
*/
|
||||
}
|
||||
|
||||
//SDL_MixAudio(stream, pointer, len, SDL_MIX_MAXVOLUME);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
child_sound_init_sdl()
|
||||
{
|
||||
printf("child_sound_init_sdl");
|
||||
|
||||
SDL_memset(&want, 0, sizeof(want)); // or SDL_zero(want)
|
||||
want.freq = g_preferred_rate; // 48000 ?
|
||||
want.format = AUDIO_S16SYS; // AUDIO_F32
|
||||
want.channels = NUM_CHANNELS; //2
|
||||
want.samples = 512; //4096
|
||||
want.callback = handle_sdl_snd; // you wrote this function elsewhere.
|
||||
|
||||
dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, SDL_AUDIO_ALLOW_FORMAT_CHANGE);
|
||||
if (dev == 0) {
|
||||
printf("Failed to open audio: %s\n", SDL_GetError());
|
||||
} else {
|
||||
if (have.format != want.format) { // we let this one thing change.
|
||||
printf("We didn't get Float32 audio format.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// super experimental unknown
|
||||
|
||||
g_playbuf_buffered = 0; // init buffered state
|
||||
|
||||
int blen;
|
||||
blen = (SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE * 2); // *2 unnecessary?
|
||||
g_sdlsnd_buflen = blen;
|
||||
bptr = (byte*)malloc(blen);
|
||||
if(bptr == NULL) {
|
||||
printf("Unabled to allocate sound buffer\n");
|
||||
exit(1);
|
||||
}
|
||||
memset(bptr, 0, SOUND_SHM_SAMP_SIZE*SAMPLE_CHAN_SIZE *2); // zero out the buffer
|
||||
|
||||
g_sdlsnd_write_idx = 0; // initialize
|
||||
g_sdlsnd_read_idx = 0;
|
||||
|
||||
SDL_PauseAudioDevice(dev, 0); // start audio playing.
|
||||
|
||||
g_audio_rate = have.freq;
|
||||
printf("g_audio_rate: %d\n", g_audio_rate);
|
||||
set_audio_rate(g_audio_rate); // let kegs simulator know the rate
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
sdlsnd_shutdown() {
|
||||
//SDL_Delay(5000); // let the audio callback play some sound for 5 seconds.
|
||||
SDL_CloseAudioDevice(dev);
|
||||
printf("sdlsnd_shutdown");
|
||||
}
|
||||
|
||||
void sdl_send_audio(word32 *ptr, int size, int real_samps) {
|
||||
|
||||
/* code */
|
||||
//printf(" sdl_s_a %d\t 0x%08x ",size, &ptr);
|
||||
int i;
|
||||
for (i=0; i<size; i++) {
|
||||
if (real_samps) {
|
||||
bptr[g_sdlsnd_write_idx++] = ptr[i];
|
||||
} else {
|
||||
bptr[g_sdlsnd_write_idx++] = 0;
|
||||
}
|
||||
if (g_sdlsnd_write_idx>g_sdlsnd_buflen) {
|
||||
g_sdlsnd_write_idx=0;
|
||||
}
|
||||
}
|
||||
g_playbuf_buffered += size;
|
||||
|
||||
}
|
||||
|
||||
void handle_sdl_snd(void *userdata, Uint8 *stream, int len) {
|
||||
/* Only play if we have data left */
|
||||
/* if ( g_playbuf_buffered == 0) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
for(int i = 0; i < len; ++i) {
|
||||
if(g_playbuf_buffered <= 0) {
|
||||
stream[i] = 0;
|
||||
} else {
|
||||
stream[i] = bptr[g_sdlsnd_read_idx++];
|
||||
if(g_sdlsnd_read_idx == g_sdlsnd_buflen)
|
||||
g_sdlsnd_read_idx = 0;
|
||||
g_playbuf_buffered--;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
/* Mix as much data as possible */
|
||||
len = ( len > g_playbuf_buffered ? g_playbuf_buffered : len );
|
||||
//len = ( g_sdlsnd_read_idx+len < g_sdlsnd_buflen ? len : g_sdlsnd_read_idx+len);
|
||||
SDL_memset(stream, 0, len);
|
||||
if (g_sdlsnd_read_idx+len < g_sdlsnd_buflen) {
|
||||
SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], len);
|
||||
g_sdlsnd_read_idx += len;
|
||||
g_playbuf_buffered -= len;
|
||||
} else {
|
||||
/*
|
||||
int top_len = 0;
|
||||
top_len = g_sdlsnd_buflen - g_sdlsnd_read_idx;
|
||||
SDL_memcpy (stream, &bptr[g_sdlsnd_read_idx], top_len);
|
||||
g_sdlsnd_read_idx = 0;
|
||||
g_playbuf_buffered -= top_len;
|
||||
// SDL_memcpy (stream+top_len, bptr[g_sdlsnd_read_idx], len-top_len);
|
||||
g_sdlsnd_read_idx += len-top_len;
|
||||
g_playbuf_buffered -= len-top_len;
|
||||
*/
|
||||
}
|
||||
|
||||
//SDL_MixAudio(stream, pointer, len, SDL_MIX_MAXVOLUME);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
child_sound_init_sdl()
|
||||
{
|
||||
printf("child_sound_init_sdl");
|
||||
|
||||
SDL_memset(&want, 0, sizeof(want)); // or SDL_zero(want)
|
||||
want.freq = g_preferred_rate; // 48000 ?
|
||||
want.format = AUDIO_S16SYS; // AUDIO_F32
|
||||
want.channels = NUM_CHANNELS; //2
|
||||
want.samples = 512; //4096
|
||||
want.callback = handle_sdl_snd; // you wrote this function elsewhere.
|
||||
|
||||
dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, SDL_AUDIO_ALLOW_FORMAT_CHANGE);
|
||||
if (dev == 0) {
|
||||
printf("Failed to open audio: %s\n", SDL_GetError());
|
||||
} else {
|
||||
if (have.format != want.format) { // we let this one thing change.
|
||||
printf("We didn't get Float32 audio format.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// super experimental unknown
|
||||
|
||||
g_playbuf_buffered = 0; // init buffered state
|
||||
|
||||
int blen;
|
||||
blen = (SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE * 2); // *2 unnecessary?
|
||||
g_sdlsnd_buflen = blen;
|
||||
bptr = (byte*)malloc(blen);
|
||||
if(bptr == NULL) {
|
||||
printf("Unabled to allocate sound buffer\n");
|
||||
exit(1);
|
||||
}
|
||||
memset(bptr, 0, SOUND_SHM_SAMP_SIZE*SAMPLE_CHAN_SIZE *2); // zero out the buffer
|
||||
|
||||
g_sdlsnd_write_idx = 0; // initialize
|
||||
g_sdlsnd_read_idx = 0;
|
||||
|
||||
SDL_PauseAudioDevice(dev, 0); // start audio playing.
|
||||
|
||||
g_audio_rate = have.freq;
|
||||
printf("g_audio_rate: %d\n", g_audio_rate);
|
||||
set_audio_rate(g_audio_rate); // let kegs simulator know the rate
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
sdlsnd_shutdown() {
|
||||
//SDL_Delay(5000); // let the audio callback play some sound for 5 seconds.
|
||||
SDL_CloseAudioDevice(dev);
|
||||
printf("sdlsnd_shutdown");
|
||||
}
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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 "SDL.h"
|
||||
#include "defc.h"
|
||||
|
||||
|
|
398
src/sim65816.c
398
src/sim65816.c
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
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
|
||||
|
@ -27,7 +29,7 @@
|
|||
#include "tfe/protos_tfe.h"
|
||||
#endif
|
||||
#include "printer.h"
|
||||
#include "imagewriter.h"
|
||||
#include "imagewriter.h"
|
||||
|
||||
#ifdef UNDER_CE
|
||||
#define vsnprintf _vsnprintf
|
||||
|
@ -43,9 +45,9 @@ extern void get_cwd(LPTSTR buffer, int size);
|
|||
|
||||
#define PC_LOG_LEN (8*1024)
|
||||
|
||||
int g_speed_fast ; // OG Expose fast parameter
|
||||
int g_initialized = 0; // OG To know if the emulator has finalized its initialization
|
||||
int g_accept_events = 0; // OG To know if the emulator is ready to accept external events
|
||||
int g_speed_fast ; // OG Expose fast parameter
|
||||
int g_initialized = 0; // OG To know if the emulator has finalized its initialization
|
||||
int g_accept_events = 0; // OG To know if the emulator is ready to accept external events
|
||||
|
||||
char g_argv0_path[256] = "./";
|
||||
|
||||
|
@ -151,10 +153,10 @@ char* g_imagewriter_output = "bmp";
|
|||
int g_imagewriter_multipage = 0;
|
||||
int g_imagewriter_timeout = 2;
|
||||
char* g_imagewriter_fixed_font = "lib/letgothl.ttf";
|
||||
char* g_imagewriter_prop_font = "lib/letgothl.ttf";
|
||||
char* g_imagewriter_prop_font = "lib/letgothl.ttf";
|
||||
int g_imagewriter_paper = 0;
|
||||
int g_imagewriter_banner = 0;
|
||||
|
||||
int g_imagewriter_banner = 0;
|
||||
|
||||
int g_config_iwm_vbl_count = 0;
|
||||
extern const char g_gsport_version_str[] = "0.31";
|
||||
int g_pause=0; // OG Added pause
|
||||
|
@ -214,13 +216,13 @@ byte *g_dummy_memory1_ptr = 0;
|
|||
byte *g_rom_fc_ff_ptr = 0;
|
||||
byte *g_rom_cards_ptr = 0;
|
||||
|
||||
// OG Added allocated pointers
|
||||
byte *g_slow_memory_ptr_allocated = 0;
|
||||
byte *g_memory_ptr_allocated = 0;
|
||||
byte *g_dummy_memory1_ptr_allocated = 0;
|
||||
byte *g_rom_fc_ff_ptr_allocated = 0;
|
||||
byte *g_rom_cards_ptr_allocated = 0;
|
||||
|
||||
// OG Added allocated pointers
|
||||
byte *g_slow_memory_ptr_allocated = 0;
|
||||
byte *g_memory_ptr_allocated = 0;
|
||||
byte *g_dummy_memory1_ptr_allocated = 0;
|
||||
byte *g_rom_fc_ff_ptr_allocated = 0;
|
||||
byte *g_rom_cards_ptr_allocated = 0;
|
||||
|
||||
void *g_memory_alloc_ptr = 0; /* for freeing memory area */
|
||||
|
||||
Page_info page_info_rd_wr[2*65536 + PAGE_INFO_PAD_SIZE];
|
||||
|
@ -236,69 +238,69 @@ Data_log *g_log_data_ptr = &(g_data_log_array[0]);
|
|||
Data_log *g_log_data_start_ptr = &(g_data_log_array[0]);
|
||||
Data_log *g_log_data_end_ptr = &(g_data_log_array[PC_LOG_LEN]);
|
||||
|
||||
// OG Added sim65816_initglobals()
|
||||
void sim65816_initglobals()
|
||||
{
|
||||
// OG Added sim65816_initglobals()
|
||||
void sim65816_initglobals()
|
||||
{
|
||||
|
||||
g_fcycles_stop = 0.0;
|
||||
halt_sim = 0;
|
||||
enter_debug = 0;
|
||||
g_rom_version = -1;
|
||||
g_user_halt_bad = 0;
|
||||
g_halt_on_bad_read = 0;
|
||||
g_ignore_bad_acc = 1;
|
||||
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 };
|
||||
|
||||
g_config_iwm_vbl_count = 0;
|
||||
|
||||
g_pause=0;
|
||||
|
||||
g_last_vbl_dcycs = START_DCYCS;
|
||||
g_cur_dcycs = START_DCYCS;
|
||||
|
||||
g_last_vbl_dadjcycs = 0.0;
|
||||
g_dadjcycs = 0.0;
|
||||
|
||||
|
||||
g_wait_pending = 0;
|
||||
g_stp_pending = 0;
|
||||
|
||||
g_num_irq = 0;
|
||||
g_num_brk = 0;
|
||||
g_num_cop = 0;
|
||||
g_num_enter_engine = 0;
|
||||
g_io_amt = 0;
|
||||
g_engine_action = 0;
|
||||
g_engine_halt_event = 0;
|
||||
g_engine_scan_int = 0;
|
||||
g_engine_doc_int = 0;
|
||||
|
||||
g_testing = 0;
|
||||
g_testing_enabled = 0;
|
||||
|
||||
g_debug_file_fd = -1;
|
||||
g_fatal_log = -1;
|
||||
|
||||
g_25sec_cntr = 0;
|
||||
g_1sec_cntr = 0;
|
||||
|
||||
g_dnatcycs_1sec = 0.0;
|
||||
g_natcycs_lastvbl = 0;
|
||||
|
||||
Verbose = 0;
|
||||
Halt_on = 0;
|
||||
|
||||
g_mem_size_base = 256*1024; /* size of motherboard memory */
|
||||
g_mem_size_exp = 8*1024*1024; /* size of expansion RAM card */
|
||||
g_mem_size_total = 256*1024; /* Total contiguous RAM from 0 */
|
||||
}
|
||||
|
||||
g_fcycles_stop = 0.0;
|
||||
halt_sim = 0;
|
||||
enter_debug = 0;
|
||||
g_rom_version = -1;
|
||||
g_user_halt_bad = 0;
|
||||
g_halt_on_bad_read = 0;
|
||||
g_ignore_bad_acc = 1;
|
||||
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 };
|
||||
|
||||
g_config_iwm_vbl_count = 0;
|
||||
|
||||
g_pause=0;
|
||||
|
||||
g_last_vbl_dcycs = START_DCYCS;
|
||||
g_cur_dcycs = START_DCYCS;
|
||||
|
||||
g_last_vbl_dadjcycs = 0.0;
|
||||
g_dadjcycs = 0.0;
|
||||
|
||||
|
||||
g_wait_pending = 0;
|
||||
g_stp_pending = 0;
|
||||
|
||||
g_num_irq = 0;
|
||||
g_num_brk = 0;
|
||||
g_num_cop = 0;
|
||||
g_num_enter_engine = 0;
|
||||
g_io_amt = 0;
|
||||
g_engine_action = 0;
|
||||
g_engine_halt_event = 0;
|
||||
g_engine_scan_int = 0;
|
||||
g_engine_doc_int = 0;
|
||||
|
||||
g_testing = 0;
|
||||
g_testing_enabled = 0;
|
||||
|
||||
g_debug_file_fd = -1;
|
||||
g_fatal_log = -1;
|
||||
|
||||
g_25sec_cntr = 0;
|
||||
g_1sec_cntr = 0;
|
||||
|
||||
g_dnatcycs_1sec = 0.0;
|
||||
g_natcycs_lastvbl = 0;
|
||||
|
||||
Verbose = 0;
|
||||
Halt_on = 0;
|
||||
|
||||
g_mem_size_base = 256*1024; /* size of motherboard memory */
|
||||
g_mem_size_exp = 8*1024*1024; /* size of expansion RAM card */
|
||||
g_mem_size_total = 256*1024; /* Total contiguous RAM from 0 */
|
||||
}
|
||||
|
||||
void
|
||||
show_pc_log()
|
||||
{
|
||||
|
@ -427,7 +429,7 @@ toolbox_debug_c(word32 xreg, word32 stack, double *cyc_ptr)
|
|||
pos = g_toolbox_log_pos;
|
||||
|
||||
stack += 9;
|
||||
g_toolbox_log_array[pos][0] = (word32)(g_last_vbl_dcycs + *cyc_ptr);
|
||||
g_toolbox_log_array[pos][0] = (word32)(g_last_vbl_dcycs + *cyc_ptr);
|
||||
g_toolbox_log_array[pos][1] = stack+1;
|
||||
g_toolbox_log_array[pos][2] = xreg;
|
||||
g_toolbox_log_array[pos][3] = toolbox_debug_4byte(stack+1);
|
||||
|
@ -718,30 +720,30 @@ show_regs()
|
|||
show_regs_act(&engine);
|
||||
}
|
||||
|
||||
//OG for regular exit, use quitEmulator()
|
||||
|
||||
void quitEmulator()
|
||||
//OG for regular exit, use quitEmulator()
|
||||
|
||||
void quitEmulator()
|
||||
{
|
||||
printf("set_halt(HALT_WANTTOQUIT)\n");
|
||||
set_halt(HALT_WANTTOQUIT);
|
||||
}
|
||||
|
||||
//OG change exit to fatal_exit()
|
||||
|
||||
#ifndef ACTIVEGS
|
||||
// use standard exit function
|
||||
#define fatalExit exit
|
||||
#else
|
||||
extern void fatalExit(int);
|
||||
printf("set_halt(HALT_WANTTOQUIT)\n");
|
||||
set_halt(HALT_WANTTOQUIT);
|
||||
}
|
||||
|
||||
//OG change exit to fatal_exit()
|
||||
|
||||
#ifndef ACTIVEGS
|
||||
// use standard exit function
|
||||
#define fatalExit exit
|
||||
#else
|
||||
extern void fatalExit(int);
|
||||
#endif
|
||||
|
||||
void my_exit(int ret)
|
||||
{
|
||||
end_screen();
|
||||
imagewriter_close();
|
||||
|
||||
void my_exit(int ret)
|
||||
{
|
||||
end_screen();
|
||||
imagewriter_close();
|
||||
printer_close();
|
||||
printf("exiting (ret=%d)\n",ret);
|
||||
fatalExit(ret);
|
||||
printf("exiting (ret=%d)\n",ret);
|
||||
fatalExit(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -786,9 +788,9 @@ do_reset()
|
|||
|
||||
g_stepping = 0;
|
||||
|
||||
if (g_irq_pending)
|
||||
halt_printf("*** irq remainings...\n");
|
||||
|
||||
if (g_irq_pending)
|
||||
halt_printf("*** irq remainings...\n");
|
||||
|
||||
}
|
||||
|
||||
#define CHECK(start, var, value, var1, var2) \
|
||||
|
@ -851,7 +853,7 @@ memalloc_align(int size, int skip_amt, void **alloc_ptr)
|
|||
word32 offset;
|
||||
|
||||
skip_amt = MAX(256, skip_amt);
|
||||
bptr = (byte*)calloc(size + skip_amt + 256, 1); // OG Added cast
|
||||
bptr = (byte*)calloc(size + skip_amt + 256, 1); // OG Added cast
|
||||
if(alloc_ptr) {
|
||||
/* Save allocation address */
|
||||
*alloc_ptr = bptr;
|
||||
|
@ -876,34 +878,34 @@ memory_ptr_init()
|
|||
/* changes this will be called */
|
||||
mem_size = MIN(0xdf0000, g_mem_size_base + g_mem_size_exp);
|
||||
g_mem_size_total = mem_size;
|
||||
|
||||
// OG using memory_ptr_shut() instead
|
||||
memory_ptr_shut();
|
||||
/*
|
||||
|
||||
// OG using memory_ptr_shut() instead
|
||||
memory_ptr_shut();
|
||||
/*
|
||||
if(g_memory_alloc_ptr) {
|
||||
free(g_memory_alloc_ptr);
|
||||
g_memory_alloc_ptr = 0;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr);
|
||||
|
||||
printf("RAM size is 0 - %06x (%.2fMB)\n", mem_size,
|
||||
(double)mem_size/(1024.0*1024.0));
|
||||
}
|
||||
|
||||
// OG Added memory_ptr_shut
|
||||
void
|
||||
memory_ptr_shut()
|
||||
{
|
||||
if(g_memory_alloc_ptr)
|
||||
{
|
||||
free(g_memory_alloc_ptr);
|
||||
g_memory_alloc_ptr = 0;
|
||||
}
|
||||
g_memory_ptr = 0;
|
||||
}
|
||||
|
||||
|
||||
// OG Added memory_ptr_shut
|
||||
void
|
||||
memory_ptr_shut()
|
||||
{
|
||||
if(g_memory_alloc_ptr)
|
||||
{
|
||||
free(g_memory_alloc_ptr);
|
||||
g_memory_alloc_ptr = 0;
|
||||
}
|
||||
g_memory_ptr = 0;
|
||||
}
|
||||
|
||||
|
||||
extern int g_screen_redraw_skip_amt;
|
||||
extern int g_use_shmem;
|
||||
extern int g_use_dhr140;
|
||||
|
@ -922,16 +924,16 @@ gsportmain(int argc, char **argv)
|
|||
int tmp1;
|
||||
int i;
|
||||
char *final_arg = 0;
|
||||
|
||||
// OG Restoring globals
|
||||
sim65816_initglobals();
|
||||
moremem_init();
|
||||
|
||||
//OG Disabling argument parsing
|
||||
#ifndef ACTIVEGS
|
||||
|
||||
|
||||
// OG Restoring globals
|
||||
sim65816_initglobals();
|
||||
moremem_init();
|
||||
|
||||
//OG Disabling argument parsing
|
||||
#ifndef ACTIVEGS
|
||||
|
||||
/* parse args */
|
||||
for(i = 1; i < argc; i++) {
|
||||
for(i = 1; i < argc; i++) {
|
||||
if(!strcmp("-badrd", argv[i])) {
|
||||
printf("Halting on bad reads\n");
|
||||
g_halt_on_bad_read = 2;
|
||||
|
@ -1043,7 +1045,7 @@ gsportmain(int argc, char **argv)
|
|||
exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
check_engine_asm_defines();
|
||||
fixed_memory_ptrs_init();
|
||||
|
@ -1133,33 +1135,33 @@ gsportmain(int argc, char **argv)
|
|||
|
||||
do_reset();
|
||||
g_stepping = 0;
|
||||
|
||||
// OG Notify emulator has been initialized and ready to accept external events
|
||||
g_initialized = 1;
|
||||
g_accept_events = 1;
|
||||
|
||||
|
||||
// OG Notify emulator has been initialized and ready to accept external events
|
||||
g_initialized = 1;
|
||||
g_accept_events = 1;
|
||||
|
||||
do_go();
|
||||
|
||||
/* If we get here, we hit a breakpoint, call debug intfc */
|
||||
do_debug_intfc();
|
||||
|
||||
// OG Notify emulator is being closed, and cannot accept events anymore
|
||||
g_accept_events = 0;
|
||||
|
||||
sound_shutdown();
|
||||
|
||||
|
||||
// OG Cleaning up
|
||||
adb_shut();
|
||||
iwm_shut();
|
||||
fixed_memory_ptrs_shut();
|
||||
load_roms_shut_memory();
|
||||
clear_fatal_logs();
|
||||
|
||||
// OG Not needed anymore : the emulator will quit gently
|
||||
//my_exit(0);
|
||||
end_screen();
|
||||
|
||||
// OG Notify emulator is being closed, and cannot accept events anymore
|
||||
g_accept_events = 0;
|
||||
|
||||
sound_shutdown();
|
||||
|
||||
|
||||
// OG Cleaning up
|
||||
adb_shut();
|
||||
iwm_shut();
|
||||
fixed_memory_ptrs_shut();
|
||||
load_roms_shut_memory();
|
||||
clear_fatal_logs();
|
||||
|
||||
// OG Not needed anymore : the emulator will quit gently
|
||||
//my_exit(0);
|
||||
end_screen();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1184,14 +1186,14 @@ load_roms_init_memory()
|
|||
set_memory16_c(0xe115fe, 0, 0);
|
||||
}
|
||||
|
||||
// OG Added load_roms_shut_memory
|
||||
void load_roms_shut_memory()
|
||||
{
|
||||
memory_ptr_shut();
|
||||
}
|
||||
|
||||
#ifndef ACTIVEGS
|
||||
|
||||
// OG Added load_roms_shut_memory
|
||||
void load_roms_shut_memory()
|
||||
{
|
||||
memory_ptr_shut();
|
||||
}
|
||||
|
||||
#ifndef ACTIVEGS
|
||||
|
||||
void
|
||||
gsport_expand_path(char *out_ptr, const char *in_ptr, int maxlen)
|
||||
{
|
||||
|
@ -1341,8 +1343,8 @@ setup_gsport_file(char *outname, int maxlen, int ok_if_missing,
|
|||
my_exit(2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Event g_event_list[MAX_EVENTS];
|
||||
Event g_event_free;
|
||||
Event g_event_start;
|
||||
|
@ -1675,13 +1677,13 @@ run_prog()
|
|||
|
||||
while(1) {
|
||||
fflush(stdout);
|
||||
|
||||
// OG Disabling control panel
|
||||
#ifndef ACTIVEGS
|
||||
|
||||
// OG Disabling control panel
|
||||
#ifndef ACTIVEGS
|
||||
if(g_config_control_panel) {
|
||||
config_control_panel();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if(g_irq_pending && !(engine.psr & 0x4)) {
|
||||
irq_printf("taking an irq!\n");
|
||||
take_irq(0);
|
||||
|
@ -1695,8 +1697,8 @@ run_prog()
|
|||
zip_follow_cps = ((g_zipgs_reg_c059 & 0x8) != 0);
|
||||
zip_speed_0tof_new = g_zipgs_reg_c05a & 0xf0;
|
||||
fast = (g_c036_val_speed & 0x80) || (zip_en && !zip_follow_cps);
|
||||
// OG Make fast parameter public
|
||||
g_speed_fast = fast;
|
||||
// OG Make fast parameter public
|
||||
g_speed_fast = fast;
|
||||
if(zip_speed_0tof_new != zip_speed_0tof) {
|
||||
zip_speed_0tof = zip_speed_0tof_new;
|
||||
setup_zip_speeds();
|
||||
|
@ -1711,11 +1713,11 @@ run_prog()
|
|||
zip_speed = faster_than_28 &&
|
||||
((zip_speed_0tof != 0) || (limit_speed == 3) ||
|
||||
(g_zipgs_unlock >= 4) );
|
||||
|
||||
// OG unlimited speed should not be affected by zip.
|
||||
// unl_speed = faster_than_28 && !zip_speed;
|
||||
unl_speed = (limit_speed == 0) && faster_than_28;
|
||||
|
||||
|
||||
// OG unlimited speed should not be affected by zip.
|
||||
// unl_speed = faster_than_28 && !zip_speed;
|
||||
unl_speed = (limit_speed == 0) && faster_than_28;
|
||||
|
||||
if(unl_speed) {
|
||||
/* use unlimited speed */
|
||||
fspeed_mult = g_projected_pmhz;
|
||||
|
@ -2125,13 +2127,13 @@ update_60hz(double dcycs, double dtime_now)
|
|||
default: sp_str = "Unlimited"; break;
|
||||
}
|
||||
|
||||
// OG Pass speed info to the control (ActiveX specific)
|
||||
#ifdef ACTIVEGS
|
||||
{
|
||||
extern void updateInfo(const char* target,const char *speed);
|
||||
updateInfo(sp_str,total_mhz_ptr);
|
||||
}
|
||||
#endif
|
||||
// OG Pass speed info to the control (ActiveX specific)
|
||||
#ifdef ACTIVEGS
|
||||
{
|
||||
extern void updateInfo(const char* target,const char *speed);
|
||||
updateInfo(sp_str,total_mhz_ptr);
|
||||
}
|
||||
#endif
|
||||
sprintf(status_buf, "dcycs:%9.1f sim MHz:%s "
|
||||
"Eff MHz:%s, sec:%1.3f vol:%02x pal:%x, Limit:%s",
|
||||
dcycs/(1000.0*1000.0), sim_mhz_ptr, total_mhz_ptr,
|
||||
|
@ -2360,17 +2362,17 @@ update_60hz(double dcycs, double dtime_now)
|
|||
}
|
||||
|
||||
iwm_vbl_update(doit_3_persec);
|
||||
|
||||
// OG Disabling config update
|
||||
#ifndef ACTIVEGS
|
||||
|
||||
// OG Disabling config update
|
||||
#ifndef ACTIVEGS
|
||||
config_vbl_update(doit_3_persec);
|
||||
#else
|
||||
// OG Added disk update
|
||||
{
|
||||
extern void checkImages();
|
||||
checkImages();
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// OG Added disk update
|
||||
{
|
||||
extern void checkImages();
|
||||
checkImages();
|
||||
}
|
||||
#endif
|
||||
|
||||
video_update();
|
||||
sound_update(dcycs);
|
||||
|
@ -2384,7 +2386,7 @@ update_60hz(double dcycs, double dtime_now)
|
|||
if (g_imagewriter_timeout)
|
||||
{
|
||||
imagewriter_update();
|
||||
}
|
||||
}
|
||||
paddle_update_buttons();
|
||||
}
|
||||
|
||||
|
@ -2465,7 +2467,7 @@ check_scan_line_int(double dcycs, int cur_video_line)
|
|||
}
|
||||
if(g_slow_memory_ptr[0x19d00+i] & 0x40) {
|
||||
irq_printf("Adding scan_int for line %d\n", i);
|
||||
delay = (int)( (DCYCS_IN_16MS/262.0) * ((double)line) );
|
||||
delay = (int)( (DCYCS_IN_16MS/262.0) * ((double)line) );
|
||||
add_event_entry(g_last_vbl_dcycs + delay, EV_SCAN_INT +
|
||||
(line << 8));
|
||||
g_scan_int_events = 1;
|
||||
|
@ -2681,15 +2683,15 @@ gsport_vprintf(const char *fmt, va_list ap)
|
|||
int len;
|
||||
int ret;
|
||||
|
||||
bufptr = (char*)malloc(4096); // OG Added Cast
|
||||
bufptr = (char*)malloc(4096); // OG Added Cast
|
||||
ret = vsnprintf(bufptr, 4090, fmt, ap);
|
||||
|
||||
// OG Display warning
|
||||
printf("Warning:%s",bufptr);
|
||||
|
||||
// OG Display warning
|
||||
printf("Warning:%s",bufptr);
|
||||
|
||||
len = strlen(bufptr);
|
||||
if(g_fatal_log >= 0 && g_fatal_log < MAX_FATAL_LOGS) {
|
||||
buf2ptr = (char*)malloc(len+1); // OG Added Cast
|
||||
buf2ptr = (char*)malloc(len+1); // OG Added Cast
|
||||
memcpy(buf2ptr, bufptr, len+1);
|
||||
g_fatal_log_strs[g_fatal_log++] = buf2ptr;
|
||||
}
|
||||
|
@ -2740,7 +2742,7 @@ gsport_malloc_str(char *in_str)
|
|||
int len;
|
||||
|
||||
len = strlen(in_str) + 1;
|
||||
str = (char*)malloc(len); // OG Added cast
|
||||
str = (char*)malloc(len); // OG Added cast
|
||||
memcpy(str, in_str, len);
|
||||
|
||||
return str;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
|
4190
src/sound.c
4190
src/sound.c
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,435 +1,437 @@
|
|||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 - 2012 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 "sound.h"
|
||||
|
||||
#ifdef HPUX
|
||||
# include <sys/audio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SDL
|
||||
# include "SDL.h"
|
||||
long sound_init_device_sdl();
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(OSS)
|
||||
# include <sys/soundcard.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN_SOUND /* Workaround - gcc in cygwin wasn't defining _WIN32 */
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifndef UNDER_CE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern int Verbose;
|
||||
|
||||
extern int g_audio_rate;
|
||||
|
||||
int g_preferred_rate = 48000;
|
||||
int g_audio_socket = -1;
|
||||
int g_bytes_written = 0;
|
||||
|
||||
#define ZERO_BUF_SIZE 2048
|
||||
|
||||
word32 g_snd_zero_buf[ZERO_BUF_SIZE];
|
||||
|
||||
#define ZERO_PAUSE_SAFETY_SAMPS (g_audio_rate >> 5)
|
||||
#define ZERO_PAUSE_NUM_SAMPS (4*g_audio_rate)
|
||||
|
||||
int g_zeroes_buffered = 0;
|
||||
int g_zeroes_seen = 0;
|
||||
int g_sound_paused = 0;
|
||||
int g_childsnd_vbl = 0;
|
||||
int g_childsnd_pos = 0;
|
||||
word32 *g_childsnd_shm_addr = 0;
|
||||
|
||||
void child_sound_init_linux();
|
||||
void child_sound_init_hpdev();
|
||||
void child_sound_initWIN_SOUND();
|
||||
void child_sound_init_mac();
|
||||
void child_sound_init_sdl();
|
||||
long sound_init_device_sdl();
|
||||
|
||||
void
|
||||
reliable_buf_write(word32 *shm_addr, int pos, int size)
|
||||
{
|
||||
byte *ptr;
|
||||
int ret;
|
||||
|
||||
if(size < 1 || pos < 0 || pos > SOUND_SHM_SAMP_SIZE ||
|
||||
size > SOUND_SHM_SAMP_SIZE ||
|
||||
(pos + size) > SOUND_SHM_SAMP_SIZE) {
|
||||
printf("reliable_buf_write: pos: %04x, size: %04x\n", pos, size);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ptr = (byte *)&(shm_addr[pos]);
|
||||
size = size * 4;
|
||||
|
||||
while(size > 0) {
|
||||
#if defined(HAVE_SDL)
|
||||
//ret = sdl_send_audio(ptr, size);
|
||||
|
||||
#elif defined(WIN_SOUND)
|
||||
ret = win32_send_audio(ptr, size);
|
||||
#elif defined(MAC) && !defined(HAVE_SDL)
|
||||
ret = mac_send_audio(ptr, size);
|
||||
#else
|
||||
ret = write(g_audio_socket, ptr, size);
|
||||
#endif
|
||||
|
||||
if(ret < 0) {
|
||||
printf("audio write, errno: %d\n", errno);
|
||||
exit(1);
|
||||
}
|
||||
size = size - ret;
|
||||
ptr += ret;
|
||||
g_bytes_written += ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
reliable_zero_write(int amt)
|
||||
{
|
||||
int len;
|
||||
|
||||
while(amt > 0) {
|
||||
len = MIN(amt, ZERO_BUF_SIZE);
|
||||
reliable_buf_write(g_snd_zero_buf, 0, len);
|
||||
amt -= len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
child_sound_loop(int read_fd, int write_fd, word32 *shm_addr)
|
||||
{
|
||||
word32 tmp;
|
||||
int ret;
|
||||
|
||||
g_audio_rate = g_preferred_rate;
|
||||
|
||||
g_zeroes_buffered = 0;
|
||||
g_zeroes_seen = 0;
|
||||
g_sound_paused = 0;
|
||||
|
||||
g_childsnd_pos = 0;
|
||||
g_childsnd_vbl = 0;
|
||||
g_childsnd_shm_addr = shm_addr;
|
||||
|
||||
#if defined(HAVE_SDL)
|
||||
//child_sound_init_sdl();
|
||||
long rate = sound_init_device_sdl();
|
||||
return;
|
||||
#elif defined(__linux__) || defined(OSS)
|
||||
child_sound_init_linux();
|
||||
#elif HPUX
|
||||
child_sound_init_hpdev();
|
||||
#elif WIN_SOUND
|
||||
child_sound_init_win32();
|
||||
return;
|
||||
#elif defined(MAC) && !defined(HAVE_SDL)
|
||||
child_sound_init_mac();
|
||||
return;
|
||||
#endif
|
||||
|
||||
doc_printf("Child pipe fd: %d\n", read_fd);
|
||||
|
||||
tmp = g_audio_rate;
|
||||
ret = write(write_fd, &tmp, 4);
|
||||
if(ret != 4) {
|
||||
printf("Unable to send back audio rate to parent\n");
|
||||
printf("ret: %d fd: %d, errno: %d\n", ret, write_fd, errno);
|
||||
exit(1);
|
||||
}
|
||||
printf("Wrote to fd %d the audio rate\n", write_fd);
|
||||
|
||||
close(write_fd);
|
||||
|
||||
while(1) {
|
||||
errno = 0;
|
||||
ret = read(read_fd, (char*)&tmp, 4);
|
||||
if(ret <= 0) {
|
||||
printf("child dying from ret: %d, errno: %d\n",
|
||||
ret, errno);
|
||||
break;
|
||||
}
|
||||
|
||||
child_sound_playit(tmp);
|
||||
}
|
||||
|
||||
#ifdef HPUX
|
||||
ioctl(g_audio_socket, AUDIO_DRAIN, 0);
|
||||
#endif
|
||||
close(g_audio_socket);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// called by sound.c:send_sound()
|
||||
void
|
||||
child_sound_playit(word32 tmp)
|
||||
{
|
||||
int size;
|
||||
|
||||
size = tmp & 0xffffff;
|
||||
printf("SIze: %d ",size);
|
||||
if((tmp >> 24) == 0xa2) {
|
||||
/* play sound here */
|
||||
|
||||
|
||||
#if 0
|
||||
g_childsnd_pos += g_zeroes_buffered;
|
||||
while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
|
||||
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(g_zeroes_buffered) {
|
||||
reliable_zero_write(g_zeroes_buffered);
|
||||
}
|
||||
|
||||
g_zeroes_buffered = 0;
|
||||
g_zeroes_seen = 0;
|
||||
|
||||
// only write up to end of buffer
|
||||
if((size + g_childsnd_pos) > SOUND_SHM_SAMP_SIZE) {
|
||||
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos,
|
||||
SOUND_SHM_SAMP_SIZE - g_childsnd_pos);
|
||||
size = (g_childsnd_pos + size) - SOUND_SHM_SAMP_SIZE;
|
||||
g_childsnd_pos = 0;
|
||||
}
|
||||
|
||||
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos, size);
|
||||
|
||||
if(g_sound_paused) {
|
||||
printf("Unpausing sound, zb: %d\n", g_zeroes_buffered);
|
||||
g_sound_paused = 0;
|
||||
}
|
||||
|
||||
} else if((tmp >> 24) == 0xa1) {
|
||||
if(g_sound_paused) {
|
||||
if(g_zeroes_buffered < ZERO_PAUSE_SAFETY_SAMPS) {
|
||||
g_zeroes_buffered += size;
|
||||
}
|
||||
} else {
|
||||
/* not paused, send it through */
|
||||
g_zeroes_seen += size;
|
||||
|
||||
reliable_zero_write(size);
|
||||
|
||||
if(g_zeroes_seen >= ZERO_PAUSE_NUM_SAMPS) {
|
||||
printf("Pausing sound\n");
|
||||
g_sound_paused = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("tmp received bad: %08x\n", tmp);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
g_childsnd_pos += size;
|
||||
while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
|
||||
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE;
|
||||
}
|
||||
|
||||
g_childsnd_vbl++;
|
||||
if(g_childsnd_vbl >= 60) {
|
||||
g_childsnd_vbl = 0;
|
||||
g_bytes_written = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef HPUX
|
||||
void
|
||||
child_sound_init_hpdev()
|
||||
{
|
||||
struct audio_describe audio_descr;
|
||||
int output_channel;
|
||||
char *str;
|
||||
int speaker;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
g_audio_socket = open("/dev/audio", O_WRONLY, 0);
|
||||
if(g_audio_socket < 0) {
|
||||
printf("open /dev/audio failed, ret: %d, errno:%d\n",
|
||||
g_audio_socket, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_DESCRIBE, &audio_descr);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_DESCRIBE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for(i = 0; i < audio_descr.nrates; i++) {
|
||||
printf("Audio rate[%d] = %d\n", i,
|
||||
audio_descr.sample_rate[i]);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_DATA_FORMAT,
|
||||
AUDIO_FORMAT_LINEAR16BIT);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_DATA_FORMAT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_CHANNELS, NUM_CHANNELS);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_CHANNELS failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_TXBUFSIZE, 16*1024);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_TXBUFSIZE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_SAMPLE_RATE, g_audio_rate);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_SAMPLE_RATE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_GET_OUTPUT, &output_channel);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_GET_OUTPUT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
speaker = 1;
|
||||
str = getenv("SPEAKER");
|
||||
if(str) {
|
||||
if(str[0] != 'i' && str[0] != 'I') {
|
||||
speaker = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(speaker) {
|
||||
printf("Sending sound to internal speaker\n");
|
||||
output_channel |= AUDIO_OUT_SPEAKER;
|
||||
} else {
|
||||
printf("Sending sound to external jack\n");
|
||||
output_channel &= (~AUDIO_OUT_SPEAKER);
|
||||
output_channel |= AUDIO_OUT_HEADPHONE;
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_OUTPUT, output_channel);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_OUTPUT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* HPUX */
|
||||
|
||||
#if defined(__linux__) || defined(OSS)
|
||||
void
|
||||
child_sound_init_linux()
|
||||
{
|
||||
int stereo;
|
||||
int sample_size;
|
||||
int rate;
|
||||
int fragment;
|
||||
int fmt;
|
||||
int ret;
|
||||
|
||||
g_audio_socket = open("/dev/dsp", O_WRONLY, 0);
|
||||
if(g_audio_socket < 0) {
|
||||
printf("open /dev/dsp failed, ret: %d, errno:%d\n",
|
||||
g_audio_socket, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fragment = 0x00200009;
|
||||
#if 0
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFRAGMENT, &fragment);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SETFRAGEMNT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
sample_size = 16;
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SAMPLESIZE, &sample_size);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_SAMPLESIZE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
|
||||
fmt = AFMT_S16_LE;
|
||||
#else
|
||||
fmt = AFMT_S16_BE;
|
||||
#endif
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFMT, &fmt);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_SETFMT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
stereo = 1;
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_STEREO, &stereo);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_STEREO failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rate = g_audio_rate;
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SPEED, &rate);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_SPEED failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
if(ret > 0) {
|
||||
rate = ret; /* rate is returned value */
|
||||
}
|
||||
if(rate < 8000) {
|
||||
printf("Audio rate of %d which is < 8000!\n", rate);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
g_audio_rate = rate;
|
||||
|
||||
printf("Sound initialized\n");
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
Copyright (C) 2010 - 2012 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 "sound.h"
|
||||
|
||||
#ifdef HPUX
|
||||
# include <sys/audio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SDL
|
||||
# include "SDL.h"
|
||||
long sound_init_device_sdl();
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(OSS)
|
||||
# include <sys/soundcard.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN_SOUND /* Workaround - gcc in cygwin wasn't defining _WIN32 */
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifndef UNDER_CE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern int Verbose;
|
||||
|
||||
extern int g_audio_rate;
|
||||
|
||||
int g_preferred_rate = 48000;
|
||||
int g_audio_socket = -1;
|
||||
int g_bytes_written = 0;
|
||||
|
||||
#define ZERO_BUF_SIZE 2048
|
||||
|
||||
word32 g_snd_zero_buf[ZERO_BUF_SIZE];
|
||||
|
||||
#define ZERO_PAUSE_SAFETY_SAMPS (g_audio_rate >> 5)
|
||||
#define ZERO_PAUSE_NUM_SAMPS (4*g_audio_rate)
|
||||
|
||||
int g_zeroes_buffered = 0;
|
||||
int g_zeroes_seen = 0;
|
||||
int g_sound_paused = 0;
|
||||
int g_childsnd_vbl = 0;
|
||||
int g_childsnd_pos = 0;
|
||||
word32 *g_childsnd_shm_addr = 0;
|
||||
|
||||
void child_sound_init_linux();
|
||||
void child_sound_init_hpdev();
|
||||
void child_sound_initWIN_SOUND();
|
||||
void child_sound_init_mac();
|
||||
void child_sound_init_sdl();
|
||||
long sound_init_device_sdl();
|
||||
|
||||
void
|
||||
reliable_buf_write(word32 *shm_addr, int pos, int size)
|
||||
{
|
||||
byte *ptr;
|
||||
int ret;
|
||||
|
||||
if(size < 1 || pos < 0 || pos > SOUND_SHM_SAMP_SIZE ||
|
||||
size > SOUND_SHM_SAMP_SIZE ||
|
||||
(pos + size) > SOUND_SHM_SAMP_SIZE) {
|
||||
printf("reliable_buf_write: pos: %04x, size: %04x\n", pos, size);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ptr = (byte *)&(shm_addr[pos]);
|
||||
size = size * 4;
|
||||
|
||||
while(size > 0) {
|
||||
#if defined(HAVE_SDL)
|
||||
//ret = sdl_send_audio(ptr, size);
|
||||
|
||||
#elif defined(WIN_SOUND)
|
||||
ret = win32_send_audio(ptr, size);
|
||||
#elif defined(MAC) && !defined(HAVE_SDL)
|
||||
ret = mac_send_audio(ptr, size);
|
||||
#else
|
||||
ret = write(g_audio_socket, ptr, size);
|
||||
#endif
|
||||
|
||||
if(ret < 0) {
|
||||
printf("audio write, errno: %d\n", errno);
|
||||
exit(1);
|
||||
}
|
||||
size = size - ret;
|
||||
ptr += ret;
|
||||
g_bytes_written += ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
reliable_zero_write(int amt)
|
||||
{
|
||||
int len;
|
||||
|
||||
while(amt > 0) {
|
||||
len = MIN(amt, ZERO_BUF_SIZE);
|
||||
reliable_buf_write(g_snd_zero_buf, 0, len);
|
||||
amt -= len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
child_sound_loop(int read_fd, int write_fd, word32 *shm_addr)
|
||||
{
|
||||
word32 tmp;
|
||||
int ret;
|
||||
|
||||
g_audio_rate = g_preferred_rate;
|
||||
|
||||
g_zeroes_buffered = 0;
|
||||
g_zeroes_seen = 0;
|
||||
g_sound_paused = 0;
|
||||
|
||||
g_childsnd_pos = 0;
|
||||
g_childsnd_vbl = 0;
|
||||
g_childsnd_shm_addr = shm_addr;
|
||||
|
||||
#if defined(HAVE_SDL)
|
||||
//child_sound_init_sdl();
|
||||
long rate = sound_init_device_sdl();
|
||||
return;
|
||||
#elif defined(__linux__) || defined(OSS)
|
||||
child_sound_init_linux();
|
||||
#elif HPUX
|
||||
child_sound_init_hpdev();
|
||||
#elif WIN_SOUND
|
||||
child_sound_init_win32();
|
||||
return;
|
||||
#elif defined(MAC) && !defined(HAVE_SDL)
|
||||
child_sound_init_mac();
|
||||
return;
|
||||
#endif
|
||||
|
||||
doc_printf("Child pipe fd: %d\n", read_fd);
|
||||
|
||||
tmp = g_audio_rate;
|
||||
ret = write(write_fd, &tmp, 4);
|
||||
if(ret != 4) {
|
||||
printf("Unable to send back audio rate to parent\n");
|
||||
printf("ret: %d fd: %d, errno: %d\n", ret, write_fd, errno);
|
||||
exit(1);
|
||||
}
|
||||
printf("Wrote to fd %d the audio rate\n", write_fd);
|
||||
|
||||
close(write_fd);
|
||||
|
||||
while(1) {
|
||||
errno = 0;
|
||||
ret = read(read_fd, (char*)&tmp, 4);
|
||||
if(ret <= 0) {
|
||||
printf("child dying from ret: %d, errno: %d\n",
|
||||
ret, errno);
|
||||
break;
|
||||
}
|
||||
|
||||
child_sound_playit(tmp);
|
||||
}
|
||||
|
||||
#ifdef HPUX
|
||||
ioctl(g_audio_socket, AUDIO_DRAIN, 0);
|
||||
#endif
|
||||
close(g_audio_socket);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// called by sound.c:send_sound()
|
||||
void
|
||||
child_sound_playit(word32 tmp)
|
||||
{
|
||||
int size;
|
||||
|
||||
size = tmp & 0xffffff;
|
||||
printf("SIze: %d ",size);
|
||||
if((tmp >> 24) == 0xa2) {
|
||||
/* play sound here */
|
||||
|
||||
|
||||
#if 0
|
||||
g_childsnd_pos += g_zeroes_buffered;
|
||||
while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
|
||||
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(g_zeroes_buffered) {
|
||||
reliable_zero_write(g_zeroes_buffered);
|
||||
}
|
||||
|
||||
g_zeroes_buffered = 0;
|
||||
g_zeroes_seen = 0;
|
||||
|
||||
// only write up to end of buffer
|
||||
if((size + g_childsnd_pos) > SOUND_SHM_SAMP_SIZE) {
|
||||
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos,
|
||||
SOUND_SHM_SAMP_SIZE - g_childsnd_pos);
|
||||
size = (g_childsnd_pos + size) - SOUND_SHM_SAMP_SIZE;
|
||||
g_childsnd_pos = 0;
|
||||
}
|
||||
|
||||
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos, size);
|
||||
|
||||
if(g_sound_paused) {
|
||||
printf("Unpausing sound, zb: %d\n", g_zeroes_buffered);
|
||||
g_sound_paused = 0;
|
||||
}
|
||||
|
||||
} else if((tmp >> 24) == 0xa1) {
|
||||
if(g_sound_paused) {
|
||||
if(g_zeroes_buffered < ZERO_PAUSE_SAFETY_SAMPS) {
|
||||
g_zeroes_buffered += size;
|
||||
}
|
||||
} else {
|
||||
/* not paused, send it through */
|
||||
g_zeroes_seen += size;
|
||||
|
||||
reliable_zero_write(size);
|
||||
|
||||
if(g_zeroes_seen >= ZERO_PAUSE_NUM_SAMPS) {
|
||||
printf("Pausing sound\n");
|
||||
g_sound_paused = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("tmp received bad: %08x\n", tmp);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
g_childsnd_pos += size;
|
||||
while(g_childsnd_pos >= SOUND_SHM_SAMP_SIZE) {
|
||||
g_childsnd_pos -= SOUND_SHM_SAMP_SIZE;
|
||||
}
|
||||
|
||||
g_childsnd_vbl++;
|
||||
if(g_childsnd_vbl >= 60) {
|
||||
g_childsnd_vbl = 0;
|
||||
g_bytes_written = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef HPUX
|
||||
void
|
||||
child_sound_init_hpdev()
|
||||
{
|
||||
struct audio_describe audio_descr;
|
||||
int output_channel;
|
||||
char *str;
|
||||
int speaker;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
g_audio_socket = open("/dev/audio", O_WRONLY, 0);
|
||||
if(g_audio_socket < 0) {
|
||||
printf("open /dev/audio failed, ret: %d, errno:%d\n",
|
||||
g_audio_socket, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_DESCRIBE, &audio_descr);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_DESCRIBE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for(i = 0; i < audio_descr.nrates; i++) {
|
||||
printf("Audio rate[%d] = %d\n", i,
|
||||
audio_descr.sample_rate[i]);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_DATA_FORMAT,
|
||||
AUDIO_FORMAT_LINEAR16BIT);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_DATA_FORMAT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_CHANNELS, NUM_CHANNELS);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_CHANNELS failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_TXBUFSIZE, 16*1024);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_TXBUFSIZE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_SAMPLE_RATE, g_audio_rate);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_SAMPLE_RATE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_GET_OUTPUT, &output_channel);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_GET_OUTPUT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
speaker = 1;
|
||||
str = getenv("SPEAKER");
|
||||
if(str) {
|
||||
if(str[0] != 'i' && str[0] != 'I') {
|
||||
speaker = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(speaker) {
|
||||
printf("Sending sound to internal speaker\n");
|
||||
output_channel |= AUDIO_OUT_SPEAKER;
|
||||
} else {
|
||||
printf("Sending sound to external jack\n");
|
||||
output_channel &= (~AUDIO_OUT_SPEAKER);
|
||||
output_channel |= AUDIO_OUT_HEADPHONE;
|
||||
}
|
||||
|
||||
ret = ioctl(g_audio_socket, AUDIO_SET_OUTPUT, output_channel);
|
||||
if(ret < 0) {
|
||||
printf("ioctl AUDIO_SET_OUTPUT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* HPUX */
|
||||
|
||||
#if defined(__linux__) || defined(OSS)
|
||||
void
|
||||
child_sound_init_linux()
|
||||
{
|
||||
int stereo;
|
||||
int sample_size;
|
||||
int rate;
|
||||
int fragment;
|
||||
int fmt;
|
||||
int ret;
|
||||
|
||||
g_audio_socket = open("/dev/dsp", O_WRONLY, 0);
|
||||
if(g_audio_socket < 0) {
|
||||
printf("open /dev/dsp failed, ret: %d, errno:%d\n",
|
||||
g_audio_socket, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fragment = 0x00200009;
|
||||
#if 0
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFRAGMENT, &fragment);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SETFRAGEMNT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
sample_size = 16;
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SAMPLESIZE, &sample_size);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_SAMPLESIZE failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if defined(GSPORT_LITTLE_ENDIAN) || defined (__LITTLE_ENDIAN__) // OSX needs to calculate endianness mid-compilation, can't be passed on compile command
|
||||
fmt = AFMT_S16_LE;
|
||||
#else
|
||||
fmt = AFMT_S16_BE;
|
||||
#endif
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SETFMT, &fmt);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_SETFMT failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
stereo = 1;
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_STEREO, &stereo);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_STEREO failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rate = g_audio_rate;
|
||||
ret = ioctl(g_audio_socket, SNDCTL_DSP_SPEED, &rate);
|
||||
if(ret < 0) {
|
||||
printf("ioctl SNDCTL_DSP_SPEED failed, ret:%d, errno:%d\n",
|
||||
ret, errno);
|
||||
exit(1);
|
||||
}
|
||||
if(ret > 0) {
|
||||
rate = ret; /* rate is returned value */
|
||||
}
|
||||
if(rate < 8000) {
|
||||
printf("Audio rate of %d which is < 8000!\n", rate);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
g_audio_rate = rate;
|
||||
|
||||
printf("Sound initialized\n");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,108 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{E810477A-E004-4308-A58A-21393213EF89}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>tfe</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\arch\win32\bittypes.h" />
|
||||
<ClInclude Include="..\arch\win32\bpf.h" />
|
||||
<ClInclude Include="..\arch\win32\dirent-win32.h" />
|
||||
<ClInclude Include="..\arch\win32\ip6_misc.h" />
|
||||
<ClInclude Include="..\arch\win32\pcap-stdinc.h" />
|
||||
<ClInclude Include="..\arch\win32\pcap.h" />
|
||||
<ClInclude Include="tfesupp.h" />
|
||||
<ClInclude Include="types.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tfe.c" />
|
||||
<ClCompile Include="tfearch.c" />
|
||||
<ClCompile Include="tfesupp.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{E810477A-E004-4308-A58A-21393213EF89}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>tfe</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;TFE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\arch\win32\bittypes.h" />
|
||||
<ClInclude Include="..\arch\win32\bpf.h" />
|
||||
<ClInclude Include="..\arch\win32\dirent-win32.h" />
|
||||
<ClInclude Include="..\arch\win32\ip6_misc.h" />
|
||||
<ClInclude Include="..\arch\win32\pcap-stdinc.h" />
|
||||
<ClInclude Include="..\arch\win32\pcap.h" />
|
||||
<ClInclude Include="tfesupp.h" />
|
||||
<ClInclude Include="types.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tfe.c" />
|
||||
<ClCompile Include="tfearch.c" />
|
||||
<ClCompile Include="tfesupp.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="tfesupp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\bittypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\bpf.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\dirent-win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\ip6_misc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\pcap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\pcap-stdinc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tfe.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tfesupp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tfearch.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="tfesupp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\bittypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\bpf.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\dirent-win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\ip6_misc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\pcap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\arch\win32\pcap-stdinc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tfe.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tfesupp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tfearch.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
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
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
TARGET = gsportfb
|
||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) fbdriver.o
|
||||
CC = gcc
|
||||
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -march=armv6
|
||||
OPTS = -DGSPORT_LITTLE_ENDIAN -DHAVE_TFE -DHAVE_ATBRIDGE
|
||||
SUFFIX =
|
||||
NAME = gsportfb
|
||||
LDFLAGS =
|
||||
LDOPTS =
|
||||
LD = g++
|
||||
EXTRA_LIBS = -ldl
|
||||
EXTRA_SPECIALS =
|
||||
|
||||
AS = cc
|
||||
PERL = perl
|
||||
|
||||
XOPTS = -I/usr/X11R6/include
|
||||
|
||||
TARGET = gsportfb
|
||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) fbdriver.o
|
||||
CC = gcc
|
||||
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -march=armv6
|
||||
OPTS = -DGSPORT_LITTLE_ENDIAN -DHAVE_TFE -DHAVE_ATBRIDGE
|
||||
SUFFIX =
|
||||
NAME = gsportfb
|
||||
LDFLAGS =
|
||||
LDOPTS =
|
||||
LD = g++
|
||||
EXTRA_LIBS = -ldl
|
||||
EXTRA_SPECIALS =
|
||||
|
||||
AS = cc
|
||||
PERL = perl
|
||||
|
||||
XOPTS = -I/usr/X11R6/include
|
||||
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
TARGET = gsplus
|
||||
NAME = gsplus
|
||||
PERL = perl
|
||||
CC = clang
|
||||
LD = clang++
|
||||
AS = cc
|
||||
|
||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) osxdriver.o sdlsnd_driver2.o
|
||||
ARCHS = ppc, i386, ppc64, x86_64
|
||||
|
||||
# OPTIONS FOR COMPILING C SOURCE
|
||||
CCOPTS = $(MACSUX) -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2
|
||||
# OPTIONS FOR COMPILING C++ SOURCE
|
||||
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2 $(MACSUX)
|
||||
|
||||
#SDK = -isysroot /Developer/SDKs/MacOSX10.5.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.7.sdk -isysroot /Developer/SDKs/MacOSX10.9.sdk -isysroot /Developer/SDKs/MacOSX10.10.sdk -isysroot /Developer/SDKs/MacOSX10.11.sdk
|
||||
#INCLUDE = -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -I/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Developer/SDKs/MacOSX10.10.sdk/usr/include -I/Developer/SDKs/MacOSX10.11.sdk/usr/include
|
||||
|
||||
|
||||
#SDK = -isysroot /Developer/SDKs/MacOSX10.11.sdk
|
||||
#INCLUDE = -I/Developer/SDKs/MacOSX10.11.sdk/usr/include
|
||||
|
||||
|
||||
|
||||
MACSUX = $(SDK) $(INCLUDE) -mmacosx-version-min=10.11
|
||||
EXTRA_LIBS = -lSDL2 -lfreetype
|
||||
OPTS = -DGSPORT_LITTLE_ENDIAN
|
||||
SUFFIX =
|
||||
LDFLAGS =
|
||||
LDOPTS = -I.
|
||||
EXTRA_SPECIALS =
|
||||
TARGET = gsplus
|
||||
NAME = gsplus
|
||||
PERL = perl
|
||||
CC = clang
|
||||
LD = clang++
|
||||
AS = cc
|
||||
|
||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) osxdriver.o sdlsnd_driver2.o
|
||||
ARCHS = ppc, i386, ppc64, x86_64
|
||||
|
||||
# OPTIONS FOR COMPILING C SOURCE
|
||||
CCOPTS = $(MACSUX) -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2
|
||||
# OPTIONS FOR COMPILING C++ SOURCE
|
||||
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2 $(MACSUX)
|
||||
|
||||
#SDK = -isysroot /Developer/SDKs/MacOSX10.5.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.7.sdk -isysroot /Developer/SDKs/MacOSX10.9.sdk -isysroot /Developer/SDKs/MacOSX10.10.sdk -isysroot /Developer/SDKs/MacOSX10.11.sdk
|
||||
#INCLUDE = -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I/Developer/SDKs/MacOSX10.6.sdk/usr/include -I/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Developer/SDKs/MacOSX10.10.sdk/usr/include -I/Developer/SDKs/MacOSX10.11.sdk/usr/include
|
||||
|
||||
|
||||
#SDK = -isysroot /Developer/SDKs/MacOSX10.11.sdk
|
||||
#INCLUDE = -I/Developer/SDKs/MacOSX10.11.sdk/usr/include
|
||||
|
||||
|
||||
|
||||
MACSUX = $(SDK) $(INCLUDE) -mmacosx-version-min=10.11
|
||||
EXTRA_LIBS = -lSDL2 -lfreetype
|
||||
OPTS = -DGSPORT_LITTLE_ENDIAN
|
||||
SUFFIX =
|
||||
LDFLAGS =
|
||||
LDOPTS = -I.
|
||||
EXTRA_SPECIALS =
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
TARGET = gsportx
|
||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) xdriver.o
|
||||
CC = clang
|
||||
#CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -arch=i686 -DHAVE_SDL -DHAVE_TFE -DHAVE_ATBRIDGE -DTOGGLE_STATUS -I/usr/include/SDL -I/usr/include/freetype2
|
||||
#CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -DHAVE_ATBRIDGE -I/usr/include/freetype2 -I/usr/include/SDL2
|
||||
|
||||
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2 -I/usr/local/include/freetype2 -L/usr/X11/lib
|
||||
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2
|
||||
OPTS = -DGSPORT_LITTLE_ENDIAN
|
||||
SUFFIX =
|
||||
NAME = gsportx
|
||||
LDFLAGS =
|
||||
LDOPTS =
|
||||
LD = g++
|
||||
EXTRA_LIBS = -lX11 -lfreetype -lSDL2 -lpcap -lXext
|
||||
EXTRA_SPECIALS =
|
||||
|
||||
AS = cc
|
||||
PERL = perl
|
||||
|
||||
XOPTS = -I/usr/X11/include
|
||||
TARGET = gsportx
|
||||
OBJECTS = $(OBJECTS1) $(TFEOBJ) $(ATOBJ) $(PCAPOBJ) xdriver.o
|
||||
CC = clang
|
||||
#CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -arch=i686 -DHAVE_SDL -DHAVE_TFE -DHAVE_ATBRIDGE -DTOGGLE_STATUS -I/usr/include/SDL -I/usr/include/freetype2
|
||||
#CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -DHAVE_ATBRIDGE -I/usr/include/freetype2 -I/usr/include/SDL2
|
||||
|
||||
CCOPTS = -O2 -Wall -fomit-frame-pointer -std=gnu99 -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/SDL2 -I/usr/local/include/freetype2 -L/usr/X11/lib
|
||||
CPPOPTS = -O2 -DHAVE_TFE -DHAVE_SDL -DTOGGLE_STATUS -I/usr/local/include/freetype2 -I/usr/local/include/SDL2
|
||||
OPTS = -DGSPORT_LITTLE_ENDIAN
|
||||
SUFFIX =
|
||||
NAME = gsportx
|
||||
LDFLAGS =
|
||||
LDOPTS =
|
||||
LD = g++
|
||||
EXTRA_LIBS = -lX11 -lfreetype -lSDL2 -lpcap -lXext
|
||||
EXTRA_SPECIALS =
|
||||
|
||||
AS = cc
|
||||
PERL = perl
|
||||
|
||||
XOPTS = -I/usr/X11/include
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue