mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Committing some cleanups by avindra:
- fix numerous warnings - make some variables unsigned - remove redundant code and header inclusions - make code more compact in lots of cases Committing some additional changes by myself: - additional header cleanups - cleanup DX11 initialization/shutdown process (hinted at by avindra) - Remove the cgD3D9 stuff from Externals since it's no longer needed git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5903 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -575,29 +575,29 @@ void ExecuteCommand(UDICR& _DICR)
|
||||
{
|
||||
case 0x80000000:
|
||||
ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (80000000)");
|
||||
for (int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
for (unsigned int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
Memory::Write_U32(0, m_DIMAR.Address + i * 4);
|
||||
break;
|
||||
case 0x80000040:
|
||||
ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (2) (80000040)");
|
||||
for (int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
for (unsigned int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
Memory::Write_U32(~0, m_DIMAR.Address + i * 4);
|
||||
Memory::Write_U32(0x00000020, m_DIMAR.Address); // DIMM SIZE, LE
|
||||
Memory::Write_U32(0x4743414D, m_DIMAR.Address + 4); // GCAM signature
|
||||
break;
|
||||
case 0x80000120:
|
||||
ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000120)");
|
||||
for (int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
for (unsigned int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4);
|
||||
break;
|
||||
case 0x80000140:
|
||||
ERROR_LOG(DVDINTERFACE, "GC-AM: READ FIRMWARE STATUS (80000140)");
|
||||
for (int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
for (unsigned int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
Memory::Write_U32(0x01010101, m_DIMAR.Address + i * 4);
|
||||
break;
|
||||
case 0x84000020:
|
||||
ERROR_LOG(DVDINTERFACE, "GC-AM: READ MEDIA BOARD STATUS (1) (84000020)");
|
||||
for (int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
for (unsigned int i = 0; i < m_DILENGTH.Length / 4; i++)
|
||||
Memory::Write_U32(0x00000000, m_DIMAR.Address + i * 4);
|
||||
break;
|
||||
default:
|
||||
|
@ -277,9 +277,9 @@ void UDPWiimote::broadcastPresence()
|
||||
void UDPWiimote::getAccel(float &_x, float &_y, float &_z)
|
||||
{
|
||||
d->mutex.Enter();
|
||||
_x=x;
|
||||
_y=y;
|
||||
_z=z;
|
||||
_x=(float)x;
|
||||
_y=(float)y;
|
||||
_z=(float)z;
|
||||
d->mutex.Leave();
|
||||
//NOTICE_LOG(WIIMOTE,"%lf %lf %lf",_x, _y, _z);
|
||||
}
|
||||
|
@ -15,8 +15,6 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "VideoConfig.h"
|
||||
#include "Setup.h"
|
||||
#include "MemoryUtil.h"
|
||||
|
@ -99,9 +99,7 @@ static void VoiceHacks(AXPB &pb)
|
||||
would end up outside of bounds while the block was still playing resulting in noise
|
||||
a strange noise. This should take care of that.
|
||||
*/
|
||||
if (
|
||||
(sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles
|
||||
)
|
||||
if ((sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2))) // ARAM bounds in nibbles
|
||||
{
|
||||
pb.running = 0;
|
||||
|
||||
@ -422,7 +420,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
|
||||
default:
|
||||
{
|
||||
static bool bFirst = true;
|
||||
if (bFirst == true)
|
||||
if (bFirst)
|
||||
{
|
||||
char szTemp[2048];
|
||||
sprintf(szTemp, "Unknown AX-Command 0x%x (address: 0x%08x). Last valid: %02x\n",
|
||||
|
@ -60,30 +60,32 @@ void CUCode_AXWii::HandleMail(u32 _uMail)
|
||||
m_rMailHandler.PushMail(DSP_RESUME);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
|
||||
{
|
||||
// We are expected to get a new CmdBlock
|
||||
DEBUG_LOG(DSPHLE, "GetNextCmdBlock (%ibytes)", (u16)_uMail);
|
||||
}
|
||||
else if (_uMail == 0xCDD10000) // Action 0 - AX_ResumeTask();
|
||||
{
|
||||
else if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
|
||||
{
|
||||
// We are expected to get a new CmdBlock
|
||||
DEBUG_LOG(DSPHLE, "GetNextCmdBlock (%ibytes)", (u16)_uMail);
|
||||
}
|
||||
else switch(_uMail)
|
||||
{
|
||||
case 0xCDD10000: // Action 0 - AX_ResumeTask()
|
||||
m_rMailHandler.PushMail(DSP_RESUME);
|
||||
}
|
||||
else if (_uMail == 0xCDD10001) // Action 1 - new ucode upload
|
||||
{
|
||||
break;
|
||||
|
||||
case 0xCDD10001: // Action 1 - new ucode upload
|
||||
NOTICE_LOG(DSPHLE,"DSP IROM - New Ucode!");
|
||||
newucodemails = 0;
|
||||
}
|
||||
else if (_uMail == 0xCDD10002) // Action 2 - IROM_Reset(); ( WII: De Blob, Cursed Mountain,...)
|
||||
{
|
||||
break;
|
||||
|
||||
case 0xCDD10002: // Action 2 - IROM_Reset(); ( WII: De Blob, Cursed Mountain,...)
|
||||
NOTICE_LOG(DSPHLE,"DSP IROM - Reset!");
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
}
|
||||
else if (_uMail == 0xCDD10003) // Action 3 - AX_GetNextCmdBlock();
|
||||
{
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case 0xCDD10003: // Action 3 - AX_GetNextCmdBlock()
|
||||
//TODO: Implement??
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
|
||||
AXTask(_uMail);
|
||||
@ -133,9 +135,9 @@ void CUCode_AXWii::MixAdd(short* _pBuffer, int _iSize)
|
||||
int left = templbuffer[i] + _pBuffer[0];
|
||||
int right = temprbuffer[i] + _pBuffer[1];
|
||||
if (left < -32767) left = -32767;
|
||||
if (left > 32767) left = 32767;
|
||||
else if (left > 32767) left = 32767;
|
||||
if (right < -32767) right = -32767;
|
||||
if (right > 32767) right = 32767;
|
||||
else if (right > 32767) right = 32767;
|
||||
*_pBuffer++ = left;
|
||||
*_pBuffer++ = right;
|
||||
}
|
||||
@ -216,24 +218,15 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
|
||||
break;
|
||||
|
||||
case 0x000a:
|
||||
if (wiisportsHack) // AXLIST_COMPRESSORTABLE
|
||||
uAddress += 4;
|
||||
else
|
||||
uAddress += 8;
|
||||
uAddress += wiisportsHack ? 4 : 8; // AXLIST_COMPRESSORTABLE
|
||||
break;
|
||||
|
||||
case 0x000b:
|
||||
if (wiisportsHack)
|
||||
uAddress += 2;
|
||||
else
|
||||
uAddress += 10;
|
||||
uAddress += wiisportsHack ? 2 : 10;
|
||||
break;
|
||||
|
||||
case 0x000c:
|
||||
if (wiisportsHack)
|
||||
uAddress += 8;
|
||||
else
|
||||
uAddress += 10;
|
||||
uAddress += wiisportsHack ? 8 : 10;
|
||||
break;
|
||||
|
||||
case 0x000d:
|
||||
|
@ -108,13 +108,13 @@ wxWindow* GetParentedWxWindow(HWND Parent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wxSetInstance((HINSTANCE)g_hInstance);
|
||||
#endif
|
||||
wxWindow *win = new wxWindow();
|
||||
#ifdef _WIN32
|
||||
win->SetHWND((WXHWND)Parent);
|
||||
win->AdoptAttributesFromHWND();
|
||||
#endif
|
||||
return win;
|
||||
#else
|
||||
return new wxWindow();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -72,7 +72,7 @@ D3DTexture2D* D3DTexture2D::Create(unsigned int width, unsigned int height, D3D1
|
||||
|
||||
void D3DTexture2D::AddRef()
|
||||
{
|
||||
ref++;
|
||||
++ref;
|
||||
}
|
||||
|
||||
UINT D3DTexture2D::Release()
|
||||
|
@ -18,7 +18,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "D3DBase.h"
|
||||
#include "TextureDecoder.h"
|
||||
|
||||
namespace D3D
|
||||
{
|
||||
|
@ -481,10 +481,13 @@ void InitUtils()
|
||||
clearvb = CreateQuadVertexBuffer(4*sizeof(ClearVertex), cqcoords);
|
||||
CHECK(clearvb!=NULL, "Create vertex buffer of drawClearQuad");
|
||||
SetDebugObjectName((ID3D11DeviceChild*)clearvb, "vertex buffer of drawClearQuad");
|
||||
|
||||
font.Init();
|
||||
}
|
||||
|
||||
void ShutdownUtils()
|
||||
{
|
||||
font.Shutdown();
|
||||
SAFE_RELEASE(point_copy_sampler);
|
||||
SAFE_RELEASE(linear_copy_sampler);
|
||||
SAFE_RELEASE(stqvb);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "VertexShaderGen.h"
|
||||
#include "PixelShaderGen.h"
|
||||
#include <stack>
|
||||
|
||||
using std::stack;
|
||||
|
||||
namespace D3D
|
||||
|
@ -229,15 +229,9 @@ static const D3D11_TEXTURE_ADDRESS_MODE d3dClamps[4] =
|
||||
|
||||
void SetupDeviceObjects()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
D3D::font.Init();
|
||||
VertexLoaderManager::Init();
|
||||
FBManager.Create();
|
||||
|
||||
VertexShaderManager::Dirty();
|
||||
PixelShaderManager::Dirty();
|
||||
|
||||
HRESULT hr;
|
||||
float colmat[20]= {0.0f};
|
||||
colmat[0] = colmat[5] = colmat[10] = 1.0f;
|
||||
D3D11_BUFFER_DESC cbdesc = CD3D11_BUFFER_DESC(20*sizeof(float), D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DEFAULT);
|
||||
@ -284,7 +278,6 @@ void SetupDeviceObjects()
|
||||
CHECK(hr==S_OK, "Create blend state for Renderer::ResetAPIState");
|
||||
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetblendstate, "blend state for Renderer::ResetAPIState");
|
||||
|
||||
// TODO: For some reason this overwrites existing resource private data...
|
||||
ddesc.DepthEnable = FALSE;
|
||||
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
|
||||
ddesc.DepthFunc = D3D11_COMPARISON_LESS;
|
||||
@ -304,15 +297,7 @@ void SetupDeviceObjects()
|
||||
|
||||
void TeardownDeviceObjects()
|
||||
{
|
||||
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL);
|
||||
FBManager.Destroy();
|
||||
D3D::font.Shutdown();
|
||||
TextureCache::Invalidate(false);
|
||||
VertexManager::DestroyDeviceObjects();
|
||||
VertexLoaderManager::Shutdown();
|
||||
VertexShaderCache::Clear();
|
||||
PixelShaderCache::Clear();
|
||||
|
||||
SAFE_RELEASE(access_efb_cbuf);
|
||||
SAFE_RELEASE(cleardepthstates[0]);
|
||||
SAFE_RELEASE(cleardepthstates[1]);
|
||||
|
@ -173,7 +173,6 @@ void VertexShaderCache::Init()
|
||||
for (k = 0;k < 32;k++) vs_constant_offset_table[C_NORMALMATRICES+k] = 568+4*k;
|
||||
for (k = 0;k < 64;k++) vs_constant_offset_table[C_POSTTRANSFORMMATRICES+k] = 696+4*k;
|
||||
for (k = 0;k < 4;k++) vs_constant_offset_table[C_DEPTHPARAMS+k] = 952+4*k;
|
||||
|
||||
|
||||
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
|
||||
@ -186,8 +185,7 @@ void VertexShaderCache::Init()
|
||||
|
||||
void VertexShaderCache::Clear()
|
||||
{
|
||||
VSCache::iterator iter = vshaders.begin();
|
||||
for (; iter != vshaders.end(); ++iter)
|
||||
for (VSCache::iterator iter = vshaders.begin(); iter != vshaders.end(); ++iter)
|
||||
iter->second.Destroy();
|
||||
vshaders.clear();
|
||||
}
|
||||
|
@ -18,15 +18,9 @@
|
||||
#ifndef _VERTEXSHADERCACHE_H
|
||||
#define _VERTEXSHADERCACHE_H
|
||||
|
||||
#include "D3DBase.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "D3DBase.h"
|
||||
#include "VertexShaderGen.h"
|
||||
|
||||
#include "d3dcompiler.h"
|
||||
#include <map>
|
||||
|
||||
class VertexShaderCache
|
||||
{
|
||||
|
@ -27,30 +27,32 @@
|
||||
#include "Thread.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#include "resource.h"
|
||||
#include "main.h"
|
||||
#include "VideoConfig.h"
|
||||
#include "Fifo.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "TextureCache.h"
|
||||
#include "BPStructs.h"
|
||||
#include "VertexManager.h"
|
||||
#include "VertexLoaderManager.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "PixelShaderManager.h"
|
||||
#include "VertexShaderCache.h"
|
||||
#include "PixelShaderCache.h"
|
||||
#include "CommandProcessor.h"
|
||||
#include "PixelEngine.h"
|
||||
#include "OnScreenDisplay.h"
|
||||
#include "VideoState.h"
|
||||
#include "XFBConvert.h"
|
||||
#include "Render.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "resource.h"
|
||||
#include "DlgSettings.h"
|
||||
#include "TextureCache.h"
|
||||
#include "VertexManager.h"
|
||||
#include "VertexShaderCache.h"
|
||||
#include "PixelShaderCache.h"
|
||||
#include "D3DTexture.h"
|
||||
#include "D3DUtil.h"
|
||||
#include "W32Util/Misc.h"
|
||||
#include "EmuWindow.h"
|
||||
#include "VideoState.h"
|
||||
#include "XFBConvert.h"
|
||||
#include "render.h"
|
||||
#include "FBManager.h"
|
||||
|
||||
|
||||
#if defined(DEBUGFAST)
|
||||
@ -222,20 +224,24 @@ void Video_Prepare()
|
||||
s_efbAccessRequested = FALSE;
|
||||
s_FifoShuttingDown = FALSE;
|
||||
s_swapRequested = FALSE;
|
||||
|
||||
// internal interfaces
|
||||
Renderer::Init();
|
||||
TextureCache::Init();
|
||||
BPInit();
|
||||
VertexManager::Init();
|
||||
VertexShaderCache::Init();
|
||||
PixelShaderCache::Init();
|
||||
D3D::InitUtils();
|
||||
|
||||
// VideoCommon
|
||||
BPInit();
|
||||
Fifo_Init();
|
||||
VertexLoaderManager::Init();
|
||||
OpcodeDecoder_Init();
|
||||
VertexShaderCache::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderCache::Init();
|
||||
PixelShaderManager::Init();
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
D3D::InitUtils();
|
||||
|
||||
// tell the host that the window is ready
|
||||
g_VideoInitialize.pCoreMessage(WM_USER_CREATE);
|
||||
@ -246,19 +252,24 @@ void Shutdown()
|
||||
s_efbAccessRequested = FALSE;
|
||||
s_FifoShuttingDown = FALSE;
|
||||
s_swapRequested = FALSE;
|
||||
|
||||
// VideoCommon
|
||||
CommandProcessor::Shutdown();
|
||||
PixelShaderManager::Shutdown();
|
||||
PixelShaderCache::Shutdown();
|
||||
VertexShaderManager::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
OpcodeDecoder_Shutdown();
|
||||
VertexLoaderManager::Shutdown();
|
||||
Fifo_Shutdown();
|
||||
|
||||
// internal interfaces
|
||||
D3D::ShutdownUtils();
|
||||
PixelShaderCache::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
VertexManager::Shutdown();
|
||||
TextureCache::Shutdown();
|
||||
D3D::ShutdownUtils();
|
||||
Renderer::Shutdown();
|
||||
EmuWindow::Close();
|
||||
|
||||
s_PluginInitialized = false;
|
||||
}
|
||||
|
||||
@ -308,11 +319,6 @@ void VideoFifo_CheckSwapRequest()
|
||||
}
|
||||
}
|
||||
|
||||
inline bool addrRangesOverlap(u32 aLower, u32 aUpper, u32 bLower, u32 bUpper)
|
||||
{
|
||||
return !((aLower >= bUpper) || (bLower >= aUpper));
|
||||
}
|
||||
|
||||
// Run from the graphics thread (from Fifo.cpp)
|
||||
void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
|
||||
{
|
||||
|
Reference in New Issue
Block a user