#include "CStoryCore.h" #include "CFE.h" #include "CFTTDateTimeUtils.h" #include "CFTTFileSystem.h" #include "CFTTServerTime.h" #include "CMessageBoxHandler.h" #include "CMyProfile.h" #include "CUnlockables.h" #include "FESU.h" #include "LOCstring.h" #include "STORY.h" #include "TGame.h" #include "TStoryConfig.h" #include "XML.h" #include "memctrl.h" #include "xsnprintf.h" CStageManager CStoryCore::m_tStageManager; TCStoryCoreActiveStory CStoryCore::m_tActiveStory; CSideStoryProfile CStoryCore::m_cSideProfile; CStoryProfile CStoryCore::m_cProfile; TStoryStages CStoryCore::m_tStages; //--------------------------------------------------------------------------------------------------------- // 0017622C int CStoryCore::GetMinutes() { return CStoryCore::m_tStageManager.GetMinutes(); } //--------------------------------------------------------------------------------------------------------- // 001E1B78 void CStoryCore::Init() {} //--------------------------------------------------------------------------------------------------------- // 001E1BA4 int CStoryCore::SetupStage(int) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E1CDC ushort CStoryCore::GetClubTeam() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E1CEC ushort CStoryCore::GetNationalTeam() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E1CFC ushort CStoryCore::GetSeason() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E1D30 ushort CStoryCore::GetStageIndex() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E1D64 void CStoryCore::SetupStageX(char const *, int) {} //--------------------------------------------------------------------------------------------------------- // 001E1D78 void CStoryCore::SetupStageX(TStoryStage *) {} //--------------------------------------------------------------------------------------------------------- // 001E1D88 void CStoryCore::SetupSingleNIS(TStageOperation *) {} //--------------------------------------------------------------------------------------------------------- // 001E1D9C void CStoryCore::SetupSingleNIS(char const *, int, int) {} //--------------------------------------------------------------------------------------------------------- // 001E1DBC void CStoryCore::AddNISCommentary(int) {} //--------------------------------------------------------------------------------------------------------- // 001E1DCC void CStoryCore::SetupAndEnterGame(ELoadingScreen, bool, bool) {} //--------------------------------------------------------------------------------------------------------- // 001E1DF8 void CStoryCore::PlayStage(bool, bool) {} //--------------------------------------------------------------------------------------------------------- // 001E1E08 void CStoryCore::EnterGame(ELoadingScreen, bool) {} //--------------------------------------------------------------------------------------------------------- // 001E1E1C void CStoryCore::Process() {} //--------------------------------------------------------------------------------------------------------- // 001E1E2C void CStoryCore::RenderHUD() {} //--------------------------------------------------------------------------------------------------------- // 001E1E3C void CStoryCore::GetOppoTeam(int, int, int, int, TTeamInfo *) {} //--------------------------------------------------------------------------------------------------------- // 001E1E8C void CStoryCore::SetupNextStage() {} //--------------------------------------------------------------------------------------------------------- // 001E1EC0 ^_^ void CStoryCore::LoadConfigForPromoLanguages() {} //--------------------------------------------------------------------------------------------------------- // 001E1EEC 按照自己思路写了一下, 因为好多是网络云相关, 直接跳过 没弄完 CFTTXmlReader *CStoryCore::GetCorrectConfig(bool a1) { CFTTXmlReader *ret = NULL; return ret; } //--------------------------------------------------------------------------------------------------------- // 001E1FFC void CStoryCore::LoadConfigForTimeAndRepeatNotifications() { LOGI("CStoryCore::LoadConfigForTimeAndRepeatNotifications entry"); } //--------------------------------------------------------------------------------------------------------- // 001E2028 void CStoryCore::FindLatestRepeatNotifications(long &d) { LOGI("CStoryCore::FindLatestRepeatNotifications entry %ld", d); } //--------------------------------------------------------------------------------------------------------- // 001E2058 void CStoryCore::FindLatestTimeNotifications(long &d) { LOGI("CStoryCore::FindLatestTimeNotifications entry %ld", d); } //--------------------------------------------------------------------------------------------------------- // 001E2088 bool CStoryCore::DownloadConfig() { int v1 = random(); if (sinf(v1) > 0) { return true; } else { return false; } } //--------------------------------------------------------------------------------------------------------- // 001E20B4 void CStoryCore::LoadConfig(bool a1) { LOGI("CStoryCore::LoadConfig entry"); LOGI("CStoryCore::LoadConfig end"); } //--------------------------------------------------------------------------------------------------------- // 001E2100 void CStoryCore::LoadAdvertsFromConfig() {} //--------------------------------------------------------------------------------------------------------- // 001E213C ^_^ bool CStoryCore::LoadStages() { return true; } //--------------------------------------------------------------------------------------------------------- // 001E21D0 void CStoryCore::OnFreeGameAssets() {} //--------------------------------------------------------------------------------------------------------- // 001E2208 bool CStoryCore::GetPlayerInitialised() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E2218 TStage *CStoryCore::GetStageInfo(int) { return NULL; } //--------------------------------------------------------------------------------------------------------- // 001E226C void CStoryCore::GetTodaysDate(wchar_t *, int) {} //--------------------------------------------------------------------------------------------------------- // 001E229C const char *CStoryCore::GetTrophyModelName() { return "League"; } //--------------------------------------------------------------------------------------------------------- // 001E231C void CStoryCore::UpdateEnvironment() {} //--------------------------------------------------------------------------------------------------------- // 001E242C void CStoryCore::RandomiseSunPos() {} //--------------------------------------------------------------------------------------------------------- // 001E2520 ^_- //单元测试等级: 目测游戏表现 //单元测试内容: 前10关 //单元测试结果:正常 //已测试分支 0 1 17 18 void CStoryCore::ProcessText(wchar_t *r0_wp, int r1_i, wchar_t const *r2_wp, int r3_i) { wchar_t const *r8_pw = r2_wp; int r0_size = xstrlen(r2_wp) * 2; int r11_i = r1_i + r0_size + 0x20; // check wchar_t *r10_wp = new wchar_t[r11_i]; memset(r10_wp, 0, r11_i * sizeof(wchar_t)); wchar_t *r5_wp = r10_wp; wchar_t const *r7_pw = r2_wp; // loc_1E2562 // loc_1E256C LOGE("ProcessText_0");//ok while (r7_pw) { r7_pw = xstrstr(r8_pw, L"#"); // loc_1E2576 LOGE("ProcessText_1");//ok if (r7_pw) { // 001E258A LOGE("ProcessText_2"); wchar_t wp_sp10[0x40]; memset(wp_sp10, 0, sizeof(wp_sp10)); // sp8=r1_i switch (r7_pw[1]) { case 'N': { LOGE("ProcessText_3"); // loc_1E25E6 wchar_t *r0_pteam_name = CDataBase::GetTeamName( m_tActiveStory.NationalTeam[0], ETeamNameType_0); // loc_1E25EE xstrlcpy(wp_sp10, r0_pteam_name, 0x40); // loc_1E2618 FESU_Capitalize(wp_sp10, wp_sp10, -1); // loc_1E26A8 break; } case 'O': { // loc_1E25DA LOGE("ProcessText_4"); wchar_t *r0_pteam_name = CDataBase::GetTeamName(tGame.CTeam_2C60[1].sIndex_0, ETeamNameType_0); // loc_1E25EE xstrlcpy(wp_sp10, r0_pteam_name, 0x40); // loc_1E2618 FESU_Capitalize(wp_sp10, wp_sp10, -1); // loc_1E26A8 break; } case 'P': { // loc_1E25F8 LOGE("ProcessText_5"); xstrlcpy(wp_sp10, MP_cMyProfile.GetPlayerName(), 0x40); if (xstrlen(wp_sp10)) { // loc_1E2618 FESU_Capitalize(wp_sp10, wp_sp10, -1); // loc_1E26A8 } else { xstrlcpy(wp_sp10, L"PlayerName", 0x40); // loc_1E2618 FESU_Capitalize(wp_sp10, wp_sp10, -1); // loc_1E26A8 } break; } case 'Q': case 'R': case 'S': case 'q': case 'r': case 's': default: { LOGE("ProcessText_6"); // 001E264E wp_sp10[0] = r7_pw[0]; // loc_1E26A8 break; } case 'T': { LOGE("ProcessText_7"); // loc_1E2626 int r0_i = r3_i; if (r3_i <= -1) { // 001E262E r0_i = GetStageClubTeam(m_tStageManager.tStoryStage_0.t_0.field_4); } // loc_1E263A wchar_t *r1_pw = CDataBase::GetTeamName(r0_i, ETeamNameType_0); if (r1_pw == NULL) { // 001E2644 r1_pw = LOCstring(0x1A91); // loc_1E269E } // loc_1E26A0 xstrlcpy(wp_sp10, r1_pw, 0x40); // loc_1E26A8 break; } case 'n': { LOGE("ProcessText_8"); // loc_1E25CE // loc_1E25E6 wchar_t *r1_pw = CDataBase::GetTeamName( m_tActiveStory.NationalTeam[0], ETeamNameType_0); // loc_1E25EE xstrlcpy(wp_sp10, r1_pw, 0x40); // loc_1E2618 FESU_Capitalize(wp_sp10, wp_sp10, -1); // loc_1E26A8 break; } case 'o': { // loc_1E2654 LOGE("ProcessText_9"); // loc_1E2698 wchar_t *r1_pw = CDataBase::GetTeamName(tGame.CTeam_2C60[1].sIndex_0, ETeamNameType_0); // /loc_1E269E // loc_1E26A0 xstrlcpy(wp_sp10, r1_pw, 0x40); // loc_1E26A8 break; } case 'p': { // loc_1E2662 LOGE("ProcessText_10"); xstrlcpy(wp_sp10, MP_cMyProfile.GetPlayerName(), 0x40); if (xstrlen(wp_sp10) == 0) { // 001E267E // loc_1E26A0 xstrlcpy(wp_sp10, L"PlayerName", 0x40); } // loc_1E26A8 break; } case 't': { LOGE("ProcessText_11"); // loc_1E2684 int r0_i = r3_i; if (r3_i <= -1) { // 001E268C r0_i = GetStageClubTeam(m_tStageManager.tStoryStage_0.t_0.field_4); } // loc_1E2698 wchar_t *r1_pw = CDataBase::GetTeamName(r0_i, ETeamNameType_0); // loc_1E269E // loc_1E26A0 xstrlcpy(wp_sp10, r1_pw, 0x40); // loc_1E26A8 } } LOGE("ProcessText_12"); int r9_i = xstrlen(wp_sp10); if (r9_i >= 1) { // 001E26B4 // r8_pw=r7_substr+2; LOGE("ProcessText_13"); memcpy(r5_wp, r8_pw, (r7_pw - r8_pw)*2); int r0_i = r7_pw - r8_pw; r8_pw = r7_pw + 2; LOGE("ProcessText_13_1"); // check // 这里没有标号是因为分支合并 if (((uint)(r7_pw[1] - 'N') <= 6 && (1 << (r7_pw[1] - 'N')) & 0x47) || ((uint)(r7_pw[1] - 'n') <= 6 && (1 << (r7_pw[1] - 'n')) & 0x47)) { // loc_1E26FC // check LOGE("ProcessText_14"); if (r8_pw[0] == 0x2019 || r8_pw[0] == '\'') { // 001E270C if ((wp_sp10[r9_i - 1] | 0x20) == 's') { // 001E271E LOGE("ProcessText_15"); r8_pw = r7_pw + 4; wp_sp10[r9_i++] = '\''; wp_sp10[r9_i] = 0; } } } // loc_1E2736 // loc_1E2738 memcpy(r5_wp + r0_i, wp_sp10, r9_i * sizeof(wchar_t)); r5_wp = r5_wp + r0_i + r9_i; } else { // loc_1E26E6 r8_pw = r7_pw + 2; LOGE("ProcessText_16"); } } else { // loc_1E256C OK LOGE("ProcessText_17"); xstrlcpy(r5_wp, r8_pw, r11_i - (r5_wp - r10_wp)); } } LOGE("ProcessText_18"); // loc_1E2756 xstrlcpy(r0_wp, r10_wp, r1_i); delete[] r10_wp; } //--------------------------------------------------------------------------------------------------------- // 001E2798 ushort CStoryCore::GetStageClubTeam(int a1) { LOGE("GetStageClubTeam"); return rand()+a1; } //--------------------------------------------------------------------------------------------------------- // 001E27C8 ushort CStoryCore::GetStageTeam(int) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E2870 //这个函数没啥用, 作用是当关卡版本不一样的时候, 去更新关卡。 void CStoryCore::CheckStageVersions() { return; /* int v4=0; while (v4 != 2) { int v5 = 0; MP_cMyProfile.SetIsSideStory(v4 == 1, 0); if ( v5 >= *CStoryCore::m_tActiveStory.field_4 ) { v4 ++; continue; } int v11; TStorySeason *pTStorySeason = &CStoryCore::m_tActiveStory.field_0[v5]; for(int i =0; iStageCount_d0; i++) { v11 = i; if ( !MP_cMyProfile.isSideStory ) v11 = pTStorySeason->TStage_d4[i].ID_0; CStoryProfileStages *pCStoryProfileStages = MP_cMyProfile.GetProfileStages(); ushort *ver = pCStoryProfileStages->GetStageVersionPointer(pTStorySeason->TStage_d4[i].ID_0, v11); char v31[0x80]; bool v16; snprintf(v31, 0x80, "PKG:/data/hero/stages/stg_%04i.dat", pTStorySeason->TStage_d4[i].ID_0); if ( CFTTFileSystem::FileExists(v31, v14) ) { v16 = false; } else { memset(v31, 0, 0x80); snprintf(v31, 0x80, "SUPPORT:stg_%04i.dat",pTStorySeason->TStage_d4[i].ID_0); v16 = !CFTTFileSystem::FileExists(v31); } if ( !ver || v16 || (pTStorySeason->TStage_d4[i].Version_4 == *ver) ) { if ( !v16 ) continue; printf("CDownloads::RequestStageDownload(v10, v15)"); continue; } snprintf(v31, 0x80, "stg_%04i.dat", pTStorySeason->TStage_d4[i].ID_0); TStoryStage v22; v22.Photo_2bc.PhotoPost_bc.Filter_0 = 0; v22.Photo_2bc.PhotoPost_bc.Red_4 = 1.0; v22.Photo_2bc.PhotoPost_bc.Green_8 = 1.0; v22.Photo_2bc.PhotoPost_bc.Blue_c = 1.0; v22.Photo_2bc.PhotoPost_bc.Brightness_10 = 0.5; v22.Photo_2bc.PhotoPost_bc.Contrast_14 = 0.5; v22.Photo_2bc.PhotoPost_bc.Saturation_18 = 0.5; v22.Photo_2bc.PhotoPost_bc.Vignette_1c = 0.0; STORY_LoadStage(&v22, v31); } } MP_cMyProfile.SetIsSideStory(MP_cMyProfile.isSideStory, 0);*/ } //--------------------------------------------------------------------------------------------------------- // 001E2A40 TStorySeason *CStoryCore::GetStageSeason(int) { return NULL; } //--------------------------------------------------------------------------------------------------------- // 001E2A98 int CStoryCore::GetAreGoldenBootsEnabled() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E2A9C bool CStoryCore::AttemptSideStoryEntry() { return false; } //--------------------------------------------------------------------------------------------------------- // 001E2B20 int CStoryCore::EnterSideStory() { int dr0 = 0; return dr0; } //--------------------------------------------------------------------------------------------------------- // 001E2BA4 ^_^ TStorySeason *CStoryCore::STORY_GetSeason(int a1) { TStorySeason *result; return result; } //--------------------------------------------------------------------------------------------------------- // 001E2BC8 ^_^ TStorySeason *CStoryCore::GetConfigSeasonWithID(int dr0) { return NULL; } //--------------------------------------------------------------------------------------------------------- // 001E2C04 void CStoryCore::PromotionCB(int, void *) {} //--------------------------------------------------------------------------------------------------------- // 001E2C1C int CStoryCore::ShowPromotion(int, bool, bool, EPromoTriggerType, int, int, bool) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E3124 int CStoryCore::CalculateCurrentStageID() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E31D8 int CStoryCore::CountNumValidPromos() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E3208 int CStoryCore::IsPromoValid(TPromo const *, bool) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E33D4 TPromo *CStoryCore::FindValidPromo(int, bool) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E3418 void CStoryCore::SetSeason(int dr1) {} //--------------------------------------------------------------------------------------------------------- // 001E3448 int CStoryCore::GetStageUnlockTime(int, int) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E34A6 int CStoryCore::GetStageUnlockTime(int) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E34FC ^_^ uchar CStoryCore::GetShirtNumber() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E3530 void CStoryCore::SetStageStars(int, int) {} //--------------------------------------------------------------------------------------------------------- // 001E3570 void CStoryCore::SetStageComplete(int, int) {} //--------------------------------------------------------------------------------------------------------- // 001E35CC void CStoryCore::SetLastPlayedStageID(int) {} //--------------------------------------------------------------------------------------------------------- // 001E35F4 CStoryProfileStages *CStoryCore::GetProfileStages() { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E3620 void CStoryCore::ApplyUserPlayer(TPlayerInfo *) {} //--------------------------------------------------------------------------------------------------------- // 001E3650 //这个函数,没有调试完成,原因是swprintf并不是原始SO内的那个, 传参也不一样, //需要写个HOOK, 看下实际程序的返回 int CStoryCore::GetTimeString(long a1, wchar_t *a2, bool a3) { return 1; } //--------------------------------------------------------------------------------------------------------- // 001E3798 time_t CStoryCore::GetTimeFromString(char *pcr0, int dr1) { return 0; } //--------------------------------------------------------------------------------------------------------- // 001E37BC void CStoryCore::IncrementSessionStagesComplete(bool) {} //---------------------------------------------------------------------------------------------------------