- [NEW] Dialeg per a configurar els joysticks

This commit is contained in:
2025-08-16 10:09:42 +02:00
parent 864c6b929d
commit 8201d51668
9 changed files with 170 additions and 38 deletions

View File

@@ -22,6 +22,7 @@
#include "ay_viewer.h"
#include "file.h"
#include "gamepad.h"
#include "zx_dialog_joystick.h"
uint32_t time = 0;
uint32_t t_states = 0;
@@ -165,6 +166,7 @@ int main(int argc, char *argv[])
time = SDL_GetTicks();
t_states = 0;
bool first_time = true;
while (!zx_system::shuttingDown())
{
@@ -174,8 +176,10 @@ int main(int argc, char *argv[])
if (e.type == SDL_QUIT) { zx_system::shutdown(); break; }
if (e.type == SDL_JOYDEVICEADDED) {
gamepad::add(e.jdevice.which, GAMEPAD_TYPE_ANY);
const uint8_t index = gamepad::add(e.jdevice.which, GAMEPAD_TYPE_ANY);
printf("JOYSTICK CONECTAT: %i\n", e.jdevice.which);
//if (!first_time)
dialogs::joysticks::init(index);
// [TODO] Mostrar dialeg de triar tipus de joystick
}
if (e.type == SDL_JOYDEVICEREMOVED) {
@@ -253,26 +257,8 @@ int main(int argc, char *argv[])
zx_system::shutdown(); break;
}
first_time = false;
if (!z80debug::debugging() && !z80debug::paused()) {
/*
//if (z80::getPC()==0x05C8) zx_tape::go_berserk();
bool fastload=false;
if (zx_tape::getplaying() && zx_tape::getOption(ZXTAPE_OPTION_FAST_LOAD)) { fastload=true; time = SDL_GetTicks(); }
while (zx_tape::getplaying() && zx_tape::getOption(ZXTAPE_OPTION_FAST_LOAD))
{
// zx_tape::update(z80::step());
uint8_t dt = z80::step();
t_states += dt;
zx_tape::update(dt);
if (SDL_GetTicks()-time>=1000) {
time = SDL_GetTicks();
zx_tape::report();
}
//speaker::update(dt);
//zxscreen::refresh(dt);
}
if (fastload) { printf("%i\n", SDL_GetTicks()-time); t_states=0; }
*/
// En cada bucle fem 10 pasos de la CPU, sino s'ofega (jo en veig 5)
for (int i=0;i<5;++i) {
@@ -284,9 +270,6 @@ int main(int argc, char *argv[])
uint8_t dt = z80::step();
t_states += dt;
zx_system::update(dt);
//zx_tape::update(dt);
//audio::update(dt);
//speaker::update(dt);
zxscreen::refresh(dt);
if (z80debug::debugging()) break;
}
@@ -306,9 +289,14 @@ int main(int argc, char *argv[])
z80analyze::refresh(true);
} else if (/*!z80debug::debugging() &&*/ z80debug::paused()) {
} else if (z80debug::paused()) {
zxscreen::redraw(false);
ui::menu::show();
if (ui::hasDialog())
ui::callDialog();
else
ui::menu::show();
zxscreen::present();
}
ui::setClicked(false);