123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- #include "FTT2D.h"
- #include "CFTTUberShader.h"
- #include "CFTTTexture.h"
- #include "CBlitter.h"
- #include "CFTTTime.h"
- #include "CFTT2d_Shader.h"
- #include "CFTTMaterialManager.h"
- #include "CFTTShaderBuiltInConstants.h"
- #include "CFTTCamera.h"
- #include "CFTTGraphicsDevice.h"
- #include "CFTTTextureManager.h"
- #include "CFTTGraphicsBufferOGLES.h"
- #include "CFTTTextureCache.h"
- #include "memctrl.h"
- //fixc
- float FTT2D_CurrentTextureUV[4]; //005AA788
- CFTTTexture *FTT2D_pCurrentTexture; //005AA798
- CBlitter *FTT2D_pBlitter; //005AA79C
- CFTTTexture *FTT2D_pDrawCallTexture; //005AA7A0
- int FTT2D_iOpenScenes; //005AA7A4
- MYSTATIC int dword_348A9C = 65532;
- MYSTATIC int dword_348AA0 = 98298;
- MYSTATIC int linecount_348AA4 = 1024;
- MYSTATIC int dMatID_348AA8 = -1;
- //-------------------------------------------------------------------------------------------------
- //ScaleAlpha(argb5, fs26);
- //0020CEB4 //^_^
- void ScaleAlpha(uint &argb, float f2) {
- uchar *p = reinterpret_cast<uchar *>(&argb);
- uchar cr2 = p[3];
- float fs0 = ((float)cr2) * f2;
- int dr1 = (uint)fs0;
- if (dr1 >= 0xFF) {
- dr1 = 0xFF;
- }
- p[3] = dr1 & (~(dr1 >> 31));
- }
- //-------------------------------------------------------------------------------------------------
- //0020C8D8
- void FTT2D_SetupBufSizes(int a1, int a2, int dLineCount) {
- LOGI("FTT2D_SetupBufSizes: %d %d %d", a1, a2, dLineCount);
- }
- //-------------------------------------------------------------------------------------------------
- //0020C8E4 //^_^
- void FTT2D_Init() {
- LOGI("FTT2D_Init: Entry");
- LOGI("FTT2D_Init: End CFTT2d_Shader::s_tInstance = %d", dMatID_348AA8);
- }
- //-------------------------------------------------------------------------------------------------
- //0020C924
- void FTT2D_Shutdown() {
- }
- //-------------------------------------------------------------------------------------------------
- //0020C96C //^_^ 经过单元测试,功能正常
- void FTT2D_Begin() {
- LOGI("FTT2D_Begin Entry %d", FTT2D_iOpenScenes);
- LOGI("FTT2D_Begin End");
- }
- //-------------------------------------------------------------------------------------------------
- //0020C9E4 //^_^
- void FTT2D_ClearTexture() {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CA28 //^_^
- void FTT2D_SetMaterial(int a1) {
- LOGI("FTT2D_SetMaterial entry");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CA4C //^_^
- void FTT2D_SetDefaultMatBlend(EFTT2D_Blend eBland) {
- LOGE("%x",eBland);
- }
- //-------------------------------------------------------------------------------------------------
- //0020CA68 //^_^ 经过单元测试,功能正常
- void FTT2D_End() {
- LOGI("FTT2D_End: Entry FTT2D_iOpenScenes = %d", FTT2D_iOpenScenes);
- LOGI("FTT2D_End: End");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CA8C //^_^
- void FTT2D_ForceFlush() {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CAA8 //^_^
- __attribute__((noinline)) void FTT2D_OnFrameEnd() {
- //empty
- }
- //-------------------------------------------------------------------------------------------------
- //0020CABC //^_^
- int FTT2D_GetMaterial() {
- int dret = FTT2D_pBlitter->material_4.dMatID_0;
- if (dret == dMatID_348AA8)
- dret = -1;
- return dret;
- }
- //-------------------------------------------------------------------------------------------------
- //0020CAE0 //^_^ 经过单元测试,功能正常
- void FTT2D_SetTexture(CFTTTexture *pTexture, ushort a2) {
- LOGI("FTT2D_SetTexture 0020CAE0 Entry %p%x", pTexture,a2);
- LOGI("FTT2D_SetTexture End");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CB58 -_- 经过单元测试,功能正常
- void FTT2D_SetTextureUV(CFTT2D_TextureUV *pTextureUV, ushort a2) {
- LOGI("FTT2D_SetTextureUV entry");
- LOGE("%x",pTextureUV);
- LOGE("%x",a2);
- LOGI("FTT2D_SetTextureUV end");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CC30 ^_- 经过单元测试,功能正常
- void FTT2D_SetTexture(CFTTTexture *pTexture, CFTT2D_TextureUV *pTextureUV, ushort a3) {
- LOGI("FTT2D_SetTexture 0020CC30 entry");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CC78 ///^_^
- __attribute__((noinline))
- CFTTTexture *
- FTT2D_GetCurrentTexture() {
- return FTT2D_pCurrentTexture;
- }
- //-------------------------------------------------------------------------------------------------
- //0020CC88 ^_- 经过单元测试,功能正常
- void FTT2D_SetTexture(CFTTTextureAtlas *pTextureAtlas, ushort a2, ushort a3) {
- LOGI("FTT2D_SetTexture 0020CC88 entry");
- LOGI("FTT2D_SetTexture 0020CC88 end");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CCE8 ^_- 经过单元测试,功能正常
- void FTT2D_SetTexture(CFTTTextureAtlas *pTextureAtlas, ushort a2, CFTT2D_TextureUV *pTextureUV, ushort a4) {
- LOGI("FTT2D_SetTexture 0020CCE8 entry");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CDA8
- void FTT2D_UpdateTextureUVs(CFTT2D_TexturedVert *pTexturedVert, int dCount) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CDF4
- void FTT2D_EnableScissorTesting(int a1, int a2, int a3, int a4) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CE14
- void FTT2D_DisableScissorTesting() {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CE3C
- void FTT2D_FlipY(bool b) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CE50
- void FTT2D_FlipX(bool b) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020CEDC //^_^ 经过单元测试,功能正常
- void FTT2D_OnMaterialModified(CFTTUberShader *pUberShader, int dIndex) {
- LOGI("FTT2D_OnMaterialModified Entry FTT2D_iOpenScenes = %d", FTT2D_iOpenScenes);
- //locret_20CEF8
- LOGI("FTT2D_OnMaterialModified End");
- }
- //-------------------------------------------------------------------------------------------------
- //0020CF04 //^_^
- CFTTTexture *FTT2D_GetCurrentDrawCallTexture() {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020CF14
- void FTT2D_OnTextureDeletion(CFTTTexture *pTexture) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020D6AC //^_^ 经过单元测试,功能正常
- void FTT2D_GenerateRectUVs(CFTT2D_TexturedVert *list_vert) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020D740
- CFTT2D_TexturedVert *FTT2D_DrawLine(float f1, float f2, float f3, float f4) {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D78C <CFTT2D_TexturedVert>
- CFTT2D_TexturedVert *FTT2D_PrepareDrawLine() {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D7B4
- CFTT2D_TexturedVert *FTT2D_DrawLineCol(float f1, float f2, float f3, float f4, uint a5) {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D818
- CFTT2D_TexturedVert *FTT2D_DrawLineCol2(float f1, float f2, float f3, float f4, uint a5, uint a6) {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D88C
- CFTT2D_TexturedVert *FTT2D_DrawLineP2P(float f1, float f2, float f3, float f4) {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D8B0
- CFTT2D_TexturedVert *FTT2D_DrawLineP2PCol(float f1, float f2, float f3, float f4, uint a5) {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D8D4
- CFTT2D_TexturedVert *FTT2D_DrawLineP2PCol2(float f1, float f2, float f3, float f4,
- uint a5, uint a6) {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020D8F8
- void FTT2D_DrawTriangle(float f1, float f2, float f3, float f4, float f5, float f6,
- bool b7, uint a8) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020D920
- void FTT2D_DrawTriangle3(float v1_x, float v1_y,
- float v2_x, float v2_y,
- float v3_x, float v3_y,
- bool b7,
- uint v1_argb, uint v2_argb, uint v3_argb) {
- //locret_20D9D8
- }
- //-------------------------------------------------------------------------------------------------
- //0020D9E0 CFTT2D_TexturedVert
- CFTT2D_TexturedVert *FTT2D_PrepareDrawTriangle(bool b) {
- CFTT2D_TexturedVert *pvert;
- return pvert;
- }
- //-------------------------------------------------------------------------------------------------
- //0020DA1C
- void FTT2D_DrawCircle(float f1, float f2, float f3, ushort a4, bool b5, uint argb6) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020DB20
- int FTT2D_DrawUnfilledRect(float f1, float f2, float f3, float f4,
- uint argb5,
- float f6, float f7, float f8) {
- //??? 0020DB3E 此处开始的汇编有问题,应该会crash,可能这个函数调用不到
- return 0;
- }
- //-------------------------------------------------------------------------------------------------
- //0020DC20 经过单元测试,功能正常
- template <typename T>
- void FTT2D_GenerateRect(T *pTmp,
- float f1, float f2, float f3, float f4,
- uint argb5, uint argb6, uint argb7, uint argb8,
- float f9, float f10, float f11) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020DD20
- void FTT2D_DrawUnfilledRect4(float f1, float f2, float f3, float f4,
- uint argb5, uint argb6, uint argb7, uint argb8,
- float f9, float f10, float f11) {
- }
- //-------------------------------------------------------------------------------------------------
- //0020DE3C //^_^
- void FTT2D_DrawRect(float f1, float f2, float f3, float f4,
- uint argb5,
- float f6, float f7, float f8) {
- LOGI("FTT2D_DrawRect 0020DE3C entry %.4f %.4f %.4f %.4f %x %.4f %.4f %.4f", f1, f2, f3, f4, argb5, f6, f7, f8);
- }
- //-------------------------------------------------------------------------------------------------
- //0020DEAC //^_^ 经过单元测试,功能正常
- template <typename T>
- T *FTT2D_PrepareDrawFilledRect() {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020DED4
- void FTT2D_DrawRect4(float f1, float f2, float f3, float f4,
- uint argb5, uint argb6, uint argb7, uint argb8,
- float f9, float f10, float f11) {
- LOGE("%x%x%x%x%x%x%x%x%x%x%x",f1,f2,f3,f4,argb5,argb6,argb7,argb8,f9,f10,f11);
- }
- //-------------------------------------------------------------------------------------------------
- //0020DF68 -_- 经过单元测试,功能正常
- void FTT2D_DrawTexturedRect(float f1, float f2, float f3, float f4,
- uint argb5,
- float f6, float f7, float f8) {
- LOGI("FTT2D_DrawTexturedRect: Entry %.2f, %.2f, %.2f, %.2f", f1, f2, f3, f4);
- LOGE("%x%x%x%x%x%x%x%x",f1,f2,f3,f4,argb5,f6,f7,f8);
- LOGI("FTT2D_DrawTexturedRect: End");
- }
- //-------------------------------------------------------------------------------------------------
- //0020E028 CFTT2D_TexturedVert //^_^
- template <typename T>
- T *FTT2D_PrepareDrawTexturedRect() {
- return nullptr;
- }
- //-------------------------------------------------------------------------------------------------
- //0020E058
- void FTT2D_DrawTexturedRect4(float f1, float f2, float f3, float f4,
- uint argb5, uint argb6, uint argb7, uint argb8,
- float f9, float f10, float f11) {
- //loc_20E158
- }
- //-------------------------------------------------------------------------------------------------
- //0020E174
- void FTT2D_DrawTexturedRect5(float f1, float f2, float f3, float f4,
- uint a5, uint a6, uint a7, uint a8, uint a9,
- float f10, float f11, float f12) {
- FTT2D_DrawTexturedRect4(f1, f2, f3, f4, a5, a6, a7, a8, f10, f11, f12);
- }
- //-------------------------------------------------------------------------------------------------
- //0020E1A8
- void FTT2D_DrawTexturedVertList(CFTT2D_TexturedVert *pTexturedVert, int a2) {
- LOGE("FTT2D_DrawTexturedVertList%p%x",pTexturedVert,a2);
- }
- //-------------------------------------------------------------------------------------------------
- //0020E1E0
- void FTT2D_DrawTexturedVertStrip(CFTT2D_TexturedVert *pTexturedVert, int dCount) {
- }
- //-------------------------------------------------------------------------------------------------
- //00202860 经过单元测试,功能正常
- void FTTPresentScene(bool b) {
- //locret_202870
- }
- //-------------------------------------------------------------------------------------------------
|