mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 07:38:05 -04:00
UIQ3 bugfixes, SVP drc indirect jumps, stuff
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@572 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
02ba8788a0
commit
f8af96349e
29 changed files with 193 additions and 157 deletions
|
@ -171,7 +171,7 @@ void ExceptionHandler(TExcType exc)
|
|||
#include <stdio.h> // vsprintf
|
||||
|
||||
// debug print from c code
|
||||
extern "C" void lprintf(char *format, ...)
|
||||
extern "C" void lprintf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[512];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
void lprintf(char *format, ...);
|
||||
void lprintf(const char *format, ...);
|
||||
#endif
|
||||
#else
|
||||
#define DEBUGPRINT(x...)
|
||||
|
|
|
@ -84,8 +84,8 @@ char *loadrom_fname = NULL;
|
|||
int loadrom_result = 0;
|
||||
static timeval noticeMsgTime = { 0, 0 }; // when started showing
|
||||
static CGameAudioMS *gameAudio = 0; // the audio object itself
|
||||
static int reset_timing;
|
||||
extern int pico_was_reset;
|
||||
static int reset_timing = 0;
|
||||
static int pico_was_reset = 0;
|
||||
extern RSemaphore initSemaphore;
|
||||
extern RSemaphore pauseSemaphore;
|
||||
extern RSemaphore loadWaitSemaphore;
|
||||
|
@ -170,21 +170,27 @@ static void TargetEpocGameL()
|
|||
int thissec = 0, frames_done = 0, frames_shown = 0;
|
||||
int target_fps, target_frametime;
|
||||
int i, lim_time;
|
||||
//TRawEvent blevent;
|
||||
|
||||
MainInit();
|
||||
buff[0] = 0;
|
||||
|
||||
// try to start pico
|
||||
DEBUGPRINT(_L("PicoInit()"));
|
||||
PicoInit();
|
||||
|
||||
// just to keep the backlight on (works only on UIQ2)
|
||||
//blevent.Set(TRawEvent::EActive);
|
||||
PicoDrawSetColorFormat(2);
|
||||
PicoWriteSound = updateSound;
|
||||
|
||||
// loop?
|
||||
for(;;)
|
||||
{
|
||||
if (gamestate == PGS_Running)
|
||||
{
|
||||
#ifdef __DEBUG_PRINT
|
||||
TInt mem, cells = User::CountAllocCells();
|
||||
User::AllocSize(mem);
|
||||
DEBUGPRINT(_L("worker: cels=%d, size=%d KB"), cells, mem/1024);
|
||||
#endif
|
||||
|
||||
// switch context to other thread
|
||||
User::After(50000);
|
||||
// prepare window and stuff
|
||||
|
@ -203,7 +209,7 @@ static void TargetEpocGameL()
|
|||
if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "NTSC@SYSTEM@/@60@FPS");
|
||||
}
|
||||
target_frametime = 1000000/target_fps;
|
||||
if(!noticeMsgTime.tv_sec && pico_was_reset)
|
||||
if (!noticeMsgTime.tv_sec && pico_was_reset)
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
|
||||
// prepare CD buffer
|
||||
|
@ -263,6 +269,7 @@ static void TargetEpocGameL()
|
|||
frames_shown -= target_fps; if (frames_shown < 0) frames_shown = 0;
|
||||
if (frames_shown > frames_done) frames_shown = frames_done;
|
||||
}
|
||||
User::ResetInactivityTime();
|
||||
}
|
||||
|
||||
|
||||
|
@ -331,14 +338,23 @@ static void TargetEpocGameL()
|
|||
CPolledActiveScheduler::Instance()->Schedule();
|
||||
CGameWindow::FreeResources();
|
||||
}
|
||||
else if(gamestate == PGS_Reset)
|
||||
{
|
||||
PicoReset();
|
||||
pico_was_reset = 1;
|
||||
gamestate = PGS_Running;
|
||||
}
|
||||
else if(gamestate == PGS_ReloadRom)
|
||||
{
|
||||
loadrom_result = emu_ReloadRom(loadrom_fname);
|
||||
pico_was_reset = 1;
|
||||
if (loadrom_result)
|
||||
gamestate = PGS_Running;
|
||||
else
|
||||
else {
|
||||
extern char menuErrorMsg[];
|
||||
gamestate = PGS_Paused;
|
||||
lprintf("%s\n", menuErrorMsg);
|
||||
}
|
||||
DEBUGPRINT(_L("done loading ROM, retval=%i"), loadrom_result);
|
||||
loadWaitSemaphore.Signal();
|
||||
User::After(50000);
|
||||
|
@ -363,15 +379,8 @@ static void TargetEpocGameL()
|
|||
User::After(150000);
|
||||
}
|
||||
|
||||
emu_WriteConfig(0);
|
||||
CGameWindow::FreeResources();
|
||||
} else if(gamestate == PGS_DebugHeap) {
|
||||
#ifdef __DEBUG_PRINT
|
||||
TInt cells = User::CountAllocCells();
|
||||
TInt mem;
|
||||
User::AllocSize(mem);
|
||||
DEBUGPRINT(_L("worker: cels=%d, size=%d KB"), cells, mem/1024);
|
||||
gamestate = gamestate_next;
|
||||
#endif
|
||||
} else if(gamestate == PGS_Quit) {
|
||||
break;
|
||||
}
|
||||
|
@ -397,11 +406,6 @@ static void MainInit()
|
|||
|
||||
DumpMemInfo();
|
||||
|
||||
// try to start pico
|
||||
DEBUGPRINT(_L("PicoInit()"));
|
||||
PicoDrawSetColorFormat(2);
|
||||
PicoWriteSound = updateSound;
|
||||
|
||||
// if (pauseSemaphore.Handle() <= 0)
|
||||
// pauseSemaphore.CreateLocal(0);
|
||||
DEBUGPRINT(_L("initSemaphore.Signal()"));
|
||||
|
@ -776,6 +780,8 @@ void CGameWindow::DoKeys(void)
|
|||
areaActions = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (movie_data) emu_updateMovie();
|
||||
}
|
||||
|
||||
|
||||
|
@ -875,8 +881,11 @@ void CGameWindow::RunEvents(TUint32 which)
|
|||
sprintf(noticeMsg, "SAVE@SLOT@%i@SELECTED", state_slot);
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
if(which & 0x0020) if(gameAudio) currentConfig.volume = gameAudio->ChangeVolume(0);
|
||||
if(which & 0x0010) if(gameAudio) currentConfig.volume = gameAudio->ChangeVolume(1);
|
||||
if ((which & 0x0030) && gameAudio != NULL) {
|
||||
currentConfig.volume = gameAudio->ChangeVolume((which & 0x0010) ? 1 : 0);
|
||||
sprintf(noticeMsg, "VOL@%02i@", currentConfig.volume);
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ static void drawTextM2Fat(int x, int y, const char *text)
|
|||
static void drawTextFpsCenter0(const char *text)
|
||||
{
|
||||
if(!text) return;
|
||||
drawTextM2(214, 216, text);
|
||||
drawTextM2((Pico.video.reg[12]&1) ? 234 : 214, 216, text);
|
||||
}
|
||||
|
||||
static void drawTextFpsFit0(const char *text)
|
||||
|
@ -206,7 +206,7 @@ static void drawTextFps0(const char *text)
|
|||
static void drawTextNoticeCenter0(const char *text)
|
||||
{
|
||||
if(!text) return;
|
||||
drawTextM2(2, 216, text);
|
||||
drawTextM2(42, 216, text);
|
||||
}
|
||||
|
||||
static void drawTextNoticeFit0(const char *text)
|
||||
|
@ -250,12 +250,14 @@ static void fillLocalPal(void)
|
|||
memcpy32(localPal+0xc0, localPal+0x40, 0x40);
|
||||
localPal[0xe0] = 0x00000000; // reserved pixels for OSD
|
||||
localPal[0xf0] = 0x00ee0000;
|
||||
} else if (rendstatus & 0x20) { // mid-frame palette changes
|
||||
}
|
||||
else if (rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes
|
||||
vidConvCpyRGB32(localPal, Pico.cram, 0x40);
|
||||
vidConvCpyRGB32(localPal+0x40, HighPal, 0x40);
|
||||
vidConvCpyRGB32(localPal+0x80, HighPal+0x40, 0x40);
|
||||
} else {
|
||||
vidConvCpyRGB32(localPal, Pico.cram, 0x40);
|
||||
memcpy32(localPal+0x80, localPal, 0x40); // for sprite prio mess
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,8 +268,6 @@ static void vidBlit_90(int full)
|
|||
unsigned char *ps = PicoDraw2FB+328*8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_90(pd, ps, localPal, 320/8);
|
||||
else {
|
||||
|
@ -284,8 +284,6 @@ static void vidBlit_270(int full)
|
|||
unsigned char *ps = PicoDraw2FB+328*8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_270(pd, ps, localPal, 320/8);
|
||||
else {
|
||||
|
@ -303,8 +301,6 @@ static void vidBlitCenter_0(int full)
|
|||
unsigned char *ps = PicoDraw2FB+328*8+8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1) ps += 32;
|
||||
vidConvCpy_center_0(pd, ps, localPal);
|
||||
if(full) vidClear(pd + 224*256, 96);
|
||||
|
@ -316,8 +312,6 @@ static void vidBlitCenter_180(int full)
|
|||
unsigned char *ps = PicoDraw2FB+328*8+8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1) ps += 32;
|
||||
vidConvCpy_center_180(pd, ps, localPal);
|
||||
if(full) vidClear(pd + 224*256, 96);
|
||||
|
@ -326,8 +320,6 @@ static void vidBlitCenter_180(int full)
|
|||
|
||||
static void vidBlitFit_0(int full)
|
||||
{
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168);
|
||||
else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168);
|
||||
|
@ -337,8 +329,6 @@ static void vidBlitFit_0(int full)
|
|||
|
||||
static void vidBlitFit_180(int full)
|
||||
{
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 168);
|
||||
else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 168);
|
||||
|
@ -348,8 +338,6 @@ static void vidBlitFit_180(int full)
|
|||
|
||||
static void vidBlitFit2_0(int full)
|
||||
{
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224);
|
||||
else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224);
|
||||
|
@ -359,8 +347,6 @@ static void vidBlitFit2_0(int full)
|
|||
|
||||
static void vidBlitFit2_180(int full)
|
||||
{
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 224);
|
||||
else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 224);
|
||||
|
@ -453,6 +439,7 @@ int vidInit(void *vidmem, int reinit)
|
|||
vidBlit = vidBlit_270;
|
||||
}
|
||||
|
||||
fillLocalPal();
|
||||
vidBlit(1);
|
||||
PicoOpt |= 0x100;
|
||||
Pico.m.dirtyPal = 1;
|
||||
|
@ -475,6 +462,7 @@ void vidDrawFrame(char *noticeStr, char *fpsStr, int num)
|
|||
drawTextFps(fpsStr);
|
||||
drawTextNotice(noticeStr);
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
vidBlit(!num); // copy full frame once a second
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue