mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
just some minor cleanup (texdecoder, dsoundstream)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2394 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a09a3e08f1
commit
3b7875bf3f
@ -22,13 +22,12 @@
|
||||
#include "TextureDecoder.h"
|
||||
#include "LookUpTables.h"
|
||||
|
||||
//Uncomment this to enable Texture Format ID overlays
|
||||
#define OVERLAY_TEXFMT
|
||||
|
||||
#ifdef OVERLAY_TEXFMT
|
||||
bool TexFmt_Overlay_Enable=false;
|
||||
bool TexFmt_Overlay_Center=false;
|
||||
#endif
|
||||
|
||||
extern const char* texfmt[];
|
||||
extern const unsigned char sfont_map[];
|
||||
extern const unsigned char sfont_raw[][9*10];
|
||||
|
||||
// TRAM
|
||||
// STATE_TO_SAVE
|
||||
@ -344,11 +343,7 @@ void decodeDXTBlock(u32 *dst, const DXTBlock *src, int pitch)
|
||||
//TODO: to save memory, don't blindly convert everything to argb8888
|
||||
//also ARGB order needs to be swapped later, to accommodate modern hardware better
|
||||
//need to add DXT support too
|
||||
#ifdef OVERLAY_TEXFMT
|
||||
PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
|
||||
#else
|
||||
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
|
||||
#endif
|
||||
{
|
||||
switch (texformat)
|
||||
{
|
||||
@ -491,15 +486,9 @@ void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef OVERLAY_TEXFMT
|
||||
extern const char* texfmt[];
|
||||
extern const unsigned char sfont_map[];
|
||||
extern const unsigned char sfont_raw[][9*10];
|
||||
|
||||
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
|
||||
{
|
||||
PC_TexFormat retval = TexDecoder_Decode_real(dst,src,width,height,texformat,tlutaddr,tlutfmt);
|
||||
|
||||
if ((!TexFmt_Overlay_Enable)||(retval==PC_TEX_FMT_NONE))
|
||||
return retval;
|
||||
|
||||
@ -1309,5 +1298,3 @@ const unsigned char sfont_raw[][9*10] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0x78, 0x78, 0x78, 0x78,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -106,7 +106,7 @@ void DSound::SoundLoop()
|
||||
while (!threadData)
|
||||
{
|
||||
// No blocking inside the csection
|
||||
soundCriticalSection->Enter();
|
||||
soundCriticalSection.Enter();
|
||||
dsBuffer->GetCurrentPosition((DWORD*)¤tPos, 0);
|
||||
int numBytesToRender = FIX128(ModBufferSize(currentPos - lastPos));
|
||||
if (numBytesToRender >= 256)
|
||||
@ -120,8 +120,10 @@ void DSound::SoundLoop()
|
||||
lastPos = currentPos;
|
||||
}
|
||||
|
||||
soundCriticalSection->Leave();
|
||||
soundSyncEvent->Wait();
|
||||
soundCriticalSection.Leave();
|
||||
if (threadData)
|
||||
break;
|
||||
soundSyncEvent.Wait();
|
||||
}
|
||||
|
||||
dsBuffer->Stop();
|
||||
@ -129,10 +131,7 @@ void DSound::SoundLoop()
|
||||
|
||||
bool DSound::Start()
|
||||
{
|
||||
soundSyncEvent = new Common::Event();
|
||||
soundSyncEvent->Init();
|
||||
|
||||
soundCriticalSection = new Common::CriticalSection();
|
||||
soundSyncEvent.Init();
|
||||
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
|
||||
return false;
|
||||
if (hWnd)
|
||||
@ -152,24 +151,21 @@ bool DSound::Start()
|
||||
|
||||
void DSound::Update()
|
||||
{
|
||||
soundSyncEvent->Set();
|
||||
soundSyncEvent.Set();
|
||||
}
|
||||
|
||||
void DSound::Stop()
|
||||
{
|
||||
soundCriticalSection->Enter();
|
||||
soundCriticalSection.Enter();
|
||||
threadData = 1;
|
||||
// kick the thread if it's waiting
|
||||
soundSyncEvent->Set();
|
||||
soundCriticalSection->Leave();
|
||||
delete soundCriticalSection;
|
||||
soundSyncEvent.Set();
|
||||
soundCriticalSection.Leave();
|
||||
delete thread;
|
||||
|
||||
dsBuffer->Release();
|
||||
ds->Release();
|
||||
|
||||
soundSyncEvent->Shutdown();
|
||||
delete soundSyncEvent;
|
||||
soundSyncEvent = NULL;
|
||||
soundSyncEvent.Shutdown();
|
||||
thread = NULL;
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ class DSound : public SoundStream
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Common::Thread *thread;
|
||||
Common::CriticalSection *soundCriticalSection;
|
||||
Common::Event *soundSyncEvent;
|
||||
Common::CriticalSection soundCriticalSection;
|
||||
Common::Event soundSyncEvent;
|
||||
void *hWnd;
|
||||
|
||||
IDirectSound8* ds;
|
||||
|
Loading…
Reference in New Issue
Block a user