FTTGraphics.cpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. #include <jni.h>
  2. #include "gl3stub.h"
  3. #include "FTTGraphics.h"
  4. #include "AndroidApp.h"
  5. #include "CFTTUberShader.h"
  6. #include "CFTTGraphicsDeviceOGLES.h"
  7. #include "CFTTGraphicsDeviceOGLES3.h"
  8. #include "CFTTMaterialManager.h"
  9. #include "CFTTTextureManager.h"
  10. #include "CFTTTextureCache.h"
  11. #include "CFTTCamera.h"
  12. #include "FTT2D.h"
  13. #include "FTT3D.h"
  14. //#include "CFTTVulkanSetup.h"
  15. #include "CFTTGraphicsDevice.h"
  16. #include "CFTTMaterialManager.h"
  17. #include "memctrl.h"
  18. MYSTATIC int dMaterialBufSize_348964;
  19. MYSTATIC int dTextureBufSize_348968;
  20. bool g_bFTTVolatileAllocated;
  21. EScreenRotation ScreenRotation_5A9AC0;
  22. MYSTATIC bool bStencilBuffer_5A9E78;
  23. MYSTATIC float ScreenSize_5A9E7C;
  24. GLint g_iMainFBOZDepth;
  25. struct GraphicsBufferNode {
  26. ushort dat[6];
  27. };
  28. //-------------------------------------------------------------------------------------------------
  29. //002005FC //^_^ 经过单元测试,功能正常
  30. void FTTGraphicsInitializeCommon() {
  31. //0020060C STR R5, [R0]
  32. LOGI("FTTGraphicsInitializeCommon: entry");
  33. LOGI("FTTGraphicsInitializeCommon: End");
  34. }
  35. //-------------------------------------------------------------------------------------------------
  36. //002006DC //^_^
  37. void FTTGraphicsCleanupCommon() {
  38. }
  39. //-------------------------------------------------------------------------------------------------
  40. //00200764 //^_^
  41. void FTTResetMaterials() {
  42. }
  43. //-------------------------------------------------------------------------------------------------
  44. //0020078C //^_^
  45. bool FTTBeginScene(CFTTClearSettings const &pSetting, CFTTRenderTarget *pRenderTarget, bool a3) {
  46. return false;
  47. }
  48. //-------------------------------------------------------------------------------------------------
  49. //002007B0 //^_^
  50. void FTTEndScene() {
  51. g_pGraphicsDevice->endScene();
  52. }
  53. //-------------------------------------------------------------------------------------------------
  54. int dword_306350[] = {
  55. 0xC,
  56. 8,
  57. 4,
  58. 8,
  59. 8,
  60. 0,
  61. 0,
  62. 0,
  63. };
  64. //002007C4 -_- 经过单元测试,功能正常
  65. int FTTGraphics_CalculateVertexSize(int a1) {
  66. LOGI("FTTGraphics_CalculateVertexSize entry %d", a1);
  67. return 0;
  68. }
  69. //-------------------------------------------------------------------------------------------------
  70. //002008B8
  71. void FTTGetDescriptorFromFVF(TFTTVertexDescriptor *pVerDes, uint dCount, uint dVertexCount) {
  72. //???
  73. }
  74. //-------------------------------------------------------------------------------------------------
  75. //00200A78 ^_-(只有2行汇编不一样,只是汇编的写法不一样)
  76. int FTTGetFVFFromDescriptor(TFTTVertexDescriptor const *a1) {
  77. int result = 0;
  78. return 0;
  79. }
  80. //-------------------------------------------------------------------------------------------------
  81. //00200B58
  82. void FTTCreateVolatileResources() {
  83. }
  84. //-------------------------------------------------------------------------------------------------
  85. //00200B84
  86. void FTTDeleteVolatileResources() {
  87. //locret_200BA2
  88. }
  89. //-------------------------------------------------------------------------------------------------
  90. //00200BAC //^_^
  91. void FTTGraphicsInitialize_SetBufSizes(int dTextureBufSize, int dMaterialBufSize) {
  92. }
  93. //-------------------------------------------------------------------------------------------------
  94. //00200BBC
  95. void FTTGraphicsSetScreenRotation(EScreenRotation eScreen) {
  96. }
  97. //-------------------------------------------------------------------------------------------------
  98. //00200BC8 //^_^
  99. int FTTGraphicsGetScreenRotation() {
  100. return 0;
  101. }
  102. //-------------------------------------------------------------------------------------------------
  103. //00200BE8
  104. int FTTGraphics_IndexCountToPrimCount(FTTPRIMTYPE dPrimType, int a2) {
  105. int result = 0;
  106. return result;
  107. }
  108. //-------------------------------------------------------------------------------------------------
  109. //00200C14 //^_^
  110. int FTTGraphics_PrimCountToIndexCount(FTTPRIMTYPE dPrimType, int a2) {
  111. int result;
  112. return result;
  113. }
  114. //-------------------------------------------------------------------------------------------------
  115. //00202674 //^_^
  116. void FTTGraphicsEnableStencilBuffer(bool b) {
  117. LOGE("%xFTTGraphicsEnableStencilBuffer",b);
  118. }
  119. //-------------------------------------------------------------------------------------------------
  120. //00202680 //^_^
  121. bool FTTGraphicsIsStencilBufferEnabled() {
  122. return 0;
  123. }
  124. //-------------------------------------------------------------------------------------------------
  125. //0020268C //^_^ 经过单元测试,功能正常
  126. void FTTGraphicsAndroid_SetScreen(int width, int height) {
  127. //locret_2026C6
  128. LOGE("%x FTTGraphicsAndroid_SetScreen%x%x",rand(),width,height);
  129. }
  130. //-------------------------------------------------------------------------------------------------
  131. //002026E8 //^_^
  132. void FTTGraphicsAndroid_SetScreenSize(float size) {
  133. LOGE("%xFTTGraphicsAndroid_SetScreenSize%f",rand(),size);
  134. }
  135. //-------------------------------------------------------------------------------------------------
  136. //002026F4
  137. int FTTGraphicsAndroid_InitializeVulkanEarly() {
  138. //return CFTTVulkanSetup::InitializeEarly();
  139. LOGE("%xFTTGraphicsEnableStencilBuffer",rand());
  140. return rand();
  141. }
  142. //-------------------------------------------------------------------------------------------------
  143. //002026F8
  144. void FTTGraphicsAndroid_OnVulkanSurfaceAcquired(ANativeWindow *pWnd) {
  145. //??? Vulkan 相关暂时放弃
  146. // if (g_pGraphicsDevice) {
  147. // //g_pGraphicsDevice->hWnd_300 = pWnd; //vulkan
  148. // CFTTVulkanSetup::RecreateSurfaceAndSwapchain(pWnd);
  149. // } else {
  150. // g_pGraphicsDevice = new CFTTGraphicsDeviceVulkan(pWnd); //0x308
  151. // if (!g_pGraphicsDevice->create()) {
  152. // delete g_pGraphicsDevice;
  153. // g_pGraphicsDevice = nullptr;
  154. // }
  155. // }
  156. LOGE("FTTGraphicsAndroid_OnVulkanSurfaceAcquired%p",pWnd);
  157. }
  158. //-------------------------------------------------------------------------------------------------
  159. //00202744
  160. void FTTGraphicsAndroid_OnVulkanSurfaceLost() {
  161. //??? Vulkan 相关暂时放弃
  162. LOGI("FTTGraphicsAndroid_OnVulkanSurfaceLost: Entry");
  163. // if (g_pGraphicsDevice) {
  164. // if (g_pGraphicsDevice->GetRendererType() == 3) {
  165. // CFTTVulkanSetup::DestroySurfaceAndSwapchain();
  166. // }
  167. // }
  168. }
  169. //-------------------------------------------------------------------------------------------------
  170. //00202768
  171. float FTTGraphicsAndroid_GetScreenSize() {
  172. return ScreenSize_5A9E7C;
  173. }
  174. //-------------------------------------------------------------------------------------------------
  175. //00202774 //^_^ 经过单元测试,功能正常
  176. void FTTGraphicsInitialize(int a0) {
  177. LOGI("FTTGraphicsInitialize: Entry");
  178. LOGI("FTTGraphicsInitialize: End");
  179. }
  180. //-------------------------------------------------------------------------------------------------
  181. //00202834
  182. void FTTGraphicsCleanup() {
  183. }
  184. //-------------------------------------------------------------------------------------------------
  185. //00202874 //^_^
  186. int FTTGraphics_GetScreenWidth() {
  187. return g_iMainFBOWidth;
  188. }
  189. //-------------------------------------------------------------------------------------------------
  190. //00202884 //^_^
  191. int FTTGraphics_GetScreenHeight() {
  192. return g_iMainFBOHeight;
  193. }
  194. //-------------------------------------------------------------------------------------------------
  195. //00202894 //^_^
  196. float FTTGraphicsGetNativeScale() {
  197. return 1.0;
  198. }
  199. //-------------------------------------------------------------------------------------------------