@@ -490,10 +490,7 @@ void PCSX::Widgets::TypedDebugger::displayNode(WatchTreeNode* node, const uint32
490
490
printValue (nodeType, node->size , value);
491
491
ImGui::TableNextColumn (); // New value.
492
492
memFile->wSeek (startAddress, SEEK_SET);
493
- displayNewValueInput (nodeType, node->size , value, memFile);
494
- ImGui::PushStyleColor (ImGuiCol_Text, ImGui::GetStyle ().Colors [ImGuiCol_TextDisabled]);
495
- ImGui::TextUnformatted (" --" );
496
- ImGui::PopStyleColor ();
493
+ displayNewValueInput (nodeType, node->size , value, memFile, currentAddress);
497
494
ImGui::TableNextColumn (); // Breakpoints.
498
495
if (watchView) {
499
496
displayBreakpointOptions (node, currentAddress);
@@ -551,56 +548,61 @@ void PCSX::Widgets::TypedDebugger::printValue(const char* type, size_t type_size
551
548
// Make an input widget for the value at the given address of the given type. If
552
549
// type is not a known primitive, it'll try to allow editing of the value
553
550
// anyway.
554
- void PCSX::Widgets::TypedDebugger::displayNewValueInput (const char * type, size_t type_size, Slice value,
555
- IO<File> memFile) {
556
- static char s[64 ];
551
+ void PCSX::Widgets::TypedDebugger::displayNewValueInput (const char * type, size_t type_size, const Slice& value,
552
+ IO<File>& memFile, uint32_t address) {
557
553
static const int8_t step = 1 ;
558
554
static const int8_t stepFast = 100 ;
559
555
const auto signedFormat = m_hex ? " %x" : " %d" ;
560
556
const auto unsignedFormat = m_hex ? " %x" : " %u" ;
561
557
const auto inputFlags = m_hex ? ImGuiInputTextFlags_CharsHexadecimal : ImGuiInputTextFlags_CharsDecimal;
562
- const uint32_t address = memFile->rTell ();
563
558
564
559
switch (type_size) {
565
560
case 1 :
566
561
if (equals (type, " char" )) {
567
- if (ImGui::InputScalar (fmt::format (f_ (" New value##{}" ), address).c_str (), ImGuiDataType_S8, &m_newValue,
568
- &step, &stepFast, signedFormat, inputFlags)) {
569
- memFile->write <int8_t >(m_newValue);
562
+ m_newValues[address] = *value.data <int8_t >();
563
+ if (ImGui::InputScalar (fmt::format (f_ (" ##{}" ), address).c_str (), ImGuiDataType_S8,
564
+ &m_newValues[address], &step, &stepFast, signedFormat, inputFlags)) {
565
+ memFile->write <int8_t >(m_newValues[address]);
570
566
}
571
567
} else {
572
568
// We have a uchar or something of size 1.
573
- if (ImGui::InputScalar (fmt::format (f_ (" New value##{}" ), address).c_str (), ImGuiDataType_U8, &m_newValue,
574
- &step, &stepFast, unsignedFormat, inputFlags)) {
575
- memFile->write <uint8_t >(m_newValue);
569
+
570
+ m_newValues[address] = *value.data <uint8_t >();
571
+ if (ImGui::InputScalar (fmt::format (f_ (" ##{}" ), address).c_str (), ImGuiDataType_U8,
572
+ &m_newValues[address], &step, &stepFast, signedFormat, inputFlags)) {
573
+ memFile->write <uint8_t >(m_newValues[address]);
576
574
}
577
575
}
578
576
break ;
579
577
case 2 :
580
578
if (equals (type, " short" )) {
581
- if (ImGui::InputScalar (fmt::format (f_ (" New value##{}" ), address).c_str (), ImGuiDataType_S16,
582
- &m_newValue, &step, &stepFast, signedFormat, inputFlags)) {
583
- memFile->write <int16_t >(m_newValue);
579
+ m_newValues[address] = *value.data <int16_t >();
580
+ if (ImGui::InputScalar (fmt::format (f_ (" ##{}" ), address).c_str (), ImGuiDataType_S16,
581
+ &m_newValues[address], &step, &stepFast, signedFormat, inputFlags)) {
582
+ memFile->write <int16_t >(m_newValues[address]);
584
583
}
585
584
} else {
586
585
// We have a ushort or something of size 2.
587
- if (ImGui::InputScalar (fmt::format (f_ (" New value##{}" ), address).c_str (), ImGuiDataType_U16,
588
- &m_newValue, &step, &stepFast, unsignedFormat, inputFlags)) {
589
- memFile->write <uint16_t >(m_newValue);
586
+ m_newValues[address] = *value.data <uint16_t >();
587
+ if (ImGui::InputScalar (fmt::format (f_ (" ##{}" ), address).c_str (), ImGuiDataType_U16,
588
+ &m_newValues[address], &step, &stepFast, unsignedFormat, inputFlags)) {
589
+ memFile->write <uint16_t >(m_newValues[address]);
590
590
}
591
591
}
592
592
break ;
593
593
case 4 :
594
594
if (equals (type, " int" ) || equals (type, " long" )) {
595
- if (ImGui::InputScalar (fmt::format (f_ (" New value##{}" ), address).c_str (), ImGuiDataType_S32,
596
- &m_newValue, &step, &stepFast, signedFormat, inputFlags)) {
597
- memFile->write <int32_t >(m_newValue);
595
+ m_newValues[address] = *value.data <int32_t >();
596
+ if (ImGui::InputScalar (fmt::format (f_ (" ##{}" ), address).c_str (), ImGuiDataType_S32,
597
+ &m_newValues[address], &step, &stepFast, signedFormat, inputFlags)) {
598
+ memFile->write <int32_t >(m_newValues[address]);
598
599
}
599
600
} else {
600
601
// We have uint or something of size 4.
601
- if (ImGui::InputScalar (fmt::format (f_ (" New value##{}" ), address).c_str (), ImGuiDataType_U32,
602
- &m_newValue, &step, &stepFast, unsignedFormat, inputFlags)) {
603
- memFile->write <uint32_t >(m_newValue);
602
+ m_newValues[address] = *value.data <uint32_t >();
603
+ if (ImGui::InputScalar (fmt::format (f_ (" ##{}" ), address).c_str (), ImGuiDataType_U32,
604
+ &m_newValues[address], &step, &stepFast, unsignedFormat, inputFlags)) {
605
+ memFile->write <uint32_t >(m_newValues[address]);
604
606
}
605
607
}
606
608
break ;
0 commit comments