- [FIX] La CPU del macbook air ja no es fica a quasi 100º durant la emulació (aplicada arquitectura del emu de gameboy per a resoldre-ho), pero encara ho fà en GUI (mirar si en gameboy GUI també)
This commit is contained in:
@@ -168,9 +168,9 @@ int main(int argc, char *argv[])
|
||||
z80debug::init();
|
||||
|
||||
//uint32_t update_freq =
|
||||
zx_system::init(ZX_48K);
|
||||
zx_system::init(ZX_128K);
|
||||
gamepad::init();
|
||||
zx_tape::load("ROBOCOP1.TAP");
|
||||
zx_tape::load("robocop.tap");
|
||||
|
||||
//if (argc==3) { z80debug::loadngo(argv[1], argv[2]); }
|
||||
|
||||
@@ -182,8 +182,10 @@ int main(int argc, char *argv[])
|
||||
t_states = 0;
|
||||
bool first_time = true;
|
||||
|
||||
uint8_t wait = 125;
|
||||
while (!zx_system::shuttingDown())
|
||||
{
|
||||
if (wait==0) {
|
||||
while (SDL_PollEvent(&e))
|
||||
{
|
||||
bool result = true;
|
||||
@@ -271,12 +273,13 @@ int main(int argc, char *argv[])
|
||||
if (!result)
|
||||
zx_system::shutdown(); break;
|
||||
}
|
||||
}
|
||||
|
||||
first_time = false;
|
||||
if (!z80debug::debugging() && !z80debug::paused()) {
|
||||
|
||||
// En cada bucle fem 10 pasos de la CPU, sino s'ofega (jo en veig 5)
|
||||
for (int i=0;i<5;++i) {
|
||||
//for (int i=0;i<5;++i) {
|
||||
if (z80debug::isbreak(z80::getPC(), 9)) {
|
||||
z80debug::stop();
|
||||
zxscreen::redraw();
|
||||
@@ -288,9 +291,14 @@ int main(int argc, char *argv[])
|
||||
zxscreen::refresh(dt);
|
||||
if (z80debug::debugging()) break;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
uint32_t update_freq = z80::getClock()/10;
|
||||
/*if (SDL_GetTicks()>=time+100) {
|
||||
time = SDL_GetTicks();
|
||||
z80analyze::refresh();
|
||||
z80viewer::refreshAll();
|
||||
}*/
|
||||
/*uint32_t update_freq = z80::getClock()/10;
|
||||
if (t_states>=update_freq)
|
||||
{
|
||||
// Esperem a que es compleixca el temps corresponent als t states executats
|
||||
@@ -300,8 +308,8 @@ int main(int argc, char *argv[])
|
||||
time = SDL_GetTicks();
|
||||
z80analyze::refresh();
|
||||
z80viewer::refreshAll();
|
||||
}
|
||||
z80analyze::refresh(true);
|
||||
}*/
|
||||
//z80analyze::refresh(true);
|
||||
|
||||
|
||||
} else if (z80debug::paused()) {
|
||||
@@ -314,7 +322,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
zxscreen::present();
|
||||
}
|
||||
ui::setClicked(false);
|
||||
|
||||
if (wait == 0) {
|
||||
ui::setClicked(false);
|
||||
wait = 125;
|
||||
} else {
|
||||
wait--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+3
-2
@@ -22,11 +22,12 @@ namespace speaker
|
||||
sampling_freq = freq;
|
||||
audio_buffer_size = buffer_size;
|
||||
|
||||
SDL_AudioSpec audioSpec{sampling_freq, AUDIO_U8, 1, 0, (uint16_t)(audio_buffer_size>>2), 0, 0, NULL, NULL};
|
||||
SDL_AudioSpec audioSpec{sampling_freq, AUDIO_U8, 1, 0, (uint16_t)(audio_buffer_size), 0, 0, NULL, NULL};
|
||||
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
|
||||
|
||||
cycles_per_sample = z80::getClock() / sampling_freq;
|
||||
sound_buffer = (uint8_t*)malloc(audio_buffer_size);
|
||||
SDL_QueueAudio(sdlAudioDevice, sound_buffer, 2000);
|
||||
|
||||
enable();
|
||||
}
|
||||
@@ -75,7 +76,7 @@ namespace speaker
|
||||
if (sound_pos>=1000) {
|
||||
SDL_QueueAudio(sdlAudioDevice, sound_buffer, sound_pos);
|
||||
sound_pos = 0;
|
||||
while (SDL_GetQueuedAudioSize(sdlAudioDevice) > (audio_buffer_size<<1) ) {}
|
||||
while (SDL_GetQueuedAudioSize(sdlAudioDevice) > 4096 ) { SDL_Delay(1); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user