update core

This commit is contained in:
Logan McNaughton committed 2022-07-07 21:21:41 -06:00
1 parent 065dcf862d
commit 2c66817981
7 files changed
+33 -3

No files matched your search

+1 -1
View File
@@ -190,7 +190,7 @@ void init_device(struct device* dev,
&dev->mi, &dev->ri, &dev->dp);
init_ri(&dev->ri, &dev->rdram);
init_si(&dev->si, si_dma_duration, &dev->mi, &dev->pif, &dev->ri);
init_vi(&dev->vi, vi_clock, expected_refresh_rate, &dev->mi, &dev->dp);
init_vi(&dev->vi, vi_clock, expected_refresh_rate, &dev->mi, &dev->dp, &dev->si);
/* FIXME: should boot on cart, unless only a disk is present, but having no cart is not yet supported by ui/core,
* so use another way of selecting boot device:
+2
View File
@@ -144,6 +144,7 @@ void init_pif(struct pif* pif,
pif->r4300 = r4300;
pif->si = si;
pif->update_counter = 0;
}
void reset_pif(struct pif* pif, unsigned int reset_type)
@@ -380,6 +381,7 @@ void update_pif_ram(struct pif* pif)
if (input.readController) {
input.readController(-1, NULL);
}
++pif->update_counter;
netplay_update_input(pif);
+2
View File
@@ -59,6 +59,8 @@ struct pif
struct cic cic;
uint32_t update_counter;
struct r4300_core* r4300;
struct si_controller* si;
};
@@ -175,3 +175,24 @@ void si_end_of_dma_event(void* opaque)
raise_rcp_interrupt(si->mi, MI_INTR_SI);
}
void si_dynamic_dma_duration(struct si_controller* si)
{
uint32_t input_updated = 0;
for (int i = 0; i < 4; ++i)
{
if (si->pif->channels[i].tx)
{
input_updated = 1;
}
}
if (input_updated)
{
/* try to keep controller polling to 1-2 per VI */
if (si->pif->update_counter > 2)
si->dma_duration += 1000;
else if (si->pif->update_counter < 1 && si->dma_duration > 1000)
si->dma_duration -= 1000;
}
si->pif->update_counter = 0;
}
@@ -89,4 +89,6 @@ void write_si_regs(void* opaque, uint32_t address, uint32_t value, uint32_t mask
void si_end_of_dma_event(void* opaque);
void si_dynamic_dma_duration(struct si_controller* si);
#endif
@@ -67,12 +67,13 @@ void set_vi_vertical_interrupt(struct vi_controller* vi)
}
void init_vi(struct vi_controller* vi, unsigned int clock, unsigned int expected_refresh_rate,
struct mi_controller* mi, struct rdp_core* dp)
struct mi_controller* mi, struct rdp_core* dp, struct si_controller* si)
{
vi->clock = clock;
vi->expected_refresh_rate = expected_refresh_rate;
vi->mi = mi;
vi->dp = dp;
vi->si = si;
}
void poweron_vi(struct vi_controller* vi)
@@ -164,6 +165,7 @@ void vi_vertical_interrupt_event(void* opaque)
/* allow main module to do things on VI event */
new_vi();
si_dynamic_dma_duration(vi->si);
/* toggle vi field if in interlaced mode */
vi->field ^= (vi->regs[VI_STATUS_REG] >> 6) & 0x1;
@@ -60,6 +60,7 @@ struct vi_controller
struct mi_controller* mi;
struct rdp_core* dp;
struct si_controller* si;
};
static osal_inline uint32_t vi_reg(uint32_t address)
@@ -73,7 +74,7 @@ unsigned int vi_expected_refresh_rate_from_tv_standard(m64p_system_type tv_stand
void set_vi_vertical_interrupt(struct vi_controller* vi);
void init_vi(struct vi_controller* vi, unsigned int clock, unsigned int expected_refresh_rate,
struct mi_controller* mi, struct rdp_core* dp);
struct mi_controller* mi, struct rdp_core* dp, struct si_controller* si);
void poweron_vi(struct vi_controller* vi);