46
46
47
47
#include " svnrev.h"
48
48
49
+ #include " debug.h"
50
+
51
+ #if MY_DEBUG || MY_DUMP
52
+ #define DEBUG_FILE_STR " hack"
53
+ #define DEBUG_DUMP_DIR " C:\\ Users\\ tchan\\ Desktop\\ ps2_debug\\ " DEBUG_FILE_STR " -dump-all"
54
+ #define DEBUG_RANGE_FILE_CALC " C:\\ Users\\ tchan\\ Desktop\\ log_files\\ pointsRange_" DEBUG_FILE_STR " _calc.txt"
55
+ #define DEBUG_RANGE_FILE_SW " C:\\ Users\\ tchan\\ Desktop\\ log_files\\ pointsRange_" DEBUG_FILE_STR " _sw.txt"
56
+ #define DEBUG_LIST_FILE_CALC " C:\\ Users\\ tchan\\ Desktop\\ log_files\\ pointsList_" DEBUG_FILE_STR " _calc_%d.txt"
57
+ #define DEBUG_LIST_FILE_SW " C:\\ Users\\ tchan\\ Desktop\\ log_files\\ pointsList_" DEBUG_FILE_STR " _sw_%d.txt"
58
+ #define DEBUG_ORIG_FILE_CALC " C:\\ Users\\ tchan\\ Desktop\\ log_files\\ pointsOrig_" DEBUG_FILE_STR " _calc_%d.txt"
59
+ #define DEBUG_ORIG_FILE_SW " C:\\ Users\\ tchan\\ Desktop\\ log_files\\ pointsOrig_" DEBUG_FILE_STR " _sw_%d.txt"
60
+
61
+ bool savePoints = false ;
62
+ bool dumpAll = true ;
63
+ int dump_frame_0 = 5072 ;
64
+ int dump_frame_1 = 5074 ;
65
+ int s_n_debug = -1 ;
66
+ int s_n_exit = -1 ;
67
+ int primID = 0 ;
68
+ int * primIDSW = 0 ;
69
+ std::map<int , std::tuple<int , int , int , int >> pointsCalcRange;
70
+ std::map<int , std::tuple<int , int , int , int >> pointsSWRange;
71
+ std::vector<std::tuple<int , int , int , int , int >> pointsCalcDebug;
72
+ std::vector<std::tuple<int , int , int , int , int >> pointsSWDebug;
73
+ std::map<std::tuple<int , int >, std::tuple<double , double , double , double >> pointsCalcDebugOrig;
74
+ std::map<std::tuple<int , int >, std::tuple<double , double , double , double >> pointsSWDebugOrig;
75
+ std::string debugDumpDir = DEBUG_DUMP_DIR;
76
+ #endif
77
+
49
78
namespace GSRunner
50
79
{
51
80
static void InitializeConsole ();
@@ -134,6 +163,20 @@ bool GSRunner::InitializeConfig()
134
163
si.SetBoolValue (" EmuCore/GS" , " OsdShowResolution" , true );
135
164
si.SetBoolValue (" EmuCore/GS" , " OsdShowGSStats" , true );
136
165
166
+ #if MY_DEBUG || MY_DUMP
167
+ if (dumpAll)
168
+ {
169
+ si.SetBoolValue (" EmuCore/GS" , " dump" , true );
170
+ si.SetIntValue (" EmuCore/GS" , " saven" , 0 );
171
+ si.SetIntValue (" EmuCore/GS" , " savel" , -1 );
172
+ si.SetBoolValue (" EmuCore/GS" , " save" , true );
173
+ si.SetBoolValue (" EmuCore/GS" , " savef" , true );
174
+ si.SetBoolValue (" EmuCore/GS" , " savet" , true );
175
+ si.SetBoolValue (" EmuCore/GS" , " savez" , true );
176
+ si.SetStringValue (" EmuCore/GS" , " HWDumpDirectory" , debugDumpDir.c_str ());
177
+ si.SetStringValue (" EmuCore/GS" , " SWDumpDirectory" , debugDumpDir.c_str ());
178
+ }
179
+ #endif
137
180
// remove memory cards, so we don't have sharing violations
138
181
for (u32 i = 0 ; i < 2 ; i++)
139
182
{
@@ -465,6 +508,7 @@ void GSRunner::InitializeConsole()
465
508
466
509
bool GSRunner::ParseCommandLineArgs (int argc, char * argv[], VMBootParameters& params)
467
510
{
511
+ std::string dumpdir; // Save from argument -dumpdir for creating sub-directories
468
512
bool no_more_args = false ;
469
513
for (int i = 1 ; i < argc; i++)
470
514
{
@@ -485,7 +529,7 @@ bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& pa
485
529
}
486
530
else if (CHECK_ARG_PARAM (" -dumpdir" ))
487
531
{
488
- s_output_prefix = StringUtil::StripWhitespace (argv[++i]);
532
+ dumpdir = s_output_prefix = StringUtil::StripWhitespace (argv[++i]);
489
533
if (s_output_prefix.empty ())
490
534
{
491
535
Console.Error (" Invalid dump directory specified." );
@@ -500,6 +544,74 @@ bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& pa
500
544
501
545
continue ;
502
546
}
547
+ else if (CHECK_ARG_PARAM (" -dump" ))
548
+ {
549
+ std::string str (argv[++i]);
550
+
551
+ s_settings_interface.SetBoolValue (" EmuCore/GS" , " dump" , true );
552
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " saven" , 0 );
553
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " savel" , -1 );
554
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " savenf" , 5000 ); // 5000 is the first frame
555
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " savelf" , -1 );
556
+
557
+ if (str.find (" rt" ) != std::string::npos)
558
+ s_settings_interface.SetBoolValue (" EmuCore/GS" , " save" , true );
559
+ if (str.find (" f" ) != std::string::npos)
560
+ s_settings_interface.SetBoolValue (" EmuCore/GS" , " savef" , true );
561
+ if (str.find (" tex" ) != std::string::npos)
562
+ s_settings_interface.SetBoolValue (" EmuCore/GS" , " savet" , true );
563
+ if (str.find (" z" ) != std::string::npos)
564
+ s_settings_interface.SetBoolValue (" EmuCore/GS" , " savez" , true );
565
+ continue ;
566
+ }
567
+ else if (CHECK_ARG_PARAM (" -dumprange" ))
568
+ {
569
+ std::string str (argv[++i]);
570
+
571
+ std::vector<std::string_view> split = StringUtil::SplitString (str, ' ,' );
572
+ int start = 0 ;
573
+ int num = -1 ;
574
+ if (split.size () > 0 )
575
+ {
576
+ start = StringUtil::FromChars<int >(split[0 ]).value_or (0 );
577
+ }
578
+ if (split.size () > 1 )
579
+ {
580
+ num = StringUtil::FromChars<int >(split[1 ]).value_or (-1 );
581
+ }
582
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " saven" , start);
583
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " savel" , num);
584
+ continue ;
585
+ }
586
+ else if (CHECK_ARG_PARAM (" -dumprangef" ))
587
+ {
588
+ std::string str (argv[++i]);
589
+
590
+ std::vector<std::string_view> split = StringUtil::SplitString (str, ' ,' );
591
+ int start = 0 ;
592
+ int num = -1 ;
593
+ if (split.size () > 0 )
594
+ {
595
+ start = StringUtil::FromChars<int >(split[0 ]).value_or (0 );
596
+ }
597
+ if (split.size () > 1 )
598
+ {
599
+ num = StringUtil::FromChars<int >(split[1 ]).value_or (-1 );
600
+ }
601
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " savenf" , start + 4999 ); // 5000 is the first frame
602
+ s_settings_interface.SetIntValue (" EmuCore/GS" , " savelf" , num);
603
+ continue ;
604
+ }
605
+ else if (CHECK_ARG_PARAM (" -dumpdirhw" ))
606
+ {
607
+ s_settings_interface.SetStringValue (" EmuCore/GS" , " HWDumpDirectory" , argv[++i]);
608
+ continue ;
609
+ }
610
+ else if (CHECK_ARG_PARAM (" -dumpdirsw" ))
611
+ {
612
+ s_settings_interface.SetStringValue (" EmuCore/GS" , " SWDumpDirectory" , argv[++i]);
613
+ continue ;
614
+ }
503
615
else if (CHECK_ARG_PARAM (" -loop" ))
504
616
{
505
617
s_loop_count = StringUtil::FromChars<s32>(argv[++i]).value_or (0 );
@@ -643,6 +755,14 @@ bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& pa
643
755
return false ;
644
756
}
645
757
758
+ if (s_settings_interface.GetBoolValue (" EmuCore/GS" , " dump" ) && !dumpdir.empty ())
759
+ {
760
+ if (s_settings_interface.GetStringValue (" EmuCore/GS" , " HWDumpDirectory" ).empty ())
761
+ s_settings_interface.SetStringValue (" EmuCore/GS" , " HWDumpDirectory" , dumpdir.c_str ());
762
+ if (s_settings_interface.GetStringValue (" EmuCore/GS" , " SWDumpDirectory" ).empty ())
763
+ s_settings_interface.SetStringValue (" EmuCore/GS" , " SWDumpDirectory" , dumpdir.c_str ());
764
+ }
765
+
646
766
// set up the frame dump directory
647
767
if (!s_output_prefix.empty ())
648
768
{
0 commit comments