mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
Added Fuller box sound and joystick
This commit is contained in:
parent
ce9f6b3c97
commit
2596ca34ab
@ -97,7 +97,7 @@ void computer_init () { //Called only on start-up
|
|||||||
ordenador.issue = 3;
|
ordenador.issue = 3;
|
||||||
ordenador.mode128k = 0;
|
ordenador.mode128k = 0;
|
||||||
ordenador.videosystem = 0; //PAL
|
ordenador.videosystem = 0; //PAL
|
||||||
ordenador.joystick[0] = 1; //Kemposton
|
ordenador.joystick[0] = 1; //Kempston
|
||||||
ordenador.joystick[1] = 0; // Cursor
|
ordenador.joystick[1] = 0; // Cursor
|
||||||
ordenador.joypad_as_joystick[0]= 1;
|
ordenador.joypad_as_joystick[0]= 1;
|
||||||
ordenador.joypad_as_joystick[1]= 1;
|
ordenador.joypad_as_joystick[1]= 1;
|
||||||
@ -135,6 +135,7 @@ void computer_init () { //Called only on start-up
|
|||||||
for (bucle = 0; bucle < 16; bucle++)
|
for (bucle = 0; bucle < 16; bucle++)
|
||||||
ordenador.ay_registers[bucle] = 0;
|
ordenador.ay_registers[bucle] = 0;
|
||||||
ordenador.ay_emul = 0;
|
ordenador.ay_emul = 0;
|
||||||
|
ordenador.fuller_box_sound = 0;
|
||||||
ordenador.gui_sound = 1;
|
ordenador.gui_sound = 1;
|
||||||
ordenador.aych_a = 0;
|
ordenador.aych_a = 0;
|
||||||
ordenador.aych_b = 0;
|
ordenador.aych_b = 0;
|
||||||
@ -1482,7 +1483,16 @@ inline void read_keyboard () {
|
|||||||
if ((ordenador.joy_axis_x_state[joy_n] == JOY_LEFT)||(joybutton_matrix[joy_n][SDLK_LEFT])) ordenador.k12|= 16;
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_LEFT)||(joybutton_matrix[joy_n][SDLK_LEFT])) ordenador.k12|= 16;
|
||||||
if (joybutton_matrix[joy_n][SDLK_LALT]) {ordenador.k12|= 1; fire_on[joy_n]=1;}//fire button
|
if (joybutton_matrix[joy_n][SDLK_LALT]) {ordenador.k12|= 1; fire_on[joy_n]=1;}//fire button
|
||||||
break;
|
break;
|
||||||
case 4: // QAOP
|
|
||||||
|
case 4: //Fuller
|
||||||
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_UP)||(joybutton_matrix[joy_n][SDLK_UP])) ordenador.jk|= 1;
|
||||||
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)||(joybutton_matrix[joy_n][SDLK_DOWN])) ordenador.jk|= 2;
|
||||||
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)||(joybutton_matrix[joy_n][SDLK_RIGHT])) ordenador.jk|= 8;
|
||||||
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_LEFT)||(joybutton_matrix[joy_n][SDLK_LEFT])) ordenador.jk|= 4;
|
||||||
|
if (joybutton_matrix[joy_n][SDLK_LALT]) {ordenador.jk |= 128; fire_on[joy_n]=1;}//fire button
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // QAOP
|
||||||
if ((ordenador.joy_axis_y_state[joy_n] == JOY_UP) ||(joybutton_matrix[joy_n][SDLK_UP]))ordenador.k10|=1;
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_UP) ||(joybutton_matrix[joy_n][SDLK_UP]))ordenador.k10|=1;
|
||||||
if ((ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)||(joybutton_matrix[joy_n][SDLK_DOWN])) ordenador.k9 |=1;
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)||(joybutton_matrix[joy_n][SDLK_DOWN])) ordenador.k9 |=1;
|
||||||
if ((ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)||(joybutton_matrix[joy_n][SDLK_RIGHT])) ordenador.k13|=1;
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)||(joybutton_matrix[joy_n][SDLK_RIGHT])) ordenador.k13|=1;
|
||||||
@ -1525,7 +1535,16 @@ inline void read_keyboard () {
|
|||||||
if ((ordenador.joy_axis_x_state[joy_n] == JOY_LEFT)||(status_hat[joy_n] & SDL_HAT_LEFT)) ordenador.k12|= 16;
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_LEFT)||(status_hat[joy_n] & SDL_HAT_LEFT)) ordenador.k12|= 16;
|
||||||
if (joybutton_matrix[joy_n][SDLK_LALT]) {ordenador.k12|= 1; fire_on[joy_n]=1;}//fire button
|
if (joybutton_matrix[joy_n][SDLK_LALT]) {ordenador.k12|= 1; fire_on[joy_n]=1;}//fire button
|
||||||
break;
|
break;
|
||||||
case 4: // QAOP
|
|
||||||
|
case 4: //Fuller
|
||||||
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_UP)||(status_hat[joy_n] & SDL_HAT_UP)) ordenador.jk|= 1;
|
||||||
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)||(status_hat[joy_n] & SDL_HAT_DOWN)) ordenador.jk|= 2;
|
||||||
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)||(status_hat[joy_n] & SDL_HAT_RIGHT)) ordenador.jk|= 8;
|
||||||
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_LEFT)||(status_hat[joy_n] & SDL_HAT_LEFT)) ordenador.jk|= 4;
|
||||||
|
if (joybutton_matrix[joy_n][SDLK_LALT]) {ordenador.jk |= 128; fire_on[joy_n]=1;}//fire button
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5: // QAOP
|
||||||
if ((ordenador.joy_axis_y_state[joy_n] == JOY_UP)||(status_hat[joy_n] & SDL_HAT_UP)) ordenador.k10|=1;
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_UP)||(status_hat[joy_n] & SDL_HAT_UP)) ordenador.k10|=1;
|
||||||
if ((ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)||(status_hat[joy_n] & SDL_HAT_DOWN)) ordenador.k9 |=1;
|
if ((ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)||(status_hat[joy_n] & SDL_HAT_DOWN)) ordenador.k9 |=1;
|
||||||
if ((ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)||(status_hat[joy_n] & SDL_HAT_RIGHT)) ordenador.k13|=1;
|
if ((ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)||(status_hat[joy_n] & SDL_HAT_RIGHT)) ordenador.k13|=1;
|
||||||
@ -2185,6 +2204,18 @@ void Z80free_Out (register word Port, register byte Value) {
|
|||||||
if (ordenador.ay_latch == 13) //Envelope shape
|
if (ordenador.ay_latch == 13) //Envelope shape
|
||||||
ordenador.ay_envel_way = 2; // start cycle
|
ordenador.ay_envel_way = 2; // start cycle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fuller Box sound chip (AY-3-8912)
|
||||||
|
|
||||||
|
if (((Port&0x00FF) == 0x3F)&&(ordenador.fuller_box_sound))
|
||||||
|
ordenador.ay_latch = ((unsigned int) (Value & 0x0F));
|
||||||
|
|
||||||
|
if (((Port&0x00FF) == 0x5F)&&(ordenador.fuller_box_sound)) {
|
||||||
|
ordenador.ay_registers[ordenador.ay_latch] = (unsigned char) Value;
|
||||||
|
if (ordenador.ay_latch == 13) //Envelope shape
|
||||||
|
ordenador.ay_envel_way = 2; // start cycle
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Z80free_Out_fake (register word Port, register byte Value) {
|
void Z80free_Out_fake (register word Port, register byte Value) {
|
||||||
@ -2312,7 +2343,7 @@ byte Z80free_In (register word Port) {
|
|||||||
return (pines);
|
return (pines);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Joystick
|
// Joystick - Kempston
|
||||||
if (!(temporal_io & 0x0020)) {
|
if (!(temporal_io & 0x0020)) {
|
||||||
if ((ordenador.joystick[0] == 1)||(ordenador.joystick[1] == 1)) {
|
if ((ordenador.joystick[0] == 1)||(ordenador.joystick[1] == 1)) {
|
||||||
return (ordenador.js);
|
return (ordenador.js);
|
||||||
@ -2321,6 +2352,16 @@ byte Z80free_In (register word Port) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Joystick - Fuller
|
||||||
|
if ((temporal_io & 0x00FF)==0x7F) {
|
||||||
|
if ((ordenador.joystick[0] == 4)||(ordenador.joystick[1] == 4)) {
|
||||||
|
return (~ordenador.js);
|
||||||
|
} else {
|
||||||
|
return 255; // if Fuller is not selected, emulate it, but always 255
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sound chip (AY-3-8912)
|
||||||
if ((temporal_io == 0xFFFD)&&(ordenador.ay_emul)) //any mask to apply?
|
if ((temporal_io == 0xFFFD)&&(ordenador.ay_emul)) //any mask to apply?
|
||||||
return (ordenador.ay_registers[ordenador.ay_latch]);
|
return (ordenador.ay_registers[ordenador.ay_latch]);
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ struct computer {
|
|||||||
unsigned int aych_a,aych_b,aych_c,aych_n,aych_envel; // counters for AY emulation
|
unsigned int aych_a,aych_b,aych_c,aych_n,aych_envel; // counters for AY emulation
|
||||||
unsigned char ayval_a,ayval_b,ayval_c,ayval_n;
|
unsigned char ayval_a,ayval_b,ayval_c,ayval_n;
|
||||||
unsigned char ay_emul; // 0: no AY emulation; 1: AY emulation
|
unsigned char ay_emul; // 0: no AY emulation; 1: AY emulation
|
||||||
|
unsigned char fuller_box_sound; // 0: no AY emulation; 1: AY emulation
|
||||||
unsigned char audio_mode; //mono, ABC, ACB, BAC
|
unsigned char audio_mode; //mono, ABC, ACB, BAC
|
||||||
unsigned char gui_sound;
|
unsigned char gui_sound;
|
||||||
unsigned int vol_a,vol_b,vol_c;
|
unsigned int vol_a,vol_b,vol_c;
|
||||||
@ -161,7 +162,7 @@ struct computer {
|
|||||||
unsigned char issue; // 2= 48K issue 2, 3= 48K issue 3
|
unsigned char issue; // 2= 48K issue 2, 3= 48K issue 3
|
||||||
unsigned char mode128k; // 0=48K, 1=128K, 2=+2, 3=+3 4=sp
|
unsigned char mode128k; // 0=48K, 1=128K, 2=+2, 3=+3 4=sp
|
||||||
unsigned char videosystem; //0=PAL, 1=NTSC
|
unsigned char videosystem; //0=PAL, 1=NTSC
|
||||||
unsigned char joystick[2]; // 0=cursor, 1=kempston, 2=sinclair1, 3=sinclair2
|
unsigned char joystick[2]; // 0=cursor, 1=kempston, 2=sinclair1, 3=sinclair2, 4=Fuller, 5=QAOP
|
||||||
unsigned char port254;
|
unsigned char port254;
|
||||||
|
|
||||||
|
|
||||||
|
@ -730,6 +730,7 @@ int save_config(struct computer *object, char *filename) {
|
|||||||
fprintf(fconfig,"joystick1=%c%c",48+object->joystick[0],10);
|
fprintf(fconfig,"joystick1=%c%c",48+object->joystick[0],10);
|
||||||
fprintf(fconfig,"joystick2=%c%c",48+object->joystick[1],10);
|
fprintf(fconfig,"joystick2=%c%c",48+object->joystick[1],10);
|
||||||
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
|
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
|
||||||
|
fprintf(fconfig,"fuller_box_sound=%c%c",48+object->fuller_box_sound,10);
|
||||||
fprintf(fconfig,"audio_mode=%c%c",48+object->audio_mode,10);
|
fprintf(fconfig,"audio_mode=%c%c",48+object->audio_mode,10);
|
||||||
fprintf(fconfig,"gui_sound=%c%c",48+object->gui_sound,10);
|
fprintf(fconfig,"gui_sound=%c%c",48+object->gui_sound,10);
|
||||||
fprintf(fconfig,"interface1=%c%c",48+object->mdr_active,10);
|
fprintf(fconfig,"interface1=%c%c",48+object->mdr_active,10);
|
||||||
@ -782,6 +783,7 @@ int save_config_game(struct computer *object, char *filename, int overwrite) {
|
|||||||
fprintf(fconfig,"joystick1=%c%c",48+object->joystick[0],10);
|
fprintf(fconfig,"joystick1=%c%c",48+object->joystick[0],10);
|
||||||
fprintf(fconfig,"joystick2=%c%c",48+object->joystick[1],10);
|
fprintf(fconfig,"joystick2=%c%c",48+object->joystick[1],10);
|
||||||
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
|
fprintf(fconfig,"ay_sound=%c%c",48+object->ay_emul,10);
|
||||||
|
fprintf(fconfig,"fuller_box_sound=%c%c",48+object->fuller_box_sound,10);
|
||||||
fprintf(fconfig,"joypad1=%c%c",48+object->joypad_as_joystick[0],10);
|
fprintf(fconfig,"joypad1=%c%c",48+object->joypad_as_joystick[0],10);
|
||||||
fprintf(fconfig,"joypad2=%c%c",48+object->joypad_as_joystick[1],10);
|
fprintf(fconfig,"joypad2=%c%c",48+object->joypad_as_joystick[1],10);
|
||||||
fprintf(fconfig,"rumble1=%c%c",48+object->rumble[0],10);
|
fprintf(fconfig,"rumble1=%c%c",48+object->rumble[0],10);
|
||||||
@ -921,7 +923,7 @@ int load_config(struct computer *object, char *filename) {
|
|||||||
unsigned char volume=255,mode128k=255,issue=255,ntsc=255, joystick1=255,joystick2=255,ay_emul=255,mdr_active=255,
|
unsigned char volume=255,mode128k=255,issue=255,ntsc=255, joystick1=255,joystick2=255,ay_emul=255,mdr_active=255,
|
||||||
dblscan=255,framerate =255, screen =255, text=255, precision=255, bw=255, tap_fast=255, audio_mode=255,
|
dblscan=255,framerate =255, screen =255, text=255, precision=255, bw=255, tap_fast=255, audio_mode=255,
|
||||||
joypad1=255, joypad2=255, rumble1=255, rumble2=255, joy_n=255, key_n=255, port=255, autoconf=255, turbo=225, vk_auto=255, vk_rumble=255,
|
joypad1=255, joypad2=255, rumble1=255, rumble2=255, joy_n=255, key_n=255, port=255, autoconf=255, turbo=225, vk_auto=255, vk_rumble=255,
|
||||||
rewind_on_reset=255, pause_instant_load =255, ignore_z80_joy_conf=255, gui_sound=255;
|
rewind_on_reset=255, pause_instant_load =255, ignore_z80_joy_conf=255, gui_sound=255, fuller_box_sound=255;
|
||||||
|
|
||||||
if (filename) strcpy(config_path,filename);
|
if (filename) strcpy(config_path,filename);
|
||||||
else return -2;
|
else return -2;
|
||||||
@ -979,6 +981,10 @@ int load_config(struct computer *object, char *filename) {
|
|||||||
ay_emul=line[9]-'0';
|
ay_emul=line[9]-'0';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strncmp(line,"fuller_box_sound=",17)) {
|
||||||
|
fuller_box_sound=line[17]-'0';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strncmp(line,"audio_mode=",11)) {
|
if (!strncmp(line,"audio_mode=",11)) {
|
||||||
audio_mode=line[11]-'0';
|
audio_mode=line[11]-'0';
|
||||||
continue;
|
continue;
|
||||||
@ -1088,15 +1094,18 @@ int load_config(struct computer *object, char *filename) {
|
|||||||
if (ntsc<2) {
|
if (ntsc<2) {
|
||||||
object->videosystem=ntsc;
|
object->videosystem=ntsc;
|
||||||
}
|
}
|
||||||
if (joystick1<5) {
|
if (joystick1<6) {
|
||||||
object->joystick[0]=joystick1;
|
object->joystick[0]=joystick1;
|
||||||
}
|
}
|
||||||
if (joystick2<5) {
|
if (joystick2<6) {
|
||||||
object->joystick[1]=joystick2;
|
object->joystick[1]=joystick2;
|
||||||
}
|
}
|
||||||
if (ay_emul<2) {
|
if (ay_emul<2) {
|
||||||
object->ay_emul=ay_emul;
|
object->ay_emul=ay_emul;
|
||||||
}
|
}
|
||||||
|
if (fuller_box_sound<2) {
|
||||||
|
object->fuller_box_sound=fuller_box_sound;
|
||||||
|
}
|
||||||
if (audio_mode<4) {
|
if (audio_mode<4) {
|
||||||
object->audio_mode=audio_mode;
|
object->audio_mode=audio_mode;
|
||||||
}
|
}
|
||||||
|
@ -117,11 +117,14 @@ static const char *audio_messages[] = {
|
|||||||
/*03*/ "AY-3-8912 Emulation",
|
/*03*/ "AY-3-8912 Emulation",
|
||||||
/*04*/ "^|on|off",
|
/*04*/ "^|on|off",
|
||||||
/*05*/ " ",
|
/*05*/ " ",
|
||||||
/*06*/ "Audio mode",
|
/*06*/ "Fuller Box Audio",
|
||||||
/*07*/ "^|mono|ABC|ACB|BAC",
|
/*07*/ "^|on|off",
|
||||||
/*08*/ " ",
|
/*08*/ " ",
|
||||||
/*09*/ "Gui sound",
|
/*09*/ "Audio mode",
|
||||||
/*10*/ "^|on|off",
|
/*10*/ "^|mono|ABC|ACB|BAC",
|
||||||
|
/*11*/ " ",
|
||||||
|
/*12*/ "Gui sound",
|
||||||
|
/*13*/ "^|on|off",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,7 +145,7 @@ static const char *screen_messages[] = {
|
|||||||
|
|
||||||
static const char *input_messages[] = {
|
static const char *input_messages[] = {
|
||||||
/*00*/ "Joystick type",
|
/*00*/ "Joystick type",
|
||||||
/*01*/ "^|Cursor|Kempston|Sincl1|Sincl2|QAOP",
|
/*01*/ "^|Curs|Kemps|Sincl1|Sincl2|Fuller|QAOP",
|
||||||
/*02*/ "Bind key to Wiimote",
|
/*02*/ "Bind key to Wiimote",
|
||||||
/*03*/ "^|A|B|1|2|-|+",
|
/*03*/ "^|A|B|1|2|-|+",
|
||||||
/*04*/ "Bind key to Nunchuk",
|
/*04*/ "Bind key to Nunchuk",
|
||||||
@ -697,7 +700,7 @@ static void tape_settings(void)
|
|||||||
|
|
||||||
static void audio_settings(void)
|
static void audio_settings(void)
|
||||||
{
|
{
|
||||||
unsigned int submenus[4];
|
unsigned int submenus[5];
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
|
|
||||||
@ -706,8 +709,9 @@ static void audio_settings(void)
|
|||||||
|
|
||||||
submenus[0] = ordenador.volume/2;
|
submenus[0] = ordenador.volume/2;
|
||||||
submenus[1] = !ordenador.ay_emul;
|
submenus[1] = !ordenador.ay_emul;
|
||||||
submenus[2] = ordenador.audio_mode;
|
submenus[2] = !ordenador.fuller_box_sound;
|
||||||
submenus[3] = !ordenador.gui_sound;
|
submenus[3] = ordenador.audio_mode;
|
||||||
|
submenus[4] = !ordenador.gui_sound;
|
||||||
|
|
||||||
opt = menu_select_title("Audio settings",
|
opt = menu_select_title("Audio settings",
|
||||||
audio_messages, submenus);
|
audio_messages, submenus);
|
||||||
@ -717,8 +721,9 @@ static void audio_settings(void)
|
|||||||
|
|
||||||
ordenador.volume = submenus[0]*2;
|
ordenador.volume = submenus[0]*2;
|
||||||
ordenador.ay_emul = !submenus[1];
|
ordenador.ay_emul = !submenus[1];
|
||||||
ordenador.audio_mode = submenus[2];
|
ordenador.fuller_box_sound = !submenus[2];
|
||||||
ordenador.gui_sound = !submenus[3];
|
ordenador.audio_mode = submenus[3];
|
||||||
|
ordenador.gui_sound = !submenus[4];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ inline void play_ay (unsigned int tstados) {
|
|||||||
0x92, 0xAF, 0xD9, 0xFF
|
0x92, 0xAF, 0xD9, 0xFF
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((!ordenador.ay_emul)||(ordenador.turbo_state))
|
if ((!(ordenador.ay_emul||ordenador.fuller_box_sound))||ordenador.turbo_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ordenador.tst_ay += tstados;
|
ordenador.tst_ay += tstados;
|
||||||
@ -330,7 +330,7 @@ inline void play_sound (unsigned int tstados) {
|
|||||||
|
|
||||||
//Each channel max 256*vol
|
//Each channel max 256*vol
|
||||||
|
|
||||||
if ((ordenador.ay_emul)&&(!ordenador.turbo_state))
|
if ((ordenador.ay_emul||ordenador.fuller_box_sound)&&(!ordenador.turbo_state))
|
||||||
{
|
{
|
||||||
switch (ordenador.audio_mode)
|
switch (ordenador.audio_mode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user