Backport r3971, r3974, r3975 from trunk

To be able to build the cocoa frontend.
This commit is contained in:
riccardom 2011-04-30 14:59:50 +00:00
parent 9faea35458
commit 6b9d89e6b6
5 changed files with 23 additions and 10 deletions

View File

@ -1650,7 +1650,7 @@ bool DmaController::loadstate(EMUFILE* f)
read8le(&temp,f); sar = (EDMASourceUpdate)temp; read8le(&temp,f); sar = (EDMASourceUpdate)temp;
read8le(&temp,f); dar = (EDMADestinationUpdate)temp; read8le(&temp,f); dar = (EDMADestinationUpdate)temp;
read32le(&saddr,f); read32le(&daddr,f); read32le(&saddr,f); read32le(&daddr,f);
read32le(&check,f); read32le(&running,f); read32le(&paused,f); read32le(&triggered,f); read32le(&dmaCheck,f); read32le(&running,f); read32le(&paused,f); read32le(&triggered,f);
read64le(&nextEvent,f); read64le(&nextEvent,f);
if(version==1) if(version==1)
@ -1673,7 +1673,7 @@ void DmaController::savestate(EMUFILE *f)
write8le(sar,f); write8le(sar,f);
write8le(dar,f); write8le(dar,f);
write32le(saddr,f); write32le(daddr,f); write32le(saddr,f); write32le(daddr,f);
write32le(check,f); write32le(running,f); write32le(paused,f); write32le(triggered,f); write32le(dmaCheck,f); write32le(running,f); write32le(paused,f); write32le(triggered,f);
write64le(nextEvent,f); write64le(nextEvent,f);
write32le(saddr_user,f); write32le(saddr_user,f);
write32le(daddr_user,f); write32le(daddr_user,f);
@ -1761,7 +1761,7 @@ if(_startmode==0 && wordcount==1) {
void DmaController::exec() void DmaController::exec()
{ {
check = FALSE; dmaCheck = FALSE;
if(running) if(running)
{ {
@ -1947,7 +1947,7 @@ void DmaController::tryTrigger(EDMAMode mode)
void DmaController::doSchedule() void DmaController::doSchedule()
{ {
check = TRUE; dmaCheck = TRUE;
nextEvent = nds_timer; nextEvent = nds_timer;
NDS_RescheduleDMA(); NDS_RescheduleDMA();
} }

View File

@ -204,7 +204,7 @@ public:
u32 saddr_user, daddr_user; u32 saddr_user, daddr_user;
//indicates whether the dma needs to be checked for triggering //indicates whether the dma needs to be checked for triggering
BOOL check; BOOL dmaCheck;
//indicates whether the dma right now is logically running //indicates whether the dma right now is logically running
//(though for now we copy all the data when it triggers) //(though for now we copy all the data when it triggers)
@ -239,7 +239,7 @@ public:
//by inspecting dma3 saddr when it boots //by inspecting dma3 saddr when it boots
saddr(0), daddr(0), saddr(0), daddr(0),
saddr_user(0), daddr_user(0), saddr_user(0), daddr_user(0),
check(FALSE), dmaCheck(FALSE),
running(FALSE), running(FALSE),
paused(FALSE), paused(FALSE),
triggered(FALSE), triggered(FALSE),

View File

@ -1183,11 +1183,11 @@ template<int procnum, int chan> struct TSequenceItem_DMA : public TSequenceItem
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
return (controller->check && nds_timer>= controller->nextEvent); return (controller->dmaCheck && nds_timer>= controller->nextEvent);
} }
FORCEINLINE bool isEnabled() { FORCEINLINE bool isEnabled() {
return controller->check?TRUE:FALSE; return controller->dmaCheck?TRUE:FALSE;
} }
FORCEINLINE u64 next() FORCEINLINE u64 next()
@ -2640,6 +2640,7 @@ void NDS_setTouchPos(u16 x, u16 y)
} }
#ifndef WIN32 #ifndef WIN32
#ifndef DESMUME_COCOA
// FIXME: this code should be deleted from here, // FIXME: this code should be deleted from here,
// other platforms should call NDS_beginProcessingInput,NDS_endProcessingInput once per frame instead // other platforms should call NDS_beginProcessingInput,NDS_endProcessingInput once per frame instead
// (see the function called "StepRunLoop_Core" in src/windows/main.cpp), // (see the function called "StepRunLoop_Core" in src/windows/main.cpp),
@ -2649,6 +2650,7 @@ void NDS_setTouchPos(u16 x, u16 y)
nds.isTouch = 1; nds.isTouch = 1;
MMU.ARM7_REG[0x136] &= 0xBF; MMU.ARM7_REG[0x136] &= 0xBF;
#endif #endif
#endif
} }
void NDS_releaseTouch(void) void NDS_releaseTouch(void)
{ {
@ -2658,6 +2660,7 @@ void NDS_releaseTouch(void)
rawUserInput.touch.isTouch = false; rawUserInput.touch.isTouch = false;
#ifndef WIN32 #ifndef WIN32
#ifndef DESMUME_COCOA
// FIXME: this code should be deleted from here, // FIXME: this code should be deleted from here,
// other platforms should call NDS_beginProcessingInput,NDS_endProcessingInput once per frame instead // other platforms should call NDS_beginProcessingInput,NDS_endProcessingInput once per frame instead
// (see the function called "StepRunLoop_Core" in src/windows/main.cpp), // (see the function called "StepRunLoop_Core" in src/windows/main.cpp),
@ -2667,6 +2670,7 @@ void NDS_releaseTouch(void)
nds.isTouch = 0; nds.isTouch = 0;
MMU.ARM7_REG[0x136] |= 0x40; MMU.ARM7_REG[0x136] |= 0x40;
#endif #endif
#endif
} }
void NDS_setMic(bool pressed) void NDS_setMic(bool pressed)
{ {

View File

@ -27,7 +27,7 @@
#else #else
#include <glib.h> #include <glib.h>
#endif /* !WXPORT */ #endif /* !WXPORT */
#else #elif !defined(DESMUME_COCOA)
#include <glib.h> #include <glib.h>
#endif /* _WINDOWS */ #endif /* _WINDOWS */
@ -185,6 +185,15 @@ public:
p = pathToModule + lstrlen(pathToModule); p = pathToModule + lstrlen(pathToModule);
while (p >= pathToModule && *p != '\\') p--; while (p >= pathToModule && *p != '\\') p--;
if (++p >= pathToModule) *p = 0; if (++p >= pathToModule) *p = 0;
#elif defined(DESMUME_COCOA)
std::string pathStr = path;
//Truncate the path from filename
int x = pathStr.find_last_of("/\\");
if (x > 0)
pathStr = pathStr.substr(0, x);
strncpy(pathToModule, pathStr.c_str(), MAX_PATH);
#else #else
char *cwd = g_build_filename(g_get_user_config_dir(), "desmume", NULL); char *cwd = g_build_filename(g_get_user_config_dir(), "desmume", NULL);
g_mkdir_with_parents(cwd, 0755); g_mkdir_with_parents(cwd, 0755);

View File

@ -18,7 +18,7 @@
*/ */
#include <string> #include <string>
#include <types.h> #include "types.h"
u32 EMU_DESMUME_VERSION_NUMERIC(); u32 EMU_DESMUME_VERSION_NUMERIC();
const char* EMU_DESMUME_VERSION_STRING(); const char* EMU_DESMUME_VERSION_STRING();