More sonarlint work

This commit is contained in:
Jasmine Iwanek
2023-06-09 23:46:54 -04:00
parent 0d1d069af4
commit ee695e71f9
218 changed files with 6282 additions and 3845 deletions

View File

@@ -17,15 +17,18 @@
#include <86box/sound.h>
#include <86box/snd_opl.h>
#include <86box/snd_ym7128.h>
#include <86box/plat_unused.h>
typedef struct adgold_t {
int adgold_irq_status;
int irq, dma;
int irq;
int dma;
uint8_t adgold_eeprom[0x1a];
uint8_t adgold_status;
int adgold_38x_state, adgold_38x_addr;
int adgold_38x_state;
int adgold_38x_addr;
uint8_t adgold_38x_regs[0x1a];
int adgold_mma_addr;
@@ -33,7 +36,8 @@ typedef struct adgold_t {
int adgold_mma_enable[2];
uint8_t adgold_mma_fifo[2][256];
int adgold_mma_fifo_start[2], adgold_mma_fifo_end[2];
int adgold_mma_fifo_start[2];
int adgold_mma_fifo_end[2];
uint8_t adgold_mma_status;
int16_t adgold_mma_out[2];
@@ -41,28 +45,42 @@ typedef struct adgold_t {
pc_timer_t adgold_mma_timer_count;
uint8_t adgold_midi_ctrl, midi_queue[16];
int midi_r, midi_w;
int uart_in, uart_out, sysex;
uint8_t adgold_midi_ctrl;
uint8_t midi_queue[16];
int midi_r;
int midi_w;
int uart_in;
int uart_out;
int sysex;
struct
{
int timer0_latch, timer0_count;
int timerbase_latch, timerbase_count;
int timer1_latch, timer1_count;
int timer2_latch, timer2_count, timer2_read;
struct {
int timer0_latch;
int timer0_count;
int timerbase_latch;
int timerbase_count;
int timer1_latch;
int timer1_count;
int timer2_latch;
int timer2_count;
int timer2_read;
int voice_count[2], voice_latch[2];
int voice_count[2];
int voice_latch[2];
} adgold_mma;
fm_drv_t opl;
ym7128_t ym7128;
int fm_vol_l, fm_vol_r;
int samp_vol_l, samp_vol_r;
int aux_vol_l, aux_vol_r;
int vol_l, vol_r;
int treble, bass;
int fm_vol_l;
int fm_vol_r;
int samp_vol_l;
int samp_vol_r;
int aux_vol_l;
int aux_vol_r;
int vol_l;
int vol_r;
int treble;
int bass;
int16_t opl_buffer[SOUNDBUFLEN * 2];
int16_t mma_buffer[2][SOUNDBUFLEN];
@@ -131,7 +149,7 @@ static int treble_cut[6] = {
(int) (0.354 * 16384) /*-3 dB - filter output is at +6 dB*/
};
void adgold_timer_poll(void *p);
void adgold_timer_poll(void *priv);
void adgold_update(adgold_t *adgold);
void
@@ -192,9 +210,9 @@ adgold_getsamp_dma(adgold_t *adgold, int channel)
}
void
adgold_write(uint16_t addr, uint8_t val, void *p)
adgold_write(uint16_t addr, uint8_t val, void *priv)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
switch (addr & 7) {
case 0:
case 1:
@@ -337,6 +355,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
case 0x18:
adgold->adgold_mma.voice_latch[0] = 72;
break; /* 7350 Hz*/
default:
break;
}
if (val & 0x80) {
adgold->adgold_mma_enable[0] = 0;
@@ -438,6 +459,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
adgold_update_irq_status(adgold);
}
break;
default:
break;
}
adgold->adgold_mma_regs[0][adgold->adgold_mma_addr] = val;
break;
@@ -460,6 +484,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
case 0x18:
adgold->adgold_mma.voice_latch[1] = 72;
break; /* 7350 Hz*/
default:
break;
}
if (val & 0x80) {
adgold->adgold_mma_enable[1] = 0;
@@ -497,16 +524,22 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
case 0xc:
adgold->adgold_mma_intpos[1] = (7 - ((val >> 2) & 7)) * 8;
break;
default:
break;
}
adgold->adgold_mma_regs[1][adgold->adgold_mma_addr] = val;
break;
default:
break;
}
}
uint8_t
adgold_read(uint16_t addr, void *p)
adgold_read(uint16_t addr, void *priv)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
uint8_t temp = 0;
switch (addr & 7) {
@@ -586,6 +619,9 @@ adgold_read(uint16_t addr, void *p)
else
temp = adgold->adgold_mma_regs[1][adgold->adgold_mma_addr];
break;
default:
break;
}
return temp;
}
@@ -633,6 +669,9 @@ adgold_mma_poll(adgold_t *adgold, int channel)
adgold->adgold_mma_fifo_start[channel] = (adgold->adgold_mma_fifo_start[channel] + 1) & 255;
adgold->adgold_mma_out[channel] = dat;
break;
default:
break;
}
if (adgold->adgold_mma_regs[channel][0xc] & 1) {
@@ -649,9 +688,9 @@ adgold_mma_poll(adgold_t *adgold, int channel)
}
void
adgold_timer_poll(void *p)
adgold_timer_poll(void *priv)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
/*A small timer period will result in hangs.*/
timer_on_auto(&adgold->adgold_mma_timer_count, 4.88964);
@@ -718,9 +757,9 @@ adgold_timer_poll(void *p)
}
static void
adgold_get_buffer(int32_t *buffer, int len, void *p)
adgold_get_buffer(int32_t *buffer, int len, void *priv)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
int16_t *adgold_buffer = malloc(sizeof(int16_t) * len * 2);
if (adgold_buffer == NULL)
fatal("adgold_buffer = NULL");
@@ -755,6 +794,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p)
break;
case 6: /*Left and right channels*/
break;
default:
break;
}
switch (adgold->adgold_38x_regs[0x8] & 0x18) {
@@ -781,6 +823,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p)
adgold_buffer[c + 1] += (l / 3) + ((r * 2) / 3);
}
break;
default:
break;
}
for (c = 0; c < len * 2; c += 2) {
@@ -831,9 +876,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p)
}
static void
adgold_filter_cd_audio(int channel, double *buffer, void *p)
adgold_filter_cd_audio(int channel, double *buffer, void *priv)
{
adgold_t *adgold = (adgold_t *) p;
adgold_t *adgold = (adgold_t *) priv;
double c;
int aux = channel ? adgold->aux_vol_r : adgold->aux_vol_l;
int vol = channel ? adgold->vol_r : adgold->vol_l;
@@ -883,7 +928,7 @@ adgold_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
}
void *
adgold_init(const device_t *info)
adgold_init(UNUSED(const device_t *info))
{
FILE *f;
int c;
@@ -957,6 +1002,9 @@ adgold_init(const device_t *info)
case 7:
adgold->adgold_eeprom[0x13] |= 0x03;
break;
default:
break;
}
adgold->adgold_eeprom[0x13] |= (adgold->dma << 3);
adgold->adgold_eeprom[0x14] |= (adgold->dma << 4);
@@ -993,15 +1041,15 @@ adgold_init(const device_t *info)
}
void
adgold_close(void *p)
adgold_close(void *priv)
{
FILE *f;
adgold_t *adgold = (adgold_t *) p;
FILE *fp;
adgold_t *adgold = (adgold_t *) priv;
f = nvr_fopen("adgold.bin", "wb");
if (f) {
fwrite(adgold->adgold_eeprom, 0x1a, 1, f);
fclose(f);
fp = nvr_fopen("adgold.bin", "wb");
if (fp) {
fwrite(adgold->adgold_eeprom, 0x1a, 1, fp);
fclose(fp);
}
free(adgold);