Added the ability to set sound to use STEREO16 format instead of STEREO_FLOAT32 (defaults to STEREO_FLOAT32);

Moved network-related files to their own subdirectory.
This commit is contained in:
OBattler
2017-06-14 07:21:01 +02:00
parent 13f769ec09
commit 62dea57270
64 changed files with 255 additions and 193 deletions

View File

@@ -8,7 +8,7 @@
# #
# Modified Makefile for Win32 (MinGW32) environment. # Modified Makefile for Win32 (MinGW32) environment.
# #
# Version: @(#)Makefile.mingw 1.0.26 2017/06/13 # Version: @(#)Makefile.mingw 1.0.27 2017/06/14
# #
# Authors: Miran Grca, <mgrca8@gmail.com> # Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com> # Fred N. van Kempen, <decwiz@yahoo.com>
@@ -64,7 +64,7 @@ endif
######################################################################### #########################################################################
# Nothing should need changing from here on.. # # Nothing should need changing from here on.. #
######################################################################### #########################################################################
VPATH = . cpu sound sound/resid-fp video lzf slirp win VPATH = . cpu sound sound/resid-fp video lzf network network/slirp win
PLAT = win/ PLAT = win/
ifeq ($(X64), y) ifeq ($(X64), y)
CPP = g++.exe -m64 -U__unix CPP = g++.exe -m64 -U__unix
@@ -229,7 +229,7 @@ LIBS = -lddraw -ldinput8 -ldxguid -ld3d9 -ld3dx9 -lopenal.dll \
# Build rules. # Build rules.
%.o: %.c %.o: %.c
@echo $< @echo $<
$(CC) $(CFLAGS) -c $< @$(CC) $(CFLAGS) -c $<
%.o: %.cc %.o: %.cc
@echo $< @echo $<

View File

@@ -1,4 +1,4 @@
/* Copyright holders: Sarah Walker /* Copyright holders: neozeed
see COPYING for more details see COPYING for more details
*/ */
#ifndef BSWAP_H #ifndef BSWAP_H

View File

@@ -10,7 +10,7 @@
* *
* NOTE: The file will also implement an NE1000 for 8-bit ISA systems. * NOTE: The file will also implement an NE1000 for 8-bit ISA systems.
* *
* Version: @(#)net_ne2000.c 1.0.10 2017/06/03 * Version: @(#)net_ne2000.c 1.0.11 2017/06/14
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Peter Grehan, grehan@iprg.nokia.com> * Peter Grehan, grehan@iprg.nokia.com>
@@ -24,15 +24,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include "ibm.h" #include "../ibm.h"
#include "io.h" #include "../io.h"
#include "mem.h" #include "../mem.h"
#include "rom.h" #include "../rom.h"
#include "pci.h" #include "../pci.h"
#include "pic.h" #include "../pic.h"
#include "device.h" #include "../device.h"
#include "config.h" #include "../config.h"
#include "disc_random.h" #include "../disc_random.h"
#include "network.h" #include "network.h"
#include "net_ne2000.h" #include "net_ne2000.h"
#include "bswap.h" #include "bswap.h"

View File

@@ -17,12 +17,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <pcap.h> #include <pcap.h>
#include "ibm.h" #include "../ibm.h"
#include "config.h" #include "../config.h"
#include "device.h" #include "../device.h"
#include "network.h" #include "network.h"
#include "plat_dynld.h" #include "../WIN/plat_dynld.h"
#include "plat_thread.h" #include "../WIN/plat_thread.h"
static void *pcap_handle; /* handle to WinPcap DLL */ static void *pcap_handle; /* handle to WinPcap DLL */

View File

@@ -8,7 +8,7 @@
* *
* Handle SLiRP library processing. * Handle SLiRP library processing.
* *
* Version: @(#)net_slirp.c 1.0.3 2017/05/21 * Version: @(#)net_slirp.c 1.0.4 2017/06/14
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
*/ */
@@ -18,11 +18,11 @@
#include <string.h> #include <string.h>
#include "slirp/slirp.h" #include "slirp/slirp.h"
#include "slirp/queue.h" #include "slirp/queue.h"
#include "ibm.h" #include "../ibm.h"
#include "config.h" #include "../config.h"
#include "device.h" #include "../device.h"
#include "network.h" #include "network.h"
#include "plat_thread.h" #include "../WIN/plat_thread.h"
static queueADT slirpq; /* SLiRP library handle */ static queueADT slirpq; /* SLiRP library handle */

View File

@@ -12,7 +12,7 @@
* it should be malloc'ed and then linked to the NETCARD def. * it should be malloc'ed and then linked to the NETCARD def.
* Will be done later. * Will be done later.
* *
* Version: @(#)network.c 1.0.9 2017/06/03 * Version: @(#)network.c 1.0.10 2017/06/14
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
*/ */
@@ -20,12 +20,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ibm.h" #include "../ibm.h"
#include "device.h" #include "../device.h"
#include "network.h" #include "network.h"
#include "net_ne2000.h" #include "net_ne2000.h"
#include "win.h" #include "../WIN/win.h"
#include "win_language.h" #include "../WIN/win_language.h"
static netcard_t net_cards[] = { static netcard_t net_cards[] = {

View File

@@ -29,6 +29,8 @@ fd_set *global_readfds, *global_writefds, *global_xfds;
extern void pclog(const char *, ...); extern void pclog(const char *, ...);
extern int config_get_int(char *, char *, int); extern int config_get_int(char *, char *, int);
#define printf pclog
#ifdef _WIN32 #ifdef _WIN32
static int get_dns_addr(struct in_addr *pdns_addr) static int get_dns_addr(struct in_addr *pdns_addr)

View File

@@ -73,10 +73,15 @@ void inital(ALvoid)
{ {
#ifdef USE_OPENAL #ifdef USE_OPENAL
int c; int c;
float buf[BUFLEN*2]; float buf[BUFLEN*2];
float cd_buf[CD_BUFLEN*2]; float cd_buf[CD_BUFLEN*2];
int16_t buf_int16[BUFLEN*2];
int16_t cd_buf_int16[CD_BUFLEN*2];
alGenBuffers(4, buffers); alGenBuffers(4, buffers);
alGenBuffers(4, buffers_cd); alGenBuffers(4, buffers_cd);
@@ -97,10 +102,18 @@ void inital(ALvoid)
memset(cd_buf,0,BUFLEN*2*sizeof(float)); memset(cd_buf,0,BUFLEN*2*sizeof(float));
for (c = 0; c < 4; c++) for (c = 0; c < 4; c++)
{
if (sound_is_float)
{ {
alBufferData(buffers[c], AL_FORMAT_STEREO_FLOAT32, buf, BUFLEN*2*sizeof(float), FREQ); alBufferData(buffers[c], AL_FORMAT_STEREO_FLOAT32, buf, BUFLEN*2*sizeof(float), FREQ);
alBufferData(buffers_cd[c], AL_FORMAT_STEREO_FLOAT32, cd_buf, CD_BUFLEN*2*sizeof(float), CD_FREQ); alBufferData(buffers_cd[c], AL_FORMAT_STEREO_FLOAT32, cd_buf, CD_BUFLEN*2*sizeof(float), CD_FREQ);
} }
else
{
alBufferData(buffers[c], AL_FORMAT_STEREO16, buf_int16, BUFLEN*2*sizeof(int16_t), FREQ);
alBufferData(buffers_cd[c], AL_FORMAT_STEREO16, cd_buf_int16, CD_BUFLEN*2*sizeof(int16_t), CD_FREQ);
}
}
alSourceQueueBuffers(source[0], 4, buffers); alSourceQueueBuffers(source[0], 4, buffers);
alSourceQueueBuffers(source[1], 4, buffers_cd); alSourceQueueBuffers(source[1], 4, buffers_cd);
@@ -135,6 +148,32 @@ void givealbuffer(float *buf)
#endif #endif
} }
void givealbuffer_int16(int16_t *buf)
{
#ifdef USE_OPENAL
int processed;
int state;
ALuint buffer;
alGetSourcei(source[0], AL_SOURCE_STATE, &state);
if (state==0x1014)
{
alSourcePlay(source[0]);
}
alGetSourcei(source[0], AL_BUFFERS_PROCESSED, &processed);
if (processed>=1)
{
alSourceUnqueueBuffers(source[0], 1, &buffer);
alBufferData(buffer, AL_FORMAT_STEREO16, buf, BUFLEN*2*sizeof(int16_t), FREQ);
alSourceQueueBuffers(source[0], 1, &buffer);
}
#endif
}
void givealbuffer_cd(float *buf) void givealbuffer_cd(float *buf)
{ {
#ifdef USE_OPENAL #ifdef USE_OPENAL
@@ -161,3 +200,30 @@ void givealbuffer_cd(float *buf)
} }
#endif #endif
} }
void givealbuffer_cd_int16(int16_t *buf)
{
#ifdef USE_OPENAL
int processed;
int state;
alGetSourcei(source[1], AL_SOURCE_STATE, &state);
if (state==0x1014)
{
alSourcePlay(source[1]);
}
alGetSourcei(source[1], AL_BUFFERS_PROCESSED, &processed);
if (processed>=1)
{
ALuint buffer;
alSourceUnqueueBuffers(source[1], 1, &buffer);
alBufferData(buffer, AL_FORMAT_STEREO16, buf, CD_BUFLEN*2*sizeof(int16_t), CD_FREQ);
alSourceQueueBuffers(source[1], 1, &buffer);
}
#endif
}

View File

@@ -8,7 +8,7 @@
* *
* Sound emulation core. * Sound emulation core.
* *
* Version: @(#)sound.c 1.0.1 2017/06/04 * Version: @(#)sound.c 1.0.2 2017/06/14
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -136,11 +136,14 @@ int soundon = 1;
static int16_t cd_buffer[CDROM_NUM][CD_BUFLEN * 2]; static int16_t cd_buffer[CDROM_NUM][CD_BUFLEN * 2];
static float cd_out_buffer[CD_BUFLEN * 2]; static float cd_out_buffer[CD_BUFLEN * 2];
static int16_t cd_out_buffer_int16[CD_BUFLEN * 2];
static thread_t *sound_cd_thread_h; static thread_t *sound_cd_thread_h;
static event_t *sound_cd_event; static event_t *sound_cd_event;
static unsigned int cd_vol_l, cd_vol_r; static unsigned int cd_vol_l, cd_vol_r;
static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN; static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN;
int sound_is_float = 1;
void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r) void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r)
{ {
cd_vol_l = vol_l; cd_vol_l = vol_l;
@@ -151,20 +154,31 @@ static void sound_cd_thread(void *param)
{ {
int i = 0; int i = 0;
while (1) float cd_buffer_temp[2] = {0.0, 0.0};
{ float cd_buffer_temp2[2] = {0.0, 0.0};
int c, has_audio; int c, has_audio;
while (1)
{
thread_wait_event(sound_cd_event, -1); thread_wait_event(sound_cd_event, -1);
if (!soundon) if (!soundon)
{ {
return; return;
} }
for (c = 0; c < CD_BUFLEN*2; c += 2) for (c = 0; c < CD_BUFLEN*2; c += 2)
{
if (sound_is_float)
{ {
cd_out_buffer[c] = 0.0; cd_out_buffer[c] = 0.0;
cd_out_buffer[c+1] = 0.0; cd_out_buffer[c+1] = 0.0;
} }
else
{
cd_out_buffer_int16[c] = 0;
cd_out_buffer_int16[c+1] = 0;
}
}
for (i = 0; i < CDROM_NUM; i++) for (i = 0; i < CDROM_NUM; i++)
{ {
has_audio = 0; has_audio = 0;
@@ -184,9 +198,6 @@ static void sound_cd_thread(void *param)
for (c = 0; c < CD_BUFLEN*2; c += 2) for (c = 0; c < CD_BUFLEN*2; c += 2)
{ {
float cd_buffer_temp[2] = {0.0, 0.0};
float cd_buffer_temp2[2] = {0.0, 0.0};
/* First, transfer the CD audio data to the temporary buffer. */ /* First, transfer the CD audio data to the temporary buffer. */
cd_buffer_temp[0] = (float) cd_buffer[i][c]; cd_buffer_temp[0] = (float) cd_buffer[i][c];
cd_buffer_temp[1] = (float) cd_buffer[i][c+1]; cd_buffer_temp[1] = (float) cd_buffer[i][c+1];
@@ -223,20 +234,71 @@ static void sound_cd_thread(void *param)
cd_buffer_temp2[1] *= (float) cd_vol_r; cd_buffer_temp2[1] *= (float) cd_vol_r;
cd_buffer_temp2[1] /= 65535.0; cd_buffer_temp2[1] /= 65535.0;
if (sound_is_float)
{
cd_out_buffer[c] += (cd_buffer_temp2[0] / 32768.0); cd_out_buffer[c] += (cd_buffer_temp2[0] / 32768.0);
cd_out_buffer[c+1] += (cd_buffer_temp2[1] / 32768.0); cd_out_buffer[c+1] += (cd_buffer_temp2[1] / 32768.0);
} }
else
{
if (cd_buffer_temp2[0] > 32767)
cd_buffer_temp2[0] = 32767;
if (cd_buffer_temp2[0] < -32768)
cd_buffer_temp2[0] = -32768;
if (cd_buffer_temp2[1] > 32767)
cd_buffer_temp2[1] = 32767;
if (cd_buffer_temp2[1] < -32768)
cd_buffer_temp2[1] = -32768;
cd_out_buffer_int16[c] += cd_buffer_temp2[0];
cd_out_buffer_int16[c+1] += cd_buffer_temp2[1];
} }
} }
}
}
if (sound_is_float)
{
givealbuffer_cd(cd_out_buffer); givealbuffer_cd(cd_out_buffer);
} }
else
{
givealbuffer_cd_int16(cd_out_buffer_int16);
}
}
} }
static int32_t *outbuffer; static int32_t *outbuffer;
static float *outbuffer_ex; static float *outbuffer_ex;
static int16_t *outbuffer_ex_int16;
static int cd_thread_enable = 0; static int cd_thread_enable = 0;
void sound_realloc_buffers(void)
{
closeal();
initalmain(0,NULL);
inital();
if (outbuffer_ex != NULL)
{
free(outbuffer_ex);
}
if (outbuffer_ex_int16 != NULL)
{
free(outbuffer_ex_int16);
}
if (sound_is_float)
{
outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float));
}
else
{
outbuffer_ex_int16 = malloc(SOUNDBUFLEN * 2 * sizeof(int16_t));
}
}
void sound_init(void) void sound_init(void)
{ {
int i = 0; int i = 0;
@@ -245,8 +307,12 @@ void sound_init(void)
initalmain(0,NULL); initalmain(0,NULL);
inital(); inital();
outbuffer_ex = NULL;
outbuffer_ex_int16 = NULL;
outbuffer = malloc(SOUNDBUFLEN * 2 * sizeof(int32_t)); outbuffer = malloc(SOUNDBUFLEN * 2 * sizeof(int32_t));
outbuffer_ex = malloc(SOUNDBUFLEN * 2 * sizeof(float));
sound_realloc_buffers();
for (i = 0; i < CDROM_NUM; i++) for (i = 0; i < CDROM_NUM; i++)
{ {
@@ -288,11 +354,33 @@ void sound_poll(void *priv)
for (c = 0; c < SOUNDBUFLEN * 2; c++) for (c = 0; c < SOUNDBUFLEN * 2; c++)
{
if (sound_is_float)
{ {
outbuffer_ex[c] = ((float) outbuffer[c]) / 32768.0; outbuffer_ex[c] = ((float) outbuffer[c]) / 32768.0;
} }
else
{
if (outbuffer[c] > 32767)
outbuffer[c] = 32767;
if (outbuffer[c] < -32768)
outbuffer[c] = -32768;
if (soundon) givealbuffer(outbuffer_ex); outbuffer_ex_int16[c] = outbuffer[c];
}
}
if (soundon)
{
if (sound_is_float)
{
givealbuffer(outbuffer_ex);
}
else
{
givealbuffer_int16(outbuffer_ex_int16);
}
}
if (cd_thread_enable) if (cd_thread_enable)
{ {

View File

@@ -8,7 +8,7 @@
* *
* Sound emulation core. * Sound emulation core.
* *
* Version: @(#)sound.h 1.0.0 2017/05/30 * Version: @(#)sound.h 1.0.1 2017/06/14
* *
* Author: Sarah Walker, <http://pcem-emulator.co.uk/> * Author: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -35,12 +35,18 @@ void sound_set_cd_volume(unsigned int vol_l, unsigned int vol_r);
extern int sound_pos_global; extern int sound_pos_global;
void sound_speed_changed(); void sound_speed_changed();
extern int sound_is_float;
void sound_realloc_buffers(void);
void sound_init(); void sound_init();
void sound_reset(); void sound_reset();
void sound_cd_thread_reset(); void sound_cd_thread_reset();
void closeal(ALvoid);
void initalmain(int argc, char *argv[]); void initalmain(int argc, char *argv[]);
void inital(); void inital();
void givealbuffer(float *buf); void givealbuffer(float *buf);
void givealbuffer_int16(int16_t *buf);
void givealbuffer_cd(float *buf); void givealbuffer_cd(float *buf);
void givealbuffer_cd_int16(int16_t *buf);

View File

@@ -279,7 +279,7 @@ BEGIN
PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14 PUSHBUTTON "Joystick 4...",IDC_JOY4,209,44,50,14
END END
DLG_CFG_SOUND DIALOG DISCARDABLE 97, 0, 267, 98 DLG_CFG_SOUND DIALOG DISCARDABLE 97, 0, 267, 116
STYLE DS_CONTROL | WS_CHILD STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI" FONT 9, "Segoe UI"
BEGIN BEGIN
@@ -304,6 +304,9 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,7,81,94,10 BS_AUTOCHECKBOX | WS_TABSTOP,7,81,94,10
CONTROL "Use Nuked OPL",IDC_CHECK_NUKEDOPL,"Button", CONTROL "Use Nuked OPL",IDC_CHECK_NUKEDOPL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,81,94,10 BS_AUTOCHECKBOX | WS_TABSTOP,147,81,94,10
CONTROL "Use FLOAT32 sound",IDC_CHECK_FLOAT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,99,94,10
END END
DLG_CFG_NETWORK DIALOG DISCARDABLE 97, 0, 267, 63 DLG_CFG_NETWORK DIALOG DISCARDABLE 97, 0, 267, 63
@@ -668,7 +671,7 @@ BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 260 RIGHTMARGIN, 260
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 71 BOTTOMMARGIN, 109
END END
CONFIGUREDLG_NETWORK, DIALOG CONFIGUREDLG_NETWORK, DIALOG

View File

@@ -126,6 +126,7 @@
#define IDC_COMBO_MIDI 1076 #define IDC_COMBO_MIDI 1076
#define IDC_CHECK_MPU401 1077 #define IDC_CHECK_MPU401 1077
#define IDC_CONFIGURE_MPU401 1078 #define IDC_CONFIGURE_MPU401 1078
#define IDC_CHECK_FLOAT 1079
#define IDC_COMBO_NET_TYPE 1090 /* network config */ #define IDC_COMBO_NET_TYPE 1090 /* network config */
#define IDC_COMBO_PCAP 1091 #define IDC_COMBO_PCAP 1091

View File

@@ -1240,7 +1240,7 @@ void update_status_bar_panes(HWND hwnds)
break; break;
case SB_TEXT: case SB_TEXT:
/* Status text */ /* Status text */
SendMessage(hwnds, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM) L"Welcome to Unicode 86Box! :p"); SendMessage(hwnds, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM) L"");
sb_part_icons[i] = -1; sb_part_icons[i] = -1;
break; break;
} }

View File

@@ -8,7 +8,7 @@
* *
* Windows 86Box Settings dialog handler. * Windows 86Box Settings dialog handler.
* *
* Version: @(#)win_settings.c 1.0.2 2017/06/04 * Version: @(#)win_settings.c 1.0.3 2017/06/14
* *
* Author: Miran Grca, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* Copyright 2016-2017 Miran Grca. * Copyright 2016-2017 Miran Grca.
@@ -34,7 +34,7 @@
#include "../ide.h" #include "../ide.h"
#include "../scsi.h" #include "../scsi.h"
#include "../scsi_buslogic.h" #include "../scsi_buslogic.h"
#include "../network.h" #include "../network/network.h"
#include "../sound/sound.h" #include "../sound/sound.h"
#include "../sound/snd_dbopl.h" #include "../sound/snd_dbopl.h"
#include "../sound/snd_mpu401.h" #include "../sound/snd_mpu401.h"
@@ -58,6 +58,7 @@ static int temp_mouse, temp_joystick;
/* Sound category */ /* Sound category */
static int temp_sound_card, temp_midi_id, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type; static int temp_sound_card, temp_midi_id, temp_mpu401, temp_SSI2001, temp_GAMEBLASTER, temp_GUS, temp_opl3_type;
static int temp_float;
/* Network category */ /* Network category */
static int temp_net_type, temp_net_card; static int temp_net_type, temp_net_card;
@@ -124,6 +125,7 @@ static void win_settings_init(void)
temp_GAMEBLASTER = GAMEBLASTER; temp_GAMEBLASTER = GAMEBLASTER;
temp_GUS = GUS; temp_GUS = GUS;
temp_opl3_type = opl3_type; temp_opl3_type = opl3_type;
temp_float = sound_is_float;
/* Network category */ /* Network category */
temp_net_type = network_type; temp_net_type = network_type;
@@ -189,6 +191,7 @@ static int win_settings_changed(void)
i = i || (GAMEBLASTER != temp_GAMEBLASTER); i = i || (GAMEBLASTER != temp_GAMEBLASTER);
i = i || (GUS != temp_GUS); i = i || (GUS != temp_GUS);
i = i || (opl3_type != temp_opl3_type); i = i || (opl3_type != temp_opl3_type);
i = i || (sound_is_float != temp_float);
/* Network category */ /* Network category */
i = i || (network_type != temp_net_type); i = i || (network_type != temp_net_type);
@@ -286,6 +289,7 @@ static void win_settings_save(void)
GAMEBLASTER = temp_GAMEBLASTER; GAMEBLASTER = temp_GAMEBLASTER;
GUS = temp_GUS; GUS = temp_GUS;
opl3_type = temp_opl3_type; opl3_type = temp_opl3_type;
sound_is_float = temp_float;
/* Network category */ /* Network category */
network_type = temp_net_type; network_type = temp_net_type;
@@ -321,6 +325,8 @@ static void win_settings_save(void)
update_status_bar_panes(hwndStatus); update_status_bar_panes(hwndStatus);
sound_realloc_buffers();
resetpchard(); resetpchard();
cpu_set(); cpu_set();
@@ -1235,6 +1241,9 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
h=GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL); h=GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL);
SendMessage(h, BM_SETCHECK, temp_opl3_type, 0); SendMessage(h, BM_SETCHECK, temp_opl3_type, 0);
h=GetDlgItem(hdlg, IDC_CHECK_FLOAT);
SendMessage(h, BM_SETCHECK, temp_float, 0);
free(lptsTemp); free(lptsTemp);
return TRUE; return TRUE;
@@ -1306,6 +1315,9 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
h = GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL); h = GetDlgItem(hdlg, IDC_CHECK_NUKEDOPL);
temp_opl3_type = SendMessage(h, BM_GETCHECK, 0, 0); temp_opl3_type = SendMessage(h, BM_GETCHECK, 0, 0);
h = GetDlgItem(hdlg, IDC_CHECK_FLOAT);
temp_float = SendMessage(h, BM_GETCHECK, 0, 0);
default: default:
return FALSE; return FALSE;
} }

View File

@@ -24,7 +24,7 @@
#include "hdd.h" #include "hdd.h"
#include "model.h" #include "model.h"
#include "mouse.h" #include "mouse.h"
#include "network.h" #include "network/network.h"
#include "nvr.h" #include "nvr.h"
#include "scsi.h" #include "scsi.h"
#include "win/plat_joystick.h" #include "win/plat_joystick.h"
@@ -997,6 +997,21 @@ static void loadconfig_sound(void)
{ {
opl3_type = 0; opl3_type = 0;
} }
memset(temps, '\0', sizeof(temps));
p = config_get_string(cat, "sound_type", "float");
if (p != NULL)
{
strcpy(temps, p);
}
if (!strcmp(temps, "float") || !strcmp(temps, "1"))
{
sound_is_float = 1;
}
else
{
sound_is_float = 0;
}
} }
@@ -2059,6 +2074,15 @@ static void saveconfig_sound(void)
config_set_string(cat, "opl3_type", (opl3_type == 1) ? "nukedopl" : "dbopl"); config_set_string(cat, "opl3_type", (opl3_type == 1) ? "nukedopl" : "dbopl");
} }
if (sound_is_float == 1)
{
config_delete_var(cat, "sound_type");
}
else
{
config_set_string(cat, "sound_type", (sound_is_float == 1) ? "float" : "int16");
}
config_delete_section_if_empty(cat); config_delete_section_if_empty(cat);
} }

View File

@@ -59,7 +59,7 @@
#include "model.h" #include "model.h"
#include "mouse.h" #include "mouse.h"
#include "plat_mouse.h" #include "plat_mouse.h"
#include "network.h" #include "network/network.h"
#include "serial.h" #include "serial.h"
#include "sound/sound.h" #include "sound/sound.h"
#include "sound/snd_cms.h" #include "sound/snd_cms.h"

View File

@@ -1,26 +0,0 @@
CC=gcc
CFLAGS=-I. -O2 -Wall
DEPS = bootp.h config-host.h config.h ctl.h \
debug.h icmp_var.h if.h ip.h \
ip_icmp.h libslirp.h main.h mbuf.h \
misc.h queue.h sbuf.h slirp.h \
slirp_config.h socket.h tcp.h tcpip.h \
tcp_timer.h tcp_var.h tftp.h udp.h
OBJ = bootp.o cksum.o debug.o if.o ip_icmp.o \
ip_input.o ip_output.o mbuf.o misc.o queue.o \
sbuf.o slirp.o socket.o tcp_input.o tcp_output.o \
tcp_subr.o tcp_timer.o tftp.o udp.o
%.o: %.c $(DEPS)
$(CC) $(CFLAGS) -c $< -o $@
default: libslirp.a
clean:
rm -f $(OBJ)
rm -f libslirp.a
libslirp.a: $(OBJ)
ar rcs $@ $^
ranlib $@

View File

@@ -1,114 +0,0 @@
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)udp.h 8.1 (Berkeley) 6/10/93
* udp.h,v 1.3 1994/08/21 05:27:41 paul Exp
*/
#ifndef _UDP_H_
#define _UDP_H_
#define UDP_TTL 0x60
#define UDP_UDPDATALEN 16192
extern struct SLIRPsocket *udp_last_so;
/*
* Udp protocol header.
* Per RFC 768, September, 1981.
*/
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(1)
#endif
struct udphdr {
u_int16_t uh_sport; /* source port */
u_int16_t uh_dport; /* destination port */
int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
} PACKED__;
#ifdef PRAGMA_PACK_SUPPORTED
#pragma pack(PACK_END)
#endif
/*
* UDP kernel structures and variables.
*/
struct udpiphdr {
struct ipovly ui_i; /* overlaid ip structure */
struct udphdr ui_u; /* udp header */
};
#define ui_next ui_i.ih_next
#define ui_prev ui_i.ih_prev
#define ui_x1 ui_i.ih_x1
#define ui_pr ui_i.ih_pr
#define ui_len ui_i.ih_len
#define ui_src ui_i.ih_src
#define ui_dst ui_i.ih_dst
#define ui_sport ui_u.uh_sport
#define ui_dport ui_u.uh_dport
#define ui_ulen ui_u.uh_ulen
#define ui_sum ui_u.uh_sum
struct udpstat {
/* input statistics: */
u_long udps_ipackets; /* total input packets */
u_long udps_hdrops; /* packet shorter than header */
u_long udps_badsum; /* checksum error */
u_long udps_badlen; /* data length larger than packet */
u_long udps_noport; /* no socket on port */
u_long udps_noportbcast; /* of above, arrived as broadcast */
u_long udps_fullsock; /* not delivered, input socket full */
u_long udpps_pcbcachemiss; /* input packets missing pcb cache */
/* output statistics: */
u_long udps_opackets; /* total output packets */
};
/*
* Names for UDP sysctl objects
*/
#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
#define UDPCTL_MAXID 2
extern struct udpstat udpstat;
extern struct SLIRPsocket udb;
struct SLIRPmbuf;
void udp_init _P((void));
void udp_input _P((register struct SLIRPmbuf *, int));
int udp_output _P((struct SLIRPsocket *, struct SLIRPmbuf *, struct sockaddr_in *));
int udp_attach _P((struct SLIRPsocket *));
void udp_detach _P((struct SLIRPsocket *));
u_int8_t udp_tos _P((struct SLIRPsocket *));
void udp_emu _P((struct SLIRPsocket *, struct SLIRPmbuf *));
struct SLIRPsocket * udp_listen _P((u_int, u_int32_t, u_int, int));
int udp_output2(struct SLIRPsocket *so, struct SLIRPmbuf *m,
struct sockaddr_in *saddr, struct sockaddr_in *daddr,
int iptos);
#endif