mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48: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
|
@ -35,6 +35,7 @@
|
|||
#include "../common/emu.h"
|
||||
#include "emu.h"
|
||||
|
||||
extern "C" char menuErrorMsg[];
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -235,26 +236,18 @@ void CPicolAppView::DisplayOpenROMDialogL()
|
|||
iROMLoaded = EFalse;
|
||||
switch (res)
|
||||
{
|
||||
case PicoErrRomOpenFailed:
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to open file."));
|
||||
case PicoErrRomOpenFailed: {
|
||||
TBuf<64> mErrorBuff;
|
||||
TPtrC8 buff8((TUint8*) menuErrorMsg);
|
||||
mErrorBuff.Copy(buff8);
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), mErrorBuff);
|
||||
break;
|
||||
}
|
||||
|
||||
case PicoErrOutOfMem:
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate memory."));
|
||||
break;
|
||||
|
||||
case PicoErrNotRom:
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("The file you selected is not a game ROM."));
|
||||
break;
|
||||
|
||||
case PicoErrNoRomsInArchive:
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("No game ROMs found in zipfile."));
|
||||
break;
|
||||
|
||||
case PicoErrUncomp:
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed while unzipping ROM."));
|
||||
break;
|
||||
|
||||
case PicoErrEmuThread:
|
||||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to create emulation thread. Try to restart this application."));
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,6 @@ extern const char *actionNames[];
|
|||
RSemaphore initSemaphore;
|
||||
RSemaphore pauseSemaphore;
|
||||
RSemaphore loadWaitSemaphore;
|
||||
int pico_was_reset = 0;
|
||||
static CPicolAppView *appView = 0;
|
||||
|
||||
|
||||
|
@ -65,9 +64,7 @@ TInt CPicoGameSession::Do(const TPicoServRqst what, TAny *param)
|
|||
|
||||
case PicoMsgReset:
|
||||
if(rom_loaded) {
|
||||
PicoReset();
|
||||
pico_was_reset = 1;
|
||||
return ChangeRunState(PGS_Running);
|
||||
return ChangeRunState(PGS_Reset);
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
@ -182,13 +179,14 @@ TInt CPicoGameSession::loadROM(TPtrC16 *pptr)
|
|||
// If successful, in will enter PGS_Running state by itself.
|
||||
loadrom_fname = (char *)writeBuf.PtrZ();
|
||||
loadrom_result = 0;
|
||||
loadWaitSemaphore.Wait(1); // make sure sem is not set
|
||||
ret = ChangeRunState(PGS_ReloadRom);
|
||||
if(ret) return ret;
|
||||
|
||||
loadWaitSemaphore.Wait(20*1000*1000);
|
||||
loadWaitSemaphore.Wait(60*1000*1000);
|
||||
|
||||
if (loadrom_result == 0)
|
||||
return PicoErrNotRom;
|
||||
return PicoErrRomOpenFailed;
|
||||
|
||||
emu_getGameName(buff);
|
||||
TPtrC8 buff8((TUint8*) buff);
|
||||
|
@ -198,11 +196,9 @@ TInt CPicoGameSession::loadROM(TPtrC16 *pptr)
|
|||
|
||||
// debug
|
||||
#ifdef __DEBUG_PRINT
|
||||
TInt cells = User::CountAllocCells();
|
||||
TInt mem;
|
||||
TInt mem, cells = User::CountAllocCells();
|
||||
User::AllocSize(mem);
|
||||
DEBUGPRINT(_L("comm: cels=%d, size=%d KB"), cells, mem/1024);
|
||||
ChangeRunState(PGS_DebugHeap, PGS_Running);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -27,8 +27,8 @@ enum TPicoGameState {
|
|||
PGS_Paused,
|
||||
PGS_Quit,
|
||||
PGS_KeyConfig,
|
||||
PGS_DebugHeap,
|
||||
PGS_ReloadRom,
|
||||
PGS_Reset,
|
||||
};
|
||||
|
||||
enum TPicoServRqst {
|
||||
|
@ -49,11 +49,8 @@ enum TPicoGenErrors { // generic errors
|
|||
PicoErrNoErr = 0, // OK
|
||||
PicoErrRomOpenFailed,
|
||||
PicoErrOutOfMem,
|
||||
PicoErrNotRom,
|
||||
PicoErrNoRomsInArchive,
|
||||
PicoErrUncomp, // 5
|
||||
PicoErrOutOfMemSnd,
|
||||
PicoErrGenSnd, // 7 generic sound system error
|
||||
PicoErrGenSnd, // generic sound system error
|
||||
PicoErrEmuThread
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# makefile for uiq3_patcher_0_2.tar.gz
|
||||
# makefile for uiq3_patcher_0_2.tar.gz setup, modified
|
||||
export CROSS = arm-none-symbianelf-
|
||||
APPNAME = PicoDrive
|
||||
VER_MAJ = 1
|
||||
|
@ -141,6 +141,20 @@ engine/blit_asm.o : engine/blit.s
|
|||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
# App.o can't be optimized
|
||||
#App.o : App.cpp
|
||||
# $(CC) $(CXXFLAGS) -O0 -c $< -o $@
|
||||
|
||||
readme.txt: ../../tools/textfilter ../base_readme.txt
|
||||
../../tools/textfilter ../base_readme.txt $@ UIQ
|
||||
|
||||
# ----------- release -----------
|
||||
ifneq ($(findstring rel,$(MAKECMDGOALS)),)
|
||||
ifeq ($(VER),)
|
||||
$(error need VER)
|
||||
endif
|
||||
endif
|
||||
|
||||
rel: picodrive.sis readme.txt
|
||||
zip -9 -j ../../PicoDrive_uiq3_$(VER).zip $^
|
||||
mkdir bin_to_cso_mp3
|
||||
cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/
|
||||
zip -9 -r ../../PicoDrive_uiq3_$(VER).zip bin_to_cso_mp3
|
||||
rm -rf bin_to_cso_mp3
|
||||
|
|
|
@ -65,6 +65,7 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.Frameskip = -1; // auto
|
||||
defaultConfig.volume = 80;
|
||||
defaultConfig.scaling = 0;
|
||||
defaultConfig.KeyBinds[0xd5] = 1<<26; // back
|
||||
}
|
||||
|
||||
/* used by config engine only, not actual menus */
|
||||
|
@ -102,7 +103,7 @@ const int opt2_entry_count = OPT2_ENTRY_COUNT;
|
|||
menu_entry cdopt_entries[] =
|
||||
{
|
||||
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define CAN_HANDLE_240_LINES 0 // for now
|
||||
|
||||
// logging emu events
|
||||
#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff
|
||||
#define EL_LOGMASK (EL_STATUS) // |EL_SVP|EL_ANOMALY)
|
||||
|
||||
//extern void dprintf(char *format, ...);
|
||||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
|
|
|
@ -35,10 +35,9 @@ ELF2E32 = elf2e32
|
|||
BMCONV = bmconv
|
||||
EPOCRC = EPOCROOT=$(EPOCROOT) epocrc
|
||||
|
||||
PATH := $(EPOCROOT)/bin:$(GCCPATH)/bin:$(GCCPATH)/$(GCCPREF)/bin:$(PATH)
|
||||
PATH := $(EPOCROOT)/bin:$(GCCPATH)/bin:$(PATH)
|
||||
|
||||
# TODO: do we really need -mapcs?
|
||||
# -march=armv5t
|
||||
# -march=armv5t ?
|
||||
CFLAGS += -Wall -pipe -nostdinc -msoft-float
|
||||
CFLAGS += -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__
|
||||
CFLAGS += -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ -D__MARM_ARMV5__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue