Skip to content

Commit

Permalink
Added ability to debug multiple roms at the same time.
Browse files Browse the repository at this point in the history
  • Loading branch information
lab313ru committed Jul 15, 2023
1 parent 78ac664 commit b623fa0
Show file tree
Hide file tree
Showing 7 changed files with 8,322 additions and 8,274 deletions.
245 changes: 123 additions & 122 deletions Gens/include/g_main.h
Original file line number Diff line number Diff line change
@@ -1,122 +1,123 @@
#ifndef G_MAIN_H
#define G_MAIN_H

#define X_RES 320
#define Y_RES 240

#define TIMER_ID 1
#define TIMER_RATE 30

#include "stdio.h"
//#include "hackdefs.h"

#ifdef __cplusplus
extern "C" {
#endif

extern HINSTANCE ghInstance;
extern WNDCLASS WndClass;
extern HWND HWnd;
extern HWND RamWatchHWnd;
extern HWND RamSearchHWnd;
extern HWND PlaneExplorerHWnd;
extern HWND VDPRamHWnd;
#ifdef DEBUG_Z80
extern HWND YM2612DbgHWnd;
#endif
extern HWND VDPSpritesHWnd;
extern HMENU Gens_Menu;
extern HMENU Context_Menu;

extern int Paused;
extern int Current_State;
extern int Full_Screen;
extern int Fast_Blur;
extern int Render_W;
extern int Render_FS;
extern int Setting_Render;
extern int Show_FPS;
extern int Show_Message;
extern int Auto_Pause;
extern int Auto_Fix_CS;
extern int Country;
extern int Country_Order[3];
extern int WinNT_Flag;
extern int Gens_Priority;
extern int Intro_Style;
extern int DialogsOpen;
extern int SlowDownMode; //Modif
extern int VideoLatencyCompensation; // Modif N.
extern int disableVideoLatencyCompensationCount;
extern float ScaleFactor;

extern BOOL AutoFireKeyDown; //Modif N.
extern BOOL AutoHoldKeyDown; //Modif N.
extern BOOL AutoClearKeyDown; //Modif N.
extern BOOL PauseKeyDown; //Modif
extern BOOL FrameAdvanceKeyDown; //Modif
extern BOOL FastForwardKeyDown; // Modif N.
extern BOOL TurboToggle;
extern BOOL TurboMode;

extern int SlowDownSpeed; //Modif
extern int SkipKeyIsPressed; //Modif

extern int Disable_Blue_Screen; //Modif
extern int Never_Skip_Frame; //Modif
extern int FrameCounterEnabled; //Modif
extern int FrameCounterFrames; //Modif N.
extern int LagCounterEnabled; //Modif
extern int LagCounterFrames; //Modif N.
extern int LeftRightEnabled; //Modif
extern int NumLoadEnabled; //Modif N.
extern int ShowInputEnabled; //Modif
extern int AutoBackupEnabled; //Modif
#define FRAME_COUNTER_TOP_LEFT 5392
#define FRAME_COUNTER_TOP_RIGHT 5650
#define FRAME_COUNTER_BOTTOM_LEFT 67216
#define FRAME_COUNTER_BOTTOM_RIGHT 67470
extern int FrameCounterPosition; //Modif
extern int MustUpdateMenu; // Modif
extern unsigned char StateSelectCfg;
extern unsigned long SpliceFrame;
extern unsigned long SeekFrame;
extern char *TempName;
extern char SpliceMovie[1024];
extern char Str_Tmp[1024];
extern char Gens_Path[1024];
extern POINT Window_Pos;

extern int no_debug; // -nodebug cmdline flag

#define MAX_RECENT_SCRIPTS 15
extern char Recent_Scripts[MAX_RECENT_SCRIPTS][1024];

#ifdef __cplusplus
};
#endif

int Set_Render(HWND hWnd, int Full, int Num, int Force);
int Change_Layer(int Num); //Nitsuja added this
int Change_Sound(HWND hWnd);
int SaveFlags();
int IsVideoLatencyCompensationOn();

HMENU Build_Main_Menu(void);

void CloseRamWindows(); // So the close rom process can close the Ram Search and watch windows (thus preventing freezeout)
void Update_RAM_Search();
void ReopenRamWindows();
void LoadFlags(int flags);
void init_list_box(HWND Box, const char* Strs[], int numColumns, int *columnWidths);

#ifdef __cplusplus
const char* GensOpenScript(const char* filename, const char* extraDirToCheck = 0, bool makeSubservient = false); // returns NULL on success, returns error msg on failure
const char* GensPlayMovie(const char* filename, bool silent = false); // returns NULL on success, returns error msg on failure
const char* MakeRomPathAbsolute(const char* filename, const char* extraDirToCheck = 0);
#endif

int GensLoadRom(const char* filename); // returns positive on success, 0 on cancelled/ignorable failure, or negative on failure that clears or corrupts the emulation state
void GensOpenFile(const char* filename); // tries to open any supported type of file, guessing what it should be

#endif
#ifndef G_MAIN_H
#define G_MAIN_H

#define X_RES 320
#define Y_RES 240

#define TIMER_ID 1
#define TIMER_RATE 30

#include "stdio.h"
//#include "hackdefs.h"

#ifdef __cplusplus
extern "C" {
#endif

extern HINSTANCE ghInstance;
extern WNDCLASS WndClass;
extern HWND HWnd;
extern HWND RamWatchHWnd;
extern HWND RamSearchHWnd;
extern HWND PlaneExplorerHWnd;
extern HWND VDPRamHWnd;
#ifdef DEBUG_Z80
extern HWND YM2612DbgHWnd;
#endif
extern HWND VDPSpritesHWnd;
extern HMENU Gens_Menu;
extern HMENU Context_Menu;

extern int Paused;
extern int Current_State;
extern int Full_Screen;
extern int Fast_Blur;
extern int Render_W;
extern int Render_FS;
extern int Setting_Render;
extern int Show_FPS;
extern int Show_Message;
extern int Auto_Pause;
extern int Auto_Fix_CS;
extern int Country;
extern int Country_Order[3];
extern int WinNT_Flag;
extern int Gens_Priority;
extern int Intro_Style;
extern int DialogsOpen;
extern int SlowDownMode; //Modif
extern int VideoLatencyCompensation; // Modif N.
extern int disableVideoLatencyCompensationCount;
extern float ScaleFactor;

extern BOOL AutoFireKeyDown; //Modif N.
extern BOOL AutoHoldKeyDown; //Modif N.
extern BOOL AutoClearKeyDown; //Modif N.
extern BOOL PauseKeyDown; //Modif
extern BOOL FrameAdvanceKeyDown; //Modif
extern BOOL FastForwardKeyDown; // Modif N.
extern BOOL TurboToggle;
extern BOOL TurboMode;

extern int SlowDownSpeed; //Modif
extern int SkipKeyIsPressed; //Modif

extern int Disable_Blue_Screen; //Modif
extern int Never_Skip_Frame; //Modif
extern int FrameCounterEnabled; //Modif
extern int FrameCounterFrames; //Modif N.
extern int LagCounterEnabled; //Modif
extern int LagCounterFrames; //Modif N.
extern int LeftRightEnabled; //Modif
extern int NumLoadEnabled; //Modif N.
extern int ShowInputEnabled; //Modif
extern int AutoBackupEnabled; //Modif
#define FRAME_COUNTER_TOP_LEFT 5392
#define FRAME_COUNTER_TOP_RIGHT 5650
#define FRAME_COUNTER_BOTTOM_LEFT 67216
#define FRAME_COUNTER_BOTTOM_RIGHT 67470
extern int FrameCounterPosition; //Modif
extern int MustUpdateMenu; // Modif
extern unsigned char StateSelectCfg;
extern unsigned long SpliceFrame;
extern unsigned long SeekFrame;
extern char *TempName;
extern char SpliceMovie[1024];
extern char Str_Tmp[1024];
extern char Gens_Path[1024];
extern POINT Window_Pos;

extern int no_debug; // -nodebug cmdline flag
extern char DebugPort[256];

#define MAX_RECENT_SCRIPTS 15
extern char Recent_Scripts[MAX_RECENT_SCRIPTS][1024];

#ifdef __cplusplus
};
#endif

int Set_Render(HWND hWnd, int Full, int Num, int Force);
int Change_Layer(int Num); //Nitsuja added this
int Change_Sound(HWND hWnd);
int SaveFlags();
int IsVideoLatencyCompensationOn();

HMENU Build_Main_Menu(void);

void CloseRamWindows(); // So the close rom process can close the Ram Search and watch windows (thus preventing freezeout)
void Update_RAM_Search();
void ReopenRamWindows();
void LoadFlags(int flags);
void init_list_box(HWND Box, const char* Strs[], int numColumns, int *columnWidths);

#ifdef __cplusplus
const char* GensOpenScript(const char* filename, const char* extraDirToCheck = 0, bool makeSubservient = false); // returns NULL on success, returns error msg on failure
const char* GensPlayMovie(const char* filename, bool silent = false); // returns NULL on success, returns error msg on failure
const char* MakeRomPathAbsolute(const char* filename, const char* extraDirToCheck = 0);
#endif

int GensLoadRom(const char* filename); // returns positive on success, 0 on cancelled/ignorable failure, or negative on failure that clears or corrupts the emulation state
void GensOpenFile(const char* filename); // tries to open any supported type of file, guessing what it should be

#endif
139 changes: 70 additions & 69 deletions Gens/include/gens.h
Original file line number Diff line number Diff line change
@@ -1,69 +1,70 @@
#include "rom.h"

#ifndef _GENS_H
#define _GENS_H

#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */

#define GENS_RR_VERSION "Gens11"

#ifndef _DEBUG
#define SUB_STRING ""
#else
#define SUB_STRING " debug"
#endif

#define GENS_NAME GENS_RR_VERSION SUB_STRING

//#define CLOCK_NTSC 53700000 // More accurate for division round
//#define CLOCK_PAL 53200000

#define CLOCK_NTSC 53693175
#define CLOCK_PAL 53203424

extern int Frame_Skip;
extern int Frame_Number;
extern int Inside_Frame;
extern int RMax_Level;
extern int GMax_Level;
extern int BMax_Level;
extern int Contrast_Level;
extern int Brightness_Level;
extern int Greyscale;
extern int Invert_Color;
extern int FakeVDPScreen;
extern int VDP_Reg_Set2_Current;
extern int VDP_Reg_Set4_Current;

int Round_Double(double val);
void Recalculate_Palettes(void);
void Check_Country_Order(void);
void Detect_Country_Genesis(void);

void Init_Genesis_Bios(void);
int Init_Genesis(struct Rom *MD_Rom);
void Reset_Genesis();
int Do_VDP_Refresh(void);
int Do_Genesis_Frame_No_VDP(void);
int Do_Genesis_Frame(void);

BOOL IsAsyncAllowed(void);

#ifdef __cplusplus
}
#endif /* #ifdef __cplusplus */

// disable warnings about all common string operations being deprecated in newer VS versions
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma warning(disable : 4996)
#endif

#ifdef _MSC_VER
#define ALIGN16 __declspec(align(16)) // 16-byte alignment speeds up memcpy for size >= 0x100 (as of VS2005, if SSE2 is supported at runtime)
#else
#define ALIGN16 // __attribute__((aligned(16)))
#endif

#endif
#include "rom.h"

#ifndef _GENS_H
#define _GENS_H

#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */

#define GENS_RR_VERSION "Gens11"
#define GENS_CLASS_NAME "GensDebug"

#ifndef _DEBUG
#define SUB_STRING ""
#else
#define SUB_STRING " debug"
#endif

#define GENS_NAME GENS_RR_VERSION SUB_STRING

//#define CLOCK_NTSC 53700000 // More accurate for division round
//#define CLOCK_PAL 53200000

#define CLOCK_NTSC 53693175
#define CLOCK_PAL 53203424

extern int Frame_Skip;
extern int Frame_Number;
extern int Inside_Frame;
extern int RMax_Level;
extern int GMax_Level;
extern int BMax_Level;
extern int Contrast_Level;
extern int Brightness_Level;
extern int Greyscale;
extern int Invert_Color;
extern int FakeVDPScreen;
extern int VDP_Reg_Set2_Current;
extern int VDP_Reg_Set4_Current;

int Round_Double(double val);
void Recalculate_Palettes(void);
void Check_Country_Order(void);
void Detect_Country_Genesis(void);

void Init_Genesis_Bios(void);
int Init_Genesis(struct Rom *MD_Rom);
void Reset_Genesis();
int Do_VDP_Refresh(void);
int Do_Genesis_Frame_No_VDP(void);
int Do_Genesis_Frame(void);

BOOL IsAsyncAllowed(void);

#ifdef __cplusplus
}
#endif /* #ifdef __cplusplus */

// disable warnings about all common string operations being deprecated in newer VS versions
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma warning(disable : 4996)
#endif

#ifdef _MSC_VER
#define ALIGN16 __declspec(align(16)) // 16-byte alignment speeds up memcpy for size >= 0x100 (as of VS2005, if SSE2 is supported at runtime)
#else
#define ALIGN16 // __attribute__((aligned(16)))
#endif

#endif
Loading

0 comments on commit b623fa0

Please sign in to comment.