/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ /* Game::handleCommand(QiString const&) */ void __thiscall Game::handleCommand(Game *this,QiString *param_1) { QiString *this_00; char cVar1; int iVar2; int iVar3; char **this_01; Game *pGVar4; long lVar5; char *pcVar6; QiString *in_x8; Audio *pAVar7; ResMan *this_02; long *plVar8; Player *pPVar9; PropertyBag *pPVar10; code *pcVar11; char *local_88 [2]; char acStack_78 [16]; char *local_68 [2]; char acStack_58 [16]; char *local_48 [2]; char acStack_38 [16]; char *local_28 [2]; char acStack_18 [16]; long local_8; local_8 = ___stack_chk_guard; QiString::QiString((QiString *)local_48,"Command: "); QiString::operator+((QiString *)local_48,param_1); pcVar6 = local_28[0]; if (local_28[0] == (char *)0x0) { pcVar6 = acStack_18; } logI(this,pcVar6); QiString::~QiString((QiString *)local_28); QiString::~QiString((QiString *)local_48); QiString::getWord(param_1,0); pcVar6 = local_88[0]; if (local_88[0] == (char *)0x0) { iVar2 = strcmp(acStack_78,"setproperty"); if (iVar2 == 0) goto LAB_0035fc64; LAB_0035f928: iVar2 = strcmp(acStack_78,"audio.playBackgroundMusic"); if (iVar2 == 0) goto LAB_0035fb7c; iVar2 = strcmp(acStack_78,"audio.playForegroundMusic"); if (iVar2 == 0) goto LAB_0035fc00; iVar2 = strcmp(acStack_78,"movie.start"); if (iVar2 == 0) { LAB_0035fc34: QiString::getWord(param_1,1); QiString::operator=((QiString *)(this + 0x618),(QiString *)local_28); QiString::~QiString((QiString *)local_28); *(undefined4 *)(this + 0x60c) = 2; } else { iVar2 = strcmp(acStack_78,"level.restart"); if (iVar2 == 0) { LAB_0035fe9c: Player::registerRestart ((Player *)gGame[0xd],(QiVec2 *)(*(long *)(*(long *)(this + 0x58) + 0x608) + 0x20) ); Player::save((Player *)gGame[0xd]); lVar5 = *(long *)(this + 0x58); *(undefined *)(lVar5 + 0x8c0) = 0; *(undefined8 *)(lVar5 + 0x8a8) = 0; *(undefined8 *)(lVar5 + 0x8b0) = 0; *(undefined8 *)(lVar5 + 0x8b8) = 0; QiInputStream::resetInputStream((QiInputStream *)(lVar5 + 0x778)); QiOutputStream::resetOutputStream((QiOutputStream *)(lVar5 + 0x788)); *(undefined *)(*(long *)(this + 0x58) + 0x8e8) = 1; } else { iVar2 = strcmp(acStack_78,"level.replay"); if (iVar2 == 0) { LAB_0035fe5c: lVar5 = *(long *)(this + 0x58); *(undefined *)(lVar5 + 0x8c0) = 1; *(undefined *)(lVar5 + 0x8e8) = 1; if (*(code **)(**gGame + 0x50) != Device::setAlwaysOn) { (**(code **)(**gGame + 0x50))(); } } else { iVar2 = strcmp(acStack_78,"level.start"); if (iVar2 == 0) { LAB_0035ff00: ResMan::clear(*(ResMan **)(*(long *)(this + 0x58) + 0x5b0)); iVar2 = *(int *)(this + 0x608); *(undefined *)(*(long *)(this + 0x58) + 0x8c0) = 0; if (iVar2 == 3) { QiString::getWord(param_1,1); QiString::operator=((QiString *)(this + 0x638),(QiString *)local_28); QiString::~QiString((QiString *)local_28); } else { QiString::getWord(param_1,1); QiString::operator=((QiString *)(this + 0x658),(QiString *)local_28); QiString::~QiString((QiString *)local_28); *(undefined4 *)(this + 0x60c) = 3; } } else { iVar2 = strcmp(acStack_78,"level.startreplay"); if (iVar2 == 0) { LAB_0035ffc4: QiString::getWord(param_1,1); QiString::operator=((QiString *)(this + 0x658),(QiString *)local_28); QiString::~QiString((QiString *)local_28); lVar5 = *(long *)(this + 0x58); *(undefined8 *)(lVar5 + 0x8a8) = 0; *(undefined8 *)(lVar5 + 0x8b0) = 0; *(undefined8 *)(lVar5 + 0x8b8) = 0; QiInputStream::resetInputStream((QiInputStream *)(lVar5 + 0x778)); QiOutputStream::resetOutputStream((QiOutputStream *)(lVar5 + 0x788)); QiString::QiString((QiString *)local_68,(QiString *)(this + 0x658)); cVar1 = isHard(this); if (cVar1 != '\0') { QiString::operator+=((QiString *)local_68,"-hard"); } this_02 = *(ResMan **)(this + 0x20); operator+("user://replay-",(QiString *)local_68); QiString::operator+((QiString *)local_48,".motion"); cVar1 = ResMan::load(this_02,(QiString *)local_28, (QiOutputStream *)(*(long *)(this + 0x58) + 0x788)); QiString::~QiString((QiString *)local_28); QiString::~QiString((QiString *)local_48); if (cVar1 != '\0') { *(undefined *)(*(long *)(this + 0x58) + 0x8c0) = 1; if (*(code **)(**gGame + 0x50) != Device::setAlwaysOn) { (**(code **)(**gGame + 0x50))(); } *(undefined4 *)(this + 0x60c) = 3; } QiString::~QiString((QiString *)local_68); } else { iVar2 = strcmp(acStack_78,"level.skip"); if (iVar2 == 0) { LAB_003600f4: QiString::getWord(param_1,1); iVar2 = Player::getCoinCount(*(Player **)(this + 0x68)); if (iVar2 < 200) { lVar5 = *(long *)(this + 0x40); QiString::QiString((QiString *)local_28,"showoutofcash"); Script::handleCommand((Script *)(lVar5 + 0xb8),(QiString *)local_28); QiString::~QiString((QiString *)local_28); } else { Player::addCoins(*(Player **)(this + 0x68),-200); Player::skipLevel(*(Player **)(this + 0x68),(QiString *)local_48); Player::save(*(Player **)(this + 0x68)); } QiString::~QiString((QiString *)local_48); } else { iVar2 = strcmp(acStack_78,"game.quit"); if (iVar2 == 0) { LAB_00360090: if (*(code **)(**(long **)this + 0xc0) != Device::quit) { (**(code **)(**(long **)this + 0xc0))(); } } else { iVar2 = strcmp(acStack_78,"game.menu"); if (iVar2 == 0) { LAB_00360140: *(undefined4 *)(this + 0x60c) = 1; } else { iVar2 = strcmp(acStack_78,"game.leaderboards"); if (iVar2 == 0) { LAB_00360168: if (*(code **)(**(long **)this + 0xb0) != Device::gameShowLeaderboards) { (**(code **)(**(long **)this + 0xb0))(); } } else { iVar2 = strcmp(acStack_78,"game.achievements"); if (iVar2 == 0) { LAB_003601d0: if (*(code **)(**(long **)this + 0xb8) != Device::gameShowAchievements) { (**(code **)(**(long **)this + 0xb8))(); } } else { iVar2 = strcmp(acStack_78,"game.saveConfig"); if (iVar2 == 0) { LAB_003601f4: saveConfig(this); } else { iVar2 = strcmp(acStack_78,"game.url"); if (iVar2 == 0) { LAB_00360200: plVar8 = *(long **)this; pcVar11 = *(code **)(*plVar8 + 0x48); QiString::getWord(param_1,1); (*pcVar11)(plVar8,local_28); QiString::~QiString((QiString *)local_28); } else { iVar2 = strcmp(acStack_78,"game.difficulty"); if (iVar2 == 0) goto LAB_0035fdd4; iVar2 = strcmp(acStack_78,"hud.reload"); if (iVar2 == 0) goto LAB_0035f908; iVar2 = strcmp(acStack_78,"player.buy"); if (iVar2 == 0) goto LAB_003602bc; iVar2 = strcmp(acStack_78,"player.buycoins"); if (iVar2 == 0) { LAB_003603e0: this_00 = (QiString *)(this + 0x6a0); QiString::getWord(param_1,1); iVar2 = QiString::toInt((QiString *)local_28); QiString::~QiString((QiString *)local_28); QiString::operator=(this_00,""); if (iVar2 == 1000) { QiString::operator=(this_00,"com.mediocre.grannysmith.coins1000"); } else if (iVar2 == 3000) { QiString::operator=(this_00,"com.mediocre.grannysmith.coins3000"); } pGVar4 = *(Game **)(this + 0x6a0); if (pGVar4 == (Game *)0x0) { if (this[0x6b0] != (Game)0x0) { pGVar4 = this + 0x6b0; goto LAB_00360448; } } else if (*pGVar4 != (Game)0x0) { LAB_00360448: storeInitPurchase((char *)pGVar4); this[0x6c4] = (Game)0x1; *(undefined4 *)(this + 0x6c0) = 0x42700000; } } else { iVar2 = strcmp(acStack_78,"player.unlockall"); if (iVar2 == 0) goto LAB_00360460; pcVar6 = acStack_78; iVar2 = strcmp(acStack_78,"player.restorepurchases"); if (iVar2 == 0) goto LAB_00360284; LAB_0035fac4: iVar2 = strcmp(pcVar6,"player.rate"); if (iVar2 == 0) { pcVar6 = "rated"; LAB_003605a0: pPVar10 = *(PropertyBag **)(this + 0x68); QiString::QiString((QiString *)local_48,pcVar6); QiString::QiString((QiString *)local_28,"1"); PropertyBag::setString (pPVar10,(QiString *)local_48,(QiString *)local_28); this_01 = local_28; goto LAB_0035fe44; } iVar2 = strcmp(pcVar6,"player.unlockallchar"); if (iVar2 == 0) { Player::unlockAllCharacters(*(Player **)(this + 0x68)); Player::save(*(Player **)(this + 0x68)); } else { iVar2 = strcmp(pcVar6,"player.selectcharacter"); if (iVar2 == 0) { pPVar9 = *(Player **)(this + 0x68); QiString::getWord(param_1,1); Player::selectCharacter(pPVar9,(QiString *)local_28); QiString::~QiString((QiString *)local_28); Player::save(*(Player **)(this + 0x68)); } else { iVar2 = strcmp(pcVar6,"player.ischaracteravailable"); if (iVar2 == 0) { pPVar9 = *(Player **)(this + 0x68); QiString::getWord(param_1,1); cVar1 = Player::isCharacterAvailable (pPVar9,(QiString *)local_28); QiString::~QiString((QiString *)local_28); if (cVar1 == '\0') { QiString::QiString(in_x8,"0"); } else { QiString::QiString(in_x8,"1"); } goto LAB_0035fbc0; } iVar2 = strcmp(pcVar6,"player.reset"); if (iVar2 == 0) { Player::reset(*(Player **)(this + 0x68)); Player::save(*(Player **)(this + 0x68)); Scene::reload(*(Scene **)(this + 0x40)); } else { iVar2 = strcmp(pcVar6,"player.adsshown"); if (iVar2 == 0) { pcVar6 = "adsshown"; goto LAB_003605a0; } iVar2 = strcmp(pcVar6,"game.signin"); if (iVar2 == 0) { (**(code **)(**(long **)this + 0x80))(*(long **)this); } else { iVar2 = strcmp(pcVar6,"game.signout"); if (iVar2 == 0) { (**(code **)(**(long **)this + 0x88))(*(long **)this); } else { operator+("Unknown command: ",param_1); if (local_28[0] == (char *)0x0) { local_28[0] = acStack_18; } logE(this,local_28[0]); QiString::~QiString((QiString *)local_28); } } } } } } } } } } } } } } } } } } } else { iVar2 = strcmp(local_88[0],"setproperty"); if (iVar2 == 0) { LAB_0035fc64: QiString::getWord(param_1,1); cVar1 = QiString::contains((QiString *)local_68,"=",true); if (cVar1 != '\0') { iVar2 = QiString::getIndexOf((QiString *)local_68,"=",0,true); QiString::substring((QiString *)local_68,0,iVar2); iVar2 = QiString::getIndexOf((QiString *)local_68,"=",0,true); QiString::substring((QiString *)local_68,iVar2 + 1); setProperty(this,(QiString *)local_48,(QiString *)local_28); QiString::~QiString((QiString *)local_28); QiString::~QiString((QiString *)local_48); } QiString::~QiString((QiString *)local_68); if (local_88[0] == (char *)0x0) goto LAB_0035f928; iVar2 = strcmp(local_88[0],"audio.playBackgroundMusic"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"audio.playForegroundMusic"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"movie.start"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"level.restart"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"level.replay"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"level.start"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"level.startreplay"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"level.skip"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"game.quit"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"game.menu"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"game.leaderboards"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"game.achievements"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"game.saveConfig"); if (iVar2 != 0) { iVar2 = strcmp(local_88[0],"game.url"); if (iVar2 == 0) goto LAB_00360200; iVar2 = strcmp(local_88[0],"game.difficulty"); pcVar6 = local_88[0]; goto joined_r0x0035fdd0; } goto LAB_003601f4; } goto LAB_003601d0; } goto LAB_00360168; } goto LAB_00360140; } goto LAB_00360090; } goto LAB_003600f4; } goto LAB_0035ffc4; } goto LAB_0035ff00; } goto LAB_0035fe5c; } goto LAB_0035fe9c; } goto LAB_0035fc34; } goto LAB_0035fc00; } } else { iVar2 = strcmp(pcVar6,"audio.playBackgroundMusic"); if (iVar2 != 0) { iVar2 = strcmp(pcVar6,"audio.playForegroundMusic"); if (iVar2 != 0) { iVar2 = strcmp(pcVar6,"movie.start"); if (iVar2 == 0) goto LAB_0035fc34; iVar2 = strcmp(pcVar6,"level.restart"); if (iVar2 == 0) goto LAB_0035fe9c; iVar2 = strcmp(pcVar6,"level.replay"); if (iVar2 == 0) goto LAB_0035fe5c; iVar2 = strcmp(pcVar6,"level.start"); if (iVar2 == 0) goto LAB_0035ff00; iVar2 = strcmp(pcVar6,"level.startreplay"); if (iVar2 == 0) goto LAB_0035ffc4; iVar2 = strcmp(pcVar6,"level.skip"); if (iVar2 == 0) goto LAB_003600f4; iVar2 = strcmp(pcVar6,"game.quit"); if (iVar2 == 0) goto LAB_00360090; iVar2 = strcmp(pcVar6,"game.menu"); if (iVar2 == 0) goto LAB_00360140; iVar2 = strcmp(pcVar6,"game.leaderboards"); if (iVar2 == 0) goto LAB_00360168; iVar2 = strcmp(pcVar6,"game.achievements"); if (iVar2 == 0) goto LAB_003601d0; iVar2 = strcmp(pcVar6,"game.saveConfig"); if (iVar2 == 0) goto LAB_003601f4; iVar2 = strcmp(pcVar6,"game.url"); if (iVar2 == 0) goto LAB_00360200; iVar2 = strcmp(pcVar6,"game.difficulty"); joined_r0x0035fdd0: if (iVar2 != 0) { iVar2 = strcmp(pcVar6,"hud.reload"); if (iVar2 != 0) { iVar2 = strcmp(pcVar6,"player.buy"); if (iVar2 != 0) { iVar2 = strcmp(pcVar6,"player.buycoins"); if (iVar2 == 0) goto LAB_003603e0; iVar2 = strcmp(pcVar6,"player.unlockall"); if (iVar2 != 0) { iVar2 = strcmp(pcVar6,"player.restorepurchases"); if (iVar2 != 0) goto LAB_0035fac4; LAB_00360284: QiString::operator=((QiString *)(this + 0x6a0),"restore"); storeInitRestore(); this[0x6c4] = (Game)0x1; *(undefined4 *)(this + 0x6c0) = 0x42700000; goto LAB_0035fbb0; } LAB_00360460: QiString::operator=((QiString *)(this + 0x6a0),"com.mediocre.grannysmith.unlockall3" ); pGVar4 = *(Game **)(this + 0x6a0); if (*(Game **)(this + 0x6a0) == (Game *)0x0) { pGVar4 = this + 0x6b0; } goto LAB_00360448; } LAB_003602bc: QiString::getWord(param_1,1); pcVar6 = local_48[0]; if (local_48[0] == (char *)0x0) { pcVar6 = acStack_38; } iVar2 = 0x14; iVar3 = strcmp(pcVar6,"helmet"); if (iVar3 != 0) { iVar2 = 0x28; iVar3 = strcmp(pcVar6,"banana"); if (iVar3 != 0) { iVar2 = 0x3c; iVar3 = strcmp(pcVar6,"baseball"); if (iVar3 != 0) { iVar2 = 500; iVar3 = strcmp(pcVar6,"scruffy"); if (iVar3 != 0) { iVar3 = strcmp(pcVar6,"stanley"); iVar2 = 0; if (iVar3 == 0) { iVar2 = 500; } } } } } iVar3 = Player::getCoinCount(*(Player **)(this + 0x68)); if (iVar3 < iVar2) { lVar5 = *(long *)(this + 0x40); QiString::QiString((QiString *)local_28,"showoutofcash"); Script::handleCommand((Script *)(lVar5 + 0xb8),(QiString *)local_28); QiString::~QiString((QiString *)local_28); QiString::QiString(in_x8,"0"); } else { Player::addCoins(*(Player **)(this + 0x68),-iVar2); if (local_48[0] == (char *)0x0) { local_48[0] = acStack_38; } iVar2 = strcmp(local_48[0],"scruffy"); if ((iVar2 == 0) || (iVar2 = strcmp(local_48[0],"stanley"), iVar2 == 0)) { Player::unlockCharacter(*(Player **)(this + 0x68),(QiString *)local_48); lVar5 = *(long *)(this + 0x40); operator+("character ",(QiString *)local_48); Script::handleCommand((Script *)(lVar5 + 0xb8),(QiString *)local_28); QiString::~QiString((QiString *)local_28); } else { Player::addPowerUp(*(Player **)(this + 0x68),(QiString *)local_48,5); } Player::save(*(Player **)(this + 0x68)); QiString::QiString(in_x8,"1"); } QiString::~QiString((QiString *)local_48); goto LAB_0035fbc0; } LAB_0035f908: this[0x67a] = (Game)0x1; goto LAB_0035fbb0; } LAB_0035fdd4: pPVar10 = *(PropertyBag **)(this + 0x68); QiString::QiString((QiString *)local_48,"hard"); QiString::getWord(param_1,1); this_01 = local_68; if (local_68[0] == (char *)0x0) { local_68[0] = acStack_58; } iVar2 = strcmp(local_68[0],"hard"); if (iVar2 == 0) { pcVar6 = "1"; } else { pcVar6 = "0"; } QiString::QiString((QiString *)local_28,pcVar6); PropertyBag::setString(pPVar10,(QiString *)local_48,(QiString *)local_28); QiString::~QiString((QiString *)local_28); LAB_0035fe44: QiString::~QiString((QiString *)this_01); QiString::~QiString((QiString *)local_48); Player::save(*(Player **)(this + 0x68)); goto LAB_0035fbb0; } LAB_0035fc00: Audio::update(*(Audio **)(this + 0x28)); pAVar7 = *(Audio **)(this + 0x28); QiString::getWord(param_1,1); Audio::playForegroundMusic(pAVar7,(QiString *)local_28); QiString::~QiString((QiString *)local_28); goto LAB_0035fbb0; } } LAB_0035fb7c: Audio::update(*(Audio **)(this + 0x28)); pAVar7 = *(Audio **)(this + 0x28); QiString::getWord(param_1,1); Audio::playBackgroundMusic(pAVar7,(QiString *)local_28,false); QiString::~QiString((QiString *)local_28); } LAB_0035fbb0: QiString::QiString(in_x8,""); LAB_0035fbc0: QiString::~QiString((QiString *)local_88); if (local_8 == ___stack_chk_guard) { return; } /* WARNING: Subroutine does not return */ __stack_chk_fail(); }