clang-modernize -loop-convert
and some manual adjustments
This commit is contained in:
parent
f401263867
commit
c89f04a7c5
|
@ -17,10 +17,10 @@ bool OpenALStream::Start()
|
|||
{
|
||||
bool bReturn = false;
|
||||
|
||||
ALDeviceList *pDeviceList = new ALDeviceList();
|
||||
if ((pDeviceList) && (pDeviceList->GetNumDevices()))
|
||||
ALDeviceList pDeviceList;
|
||||
if (pDeviceList.GetNumDevices())
|
||||
{
|
||||
char *defDevName = pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice());
|
||||
char *defDevName = pDeviceList.GetDeviceName(pDeviceList.GetDefaultDevice());
|
||||
|
||||
WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName);
|
||||
|
||||
|
@ -49,7 +49,6 @@ bool OpenALStream::Start()
|
|||
{
|
||||
PanicAlertT("OpenAL: can't open device %s", defDevName);
|
||||
}
|
||||
delete pDeviceList;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
void SymbolDB::List()
|
||||
{
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter)
|
||||
for (const auto& func : functions)
|
||||
{
|
||||
DEBUG_LOG(OSHLE, "%s @ %08x: %i bytes (hash %08x) : %i calls",
|
||||
iter->second.name.c_str(), iter->second.address,
|
||||
iter->second.size, iter->second.hash,
|
||||
iter->second.numCalls);
|
||||
func.second.name.c_str(), func.second.address,
|
||||
func.second.size, func.second.hash,
|
||||
func.second.numCalls);
|
||||
}
|
||||
INFO_LOG(OSHLE, "%lu functions known in this program above.",
|
||||
(unsigned long)functions.size());
|
||||
(unsigned long)functions.size());
|
||||
}
|
||||
|
||||
void SymbolDB::Clear(const char *prefix)
|
||||
|
|
|
@ -492,7 +492,7 @@ const char* pdname(u16 val)
|
|||
{
|
||||
static char tmpstr[12]; // nasty
|
||||
|
||||
for (auto& pdlabel : pdlabels)
|
||||
for (const pdlabel_t& pdlabel : pdlabels)
|
||||
{
|
||||
if (pdlabel.addr == val)
|
||||
return pdlabel.name;
|
||||
|
@ -527,31 +527,37 @@ void InitInstructionTable()
|
|||
{
|
||||
extOpTable[i] = &cw;
|
||||
|
||||
for (auto& ext : opcodes_ext)
|
||||
for (const DSPOPCTemplate& ext : opcodes_ext)
|
||||
{
|
||||
u16 mask = ext.opcode_mask;
|
||||
if ((mask & i) == ext.opcode)
|
||||
{
|
||||
if (extOpTable[i] == &cw)
|
||||
{
|
||||
extOpTable[i] = &ext;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if the entry already in the table
|
||||
//is a strict subset, allow it
|
||||
if ((extOpTable[i]->opcode_mask | ext.opcode_mask) != extOpTable[i]->opcode_mask)
|
||||
{
|
||||
ERROR_LOG(DSPLLE, "opcode ext table place %d already in use by %s when inserting %s", i, extOpTable[i]->name, ext.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// op table
|
||||
for (int i = 0; i < OPTABLE_SIZE; i++)
|
||||
opTable[i] = &cw;
|
||||
for (const DSPOPCTemplate*& opcode : opTable)
|
||||
{
|
||||
opcode = &cw;
|
||||
}
|
||||
|
||||
for (int i = 0; i < OPTABLE_SIZE; i++)
|
||||
{
|
||||
for (auto& opcode : opcodes)
|
||||
for (const DSPOPCTemplate& opcode : opcodes)
|
||||
{
|
||||
u16 mask = opcode.opcode_mask;
|
||||
if ((mask & i) == opcode.opcode)
|
||||
|
@ -564,6 +570,8 @@ void InitInstructionTable()
|
|||
}
|
||||
}
|
||||
|
||||
for (int i=0; i < WRITEBACKLOGSIZE; i++)
|
||||
writeBackLogIdx[i] = -1;
|
||||
for (int& elem : writeBackLogIdx)
|
||||
{
|
||||
elem = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ static void *reg_ptr(int reg)
|
|||
DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
||||
: emitter(_emitter), temporary(false), merged(false)
|
||||
{
|
||||
for(auto& xreg : xregs)
|
||||
for (X64CachedReg& xreg : xregs)
|
||||
{
|
||||
xreg.guest_reg = DSP_REG_STATIC;
|
||||
xreg.pushed = false;
|
||||
|
@ -475,7 +475,7 @@ void DSPJitRegCache::pushRegs()
|
|||
}
|
||||
|
||||
int push_count = 0;
|
||||
for(auto& xreg : xregs)
|
||||
for (X64CachedReg& xreg : xregs)
|
||||
{
|
||||
if (xreg.guest_reg == DSP_REG_USED)
|
||||
push_count++;
|
||||
|
@ -533,7 +533,7 @@ void DSPJitRegCache::popRegs() {
|
|||
emitter.MOV(32, M(&ebp_store), R(EBP));
|
||||
#endif
|
||||
int push_count = 0;
|
||||
for(auto& xreg : xregs)
|
||||
for (X64CachedReg& xreg : xregs)
|
||||
{
|
||||
if (xreg.pushed)
|
||||
{
|
||||
|
@ -1062,9 +1062,8 @@ X64Reg DSPJitRegCache::spillXReg()
|
|||
{
|
||||
int max_use_ctr_diff = 0;
|
||||
X64Reg least_recent_use_reg = INVALID_REG;
|
||||
for(size_t i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for (X64Reg reg : alloc_order)
|
||||
{
|
||||
X64Reg reg = alloc_order[i];
|
||||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
{
|
||||
|
@ -1084,9 +1083,8 @@ X64Reg DSPJitRegCache::spillXReg()
|
|||
}
|
||||
|
||||
//just choose one.
|
||||
for(size_t i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for (X64Reg reg : alloc_order)
|
||||
{
|
||||
X64Reg reg = alloc_order[i];
|
||||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
{
|
||||
|
@ -1118,7 +1116,7 @@ void DSPJitRegCache::spillXReg(X64Reg reg)
|
|||
|
||||
X64Reg DSPJitRegCache::findFreeXReg()
|
||||
{
|
||||
for(auto& x : alloc_order)
|
||||
for (X64Reg x : alloc_order)
|
||||
{
|
||||
if (xregs[x].guest_reg == DSP_REG_NONE)
|
||||
{
|
||||
|
|
|
@ -52,8 +52,7 @@ bool FifoDataFile::Save(const char *filename)
|
|||
|
||||
// Add space for frame list
|
||||
u64 frameListOffset = file.Tell();
|
||||
for (size_t i = 0; i < m_Frames.size(); i++)
|
||||
PadFile(sizeof(FileFrameInfo), file);
|
||||
PadFile(m_Frames.size() * sizeof(FileFrameInfo), file);
|
||||
|
||||
u64 bpMemOffset = file.Tell();
|
||||
file.WriteArray(m_BPMem, BP_MEM_SIZE);
|
||||
|
@ -194,12 +193,10 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
|
|||
return dataFile;
|
||||
}
|
||||
|
||||
void FifoDataFile::PadFile(u32 numBytes, File::IOFile &file)
|
||||
void FifoDataFile::PadFile(u32 numBytes, File::IOFile& file)
|
||||
{
|
||||
FILE *handle = file.GetHandle();
|
||||
|
||||
for (u32 i = 0; i < numBytes; ++i)
|
||||
fputc(0, handle);
|
||||
const u8 zero = 0;
|
||||
fwrite(&zero, sizeof(zero), numBytes, file.GetHandle());
|
||||
}
|
||||
|
||||
void FifoDataFile::SetFlag(u32 flag, bool set)
|
||||
|
@ -219,8 +216,7 @@ u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates
|
|||
{
|
||||
// Add space for memory update list
|
||||
u64 updateListOffset = file.Tell();
|
||||
for (size_t i = 0; i < memUpdates.size(); i++)
|
||||
PadFile(sizeof(FileMemoryUpdate), file);
|
||||
PadFile(memUpdates.size() * sizeof(FileMemoryUpdate), file);
|
||||
|
||||
for (unsigned int i = 0; i < memUpdates.size(); ++i)
|
||||
{
|
||||
|
|
|
@ -20,8 +20,8 @@ CUCode_AXWii::CUCode_AXWii(DSPHLE *dsp_hle, u32 l_CRC)
|
|||
: CUCode_AX(dsp_hle, l_CRC),
|
||||
m_last_main_volume(0x8000)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
m_last_aux_volumes[i] = 0x8000;
|
||||
for (u16& volume : m_last_aux_volumes)
|
||||
volume = 0x8000;
|
||||
|
||||
WARN_LOG(DSPHLE, "Instantiating CUCode_AXWii");
|
||||
|
||||
|
|
|
@ -173,11 +173,15 @@ void Init()
|
|||
|
||||
m_DTVStatus.ntsc_j = Core::g_CoreStartupParameter.bForceNTSCJ;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
m_InterruptRegister[i].Hex = 0;
|
||||
for (UVIInterruptRegister& reg : m_InterruptRegister)
|
||||
{
|
||||
reg.Hex = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
m_LatchRegister[i].Hex = 0;
|
||||
for (UVILatchRegister& reg : m_LatchRegister)
|
||||
{
|
||||
reg.Hex = 0;
|
||||
}
|
||||
|
||||
m_DisplayControlRegister.Hex = 0;
|
||||
UpdateParameters();
|
||||
|
@ -359,8 +363,10 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
|||
{
|
||||
// shuffle2 clear all data, reset to default vals, and enter idle mode
|
||||
m_DisplayControlRegister.RST = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
m_InterruptRegister[i].Hex = 0;
|
||||
for (UVIInterruptRegister& reg : m_InterruptRegister)
|
||||
{
|
||||
reg.Hex = 0;
|
||||
}
|
||||
UpdateInterrupts();
|
||||
}
|
||||
|
||||
|
@ -576,10 +582,12 @@ void Update()
|
|||
if (++m_VBeamPos > s_lineCount * fields)
|
||||
m_VBeamPos = 1;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (UVIInterruptRegister& reg : m_InterruptRegister)
|
||||
{
|
||||
if (m_VBeamPos == m_InterruptRegister[i].VCT)
|
||||
m_InterruptRegister[i].IR_INT = 1;
|
||||
if (m_VBeamPos == reg.VCT)
|
||||
{
|
||||
reg.IR_INT = 1;
|
||||
}
|
||||
}
|
||||
UpdateInterrupts();
|
||||
}
|
||||
|
|
|
@ -92,20 +92,20 @@ void Init()
|
|||
{
|
||||
_dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init");
|
||||
CWII_IPC_HLE_Device_es::m_ContentFile = "";
|
||||
u32 i;
|
||||
for (i=0; i<IPC_MAX_FDS; i++)
|
||||
|
||||
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
|
||||
{
|
||||
g_FdMap[i] = NULL;
|
||||
dev = NULL;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
u32 i = 0;
|
||||
// Build hardware devices
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_oh1_57e_305(i, std::string("/dev/usb/oh1/57e/305")); i++;
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_immediate(i, std::string("/dev/stm/immediate")); i++;
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stm_eventhook(i, std::string("/dev/stm/eventhook")); i++;
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_fs(i, std::string("/dev/fs")); i++;
|
||||
|
||||
// IOS allows two ES devices at a time<
|
||||
// IOS allows two ES devices at a time
|
||||
for (u32 j=0; j<ES_MAX_COUNT; j++)
|
||||
{
|
||||
g_DeviceMap[i] = es_handles[j] = new CWII_IPC_HLE_Device_es(i, std::string("/dev/es")); i++;
|
||||
|
@ -137,21 +137,21 @@ void Reset(bool _bHard)
|
|||
{
|
||||
CoreTiming::RemoveAllEvents(enque_reply);
|
||||
|
||||
for (u32 i=0; i<IPC_MAX_FDS; i++)
|
||||
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
|
||||
{
|
||||
if (g_FdMap[i] != NULL && !g_FdMap[i]->IsHardware())
|
||||
if (dev != NULL && !dev->IsHardware())
|
||||
{
|
||||
// close all files and delete their resources
|
||||
g_FdMap[i]->Close(0, true);
|
||||
delete g_FdMap[i];
|
||||
dev->Close(0, true);
|
||||
delete dev;
|
||||
}
|
||||
|
||||
g_FdMap[i] = NULL;
|
||||
dev = NULL;
|
||||
}
|
||||
|
||||
for (u32 j=0; j<ES_MAX_COUNT; j++)
|
||||
for (bool& in_use : es_inuse)
|
||||
{
|
||||
es_inuse[j] = false;
|
||||
in_use = false;
|
||||
}
|
||||
|
||||
for (const auto& entry : g_DeviceMap)
|
||||
|
@ -228,7 +228,9 @@ IWII_IPC_HLE_Device* GetDeviceByName(const std::string& _rDeviceName)
|
|||
for (const auto& entry : g_DeviceMap)
|
||||
{
|
||||
if (entry.second && entry.second->GetDeviceName() == _rDeviceName)
|
||||
{
|
||||
return entry.second;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -237,9 +239,11 @@ IWII_IPC_HLE_Device* GetDeviceByName(const std::string& _rDeviceName)
|
|||
IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
|
||||
{
|
||||
if (g_DeviceMap.find(_ID) != g_DeviceMap.end())
|
||||
{
|
||||
return g_DeviceMap[_ID];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// This is called from ExecuteCommand() COMMAND_OPEN_DEVICE
|
||||
|
@ -310,22 +314,22 @@ void DoState(PointerWrap &p)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (u32 i=0; i<IPC_MAX_FDS; i++)
|
||||
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
|
||||
{
|
||||
u32 exists = g_FdMap[i] ? 1 : 0;
|
||||
u32 exists = dev ? 1 : 0;
|
||||
p.Do(exists);
|
||||
if (exists)
|
||||
{
|
||||
u32 isHw = g_FdMap[i]->IsHardware() ? 1 : 0;
|
||||
u32 isHw = dev->IsHardware() ? 1 : 0;
|
||||
p.Do(isHw);
|
||||
if (isHw)
|
||||
{
|
||||
u32 hwId = g_FdMap[i]->GetDeviceID();
|
||||
u32 hwId = dev->GetDeviceID();
|
||||
p.Do(hwId);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_FdMap[i]->DoState(p);
|
||||
dev->DoState(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,32 +11,32 @@ WII_SSL CWII_IPC_HLE_Device_net_ssl::_SSL[NET_SSL_MAXINSTANCES];
|
|||
CWII_IPC_HLE_Device_net_ssl::CWII_IPC_HLE_Device_net_ssl(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{
|
||||
for (int i = 0; i < NET_SSL_MAXINSTANCES; ++i)
|
||||
for (WII_SSL& ssl : _SSL)
|
||||
{
|
||||
memset(&_SSL[i], 0, sizeof(WII_SSL));
|
||||
memset(&ssl, 0, sizeof(WII_SSL));
|
||||
}
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_Device_net_ssl::~CWII_IPC_HLE_Device_net_ssl()
|
||||
{
|
||||
// Cleanup sessions
|
||||
for (int i = 0; i < NET_SSL_MAXINSTANCES; i++)
|
||||
for (WII_SSL& ssl : _SSL)
|
||||
{
|
||||
if (_SSL[i].active)
|
||||
if (ssl.active)
|
||||
{
|
||||
ssl_close_notify(&_SSL[i].ctx);
|
||||
ssl_session_free(&_SSL[i].session);
|
||||
ssl_free(&_SSL[i].ctx);
|
||||
ssl_close_notify(&ssl.ctx);
|
||||
ssl_session_free(&ssl.session);
|
||||
ssl_free(&ssl.ctx);
|
||||
|
||||
x509_crt_free(&_SSL[i].cacert);
|
||||
x509_crt_free(&_SSL[i].clicert);
|
||||
x509_crt_free(&ssl.cacert);
|
||||
x509_crt_free(&ssl.clicert);
|
||||
|
||||
memset(&_SSL[i].ctx, 0, sizeof(ssl_context));
|
||||
memset(&_SSL[i].session, 0, sizeof(ssl_session));
|
||||
memset(&_SSL[i].entropy, 0, sizeof(entropy_context));
|
||||
memset(_SSL[i].hostname, 0, NET_SSL_MAX_HOSTNAME_LEN);
|
||||
memset(&ssl.ctx, 0, sizeof(ssl_context));
|
||||
memset(&ssl.session, 0, sizeof(ssl_session));
|
||||
memset(&ssl.entropy, 0, sizeof(entropy_context));
|
||||
memset(ssl.hostname, 0, NET_SSL_MAX_HOSTNAME_LEN);
|
||||
|
||||
_SSL[i].active = false;
|
||||
ssl.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,9 +79,9 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtl(u32 _CommandAddress)
|
|||
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
|
||||
|
||||
INFO_LOG(WII_IPC_SSL, "%s unknown %i "
|
||||
"(BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
||||
GetDeviceName().c_str(), Command,
|
||||
BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||
"(BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
||||
GetDeviceName().c_str(), Command,
|
||||
BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
return true;
|
||||
}
|
||||
|
@ -139,45 +139,46 @@ bool CWII_IPC_HLE_Device_net_ssl::IOCtlV(u32 _CommandAddress)
|
|||
if (freeSSL)
|
||||
{
|
||||
int sslID = freeSSL - 1;
|
||||
int ret = ssl_init(&_SSL[sslID].ctx);
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
int ret = ssl_init(&ssl->ctx);
|
||||
if (ret)
|
||||
{
|
||||
// Cleanup possibly dirty ctx
|
||||
memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
|
||||
memset(&ssl->ctx, 0, sizeof(ssl_context));
|
||||
goto _SSL_NEW_ERROR;
|
||||
}
|
||||
|
||||
entropy_init(&_SSL[sslID].entropy);
|
||||
entropy_init(&ssl->entropy);
|
||||
const char* pers = "dolphin-emu";
|
||||
ret = ctr_drbg_init(&_SSL[sslID].ctr_drbg, entropy_func,
|
||||
&_SSL[sslID].entropy,
|
||||
ret = ctr_drbg_init(&ssl->ctr_drbg, entropy_func,
|
||||
&ssl->entropy,
|
||||
(const unsigned char*)pers,
|
||||
strlen(pers));
|
||||
if (ret)
|
||||
{
|
||||
ssl_free(&_SSL[sslID].ctx);
|
||||
ssl_free(&ssl->ctx);
|
||||
// Cleanup possibly dirty ctx
|
||||
memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
|
||||
entropy_free(&_SSL[sslID].entropy);
|
||||
memset(&ssl->ctx, 0, sizeof(ssl_context));
|
||||
entropy_free(&ssl->entropy);
|
||||
goto _SSL_NEW_ERROR;
|
||||
}
|
||||
|
||||
ssl_set_rng(&_SSL[sslID].ctx, ctr_drbg_random, &_SSL[sslID].ctr_drbg);
|
||||
ssl_set_rng(&ssl->ctx, ctr_drbg_random, &ssl->ctr_drbg);
|
||||
|
||||
// For some reason we can't use TLSv1.2, v1.1 and below are fine!
|
||||
ssl_set_max_version(&_SSL[sslID].ctx, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_2);
|
||||
ssl_set_max_version(&ssl->ctx, SSL_MAJOR_VERSION_3, SSL_MINOR_VERSION_2);
|
||||
|
||||
ssl_set_session(&_SSL[sslID].ctx, &_SSL[sslID].session);
|
||||
ssl_set_session(&ssl->ctx, &ssl->session);
|
||||
|
||||
ssl_set_endpoint(&_SSL[sslID].ctx, SSL_IS_CLIENT);
|
||||
ssl_set_authmode(&_SSL[sslID].ctx, SSL_VERIFY_NONE);
|
||||
ssl_set_renegotiation(&_SSL[sslID].ctx, SSL_RENEGOTIATION_ENABLED);
|
||||
ssl_set_endpoint(&ssl->ctx, SSL_IS_CLIENT);
|
||||
ssl_set_authmode(&ssl->ctx, SSL_VERIFY_NONE);
|
||||
ssl_set_renegotiation(&ssl->ctx, SSL_RENEGOTIATION_ENABLED);
|
||||
|
||||
memcpy(_SSL[sslID].hostname, hostname, min((int)BufferOutSize2, NET_SSL_MAX_HOSTNAME_LEN));
|
||||
_SSL[sslID].hostname[NET_SSL_MAX_HOSTNAME_LEN-1] = '\0';
|
||||
ssl_set_hostname(&_SSL[sslID].ctx, _SSL[sslID].hostname);
|
||||
memcpy(ssl->hostname, hostname, min((int)BufferOutSize2, NET_SSL_MAX_HOSTNAME_LEN));
|
||||
ssl->hostname[NET_SSL_MAX_HOSTNAME_LEN-1] = '\0';
|
||||
ssl_set_hostname(&ssl->ctx, ssl->hostname);
|
||||
|
||||
_SSL[sslID].active = true;
|
||||
ssl->active = true;
|
||||
Memory::Write_U32(freeSSL, _BufferIn);
|
||||
}
|
||||
else
|
||||
|
@ -201,21 +202,22 @@ _SSL_NEW_ERROR:
|
|||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||
if (SSLID_VALID(sslID))
|
||||
{
|
||||
ssl_close_notify(&_SSL[sslID].ctx);
|
||||
ssl_session_free(&_SSL[sslID].session);
|
||||
ssl_free(&_SSL[sslID].ctx);
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
ssl_close_notify(&ssl->ctx);
|
||||
ssl_session_free(&ssl->session);
|
||||
ssl_free(&ssl->ctx);
|
||||
|
||||
entropy_free(&_SSL[sslID].entropy);
|
||||
entropy_free(&ssl->entropy);
|
||||
|
||||
x509_crt_free(&_SSL[sslID].cacert);
|
||||
x509_crt_free(&_SSL[sslID].clicert);
|
||||
x509_crt_free(&ssl->cacert);
|
||||
x509_crt_free(&ssl->clicert);
|
||||
|
||||
memset(&_SSL[sslID].ctx, 0, sizeof(ssl_context));
|
||||
memset(&_SSL[sslID].session, 0, sizeof(ssl_session));
|
||||
memset(&_SSL[sslID].entropy, 0, sizeof(entropy_context));
|
||||
memset(_SSL[sslID].hostname, 0, NET_SSL_MAX_HOSTNAME_LEN);
|
||||
memset(&ssl->ctx, 0, sizeof(ssl_context));
|
||||
memset(&ssl->session, 0, sizeof(ssl_session));
|
||||
memset(&ssl->entropy, 0, sizeof(entropy_context));
|
||||
memset(ssl->hostname, 0, NET_SSL_MAX_HOSTNAME_LEN);
|
||||
|
||||
_SSL[sslID].active = false;
|
||||
ssl->active = false;
|
||||
|
||||
Memory::Write_U32(SSL_OK, _BufferIn);
|
||||
}
|
||||
|
@ -246,8 +248,9 @@ _SSL_NEW_ERROR:
|
|||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||
if (SSLID_VALID(sslID))
|
||||
{
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
int ret = x509_crt_parse_der(
|
||||
&_SSL[sslID].cacert,
|
||||
&ssl->cacert,
|
||||
Memory::GetPointer(BufferOut2),
|
||||
BufferOutSize2);
|
||||
|
||||
|
@ -257,7 +260,7 @@ _SSL_NEW_ERROR:
|
|||
}
|
||||
else
|
||||
{
|
||||
ssl_set_ca_chain(&_SSL[sslID].ctx, &_SSL[sslID].cacert, NULL, _SSL[sslID].hostname);
|
||||
ssl_set_ca_chain(&ssl->ctx, &ssl->cacert, NULL, ssl->hostname);
|
||||
Memory::Write_U32(SSL_OK, _BufferIn);
|
||||
}
|
||||
|
||||
|
@ -282,20 +285,21 @@ _SSL_NEW_ERROR:
|
|||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||
if (SSLID_VALID(sslID))
|
||||
{
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
|
||||
int ret = x509_crt_parse_file(&_SSL[sslID].clicert, (cert_base_path + "clientca.pem").c_str());
|
||||
int pk_ret = pk_parse_keyfile(&_SSL[sslID].pk, (cert_base_path + "clientcakey.pem").c_str(), NULL);
|
||||
int ret = x509_crt_parse_file(&ssl->clicert, (cert_base_path + "clientca.pem").c_str());
|
||||
int pk_ret = pk_parse_keyfile(&ssl->pk, (cert_base_path + "clientcakey.pem").c_str(), NULL);
|
||||
if (ret || pk_ret)
|
||||
{
|
||||
x509_crt_free(&_SSL[sslID].clicert);
|
||||
pk_free(&_SSL[sslID].pk);
|
||||
memset(&_SSL[sslID].clicert, 0, sizeof(x509_crt));
|
||||
memset(&_SSL[sslID].pk, 0, sizeof(pk_context));
|
||||
x509_crt_free(&ssl->clicert);
|
||||
pk_free(&ssl->pk);
|
||||
memset(&ssl->clicert, 0, sizeof(x509_crt));
|
||||
memset(&ssl->pk, 0, sizeof(pk_context));
|
||||
Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
|
||||
}
|
||||
else
|
||||
{
|
||||
ssl_set_own_cert(&_SSL[sslID].ctx, &_SSL[sslID].clicert, &_SSL[sslID].pk);
|
||||
ssl_set_own_cert(&ssl->ctx, &ssl->clicert, &ssl->pk);
|
||||
Memory::Write_U32(SSL_OK, _BufferIn);
|
||||
}
|
||||
|
||||
|
@ -321,12 +325,13 @@ _SSL_NEW_ERROR:
|
|||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||
if (SSLID_VALID(sslID))
|
||||
{
|
||||
x509_crt_free(&_SSL[sslID].clicert);
|
||||
pk_free(&_SSL[sslID].pk);
|
||||
memset(&_SSL[sslID].clicert, 0, sizeof(x509_crt));
|
||||
memset(&_SSL[sslID].pk, 0, sizeof(pk_context));
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
x509_crt_free(&ssl->clicert);
|
||||
pk_free(&ssl->pk);
|
||||
memset(&ssl->clicert, 0, sizeof(x509_crt));
|
||||
memset(&ssl->pk, 0, sizeof(pk_context));
|
||||
|
||||
ssl_set_own_cert(&_SSL[sslID].ctx, NULL, NULL);
|
||||
ssl_set_own_cert(&ssl->ctx, NULL, NULL);
|
||||
Memory::Write_U32(SSL_OK, _BufferIn);
|
||||
}
|
||||
else
|
||||
|
@ -341,17 +346,18 @@ _SSL_NEW_ERROR:
|
|||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||
if (SSLID_VALID(sslID))
|
||||
{
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
std::string cert_base_path(File::GetUserPath(D_WIIUSER_IDX));
|
||||
|
||||
int ret = x509_crt_parse_file(&_SSL[sslID].cacert, (cert_base_path + "rootca.pem").c_str());
|
||||
int ret = x509_crt_parse_file(&ssl->cacert, (cert_base_path + "rootca.pem").c_str());
|
||||
if (ret)
|
||||
{
|
||||
x509_crt_free(&_SSL[sslID].clicert);
|
||||
x509_crt_free(&ssl->clicert);
|
||||
Memory::Write_U32(SSL_ERR_FAILED, _BufferIn);
|
||||
}
|
||||
else
|
||||
{
|
||||
ssl_set_ca_chain(&_SSL[sslID].ctx, &_SSL[sslID].cacert, NULL, _SSL[sslID].hostname);
|
||||
ssl_set_ca_chain(&ssl->ctx, &ssl->cacert, NULL, ssl->hostname);
|
||||
Memory::Write_U32(SSL_OK, _BufferIn);
|
||||
}
|
||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA = %d", ret);
|
||||
|
@ -374,9 +380,10 @@ _SSL_NEW_ERROR:
|
|||
int sslID = Memory::Read_U32(BufferOut) - 1;
|
||||
if (SSLID_VALID(sslID))
|
||||
{
|
||||
_SSL[sslID].sockfd = Memory::Read_U32(BufferOut2);
|
||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_CONNECT socket = %d", _SSL[sslID].sockfd);
|
||||
ssl_set_bio(&_SSL[sslID].ctx, net_recv, &_SSL[sslID].sockfd, net_send, &_SSL[sslID].sockfd);
|
||||
WII_SSL* ssl = &_SSL[sslID];
|
||||
ssl->sockfd = Memory::Read_U32(BufferOut2);
|
||||
INFO_LOG(WII_IPC_SSL, "IOCTLV_NET_SSL_CONNECT socket = %d", ssl->sockfd);
|
||||
ssl_set_bio(&ssl->ctx, net_recv, &ssl->sockfd, net_send, &ssl->sockfd);
|
||||
Memory::Write_U32(SSL_OK, _BufferIn);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,8 +27,10 @@ bool CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mode)
|
|||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
ini.Get("USB Keyboard", "Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY);
|
||||
|
||||
for(int i = 0; i < 256; i++)
|
||||
m_OldKeyBuffer[i] = false;
|
||||
for (bool& pressed : m_OldKeyBuffer)
|
||||
{
|
||||
pressed = false;
|
||||
}
|
||||
|
||||
m_OldModifiers = 0x00;
|
||||
|
||||
|
|
|
@ -184,8 +184,10 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
|
||||
case NP_MSG_PAD_MAPPING :
|
||||
{
|
||||
for (PadMapping i = 0; i < 4; i++)
|
||||
packet >> m_pad_map[i];
|
||||
for (PadMapping& mapping : m_pad_map)
|
||||
{
|
||||
packet >> mapping;
|
||||
}
|
||||
|
||||
UpdateDevices();
|
||||
|
||||
|
@ -195,8 +197,10 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
|||
|
||||
case NP_MSG_WIIMOTE_MAPPING :
|
||||
{
|
||||
for (PadMapping i = 0; i < 4; i++)
|
||||
packet >> m_wiimote_map[i];
|
||||
for (PadMapping& mapping : m_wiimote_map)
|
||||
{
|
||||
packet >> mapping;
|
||||
}
|
||||
|
||||
m_dialog->Update();
|
||||
}
|
||||
|
@ -759,15 +763,19 @@ void NetPlayClient::Stop()
|
|||
if (m_is_running == false)
|
||||
return;
|
||||
bool isPadMapped = false;
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
for (PadMapping mapping : m_pad_map)
|
||||
{
|
||||
if (m_pad_map[i] == m_local_player->pid)
|
||||
if (mapping == m_local_player->pid)
|
||||
{
|
||||
isPadMapped = true;
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
for (PadMapping mapping : m_wiimote_map)
|
||||
{
|
||||
if (m_wiimote_map[i] == m_local_player->pid)
|
||||
if (mapping == m_local_player->pid)
|
||||
{
|
||||
isPadMapped = true;
|
||||
}
|
||||
}
|
||||
// tell the server to stop if we have a pad mapped in game.
|
||||
if (isPadMapped)
|
||||
|
|
|
@ -156,11 +156,11 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
|
|||
player.pid = (PlayerId)(m_players.size() + 1);
|
||||
|
||||
// try to automatically assign new user a pad
|
||||
for (unsigned int m = 0; m < 4; ++m)
|
||||
for (PadMapping& mapping : m_pad_map)
|
||||
{
|
||||
if (m_pad_map[m] == -1)
|
||||
if (mapping == -1)
|
||||
{
|
||||
m_pad_map[m] = player.pid;
|
||||
mapping = player.pid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -229,9 +229,9 @@ unsigned int NetPlayServer::OnDisconnect(sf::SocketTCP& socket)
|
|||
|
||||
if (m_is_running)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (PadMapping mapping : m_pad_map)
|
||||
{
|
||||
if (m_pad_map[i] == pid)
|
||||
if (mapping == pid)
|
||||
{
|
||||
PanicAlertT("Client disconnect while game is running!! NetPlay is disabled. You must manually stop the game.");
|
||||
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
|
||||
|
@ -260,14 +260,22 @@ unsigned int NetPlayServer::OnDisconnect(sf::SocketTCP& socket)
|
|||
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
|
||||
SendToClients(spac);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (m_pad_map[i] == pid)
|
||||
m_pad_map[i] = -1;
|
||||
for (PadMapping& mapping : m_pad_map)
|
||||
{
|
||||
if (mapping == pid)
|
||||
{
|
||||
mapping = -1;
|
||||
}
|
||||
}
|
||||
UpdatePadMapping();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (m_wiimote_map[i] == pid)
|
||||
m_wiimote_map[i] = -1;
|
||||
for (PadMapping& mapping : m_wiimote_map)
|
||||
{
|
||||
if (mapping == pid)
|
||||
{
|
||||
mapping = -1;
|
||||
}
|
||||
}
|
||||
UpdateWiimoteMapping();
|
||||
|
||||
return 0;
|
||||
|
@ -307,8 +315,10 @@ void NetPlayServer::UpdatePadMapping()
|
|||
{
|
||||
sf::Packet spac;
|
||||
spac << (MessageId)NP_MSG_PAD_MAPPING;
|
||||
for (int i = 0; i < 4; i++)
|
||||
spac << m_pad_map[i];
|
||||
for (PadMapping mapping : m_pad_map)
|
||||
{
|
||||
spac << mapping;
|
||||
}
|
||||
SendToClients(spac);
|
||||
}
|
||||
|
||||
|
@ -317,8 +327,10 @@ void NetPlayServer::UpdateWiimoteMapping()
|
|||
{
|
||||
sf::Packet spac;
|
||||
spac << (MessageId)NP_MSG_WIIMOTE_MAPPING;
|
||||
for (int i = 0; i < 4; i++)
|
||||
spac << m_wiimote_map[i];
|
||||
for (PadMapping mapping : m_wiimote_map)
|
||||
{
|
||||
spac << mapping;
|
||||
}
|
||||
SendToClients(spac);
|
||||
}
|
||||
|
||||
|
@ -552,12 +564,14 @@ bool NetPlayServer::StartGame(const std::string &path)
|
|||
// called from multiple threads
|
||||
void NetPlayServer::SendToClients(sf::Packet& packet, const PlayerId skip_pid)
|
||||
{
|
||||
std::map<sf::SocketTCP, Client>::iterator
|
||||
i = m_players.begin(),
|
||||
e = m_players.end();
|
||||
for ( ; i!=e; ++i)
|
||||
if (i->second.pid && (i->second.pid != skip_pid))
|
||||
i->second.socket.Send(packet);
|
||||
for (std::pair<const sf::SocketTCP, Client>& p : m_players)
|
||||
{
|
||||
if (p.second.pid &&
|
||||
p.second.pid != skip_pid)
|
||||
{
|
||||
p.second.socket.Send(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_UPNP
|
||||
|
|
|
@ -34,8 +34,10 @@ void SectorReader::SetSectorSize(int blocksize)
|
|||
}
|
||||
|
||||
SectorReader::~SectorReader() {
|
||||
for (int i = 0; i < CACHE_SIZE; i++)
|
||||
delete [] cache[i];
|
||||
for (u8*& block : cache)
|
||||
{
|
||||
delete [] block;
|
||||
}
|
||||
}
|
||||
|
||||
const u8 *SectorReader::GetBlockData(u64 block_num)
|
||||
|
|
|
@ -325,11 +325,9 @@ CNANDContentManager CNANDContentManager::m_Instance;
|
|||
|
||||
CNANDContentManager::~CNANDContentManager()
|
||||
{
|
||||
CNANDContentMap::iterator itr = m_Map.begin();
|
||||
while (itr != m_Map.end())
|
||||
for (auto& entry : m_Map)
|
||||
{
|
||||
delete itr->second;
|
||||
++itr;
|
||||
delete entry.second;
|
||||
}
|
||||
m_Map.clear();
|
||||
}
|
||||
|
|
|
@ -170,14 +170,14 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part
|
|||
SPartitionGroup PartitionGroup[4];
|
||||
|
||||
// read all partitions
|
||||
for (u32 x = 0; x < 4; x++)
|
||||
for (SPartitionGroup& group : PartitionGroup)
|
||||
{
|
||||
for (u32 i = 0; i < numPartitions; i++)
|
||||
{
|
||||
SPartition Partition;
|
||||
Partition.Offset = ((u64)Reader.Read32(PartitionsOffset + (i * 8) + 0)) << 2;
|
||||
Partition.Type = Reader.Read32(PartitionsOffset + (i * 8) + 4);
|
||||
PartitionGroup[x].PartitionsVec.push_back(Partition);
|
||||
group.PartitionsVec.push_back(Partition);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -338,11 +338,11 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
|
|||
m_Label_NumCodes->SetLabel(StrToWxStr(numcodes));
|
||||
m_ListBox_CodesList->Clear();
|
||||
|
||||
for (size_t j = 0; j < code.ops.size(); j++)
|
||||
for (const AREntry& entry : code.ops)
|
||||
{
|
||||
char text2[CHAR_MAX];
|
||||
char* ops = text2;
|
||||
sprintf(ops, "%08x %08x", code.ops[j].cmd_addr, code.ops[j].value);
|
||||
sprintf(ops, "%08x %08x", entry.cmd_addr, entry.value);
|
||||
m_ListBox_CodesList->Append(StrToWxStr(ops));
|
||||
}
|
||||
}
|
||||
|
@ -352,11 +352,11 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
|
|||
void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
int index = m_CheckListBox_CheatsList->GetSelection();
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
for (const ARCodeIndex& code_index : indexList)
|
||||
{
|
||||
if ((int)indexList[i].uiIndex == index)
|
||||
if ((int)code_index.uiIndex == index)
|
||||
{
|
||||
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), indexList[i].index);
|
||||
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), code_index.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,9 +364,9 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (ev
|
|||
void wxCheatsWindow::OnEvent_ApplyChanges_Press(wxCommandEvent& ev)
|
||||
{
|
||||
// Apply AR Code changes
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
for (const ARCodeIndex& code_index : indexList)
|
||||
{
|
||||
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(indexList[i].uiIndex), indexList[i].index);
|
||||
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(code_index.uiIndex), code_index.index);
|
||||
}
|
||||
|
||||
// Apply Gecko Code changes
|
||||
|
@ -385,10 +385,9 @@ void wxCheatsWindow::OnEvent_ApplyChanges_Press(wxCommandEvent& ev)
|
|||
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
m_TextCtrl_Log->Clear();
|
||||
const std::vector<std::string> &arLog = ActionReplay::GetSelfLog();
|
||||
for (u32 i = 0; i < arLog.size(); i++)
|
||||
for (const std::string& text : ActionReplay::GetSelfLog())
|
||||
{
|
||||
m_TextCtrl_Log->AppendText(StrToWxStr(arLog[i]));
|
||||
m_TextCtrl_Log->AppendText(StrToWxStr(text));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,10 +439,6 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector<CheatSearchResult>::iterator
|
||||
i = search_results.begin(),
|
||||
e = search_results.end();
|
||||
|
||||
// Set up the sub-search results efficiently to prevent automatic re-allocations.
|
||||
std::vector<CheatSearchResult> filtered_results;
|
||||
filtered_results.reserve(search_results.size());
|
||||
|
@ -459,10 +454,10 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
|
|||
|
||||
if (value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison
|
||||
{
|
||||
for (; i!=e; ++i)
|
||||
for (CheatSearchResult& result : search_results)
|
||||
{
|
||||
// with big endian, can just use memcmp for ><= comparison
|
||||
int cmp_result = memcmp(memptr + i->address, &i->old_value, search_type_size);
|
||||
int cmp_result = memcmp(memptr + result.address, &result.old_value, search_type_size);
|
||||
if (cmp_result < 0)
|
||||
cmp_result = 4;
|
||||
else
|
||||
|
@ -470,8 +465,8 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
|
|||
|
||||
if (cmp_result & filter_mask)
|
||||
{
|
||||
memcpy(&i->old_value, memptr + i->address, search_type_size);
|
||||
filtered_results.push_back(*i);
|
||||
memcpy(&result.old_value, memptr + result.address, search_type_size);
|
||||
filtered_results.push_back(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -510,10 +505,10 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
|
|||
// #endif
|
||||
}
|
||||
|
||||
for (; i!=e; ++i)
|
||||
for (CheatSearchResult& result : search_results)
|
||||
{
|
||||
// with big endian, can just use memcmp for ><= comparison
|
||||
int cmp_result = memcmp(memptr + i->address, &user_x_val, search_type_size);
|
||||
int cmp_result = memcmp(memptr + result.address, &user_x_val, search_type_size);
|
||||
if (cmp_result < 0)
|
||||
cmp_result = 4;
|
||||
else if (cmp_result)
|
||||
|
@ -523,8 +518,8 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
|
|||
|
||||
if (cmp_result & filter_mask)
|
||||
{
|
||||
memcpy(&i->old_value, memptr + i->address, search_type_size);
|
||||
filtered_results.push_back(*i);
|
||||
memcpy(&result.old_value, memptr + result.address, search_type_size);
|
||||
filtered_results.push_back(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,16 +42,13 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
|
||||
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
|
||||
|
||||
std::vector< ControlGroupBox* >::iterator
|
||||
g = current_page->control_groups.begin(),
|
||||
ge = current_page->control_groups.end();
|
||||
for ( ; g != ge; ++g )
|
||||
for (ControlGroupBox* g : current_page->control_groups)
|
||||
{
|
||||
// if this control group has a bitmap
|
||||
if ( (*g)->static_bitmap )
|
||||
if (g->static_bitmap)
|
||||
{
|
||||
wxMemoryDC dc;
|
||||
wxBitmap bitmap((*g)->static_bitmap->GetBitmap());
|
||||
wxBitmap bitmap(g->static_bitmap->GetBitmap());
|
||||
dc.SelectObject(bitmap);
|
||||
dc.Clear();
|
||||
|
||||
|
@ -60,9 +57,9 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
|
||||
// label for sticks and stuff
|
||||
if (64 == bitmap.GetHeight())
|
||||
dc.DrawText(StrToWxStr((*g)->control_group->name).Upper(), 4, 2);
|
||||
dc.DrawText(StrToWxStr(g->control_group->name).Upper(), 4, 2);
|
||||
|
||||
switch ( (*g)->control_group->type )
|
||||
switch (g->control_group->type)
|
||||
{
|
||||
case GROUP_TYPE_TILT :
|
||||
case GROUP_TYPE_STICK :
|
||||
|
@ -73,32 +70,32 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
float x = 0, y = 0, z = 0;
|
||||
float xx, yy;
|
||||
|
||||
switch ((*g)->control_group->type)
|
||||
switch (g->control_group->type)
|
||||
{
|
||||
case GROUP_TYPE_STICK :
|
||||
((ControllerEmu::AnalogStick*)(*g)->control_group)->GetState( &x, &y, 32.0, 32-1.5 );
|
||||
((ControllerEmu::AnalogStick*)g->control_group)->GetState(&x, &y, 32.0, 32-1.5);
|
||||
break;
|
||||
case GROUP_TYPE_TILT :
|
||||
((ControllerEmu::Tilt*)(*g)->control_group)->GetState( &x, &y, 32.0, 32-1.5 );
|
||||
((ControllerEmu::Tilt*)g->control_group)->GetState(&x, &y, 32.0, 32-1.5);
|
||||
break;
|
||||
case GROUP_TYPE_CURSOR :
|
||||
((ControllerEmu::Cursor*)(*g)->control_group)->GetState( &x, &y, &z );
|
||||
((ControllerEmu::Cursor*)g->control_group)->GetState(&x, &y, &z);
|
||||
x *= (32-1.5); x+= 32;
|
||||
y *= (32-1.5); y+= 32;
|
||||
break;
|
||||
}
|
||||
|
||||
xx = (*g)->control_group->controls[3]->control_ref->State();
|
||||
xx -= (*g)->control_group->controls[2]->control_ref->State();
|
||||
yy = (*g)->control_group->controls[1]->control_ref->State();
|
||||
yy -= (*g)->control_group->controls[0]->control_ref->State();
|
||||
xx = g->control_group->controls[3]->control_ref->State();
|
||||
xx -= g->control_group->controls[2]->control_ref->State();
|
||||
yy = g->control_group->controls[1]->control_ref->State();
|
||||
yy -= g->control_group->controls[0]->control_ref->State();
|
||||
xx *= 32 - 1; xx += 32;
|
||||
yy *= 32 - 1; yy += 32;
|
||||
|
||||
// draw the shit
|
||||
|
||||
// ir cursor forward movement
|
||||
if (GROUP_TYPE_CURSOR == (*g)->control_group->type)
|
||||
if (GROUP_TYPE_CURSOR == g->control_group->type)
|
||||
{
|
||||
if (z)
|
||||
{
|
||||
|
@ -110,13 +107,13 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetBrush(*wxGREY_BRUSH);
|
||||
}
|
||||
dc.DrawRectangle( 0, 31 - z*31, 64, 2);
|
||||
dc.DrawRectangle(0, 31 - z*31, 64, 2);
|
||||
}
|
||||
|
||||
// octagon for visual aid for diagonal adjustment
|
||||
dc.SetPen(*wxLIGHT_GREY_PEN);
|
||||
dc.SetBrush(*wxWHITE_BRUSH);
|
||||
if ( GROUP_TYPE_STICK == (*g)->control_group->type )
|
||||
if (GROUP_TYPE_STICK == g->control_group->type)
|
||||
{
|
||||
// outline and fill colors
|
||||
wxBrush LightGrayBrush(_T("#dddddd"));
|
||||
|
@ -131,12 +128,12 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
, d_of = box / 256.0
|
||||
, x_of = box / 2.0;
|
||||
|
||||
if (strcmp((*g)->control_group->name, "Main Stick") == 0)
|
||||
if (strcmp(g->control_group->name, "Main Stick") == 0)
|
||||
{
|
||||
max = (87.0f / 127.0f) * 100;
|
||||
diagonal = (55.0f / 127.0f) * 100.0;
|
||||
}
|
||||
else if (strcmp((*g)->control_group->name,"C-Stick") == 0)
|
||||
else if (strcmp(g->control_group->name,"C-Stick") == 0)
|
||||
{
|
||||
max = (74.0f / 127.0f) * 100;
|
||||
diagonal = (46.0f / 127.0f) * 100;
|
||||
|
@ -163,33 +160,33 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
}
|
||||
else
|
||||
{
|
||||
dc.DrawRectangle( 16, 16, 32, 32 );
|
||||
dc.DrawRectangle(16, 16, 32, 32);
|
||||
}
|
||||
|
||||
if ( GROUP_TYPE_CURSOR != (*g)->control_group->type )
|
||||
if (GROUP_TYPE_CURSOR != g->control_group->type)
|
||||
{
|
||||
// deadzone circle
|
||||
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
|
||||
dc.DrawCircle( 32, 32, ((*g)->control_group)->settings[SETTING_DEADZONE]->value * 32 );
|
||||
dc.DrawCircle(32, 32, g->control_group->settings[SETTING_DEADZONE]->value * 32);
|
||||
}
|
||||
|
||||
// raw dot
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetBrush(*wxGREY_BRUSH);
|
||||
// i like the dot better than the cross i think
|
||||
dc.DrawRectangle( xx - 2, yy - 2, 4, 4 );
|
||||
//dc.DrawRectangle( xx-1, 64-yy-4, 2, 8 );
|
||||
//dc.DrawRectangle( xx-4, 64-yy-1, 8, 2 );
|
||||
dc.DrawRectangle(xx - 2, yy - 2, 4, 4);
|
||||
//dc.DrawRectangle(xx-1, 64-yy-4, 2, 8);
|
||||
//dc.DrawRectangle(xx-4, 64-yy-1, 8, 2);
|
||||
|
||||
// adjusted dot
|
||||
if (x!=32 || y!=32)
|
||||
{
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.SetBrush(*wxRED_BRUSH);
|
||||
dc.DrawRectangle( x-2, 64-y-2, 4, 4 );
|
||||
dc.DrawRectangle(x-2, 64-y-2, 4, 4);
|
||||
// i like the dot better than the cross i think
|
||||
//dc.DrawRectangle( x-1, 64-y-4, 2, 8 );
|
||||
//dc.DrawRectangle( x-4, 64-y-1, 8, 2 );
|
||||
//dc.DrawRectangle(x-1, 64-y-4, 2, 8);
|
||||
//dc.DrawRectangle(x-4, 64-y-1, 8, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -198,64 +195,64 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
{
|
||||
float raw_dot[3];
|
||||
float adj_dot[3];
|
||||
const float deadzone = 32 * ((*g)->control_group)->settings[0]->value;
|
||||
const float deadzone = 32 * g->control_group->settings[0]->value;
|
||||
|
||||
// adjusted
|
||||
((ControllerEmu::Force*)(*g)->control_group)->GetState( adj_dot, 32.0, 32-1.5 );
|
||||
((ControllerEmu::Force*)g->control_group)->GetState(adj_dot, 32.0, 32-1.5);
|
||||
|
||||
// raw
|
||||
for ( unsigned int i=0; i<3; ++i )
|
||||
for (unsigned int i=0; i<3; ++i)
|
||||
{
|
||||
raw_dot[i] = (*g)->control_group->controls[i*2 + 1]->control_ref->State()
|
||||
- (*g)->control_group->controls[i*2]->control_ref->State();
|
||||
raw_dot[i] = g->control_group->controls[i*2 + 1]->control_ref->State()
|
||||
- g->control_group->controls[i*2]->control_ref->State();
|
||||
raw_dot[i] *= 32 - 1; raw_dot[i] += 32;
|
||||
}
|
||||
|
||||
// deadzone rect for forward/backward visual
|
||||
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
|
||||
dc.SetPen(*wxLIGHT_GREY_PEN);
|
||||
dc.DrawRectangle( 0, 32 - deadzone, 64, deadzone * 2 );
|
||||
dc.DrawRectangle(0, 32 - deadzone, 64, deadzone * 2);
|
||||
|
||||
// raw forward/background line
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetBrush(*wxGREY_BRUSH);
|
||||
dc.DrawRectangle( 0, raw_dot[2] - 1, 64, 2 );
|
||||
dc.DrawRectangle(0, raw_dot[2] - 1, 64, 2);
|
||||
|
||||
// adjusted forward/background line
|
||||
if ( adj_dot[2]!=32 )
|
||||
if (adj_dot[2]!=32)
|
||||
{
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.SetBrush(*wxRED_BRUSH);
|
||||
dc.DrawRectangle( 0, adj_dot[2] - 1, 64, 2 );
|
||||
dc.DrawRectangle(0, adj_dot[2] - 1, 64, 2);
|
||||
}
|
||||
|
||||
// a rectangle, for looks i guess
|
||||
dc.SetBrush(*wxWHITE_BRUSH);
|
||||
dc.SetPen(*wxLIGHT_GREY_PEN);
|
||||
dc.DrawRectangle( 16, 16, 32, 32 );
|
||||
dc.DrawRectangle(16, 16, 32, 32);
|
||||
|
||||
// deadzone square
|
||||
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
|
||||
dc.DrawRectangle( 32 - deadzone, 32 - deadzone, deadzone * 2, deadzone * 2 );
|
||||
dc.DrawRectangle(32 - deadzone, 32 - deadzone, deadzone * 2, deadzone * 2);
|
||||
|
||||
// raw dot
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetBrush(*wxGREY_BRUSH);
|
||||
dc.DrawRectangle( raw_dot[1] - 2, raw_dot[0] - 2, 4, 4 );
|
||||
dc.DrawRectangle(raw_dot[1] - 2, raw_dot[0] - 2, 4, 4);
|
||||
|
||||
// adjusted dot
|
||||
if ( adj_dot[1]!=32 || adj_dot[0]!=32 )
|
||||
if (adj_dot[1]!=32 || adj_dot[0]!=32)
|
||||
{
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.SetBrush(*wxRED_BRUSH);
|
||||
dc.DrawRectangle( adj_dot[1]-2, adj_dot[0]-2, 4, 4 );
|
||||
dc.DrawRectangle(adj_dot[1]-2, adj_dot[0]-2, 4, 4);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case GROUP_TYPE_BUTTONS :
|
||||
{
|
||||
const unsigned int button_count = ((unsigned int)(*g)->control_group->controls.size());
|
||||
const unsigned int button_count = ((unsigned int)g->control_group->controls.size());
|
||||
|
||||
// draw the shit
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
|
@ -265,23 +262,23 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
bitmasks[n] = (1 << n);
|
||||
|
||||
unsigned int buttons = 0;
|
||||
((ControllerEmu::Buttons*)(*g)->control_group)->GetState( &buttons, bitmasks );
|
||||
((ControllerEmu::Buttons*)g->control_group)->GetState(&buttons, bitmasks);
|
||||
|
||||
for (unsigned int n = 0; n<button_count; ++n)
|
||||
{
|
||||
if ( buttons & bitmasks[n] )
|
||||
if (buttons & bitmasks[n])
|
||||
{
|
||||
dc.SetBrush( *wxRED_BRUSH );
|
||||
dc.SetBrush(*wxRED_BRUSH);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char amt = 255 - (*g)->control_group->controls[n]->control_ref->State() * 128;
|
||||
unsigned char amt = 255 - g->control_group->controls[n]->control_ref->State() * 128;
|
||||
dc.SetBrush(wxBrush(wxColor(amt, amt, amt)));
|
||||
}
|
||||
dc.DrawRectangle(n * 12, 0, 14, 12);
|
||||
|
||||
// text
|
||||
const char* const name = (*g)->control_group->controls[n]->name;
|
||||
const char* const name = g->control_group->controls[n]->name;
|
||||
// bit of hax so ZL, ZR show up as L, R
|
||||
dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n*12 + 2, 1);
|
||||
}
|
||||
|
@ -292,18 +289,18 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
break;
|
||||
case GROUP_TYPE_TRIGGERS :
|
||||
{
|
||||
const unsigned int trigger_count = ((unsigned int)((*g)->control_group->controls.size()));
|
||||
const unsigned int trigger_count = ((unsigned int)(g->control_group->controls.size()));
|
||||
|
||||
// draw the shit
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
ControlState deadzone = (*g)->control_group->settings[0]->value;
|
||||
ControlState deadzone = g->control_group->settings[0]->value;
|
||||
|
||||
unsigned int* const trigs = new unsigned int[trigger_count];
|
||||
((ControllerEmu::Triggers*)(*g)->control_group)->GetState( trigs, 64 );
|
||||
((ControllerEmu::Triggers*)g->control_group)->GetState(trigs, 64);
|
||||
|
||||
for ( unsigned int n = 0; n < trigger_count; ++n )
|
||||
for (unsigned int n = 0; n < trigger_count; ++n)
|
||||
{
|
||||
ControlState trig_r = (*g)->control_group->controls[n]->control_ref->State();
|
||||
ControlState trig_r = g->control_group->controls[n]->control_ref->State();
|
||||
|
||||
// outline
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
|
@ -319,7 +316,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
dc.DrawRectangle(0, n*12, trigs[n], 14);
|
||||
|
||||
// text
|
||||
dc.DrawText(StrToWxStr((*g)->control_group->controls[n]->name), 3, n*12 + 1);
|
||||
dc.DrawText(StrToWxStr(g->control_group->controls[n]->name), 3, n*12 + 1);
|
||||
}
|
||||
|
||||
delete[] trigs;
|
||||
|
@ -333,29 +330,29 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
break;
|
||||
case GROUP_TYPE_MIXED_TRIGGERS :
|
||||
{
|
||||
const unsigned int trigger_count = ((unsigned int)((*g)->control_group->controls.size() / 2));
|
||||
const unsigned int trigger_count = ((unsigned int)(g->control_group->controls.size() / 2));
|
||||
|
||||
// draw the shit
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
ControlState thresh = (*g)->control_group->settings[0]->value;
|
||||
ControlState thresh = g->control_group->settings[0]->value;
|
||||
|
||||
for ( unsigned int n = 0; n < trigger_count; ++n )
|
||||
for (unsigned int n = 0; n < trigger_count; ++n)
|
||||
{
|
||||
dc.SetBrush(*wxRED_BRUSH);
|
||||
ControlState trig_d = (*g)->control_group->controls[n]->control_ref->State();
|
||||
ControlState trig_d = g->control_group->controls[n]->control_ref->State();
|
||||
|
||||
ControlState trig_a = trig_d > thresh ? 1
|
||||
: (*g)->control_group->controls[n+trigger_count]->control_ref->State();
|
||||
: g->control_group->controls[n+trigger_count]->control_ref->State();
|
||||
|
||||
dc.DrawRectangle(0, n*12, 64+20, 14);
|
||||
if ( trig_d <= thresh )
|
||||
if (trig_d <= thresh)
|
||||
dc.SetBrush(*wxWHITE_BRUSH);
|
||||
dc.DrawRectangle(trig_a*64, n*12, 64+20, 14);
|
||||
dc.DrawRectangle(64, n*12, 32, 14);
|
||||
|
||||
// text
|
||||
dc.DrawText(StrToWxStr((*g)->control_group->controls[n+trigger_count]->name), 3, n*12 + 1);
|
||||
dc.DrawText(StrToWxStr(std::string(1, (*g)->control_group->controls[n]->name[0])), 64 + 3, n*12 + 1);
|
||||
dc.DrawText(StrToWxStr(g->control_group->controls[n+trigger_count]->name), 3, n*12 + 1);
|
||||
dc.DrawText(StrToWxStr(std::string(1, g->control_group->controls[n]->name[0])), 64 + 3, n*12 + 1);
|
||||
}
|
||||
|
||||
// threshold box
|
||||
|
@ -367,14 +364,14 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
break;
|
||||
case GROUP_TYPE_SLIDER:
|
||||
{
|
||||
const ControlState deadzone = (*g)->control_group->settings[0]->value;
|
||||
const ControlState deadzone = g->control_group->settings[0]->value;
|
||||
|
||||
ControlState state = (*g)->control_group->controls[1]->control_ref->State() - (*g)->control_group->controls[0]->control_ref->State();
|
||||
ControlState state = g->control_group->controls[1]->control_ref->State() - g->control_group->controls[0]->control_ref->State();
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
dc.SetBrush(*wxGREY_BRUSH);
|
||||
dc.DrawRectangle(31 + state * 30, 0, 2, 14);
|
||||
|
||||
((ControllerEmu::Slider*)(*g)->control_group)->GetState(&state, 1);
|
||||
((ControllerEmu::Slider*)g->control_group)->GetState(&state, 1);
|
||||
if (state)
|
||||
{
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
|
@ -399,7 +396,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
|||
dc.DrawRectangle(0, 0, bitmap.GetWidth(), bitmap.GetHeight());
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
(*g)->static_bitmap->SetBitmap(bitmap);
|
||||
g->static_bitmap->SetBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -404,21 +404,26 @@ void ProgramShaderCache::Shutdown(void)
|
|||
// store all shaders in cache on disk
|
||||
if (g_ogl_config.bSupportsGLSLCache && !g_Config.bEnableShaderDebugging)
|
||||
{
|
||||
PCache::iterator iter = pshaders.begin();
|
||||
for (; iter != pshaders.end(); ++iter)
|
||||
for (auto& entry : pshaders)
|
||||
{
|
||||
if(iter->second.in_cache) continue;
|
||||
if(entry.second.in_cache)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
GLint binary_size;
|
||||
glGetProgramiv(iter->second.shader.glprogid, GL_PROGRAM_BINARY_LENGTH, &binary_size);
|
||||
if(!binary_size) continue;
|
||||
glGetProgramiv(entry.second.shader.glprogid, GL_PROGRAM_BINARY_LENGTH, &binary_size);
|
||||
if(!binary_size)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
u8 *data = new u8[binary_size+sizeof(GLenum)];
|
||||
u8 *binary = data + sizeof(GLenum);
|
||||
GLenum *prog_format = (GLenum*)data;
|
||||
glGetProgramBinary(iter->second.shader.glprogid, binary_size, NULL, prog_format, binary);
|
||||
glGetProgramBinary(entry.second.shader.glprogid, binary_size, NULL, prog_format, binary);
|
||||
|
||||
g_program_disk_cache.Append(iter->first, data, binary_size+sizeof(GLenum));
|
||||
g_program_disk_cache.Append(entry.first, data, binary_size+sizeof(GLenum));
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
|
@ -428,9 +433,10 @@ void ProgramShaderCache::Shutdown(void)
|
|||
|
||||
glUseProgram(0);
|
||||
|
||||
PCache::iterator iter = pshaders.begin();
|
||||
for (; iter != pshaders.end(); ++iter)
|
||||
iter->second.Destroy();
|
||||
for (auto& entry : pshaders)
|
||||
{
|
||||
entry.second.Destroy();
|
||||
}
|
||||
pshaders.clear();
|
||||
|
||||
pixel_uid_checker.Invalidate();
|
||||
|
|
|
@ -54,12 +54,12 @@ void DoState(PointerWrap &p)
|
|||
{
|
||||
ZSlope.DoState(p);
|
||||
WSlope.DoState(p);
|
||||
for (auto& ColorSlope : ColorSlopes)
|
||||
for (int n=0; n<4; ++n)
|
||||
ColorSlope[n].DoState(p);
|
||||
for (auto& TexSlope : TexSlopes)
|
||||
for (int n=0; n<3; ++n)
|
||||
TexSlope[n].DoState(p);
|
||||
for (auto& color_slopes_1d : ColorSlopes)
|
||||
for (Slope& color_slope : color_slopes_1d)
|
||||
color_slope.DoState(p);
|
||||
for (auto& tex_slopes_1d : TexSlopes)
|
||||
for (Slope& tex_slope : tex_slopes_1d)
|
||||
tex_slope.DoState(p);
|
||||
p.Do(vertex0X);
|
||||
p.Do(vertex0Y);
|
||||
p.Do(vertexOffsetX);
|
||||
|
|
|
@ -33,8 +33,10 @@ void Tev::Init()
|
|||
FixedConstants[7] = 223;
|
||||
FixedConstants[8] = 255;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
Zero16[i] = 0;
|
||||
for (s16& comp : Zero16)
|
||||
{
|
||||
comp = 0;
|
||||
}
|
||||
|
||||
m_ColorInputLUT[0][RED_INP] = &Reg[0][RED_C]; m_ColorInputLUT[0][GRN_INP] = &Reg[0][GRN_C]; m_ColorInputLUT[0][BLU_INP] = &Reg[0][BLU_C]; // prev.rgb
|
||||
m_ColorInputLUT[1][RED_INP] = &Reg[0][ALP_C]; m_ColorInputLUT[1][GRN_INP] = &Reg[0][ALP_C]; m_ColorInputLUT[1][BLU_INP] = &Reg[0][ALP_C]; // prev.aaa
|
||||
|
@ -148,21 +150,27 @@ void Tev::SetRasColor(int colorChan, int swaptable)
|
|||
break;
|
||||
case 5: // alpha bump
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
RasColor[i] = AlphaBump;
|
||||
for (s16& comp : RasColor)
|
||||
{
|
||||
comp = AlphaBump;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6: // alpha bump normalized
|
||||
{
|
||||
u8 normalized = AlphaBump | AlphaBump >> 5;
|
||||
for(int i = 0; i < 4; i++)
|
||||
RasColor[i] = normalized;
|
||||
for (s16& comp : RasColor)
|
||||
{
|
||||
comp = normalized;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: // zero
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
RasColor[i] = 0;
|
||||
for (s16& comp : RasColor)
|
||||
{
|
||||
comp = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -22,12 +22,10 @@ FramebufferManagerBase::FramebufferManagerBase()
|
|||
|
||||
FramebufferManagerBase::~FramebufferManagerBase()
|
||||
{
|
||||
VirtualXFBListType::iterator
|
||||
it = m_virtualXFBList.begin(),
|
||||
vlend = m_virtualXFBList.end();
|
||||
for (; it != vlend; ++it)
|
||||
delete it->xfbSource;
|
||||
|
||||
for (VirtualXFB& vxfb : m_virtualXFBList)
|
||||
{
|
||||
delete vxfb.xfbSource;
|
||||
}
|
||||
m_virtualXFBList.clear();
|
||||
|
||||
delete m_realXFBSource;
|
||||
|
|
|
@ -61,12 +61,10 @@ void TextureCache::RequestInvalidateTextureCache()
|
|||
|
||||
void TextureCache::Invalidate()
|
||||
{
|
||||
TexCache::iterator
|
||||
iter = textures.begin(),
|
||||
tcend = textures.end();
|
||||
for (; iter != tcend; ++iter)
|
||||
delete iter->second;
|
||||
|
||||
for (auto& tex : textures)
|
||||
{
|
||||
delete tex.second;
|
||||
}
|
||||
textures.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue