MCPcopy Create free account
hub / github.com/TASEmulators/fceux / GetComboBoxListItemData

Function GetComboBoxListItemData

src/drivers/win/header_editor.cpp:1753–1810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1751}
1752
1753bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header)
1754{
1755
1756 bool success = true;
1757 *value = SendDlgItemMessage(hwnd, id, CB_GETCURSEL, 0, 0);
1758 if (*value != CB_ERR)
1759 *value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, *value, 0);
1760 else {
1761 GetDlgItemText(hwnd, id, buf, 256);
1762
1763 if (header)
1764 *value = SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf);
1765 else
1766 *value = SendDlgItemMessage(hwnd, id, CB_FINDSTRINGEXACT, 0, (LPARAM)buf);
1767
1768 if (*value != CB_ERR)
1769 *value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, *value, 0);
1770 else
1771 {
1772 switch (id)
1773 {
1774 default:
1775 success = false;
1776 break;
1777 case IDC_MAPPER_COMBO:
1778 if (!(success = sscanf(buf, "%d", value) > 0))
1779 success = SearchByString(hwnd, id, value, buf, header);
1780 else if (header)
1781 SetDlgItemText(hwnd, id, buf);
1782 break;
1783 case IDC_VS_SYSTEM_COMBO:
1784 case IDC_VS_PPU_COMBO:
1785 case IDC_SYSTEM_EXTEND_COMBO:
1786 if (!(success = sscanf(buf, "$%X", (unsigned int *)value) > 0))
1787 success = SearchByString(hwnd, id, value, buf, header);
1788 else if (header)
1789 SetDlgItemText(hwnd, id, buf);
1790 break;
1791 case IDC_INPUT_DEVICE_COMBO:
1792 if (success = sscanf(buf, "$%X", (unsigned int *)value) > 0)
1793 {
1794 char buf2[8];
1795 sprintf(buf2, "$%02X", *value);
1796 if (header && SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf2) == CB_ERR)
1797 SetDlgItemText(hwnd, id, buf);
1798 }
1799 else
1800 success = SearchByString(hwnd, id, value, buf, header);
1801 break;
1802 }
1803
1804 if (header && !success)
1805 SetDlgItemText(hwnd, id, buf);
1806 }
1807 }
1808
1809 return success;
1810}

Callers 2

WriteHeaderDataFunction · 0.85
GetComboBoxByteSizeFunction · 0.85

Calls 2

GetDlgItemTextFunction · 0.85
SearchByStringFunction · 0.85

Tested by

no test coverage detected