CStoryCore.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. #include "CStoryCore.h"
  2. #include "CMyProfile.h"
  3. #include "CFTTDateTimeUtils.h"
  4. #include "CFTTServerTime.h"
  5. #include "LOCstring.h"
  6. #include "CMessageBoxHandler.h"
  7. #include "xsnprintf.h"
  8. #include "CFTTFileSystem.h"
  9. #include "XML.h"
  10. #include "TStoryConfig.h"
  11. #include "STORY.h"
  12. #include "CFE.h"
  13. #include "CUnlockables.h"
  14. #include "memctrl.h"
  15. CStageManager CStoryCore::m_tStageManager;
  16. TCStoryCoreActiveStory CStoryCore::m_tActiveStory;
  17. CSideStoryProfile CStoryCore::m_cSideProfile;
  18. CStoryProfile CStoryCore::m_cProfile;
  19. TStoryStages CStoryCore::m_tStages;
  20. //---------------------------------------------------------------------------------------------------------
  21. //0017622C
  22. int CStoryCore::GetMinutes() {
  23. return CStoryCore::m_tStageManager.GetMinutes();
  24. }
  25. //---------------------------------------------------------------------------------------------------------
  26. //001E1B78
  27. void CStoryCore::Init() {
  28. }
  29. //---------------------------------------------------------------------------------------------------------
  30. //001E1BA4
  31. int CStoryCore::SetupStage(int) {
  32. return 0;
  33. }
  34. //---------------------------------------------------------------------------------------------------------
  35. //001E1CDC
  36. ushort CStoryCore::GetClubTeam() {
  37. return 0;
  38. }
  39. //---------------------------------------------------------------------------------------------------------
  40. //001E1CEC
  41. ushort CStoryCore::GetNationalTeam() {
  42. return 0;
  43. }
  44. //---------------------------------------------------------------------------------------------------------
  45. //001E1CFC
  46. ushort CStoryCore::GetSeason() {
  47. return 0;
  48. }
  49. //---------------------------------------------------------------------------------------------------------
  50. //001E1D30
  51. ushort CStoryCore::GetStageIndex() {
  52. return 0;
  53. }
  54. //---------------------------------------------------------------------------------------------------------
  55. //001E1D64
  56. void CStoryCore::SetupStageX(char const *, int) {
  57. }
  58. //---------------------------------------------------------------------------------------------------------
  59. //001E1D78
  60. void CStoryCore::SetupStageX(TStoryStage *) {
  61. }
  62. //---------------------------------------------------------------------------------------------------------
  63. //001E1D88
  64. void CStoryCore::SetupSingleNIS(TStageOperation *) {
  65. }
  66. //---------------------------------------------------------------------------------------------------------
  67. //001E1D9C
  68. void CStoryCore::SetupSingleNIS(char const *, int, int) {
  69. }
  70. //---------------------------------------------------------------------------------------------------------
  71. //001E1DBC
  72. void CStoryCore::AddNISCommentary(int) {
  73. }
  74. //---------------------------------------------------------------------------------------------------------
  75. //001E1DCC
  76. void CStoryCore::SetupAndEnterGame(ELoadingScreen, bool, bool) {
  77. }
  78. //---------------------------------------------------------------------------------------------------------
  79. //001E1DF8
  80. void CStoryCore::PlayStage(bool, bool) {
  81. }
  82. //---------------------------------------------------------------------------------------------------------
  83. //001E1E08
  84. void CStoryCore::EnterGame(ELoadingScreen, bool) {
  85. }
  86. //---------------------------------------------------------------------------------------------------------
  87. //001E1E1C
  88. void CStoryCore::Process() {
  89. }
  90. //---------------------------------------------------------------------------------------------------------
  91. //001E1E2C
  92. void CStoryCore::RenderHUD() {
  93. }
  94. //---------------------------------------------------------------------------------------------------------
  95. //001E1E3C
  96. void CStoryCore::GetOppoTeam(int, int, int, int, TTeamInfo *) {
  97. }
  98. //---------------------------------------------------------------------------------------------------------
  99. //001E1E8C
  100. void CStoryCore::SetupNextStage() {
  101. }
  102. //---------------------------------------------------------------------------------------------------------
  103. //001E1EC0 ^_^
  104. void CStoryCore::LoadConfigForPromoLanguages() {
  105. }
  106. //---------------------------------------------------------------------------------------------------------
  107. //001E1EEC 按照自己思路写了一下, 因为好多是网络云相关, 直接跳过 没弄完
  108. CFTTXmlReader *CStoryCore::GetCorrectConfig(bool a1) {
  109. CFTTXmlReader *ret = NULL;
  110. return ret;
  111. }
  112. //---------------------------------------------------------------------------------------------------------
  113. //001E1FFC
  114. void CStoryCore::LoadConfigForTimeAndRepeatNotifications() {
  115. LOGI("CStoryCore::LoadConfigForTimeAndRepeatNotifications entry");
  116. }
  117. //---------------------------------------------------------------------------------------------------------
  118. //001E2028
  119. void CStoryCore::FindLatestRepeatNotifications(long &d) {
  120. LOGI("CStoryCore::FindLatestRepeatNotifications entry %ld", d);
  121. }
  122. //---------------------------------------------------------------------------------------------------------
  123. //001E2058
  124. void CStoryCore::FindLatestTimeNotifications(long &d) {
  125. LOGI("CStoryCore::FindLatestTimeNotifications entry %ld", d);
  126. }
  127. //---------------------------------------------------------------------------------------------------------
  128. //001E2088
  129. bool CStoryCore::DownloadConfig() {
  130. int v1 = random();
  131. if (sinf(v1) > 0) {
  132. return true;
  133. } else {
  134. return false;
  135. }
  136. }
  137. //---------------------------------------------------------------------------------------------------------
  138. //001E20B4
  139. void CStoryCore::LoadConfig(bool a1) {
  140. LOGI("CStoryCore::LoadConfig entry");
  141. LOGI("CStoryCore::LoadConfig end");
  142. }
  143. //---------------------------------------------------------------------------------------------------------
  144. //001E2100
  145. void CStoryCore::LoadAdvertsFromConfig() {
  146. }
  147. //---------------------------------------------------------------------------------------------------------
  148. //001E213C ^_^
  149. bool CStoryCore::LoadStages() {
  150. return true;
  151. }
  152. //---------------------------------------------------------------------------------------------------------
  153. //001E21D0
  154. void CStoryCore::OnFreeGameAssets() {
  155. }
  156. //---------------------------------------------------------------------------------------------------------
  157. //001E2208
  158. bool CStoryCore::GetPlayerInitialised() {
  159. return 0;
  160. }
  161. //---------------------------------------------------------------------------------------------------------
  162. //001E2218
  163. TStage* CStoryCore::GetStageInfo(int) {
  164. return NULL;
  165. }
  166. //---------------------------------------------------------------------------------------------------------
  167. //001E226C
  168. void CStoryCore::GetTodaysDate(wchar_t *, int) {
  169. }
  170. //---------------------------------------------------------------------------------------------------------
  171. //001E229C
  172. const char *CStoryCore::GetTrophyModelName() {
  173. return "League";
  174. }
  175. //---------------------------------------------------------------------------------------------------------
  176. //001E231C
  177. void CStoryCore::UpdateEnvironment() {
  178. }
  179. //---------------------------------------------------------------------------------------------------------
  180. //001E242C
  181. void CStoryCore::RandomiseSunPos() {
  182. }
  183. //---------------------------------------------------------------------------------------------------------
  184. //001E2520
  185. void CStoryCore::ProcessText(wchar_t *r0_wp, int r1_i, wchar_t const *r2_wp, int r3_i) {
  186. // int r0_size=xstrlen(r2_wp)*2;
  187. // int r11_i=r1_i+r0_size+0x20;
  188. // //check
  189. // wchar_t*r10_wp= new wchar_t[r11_i];
  190. // memset(r10_wp,0,r11_i*sizeof(wchar_t));
  191. // wchar_t*r5_wp=r10_wp;
  192. // //loc_1E2562
  193. // //loc_1E256C
  194. // while(r2_wp){
  195. // const wchar_t*r7_substr= xstrstr(r2_wp,L"#");
  196. // if(r7_substr){
  197. // //001E258A
  198. // wchar_t wp_sp10[0x40];
  199. // memset(wp_sp10,0,sizeof(wp_sp10));
  200. // //sp8=r1_i
  201. // switch (r7_substr[1])
  202. // {
  203. // case 'N'{
  204. // break;
  205. // }
  206. // default:
  207. // {
  208. // wp_sp10[0]=r7_substr[0];
  209. // break;
  210. // }
  211. // }
  212. // }else{
  213. // //loc_1E256C
  214. // xstrlcpy(r5_wp,r2_wp,r11_i-(r5_wp-r10_wp))
  215. // }
  216. // }
  217. // //loc_1E2756
  218. // xstrlcpy(r0_wp,r10_wp,r1_i);
  219. // delete [] r10_wp;
  220. }
  221. //---------------------------------------------------------------------------------------------------------
  222. //001E2798
  223. ushort CStoryCore::GetStageClubTeam(int) {
  224. return 0;
  225. }
  226. //---------------------------------------------------------------------------------------------------------
  227. //001E27C8
  228. ushort CStoryCore::GetStageTeam(int) {
  229. return 0;
  230. }
  231. //---------------------------------------------------------------------------------------------------------
  232. //001E2870 //这个函数没啥用, 作用是当关卡版本不一样的时候, 去更新关卡。
  233. void CStoryCore::CheckStageVersions() {
  234. return;
  235. /*
  236. int v4=0;
  237. while (v4 != 2)
  238. {
  239. int v5 = 0;
  240. MP_cMyProfile.SetIsSideStory(v4 == 1, 0);
  241. if ( v5 >= *CStoryCore::m_tActiveStory.field_4 )
  242. {
  243. v4 ++;
  244. continue;
  245. }
  246. int v11;
  247. TStorySeason *pTStorySeason = &CStoryCore::m_tActiveStory.field_0[v5];
  248. for(int i =0; i<pTStorySeason->StageCount_d0; i++)
  249. {
  250. v11 = i;
  251. if ( !MP_cMyProfile.isSideStory )
  252. v11 = pTStorySeason->TStage_d4[i].ID_0;
  253. CStoryProfileStages *pCStoryProfileStages = MP_cMyProfile.GetProfileStages();
  254. ushort *ver = pCStoryProfileStages->GetStageVersionPointer(pTStorySeason->TStage_d4[i].ID_0, v11);
  255. char v31[0x80];
  256. bool v16;
  257. snprintf(v31, 0x80, "PKG:/data/hero/stages/stg_%04i.dat", pTStorySeason->TStage_d4[i].ID_0);
  258. if ( CFTTFileSystem::FileExists(v31, v14) )
  259. {
  260. v16 = false;
  261. }
  262. else
  263. {
  264. memset(v31, 0, 0x80);
  265. snprintf(v31, 0x80, "SUPPORT:stg_%04i.dat",pTStorySeason->TStage_d4[i].ID_0);
  266. v16 = !CFTTFileSystem::FileExists(v31);
  267. }
  268. if ( !ver || v16 || (pTStorySeason->TStage_d4[i].Version_4 == *ver) )
  269. {
  270. if ( !v16 )
  271. continue;
  272. printf("CDownloads::RequestStageDownload(v10, v15)");
  273. continue;
  274. }
  275. snprintf(v31, 0x80, "stg_%04i.dat", pTStorySeason->TStage_d4[i].ID_0);
  276. TStoryStage v22;
  277. v22.Photo_2bc.PhotoPost_bc.Filter_0 = 0;
  278. v22.Photo_2bc.PhotoPost_bc.Red_4 = 1.0;
  279. v22.Photo_2bc.PhotoPost_bc.Green_8 = 1.0;
  280. v22.Photo_2bc.PhotoPost_bc.Blue_c = 1.0;
  281. v22.Photo_2bc.PhotoPost_bc.Brightness_10 = 0.5;
  282. v22.Photo_2bc.PhotoPost_bc.Contrast_14 = 0.5;
  283. v22.Photo_2bc.PhotoPost_bc.Saturation_18 = 0.5;
  284. v22.Photo_2bc.PhotoPost_bc.Vignette_1c = 0.0;
  285. STORY_LoadStage(&v22, v31);
  286. }
  287. }
  288. MP_cMyProfile.SetIsSideStory(MP_cMyProfile.isSideStory, 0);*/
  289. }
  290. //---------------------------------------------------------------------------------------------------------
  291. //001E2A40
  292. TStorySeason* CStoryCore::GetStageSeason(int) {
  293. return NULL;
  294. }
  295. //---------------------------------------------------------------------------------------------------------
  296. //001E2A98
  297. int CStoryCore::GetAreGoldenBootsEnabled() {
  298. return 0;
  299. }
  300. //---------------------------------------------------------------------------------------------------------
  301. //001E2A9C
  302. bool CStoryCore::AttemptSideStoryEntry() {
  303. return false;
  304. }
  305. //---------------------------------------------------------------------------------------------------------
  306. //001E2B20
  307. int CStoryCore::EnterSideStory() {
  308. int dr0 = 0;
  309. return dr0;
  310. }
  311. //---------------------------------------------------------------------------------------------------------
  312. //001E2BA4 ^_^
  313. TStorySeason *CStoryCore::STORY_GetSeason(int a1) {
  314. TStorySeason *result;
  315. return result;
  316. }
  317. //---------------------------------------------------------------------------------------------------------
  318. //001E2BC8 ^_^
  319. TStorySeason *CStoryCore::GetConfigSeasonWithID(int dr0) {
  320. return NULL;
  321. }
  322. //---------------------------------------------------------------------------------------------------------
  323. //001E2C04
  324. void CStoryCore::PromotionCB(int, void *) {
  325. }
  326. //---------------------------------------------------------------------------------------------------------
  327. //001E2C1C
  328. int CStoryCore::ShowPromotion(int, bool, bool, EPromoTriggerType, int, int, bool) {
  329. return 0;
  330. }
  331. //---------------------------------------------------------------------------------------------------------
  332. //001E3124
  333. int CStoryCore::CalculateCurrentStageID() {
  334. return 0;
  335. }
  336. //---------------------------------------------------------------------------------------------------------
  337. //001E31D8
  338. int CStoryCore::CountNumValidPromos() {
  339. return 0;
  340. }
  341. //---------------------------------------------------------------------------------------------------------
  342. //001E3208
  343. int CStoryCore::IsPromoValid(TPromo const *, bool) {
  344. return 0;
  345. }
  346. //---------------------------------------------------------------------------------------------------------
  347. //001E33D4
  348. TPromo* CStoryCore::FindValidPromo(int, bool) {
  349. return 0;
  350. }
  351. //---------------------------------------------------------------------------------------------------------
  352. //001E3418
  353. void CStoryCore::SetSeason(int dr1) {
  354. }
  355. //---------------------------------------------------------------------------------------------------------
  356. //001E3448
  357. int CStoryCore::GetStageUnlockTime(int, int) {
  358. return 0;
  359. }
  360. //---------------------------------------------------------------------------------------------------------
  361. //001E34A6
  362. int CStoryCore::GetStageUnlockTime(int) {
  363. return 0;
  364. }
  365. //---------------------------------------------------------------------------------------------------------
  366. //001E34FC ^_^
  367. uchar CStoryCore::GetShirtNumber() {
  368. return 0;
  369. }
  370. //---------------------------------------------------------------------------------------------------------
  371. //001E3530
  372. void CStoryCore::SetStageStars(int, int) {
  373. }
  374. //---------------------------------------------------------------------------------------------------------
  375. //001E3570
  376. void CStoryCore::SetStageComplete(int, int) {
  377. }
  378. //---------------------------------------------------------------------------------------------------------
  379. //001E35CC
  380. void CStoryCore::SetLastPlayedStageID(int) {
  381. }
  382. //---------------------------------------------------------------------------------------------------------
  383. //001E35F4
  384. CStoryProfileStages* CStoryCore::GetProfileStages() {
  385. return 0;
  386. }
  387. //---------------------------------------------------------------------------------------------------------
  388. //001E3620
  389. void CStoryCore::ApplyUserPlayer(TPlayerInfo *) {
  390. }
  391. //---------------------------------------------------------------------------------------------------------
  392. //001E3650
  393. //这个函数,没有调试完成,原因是swprintf并不是原始SO内的那个, 传参也不一样, 需要写个HOOK, 看下实际程序的返回
  394. int CStoryCore::GetTimeString(long a1, wchar_t *a2, bool a3) {
  395. return 1;
  396. }
  397. //---------------------------------------------------------------------------------------------------------
  398. //001E3798
  399. time_t CStoryCore::GetTimeFromString(char *pcr0, int dr1) {
  400. return 0;
  401. }
  402. //---------------------------------------------------------------------------------------------------------
  403. //001E37BC
  404. void CStoryCore::IncrementSessionStagesComplete(bool) {
  405. }
  406. //---------------------------------------------------------------------------------------------------------