summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorayuanx <ayuanx@gmail.com>2009-12-30 14:37:12 +0000
committerayuanx <ayuanx@gmail.com>2009-12-30 14:37:12 +0000
commit151ff28ab7dd1fd0343587f194bf8620d5fc3620 (patch)
treea47f43544c2c44fc52b529f3eacf2c78c3b8c490 /Source/Core/VideoCommon
parent97779ea295b025d013ed07fc3b0f6bf99def6c5a (diff)
Fixed mem leak caused by not releasing pad & wiimote plugin when shutdown
Fixed main frame crash after shutdown git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4755 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/CommandProcessor.cpp40
-rw-r--r--Source/Core/VideoCommon/Src/CommandProcessor.h4
2 files changed, 27 insertions, 17 deletions
diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp
index 7c0864d692..a9151af1b0 100644
--- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp
+++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp
@@ -133,11 +133,6 @@ inline void WriteHigh(volatile u32& _reg, u16 highbits) {Common::AtomicStore(_re
inline u16 ReadLow (u32 _reg) {return (u16)(_reg & 0xFFFF);}
inline u16 ReadHigh (u32 _reg) {return (u16)(_reg >> 16);}
-void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
-{
- UpdateInterrupts();
-}
-
void Init()
{
m_CPStatusReg.Hex = 0;
@@ -161,7 +156,7 @@ void Init()
s_fifoIdleEvent.Init();
- et_UpdateInterrupts = g_VideoInitialize.pRegisterEvent("UpdateInterrupts", UpdateInterrupts_Wrapper);
+// et_UpdateInterrupts = g_VideoInitialize.pRegisterEvent("UpdateInterrupts", UpdateInterrupts_Wrapper);
}
void Shutdown()
@@ -187,7 +182,7 @@ void Read16(u16& _rReturnValue, const u32 _Address)
m_CPStatusReg.ReadIdle = fifo.CPReadIdle; // This seems not necessary though
m_CPStatusReg.Breakpoint = fifo.bFF_Breakpoint;
// Clear on Read
- g_VideoInitialize.pSetInterrupt(INT_CAUSE_CP, false);
+ UpdateInterrupts(false);
_rReturnValue = m_CPStatusReg.Hex;
@@ -358,14 +353,22 @@ void Write16(const u16 _Value, const u32 _Address)
{
// Instant Breakpoint and Interrupt, since we haven't implemented accurate BP on dual core
// Most likely the Read thread has already exceeded BP here, but it seems we are still cool
- Common::AtomicStore(fifo.bFF_Breakpoint, tmpCtrl.BPEnable && tmpCtrl.CPIntEnable && tmpCtrl.GPReadEnable);
- UpdateInterrupts();
+ if (tmpCtrl.BPEnable && tmpCtrl.CPIntEnable && tmpCtrl.GPReadEnable && tmpCtrl.GPLinkEnable)
+ {
+ Common::AtomicStore(fifo.bFF_Breakpoint, 1);
+ UpdateInterrupts(true);
+ }
+ else
+ {
+ Common::AtomicStore(fifo.bFF_Breakpoint, 0);
+ }
+
}
else
{
// fifo.bFF_BPEnable is only used in single core
- Common::AtomicStore(fifo.bFF_BPEnable, tmpCtrl.BPEnable && tmpCtrl.CPIntEnable && tmpCtrl.GPReadEnable);
- if (!tmpCtrl.BPEnable || !tmpCtrl.CPIntEnable || !tmpCtrl.GPReadEnable)
+ Common::AtomicStore(fifo.bFF_BPEnable, tmpCtrl.BPEnable && tmpCtrl.CPIntEnable && tmpCtrl.GPReadEnable && tmpCtrl.GPLinkEnable);
+ if (!tmpCtrl.BPEnable || !tmpCtrl.CPIntEnable || !tmpCtrl.GPReadEnable || !tmpCtrl.GPLinkEnable)
Common::AtomicStore(fifo.bFF_Breakpoint, 0);
}
@@ -608,7 +611,7 @@ void CatchUpGPU()
{
//_assert_msg_(POWERPC,0,"BP: %08x",fifo.CPBreakpoint);
fifo.bFF_Breakpoint = 1;
- UpdateInterrupts();
+ UpdateInterrupts(true);
break;
}
}
@@ -669,17 +672,24 @@ void UpdateFifoRegister()
CatchUpGPU();
}
-void UpdateInterrupts()
+void UpdateInterrupts(bool active)
{
- DEBUG_LOG(COMMANDPROCESSOR, "Fifo Breakpoint Interrupt triggered");
- g_VideoInitialize.pSetInterrupt(INT_CAUSE_CP, true);
+ DEBUG_LOG(COMMANDPROCESSOR, "Fifo Breakpoint Interrupt: %s", (active)? "Asserted" : "Deasserted");
+ g_VideoInitialize.pSetInterrupt(INT_CAUSE_CP, active);
}
+/*
void UpdateInterruptsFromVideoPlugin()
{
g_VideoInitialize.pScheduleEvent_Threadsafe(0, et_UpdateInterrupts, 0);
}
+void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
+{
+ UpdateInterrupts();
+}
+*/
+
void SetFifoIdleFromVideoPlugin()
{
s_fifoIdleEvent.Set();
diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.h b/Source/Core/VideoCommon/Src/CommandProcessor.h
index 1a3a47ace8..668b2c2f34 100644
--- a/Source/Core/VideoCommon/Src/CommandProcessor.h
+++ b/Source/Core/VideoCommon/Src/CommandProcessor.h
@@ -148,8 +148,8 @@ void Write32(const u32 _Data, const u32 _Address);
void CatchUpGPU();
void GatherPipeBursted();
void UpdateFifoRegister();
-void UpdateInterrupts();
-void UpdateInterruptsFromVideoPlugin();
+void UpdateInterrupts(bool active);
+//void UpdateInterruptsFromVideoPlugin();
void SetFifoIdleFromVideoPlugin();
bool AllowIdleSkipping();