initial import

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@2 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2006-12-19 20:53:21 +00:00
parent 2cadbd5e56
commit cc68a136aa
341 changed files with 180839 additions and 0 deletions

View file

@ -0,0 +1,69 @@
// protocol used to talk between exe and it's launcher
#ifndef __CLIENTSERVER_H
#define __CLIENTSERVER_H
#include <w32std.h>
// names
_LIT(KServerName, "PicodriveNServ");
_LIT(KServerWGName, "Picosmall"); // window group name
_LIT(KClientName, "PicodriveN");
_LIT(KClientFind, "PicodriveN*"); // client search mask (for TFindLibrary)
// opcodes used in message passing between client and server
enum TPicoServRqst {
PicoMsgLoadState,
PicoMsgSaveState,
PicoMsgLoadROM,
PicoMsgResume,
PicoMsgReset,
PicoMsgKeys,
PicoMsgPause,
PicoMsgQuit,
PicoMsgConfigChange, // launcher -> emu
PicoMsgRetrieveConfig, // emu -> launcher
PicoMsgRetrieveDebugStr,// fixed to 512 bytes 4 now
kDefaultMessageSlots // this is how many messages we need :)
};
// event messages to launcher
enum TPicoLauncherEvents {
EEventKeyCfgDone = EEventUser + 1,
EEventGamePaused,
};
// configuration data to be sent between server and client
struct TPicoConfig {
enum TPicoScreenRotation {
PRot0,
PRot90,
PRot180,
PRot270
};
enum TPicoScreenMode {
PMCenter,
PMFit,
PMFit2
};
enum TPicoFrameSkip {
PFSkipAuto = -1,
PFSkip0
};
TInt32 iScreenRotation;
TInt32 iScreenMode;
TUint32 iFlags; // LSb->MSb: use_sram, show_fps, enable_sound, sound_rate(3bits), gzip_saves{=0x40}, dont_use_mot_vol
// enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;
// alt_renderer, 6button_gamepad, accurate_timing
TInt32 iPicoOpt;
TInt32 iFrameskip;
TUint32 iKeyBinds[32];
TUint32 iAreaBinds[19];
TInt32 PicoRegion;
};
#endif // __CLIENTSERVER_H

321
platform/uiq2/Makefile Normal file
View file

@ -0,0 +1,321 @@
# environmental vars required:
# EPOCROOT2 - root of your SDK with slash at the end
# settings
#dprint = 1
#mz80 = 1
#debug_cyclone = 1
asm_memory = 1
#asm_render = 1
#use_musashi = 1
EPOCBLDUREL = _BUILD
EPOCTRGUREL = $(EPOCROOT2)EPOC32\RELEASE\ARMI\UREL
EPOCLINKUREL = $(EPOCTRGUREL)
EPOCSTATLINKUREL = $(EPOCTRGUREL)
# must set both PATH and Path to make it work correctly (?)
Path:=$(EPOCROOT2)EPOC32\gcc\bin;$(Path)
PATH:=$(Path)
ERASE = @erase 2>>nul
ALL : UREL
UREL : CHECKENV MAKEDIRS
UREL : $(EPOCTRGUREL)\PICOSMALL.EXE
CLEAN :
@perl -S ermdir.pl "$(EPOCBLDUREL)"
@del *.o 2> NUL
CLEANZ :
del ..\..\zlib\*.o 2> NUL
CLEANM :
del ..\..\musashi\*.o 2> NUL
CLEANALL : CLEAN CLEANZ CLEANM
# check for EPOCROOT2
CHECKENV : $(EPOCROOT2)epoc32
$(EPOCROOT2)epoc32 :
@echo Please set EPOCROOT2 environmental variable to full path to your SDK
@echo with ending slash (something like C:\Uiq_21\)
@cd : 2> NUL # do something stupid to make it silently fail
# GCC
INCDIR = -I. -I "..\..\" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC"
GCCFLAGS = -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -march=armv4t -mthumb-interwork -pipe -O3 -fomit-frame-pointer
GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__EXE__ -DNDEBUG -D_UNICODE -DARM
# dprint
ifeq "$(dprint)" "1"
GCCDEFS += -D__DEBUG_PRINT
endif
# drz80/mz80
ifeq "$(mz80)" "1"
GCCDEFS += -D_USE_MZ80
else
GCCDEFS += -D_USE_DRZ80
endif
# debug_cyclone
ifeq "$(debug_cyclone)" "1"
use_musashi := 1
GCCDEFS += -DEMU_C68K
asm_memory := 0
endif
# musashi
ifeq "$(use_musashi)" "1"
GCCDEFS += -DEMU_M68K
else
GCCDEFS += -DEMU_C68K
endif
GCC = gcc -c $(GCCFLAGS) $(GCCDEFS) $(INCDIR)
LIBSUREL = \
$(EPOCSTATLINKUREL)\EGCC.LIB \
$(EPOCLINKUREL)\ESTLIB.LIB \
$(EPOCLINKUREL)\WS32.LIB \
$(EPOCLINKUREL)\HAL.LIB \
$(EPOCLINKUREL)\EUSER.LIB \
$(EPOCLINKUREL)\EFSRV.LIB \
$(EPOCLINKUREL)\EZLIB.LIB
$(EPOCTRGUREL)\PICOSMALL.EXE : $(EPOCBLDUREL)\PICOSMALL.in $(EPOCSTATLINKUREL)\EEXE.LIB $(LIBSUREL)
@echo * linking and finishing
@ld -s -e _E32Startup -u _E32Startup \
--base-file "$(EPOCBLDUREL)\PICOSMALL.bas" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \
"$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \
--no-whole-archive $(LIBSUREL) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE"
@dlltool -m arm_interwork \
--base-file "$(EPOCBLDUREL)\PICOSMALL.bas" \
--output-exp "$(EPOCBLDUREL)\PICOSMALL.exp"
-$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.bas"
@ld -s -e _E32Startup -u _E32Startup \
"$(EPOCBLDUREL)\PICOSMALL.exp" \
-Map "$(EPOCBLDUREL)\PICOSMALL.EXE.map" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \
"$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \
--no-whole-archive $(LIBSUREL) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.exp"
ifeq "$(noecompxl)" "1"
@petran "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \
-nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \
-heap 0x00000001 0x00800000
else
@petran_ "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \
-nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \
-heap 0x00000001 0x00800000 -stack 0x80000000
endif
# -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE"
@perl -S ecopyfile.pl "$@" "PICOSMALL.EXE"
ifeq "$(up)" "1"
@quploadpico.cmd
endif
OBJECTSUREL= \
$(EPOCBLDUREL)\debug.o \
$(EPOCBLDUREL)\CART.o \
$(EPOCBLDUREL)\DRAW.o \
$(EPOCBLDUREL)\DRAW2.o \
$(EPOCBLDUREL)\MAIN.o \
$(EPOCBLDUREL)\MEMORY.o \
$(EPOCBLDUREL)\PICO.o \
$(EPOCBLDUREL)\SEK.o \
$(EPOCBLDUREL)\VIDEOPORT.o \
$(EPOCBLDUREL)\SIMPLESERVER.o \
$(EPOCBLDUREL)\VID.o \
$(EPOCBLDUREL)\Utils.o \
$(EPOCBLDUREL)\Area.o \
$(EPOCBLDUREL)\Misc.o \
$(EPOCBLDUREL)\unzip.o \
..\..\zlib\gzio_symb.o \
$(EPOCBLDUREL)\sound.o \
$(EPOCBLDUREL)\sn76496.o \
$(EPOCBLDUREL)\ym2612.o \
$(EPOCBLDUREL)\blit.o
ifeq "$(debug_cyclone)" "1"
OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o $(EPOCBLDUREL)\_cyclone_debug.o
endif
# the MUSASHI core
ifeq "$(use_musashi)" "1"
OBJECTSUREL += \
..\..\musashi\m68kcpu.o \
..\..\musashi\m68kops.o \
..\..\musashi\m68kopac.o \
..\..\musashi\m68kopdm.o \
..\..\musashi\m68kopnz.o \
..\..\musashi\m68kdasm.o
else
OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o
endif
ifeq "$(mz80)" "1"
OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\mz80.o
else
OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\DrZ80.o
endif
ifeq "$(asm_memory)" "1"
ASMDEFINES += -D_ASM_MEMORY_C
OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\memory_asm.o
endif
ifeq "$(asm_render)" "1"
ASMDEFINES += -D_ASM_DRAW_C
OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\draw_asm.o $(EPOCBLDUREL)\draw2_asm.o
endif
$(EPOCBLDUREL)\PICOSMALL.in : $(OBJECTSUREL)
@echo * ar
@if exist "$@" del "$@"
@ar cr $@ $^
..\..\Cyclone\proj\Cyclone.s :
@echo You need to build Cyclone first. See Cyclone.txt in cyclone directory.
@cd : 2> NUL # do something stupid to make it silently fail
$(EPOCBLDUREL)\Cyclone.o : ..\..\Cyclone\proj\Cyclone.s
@echo * assembling Cyclone..
@as -marmv4t -mthumb-interwork -o $@ $^
$(EPOCBLDUREL)\DrZ80.o : ..\..\pico\sound\DrZ80.s ..\..\pico\sound\DrZ80.h
@echo * assembling DrZ80..
@as -marmv4t -mthumb-interwork -o $@ ..\..\pico\sound\DrZ80.s
# Source
$(EPOCBLDUREL)\debug.o : debug.cpp debug.h
@echo * debug.cpp
@$(GCC) -o $@ debug.cpp
$(EPOCBLDUREL)\MAIN.o : Main.cpp ..\..\pico\picoInt.h vid.h SimpleServer.h ClientServer.h audio.h debug.h
@echo * Main.cpp
@$(GCC) -o $@ "Main.cpp"
$(EPOCBLDUREL)\VID.o : VID.cpp vid.h ClientServer.h ..\..\pico\picoInt.h
@echo * Vid.cpp
@$(GCC) -o $@ "VID.cpp"
$(EPOCBLDUREL)\SIMPLESERVER.o : SIMPLESERVER.cpp version.h ClientServer.h SimpleServer.h ..\..\pico\picoInt.h debug.h
@echo * SimpleServer.cpp
@$(GCC) -o $@ "SIMPLESERVER.cpp"
$(EPOCBLDUREL)\CART.o : ..\..\pico\Cart.c ..\..\pico\picoInt.h ..\..\pico\Pico.h ..\..\unzip\unzip.h
@echo * Cart.c
@$(GCC) -D_UNZIP_SUPPORT -o $@ "..\..\pico\Cart.c"
$(EPOCBLDUREL)\DRAW.o : ..\..\pico\Draw.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Draw.c
@$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw.c"
#
$(EPOCBLDUREL)\DRAW2.o : ..\..\pico\Draw2.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Draw2.c
@$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw2.c"
$(EPOCBLDUREL)\MEMORY.o : ..\..\pico\Memory.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Memory.c
@$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Memory.c"
$(EPOCBLDUREL)\PICO.o : ..\..\pico\Pico.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Pico.c
@$(GCC) -o $@ "..\..\pico\Pico.c"
$(EPOCBLDUREL)\SEK.o : ..\..\pico\Sek.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Sek.c
@$(GCC) -o $@ "..\..\pico\Sek.c"
$(EPOCBLDUREL)\VIDEOPORT.o : ..\..\pico\Videoport.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Videoport.c
@$(GCC) -o $@ "..\..\pico\Videoport.c"
$(EPOCBLDUREL)\Utils.o : ..\..\pico\Utils.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Utils.c
@$(GCC) -o $@ "..\..\pico\Utils.c"
$(EPOCBLDUREL)\Area.o : ..\..\pico\Area.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Area.c
@$(GCC) -o $@ "..\..\pico\Area.c"
$(EPOCBLDUREL)\Misc.o : ..\..\pico\Misc.c ..\..\pico\picoInt.h ..\..\pico\Pico.h
@echo * Misc.c
@$(GCC) -o $@ "..\..\pico\Misc.c"
$(EPOCBLDUREL)\unzip.o : ..\..\unzip\unzip.c ..\..\unzip\unzip.h
@echo * unzip.c
@$(GCC) -o $@ "..\..\unzip\unzip.c"
# assembly "optimized" stuff
$(EPOCBLDUREL)\blit.o : blit.s
@echo * blit.s
@as -marmv4t -mthumb-interwork -o $@ blit.s
$(EPOCBLDUREL)\draw_asm.o : ..\..\pico\draw.s
@echo * draw.s
@as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw.s
$(EPOCBLDUREL)\draw2_asm.o : ..\..\pico\draw2.s
@echo * draw2.s
@as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw2.s
$(EPOCBLDUREL)\memory_asm.o : ..\..\pico\memory.s
@echo * memory.s
@as -marmv4t -mthumb-interwork -o $@ ..\..\pico\memory.s
# sound stuff
$(EPOCBLDUREL)\sound.o : ..\..\pico\sound\sound.c ..\..\pico\sound\sound.h
@echo * sound.c
@$(GCC) -o $@ "..\..\pico\sound\sound.c"
$(EPOCBLDUREL)\ym2612.o : ..\..\pico\sound\ym2612.c ..\..\pico\sound\ym2612.h ..\..\pico\sound\driver.h
@echo * ym2612.c
@$(GCC) -o $@ "..\..\pico\sound\ym2612.c"
$(EPOCBLDUREL)\sn76496.o : ..\..\pico\sound\sn76496.c ..\..\pico\sound\sn76496.h ..\..\pico\sound\driver.h
@echo * sn76496.c
@$(GCC) -o $@ "..\..\pico\sound\sn76496.c"
$(EPOCBLDUREL)\mz80.o : ..\..\pico\sound\mz80.c ..\..\pico\sound\mz80.h
@echo * mz80.c
@$(GCC) -o $@ "..\..\pico\sound\mz80.c"
# -D__DEBUG_PRINT_SND
# misc
$(EPOCBLDUREL)\_cyclone_debug.o : ..\..\pico\_cyclone_debug.c
@echo * _cyclone_debug.c
@$(GCC) -o $@ "..\..\pico\_cyclone_debug.c"
# generic rule for generic C stuff
.c.o:
@echo * $<
@$(GCC) $< -o $@
# --- SRCFILES END ---
# Rules to create all necessary directories
MAKEDIRS : \
_build
_build :
@echo * making build dir
@perl -S emkdir.pl $@

View file

@ -0,0 +1,430 @@
// SimpleServer.cpp
#include <e32svr.h>
#include <e32math.h>
#include <e32uid.h>
#include <string.h>
#include "debug.h"
#include "version.h"
#include "ClientServer.h"
#include "SimpleServer.h"
#include "pico\picoInt.h"
extern TInt machineUid;
extern int gamestate, gamestate_prev;
extern TPicoConfig currentConfig;
extern TPicoKeyConfigEntry keyConfigMotA[];
extern const char *actionNames[];
const char *RomFileName = 0;
int pico_was_reset = 0;
// utility
unsigned int bigend(unsigned int l)
{
return (l>>24)|((l>>8)&0xff00)|((l<<8)&0xff0000)|(l<<24);
}
//**********************************
//CPicoServServer
//**********************************
CPicoServServer::CPicoServServer(TInt aPriority)
: CServer(aPriority)
{
}
// Create and start a new count server.
void CPicoServServer::New()
{
CPicoServServer *pS=new CPicoServServer(EPriority);
__ASSERT_ALWAYS(pS!=NULL,PanicServer(ESvrCreateServer));
pS->StartL(KServerName);
}
// Create a new server session.
CSharableSession *CPicoServServer::NewSessionL(const TVersion &aVersion) const
{
// check we're the right version
TVersion v(KPicoMajorVersionNumber,KPicoMinorVersionNumber,0);
if (!User::QueryVersionSupported(v,aVersion))
User::Leave(KErrNotSupported);
// make new session
RThread aClient = Message().Client();
return CPicoServSession::NewL(aClient, (CPicoServServer*)this);
}
//**********************************
//CPicoServSession
//**********************************
// constructor - must pass client to CSession
CPicoServSession::CPicoServSession(RThread &aClient, CPicoServServer *aServer)
: CSession(aClient), rom_data(0)
{
// iPicoSvr=aServer;
}
CPicoServSession* CPicoServSession::NewL(RThread &aClient, CPicoServServer * aServer)
{
return new(ELeave) CPicoServSession(aClient,aServer);
}
void CPicoServSession::ServiceL(const RMessage& aMessage)
{
TRAPD(err,DispatchMessageL(aMessage));
aMessage.Complete(err);
}
// service a client request; test the opcode and then do appropriate servicing
void CPicoServSession::DispatchMessageL(const RMessage &aMessage)
{
switch (aMessage.Function()) {
case PicoMsgLoadState:
if(!rom_data) User::Leave(-1); // no ROM
User::LeaveIfError(saveLoadGame(1));
gamestate = PGS_Running;
return;
case PicoMsgSaveState:
if(!rom_data) User::Leave(-1);
User::LeaveIfError(saveLoadGame(0));
gamestate = PGS_Running;
return;
case PicoMsgLoadROM:
loadROM();
return;
case PicoMsgResume:
if(rom_data) gamestate = PGS_Running;
return;
case PicoMsgReset:
if(rom_data) {
PicoReset(0);
pico_was_reset = 1;
gamestate = PGS_Running;
}
return;
case PicoMsgKeys:
gamestate = PGS_KeyConfig;
return;
case PicoMsgPause:
gamestate = PGS_Paused;
return;
case PicoMsgQuit:
DEBUGPRINT(_L("got quit msg."));
gamestate = PGS_Quit;
return;
// config change
case PicoMsgConfigChange: // launcher -> emu
changeConfig();
return;
case PicoMsgRetrieveConfig: // emu -> launcher
sendConfig();
return;
case PicoMsgRetrieveDebugStr: // emu -> launcher
sendDebug();
return;
// requests we don't understand at all are a different thing,
// so panic the client here, this function also completes the message
default:
PanicClient(EBadRequest);
return;
}
}
void CPicoServSession::loadROM()
{
TInt res;
const TAny* pD=Message().Ptr0();
// TInt desLen=Message().Client().GetDesLength(pD);
if(rom_data) {
// save SRAM for previous ROM
if(currentConfig.iFlags & 1)
saveLoadGame(0, 1);
}
RomFileName = 0;
if(rom_data) {
free(rom_data);
rom_data = 0;
}
// read the contents of the client pointer into a TPtr.
static TBuf8<KMaxFileName> writeBuf;
TRAP(res,Message().ReadL(pD,writeBuf));
if (res!=KErrNone) {
PanicClient(EBadDescriptor);
return;
}
// detect wrong extensions (.srm and .mds)
TBuf8<5> ext;
ext.Copy(writeBuf.Right(4));
ext.LowerCase();
if(!strcmp((char *)ext.PtrZ(), ".srm") || !strcmp((char *)ext.PtrZ(), "s.gz") || // .mds.gz
!strcmp((char *)ext.PtrZ(), ".mds")) {
User::Leave(3);
return;
}
FILE *rom = fopen((char *) writeBuf.PtrZ(), "rb");
if(!rom) {
DEBUGPRINT(_L("failed to open rom."));
User::Leave(1);
return;
}
unsigned int rom_size = 0;
// zipfile support
if(!strcmp((char *)ext.PtrZ(), ".zip")) {
fclose(rom);
res = CartLoadZip((const char *) writeBuf.PtrZ(), &rom_data, &rom_size);
if(res) {
User::Leave(res);
return;
}
} else {
if( (res = PicoCartLoad(rom, &rom_data, &rom_size)) ) {
DEBUGPRINT(_L("PicoCartLoad() failed."));
fclose(rom);
User::Leave(2);
return;
}
fclose(rom);
}
// detect wrong files (Pico crashes on very small files), also see if ROM EP is good
if(rom_size <= 0x200 || strncmp((char *)rom_data, "Pico", 4) == 0 ||
((*(TUint16 *)(rom_data+4)<<16)|(*(TUint16 *)(rom_data+6))) >= (int)rom_size) {
free(rom_data);
rom_data = 0;
User::Leave(3); // not a ROM
}
DEBUGPRINT(_L("PicoCartInsert(0x%08X, %d);"), rom_data, rom_size);
if(PicoCartInsert(rom_data, rom_size)) {
User::Leave(2);
return;
}
pico_was_reset = 1;
// global ROM file name for later use
RomFileName = (const char *) writeBuf.PtrZ();
// load SRAM for this ROM
if(currentConfig.iFlags & 1)
saveLoadGame(1, 1);
// debug
#ifdef __DEBUG_PRINT
TInt cells = User::CountAllocCells();
TInt mem;
User::AllocSize(mem);
DEBUGPRINT(_L("comm: cels=%d, size=%d KB"), cells, mem/1024);
gamestate = PGS_DebugHeap;
gamestate_prev = PGS_Running;
#else
gamestate = PGS_Running;
#endif
}
void CPicoServSession::changeConfig()
{
DEBUGPRINT(_L("got new config."));
// receve it
const TAny* pD=Message().Ptr0();
TPtr8 descr((TUint8*) &currentConfig, sizeof(currentConfig));
TRAPD(res,Message().ReadL(pD, descr));
if (res!=KErrNone) {
PanicClient(EBadDescriptor);
return;
}
// Motorola: enable experimental volume control
if((machineUid&0xfffffff0) == 0x101f6b20) { // Motorolas
if(currentConfig.iFlags & 0x40) {
currentConfig.iKeyBinds[11] = 0x00100000; // vol up
currentConfig.iKeyBinds[12] = 0x00200000; // vol down
keyConfigMotA[11].flags |= 0x40; // add "not configurable" flag
keyConfigMotA[12].flags |= 0x40;
} else {
currentConfig.iKeyBinds[11] &= ~0x00100000; // remove vol actions
currentConfig.iKeyBinds[12] &= ~0x00200000;
keyConfigMotA[11].flags &= ~0x40; // remove "not configurable" flag
keyConfigMotA[12].flags &= ~0x40;
}
}
// set region, PicoOpt and rate
PicoRegionOverride = currentConfig.PicoRegion;
PicoOpt = currentConfig.iPicoOpt;
switch((currentConfig.iFlags>>3)&3) {
case 1: PsndRate=11025; break;
case 2: PsndRate=16000; break;
case 3: PsndRate=22050; break;
default: PsndRate= 8000; break;
}
// 6 button pad, enable XYZM config if needed
if(PicoOpt & 0x20) {
actionNames[8] = "Z";
actionNames[9] = "Y";
actionNames[10] = "X";
actionNames[11] = "MODE";
} else {
actionNames[8] = actionNames[9] = actionNames[10] = actionNames[11] = 0;
}
// if we are in center 90||270 modes, we can bind renderer switcher
if(currentConfig.iScreenMode == TPicoConfig::PMCenter &&
(currentConfig.iScreenRotation == TPicoConfig::PRot90 || currentConfig.iScreenRotation == TPicoConfig::PRot270))
actionNames[25] = "RENDERER";
else actionNames[25] = 0;
}
void CPicoServSession::sendConfig()
{
// send current config to client
currentConfig.iPicoOpt = PicoOpt;
TPtrC8 descr((TUint8*) &currentConfig, sizeof(currentConfig));
Write(Message().Ptr0(), descr);
}
#ifdef __DEBUG_PRINT
extern "C" char *debugString();
#endif
void CPicoServSession::sendDebug()
{
#ifdef __DEBUG_PRINT
char *str = debugString();
// send current config to client
currentConfig.iPicoOpt = PicoOpt;
TPtrC8 descr((TUint8*) str, 1024);
Write(Message().Ptr0(), descr);
#endif
}
// panic the client
void CPicoServSession::PanicClient(TInt aPanic) const
{
Panic(_L("PicoN client"), aPanic);
// client screwed up - there is nothing for us to do now
RProcess me;
me.Terminate(1);
}
// write to the client thread; if unsuccessful, panic the client
void CPicoServSession::Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset)
{
TRAPD(ret,WriteL(aPtr,aDes,anOffset);)
if (ret!=KErrNone)
PanicClient(EBadDescriptor);
}
//**********************************
//Global functions
//**********************************
// The server thread.
TInt CPicoServServer::ThreadFunction(TAny* anArg)
{
// install our exception hanler first
RThread().SetExceptionHandler(&ExceptionHandler, -1);
// convert argument into semaphore reference
// RSemaphore& semaphore=*(RSemaphore *)anArg;
// start scheduler and server
CActiveScheduler *pA=new CActiveScheduler;
__ASSERT_ALWAYS(pA!=NULL,PanicServer(EMainSchedulerError));
CActiveScheduler::Install(pA);
//CTrapCleanup::New(); // docs say this is created automatically, but I somehow got E32USER-CBase 69 panic
CPicoServServer::New();
// signal that we've started
// semaphore.Signal();
// start fielding requests from clients
CActiveScheduler::Start();
// finished
return(KErrNone);
}
// Panic the server
//GLDEF_C
void PanicServer(TPicoServPanic aPanic)
{
User::Panic(_L("PicoN server"),aPanic);
}
// Create the server thread
// This function is exported from the DLL and called from the client
//EXPORT_C
TInt StartThread()
{
TInt res=KErrNone;
// create server - if one of this name does not already exist
TFindServer findPicoServer(KServerName);
TFullName name;
if(findPicoServer.Next(name) == KErrNone) return -1; // we already exist
RThread thread;
// RSemaphore semaphore;
// semaphore.CreateLocal(0); // create a semaphore so we know when thread finished
res=thread.Create(KServerName, // create new server thread
CPicoServServer::ThreadFunction, // thread's main function
KDefaultStackSize,
KMinHeapSize,
KPicoMaxHeapSize,
// &semaphore // passed as TAny* argument to thread function
0
);
if(res==KErrNone) { // thread created ok - now start it going
thread.SetPriority(EPriorityNormal);
thread.Resume(); // start it going
// semaphore.Wait(); // wait until it's initialized
thread.Close(); // we're no longer interested in the other thread
}
// semaphore.Close();
return res;
}

View file

@ -0,0 +1,121 @@
// SimpleServer.h
#ifndef __SIMPLESERVER_H
#define __SIMPLESERVER_H
#include <e32base.h>
TInt StartThread();
// engine states
enum TPicoGameState {
PGS_Running,
PGS_Paused,
PGS_Quit,
PGS_KeyConfig,
PGS_DebugHeap,
};
// needed for creating server thread.
const TUint KPicoMaxHeapSize=0x00800000;
// reasons for server panic
enum TPicoServPanic
{
EBadRequest,
EBadDescriptor,
EMainSchedulerError,
ESvrCreateServer,
ESvrStartServer,
ECreateTrapCleanup,
ENotImplementedYet,
};
// key config entry (touchpad areas)
struct TPicoAreaConfigEntry {
TRect rect;
//unsigned long actions;
};
struct TPicoKeyConfigEntry
{
unsigned short keyCode;
unsigned char scanCode;
unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled
TInt32 handle1; // for CancelCaptureKeyUpAndDowns()
TInt32 handle2; // for CancelCaptureKey()
char *name;
};
//**********************************
//CPicoServServer
//**********************************
//The server class; an active object.
//Contains an instance of RServer; a handle to the kernel server representation which is used
//to receive messages.
class CPicoServServer : public CServer
{
public:
enum {EPriority=950};
public:
static void New();
virtual CSharableSession *NewSessionL(const TVersion &aVersion) const;
static TInt ThreadFunction(TAny* aStarted);
protected:
CPicoServServer(TInt aPriority);
private:
TInt iActive;
};
//**********************************
//CPicoServSession
//**********************************
//This class represents a session in the server.
//CSession::Client() returns the client thread.
//Functions are provided to respond appropriately to client messages.
class CPicoServSession : public CSession
{
public:
// construct/destruct
CPicoServSession(RThread &aClient, CPicoServServer * aServer);
static CPicoServSession* NewL(RThread &aClient, CPicoServServer * aServer);
//service request
virtual void ServiceL(const RMessage &aMessage);
void DispatchMessageL(const RMessage &aMessage);
// services available
void loadROM();
void changeConfig();
void sendConfig();
void sendDebug();
protected:
// panic the client
void PanicClient(TInt aPanic) const;
// safewrite between client and server
void Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset=0);
private:
//CPicoServServer *iPicoSvr;
unsigned char *rom_data;
};
//**********************************
//global functions
//**********************************
// function to panic the server
GLREF_C void PanicServer(TPicoServPanic aPanic);
int saveLoadGame(int load, int sram=0);
#endif // __SIMPLESERVER_H

View file

@ -0,0 +1,24 @@
#{"PicodriveN"},(0x1000C193),0,93,0
;
; For the UIQ?
(0x101F617B), 2, 0, 0, {"UIQ20ProductID"}
;
; PicodriveN (Frontend)
;
"..\..\..\..\..\epoc32\release\armi\urel\PicodriveN.app"-"!:\system\apps\PicodriveN\PicodriveN.app"
"..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PicodriveN.rsc"-"!:\system\apps\PicodriveN\PicodriveN.rsc"
"..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PicodriveN.aif"-"!:\system\apps\PicodriveN\PicodriveN.aif"
"..\audio\audio_mediaserver.dll"-"!:\system\apps\PicodriveN\audio_mediaserver.dll"
"..\audio\audio_motorola.dll"-"!:\system\apps\PicodriveN\audio_motorola.dll"
;
; Picosmall
;
"..\PICOSMALL.EXE"-"!:\system\apps\PicodriveN\PICOSMALL.EXE"
;
; Text to show during installation, not copied to destination
;
".\install.txt"-"!:\system\apps\PicodriveN\install.txt",FILETEXT

View file

@ -0,0 +1,16 @@
Be sure to configure keys before loading your first ROM, because there is no default config. You need to configure 'pause emu' function to exit game.
Key configuration tutorial:
http://notaz.atspace.com/pico_tut/
You can also hold power button to exit (PXXX only).
(Motorola users, try the 'end' button).
Some quick sound related notes:
* You must use auto frameskip or you will get stuttering sound.
* Sound needs a lot of CPU power, so it is best to use "fit 0" or "fit 180" display modes and to exit all other apps.
* if you change sound settings AFTER loading a ROM, you may need to reset game to get sound (this depends on a ROM itself).
Enabling Z80 in sound settings will improve compatibility (you don't have to enable anything else, only Z80), because some games need it to run. But it slows emulation down, so turn it off if the game doesn't need it.
See readme for more details.

View file

@ -0,0 +1,347 @@
About
-----
PicodriveN is another port of PicoDrive, Dave's Megadrive / Genesis
emulator for Pocket PC. This version is based on PicoDrive 0.030 and is
made for Symbian UIQ devices. It is alternative version to another port by
AnotherGuest / Someone and is not based on it (so it has a little
different name). It also has full sound support (starting
from version 0.70) .
Features
--------
* Good compatibility (> 90%)
* Improved Cyclone 68000 core.
* Zipped ROMs and savestates.
* SRAM support, including serial SRAM.
* Game screen rotation with many render modes (like 'centered' and 'fit').
* Selectable frameskip.
* Configurable keys and touchpad.
* Flip-closed mode for SE phones.
* Full sound support.
Problems / limitations
----------------------
* 32x, Sega CD, SVP are not emulated.
* Various VDP quirks (window bug, scroll size 2, etc.) are not emulated,
as very few games use this.
* Some games don't work or have glitches because of inaccurate sync.
Configuration
-------------
1. Keys:
If it looks confusing to you, check this tutorial first:
http://notaz.atspace.com/pico_tut/
There are no default settings.
When you start key configuration mode, black screen with dark-red squares will
appear. Also there will be little 'control' on the right with the function
name in it, and arrows on the corners of it. You can tap on these corners to
select a function. You can also tap on these squares to bind that function to
them. This way you can associate touchpad areas with game-controls or functions.
I also made a small square in every corner of the screen to be used as a virtual
button for some function, like save state. You can bind it as you like. To
bind phone buttons, simply select the function you need, and press a button
you want. To unbind any key or touchpad area, simply push or tap it again.
To configure flip-closed mode, enter configuration mode and close flip.
When finished, select 'done' and press any key. You can also hold 'Power'
button for a while to exit (seems to work on PXXX only).
You need to bind 'pause emu' function to be able exit game when ROM is loaded.
You can also exit game by holding 'power' button (possibly 'end' for motorola
users (?)).
2. Main Settings:
Here you can set the orientation of screen and the drawing mode. The "fit"
option will scale the image so it fully fits in the screen, but some detail
will be lost. "center" displays the game at the center of the screen, but
non-fitting parts are not visible then (better for RPG games with lots of
text, which becomes unreadable in 'fit' mode). "fit2" was meant for Pxxx FC
gaming and will always use 208x146 for P800 and 208x208 for all other phones.
"Fast renderer" enables faster rendering method, but it works only with some
games (some other have serious glitches or even hang).
"Accurate timing" is needed for some games to run (like Red Zone). It should
be kept off for all other games, because it slows emulation down. Some games
also need this option for proper sound, so enable this if game has any
glitches.
"Accurate sprites" fixes sprite priority problems, for example if game
character is in front of or behind some object it should not be, this option
should fix it. This option does not work in "Fast renderer" mode.
"Show FPS" shows game frames per second in format XX/YY, where XX is the
number of frames shown per previous second, and YY is the number of frames
emulated, but not necessarily shown. By calculating YY-XX you get the number
of skipped frames per second.
3. Sound settings:
Sound emulation is very picky on CPU power (in most cases sound alone uses
more CPU power than everything else altogether), but it is still possible to
play some games. When using sound, the recommended display modes are "fit 0"
and "fit 180", because these are the fastest ones. Also try "Alternative
renderer", but it might cause graphical glitches. You must use auto frameskip
when using sound, or else you will get stuttering sound. Also, it is
recommended to exit all other non-vital apps (you can use SMan for this),
disable bluetooth and any other devices your phone may have. I also noticed
that simply connecting the phone battery charger strangely slows everything
down.
"Enable sound" tries to enable sound output on your device, but that alone is
not enough to get sound. You need to enable the sound chips below:
"Z80" is secondary CPU in genesis and is mostly used to control the other 2
sound chips. So if you disable Z80, sound will be lost in most games, with
some exceptions like Sonic1. It is possible to use Z80 for other things,
some games do that and Z80 must be enabled to run them at all.
"YM2612" is a fairly complex Frequency Modulation (FM) sound synthesis chip.
It was the main sound output device in genesis and is horrible CPU hog when
is tried to be emulated in software. Disabling it gives large speed
improvement, but most of the sound is lost.
"SN76496" is programmable sound generator (PSG) chip, used for various sound
effects and music elements.
The lowest setting is audio quality setting, which should be left set to
"8000Hz mono", because other choces slow everything down terribly and
are left for testing and possibly for use in other ports to faster future
devices with faster CPUs.
Note: if you change sound settings AFTER loading a ROM, you may need to reset
game to get sound. This is because most games initialize sound chips on
startup, and this data is lost when sound chips are being enabled/disabled.
4. Misc:
"6 button pad" will enable 6 button gamepad emulation and will add additional
X, Y, Z and MODE actions to key configuration.
Note: if you enable this, games may detect that and use different button
configuration, for example A ("high punch") will change to "low punch" in
Mortal Kombat and you will need to bind X for "high punch".
"gzip save states" enables gzip (similar to ordinary zip, but a little
different) compression on your save states to save space. The compression
ratio is 50-90%, so it's worth to enable this.
"Use SRAM saves" option enables emulation of batery-backed save RAM some game
cartridges had. RPG games used it alot, but there were some others too, like
Sonic 3. If this is enabled, <ROMname>.srm files are generated when you exit
the emulator or load another ROM. Format is compatible with other popular
emulators (like Gens and Fusion).
5. Frameskip:
"Auto" option tries to run the game in it's original speed by skipping next
frame if the previous was rendered too slow.
"0" displays every frame, thus game runs very slow.
"1" skips every other frame. Use this for a game which is smoother, but a bit
too slow (actually depends on display mode you use).
"2" also makes the game smoother, but it will be too fast in most areas.
"4","8" is way too fast and is useful for skiping intros, etc.
Credits
-------
This emulator uses code from these people/projects:
Dave
Cyclone 68000 core, Pico emulation library
Homepage: http://www.finalburn.com/
E-mail: david(atsymbol)finalburn.com
notaz
UIQ port, Cyclone 68000 hacks, some additional coding (see changelog).
Homepage: http://notaz.atspace.com/
E-mail: notasas(atsymbol)gmail.com
Reesy & FluBBa
DrZ80, the Z80 emulator written in ARM assembly.
Homepage: http://reesy.gp32x.de/
E-mail: drsms_reesy(atsymbol)yahoo.co.uk
Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator development
software implementation of Yamaha FM sound generator
MultiArcadeMachineEmulator (MAME) development
Texas Instruments SN76489 / SN76496 programmable tone /noise generator
Homepage: http://www.mame.net/
Additional thanks
-----------------
* Peter van Sebille for ECompXL and his various open-source Symbian projects
to learn from.
* Steve Fischer for his open-source Motorola projects.
* Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful
info about genesis hardware.
* Stéphane Dallongeville for creating Gens and making it open-source.
* Steve Snake for all that he has done for Genesis emulation scene.
* Bart Trzynadlowski for his SSFII and 68000 docs.
* Haze for his research (http://haze.mameworld.info).
* The development team behind "Symbian GCC Improvement Project"
(http://www.inf.u-szeged.hu/symbian-gcc/) for their updated compile tools.
* Mark and Jean-loup for zlib library.
* Reesy for also finding some Cyclone bugs.
* Inder for the icons.
Changelog
---------
0.94
* Improved interrupt timing, Mazin Saga and Burning Force now works.
* Rewritten renderer code to better suit gp2x, should be faster on other
ports too.
+ Added support for banking used by 12-in-1 and 4-in-1 ROMs (thanks Haze).
+ Added some protection device faking, used by some unlicensed games like
Super Bubble Bobble, King of Fighters, Elf Wor, ...
+ Added primitive Virtua Racing SVP faking, so menus can be seen now.
0.93
* Fixed a problem with P900/P910 key configuration in FC mode.
* Improved shadow/hilight mode emulation. Still not perfect, but should be
enough for most games.
+ Save state slots added.
+ Region selector added.
0.92
VDP changes:
* VDP emulation is now more accurate (fixes flickering in Chase HQ II,
Super Hang-On and some other problems in other games).
* HV counter emulation is now much more accurate. Fixes the Asterix games,
line in Road Rash 3, etc.
* Minnor sprite and layer scroll masking bugs fixed.
+ Added partial interlace mode renderer (Sonic 2 vs mode)
* Fixed a crash in both renderers when certain size window layers were used.
+ Added emulation of shadow/hilight operator sprites. Other shadow/hilight
effects are still unemulated.
+ Sprite emulation is more accurate, sprite limit is emulated.
+ Added "accurate sprites" option, which always draws sprites in correct
order and emulates sprite collision bit, but is significantly slower.
Emulation changes:
* Improved interrupt handling, added deferred interrupt emulation
(Lemmings, etc).
+ Added serial EEPROM SRAM support (Wonder Boy in Monster World,
Megaman - The Wily Wars and many EA sports games like NBA Jam).
+ Implemented ROM banking for Super Street Fighter II - The New Challengers
* Updated to the latest version of DrZ80 core, integrated memory handlers
in it for better performance. A noticeable performance increase, but save
states may not work from the previous version (you can only use them with
sound disabled in that case).
+ SRAM word read handler was using incorrect byte order, fixed.
Changes in Cyclone 0.0086:
+ Added missing CHK opcode handler (used by SeaQuest DSV).
+ Added missing TAS opcode handler (Gargoyles,Bubba N Stix,...). As in real genesis,
memory write-back phase is ignored (but can be enabled in config.h if needed).
+ Added missing NBCD and TRAPV opcode handlers.
+ Added missing addressing mode for CMP/EOR.
+ Added some minor optimizations.
- Removed 216 handlers for 2927 opcodes which were generated for invalid addressing modes.
+ Fixed flags for ASL, NEG, NEGX, DIVU, ADDX, SUBX, ROXR.
+ Bugs fixed in MOVEP, LINK, ADDQ, DIVS handlers.
* Undocumented flags for CHK, ABCD, SBCD and NBCD are now emulated the same way as in Musashi.
+ Added Uninitialized Interrupt emulation.
+ Altered timing for about half of opcodes to match Musashi's.
0.80
* Nearly all VDP code was rewritten in ARM asm. Gives ~10-25% performance
increase (depends on game).
* Optimized 32-column renderer not to render tiles offscreen, games which
use 32-column display (like Shining Force) run ~50% faster.
+ Added new "Alternative renderer", which gives another ~30-45% performance
increase (in addition to mentioned above), but works only with some games,
because it is missing some features (it uses tile-based renderering
instead of default line-based and disables H-ints).
+ Added "fit2" display mode for all FC gamers. It always uses 208x146 for
P800 and 208x208 for all other phones.
+ Added volume control for Motorolas (experimental).
VDP changes:
+ Added support for vertical window (used by Vapor Trail, Mercs, GRIND
Stormer and others).
+ Added sprite masking (hiding), adds some speed.
+ Added preliminary H counter emulation. Comix Zone and Sonic 3D Blast
special stage are now playable.
+ Added column based vertical scrolling (Gunstar Heroes battleship level,
Sonic and Knuckles lava boss, etc).
Emulation changes:
+ Re-added and improved Z80 faking when Z80 is disabled. Many games now can
be played without enabling Z80 (Lost Vikings, Syndicate, etc), but some
still need it (International Superstar Soccer Deluxe).
* Improved ym2612 timers, Outrun music plays at correct speed, voices in
Earthworm Jim play better, more games play sound.
* I/O registers now remember their values (needed for Pirates! Gold)
+ Added support for 6 button pad.
Changes in Cyclone 0.0083wip:
+ Added missing CHK opcode (used by SeaQuest DSV).
+ Added missing TAS opcode (Gargoyles). As in real genesis, write-back phase
is ignored (but is enabled for other systems).
Backported stuff from Snes9x:
* Fixed Pxxx jog up/down which were not working in game.
+ Added an option to gzip save states to save space.
+ The emulator now pauses whenever it is loosing focus, so it will now pause
when alarm/ponecall/battery low/... windows come up.
- Removed 'pause on phonecall' feature, as it is no longer needed.
+ Video fix for asian A1000s.
0.70
* Started using tools from "Symbian GCC Improvement Project", which give
considerable speed increase (~4fps in "center 90" mode).
* Rewrote some drawing routines in ARM assembly (gives ~6 more fps in
"center 90" mode).
* Minor improvement to 0 and 180 "fit" modes. Now they look slightly better
and are faster.
* Minor stability improvements (emulator is less likely to crash).
+ Added some background for OSD text for better readability.
+ Added Pal/NTSC detection. This is needed for proper sound speed.
+ Implemented Reesy's DrZ80 Z80 emu. Made some changes to it with hope to make
it faster.
+ Implemented ym2612 emu from the MAME project. Runs well but sometimes sounds
a bit weird. Could be a little faster, so made some changes too.
+ Implemented SN76489 emu from the MAME project.
+ Added two separate sound output methods (mediaserver and cmaudiofb) with
autodetection (needs testing).
* Fixed VDP DMA fill emulation (as described in Charles MacDonald's docs),
fixes Contra and some other games.
0.301
Launcher:
* Launcher now starts emulation process from current directory,
not from hardcoded paths.
* Improved 'pause on call' feature, should hopefully work with Motorola phones.
0.30
Initial release.
Disclaimer
----------
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

24
platform/uiq2/audio.h Normal file
View file

@ -0,0 +1,24 @@
// audio interface, used in picodriveN
#ifndef __AUDIO_H
#define __AUDIO_H
#include <e32std.h>
class IGameAudio : public CBase
{
public:
virtual TInt16 *NextFrameL() = 0;
virtual TInt16 *DupeFrameL(TInt &aUnderflowed) = 0;
virtual TInt16 *ResumeL() = 0;
virtual void Pause() = 0;
virtual void ChangeVolume(TInt aUp) = 0; // for Motorolas (experimental)
};
// our audio object maker type
typedef IGameAudio *(*_gameAudioNew)(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);
#endif /* __AUDIO_H */

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,402 @@
# CWD \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\
# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.MMP
# Target AUDIO_MEDIASERVER.DLL
# TargetType DLL
# BasicTargetType DLL
# MakefileType GNU
ERASE = @erase 2>>nul
# EPOC DEFINITIONS
EPOCBLD = ..\..\..\..\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI
EPOCTRG = ..\..\..\..\EPOC32\RELEASE\ARMI
EPOCLIB = ..\..\..\..\EPOC32\RELEASE\ARMI
EPOCLINK = ..\..\..\..\EPOC32\RELEASE\ARMI
EPOCSTATLINK = ..\..\..\..\EPOC32\RELEASE\ARMI
EPOCASSPLINK = ..\..\..\..\EPOC32\RELEASE\MARM
EPOCDATA = \DEV\UIQ21\EPOC32\DATA
EPOCINC = \DEV\UIQ21\EPOC32\INCLUDE
TRGDIR =
DATADIR = Z\SYSTEM\DATA
EPOCBLDUREL = $(EPOCBLD)\UREL
EPOCTRGUREL = $(EPOCTRG)\UREL
EPOCLIBUREL = $(EPOCLIB)\UREL
EPOCLINKUREL = $(EPOCLINK)\UREL
EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL
EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL
EPOCBLDUDEB = $(EPOCBLD)\UDEB
EPOCTRGUDEB = $(EPOCTRG)\UDEB
EPOCLIBUDEB = $(EPOCLIB)\UREL
EPOCLINKUDEB = $(EPOCLINK)\UREL
EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB
EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL
# EPOC PSEUDOTARGETS
UREL : MAKEWORKUREL RESOURCEUREL
UDEB : MAKEWORKUDEB RESOURCEUDEB
ALL : UREL UDEB
CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY
WHAT WHATALL : WHATUREL WHATUDEB
RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB
CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB
CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB
MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB
LISTING LISTINGALL : LISTINGUREL LISTINGUDEB
MAKEWORK : MAKEWORKLIBRARY
RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE
# must set both PATH and Path to make it work correctly
Path:=X:\DEV\UIQ21\EPOC32\gcc\bin;$(Path)
PATH:=$(Path)
INCDIR = -I "." -I "..\.." -I "..\..\..\..\EPOC32\INCLUDE"
GCCFLAGS=-march=armv4t -mthumb-interwork \
-pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas
GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS)
GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS)
GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS)
UREL : \
$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL \
LIBRARY
UDEB : \
$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL \
LIBRARY
RESOURCEUREL : MAKEWORKUREL
RESOURCEUDEB : MAKEWORKUDEB
LIBRARY : MAKEWORKLIBRARY $(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB
# REAL TARGET - LIBRARY
$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF
dlltool -m arm_interwork --output-lib "$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB" \
--def ".\AUDIO_MEDIASERVER.DEF" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL"
\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF
dlltool -m arm --output-lib "..\..\..\..\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB" \
--def ".\AUDIO_MEDIASERVER.DEF" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL"
\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF
dlltool -m thumb --output-lib "..\..\..\..\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB" \
--def ".\AUDIO_MEDIASERVER.DEF" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL"
FREEZE :
perl -S efreeze.pl "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def"
CLEANLIBRARY :
-$(ERASE) "$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB"
-$(ERASE) "\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB"
-$(ERASE) "\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB"
GENERIC_RESOURCE : GENERIC_MAKEWORK
# REAL TARGET - BUILD VARIANT UREL
WHATUREL : WHATGENERIC
CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL
CLEANBUILDUREL :
@perl -S ermdir.pl "$(EPOCBLDUREL)"
CLEANRELEASEUREL : CLEANGENERIC
UREL_RELEASEABLES1= \
\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.DLL \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.DLL.MAP \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.LIB \
\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB
WHATUREL:
@echo $(UREL_RELEASEABLES1)
CLEANRELEASEUREL:
-$(ERASE) $(UREL_RELEASEABLES1)
LISTINGUREL : MAKEWORKUREL \
LISTINGURELAUDIO_MEDIASERVER \
LISTINGURELPOLLEDAS
LIBSUREL= \
$(EPOCSTATLINKUREL)\EDLLSTUB.LIB \
$(EPOCSTATLINKUREL)\EGCC.LIB \
$(EPOCLINKUREL)\EUSER.LIB \
$(EPOCLINKUREL)\MEDIACLIENTAUDIOSTREAM.LIB \
$(EPOCLINKUREL)\MEDIACLIENT.LIB
$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL : $(EPOCBLDUREL)\AUDIO_MEDIASERVER.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL)
dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in"
perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def"
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf"
dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \
--output-exp "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL"
ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" --dll \
--base-file "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" -o "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" \
"$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" \
--no-whole-archive $(LIBSUREL) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp"
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL"
dlltool -m arm_interwork \
--def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL" \
--base-file "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" \
--output-exp "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp"
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas"
ld -s -e _E32Dll -u _E32Dll --dll \
"$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \
-Map "$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL.map" -o "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" \
"$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" \
--no-whole-archive $(LIBSUREL) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp"
petran "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" "$@" \
-nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c196
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL"
OBJECTSUREL= \
$(EPOCBLDUREL)\AUDIO_MEDIASERVER.o \
$(EPOCBLDUREL)\POLLEDAS.o
$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in : $(OBJECTSUREL)
if exist "$@" del "$@"
ar cr $@ $^
# REAL TARGET - BUILD VARIANT UDEB
WHATUDEB : WHATGENERIC
CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB
CLEANBUILDUDEB :
@perl -S ermdir.pl "$(EPOCBLDUDEB)"
CLEANRELEASEUDEB : CLEANGENERIC
UDEB_RELEASEABLES1= \
\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MEDIASERVER.DLL \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MEDIASERVER.DLL.MAP \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.LIB \
\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB
WHATUDEB:
@echo $(UDEB_RELEASEABLES1)
CLEANRELEASEUDEB:
-$(ERASE) $(UDEB_RELEASEABLES1)
LISTINGUDEB : MAKEWORKUDEB \
LISTINGUDEBAUDIO_MEDIASERVER \
LISTINGUDEBPOLLEDAS
LIBSUDEB= \
$(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \
$(EPOCSTATLINKUDEB)\EGCC.LIB \
$(EPOCLINKUDEB)\EUSER.LIB \
$(EPOCLINKUDEB)\MEDIACLIENTAUDIOSTREAM.LIB \
$(EPOCLINKUDEB)\MEDIACLIENT.LIB
$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL : $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB)
dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in"
perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def"
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf"
dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \
--output-exp "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL"
ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" --dll \
--base-file "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" -o "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" \
"$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" \
--no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp"
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL"
dlltool -m arm_interwork \
--def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \
--dllname "AUDIO_MEDIASERVER[1000c196].DLL" \
--base-file "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" \
--output-exp "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp"
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas"
ld -e _E32Dll -u _E32Dll --dll \
"$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \
-Map "$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL.map" -o "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" \
"$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" \
--no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp"
objcopy -X "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" "$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.sym"
petran "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" "$@" \
-nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c196
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL"
OBJECTSUDEB= \
$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o \
$(EPOCBLDUDEB)\POLLEDAS.o
$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in : $(OBJECTSUDEB)
if exist "$@" del "$@"
ar cr $@ $^
# SOURCES
# Source AUDIO_MEDIASERVER.CPP
$(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis $(EPOCBLDUREL)\AUDIO_MEDIASERVER.o \
$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o \
: \
\DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \
\DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \
\DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDAAUDIOOUTPUTSTREAM.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\BASE.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\BASE.INL \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\CONTROLLER.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\PORT.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\UTILITY.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIO.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIO.HRH \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIOSTREAM.HRH \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.HRH \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.INL \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.HRH \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\PORT.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\PORT.HRH \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\RESOURCE.H \
\DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\RESOURCE.HRH \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO.H \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.H \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.H
$(EPOCBLDUREL)\AUDIO_MEDIASERVER.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp
$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Audio_mediaserver.cpp"
LISTINGURELAUDIO_MEDIASERVER : $(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis
perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.lst.ARMI
$(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp
$(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_mediaserver.cpp" > $@
$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp
$(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Audio_mediaserver.cpp"
LISTINGUDEBAUDIO_MEDIASERVER : $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis
perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.lst.ARMI
$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp
$(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_mediaserver.cpp" > $@
# Source POLLEDAS.CPP
$(EPOCBLDUREL)\POLLEDAS.lis $(EPOCBLDUREL)\POLLEDAS.o \
$(EPOCBLDUDEB)\POLLEDAS.lis $(EPOCBLDUDEB)\POLLEDAS.o \
: \
\DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \
\DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.H
$(EPOCBLDUREL)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp
$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"
LISTINGURELPOLLEDAS : $(EPOCBLDUREL)\POLLEDAS.lis
perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.lst.ARMI
$(EPOCBLDUREL)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp
$(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@
$(EPOCBLDUDEB)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp
$(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"
LISTINGUDEBPOLLEDAS : $(EPOCBLDUDEB)\POLLEDAS.lis
perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.lst.ARMI
$(EPOCBLDUDEB)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp
$(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@
ROMFILE:
@echo file=\DEV\UIQ21\EPOC32\RELEASE\ARMI\##BUILD##\AUDIO_MEDIASERVER.DLL System\Libs\AUDIO_MEDIASERVER.DLL
WHATGENERIC CLEANGENERIC :
@rem none
# Rules to create all necessary directories
GENERIC_MAKEWORK : \
\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI
MAKEWORKLIBRARY : \
\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \
\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL
MAKEWORKUDEB : \
\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UDEB \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB
MAKEWORKUREL : \
\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UREL \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL
\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI \
\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UDEB \
\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UREL \
\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB \
\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \
\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL \
:
perl -S emkdir.pl $@

View file

@ -0,0 +1,32 @@
/*******************************************************************
*
* File: PolledAS.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __POLLED_AS_H
#define __POLLED_AS_H
class CPrivatePolledActiveScheduler;
class CPolledActiveScheduler : public CBase
{
public:
~CPolledActiveScheduler();
static CPolledActiveScheduler* NewL();
//static CPolledActiveScheduler* Instance();
void Schedule();
protected:
CPolledActiveScheduler(){};
void ConstructL();
CPrivatePolledActiveScheduler* iPrivatePolledActiveScheduler;
};
#endif /* __POLLED_AS_H */

View file

@ -0,0 +1,321 @@
/*******************************************************************
*
* File: Audio_mediaserver.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#include "audio_mediaserver.h"
//#define __DEBUG_PRINT_SND
#ifdef __DEBUG_PRINT_SND
#include <e32svr.h> // RDebug
#define DEBUGPRINT(x...) RDebug::Print(x)
#else
#define DEBUGPRINT(x...)
#endif
GLDEF_C TInt E32Dll(TDllReason)
{
return KErrNone;
}
/*******************************************
*
* CGameAudioMS
*
*******************************************/
CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)
: iRate(aRate), iStereo(aStereo), iBufferedFrames(aBufferedFrames), iPcmFrames(aPcmFrames)
{
}
CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)
{
DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i, %i)"),aRate, aStereo, aPcmFrames, aBufferedFrames);
CGameAudioMS* self = new(ELeave) CGameAudioMS(aRate, aStereo, aPcmFrames, aBufferedFrames);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(); // self
return self;
}
CGameAudioMS::~CGameAudioMS()
{
DEBUGPRINT(_L("CGameAudioMS::~CGameAudioMS()"));
if(iMdaAudioOutputStream) {
iScheduler->Schedule(); // let it finish it's stuff
iMdaAudioOutputStream->Stop();
delete iMdaAudioOutputStream;
}
if(iServer) delete iServer;
for (TInt i=0 ; i<KSoundBuffers+1 ; i++)
delete iSoundBuffers[i];
// Polled AS
if(iScheduler) delete iScheduler;
}
void CGameAudioMS::ConstructL()
{
iServer = CMdaServer::NewL();
iScheduler = CPolledActiveScheduler::NewL();
switch(iRate) {
case 11025: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate11025Hz; break;
case 16000: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate16000Hz; break;
case 22050: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate22050Hz; break;
default: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz; break;
}
iMdaAudioDataSettings.iChannels = (iStereo) ? TMdaAudioDataSettings::EChannelsStereo : TMdaAudioDataSettings::EChannelsMono;
iMdaAudioDataSettings.iCaps = TMdaAudioDataSettings::ESampleRateFixed | iMdaAudioDataSettings.iSampleRate;
iMdaAudioDataSettings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
TInt bytesPerFrame = iStereo ? iPcmFrames << 2 : iPcmFrames << 1;
for (TInt i=0 ; i<KSoundBuffers ; i++)
{
iSoundBuffers[i] = HBufC8::NewL(bytesPerFrame * iBufferedFrames);
iSoundBuffers[i]->Des().FillZ (bytesPerFrame * iBufferedFrames);
}
// because feeding 2 buffers after an underflow is a little too much, but feeding 1 may be not enough,
// prepare this ~50ms empty buffer to additionaly feed after every underflow.
// Another strange thing here: if we try to make and odd-length sound buffer here,
// system then outputs horrible noise! (this happened on 22050 mono and when there
// were no parenthesis around iBufferedFrames / 4.
iSoundBuffers[KSoundBuffers] = HBufC8::NewL(bytesPerFrame * (iBufferedFrames / 4));
iSoundBuffers[KSoundBuffers]->Des().FillZ (bytesPerFrame * (iBufferedFrames / 4));
iCurrentBuffer = 0;
// here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later.
iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);
if(iMdaAudioOutputStream) {
delete iMdaAudioOutputStream;
iMdaAudioOutputStream = 0;
}
}
/* currently unused
TInt CGameAudioMS::Write(TInt16* aBuffer, TInt aSize)
{
TInt byteSize = iStereo ? aSize << 2 : aSize << 1;
Mem::Copy(iCurrentPosition, aBuffer, byteSize);
iCurrentPosition += aSize;
if (++iFrameCount == iBufferedFrames)
{
WriteBlock();
}
CPolledActiveScheduler::Instance()->Schedule();
if(iListener.iUnderflowed) Underflowed(); // oh no, CMdaAudioOutputStream underflowed!
return aSize;
}
*/
// returns a pointer to buffer for next frame,
// to be used when iSoundBuffers are used directly
TInt16 *CGameAudioMS::NextFrameL()
{
iCurrentPosition += iPcmFrames << (iStereo?1:0);
if (++iFrameCount == iBufferedFrames)
{
WriteBlockL();
}
iScheduler->Schedule();
if(iListener.iUnderflowed) {
if(iListener.iUnderflowed > KMaxUnderflows) {
delete iMdaAudioOutputStream;
iMdaAudioOutputStream = 0;
return 0;
}
UnderflowedL(); // not again!
}
return iCurrentPosition;
}
TInt16 *CGameAudioMS::DupeFrameL(TInt &aUnderflowed)
{
TInt shorts = iStereo ? (iPcmFrames << 1) : iPcmFrames;
if(iFrameCount)
Mem::Copy(iCurrentPosition, iCurrentPosition-shorts, shorts<<1);
else {
TInt lastBuffer = iCurrentBuffer;
if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;
Mem::Copy(iCurrentPosition, ((TInt16*) (iSoundBuffers[lastBuffer]->Ptr()))+shorts*(iBufferedFrames-1), shorts<<1);
}
iCurrentPosition += shorts;
if (++iFrameCount == iBufferedFrames)
{
WriteBlockL();
}
iScheduler->Schedule();
if((aUnderflowed = iListener.iUnderflowed)) { // not again!
if(iListener.iUnderflowed > KMaxUnderflows) {
delete iMdaAudioOutputStream;
iMdaAudioOutputStream = 0;
return 0;
}
UnderflowedL(); // not again!
}
return iCurrentPosition;
}
void CGameAudioMS::WriteBlockL()
{
iScheduler->Schedule();
// do not write until stream is open
if(!iListener.iIsOpen) WaitForOpenToCompleteL();
//if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks?
//iListener.iHasCopied = EFalse;
if(!iListener.iUnderflowed) {
// don't write if sound is lagging too much
if(iTime - iMdaAudioOutputStream->Position().Int64() <= TInt64(0, KMaxLag)) {
//RDebug::Print(_L("delta: %i"), iTime.Low() - iMdaAudioOutputStream->Position().Int64().Low());
iMdaAudioOutputStream->WriteL(*iSoundBuffers[iCurrentBuffer]);
iTime += KBlockTime;
}
}
iFrameCount = 0;
if (++iCurrentBuffer == KSoundBuffers)
iCurrentBuffer = 0;
iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();
}
void CGameAudioMS::Pause()
{
if(!iMdaAudioOutputStream) return;
iScheduler->Schedule(); // let it finish it's stuff
iMdaAudioOutputStream->Stop();
delete iMdaAudioOutputStream;
iMdaAudioOutputStream = 0;
}
// call this before doing any playback!
TInt16 *CGameAudioMS::ResumeL()
{
DEBUGPRINT(_L("CGameAudioMS::Resume()"));
iScheduler->Schedule();
// we act a bit strange here: simulate buffer underflow, which actually starts audio
iListener.iIsOpen = ETrue;
iListener.iUnderflowed = 1;
iFrameCount = 0;
iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();
return iCurrentPosition;
}
// handles underflow condition
void CGameAudioMS::UnderflowedL()
{
// recreate the stream
//iMdaAudioOutputStream->Stop();
if(iMdaAudioOutputStream) delete iMdaAudioOutputStream;
iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);
iMdaAudioOutputStream->Open(&iMdaAudioDataSettings);
iListener.iIsOpen = EFalse; // wait for it to open
//iListener.iHasCopied = ETrue; // but don't wait for last copy to complete
// let it open and feed some stuff to make it happy
User::After(0);
TInt lastBuffer = iCurrentBuffer;
if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;
iScheduler->Schedule();
if(!iListener.iIsOpen) WaitForOpenToCompleteL();
iMdaAudioOutputStream->WriteL(*iSoundBuffers[KSoundBuffers]); // special empty fill-up
iMdaAudioOutputStream->WriteL(*iSoundBuffers[lastBuffer]);
iTime = TInt64(0, KBlockTime/4 + KBlockTime);
}
/*
void CGameAudioMS::WaitForCopyToCompleteL()
{
DEBUGPRINT(_L("CGameAudioMS::WaitForCopyToCompleteL"));
while (!iListener.iHasCopied) {
//User::After(0);
iScheduler->Schedule();
}
}
*/
void CGameAudioMS::WaitForOpenToCompleteL()
{
DEBUGPRINT(_L("CGameAudioMS::WaitForOpenToCompleteL"));
TInt count = 20; // 2 seconds
TInt waitPeriod = 100 * 1000;
if(!iListener.iIsOpen) {
// it is often enough to do this
User::After(0);
iScheduler->Schedule();
}
while (!iListener.iIsOpen && --count)
{
User::After(waitPeriod);
iScheduler->Schedule();
}
if (!iListener.iIsOpen)
User::LeaveIfError(KErrNotSupported);
}
void CGameAudioMS::ChangeVolume(TInt aUp)
{
// do nothing
DEBUGPRINT(_L("CGameAudioMS::ChangeVolume(%i)"), aUp);
}
void TGameAudioEventListener::MaoscOpenComplete(TInt aError)
{
DEBUGPRINT(_L("CGameAudioMS::MaoscOpenComplete, error=%d"), aError);
iIsOpen = ETrue;
if(aError) iUnderflowed++;
else iUnderflowed = 0;
}
void TGameAudioEventListener::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer)
{
DEBUGPRINT(_L("CGameAudioMS::MaoscBufferCopied, error=%d"), aError);
// iHasCopied = ETrue;
if(aError) // shit!
iUnderflowed++;
}
void TGameAudioEventListener::MaoscPlayComplete(TInt aError)
{
DEBUGPRINT(_L("CGameAudioMS::MaoscPlayComplete: %i"), aError);
if(aError)
iUnderflowed++; // never happened to me while testing, but just in case
}

View file

@ -0,0 +1,3 @@
EXPORTS
; NEW:
NewL__12CGameAudioMSiiii @ 1 NONAME ; static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);

View file

@ -0,0 +1,87 @@
/*******************************************************************
*
* File: Audio_mediaserver.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __AUDIO_MEDIASERVER_H
#define __AUDIO_MEDIASERVER_H
#include <Mda\Common\Audio.h>
#include <MdaAudioOutputStream.h>
#include "audio.h"
#include "polledas.h"
const TInt KSoundBuffers = 4;
const TInt KBlockTime = 1000000 / 5; // hardcoded: 5 updates/sec
const TInt KMaxLag = 260000; // max sound lag, lower values increase chanse of underflow
const TInt KMaxUnderflows = 50; // max underflows/API errors we are going allow in a row (to prevent lockups)
class TGameAudioEventListener : public MMdaAudioOutputStreamCallback
{
public: // implements MMdaAudioOutputStreamCallback
void MaoscOpenComplete(TInt aError);
void MaoscBufferCopied(TInt aError, const TDesC8& );
void MaoscPlayComplete(TInt aError);
TBool iIsOpen;
// TBool iHasCopied;
TInt iUnderflowed;
};
class CGameAudioMS : public IGameAudio // IGameAudio MUST be specified first!
{
public: // implements IGameAudio
TInt16 *NextFrameL();
TInt16 *DupeFrameL(TInt &aUnderflowed);
TInt16 *ResumeL();
void Pause();
void ChangeVolume(TInt aUp);
public:
~CGameAudioMS();
CGameAudioMS(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);
void ConstructL();
EXPORT_C static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);
protected:
void WriteBlockL();
void UnderflowedL();
protected:
void WaitForOpenToCompleteL();
// void WaitForCopyToCompleteL();
TInt iRate;
TBool iStereo;
CMdaAudioOutputStream *iMdaAudioOutputStream;
TMdaAudioDataSettings iMdaAudioDataSettings;
TGameAudioEventListener iListener;
CPolledActiveScheduler *iScheduler;
HBufC8* iSoundBuffers[KSoundBuffers+1];
TInt iBufferedFrames;
TInt16* iCurrentPosition;
TInt iCurrentBuffer;
TInt iFrameCount;
TInt iPcmFrames;
CMdaServer* iServer;
TInt64 iTime;
};
#endif /* __AUDIO_MEDIASERVER_H */

View file

@ -0,0 +1,18 @@
TARGET audio_mediaserver.dll
TARGETTYPE dll
UID 0x100039CE 0x1000C196
USERINCLUDE .
USERINCLUDE ..\..\
SYSTEMINCLUDE \epoc32\include
SOURCEPATH .
SOURCE audio_mediaserver.cpp
SOURCE polledas.cpp
LIBRARY EUSER.LIB mediaclientaudiostream.lib mediaclient.lib
deffile .\audio_mediaserver.def
nostrictdef

View file

@ -0,0 +1,213 @@
/*******************************************************************
*
* File: PolledAS.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
/*
* Oh Lord, forgive me for I have sinned.
* In their infinite wisdom, Symbian Engineers have decided that
* the Active Scheduler's queue of Active Objects is private
* and no getters are provided... sigh.
* This mere mortal will have to excercise the power of C pre-processor
* once more to circumvent the will of the gods.
*/
#include <e32std.h>
// from e32base.h
class CBase
{
public:
IMPORT_C virtual ~CBase();
inline TAny* operator new(TUint aSize,TAny *aBase) {Mem::FillZ(aBase,aSize);return(aBase);}
IMPORT_C TAny* operator new(TUint aSize);
inline TAny* operator new(TUint aSize, TLeave) {return newL(aSize);}
IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize);
protected:
IMPORT_C CBase();
private:
CBase(const CBase&);
CBase& operator=(const CBase&);
IMPORT_C static TAny* newL(TUint aSize);
};
class CActive : public CBase
{
public:
enum TPriority
{
EPriorityIdle=-100,
EPriorityLow=-20,
EPriorityStandard=0,
EPriorityUserInput=10,
EPriorityHigh=20,
};
public:
IMPORT_C ~CActive();
IMPORT_C void Cancel();
IMPORT_C void Deque();
IMPORT_C void SetPriority(TInt aPriority);
inline TBool IsActive() const {return(iActive);}
inline TBool IsAdded() const {return(iLink.iNext!=NULL);}
inline TInt Priority() const {return iLink.iPriority;}
protected:
IMPORT_C CActive(TInt aPriority);
IMPORT_C void SetActive();
// Pure virtual
virtual void DoCancel() =0;
virtual void RunL() =0;
IMPORT_C virtual TInt RunError(TInt aError);
public:
TRequestStatus iStatus;
private:
TBool iActive;
TPriQueLink iLink;
friend class CActiveScheduler;
// friend class CServer;
friend class CPrivatePolledActiveScheduler; // added
};
class CActiveScheduler : public CBase
{
public:
IMPORT_C CActiveScheduler();
IMPORT_C ~CActiveScheduler();
IMPORT_C static void Install(CActiveScheduler* aScheduler);
IMPORT_C static CActiveScheduler* Current();
IMPORT_C static void Add(CActive* anActive);
IMPORT_C static void Start();
IMPORT_C static void Stop();
IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority);
IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler);
IMPORT_C virtual void WaitForAnyRequest();
IMPORT_C virtual void Error(TInt anError) const;
private:
void DoStart();
void OwnedStartLoop(TInt& aRunning);
IMPORT_C virtual void OnStarting();
IMPORT_C virtual void OnStopping();
IMPORT_C virtual void Reserved_1();
IMPORT_C virtual void Reserved_2();
friend class CPrivatePolledActiveScheduler; // added
private:
// private interface used through by CActiveSchedulerWait objects
friend class CActiveSchedulerWait;
static void OwnedStart(CActiveSchedulerWait& aOwner);
protected:
inline TInt Level() const {return(iLevel);}
private:
TInt iLevel;
TPriQue<CActive> iActiveQ;
};
class TCleanupItem;
class CleanupStack
{
public:
IMPORT_C static void PushL(TAny* aPtr);
IMPORT_C static void PushL(CBase* aPtr);
IMPORT_C static void PushL(TCleanupItem anItem);
IMPORT_C static void Pop();
IMPORT_C static void Pop(TInt aCount);
IMPORT_C static void PopAndDestroy();
IMPORT_C static void PopAndDestroy(TInt aCount);
IMPORT_C static void Check(TAny* aExpectedItem);
inline static void Pop(TAny* aExpectedItem);
inline static void Pop(TInt aCount, TAny* aLastExpectedItem);
inline static void PopAndDestroy(TAny* aExpectedItem);
inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem);
};
/*
* This will declare CPrivatePolledActiveScheduler as a friend
* of all classes that define a friend. CPrivatePolledActiveScheduler needs to
* be a friend of CActive
*/
//#define friend friend class CPrivatePolledActiveScheduler; friend
/*
* This will change the:
* void DoStart();
* method in CActiveScheduler to:
* void DoStart(); friend class CPrivatePolledActiveScheduler;
* We need this to access the private datamembers in CActiveScheduler.
*/
//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler;
//#include <e32base.h>
#include "PolledAS.h"
class CPrivatePolledActiveScheduler : public CActiveScheduler
{
public:
void Schedule();
};
void CPrivatePolledActiveScheduler::Schedule()
{
TDblQueIter<CActive> q(iActiveQ);
q.SetToFirst();
FOREVER
{
CActive *pR=q++;
if (pR)
{
if (pR->IsActive() && pR->iStatus!=KRequestPending)
{
pR->iActive=EFalse;
TRAPD(r,pR->RunL());
break;
}
}
else
break;
}
}
CPolledActiveScheduler::~CPolledActiveScheduler()
{
delete iPrivatePolledActiveScheduler;
}
//static CPolledActiveScheduler* sPolledActiveScheduler = NULL;
CPolledActiveScheduler* CPolledActiveScheduler::NewL()
{
//sPolledActiveScheduler =
CPolledActiveScheduler* self = new(ELeave)CPolledActiveScheduler;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self;
}
void CPolledActiveScheduler::ConstructL()
{
iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler;
iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler);
}
void CPolledActiveScheduler::Schedule()
{
iPrivatePolledActiveScheduler->Schedule();
}
/*
CPolledActiveScheduler* CPolledActiveScheduler::Instance()
{
// return (CPolledActiveScheduler*) CActiveScheduler::Current();
return sPolledActiveScheduler;
}
*/

View file

@ -0,0 +1,2 @@
copy %EPOCROOT%\epoc32\release\armi\urel\audio_mediaserver.dll ..\
..\..\..\qconsole-1.52\qtty\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\audio_mediaserver.dll ..\audio_mediaserver.dll" exit

View file

@ -0,0 +1 @@
copy %EPOCROOT%\epoc32\release\armi\urel\audio_mediaserver.dll ..\

View file

@ -0,0 +1,418 @@
# CWD \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\
# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.MMP
# Target AUDIO_MOTOROLA.DLL
# TargetType DLL
# BasicTargetType DLL
# MakefileType GNU
ERASE = @erase 2>>nul
# EPOC DEFINITIONS
EPOCBLD = ..\..\..\..\..\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI
EPOCTRG = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI
EPOCLIB = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI
EPOCLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI
EPOCSTATLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI
EPOCASSPLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\MARM
EPOCDATA = \DEV\A925SDK\EPOC32\DATA
EPOCINC = \DEV\A925SDK\EPOC32\INCLUDE
TRGDIR =
DATADIR = Z\SYSTEM\DATA
EPOCBLDUREL = $(EPOCBLD)\UREL
EPOCTRGUREL = $(EPOCTRG)\UREL
EPOCLIBUREL = $(EPOCLIB)\UREL
EPOCLINKUREL = $(EPOCLINK)\UREL
EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL
EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL
EPOCBLDUDEB = $(EPOCBLD)\UDEB
EPOCTRGUDEB = $(EPOCTRG)\UDEB
EPOCLIBUDEB = $(EPOCLIB)\UREL
EPOCLINKUDEB = $(EPOCLINK)\UREL
EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB
EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL
# EPOC PSEUDOTARGETS
UREL : MAKEWORKUREL RESOURCEUREL
UDEB : MAKEWORKUDEB RESOURCEUDEB
ALL : UREL UDEB
CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY
WHAT WHATALL : WHATUREL WHATUDEB
RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB
CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB
CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB
MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB
LISTING LISTINGALL : LISTINGUREL LISTINGUDEB
MAKEWORK : MAKEWORKLIBRARY
RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE
# must set both PATH and Path to make it work correctly
Path:=X:\DEV\A925SDK\EPOC32\gcc\bin;$(Path)
PATH:=$(Path)
INCDIR = -I "." -I "..\.." -I "..\..\..\..\..\A925SDK\EPOC32\INCLUDE"
GCCFLAGS=-march=armv4t -mthumb-interwork \
-pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas
GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS)
GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS)
GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS)
UREL : \
$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL \
LIBRARY
UDEB : \
$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL \
LIBRARY
RESOURCEUREL : MAKEWORKUREL
RESOURCEUDEB : MAKEWORKUDEB
LIBRARY : MAKEWORKLIBRARY $(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB
# REAL TARGET - LIBRARY
$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF
@echo AUDIO_MOTOROLA.LIB: dlltool
@dlltool -m arm_interwork --output-lib "$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB" \
--def ".\AUDIO_MOTOROLA.DEF" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL"
\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF
@echo AUDIO_MOTOROLA.LIB: dlltool
@dlltool -m arm --output-lib "..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB" \
--def ".\AUDIO_MOTOROLA.DEF" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL"
\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF
@echo AUDIO_MOTOROLA.LIB: dlltool
@dlltool -m thumb --output-lib "..\..\..\..\..\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB" \
--def ".\AUDIO_MOTOROLA.DEF" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL"
FREEZE :
perl -S efreeze.pl "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def"
CLEANLIBRARY :
-$(ERASE) "$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB"
-$(ERASE) "\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB"
-$(ERASE) "\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB"
GENERIC_RESOURCE : GENERIC_MAKEWORK
# REAL TARGET - BUILD VARIANT UREL
WHATUREL : WHATGENERIC
CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL
CLEANBUILDUREL :
@perl -S ermdir.pl "$(EPOCBLDUREL)"
CLEANRELEASEUREL : CLEANGENERIC
UREL_RELEASEABLES1= \
\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.DLL \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.DLL.MAP \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.LIB \
\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB
WHATUREL:
@echo $(UREL_RELEASEABLES1)
CLEANRELEASEUREL:
-$(ERASE) $(UREL_RELEASEABLES1)
LISTINGUREL : MAKEWORKUREL \
LISTINGURELAUDIO_MOTOROLA \
LISTINGURELPOLLEDAS
LIBSUREL= \
$(EPOCSTATLINKUREL)\EDLLSTUB.LIB \
$(EPOCSTATLINKUREL)\EGCC.LIB \
$(EPOCLINKUREL)\EUSER.LIB \
$(EPOCLINKUREL)\MAUDIOFB.LIB \
$(EPOCLINKUREL)\MAUDIOAC.LIB
$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL : $(EPOCBLDUREL)\AUDIO_MOTOROLA.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL)
@echo AUDIO_MOTOROLA.DLL: dlltool
@dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in"
@echo AUDIO_MOTOROLA.DLL: perl -S makedef.pl
@perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def"
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf"
@echo AUDIO_MOTOROLA.DLL: dlltool
@dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \
--output-exp "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL"
@echo AUDIO_MOTOROLA.DLL: ld
@ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" --dll \
--base-file "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" -o "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" \
"$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" \
--no-whole-archive $(LIBSUREL) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp"
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL"
@echo AUDIO_MOTOROLA.DLL: dlltool
@dlltool -m arm_interwork \
--def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL" \
--base-file "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" \
--output-exp "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp"
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas"
@echo AUDIO_MOTOROLA.DLL: ld
@ld -s -e _E32Dll -u _E32Dll --dll \
"$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \
-Map "$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL.map" -o "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" \
"$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" \
--no-whole-archive $(LIBSUREL) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp"
@echo AUDIO_MOTOROLA.DLL: petran
@petran "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" "$@" \
-nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c197
-$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL"
OBJECTSUREL= \
$(EPOCBLDUREL)\AUDIO_MOTOROLA.o \
$(EPOCBLDUREL)\POLLEDAS.o
$(EPOCBLDUREL)\AUDIO_MOTOROLA.in : $(OBJECTSUREL)
@echo AUDIO_MOTOROLA.in: if exist (del?)
@if exist "$@" del "$@"
@echo AUDIO_MOTOROLA.in: ar
@ar cr $@ $^
# REAL TARGET - BUILD VARIANT UDEB
WHATUDEB : WHATGENERIC
CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB
CLEANBUILDUDEB :
@perl -S ermdir.pl "$(EPOCBLDUDEB)"
CLEANRELEASEUDEB : CLEANGENERIC
UDEB_RELEASEABLES1= \
\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MOTOROLA.DLL \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MOTOROLA.DLL.MAP \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.LIB \
\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB
WHATUDEB:
@echo $(UDEB_RELEASEABLES1)
CLEANRELEASEUDEB:
-$(ERASE) $(UDEB_RELEASEABLES1)
LISTINGUDEB : MAKEWORKUDEB \
LISTINGUDEBAUDIO_MOTOROLA \
LISTINGUDEBPOLLEDAS
LIBSUDEB= \
$(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \
$(EPOCSTATLINKUDEB)\EGCC.LIB \
$(EPOCLINKUDEB)\EUSER.LIB \
$(EPOCLINKUDEB)\MAUDIOFB.LIB \
$(EPOCLINKUDEB)\MAUDIOAC.LIB
$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL : $(EPOCBLDUDEB)\AUDIO_MOTOROLA.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB)
@echo AUDIO_MOTOROLA.DLL: dlltool
@dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in"
@echo AUDIO_MOTOROLA.DLL: perl -S makedef.pl
@perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def"
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf"
@echo AUDIO_MOTOROLA.DLL: dlltool
@dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \
--output-exp "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL"
@echo AUDIO_MOTOROLA.DLL: ld
@ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" --dll \
--base-file "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" -o "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" \
"$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" \
--no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp"
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL"
@echo AUDIO_MOTOROLA.DLL: dlltool
@dlltool -m arm_interwork \
--def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \
--dllname "AUDIO_MOTOROLA[1000c197].DLL" \
--base-file "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" \
--output-exp "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp"
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas"
@echo AUDIO_MOTOROLA.DLL: ld
@ld -e _E32Dll -u _E32Dll --dll \
"$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \
-Map "$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL.map" -o "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" \
"$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" \
--no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp"
objcopy -X "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" "$(EPOCTRGUDEB)\AUDIO_MOTOROLA.sym"
@echo AUDIO_MOTOROLA.DLL: petran
@petran "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" "$@" \
-nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c197
-$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL"
OBJECTSUDEB= \
$(EPOCBLDUDEB)\AUDIO_MOTOROLA.o \
$(EPOCBLDUDEB)\POLLEDAS.o
$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in : $(OBJECTSUDEB)
@echo AUDIO_MOTOROLA.in: if exist (del?)
@if exist "$@" del "$@"
@echo AUDIO_MOTOROLA.in: ar
@ar cr $@ $^
# SOURCES
# Source AUDIO_MOTOROLA.CPP
$(EPOCBLDUREL)\AUDIO_MOTOROLA.lis $(EPOCBLDUREL)\AUDIO_MOTOROLA.o \
$(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis $(EPOCBLDUDEB)\AUDIO_MOTOROLA.o \
: \
\DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOAC.H \
\DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOFB.H \
\DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOFBFORMAT.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32BASE.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32BASE.INL \
\DEV\A925SDK\EPOC32\INCLUDE\E32DEF.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32DES16.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32DES8.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32HAL.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32KEYS.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32PCCD.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32STD.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32STD.INL \
\DEV\A925SDK\EPOC32\INCLUDE\E32SVR.H \
\DEV\A925SDK\EPOC32\INCLUDE\F32FILE.H \
\DEV\A925SDK\EPOC32\INCLUDE\F32FILE.INL \
\DEV\A925SDK\EPOC32\INCLUDE\MAUDIOGLOBAL.H \
\DEV\A925SDK\EPOC32\INCLUDE\RPFILE.H \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO.H \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.H \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.H
$(EPOCBLDUREL)\AUDIO_MOTOROLA.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp
@echo AUDIO_MOTOROLA.o: gcc
@$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Audio_motorola.cpp"
LISTINGURELAUDIO_MOTOROLA : $(EPOCBLDUREL)\AUDIO_MOTOROLA.lis
@echo ISTINGURELAUDIO_MOTOROLA: perl -S ecopyfile.pl
@perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.lst.ARMI
$(EPOCBLDUREL)\AUDIO_MOTOROLA.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp
$(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_motorola.cpp" > $@
$(EPOCBLDUDEB)\AUDIO_MOTOROLA.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp
$(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Audio_motorola.cpp"
LISTINGUDEBAUDIO_MOTOROLA : $(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis
@echo ISTINGUDEBAUDIO_MOTOROLA: perl -S ecopyfile.pl
@perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.lst.ARMI
$(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp
$(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_motorola.cpp" > $@
# Source POLLEDAS.CPP
$(EPOCBLDUREL)\POLLEDAS.lis $(EPOCBLDUREL)\POLLEDAS.o \
$(EPOCBLDUDEB)\POLLEDAS.lis $(EPOCBLDUDEB)\POLLEDAS.o \
: \
\DEV\A925SDK\EPOC32\INCLUDE\E32DEF.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32DES16.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32DES8.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32STD.H \
\DEV\A925SDK\EPOC32\INCLUDE\E32STD.INL \
\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.H
$(EPOCBLDUREL)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp
@echo POLLEDAS.o: gcc
@$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"
LISTINGURELPOLLEDAS : $(EPOCBLDUREL)\POLLEDAS.lis
@echo ISTINGURELPOLLEDAS: perl -S ecopyfile.pl
@perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.lst.ARMI
$(EPOCBLDUREL)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp
$(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@
$(EPOCBLDUDEB)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp
$(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"
LISTINGUDEBPOLLEDAS : $(EPOCBLDUDEB)\POLLEDAS.lis
@echo ISTINGUDEBPOLLEDAS: perl -S ecopyfile.pl
@perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.lst.ARMI
$(EPOCBLDUDEB)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp
$(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@
ROMFILE:
@echo file=\DEV\A925SDK\EPOC32\RELEASE\ARMI\##BUILD##\AUDIO_MOTOROLA.DLL System\Libs\AUDIO_MOTOROLA.DLL
WHATGENERIC CLEANGENERIC :
@rem none
# Rules to create all necessary directories
GENERIC_MAKEWORK : \
\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI
MAKEWORKLIBRARY : \
\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL \
\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL
MAKEWORKUDEB : \
\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UDEB \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB
MAKEWORKUREL : \
\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UREL \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL
\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI \
\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UDEB \
\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UREL \
\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB \
\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL \
\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL \
:
@echo UREL: perl -S emkdir.pl
@perl -S emkdir.pl $@

View file

@ -0,0 +1,32 @@
/*******************************************************************
*
* File: PolledAS.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __POLLED_AS_H
#define __POLLED_AS_H
class CPrivatePolledActiveScheduler;
class CPolledActiveScheduler : public CBase
{
public:
~CPolledActiveScheduler();
static CPolledActiveScheduler* NewL();
//static CPolledActiveScheduler* Instance();
void Schedule();
protected:
CPolledActiveScheduler(){};
void ConstructL();
CPrivatePolledActiveScheduler* iPrivatePolledActiveScheduler;
};
#endif /* __POLLED_AS_H */

View file

@ -0,0 +1,363 @@
/*******************************************************************
*
* File: Audio_motorola.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
// if only I had Motorola to test this on..
#include "audio_motorola.h"
#ifdef __DEBUG_PRINT_SND
#include <e32svr.h> // RDebug
#define DEBUGPRINT(x...) RDebug::Print(x)
#else
#define DEBUGPRINT(x...)
#endif
GLDEF_C TInt E32Dll(TDllReason)
{
return KErrNone;
}
/*******************************************
*
* CGameAudioMot
*
*******************************************/
CGameAudioMot::CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)
: iRate(aRate), iStereo(aStereo), iBufferedFrames(aBufferedFrames), iPcmFrames(aPcmFrames)
{
DEBUGPRINT(_L("CGameAudioMot::CGameAudioMot"));
}
CGameAudioMot* CGameAudioMot::NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)
{
DEBUGPRINT(_L("CGameAudioMot::NewL(%i, %i, %i, %i)"),aRate, aStereo, aPcmFrames, aBufferedFrames);
CGameAudioMot* self = new(ELeave) CGameAudioMot(aRate, aStereo, aPcmFrames, aBufferedFrames);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(); // self
return self;
}
CGameAudioMot::~CGameAudioMot()
{
DEBUGPRINT(_L("CGameAudioMot::~CGameAudioMot()"));
if(iAudioOutputStream) {
iScheduler->Schedule(); // let it finish it's stuff
//iAudioOutputStream->Stop();
delete iAudioOutputStream;
}
if(iAudioControl) delete iAudioControl;
for (TInt i=0 ; i < KSoundBuffers+1; i++) {
delete iSoundBufferPtrs[i];
delete iSoundBuffers[i];
}
// Polled AS
if(iScheduler) delete iScheduler;
}
void CGameAudioMot::ConstructL()
{
iScheduler = CPolledActiveScheduler::NewL();
iSettings.iPCMSettings.iSamplingFreq = (TMSampleRate) iRate;
iSettings.iPCMSettings.iStereo = iStereo;
TInt bytesPerFrame = iStereo ? iPcmFrames << 2 : iPcmFrames << 1;
for (TInt i=0 ; i<KSoundBuffers ; i++)
{
iSoundBuffers[i] = HBufC8::NewL(bytesPerFrame * iBufferedFrames);
iSoundBuffers[i]->Des().FillZ (bytesPerFrame * iBufferedFrames);
iSoundBufferPtrs[i] = new TPtr8( iSoundBuffers[i]->Des() );
}
// because feeding 2 buffers after an underflow is a little too much, but feeding 1 may be not enough,
// prepare this ~50ms empty buffer to additionaly feed after every underflow.
iSoundBuffers[KSoundBuffers] = HBufC8::NewL(bytesPerFrame * (iBufferedFrames / 4));
iSoundBuffers[KSoundBuffers]->Des().FillZ (bytesPerFrame * (iBufferedFrames / 4));
iSoundBufferPtrs[KSoundBuffers] = new TPtr8( iSoundBuffers[KSoundBuffers]->Des() );
iCurrentBuffer = 0;
iListener.iFatalError = iListener.iIsOpen = iListener.iIsCtrlOpen = EFalse;
// here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later.
iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener);
if(iAudioOutputStream) {
delete iAudioOutputStream;
iAudioOutputStream = 0;
}
// ceate audio control object
iAudioControl = CMAudioAC::NewL(iListener);
}
// returns a pointer to buffer for next frame,
// to be used when iSoundBuffers are used directly
TInt16 *CGameAudioMot::NextFrameL()
{
iCurrentPosition += iPcmFrames << (iStereo?1:0);
if (++iFrameCount == iBufferedFrames)
{
WriteBlockL();
}
iScheduler->Schedule();
if(iListener.iFatalError || iListener.iUnderflowed > KMaxUnderflows) {
if(iAudioOutputStream) delete iAudioOutputStream;
iAudioOutputStream = 0;
return 0;
}
else if(iListener.iUnderflowed) UnderflowedL();
return iCurrentPosition;
}
TInt16 *CGameAudioMot::DupeFrameL(TInt &aUnderflowed)
{
TInt shorts = iStereo ? (iPcmFrames << 1) : iPcmFrames;
if(iFrameCount)
Mem::Copy(iCurrentPosition, iCurrentPosition-shorts, shorts<<1);
else {
TInt lastBuffer = iCurrentBuffer;
if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;
Mem::Copy(iCurrentPosition, ((TInt16*) (iSoundBuffers[lastBuffer]->Ptr()))+shorts*(iBufferedFrames-1), shorts<<1);
}
iCurrentPosition += shorts;
if (++iFrameCount == iBufferedFrames)
{
WriteBlockL();
}
iScheduler->Schedule();
if(iListener.iFatalError || iListener.iUnderflowed > KMaxUnderflows) {
if(iAudioOutputStream) delete iAudioOutputStream;
iAudioOutputStream = 0;
return 0;
}
else if((aUnderflowed = iListener.iUnderflowed)) UnderflowedL(); // not again!
return iCurrentPosition;
}
void CGameAudioMot::WriteBlockL()
{
iScheduler->Schedule();
// do not write until stream is open
if(!iListener.iIsOpen) WaitForOpenToCompleteL();
//if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks?
//iListener.iHasCopied = EFalse;
if(!iListener.iUnderflowed) {
iAudioOutputStream->QueueBufferL(iSoundBufferPtrs[iCurrentBuffer]);
// it is certain we already Queued at least 2 buffers (one just after underflow, another above)
if(!iDecoding) {
iAudioOutputStream->DecodeL();
iDecoding = ETrue;
}
}
iFrameCount = 0;
if (++iCurrentBuffer == KSoundBuffers)
iCurrentBuffer = 0;
iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();
}
void CGameAudioMot::Pause()
{
if(!iAudioOutputStream) return;
iScheduler->Schedule();
// iAudioOutputStream->Stop(); // may be this breaks everything in A925?
delete iAudioOutputStream;
iAudioOutputStream = 0;
}
// call this before doing any playback!
TInt16 *CGameAudioMot::ResumeL()
{
DEBUGPRINT(_L("CGameAudioMot::Resume()"));
iScheduler->Schedule();
// we act a bit strange here: simulate buffer underflow, which actually starts audio
iListener.iIsOpen = ETrue;
iListener.iUnderflowed = 1;
iListener.iFatalError = EFalse;
iFrameCount = 0;
iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();
return iCurrentPosition;
}
// handles underflow condition
void CGameAudioMot::UnderflowedL()
{
// recreate the stream
if(iAudioOutputStream) delete iAudioOutputStream;
if(iListener.iUnderflowed > 4) {
// HACK: A925 user said sound works for the first time, but fails after pause/resume, etc.
// at the very beginning we create and delete CMAudioFB object, maybe we should do this every time?
iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener);
if(iAudioOutputStream) delete iAudioOutputStream;
}
iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener);
iListener.iIsOpen = EFalse; // wait for it to open
iDecoding = EFalse;
//iListener.iHasCopied = ETrue; // but don't wait for last copy to complete
// let it open and feed some stuff to make it happy
User::After(0);
//TInt lastBuffer = iCurrentBuffer;
//if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;
iScheduler->Schedule();
if(!iListener.iIsOpen) WaitForOpenToCompleteL();
if(iListener.iUnderflowed) {
// something went wrong again. May be it needs time? Trying to fix something without ability to test is hell.
if(iAudioOutputStream) delete iAudioOutputStream;
iAudioOutputStream = 0;
User::After(50*000);
iScheduler->Schedule();
return;
}
iAudioOutputStream->QueueBufferL(iSoundBufferPtrs[KSoundBuffers]); // try a short buffer with hope to reduce lag
}
void CGameAudioMot::ChangeVolume(TInt aUp)
{
if(iAudioControl && iListener.iIsCtrlOpen)
{
TInt vol = iAudioControl->GetMasterVolume();
TInt max = iAudioControl->GetMaxMasterVolume();
if(aUp) vol++; // adjust volume
else vol--;
if(vol >= 0 && vol <= max)
{
iAudioControl->SetMasterVolume(vol);
}
}
}
void CGameAudioMot::WaitForOpenToCompleteL()
{
DEBUGPRINT(_L("CGameAudioMot::WaitForOpenToCompleteL"));
TInt count = 20; // 2 seconds
TInt waitPeriod = 100 * 1000;
if(!iListener.iIsOpen) {
// it is often enough to do this
User::After(0);
iScheduler->Schedule();
}
while (!iListener.iIsOpen && --count)
{
User::After(waitPeriod);
iScheduler->Schedule();
}
if (!iListener.iIsOpen)
User::LeaveIfError(KErrNotSupported);
}
void TGameAudioEventListener::OnEvent(TMAudioFBCallbackState aState, TInt aError)
{
switch ( aState )
{
case EMAudioFBCallbackStateReady:
iIsOpen = ETrue;
iUnderflowed = 0;
break;
case EMAudioFBCallbackStateDecodeCompleteStopped:
break;
//case EMAudioFBCallbackStateDecodeFileSystemError:
case EMAudioFBCallbackStateDecodeError:
switch( aError )
{
case EMAudioFBCallbackErrorBufferFull:
case EMAudioFBCallbackErrorForcedStop:
case EMAudioFBCallbackErrorForcedClose:
//case EMAudioFBCallbackErrorForcedPause:
case EMAudioFBCallbackErrorPriorityRejection:
case EMAudioFBCallbackErrorAlertModeRejection:
case EMAudioFBCallbackErrorResourceRejection:
case EMAudioFBCallbackErrorUnknown:
iUnderflowed++;
break;
// these look like really bad errors
case EMAudioFBCallbackErrorInvalidParameter:
case EMAudioFBCallbackErrorWrongState:
case EMAudioFBCallbackErrorFormatNotSupported:
case EMAudioFBCallbackErrorFunctionNotSupported:
case EMAudioFBCallbackErrorNoBuffer:
case EMAudioFBCallbackErrorSampleOrBitRateNotSupported:
//case EMAudioFBCallbackErrorPriorityOrPreferenceNotSupported:
//case EMAudioFBCallbackErrorFileSystemFull:
//iFatalError = ETrue;
// who cares, just keep retrying
iUnderflowed++;
break;
default:
iUnderflowed++;
break;
}
// in error condition we also set to open, so that the
// framework would not leave, catch the error and retry
iIsOpen = ETrue;
break;
default:
break;
}
}
void TGameAudioEventListener::OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer)
{
switch( aState )
{
case EMAudioFBCallbackStateDecodeBufferDecoded:
break;
default:
OnEvent( aState, aError );
break;
}
}
void TGameAudioEventListener::OnEvent(TMAudioACCallbackState aState, TInt aError)
{
if(aState == EMAudioACCallbackStateReady) iIsCtrlOpen = ETrue;
}

View file

@ -0,0 +1,3 @@
EXPORTS
; NEW:
NewL__13CGameAudioMotiiii @ 1 NONAME ; static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);

View file

@ -0,0 +1,91 @@
/*******************************************************************
*
* File: Audio_motorola.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __AUDIO_MEDIASERVER_H
#define __AUDIO_MEDIASERVER_H
#include <cmaudiofb.h>
#include "audio.h"
#include "polledas.h"
const TInt KSoundBuffers = 8;
const TInt KMaxUnderflows = 20; // max underflows/API errors we are going allow in a row (to prevent lockups)
class TGameAudioEventListener : public MMAudioFBObserver, public MMAudioACObserver
{
public:
// Implementation of MMAudioFBObserver
void OnEvent(TMAudioFBCallbackState aState, TInt aError);
void OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer);
// Implementation of MMAudioACObserver
void OnEvent(TMAudioACCallbackState aState, TInt aError);
TBool iIsOpen;
TBool iIsCtrlOpen;
// TBool iHasCopied;
TInt iUnderflowed;
TBool iFatalError;
};
class CGameAudioMot : public IGameAudio // IGameAudio MUST be specified first!
{
public: // implements IGameAudio
TInt16 *NextFrameL();
TInt16 *DupeFrameL(TInt &aUnderflowed);
TInt16 *ResumeL();
void Pause();
void ChangeVolume(TInt aUp);
public:
~CGameAudioMot();
CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);
void ConstructL();
EXPORT_C static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);
protected:
void WriteBlockL();
void UnderflowedL();
protected:
void WaitForOpenToCompleteL();
TInt iRate;
TBool iStereo;
CMAudioFB *iAudioOutputStream;
CMAudioAC *iAudioControl;
TMAudioFBBufSettings iSettings;
TGameAudioEventListener iListener;
CPolledActiveScheduler *iScheduler;
HBufC8* iSoundBuffers[KSoundBuffers+1];
TPtr8* iSoundBufferPtrs[KSoundBuffers+1];
TInt iBufferedFrames;
TInt16* iCurrentPosition;
TInt iCurrentBuffer;
TInt iFrameCount;
TInt iPcmFrames;
TBool iDecoding;
//TInt64 iTime; // removed because can't test
};
#endif /* __AUDIO_MEDIASERVER_H */

View file

@ -0,0 +1,20 @@
TARGET audio_motorola.dll
TARGETTYPE dll
UID 0x100039CE 0x1000C197
USERINCLUDE .
USERINCLUDE ..\..\
SYSTEMINCLUDE \epoc32\include
SOURCEPATH .
SOURCE audio_motorola.cpp
SOURCE polledas.cpp
LIBRARY EUSER.LIB
LIBRARY maudiofb.lib
LIBRARY maudioac.lib
deffile .\audio_motorola.def
nostrictdef

View file

@ -0,0 +1,209 @@
/*******************************************************************
*
* File: PolledAS.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
/*
* Oh Lord, forgive me for I have sinned.
* In their infinite wisdom, Symbian Engineers have decided that
* the Active Scheduler's queue of Active Objects is private
* and no getters are provided... sigh.
* This mere mortal will have to excercise the power of C pre-processor
* once more to circumvent the will of the gods.
*/
#include <e32std.h>
// from e32base.h
class CBase
{
public:
IMPORT_C virtual ~CBase();
inline TAny* operator new(TUint aSize,TAny *aBase) {Mem::FillZ(aBase,aSize);return(aBase);}
IMPORT_C TAny* operator new(TUint aSize);
inline TAny* operator new(TUint aSize, TLeave) {return newL(aSize);}
IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize);
protected:
IMPORT_C CBase();
private:
CBase(const CBase&);
CBase& operator=(const CBase&);
IMPORT_C static TAny* newL(TUint aSize);
};
class CActive : public CBase
{
public:
enum TPriority
{
EPriorityIdle=-100,
EPriorityLow=-20,
EPriorityStandard=0,
EPriorityUserInput=10,
EPriorityHigh=20,
};
public:
IMPORT_C ~CActive();
IMPORT_C void Cancel();
IMPORT_C void Deque();
IMPORT_C void SetPriority(TInt aPriority);
inline TBool IsActive() const {return(iActive);}
inline TBool IsAdded() const {return(iLink.iNext!=NULL);}
inline TInt Priority() const {return iLink.iPriority;}
protected:
IMPORT_C CActive(TInt aPriority);
IMPORT_C void SetActive();
// Pure virtual
virtual void DoCancel() =0;
virtual void RunL() =0;
IMPORT_C virtual TInt RunError(TInt aError);
public:
TRequestStatus iStatus;
private:
TBool iActive;
TPriQueLink iLink;
friend class CActiveScheduler;
// friend class CServer;
friend class CPrivatePolledActiveScheduler; // added
};
//
class CActiveScheduler : public CBase
{
public:
IMPORT_C CActiveScheduler();
IMPORT_C ~CActiveScheduler();
IMPORT_C static void Install(CActiveScheduler* aScheduler);
IMPORT_C static CActiveScheduler* Current();
IMPORT_C static void Add(CActive* anActive);
IMPORT_C static void Start();
IMPORT_C static void Stop();
IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority);
IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler);
IMPORT_C virtual void WaitForAnyRequest();
IMPORT_C virtual void Error(TInt anError) const;
private:
void DoStart();
IMPORT_C virtual void OnStarting();
IMPORT_C virtual void OnStopping();
IMPORT_C virtual void Reserved_1();
IMPORT_C virtual void Reserved_2();
friend class CPrivatePolledActiveScheduler; // added
protected:
inline TInt Level() const;
private:
TInt iLevel;
TPriQue<CActive> iActiveQ;
};
class TCleanupItem;
class CleanupStack
{
public:
IMPORT_C static void PushL(TAny* aPtr);
IMPORT_C static void PushL(CBase* aPtr);
IMPORT_C static void PushL(TCleanupItem anItem);
IMPORT_C static void Pop();
IMPORT_C static void Pop(TInt aCount);
IMPORT_C static void PopAndDestroy();
IMPORT_C static void PopAndDestroy(TInt aCount);
IMPORT_C static void Check(TAny* aExpectedItem);
inline static void Pop(TAny* aExpectedItem);
inline static void Pop(TInt aCount, TAny* aLastExpectedItem);
inline static void PopAndDestroy(TAny* aExpectedItem);
inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem);
};
/*
* This will declare CPrivatePolledActiveScheduler as a friend
* of all classes that define a friend. CPrivatePolledActiveScheduler needs to
* be a friend of CActive
*/
//#define friend friend class CPrivatePolledActiveScheduler; friend
/*
* This will change the:
* void DoStart();
* method in CActiveScheduler to:
* void DoStart(); friend class CPrivatePolledActiveScheduler;
* We need this to access the private datamembers in CActiveScheduler.
*/
//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler;
//#include <e32base.h>
#include "PolledAS.h"
class CPrivatePolledActiveScheduler : public CActiveScheduler
{
public:
void Schedule();
};
void CPrivatePolledActiveScheduler::Schedule()
{
TDblQueIter<CActive> q(iActiveQ);
q.SetToFirst();
FOREVER
{
CActive *pR=q++;
if (pR)
{
if (pR->IsActive() && pR->iStatus!=KRequestPending)
{
pR->iActive=EFalse;
TRAPD(r,pR->RunL());
break;
}
}
else
break;
}
}
CPolledActiveScheduler::~CPolledActiveScheduler()
{
delete iPrivatePolledActiveScheduler;
}
//static CPolledActiveScheduler* sPolledActiveScheduler = NULL;
CPolledActiveScheduler* CPolledActiveScheduler::NewL()
{
//sPolledActiveScheduler =
CPolledActiveScheduler* self = new(ELeave)CPolledActiveScheduler;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self;
}
void CPolledActiveScheduler::ConstructL()
{
iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler;
iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler);
}
void CPolledActiveScheduler::Schedule()
{
iPrivatePolledActiveScheduler->Schedule();
}
/*
CPolledActiveScheduler* CPolledActiveScheduler::Instance()
{
// return (CPolledActiveScheduler*) CActiveScheduler::Current();
return sPolledActiveScheduler;
}
*/

View file

@ -0,0 +1,2 @@
copy %EPOCROOT%\epoc32\release\armi\urel\audio_motorola.dll ..\
..\..\..\qconsole-1.52\qtty\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\audio_motorola.dll ..\audio_motorola.dll" exit

View file

@ -0,0 +1 @@
copy %EPOCROOT%\epoc32\release\armi\urel\audio_motorola.dll ..\

11
platform/uiq2/blit.h Normal file
View file

@ -0,0 +1,11 @@
extern "C" {
void vidConvCpyRGB444(void *to, void *from, int pixels);
void vidConvCpyRGB565(void *to, void *from, int pixels);
void vidConvCpyRGB32 (void *to, void *from, int pixels);
// warning: the functions below will reboot the phone if used incorrectly!
void vidConvCpyM2_16_90 (void *to, void *from, int width); // width is in blocks of 8 pixels
void vidConvCpyM2_16_270 (void *to, void *from, int width);
void vidConvCpyM2_RGB32_90 (void *to, void *from, int width);
void vidConvCpyM2_RGB32_270(void *to, void *from, int width);
}

432
platform/uiq2/blit.s Normal file
View file

@ -0,0 +1,432 @@
@ assembly "optimized" blitter and copy functions
@ all pointers must be word-aligned
@ (c) Copyright 2006, notaz
@ All Rights Reserved
@ Convert 0000bbb0 ggg0rrr0
@ to 0000rrr0 ggg0bbb0
@ r2,r3 - scratch, lr = 0x000F000F
.macro convRGB444 reg
and r2, \reg, lr @ r2=red
and r3, \reg, lr, lsl #8 @ r3=blue
and \reg, \reg, lr, lsl #4 @ green stays in place
orr \reg, \reg, r2, lsl #8 @ add red back
orr \reg, \reg, r3, lsr #8 @ add blue back
.endm
.global vidConvCpyRGB444 @ void *to, void *from, int pixels
vidConvCpyRGB444:
stmfd sp!, {r4-r11,lr}
mov r12, r2, lsr #4 @ repeats
mov lr, #0xF0000
orr lr, lr, #0xF @ lr == pattern 0x000F000F
.loopRGB444:
subs r12, r12, #1
@ I first thought storing multiple registers would be faster,
@ but this doesn't seem to be the case, probably because of
@ slow video memory we are dealing with
ldmia r1!, {r4-r11}
convRGB444 r4
str r4, [r0], #4
convRGB444 r5
str r5, [r0], #4
convRGB444 r6
str r6, [r0], #4
convRGB444 r7
str r7, [r0], #4
convRGB444 r8
str r8, [r0], #4
convRGB444 r9
str r9, [r0], #4
convRGB444 r10
str r10, [r0], #4
convRGB444 r11
str r11, [r0], #4
bgt .loopRGB444
ldmfd sp!, {r4-r11,lr}
bx lr
@ Convert 0000bbb0 ggg0rrr0
@ to rrr00ggg 000bbb00
@ r2,r3 - scratch, lr = 0x07800780
.macro convRGB565 reg
and r2, \reg, lr, lsr #7 @ r2=red
and r3, \reg, lr, lsl #1 @ r3=blue
and \reg, lr, \reg,lsl #3 @ green stays, but needs shifting
orr \reg, \reg, r2, lsl #12 @ add red back
orr \reg, \reg, r3, lsr #7 @ add blue back
.endm
.global vidConvCpyRGB565 @ void *to, void *from, int pixels
vidConvCpyRGB565:
stmfd sp!, {r4-r11,lr}
mov r12, r2, lsr #4 @ repeats
mov lr, #0x07800000
orr lr, lr, #0x780 @ lr == pattern 0x07800780
.loopRGB565:
subs r12, r12, #1
ldmia r1!, {r4-r11}
convRGB565 r4
str r4, [r0], #4
convRGB565 r5
str r5, [r0], #4
convRGB565 r6
str r6, [r0], #4
convRGB565 r7
str r7, [r0], #4
convRGB565 r8
str r8, [r0], #4
convRGB565 r9
str r9, [r0], #4
convRGB565 r10
str r10, [r0], #4
convRGB565 r11
str r11, [r0], #4
bgt .loopRGB565
ldmfd sp!, {r4-r11,lr}
bx lr
@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
@ to 00000000 rrr00000 ggg00000 bbb00000 ...
@ r2,r3 - scratch, lr = 0x0000F000
@ rin - src reg, rout - dest reg (can be same for both; rout can be r3)
.macro convRGB32_l rout rin
and r2, \rin, lr, lsr #12 @ r2=red
and r3, \rin, lr, lsr #4 @ r3=blue
orr r2, r3, r2, lsl #24
and \rout, lr, \rin, lsl #8 @ green stays, but needs shifting
orr \rout, \rout, r2, lsr #4 @ add red+blue back
.endm
@ r2,r3 - scratch, lr = 0x0000F000
@ rin - src reg, rout - dest reg (can be same for both; rout can be r3)
.macro convRGB32_h rout rin
and r2, \rin, lr, lsl #4 @ r2=red
mov r3, \rin, lsr #24 @ r3=blue
orr r2, r3, r2
and \rout, lr, \rin, lsr #8 @ green
orr \rout, \rout, r2, lsl #4
.endm
@ slightly faster conversion, saves 1 opcode, writes output
@ lr = 0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin
.macro convRGB32_2 rin rethigh=0
and r2, lr, \rin, lsr #4 @ blue
and r3, \rin, lr
orr r2, r2, r3, lsl #8 @ g0b0g0b0
mov r3, r2, lsl #16 @ g0b00000
and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed)
orr r3, r3, \rin, lsr #16 @ g0b000r0
mov r3, r3, ror #16 @ r3=low
str r3, [r0], #4
mov r2, r2, lsr #16
.if \rethigh
orr \rin,r2, \rin, lsl #16
.else
orr r2, r2, \rin, lsl #16
str r2, [r0], #4
.endif
.endm
.global vidConvCpyRGB32 @ void *to, void *from, int pixels
vidConvCpyRGB32:
stmfd sp!, {r4-r7,lr}
mov r12, r2, lsr #3 @ repeats
mov lr, #0x00F00000
orr lr, lr, #0x00F0
.loopRGB32:
subs r12, r12, #1
ldmia r1!, {r4-r7}
convRGB32_2 r4
convRGB32_2 r5
convRGB32_2 r6
convRGB32_2 r7
bgt .loopRGB32
ldmfd sp!, {r4-r7,lr}
bx lr
@ -------- M2 stuff ---------
.bss
tmpstore1d: .long
.text
tmpstore1: .long tmpstore1d
@ r3 - scratch, ru - reg with 2 pixels from upper col, rl - ... lower col
.macro rot_str16_90 ru rl
mov r3, \rl,lsl #16
mov r3, r3, lsr #16
orr r3, r3, \ru, lsl #16
str r3, [r0], #208*2
mov r3, \ru,lsr #16
mov r3, r3, lsl #16
orr r3, r3, \rl, lsr #16
str r3, [r0], #208*2
.endm
.global vidConvCpyM2_16_90 @ void *to, void *from, int width
vidConvCpyM2_16_90:
stmfd sp!, {r4-r11,lr}
ldr r4, =tmpstore1
str sp, [r4] @ save sp, we will need sp reg..
mov sp, r0 @ .. to store our dst
@ crashing beyond this point will be fatal (phone reboots), as Symbian OS expects sp to always point to stack
sub r2, r2, #1
mov r12, #0x00670000
orr r12, r12, r2, lsl #24
orr r12, r12, r2 @ r12 == ((208-2)/2 << 16) | ((width-1)<<24) | (width-1)
add r0, r0, #206*2
add r1, r1, #8*2 @ skip left border
add lr, r1, #328*2
.loopM2_16_90:
subs r12, r12, #1<<24
ldmia r1!, {r4-r7}
ldmia lr!, {r8-r11}
rot_str16_90 r4 r8
rot_str16_90 r5 r9
rot_str16_90 r6 r10
rot_str16_90 r7 r11
bpl .loopM2_16_90
add r12, r12, #1<<24
subs r12, r12, #0x00010000
bmi .loopM2_16_90_end
add r0, sp, r12, lsr #14 @ calculate new dst pointer
orr r12, r12, r12, lsl #24 @ restore the width counter
@ skip remaining pixels on these 2 lines
mov r4, #328/8-1 @ width of mode2 in line_pixels/8
sub r4, r4, r12, lsr #24
add r1, lr, r4, lsl #4 @ skip src pixels
add lr, r1, #328*2
b .loopM2_16_90
.loopM2_16_90_end:
@ restore sp
ldr r4, =tmpstore1
ldr sp, [r4]
ldmfd sp!, {r4-r11,lr}
bx lr
@ r3 - scratch, ru - reg with 2 pixels from upper col, rl - ... lower col (for right-to-left copies)
.macro rot_str16_270 ru rl
mov r3, \rl,lsr #16
mov r3, r3, lsl #16
orr r3, r3, \ru, lsr #16
str r3, [r0], #208*2
mov r3, \ru,lsl #16
mov r3, r3, lsr #16
orr r3, r3, \rl, lsl #16
str r3, [r0], #208*2
.endm
.global vidConvCpyM2_16_270 @ void *to, void *from, int width
vidConvCpyM2_16_270:
stmfd sp!, {r4-r11,lr}
ldr r4, =tmpstore1
str sp, [r4] @ save sp, we will need sp reg to store our dst
sub r2, r2, #1
mov r12, #0x00670000
orr r12, r12, r2, lsl #24
orr r12, r12, r2 @ r12 == ((208-2)/2 << 16) | ((width-1)<<24) | (width-1)
add r1, r1, #328*2 @ skip left border+1line
add lr, r1, #328*2
add sp, r0, #206*2 @ adjust for algo
.loopM2_16_270:
subs r12, r12, #1<<24
ldmdb r1!, {r4-r7}
ldmdb lr!, {r8-r11}
rot_str16_270 r7 r11 @ update the screen in incrementing direction, reduces tearing slightly
rot_str16_270 r6 r10
rot_str16_270 r5 r9
rot_str16_270 r4 r8
bpl .loopM2_16_270
add r12, r12, #1<<24
subs r12, r12, #0x00010000
bmi .loopM2_16_90_end @ same end as in 90
sub r0, sp, r12, lsr #14 @ calculate new dst pointer
orr r12, r12, r12, lsl #24 @ restore the width counter
@ skip remaining pixels on these 2 lines
mov r4, #328/8-1 @ width of mode2 in line_pixels/8
sub r4, r4, r12, lsr #24
sub r1, lr, r4, lsl #4 @ skip src pixels
add r1, r1, #328*2*2
add lr, r1, #328*2
b .loopM2_16_270
.global vidConvCpyM2_RGB32_90 @ void *to, void *from, int width
vidConvCpyM2_RGB32_90:
stmfd sp!, {r4-r10,lr}
mov lr, #0x00F00000
orr lr, lr, #0x00F0
mov r12, #208/4 @ row counter
mov r10, r2, lsl #2 @ we do 2 pixel wide copies
add r8, r0, #208*4 @ parallel line
add r1, r1, #0x21000
add r1, r1, #0x00280 @ r1+=328*207*2+8*2
mov r9, r1
.loopM2RGB32_90:
subs r12, r12, #1
@ at first this loop was written differently: src pixels were fetched with ldm's and
@ dest was not sequential. It ran nearly 2 times slower. It seems it is very important
@ to do sequential memory access on those items, which we have more (to offload addressing bus?).
ldr r4, [r1], #-328*2
ldr r5, [r1], #-328*2
ldr r6, [r1], #-328*2
ldr r7, [r1], #-328*2
convRGB32_2 r4, 1
convRGB32_2 r5, 1
convRGB32_2 r6, 1
convRGB32_2 r7, 1
str r4, [r8], #4
str r5, [r8], #4
str r6, [r8], #4
str r7, [r8], #4
bne .loopM2RGB32_90
subs r10, r10, #1
ldmeqfd sp!, {r4-r10,pc} @ return
mov r12, #208/4 @ restore row counter
mov r0, r8 @ set new dst pointer
add r8, r0, #208*4
add r9, r9, #2*2 @ fix src pointer
mov r1, r9
b .loopM2RGB32_90
@ converter for vidConvCpyM2_RGB32_270
@ lr = 0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin
.macro convRGB32_3 rin
and r2, lr, \rin, lsr #4 @ blue
and r3, \rin, lr
orr r2, r2, r3, lsl #8 @ g0b0g0b0
mov r3, r2, lsl #16 @ g0b00000
and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed)
orr r3, r3, \rin, lsr #16 @ g0b000r0
mov r2, r2, lsr #16
orr r2, r2, \rin, lsl #16
str r2, [r0], #4
mov \rin,r3, ror #16 @ r3=low
.endm
.global vidConvCpyM2_RGB32_270 @ void *to, void *from, int width
vidConvCpyM2_RGB32_270:
stmfd sp!, {r4-r10,lr}
mov lr, #0x00F00000
orr lr, lr, #0x00F0
mov r12, #208/4 @ row counter
mov r10, r2, lsl #2 @ we do 2 pixel wide copies (right to left)
add r8, r0, #208*4 @ parallel line
add r1, r1, #326*2
mov r9, r1
.loopM2RGB32_270:
subs r12, r12, #1
ldr r4, [r1], #328*2
ldr r5, [r1], #328*2
ldr r6, [r1], #328*2
ldr r7, [r1], #328*2
convRGB32_3 r4
convRGB32_3 r5
convRGB32_3 r6
convRGB32_3 r7
str r4, [r8], #4
str r5, [r8], #4
str r6, [r8], #4
str r7, [r8], #4
bne .loopM2RGB32_270
subs r10, r10, #1
ldmeqfd sp!, {r4-r10,pc} @ return
mov r12, #208/4 @ restore row counter
mov r0, r8 @ set new dst pointer
add r8, r0, #208*4
sub r9, r9, #2*2 @ fix src pointer
mov r1, r9
b .loopM2RGB32_270

241
platform/uiq2/debug.cpp Normal file
View file

@ -0,0 +1,241 @@
#include <e32svr.h> // RDebug
#include "debug.h"
#ifdef __WINS__
void ExceptionHandler(TExcType exc) {}
#else
static const wchar_t * const exception_names[] = {
L"General",
L"IntegerDivideByZero",
L"SingleStep",
L"BreakPoint",
L"IntegerOverflow",
L"BoundsCheck",
L"InvalidOpCode",
L"DoubleFault",
L"StackFault",
L"AccessViolation",
L"PrivInstruction",
L"Alignment",
L"PageFault",
L"FloatDenormal",
L"FloatDivideByZero",
L"FloatInexactResult",
L"FloatInvalidOperation",
L"FloatOverflow",
L"FloatStackCheck",
L"FloatUnderflow",
L"Abort",
L"Kill",
L"DataAbort",
L"CodeAbort",
L"MaxNumber",
L"InvalidVector",
L"UserInterrupt",
L"Unknown"
};
static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end)
{
TUint pc, sp;
RChunk chunk;
TFullName chunkname;
TFindChunk findChunk(_L("*"));
asm volatile ("str pc, %0" : "=m" (pc) );
asm volatile ("str sp, %0" : "=m" (sp) );
while( findChunk.Next(chunkname) != KErrNotFound ) {
chunk.Open(findChunk);
if((TUint)chunk.Base()+chunk.Bottom() < pc && pc < (TUint)chunk.Base()+chunk.Top()) {
if(code_start) *code_start = (TUint)chunk.Base()+chunk.Bottom();
if(code_end) *code_end = (TUint)chunk.Base()+chunk.Top();
} else
if((TUint)chunk.Base()+chunk.Bottom() < sp && sp < (TUint)chunk.Base()+chunk.Top()) {
if(stack_start) *stack_start = (TUint)chunk.Base()+chunk.Bottom();
if(stack_end) *stack_end = (TUint)chunk.Base()+chunk.Top();
}
chunk.Close();
}
}
// tmp
#if defined(__DEBUG_PRINT)
extern "C" char *debugString();
#endif
// our very own exception handler
void ExceptionHandler(TExcType exc)
{
TUint lr, sp, i;
TUint stack_end = 0; // ending address of our stack chunk
TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk
TUint guessed_address = 0;
asm volatile ("str lr, %0" : "=m" (lr) );
asm volatile ("str sp, %0" : "=m" (sp) );
// first get some info about the chunks we live in
getASpace(&code_start, &code_end, 0, &stack_end);
// now we begin some black magic tricks
// we go up our stack until we pass our caller address
for(; sp < stack_end; sp += 4)
if(*(TUint *)sp == lr) break;
// there might be mirored caller address
for(i = sp + 4; i < sp + 0x300 && i < stack_end; i += 4)
if(*(TUint *)i == lr) { sp = i; break; }
// aah, it is always 0x9c bytes away from the caller address in my firmware,
// don't know how to detect it in any other way
sp += 0x9c;
guessed_address = *(TUint *)sp;
// output the info
TUint exec_show = exc;
if(exec_show > 27) exec_show = 27;
TPtrC ptrExc((TUint16 *) exception_names[exec_show]);
RDebug::Print(_L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start);
#ifdef __DEBUG_PRINT_FILE
DEBUGPRINT( _L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start);
#endif
TBuf<148> buff1;
TBuf<10> buff2;
buff1.Copy(_L(" guessed stack: "));
for(sp += 4, i = 0; i < 5 && sp < stack_end; sp += 4) {
if((*(TUint *)sp >> 28) == 5) {
if(i++) buff1.Append(_L(", "));
buff2.Format(_L("0x%08x"), *(TUint *)sp);
buff1.Append(buff2);
}
else if(code_start < *(TUint *)sp && *(TUint *)sp < code_end) {
if(i++) buff1.Append(_L(", "));
buff2.Format(_L("0x%08x"), *(TUint *)sp);
buff1.Append(buff2);
buff1.Append(_L(" ("));
buff2.Format(_L("0x%08x"), *(TUint *)sp - code_start);
buff1.Append(buff2);
buff1.Append(_L(")"));
}
}
RDebug::Print(_L("%S"), &buff1);
#ifdef __DEBUG_PRINT_FILE
DEBUGPRINT(_L("%S"), &buff1);
#endif
// tmp
#if defined(__DEBUG_PRINT)
char *ps, *cstr = debugString();
for(ps = cstr; *ps; ps++) {
if(*ps == '\n') {
*ps = 0;
dprintf(cstr);
cstr = ps+1;
}
}
#endif
// RDebug::Print(_L("Stack dump:"));
// asm volatile ("str sp, %0" : "=m" (sp) );
// for(TUint i = sp+0x400; i >= sp-16; i-=4)
// RDebug::Print(_L("%08x: %08x"), i, *(int *)i);
// more descriptive replacement of "KERN-EXEC 3" panic
buff1.Format(_L("K-EX3: %S"), &ptrExc);
User::Panic(buff1, exc);
}
#endif // ifdef __WINS__
#if defined(__DEBUG_PRINT) || defined(__WINS__)
#ifndef __DLL__
// c string dumper for RDebug::Print()
static TBuf<1024> sTextBuffer;
TDesC* DO_CONV(const char* s)
{
TPtrC8 text8((TUint8*) (s));
sTextBuffer.Copy(text8);
return &sTextBuffer;
}
#endif
#ifdef __DEBUG_PRINT_C
#include <stdarg.h> // va_*
#include <stdio.h> // vsprintf
// debug print from c code
extern "C" void dprintf(char *format, ...)
{
va_list args;
char buffer[512];
va_start(args,format);
vsprintf(buffer,format,args);
va_end(args);
DEBUGPRINT(_L("%S"), DO_CONV(buffer));
}
#endif
#ifdef __DEBUG_PRINT_FILE
#include <f32file.h>
// note: uses tls, leaks some mem
void debugPrintFileInit()
{
RFs *fs = new(ELeave) RFs;
fs->Connect();
RFile *file = new(ELeave) RFile;
// try to open
TInt res = file->Open(*fs, _L("C:\\documents\\Media files\\other\\snes9x.log"), EFileWrite|EFileShareAny);
if(res) res = file->Open(*fs, _L("C:\\snes9x.log"), EFileWrite|EFileShareAny);
if(!res) { TInt size; file->Size(size); file->Seek(ESeekStart, size); }
// try to create
if(res) res = file->Create(*fs, _L("C:\\documents\\Media files\\other\\snes9x.log"), EFileWrite|EFileShareAny);
if(res) res = file->Create(*fs, _L("C:\\snes9x.log"), EFileWrite|EFileShareAny);
Dll::SetTls(res ? 0 : file);
}
// debug print to file
void debugPrintFile(TRefByValue<const TDesC> aFmt, ...)
{
// get RFile
RFile *file = (RFile *) Dll::Tls();
if(!file) return; // shit!
TTime now; now.UniversalTime();
TBuf<512> tmpBuff;
TBuf8<512> tmpBuff8;
TInt size;
file->Size(size); file->Seek(ESeekStart, size); // something else could have written to the file
now.FormatL(tmpBuff, _L("%H:%T:%S.%C: "));
tmpBuff8.Copy(tmpBuff);
file->Write(tmpBuff8);
VA_LIST args;
VA_START(args, aFmt);
tmpBuff.FormatList(aFmt, args);
VA_END(args);
tmpBuff8.Copy(tmpBuff);
file->Write(tmpBuff8);
file->Write(TPtrC8((TUint8 const *) "\r\n"));
file->Flush();
}
#endif
#endif

27
platform/uiq2/debug.h Normal file
View file

@ -0,0 +1,27 @@
#include <e32std.h>
#define __DEBUG_PRINT_C
#if defined(__DEBUG_PRINT) || defined(__WINS__)
#include <e32svr.h> // RDebug
#ifdef __DEBUG_PRINT_FILE
void debugPrintFileInit();
void debugPrintFile(TRefByValue<const TDesC> aFmt, ...);
#define DEBUG_PRINT_FILE_INIT debugPrintFileInit
#define DEBUGPRINT debugPrintFile
#else
#define DEBUG_PRINT_FILE_INIT()
#define DEBUGPRINT RDebug::Print
#endif
TDesC* DO_CONV(const char* s);
#ifdef __DEBUG_PRINT_C
#ifdef __cplusplus
extern "C"
#endif
void dprintf(char *format, ...);
#endif
#else
#define DEBUGPRINT(x...)
#endif
void ExceptionHandler(TExcType exc);

View file

@ -0,0 +1,644 @@
/*******************************************************************
*
* File: App.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#include "app.h"
// #include "picodriven.mbg" // bitmap identifiers
#include "picodriven.rsg"
#include <eikenv.h>
#include <qbtselectdlg.h>
//#include <gulutil.h>
//#include <bautils.h>
#include <eikmenub.h> // CEikMenuBar
#include <apgtask.h> // TApaSystemEvent
#include "Dialogs.h"
CApaDocument* CPicolApplication::CreateDocumentL()
{
return new (ELeave) CPicolDocument(*this);
}
CPicolDocument::CPicolDocument(CEikApplication& aApp)
: CEikDocument(aApp)
{
}
CPicolDocument::~CPicolDocument()
{
}
CEikAppUi* CPicolDocument::CreateAppUiL()
{
return new(ELeave) CPicolAppUi;
}
////////////////////////////////////////////////////////////////
//
// class CPicolAppUi
//
////////////////////////////////////////////////////////////////
CPicolAppUi::CPicolAppUi()
: iCurrentLConfig(iCurrentConfig)
{
// set default config
Mem::FillZ(&iCurrentConfig, sizeof(iCurrentConfig));
iCurrentConfig.iFlags = 1; // use_sram
iCurrentConfig.iFrameskip = TPicoConfig::PFSkipAuto;
iCurrentConfig.iScreenRotation = TPicoConfig::PRot90;
}
CPicolAppUi::~CPicolAppUi()
{
delete iAppView;
DeregisterView(*iFOView);
delete iFOView;
DeregisterView(*iFCView);
delete iFCView;
}
void CPicolAppUi::ConstructL()
{
BaseConstructL();
// load config
iCurrentLConfig.Load();
iAppView=new(ELeave) CEPicolAppView;
iAppView->ConstructL(ClientRect());
iFOView=new(ELeave) CPicolFOView(*iAppView);
RegisterViewL(*iFOView);
iFCView=new(ELeave) CPicolFCView(*iAppView);
RegisterViewL(*iFCView);
}
void CPicolAppUi::HandleCommandL(TInt aCommand)
{
TInt oldFrameskip = iCurrentConfig.iFrameskip;
TInt res;
// give time for config dialog destruction
if(iAfterConfigDialog) {
iAfterConfigDialog = EFalse;
TTime now; now.UniversalTime();
if(now.MicroSecondsFrom(iConfigDialogClosed).Int64().Low() < 2500*1000)
User::After(2500*1000-now.MicroSecondsFrom(iConfigDialogClosed).Int64().Low());
}
switch (aCommand)
{
case EEikCmdPicoLoadState:
if(iGameRunner) {
CEikonEnv::Static()->BusyMsgL(_L("Loading State"));
res = ss.SendReceive(PicoMsgLoadState, 0);
CEikonEnv::Static()->BusyMsgCancel();
// emu doesn't start to run if load fails, so we can display this
if(res) CEikonEnv::Static()->InfoMsg(_L("Load Failed"));
}
break;
case EEikCmdPicoSaveState:
if(iGameRunner) {
CEikonEnv::Static()->BusyMsgL(_L("Saving State"));
res = ss.SendReceive(PicoMsgSaveState, 0);
CEikonEnv::Static()->BusyMsgCancel();
if(res) CEikonEnv::Static()->InfoMsg(_L("Save Failed"));
}
break;
case EEikCmdPicoLoadROM:
DisplayOpenROMDialogL();
break;
case EEikCmdPicoResume:
ss.Send(PicoMsgResume, 0);
iEmuRunning = ETrue;
break;
case EEikCmdPicoReset:
ss.Send(PicoMsgReset, 0);
iEmuRunning = ETrue;
break;
case EEikCmdPicoKeys:
if(!iGameRunner) RunGameL();
ss.Send(PicoMsgKeys, 0);
iEmuRunning = ETrue;
break;
case EEikCmdPicoSettings:
DisplayConfigDialogL();
break;
case EEikCmdHelpAbout: // EEikCmdPicoAbout:
DisplayAboutDialogL();
break;
// standard identifier must be used here, TApaTask::EndTask() and probably others send it
case EEikCmdExit: // EEikCmdPicoExit:
if(iGameRunner) {
iQuitting = ETrue;
iExitForcer = CExitForcer::NewL(*this, 2000);
ss.Send(PicoMsgQuit, 0);
} else {
iCurrentLConfig.Save();
DEBUGPRINT(_L("[app] Exit (menu)"));
Exit();
}
break;
// frameskips
case EEikCmdPicoFrameskipAuto:
iCurrentConfig.iFrameskip = TPicoConfig::PFSkipAuto;
break;
case EEikCmdPicoFrameskip0:
iCurrentConfig.iFrameskip = TPicoConfig::PFSkip0;
break;
case EEikCmdPicoFrameskip1:
iCurrentConfig.iFrameskip = 1;
break;
case EEikCmdPicoFrameskip2:
iCurrentConfig.iFrameskip = 2;
break;
case EEikCmdPicoFrameskip4:
iCurrentConfig.iFrameskip = 4;
break;
case EEikCmdPicoFrameskip8:
iCurrentConfig.iFrameskip = 8;
break;
case EEikCmdPicoDebugKillEmu:
if(iGameRunner) {
iExitForcer = CExitForcer::NewL(*this, 4000);
ss.Send(PicoMsgQuit, 0);
}
break;
case EEikCmdPicoDebugInfo:
if(iGameRunner)
DisplayDebugDialogL();
break;
}
// send config update if needed
if(iCurrentConfig.iFrameskip != oldFrameskip)
SendConfig();
}
void CPicolAppUi::HandleSystemEventL(const TWsEvent& aEvent)
{
TApaSystemEvent event;
event = *(TApaSystemEvent*)aEvent.EventData();
if(event == EApaSystemEventBroughtToForeground) // application brought to foreground
{
DEBUGPRINT(_L("[app] EApaSystemEventBroughtToForeground, iEmuRunning=%i"), iEmuRunning);
// we might have missed flip open event (when moved to background),
// so make sure we have correct view active
if(iCoeEnv->ScreenDevice()->CurrentScreenMode() == EScreenModeFlipOpen) {
ActivateViewL(TVwsViewId(KUidPicolApp, KUidPicolFOView));
return;
}
}
if(event == EApaSystemEventShutdown)
{
DEBUGPRINT(_L("[app] EApaSystemEventShutdown"));
}
CEikAppUi::HandleSystemEventL(aEvent);
}
// called just before the menu is shown
void CPicolAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
if(aResourceId == R_APP_EMU_MENU) {
TBool dimmed = !iGameRunner || !iROMLoaded;
aMenuPane->SetItemDimmed(EEikCmdPicoLoadState, dimmed);
aMenuPane->SetItemDimmed(EEikCmdPicoSaveState, dimmed);
aMenuPane->SetItemDimmed(EEikCmdPicoResume, dimmed);
aMenuPane->SetItemDimmed(EEikCmdPicoReset, dimmed);
} else if(aResourceId == R_APP_FRAMESKIP_MENU) {
TInt itemToCheck = EEikCmdPicoFrameskipAuto;
switch(iCurrentConfig.iFrameskip) {
case 0: itemToCheck = EEikCmdPicoFrameskip0; break;
case 1: itemToCheck = EEikCmdPicoFrameskip1; break;
case 2: itemToCheck = EEikCmdPicoFrameskip2; break;
case 4: itemToCheck = EEikCmdPicoFrameskip4; break;
case 8: itemToCheck = EEikCmdPicoFrameskip8; break;
}
aMenuPane->SetItemButtonState(itemToCheck, EEikMenuItemSymbolOn);
}
}
void CPicolAppUi::DisplayAboutDialogL()
{
CEikDialog* dialog = new(ELeave) CAboutDialog;
TInt iButtonRes = dialog->ExecuteLD(R_DIALOG_ABOUT);
if(iButtonRes == EEikBidYes) {
CCreditsDialog *creditsDialog = new (ELeave) CCreditsDialog();
creditsDialog->iMessageResourceID = R_TBUF_CREDITS;
creditsDialog->ExecuteLD(R_DIALOG_CREDITS);
}
}
void CPicolAppUi::DisplayOpenROMDialogL()
{
TFileName file(iCurrentLConfig.iLastROMFile);
CEikDialog* dialog = new(ELeave) CEikFileOpenDialog(&file);
//((CEikFileOpenDialog *)dialog)->SetRequiredExtension(&ext);
if(dialog->ExecuteLD(R_EIK_DIALOG_FILE_OPEN) == EEikBidOk) {
CEikonEnv::Static()->BusyMsgL(_L("Loading ROM"));
// start emu process if it is not running
if(!iGameRunner) RunGameL();
iROMLoaded = EFalse;
TBuf8<KMaxFileName> file8;
file8.Copy(file);
TAny *p[KMaxMessageArguments];
p[0]= (TAny*)(&file8);
TInt res = ss.SendReceive(PicoMsgLoadROM, &p[0]);
CEikonEnv::Static()->BusyMsgCancel();
if(res == 1)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to open file."));
else if(res == 2)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate memory."));
else if(res == 3)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("The file you selected is not a game ROM."));
else if(res == 4)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("No game ROMs found in zipfile."));
else if(res == 5)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed while unzipping ROM."));
else if(res < 0)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to send request to emu process."));
else {
iROMLoaded = ETrue;
iEmuRunning = ETrue;
}
// sound errors which leave ROM loaded
if(res == 6)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate sound buffer, disabled sound."));
else if(res == 7)
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start soundsystem, disabled sound."));
if(res == 6 || res == 7) iCurrentConfig.iFlags &= ~4;
iCurrentLConfig.iLastROMFile.Copy(file);
}
}
void CPicolAppUi::DisplayConfigDialogL()
{
CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(iCurrentConfig, iCurrentLConfig);
configDialog->ExecuteLD(R_PICO_CONFIG);
if(iGameRunner)
SendConfig();
iCurrentLConfig.Save();
// configDialog seems to be actually destroyed later after returning,
// and this usually happens just after resuming game and causes emu slowdowns :/
iAfterConfigDialog = ETrue;
iConfigDialogClosed.UniversalTime();
}
void CPicolAppUi::DisplayDebugDialogL()
{
// first get our debug info
char dtxt[1024];
TAny *p[KMaxMessageArguments];
TPtr8 descr((TUint8*) dtxt, sizeof(dtxt));
p[0]= (TAny*)(&descr);
ss.SendReceive(PicoMsgRetrieveDebugStr, &p[0]);
CEikDialog* dialog = new(ELeave) CDebugDialog(dtxt);
dialog->ExecuteLD(R_DIALOG_DEBUG);
}
void CPicolAppUi::SendConfig()
{
// send config
if(iGameRunner) {
TAny *p[KMaxMessageArguments];
TPtrC8 descr((TUint8*) &iCurrentConfig, sizeof(iCurrentConfig));
p[0]= (TAny*)(&descr);
ss.Send(PicoMsgConfigChange, &p[0]);
}
}
// get config from emu proc
void CPicolAppUi::RetrieveConfig()
{
// ask to configure keys and receive new config
TAny *p[KMaxMessageArguments];
TPtr8 descr((TUint8*) &iCurrentConfig, sizeof(iCurrentConfig));
p[0]= (TAny*)(&descr);
ss.SendReceive(PicoMsgRetrieveConfig, &p[0]);
iCurrentLConfig.Save();
}
void CPicolAppUi::NotifyEmuDeath()
{
StopGame();
if(iQuitting) {
DEBUGPRINT(_L("[app] Exit (NotifyEmuDeath)"));
iCurrentLConfig.Save();
RProcess me;
me.Terminate(0);
}
}
void CPicolAppUi::NotifyForcedExit()
{
DEBUGPRINT(_L("[app] Exit (NotifyForcedExit)"));
StopGame();
RProcess me;
me.Terminate(0);
}
TBool CPicolAppUi::EmuRunning() const
{
return iEmuRunning;
}
void CPicolAppUi::StopGame()
{
// in case we have busyMsg and process crashes
CEikonEnv::Static()->BusyMsgCancel();
ss.Close();
if(iGameRunner) delete iGameRunner;
iGameRunner = NULL;
if(iExitForcer) delete iExitForcer;
iExitForcer = NULL;
if(iThreadWatcher1) delete iThreadWatcher1;
iThreadWatcher1 = NULL;
iROMLoaded = EFalse;
iEmuRunning = EFalse;
}
void CPicolAppUi::RunGameL()
{
TInt res = KErrNone;
// do one connection attemt to emu and ask it to quit if we succeed
res = ss.Connect();
if(res == KErrNone) {
ss.Send(PicoMsgQuit, 0);
ss.Close();
}
iGameRunner = CGameRunner::NewL(*this);
// Connect to the server
// we don't want to do complex asynchronous stuff here, so we just
// wait and do several connection attempts
User::After(200000);
for(TInt attempt=0; attempt < 10; attempt++) {
res = ss.Connect();
if(res == KErrNone) break;
User::After(200000);
}
if(res != KErrNone) {
CEikonEnv::Static()->BusyMsgCancel();
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to communicate with the emulation process."));
StopGame();
RProcess me;
me.Terminate(2);
}
// now we are successfully connected, that means emu process' helper-communication thread is running.
// we have to keep an eye on it too, because if it crashes, symbian OS leaves it's process
// alive, but it becomes useless without it's communication thread so we have to detect it's death.
iThreadWatcher1 = CThreadWatcher::NewL(*this, KServerName);
// send initial config
SendConfig();
}
/*
void CPicolAppUi::HandleScreenDeviceChangedL()
{
// does not receive when emu is in foreground
if(iCoeEnv->ScreenDevice()->CurrentScreenMode() == 0) { // flip open
// regain focus
//iCoeEnv->BringOwnerToFront();
}
// ss.Send(PicoMsgFlipChange, 0);
}
*/
void CPicolAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent)
{
DEBUGPRINT(_L("[app] event from server: %i"), aEvent.Type());
switch (aEvent.Type())
{
case EEventKeyCfgDone:
RetrieveConfig();
break;
case EEventGamePaused:
iEmuRunning = EFalse;
break;
}
}
////////////////////////////////////////////////////////////////
//
// class CEPicolAppView
//
////////////////////////////////////////////////////////////////
void CEPicolAppView::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
/*
* Load background image
*/
/*
TBuf<1> name = _L("*");
TRAPD(err, iBgImage = CEikonEnv::Static()->CreateBitmapL(name, EMbmEdoomDoom));
if (iBgImage)
{
iImagePosition.iX = (aRect.Size().iWidth - iBgImage->SizeInPixels().iWidth) / 2;
iImagePosition.iY = (aRect.Size().iHeight - iBgImage->SizeInPixels().iHeight) / 2;
}
*/
}
CEPicolAppView::~CEPicolAppView()
{
//if (iBgImage) delete iBgImage;
}
void CEPicolAppView::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
//if (iBgImage)
//{
// gc.DrawBitmap(iImagePosition, iBgImage);
// DrawUtils::ClearBetweenRects(gc, Rect(), TRect(iImagePosition, iBgImage->SizeInPixels()));
//}
//else
gc.Clear();//aRect);
}
////////////////////////////////////////////////////////////////
//
// class CPicolViewBase
//
////////////////////////////////////////////////////////////////
void CPicolViewBase::ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)
{
TPixelsAndRotation sizeAndRotation;
CEikonEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(sizeAndRotation);
CEikonEnv::Static()->ScreenDevice()->SetScreenSizeAndRotation(sizeAndRotation);
//iAppViewCtl.MakeVisible(ETrue);
}
void CPicolViewBase::ViewDeactivated()
{
//iAppViewCtl.MakeVisible(EFalse);
}
////////////////////////////////////////////////////////////////
//
// class CPicolFOView
//
////////////////////////////////////////////////////////////////
TVwsViewId CPicolFOView::ViewId() const
{
return TVwsViewId(KUidPicolApp, KUidPicolFOView);
}
TVwsViewIdAndMessage CPicolFOView::ViewScreenDeviceChangedL()
{
// only handle change to FC mode when emu process is running
if(static_cast<CPicolAppUi*>(CEikonEnv::Static()->AppUi())->EmuRunning())
return TVwsViewIdAndMessage(TVwsViewId(KUidPicolApp, KUidPicolFCView));
else return MCoeView::ViewScreenDeviceChangedL();
}
TBool CPicolFOView::ViewScreenModeCompatible(TInt aScreenMode)
{
return (aScreenMode == EScreenModeFlipOpen);
}
void CPicolFOView::ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
{
DEBUGPRINT(_L("[app] FO"));
CPicolViewBase::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage);
CEikonEnv::Static()->AppUiFactory()->MenuBar()->MakeVisible(ETrue);
iAppViewCtl.SetRect(static_cast<CEikAppUi*>(CEikonEnv::Static()->AppUi())->ClientRect());
}
////////////////////////////////////////////////////////////////
//
// class CPicolFCView
//
////////////////////////////////////////////////////////////////
TVwsViewId CPicolFCView::ViewId() const
{
return TVwsViewId(KUidPicolApp, KUidPicolFCView);
}
TVwsViewIdAndMessage CPicolFCView::ViewScreenDeviceChangedL()
{
return TVwsViewIdAndMessage(TVwsViewId(KUidPicolApp, KUidPicolFOView));
}
TBool CPicolFCView::ViewScreenModeCompatible(TInt aScreenMode)
{
return (aScreenMode == EScreenModeFlipClosed);
}
void CPicolFCView::ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
{
DEBUGPRINT(_L("[app] FC"));
CPicolViewBase::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage);
CEikonEnv::Static()->AppUiFactory()->MenuBar()->MakeVisible(EFalse);
//iAppViewCtl.ChangeLayout(ETrue);
iAppViewCtl.SetRect(CEikonEnv::Static()->ScreenDevice()->SizeInPixels());
}
////////////////////////////////////////////////////////////////
//
// framework
//
////////////////////////////////////////////////////////////////
GLDEF_C TInt E32Dll(TDllReason)
{
return KErrNone;
}
EXPORT_C CApaApplication* NewApplication()
{
return new CPicolApplication;
}
TUid CPicolApplication::AppDllUid() const
{
return KUidPicolApp;
}

View file

@ -0,0 +1,178 @@
/*******************************************************************
*
* File: App.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2001, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __APP_H
#define __APP_H
#include <coecntrl.h>
#include <coeccntx.h>
#include <coemain.h>
#include <eikappui.h>
#include <eikapp.h>
#include <eikdoc.h>
#include "Engine.h"
#include "../ClientServer.h"
#include "SimpleClient.h"
#include "picodriven.hrh"
const TUid KUidPicolApp = { 0x1000C193 };
const TUid KUidPicolFOView = { 0x1000C194 };
const TUid KUidPicolFCView = { 0x1000C195 };
enum
{
EScreenModeFlipOpen = 0,
EScreenModeFlipClosed
};
//class CWsBitmap;
class CPicolDocument : public CEikDocument
{
public:
~CPicolDocument();
CPicolDocument(CEikApplication& aApp);
void ConstructL();
private: // from CEikDocument
CEikAppUi* CreateAppUiL();
};
class CEPicolAppView : public CCoeControl // , public MCoeControlBrushContext
{
public:
~CEPicolAppView();
void ConstructL(const TRect& aRect);
private:
void Draw(const TRect& aRect) const;
//CWsBitmap* iBgImage;
//TPoint iImagePosition;
};
class CPicolViewBase : public CBase, public MCoeView
{
public:
CPicolViewBase(CEPicolAppView& aAppViewCtl) : iAppViewCtl(aAppViewCtl) {}
//~CPicolViewBase();
protected:
// implements MCoeView:
virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);
virtual void ViewDeactivated();
//virtual void ViewConstructL();
CEPicolAppView& iAppViewCtl;
};
class CPicolFOView : public CPicolViewBase
{
public:
CPicolFOView(CEPicolAppView& aAppViewCtl) : CPicolViewBase(aAppViewCtl) {}
//~CPicolFOView();
virtual TVwsViewId ViewId() const;
virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL();
virtual TBool ViewScreenModeCompatible(TInt aScreenMode);
virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);
};
class CPicolFCView : public CPicolViewBase
{
public:
CPicolFCView(CEPicolAppView& aAppViewCtl) : CPicolViewBase(aAppViewCtl) {}
//~CPicolFCView();
virtual TVwsViewId ViewId() const;
virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL();
virtual TBool ViewScreenModeCompatible(TInt aScreenMode);
virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);
};
class CPicolAppUi : public CEikAppUi, public MGameWatcher
{
public:
CPicolAppUi();
void ConstructL();
~CPicolAppUi();
public: // implements MGameWatcher
void NotifyEmuDeath();
void NotifyForcedExit();
TBool EmuRunning() const;
protected: // from CEikAppUi
void HandleCommandL(TInt aCommand);
void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
void HandleSystemEventL(const TWsEvent& aEvent);
protected: // new stuf
void DisplayAboutDialogL();
void DisplayOpenROMDialogL();
void DisplayConfigDialogL();
void DisplayDebugDialogL();
void StopGame();
void RunGameL();
void SendConfig();
void RetrieveConfig();
CGameRunner* iGameRunner;
CExitForcer* iExitForcer; // makes sure emu process exits
CThreadWatcher* iThreadWatcher1; // emu process helper thread watcher
RServSession ss;
private:
//void HandleScreenDeviceChangedL();
//void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent);
private:
TBool iQuitting;
TBool iROMLoaded;
TBool iEmuRunning;
TBool iAfterConfigDialog;
TTime iConfigDialogClosed;
TPicoConfig iCurrentConfig;
TPLauncherConfig iCurrentLConfig;
CEPicolAppView* iAppView;
CPicolFOView* iFOView;
CPicolFCView* iFCView;
};
class CPicolApplication : public CEikApplication
{
private: // from CApaApplication
CApaDocument* CreateDocumentL();
TUid AppDllUid() const;
};
#endif

View file

@ -0,0 +1,477 @@
/*******************************************************************
*
* File: CSimpleTextParser.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#include "CSimpleTextParser.h"
enum
{
EBadTag,
EBadZeroLengthTag,
EBadIntegerParam,
EBadAlignmentParam,
EBadRgbColorParam
};
void Panic(TInt aPanic)
{
User::Panic(_L("STP"), aPanic);
}
CSimpleTextFormatParser* CSimpleTextFormatParser::NewLC()
{
CSimpleTextFormatParser* self = new(ELeave)CSimpleTextFormatParser;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CSimpleTextFormatParser::~CSimpleTextFormatParser()
{
delete iParaFormat;
}
void CSimpleTextFormatParser::ConstructL()
{
iParaFormat = CParaFormat::NewL();
}
void CSimpleTextFormatParser::SetBold(TBool aEnable)
{
iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(aEnable ? EStrokeWeightBold : EStrokeWeightNormal);
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttFontStrokeWeight);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
void CSimpleTextFormatParser::SetItalic(TBool aEnable)
{
iCharFormat.iFontSpec.iFontStyle.SetPosture(aEnable ? EPostureItalic : EPostureUpright);
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttFontPosture);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
void CSimpleTextFormatParser::SetUnderLine(TBool aEnable)
{
iCharFormat.iFontPresentation.iUnderline = aEnable ? EUnderlineOn : EUnderlineOff;
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttFontUnderline);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
void CSimpleTextFormatParser::SetHiddenText(TBool aEnable)
{
iCharFormat.iFontPresentation.iHiddenText = aEnable;
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttFontHiddenText);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
TRgb CSimpleTextFormatParser::ForegroundColor()
{
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttColor);
iRichText->GetCharFormat(iCharFormat, iCharMask, TextPos(), 0);
return iCharFormat.iFontPresentation.iTextColor;
}
void CSimpleTextFormatParser::SetForegroundColor(const TRgb& aColor)
{
iCharFormat.iFontPresentation.iTextColor = aColor;
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttColor);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
void CSimpleTextFormatParser::SetBackgroundColor(const TRgb& aColor)
{
iParaFormat->iFillColor = aColor;
iParaMask.ClearAll();
iParaMask.SetAttrib(EAttFillColor);
iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0);
}
void CSimpleTextFormatParser::NewParagraph()
{
iCurrentPara++;
iRichText->AppendParagraphL();
AppendTextL(_L(""));
}
void CSimpleTextFormatParser::SetAlignment(CParaFormat::TAlignment aAlignment)
{
iParaFormat->iHorizontalAlignment = aAlignment;
iParaMask.ClearAll();
iParaMask.SetAttrib(EAttAlignment);
iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0);
}
void CSimpleTextFormatParser::SetFontHeight(TInt aHeight)
{
iCharFormat.iFontSpec.iHeight = (aHeight * KTwipsPerInch)/KPointsPerInch;
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttFontHeight);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
void CSimpleTextFormatParser::SetFontName(const TDesC& aName)
{
iCharFormat.iFontSpec.iTypeface.iName = aName;
iCharFormat.iFontSpec.iTypeface.SetAttributes(0);
iCharFormat.iFontSpec.iTypeface.SetIsProportional(ETrue);
iCharMask.ClearAll();
iCharMask.SetAttrib(EAttFontTypeface);
iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);
}
/*
* Character formatting:
* <b> Bold on
* </b> Bold of
* <i> Italic on
* </i> Italic off
* <u> Underline on
* </u> Underline off
* <h> Hidden text on **doesn't work**
* </h> Hidden text off **doesn't work**
* <f=name> Fontname: name (type: string)
* <s=size> Fontsize: size (type: integer)
* <fg=color> Foreground color: color (type: color)
* </fg> Restore foreground color
*
* Paragraph formatting:
* <p> New paragraph - will reset both character & paragraph formatting to defaults
* <a=align> Alignment: aling (type: alignement)
* <bg=color> Background color: color (type: color) **doesn't work**
*
* Special characters:
* </<> The character: <
*
* Types:
* - string:
* - integer: Either decimal or hexidecimal value
* - color: Either integer specifing rgb value, or (r,g,b) in which r, g and b are of type integer
* - align: element of enumeration {center, left, right}
*
* Comments:
* The syntax/parser is fairly simplistic. The parser is not trying to match a tag like
* <tag> </tag> as XML/HTML do. Basically, when it encounters a tag (e.g., <b>) it will
* simply instruct the the editor to apply the formatting from the current position as
* specified by the tag (e.g., enable bold). For example, <b><b>Hello</b>World</b> results
* in Hello displayed in a Bold font and World in a normal font.
*
* The only case where state is maintained is when using <fg=color> and </fg>. The current
* fg color is stored when parsing <fg=color> and restored when doing </fg>. Again, <fg> and
* </fg> don't have the XML/HTML <tag> </tag> behavior. For example:
* <fg=red>Peter<fg=blue>was</fg></fg>here
* results in "Peter" displayed in red, "was" displayed in blue and "here" displayed in red.
* It literally goes like this:
* 1) <fg=red> --> apply editor text color red, previous color = whatever the editor's text color is now
* 2) <fg=blue> --> apply editor text color blue, previous color = whatever the editor's text color
* is now --> red
* 3) </fg> --> apply editor text to previous color --> red
* 4) </fg> --> apply editor text to previous color --> red
*
* What you probably wanted was:
* <fg=red>Peter</fg><fg=blue>was</fg>here
* Now "Peter" is displayed in red, "was" in blue and "here" in the default editor's color
*/
static TUint32 ParseInteger(const TDesC& aString)
{
TUint32 val = 0;
TBool parsed = EFalse;
if (aString.Length() > 2)
{
if ((aString[0] == '0') && ((aString[0] == 'x') || (aString[0] == 'X')))
{
TLex lex(aString.Right(aString.Length()-2));
if (lex.Val(val, EHex) != KErrNone)
{
__ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam));
}
parsed = ETrue;
}
}
if (!parsed)
{
TLex lex(aString);
if (lex.Val(val, EDecimal) != KErrNone)
{
__ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam));
}
}
return val;
}
static TRgb ParseColor(const TDesC& aString)
{
if (aString.Length() > 0)
{
if (aString[0] == 'R')
{
if (aString.Compare(_L("RgbBlack")) == 0)
return KRgbBlack;
else if (aString.Compare(_L("RgbDarkGray")) == 0)
return KRgbDarkGray;
else if (aString.Compare(_L("RgbDarkRed")) == 0)
return KRgbDarkRed;
else if (aString.Compare(_L("RgbDarkGreen")) == 0)
return KRgbDarkGreen;
else if (aString.Compare(_L("RgbDarkYellow")) == 0)
return KRgbDarkYellow;
else if (aString.Compare(_L("RgbDarkBlue")) == 0)
return KRgbDarkBlue;
else if (aString.Compare(_L("RgbDarkMagenta")) == 0)
return KRgbDarkMagenta;
else if (aString.Compare(_L("RgbDarkCyan")) == 0)
return KRgbDarkCyan;
else if (aString.Compare(_L("RgbRed")) == 0)
return KRgbRed;
else if (aString.Compare(_L("RgbGreen")) == 0)
return KRgbGreen;
else if (aString.Compare(_L("RgbYellow")) == 0)
return KRgbYellow;
else if (aString.Compare(_L("RgbBlue")) == 0)
return KRgbBlue;
else if (aString.Compare(_L("RgbMagenta")) == 0)
return KRgbMagenta;
else if (aString.Compare(_L("RgbCyan")) == 0)
return KRgbCyan;
else if (aString.Compare(_L("RgbGray")) == 0)
return KRgbGray;
else if (aString.Compare(_L("RgbWhite")) == 0)
return KRgbWhite;
else
{
__ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam));
}
}
return ParseInteger(aString);
}
__ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam));
return KRgbBlack;
}
static CParaFormat::TAlignment ParseAlignment(const TDesC& aString)
{
if (aString.Compare(_L("center")) == 0)
{
return CParaFormat::ECenterAlign;
}
else if (aString.Compare(_L("left")) == 0)
{
return CParaFormat::ELeftAlign;
}
else if (aString.Compare(_L("right")) == 0)
{
return CParaFormat::ERightAlign;
}
__ASSERT_DEBUG(ETrue, Panic(EBadAlignmentParam));
return CParaFormat::ECenterAlign;
}
void CSimpleTextFormatParser::ParseTagL(const TDesC& aTag)
{
TInt tagLength = aTag.Length();
if (tagLength == 0)
{
__ASSERT_DEBUG(ETrue, Panic(EBadZeroLengthTag));
return;
}
TPtrC param(_L(""));
TInt pos = aTag.Find(_L("="));
if (pos>0)
{
param.Set(aTag.Right(aTag.Length()-pos-1));
tagLength = pos;
}
TPtrC tag = aTag.Left(tagLength);
// RDebug::Print(_L("tag=%S, param=%S"), &tag, &param);
switch (tagLength)
{
case 1:
{
if (tag.Compare(_L("a")) == 0)
SetAlignment(ParseAlignment(param));
else if (tag.Compare(_L("b")) == 0)
SetBold();
else if (tag.Compare(_L("f")) == 0)
SetFontName(param);
else if (tag.Compare(_L("h")) == 0)
SetHiddenText();
else if (tag.Compare(_L("i")) == 0)
SetItalic();
else if (tag.Compare(_L("p")) == 0)
NewParagraph();
else if (tag.Compare(_L("s")) == 0)
SetFontHeight(ParseInteger(param));
else if (tag.Compare(_L("u")) == 0)
SetUnderLine();
else
{
__ASSERT_DEBUG(ETrue, Panic(EBadTag));
}
break;
}
case 2:
{
if (tag.Compare(_L("/b")) == 0)
SetBold(EFalse);
if (tag.Compare(_L("bg")) == 0)
SetBackgroundColor(ParseColor(param));
if (tag.Compare(_L("fg")) == 0)
{
iPrevFgColor = ForegroundColor();
SetForegroundColor(ParseColor(param));
}
else if (tag.Compare(_L("/h")) == 0)
SetHiddenText(EFalse);
else if (tag.Compare(_L("/i")) == 0)
SetItalic(EFalse);
else if (tag.Compare(_L("/u")) == 0)
SetUnderLine(EFalse);
else if (tag.Compare(_L("/<")) == 0)
AppendTextL(_L("<"));
break;
}
case 3:
{
if (tag.Compare(_L("/fg")) == 0)
SetForegroundColor(iPrevFgColor);
break;
}
default:
;
}
}
void CSimpleTextFormatParser::ParseL(const TDesC& aSimpleText, CRichText& aRichText)
{
iRichText = &aRichText;
iCurrentPara = 0;
TBool done = EFalse;
TPtrC simpleText(aSimpleText);
do
{
TInt pos = simpleText.Locate('<');
if (pos > 0)
{
AppendTextL(simpleText.Left(pos));
simpleText.Set(simpleText.Right(simpleText.Length() - pos));
}
else if (pos == 0)
{
pos = simpleText.Locate('>');
if (pos<=0)
User::Leave(KErrArgument);
ParseTagL(simpleText.Mid(1, pos-1));
simpleText.Set(simpleText.Right(simpleText.Length() - pos - 1));
}
else
{
AppendTextL(simpleText);
done = ETrue;
}
} while (!done);
}
TInt CSimpleTextFormatParser::TextPos()
{
return iRichText->DocumentLength();
#if 0
TInt pos, length;
pos = iRichText->CharPosOfParagraph(length, iCurrentPara);
return pos+length-1;
#endif
}
TInt CSimpleTextFormatParser::ParaPos()
{
return TextPos();
#if 0
TInt pos, length;
pos = iRichText->CharPosOfParagraph(length, iCurrentPara);
return pos+length-1;
#endif
}
void CSimpleTextFormatParser::AppendTextL(const TDesC& aText)
{
// RDebug::Print(_L("text=%S"), &aText);
iRichText->InsertL(TextPos(), aText);
}
#if 0
void CTestDialog::ShowTextL(CRichText& aRichText)
{
aRichText.Reset();
TCharFormat charFormat;
TCharFormatMask charMask;
aRichText.GetCharFormat(charFormat, charMask, 0, 0);
TInt para = 0;
AppendTextL(_L("http://www.yipton.net"), aRichText);
para++;
aRichText.AppendParagraphL();
CParaFormat* paraFormat = CParaFormat::NewLC();
TParaFormatMask paraMask;
aRichText.GetParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0);
paraFormat->iHorizontalAlignment = CParaFormat::ECenterAlign;
paraMask.ClearAll();
paraMask.SetAttrib(EAttAlignment);
aRichText.ApplyParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0);
charFormat.iFontPresentation.iUnderline = EUnderlineOn;
charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic);
charMask.ClearAll();
charMask.SetAttrib(EAttFontPosture);
charMask.SetAttrib(EAttFontUnderline);
aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para));
AppendTextL(_L("mailto:Peter is here"), aRichText, para);
para++;
aRichText.AppendParagraphL();
TFontSpec fontSpec(_L("edmunds"), 20 * KPointsPerInch);
// CFont* font = NULL;
// iCoeEnv->ScreenDevice()->GetNearestFontInTwips(font, fontSpec);
charFormat.iFontSpec = fontSpec;
charMask.ClearAll();
charMask.SetAttrib(EAttFontHeight);
charMask.SetAttrib(EAttFontTypeface);
aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para));
AppendTextL(_L("mailto:Peter is here"), aRichText, para);
CleanupStack::PopAndDestroy();
}
#endif

View file

@ -0,0 +1,62 @@
/*******************************************************************
*
* File: CSimpleTextParser.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __CSIMPLE_TEXT_PARSER_H
#define __CSIMPLE_TEXT_PARSER_H
#include <e32def.h>
#include <txtrich.h> // CRichText
#include <eikrted.h> // CEikRichTextEditor
class CSimpleTextFormatParser : public CBase
{
public:
static CSimpleTextFormatParser* NewLC();
void ParseL(const TDesC& aPSTText, CRichText& aRichText);
protected:
CSimpleTextFormatParser(){}
~CSimpleTextFormatParser();
void ConstructL();
void ParseTagL(const TDesC& aTag);
TRgb ForegroundColor();
void SetBold(TBool aEnable=ETrue);
void SetItalic(TBool aEnable=ETrue);
void SetUnderLine(TBool aEnable=ETrue);
void SetFontHeight(TInt aHeight);
void SetFontName(const TDesC& aName);
void SetHiddenText(TBool aEnable=ETrue);
void SetForegroundColor(const TRgb& aColor);
void NewParagraph();
void SetAlignment(CParaFormat::TAlignment aAlignment);
void SetBackgroundColor(const TRgb& aColor);
void AppendTextL(const TDesC& aText);
TInt TextPos();
TInt ParaPos();
CRichText* iRichText;
TCharFormat iCharFormat;
TCharFormatMask iCharMask;
CParaFormat* iParaFormat;
TParaFormatMask iParaMask;
TInt iCurrentPara;
TRgb iPrevFgColor;
};
#endif /* __CSIMPLE_TEXT_PARSER_H */

View file

@ -0,0 +1,473 @@
/*******************************************************************
*
* File: Dialogs.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#include "Dialogs.h"
#include "Engine.h"
#include "picodriven.hrh"
#include "picodriven.rsg"
#include "../version.h"
#include "CSimpleTextParser.h"
#include <txtrich.h> // CRichText
#include <eikrted.h> // CEikRichTextEditor
#include <qikvertoptionbuttonlist.h> // CEikHorOptionButtonList
#include <eikopbut.h> // CEikOptionButton
#include <QuartzKeys.h> // EQuartzKeyTwoWayDown
/************************************************
*
* config Dialog
*
************************************************/
CPicoConfigDialog::CPicoConfigDialog(TPicoConfig &cfg, TPLauncherConfig &cfgl) : config(cfg), config_l(cfgl)
{
}
void CPicoConfigDialog::PostLayoutDynInitL()
{
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend );
CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming );
CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM );
CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS );
CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound );
CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 );
CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 );
CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 );
CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality );
CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad );
CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates );
CEikCheckBox *chkbox_motvol = (CEikCheckBox*) Control( ECtlOptMotDontUseVol );
CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion );
CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 );
buttons_rot ->SetButtonById(ECtlOptRotation0 + config.iScreenRotation);
buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.iScreenMode);
chkbox_sram ->SetState(config.iFlags & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_fps ->SetState(config.iFlags & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_sound ->SetState(config.iFlags & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_motvol ->SetState(config.iFlags & 0x40 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_gzipst ->SetState(config.iFlags & 0x80 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_z80 ->SetState(config.iPicoOpt & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_ym2612 ->SetState(config.iPicoOpt & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_sn76496->SetState(config.iPicoOpt & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_altrend->SetState(config.iPicoOpt & 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_6bpad ->SetState(config.iPicoOpt & 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_acctmng->SetState(config.iPicoOpt & 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear);
chkbox_accsprt->SetState(config.iPicoOpt & 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear);
// hide "fit2" if we are not in 0 or 180 mode
if(config.iScreenRotation != TPicoConfig::PRot0 && config.iScreenRotation != TPicoConfig::PRot180) opt_fit2->MakeVisible(EFalse);
// dim some stuff for alternative renderer
if(config.iPicoOpt & 0x10) {
buttons_disp->SetDimmed(ETrue);
((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot0)))->SetDimmed(ETrue);
((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot180)))->SetDimmed(ETrue);
}
// dim accurate sprites
if(config.iPicoOpt & 0x10) {
chkbox_accsprt->SetState(CEikButtonBase::EClear);
chkbox_accsprt->SetDimmed(ETrue);
}
TInt sel = (config.iPicoOpt&8) ? 4 : 0;
sel+= (config.iFlags>>3)&3;
combo_sndq->SetCurrentItem(sel);
switch(config.PicoRegion) {
case 1: sel = 4; break;
case 2: sel = 3; break;
case 4: sel = 2; break;
case 8: sel = 1; break;
default:sel = 0; // auto
}
combo_region->SetCurrentItem(sel);
}
TBool CPicoConfigDialog::OkToExitL(TInt aButtonId)
{
if(aButtonId != EEikBidOk) return ETrue;
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend );
CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming );
CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM );
CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS );
CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound );
CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 );
CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 );
CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 );
CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality );
CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad );
CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates );
CEikCheckBox *chkbox_motvol = (CEikCheckBox*) Control( ECtlOptMotDontUseVol );
CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion );
config.iScreenRotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0);
config.iScreenMode = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter);
if(chkbox_sram ->State() == CEikButtonBase::ESet) config.iFlags |= 1; else config.iFlags &= ~1;
if(chkbox_fps ->State() == CEikButtonBase::ESet) config.iFlags |= 2; else config.iFlags &= ~2;
if(chkbox_sound ->State() == CEikButtonBase::ESet) config.iFlags |= 4; else config.iFlags &= ~4;
if(chkbox_motvol ->State() == CEikButtonBase::ESet) config.iFlags |= 0x40; else config.iFlags &= ~0x40;
if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.iFlags |= 0x80; else config.iFlags &= ~0x80;
if(chkbox_z80 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 4; else config.iPicoOpt &= ~4;
if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 1; else config.iPicoOpt &= ~1;
if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.iPicoOpt |= 2; else config.iPicoOpt &= ~2;
if(chkbox_altrend->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x10;else config.iPicoOpt &= ~0x10;
if(chkbox_6bpad ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x20;else config.iPicoOpt &= ~0x20;
if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x40;else config.iPicoOpt &= ~0x40;
if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x80;else config.iPicoOpt &= ~0x80;
TInt sel = combo_sndq->CurrentItem();
if(sel > 3) { config.iPicoOpt |= 8; sel-=4; } else config.iPicoOpt &= ~8;
config.iFlags &= ~0x18;
config.iFlags |= (sel<<3)&0x18;
switch(combo_region->CurrentItem()) {
case 4: config.PicoRegion = 1; break;
case 3: config.PicoRegion = 2; break;
case 2: config.PicoRegion = 4; break;
case 1: config.PicoRegion = 8; break;
default:config.PicoRegion = 0; // auto
}
return ETrue;
}
// simple GUI stuff needs lots of code
void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId)
{
if(aControlId == ECtlOptEnableSound) {
CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound );
CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 );
CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 );
CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 );
if(chkbox_sound->State() == CEikButtonBase::ESet) {
// check all sound chips too, but only if they all are not set
if((chkbox_z80->State() | chkbox_ym2612->State() | chkbox_sn76496->State()) == CEikButtonBase::EClear) { // (==0)
chkbox_z80 ->SetState(CEikButtonBase::ESet);
chkbox_ym2612 ->SetState(CEikButtonBase::ESet);
chkbox_sn76496->SetState(CEikButtonBase::ESet);
chkbox_z80 ->DrawDeferred();
chkbox_ym2612 ->DrawDeferred();
chkbox_sn76496->DrawDeferred();
}
} else {
// clear everything, but only if everything is set
if((chkbox_z80->State() & chkbox_ym2612->State() & chkbox_sn76496->State()) == CEikButtonBase::ESet) { // (==1)
chkbox_z80 ->SetState(CEikButtonBase::EClear);
chkbox_ym2612 ->SetState(CEikButtonBase::EClear);
chkbox_sn76496->SetState(CEikButtonBase::EClear);
chkbox_z80 ->DrawDeferred();
chkbox_ym2612 ->DrawDeferred();
chkbox_sn76496->DrawDeferred();
}
}
} else if(aControlId == ECtlOptUseAltRend) {
CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend );
CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
TBool dimmed = chkbox_altrend->State() == CEikButtonBase::ESet;
// show/hide more stuff for alternative renderer
buttons_disp->SetDimmed(dimmed);
chkbox_accsprt->SetDimmed(dimmed);
((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot0)))->SetDimmed(dimmed);
((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot180)))->SetDimmed(dimmed);
if(dimmed && buttons_rot->LabeledButtonId() != ECtlOptRotation90 && buttons_rot->LabeledButtonId() != ECtlOptRotation270) {
buttons_rot->SetButtonById(ECtlOptRotation90);
aControlId = ECtlOptRotation; // cause rotation update
}
buttons_disp->SetButtonById(ECtlOptScreenModeCenter);
chkbox_accsprt->DrawDeferred();
buttons_disp->DrawDeferred();
buttons_rot->DrawDeferred();
}
if(aControlId == ECtlOptRotation) {
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 );
if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) {
opt_fit2->MakeVisible(ETrue);
opt_fit2->DrawDeferred();
} else {
if(opt_fit2->State() == CEikButtonBase::ESet) {
buttons_disp->SetButtonById(ECtlOptScreenModeFit);
buttons_disp->DrawDeferred();
}
opt_fit2->MakeVisible(EFalse);
}
}
}
/*************************************************************
*
* Credits dialog
*
**************************************************************/
void CCreditsDialog::PreLayoutDynInitL()
{
CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(iMessageResourceID);
CleanupStack::PushL(desArray);
TInt iLength;
TInt count = desArray->Count();
for (TInt i=0 ;i < count; i++)
{
iLength = static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->TextLength();
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->Text()->InsertL(iLength, desArray->operator[](i));
iLength = static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->TextLength();
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->Text()->InsertL(iLength, CEditableText::ELineBreak);
}
CleanupStack::PopAndDestroy(desArray);
}
void CCreditsDialog::PostLayoutDynInitL()
{
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->CreateScrollBarFrameL();
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);
}
TKeyResponse CCreditsDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
if (aType == EEventKey)
{
if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)
{
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->MoveDisplayL(TCursorPosition::EFLineDown);
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->UpdateScrollBarsL();
return EKeyWasConsumed;
}
else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)
{
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->MoveDisplayL(TCursorPosition::EFLineUp);
static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->UpdateScrollBarsL();
return EKeyWasConsumed;
}
}
return CEikDialog::OfferKeyEventL(aKeyEvent, aType);
}
/*************************************************************
*
* Debug dialog
*
**************************************************************/
CDebugDialog::CDebugDialog(char *t)
{
Mem::Copy(iText, t, 1024);
iText[1023] = 0;
}
void CDebugDialog::PreLayoutDynInitL()
{
char *p = iText, *line = iText;
TBool end=0;
TBuf<128> tbuf;
CEikGlobalTextEditor *editor = static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit));
while(!end) {
while(*p && *p != '\r' && *p != '\n') p++;
if(!*p) end=1;
*p = 0;
TPtrC8 ptr((TUint8*) line);
tbuf.Copy(ptr);
editor->Text()->InsertL(editor->TextLength(), tbuf);
editor->Text()->InsertL(editor->TextLength(), CEditableText::ELineBreak);
line = ++p;
}
}
void CDebugDialog::PostLayoutDynInitL()
{
static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->CreateScrollBarFrameL();
static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);
}
TKeyResponse CDebugDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
if (aType == EEventKey)
{
if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)
{
static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->MoveDisplayL(TCursorPosition::EFLineDown);
static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->UpdateScrollBarsL();
return EKeyWasConsumed;
}
else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)
{
static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->MoveDisplayL(TCursorPosition::EFLineUp);
static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->UpdateScrollBarsL();
return EKeyWasConsumed;
}
}
return CEikDialog::OfferKeyEventL(aKeyEvent, aType);
}
/************************************************
*
* SimpleTextInfoDialog
*
************************************************/
CSimpleTextInfoDialog::CSimpleTextInfoDialog(TInt aTextIdOne, TInt aRichTextCtlIdOne, TInt aTextIdTwo, TInt aRichTextCtlIdTwo, TBool aSimpleTextResIdOneIsArray, TBool aSimpleTextResIdTwoIsArray)
: iSimpleTextResIdOne(aTextIdOne),
iSimpleTextResIdTwo(aTextIdTwo),
iRichTextCtlIdOne(aRichTextCtlIdOne),
iRichTextCtlIdTwo(aRichTextCtlIdTwo),
iSimpleTextResIdOneIsArray(aSimpleTextResIdOneIsArray),
iSimpleTextResIdTwoIsArray(aSimpleTextResIdTwoIsArray),
iSetDialogBackground(ETrue)
{
}
void CSimpleTextInfoDialog::PreLayoutDynInitL()
{
CEikRichTextEditor* richTextEditor;
if (iRichTextCtlIdOne != -1)
{
richTextEditor=STATIC_CAST(CEikRichTextEditor*, Control(iRichTextCtlIdOne));
PreLayoutDynInitRichTextL(*richTextEditor, iRichTextCtlIdOne, iSimpleTextResIdOne);
}
if (iRichTextCtlIdTwo != -1)
{
richTextEditor=STATIC_CAST(CEikRichTextEditor*, Control(iRichTextCtlIdTwo));
richTextEditor->Border().SetType(ENone);
PreLayoutDynInitRichTextL(*richTextEditor, iRichTextCtlIdTwo, iSimpleTextResIdTwo);
}
}
void CSimpleTextInfoDialog::PreLayoutDynInitRichTextL(CEikRichTextEditor& aRichTextEditor, TInt aRichTextCtlId, TInt aSimpleTextResId)
{
iEikonEnv->BusyMsgL(_L("Opening"));
aRichTextEditor.SetEdwinSizeObserver(this);
if (iSetDialogBackground)
aRichTextEditor.SetBackgroundColorL(iEikonEnv->Color(EColorDialogBackground));
aRichTextEditor.SetSize(aRichTextEditor.Size()); // Set the size of the edwin
// no scrollbars for us
aRichTextEditor.CreateScrollBarFrameL(); // Create the scrollbars
aRichTextEditor.ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, iWantVertScrollbar ? CEikScrollBarFrame::EAuto: CEikScrollBarFrame::EOff);
ShowTextL(*aRichTextEditor.RichText(), aRichTextCtlId, aSimpleTextResId);
aRichTextEditor.UpdateAllFieldsL(); // Updates all the fields in the document
aRichTextEditor.UpdateScrollBarsL();
}
void CSimpleTextInfoDialog::PostLayoutDynInitL()
{
Layout();
iEikonEnv->BusyMsgCancel();
}
TBool CSimpleTextInfoDialog::HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize)
{
if ((aEventType == EEventSizeChanging))
aEdwin->SetSize(aDesirableEdwinSize);
return EFalse;
}
void CSimpleTextInfoDialog::ShowTextL(CRichText& aRichText, TInt /*aRichTextCtlId*/, TInt aResId)
{
if (aResId != -1)
{
if ( ((aResId == iSimpleTextResIdOne) && (iSimpleTextResIdOneIsArray)) ||
((aResId == iSimpleTextResIdTwo) && (iSimpleTextResIdTwoIsArray))
)
{
CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(aResId);
CleanupStack::PushL(desArray);
CSimpleTextFormatParser* parser = CSimpleTextFormatParser::NewLC();
TInt count = desArray->Count();
for (TInt i=0 ;i<count ; i++)
parser->ParseL(desArray->operator[](i), aRichText);
CleanupStack::PopAndDestroy(parser);
CleanupStack::PopAndDestroy(desArray);
}
else
{
HBufC* text = CEikonEnv::Static()->AllocReadResourceLC(aResId);
ShowSimpleTextL(*text, aRichText);
CleanupStack::PopAndDestroy(text);
}
}
}
void CSimpleTextInfoDialog::ShowSimpleTextL(const TDesC& aSimpleText, CRichText& aRichText)
{
CSimpleTextFormatParser* parser = CSimpleTextFormatParser::NewLC();
parser->ParseL(aSimpleText, aRichText);
CleanupStack::PopAndDestroy(parser);
}
/************************************************
*
* About Dialog
*
************************************************/
CAboutDialog::CAboutDialog() : CSimpleTextInfoDialog(-1, ECtlAboutVersion, R_SIMPLE_TEXT_ABOUT_LINKS, ECtlAboutLinks)
{
}
void CAboutDialog::ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId)
{
if (aRichTextCtlId == ECtlAboutLinks)
CSimpleTextInfoDialog::ShowTextL(aRichText, aRichTextCtlId, aResId);
else
{
TBuf<16> versionText;
TBuf<512> text;
#if (KPicoBuildNumber != 0)
versionText.Format(_L("%d.%d%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber, KPicoBuildNumber);
#else
versionText.Format(_L("%d.%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber);
#endif
HBufC* aboutFormat = CEikonEnv::Static()->AllocReadResourceLC(R_SIMPLE_TEXT_ABOUT);
text.Format(*aboutFormat, &versionText);
ShowSimpleTextL(text, aRichText);
CleanupStack::PopAndDestroy(aboutFormat);
}
}

View file

@ -0,0 +1,145 @@
/*******************************************************************
*
* File: Dialogs.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __DIALOGS_H
#define __DIALOGS_H
#include <eikenv.h>
#include <eikdialg.h>
#include <eiktxlbx.h>
#include <eiktxlbm.h>
#include <eikdlgtb.h>
#include <eiklabel.h>
#include <eikchlst.h>
#include <eikchkbx.h>
#include <eikedwob.h>
#include "../ClientServer.h"
class CRichText;
class CEikRichTextEditor;
class TPLauncherConfig;
/************************************************
*
* CSimpleTextInfo Dialog
*
************************************************/
class CSimpleTextInfoDialog : public CEikDialog, public MEikEdwinSizeObserver
{
public:
CSimpleTextInfoDialog(TInt aTextIdOne = -1, TInt aRichTextCtlIdOne = -1,
TInt aTextIdTwo = -1, TInt aRichTextCtlIdTwo = -1,
TBool aSimpleTextResIdOneIsArray = EFalse, TBool aSimpleTextResIdTwoIsArray = EFalse
);
void SetDialogBackground(TBool aEnable){iSetDialogBackground=aEnable;}
void WantVertScrollbar(TBool aEnable){iWantVertScrollbar=aEnable;}
public: // implements MEikEdwinSizeObserver
virtual TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);
protected: // framework
void PreLayoutDynInitL();
void PostLayoutDynInitL();
protected: // new stuff
virtual void ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId);
virtual void PreLayoutDynInitRichTextL(CEikRichTextEditor& aRichTextEditor, TInt aRichTextCtlId, TInt aResId);
void ShowSimpleTextL(const TDesC& aSimpleText, CRichText& aRichText);
TInt iSimpleTextResIdOne;
TInt iSimpleTextResIdTwo;
TInt iRichTextCtlIdOne;
TInt iRichTextCtlIdTwo;
TBool iSimpleTextResIdOneIsArray;
TBool iSimpleTextResIdTwoIsArray;
TBool iSetDialogBackground;
TBool iWantVertScrollbar;
};
/************************************************
*
* config Dialog
*
************************************************/
class CPicoConfigDialog : public CEikDialog
{
public:
CPicoConfigDialog(TPicoConfig &cfg, TPLauncherConfig &cfgl);
protected: // framework
void PostLayoutDynInitL();
void HandleControlStateChangeL(TInt aControlId);
TBool OkToExitL(TInt aButtonId);
TPicoConfig &config;
TPLauncherConfig &config_l;
};
/************************************************
*
* About Dialog
*
************************************************/
class CAboutDialog : public CSimpleTextInfoDialog
{
public:
CAboutDialog();
protected: // from CSimpleTextInfoDialog
virtual void ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId);
};
/*************************************************************
*
* Credits dialog
*
**************************************************************/
class CCreditsDialog : public CEikDialog
{
public:
TInt iMessageResourceID;
protected:
void PreLayoutDynInitL();
void PostLayoutDynInitL();
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
};
/*************************************************************
*
* Debug dialog
*
**************************************************************/
class CDebugDialog : public CEikDialog
{
public:
CDebugDialog(char *t);
protected:
char iText[1024];
void PreLayoutDynInitL();
void PostLayoutDynInitL();
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
};
#endif // __DIALOGS_H

View file

@ -0,0 +1,256 @@
/*******************************************************************
*
* File: Engine.cpp
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#include "Engine.h"
#include <w32std.h>
#include <eikenv.h>
//#include <eikdll.h>
#include "../version.h"
CGameRunner::~CGameRunner()
{
Cancel();
RProcess process;
if(process.Open(iProcessId) == KErrNone) {
process.Terminate(1);
process.Close();
}
}
CGameRunner::CGameRunner(MGameWatcher& aGameWatcher)
: CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher)
{
}
CGameRunner* CGameRunner::NewL(MGameWatcher& aGameWatcher)
{
CGameRunner* self = new(ELeave) CGameRunner(aGameWatcher);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(); // self
return self;
}
void CGameRunner::ConstructL()
{
RProcess newProcess, thisProcess;
// make path to picosmall
TBuf<KMaxFileName> exePath;
TBuf<KMaxFileName*3> tmpbuff; // hopefully large enough
thisProcess.CommandLine(tmpbuff);
TInt pos = tmpbuff.Find(_L(" "));
if(pos == KErrNotFound) pos = tmpbuff.Length();
for(pos--; pos > 2; pos--)
if(tmpbuff[pos] == '\\') break;
if(pos > 2) {
exePath.Copy(tmpbuff.Ptr(), pos+1);
exePath.Append(_L("PICOSMALL.EXE"));
}
DEBUGPRINT(_L("[app] starting EXE: %S"), &exePath);
if(newProcess.Create(exePath, _L(""))) {
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start emulation process."));
thisProcess.Terminate(1);
}
iProcessId = newProcess.Id();
DEBUGPRINT(_L("[app] newProcess.Id(): %d"), iProcessId);
CActiveScheduler::Add(this);
newProcess.SetOwner(thisProcess); // Warning: phone strangely reboots when attempting to get owner after thisProcess exits
newProcess.Logon(iStatus);
SetActive();
newProcess.Resume(); // start execution
newProcess.Close();
}
void CGameRunner::RunL()
{
iGameWatcher.NotifyEmuDeath();
}
void CGameRunner::DoCancel()
{
RProcess process;
if(process.Open(iProcessId) == KErrNone) {
process.LogonCancel(iStatus);
process.Close();
}
}
// CExitForcer
CExitForcer::~CExitForcer()
{
Cancel();
}
CExitForcer::CExitForcer(MGameWatcher& aGameWatcher) : CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher)
{
}
CExitForcer* CExitForcer::NewL(MGameWatcher& aGameWatcher, TInt ms)
{
CExitForcer* self = new(ELeave) CExitForcer(aGameWatcher);
CleanupStack::PushL(self);
self->ConstructL(ms);
CleanupStack::Pop(); // self
return self;
}
void CExitForcer::ConstructL(TInt ms)
{
CActiveScheduler::Add(this);
iTimer.CreateLocal();
iTimer.After(iStatus, ms*1000);
SetActive();
}
void CExitForcer::RunL()
{
iGameWatcher.NotifyForcedExit();
}
void CExitForcer::DoCancel()
{
if(iTimer.Handle()) {
iTimer.Cancel();
iTimer.Close();
}
}
// CThreadWatcher
CThreadWatcher::~CThreadWatcher()
{
Cancel();
}
CThreadWatcher::CThreadWatcher(MGameWatcher& aGameWatcher, const TDesC& aName)
: CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher), iName(aName)
{
}
CThreadWatcher* CThreadWatcher::NewL(MGameWatcher& aGameWatcher, const TDesC& aName)
{
CThreadWatcher* self = new(ELeave) CThreadWatcher(aGameWatcher, aName);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(); // self
return self;
}
void CThreadWatcher::ConstructL()
{
CActiveScheduler::Add(this);
RThread thread;
if(thread.Open(iName) == KErrNone) {
thread.Logon(iStatus);
thread.Close();
SetActive();
}
}
void CThreadWatcher::RunL()
{
iGameWatcher.NotifyEmuDeath();
}
void CThreadWatcher::DoCancel()
{
RThread thread;
if(thread.Open(iName) == KErrNone) {
thread.LogonCancel(iStatus);
thread.Close();
}
}
// config
TPLauncherConfig::TPLauncherConfig(TPicoConfig &cfg)
: iEmuConfig(cfg)
{
iLastROMFile.Copy(_L("C:\\"));
// ini
TBuf<KMaxFileName*3> tmpbuff; // hopefully large enough
RProcess me;
me.CommandLine(tmpbuff);
TInt pos = tmpbuff.Find(_L(" "));
if(pos == KErrNotFound) pos = tmpbuff.Length();
if(pos > 3) {
iIniFileName.Copy(tmpbuff.Ptr(), pos-3);
iIniFileName.Append(_L("ini"));
}
//DEBUGPRINT(_L("[app] made ini: %S"), &iIniFileName);
}
void TPLauncherConfig::Load()
{
RFile file;
if(!file.Open(CEikonEnv::Static()->FsSession(), iIniFileName, 0))
{
TInt version;
TPckg<TInt> pkg_version(version);
TPckg<TBool> pkg_Pad(iPad);
TBuf8<KMaxFileName> pad0; // reserved for future use (6 words)
TPtr8 picoCfg((TUint8*) &iEmuConfig, sizeof(iEmuConfig));
file.Read(pkg_version);
file.Read(pkg_Pad);
file.Read(pad0, 24);
file.Read(pad0, KMaxFileName);
file.Read(picoCfg);
TBuf8<KMaxFileName> file8(pad0.Ptr()); // take as zero terminated string
iLastROMFile.Copy(file8);
//DEBUGPRINT(_L("[app] iLastROMFile (%i): %S"), iLastROMFile.Length(), &iLastROMFile);
file.Close();
}
}
void TPLauncherConfig::Save()
{
RFile file;
if(!file.Replace(CEikonEnv::Static()->FsSession(), iIniFileName, EFileWrite)) {
TInt version = (KPicoMajorVersionNumber<<24)+(KPicoMinorVersionNumber<<16);
TPckgC<TInt> pkg_version(version);
TPckgC<TBool> pkg_Pad(iPad);
TBuf8<KMaxFileName> pad0; pad0.FillZ(KMaxFileName);
TBuf8<KMaxFileName> file8; file8.Copy(iLastROMFile);
TPtrC8 picoCfg((TUint8*) &iEmuConfig, sizeof(iEmuConfig));
file.Write(pkg_version);
file.Write(pkg_Pad); // 0x0004
file.Write(pad0, 24); // 0x0008, reserved for future use (6 words)
file.Write(file8); // 0x0020
file.Write(pad0, KMaxFileName-file8.Length());
file.Write(picoCfg); // 0x0120
file.Close();
}
}

View file

@ -0,0 +1,112 @@
/*******************************************************************
*
* File: Engine.h
*
* Author: Peter van Sebille (peter@yipton.net)
*
* Modified/adapted for picodriveN by notaz, 2006
*
* (c) Copyright 2006, notaz
* (c) Copyright 2002, Peter van Sebille
* All Rights Reserved
*
*******************************************************************/
#ifndef __ENGINE_H
#define __ENGINE_H
#include <e32base.h>
#include <etel.h>
#include "../ClientServer.h"
class RFs;
#ifdef __DEBUG_PRINT
#define DEBUGPRINT(x...) RDebug::Print(x)
#else
#define DEBUGPRINT(x...)
#endif
class MGameWatcher
{
public:
virtual void NotifyEmuDeath() = 0;
virtual void NotifyForcedExit() = 0;
};
class CGameRunner : public CActive
{
public:
static CGameRunner* NewL(MGameWatcher& aGameWatcher);
~CGameRunner();
void KillAfter(TInt ms);
protected:
CGameRunner(MGameWatcher& aGameWatcher);
void ConstructL();
virtual void RunL();
virtual void DoCancel();
MGameWatcher& iGameWatcher;
TProcessId iProcessId;
};
class CExitForcer : public CActive
{
public:
static CExitForcer* NewL(MGameWatcher& aGameWatcher, TInt ms);
~CExitForcer();
protected:
CExitForcer(MGameWatcher& aGameWatcher);
void ConstructL(TInt ms);
virtual void RunL();
virtual void DoCancel();
MGameWatcher& iGameWatcher;
RTimer iTimer;
};
class CThreadWatcher : public CActive
{
public:
static CThreadWatcher* NewL(MGameWatcher& aGameWatcher, const TDesC& aName);
~CThreadWatcher();
protected:
CThreadWatcher(MGameWatcher& aGameWatcher, const TDesC& aName);
void ConstructL();
virtual void RunL();
virtual void DoCancel();
MGameWatcher& iGameWatcher;
const TDesC& iName; // thread name
};
// configuration emu process doesn't care about
class TPLauncherConfig {
public:
TPLauncherConfig(TPicoConfig &cfg);
void Load();
void Save();
TBool iPad; // was iPauseOnCall
TFileName iLastROMFile;
TPicoConfig &iEmuConfig;
private:
TFileName iIniFileName;
};
#endif

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,70 @@
enum TAppMenuCommands
{
// Emu menu
EEikCmdPicoLoadState = 10000,
EEikCmdPicoSaveState,
EEikCmdPicoLoadROM,
EEikCmdPicoResume,
EEikCmdPicoReset,
EEikCmdPicoKeys,
EEikCmdPicoSettings,
// Frameskip menu
EEikCmdPicoFrameskipAuto,
EEikCmdPicoFrameskip0,
EEikCmdPicoFrameskip1,
EEikCmdPicoFrameskip2,
EEikCmdPicoFrameskip4,
EEikCmdPicoFrameskip8,
// Debug menu
EEikCmdPicoDebugKillEmu,
EEikCmdPicoDebugInfo,
// config Dialog
// pages
ECtlOptPageMain,
ECtlOptPageSound,
ECtlOptPageMisc,
// main page
ECtlOptRotationLabel,
ECtlOptRotation,
ECtlOptRotation0,
ECtlOptRotation90,
ECtlOptRotation180,
ECtlOptRotation270,
ECtlOptScreenModeLabel,
ECtlOptScreenMode,
ECtlOptScreenModeCenter,
ECtlOptScreenModeFit,
ECtlOptScreenModeFit2,
ECtlOptUseAltRend,
ECtlOptUseAccTiming,
ECtlOptUseAccSprites,
ECtlOptShowFPS,
// sound page
ECtlOptEnableSound,
ECtlOptChipSelLabel,
ECtlOptEmulateZ80,
ECtlOptEmulateYM2612,
ECtlOptEmulateSN76496,
ECtlOptSndQLabel,
ECtlOptSndQuality,
// misc page
ECtlOpt6ButtonPad,
ECtlOptGzipStates,
ECtlOptUseSRAM,
ECtlOptMotDontUseVol,
ECtlOptRegionLabel,
ECtlOptRegion,
// credits
ECtlCredits,
// debug
ECtlDebugEdit
};
#define ECtlAboutVersion 1
#define ECtlAboutLinks 2

View file

@ -0,0 +1,34 @@
TARGET PicodriveN.app
TARGETTYPE app
TARGETPATH \system\Apps\PicodriveN
UID 0x100039CE 0x1000C193
USERINCLUDE .
SYSTEMINCLUDE \epoc32\include
SOURCEPATH .
SOURCE App.cpp
SOURCE Engine.cpp
SOURCE Dialogs.cpp
SOURCE CSimpleTextParser.cpp
SOURCE SimpleClient.cpp
LIBRARY EUSER.LIB WS32.LIB EFSRV.LIB
LIBRARY APPARC.LIB CONE.LIB
LIBRARY EIKCOCTL.LIB EIKCORE.LIB EIKDLG.LIB EIKCTL.LIB
LIBRARY EIKFILE.LIB // CEikFileOpenDialog
LIBRARY EGUL.LIB // CColorList
LIBRARY ETEXT.LIB // TCharFormat
LIBRARY GDI.LIB // TTypeface
//LIBRARY ETEL.LIB
//LIBRARY APGRFX.LIB FBSCLI.LIB bafl.lib BITGDI.LIB
SOURCEPATH .
RESOURCE PicodriveN.rss
//MACRO __DEBUG_PRINT
AIF PicodriveN.aif . PicodriveNAif.rss c8 PicoN20x16.bmp PicoN20x16m.bmp PicoN32x32.bmp PicoN32x32m.bmp

View file

@ -0,0 +1,474 @@
NAME PDN
#include <eikon.rh>
#include <eikon.rsg>
#include "picodriven.hrh"
RESOURCE RSS_SIGNATURE { }
RESOURCE TBUF { buf=""; }
RESOURCE EIK_APP_INFO
{
menubar=r_app_menubar;
hotkeys=r_app_hotkeys;
}
RESOURCE HOTKEYS r_app_hotkeys
{
control=
{
HOTKEY { command=EEikCmdExit; key='e'; }
};
}
RESOURCE MENU_BAR r_app_menubar
{
titles=
{
MENU_TITLE { menu_pane=r_app_emu_menu; txt="Emu"; },
MENU_TITLE { menu_pane=r_app_frameskip_menu; txt="Frameskip"; }
#ifdef __DEBUG_PRINT
,MENU_TITLE { menu_pane=r_app_debug_menu; txt="Debug"; }
#endif
};
}
RESOURCE MENU_PANE r_app_emu_menu
{
items=
{
MENU_ITEM { command=EEikCmdPicoLoadState; txt="Load state"; flags=EEikMenuItemDimmed; },
MENU_ITEM { command=EEikCmdPicoSaveState; txt="Save state"; flags=EEikMenuItemDimmed; },
MENU_ITEM { command=EEikCmdPicoLoadROM; txt="Load new ROM"; },
MENU_ITEM { command=EEikCmdPicoResume; txt="Resume game"; flags=EEikMenuItemDimmed; },
MENU_ITEM { command=EEikCmdPicoReset; txt="Reset game"; flags=EEikMenuItemDimmed; },
MENU_ITEM { command=EEikCmdPicoKeys; txt="Configure keys"; },
MENU_ITEM { command=EEikCmdPicoSettings; txt="Settings"; },
MENU_ITEM { command=EEikCmdHelpAbout; txt="About"; flags=EEikMenuItemSeparatorAfter; },
MENU_ITEM { command=EEikCmdExit; txt="Exit"; }
};
}
RESOURCE MENU_PANE r_app_frameskip_menu
{
items=
{
MENU_ITEM { command=EEikCmdPicoFrameskipAuto; txt="Auto"; flags=EEikMenuItemRadioStart | EEikMenuItemSeparatorAfter; },
MENU_ITEM { command=EEikCmdPicoFrameskip0; txt="0"; flags=EEikMenuItemRadioMiddle; },
MENU_ITEM { command=EEikCmdPicoFrameskip1; txt="1"; flags=EEikMenuItemRadioMiddle; },
MENU_ITEM { command=EEikCmdPicoFrameskip2; txt="2"; flags=EEikMenuItemRadioMiddle; },
MENU_ITEM { command=EEikCmdPicoFrameskip4; txt="4"; flags=EEikMenuItemRadioMiddle; },
MENU_ITEM { command=EEikCmdPicoFrameskip8; txt="8"; flags=EEikMenuItemRadioEnd; }
};
}
RESOURCE MENU_PANE r_app_debug_menu
{
items=
{
MENU_ITEM { command=EEikCmdPicoDebugKillEmu; txt="Kill emu proc"; },
MENU_ITEM { command=EEikCmdPicoDebugInfo; txt="info"; }
};
}
/**************************************
*
* about dialog
*
**************************************/
RESOURCE DIALOG r_dialog_about
{
title = "About";
buttons = r_buttons_continue_credits;
flags = EEikDialogFlagWait;
items =
{
DLG_LINE
{
itemflags = EQikDlgItemUseFullWidth | EQikDlgItemDenselyPacked;
type = EEikCtRichTextEditor;
id = ECtlAboutVersion;
control = RTXTED
{
flags = EEikEdwinResizable | EEikEdwinNoAutoSelection | EEikEdwinReadOnly | EEikEdwinWidthInPixels;
numlines = 4;
};
},
DLG_LINE
{
itemflags = EQikDlgItemUseFullWidth | EQikDlgItemDenselyPacked;
type = EEikCtRichTextEditor;
id = ECtlAboutLinks;
control = RTXTED
{
flags = EEikEdwinResizable | EEikEdwinNoAutoSelection | EEikEdwinReadOnly | EEikEdwinWidthInPixels | 0x00200000;
numlines = 4;
};
}
};
}
RESOURCE DLG_BUTTONS r_buttons_continue_credits
{
buttons =
{
DLG_BUTTON { id = EEikBidYes; button = CMBUT { txt = "Credits"; }; },
DLG_BUTTON { id = EEikBidCancel; button = CMBUT { txt = "Continue"; }; flags=EEikLabeledButtonIsDefault; }
};
}
RESOURCE TBUF r_simple_text_about_links
{
buf=
"<f=Corinna><s=11><u>Email</u>: notasas@gmail.com"\
"<p><f=Corinna><s=11><u>Web</u>:<p>http://notaz.atspace.com"\
"<p><f=Corinna><s=11><u>Dave's Web</u>:<p>http://www.finalburn.com";
}
RESOURCE TBUF r_simple_text_about
{
buf=
"<f=Polo><s=26><a=center><fg=RgbDarkBlue>PicodriveN"\
"<p><f=Polo><s=10><a=center>for UIQ2"\
"<p> <p><f=Corinna><s=12>Version %S, by notaz."\
"<p><s=6> <p><s=10>Port based on PicoDrive 0.030 for Pocket PC by Dave";
}
RESOURCE DIALOG r_dialog_credits
{
title = "Credits and thanks";
buttons = R_EIK_BUTTONS_DONE;
flags = EEikDialogFlagWait;
items =
{
DLG_LINE
{
type = EEikCtGlobalTextEditor;
id = ECtlCredits;
control = GTXTED
{
width = 150; height = 200; numlines = 26; flags = EEikEdwinReadOnly | EEikEdwinNoAutoSelection | EEikEdwinDisplayOnly;
};
}
};
}
RESOURCE ARRAY r_tbuf_credits
{
items=
{
LBUF{txt="This emulator uses code from these people / projects:";},
LBUF{txt="";},
LBUF{txt="Dave";},
LBUF{txt="- Cyclone 68000 core, Pico emulation library";},
LBUF{txt="Homepage: http://www.finalburn.com/";},
LBUF{txt="E-mail: david(atsymbol)finalburn.com";},
LBUF{txt="";},
LBUF{txt="Reesy & FluBBa";},
LBUF{txt="- DrZ80, the Z80 emulator written in ARM assembly.";},
LBUF{txt="Homepage: http://reesy.gp32x.de/";},
LBUF{txt="E-mail: drsms_reesy(atsymbol)yahoo.co.uk";},
LBUF{txt="";},
LBUF{txt="Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator (MAME) development";},
LBUF{txt="- software implementation of Yamaha FM sound generator and";},
LBUF{txt="Texas Instruments SN76489 / SN76496 programmable tone / noise generator";},
LBUF{txt="Homepage: http://www.mame.net/";},
LBUF{txt="";},
LBUF{txt="Additional thanks:";},
LBUF{txt="- Peter van Sebille for ECompXL and his various open-source Symbian projects to learn from.";},
LBUF{txt="- Steve Fischer for his open-source Motorola projects.";},
LBUF{txt="- Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful info about genesis hardware.";},
LBUF{txt="- Stéphane Dallongeville for creating Gens and making it open-source.";},
LBUF{txt="- Steve Snake for all that he has done for Genesis emulation scene.";},
LBUF{txt="- Bart Trzynadlowski for his SSFII and 68000 docs.";},
LBUF{txt="- Haze for his research (http://haze.mameworld.info).";},
LBUF{txt="- The development team behind \"Symbian GCC Improvement Project \" (http://www.inf.u-szeged.hu/symbian-gcc/) for their updated compile tools.";},
LBUF{txt="- Mark and Jean-loup for zlib library.";},
LBUF{txt="- Reesy for also finding some Cyclone bugs.";},
LBUF{txt="- Inder for the icons.";}
};
}
/**************************************
*
* debug dialog
*
**************************************/
RESOURCE DIALOG r_dialog_debug
{
title = "debug";
buttons = R_EIK_BUTTONS_DONE;
flags = EEikDialogFlagWait;
items =
{
DLG_LINE
{
type = EEikCtGlobalTextEditor;
id = ECtlDebugEdit;
control = GTXTED
{
width = 150; height = 200; numlines = 26; flags = EEikEdwinReadOnly | EEikEdwinNoAutoSelection | EEikEdwinDisplayOnly;
};
}
};
}
/**************************************
*
* config dialog
*
**************************************/
RESOURCE DIALOG r_pico_config
{
title = "Settings";
buttons = R_EIK_BUTTONS_CANCEL_OK;
flags = EEikDialogFlagWait;
pages = r_pico_config_pages;
}
RESOURCE ARRAY r_pico_config_pages
{
items = {
PAGE
{
id = ECtlOptPageMain;
text = "Main";
lines = r_pico_config_page_main;
},
PAGE
{
id = ECtlOptPageSound;
text = "Sound";
lines = r_pico_config_page_sound;
},
PAGE
{
id = ECtlOptPageMisc;
text = "Misc";
lines = r_pico_config_page_misc;
}
};
}
RESOURCE ARRAY r_pico_config_page_main
{
items = {
DLG_LINE
{
id = ECtlOptRotationLabel;
type = EEikCtLabel;
prompt = "Screen Rotation";
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
},
DLG_LINE
{
id = ECtlOptRotation;
type = EEikCtHorOptionButList;
control = HOROPBUT
{
array_id = r_pico_config_rotation_buttons;
};
},
DLG_LINE
{
id = ECtlOptScreenModeLabel;
type = EEikCtLabel;
prompt = "Screen Mode";
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
},
DLG_LINE
{
id = ECtlOptScreenMode;
type = EEikCtHorOptionButList;
control = HOROPBUT
{
array_id = r_pico_config_screenmode_buttons;
};
},
DLG_LINE
{
id = ECtlOptUseAltRend;
type = EEikCtCheckBox;
prompt = "Fast renderer (inaccurate)";
},
DLG_LINE
{
id = ECtlOptUseAccTiming;
type = EEikCtCheckBox;
prompt = "Accurate timing (slower)";
},
DLG_LINE
{
id = ECtlOptUseAccSprites;
type = EEikCtCheckBox;
prompt = "Accurate sprites (slower)";
},
DLG_LINE
{
id = ECtlOptShowFPS;
type = EEikCtCheckBox;
prompt = "Show FPS";
}
};
}
RESOURCE ARRAY r_pico_config_page_sound
{
items = {
DLG_LINE
{
id = ECtlOptEnableSound;
type = EEikCtCheckBox;
prompt = "Enable sound";
},
DLG_LINE
{
id = ECtlOptChipSelLabel;
type = EEikCtLabel;
prompt = "Emulate these sound chips:";
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
},
DLG_LINE
{
id = ECtlOptEmulateZ80;
type = EEikCtCheckBox;
prompt = "Z80";
},
DLG_LINE
{
id = ECtlOptEmulateYM2612;
type = EEikCtCheckBox;
prompt = "YM2612";
},
DLG_LINE
{
id = ECtlOptEmulateSN76496;
type = EEikCtCheckBox;
prompt = "SN76496 (PSG)";
},
DLG_LINE
{
id = ECtlOptSndQLabel;
type = EEikCtLabel;
prompt = "Quality (lowest is fastest)";
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
},
DLG_LINE
{
id = ECtlOptSndQuality;
type = EEikCtChoiceList;
prompt = "";
control = CHOICELIST { array_id = r_pico_config_snd_quality; };
itemflags = EEikDlgItemNonFocusing;
}
};
}
RESOURCE ARRAY r_pico_config_page_misc
{
items = {
DLG_LINE
{
id = ECtlOpt6ButtonPad;
type = EEikCtCheckBox;
prompt = "6 button pad";
},
DLG_LINE
{
id = ECtlOptGzipStates;
type = EEikCtCheckBox;
prompt = "gzip save states";
},
DLG_LINE
{
id = ECtlOptUseSRAM;
type = EEikCtCheckBox;
prompt = "Use SRAM saves (.srm)";
},
DLG_LINE
{
id = ECtlOptMotDontUseVol;
type = EEikCtCheckBox;
prompt = "Motorola: don't use volume keys for game controls";
},
DLG_LINE
{
id = ECtlOptRegionLabel;
type = EEikCtLabel;
prompt = "Region: ";
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
},
DLG_LINE
{
id = ECtlOptRegion;
type = EEikCtChoiceList;
prompt = "";
control = CHOICELIST { array_id = r_pico_config_region; };
itemflags = EEikDlgItemNonFocusing;
}
};
}
RESOURCE ARRAY r_pico_config_rotation_buttons
{
items = {
OPBUT { id = ECtlOptRotation0; text = "0º"; },
OPBUT { id = ECtlOptRotation90; text = "90º"; },
OPBUT { id = ECtlOptRotation180; text = "180º"; },
OPBUT { id = ECtlOptRotation270; text = "270º"; }
};
}
RESOURCE ARRAY r_pico_config_screenmode_buttons
{
items = {
OPBUT { id = ECtlOptScreenModeCenter; text = "Center"; },
OPBUT { id = ECtlOptScreenModeFit; text = "Fit"; },
OPBUT { id = ECtlOptScreenModeFit2; text = "Fit2"; }
};
}
RESOURCE ARRAY r_pico_config_snd_quality
{
items = {
LBUF { txt = "8000Hz mono"; },
LBUF { txt = "11025Hz mono"; },
LBUF { txt = "16000Hz mono"; },
LBUF { txt = "22050Hz mono"; },
LBUF { txt = "8000Hz stereo"; },
LBUF { txt = "11025Hz stereo"; },
LBUF { txt = "16000Hz stereo"; },
LBUF { txt = "22050Hz stereo"; }
};
}
RESOURCE ARRAY r_pico_config_region
{
items = {
LBUF { txt = "Auto"; },
LBUF { txt = "Europe"; },
LBUF { txt = "USA"; },
LBUF { txt = "Japan PAL"; },
LBUF { txt = "Japan NTSC"; }
};
}

View file

@ -0,0 +1,14 @@
#include <aiftool.rh>
RESOURCE AIF_DATA
{
app_uid=0x1000C193;
caption_list=
{
CAPTION { code=ELangEnglish; caption="PicodriveN"; }
};
num_icons=2;
embeddability=KAppNotEmbeddable;
newfile=KAppDoesNotSupportNewFile;
}

View file

@ -0,0 +1,33 @@
// needed for client interface
#include "../version.h"
#include "../ClientServer.h"
#include "SimpleClient.h"
// Connect to the server - default number of message slots = 4
TInt RServSession::Connect()
{
TInt r=CreateSession(KServerName,Version(),kDefaultMessageSlots);
return(r);
}
// Return the client side version number.
TVersion RServSession::Version(void) const
{
return(TVersion(KPicoMajorVersionNumber,KPicoMinorVersionNumber,0));
}
TInt RServSession::SendReceive(TInt aFunction, TAny* aPtr) const
{
return RSessionBase::SendReceive(aFunction, aPtr);
}
TInt RServSession::Send(TInt aFunction, TAny* aPtr) const
{
return RSessionBase::Send(aFunction, aPtr);
}

View file

@ -0,0 +1,23 @@
#ifndef __SERVSESSION_H__
#define __SERVSESSION_H__
#include <e32base.h>
//**********************************
// RServSession
//**********************************
class RServSession : public RSessionBase
{
public:
RServSession() {}
TInt Connect();
TVersion Version() const;
TInt SendReceive(TInt aFunction,TAny* aPtr) const;
TInt Send(TInt aFunction,TAny* aPtr) const;
};
#endif

View file

@ -0,0 +1,101 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void targetname(char *dest, char *src)
{
char *p, *p1;
if(strlen(src) < 5 || src[0] == '\t') return;
// goto string end
for(p=src; *p && *p != ' ' && *p != '\r'; p++);
// goto start
for(p1=p; p1 > src && *p1 != '\\'; p1--); p1++;
if(p-p1 > 0) {
strncpy(dest, p1, p-p1);
dest[p-p1] = 0;
}
}
int main(int argc, char *argv[])
{
FILE *f = 0, *fo = 0;
unsigned char buff[512], buff2[128], outname[512];
buff2[0] = 0;
if(argc != 2) {
printf("usage: %s <makefile>\n\n", argv[0]);
return 1;
}
f = fopen(argv[1], "r");
if(!f) {
printf("%s: couldn't open %s\n", argv[0], argv[1]);
return 2;
}
strcpy(outname, argv[1]);
strcat(outname, ".out");
fo = fopen(outname, "w");
if(!fo) {
fclose(f);
printf("%s: couldn't open %s for writing\n", argv[0], outname);
return 3;
}
while(!feof(f)) {
fgets(buff, 512, f);
if(!strncmp(buff, "\t$(GCCUREL)", 11) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: gcc\n\t@$(GCCUREL)", buff2);
fputs(buff+11, fo);
} else if(!strncmp(buff, "\tperl -S ecopyfile.pl", 21) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: perl -S ecopyfile.pl\n\t@perl", buff2);
fputs(buff+5, fo);
} else if(!strncmp(buff, "\tperl -S epocrc.pl", 18) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: perl -S epocrc.pl\n\t@perl", buff2);
fputs(buff+5, fo);
} else if(!strncmp(buff, "\tperl -S epocaif.pl", 19) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: perl -S epocaif.pl\n\t@perl", buff2);
fputs(buff+5, fo);
} else if(!strncmp(buff, "\tperl -S emkdir.pl", 18) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: perl -S emkdir.pl\n\t@perl", buff2);
fputs(buff+5, fo);
} else if(!strncmp(buff, "\tperl -S makedef.pl", 18) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: perl -S makedef.pl\n\t@perl", buff2);
fputs(buff+5, fo);
} else if(!strncmp(buff, "\tld ", 4) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: ld\n\t@ld ", buff2);
fputs(buff+4, fo);
} else if(!strncmp(buff, "\tar ", 4) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: ar\n\t@ar ", buff2);
fputs(buff+4, fo);
} else if(!strncmp(buff, "\tif exist ", 10) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: if exist (del?)\n\t@if exist ", buff2);
fputs(buff+10, fo);
} else if(!strncmp(buff, "\tdlltool ", 9) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: dlltool\n\t@dlltool ", buff2);
fputs(buff+9, fo);
} else if(!strncmp(buff, "\tpetran ", 8) && !strchr(buff, '>')) {
fprintf(fo, "\t@echo %s: petran\n\t@petran ", buff2);
fputs(buff+8, fo);
} else {
// try to get new targetname
targetname(buff2, buff);
fputs(buff, fo);
}
}
// done!
fclose(f);
fclose(fo);
remove(argv[1]);
rename(outname, argv[1]);
return 0;
}

Binary file not shown.

View file

@ -0,0 +1 @@
@..\..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\PICODRIVEN.APP ..\..\..\..\..\epoc32\release\armi\urel\PICODRIVEN.APP" "put d:\system\apps\picodriven\PICODRIVEN.rsc ..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PICODRIVEN.rsc" exit

1183
platform/uiq2/main.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
// port specific settings
#ifndef PORT_CONFIG_H
#define PORT_CONFIG_H
#define CPU_CALL
// draw2.c
#define START_ROW 1 // which row of tiles to start rendering at?
#define END_ROW 27 // ..end
// pico.c
#define CAN_HANDLE_240_LINES 0
// common debug
#if defined(__DEBUG_PRINT)
void dprintf(char *format, ...);
#else
#define dprintf(x...)
#endif
#endif //PORT_CONFIG_H

View file

@ -0,0 +1,2 @@
.equiv START_ROW, 1
.equiv END_ROW, 27

1
platform/uiq2/qconn.cmd Normal file
View file

@ -0,0 +1 @@
@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server

View file

@ -0,0 +1 @@
@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\PICOSMALL.EXE PICOSMALL.EXE" exit

View file

@ -0,0 +1 @@
@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\PICODRIVEN.APP launcher\PICODRIVEN.APP" "put d:\system\apps\picodriven\PICODRIVEN.rsc launcher\PICODRIVEN.rsc" exit

10
platform/uiq2/version.h Normal file
View file

@ -0,0 +1,10 @@
// version number
#ifndef __VERSION_H
#define __VERSION_H
#define KPicoMajorVersionNumber 0
#define KPicoMinorVersionNumber 93
#define KPicoBuildNumber 0
#endif /* __VERSION_H */

1017
platform/uiq2/vid.cpp Normal file

File diff suppressed because it is too large Load diff

9
platform/uiq2/vid.h Normal file
View file

@ -0,0 +1,9 @@
#include <e32base.h>
// let's do it in more c-like way
int vidInit(int displayMode, void *vidmem, int p800, int reinit=0);
void vidFree();
void vidDrawFrame(char *noticeStr, char *fpsStr, int num);
void vidKeyConfigFrame(const TUint whichAction, TInt flipClosed);
void vidDrawFCconfigDone();
void vidDrawNotice(const char *txt); // safe to call anytime, draws text for 1 frame