mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
hint-less mode updated for SVP, state load callback, etc
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@384 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
71bb1b7bd0
commit
fad248933b
11 changed files with 86 additions and 19 deletions
10
Pico/Area.c
10
Pico/Area.c
|
@ -28,6 +28,8 @@ areaeof *areaEof = (areaeof *) 0;
|
|||
areaseek *areaSeek = (areaseek *) 0;
|
||||
areaclose *areaClose = (areaclose *) 0;
|
||||
|
||||
void (*PicoLoadStateHook)(void) = NULL;
|
||||
|
||||
|
||||
// Scan one variable and callback
|
||||
static int ScanVar(void *data,int len,char *name,void *PmovFile,int PmovAction)
|
||||
|
@ -177,7 +179,11 @@ int PmovState(int PmovAction, void *PmovFile)
|
|||
if ((PicoMCD & 1) || carthw_chunks != NULL)
|
||||
{
|
||||
if (PmovAction&1) return PicoCdSaveState(PmovFile);
|
||||
if (PmovAction&2) return PicoCdLoadState(PmovFile);
|
||||
if (PmovAction&2) {
|
||||
int ret = PicoCdLoadState(PmovFile);
|
||||
if (PicoLoadStateHook) PicoLoadStateHook();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
memset(head,0,sizeof(head));
|
||||
|
@ -197,6 +203,8 @@ int PmovState(int PmovAction, void *PmovFile)
|
|||
// Scan memory areas:
|
||||
PicoAreaScan(PmovAction, *(unsigned int *)(head+0x8), PmovFile);
|
||||
|
||||
if ((PmovAction&2) && PicoLoadStateHook) PicoLoadStateHook();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -504,6 +504,7 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize)
|
|||
PicoDmaHook = NULL;
|
||||
PicoResetHook = NULL;
|
||||
PicoLineHook = NULL;
|
||||
PicoLoadStateHook = NULL;
|
||||
carthw_chunks = NULL;
|
||||
|
||||
PicoMemReset();
|
||||
|
|
22
Pico/Pico.c
22
Pico/Pico.c
|
@ -244,12 +244,12 @@ static __inline void SekStep(void)
|
|||
|
||||
static int CheckIdle(void)
|
||||
{
|
||||
int i, state[0x22];
|
||||
int i, state[0x24];
|
||||
|
||||
// See if the state is the same after 2 steps:
|
||||
SekState(state); SekStep(); SekStep(); SekState(state+0x11);
|
||||
for (i = 0x10; i >= 0; i--)
|
||||
if (state[i] != state[i+0x11]) return 0;
|
||||
SekState(state); SekStep(); SekStep(); SekState(state+0x12);
|
||||
for (i = 0x11; i >= 0; i--)
|
||||
if (state[i] != state[i+0x12]) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -344,6 +344,10 @@ static int PicoFrameSimple(void)
|
|||
lines_step = 14;
|
||||
}
|
||||
|
||||
// a hack for VR, to get it running in fast mode
|
||||
if (PicoRead16Hook == PicoSVPRead16)
|
||||
Pico.ram[0xd864^1] = 0x1a;
|
||||
|
||||
// we don't emulate DMA timing in this mode
|
||||
if (Pico.m.dma_xfers) {
|
||||
Pico.m.dma_xfers=0;
|
||||
|
@ -391,10 +395,19 @@ static int PicoFrameSimple(void)
|
|||
if (PicoLineHook) PicoLineHook(sects*lines_step);
|
||||
}
|
||||
|
||||
// another hack for VR (it needs hints to work)
|
||||
if (PicoRead16Hook == PicoSVPRead16) {
|
||||
Pico.ram[0xd864^1] = 1;
|
||||
pv->pending_ints|=0x10;
|
||||
if (pv->reg[0]&0x10) SekInterrupt(4);
|
||||
SekRunM68k(160);
|
||||
}
|
||||
|
||||
// render screen
|
||||
if (!PicoSkipFrame)
|
||||
{
|
||||
if (!(PicoOpt&0x10))
|
||||
{
|
||||
// Draw the screen
|
||||
#if CAN_HANDLE_240_LINES
|
||||
if (pv->reg[1]&8) {
|
||||
|
@ -405,6 +418,7 @@ static int PicoFrameSimple(void)
|
|||
#else
|
||||
for (y=0;y<224;y++) PicoLine(y);
|
||||
#endif
|
||||
}
|
||||
else PicoFrameFull();
|
||||
#ifdef DRAW_FINISH_FUNC
|
||||
DRAW_FINISH_FUNC();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// common code for Pico.c and cd/Pico.c
|
||||
// (c) Copyright 2007, Grazvydas "notaz" Ignotas
|
||||
// (c) Copyright 2007,2008 Grazvydas "notaz" Ignotas
|
||||
|
||||
#define CYCLES_M68K_LINE 488 // suitable for both PAL/NTSC
|
||||
#define CYCLES_M68K_VINT_LAG 68
|
||||
|
@ -60,7 +60,7 @@ static int PicoFrameHints(void)
|
|||
int lines, y, lines_vis = 224, total_z80 = 0, z80CycleAim = 0, line_sample, skip;
|
||||
int hint; // Hint counter
|
||||
|
||||
if ((PicoOpt&0x10) && !PicoSkipFrame) {
|
||||
if ((PicoOpt&0x10) && !PicoSkipFrame && (pv->reg[1]&0x40)) { // fast rend., display enabled
|
||||
// draw a frame just after vblank in alternative render mode
|
||||
// yes, this will cause 1 frame lag, but this is inaccurate mode anyway.
|
||||
PicoFrameFull();
|
||||
|
@ -125,21 +125,37 @@ static int PicoFrameHints(void)
|
|||
}
|
||||
|
||||
// decide if we draw this line
|
||||
#if CAN_HANDLE_240_LINES
|
||||
if(!skip && ((!(pv->reg[1]&8) && y<224) || (pv->reg[1]&8)) )
|
||||
#else
|
||||
if(!skip && y<224)
|
||||
if (!skip)
|
||||
{
|
||||
if (PicoOpt&0x10) {
|
||||
// find the right moment for fast renderer, when display is no longer blanked
|
||||
if ((pv->reg[1]&0x40) || y > 100) {
|
||||
PicoFrameFull();
|
||||
#ifdef DRAW_FINISH_FUNC
|
||||
DRAW_FINISH_FUNC();
|
||||
#endif
|
||||
PicoLine(y);
|
||||
skip = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if CAN_HANDLE_240_LINES
|
||||
if (((!(pv->reg[1]&8) && y < 224) || (pv->reg[1]&8)) )
|
||||
#else
|
||||
if (y < 224)
|
||||
#endif
|
||||
PicoLine(y);
|
||||
}
|
||||
}
|
||||
|
||||
if(PicoOpt&1)
|
||||
if (PicoOpt&1)
|
||||
Psnd_timers_and_dac(y);
|
||||
|
||||
#ifndef PICO_CD
|
||||
// get samples from sound chips
|
||||
if(y == 32 && PsndOut)
|
||||
if (y == 32 && PsndOut)
|
||||
emustatus &= ~1;
|
||||
else if((y == 224 || y == line_sample) && PsndOut)
|
||||
else if ((y == 224 || y == line_sample) && PsndOut)
|
||||
getSamples(y);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -362,6 +362,7 @@ typedef struct
|
|||
// Area.c
|
||||
PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub);
|
||||
PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub);
|
||||
extern void (*PicoLoadStateHook)(void);
|
||||
|
||||
// cd/Area.c
|
||||
PICO_INTERNAL int PicoCdSaveState(void *file);
|
||||
|
|
|
@ -170,12 +170,15 @@ PICO_INTERNAL void SekState(int *data)
|
|||
{
|
||||
#ifdef EMU_C68K
|
||||
memcpy32(data,(int *)PicoCpuCM68k.d,0x44/4);
|
||||
data[0x11] = PicoCpuCM68k.flags;
|
||||
#elif defined(EMU_M68K)
|
||||
memcpy32(data, (int *)PicoCpuMM68k.dar, 0x40/4);
|
||||
data[0x10] = PicoCpuMM68k.pc;
|
||||
data[0x11] = m68k_get_reg(&PicoCpuMM68k, M68K_REG_SR);
|
||||
#elif defined(EMU_F68K)
|
||||
memcpy32(data, (int *)PicoCpuFM68k.dreg, 0x40/4);
|
||||
data[0x10] = PicoCpuFM68k.pc;
|
||||
data[0x11] = PicoCpuFM68k.sr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
|
|||
else if(pints & 0x10) irq = 4;
|
||||
SekInterrupt(irq); // update line
|
||||
|
||||
if (irq) SekEndRun(24); // make it delayed
|
||||
if (irq && Pico.m.scanline!=-1) SekEndRun(24); // make it delayed
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1629,6 +1629,12 @@ void *ssp_translate_block(int pc)
|
|||
|
||||
// -----------------------------------------------------
|
||||
|
||||
static void ssp1601_state_load(void)
|
||||
{
|
||||
ssp->drc.iram_dirty = 1;
|
||||
ssp->drc.iram_context = 0;
|
||||
}
|
||||
|
||||
int ssp1601_dyn_startup(void)
|
||||
{
|
||||
memset(tcache, 0, TCACHE_SIZE);
|
||||
|
@ -1637,6 +1643,8 @@ int ssp1601_dyn_startup(void)
|
|||
tcache_ptr = tcache;
|
||||
*tcache_ptr++ = 0xffffffff;
|
||||
|
||||
PicoLoadStateHook = ssp1601_state_load;
|
||||
|
||||
#ifdef ARM
|
||||
// hle'd blocks
|
||||
block_table[0x400] = (void *) ssp_hle_800;
|
||||
|
@ -1664,6 +1672,11 @@ void ssp1601_dyn_run(int cycles)
|
|||
{
|
||||
if (ssp->emu_status & SSP_WAIT_MASK) return;
|
||||
|
||||
#ifdef DUMP_BLOCK
|
||||
ssp_translate_block(DUMP_BLOCK >> 1);
|
||||
#endif
|
||||
#ifdef ARM
|
||||
ssp_drc_entry(cycles);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,9 @@ static void emit_block_epilogue(int cycles)
|
|||
{
|
||||
if (cycles > 0xff) { printf("large cycle count: %i\n", cycles); cycles = 0xff; }
|
||||
EOP_SUB_IMM(11,11,0,cycles); // sub r11, r11, #cycles
|
||||
#ifdef ARM
|
||||
emit_call(ssp_drc_next);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void emit_pc_dump(int pc)
|
||||
|
|
|
@ -291,7 +291,8 @@ static void blit(const char *fps, const char *notice)
|
|||
{
|
||||
int emu_opt = currentConfig.EmuOpt;
|
||||
|
||||
if (PicoOpt&0x10) {
|
||||
if (PicoOpt&0x10)
|
||||
{
|
||||
// 8bit fast renderer
|
||||
if (Pico.m.dirtyPal) {
|
||||
Pico.m.dirtyPal = 0;
|
||||
|
@ -299,8 +300,14 @@ static void blit(const char *fps, const char *notice)
|
|||
// feed new palette to our device
|
||||
gp2x_video_setpalette(localPal, 0x40);
|
||||
}
|
||||
// a hack for VR
|
||||
if (PicoRead16Hook == PicoSVPRead16)
|
||||
memset32((int *)(PicoDraw2FB+328*8+328*223), 0xe0e0e0e0, 328);
|
||||
// do actual copy
|
||||
vidCpyM2((unsigned char *)gp2x_screen+320*8, PicoDraw2FB+328*8);
|
||||
} else if (!(emu_opt&0x80)) {
|
||||
}
|
||||
else if (!(emu_opt&0x80))
|
||||
{
|
||||
// 8bit accurate renderer
|
||||
if (Pico.m.dirtyPal) {
|
||||
Pico.m.dirtyPal = 0;
|
||||
|
|
|
@ -96,7 +96,9 @@ PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
|
|||
mkdirs:
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
Pico/carthw/svp/compiler.o : Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c
|
||||
Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/gen_arm.c
|
||||
|
||||
Pico/Pico.o : ../../Pico/PicoFrameHints.c
|
||||
|
||||
../../cpu/musashi/m68kops.c :
|
||||
@make -C ../../cpu/musashi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue