diff --git a/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp b/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp index efeeeacd9..8d9ec77df 100644 --- a/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp +++ b/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp @@ -251,7 +251,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, // char FileName[_MAX_PATH],Directory[_MAX_PATH]; // memset(&FileName, 0, sizeof(FileName)); // memset(&openfilename, 0, sizeof(openfilename)); -// strcpy(Directory,g_Settings->LoadString(ApplicationDir).c_str()); +// strcpy(Directory,g_Settings->LoadStringVal(ApplicationDir).c_str()); // openfilename.lStructSize = sizeof( openfilename ); // openfilename.hwndOwner = hDlg; // openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0"; @@ -334,7 +334,7 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, CLog LogFile; if (!LogFile.Open(FileName)) { - g_Notify->DisplayError(L"Failed to open\n%s",FileName); + g_Notify->DisplayError(stdstr_f("Failed to open\n%s",FileName).ToUTF16().c_str()); return false; } LogFile.SetFlush(false); @@ -489,7 +489,7 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, // memset(&FileName, 0, sizeof(FileName)); // memset(&openfilename, 0, sizeof(openfilename)); // -// strcpy(Directory,g_Settings->LoadString(ApplicationDir).c_str()); +// strcpy(Directory,g_Settings->LoadStringVal(ApplicationDir).c_str()); // // openfilename.lStructSize = sizeof( openfilename ); // openfilename.hwndOwner = hDlg; diff --git a/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp b/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp index a94c8283b..62596c765 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp @@ -87,7 +87,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) default: if (g_Settings->LoadBool(Debugger_Enabled)) { - g_Notify->DisplayError(L"Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC); + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); } return true; } @@ -118,7 +118,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) default: if (g_Settings->LoadBool(Debugger_Enabled)) { - g_Notify->DisplayError(L"Does %s effect Delay slot at %X?\n6",R4300iOpcodeName(Command.Hex,PC+4), PC); + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n6",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); } return true; } @@ -127,7 +127,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) { if (g_Settings->LoadBool(Debugger_Enabled)) { - g_Notify->DisplayError(L"Does %s effect Delay slot at %X?\n7",R4300iOpcodeName(Command.Hex,PC+4), PC); + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n7",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); } return true; } @@ -156,7 +156,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) default: if (g_Settings->LoadBool(Debugger_Enabled)) { - g_Notify->DisplayError(L"Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC); + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); } return true; } @@ -204,7 +204,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) default: if (g_Settings->LoadBool(Debugger_Enabled)) { - g_Notify->DisplayError(L"Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC); + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); } return true; } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp index 90d78b08c..ee5934aac 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp @@ -891,7 +891,7 @@ void R4300iOp32::LB() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LB TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -912,7 +912,7 @@ void R4300iOp32::LH() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LH TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -933,7 +933,7 @@ void R4300iOp32::LWL() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); return; @@ -960,7 +960,7 @@ void R4300iOp32::LW() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LW TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -977,7 +977,7 @@ void R4300iOp32::LBU() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LBU TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -998,7 +998,7 @@ void R4300iOp32::LHU() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LHU TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1020,7 +1020,7 @@ void R4300iOp32::LWR() g_Notify->BreakPoint(__FILEW__,__LINE__); if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1041,7 +1041,7 @@ void R4300iOp32::LWU() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWU TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1064,7 +1064,7 @@ void R4300iOp32::LL() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp index d5cddf7d9..cbdce8121 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp @@ -1012,7 +1012,7 @@ void R4300iOp::LDL() g_Notify->BreakPoint(__FILEW__,__LINE__); if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LDL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1039,7 +1039,7 @@ void R4300iOp::LDR() g_Notify->BreakPoint(__FILEW__,__LINE__); if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LDR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1056,7 +1056,7 @@ void R4300iOp::LB() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LB TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1077,7 +1077,7 @@ void R4300iOp::LH() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LH TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1099,7 +1099,7 @@ void R4300iOp::LWL() g_Notify->BreakPoint(__FILEW__,__LINE__); if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1125,7 +1125,7 @@ void R4300iOp::LW() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LW TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1142,7 +1142,7 @@ void R4300iOp::LBU() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LBU TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1163,7 +1163,7 @@ void R4300iOp::LHU() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LHU TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1185,7 +1185,7 @@ void R4300iOp::LWR() g_Notify->BreakPoint(__FILEW__,__LINE__); if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1206,7 +1206,7 @@ void R4300iOp::LWU() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWU TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1227,7 +1227,7 @@ void R4300iOp::SB() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SB TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1247,7 +1247,7 @@ void R4300iOp::SH() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SH TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1267,7 +1267,7 @@ void R4300iOp::SWL() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SWL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1283,7 +1283,7 @@ void R4300iOp::SWL() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SWL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1308,7 +1308,7 @@ void R4300iOp::SW() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SW TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1339,7 +1339,7 @@ void R4300iOp::SDL() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SDL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1355,7 +1355,7 @@ void R4300iOp::SDL() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SDL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1387,7 +1387,7 @@ void R4300iOp::SDR() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SDR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1403,7 +1403,7 @@ void R4300iOp::SDR() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SDR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1423,7 +1423,7 @@ void R4300iOp::SWR() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SWR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1439,7 +1439,7 @@ void R4300iOp::SWR() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SWR TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1466,7 +1466,7 @@ void R4300iOp::LL() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LL TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1489,7 +1489,7 @@ void R4300iOp::LWC1() { if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LWC1 TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } TLB_READ_EXCEPTION(Address); } @@ -1510,7 +1510,7 @@ void R4300iOp::SC() g_Notify->BreakPoint(__FILEW__,__LINE__); if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SC TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1532,7 +1532,7 @@ void R4300iOp::LD() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LD TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } return; } @@ -1562,7 +1562,7 @@ void R4300iOp::LDC1() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"LDC1 TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1584,7 +1584,7 @@ void R4300iOp::SWC1() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SWC1 TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1606,7 +1606,7 @@ void R4300iOp::SDC1() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SDC1 TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -1626,7 +1626,7 @@ void R4300iOp::SD() } if (bShowTLBMisses()) { - g_Notify->DisplayError(L"SD TLB: %X",Address); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); } } } @@ -2559,7 +2559,7 @@ void R4300iOp::COP1_S_CMP() { if (bHaveDebugger()) { - g_Notify->DisplayError(L"Signal InvalidOperationException\nin r4300i_COP1_S_CMP\n%X %ff\n%X %ff", Temp0,Temp0,Temp1,Temp1); + g_Notify->DisplayError(stdstr_f("Signal InvalidOperationException\nin r4300i_COP1_S_CMP\n%X %ff\n%X %ff", Temp0,Temp0,Temp1,Temp1).ToUTF16().c_str()); } } } @@ -2828,8 +2828,8 @@ void R4300iOp::COP1_L_CVT_D() /************************** Other functions **************************/ void R4300iOp::UnknownOpcode() { - g_Notify->DisplayError(L"%s: %08X\n%s\n\nStopping Emulation !", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER), - R4300iOpcodeName(m_Opcode.Hex,(*_PROGRAM_COUNTER))); + g_Notify->DisplayError(stdstr_f("%s: %08X\n%s\n\nStopping Emulation !", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER), + R4300iOpcodeName(m_Opcode.Hex,(*_PROGRAM_COUNTER))).ToUTF16().c_str()); g_System->m_EndEmulation = true; g_Notify->BreakPoint(__FILEW__,__LINE__); diff --git a/Source/Project64/N64 System/Mips/Dma.cpp b/Source/Project64/N64 System/Mips/Dma.cpp index 57287e002..2ecf4e835 100644 --- a/Source/Project64/N64 System/Mips/Dma.cpp +++ b/Source/Project64/N64 System/Mips/Dma.cpp @@ -28,7 +28,7 @@ void CDMA::OnFirstDMA() case CIC_NUS_6103: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; case CIC_NUS_6105: *(DWORD *)&((g_MMU->Rdram())[0x3F0]) = g_MMU->RdramSize(); break; case CIC_NUS_6106: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; - default: g_Notify->DisplayError(L"Unhandled CicChip(%d) in first DMA",g_Rom->CicChipID()); + default: g_Notify->DisplayError(stdstr_f("Unhandled CicChip(%d) in first DMA",g_Rom->CicChipID()).ToUTF16().c_str()); } } @@ -46,7 +46,7 @@ void CDMA::PI_DMA_READ() { if (bHaveDebugger()) { - g_Notify->DisplayError(L"PI_DMA_READ not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG); + g_Notify->DisplayError(stdstr_f("PI_DMA_READ not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG).ToUTF16().c_str()); } g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; g_Reg->MI_INTR_REG |= MI_INTR_PI; @@ -134,7 +134,7 @@ void CDMA::PI_DMA_READ() } if (g_System->m_SaveUsing == SaveChip_FlashRam) { - g_Notify->DisplayError(L"**** FLashRam DMA Read address %08X *****",g_Reg->PI_CART_ADDR_REG); + g_Notify->DisplayError(stdstr_f("**** FLashRam DMA Read address %08X *****",g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str()); g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; g_Reg->MI_INTR_REG |= MI_INTR_PI; g_Reg->CheckInterrupts(); @@ -142,7 +142,7 @@ void CDMA::PI_DMA_READ() } if (bHaveDebugger()) { - g_Notify->DisplayError(L"PI_DMA_READ where are you dmaing to ?: %08X", g_Reg->PI_CART_ADDR_REG); + g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you dmaing to ? : %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str()); } g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; g_Reg->MI_INTR_REG |= MI_INTR_PI; @@ -162,7 +162,7 @@ void CDMA::PI_DMA_WRITE() g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY; if ( g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize()) { - if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(L"PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG); } + if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).ToUTF16().c_str()); } g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; g_Reg->MI_INTR_REG |= MI_INTR_PI; g_Reg->CheckInterrupts(); @@ -271,7 +271,7 @@ void CDMA::PI_DMA_WRITE() if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"PI_DMA_WRITE not in ROM: %08X", g_Reg->PI_CART_ADDR_REG); + g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in ROM: %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str()); } g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; g_Reg->MI_INTR_REG |= MI_INTR_PI; @@ -287,7 +287,7 @@ void CDMA::SP_DMA_READ() { if (bHaveDebugger()) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nSP_DRAM_ADDR_REG not in RDRam space: %08X", g_Reg->SP_DRAM_ADDR_REG); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", g_Reg->SP_DRAM_ADDR_REG).ToUTF16().c_str()); } g_Reg->SP_DMA_BUSY_REG = 0; g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY; @@ -329,7 +329,7 @@ void CDMA::SP_DMA_WRITE() { if (bHaveDebugger()) { - g_Notify->DisplayError(L"SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space: %08X", g_Reg->SP_DRAM_ADDR_REG); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", g_Reg->SP_DRAM_ADDR_REG).ToUTF16().c_str()); } return; } diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp index 91e355011..d5b76e522 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp @@ -597,7 +597,7 @@ void CMipsMemoryVM::Compile_LB(x86Reg Reg, DWORD VAddr, bool SignExtend) CPU_Message("Compile_LB\nFailed to translate address %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_LB\nFailed to translate address %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address %08X",VAddr).ToUTF16().c_str()); } return; } @@ -627,7 +627,7 @@ void CMipsMemoryVM::Compile_LB(x86Reg Reg, DWORD VAddr, bool SignExtend) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_LB\nFailed to compile address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to compile address: %08X",VAddr).ToUTF16().c_str()); } } } @@ -668,7 +668,7 @@ void CMipsMemoryVM::Compile_LH(x86Reg Reg, DWORD VAddr, bool SignExtend) CPU_Message("Compile_LH\nFailed to translate address %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_LH\nFailed to translate address %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address %08X",VAddr).ToUTF16().c_str()); } return; } @@ -698,7 +698,7 @@ void CMipsMemoryVM::Compile_LH(x86Reg Reg, DWORD VAddr, bool SignExtend) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_LHU\nFailed to compile address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to compile address: %08X", VAddr).ToUTF16().c_str()); } } } @@ -765,7 +765,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; @@ -790,7 +790,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) case 0x0430000C: MoveVariableToX86reg(&g_Reg->MI_INTR_MASK_REG,"MI_INTR_MASK_REG",Reg); break; default: MoveConstToX86reg(0,Reg); - if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); } + if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; case 0x04400000: @@ -810,7 +810,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; @@ -865,7 +865,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; @@ -885,7 +885,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; @@ -898,7 +898,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; @@ -910,7 +910,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) MoveConstToX86reg(0,Reg); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } break; @@ -931,7 +931,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { CPU_Message(__FUNCTION__ "\nFailed to translate address: %08X",VAddr); - g_Notify->DisplayError(__FUNCTIONW__ L"\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } } } @@ -959,7 +959,7 @@ void CMipsMemoryVM::Compile_SB_Const ( BYTE Value, DWORD VAddr ) if (!TranslateVaddr(VAddr, PAddr)) { CPU_Message("Compile_SB\nFailed to translate address: %08X",VAddr); - if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(L"Compile_SB\nFailed to translate address: %08X",VAddr); } + if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X",VAddr).ToUTF16().c_str()); } return; } @@ -979,7 +979,7 @@ void CMipsMemoryVM::Compile_SB_Const ( BYTE Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SB_Const\ntrying to store %02X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %02X in %08X?",Value,VAddr).ToUTF16().c_str()); } } } @@ -1009,7 +1009,7 @@ void CMipsMemoryVM::Compile_SB_Register ( x86Reg Reg, DWORD VAddr ) CPU_Message("Compile_SB\nFailed to translate address: %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SB\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X", VAddr).ToUTF16().c_str()); } return; } @@ -1030,7 +1030,7 @@ void CMipsMemoryVM::Compile_SB_Register ( x86Reg Reg, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SB_Register\ntrying to store in %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } } @@ -1057,7 +1057,7 @@ void CMipsMemoryVM::Compile_SH_Const ( WORD Value, DWORD VAddr ) CPU_Message("Compile_SH\nFailed to translate address: %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SH\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X", VAddr).ToUTF16().c_str()); } return; } @@ -1078,7 +1078,7 @@ void CMipsMemoryVM::Compile_SH_Const ( WORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\ntrying to store %04X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %04X in %08X?",Value,VAddr).ToUTF16().c_str()); } } } @@ -1107,7 +1107,7 @@ void CMipsMemoryVM::Compile_SH_Register ( x86Reg Reg, DWORD VAddr ) CPU_Message("Compile_SH\nFailed to translate address: %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SH\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X", VAddr).ToUTF16().c_str()); } return; } @@ -1128,7 +1128,7 @@ void CMipsMemoryVM::Compile_SH_Register ( x86Reg Reg, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(__FUNCTIONW__ L"\ntrying to store in %08X?",PAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", PAddr).ToUTF16().c_str()); } } } @@ -1157,7 +1157,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) CPU_Message("Compile_SW\nFailed to translate address: %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X", VAddr).ToUTF16().c_str()); } return; } @@ -1197,7 +1197,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1238,7 +1238,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1256,7 +1256,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1374,7 +1374,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1432,7 +1432,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1475,7 +1475,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) MoveConstToVariable(Value,PAddr + m_RDRAM,VarName); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1515,7 +1515,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1529,7 +1529,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %X in %X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1568,7 +1568,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } } break; @@ -1589,7 +1589,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Const\ntrying to store %08X in %08X?",Value,VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store %08X in %08X?", Value, VAddr).ToUTF16().c_str()); } m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount()-g_System->CountPerOp()); UpdateCounters(m_RegWorkingSet,false,true); @@ -1630,7 +1630,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) CPU_Message("Compile_SW_Register\nFailed to translate address: %08X",VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\nFailed to translate address: %08X",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nFailed to translate address: %08X", VAddr).ToUTF16().c_str()); } return; } @@ -1692,7 +1692,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) CPU_Message(" Should be moving %s in to %08X ?!?",x86_Name(Reg),VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } } @@ -1730,7 +1730,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) CPU_Message(" Should be moving %s in to %08X ?!?",x86_Name(Reg),VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } break; @@ -1791,7 +1791,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) CPU_Message(" Should be moving %s in to %08X ?!?",x86_Name(Reg),VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } break; @@ -1835,7 +1835,11 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) default: sprintf(VarName,"m_RDRAM + %X",PAddr); MoveX86regToVariable(Reg,PAddr + m_RDRAM,VarName); - if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); } } + if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); + } + } break; case 0x04600000: switch (PAddr) @@ -1857,7 +1861,10 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) AfterCallDirect(m_RegWorkingSet); break; case 0x04600010: - if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); } + if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); + } AndConstToVariable((DWORD)~MI_INTR_PI,&g_Reg->MI_INTR_REG,"MI_INTR_REG"); BeforeCallDirect(m_RegWorkingSet); MoveConstToX86reg((DWORD)g_Reg,x86_ECX); @@ -1884,7 +1891,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) CPU_Message(" Should be moving %s in to %08X ?!?",x86_Name(Reg),VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } break; @@ -1895,7 +1902,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } break; @@ -1926,7 +1933,10 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) AfterCallDirect(m_RegWorkingSet); break; default: - if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store at %08X?",VAddr); } + if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); + } } break; case 0x1FC00000: @@ -1937,7 +1947,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) CPU_Message(" Should be moving %s in to %08X ?!?",x86_Name(Reg),VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Compile_SW_Register\ntrying to store in %08X?",VAddr); + g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\ntrying to store in %08X?", VAddr).ToUTF16().c_str()); } } } @@ -2172,9 +2182,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2184,9 +2194,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to load half word\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2196,9 +2206,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2208,9 +2218,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to load half word\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to load half word\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2231,9 +2241,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to half word\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to half word\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2243,8 +2253,8 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to store half word\n\nMIPS Address: %08X\nX86 Address: %08X",MemAddress, - (unsigned char *)lpEP->ContextRecord->Eip); + g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2261,8 +2271,8 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) if (!SH_NonMemory(MemAddress,*(WORD *)ReadPos)) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to store half word\n\nMIPS Address: %08X\nX86 Address: %08X",MemAddress, - (unsigned char *)lpEP->ContextRecord->Eip); + g_Notify->DisplayError(stdstr_f("Failed to store half word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 2); @@ -2280,9 +2290,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to store byte\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2292,9 +2302,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to load byte\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2304,9 +2314,9 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to load word\n\nMIPS Address: %08X\nX86 Address: %08X", + g_Notify->DisplayError(stdstr_f("Failed to load word\n\nMIPS Address: %08X\nX86 Address: %08X", (char *)exRec.ExceptionInformation[1] - (char *)m_RDRAM, - (unsigned char *)lpEP->ContextRecord->Eip); + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2316,8 +2326,8 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to store word\n\nMIPS Address: %08X\nX86 Address: %08X",MemAddress, - (unsigned char *)lpEP->ContextRecord->Eip); + g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)ReadPos; @@ -2335,8 +2345,8 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to store byte\n\nMIPS Address: %08X\nX86 Address: %08X",MemAddress, - (unsigned char *)lpEP->ContextRecord->Eip); + g_Notify->DisplayError(stdstr_f("Failed to store byte\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 1); @@ -2354,8 +2364,8 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (g_Settings->LoadDword(Debugger_ShowUnhandledMemory)) { - g_Notify->DisplayError(L"Failed to store word\n\nMIPS Address: %08X\nX86 Address: %08X",MemAddress, - (unsigned char *)lpEP->ContextRecord->Eip); + g_Notify->DisplayError(stdstr_f("Failed to store word\n\nMIPS Address: %08X\nX86 Address: %08X", MemAddress, + (unsigned char *)lpEP->ContextRecord->Eip).ToUTF16().c_str()); } } lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 4); diff --git a/Source/Project64/N64 System/Mips/Pif Ram.cpp b/Source/Project64/N64 System/Mips/Pif Ram.cpp index b355985d3..d581937ad 100644 --- a/Source/Project64/N64 System/Mips/Pif Ram.cpp +++ b/Source/Project64/N64 System/Mips/Pif Ram.cpp @@ -135,7 +135,7 @@ void CPifRam::PifRamRead() { if (bShowPifRamErrors()) { - g_Notify->DisplayError(L"Unknown Command in PifRamRead(%X)",m_PifRam[CurPos]); + g_Notify->DisplayError(stdstr_f("Unknown Command in PifRamRead(%X)",m_PifRam[CurPos]).ToUTF16().c_str()); } CurPos = 0x40; } @@ -200,7 +200,7 @@ void CPifRam::PifRamWrite() default: if (bShowPifRamErrors()) { - g_Notify->DisplayError(L"Unkown PifRam control: %d",m_PifRam[0x3F]); + g_Notify->DisplayError(stdstr_f("Unkown PifRam control: %d",m_PifRam[0x3F]).ToUTF16().c_str()); } } return; @@ -255,7 +255,7 @@ void CPifRam::PifRamWrite() { if (bShowPifRamErrors()) { - g_Notify->DisplayError(L"Unknown Command in PifRamWrite(%X)",m_PifRam[CurPos]); + g_Notify->DisplayError(stdstr_f("Unknown Command in PifRamWrite(%X)",m_PifRam[CurPos]).ToUTF16().c_str()); } CurPos = 0x40; } @@ -599,7 +599,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command) default: if (bShowPifRamErrors()) { - g_Notify->DisplayError(L"Unknown ControllerCommand %d",Command[2]); + g_Notify->DisplayError(stdstr_f("Unknown ControllerCommand %d",Command[2]).ToUTF16().c_str()); } } } diff --git a/Source/Project64/N64 System/Mips/Register Class.cpp b/Source/Project64/N64 System/Mips/Register Class.cpp index 1fc9dfa5d..f3bc474d5 100644 --- a/Source/Project64/N64 System/Mips/Register Class.cpp +++ b/Source/Project64/N64 System/Mips/Register Class.cpp @@ -518,7 +518,7 @@ void CRegisters::DoTLBReadMiss(bool DelaySlot, DWORD BadVaddr) { if (bHaveDebugger()) { - g_Notify->DisplayError(L"TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,g_TLB->AddressDefined(BadVaddr)?"TRUE":"FALSE"); + g_Notify->DisplayError(stdstr_f("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,g_TLB->AddressDefined(BadVaddr)?"TRUE":"FALSE").ToUTF16().c_str()); } m_PROGRAM_COUNTER = 0x80000180; } diff --git a/Source/Project64/N64 System/Mips/System Events.cpp b/Source/Project64/N64 System/Mips/System Events.cpp index 2bd74cb24..ff8b9a4e5 100644 --- a/Source/Project64/N64 System/Mips/System Events.cpp +++ b/Source/Project64/N64 System/Mips/System Events.cpp @@ -122,7 +122,7 @@ void CSystemEvents::ExecuteEvents() ChangePluginFunc(); break; case SysEvent_ChangingFullScreen: - g_Notify->ChangeFullScreen(); + Notify().ChangeFullScreen(); break; case SysEvent_GSButtonPressed: if (m_System->m_Cheats.CheatsSlectionChanged()) diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index 39a8caf71..fd897c26e 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -27,7 +27,6 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) : m_MMU_VM(this,SavesReadOnly), m_TLB(this), m_Reg(this,this), - m_FPS(g_Notify), m_Recomp(NULL), m_InReset(false), m_NextTimer(0), @@ -947,14 +946,14 @@ void CN64System::ExecuteRecompiler() void CN64System::ExecuteSyncCPU() { - g_Notify->BringToTop(); + Notify().BringToTop(); m_Recomp->Run(); } void CN64System::CpuStopped() { g_Settings->SaveBool(GameRunning_CPU_Running,(DWORD)false); - g_Notify->WindowMode(); + Notify().WindowMode(); if (!m_InReset) { if (m_hPauseEvent) @@ -963,12 +962,12 @@ void CN64System::CpuStopped() m_hPauseEvent = NULL; } - g_Notify->RefreshMenu(); - g_Notify->MakeWindowOnTop(false); + Notify().RefreshMenu(); + Notify().MakeWindowOnTop(false); g_Notify->DisplayMessage(5,MSG_EMULATION_ENDED); if (g_Settings->LoadDword(RomBrowser_Enabled)) { - g_Notify->ShowRomBrowser(); + Notify().ShowRomBrowser(); } } if (m_SyncCPU) diff --git a/Source/Project64/N64 System/N64 Rom Class.cpp b/Source/Project64/N64 System/N64 Rom Class.cpp index 30b6390fe..dd2569dc3 100644 --- a/Source/Project64/N64 System/N64 Rom Class.cpp +++ b/Source/Project64/N64 System/N64 Rom Class.cpp @@ -75,7 +75,7 @@ bool CN64Rom::AllocateAndLoadN64Image ( const char * FileLoc, bool LoadBootCodeO TotalRead += dwRead; //Show Message of how much % wise of the rom has been loaded - g_Notify->DisplayMessage(0,L"%s: %.2f%c",GS(MSG_LOADED),((float)TotalRead/(float)RomFileSize) * 100.0f,'%'); + g_Notify->DisplayMessage(0,stdstr_f("%s: %.2f%c",GS(MSG_LOADED),((float)TotalRead/(float)RomFileSize) * 100.0f,'%').ToUTF16().c_str()); } dwRead = TotalRead; @@ -159,7 +159,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl TotalRead += dwRead; //Show Message of how much % wise of the rom has been loaded - g_Notify->DisplayMessage(5,L"%s: %.2f%c",GS(MSG_LOADED),((float)TotalRead/(float)RomFileSize) * 100.0f,'%'); + g_Notify->DisplayMessage(5,stdstr_f("%s: %.2f%c",GS(MSG_LOADED),((float)TotalRead/(float)RomFileSize) * 100.0f,'%').ToUTF16().c_str()); } dwRead = TotalRead + 4; @@ -222,7 +222,7 @@ void CN64Rom::ByteSwapRom() { break; case 0x80371240: break; default: - g_Notify->DisplayError(L"ByteSwapRom: %X",m_ROMImage[0]); + g_Notify->DisplayError(stdstr_f("ByteSwapRom: %X",m_ROMImage[0]).ToUTF16().c_str()); } } @@ -250,7 +250,9 @@ void CN64Rom::CalculateCicChip() case 0x000000D2E53EF008: m_CicChip = CIC_NUS_8303; break; //64DD IPL default: if (bHaveDebugger()) - g_Notify->DisplayError(L"Unknown CIC checksum:\n%I64X.", CRC); + { + g_Notify->DisplayError(stdstr_f("Unknown CIC checksum:\n%I64X.", CRC).ToUTF16().c_str()); + } m_CicChip = CIC_UNKNOWN; break; } @@ -353,7 +355,7 @@ bool CN64Rom::IsValidRomImage ( BYTE Test[4] ) { void CN64Rom::NotificationCB ( LPCWSTR Status, CN64Rom * /*_this*/ ) { - g_Notify->DisplayMessage(5,L"%s",Status); + g_Notify->DisplayMessage(5,stdstr_f("%s",Status).ToUTF16().c_str()); } bool CN64Rom::LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly ) { diff --git a/Source/Project64/N64 System/Profiling Class.cpp b/Source/Project64/N64 System/Profiling Class.cpp index b8b7def8e..367ba545f 100644 --- a/Source/Project64/N64 System/Profiling Class.cpp +++ b/Source/Project64/N64 System/Profiling Class.cpp @@ -103,11 +103,11 @@ void CProfiling::ShowCPU_Usage() { TotalTime = CPU + Alist + Dlist + Idle; - g_Notify->DisplayMessage(0,L"r4300i: %0.1f%c GFX: %0.1f%c Alist: %0.1f%c Idle: %0.1f%c", + g_Notify->DisplayMessage(0,stdstr_f("r4300i: %0.1f%c GFX: %0.1f%c Alist: %0.1f%c Idle: %0.1f%c", (float)(((double)CPU / (double)TotalTime) * 100),'%', (float)(((double)Dlist / (double)TotalTime) * 100),'%', (float)(((double)Alist / (double)TotalTime) * 100),'%', - (float)(((double)Idle / (double)TotalTime) * 100),'%'); + (float)(((double)Idle / (double)TotalTime) * 100),'%').ToUTF16().c_str()); ResetCounters(); } diff --git a/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp b/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp index fae3636e5..e8ebe7760 100644 --- a/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp +++ b/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp @@ -503,29 +503,32 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section) break; case R4300i_COP0_MT: break; default: - if ( (m_Command.rs & 0x10 ) != 0 ) { - switch( m_Command.funct ) { + if ( (m_Command.rs & 0x10 ) != 0 ) + { + switch( m_Command.funct ) + { case R4300i_COP0_CO_TLBR: break; case R4300i_COP0_CO_TLBWI: break; case R4300i_COP0_CO_TLBWR: break; case R4300i_COP0_CO_TLBP: break; case R4300i_COP0_CO_ERET: m_NextInstruction = END_BLOCK; break; default: - g_Notify->DisplayError(L"Unhandled R4300i OpCode in FillSectionInfo\n%s", - R4300iOpcodeName(m_Command.Hex,m_PC)); + g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo\n%s",R4300iOpcodeName(m_Command.Hex,m_PC)).ToUTF16().c_str()); m_NextInstruction = END_BLOCK; m_PC -= 4; } - } else { - g_Notify->DisplayError(L"Unhandled R4300i OpCode in FillSectionInfo 3\n%s", - R4300iOpcodeName(m_Command.Hex,m_PC)); + } + else + { + g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo 3\n%s",R4300iOpcodeName(m_Command.Hex,m_PC)).ToUTF16().c_str()); m_NextInstruction = END_BLOCK; m_PC -= 4; } } break; case R4300i_CP1: - switch (m_Command.fmt) { + switch (m_Command.fmt) + { case R4300i_COP1_CF: case R4300i_COP1_MF: case R4300i_COP1_DMF: @@ -594,8 +597,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section) case R4300i_COP1_W: break; case R4300i_COP1_L: break; default: - g_Notify->DisplayError(L"Unhandled R4300i OpCode in FillSectionInfo 2\n%s", - R4300iOpcodeName(m_Command.Hex,m_PC)); + g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo 2\n%s",R4300iOpcodeName(m_Command.Hex,m_PC)).ToUTF16().c_str()); m_NextInstruction = END_BLOCK; m_PC -= 4; } @@ -689,8 +691,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section) if (m_Command.Hex == 0xF1F3F5F7) { break; } if (m_Command.Hex == 0xC1200000) { break; } if (m_Command.Hex == 0x4C5A5353) { break; } - g_Notify->DisplayError(L"Unhandled R4300i OpCode in FillSectionInfo 1\n%s\n%X", - R4300iOpcodeName(m_Command.Hex,m_PC),m_Command.Hex); + g_Notify->DisplayError(stdstr_f("Unhandled R4300i OpCode in FillSectionInfo 1\n%s\n%X",R4300iOpcodeName(m_Command.Hex,m_PC),m_Command.Hex).ToUTF16().c_str()); } CPU_Message(" %s state: %X value: %X",CRegName::GPR[5],m_Reg.GetMipsRegState(5),m_Reg.GetMipsRegLo(5)); diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp index 56fee2bbb..0a5aa6993 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp @@ -102,7 +102,7 @@ void CRecompiler::RecompilerMain_VirtualTable() m_Registers.DoTLBReadMiss(false,PC); if (!g_TransVaddr->ValidVaddr(PC)) { - g_Notify->DisplayError(L"Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PC); + g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PC).ToUTF16().c_str()); return; } continue; @@ -521,7 +521,7 @@ void CRecompiler::RecompilerMain_Lookup_TLB() m_Registers.DoTLBReadMiss(false,PROGRAM_COUNTER); if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr)) { - g_Notify->DisplayError(L"Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER); + g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER).ToUTF16().c_str()); m_EndEmulation = true; } continue; @@ -544,7 +544,9 @@ void CRecompiler::RecompilerMain_Lookup_TLB() JumpTable()[PhysicalAddr >> 2] = info; } (info->Function())(); - } else { + } + else + { DWORD opsExecuted = 0; while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize()) @@ -621,7 +623,7 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB() m_Registers.DoTLBReadMiss(false,PROGRAM_COUNTER); if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr)) { - g_Notify->DisplayError(L"Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER); + g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER).ToUTF16().c_str()); m_EndEmulation = true; } continue; diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Memory.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Memory.cpp index b51136af6..b119c6449 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Memory.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Memory.cpp @@ -88,5 +88,5 @@ void CRecompMemory::ShowMemUsed() DWORD TotalAvaliable = m_RecompSize / 0x100000; - g_Notify->DisplayMessage(0,L"Memory used: %d mb %-3d kb %-3d bytes Total Available: %d mb",MB,KB,Size, TotalAvaliable); + g_Notify->DisplayMessage(0,stdstr_f("Memory used: %d mb %-3d kb %-3d bytes Total Available: %d mb",MB,KB,Size, TotalAvaliable).ToUTF16().c_str()); } diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp index 6d76a1dfe..eb9ecb840 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp @@ -295,7 +295,7 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc, } else { if (bHaveDebugger()) { - g_Notify->DisplayError(L"WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction); + g_Notify->DisplayError(stdstr_f("WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction).ToUTF16().c_str()); } } } @@ -415,7 +415,7 @@ void CRecompilerOps::Compile_BranchLikely (BranchFunction CompareFunc, bool Link m_Section->GenerateSectionLinkage(); m_NextInstruction = END_BLOCK; } else if (bHaveDebugger()) { - g_Notify->DisplayError(L"WTF\n\nBranchLikely\nNextInstruction = %X", m_NextInstruction); + g_Notify->DisplayError(stdstr_f("WTF\n\nBranchLikely\nNextInstruction = %X", m_NextInstruction).ToUTF16().c_str()); } } @@ -1338,11 +1338,12 @@ void CRecompilerOps::J() { m_Section->GenerateSectionLinkage(); m_NextInstruction = END_BLOCK; } else if (bHaveDebugger()) { - g_Notify->DisplayError(L"WTF\n\nJ\nNextInstruction = %X", m_NextInstruction); + g_Notify->DisplayError(stdstr_f("WTF\n\nJ\nNextInstruction = %X", m_NextInstruction).ToUTF16().c_str()); } } -void CRecompilerOps::JAL() { +void CRecompilerOps::JAL() +{ if ( m_NextInstruction == NORMAL ) { CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); @@ -1763,7 +1764,7 @@ void CRecompilerOps::CACHE(){ default: if (bHaveDebugger()) { - g_Notify->DisplayError(L"cache: %d",m_Opcode.rt); + g_Notify->DisplayError(stdstr_f("cache: %d",m_Opcode.rt).ToUTF16().c_str()); } } } @@ -1957,16 +1958,26 @@ void CRecompilerOps::SPECIAL_JR() { } } m_NextInstruction = DO_DELAY_SLOT; - } else if (m_NextInstruction == DELAY_SLOT_DONE) { - if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) { + } + else if (m_NextInstruction == DELAY_SLOT_DONE) + { + if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) + { m_Section->CompileExit(m_CompilePC, (DWORD)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL); - } else { + } + else + { UpdateCounters(m_RegWorkingSet,true,true); - if (IsConst(m_Opcode.rs)) { + if (IsConst(m_Opcode.rs)) + { MoveConstToVariable(GetMipsRegLo(m_Opcode.rs), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else if (IsMapped(m_Opcode.rs)) { + } + else if (IsMapped(m_Opcode.rs)) + { MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else { + } + else + { MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); } m_Section->CompileExit((DWORD)-1, (DWORD)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL); @@ -1976,8 +1987,10 @@ void CRecompilerOps::SPECIAL_JR() { } } m_NextInstruction = END_BLOCK; - } else if (bHaveDebugger()) { - g_Notify->DisplayError(L"WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction); + } + else if (bHaveDebugger()) + { + g_Notify->DisplayError(stdstr_f("WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction).ToUTF16().c_str()); } } @@ -1988,11 +2001,16 @@ void CRecompilerOps::SPECIAL_JALR() CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0) && (m_CompilePC & 0xFFC) != 0xFFC) { - if (IsConst(m_Opcode.rs)) { + if (IsConst(m_Opcode.rs)) + { MoveConstToVariable(GetMipsRegLo(m_Opcode.rs), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else if (IsMapped(m_Opcode.rs)) { + } + else if (IsMapped(m_Opcode.rs)) + { MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else { + } + else + { MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); } } @@ -2001,10 +2019,13 @@ void CRecompilerOps::SPECIAL_JALR() m_RegWorkingSet.SetMipsRegState(m_Opcode.rd,CRegInfo::STATE_CONST_32_SIGN); if ((m_CompilePC & 0xFFC) == 0xFFC) { - if (IsMapped(m_Opcode.rs)) { + if (IsMapped(m_Opcode.rs)) + { MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs), &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation"); m_RegWorkingSet.WriteBackRegisters(); - } else { + } + else + { m_RegWorkingSet.WriteBackRegisters(); MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation"); } @@ -2020,16 +2041,26 @@ void CRecompilerOps::SPECIAL_JALR() m_Section->m_Cont.LinkLocation2 = NULL; m_NextInstruction = DO_DELAY_SLOT; - } else if (m_NextInstruction == DELAY_SLOT_DONE ) { - if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) { + } + else if (m_NextInstruction == DELAY_SLOT_DONE ) + { + if (DelaySlotEffectsCompare(m_CompilePC,m_Opcode.rs,0)) + { m_Section->CompileExit(m_CompilePC, (DWORD)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL); - } else { + } + else + { UpdateCounters(m_RegWorkingSet,true,true); - if (IsConst(m_Opcode.rs)) { + if (IsConst(m_Opcode.rs)) + { MoveConstToVariable(GetMipsRegLo(m_Opcode.rs), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else if (IsMapped(m_Opcode.rs)) { + } + else if (IsMapped(m_Opcode.rs)) + { MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); - } else { + } + else + { MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER"); } m_Section->CompileExit((DWORD)-1, (DWORD)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL); @@ -2039,18 +2070,22 @@ void CRecompilerOps::SPECIAL_JALR() } } m_NextInstruction = END_BLOCK; - } else if (bHaveDebugger()) { - g_Notify->DisplayError(L"WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction); + } + else if (bHaveDebugger()) + { + g_Notify->DisplayError(stdstr_f("WTF\n\nBranch\nNextInstruction = %X", m_NextInstruction).ToUTF16().c_str()); } } -void CRecompilerOps::SPECIAL_SYSCALL() { +void CRecompilerOps::SPECIAL_SYSCALL() +{ CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); m_Section->CompileExit(m_CompilePC, (DWORD)-1, m_RegWorkingSet, CExitInfo::DoSysCall, true, NULL); m_NextInstruction = END_BLOCK; } -void CRecompilerOps::SPECIAL_MFLO() { +void CRecompilerOps::SPECIAL_MFLO() +{ CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); if (m_Opcode.rd == 0) { return; } @@ -2059,28 +2094,44 @@ void CRecompilerOps::SPECIAL_MFLO() { MoveVariableToX86reg(&_RegLO->UW[1],"_RegLO->UW[1]",GetMipsRegMapHi(m_Opcode.rd)); } -void CRecompilerOps::SPECIAL_MTLO() { +void CRecompilerOps::SPECIAL_MTLO() +{ CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); - if (IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) { - if (Is64Bit(m_Opcode.rs)) { + if (IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) + { + if (Is64Bit(m_Opcode.rs)) + { MoveConstToVariable(GetMipsRegHi(m_Opcode.rs),&_RegLO->UW[1],"_RegLO->UW[1]"); - } else if (IsSigned(m_Opcode.rs) && ((GetMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) { + } + else if (IsSigned(m_Opcode.rs) && ((GetMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) + { MoveConstToVariable(0xFFFFFFFF,&_RegLO->UW[1],"_RegLO->UW[1]"); - } else { + } + else + { MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]"); } MoveConstToVariable(GetMipsRegLo(m_Opcode.rs), &_RegLO->UW[0],"_RegLO->UW[0]"); - } else if (IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) { - if (Is64Bit(m_Opcode.rs)) { + } + else if (IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) + { + if (Is64Bit(m_Opcode.rs)) + { MoveX86regToVariable(GetMipsRegMapHi(m_Opcode.rs),&_RegLO->UW[1],"_RegLO->UW[1]"); - } else if (IsSigned(m_Opcode.rs)) { + } + else if (IsSigned(m_Opcode.rs)) + { MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, true), &_RegLO->UW[1], "_RegLO->UW[1]"); - } else { + } + else + { MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]"); } MoveX86regToVariable(GetMipsRegMapLo(m_Opcode.rs), &_RegLO->UW[0],"_RegLO->UW[0]"); - } else { + } + else + { x86Reg reg = Map_TempReg(x86_Any, m_Opcode.rs, true); MoveX86regToVariable(reg,&_RegLO->UW[1],"_RegLO->UW[1]"); MoveX86regToVariable(Map_TempReg(reg, m_Opcode.rs, false), &_RegLO->UW[0], "_RegLO->UW[0]"); diff --git a/Source/Project64/N64 System/Recompiler/Reg Info.cpp b/Source/Project64/N64 System/Recompiler/Reg Info.cpp index 8fe097cca..672e864b9 100644 --- a/Source/Project64/N64 System/Recompiler/Reg Info.cpp +++ b/Source/Project64/N64 System/Recompiler/Reg Info.cpp @@ -337,7 +337,7 @@ void CRegInfo::Load_FPR_ToTop ( int Reg, int RegToLoad, FPU_STATE Format) fpuLoadQwordFromX86Reg(&StackTopPos(),TempReg); break; default: - if (bHaveDebugger()) { g_Notify->DisplayError(L"Load_FPR_ToTop\nUnkown format to load %d",Format); } + if (bHaveDebugger()) { g_Notify->DisplayError(stdstr_f("Load_FPR_ToTop\nUnkown format to load %d",Format).ToUTF16().c_str()); } } SetX86Protected(TempReg, false); FpuRoundingModel(StackTopPos()) = RoundDefault; @@ -979,7 +979,7 @@ void CRegInfo::UnMap_FPR (int Reg, int WriteBackValue ) fpuStoreQwordFromX86Reg(&StackTopPos(),TempReg, true); break; default: - if (bHaveDebugger()) { g_Notify->DisplayError(__FUNCTIONW__ L"\nUnknown format to load %d",x86fpu_State[StackTopPos()]); } + if (bHaveDebugger()) { g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nUnknown format to load %d",x86fpu_State[StackTopPos()]).ToUTF16().c_str()); } } SetX86Protected(TempReg, false); FpuRoundingModel(RegPos) = RoundDefault; diff --git a/Source/Project64/Settings/Notification Settings.cpp b/Source/Project64/Settings/Notification Settings.cpp index bccd89f04..dad717a84 100644 --- a/Source/Project64/Settings/Notification Settings.cpp +++ b/Source/Project64/Settings/Notification Settings.cpp @@ -14,8 +14,6 @@ bool CNotificationSettings::m_bInFullScreen = false; CNotificationSettings::CNotificationSettings() { - g_Settings->RegisterChangeCB(UserInterface_InFullScreen,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); - RefreshSettings(); } CNotificationSettings::~CNotificationSettings() @@ -26,6 +24,12 @@ CNotificationSettings::~CNotificationSettings() } } +void CNotificationSettings::RegisterNotifications() +{ + g_Settings->RegisterChangeCB(UserInterface_InFullScreen, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + RefreshSettings(); +} + void CNotificationSettings::RefreshSettings() { m_bInFullScreen = g_Settings->LoadBool(UserInterface_InFullScreen); diff --git a/Source/Project64/Settings/Notification Settings.h b/Source/Project64/Settings/Notification Settings.h index 5c4f0963a..5e75da155 100644 --- a/Source/Project64/Settings/Notification Settings.h +++ b/Source/Project64/Settings/Notification Settings.h @@ -25,5 +25,6 @@ protected: CNotificationSettings(); virtual ~CNotificationSettings(); + void RegisterNotifications (void); inline bool InFullScreen ( void ) const { return m_bInFullScreen; } }; diff --git a/Source/Project64/User Interface/Frame Per Second Class.cpp b/Source/Project64/User Interface/Frame Per Second Class.cpp index bf7a26262..3228a31cc 100644 --- a/Source/Project64/User Interface/Frame Per Second Class.cpp +++ b/Source/Project64/User Interface/Frame Per Second Class.cpp @@ -10,8 +10,7 @@ ****************************************************************************/ #include "stdafx.h" -CFramePerSecond::CFramePerSecond (CNotification * Notification): - g_Notify(Notification) +CFramePerSecond::CFramePerSecond () { m_iFrameRateType = g_Settings->LoadDword(UserInterface_FrameDisplayType); m_ScreenHertz = g_Settings->LoadDword(GameRunning_ScreenHertz); @@ -25,7 +24,7 @@ CFramePerSecond::CFramePerSecond (CNotification * Notification): LARGE_INTEGER Freq; QueryPerformanceFrequency(&Freq); - Frequency = Freq.QuadPart; + m_Frequency = Freq.QuadPart; Reset(true); } @@ -37,12 +36,12 @@ CFramePerSecond::~CFramePerSecond() void CFramePerSecond::Reset (bool ClearDisplay) { - CurrentFrame = 0; - LastFrame = 0; + m_CurrentFrame = 0; + m_LastFrame = 0; for (int count = 0; count < NoOfFrames; count ++) { - Frames[count] = 0; + m_Frames[count] = 0; } if (ClearDisplay) { @@ -62,14 +61,15 @@ void CFramePerSecond::UpdateViCounter ( void ) { return; } - if ((CurrentFrame & 7) == 0) { + if ((m_CurrentFrame & 7) == 0) + { LARGE_INTEGER Time; QueryPerformanceCounter(&Time); - Frames[(CurrentFrame >> 3) % NoOfFrames] = Time.QuadPart - LastFrame; - LastFrame = Time.QuadPart; + m_Frames[(m_CurrentFrame >> 3) % NoOfFrames] = Time.QuadPart - m_LastFrame; + m_LastFrame = Time.QuadPart; DisplayViCounter(0); } - CurrentFrame += 1; + m_CurrentFrame += 1; } void CFramePerSecond::DisplayViCounter(DWORD FrameRate) @@ -78,20 +78,20 @@ void CFramePerSecond::DisplayViCounter(DWORD FrameRate) { if (FrameRate != 0) { - g_Notify->DisplayMessage2(L"VI/s: %d.00", FrameRate); + g_Notify->DisplayMessage2(stdstr_f("VI/s: %d.00", FrameRate).ToUTF16().c_str()); } else { - if (CurrentFrame > (NoOfFrames << 3)) + if (m_CurrentFrame > (NoOfFrames << 3)) { __int64 Total; Total = 0; for (int count = 0; count < NoOfFrames; count ++) { - Total += Frames[count]; + Total += m_Frames[count]; } - g_Notify->DisplayMessage2(L"VI/s: %.2f", Frequency/ ((double)Total / (NoOfFrames << 3))); + g_Notify->DisplayMessage2(stdstr_f("VI/s: %.2f", m_Frequency / ((double)Total / (NoOfFrames << 3))).ToUTF16().c_str()); } else { @@ -108,16 +108,16 @@ void CFramePerSecond::DisplayViCounter(DWORD FrameRate) } else { - if (CurrentFrame > (NoOfFrames << 3)) + if (m_CurrentFrame > (NoOfFrames << 3)) { __int64 Total; Total = 0; for (int count = 0; count < NoOfFrames; count ++) { - Total += Frames[count]; + Total += m_Frames[count]; } - Percent = ((float)(Frequency/ ((double)Total / (NoOfFrames << 3)))) / m_ScreenHertz; + Percent = ((float)(m_Frequency / ((double)Total / (NoOfFrames << 3)))) / m_ScreenHertz; } else { @@ -125,13 +125,13 @@ void CFramePerSecond::DisplayViCounter(DWORD FrameRate) return; } } - g_Notify->DisplayMessage2(L"%.1f %%",Percent * 100); + g_Notify->DisplayMessage2(stdstr_f("%.1f %%",Percent * 100).ToUTF16().c_str()); } } void CFramePerSecond::FrameRateTypeChanged (CFramePerSecond * _this) { - _this->m_iFrameRateType = g_Settings->LoadDword(UserInterface_FrameDisplayType); + _this->m_iFrameRateType = g_Settings->LoadDword(UserInterface_FrameDisplayType); _this->Reset(true); } @@ -147,33 +147,41 @@ void CFramePerSecond::UpdateDlCounter ( void ) { return; } - if ((CurrentFrame & 3) == 0) { + if ((m_CurrentFrame & 3) == 0) { LARGE_INTEGER Time; QueryPerformanceCounter(&Time); - Frames[(CurrentFrame >> 2) % NoOfFrames] = Time.QuadPart - LastFrame; - LastFrame = Time.QuadPart; + m_Frames[(m_CurrentFrame >> 2) % NoOfFrames] = Time.QuadPart - m_LastFrame; + m_LastFrame = Time.QuadPart; DisplayDlCounter(0); } - CurrentFrame += 1; + m_CurrentFrame += 1; } -void CFramePerSecond::DisplayDlCounter(DWORD FrameRate) { +void CFramePerSecond::DisplayDlCounter(DWORD FrameRate) +{ if (m_iFrameRateType != FR_DLs) { return; } - if (FrameRate != 0) { - g_Notify->DisplayMessage2(L"DL/s: %d.00", FrameRate); - } else { - if (CurrentFrame > (NoOfFrames << 2)) { + if (FrameRate != 0) + { + g_Notify->DisplayMessage2(stdstr_f("DL/s: %d.00", FrameRate).ToUTF16().c_str()); + } + else + { + if (m_CurrentFrame > (NoOfFrames << 2)) + { __int64 Total; Total = 0; - for (int count = 0; count < NoOfFrames; count ++) { - Total += Frames[count]; + for (int count = 0; count < NoOfFrames; count ++) + { + Total += m_Frames[count]; } - g_Notify->DisplayMessage2(L"DL/s: %.1f", Frequency/ ((double)Total / (NoOfFrames << 2))); - } else { + g_Notify->DisplayMessage2(stdstr_f("DL/s: %.1f", m_Frequency / ((double)Total / (NoOfFrames << 2))).ToUTF16().c_str()); + } + else + { g_Notify->DisplayMessage2(L"DL/s: -.--"); } } diff --git a/Source/Project64/User Interface/Frame Per Second Class.h b/Source/Project64/User Interface/Frame Per Second Class.h index bbb32cbbf..0525fe4b0 100644 --- a/Source/Project64/User Interface/Frame Per Second Class.h +++ b/Source/Project64/User Interface/Frame Per Second Class.h @@ -10,21 +10,10 @@ ****************************************************************************/ #pragma once -class CFramePerSecond { - CNotification * const g_Notify; - int m_iFrameRateType, m_ScreenHertz; - - enum { NoOfFrames = 7 }; - - __int64 Frequency, Frames[NoOfFrames], LastFrame; - int CurrentFrame; - - static void FrameRateTypeChanged (CFramePerSecond * _this); - static void ScreenHertzChanged (CFramePerSecond * _this); - - +class CFramePerSecond +{ public: - CFramePerSecond ( CNotification * Notification ); + CFramePerSecond ( void ); ~CFramePerSecond ( void ); void Reset ( bool ClearDisplay ); @@ -33,5 +22,15 @@ public: void UpdateViCounter ( void ); void DisplayDlCounter ( DWORD FrameRate ); void DisplayViCounter ( DWORD FrameRate ); -// void ClearDisplay ( void ); + +private: + static void FrameRateTypeChanged(CFramePerSecond * _this); + static void ScreenHertzChanged(CFramePerSecond * _this); + + int m_iFrameRateType, m_ScreenHertz; + + enum { NoOfFrames = 7 }; + + __int64 m_Frequency, m_Frames[NoOfFrames], m_LastFrame; + int m_CurrentFrame; }; diff --git a/Source/Project64/User Interface/Main Menu Class.h b/Source/Project64/User Interface/Main Menu Class.h index cb7ce9f54..880c36208 100644 --- a/Source/Project64/User Interface/Main Menu Class.h +++ b/Source/Project64/User Interface/Main Menu Class.h @@ -1,4 +1,7 @@ -enum MainMenuID { +#pragma once + +enum MainMenuID +{ //File Menu ID_FILE_OPEN_ROM = 4000, ID_FILE_ROM_INFO, ID_FILE_STARTEMULATION, ID_FILE_ENDEMULATION, ID_FILE_ROMDIRECTORY, ID_FILE_REFRESHROMLIST, ID_FILE_EXIT, diff --git a/Source/Project64/User Interface/Notification Class.cpp b/Source/Project64/User Interface/Notification Class.cpp index d13e1fd1a..bb758782c 100644 --- a/Source/Project64/User Interface/Notification Class.cpp +++ b/Source/Project64/User Interface/Notification Class.cpp @@ -15,6 +15,11 @@ CNotification::CNotification() : _tzset(); } +void CNotification::AppInitDone(void) +{ + CNotificationSettings::RegisterNotifications(); +} + void CNotification::SetMainWindow ( CMainGui * Gui ) { m_hWnd = Gui; @@ -43,23 +48,17 @@ void CNotification::WindowMode ( void ) const InsideFunc = false; } -void CNotification::DisplayError ( const wchar_t * Message, ... ) const +void CNotification::DisplayError(LanguageStringID StringID) const { - va_list ap; - va_start( ap, Message ); - DisplayError (Message,ap); + DisplayError(g_Lang->GetString(StringID).c_str()); } -void CNotification::DisplayError ( const wchar_t * Message, va_list ap ) const +void CNotification::DisplayError(const wchar_t * Message) const { if (this == NULL) { return; } - wchar_t Msg[1000]; - - _vsnwprintf( Msg,sizeof(Msg) - 1,Message, ap ); - va_end( ap ); stdstr TraceMessage; - TraceMessage.FromUTF16(Msg); + TraceMessage.FromUTF16(Message); WriteTrace(TraceError,TraceMessage.c_str()); WindowMode(); @@ -68,17 +67,15 @@ void CNotification::DisplayError ( const wchar_t * Message, va_list ap ) const { Parent = m_hWnd->GetHandle(); } - MessageBoxW(Parent,Msg,GS(MSG_MSGBOX_TITLE),MB_OK|MB_ICONERROR|MB_SETFOREGROUND); + MessageBoxW(Parent, Message, GS(MSG_MSGBOX_TITLE), MB_OK | MB_ICONERROR | MB_SETFOREGROUND); } -void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message, ... ) const +void CNotification::DisplayMessage(int DisplayTime, LanguageStringID StringID) const { - va_list ap; - va_start( ap, Message ); - DisplayMessage (DisplayTime, Message,ap); + DisplayMessage(DisplayTime, g_Lang->GetString(StringID).c_str()); } -void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message, va_list ap ) const +void CNotification::DisplayMessage(int DisplayTime, const wchar_t * Message) const { if (!m_hWnd) { return; } @@ -97,13 +94,7 @@ void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message, { m_NextMsg = 0; } - } - - wchar_t Msg[1000]; - - _vsnwprintf( Msg,sizeof(Msg) - 1,Message, ap ); - va_end( ap ); - + } if (InFullScreen()) { @@ -111,7 +102,7 @@ void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message, { WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Starting"); stdstr PluginMessage; - PluginMessage.FromUTF16(Msg); + PluginMessage.FromUTF16(Message); m_gfxPlugin->DrawStatus(PluginMessage.c_str(), FALSE); WriteTrace(TraceGfxPlugin,__FUNCTION__ ": DrawStatus - Done"); } @@ -119,30 +110,19 @@ void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message, else { #if defined(WINDOWS_UI) - m_hWnd->SetStatusText(0, Msg); + m_hWnd->SetStatusText(0, Message); #else g_Notify -> BreakPoint(__FILEW__, __LINE__); #endif } } -void CNotification::DisplayMessage2 ( const wchar_t * Message, ... ) const -{ - va_list ap; - va_start( ap, Message ); - DisplayMessage2 (Message,ap); -} - -void CNotification::DisplayMessage2 ( const wchar_t * Message, va_list ap ) const +void CNotification::DisplayMessage2 ( const wchar_t * Message ) const { if (!m_hWnd) { return; } - wchar_t Msg[1000]; - _vsnwprintf( Msg,sizeof(Msg) - 1 ,Message, ap ); - va_end( ap ); - #if defined(WINDOWS_UI) - m_hWnd->SetStatusText(1,Msg); + m_hWnd->SetStatusText(1, Message); #else g_Notify -> BreakPoint(__FILEW__, __LINE__); #endif @@ -167,19 +147,18 @@ void CNotification::SetWindowCaption (const wchar_t * Caption) #endif } -void CNotification::FatalError ( const wchar_t * Message, ... ) const +void CNotification::FatalError(LanguageStringID StringID) const { - wchar_t Msg[1000]; - va_list ap; + FatalError(g_Lang->GetString(StringID).c_str()); +} +void CNotification::FatalError(const wchar_t * Message) const +{ WindowMode(); - va_start( ap, Message ); - _vsnwprintf( Msg,(sizeof(Msg) / sizeof(Msg[0])) - 1, Message, ap ); - va_end( ap ); HWND Parent = NULL; if (m_hWnd) { Parent = reinterpret_cast(m_hWnd->GetHandle()); } - MessageBoxW(Parent,Msg,L"Error",MB_OK|MB_ICONERROR|MB_SETFOREGROUND); + MessageBoxW(Parent, Message, L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND); ExitThread(0); } @@ -338,7 +317,7 @@ void CNotification::BreakPoint ( const wchar_t * FileName, const int LineNumber { if (g_Settings->LoadBool(Debugger_Enabled)) { - DisplayError(L"Break point found at\n%s\n%d",FileName, LineNumber); + DisplayError(stdstr_f("Break point found at\n%s\n%d",FileName, LineNumber).ToUTF16().c_str()); if (IsDebuggerPresent() != 0) { DebugBreak(); diff --git a/Source/Project64/User Interface/Notification Class.h b/Source/Project64/User Interface/Notification Class.h index 8a7a2faf0..ed600f4f3 100644 --- a/Source/Project64/User Interface/Notification Class.h +++ b/Source/Project64/User Interface/Notification Class.h @@ -20,27 +20,25 @@ class CNotification : public: CNotification ( void ); + void AppInitDone ( void ); + // Make sure we are not in full screen void WindowMode ( void ) const; //Error Messages - void DisplayError ( const wchar_t * Message, ... ) const; - void DisplayError ( const wchar_t * Message, va_list ap ) const; - void DisplayError ( LanguageStringID StringID ) const { std::wstring str = g_Lang->GetString(StringID); DisplayError(str.c_str()); } - void FatalError ( const wchar_t * Message, ... ) const; - void FatalError ( const wchar_t * Message, va_list ap ) const; - void FatalError ( LanguageStringID StringID ) const { std::wstring str = g_Lang->GetString(StringID); FatalError(str.c_str()); } - + virtual void DisplayError(const wchar_t * Message) const; + virtual void DisplayError(LanguageStringID StringID) const; + + virtual void FatalError(const wchar_t * Message) const; + virtual void FatalError(LanguageStringID StringID) const; + //User Feedback - void DisplayMessage ( int DisplayTime, const wchar_t * Message, ... ) const; - void DisplayMessage ( int DisplayTime, const wchar_t * Message, va_list ap ) const; - void DisplayMessage ( int DisplayTime, LanguageStringID StringID ) const - { - std::wstring str = g_Lang->GetString(StringID); - DisplayMessage(DisplayTime,L"%s",str.c_str()); - } - void DisplayMessage2 ( const wchar_t * Message, ... ) const; - void DisplayMessage2 ( const wchar_t * Message, va_list ap ) const; + virtual void DisplayMessage(int DisplayTime, const wchar_t * Message) const; + virtual void DisplayMessage(int DisplayTime, LanguageStringID StringID) const; + + virtual void DisplayMessage2(const wchar_t * Message) const; + virtual void BreakPoint(const wchar_t * FileName, const int LineNumber); + void SetWindowCaption ( const wchar_t * Caption ); //Remember roms loaded and Rom Dir selected @@ -54,7 +52,6 @@ public: void ShowRomBrowser ( void ); void MakeWindowOnTop ( bool OnTop ); void BringToTop ( void ); - void BreakPoint ( const wchar_t * FileName, const int LineNumber); bool ProcessGuiMessages ( void ) const; void ChangeFullScreen ( void ) const; void SetGfxPlugin ( CGfxPlugin * Plugin );