From: notaz Date: Tue, 1 Jul 2008 14:32:09 +0000 (+0000) Subject: nonacc mode removal, function return value audit X-Git-Tag: v1.85~452 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2aa27095f2dbf5b38950fcb1f856d5ffc6a70361;p=picodrive.git nonacc mode removal, function return value audit git-svn-id: file:///home/notaz/opt/svn/PicoDrive@510 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Area.c b/Pico/Area.c index 040154ed..49c2afcd 100644 --- a/Pico/Area.c +++ b/Pico/Area.c @@ -44,7 +44,7 @@ static int ScanVar(void *data,int len,char *name,void *PmovFile,int PmovAction) #define SCANP(x) ScanVar(&Pico.x,sizeof(Pico.x),#x,PmovFile,PmovAction); // Pack the cpu into a common format: -PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub) +PICO_INTERNAL void PicoAreaPackCpu(unsigned char *cpu, int is_sub) { unsigned int pc=0; @@ -77,10 +77,9 @@ PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub) #endif *(unsigned int *)(cpu+0x40)=pc; - return 0; } -PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub) +PICO_INTERNAL void PicoAreaUnpackCpu(unsigned char *cpu, int is_sub) { #if defined(EMU_C68K) struct Cyclone *context = is_sub ? &PicoCpuCS68k : &PicoCpuCM68k; @@ -113,7 +112,6 @@ PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub) context->execinfo &= ~FM68K_HALTED; if (cpu[0x4d]&1) context->execinfo |= FM68K_HALTED; #endif - return 0; } // Scan the contents of the virtual machine's memory for saving or loading diff --git a/Pico/Cart.c b/Pico/Cart.c index e65b509b..de340a11 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -545,14 +545,13 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize) return 0; } -int PicoCartUnload(void) +void PicoCartUnload(void) { if (Pico.rom != NULL) { SekFinishIdleDet(); free(Pico.rom); Pico.rom=NULL; } - return 0; } static int rom_strcmp(int rom_offset, const char *s1) diff --git a/Pico/Memory.c b/Pico/Memory.c index 88e3a322..22bd7ad4 100644 --- a/Pico/Memory.c +++ b/Pico/Memory.c @@ -89,10 +89,9 @@ PICO_INTERNAL u32 PicoCheckPc(u32 pc) } -PICO_INTERNAL int PicoInitPc(u32 pc) +PICO_INTERNAL void PicoInitPc(u32 pc) { PicoCheckPc(pc); - return 0; } #ifndef _ASM_MEMORY_C @@ -689,8 +688,6 @@ static void m68k_mem_setup(void) // ----------------------------------------------------------------- -extern const unsigned short vcounts[]; - static int get_scanline(int is_from_z80) { if (is_from_z80) { @@ -700,10 +697,7 @@ static int get_scanline(int is_from_z80) return z80_scanline; } - if (Pico.m.scanline != -1) - return Pico.m.scanline; - - return vcounts[SekCyclesDone()>>8]; + return Pico.m.scanline; } /* probably not should be in this file, but it's near related code here */ diff --git a/Pico/MemoryCmn.c b/Pico/MemoryCmn.c index 1b8a1b91..dee031d5 100644 --- a/Pico/MemoryCmn.c +++ b/Pico/MemoryCmn.c @@ -46,7 +46,7 @@ static u32 z80ReadBusReq(void) { u32 d=Pico.m.z80Run&1; - if (!d && Pico.m.scanline != -1) { + if (!d) { // needed by buggy Terminator (Sega CD) int stop_before = SekCyclesDone() - z80stopCycle; //elprintf(EL_BUSREQ, "get_zrun: stop before: %i", stop_before); @@ -55,7 +55,7 @@ u32 z80ReadBusReq(void) if (stop_before > 0 && stop_before < 20) // Gens uses 16 here d = 1; // bus not yet available } - // |=0x80 for Shadow of the Beast & Super Offroad + elprintf(EL_BUSREQ, "get_zrun: %02x [%i] @%06x", d|0x80, SekCyclesDone(), SekPc); return d|0x80; } diff --git a/Pico/Misc.c b/Pico/Misc.c index f21c5111..944e4c86 100644 --- a/Pico/Misc.c +++ b/Pico/Misc.c @@ -85,48 +85,6 @@ const unsigned char hcounts_32[] = { 0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d, }; -// vcounter values for PicoFrameSimple -const unsigned short vcounts[] = { - 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, - 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, - 16, 17, 17, 18, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 24, - 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, - 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, - 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, - 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, - 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, - 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 73, 74, 74, 75, - 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 83, 83, - 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, - 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99,100, -100,101,101,102,102,103,104,104,105,105,106,106,107,107,108,108, -109,109,110,110,111,111,112,112,113,114,114,115,115,116,116,117, -117,118,118,119,119,120,120,121,121,122,122,123,124,124,125,125, -126,126,127,127,128,128,129,129,130,130,131,131,132,132,133,133, -134,135,135,136,136,137,137,138,138,139,139,140,140,141,141,142, -142,143,143,144,145,145,146,146,147,147,148,148,149,149,150,150, -151,151,152,152,153,153,154,155,155,156,156,157,157,158,158,159, -159,160,160,161,161,162,162,163,163,164,164,165,166,166,167,167, -168,168,169,169,170,170,171,171,172,172,173,173,174,174,175,176, -176,177,177,178,178,179,179,180,180,181,181,182,182,183,183,184, -184,185,186,186,187,187,188,188,189,189,190,190,191,191,192,192, -193,193,194,194,195,195,196,197,197,198,198,199,199,200,200,201, -201,202,202,203,203,204,204,205,205,206,207,207,208,208,209,209, -210,210,211,211,212,212,213,213,214,214,215,215,216,217,217,218, -218,219,219,220,220,221,221,222,222,223,223,224,224,225,225,226, -226,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234, -235,235,236,236,237,238,238,239,239,240,240,241,241,242,242,243, -243,244,244,245,245,246,246,247,248,248,249,249,250,250,251,251, -252,252,253,253,254,254,255,255,256,256,257,257,258,259,259,260, -260,261,261,262,262,263,263,264,264,265,265,266,266,267,267,268, -269,269,270,270,271,271,272,272,273,273,274,274,275,275,276,276, -277,277,278,279,279,280,280,281,281,282,282,283,283,284,284,285, -285,286,286,287,287,288,288,289,290,290,291,291,292,292,293,293, -294,294,295,295,296,296,297,297,298,298,299,300,300,301,301,302, -302,303,303,304,304,305,305,306,306,307,307,308,308,309,310,310, -311,311,311,311, -}; - // rarely used EEPROM SRAM code // known games which use this: diff --git a/Pico/Pico.c b/Pico/Pico.c index 58c1a354..c85c78a2 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -26,7 +26,7 @@ void (*PicoResetHook)(void) = NULL; void (*PicoLineHook)(int count) = NULL; // to be called once on emu init -int PicoInit(void) +void PicoInit(void) { // Blank space for state: memset(&Pico,0,sizeof(Pico)); @@ -40,8 +40,6 @@ int PicoInit(void) PicoSVPInit(); SRam.data=0; - - return 0; } // to be called once on emu exit @@ -255,36 +253,6 @@ static __inline void SekRunM68k(int cyc) #endif } -static __inline void SekStep(void) -{ - // this is required for timing sensitive stuff to work - int realaim=SekCycleAim; SekCycleAim=SekCycleCnt+1; -#if defined(EMU_CORE_DEBUG) - SekCycleCnt+=CM_compareRun(1, 0); -#elif defined(EMU_C68K) - PicoCpuCM68k.cycles=1; - CycloneRun(&PicoCpuCM68k); - SekCycleCnt+=1-PicoCpuCM68k.cycles; -#elif defined(EMU_M68K) - SekCycleCnt+=m68k_execute(1); -#elif defined(EMU_F68K) - SekCycleCnt+=fm68k_emulate(1, 0); -#endif - SekCycleAim=realaim; -} - -static int CheckIdle(void) -{ - int i, state[0x24]; - - // See if the state is the same after 2 steps: - SekState(state); SekStep(); SekStep(); SekState(state+0x12); - for (i = 0x11; i >= 0; i--) - if (state[i] != state[i+0x12]) return 0; - - return 1; -} - // to be called on 224 or line_sample scanlines only static __inline void getSamples(int y) @@ -339,216 +307,36 @@ PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done) } -// Simple frame without H-Ints -static int PicoFrameSimple(void) -{ - struct PicoVideo *pv=&Pico.video; - int y=0,lines_step=0,sects,line_last; - int cycles_68k_vblock,cycles_68k_block; - - // split to 16 run calls for active scan, for vblank split to 2 (ntsc), 3 (pal 240), 4 (pal 224) - if (Pico.m.pal) - { - if(pv->reg[1]&8) { // 240 lines - cycles_68k_block = 7308; - cycles_68k_vblock = 11694; - lines_step = 15; - } else { - cycles_68k_block = 6821; - cycles_68k_vblock = 10719; - lines_step = 14; - } - line_last = 312-1; - } else { - // M68k cycles/frame: 127840.71 - cycles_68k_block = 6841; // (488*224+148)/16.0, -4 - cycles_68k_vblock = 9164; // (38*488-148-68)/2.0, 0 - lines_step = 14; - line_last = 262-1; - } - - // a hack for VR, to get it running in fast mode - if (PicoAHW & PAHW_SVP) - Pico.ram[0xd864^1] = 0x1a; - - // we don't emulate DMA timing in this mode - if (Pico.m.dma_xfers) { - Pico.m.dma_xfers=0; - Pico.video.status&=~2; - } - - // VDP FIFO too - pv->lwrite_cnt = 0; - Pico.video.status|=0x200; - - Pico.m.scanline=-1; - PsndDacLine = 0; - - SekCyclesReset(); - z80_resetCycles(); - - // 6 button pad: let's just say it timed out now - Pico.m.padTHPhase[0]=Pico.m.padTHPhase[1]=0; - - // ---- Active Scan ---- - pv->status&=~0x88; // clear V-Int, come out of vblank - - // Run in sections: - for (sects=16; sects; sects--) - { - if (CheckIdle()) break; - - SekRunM68k(cycles_68k_block); - if (PicoLineHook) PicoLineHook(lines_step); - } - - // do remaining sections without 68k - if (sects) { - SekCycleCnt += sects * cycles_68k_block; - SekCycleAim += sects * cycles_68k_block; - - if (PicoLineHook) PicoLineHook(sects*lines_step); - } - - // another hack for VR (it needs hints to work) - if (PicoAHW & PAHW_SVP) { - Pico.ram[0xd864^1] = 1; - pv->pending_ints|=0x10; - if (pv->reg[0]&0x10) SekInterrupt(4); - SekRunM68k(160); - } - - // render screen - if (!PicoSkipFrame) - { - if (!(PicoOpt&POPT_ALT_RENDERER)) - { - // Draw the screen -#if 0 -#if CAN_HANDLE_240_LINES - if (pv->reg[1]&8) { - for (y=0;y<240;y++) PicoLine(y); - } else { - for (y=0;y<224;y++) PicoLine(y); - } -#else - for (y=0;y<224;y++) PicoLine(y); -#endif -#endif - } - else PicoFrameFull(); -#ifdef DRAW_FINISH_FUNC - DRAW_FINISH_FUNC(); -#endif - } - - // a gap between flags set and vint - pv->pending_ints|=0x20; - pv->status|=8; // go into vblank - SekRunM68k(68+4); - - if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80)) - PicoSyncZ80(SekCycleCnt); - - // render sound - if (PsndOut) - { - int len; - if (ym2612.dacen && PsndDacLine <= lines_step*16) - PsndDoDAC(lines_step*16); - len = PsndRender(0, PsndLen); - if (PicoWriteSound) PicoWriteSound(len); - // clear sound buffer - PsndClear(); - } - - // ---- V-Blanking period ---- - // fix line counts - if(Pico.m.pal) { - if(pv->reg[1]&8) { // 240 lines - sects = 3; - lines_step = 24; - } else { - sects = 4; - lines_step = 22; - } - } else { - sects = 2; - lines_step = 19; - } - - if (pv->reg[1]&0x20) SekInterrupt(6); // Set IRQ - if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80)) - z80_int(); - - while (1) - { - SekRunM68k(cycles_68k_vblock); - if (PicoLineHook) PicoLineHook(lines_step); - - sects--; - if (sects == 0) break; - if (CheckIdle()) break; - } - - if (sects) { - SekCycleCnt += sects * cycles_68k_vblock; - SekCycleAim += sects * cycles_68k_vblock; - if (PicoLineHook) PicoLineHook(sects*lines_step); - } - - // must sync z80 before return, and extend last DAC sample - if (Pico.m.z80Run && (PicoOpt&POPT_EN_Z80)) - PicoSyncZ80(SekCycleCnt); - if (PsndOut && ym2612.dacen && PsndDacLine <= line_last) - PsndDoDAC(line_last); - - timers_cycle(); - - return 0; -} - int idle_hit_counter = 0; -int PicoFrame(void) +void PicoFrame(void) { - int acc; - +#if 0 if ((Pico.m.frame_count&0x3f) == 0) { elprintf(EL_STATUS, "ihits: %i", idle_hit_counter); idle_hit_counter = 0; } +#endif Pico.m.frame_count++; if (PicoAHW & PAHW_MCD) { PicoFrameMCD(); - return 0; + return; } - // be accurate if we are asked for this - if (PicoOpt&POPT_ACC_TIMING) acc=1; - // don't be accurate in alternative render mode, as hint effects will not be rendered anyway - else if (PicoOpt&POPT_ALT_RENDERER) acc = 0; - else acc=Pico.video.reg[0]&0x10; // be accurate if hints are used - //if(Pico.video.reg[12]&0x2) Pico.video.status ^= 0x10; // change odd bit in interlace mode if (!(PicoOpt&POPT_ALT_RENDERER)) PicoFrameStart(); - if (acc) - PicoFrameHints(); - else PicoFrameSimple(); - - return 0; + PicoFrameHints(); } void PicoFrameDrawOnly(void) { - int y; PicoFrameStart(); - for (y=0;y<224;y++) PicoLine(y); + PicoDrawSync(223, 0); } void PicoGetInternal(pint_t which, pint_ret_t *r) diff --git a/Pico/Pico.h b/Pico/Pico.h index 73b7d40a..8d9aa657 100644 --- a/Pico/Pico.h +++ b/Pico/Pico.h @@ -34,7 +34,7 @@ void mp3_update(int *buffer, int length, int stereo); #define POPT_EN_STEREO (1<< 3) #define POPT_ALT_RENDERER (1<< 4) // 00 00x0 #define POPT_6BTN_PAD (1<< 5) -#define POPT_ACC_TIMING (1<< 6) +// unused (1<< 6) #define POPT_ACC_SPRITES (1<< 7) #define POPT_DIS_32C_BORDER (1<< 8) // 00 0x00 #define POPT_EXT_FM (1<< 9) @@ -59,11 +59,11 @@ extern int PicoSkipFrame; // skip rendering frame, but still do sound (if e extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP extern int PicoSVPCycles; -int PicoInit(void); +void PicoInit(void); void PicoExit(void); void PicoPower(void); int PicoReset(void); -int PicoFrame(void); +void PicoFrame(void); void PicoFrameDrawOnly(void); extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware @@ -109,7 +109,7 @@ extern areaclose *areaClose; extern void (*PicoStateProgressCB)(const char *str); // cd/Area.c -int PicoCdLoadStateGfx(void *file); +int PicoCdLoadStateGfx(void *file); // cd/buffering.c void PicoCDBufferInit(void); @@ -117,7 +117,6 @@ void PicoCDBufferFree(void); void PicoCDBufferFlush(void); // cd/cd_sys.c -int Insert_CD(char *iso_name, int is_bin); int Insert_CD(char *cdimg_name, int type); void Stop_CD(void); // releases all resources taken when CD game was started. @@ -142,7 +141,7 @@ int pm_close(pm_file *fp); int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize); int PicoCartInsert(unsigned char *rom,unsigned int romsize); void Byteswap(unsigned char *data,int len); -int PicoCartUnload(void); +void PicoCartUnload(void); extern void (*PicoCartLoadProgressCB)(int percent); extern void (*PicoCDLoadProgressCB)(int percent); diff --git a/Pico/Pico/Pico.c b/Pico/Pico/Pico.c index bd2bece8..1230728f 100644 --- a/Pico/Pico/Pico.c +++ b/Pico/Pico/Pico.c @@ -73,7 +73,7 @@ static void PicoResetPico(void) PicoPicohw.xpcm_ptr = PicoPicohw.xpcm_buffer; } -PICO_INTERNAL int PicoInitPico(void) +PICO_INTERNAL void PicoInitPico(void) { elprintf(EL_STATUS, "Pico detected"); PicoLineHook = PicoLinePico; @@ -93,7 +93,5 @@ PICO_INTERNAL int PicoInitPico(void) case 2: PicoPicohw.r1 = 0x40; break; case 3: PicoPicohw.r1 = 0x20; break; } - - return 0; } diff --git a/Pico/PicoFrameHints.c b/Pico/PicoFrameHints.c index 2d0fbe26..962f9dcb 100644 --- a/Pico/PicoFrameHints.c +++ b/Pico/PicoFrameHints.c @@ -38,7 +38,7 @@ static int PicoFrameHints(void) int lines, y, lines_vis = 224, line_sample, skip; int hint; // Hint counter - Pico.m.scanline=0; + Pico.m.scanline = 0; if ((PicoOpt&POPT_ALT_RENDERER) && !PicoSkipFrame && (pv->reg[1]&0x40)) { // fast rend., display enabled // draw a frame just after vblank in alternative render mode @@ -75,7 +75,7 @@ static int PicoFrameHints(void) for (y = 0; y < lines_vis; y++) { - Pico.m.scanline=(short)y; + Pico.m.scanline = y; // VDP FIFO pv->lwrite_cnt -= 12; @@ -148,7 +148,7 @@ static int PicoFrameHints(void) } // V-int line (224 or 240) - Pico.m.scanline=(short)y; + Pico.m.scanline = y; // VDP FIFO pv->lwrite_cnt=0; @@ -215,7 +215,7 @@ static int PicoFrameHints(void) for (y++; y < lines; y++) { - Pico.m.scanline=(short)y; + Pico.m.scanline = y; PAD_DELAY #ifdef PICO_CD diff --git a/Pico/PicoInt.h b/Pico/PicoInt.h index e25db5b2..664c2f2b 100644 --- a/Pico/PicoInt.h +++ b/Pico/PicoInt.h @@ -245,7 +245,7 @@ struct PicoMisc unsigned char rotate; unsigned char z80Run; unsigned char padTHPhase[2]; // 02 phase of gamepad TH switches - short scanline; // 04 0 to 261||311; -1 in fast mode + unsigned short scanline; // 04 0 to 261||311 char dirtyPal; // 06 Is the palette dirty (1 - change @ this frame, 2 - some time before) unsigned char hardware; // 07 Hardware value for country unsigned char pal; // 08 1=PAL 0=NTSC @@ -371,8 +371,8 @@ typedef struct // Area.c -PICO_INTERNAL int PicoAreaPackCpu(unsigned char *cpu, int is_sub); -PICO_INTERNAL int PicoAreaUnpackCpu(unsigned char *cpu, int is_sub); +PICO_INTERNAL void PicoAreaPackCpu(unsigned char *cpu, int is_sub); +PICO_INTERNAL void PicoAreaUnpackCpu(unsigned char *cpu, int is_sub); extern void (*PicoLoadStateHook)(void); // cd/Area.c @@ -402,7 +402,7 @@ extern int DrawScanline; PICO_INTERNAL void PicoFrameFull(); // Memory.c -PICO_INTERNAL int PicoInitPc(unsigned int pc); +PICO_INTERNAL void PicoInitPc(unsigned int pc); PICO_INTERNAL unsigned int PicoCheckPc(unsigned int pc); PICO_INTERNAL_ASM unsigned int PicoRead32(unsigned int a); PICO_INTERNAL void PicoMemSetup(void); @@ -442,14 +442,14 @@ PICO_INTERNAL void PicoDetectRegion(void); PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done); // cd/Pico.c -PICO_INTERNAL int PicoInitMCD(void); +PICO_INTERNAL void PicoInitMCD(void); PICO_INTERNAL void PicoExitMCD(void); PICO_INTERNAL void PicoPowerMCD(void); -PICO_INTERNAL int PicoResetMCD(void); -PICO_INTERNAL int PicoFrameMCD(void); +PICO_INTERNAL int PicoResetMCD(void); +PICO_INTERNAL void PicoFrameMCD(void); // Pico/Pico.c -PICO_INTERNAL int PicoInitPico(void); +PICO_INTERNAL void PicoInitPico(void); PICO_INTERNAL void PicoReratePico(void); // Pico/xpcm.c @@ -458,17 +458,17 @@ PICO_INTERNAL void PicoPicoPCMReset(void); PICO_INTERNAL void PicoPicoPCMRerate(int xpcm_rate); // Sek.c -PICO_INTERNAL int SekInit(void); -PICO_INTERNAL int SekReset(void); +PICO_INTERNAL void SekInit(void); +PICO_INTERNAL int SekReset(void); PICO_INTERNAL void SekState(int *data); PICO_INTERNAL void SekSetRealTAS(int use_real); void SekInitIdleDet(void); void SekFinishIdleDet(void); // cd/Sek.c -PICO_INTERNAL int SekInitS68k(void); -PICO_INTERNAL int SekResetS68k(void); -PICO_INTERNAL int SekInterruptS68k(int irq); +PICO_INTERNAL void SekInitS68k(void); +PICO_INTERNAL int SekResetS68k(void); +PICO_INTERNAL int SekInterruptS68k(int irq); // sound/sound.c PICO_INTERNAL void cdda_start_play(); diff --git a/Pico/Sek.c b/Pico/Sek.c index 45fa10f7..cb76ea83 100644 --- a/Pico/Sek.c +++ b/Pico/Sek.c @@ -96,7 +96,7 @@ static void SekIntAckF68K(unsigned level) #endif -PICO_INTERNAL int SekInit() +PICO_INTERNAL void SekInit(void) { #ifdef EMU_C68K CycloneInit(); @@ -129,13 +129,11 @@ PICO_INTERNAL int SekInit() g_m68kcontext = oldcontext; } #endif - - return 0; } // Reset the 68000: -PICO_INTERNAL int SekReset() +PICO_INTERNAL int SekReset(void) { if (Pico.rom==NULL) return 1; @@ -166,23 +164,6 @@ PICO_INTERNAL int SekReset() } -// data must be word aligned -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 -} - PICO_INTERNAL void SekSetRealTAS(int use_real) { #ifdef EMU_C68K diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index 849389d3..db7b2b7f 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -12,7 +12,6 @@ extern const unsigned char hcounts_32[]; extern const unsigned char hcounts_40[]; -extern const unsigned short vcounts[]; #ifndef UTYPES_DEFINED typedef unsigned char u8; @@ -43,7 +42,6 @@ static void VideoWrite(u16 d) //default:elprintf(EL_ANOMALY, "VDP write %04x with bad type %i", d, Pico.video.type); break; } - //dprintf("w[%i] @ %04x, inc=%i [%i|%i]", Pico.video.type, a, Pico.video.reg[0xf], Pico.m.scanline, SekCyclesDone()); AutoIncrement(); } @@ -92,14 +90,9 @@ static void DmaSlow(int len) Pico.video.type, source, a, len, inc, (Pico.video.status&8)||!(Pico.video.reg[1]&0x40), SekCyclesDone(), SekPc); - if (Pico.m.scanline != -1) { - Pico.m.dma_xfers += len; - if ((PicoAHW & PAHW_MCD) && (PicoOpt & POPT_EN_MCD_PSYNC)) SekCyclesBurn(CheckDMA()); - else SekSetCyclesLeftNoMCD(SekCyclesLeftNoMCD - CheckDMA()); - } else { - // be approximate in non-accurate mode - SekSetCyclesLeft(SekCyclesLeft - (len*(((488<<8)/167))>>8)); - } + Pico.m.dma_xfers += len; + if ((PicoAHW & PAHW_MCD) && (PicoOpt & POPT_EN_MCD_PSYNC)) SekCyclesBurn(CheckDMA()); + else SekSetCyclesLeftNoMCD(SekCyclesLeftNoMCD - CheckDMA()); if ((source&0xe00000)==0xe00000) { // Ram pd=(u16 *)(Pico.ram+(source&0xfffe)); @@ -230,16 +223,15 @@ static void DmaCopy(int len) elprintf(EL_VDPDMA, "DmaCopy len %i [%i]", len, SekCyclesDone()); Pico.m.dma_xfers += len; - if(Pico.m.scanline != -1) - Pico.video.status|=2; // dma busy + Pico.video.status |= 2; // dma busy source =Pico.video.reg[0x15]; source|=Pico.video.reg[0x16]<<8; vrs=vr+source; - if(source+len > 0x10000) len=0x10000-source; // clip?? + if (source+len > 0x10000) len=0x10000-source; // clip?? - for(;len;len--) + for (; len; len--) { vr[a] = *vrs++; // AutoIncrement @@ -264,17 +256,16 @@ static void DmaFill(int data) elprintf(EL_VDPDMA, "DmaFill len %i inc %i [%i]", len, inc, SekCyclesDone()); Pico.m.dma_xfers += len; - if(Pico.m.scanline != -1) - Pico.video.status|=2; // dma busy (in accurate mode) + Pico.video.status |= 2; // dma busy // from Charles MacDonald's genvdp.txt: // Write lower byte to address specified vr[a] = (unsigned char) data; a=(u16)(a+inc); - if(!inc) len=1; + if (!inc) len=1; - for(;len;len--) { + for (; len; len--) { // Write upper byte to adjacent address // (here we are byteswapped, so address is already 'adjacent') vr[a] = high; @@ -327,7 +318,7 @@ static __inline void DrawSync(int blank_on) { if (Pico.m.scanline < 224 && !(PicoOpt & POPT_ALT_RENDERER) && !PicoSkipFrame && DrawScanline <= Pico.m.scanline) { - elprintf(EL_ANOMALY, "sync"); + //elprintf(EL_ANOMALY, "sync"); PicoDrawSync(Pico.m.scanline, blank_on); } } @@ -336,8 +327,8 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d) { struct PicoVideo *pvid=&Pico.video; - if (Pico.m.scanline < 224) - elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d); + //if (Pico.m.scanline < 224) + // elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d); a&=0x1c; if (a==0x00) // Data port 0 or 2 @@ -362,7 +353,7 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d) else { // preliminary FIFO emulation for Chaos Engine, The (E) - if (!(pvid->status&8) && (pvid->reg[1]&0x40) && Pico.m.scanline!=-1 && !(PicoOpt&POPT_DIS_VDP_FIFO)) // active display, accurate mode? + if (!(pvid->status&8) && (pvid->reg[1]&0x40) && !(PicoOpt&POPT_DIS_VDP_FIFO)) // active display? { pvid->status&=~0x200; // FIFO no longer empty pvid->lwrite_cnt++; @@ -439,7 +430,7 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d) else if (pints & 0x10) irq = 4; SekInterrupt(irq); // update line - if (irq && Pico.m.scanline!=-1) SekEndRun(24); // make it delayed + if (irq) SekEndRun(24); // make it delayed } #endif } @@ -499,30 +490,22 @@ PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a) if ((a&0x1c)==0x08) { unsigned int hc, d; + int lineCycles; + + lineCycles = (488-SekCyclesLeft)&0x1ff; + d = Pico.m.scanline; // V-Counter - if (Pico.m.scanline != -1) - { - int lineCycles=(488-SekCyclesLeft)&0x1ff; - d=Pico.m.scanline; // V-Counter - - if(Pico.video.reg[12]&1) - hc=hcounts_40[lineCycles]; - else hc=hcounts_32[lineCycles]; - - //if(lineCycles > 488-12) d++; // Wheel of Fortune - } else { - // get approximate V-Counter - d=vcounts[SekCyclesDone()>>8]; - hc = Pico.m.rotate&0xff; - } + if (Pico.video.reg[12]&1) + hc=hcounts_40[lineCycles]; + else hc=hcounts_32[lineCycles]; - if(Pico.m.pal) { + if (Pico.m.pal) { if (d >= 0x103) d-=56; // based on Gens } else { if (d >= 0xEB) d-=6; } - if((Pico.video.reg[12]&6) == 6) { + if ((Pico.video.reg[12]&6) == 6) { // interlace mode 2 (Combat Cars (UE) [!]) d <<= 1; if (d&0xf00) d|= 1; diff --git a/Pico/cd/Pico.c b/Pico/cd/Pico.c index 0bb61161..1fd3bd52 100644 --- a/Pico/cd/Pico.c +++ b/Pico/cd/Pico.c @@ -31,12 +31,10 @@ int (*PicoMCDcloseTray)(void) = NULL; } -PICO_INTERNAL int PicoInitMCD(void) +PICO_INTERNAL void PicoInitMCD(void) { SekInitS68k(); Init_CD_Driver(); - - return 0; } @@ -264,14 +262,12 @@ static __inline void getSamples(int y) #include "../PicoFrameHints.c" -PICO_INTERNAL int PicoFrameMCD(void) +PICO_INTERNAL void PicoFrameMCD(void) { if (!(PicoOpt&POPT_ALT_RENDERER)) PicoFrameStart(); PicoFrameHints(); - - return 0; } diff --git a/Pico/cd/Sek.c b/Pico/cd/Sek.c index 47370dae..24844d8c 100644 --- a/Pico/cd/Sek.c +++ b/Pico/cd/Sek.c @@ -93,7 +93,7 @@ static void SekIntAckFS68k(unsigned level) #endif -PICO_INTERNAL int SekInitS68k() +PICO_INTERNAL void SekInitS68k(void) { #ifdef EMU_C68K // CycloneInit(); @@ -125,12 +125,10 @@ PICO_INTERNAL int SekInitS68k() g_m68kcontext = oldcontext; } #endif - - return 0; } // Reset the 68000: -PICO_INTERNAL int SekResetS68k() +PICO_INTERNAL int SekResetS68k(void) { if (Pico.rom==NULL) return 1; diff --git a/platform/common/emu.c b/platform/common/emu.c index fabd5213..1d57e226 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -450,7 +450,7 @@ int emu_ReloadRom(void) if(movie_data[0x14] == '6') PicoOpt |= POPT_6BTN_PAD; // 6 button pad else PicoOpt &= ~POPT_6BTN_PAD; - PicoOpt |= POPT_DIS_VDP_FIFO|POPT_ACC_TIMING; // accurate timing, no VDP fifo timing + PicoOpt |= POPT_DIS_VDP_FIFO; // no VDP fifo timing if(movie_data[0xF] >= 'A') { if(movie_data[0x16] & 0x80) { PicoRegionOverride = 8; diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index 6eca2d38..52a5edb4 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -1045,7 +1045,6 @@ menu_entry opt_entries[] = { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1 }, { "Scanline mode (faster)", MB_ONOFF, MA_OPT_INTERLACED, ¤tConfig.EmuOpt, 0x4000, 0, 0, 1 }, { "Scale low res mode", MB_ONOFF, MA_OPT_SCALING, ¤tConfig.scaling, 0x0001, 0, 3, 1 }, - { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, ¤tConfig.PicoOpt, 0x0040, 0, 0, 1 }, { "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, ¤tConfig.PicoOpt, 0x0080, 0, 0, 1 }, { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1 }, diff --git a/platform/gp2x/menu.c b/platform/gp2x/menu.c index f55b838b..c428a608 100644 --- a/platform/gp2x/menu.c +++ b/platform/gp2x/menu.c @@ -1150,7 +1150,6 @@ menu_entry opt_entries[] = { { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, { NULL, MB_RANGE, MA_OPT_SCALING, ¤tConfig.scaling, 0, 0, 3, 1, 1 }, - { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, &PicoOpt, 0x040, 0, 0, 1, 1 }, { "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 1, 1 }, { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x002, 0, 0, 1, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 }, diff --git a/platform/psp/menu.c b/platform/psp/menu.c index 89ba7423..1c1b5df9 100644 --- a/platform/psp/menu.c +++ b/platform/psp/menu.c @@ -1235,7 +1235,6 @@ static void amenu_loop_options(void) menu_entry opt_entries[] = { { NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 }, - { "Accurate timing (slower)", MB_ONOFF, MA_OPT_ACC_TIMING, &PicoOpt, 0x0040, 0, 0, 1, 1 }, { "Accurate sprites (slower)", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x0080, 0, 0, 1, 1 }, { "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x0002, 0, 0, 1, 1 }, { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 },