1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 #ifndef __DEMO_TEST_H__
13 #define __DEMO_TEST_H__
14 
15 #include <cafe/demo.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /// @addtogroup demoTest
22 /// @{
23 
24 /// \brief Initializes Demo Test system
25 ///
26 /// If the following arguments pass, Demo Test System runs.
27 /// If no arguments, Demo Test System is disabled.
28 ///
29 /// - TEST_SELECT=#
30 /// - CAPTURE_SELECT=#
31 /// - COMPARE_FILE=name
32 /// - STOP_SELECT=#
33 /// - GX2R_DUMP_SELECT=#
34 /// - PM4_SELECT=#-#
35 /// - PM4_FILE=name
36 ///
37 /// (e.g)\n
38 ///   make run RUN_ARGS="TEST_SELECT=1,CAPTURE_SELECT=1,COMPARE_FILE=image/xxx.tga"\n
39 ///   make run RUN_ARGS="STOP_SELECT=2,PM4_SELECT=2,PM4_FILE=xxx.4mp"\n
40 ///
41 /// Where # should be replaced by a number, and "name" should be replaced by a file path name.\n
42 /// TEST_SELECT indicates the frame number when the DEMOTestCompare function is called.\n
43 /// CAPTURE_SELECT indicates the frame number when the DEMOTestCapture function is called.\n
44 /// COMPARE_FILE is the name of the file containing the data to compare against.\n
45 /// STOP_SELECT indicates the frame number when the demo should stop running.\n
46 /// GX2R_DUMP_SELECT indicates the frame number when the \ref GX2TempDumpResources function is called.\n
47 /// PM4_SELECT indicates the frame numbers when the \ref GX2DebugCaptureStart and \ref GX2DebugCaptureEnd functions are called.\n
48 /// PM4_FILE is the name of the .4mp file to store the PM4 capture in.\n
49 /// \note The first frame is number 1. Using 0 for a SELECT disables that function.
50 /// \note This function should be called by the same core that calls GX2Init.
51 ///
52 void DEMOTestInit(int argc, char *argv[]);
53 
54 /// \brief Shuts down Demo Test system
55 ///
56 void DEMOTestShutdown(void);
57 
58 /// \brief Does per-frame check to see if other test APIs need to be called
59 /// (called internally by DEMOIsRunning)
60 void DEMOTestCheck(void);
61 
62 /// \brief Called when Demo Test condition is met
63 /// (called internally by DEMOTestCheck)
64 void DEMOTestCompare(void);
65 
66 /// \brief Called when Demo Capture condition is met
67 /// (called internally by DEMOTestCheck)
68 void DEMOTestCapture(void);
69 
70 /// \brief Called in DEMOGfxBeforeRender when Demo Perf condition is met
71 void DEMOTestCheckPerfBegin(void);
72 
73 /// \brief Called in DEMOGfxDoneRender when Demo Perf condition is met
74 void DEMOTestCheckPerfEnd(void);
75 
76 /// \brief Returns value of test result.
77 /// TRUE means test passed; FALSE means test failed.
78 /// The value -1 means the test has not yet occurred.
79 int DEMOTestResult(void);
80 
81 /// \brief Returns the current test frame number.
82 /// \note The first frame is number 1.
83 u32 DEMOTestFrame(void);
84 
85 /// \brief Calc CRC-16 Hash (for Demo Test system)
86 ///
87 /// \param pData Pointer to data to hash.
88 /// \param size  Size (in bytes) of data to hash.
89 ///
90 /// \return result CRC-16 hash value
91 ///
92 u16 DEMOTestHashCRC16(const void *pData, u32 size);
93 
94 /// \brief Calc CRC-32 Hash (for Demo Test system)
95 ///
96 /// \param pData Pointer to data to hash.
97 /// \param size  Size (in bytes) of data to hash.
98 ///
99 /// \return result CRC-32 hash value
100 ///
101 u32 DEMOTestHashCRC32(const void *pData, u32 size);
102 
103 /// @}
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /// __DEMO_TEST_H__
110