Files
kichikuou_xsystem35-sdl2/src/debugger_private.h
T
kichikuou 4b15f45897 debugger: Add custom DAP messages for communicating palette changes
This implements "xsystem35.palette" custom request and
"xsystem35.paletteChanged" custom event.

The "xsystem35.palette" request retrieves the color values of the AGS
palette.

  interface PaletteRequest extends Request {
    command: 'xsystem35.palette';
  }

  interface PaletteResponse extends Response {
    body: {
      /**
       * A number that increases each time the palette changes.
       */
      version: number;

      /**
       * 256 element array containing color values in 0xRRGGBB format.
       */
      palette: number[];
    };
  }

The "xsystem35.paletteChanged" event indicates that the AGS palette has
changed.

  interface PaletteChangedEvent extends Event {
    event: 'xsystem35.paletteChanged';

    body: {
      /**
       * A number that increases each time the palette changes.
       */
      version: number;
    };
  }

DAP clients can know if the received value is up to date by comparing
the `version` values of paletteChanged and PaletteResponse.
2023-12-08 08:35:45 +09:00

81 lines
2.2 KiB
C

/*
* Copyright (C) 2021 kichikuou <KichikuouChrome@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __DEBUGGER_PRIVATE_H__
#define __DEBUGGER_PRIVATE_H__
#include "portab.h"
#include "dri.h"
extern struct debug_symbols *symbols;
typedef struct {
int page;
int addr;
int refcnt;
uint8_t restore_op;
} PhysicalBreakpoint;
typedef struct breakpoint {
struct breakpoint *next;
PhysicalBreakpoint *phys;
int no;
char *condition;
dridata *dfile; // keeps modified scenario page alive in the cache
} Breakpoint;
typedef struct {
int page;
int addr;
const char *src;
int line;
const char *name;
} StackFrame;
typedef struct {
int nr_frame;
StackFrame frames[];
} StackTrace;
typedef struct {
void (*init)(const char *symbols_path);
void (*quit)(void);
void (*repl)(int bp_no);
void (*onsleep)(void);
void (*on_palette_change)(void);
void (*console_output)(int lv, const char *output);
} DebuggerImpl;
extern DebuggerImpl dbg_cui_impl;
extern DebuggerImpl dbg_dap_impl;
extern DebuggerImpl *dbg_impl;
Breakpoint *dbg_set_breakpoint(int page, int addr, boolean is_internal);
boolean dbg_delete_breakpoint(int no);
void dbg_delete_breakpoints_in_page(int page);
boolean dbg_set_breakpoint_condition(Breakpoint *bp, const char *condition, char *err, size_t errsize);
void dbg_stepin(void);
void dbg_stepout(void);
void dbg_next(void);
int dbg_lookup_var(const char *name);
boolean dbg_evaluate(const char *expr, char *result, size_t result_size);
StackTrace *dbg_stack_trace(void);
#endif // __DEBUGGER_PRIVATE_H__