OROCHI
 
Loading...
Searching...
No Matches
GxSysDebugCommunication.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13GX_CORE_NAMESPACE_BEGIN()
14
15#if GX_DEVELOP
16//===========================================================================
18//===========================================================================
19class GxDebugCommunicationInitialInformation : public GxClassBase
20{
21 //-----------------------------------------------------------
23 //-----------------------------------------------------------
25public:
26 // RTTI定義
27 GX_RTTI_CLASS(GxDebugCommunicationInitialInformation, GxClassBase)
28 // GxClassBase継承クラス用禁止宣言
29 GX_PROHIBIT_CLASS_BASE(GxDebugCommunicationInitialInformation)
30
31
32 //-------------------------------------------------------------
34 //-------------------------------------------------------------
36
38 GxDebugCommunicationInitialInformation(void)
39 : _reciveBufferSize(GxDebugCommunicationBase::RECEIVE_MAX_SIZE)
40 , _useRuntimeShaderCompile(false)
41#if defined(_NX64)
42 , _useLastWriteTime(true)
43#endif //_NX64
44 {}
45
47 //-------------------------------------------------------------
49 //-------------------------------------------------------------
51
53 void loadJson(const GxJson::GxJsonNode& jsonNode);
54
55#if GX_DEVELOP
57 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index);
58#endif // GX_DEVELOP
59
61 //-------------------------------------------------------------
63 //-------------------------------------------------------------
65
66 u32 _reciveBufferSize;
67 b32 _useRuntimeShaderCompile;
68#if defined(_NX64)
69 b32 _useLastWriteTime;
70#endif //_NX64
71};
72
73//===========================================================================
75//===========================================================================
76class GxSysDebugCommunication : public GxSysBase, public SingletonBase<GxSysDebugCommunication>
77{
78 //-----------------------------------------------------------
80 //-----------------------------------------------------------
82public:
83 // RTTI定義
84 GX_RTTI_ABSTRACT_CLASS(GxSysDebugCommunication, GxSysBase)
85 // ClassBase継承クラス用禁止宣言
86 GX_PROHIBIT_CLASS_BASE(GxSysDebugCommunication)
87
88 // アプリケーションデータ受信オブザーバ基底クラス宣言
89 class ApplicationDataReceiveObserverBase;
90
91protected:
93 static constexpr u32 FILE_COMMUNICATION_TIMEOUT_MSEC = 5 * 1000;
95 static constexpr u32 PACKET_MAX_SIZE = GxDebugCommunicationBase::PACKET_MAX_SIZE;
97 static constexpr u32 KEEP_ALIVE_PACKET_SPAN_SEC = 2 * 1000;
98
99protected:
101 struct GxApplicationDataReceiveCallbackInformation
102 {
103 u32 _magic;
104 GxSysDebugCommunication::ApplicationDataReceiveObserverBase* _pObserver;
105 };
106
107protected:
109 enum class COMMAND
110 {
111 HEALTH_CHECK = 0x00010001,
112 INPUT = 0x00100001,
113 FILE_OPEN = 0x01000001,
114 FILE_CLOSE = 0x01000002,
115 FILE_READ = 0x01000003,
116 FILE_WRITE = 0x01000004,
117 FILE_SEEK = 0x01000005,
118 FILE_MOVE = 0x01000006,
119 FILE_COPY = 0x01000007,
120 FILE_REMOVE = 0x01000008,
121 FILE_FIND_FIRST = 0x01000009,
122 FILE_FIND_NEXT = 0x0100000a,
123 FILE_FIND_CLOSE = 0x0100000b,
124 FILE_SET_TIMESTAMP = 0x0100000c,
125 FILE_GET_SIZE = 0x0100000d,
126#if defined(_NX64)
127 FILE_GET_TIMESTAMP_NX = 0x0100000e,
128 FILE_SET_TIMESTAMP_NX = 0x0100000f,
129#endif // _NX64
130 DIRECTORY_CREATE = 0x02000001,
131 DIRECTORY_REMOVE = 0x02000002,
132#if ENABLE_SHADER_COMPILE
133 COMPILE_SHADER = 0x03000001,
134#endif //ENABLE_SHADER_COMPILE
135 SENDDATA_FROM_APPLICATION = 0x10000001,
136 SENDDATA_FROM_PLATFORM = 0x10000002
137 };
138
140 struct GxPacketKeepAliveResponse
141 {
142 //-------------------------------------------------------------
144 //-------------------------------------------------------------
146
148 GxPacketKeepAliveResponse(void)
149 {
150 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::HEALTH_CHECK));
151 _header._bodySize = 0;
152 _header._isReply = true;
153 }
154
156 //-------------------------------------------------------------
158 //-------------------------------------------------------------
160
161 GxDebugCommunicationBase::GxPacketHeader _header;
162
164 };
165
167 struct GxPacketBodyInput
168 {
169 //-------------------------------------------------------------
171 //-------------------------------------------------------------
173
175 static constexpr u32 KEY_NUM = GxMath::VALUE_256;
177 static constexpr u32 KEY_LBUTTON = 0x01;
179 static constexpr u32 KEY_RBUTTON = 0x02;
181 static constexpr u32 KEY_MBUTTON = 0x04;
183 static constexpr u32 KEY_XBUTTON1 = 0x05;
185 static constexpr u32 KEY_XBUTTON2 = 0x06;
186
188 //-------------------------------------------------------------
190 //-------------------------------------------------------------
192
193 s32 _mousePointX;
194 s32 _mousePointY;
195 u32 _captureRectWidth;
196 u32 _captureRectHeight;
197 s32 _mouseOffsetZ;
198 GX_CHAR _keyboardState[KEY_NUM];
199
201 };
202
204 struct GxPacketBodyFileOpen
205 {
206 //-------------------------------------------------------------
208 //-------------------------------------------------------------
210
212 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
213
215 //-------------------------------------------------------------
217 //-------------------------------------------------------------
219
220 GX_CHAR _path[FILE_PATH_MAX];
221 u32 _mode;
222
224 };
225
227 struct GxPacketBodyFileOpenResponse
228 {
229 u32 _handle;
230 u32 _size;
231 };
232
234 struct GxPacketFileOpen
235 {
236 //-------------------------------------------------------------
238 //-------------------------------------------------------------
240
242 GxPacketFileOpen(void)
243 {
244 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_OPEN));
245 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileOpen)));
246 _header._isReply = false;
247 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileOpen));
248 }
249
251 //-------------------------------------------------------------
253 //-------------------------------------------------------------
255
256 GxDebugCommunicationBase::GxPacketHeader _header;
257 GxPacketBodyFileOpen _body;
258
260 };
261
263 struct GxPacketBodyFileClose
264 {
265 u32 _handle;
266 };
267
269 struct GxPacketFileClose
270 {
271 //-------------------------------------------------------------
273 //-------------------------------------------------------------
275
277 GxPacketFileClose(void)
278 {
279 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_CLOSE));
280 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileClose)));
281 _header._isReply = false;
282 _body._handle = 0;
283 }
284
286 //-------------------------------------------------------------
288 //-------------------------------------------------------------
290
291 GxDebugCommunicationBase::GxPacketHeader _header;
292 GxPacketBodyFileClose _body;
293
295 };
296
298 struct GxPacketBodyFileRead
299 {
300 u32 _handle;
301 u32 _size;
302 };
303
305 struct GxPacketBodyFileReadResponse
306 {
307 //-------------------------------------------------------------
309 //-------------------------------------------------------------
311
313 static constexpr u32 READ_SIZE_MAX = PACKET_MAX_SIZE - sizeof(GxDebugCommunicationBase::GxPacketHeader) - sizeof(u32);
314
316 //-------------------------------------------------------------
318 //-------------------------------------------------------------
320
321 u32 _size;
322 GX_CHAR _data[READ_SIZE_MAX];
323
325 };
326
328 struct GxPacketFileRead
329 {
330 //-------------------------------------------------------------
332 //-------------------------------------------------------------
334
336 GxPacketFileRead(void)
337 {
338 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_READ));
339 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileRead)));
340 _header._isReply = false;
341 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileRead));
342 }
343
345 //-------------------------------------------------------------
347 //-------------------------------------------------------------
349
350 GxDebugCommunicationBase::GxPacketHeader _header;
351 GxPacketBodyFileRead _body;
352
354 };
355
357 struct GxPacketBodyFileWrite
358 {
359 //-------------------------------------------------------------
361 //-------------------------------------------------------------
363
365 static constexpr u32 WRITE_SIZE_MAX = PACKET_MAX_SIZE - sizeof(GxDebugCommunicationBase::GxPacketHeader) - sizeof(u32) * 2;
366
368 //-------------------------------------------------------------
370 //-------------------------------------------------------------
372
373 u32 _handle;
374 u32 _size;
375 GX_CHAR _data[WRITE_SIZE_MAX];
376
378 };
379
381 struct GxPacketBodyFileWriteResponse
382 {
383 u32 _size;
384 };
385
387 struct GxPacketFileWrite
388 {
389 //-------------------------------------------------------------
391 //-------------------------------------------------------------
393
395 GxPacketFileWrite(void)
396 {
397 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_WRITE));
398 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileWrite)));
399 _header._isReply = false;
400 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileWrite));
401 }
402
404 //-------------------------------------------------------------
406 //-------------------------------------------------------------
408
409 GxDebugCommunicationBase::GxPacketHeader _header;
410 GxPacketBodyFileWrite _body;
411
413 };
414
415 //---- ファイルシーク
416
418 struct GxPacketBodyFileSeek
419 {
420 u32 _handle;
421 s32 _position;
422 u32 _mode;
423 };
424
426 struct GxPacketBodyFileSeekResponse
427 {
428 u32 _position;
429 };
430
432 struct GxPacketFileSeek
433 {
434 //-------------------------------------------------------------
436 //-------------------------------------------------------------
438
440 GxPacketFileSeek(void)
441 {
442 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_SEEK));
443 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileSeek)));
444 _header._isReply = false;
445 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileSeek));
446 }
447
449 //-------------------------------------------------------------
451 //-------------------------------------------------------------
453
454 GxDebugCommunicationBase::GxPacketHeader _header;
455 GxPacketBodyFileSeek _body;
456
458 };
459
461 struct GxPacketBodyFileMove
462 {
463 //-------------------------------------------------------------
465 //-------------------------------------------------------------
467
469 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
470
472 //-------------------------------------------------------------
474 //-------------------------------------------------------------
476
477 GX_CHAR _srcPath[FILE_PATH_MAX];
478 GX_CHAR _dstPath[FILE_PATH_MAX];
479
481 };
482
484 struct GxPacketFileMove
485 {
486 //-------------------------------------------------------------
488 //-------------------------------------------------------------
490
492 GxPacketFileMove(void)
493 {
494 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_MOVE));
495 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileMove)));
496 _header._isReply = false;
497 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileMove));
498 }
499
501 //-------------------------------------------------------------
503 //-------------------------------------------------------------
505
506 GxDebugCommunicationBase::GxPacketHeader _header;
507 GxPacketBodyFileMove _body;
508
510 };
511
512 //--- ファイルコピー
513
515 struct GxPacketBodyFileCopy
516 {
517 //-------------------------------------------------------------
519 //-------------------------------------------------------------
521
523 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
524
526 //-------------------------------------------------------------
528 //-------------------------------------------------------------
530
531 GX_CHAR _srcPath[FILE_PATH_MAX];
532 GX_CHAR _dstPath[FILE_PATH_MAX];
533
535 };
536
538 struct GxPacketFileCopy
539 {
540 //-------------------------------------------------------------
542 //-------------------------------------------------------------
544
546 GxPacketFileCopy(void)
547 {
548 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_COPY));
549 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileCopy)));
550 _header._isReply = false;
551 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileCopy));
552 }
553
555 //-------------------------------------------------------------
557 //-------------------------------------------------------------
559
560 GxDebugCommunicationBase::GxPacketHeader _header;
561 GxPacketBodyFileCopy _body;
562
564 };
565
567 struct GxPacketBodyFileRemove
568 {
569 //-------------------------------------------------------------
571 //-------------------------------------------------------------
573
575 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
576
578 //-------------------------------------------------------------
580 //-------------------------------------------------------------
582
583 GX_CHAR _path[FILE_PATH_MAX];
584
586 };
587
589 struct GxPacketFileRemove
590 {
591 //-------------------------------------------------------------
593 //-------------------------------------------------------------
595
597 GxPacketFileRemove(void)
598 {
599 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_REMOVE));
600 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileRemove)));
601 _header._isReply = false;
602 _body._path[0] = '\0';
603 }
604
606 //-------------------------------------------------------------
608 //-------------------------------------------------------------
610
611 GxDebugCommunicationBase::GxPacketHeader _header;
612 GxPacketBodyFileRemove _body;
613
615 };
616
617 //---- ファイル初回探索
618
620 struct GxPacketBodyFileFindFirst
621 {
622 //-------------------------------------------------------------
624 //-------------------------------------------------------------
626
628 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
629
631 //-------------------------------------------------------------
633 //-------------------------------------------------------------
635
636 GX_CHAR _path[FILE_PATH_MAX];
637
639 };
640
642 struct GxPacketBodyFileFindFirstResponse
643 {
644 //-------------------------------------------------------------
646 //-------------------------------------------------------------
648
650 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
651
653 enum ATTRIBUTE
654 {
655 ATTRIBUTE_NOTHING = 0,
656 ATTRIBUTE_DIRECTORY = (1<<0),
657 ATTRIBUTE_ARCHIVE = (1<<1),
658 ATTRIBUTE_READONLY = (1<<2),
659 ATTRIBUTE_HIDDEN = (1<<3),
660 ATTRIBUTE_SYSTEM = (1<<4),
661 ATTRIBUTE_NORMAL = (1<<5)
662 };
663
665 //-------------------------------------------------------------
667 //-------------------------------------------------------------
669
670 u32 _handle;
671 u32 _fileSizeLow;
672 u32 _fileSizeHigh;
673 u32 _lastWriteTimeLow;
674 u32 _lastWriteTimeHigh;
675 u32 _attribute;
676 GX_CHAR _filename[FILE_PATH_MAX];
677
679 };
680
682 struct GxPacketFileFindFirst
683 {
684 //-------------------------------------------------------------
686 //-------------------------------------------------------------
688
690 GxPacketFileFindFirst(void)
691 {
692 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_FIND_FIRST));
693 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileFindFirst)));
694 _header._isReply = false;
695 _body._path[0] = '\0';
696 }
697
699 //-------------------------------------------------------------
701 //-------------------------------------------------------------
703
704 GxDebugCommunicationBase::GxPacketHeader _header;
705 GxPacketBodyFileFindFirst _body;
706
708 };
709
711 struct GxPacketBodyFileFindNext
712 {
713 u32 _handle;
714 };
715
717 struct GxPacketBodyFileFindNextResponse
718 {
719 //-------------------------------------------------------------
721 //-------------------------------------------------------------
723
725 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
726
728 enum ATTRIBUTE
729 {
730 ATTRIBUTE_NOTHING = 0,
731 ATTRIBUTE_DIRECTORY = (1<<0),
732 ATTRIBUTE_ARCHIVE = (1<<1),
733 ATTRIBUTE_READONLY = (1<<2),
734 ATTRIBUTE_HIDDEN = (1<<3),
735 ATTRIBUTE_SYSTEM = (1<<4),
736 ATTRIBUTE_NORMAL = (1<<5)
737 };
738
740 //-------------------------------------------------------------
742 //-------------------------------------------------------------
744
745 u32 _fileSizeLow;
746 u32 _fileSizeHigh;
747 u32 _lastWriteTimeLow;
748 u32 _lastWriteTimeHigh;
749 u32 _attribute;
750 GX_CHAR _filename[FILE_PATH_MAX];
751 u8 _result;
752 u8 _padding[3];
753
755 };
756
758 struct GxPacketFileFindNext
759 {
760 //-------------------------------------------------------------
762 //-------------------------------------------------------------
764
766 GxPacketFileFindNext(void)
767 {
768 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_FIND_NEXT));
769 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileFindNext)));
770 _header._isReply = false;
771 _body._handle = 0;
772 }
773
775 //-------------------------------------------------------------
777 //-------------------------------------------------------------
779
780 GxDebugCommunicationBase::GxPacketHeader _header;
781 GxPacketBodyFileFindNext _body;
782
784 };
785
787 struct GxPacketBodyFileFindClose
788 {
789 u32 _handle;
790 };
791
793 struct GxPacketFileFindClose
794 {
795 //-------------------------------------------------------------
797 //-------------------------------------------------------------
799
801 GxPacketFileFindClose(void)
802 {
803 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_FIND_CLOSE));
804 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileFindClose)));
805 _header._isReply = false;
806 _body._handle = 0;
807 }
808
810 //-------------------------------------------------------------
812 //-------------------------------------------------------------
814
815 GxDebugCommunicationBase::GxPacketHeader _header;
816 GxPacketBodyFileFindClose _body;
817
819 };
820
822 struct GxPacketBodyFileTimestamp
823 {
824 u32 _handle;
825 u32 _lowDateTime;
826 u32 _highDateTime;
827 };
828
830 struct GxPacketFileTimestamp
831 {
832 //-------------------------------------------------------------
834 //-------------------------------------------------------------
836
838 GxPacketFileTimestamp(void)
839 {
840 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_SET_TIMESTAMP));
841 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileTimestamp)));
842 _header._isReply = false;
843 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileTimestamp));
844 }
845
847 //-------------------------------------------------------------
849 //-------------------------------------------------------------
851
852 GxDebugCommunicationBase::GxPacketHeader _header;
853 GxPacketBodyFileTimestamp _body;
854
856 };
857
859 struct GxPacketBodyFileGetSize
860 {
861 u32 _handle;
862 };
863
865 struct GxPacketBodyFileGetSizeResponse
866 {
867 u32 _size;
868 };
869
871 struct GxPacketFileGetSize
872 {
873 //-------------------------------------------------------------
875 //-------------------------------------------------------------
877
879 GxPacketFileGetSize(void)
880 {
881 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_GET_SIZE));
882 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileGetSize)));
883 _header._isReply = false;
884 _body._handle = 0;
885 }
886
888 //-------------------------------------------------------------
890 //-------------------------------------------------------------
892
893 GxDebugCommunicationBase::GxPacketHeader _header;
894 GxPacketBodyFileGetSize _body;
895
897 };
898
899#if defined(_NX64)
901 struct GxPacketBodyFileGetTimestampNx
902 {
903 //-------------------------------------------------------------
905 //-------------------------------------------------------------
907
909 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
910
912 //-------------------------------------------------------------
914 //-------------------------------------------------------------
916
917 GX_CHAR _path[FILE_PATH_MAX];
918
920 };
921
923 struct GxPacketBodyFileGetTimestampNxResponse
924 {
925 u32 _size;
926 u32 _lowDateTime;
927 u32 _highDateTime;
928 };
929
931 struct GxPacketFileGetTimestampNx
932 {
933 //-------------------------------------------------------------
935 //-------------------------------------------------------------
937
939 GxPacketFileGetTimestampNx(void)
940 {
941 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_GET_TIMESTAMP_NX));
942 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileGetTimestampNx)));
943 _header._isReply = false;
944 _body._path[0] = '\0';
945 }
946
948 //-------------------------------------------------------------
950 //-------------------------------------------------------------
952
953 GxDebugCommunicationBase::GxPacketHeader _header;
954 GxPacketBodyFileGetTimestampNx _body;
955
957 };
958
960 struct GxPacketBodyFileSetTimestampNx
961 {
962 //-------------------------------------------------------------
964 //-------------------------------------------------------------
966
968 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
969
971 //-------------------------------------------------------------
973 //-------------------------------------------------------------
975
976 GX_CHAR _path[FILE_PATH_MAX];
977 u32 _lowDateTime;
978 u32 _highDateTime;
979
981 };
982
984 struct GxPacketFileSetTimestampNx
985 {
986 //-------------------------------------------------------------
988 //-------------------------------------------------------------
990
992 GxPacketFileSetTimestampNx(void)
993 {
994 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::FILE_SET_TIMESTAMP_NX));
995 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyFileSetTimestampNx)));
996 _header._isReply = false;
997 GX_MEMSET(&_body, 0, sizeof(GxPacketBodyFileSetTimestampNx));
998 }
999
1001 //-------------------------------------------------------------
1003 //-------------------------------------------------------------
1005
1006 GxDebugCommunicationBase::GxPacketHeader _header;
1007 GxPacketBodyFileSetTimestampNx _body;
1008
1010 };
1011#endif // _NX64
1012
1014 struct GxPacketBodyDirectoryCreate
1015 {
1016 //-------------------------------------------------------------
1018 //-------------------------------------------------------------
1020
1022 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
1023
1025 //-------------------------------------------------------------
1027 //-------------------------------------------------------------
1029
1030 GX_CHAR _path[FILE_PATH_MAX];
1031
1033 };
1034
1036 struct GxPacketBodyDirectoryCreateResponse
1037 {
1038 u8 _result;
1039 u8 _padding[3];
1040 };
1041
1043 struct GxPacketDirectoryCreate
1044 {
1045 //-------------------------------------------------------------
1047 //-------------------------------------------------------------
1049
1051 GxPacketDirectoryCreate(void)
1052 {
1053 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::DIRECTORY_CREATE));
1054 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyDirectoryCreate)));
1055 _header._isReply = false;
1056 _body._path[0] = '\0';
1057 }
1058
1060 //-------------------------------------------------------------
1062 //-------------------------------------------------------------
1064
1065 GxDebugCommunicationBase::GxPacketHeader _header;
1066 GxPacketBodyDirectoryCreate _body;
1067
1069 };
1070
1072 struct GxPacketBodyDirectoryRemove
1073 {
1074 //-------------------------------------------------------------
1076 //-------------------------------------------------------------
1078
1080 static constexpr u32 FILE_PATH_MAX = GxMath::VALUE_256;
1081
1083 //-------------------------------------------------------------
1085 //-------------------------------------------------------------
1087
1088 GX_CHAR _path[FILE_PATH_MAX];
1089
1091 };
1092
1094 struct GxPacketBodyDirectoryRemoveResponse
1095 {
1096 u8 _result;
1097 u8 _padding[3];
1098 };
1099
1101 struct GxPacketDirectoryRemove
1102 {
1103 //-------------------------------------------------------------
1105 //-------------------------------------------------------------
1107
1109 GxPacketDirectoryRemove(void)
1110 {
1111 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::DIRECTORY_REMOVE));
1112 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyDirectoryRemove)));
1113 _header._isReply = false;
1114 _body._path[0] = '\0';
1115 }
1116
1118 //-------------------------------------------------------------
1120 //-------------------------------------------------------------
1122
1123 GxDebugCommunicationBase::GxPacketHeader _header;
1124 GxPacketBodyDirectoryRemove _body;
1125
1127 };
1128
1129#if ENABLE_SHADER_COMPILE
1130public:
1132 struct GxCompileOptions
1133 {
1134 //-----------------------------------------------------------
1136 //-----------------------------------------------------------
1138
1140 enum class LOCALE
1141 {
1142 ENGLISH,
1143 JAPANESE,
1144 };
1145
1147 //-----------------------------------------------------------
1149 //-----------------------------------------------------------
1151
1153 GxCompileOptions(void) : _mainSourceFile(nullptr), _targetProfile(RENDER_SHADER::VERTEX), _entryFunctionName("main"),
1154 _searchPathCount(0), _searchPaths(nullptr), _macroDefinitionCount(0), _macroDefinitions(nullptr),
1155 _includeFileCount(0), _includeFiles(nullptr), _suppressedWarningsCount(0), _pSuppressedWarnings(nullptr),
1156 _locale(LOCALE::ENGLISH),
1157 _useFx(0), _noStdlib(0),
1158 _optimizationLevel(3), _useFastMath(1), _useFastPrecision(0), _useFastInt(1), _positionInvariant(0),
1159 _warningsAsErrors(0), _performanceWarnings(0), _warningLevel(1), _pedantic(0), _pedanticError(0),
1160 _stripSymbols(0) {}
1161
1163 //-----------------------------------------------------------
1165 //-----------------------------------------------------------
1167
1168 GX_STR _mainSourceFile;
1169 RENDER_SHADER _targetProfile;
1170 GX_CSTR _entryFunctionName;
1171 u32 _searchPathCount;
1172 GX_STR _searchPaths;
1173 u32 _macroDefinitionCount;
1174 GX_STR _macroDefinitions;
1175 u32 _includeFileCount;
1176 GX_STR _includeFiles;
1177 u32 _suppressedWarningsCount;
1178 u32* _pSuppressedWarnings;
1179
1180 LOCALE _locale;
1181
1182 s32 _useFx;
1183 s32 _noStdlib;
1184
1185 s32 _optimizationLevel;
1186 s32 _useFastMath;
1187 s32 _useFastPrecision;
1188 s32 _useFastInt;
1189 s32 _positionInvariant;
1190
1191 s32 _warningsAsErrors;
1192 s32 _performanceWarnings;
1193 s32 _warningLevel;
1194 s32 _pedantic;
1195 s32 _pedanticError;
1196 s32 _xmlCache;
1197 s32 _stripSymbols;
1198
1199#if defined(_PS4) || defined(_PS5)
1200 s32 _outputTargets;
1201#endif //_PS4 || _PS5
1202
1204 };
1205
1206public:
1208 struct GxPacketBodyCompileShaderResult
1209 {
1210 //-----------------------------------------------------------
1212 //-----------------------------------------------------------
1214
1216 enum class DATA_STRING
1217 {
1218 ENTRY_FUNCTION_NAME,
1219 SEARCH_PATHS,
1220 MACRO_DEFINITIONS,
1221 INCLUDE_FILES,
1222 SUPPRESSED_WARNINGS,
1223 MAIN_SOURCE_FILE,
1224 MAX,
1225 };
1226
1228 static constexpr u32 DATA_SIZE_MAX = PACKET_MAX_SIZE - sizeof(GxDebugCommunicationBase::GxPacketHeader) - sizeof(GxCompileOptions) - sizeof(u32) * (static_cast<s32>(DATA_STRING::MAX) + 2);
1229
1231 //-----------------------------------------------------------
1233 //-----------------------------------------------------------
1235
1237 GxPacketBodyCompileShaderResult(void) : _packetCount(0), _shaderCount(0) { GX_MEMSET(_size, 0, sizeof(u32) * static_cast<s32>(DATA_STRING::MAX)); }
1238
1240 //-----------------------------------------------------------
1242 //-----------------------------------------------------------
1244
1245 GxCompileOptions _options;
1246 u32 _size[static_cast<s32>(DATA_STRING::MAX)];
1247 u32 _packetCount;
1248 u32 _shaderCount;
1249 GX_CHAR _data[DATA_SIZE_MAX];
1250
1252 };
1253
1255 struct GxPacketCompileShaderResult
1256 {
1257 //-----------------------------------------------------------
1259 //-----------------------------------------------------------
1261
1263 GxPacketCompileShaderResult(void)
1264 {
1265 _header._command = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u32>(COMMAND::COMPILE_SHADER));
1266 _header._bodySize = GxDebugCommunicationBase::getPlatformToNetwork(static_cast<u16>(sizeof(GxPacketBodyCompileShaderResult)));
1267 _header._isReply = false;
1268 }
1269
1271 //-----------------------------------------------------------
1273 //-----------------------------------------------------------
1275
1276 GxDebugCommunicationBase::GxPacketHeader _header;
1277 GxPacketBodyCompileShaderResult _body;
1278
1280 };
1281#endif //_PS4 || _NX64 || _PS5
1282
1283 //---- アプリケーションデータ送信
1284
1286 struct GxPacketApplicationHeader
1287 {
1288 u32 _magic;
1289 };
1290
1292 //-----------------------------------------------------------
1294 //-----------------------------------------------------------
1296public:
1298 GxSysDebugCommunication(void);
1300 ~GxSysDebugCommunication(void) override;
1301
1303 b32 initialize(const GxClassBase* pInitialInformation) override;
1305 void terminate(void) override;
1306
1308 //-----------------------------------------------------------
1310 //-----------------------------------------------------------
1312public:
1314 GX_FORCE_INLINE b32 isConnected(void) const { return (_pCommunication == nullptr) ? static_cast<b32>(false) : _pCommunication->isConnected(); }
1315
1317 GX_FORCE_INLINE void getKeyboardState(GX_CHAR* pDst) const { GX_MEMCPY(pDst, _keyboardState, sizeof(_keyboardState)); }
1319 GX_FORCE_INLINE void getMouseState(GxMouse::GxInputData* pDst) const { GX_MEMCPY(pDst, &_mouseState, sizeof(_mouseState)); }
1320#if ENABLE_SHADER_COMPILE
1322 constexpr u32 getCompiledShaderSize(void) const { return _compiledShaderSize; }
1324 constexpr GX_CHAR* getCompiledShader(void){ return _compiledShader; }
1325#endif //ENABLE_SHADER_COMPILE
1327 GX_FORCE_INLINE b32 getUseRuntimeShaderCompile(void) const { return _useRuntimeShaderCompile; }
1328
1330 //-----------------------------------------------------------
1332 //-----------------------------------------------------------
1334public:
1336 void update(void) override;
1337
1339 GX_HANDLE openFile(GX_CSTR path, GxFile::MODE mode, u32* pSize = nullptr);
1341 void closeFile(GX_HANDLE handle);
1343 u32 readFile(GX_HANDLE handle, void* pDst, u32 size);
1345 b32 writeFile(GX_HANDLE handle, const void* pSrc, u32 size);
1347 u32 seekFile(GX_HANDLE handle, s32 offset, GxFile::SEEK_TYPE seekType = GxFile::SEEK_TYPE::BEGIN);
1349 void moveFile(GX_CSTR srcPath, GX_CSTR dstPath);
1351 void copyFile(GX_CSTR srcPath, GX_CSTR dstPath);
1353 void removeFile(GX_CSTR path);
1355 GX_HANDLE findFirstFile(GX_CSTR path, GxFileInformation& fileInformation);
1357 b32 findNextFile(GX_HANDLE handle, GxFileInformation& fileInformation);
1359 void findCloseFile(GX_HANDLE handle);
1361 void setLastWriteTime(GX_HANDLE handle, u64 lastWriteTime);
1363 u32 getFileSize(GX_HANDLE handle);
1364#if defined(_NX64)
1366 GX_FORCE_INLINE b32 getUseLastWriteTime(void) const { return _useLastWriteTime; }
1368 u64 getLastWriteTimeNX(GX_CSTR path);
1370 void setLastWriteTimeNX(GX_CSTR path, u64 lastWriteTime);
1371#endif // _NX64
1373 b32 createDirectory(GX_CSTR directoryPath);
1375 b32 removeDirectory(GX_CSTR directoryPath);
1376#if ENABLE_SHADER_COMPILE
1378 b32 compileShader(const GxCompileOptions& options, void* pData, u32 size, b32 isOutputTrace);
1380 constexpr void startCompileShader(void) {_shaderCompiling = true;}
1382 u32 addCompileCounter(void);
1384 void sendShaderCompileRequset(void);
1386 constexpr u32 getCompileCounter(void) const { return _shaderCompileCount; }
1387#endif //ENABLE_SHADER_COMPILE
1388
1389public:
1391 b32 sendApplicationData(u32 magic, const void* pData, u32 size);
1393 b32 registerApplicationDataReceiveObserver(u32 magic, GxSysDebugCommunication::ApplicationDataReceiveObserverBase* pObserver);
1395 void unregisterApplicationDataReceiveObserver(u32 magic);
1396
1397protected:
1399 GxSysDebugCommunication::ApplicationDataReceiveObserverBase* getApplicationDataReceiveObserver(u32 magic);
1400
1402 b32 reserveFileCommunicationRights(void);
1404 void freeFileCommunicationRigths(void);
1406 b32 waitFileCommunicationResponse(void);
1408 void completeFileCommunicationResponse(void);
1409
1411 static void callbackAnalyseMessage(const GxDebugCommunicationBase::GxPacketHeader& header, const void* pBody);
1412
1414 //-----------------------------------------------------------
1416 //-----------------------------------------------------------
1418protected:
1419 GxDebugCommunicationBase* _pCommunication;
1420
1421 GX_CHAR _keyboardState[GxPacketBodyInput::KEY_NUM];
1422 GxMouse::GxInputData _mouseState;
1423
1424 GxTimer _fileCommunicationTimer;
1425 b32 _isFileCommunicationRights;
1426 b32 _isFileCommunicationResponseWaiting;
1427 GX_CHAR _fileCommunicationBuffer[PACKET_MAX_SIZE];
1428
1429 GxTimer _keepAliveTimer;
1430
1431 GxArray* _pApplicationDataReceiveCallbackList;
1432 b32 _useRuntimeShaderCompile;
1433#if defined(_NX64)
1434 b32 _useLastWriteTime;
1435#endif //_NX64
1436#if ENABLE_SHADER_COMPILE
1437 u32 _shaderCompileCount;
1438 volatile bool _shaderCompiling;
1439 u32 _compiledShaderSize;
1440 GX_CHAR _compiledShader[PACKET_MAX_SIZE];
1441#endif //ENABLE_SHADER_COMPILE
1442
1444};
1445
1446#if ENABLE_PARARELL_SHADER_COMPILE
1447//===========================================================================
1449//===========================================================================
1450class GxShaderCompileRequestSender: public GxThread
1451{
1452 //-----------------------------------------------------------
1454 //-----------------------------------------------------------
1456
1457 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
1458
1459
1460 //-----------------------------------------------------------
1462 //-----------------------------------------------------------
1464public:
1466 GxShaderCompileRequestSender(void) : _isFinish(0)
1467 {
1468 GX_ASSERT(_pEvent == nullptr, "singleton");
1469 _pEvent = &_event;
1470 }
1472 ~GxShaderCompileRequestSender(void){ _pEvent = nullptr; }
1473
1475 //-----------------------------------------------------------
1477 //-----------------------------------------------------------
1479
1481 GX_FORCE_INLINE void Stop(void) { GxThread::atomicExchangeU32(&_isFinish, 1); }
1483 GX_FORCE_INLINE void setEvent(void) { _event.setEvent(); }
1485 GX_FORCE_INLINE static void sendStart(void) { _pEvent->setEvent(); }
1486protected:
1488 void threadMain(void* pArgument) override;
1489
1491 //-----------------------------------------------------------
1493 //-----------------------------------------------------------
1495protected:
1496 volatile u32 _isFinish;
1497 GxEvent _event;
1498 static GxEvent* _pEvent;
1499
1501};
1502
1503//===========================================================================
1505//===========================================================================
1506class GxShaderCompileMessenger : public GxClassBaseReference
1507{
1508 //-----------------------------------------------------------
1510 //-----------------------------------------------------------
1512public:
1513 GX_OPERATOR_NEW_DELETE(gx::core::GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
1514
1515
1516 //-----------------------------------------------------------
1518 //-----------------------------------------------------------
1520
1522 GxShaderCompileMessenger(void) : _shaderCompiling(0), _compiledShaderSize(0), _currentCompileCount(0xffffffff)
1523 {
1524 GX_MEMSET(_compiledShader, 0, GxDebugCommunicationBase::PACKET_MAX_SIZE);
1525 }
1526
1528 //-----------------------------------------------------------
1530 //-----------------------------------------------------------
1532
1534 b32 compileShader(const GxSysDebugCommunication::GxCompileOptions& options, void* pData, u32 size, b32 isOutputTrace);
1536 constexpr u32 getCurrentCompileCount(void) { return _currentCompileCount; }
1537
1539 constexpr void setCurrentCompileCounter(u32 count){ _currentCompileCount = count; }
1541 void copyCompiledShader(const void* pSrc, u32 size);
1543 constexpr GX_STR getCompileShader(void) { return _compiledShader; }
1545 constexpr u32 getCompiledShaderSize(void) { return _compiledShaderSize; }
1546
1548 //-----------------------------------------------------------
1550 //-----------------------------------------------------------
1552private:
1553 volatile u32 _shaderCompiling;
1554 u32 _compiledShaderSize;
1555 GX_CHAR _compiledShader[GxDebugCommunicationBase::PACKET_MAX_SIZE];
1556 u32 _currentCompileCount;
1557 GxCriticalSection _criticalSection;
1558
1560};
1561
1562//===========================================================================
1564//===========================================================================
1565class GxCompileMessengerContainer
1566{
1567 //-----------------------------------------------------------
1569 //-----------------------------------------------------------
1571public:
1573 static void initialize(void);
1575 static void terminate(void);
1576
1578 //-----------------------------------------------------------
1580 //-----------------------------------------------------------
1582
1584 static GxShaderCompileMessenger* createMessenger(void);
1586 static GxShaderCompileMessenger* getMessengerFrom(u32 requestCount);
1588 static void releaseMessengerFrom(u32 requestCount);
1590 static void requestShaderCompile(GxSysDebugCommunication::GxPacketCompileShaderResult& requestData);
1592 GX_FORCE_INLINE static GxArray* getRequestList(void) { return _pRequestList; }
1594 GX_FORCE_INLINE static void lock(void) { _pCriticalSection->lock(); }
1596 GX_FORCE_INLINE static void unlock(void) { _pCriticalSection->unlock(); }
1597
1599 //-----------------------------------------------------------
1601 //-----------------------------------------------------------
1603private:
1604 static GxArray* _pRequestList;
1605 static GxArray* _pCompilerList;
1606 static GxCriticalSection* _pCriticalSection;
1607
1609};
1610#endif // ENABLE_PARARELL_SHADER_COMPILE
1611
1612// アクセスインターフェース
1613GX_FORCE_INLINE GxSysDebugCommunication* getGxSysDebugCommunication(void) { return GxSysDebugCommunication::getSingletonPointer(); }
1614
1615//===========================================================================
1617//===========================================================================
1618class GxSysDebugCommunication::ApplicationDataReceiveObserverBase
1619{
1620 //-----------------------------------------------------------
1622 //-----------------------------------------------------------
1624public:
1626 ApplicationDataReceiveObserverBase(void){}
1628 virtual ~ApplicationDataReceiveObserverBase(void){}
1629
1631 //-----------------------------------------------------------
1633 //-----------------------------------------------------------
1635public:
1640 virtual b32 callbackReceiveData(const void* pData, u32 size) = 0;
1641
1643};
1644
1645#endif // GX_DEVELOP
1646
1647GX_CORE_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
@ MAX
定義数
void GxTypedObject
その他
Definition GxDefine.h:213
u32 GX_HANDLE
ハンドル
Definition GxDefine.h:214
RENDER_SHADER
Definition GxRender.h:75
@ VERTEX
頂点シェーダー
配列クラス
Definition GxArray.h:18
オブジェクト基底クラス
Definition GxBase.h:88
参照オブジェクト基底クラス
Definition GxBase.h:122
クリティカルセクションクラス
Definition GxThread.h:20
イベントクラス
Definition GxThread.h:132
SEEK_TYPE
シークタイプ
Definition GxFile.h:201
@ BEGIN
先頭基準
MODE
ファイルアクセスモード
Definition GxFile.h:185
ファイル情報クラス
Definition GxFile.h:19
JSON解析用ノード
Definition GxJson.h:108
static constexpr u32 VALUE_256
256
Definition GxMath.h:127
プロパティクラス
Definition GxProperty.h:48
実行時型情報クラス
Definition GxRtti.h:154
システム基底クラス
Definition GxSysBase.h:18
virtual void update(void)
更新
Definition GxSysBase.cpp:79
virtual b32 initialize(const GxClassBase *pInitialiInformation=nullptr)
初期化
Definition GxSysBase.cpp:29
virtual void terminate(void)
終了処理
Definition GxSysBase.cpp:50
スレッドクラス
Definition GxThread.h:177
static void atomicExchangeU32(volatile u32 *pTarget, u32 newValue)
アトミックU32
Definition GxThread.cpp:78
virtual void threadMain(void *pArgument)=0
メインループ
タイマークラス
Definition GxTimer.h:110
シングルトン基礎クラス
Definition GxSingleton.h:19
32bitブーリアン
Definition GxDefine.h:173