Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
4.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // XBOX_LOADER.H
  4. //
  5. // Master Include
  6. //=====================================================================================//
  7. #pragma once
  8. #include <xtl.h>
  9. #include <XBApp.h>
  10. #include <XBFont.h>
  11. #include <XBHelp.h>
  12. #include <xgraphics.h>
  13. #include <xfont.h>
  14. #include <xmv.h>
  15. #include <xbdm.h>
  16. #include <math.h>
  17. #include "XBResource.h"
  18. #include "xmvhelper.h"
  19. #include "toollib.h"
  20. #include "scriplib.h"
  21. #include "loader.h"
  22. #include "jcalg1.h"
  23. #include "xbox/xbox_launch.h"
  24. #define XBOX_FORENSIC_LOG
  25. #define SCREEN_WIDTH 640
  26. #define SCREEN_HEIGHT 480
  27. #define MAX_FILES 500
  28. #define MAX_SLIDESHOW_TEXTURES 9
  29. #define LEGAL_DISPLAY_TIME 6000
  30. #define LOADINGBAR_UPTIME 500.0f // slid up or down
  31. #define LOADINGBAR_SLIDETIME 1500.0f // progress speed
  32. #define LOADINGBAR_WAITTIME 500.0f // delay after up to begin slide
  33. #define SLIDESHOW_SLIDETIME 7000
  34. #define SLIDESHOW_FLIPTIME 1000
  35. #define LEGAL_MAIN 0
  36. #define LEGAL_SOURCE 1
  37. #define FOOTER_W 512
  38. #define SEGMENT_W 10
  39. #define SEGMENT_GAP 1
  40. #define SEGMENT_COUNT 26
  41. #define PROGRESS_Y 405
  42. #define PROGRESS_W (SEGMENT_COUNT*(SEGMENT_W+SEGMENT_GAP))
  43. #define PROGRESS_H 15
  44. #define PROGRESS_X 124
  45. #define PROGRESS_FOOTER_COLOR 0x88FFFFFF
  46. #define PROGRESS_INSET_COLOR 0xFF222222
  47. #define PROGRESS_SEGMENT_COLOR 0xFFCC6C00
  48. #define PROGRESS_TEXT_COLOR 0xFFFFFFFF
  49. //-----------------------------------------------------------------------------
  50. // Main class to run this application. Most functionality is inherited
  51. // from the CXBApplication base class.
  52. //-----------------------------------------------------------------------------
  53. class CXBoxLoader : public CXBApplication
  54. {
  55. public:
  56. CXBoxLoader();
  57. virtual HRESULT Initialize( void );
  58. virtual HRESULT Render( void );
  59. virtual HRESULT FrameMove( void );
  60. void DrawRect( int x, int y, int w, int h, DWORD color );
  61. void DrawLegals();
  62. void DrawDebug();
  63. BOOL PlayVideoFrame();
  64. HRESULT StartVideo( const CHAR* strFilename, bool bFromMemory, bool bFatalOnError );
  65. void StopVideo();
  66. bool StartInstall( void );
  67. bool LoadInstallScript( void );
  68. D3DTexture *LoadTexture( int resourceID );
  69. HRESULT LoadFont( CXBFont *pFont, int resourceID );
  70. void DrawTexture( D3DTexture *pD3DTexture, int x, int y, int w, int h, int color );
  71. void StartLegalScreen( int legal );
  72. void DrawProgressBar();
  73. void DrawLoadingMarquee();
  74. void DrawSlideshow();
  75. bool VerifyInstall();
  76. void StartDashboard( bool bGotoMemory );
  77. void LoadLogFile();
  78. void DrawLog();
  79. void FatalMediaError();
  80. void LaunchHL2( unsigned int contextCode );
  81. void TickVideo();
  82. private:
  83. IDirect3DTexture8 *m_pLastMovieFrame;
  84. D3DTexture *m_pFooterTexture;
  85. D3DTexture *m_pLoadingIconTexture;
  86. D3DTexture *m_pMainLegalTexture;
  87. D3DTexture *m_pSourceLegalTexture;
  88. D3DTexture *m_pLegalTexture;
  89. D3DTexture *m_pSlideShowTextures[MAX_SLIDESHOW_TEXTURES];
  90. CXMVPlayer m_player;
  91. D3DVertexBuffer *m_pVB;
  92. CXBPackedResource m_xprResource;
  93. CXBFont m_Font;
  94. int m_contextCode;
  95. char *m_fileSrc[MAX_FILES];
  96. char *m_fileDest[MAX_FILES];
  97. xCompressHeader *m_fileCompressionHeaders[MAX_FILES];
  98. DWORD m_fileDestSizes[MAX_FILES];
  99. int m_numFiles;
  100. bool m_bAllowAttractAbort;
  101. bool m_bDrawLoading;
  102. bool m_bDrawProgress;
  103. bool m_bDrawDebug;
  104. bool m_bLaunch;
  105. DWORD m_dwLoading;
  106. bool m_bDrawLegal;
  107. HANDLE m_installThread;
  108. DWORD m_LegalTime;
  109. int m_State;
  110. DWORD m_LoadingBarStartTime;
  111. DWORD m_LoadingBarEndTime;
  112. DWORD m_LegalStartTime;
  113. bool m_bInstallComplete;
  114. int m_Version;
  115. int m_FrameCounter;
  116. int m_MovieCount;
  117. bool m_bMovieErrorIsFatal;
  118. bool m_bCaptureLastMovieFrame;
  119. DWORD m_SlideShowStartTime;
  120. bool m_bDrawSlideShow;
  121. int m_SlideShowCount;
  122. bool m_bFinalSlide;
  123. char *m_pLogData;
  124. XFONT* m_pDefaultTrueTypeFont;
  125. };
  126. struct CopyStats_t
  127. {
  128. char m_srcFilename[MAX_PATH];
  129. char m_dstFilename[MAX_PATH];
  130. DWORD m_readSize;
  131. DWORD m_writeSize;
  132. DWORD m_bytesCopied;
  133. DWORD m_totalReadTime;
  134. DWORD m_totalWriteTime;
  135. DWORD m_totalReadSize;
  136. DWORD m_totalWriteSize;
  137. DWORD m_bufferReadSize;
  138. DWORD m_bufferWriteSize;
  139. DWORD m_bufferReadTime;
  140. DWORD m_bufferWriteTime;
  141. DWORD m_inflateSize;
  142. DWORD m_inflateTime;
  143. DWORD m_copyTime;
  144. DWORD m_copyErrors;
  145. DWORD m_numReadBuffers;
  146. DWORD m_numWriteBuffers;
  147. };
  148. extern bool CopyFileOverlapped( const char *pSrc, const char *pDest, xCompressHeader *pxcHeader, CopyStats_t *pCopyStats );
  149. extern bool CreateFilePath( const char *inPath );