tfe -> rawnet.

This commit is contained in:
Kelvin Sherlock 2018-12-14 20:37:39 -05:00
parent 12c8f215ba
commit ba50807910
4 changed files with 59 additions and 35 deletions

View File

@ -9,6 +9,7 @@ ATOBJ = atbridge/aarp.o atbridge/atbridge.o atbridge/elap.o atbridge/llap.o atbr
PCAPOBJ = atbridge/pcap_delay.o
TFEOBJ = tfe/tfe.o tfe/tfearch.o tfe/tfesupp.o
FSTOBJ = unix_host_common.o host_common.o host_fst.o host_mli.o
RAWNETOBJ = rawnet/cs8900.o rawnet/rawnet.o rawnet/rawnetsupp.o
include vars

View File

@ -16,9 +16,8 @@
#include <dirent.h>
#endif
#ifdef HAVE_TFE
#include "tfe/tfesupp.h"
#include "tfe/protos_tfe.h"
#ifdef HAVE_RAWNET
#include "rawnet/rawnet.h"
#endif
#if defined _MSC_VER
@ -76,6 +75,7 @@ extern int g_joystick_button_1;
extern int g_joystick_button_2;
extern int g_joystick_button_3;
extern int g_ethernet;
extern int g_ethernet_enabled;
extern int g_halt_on_bad_read;
extern int g_ignore_bad_acc;
extern int g_ignore_halts;
@ -695,24 +695,24 @@ void cfg_iwreset() {
imagewriter_init(g_imagewriter_dpi,g_imagewriter_paper,g_imagewriter_banner, g_imagewriter_output,g_imagewriter_multipage);
return;
}
#ifdef HAVE_TFE
#ifdef HAVE_RAWNET
void cfg_get_tfe_name() {
int i = 0;
char *ppname = NULL;
char *ppdes = NULL;
cfg_htab_vtab(0,11);
if (tfe_enumadapter_open())
if (rawnet_enumadapter_open())
{
cfg_printf("Interface List:\n---------------");
while(tfe_enumadapter(&ppname,&ppdes))
while(rawnet_enumadapter(&ppname,&ppdes))
{
cfg_htab_vtab(0, 13+i);
cfg_printf("%2d: %s",i,ppdes);
i++;
lib_free(ppname);
lib_free(ppdes);
free(ppname);
free(ppdes);
}
tfe_enumadapter_close();
rawnet_enumadapter_close();
}
else
{
@ -3247,7 +3247,7 @@ void config_control_panel() {
if(g_cfg_slotdrive >= 0) {
cfg_file_draw();
}
#ifdef HAVE_TFE
#ifdef HAVE_RAWNET
/*HACK eh, at least I think it is. Display the available ethernet interfaces
when in the ethernet control panel. This is the only way one can customize a menu pane.
Kent did it with the directory browser, so why not.*/

View File

@ -7,8 +7,8 @@
#include "defc.h"
#ifdef HAVE_TFE
#include "tfe/protos_tfe.h"
#ifdef HAVE_RAWNET
#include "rawnet/cs8900.h"
#endif
extern char const g_gsplus_version_str[];
@ -34,6 +34,8 @@ extern int g_rom_version;
extern int g_user_page2_shadow;
extern int g_parallel;
extern int g_ethernet_enabled;
char c;
/* from iwm.c */
int g_num_shadow_all_banks = 0;
@ -1591,7 +1593,7 @@ int io_read(word32 loc, double *cyc_ptr) {
//case 0xb8:
// return 0;
// break;
#ifdef HAVE_TFE
#ifdef HAVE_RAWNET
/*Uthernet read access on slot 3*/
case 0xb0:
case 0xb1:
@ -1609,8 +1611,8 @@ int io_read(word32 loc, double *cyc_ptr) {
case 0xbd:
case 0xbe:
case 0xbf:
if (tfe_enabled) {
return tfe_read((word16)loc & 0xf);
if (g_ethernet_enabled) {
return cs8900_read((word16)loc & 0xf);
}
else
{return 0;}
@ -2326,7 +2328,7 @@ void io_write(word32 loc, int val, double *cyc_ptr) {
//case 0xb8: case 0xb9: case 0xba: case 0xbb:
//case 0xbc: case 0xbd: case 0xbe: case 0xbf:
// UNIMPL_WRITE;
#ifdef HAVE_TFE
#ifdef HAVE_RAWNET
/*Uthernet write access on slot 3*/
case 0xb0:
case 0xb1:
@ -2344,9 +2346,9 @@ void io_write(word32 loc, int val, double *cyc_ptr) {
case 0xbd:
case 0xbe:
case 0xbf:
if (tfe_enabled)
if (g_ethernet_enabled)
{
tfe_store((word16)loc & 0xf, (byte)val);
cs8900_store((word16)loc & 0xf, (byte)val);
return;
}
else

View File

@ -21,9 +21,9 @@ extern char g_config_gsplus_screenshot_dir[];
#define vsnprintf _vsnprintf
#endif
#ifdef HAVE_TFE
#include "tfe/tfesupp.h"
#include "tfe/protos_tfe.h"
#ifdef HAVE_RAWNET
#include "rawnet/rawnet.h"
#include "rawnet/cs8900.h"
#endif
#if defined (_WIN32) && !defined(WIN_SDL)|| defined(__CYGWIN__) && !defined(WIN_SDL)
@ -143,6 +143,7 @@ int g_serial_out_masking = 0;
int g_serial_modem[2] = { 0, 1 };
int g_ethernet = 0;
int g_ethernet_interface = 0;
int g_ethernet_enabled = 0;
int g_parallel = 0;
int g_parallel_out_masking = 0;
int g_printer = 0;
@ -945,31 +946,44 @@ int gsplusmain(int argc, char **argv) {
}
printer_init(g_printer_dpi,85,110,g_printer_output,g_printer_multipage != 0);
//If ethernet is enabled in config.gsport, let's initialize it
#ifdef HAVE_TFE
#ifdef HAVE_RAWNET
g_ethernet_enabled = 0;
if (g_ethernet == 1)
{
int i = 0;
int i = -1;
int ok = 0;
char *ppname = NULL;
char *ppdes = NULL;
if (tfe_enumadapter_open())
if (rawnet_enumadapter_open())
{
//Loop through the available adapters until we reach the interface number specified in config.gsport
while(tfe_enumadapter(&ppname,&ppdes))
while(rawnet_enumadapter(&ppname,&ppdes))
{
if (i == g_ethernet_interface) break;
i++;
++i;
if (i == g_ethernet_interface) {
if (cs8900_init() >= 0 && cs8900_activate(ppname) >= 0) {
g_ethernet_enabled = 1;
} else {
fprintf(stderr, "Unable to start ethernet.\n");
}
free(ppname);
free(ppdes);
break;
}
free(ppname);
free(ppdes);
}
tfe_enumadapter_close();
printf("Using host ethernet interface: %s\nUthernet support is ON.\n",ppdes);
rawnet_enumadapter_close();
}
else
if (i < 0)
{
printf("No ethernet host adapters found. Do you have PCap installed/enabled?\nUthernet support is OFF.\n");
fprintf(stderr, "No ethernet host adapters found. Do you have PCap installed/enabled?\nUthernet support is OFF.\n");
}
set_tfe_interface(ppname); //Connect the emulated ethernet device with the selected host adapter
lib_free(ppname);
lib_free(ppdes);
tfe_init();
}
#endif
@ -1021,6 +1035,13 @@ int gsplusmain(int argc, char **argv) {
load_roms_shut_memory();
clear_fatal_logs();
#if HAVE_RAWNET
if (g_ethernet_enabled) {
cs8900_deactivate();
cs8900_shutdown();
}
#endif
// OG Not needed anymore : the emulator will quit gently
//my_exit(0);
end_screen();