Parcourir la source

0x00178378,SETUP_ExpandPlayers bugfix

DESKTOP-AB9OQPJ\RED-10 il y a 3 ans
Parent
commit
31a0651eda
5 fichiers modifiés avec 106 ajouts et 38 suppressions
  1. 2 1
      jni/CDataBase.cpp
  2. 3 1
      jni/CStoryCore.cpp
  3. 1 1
      jni/CTeam.h
  4. 100 35
      jni/SETUP.cpp
  5. 0 0
      obj/local/armeabi-v7a/objs/Hero/linker.list.tmp

+ 2 - 1
jni/CDataBase.cpp

@@ -90,7 +90,8 @@ bool CDataBase::IsLeagueInternational(ELeague e, int a) {
 //0011B116 static
 bool CDataBase::IsTeamInternational(int a) {
   //loc_11B13C
-  return false;
+  LOGE("IsTeamInternational%x",a);
+  return rand()%2==1;
 }
 //-------------------------------------------------------------------------------------------------
 //0011B140 static

+ 3 - 1
jni/CStoryCore.cpp

@@ -482,7 +482,9 @@ int CStoryCore::GetStageUnlockTime(int, int) { return 0; }
 int CStoryCore::GetStageUnlockTime(int) { return 0; }
 //---------------------------------------------------------------------------------------------------------
 // 001E34FC ^_^
-uchar CStoryCore::GetShirtNumber() { return 0; }
+uchar CStoryCore::GetShirtNumber() { 
+  LOGE("GetShirtNumber");
+  return rand(); }
 //---------------------------------------------------------------------------------------------------------
 // 001E3530
 void CStoryCore::SetStageStars(int, int) {}

+ 1 - 1
jni/CTeam.h

@@ -147,7 +147,7 @@ class CTeam {
 public:
   int16 sIndex_0;
   uchar field_2;
-  uchar leagueId_3;
+  char leagueId_3;//00178392
   uchar field_4;
   uchar field_5;
   wchar_t name_6[0x21];

+ 100 - 35
jni/SETUP.cpp

@@ -1,96 +1,161 @@
 #include "SETUP.h"
+
 #include "CStoryCore.h"
-#include "str_conv.h"
 #include "TGame.h"
-#include "name.h"
 #include "XSYS.h"
+#include "name.h"
+#include "str_conv.h"
 
-MYSTATIC ECountry gs_icountryTable_2FE4C0[] = {ECountry_ENG_D,
-                                               ECountry_neg1,
-                                               ECountry_FRA_A,
-                                               ECountry_ITA_1,
-                                               ECountry_GER_2,
-                                               ECountry_SPA_0,
-                                               ECountry_SPA_0,
-                                               ECountry_SPA_0,
-                                               ECountry_CRO_4};
+MYSTATIC ECountry gs_icountryTable_2FE4C0[] = {
+    ECountry_ENG_D, ECountry_neg1,  ECountry_FRA_A,
+    ECountry_ITA_1, ECountry_GER_2, ECountry_SPA_0,
+    ECountry_SPA_0, ECountry_SPA_0, ECountry_CRO_4};
 
-MYSTATIC int gs_idword_2FEE80[] = {0xBF, 0xB0, 0xC0, 0xB7, 0xAD, 0xB2, 0xAE, 0xB7, 0xAC, 0xBD, 0xB0};
+MYSTATIC int gs_idword_2FEE80[] = {0xBF, 0xB0, 0xC0, 0xB7, 0xAD, 0xB2,
+                                   0xAE, 0xB7, 0xAC, 0xBD, 0xB0};
 
 unsigned int s_iDefaultThirdGKCols[20] = {
     0xFF404040, 0xFF404040, 0xFFFFFFFF, 0xFF404040, 0xFF404040,
     0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000,
     0xFFC0C0C0, 0xFFC0C0C0, 0xFF000000, 0xFFC0C0C0, 0xFFC0C0C0,
-    0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};  //0033EA0C
+    0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};  // 0033EA0C
 
 //-------------------------------------------------------------------------------------------------
-//0011BB30
-wchar_t* SURNAME_GetNameFromMainList(ECountry) {
-  return nullptr;
-}
+// 0011BB30
+wchar_t* SURNAME_GetNameFromMainList(ECountry) { return nullptr; }
 //-------------------------------------------------------------------------------------------------
-//0011BEF8
-wchar_t* SURNAME_GetName(int, ECountry, bool) {
-  return nullptr;
-}
+// 0011BEF8
+wchar_t* SURNAME_GetName(int, ECountry, bool) { return nullptr; }
 //-------------------------------------------------------------------------------------------------
-//0017864a  ^_^  返回值必须是int否则不是笑脸 实际应该是个char
+// 0017864a  ^_^  返回值必须是int否则不是笑脸 实际应该是个char
 //单元测试等级: 目测游戏表现
 //单元测试内容: 玩游戏第2 6 7关
 //单元测试结果: 正常
 //已测试分支:  loc_178652
 //未测试分支: loc_178666
-int SETUP_GetCaptainIndex(CTeam* pteam0) {
-  return -1;
-}
+int SETUP_GetCaptainIndex(CTeam* pteam0) { return -1; }
 //-------------------------------------------------------------------------------------------------
-//0017829c  ^_-
+// 0017829c  ^_-
 //单元测试等级: 目测游戏表现
 //单元测试内容: 玩游戏第三关3到第4关
 //单元测试结果: 正常
 //已测试分支:   0017829C loc_1782D2
 //未测试分支:   无
-void SETUP_ExpandPlayer(TPlayerInfo* ptplayerInfo0, TPlayerInfoLight* ptllayerInfoLight1, int i2, ECountry country3, bool b5) {
+void SETUP_ExpandPlayer(TPlayerInfo* ptplayerInfo0,
+                        TPlayerInfoLight* ptllayerInfoLight1, int i2,
+                        ECountry country3, bool b5) {
+  LOGE("%x%x%x%x%x", ptplayerInfo0, ptllayerInfoLight1, i2, country3, b5);
   return;
 }
 //-------------------------------------------------------------------------------------------------
-//00178378   ^_-
+// 00178378   ^_-
 //单元测试等级: 目测游戏表现
 //单元测试内容: 玩游戏到第3关
 //单元测试结果: 正常
 //已测试分支:    00178378 loc_1783B4 loc_1783FC
 //未测试分支: loc_1783A4 loc_1783B4——2  loc_17842A
 void SETUP_ExpandPlayers(CTeam* pteam0, TTeamInfo* pteam1Info1) {
+  pteam0->field_1EC = 0;
+  bool r9_bisTeamInternational =
+      CDataBase::IsTeamInternational(pteam0->sIndex_0);
+  ECountry r8_ecountry = ECountry_SPA_0;
+  if (r9_bisTeamInternational == false && pteam0->leagueId_3 <= 5) {
+    r8_ecountry = gs_icountryTable_2FE4C0[pteam0->leagueId_3];
+  } else {
+    // loc_1783A4
+    r8_ecountry = ECountry_neg1;
+  }
+
+  // loc_1783A8
+  TPlayerInfoLight* r6_ptplayerInfoLight = pteam1Info1->ptplayerInfoLight_10A8;
+  // loc_1783E0
+  for (int r7_i = 0; r7_i != 0x10; r7_i++) {
+    // loc_1783B4
+    ECountry r3_ecountry = r8_ecountry;  //获取国家
+    if (r9_bisTeamInternational) {
+      r3_ecountry = (ECountry)r6_ptplayerInfoLight->country_3;
+    }
+    SETUP_ExpandPlayer(&pteam0->ptplayerInfo_1F0[r7_i], r6_ptplayerInfoLight,
+                       r7_i, r3_ecountry, r9_bisTeamInternational);
+    r6_ptplayerInfoLight++;
+    pteam0->field_1EC++;
+  }
+  // 001783E4
+  //  loc_178400
+  unsigned int r0_ui = pteam0->field_1EC;
+  for (unsigned int r6_i = 0; r6_i < r0_ui; r6_i++) {
+    // loc_1783EA
+    uchar r0_number = CStoryCore::GetShirtNumber();
+    if (r6_i != 0x7) {
+      if (pteam0->ptplayerInfo_1F0[r6_i].shirtNum_5F != r0_number) {
+        continue;
+      } else {
+        // loc_17840A
+        uint r2_u = 0xC;
+        while (r2_u <= 0x62) {
+          r6_i = 0;
+          while (r6_i < pteam0->field_1EC && r2_u != r0_number) {
+            r6_i++;
+          };
+          if (r6_i >= pteam0->field_1EC) {
+            // loc_17842A
+            pteam0->ptplayerInfo_1F0->shirtNum_5F = r2_u;
+            break;
+          } else
+            r2_u = r0_number + 1;
+        }
+        break;
+      }
+    }
+  }
+  // loc_17842C
+  int i_r1 = 0x0;
+  // loc_178442
+  while (i_r1 != 0xB) {
+    // loc_178434
+    pteam0->ptplayerInfo_1F0[i_r1].field_50 = gs_idword_2FEE80[i_r1];
+    i_r1++;
+  }
+
+  // loc_17845A
+  unsigned int r0_i = 0xB;
+  while (r0_i < pteam0->field_1EC) {
+    // loc_178450
+    // LOGI("loc_178450 ");
+    pteam0->ptplayerInfo_1F0[r0_i].field_50 = 0xB6;
+    r0_i++;
+  }
   return;
 }
 //-------------------------------------------------------------------------------------------------
-//001781d0 ^_-
+// 001781d0 ^_-
 //单元测试等级: 目测游戏表现
 //单元测试内容: resetgame 加载hero
 //单元测试结果: 正常
 //已测试分支:   001781d0
 //未测试分支: 无
 void SETUP_StandardPlayer(TPlayerInfo* ptplayInfo0) {
-  //LOGE("SETUP_StandardPlayer");
+  // LOGE("SETUP_StandardPlayer");
 }
 //-------------------------------------------------------------------------------------------------
-//001784c8 ^_-
+// 001784c8 ^_-
 //单元测试等级: 目测游戏表现
 //单元测试内容:
 //单元测试结果: 正常
 //已测试分支:loc_17854A  loc_17859C loc_1785E8  loc_178626_1 loc_178626_2
 //未测试分支: 001784c8
-void SETUP_TeamExpand(CTeam* pteam0, TPlayerInfo* ptplayerInfo1, TPlayerInfo* ptplayerInfo2, ushort us3) {
-  //001784C8
+void SETUP_TeamExpand(CTeam* pteam0, TPlayerInfo* ptplayerInfo1,
+                      TPlayerInfo* ptplayerInfo2, ushort us3) {
+  // 001784C8
 }
 //-------------------------------------------------------------------------------------------------
-//00178474  ^_-
+// 00178474  ^_-
 //单元测试等级: 目测游戏表现
 //单元测试内容:
 //单元测试结果: 无
 //已测试分支:   函数未调用
 //未测试分支:
 void SETUP_TeamNames() {
-  //00178474
+  // 00178474
 }
 //-------------------------------------------------------------------------------------------------

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
obj/local/armeabi-v7a/objs/Hero/linker.list.tmp


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff