mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Merge pull request #3784 from unknownbrackets/debugger
Enable the debug windows always, disable buttons
This commit is contained in:
commit
06b2151939
@ -256,6 +256,7 @@ bool SymbolMap::LoadNocashSym(const char *filename)
|
||||
|
||||
int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask) const
|
||||
{
|
||||
lock_guard guard(lock_);
|
||||
for (size_t i = 0, n = entries.size(); i < n; i++)
|
||||
{
|
||||
const MapEntry &entry = entries[i];
|
||||
@ -278,6 +279,7 @@ int SymbolMap::GetSymbolNum(unsigned int address, SymbolType symmask) const
|
||||
|
||||
bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask) const
|
||||
{
|
||||
lock_guard guard(lock_);
|
||||
// entryRanges is indexed by end. The first entry after address should contain address.
|
||||
// Otherwise, we have no entry that contains it, unless things overlap (which they shouldn't.)
|
||||
const auto containingEntry = entryRanges.upper_bound(address);
|
||||
@ -314,6 +316,7 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask)
|
||||
|
||||
const char* SymbolMap::getDirectSymbol(u32 address)
|
||||
{
|
||||
lock_guard guard(lock_);
|
||||
SymbolInfo info;
|
||||
if (GetSymbolInfo(&info,address) == false) return NULL;
|
||||
if (info.address != address) return NULL; // has to be the START of the function
|
||||
@ -332,6 +335,7 @@ const char* SymbolMap::getDirectSymbol(u32 address)
|
||||
|
||||
bool SymbolMap::getSymbolValue(char* symbol, u32& dest)
|
||||
{
|
||||
lock_guard guard(lock_);
|
||||
for (auto it = entries.begin(), end = entries.end(); it != end; ++it)
|
||||
{
|
||||
const MapEntry &entry = *it;
|
||||
@ -479,6 +483,7 @@ void SymbolMap::FillListBoxBLinks(HWND listbox, int num) const
|
||||
|
||||
int SymbolMap::GetNumSymbols() const
|
||||
{
|
||||
lock_guard guard(lock_);
|
||||
return (int)entries.size();
|
||||
}
|
||||
SymbolType SymbolMap::GetSymbolType(int i) const
|
||||
@ -507,6 +512,7 @@ u32 SymbolMap::GetSymbolSize(int i) const
|
||||
|
||||
int SymbolMap::FindSymbol(const char *name) const
|
||||
{
|
||||
lock_guard guard(lock_);
|
||||
for (size_t i = 0; i < entries.size(); i++)
|
||||
if (strcmp(entries[i].name,name)==0)
|
||||
return (int) i;
|
||||
|
@ -18,10 +18,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Globals.h"
|
||||
#include "MemMap.h"
|
||||
#include "FileSystems/MetaFileSystem.h"
|
||||
#include "CoreParameter.h"
|
||||
#include "ELF/ParamSFO.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/FileSystems/MetaFileSystem.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
|
||||
extern MetaFileSystem pspFileSystem;
|
||||
extern ParamSFOData g_paramSFO;
|
||||
@ -38,6 +39,13 @@ enum GlobalUIState {
|
||||
|
||||
extern GlobalUIState globalUIState;
|
||||
|
||||
inline static void UpdateUIState(GlobalUIState newState) {
|
||||
if (globalUIState != newState) {
|
||||
globalUIState = newState;
|
||||
host->UpdateDisassembly();
|
||||
}
|
||||
}
|
||||
|
||||
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string);
|
||||
bool PSP_IsInited();
|
||||
void PSP_Shutdown();
|
||||
|
@ -166,11 +166,11 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
||||
bootGame(value);
|
||||
}
|
||||
else if (!strcmp(message, "control mapping")) {
|
||||
globalUIState = UISTATE_MENU;
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new ControlMappingScreen());
|
||||
}
|
||||
else if (!strcmp(message, "settings")) {
|
||||
globalUIState = UISTATE_MENU;
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new GameSettingsScreen(gamePath_));
|
||||
}
|
||||
}
|
||||
@ -423,7 +423,7 @@ void EmuScreen::update(InputState &input) {
|
||||
PSP_CoreParameter().pixelWidth = pixel_xres;
|
||||
PSP_CoreParameter().pixelHeight = pixel_yres;
|
||||
|
||||
globalUIState = UISTATE_INGAME;
|
||||
UpdateUIState(UISTATE_INGAME);
|
||||
|
||||
if (errorMessage_.size()) {
|
||||
I18NCategory *g = GetI18NCategory("Error");
|
||||
|
@ -559,18 +559,18 @@ void MainScreen::sendMessage(const char *message, const char *value) {
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
if (!strcmp(message, "control mapping")) {
|
||||
globalUIState = UISTATE_MENU;
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new ControlMappingScreen());
|
||||
}
|
||||
if (!strcmp(message, "settings")) {
|
||||
globalUIState = UISTATE_MENU;
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new GameSettingsScreen(""));
|
||||
}
|
||||
}
|
||||
|
||||
void MainScreen::update(InputState &input) {
|
||||
UIScreen::update(input);
|
||||
globalUIState = UISTATE_MENU;
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
}
|
||||
|
||||
UI::EventReturn MainScreen::OnLoadFile(UI::EventParams &e) {
|
||||
@ -665,7 +665,7 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
|
||||
}
|
||||
|
||||
void GamePauseScreen::update(InputState &input) {
|
||||
globalUIState = UISTATE_PAUSEMENU;
|
||||
UpdateUIState(UISTATE_PAUSEMENU);
|
||||
UIScreen::update(input);
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ UI::EventReturn CreditsScreen::OnOK(UI::EventParams &e) {
|
||||
|
||||
void CreditsScreen::update(InputState &input_state) {
|
||||
UIScreen::update(input_state);
|
||||
globalUIState = UISTATE_MENU;
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
if (input_state.pad_buttons_down & PAD_BUTTON_BACK) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ void CDisasm::changeSubWindow(SubWindowType type)
|
||||
|
||||
void CDisasm::stepInto()
|
||||
{
|
||||
if (Core_IsActive()) return;
|
||||
if (!Core_IsStepping()) return;
|
||||
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
lastTicks = CoreTiming::GetTicks();
|
||||
@ -790,7 +790,7 @@ void CDisasm::SetDebugMode(bool _bDebug)
|
||||
HWND hDlg = m_hDlg;
|
||||
|
||||
// Update Dialog Windows
|
||||
if (_bDebug)
|
||||
if (_bDebug && globalUIState == UISTATE_INGAME)
|
||||
{
|
||||
Core_WaitInactive(TEMP_BREAKPOINT_WAIT_MS);
|
||||
CBreakPoints::ClearTemporaryBreakPoints();
|
||||
@ -800,6 +800,7 @@ void CDisasm::SetDebugMode(bool _bDebug)
|
||||
updateThreadLabel(false);
|
||||
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), TRUE);
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEP), TRUE);
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), TRUE);
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEPHLE), TRUE);
|
||||
@ -819,7 +820,16 @@ void CDisasm::SetDebugMode(bool _bDebug)
|
||||
{
|
||||
updateThreadLabel(true);
|
||||
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
|
||||
if (globalUIState == UISTATE_INGAME)
|
||||
{
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Stop");
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STOPGO), FALSE);
|
||||
}
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEP), FALSE);
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), FALSE);
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEPHLE), FALSE);
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
virtual void Update()
|
||||
{
|
||||
UpdateDialog(true);
|
||||
SetDebugMode(Core_IsStepping());
|
||||
breakpointList->update();
|
||||
};
|
||||
void UpdateDialog(bool _bComplete = false);
|
||||
|
@ -8,11 +8,13 @@ Dialog::Dialog(LPCSTR res, HINSTANCE _hInstance, HWND _hParent)
|
||||
m_hInstance = _hInstance;
|
||||
m_hParent = _hParent;
|
||||
m_hResource=res;
|
||||
m_bValid = true;
|
||||
Create();
|
||||
}
|
||||
|
||||
Dialog::~Dialog()
|
||||
{
|
||||
m_bValid = false;
|
||||
Destroy();
|
||||
}
|
||||
|
||||
@ -38,7 +40,7 @@ void Dialog::Show(bool _bShow)
|
||||
INT_PTR Dialog::DlgProcStatic(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Dialog *dis = (Dialog*)GetWindowLongPtr(hdlg, GWLP_USERDATA);
|
||||
if (dis)
|
||||
if (dis && dis->m_bValid)
|
||||
return dis->DlgProc(message,wParam,lParam);
|
||||
else
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ protected:
|
||||
HWND m_hParent;
|
||||
HWND m_hDlg;
|
||||
LPCSTR m_hResource;
|
||||
bool m_bValid;
|
||||
|
||||
virtual BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -742,12 +742,10 @@ namespace MainWindow
|
||||
void CreateDebugWindows() {
|
||||
disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
||||
DialogManager::AddDlg(disasmWindow[0]);
|
||||
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
||||
disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
|
||||
|
||||
memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
|
||||
DialogManager::AddDlg(memoryWindow[0]);
|
||||
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
||||
}
|
||||
|
||||
void BrowseAndBoot(std::string defaultPath, bool browseDirectory) {
|
||||
@ -1071,9 +1069,6 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_EMULATION_STOP:
|
||||
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
||||
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
||||
|
||||
if (Core_IsStepping()) {
|
||||
// If the current PC is on a breakpoint, disabling stepping doesn't work without
|
||||
// explicitly skipping it
|
||||
@ -1085,9 +1080,6 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_EMULATION_RESET:
|
||||
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
||||
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
||||
|
||||
if (Core_IsStepping()) {
|
||||
// If the current PC is on a breakpoint, disabling stepping doesn't work without
|
||||
// explicitly skipping it
|
||||
@ -1100,9 +1092,6 @@ namespace MainWindow
|
||||
case ID_EMULATION_CHEATS:
|
||||
g_Config.bEnableCheats = !g_Config.bEnableCheats;
|
||||
osm.ShowOnOff(g->T("Cheats"), g_Config.bEnableCheats);
|
||||
|
||||
EnableWindow(disasmWindow[0]->GetDlgHandle(),FALSE);
|
||||
EnableWindow(memoryWindow[0]->GetDlgHandle(),FALSE);
|
||||
|
||||
if (Core_IsStepping()) {
|
||||
// If the current PC is on a breakpoint, disabling stepping doesn't work without
|
||||
@ -1283,12 +1272,10 @@ namespace MainWindow
|
||||
break;
|
||||
|
||||
case ID_DEBUG_DISASSEMBLY:
|
||||
EnableWindow(disasmWindow[0]->GetDlgHandle(),TRUE);
|
||||
disasmWindow[0]->Show(true);
|
||||
break;
|
||||
|
||||
case ID_DEBUG_MEMORYVIEW:
|
||||
EnableWindow(memoryWindow[0]->GetDlgHandle(),TRUE);
|
||||
memoryWindow[0]->Show(true);
|
||||
break;
|
||||
|
||||
@ -1492,9 +1479,6 @@ namespace MainWindow
|
||||
case WM_USER+1:
|
||||
if (g_Config.bFullScreen)
|
||||
_ViewFullScreen(hWnd);
|
||||
|
||||
EnableWindow (disasmWindow[0]->GetDlgHandle(),TRUE);
|
||||
EnableWindow (memoryWindow[0]->GetDlgHandle(),TRUE);
|
||||
|
||||
disasmWindow[0]->NotifyMapLoaded();
|
||||
memoryWindow[0]->NotifyMapLoaded();
|
||||
|
Loading…
Reference in New Issue
Block a user