diff --git a/SRC/Backends/DolwinVideo/Fifo.cpp b/SRC/Backends/DolwinVideo/Fifo.cpp index 46fb0900..9b96da99 100644 --- a/SRC/Backends/DolwinVideo/Fifo.cpp +++ b/SRC/Backends/DolwinVideo/Fifo.cpp @@ -17,6 +17,8 @@ GX_FromFuture::FifoProcessor GxFifo; bool frame_done = true; +bool logDrawCommands = false; + // --------------------------------------------------------------------------- // stage callbacks @@ -975,7 +977,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) uint8_t* fifoPtr = &RAM[physAddress]; size_t size = fifo->Read32() & ~0x1f; - Report(Channel::GP, "OP_CMD_CALL_DL: addr: 0x%08X, size: %i\n", physAddress, size); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_CALL_DL: addr: 0x%08X, size: %i\n", physAddress, size); + } GX_FromFuture::FifoProcessor* callDlFifo = new GX_FromFuture::FifoProcessor(fifoPtr, size); @@ -1134,7 +1139,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_QUAD: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_QUAD: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 1---2 tri1: 0-1-2 | /| tri2: 0-2-3 @@ -1171,7 +1179,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_TRIANGLE: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_TRIANGLE: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 1---2 tri: 0-1-2 | / @@ -1208,7 +1219,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_STRIP: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_STRIP: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 1---3---5 tri1: 0-1-2 /| /| / tri2: 1-2-3 @@ -1260,7 +1274,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_FAN: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_FAN: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 1---2---3 tri1: 0-1-2 | / _/ tri2: 0-2-3 @@ -1311,7 +1328,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_LINE: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_LINE: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 1 3 5 / / / @@ -1348,7 +1368,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_LINESTRIP: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_LINESTRIP: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 1 3 5 /| /| / @@ -1395,7 +1418,10 @@ static void GxCommand(GX_FromFuture::FifoProcessor * fifo) unsigned vatnum = cmd & 7; unsigned vtxnum = fifo->Read16(); usevat = vatnum; - Report(Channel::GP, "OP_CMD_DRAW_POINT: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + if (logDrawCommands) + { + Report(Channel::GP, "OP_CMD_DRAW_POINT: vtxnum: %i, vat: %i\n", vtxnum, vatnum); + } /*/ 0---0 tri: 0-0-0 (1x1x1 tri) | / diff --git a/SRC/Hardware/MC.cpp b/SRC/Hardware/MC.cpp index c3962c41..260809e7 100644 --- a/SRC/Hardware/MC.cpp +++ b/SRC/Hardware/MC.cpp @@ -251,7 +251,7 @@ static void MCReadArrayProc (Memcard * memcard){ offset = MCCalculateOffset(auxdata); if (offset >= memcard->size + size) { - Halt("MC :: ReadArray offset is out of range\n"); + Report(Channel::MC, "ReadArray offset is out of range\n"); return; } @@ -530,6 +530,16 @@ void MCOpen (HWConfig * config) wcscpy(memcard[MEMCARD_SLOTB].filename, config->MemcardB_Filename); SyncSave = config->Memcard_SyncSave; + if (!Util::FileExists(memcard[MEMCARD_SLOTA].filename)) + { + Memcard_Connected[MEMCARD_SLOTA] = false; + } + + if (!Util::FileExists(memcard[MEMCARD_SLOTB].filename)) + { + Memcard_Connected[MEMCARD_SLOTB] = false; + } + MCConnect(); } diff --git a/SRC/UI/Legacy/DolwinLegacy/UserMemcards.cpp b/SRC/UI/Legacy/DolwinLegacy/UserMemcards.cpp index 91d589b0..b89c7e30 100644 --- a/SRC/UI/Legacy/DolwinLegacy/UserMemcards.cpp +++ b/SRC/UI/Legacy/DolwinLegacy/UserMemcards.cpp @@ -252,6 +252,7 @@ static INT_PTR CALLBACK MemcardSettingsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar { wchar_t buf[MAX_PATH] = { 0 }, buf2[MAX_PATH] = { 0 }, * filename; size_t newsize; + size_t fileSize; switch(uMsg) { @@ -264,6 +265,19 @@ static INT_PTR CALLBACK MemcardSettingsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar else if (um_num == 1) SendMessage(hwndDlg, WM_SETTEXT, (WPARAM)0, lParam = (LPARAM)L"Memcard B Settings"); + SyncSave = UI::Jdi.GetConfigBool(Memcard_SyncSave_Key, USER_MEMCARDS); + + if (um_num == 0) + { + Memcard_Connected[um_num] = UI::Jdi.GetConfigBool(MemcardA_Connected_Key, USER_MEMCARDS); + wcscpy_s(Memcard_filename[um_num], _countof(Memcard_filename[um_num]), Util::StringToWstring(UI::Jdi.GetConfigString(MemcardA_Filename_Key, USER_MEMCARDS)).c_str()); + } + else if (um_num == 1) + { + Memcard_Connected[um_num] = UI::Jdi.GetConfigBool(MemcardB_Connected_Key, USER_MEMCARDS); + wcscpy_s(Memcard_filename[um_num], _countof(Memcard_filename[um_num]), Util::StringToWstring(UI::Jdi.GetConfigString(MemcardB_Filename_Key, USER_MEMCARDS)).c_str()); + } + if (SyncSave) CheckRadioButton(hwndDlg, IDC_MEMCARD_SYNCSAVE_FALSE, IDC_MEMCARD_SYNCSAVE_TRUE, IDC_MEMCARD_SYNCSAVE_TRUE ); @@ -286,11 +300,20 @@ static INT_PTR CALLBACK MemcardSettingsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar SendDlgItemMessage(hwndDlg, IDC_MEMCARD_PATH, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCTSTR)buf); } + if (Util::FileExists(buf)) + { + fileSize = Util::FileSize(buf); + } + else + { + Memcard_Connected[um_num] = false; + fileSize = 0; + } + if (Memcard_Connected[um_num]) { - // TODO: Refactoring - //_stprintf_s (buf, _countof(buf) - 1, _T("Size: %d usable blocks (%d Kb)"), - // (int)(memcard[um_num].size / Memcard_BlockSize - 5), (int)(memcard[um_num].size / 1024)); - //SendDlgItemMessage(hwndDlg, IDC_MEMCARD_SIZEDESC, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCTSTR)buf); + swprintf_s (buf, _countof(buf) - 1, L"Size: %d usable blocks (%d Kb)", + (int)(fileSize / Memcard_BlockSize - 5), (int)(fileSize / 1024)); + SendDlgItemMessage(hwndDlg, IDC_MEMCARD_SIZEDESC, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCTSTR)buf); } else { SendDlgItemMessage(hwndDlg, IDC_MEMCARD_SIZEDESC, WM_SETTEXT, (WPARAM)0, (LPARAM)L"Not connected"); @@ -377,6 +400,18 @@ static INT_PTR CALLBACK MemcardSettingsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar wcscat_s(buf, _countof(buf) - 1, L"\\"); wcscat_s(buf, _countof(buf) - 1, buf2); } + else + { + size_t Fnsize, Pathsize; + Fnsize = SendDlgItemMessage(hwndDlg, IDC_MEMCARD_FILE, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0); + Pathsize = SendDlgItemMessage(hwndDlg, IDC_MEMCARD_PATH, WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0); + + SendDlgItemMessage(hwndDlg, IDC_MEMCARD_PATH, WM_GETTEXT, (WPARAM)(Pathsize + 1), (LPARAM)(LPCTSTR)buf); + SendDlgItemMessage(hwndDlg, IDC_MEMCARD_FILE, WM_GETTEXT, (WPARAM)(Fnsize + 1), (LPARAM)(LPCTSTR)buf2); + + wcscat_s(buf, _countof(buf) - 1, L"\\"); + wcscat_s(buf, _countof(buf) - 1, buf2); + } if (IsDlgButtonChecked(hwndDlg, IDC_MEMCARD_SYNCSAVE_FALSE) == BST_CHECKED ) SyncSave = false; @@ -398,11 +433,13 @@ static INT_PTR CALLBACK MemcardSettingsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar if (um_num == 0) { + wcscpy_s(Memcard_filename[0], _countof(Memcard_filename[0]), buf); UI::Jdi.SetConfigBool(MemcardA_Connected_Key, Memcard_Connected[0], USER_MEMCARDS); UI::Jdi.SetConfigString(MemcardA_Filename_Key, Util::WstringToString(Memcard_filename[0]), USER_MEMCARDS); } else { + wcscpy_s(Memcard_filename[1], _countof(Memcard_filename[1]), buf); UI::Jdi.SetConfigBool(MemcardB_Connected_Key, Memcard_Connected[1], USER_MEMCARDS); UI::Jdi.SetConfigString(MemcardB_Filename_Key, Util::WstringToString(Memcard_filename[1]), USER_MEMCARDS); }