Clean up warnings

This commit is contained in:
zilmar 2023-02-28 10:09:08 +10:30
parent cb124b7009
commit ea70218d1c
55 changed files with 231 additions and 230 deletions

View File

@ -910,7 +910,7 @@ uint32_t CCodeBlock::Finilize(uint8_t * CompiledLocation)
#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
__clear_cache((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocation + codeSize);
#endif
return codeSize;
return (uint32_t)codeSize;
}
uint32_t CCodeBlock::NextTest()

View File

@ -786,6 +786,7 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
}
} while (m_RecompilerOps->GetNextStepType() != PIPELINE_STAGE_END_BLOCK);
#else
Test = Test;
g_Notify->BreakPoint(__FILE__, __LINE__);
#endif
return true;

View File

@ -35,7 +35,7 @@ bool CX64RegInfo::operator!=(const CX64RegInfo & /*right*/) const
return false;
}
void CX64RegInfo::UnMap_GPR(uint32_t Reg, bool WriteBackValue)
void CX64RegInfo::UnMap_GPR(uint32_t /*Reg*/, bool /*WriteBackValue*/)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}

View File

@ -563,7 +563,8 @@ const asmjit::x86::St & CX86RegInfo::StackPosition(int32_t Reg)
return StRegs[((i - StackTopPos()) & 7)];
}
}
return asmjit::x86::St();
static asmjit::x86::St Unknown;
return Unknown;
}
asmjit::x86::Gp CX86RegInfo::FreeX86Reg()

View File

@ -118,7 +118,7 @@ void CSettingTypeRomDatabase::BaseDirChanged(void * /*Data */)
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
}
void CSettingTypeRomDatabase::GameChanged(void * Data)
void CSettingTypeRomDatabase::GameChanged(void * /*Data*/)
{
if (m_SectionIdent)
{

View File

@ -19,7 +19,7 @@ CPluginList::~CPluginList()
int CPluginList::GetPluginCount() const
{
return m_PluginList.size();
return (int)((INT_PTR)m_PluginList.size());
}
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const

View File

@ -228,7 +228,7 @@ LRESULT CCheatList::OnChangeCodeExtension(UINT /*uMsg*/, WPARAM /*wParam*/, LPAR
std::wstring wName = Name.ToUTF16();
item.mask = TVIF_TEXT;
item.pszText = (LPWSTR)wName.c_str();
item.cchTextMax = wName.length();
item.cchTextMax = (int)((INT_PTR)wName.length());
m_hCheatTree.SetItem(&item);
return 0;
}

View File

@ -29,14 +29,14 @@ DMALOGENTRY * CDMALog::GetEntryByIndex(uint32_t index)
DMALOGENTRY * CDMALog::GetEntryByRamAddress(uint32_t ramAddr)
{
uint32_t nEntries = GetNumEntries();
size_t nEntries = GetNumEntries();
if (nEntries == 0)
{
return nullptr;
}
for (uint32_t i = nEntries - 1; i-- > 0;)
for (size_t i = nEntries - 1; i-- > 0;)
{
uint32_t min = m_Log[i].ramAddr;
uint32_t max = min + m_Log[i].length - 1;
@ -66,14 +66,14 @@ DMALOGENTRY * CDMALog::GetEntryByRamAddress(uint32_t ramAddr, uint32_t * lpRomAd
DMALOGENTRY * CDMALog::GetEntryByRomAddress(uint32_t romAddr)
{
uint32_t nEntries = GetNumEntries();
size_t nEntries = GetNumEntries();
if (nEntries == 0)
{
return nullptr;
}
for (uint32_t i = nEntries - 1; i-- > 0;)
for (size_t i = nEntries - 1; i-- > 0;)
{
uint32_t min = m_Log[i].romAddr;
uint32_t max = min + m_Log[i].length - 1;

View File

@ -278,7 +278,7 @@ size_t CDebugMMU::ReadPhysical(uint32_t paddr, size_t length, uint8_t * buffer)
size_t nByte;
for (nByte = 0; nByte < length; nByte++)
{
if (!GetPhysicalByte(paddr + nByte, &buffer[nByte]))
if (!GetPhysicalByte((uint32_t)((INT_PTR)(paddr + nByte)), &buffer[nByte]))
{
return nByte;
}
@ -292,7 +292,7 @@ size_t CDebugMMU::ReadVirtual(uint32_t vaddr, size_t length, uint8_t * buffer)
for (nByte = 0; nByte < length; nByte++)
{
uint32_t paddr;
if (!g_MMU || !g_MMU->VAddrToPAddr(vaddr + nByte, paddr))
if (!g_MMU || !g_MMU->VAddrToPAddr((uint32_t)((UINT_PTR)(vaddr + nByte)), paddr))
{
return nByte;
}
@ -309,7 +309,7 @@ size_t CDebugMMU::WritePhysical(uint32_t paddr, size_t length, uint8_t * buffer)
size_t nByte;
for (nByte = 0; nByte < length; nByte++)
{
if (!SetPhysicalByte(paddr + nByte, buffer[nByte]))
if (!SetPhysicalByte((uint32_t)((UINT_PTR)(paddr + nByte)), buffer[nByte]))
{
return nByte;
}
@ -323,7 +323,7 @@ size_t CDebugMMU::WriteVirtual(uint32_t vaddr, size_t length, uint8_t * buffer)
for (nByte = 0; nByte < length; nByte++)
{
uint32_t paddr;
if (!g_MMU || !g_MMU->VAddrToPAddr(vaddr + nByte, paddr))
if (!g_MMU || !g_MMU->VAddrToPAddr((uint32_t)((UINT_PTR)(vaddr + nByte)), paddr))
{
return nByte;
}

View File

@ -292,7 +292,7 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer)
size_t numVisibleRows = GetNumVisibleRows(m_CPUListView);
bool bCanDisplayAll = (numVisibleRows >= count);
int scrollRangeMax = bCanDisplayAll ? 0 : count - numVisibleRows;
int scrollRangeMax = bCanDisplayAll ? 0 : (int)((INT_PTR)(count - numVisibleRows));
m_Scrollbar.SetScrollRange(0, scrollRangeMax, false);
m_Scrollbar.EnableWindow(!bCanDisplayAll);

View File

@ -297,7 +297,7 @@ void CDebugCommandsView::AddBranchArrow(int startPos, int endPos)
void CDebugCommandsView::HistoryPushState()
{
m_History.push_back(m_StartAddress);
m_HistoryIndex = m_History.size() - 1;
m_HistoryIndex = (int)((INT_PTR)(m_History.size() - 1));
ToggleHistoryButtons();
}
@ -1009,7 +1009,7 @@ void CDebugCommandsView::RemoveSelectedBreakpoints()
wchar_t itemText[32];
m_BreakpointList.GetText(nItem, itemText);
uint32_t address = m_BreakpointList.GetItemData(nItem);
uint32_t address = (uint32_t)(m_BreakpointList.GetItemData(nItem));
switch (itemText[0])
{
@ -1430,7 +1430,7 @@ LRESULT CDebugCommandsView::OnListBoxClicked(WORD /*wNotifyCode*/, WORD wID, HWN
if (wID == IDC_BP_LIST)
{
int index = m_BreakpointList.GetCaretIndex();
uint32_t address = m_BreakpointList.GetItemData(index);
uint32_t address = (uint32_t)m_BreakpointList.GetItemData(index);
int len = m_BreakpointList.GetTextLen(index);
std::wstring rowText;
rowText.resize(len);
@ -1613,7 +1613,7 @@ void CDebugCommandsView::RestoreOp(uint32_t address)
void CDebugCommandsView::RestoreAllOps()
{
int lastIndex = m_EditedOps.size() - 1;
int lastIndex = (int)((INT_PTR)(m_EditedOps.size() - 1));
for (int i = lastIndex; i >= 0; i--)
{
m_Debugger->DebugStore_VAddr(m_EditedOps[i].address, m_EditedOps[i].originalOp);

View File

@ -60,7 +60,7 @@ void CDebugDMALogView::RefreshList()
}
int startIndex;
int dmaLogSize = m_Debugger->DMALog()->GetNumEntries();
int dmaLogSize = (int)((INT_PTR)(m_Debugger->DMALog()->GetNumEntries()));
HWND hWndExportBtn = GetDlgItem(IDC_EXPORT_BTN);
@ -171,7 +171,7 @@ void CDebugDMALogView::Export(void)
for (size_t nEntry = 0; nEntry < numEntries; nEntry++)
{
DMALOGENTRY * entry = m_DMALog->GetEntryByIndex(nEntry);
DMALOGENTRY * entry = m_DMALog->GetEntryByIndex((uint32_t)((INT_PTR)nEntry));
file << stdstr_f("0x%08X,0x%08X,0x%08X\r\n",
entry->romAddr, entry->ramAddr, entry->length);
@ -364,7 +364,7 @@ LRESULT CDebugDMALogView::OnCustomDrawList(NMHDR * pNMHDR)
default: return CDRF_DODEFAULT;
}
DWORD nItem = pLVCD->nmcd.dwItemSpec;
DWORD nItem = (DWORD)pLVCD->nmcd.dwItemSpec;
DWORD nSubItem = pLVCD->iSubItem;
if (nSubItem != 0)

View File

@ -428,7 +428,7 @@ LRESULT CDebugMemorySearch::OnResultsDblClick(LPNMHDR)
}
// Copy result to watch list
int index = m_ResultsListCtrl.GetItemData(iItem);
int index = (int)m_ResultsListCtrl.GetItemData(iItem);
AddResultToWatchList(index);
UpdateWatchList(true);
@ -477,7 +477,7 @@ LRESULT CDebugMemorySearch::OnResultsPopupAddToWatchList(WORD /*wNotifyCode*/, W
while ((iItem = m_ResultsListCtrl.GetNextItem(iItem, LVNI_SELECTED)) != -1)
{
int index = m_ResultsListCtrl.GetItemData(iItem);
int index = (int)m_ResultsListCtrl.GetItemData(iItem);
AddResultToWatchList(index);
}
@ -492,7 +492,7 @@ LRESULT CDebugMemorySearch::OnResultsPopupAddAllToWatchList(WORD /*wNotifyCode*/
for (size_t i = 0; i < numResults; i++)
{
AddResultToWatchList(i);
AddResultToWatchList((int)((INT_PTR)i));
}
UpdateWatchList(true);
@ -522,7 +522,7 @@ LRESULT CDebugMemorySearch::OnResultsPopupSetValue(WORD /*wNotifyCode*/, WORD /*
if (bSelected)
{
int index = m_ResultsListCtrl.GetItemData(iItem);
int index = (int)m_ResultsListCtrl.GetItemData(iItem);
CScanResult * presult = m_MemoryScanner.GetResult(index);
const std::string & enteredString = m_SetValueDlg.GetEnteredString();
presult->SetMemoryValueFromString(enteredString.c_str());
@ -629,7 +629,7 @@ LRESULT CDebugMemorySearch::OnWatchListDblClick(LPNMHDR /*lpnmh*/)
return true;
}
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
int nSelectedCol = -1;
@ -728,7 +728,7 @@ LRESULT CDebugMemorySearch::OnWatchListRClick(LPNMHDR /*lpnmh*/)
return true;
}
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
// Load the menu
@ -780,7 +780,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupLock(WORD /*wNotifyCode*/, WORD /*wI
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
m_Debugger->Breakpoints()->ToggleMemLock(presult->m_Address);
}
@ -855,7 +855,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupHexadecimal(WORD /*wNotifyCode*/, WO
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
if (presult->m_DisplayFormat == DisplayDefault)
@ -893,7 +893,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeValue(WORD /*wNotifyCode*/, WO
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
// TODO: prompt for size change if string is too long
presult->SetMemoryValueFromString(m_SetValueDlg.GetEnteredString().c_str());
@ -923,7 +923,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeDescription(WORD /*wNotifyCode
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
stdstr description = m_SetValueDlg.GetEnteredString();
presult->SetDescription(description.c_str());
@ -970,7 +970,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeType(WORD /*wNotifyCode*/, WOR
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
if (presult->IsStringType())
@ -1012,7 +1012,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddress(WORD /*wNotifyCode*/,
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
presult->SetAddressSafe(newAddr);
m_WatchListCtrl.SetItemText(iItem, WatchListCtrl_Col_Address, newAddrStr.ToUTF16().c_str());
@ -1043,7 +1043,7 @@ LRESULT CDebugMemorySearch::OnWatchListPopupChangeAddressBy(WORD /*wNotifyCode*/
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
uint32_t newAddr = presult->m_Address + offset;
if (presult->SetAddressSafe(newAddr))
@ -1375,7 +1375,7 @@ void CDebugMemorySearch::RemoveSelectedWatchListItems(void)
if (bSelected)
{
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
RemoveWatchListItem(index);
}
}
@ -1398,7 +1398,7 @@ CScanResult * CDebugMemorySearch::GetFirstSelectedScanResult(void)
return nullptr;
}
int index = m_ResultsListCtrl.GetItemData(iItem);
int index = (int)m_ResultsListCtrl.GetItemData(iItem);
CScanResult * presult = m_MemoryScanner.GetResult(index);
return presult;
}
@ -1412,7 +1412,7 @@ CScanResult * CDebugMemorySearch::GetFirstSelectedWatchListResult(void)
return nullptr;
}
int index = m_WatchListCtrl.GetItemData(iItem);
int index = (int)m_WatchListCtrl.GetItemData(iItem);
CScanResult * presult = &m_WatchList[index];
return presult;
}
@ -1777,7 +1777,7 @@ void CDebugMemorySearch::UpdateResultsList(bool bUpdateScrollbar, bool bResetScr
if (bUpdateScrollbar)
{
bool bCanDisplayAll = (numVisibleRows >= numResults);
int scrollRangeMax = bCanDisplayAll ? 0 : numResults - numVisibleRows;
int scrollRangeMax = bCanDisplayAll ? 0 : (int)((INT_PTR)(numResults - numVisibleRows));
m_ResultsScrollbar.EnableWindow(!bCanDisplayAll);
m_ResultsScrollbar.SetScrollRange(0, scrollRangeMax, false);
@ -1824,7 +1824,7 @@ void CDebugMemorySearch::UpdateResultsList(bool bUpdateScrollbar, bool bResetScr
m_ResultsListCtrl.SetRedraw(TRUE);
char szNumResults[32];
sprintf(szNumResults, "Results (%d)", numResults);
sprintf(szNumResults, "Results (%d)", (int)((INT_PTR)numResults));
::SetWindowTextA(GetDlgItem(IDC_NUM_RESULTS), szNumResults);
}
@ -1836,7 +1836,7 @@ void CDebugMemorySearch::UpdateWatchList(bool bUpdateScrollbar)
if (bUpdateScrollbar)
{
bool bCanDisplayAll = (numVisibleRows >= numEntries);
int scrollRangeMax = bCanDisplayAll ? 0 : numEntries - numVisibleRows;
int scrollRangeMax = bCanDisplayAll ? 0 : (int)((INT_PTR)(numEntries - numVisibleRows));
m_WatchListScrollbar.SetScrollRange(0, scrollRangeMax, false);
m_WatchListScrollbar.SetScrollPos(0, true);
@ -2018,7 +2018,7 @@ void CDebugMemorySearch::FlushWatchList(void)
stdstr line = stdstr_f("%c,%08X,%s,%s,%s\n",
cAddrType, presult->m_Address, pSzValueType, szDisplayFormat, presult->GetDescription());
m_WatchListFile.Write(line.c_str(), line.length());
m_WatchListFile.Write(line.c_str(), (uint32_t)((INT_PTR)(line.length())));
}
m_WatchListFile.Close();

View File

@ -22,12 +22,12 @@ struct TabRecord
int GetLabelIndex(WORD ctrl) const
{
for (int i = 0, end = FieldCount; i < end; i++)
for (size_t i = 0, end = FieldCount; i < end; i++)
{
const FieldPair * pair = (Fields + i);
if (pair->LabelId == ctrl)
{
return i;
return (int)((INT_PTR)i);
}
}
return -1;
@ -35,12 +35,12 @@ struct TabRecord
int GetEditIndex(WORD ctrl) const
{
for (int i = 0, end = FieldCount; i < end; i++)
for (size_t i = 0, end = FieldCount; i < end; i++)
{
const FieldPair * pair = (Fields + i);
if (pair->EditId == ctrl)
{
return i;
return (int)((INT_PTR)i);
}
}
return -1;

View File

@ -102,23 +102,23 @@ void CRegisterTabs::RefreshEdits()
{
if (g_Reg == nullptr)
{
ZeroRegisterEdits64(m_GPREdits, TabData::GPR.FieldCount);
ZeroRegisterEdits64(m_GPREdits, (int)((INT_PTR)(TabData::GPR.FieldCount)));
ZeroRegisterEdit64(m_HIEdit);
ZeroRegisterEdit64(m_LOEdit);
ZeroRegisterEdits(m_FPREdits, TabData::FPR.FieldCount);
ZeroRegisterEdits(m_FPREdits, (int)((INT_PTR)(TabData::FPR.FieldCount)));
ZeroRegisterEdit(m_FCSREdit);
ZeroRegisterEdits(m_COP0Edits, TabData::COP0.FieldCount);
ZeroRegisterEdits(m_RDRAMEdits, TabData::RDRAM.FieldCount);
ZeroRegisterEdits(m_SPEdits, TabData::SP.FieldCount);
ZeroRegisterEdits(m_COP0Edits, (int)((INT_PTR)(TabData::COP0.FieldCount)));
ZeroRegisterEdits(m_RDRAMEdits, (int)((INT_PTR)(TabData::RDRAM.FieldCount)));
ZeroRegisterEdits(m_SPEdits, (int)((INT_PTR)(TabData::SP.FieldCount)));
ZeroRegisterEdit(m_SPPCEdit);
ZeroRegisterEdits(m_DPCEdits, TabData::DPC.FieldCount);
ZeroRegisterEdits(m_MIEdits, TabData::MI.FieldCount);
ZeroRegisterEdits(m_VIEdits, TabData::VI.FieldCount);
ZeroRegisterEdits(m_AIEdits, TabData::AI.FieldCount);
ZeroRegisterEdits(m_PIEdits, TabData::PI.FieldCount);
ZeroRegisterEdits(m_RIEdits, TabData::RI.FieldCount);
ZeroRegisterEdits(m_SIEdits, TabData::SI.FieldCount);
ZeroRegisterEdits(m_DDEdits, TabData::DD.FieldCount);
ZeroRegisterEdits(m_DPCEdits, (int)((INT_PTR)(TabData::DPC.FieldCount)));
ZeroRegisterEdits(m_MIEdits, (int)((INT_PTR)(TabData::MI.FieldCount)));
ZeroRegisterEdits(m_VIEdits, (int)((INT_PTR)(TabData::VI.FieldCount)));
ZeroRegisterEdits(m_AIEdits, (int)((INT_PTR)(TabData::AI.FieldCount)));
ZeroRegisterEdits(m_PIEdits, (int)((INT_PTR)(TabData::PI.FieldCount)));
ZeroRegisterEdits(m_RIEdits, (int)((INT_PTR)(TabData::RI.FieldCount)));
ZeroRegisterEdits(m_SIEdits, (int)((INT_PTR)(TabData::SI.FieldCount)));
ZeroRegisterEdits(m_DDEdits, (int)((INT_PTR)(TabData::DD.FieldCount)));
return;
}
@ -739,7 +739,7 @@ CWindow CRegisterTabs::AddTab(char * caption, int dialogId, DLGPROC dlgProc)
m_TabWindows.push_back(tabWin);
int index = m_TabWindows.size() - 1;
int index = (int)((INT_PTR)(m_TabWindows.size() - 1));
if (index == 0)
{
@ -782,7 +782,7 @@ void CRegisterTabs::InitRegisterEdit(CWindow & tab, CEditNumber32 & edit, FieldP
void CRegisterTabs::InitRegisterEdits(CWindow & tab, CEditNumber32 * edits, const TabRecord * ctrlIds)
{
for (int i = 0, n = ctrlIds->FieldCount; i < n; i++)
for (size_t i = 0, n = ctrlIds->FieldCount; i < n; i++)
{
InitRegisterEdit(tab, edits[i], ctrlIds->Fields[i]);
}
@ -795,7 +795,7 @@ void CRegisterTabs::InitRegisterEdit64(CWindow & tab, CEditReg64 & edit, FieldPa
void CRegisterTabs::InitRegisterEdits64(CWindow & tab, CEditReg64 * edits, const TabRecord * ctrlIds)
{
for (int i = 0, n = ctrlIds->FieldCount; i < n; i++)
for (size_t i = 0, n = ctrlIds->FieldCount; i < n; i++)
{
InitRegisterEdit64(tab, edits[i], ctrlIds->Fields[i]);
}
@ -987,12 +987,12 @@ LRESULT CEditReg64::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHand
if (isalpha(charCode) && !isupper(charCode))
{
SendMessage(uMsg, toupper(wParam), lParam);
SendMessage(uMsg, toupper((int)(UINT_PTR)(wParam)), lParam);
return 0;
}
std::string text = GetCWindowText(*this);
int textLen = text.size();
size_t textLen = text.size();
if (textLen >= 17)
{

View File

@ -199,7 +199,7 @@ void CDebugScripts::ConsoleCopy()
return;
}
m_ConOutputEdit.GetWindowText(memBuf, nChars);
m_ConOutputEdit.GetWindowText(memBuf, (int)((INT_PTR)(nChars)));
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
@ -358,7 +358,7 @@ LRESULT CDebugScripts::OnScriptListCustomDraw(NMHDR * pNMHDR)
return CDRF_DODEFAULT;
}
DWORD nItem = pLVCD->nmcd.dwItemSpec;
DWORD nItem = (DWORD)pLVCD->nmcd.dwItemSpec;
wchar_t scriptName[MAX_PATH];
m_ScriptList.GetItemText(nItem, 1, scriptName, MAX_PATH);
@ -533,7 +533,7 @@ LRESULT CDebugScripts::OnInputSpecialKey(NMHDR * pNMHDR)
{
wchar_t * code = m_InputHistory[--m_InputHistoryIndex];
m_ConInputEdit.SetWindowText(code);
int selEnd = wcslen(code);
int selEnd = (int)((INT_PTR)wcslen(code));
m_ConInputEdit.SetSel(selEnd, selEnd);
}
@ -553,7 +553,7 @@ LRESULT CDebugScripts::OnInputSpecialKey(NMHDR * pNMHDR)
{
wchar_t * code = m_InputHistory[m_InputHistoryIndex];
m_ConInputEdit.SetWindowText(code);
int selEnd = wcslen(code);
int selEnd = (int)((INT_PTR)(wcslen(code)));
m_ConInputEdit.SetSel(selEnd, selEnd);
}
else
@ -574,7 +574,7 @@ LRESULT CDebugScripts::OnInputSpecialKey(NMHDR * pNMHDR)
}
wchar_t * code = new wchar_t[codeLength + 1];
m_ConInputEdit.GetWindowText(code, codeLength + 1);
m_ConInputEdit.GetWindowText(code, (int)((INT_PTR)(codeLength + 1)));
m_ConInputEdit.SetWindowText(L"");
SendInput(m_SelectedScriptName.c_str(), stdstr().FromUTF16(code).c_str());

View File

@ -67,7 +67,7 @@ LRESULT CDebugStackTrace::OnListDblClicked(NMHDR * pNMHDR)
NMITEMACTIVATE * pIA = reinterpret_cast<NMITEMACTIVATE *>(pNMHDR);
int nItem = pIA->iItem;
uint32_t address = m_List.GetItemData(nItem);
uint32_t address = (uint32_t)((INT_PTR)(m_List.GetItemData(nItem)));
m_Debugger->Debug_ShowCommandsLocation(address, true);

View File

@ -293,7 +293,7 @@ LRESULT CDebugSymbols::OnListGetDispInfo(NMHDR * pNMHDR)
if (!m_bFiltering)
{
index -= m_SymbolCacheStartIndex;
index -= (int)((INT_PTR)m_SymbolCacheStartIndex);
}
switch (plvdi->item.iSubItem)
@ -359,7 +359,7 @@ LRESULT CDebugSymbols::OnFilterChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND
UpdateFilteredSymbols();
m_SymbolsListView.SetItemCount(m_FilteredSymbols.size());
m_SymbolsListView.SetItemCount((int)((INT_PTR)m_FilteredSymbols.size()));
return FALSE;
}
@ -426,7 +426,7 @@ void CDebugSymbols::Refresh()
if (m_bFiltering)
{
UpdateFilteredSymbols();
numSymbols = m_FilteredSymbols.size();
numSymbols = (int)((INT_PTR)m_FilteredSymbols.size());
}
else
{
@ -440,7 +440,7 @@ int CDebugSymbols::GetListItemSymbolId(int nItem)
{
if (m_bFiltering)
{
if (nItem >= m_FilteredSymbols.size())
if (nItem >= (int)m_FilteredSymbols.size())
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}

View File

@ -991,10 +991,10 @@ LRESULT CDebugMemoryView::OnHxPaste(LPNMHDR lpNMHDR)
size_t length = strlen(text);
for (size_t i = 0; i < length; i++)
{
SetByte(nmp->address + i, text[i]);
SetByte((int)((INT_PTR)(nmp->address + i)), text[i]);
}
retDataLength = length;
retDataLength = (int)((INT_PTR)(length));
}
GlobalUnlock(hData);
@ -1093,7 +1093,7 @@ void CDebugMemoryView::OpenNewTab(uint32_t address, bool bVirtual, int numBytesP
{
if (m_TabData[i].address == address && m_TabData[i].bVirtual == bVirtual)
{
m_TabCtrl.SetCurSel(i);
m_TabCtrl.SetCurSel((int)((INT_PTR)(i)));
TabSelChanged();
return;
}

View File

@ -42,7 +42,7 @@ private:
void OnRButtonDown(UINT /*nFlags*/, CPoint point)
{
TCHITTESTINFO ht = {point, 0};
int nItem = ::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)&ht);
int nItem = (int)((INT_PTR)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)&ht));
if (nItem != -1)
{
m_nItemRClick = nItem;
@ -52,7 +52,7 @@ private:
void OnRButtonUp(UINT /*nFlags*/, CPoint point)
{
TCHITTESTINFO ht = {point, 0};
int nItem = ::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)&ht);
int nItem = (int)((INT_PTR)::SendMessage(m_hWnd, TCM_HITTEST, 0, (LPARAM)&ht));
if (nItem != -1 && nItem == m_nItemRClick)
{
NMMTRCLICK nmrc = {{m_hWnd, (UINT_PTR)::GetDlgCtrlID(m_hWnd), MTCN_RCLICK}, nItem};

View File

@ -244,7 +244,7 @@ int CScanResult::GetMemoryValueString(char * buffer, size_t size, bool bIgnoreHe
out += sprintf(out, "%02X", mem[ipaddr]);
}
*out = '\0';
return out - buffer;
return (int)((INT_PTR)(out - buffer));
}
else
{

View File

@ -285,7 +285,7 @@ void CJSSocketWorker::ProcSendData()
CGuard guard(m_Queue.cs);
BufferedWrite & bufferedWrite = m_Queue.writes.front();
int avail = bufferedWrite.data.size() - bufferedWrite.offset;
int avail = (int)((UINT_PTR)(bufferedWrite.data.size() - bufferedWrite.offset));
int numBytesSent = send(m_Socket, &bufferedWrite.data[bufferedWrite.offset], avail, 0);
if (numBytesSent >= 0)

View File

@ -297,7 +297,7 @@ int CN64Image::UpdatePixelsAndPaletteFromBitmap()
{
if (m_bUsePalette)
{
m_PaletteData.resize(1 << m_PixelSize);
m_PaletteData.resize(((ULONG_PTR)1) << m_PixelSize);
std::vector<uint16_t> newPalette;
std::map<uint16_t, size_t> colorIndexMap;
@ -316,7 +316,7 @@ int CN64Image::UpdatePixelsAndPaletteFromBitmap()
}
else
{
if (newPalette.size() > (size_t)(1 << m_PixelSize))
if (newPalette.size() > (size_t)((ULONG_PTR)(1) << m_PixelSize))
{
return N64IMG_TOO_MANY_COLORS;
}
@ -329,7 +329,7 @@ int CN64Image::UpdatePixelsAndPaletteFromBitmap()
for (size_t nPixel = 0; nPixel < indices.size(); nPixel++)
{
SetTexel(nPixel, indices[nPixel]);
SetTexel(nPixel, (int)((ULONG_PTR)(indices[nPixel])));
}
m_PaletteData.resize(newPalette.size());

View File

@ -112,7 +112,7 @@ void CN64Image::WritePNG(uint8_t * rgba32, size_t width, size_t height, std::vec
return;
}
png_set_IHDR(png_ptr, info_ptr, width, height,
png_set_IHDR(png_ptr, info_ptr, (int)((UINT_PTR)width), (int)((UINT_PTR)height),
8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);

View File

@ -389,7 +389,7 @@ JSAppCallbackID ScriptAPI::AddAppCallback(duk_context * ctx, JSAppHookID hookId,
duk_push_object(ctx);
duk_push_number(ctx, hookId);
duk_put_prop_string(ctx, -2, "hookId");
duk_push_number(ctx, callbackId);
duk_push_number(ctx, (int)((UINT_PTR)callbackId));
duk_put_prop_string(ctx, -2, "callbackId");
duk_push_heapptr(ctx, callback.m_DukFuncHeapPtr);
duk_put_prop_string(ctx, -2, "func");
@ -397,7 +397,7 @@ JSAppCallbackID ScriptAPI::AddAppCallback(duk_context * ctx, JSAppHookID hookId,
duk_push_c_function(ctx, js__AppCallbackFinalizer, 1);
duk_set_finalizer(ctx, -2);
duk_put_prop_index(ctx, -2, callbackId);
duk_put_prop_index(ctx, -2, (int)((UINT_PTR)callbackId));
duk_pop(ctx);
@ -407,12 +407,12 @@ JSAppCallbackID ScriptAPI::AddAppCallback(duk_context * ctx, JSAppHookID hookId,
bool ScriptAPI::RemoveAppCallback(duk_context * ctx, JSAppCallbackID callbackId)
{
duk_get_global_string(ctx, HS_gAppCallbacks);
duk_bool_t bExists = duk_has_prop_index(ctx, -1, callbackId);
duk_bool_t bExists = duk_has_prop_index(ctx, -1, (int)((UINT_PTR)callbackId));
if (bExists)
{
// will invoke CallbackFinalizer
duk_del_prop_index(ctx, -1, callbackId);
duk_del_prop_index(ctx, -1, (int)((UINT_PTR)callbackId));
}
duk_pop(ctx);
@ -580,13 +580,13 @@ duk_ret_t ScriptAPI::js__Emitter_on(duk_context * ctx)
duk_get_prop_string(ctx, -2, HS_emitterNextListenerId);
duk_size_t nextIdx = duk_get_int(ctx, -1);
duk_pop(ctx);
duk_push_int(ctx, nextIdx + 1);
duk_push_int(ctx, (int)((UINT_PTR)nextIdx + 1));
duk_put_prop_string(ctx, -3, HS_emitterNextListenerId);
duk_get_prop_string(ctx, -1, eventName);
duk_pull(ctx, 1);
duk_put_prop_index(ctx, -2, nextIdx);
duk_put_prop_index(ctx, -2, (int)((UINT_PTR)nextIdx));
duk_push_this(ctx);
return 1;
@ -706,7 +706,7 @@ void ScriptAPI::RegisterNativeModule(duk_context * ctx, HMODULE hModule)
duk_put_prop_string(ctx, -2, "modPtr");
duk_push_c_function(ctx, js__NativeModuleFinalizer, 1);
duk_set_finalizer(ctx, -2);
duk_put_prop_index(ctx, -2, index);
duk_put_prop_index(ctx, -2, (int)((UINT_PTR)index));
duk_pop(ctx);
}
@ -769,7 +769,7 @@ bool ScriptAPI::PrivateCallAllowed(duk_context * ctx)
return false;
}
bool bAllowed = duk_get_boolean(ctx, -1);
bool bAllowed = duk_get_boolean(ctx, -1) != 0;
duk_pop(ctx);
return bAllowed;
}

View File

@ -70,8 +70,8 @@ static void InitImageObjectProps(duk_context * ctx, duk_idx_t idx, CN64Image * i
{HS_n64ImagePtr, DukPointer(image)},
{"pixels", DukDupIndex(pixels_idx)},
{"palette", DukDupIndex(palette_idx)},
{"width", DukUInt(image->Width())},
{"height", DukUInt(image->Height())},
{"width", DukUInt((int)((UINT_PTR)image->Width()))},
{"height", DukUInt((int)((UINT_PTR)image->Height()))},
{nullptr},
};

View File

@ -48,7 +48,7 @@ duk_ret_t ScriptAPI::js_Socket__constructor(duk_context * ctx)
if (duk_has_prop_string(ctx, 0, "allowHalfOpen"))
{
duk_get_prop_string(ctx, 0, "allowHalfOpen");
bAllowHalfOpen = (bool)duk_get_boolean_default(ctx, -1, 0);
bAllowHalfOpen = duk_get_boolean_default(ctx, -1, 0) != 0;
duk_pop(ctx);
}
}
@ -191,7 +191,7 @@ duk_ret_t ScriptAPI::js_Socket__invokeWriteEndCallbacks(duk_context * ctx)
duk_size_t numCallbacks = duk_get_length(ctx, -1);
for (duk_size_t i = 0; i < numCallbacks; i++)
{
duk_get_prop_index(ctx, -1, i);
duk_get_prop_index(ctx, -1, (int)((UINT_PTR)i));
duk_dup(ctx, -3);
if (duk_pcall_method(ctx, 0) != 0)
@ -315,6 +315,6 @@ void RegisterWriteEndCallback(duk_context * ctx, duk_idx_t idx)
duk_get_prop_string(ctx, -1, HS_socketWriteEndCallbacks);
duk_size_t callbackIdx = duk_get_length(ctx, -1);
duk_dup(ctx, idx);
duk_put_prop_index(ctx, -2, callbackIdx);
duk_put_prop_index(ctx, -2, (int)((UINT_PTR)callbackIdx));
duk_pop(ctx);
}

View File

@ -75,7 +75,7 @@ duk_ret_t ScriptAPI::js_events_onstatechange(duk_context * ctx)
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_EMUSTATECHANGE,
CbArgs_EmuStateChangeEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -95,7 +95,7 @@ duk_ret_t ScriptAPI::js_events_onexec(duk_context * ctx)
JSAppCallbackID callbackId = AddAppCallback(ctx, JS_HOOK_CPU_EXEC, cb);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -115,7 +115,7 @@ duk_ret_t ScriptAPI::js_events_onread(duk_context * ctx)
JSAppCallbackID callbackId = AddAppCallback(ctx, JS_HOOK_CPU_READ, cb);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -135,7 +135,7 @@ duk_ret_t ScriptAPI::js_events_onwrite(duk_context * ctx)
JSAppCallbackID callbackId = AddAppCallback(ctx, JS_HOOK_CPU_WRITE, cb);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -160,7 +160,7 @@ duk_ret_t ScriptAPI::js_events_onopcode(duk_context * ctx)
JSAppCallbackID callbackId = AddAppCallback(ctx, JS_HOOK_CPU_EXEC, cb);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -182,7 +182,7 @@ duk_ret_t ScriptAPI::js_events_ongprvalue(duk_context * ctx)
JSAppCallbackID callbackId = AddAppCallback(ctx, JS_HOOK_CPU_EXEC, cb);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -191,7 +191,7 @@ duk_ret_t ScriptAPI::js_events_onpifread(duk_context * ctx)
CheckArgs(ctx, {Arg_Function});
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_PIFREAD, CbArgs_GenericEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -200,7 +200,7 @@ duk_ret_t ScriptAPI::js_events_onsptask(duk_context * ctx)
CheckArgs(ctx, {Arg_Function});
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_RSPTASK, CbArgs_SPTaskEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -209,7 +209,7 @@ duk_ret_t ScriptAPI::js_events_onpidma(duk_context * ctx)
CheckArgs(ctx, {Arg_Function});
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_PIDMA, CbArgs_PIEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -218,7 +218,7 @@ duk_ret_t ScriptAPI::js_events_onmouseup(duk_context * ctx)
CheckArgs(ctx, {Arg_Function});
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_MOUSEUP, CbArgs_MouseEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -227,7 +227,7 @@ duk_ret_t ScriptAPI::js_events_onmousedown(duk_context * ctx)
CheckArgs(ctx, {Arg_Function});
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_MOUSEDOWN, CbArgs_MouseEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -236,7 +236,7 @@ duk_ret_t ScriptAPI::js_events_onmousemove(duk_context * ctx)
CheckArgs(ctx, {Arg_Function});
JSAppCallbackID callbackId = AddAppCallback(ctx, 0, JS_HOOK_MOUSEMOVE, CbArgs_MouseEventObject);
duk_push_uint(ctx, callbackId);
duk_push_uint(ctx, (int)((UINT_PTR)callbackId));
return 1;
}
@ -332,7 +332,7 @@ duk_idx_t CbArgs_EmuStateChangeEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "EmuStateChangeEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"state", DukUInt(env->state)},
{nullptr},
};
@ -349,7 +349,7 @@ duk_idx_t CbArgs_GenericEventObject(duk_context * ctx, void * /*_env*/)
SetDummyConstructor(ctx, -1, "GenericEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{nullptr},
};
@ -366,7 +366,7 @@ duk_idx_t CbArgs_ExecEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "CPUExecEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"pc", DukUInt(env->pc)},
{nullptr},
};
@ -392,7 +392,7 @@ duk_idx_t CbArgs_ReadEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "CPUReadWriteEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"pc", DukUInt(env->pc)},
{"address", DukUInt(address)},
{"reg", DukUInt(rt)},
@ -543,7 +543,7 @@ duk_idx_t CbArgs_WriteEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "CPUReadWriteEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"pc", DukUInt(env->pc)},
{"address", DukUInt(address)},
{"reg", DukUInt(rt)},
@ -653,7 +653,7 @@ duk_idx_t CbArgs_OpcodeEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "CPUOpcodeEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"pc", DukUInt(env->pc)},
{"opcode", DukUInt(env->opInfo.m_OpCode.Value)},
{nullptr},
@ -672,7 +672,7 @@ duk_idx_t CbArgs_RegValueEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "CPURegValueEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"pc", DukUInt(env->pc)},
{"value", DukUInt(g_Reg->m_GPR[env->outAffectedRegIndex].UW[0])},
{"reg", DukUInt(env->outAffectedRegIndex)},
@ -692,7 +692,7 @@ static duk_idx_t CbArgs_MouseEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "MouseEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"button", DukInt(env->button)},
{"x", DukInt(env->x)},
{"y", DukInt(env->y)},
@ -712,7 +712,7 @@ static duk_idx_t CbArgs_SPTaskEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "SPTaskEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"taskType", DukUInt(env->taskType)},
{"taskFlags", DukUInt(env->taskFlags)},
{"ucodeBootAddress", DukUInt(env->ucodeBootAddress | 0x80000000)},
@ -745,7 +745,7 @@ static duk_idx_t CbArgs_PIEventObject(duk_context * ctx, void * _env)
SetDummyConstructor(ctx, -1, "PIEvent");
const DukPropListEntry props[] = {
{"callbackId", DukUInt(inst->CallbackId())},
{"callbackId", DukUInt((int)((UINT_PTR)inst->CallbackId()))},
{"direction", DukUInt(env->direction)},
{"dramAddress", DukUInt(env->dramAddress | 0x80000000)},
{"cartAddress", DukUInt(env->cartAddress | 0xA0000000)},

View File

@ -533,7 +533,7 @@ static duk_ret_t ReadWriteImpl(duk_context * ctx, fsop op)
if (bHavePos)
{
fseek(fp, position, SEEK_SET);
fseek(fp, (long)((UINT_PTR)position), SEEK_SET);
}
switch (op)
@ -548,7 +548,7 @@ static duk_ret_t ReadWriteImpl(duk_context * ctx, fsop op)
return DUK_RET_ERROR;
}
duk_push_number(ctx, rc);
duk_push_number(ctx, (duk_double_t)((UINT_PTR)rc));
return 1;
err_invalid_args:

View File

@ -151,13 +151,13 @@ duk_ret_t ScriptAPI::js_mem_getblock(duk_context * ctx)
for (size_t i = 0; i < length; i++)
{
uint8_t byte;
if (inst->Debugger()->DebugLoad_VAddr<uint8_t>(addr + i, byte))
if (inst->Debugger()->DebugLoad_VAddr<uint8_t>((uint32_t)((UINT_PTR)addr + i), byte))
{
data[i] = byte;
}
else
{
return ThrowMemoryError(ctx, addr + i);
return ThrowMemoryError(ctx, (uint32_t)((UINT_PTR)addr + i));
}
}
}
@ -179,7 +179,7 @@ duk_ret_t ScriptAPI::js_mem_getstring(duk_context * ctx)
for (size_t i = 0; i < maxLength; i++)
{
char c;
if (!inst->Debugger()->DebugLoad_VAddr<char>(addr + i, c))
if (!inst->Debugger()->DebugLoad_VAddr<char>((uint32_t)((UINT_PTR)addr + i), c))
{
return ThrowMemoryError(ctx, addr);
}
@ -197,7 +197,7 @@ duk_ret_t ScriptAPI::js_mem_getstring(duk_context * ctx)
for (size_t i = 0; i < length; i++)
{
if (!inst->Debugger()->DebugLoad_VAddr<char>(addr + i, str[i]))
if (!inst->Debugger()->DebugLoad_VAddr<char>((uint32_t)((UINT_PTR)addr + i), str[i]))
{
delete[] str;
return ThrowMemoryError(ctx, addr);
@ -253,9 +253,9 @@ duk_ret_t ScriptAPI::js_mem_setblock(duk_context * ctx)
for (size_t i = 0; i < length; i++)
{
if (!debugger->DebugStore_VAddr(address + i, data[i]))
if (!debugger->DebugStore_VAddr((uint32_t)((UINT_PTR)address + i), data[i]))
{
return ThrowMemoryError(ctx, address + i);
return ThrowMemoryError(ctx, (uint32_t)((UINT_PTR)address + i));
}
}
@ -463,7 +463,7 @@ duk_ret_t ScriptAPI::js_mem_bindstruct(duk_context * ctx)
duk_pop(ctx);
curAddr += MemTypeSize(type);
curAddr += (uint32_t)((UINT_PTR)MemTypeSize(type));
}
duk_dup(ctx, 0);

View File

@ -65,7 +65,7 @@ duk_ret_t ScriptAPI::js_pj64_close(duk_context * /*ctx*/)
duk_ret_t ScriptAPI::js_pj64_reset(duk_context * ctx)
{
CheckArgs(ctx, {Arg_OptBoolean});
bool bSoftReset = (bool)duk_get_boolean_default(ctx, 0, (duk_bool_t) false);
bool bSoftReset = duk_get_boolean_default(ctx, 0, (duk_bool_t) false) != 0;
HWND hMainWindow = (HWND)g_Plugins->MainWindow()->GetWindowHandle();
PostMessage(hMainWindow, WM_JSAPI_ACTION, JSAPI_ACT_RESET, (WPARAM)bSoftReset);
@ -89,7 +89,7 @@ duk_ret_t ScriptAPI::js_pj64_resume(duk_context * /*ctx*/)
duk_ret_t ScriptAPI::js_pj64_limitfps(duk_context * ctx)
{
CheckArgs(ctx, {Arg_Boolean});
bool bLimitFps = duk_get_boolean(ctx, 0);
bool bLimitFps = duk_get_boolean(ctx, 0) != 0;
g_Settings->SaveBool(GameRunning_LimitFPS, bLimitFps);
return 0;
}
@ -201,7 +201,7 @@ duk_ret_t ScriptAPI::js_pj64_romInfo__get_headerName(duk_context * ctx)
char headerName[0x15] = "";
for (size_t i = 0; i < 0x14; i++)
{
debugger->DebugLoad_VAddr<char>(0xB0000020 + i, headerName[i]);
debugger->DebugLoad_VAddr<char>((int)((UINT_PTR)0xB0000020 + i), headerName[i]);
}
duk_push_string(ctx, headerName);
duk_trim(ctx, -1);

View File

@ -202,7 +202,7 @@ void CScriptSystem::UpdateCpuCbListInfo(volatile JSCpuCbListInfo & info, JSAppCa
{
uint32_t minAddrStart = 0;
uint32_t maxAddrEnd = 0;
int numCacheEntries = 0;
size_t numCacheEntries = 0;
bool bCacheExceeded = false;
for (JSAppCallback & callback : callbacks)

View File

@ -157,7 +157,7 @@ void CSymbolTable::Load()
m_SymFileSize = m_SymFileHandle.GetLength();
m_SymFileBuffer = new char[m_SymFileSize + 1];
m_SymFileParseBuffer = new char[m_SymFileSize + 1];
m_SymFileHandle.Read(m_SymFileBuffer, m_SymFileSize);
m_SymFileHandle.Read(m_SymFileBuffer, (uint32_t)((UINT_PTR)m_SymFileSize));
m_SymFileHandle.Close();
m_SymFileBuffer[m_SymFileSize] = '\0';
@ -284,7 +284,7 @@ void CSymbolTable::Save()
}
strLine += "\n";
m_SymFileHandle.Write(strLine.c_str(), strLine.length());
m_SymFileHandle.Write(strLine.c_str(), (uint32_t)((UINT_PTR)strLine.length()));
}
m_SymFileHandle.SetEndOfFile();
@ -442,7 +442,7 @@ void CSymbolTable::UpdateAddressMap()
int CSymbolTable::GetCount()
{
CGuard guard(m_CS);
return m_Symbols.size();
return (int)((UINT_PTR)m_Symbols.size());
}
bool CSymbolTable::GetSymbolByIndex(size_t index, CSymbol * symbol)

View File

@ -1461,11 +1461,11 @@ void CMainMenu::ResetMenu(void)
WriteTrace(TraceUserInterface, TraceDebug, "Remove plugin menu");
if (g_Plugins->Gfx() != nullptr && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu()))
{
RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->Gfx()->GetDebugMenu(), MF_BYCOMMAND);
RemoveMenu((HMENU)OldMenuHandle, (UINT)((UINT_PTR)g_Plugins->Gfx()->GetDebugMenu()), MF_BYCOMMAND);
}
if (g_Plugins->RSP() != nullptr && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu()))
{
RemoveMenu((HMENU)OldMenuHandle, (DWORD)g_Plugins->RSP()->GetDebugMenu(), MF_BYCOMMAND);
RemoveMenu((HMENU)OldMenuHandle, (UINT)((UINT_PTR)g_Plugins->RSP()->GetDebugMenu()), MF_BYCOMMAND);
}
WriteTrace(TraceUserInterface, TraceDebug, "Destroy old menu");

View File

@ -124,7 +124,7 @@ void CMainGui::AddRecentRom(const char * ImagePath)
size_t i;
for (i = 0; i < MaxRememberedFiles; i++)
{
stdstr RecentGame = UISettingsLoadStringIndex(File_RecentGameFileIndex, i);
stdstr RecentGame = UISettingsLoadStringIndex(File_RecentGameFileIndex, (int32_t)((UINT_PTR)i));
if (RecentGame.empty())
{
break;
@ -151,7 +151,7 @@ void CMainGui::AddRecentRom(const char * ImagePath)
for (i = 0, iter = RecentGames.begin(); iter != RecentGames.end(); iter++, i++)
{
UISettingsSaveStringIndex(File_RecentGameFileIndex, i, *iter);
UISettingsSaveStringIndex(File_RecentGameFileIndex, (int32_t)((UINT_PTR)i), *iter);
}
}
@ -455,7 +455,7 @@ bool CMainGui::ProcessGuiMessages(void)
return false;
}
void CMainGui::Resize(DWORD /*fwSizeType*/, WORD nWidth, WORD nHeight)
void CMainGui::Resize(WPARAM /*fwSizeType*/, WORD nWidth, WORD nHeight)
{
RECT clrect, swrect;
GetClientRect(m_hMainWindow, &clrect);
@ -606,7 +606,7 @@ void CMainGui::SaveWindowLoc(void)
}
}
LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWORD lParam)
LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
@ -789,7 +789,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
{
if (g_Plugins && g_Plugins->Control()->WM_KeyUp)
{
g_Plugins->Control()->WM_KeyUp(wParam, lParam);
g_Plugins->Control()->WM_KeyUp((uint32_t)((UINT_PTR)wParam), (uint32_t)((UINT_PTR)lParam));
}
}
}
@ -805,7 +805,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
{
if (g_Plugins && g_Plugins->Control()->WM_KeyDown)
{
g_Plugins->Control()->WM_KeyDown(wParam, lParam);
g_Plugins->Control()->WM_KeyDown((uint32_t)((UINT_PTR)wParam), (uint32_t)((UINT_PTR)lParam));
}
}
}
@ -848,7 +848,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
if (g_Plugins && g_Plugins->Control()->WM_KillFocus)
{
g_Plugins->Control()->WM_KillFocus(wParam, lParam);
g_Plugins->Control()->WM_KillFocus((uint32_t)((UINT_PTR)wParam), (uint32_t)((UINT_PTR)lParam));
}
}
}

View File

@ -115,12 +115,12 @@ private:
void ChangeWinSize(long width, long height);
void Create(const char * WindowTitle);
void CreateStatusBar(void);
void Resize(DWORD fwSizeType, WORD nWidth, WORD nHeight); // Responding to WM_SIZE
void Resize(WPARAM fwSizeType, WORD nWidth, WORD nHeight); // Responding to WM_SIZE
void AddRecentRom(const char * ImagePath);
void SetWindowCaption(const wchar_t * Caption);
void ShowRomBrowser(void);
static LRESULT CALLBACK MainGui_Proc(HWND, DWORD, DWORD, DWORD);
static LRESULT CALLBACK MainGui_Proc(HWND, DWORD, WPARAM, LPARAM);
friend void RomBowserEnabledChanged(CMainGui * Gui);
friend void RomBowserColoumnsChanged(CMainGui * Gui);

View File

@ -44,22 +44,22 @@ bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items)
MenuItemList * SubMenu = (MenuItemList *)MenuItem->SubMenu();
if (ItemID == SUB_MENU && HIWORD(SubMenu) != 0 && (SubMenu->begin() != SubMenu->end()))
{
ItemID = (UINT)CreatePopupMenu();
ItemID = (UINT)((LONG_PTR)CreatePopupMenu());
uFlags |= MF_POPUP;
AddMenu((HMENU)ItemID, *SubMenu);
AddMenu((HMENU)((LONG_PTR)ItemID), *SubMenu);
}
if (ItemID == ID_PLUGIN_MENU)
{
ItemID = (UINT)MenuItem->SubMenu();
ItemID = (UINT)((LONG_PTR)MenuItem->SubMenu());
uFlags |= MF_POPUP;
MENUITEMINFO lpmii;
lpmii.cbSize = sizeof(MENUITEMINFO);
lpmii.fMask = MIIM_STATE;
lpmii.fState = 0;
SetMenuItemInfo((HMENU)ItemID, (DWORD)MenuItem->SubMenu(), FALSE, &lpmii);
SetMenuItemInfo((HMENU)((LONG_PTR)ItemID), (DWORD)((LONG_PTR)MenuItem->SubMenu()), FALSE, &lpmii);
}
if (MenuItem->ShortCut().empty() == false)

View File

@ -556,7 +556,7 @@ HACCEL CShortCuts::GetAcceleratorTable(void)
CGuard CS(m_CS);
// Generate an ACCEL list
int size = 0, MaxSize = m_ShortCuts.size() * 5;
int32_t size = 0, MaxSize = (int32_t)((UINT_PTR)m_ShortCuts.size()) * 5;
ACCEL * AccelList = new ACCEL[MaxSize];
CMenuShortCutKey::RUNNING_STATE RunningState = CMenuShortCutKey::RunningState();

View File

@ -189,7 +189,7 @@ void CNotificationImp::AddRecentDir(const char * RomDir)
size_t i;
for (i = 0; i < MaxRememberedDirs; i++)
{
stdstr RecentDir = UISettingsLoadStringIndex(Directory_RecentGameDirIndex, i);
stdstr RecentDir = UISettingsLoadStringIndex(Directory_RecentGameDirIndex, (int32_t)((UINT_PTR)i));
if (RecentDir.empty())
{
break;
@ -216,7 +216,7 @@ void CNotificationImp::AddRecentDir(const char * RomDir)
for (i = 0, iter = RecentDirs.begin(); iter != RecentDirs.end(); iter++, i++)
{
UISettingsSaveStringIndex(Directory_RecentGameDirIndex, i, *iter);
UISettingsSaveStringIndex(Directory_RecentGameDirIndex, (int32_t)((UINT_PTR)i), *iter);
}
}

View File

@ -105,7 +105,7 @@ std::string CProjectSupport::GenerateMachineID(void)
}
stdstr_f Machine("%s.%ud.%s", stdstr().FromUTF16(ComputerName).c_str(), SerialNumber, stdstr().FromUTF16(MachineGuid).c_str());
return std::string(MD5((const unsigned char *)Machine.c_str(), Machine.size()).hex_digest());
return std::string(MD5((const unsigned char *)Machine.c_str(), (uint32_t)((UINT_PTR)Machine.size())).hex_digest());
}
void CProjectSupport::IncrementRunCount()
@ -159,7 +159,7 @@ bool CProjectSupport::PerformRequest(const wchar_t * Url, const std::string & Po
return false;
}
wchar_t hdheaders[] = _T("Content-Type: application/x-www-form-urlencoded\r\n");
BOOL Success = HttpSendRequest(hRequest, hdheaders, _tcslen(hdheaders), (LPVOID)PostData.c_str(), PostData.length());
BOOL Success = HttpSendRequest(hRequest, hdheaders, (uint32_t)((UINT_PTR)_tcslen(hdheaders)), (LPVOID)PostData.c_str(), (uint32_t)((UINT_PTR)PostData.length()));
if (!Success)
{
InternetCloseHandle(hRequest);
@ -230,7 +230,7 @@ void CProjectSupport::SaveSupportInfo(void)
long lResult = RegCreateKeyEx(HKEY_CURRENT_USER, L"SOFTWARE\\Project64", 0, L"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &hKeyResults, &Disposition);
if (lResult == ERROR_SUCCESS)
{
RegSetValueEx(hKeyResults, L"user", 0, REG_BINARY, (BYTE *)OutData.data(), OutData.size());
RegSetValueEx(hKeyResults, L"user", 0, REG_BINARY, (BYTE *)OutData.data(), (uint32_t)((UINT_PTR)OutData.size()));
RegCloseKey(hKeyResults);
}
}
@ -269,8 +269,8 @@ void CProjectSupport::LoadSupportInfo(void)
InData[i] ^= 0xAA;
}
OutData.resize(sizeof(m_SupportInfo) + 100);
uLongf DestLen = OutData.size();
if (uncompress(OutData.data(), &DestLen, InData.data(), InData.size()) >= 0)
uLongf DestLen = (uLongf)((UINT_PTR)OutData.size());
if (uncompress(OutData.data(), &DestLen, InData.data(), (uint32_t)((UINT_PTR)InData.size())) >= 0)
{
OutData.resize(DestLen);
}

View File

@ -97,7 +97,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
}
SORT_FIELD SortFieldInfo;
SortFieldInfo._this = this;
SortFieldInfo.Key = index;
SortFieldInfo.Key = (int32_t)((UINT_PTR)index);
SortFieldInfo.KeyAscend = UISettingsLoadBoolIndex(RomBrowser_SortAscendingIndex, SortIndex);
// Calculate new start and end
@ -120,7 +120,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
return End;
}
int32_t Result = RomList_CompareItems(lParam, lvItem.lParam, (uint32_t)&SortFieldInfo);
int32_t Result = RomList_CompareItems(lParam, lvItem.lParam, &SortFieldInfo);
if (Result < 0)
{
if (End == TestPos)
@ -159,7 +159,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
return End;
}
Result = RomList_CompareItems(lParam, lvItem.lParam, (uint32_t)&SortFieldInfo);
Result = RomList_CompareItems(lParam, lvItem.lParam, &SortFieldInfo);
if (Result <= 0)
{
if (Right == NewTestPos)
@ -195,7 +195,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
return End;
}
Result = RomList_CompareItems(lParam, lvItem.lParam, (uint32_t)&SortFieldInfo);
Result = RomList_CompareItems(lParam, lvItem.lParam, &SortFieldInfo);
if (Result >= 0)
{
if (Left == NewTestPos)
@ -238,7 +238,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
}
SORT_FIELD SortFieldInfo;
SortFieldInfo._this = this;
SortFieldInfo.Key = index;
SortFieldInfo.Key = (int)((UINT_PTR)index);
SortFieldInfo.KeyAscend = UISettingsLoadBoolIndex(RomBrowser_SortAscendingIndex, SortIndex) != 0;
LVITEM lvItem;
@ -250,7 +250,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
return End;
}
int32_t Result = RomList_CompareItems(lParam, lvItem.lParam, (uint32_t)&SortFieldInfo);
int32_t Result = RomList_CompareItems(lParam, lvItem.lParam, &SortFieldInfo);
if (Result < 0)
{
return End;
@ -272,7 +272,7 @@ void CRomBrowser::RomAddedToList(int32_t ListPos)
lvItem.lParam = (LPARAM)ListPos;
lvItem.pszText = LPSTR_TEXTCALLBACK;
int32_t index = SendMessage(m_hRomList, LVM_INSERTITEM, 0, (LPARAM)&lvItem);
int32_t index = (int32_t)((UINT_PTR)SendMessage(m_hRomList, LVM_INSERTITEM, 0, (LPARAM)&lvItem));
int32_t iItem = ListView_GetNextItem(m_hRomList, -1, LVNI_SELECTED);
// If the last ROM then highlight the item
@ -510,7 +510,7 @@ void CRomBrowser::RomBrowserMaximize(bool Mazimize)
UISettingsSaveBool(RomBrowser_Maximized, Mazimize);
}
bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
bool CRomBrowser::RomListDrawItem(WPARAM idCtrl, LPARAM lParam)
{
if (idCtrl != IDC_ROMLIST)
{
@ -583,7 +583,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
text = stdstr(pRomInfo->FileName).ToUTF16();
}
DrawText(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
DrawText(ditem->hDC, text.c_str(), (int)((UINT_PTR)text.length()), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
memset(&lvc, 0, sizeof(lvc));
lvc.mask = LVCF_FMT | LVCF_WIDTH;
@ -608,12 +608,12 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
text = stdstr(pRomInfo->FileName).ToUTF16();
}
DrawText(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
DrawText(ditem->hDC, text.c_str(), (int)((UINT_PTR)text.length()), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
}
return true;
}
bool CRomBrowser::RomListNotify(int32_t idCtrl, uint32_t pnmh)
bool CRomBrowser::RomListNotify(WPARAM idCtrl, LPARAM pnmh)
{
if (idCtrl != IDC_ROMLIST)
{
@ -646,7 +646,7 @@ bool CRomBrowser::RomListNotify(int32_t idCtrl, uint32_t pnmh)
return true;
}
void CRomBrowser::RomList_ColoumnSortList(uint32_t pnmh)
void CRomBrowser::RomList_ColoumnSortList(LPARAM pnmh)
{
LPNMLISTVIEW pnmv = (LPNMLISTVIEW)pnmh;
size_t index;
@ -681,15 +681,15 @@ void CRomBrowser::RomList_ColoumnSortList(uint32_t pnmh)
RomList_SortList();
}
int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lParam2, uint32_t lParamSort)
int32_t CALLBACK CRomBrowser::RomList_CompareItems(LPARAM lParam1, LPARAM lParam2, void * lParamSort)
{
SORT_FIELD * SortFieldInfo = (SORT_FIELD *)lParamSort;
CRomBrowser * _this = SortFieldInfo->_this;
if (lParam1 < 0 || lParam1 >= _this->m_RomInfo.size())
if (lParam1 < 0 || lParam1 >= (int32_t)((UINT_PTR)_this->m_RomInfo.size()))
{
return 0;
}
if (lParam2 < 0 || lParam2 >= _this->m_RomInfo.size())
if (lParam2 < 0 || lParam2 >= (int32_t)((UINT_PTR)_this->m_RomInfo.size()))
{
return 0;
}
@ -739,7 +739,7 @@ int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lP
return result;
}
void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh)
void CRomBrowser::RomList_GetDispInfo(LPARAM pnmh)
{
LV_DISPINFO * lpdi = (LV_DISPINFO *)pnmh;
if (lpdi->item.lParam < 0 || lpdi->item.lParam >= (LPARAM)m_RomInfo.size())
@ -853,7 +853,7 @@ void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh)
}
}
void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/)
void CRomBrowser::RomList_OpenRom(LPARAM /*pnmh*/)
{
ROM_INFO * pRomInfo;
LV_ITEM lvItem;
@ -899,7 +899,7 @@ void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/)
}
}
void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
void CRomBrowser::RomList_PopupMenu(LPARAM /*pnmh*/)
{
LONG iItem = ListView_GetNextItem(m_hRomList, -1, LVNI_SELECTED);
m_SelectedRom = "";
@ -987,11 +987,11 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
if (GfxMenu)
{
MENUITEMINFO lpmii;
InsertMenu(hPopupMenu, 7, MF_POPUP | MF_BYPOSITION, (uint32_t)GfxMenu, wGS(POPUP_GFX_PLUGIN).c_str());
InsertMenu(hPopupMenu, 7, MF_POPUP | MF_BYPOSITION, (UINT_PTR)GfxMenu, wGS(POPUP_GFX_PLUGIN).c_str());
lpmii.cbSize = sizeof(MENUITEMINFO);
lpmii.fMask = MIIM_STATE;
lpmii.fState = 0;
SetMenuItemInfo(hPopupMenu, (uint32_t)GfxMenu, MF_BYCOMMAND, &lpmii);
SetMenuItemInfo(hPopupMenu, (UINT)(UINT_PTR)GfxMenu, MF_BYCOMMAND, &lpmii);
}
}
}
@ -1027,7 +1027,7 @@ void CRomBrowser::RomList_SortList(void)
continue;
}
SortFieldInfo._this = this;
SortFieldInfo.Key = index;
SortFieldInfo.Key = (int)((UINT_PTR)index);
SortFieldInfo.KeyAscend = UISettingsLoadBoolIndex(RomBrowser_SortAscendingIndex, count) != 0;
ListView_SortItems(m_hRomList, RomList_CompareItems, &SortFieldInfo);
}
@ -1103,7 +1103,7 @@ void CRomBrowser::SelectRomDir(void)
bi.lpszTitle = title.c_str();
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_USENEWUI;
bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack;
bi.lParam = (uint32_t)RomDir.c_str();
bi.lParam = (UINT_PTR)RomDir.c_str();
WriteTrace(TraceUserInterface, TraceDebug, "2");
if ((pidl = SHBrowseForFolder(&bi)) != nullptr)
{
@ -1111,7 +1111,7 @@ void CRomBrowser::SelectRomDir(void)
char Directory[_MAX_PATH];
if (SHGetPathFromIDListA(pidl, Directory))
{
int32_t len = strlen(Directory);
int32_t len = (int32_t)((UINT_PTR)strlen(Directory));
WriteTrace(TraceUserInterface, TraceDebug, "4");
if (Directory[len - 1] != '\\')

View File

@ -66,7 +66,7 @@ public:
void SetColPos(int Pos)
{
m_Pos = Pos;
UISettingsSaveDwordIndex(RomBrowser_PosIndex, m_ID, m_Pos);
UISettingsSaveDwordIndex(RomBrowser_PosIndex, m_ID, (int)((UINT_PTR)m_Pos));
m_PosChanged = true;
}
void ResetPos(void)
@ -102,8 +102,8 @@ public:
void RomBrowserToTop(void);
void RomBrowserMaximize(bool Mazimize);
bool RomBrowserVisible(void);
bool RomListDrawItem(int idCtrl, uint32_t lParam);
bool RomListNotify(int idCtrl, uint32_t pnmh);
bool RomListDrawItem(WPARAM idCtrl, LPARAM lParam);
bool RomListNotify(WPARAM idCtrl, LPARAM pnmh);
void SaveRomListColoumnInfo(void);
void SelectRomDir(void);
void ShowRomList(void);
@ -163,10 +163,10 @@ private:
void DeallocateBrushs(void);
void FixRomListWindow(void);
void MenuSetText(HMENU hMenu, int32_t MenuPos, const wchar_t * Title, char * ShortCut);
void RomList_ColoumnSortList(uint32_t pnmh);
void RomList_GetDispInfo(uint32_t pnmh);
void RomList_OpenRom(uint32_t pnmh);
void RomList_PopupMenu(uint32_t pnmh);
void RomList_ColoumnSortList(LPARAM pnmh);
void RomList_GetDispInfo(LPARAM pnmh);
void RomList_OpenRom(LPARAM pnmh);
void RomList_PopupMenu(LPARAM pnmh);
void RomList_SortList(void);
bool RomDirNeedsRefresh(void); // Called from watch thread
@ -180,7 +180,7 @@ private:
// Callback
static int CALLBACK SelectRomDirCallBack(HWND hwnd, uint32_t uMsg, uint32_t lp, uint32_t lpData);
static int CALLBACK RomList_CompareItems(uint32_t lParam1, uint32_t lParam2, uint32_t lParamSort);
static int CALLBACK RomList_CompareItems(LPARAM lParam1, LPARAM lParam2, void * lParamSort);
// Watch directory changed function
HANDLE m_WatchThread, m_WatchStopEvent;

View File

@ -70,10 +70,10 @@ void RomInformation::DisplayInformation(HWND hParent) const
return;
}
DialogBoxParam(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_Rom_Information), hParent, (DLGPROC)RomInfoProc, (DWORD)this);
DialogBoxParam(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDD_Rom_Information), hParent, (DLGPROC)RomInfoProc, (LPARAM)this);
}
DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{

View File

@ -8,7 +8,7 @@ class RomInformation
CN64Rom * m_pRomInfo;
CN64Disk * m_pDiskInfo;
friend DWORD CALLBACK RomInfoProc(HWND, DWORD, DWORD, DWORD);
friend DWORD CALLBACK RomInfoProc(HWND, DWORD, WPARAM, LPARAM);
public:
RomInformation(const char * RomFile);

View File

@ -75,7 +75,7 @@ void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedE
bi.lpszTitle = wTitle.c_str();
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_USENEWUI;
bi.lpfn = (BFFCALLBACK)SelectDirCallBack;
bi.lParam = (DWORD)InitialDir.c_str();
bi.lParam = (INT_PTR)InitialDir.c_str();
if ((pidl = SHBrowseForFolder(&bi)) != nullptr)
{
if (SHGetPathFromIDList(pidl, Directory))
@ -231,7 +231,7 @@ void COptionsDirectoriesPage::UseSelectedClicked(UINT /*Code*/, int id, HWND /*c
if (!Button->IsChanged() || Button->IsReset())
{
if ((int)Button->GetMenu() == id)
if ((int)(INT_PTR)Button->GetMenu() == id)
{
return;
}

View File

@ -77,7 +77,7 @@ void CGamePluginPage::ShowAboutButton(int id)
CModifiedComboBox * ComboBox = nullptr;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{
if ((int)(cb_iter->second->GetMenu()) != id)
if ((INT_PTR)(cb_iter->second->GetMenu()) != id)
{
continue;
}
@ -130,7 +130,7 @@ void CGamePluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged)
CModifiedComboBox * ComboBox = nullptr;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{
if ((int)(cb_iter->second->GetMenu()) != id)
if ((INT_PTR)(cb_iter->second->GetMenu()) != id)
{
continue;
}
@ -301,7 +301,7 @@ void CGamePluginPage::HleGfxChanged(UINT /*Code*/, int id, HWND /*ctl*/)
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{
CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id)
if ((INT_PTR)Button->GetMenu() != id)
{
continue;
}
@ -324,7 +324,7 @@ void CGamePluginPage::HleAudioChanged(UINT /*Code*/, int id, HWND /*ctl*/)
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{
CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id)
if ((INT_PTR)Button->GetMenu() != id)
{
continue;
}

View File

@ -41,13 +41,13 @@ void COptionsGameBrowserPage::UpdateFieldList(const ROMBROWSER_FIELDS_LIST & Fie
m_Using.ResetContent();
m_OrderChanged = false;
for (int i = 0, n = Fields.size(); i < n; i++)
for (size_t i = 0, n = Fields.size(); i < n; i++)
{
if (Fields[i].PosChanged())
{
m_OrderChanged = true;
}
int Pos = Fields[i].Pos();
int Pos = (int)((UINT_PTR)Fields[i].Pos());
if (Pos < 0)
{
m_Avaliable.SetItemData(m_Avaliable.AddString(wGS(Fields[i].LangID()).c_str()), i);
@ -97,7 +97,7 @@ void COptionsGameBrowserPage::AddFieldClicked(UINT /*Code*/, int /*id*/, HWND /*
return;
}
// Remove from list
int i = m_Avaliable.GetItemData(index);
int i = (int)((UINT_PTR)m_Avaliable.GetItemData(index));
m_Avaliable.DeleteString(index);
// Select next in list
@ -126,7 +126,7 @@ void COptionsGameBrowserPage::RemoveFieldClicked(UINT /*Code*/, int /*id*/, HWND
return;
}
// Remove from list
int i = m_Using.GetItemData(index);
int i = (int)((UINT_PTR)m_Using.GetItemData(index));
m_Using.DeleteString(index);
// Select next in list
@ -154,7 +154,7 @@ void COptionsGameBrowserPage::MoveFieldUpClicked(UINT /*Code*/, int /*id*/, HWND
{
return;
}
int i = m_Using.GetItemData(index);
int i = (int)((UINT_PTR)m_Using.GetItemData(index));
m_Using.DeleteString(index);
index = m_Using.InsertString(index - 1, wGS(m_Fields[i].LangID()).c_str());
@ -173,7 +173,7 @@ void COptionsGameBrowserPage::MoveFieldDownClicked(UINT /*Code*/, int /*id*/, HW
{
return;
}
int i = m_Using.GetItemData(index);
int i = (int)((UINT_PTR)m_Using.GetItemData(index));
m_Using.DeleteString(index);
index = m_Using.InsertString(index + 1, wGS(m_Fields[i].LangID()).c_str());
@ -211,10 +211,10 @@ void COptionsGameBrowserPage::ApplySettings(bool UpdateScreen)
size_t Item, listCount = m_Using.GetCount();
for (Item = 0; Item < listCount; Item++)
{
int Pos = m_Using.GetItemData(Item);
int Pos = (int)((UINT_PTR)m_Using.GetItemData((int)((UINT_PTR)Item)));
if (m_OrderReset || m_Fields[Pos].Pos() != Item)
{
m_Fields[Pos].SetColPos(Item);
m_Fields[Pos].SetColPos((int)((UINT_PTR)Item));
bColChanged = true;
}
}
@ -222,7 +222,7 @@ void COptionsGameBrowserPage::ApplySettings(bool UpdateScreen)
listCount = m_Avaliable.GetCount();
for (Item = 0; Item < listCount; Item++)
{
int Pos = m_Avaliable.GetItemData(Item);
int Pos = (int)((UINT_PTR)m_Avaliable.GetItemData((int)((UINT_PTR)Item)));
if (m_OrderReset || m_Fields[Pos].Pos() != -1)
{
m_Fields[Pos].SetColPos(-1);

View File

@ -69,7 +69,7 @@ void COptionPluginPage::ShowAboutButton(int id)
CModifiedComboBox * ComboBox = nullptr;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{
if ((int)(cb_iter->second->GetMenu()) != id)
if ((int)((INT_PTR)cb_iter->second->GetMenu()) != id)
{
continue;
}
@ -122,7 +122,7 @@ void COptionPluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged)
CModifiedComboBox * ComboBox = nullptr;
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{
if ((int)(cb_iter->second->GetMenu()) != id)
if ((int)((INT_PTR)cb_iter->second->GetMenu()) != id)
{
continue;
}
@ -283,7 +283,7 @@ void COptionPluginPage::HleGfxChanged(UINT /*Code*/, int id, HWND /*ctl*/)
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{
CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id)
if ((int)(INT_PTR)Button->GetMenu() != id)
{
continue;
}
@ -306,7 +306,7 @@ void COptionPluginPage::HleAudioChanged(UINT /*Code*/, int id, HWND /*ctl*/)
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{
CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id)
if ((int)(INT_PTR)Button->GetMenu() != id)
{
continue;
}

View File

@ -72,7 +72,7 @@ protected:
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter++)
{
CModifiedButton * Button = iter->second;
if ((int)Button->GetMenu() != id)
if ((INT_PTR)Button->GetMenu() != id)
{
continue;
}
@ -294,7 +294,7 @@ protected:
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter++)
{
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
if ((int)ComboBox->GetMenu() != id)
if ((INT_PTR)ComboBox->GetMenu() != id)
{
continue;
}
@ -305,7 +305,7 @@ protected:
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
if ((int)ComboBox->GetMenu() != id)
if ((INT_PTR)ComboBox->GetMenu() != id)
{
continue;
}
@ -325,7 +325,7 @@ protected:
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter++)
{
CModifiedEditBox * EditBox = eb_iter->second;
if ((int)EditBox->GetMenu() != id)
if ((INT_PTR)EditBox->GetMenu() != id)
{
continue;
}

View File

@ -65,8 +65,8 @@ void CSettingConfig::UpdateAdvanced(bool AdvancedMode, HTREEITEM hItem)
}
else if (AdvancedMode && Page == m_GeneralOptionsPage)
{
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(m_AdvancedPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_AdvancedPage, hItem, TVI_FIRST);
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(m_DefaultsPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_DefaultsPage, hItem, TVI_FIRST);
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(m_AdvancedPage->PageTitle()).c_str(), 0, 0, 0, 0, (LPARAM)m_AdvancedPage, hItem, TVI_FIRST);
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(m_DefaultsPage->PageTitle()).c_str(), 0, 0, 0, 0, (LPARAM)m_DefaultsPage, hItem, TVI_FIRST);
break;
}
else
@ -184,21 +184,21 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
for (size_t i = 0; i < Section->GetPageCount(); i++)
{
CSettingsPage * Page = Section->GetPage(i);
CSettingsPage * Page = Section->GetPage((int32_t)((UINT_PTR)i));
if (HideAdvanced && (Page == m_AdvancedPage || Page == m_DefaultsPage))
{
continue;
}
if (i == 0)
{
hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, Section->GetPageTitle(), 0, 0, 0, 0, (ULONG)Page, TVI_ROOT, TVI_LAST);
hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, Section->GetPageTitle(), 0, 0, 0, 0, (LPARAM)Page, TVI_ROOT, TVI_LAST);
continue;
}
if (hSectionItem == nullptr)
{
continue;
}
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(Page->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)Page, hSectionItem, TVI_LAST);
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(Page->PageTitle()).c_str(), 0, 0, 0, 0, (LPARAM)Page, hSectionItem, TVI_LAST);
}
if (bFirstItem && hSectionItem != nullptr)
{
@ -240,7 +240,7 @@ LRESULT CSettingConfig::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL & /
for (size_t i = 0; i < Section->GetPageCount(); i++)
{
CSettingsPage * Page = Section->GetPage(i);
CSettingsPage * Page = Section->GetPage((int32_t)((UINT_PTR)i));
if (Page->EnableReset())
{
Page->ResetPage();
@ -272,7 +272,7 @@ void CSettingConfig::ApplySettings(bool UpdateScreen)
for (size_t i = 0; i < Section->GetPageCount(); i++)
{
CSettingsPage * Page = Section->GetPage(i);
CSettingsPage * Page = Section->GetPage((int32_t)((UINT_PTR)i));
Page->ApplySettings(UpdateScreen);
}
}

View File

@ -73,7 +73,7 @@ LRESULT CSupportEnterCode::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
hFont = (HFONT)::GetStockObject(SYSTEM_FONT);
}
hDC.SelectFont(hFont);
if (hDC.DrawText(DescriptionText.c_str(), DescriptionText.length(), &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0)
if (hDC.DrawText(DescriptionText.c_str(), (int)((INT_PTR)DescriptionText.length()), &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0)
{
hDescription.SetWindowPos(nullptr, 0, 0, rcWin.right, rcWin.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER);
}

View File

@ -83,7 +83,7 @@ LRESULT CSupportWindow::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
hFont = (HFONT)::GetStockObject(SYSTEM_FONT);
}
hDC.SelectFont(hFont);
if (hDC.DrawText(InfoText.c_str(), InfoText.length(), &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0)
if (hDC.DrawText(InfoText.c_str(), (int)((INT_PTR)InfoText.length()), &rcWin, DT_LEFT | DT_CALCRECT | DT_WORDBREAK | DT_NOCLIP) > 0)
{
hInfo.SetWindowPos(nullptr, 0, 0, rcWin.right, rcWin.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER);
}

View File

@ -511,7 +511,7 @@ void CHexEditCtrl::Text(int x, int y, const char * text, COLORREF bg, COLORREF f
{
std::wstring textOuput = stdstr(text).ToUTF16(CP_ACP);
size_t length = textOuput.length();
int calcWidth = length * m_CharWidth;
int calcWidth = (int)((INT_PTR)length) * m_CharWidth;
CRect rc(x, y, 0, 0);
COLORREF orgBg = ::SetBkColor(m_BackDC, bg);
@ -1093,7 +1093,7 @@ void CHexEditCtrl::OnChar(UINT nChar, UINT /*nRepCnt*/, UINT /*nFlags*/)
void CHexEditCtrl::Paste(bool bAdvanceCaret)
{
uint32_t targetAddress = m_bHaveRealSel ? m_RealSelStartAddress : m_CaretAddress;
int retLength = NotifyPaste(targetAddress);
int retLength = (int)((INT_PTR)NotifyPaste(targetAddress));
if (retLength != 0)
{

View File

@ -57,7 +57,7 @@ bool CBitmapPicture::SetIcon(LPCWSTR lpszResourceName, uint32_t nWidth, uint32_t
}
if (IS_INTRESOURCE(lpszResourceName))
{
m_nResourceID = (int)lpszResourceName;
m_nResourceID = (int)((LONG_PTR)lpszResourceName);
}
else
{
@ -79,7 +79,7 @@ void CBitmapPicture::SetBitmap(LPCWSTR lpszResourceName)
{
if (IS_INTRESOURCE(lpszResourceName))
{
m_nResourceID = (int)lpszResourceName;
m_nResourceID = (int)((LONG_PTR)lpszResourceName);
}
else
{

View File

@ -44,5 +44,4 @@
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>