- [CHG] Més neteja de basura
- [FIX] Intentant arreglar un "pop" que fa el só al inici, he descobert que no fa falta més sincronització que la del àudio! - [CHG] De fet, ara en compte de fer 20 cicles de cpu cada iteració, faig un cicle per iteració i nomes refresque events cada 125ms. No detecte canvis, pero seria molt més net. A vore que tal. - [NEW] Comence la classe directora "gameboy"
This commit is contained in:
+17
-11
@@ -108,9 +108,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
time = SDL_GetTicks();
|
||||
t_states = 0;
|
||||
|
||||
uint8_t wait = 125;
|
||||
while (!should_exit)
|
||||
{
|
||||
if (wait==0) {
|
||||
while (SDL_PollEvent(&e))
|
||||
{
|
||||
bool result = true;
|
||||
@@ -175,10 +176,11 @@ int main(int argc, char *argv[])
|
||||
if (!result)
|
||||
should_exit = true; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!debug::debugging() && !debug::paused()) {
|
||||
// En cada pas de bucle fem 10 pasos de la CPU, sino s'ofega
|
||||
for (int i=0;i<20;++i) {
|
||||
//for (int i=0;i<20;++i) {
|
||||
if (debug::isbreak(sm83::getPC(), 9)) {
|
||||
debug::stop();
|
||||
display::redraw();
|
||||
@@ -186,11 +188,10 @@ int main(int argc, char *argv[])
|
||||
} else {
|
||||
uint8_t dt = sm83::step();
|
||||
t_states += dt;
|
||||
//zx_ula::sound_update(dt);
|
||||
ppu::refresh(dt);
|
||||
if (debug::debugging()) break;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// Sincronització:
|
||||
// la frequència del rellotge diu quants t_states pot executar per segon.
|
||||
@@ -198,12 +199,12 @@ int main(int argc, char *argv[])
|
||||
// pot executar cada 125 ms. Ací comprobem si ja havem executat eixe nombre
|
||||
// de t_states i, si ho havem fet, esperem fins que passen 125ms des de l'ultima
|
||||
// vegada que ho comprobarem.
|
||||
if (t_states>=update_freq)
|
||||
{
|
||||
while (SDL_GetTicks()<(time+125)) {}
|
||||
t_states -= update_freq;
|
||||
time = SDL_GetTicks();
|
||||
}
|
||||
//if (t_states>=update_freq)
|
||||
//{
|
||||
// while (SDL_GetTicks()<(time+125)) {}
|
||||
// t_states -= update_freq;
|
||||
// time = SDL_GetTicks();
|
||||
//}
|
||||
|
||||
|
||||
} else if (!debug::debugging() && debug::paused()) {
|
||||
@@ -211,7 +212,12 @@ int main(int argc, char *argv[])
|
||||
ui::menu::show();
|
||||
display::present();
|
||||
}
|
||||
ui::setClicked(false);
|
||||
if (wait == 0) {
|
||||
ui::setClicked(false);
|
||||
wait = 125;
|
||||
} else {
|
||||
wait--;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user