string CGamePlayer :: GetProvider() { if (m_Provider=="") { if (GetCountry()!="??" && GetCountry()!="Ga") m_Provider=m_Game->m_GHost->UDPChatWhoIs(GetCountry(), GetExternalIPString( )); } return m_Provider; }
const Country* CountryCollection::GetOptionalCountryByTitle(const std::string& titleID) const { auto countryTag = titleCountryMapping.GetOptionalCountryTag(titleID); if (countryTag.empty()) return nullptr; return &GetCountry(countryTag); }
Locale* Locale::CreateLocale(const char* l, const char* c, const char* v) { for (auto iter = locales.begin(); iter != locales.end(); ++iter) { if (!_stricmp(l, iter->GetLanguage())) { if (c && *c) { if (!_stricmp(c, iter->GetCountry())) { if (v && *v) { if (!_stricmp(v, iter->GetVariant())) { return &(*iter); } } else { return &(*iter); } } } else { return &(*iter); } } } if (l[0]) { if (c[0]) { if (v[0]) { return new(__FILE__,__LINE__) Locale(l, c, v); } return new(__FILE__,__LINE__) Locale(l, c); } return new(__FILE__,__LINE__) Locale(l); } return 0; }
void EjectedPilotClass::ApplyDamage(FalconDamageMessage *damageMsg) { if(_stage >= PD_CHUTE_OPENING) { SimMoverClass::ApplyDamage(damageMsg); if(_collapseChute == FALSE) { // PlayRadioMessage (rcAIRMANDOWNB) // _flightId is the VU_ID of the flight the pilot ejected from Flight flight; flight = (Flight) vuDatabase->Find(_flightId); if(flight) { FalconRadioChatterMessage *radioMessage = new FalconRadioChatterMessage( flight->Id(), FalconLocalSession ); radioMessage->dataBlock.from = flight->Id(); radioMessage->dataBlock.to = MESSAGE_FOR_TEAM; radioMessage->dataBlock.voice_id = flight->GetFlightLeadVoiceID(); radioMessage->dataBlock.message = rcAIRMANDOWNB; //M.N. changed to 32767 -> flexibly use randomized values of max available eval indexes radioMessage->dataBlock.edata[0] = 32767; FalconSendMessage(radioMessage, FALSE); } F4Assert(_deathMsg == NULL); // Create death message. _deathMsg = new FalconDeathMessage (Id(), FalconLocalGame); // ahhhhhhhhhhhhhhhhh #ifdef MLR_NEWSNDCODE SoundPos.Sfx( SFX_SCREAM, 0, 1, 0); #else F4SoundFXSetPos( SFX_SCREAM, TRUE, XPos(), YPos(), ZPos(), 1.0f , 0 , XDelta(),YDelta(),ZDelta()); #endif _deathMsg->dataBlock.damageType = damageMsg->dataBlock.damageType; _deathMsg->dataBlock.dEntityID = Id(); _deathMsg->dataBlock.dCampID = 0; _deathMsg->dataBlock.dSide = GetCountry(); _deathMsg->dataBlock.dPilotID = pilotSlot; _deathMsg->dataBlock.dIndex = Type(); _deathMsg->dataBlock.fEntityID = damageMsg->dataBlock.fEntityID; _deathMsg->dataBlock.fCampID = damageMsg->dataBlock.fCampID; _deathMsg->dataBlock.fSide = damageMsg->dataBlock.fSide; _deathMsg->dataBlock.fPilotID = damageMsg->dataBlock.fPilotID; _deathMsg->dataBlock.fIndex = damageMsg->dataBlock.fIndex; _deathMsg->dataBlock.fWeaponID = damageMsg->dataBlock.fWeaponID; _deathMsg->dataBlock.fWeaponUID = damageMsg->dataBlock.fWeaponUID; } _collapseChute = TRUE; } }
UINT CGetAccountInfoRequest::ProcessResponse(CHttpFile& pHttpFile) { #ifdef ARTSTORE return 1; #else //Take the HttpFile and parse it. UINT nFileLength = pHttpFile.GetLength(); CString strBuffer; CString strSearch; CString strList; LPSTR b = strBuffer.GetBuffer(nFileLength); pHttpFile.Read(b, nFileLength); strBuffer.ReleaseBuffer(); CBasicRequestInfo::ProcessResponse(strBuffer); UINT nRet = atoi((LPCTSTR)GetStatusCode()); if(nRet == 0) //success { CString strSearch; strSearch = "Last="; ParseFileForValue(strBuffer, strSearch, GetCustLastName()); strSearch = "First="; ParseFileForValue(strBuffer, strSearch, GetCustFirstName()); strSearch = "Street1="; ParseFileForValue(strBuffer, strSearch, GetStreet1()); strSearch = "Street2="; ParseFileForValue(strBuffer, strSearch, GetStreet2()); strSearch = "City="; ParseFileForValue(strBuffer, strSearch, GetCity()); strSearch = "State="; ParseFileForValue(strBuffer, strSearch, GetState()); strSearch = "Country="; ParseFileForValue(strBuffer, strSearch, GetCountry()); strSearch = "ZipCode="; ParseFileForValue(strBuffer, strSearch, GetZipCode()); strSearch = "EMail="; ParseFileForValue(strBuffer, strSearch, GetEMail()); strSearch = "Phone="; ParseFileForValue(strBuffer, strSearch, GetPhone()); } return nRet; #endif }
std::vector<std::string> CVolumeGC::GetNames() const { std::vector<std::string> names; auto const string_decoder = GetStringDecoder(GetCountry()); char name[0x60 + 1] = {}; if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)name)) names.push_back(string_decoder(name)); return names; }
void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bnr1) const { u32 number_of_languages = 0; Language start_language = Language::LANGUAGE_UNKNOWN; if (is_bnr1) // NTSC { bool is_japanese = GetCountry() == Country::COUNTRY_JAPAN; number_of_languages = 1; start_language = is_japanese ? Language::LANGUAGE_JAPANESE : Language::LANGUAGE_ENGLISH; } else // PAL { number_of_languages = 6; start_language = Language::LANGUAGE_ENGLISH; } m_image_width = GC_BANNER_WIDTH; m_image_height = GC_BANNER_HEIGHT; m_image_buffer = std::vector<u32>(m_image_width * m_image_height); ColorUtil::decode5A3image(m_image_buffer.data(), banner_file.image, m_image_width, m_image_height); for (u32 i = 0; i < number_of_languages; ++i) { const GCBannerInformation& info = banner_file.information[i]; Language language = static_cast<Language>(static_cast<int>(start_language) + i); std::string description = DecodeString(info.description); if (!description.empty()) m_descriptions[language] = description; std::string short_name = DecodeString(info.short_name); if (!short_name.empty()) m_short_names[language] = short_name; std::string long_name = DecodeString(info.long_name); if (!long_name.empty()) m_long_names[language] = long_name; std::string short_maker = DecodeString(info.short_maker); if (!short_maker.empty()) m_short_makers[language] = short_maker; std::string long_maker = DecodeString(info.long_maker); if (!long_maker.empty()) m_long_makers[language] = long_maker; } }
/** * @param notifyChange indicates whether the listener should be notified the change of the * country * @param startLocationBasedDetection indicates whether the LocationBasedCountryDetector could * be started if the current country source is less reliable than the location. * @return the current available UserCountry */ AutoPtr<ICountry> ComprehensiveCountryDetector::DetectCountry( /* [in] */ Boolean notifyChange, /* [in] */ Boolean startLocationBasedDetection) { AutoPtr<ICountry> country = GetCountry(); AutoPtr<ICountry> countryTemp; if (mCountry != NULL) { CCountry::New(mCountry, (ICountry**)&countryTemp); } else { countryTemp = mCountry; } RunAfterDetectionAsync(countryTemp, country, notifyChange, startLocationBasedDetection); mCountry = country; return mCountry; }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetNames() const { std::map<IVolume::ELanguage, std::string> names; if (!LoadBannerFile()) return names; u32 name_count = 0; IVolume::ELanguage language; bool is_japanese = GetCountry() == IVolume::ECountry::COUNTRY_JAPAN; switch (m_banner_file_type) { case BANNER_BNR1: name_count = 1; language = is_japanese ? IVolume::ELanguage::LANGUAGE_JAPANESE : IVolume::ELanguage::LANGUAGE_ENGLISH; break; case BANNER_BNR2: name_count = 6; language = IVolume::ELanguage::LANGUAGE_ENGLISH; break; case BANNER_INVALID: case BANNER_NOT_LOADED: break; } auto const banner = reinterpret_cast<const GCBanner*>(m_banner_file.data()); for (u32 i = 0; i < name_count; ++i) { auto& comment = banner->comment[i]; std::string name = DecodeString(comment.longTitle); if (name.empty()) name = DecodeString(comment.shortTitle); if (!name.empty()) names[(IVolume::ELanguage)(language + i)] = name; } return names; }
//Save the settings of the loaded rom, so all loaded settings about rom will be identified with //this rom void CN64Disk::SaveDiskSettingID(bool temp) { g_Settings->SaveBool(Game_TempLoaded, temp); g_Settings->SaveString(Game_GameName, m_RomName.c_str()); g_Settings->SaveString(Game_IniKey, m_DiskIdent.c_str()); //g_Settings->SaveString(Game_UniqueSaveDir, stdstr_f("%s-%s", m_RomName.c_str(), m_MD5.c_str()).c_str()); switch (GetCountry()) { case Germany: case french: case Italian: case Europe: case Spanish: case Australia: case X_PAL: case Y_PAL: g_Settings->SaveDword(Game_SystemType, SYSTEM_PAL); break; default: g_Settings->SaveDword(Game_SystemType, SYSTEM_NTSC); break; } }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetDescriptions() const { std::map<IVolume::ELanguage, std::string> descriptions; if (!LoadBannerFile()) return descriptions; u32 desc_count = 0; IVolume::ELanguage language; bool is_japanese = GetCountry() == IVolume::ECountry::COUNTRY_JAPAN; switch (m_banner_file_type) { case BANNER_BNR1: desc_count = 1; language = is_japanese ? IVolume::ELanguage::LANGUAGE_JAPANESE : IVolume::ELanguage::LANGUAGE_ENGLISH; break; case BANNER_BNR2: language = IVolume::ELanguage::LANGUAGE_ENGLISH; desc_count = 6; break; case BANNER_INVALID: case BANNER_NOT_LOADED: break; } auto banner = reinterpret_cast<const GCBanner*>(m_banner_file.data()); for (u32 i = 0; i < desc_count; ++i) { auto& data = banner->comment[i].comment; std::string description = DecodeString(data); if (!description.empty()) descriptions[(IVolume::ELanguage)(language + i)] = description; } return descriptions; }
bool CId_pat::GetLabelV1(string* label, TLabelFlags) const { return x_GetLabelV1(label, false, 0, 0, 0, 0, 0, &GetCountry(), &GetSomeNumber()); }
const cxStr *cxUtil::LocalizedKey() const { return GetCountry(); }
void CGameListCtrl::ScanForISOs() { ClearIsoFiles(); // Load custom game titles from titles.txt // http://www.gametdb.com/Wii/Downloads std::unordered_map<std::string, std::string> custom_title_map; std::ifstream titlestxt; OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "titles.txt", std::ios::in); if (!titlestxt.is_open()) OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "wiitdb.txt", std::ios::in); if (titlestxt.is_open()) { std::string line; while (!titlestxt.eof() && std::getline(titlestxt, line)) { const size_t equals_index = line.find('='); if (equals_index != std::string::npos) custom_title_map.emplace(StripSpaces(line.substr(0, equals_index)), StripSpaces(line.substr(equals_index + 1))); } titlestxt.close(); } std::vector<std::string> Extensions; if (SConfig::GetInstance().m_ListGC) Extensions.push_back(".gcm"); if (SConfig::GetInstance().m_ListWii || SConfig::GetInstance().m_ListGC) { Extensions.push_back(".iso"); Extensions.push_back(".ciso"); Extensions.push_back(".gcz"); Extensions.push_back(".wbfs"); } if (SConfig::GetInstance().m_ListWad) Extensions.push_back(".wad"); if (SConfig::GetInstance().m_ListElfDol) { Extensions.push_back(".dol"); Extensions.push_back(".elf"); } auto rFilenames = DoFileSearch(Extensions, SConfig::GetInstance().m_ISOFolder, SConfig::GetInstance().m_RecursiveISOFolder); if (rFilenames.size() > 0) { wxProgressDialog dialog( _("Scanning for ISOs"), _("Scanning..."), (int)rFilenames.size() - 1, this, wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_SMOOTH // - makes updates as small as possible (down to 1px) ); for (u32 i = 0; i < rFilenames.size(); i++) { std::string FileName; SplitPath(rFilenames[i], nullptr, &FileName, nullptr); // Update with the progress (i) and the message dialog.Update(i, wxString::Format(_("Scanning %s"), StrToWxStr(FileName))); if (dialog.WasCancelled()) break; auto iso_file = std::make_unique<GameListItem>(rFilenames[i], custom_title_map); if (iso_file->IsValid()) { bool list = true; switch(iso_file->GetPlatform()) { case DiscIO::IVolume::WII_DISC: if (!SConfig::GetInstance().m_ListWii) list = false; break; case DiscIO::IVolume::WII_WAD: if (!SConfig::GetInstance().m_ListWad) list = false; break; case DiscIO::IVolume::ELF_DOL: if (!SConfig::GetInstance().m_ListElfDol) list = false; break; default: if (!SConfig::GetInstance().m_ListGC) list = false; break; } switch(iso_file->GetCountry()) { case DiscIO::IVolume::COUNTRY_AUSTRALIA: if (!SConfig::GetInstance().m_ListAustralia) list = false; break; case DiscIO::IVolume::COUNTRY_EUROPE: if (!SConfig::GetInstance().m_ListPal) list = false; break; case DiscIO::IVolume::COUNTRY_FRANCE: if (!SConfig::GetInstance().m_ListFrance) list = false; break; case DiscIO::IVolume::COUNTRY_GERMANY: if (!SConfig::GetInstance().m_ListGermany) list = false; break; case DiscIO::IVolume::COUNTRY_ITALY: if (!SConfig::GetInstance().m_ListItaly) list = false; break; case DiscIO::IVolume::COUNTRY_JAPAN: if (!SConfig::GetInstance().m_ListJap) list = false; break; case DiscIO::IVolume::COUNTRY_KOREA: if (!SConfig::GetInstance().m_ListKorea) list = false; break; case DiscIO::IVolume::COUNTRY_NETHERLANDS: if (!SConfig::GetInstance().m_ListNetherlands) list = false; break; case DiscIO::IVolume::COUNTRY_RUSSIA: if (!SConfig::GetInstance().m_ListRussia) list = false; break; case DiscIO::IVolume::COUNTRY_SPAIN: if (!SConfig::GetInstance().m_ListSpain) list = false; break; case DiscIO::IVolume::COUNTRY_TAIWAN: if (!SConfig::GetInstance().m_ListTaiwan) list = false; break; case DiscIO::IVolume::COUNTRY_USA: if (!SConfig::GetInstance().m_ListUsa) list = false; break; case DiscIO::IVolume::COUNTRY_WORLD: if (!SConfig::GetInstance().m_ListWorld) list = false; break; case DiscIO::IVolume::COUNTRY_UNKNOWN: default: if (!SConfig::GetInstance().m_ListUnknown) list = false; break; } if (list) m_ISOFiles.push_back(iso_file.release()); } } } if (SConfig::GetInstance().m_ListDrives) { const std::vector<std::string> drives = cdio_get_devices(); for (const auto& drive : drives) { auto gli = std::make_unique<GameListItem>(drive, custom_title_map); if (gli->IsValid()) m_ISOFiles.push_back(gli.release()); } } std::sort(m_ISOFiles.begin(), m_ISOFiles.end()); }
int GroundClass::Wake(void) { if (IsAwake()){ return 0; } SimVehicleClass::Wake(); Tpoint pos; int retval = 0; if (Sms) { Sms->AddWeaponGraphics(); } // Pick a groupId. KCK: Is this even being used? groupId = GetCampaignObject()->Id().num_; if ( !gai->rank ){ drawPointer->SetLabel ("", 0xff00ff00); } // edg: I'm not sure if drawpointer has valid position yet? drawPointer->GetPosition( &pos ); SetPosition (XPos(), YPos(), pos.z - 0.7f ); ShiAssert(XPos() > 0.0F && YPos() > 0.0F ) // determine if its a foot squad or not -- Real thinking done in addobj.cpp isFootSquad = (drawPointer->GetClass() == DrawableObject::Guys); // Determine if this vehicle has a truck and create it, if needed if (drawPointer && isTowed){ // Place truck 20 feet behind us Tpoint simView; int vistype; mlTrig trig; int tracktorType; // RV - Biker - Make the tracktor random tracktorType = (rand() % 3); bool teamUs = ( TeamInfo[GetCountry()] && ( TeamInfo[GetCountry()]->equipment == toe_us || TeamInfo[GetCountry()]->equipment == toe_rok ) ); int vtIdx; switch (tracktorType){ case 0: vtIdx = teamUs ? F4_GENERIC_US_TRUCK_TYPE_SMALL : F4_GENERIC_OPFOR_TRUCK_TYPE_SMALL; break; case 1: vtIdx = teamUs ? F4_GENERIC_US_TRUCK_TYPE_LARGE : F4_GENERIC_OPFOR_TRUCK_TYPE_LARGE; break; default: vtIdx = teamUs ? F4_GENERIC_US_TRUCK_TYPE_TRAILER : F4_GENERIC_OPFOR_TRUCK_TYPE_TRAILER; break; } vistype = Falcon4ClassTable[vtIdx].visType[Status() & VIS_TYPE_MASK]; mlSinCos (&trig, Yaw()); simView.x = XPos()-20.0F*trig.cos; simView.y = YPos()-20.0F*trig.sin; simView.z = ZPos(); if (vistype > 0){ truckDrawable = new DrawableGroundVehicle(vistype, &simView, Yaw()+PI, drawPointer->GetScale()); } } // when we wake the object, default it to not labeled unless // it's the main guy if (drawPointer && gai->rank != GNDAI_BATTALION_COMMANDER){ drawPointer->SetLabel ("", 0xff00ff00); // Don't label SetLocalFlag(NOT_LABELED); } return retval; }
Country& CountryCollection::GetCountryByTitle(const std::string& titleID) { return GetCountry(titleCountryMapping.GetCountryTag(titleID)); }
// comparison function bool CId_pat::Match(const CId_pat& idp2) const { return AStrEquiv(GetCountry(), idp2.GetCountry(), PNocase()) && Id_Match(GetId(), idp2.GetId()); }
void CGameListCtrl::ScanForISOs() { ClearIsoFiles(); CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder); if (SConfig::GetInstance().m_RecursiveISOFolder) { for (u32 i = 0; i < Directories.size(); i++) { File::FSTEntry FST_Temp; File::ScanDirectoryTree(Directories[i], FST_Temp); for (auto& Entry : FST_Temp.children) { if (Entry.isDirectory) { bool duplicate = false; for (auto& Directory : Directories) { if (Directory == Entry.physicalName) { duplicate = true; break; } } if (!duplicate) Directories.push_back(Entry.physicalName); } } } } CFileSearch::XStringVector Extensions; if (SConfig::GetInstance().m_ListGC) Extensions.push_back("*.gcm"); if (SConfig::GetInstance().m_ListWii || SConfig::GetInstance().m_ListGC) { Extensions.push_back("*.iso"); Extensions.push_back("*.ciso"); Extensions.push_back("*.gcz"); Extensions.push_back("*.wbfs"); } if (SConfig::GetInstance().m_ListWad) Extensions.push_back("*.wad"); CFileSearch FileSearch(Extensions, Directories); const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames(); if (rFilenames.size() > 0) { wxProgressDialog dialog( _("Scanning for ISOs"), _("Scanning..."), (int)rFilenames.size() - 1, this, wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_SMOOTH // - makes updates as small as possible (down to 1px) ); for (u32 i = 0; i < rFilenames.size(); i++) { std::string FileName; SplitPath(rFilenames[i], nullptr, &FileName, nullptr); // Update with the progress (i) and the message dialog.Update(i, wxString::Format(_("Scanning %s"), StrToWxStr(FileName))); if (dialog.WasCancelled()) break; auto iso_file = std::make_unique<GameListItem>(rFilenames[i]); if (iso_file->IsValid()) { bool list = true; switch(iso_file->GetPlatform()) { case GameListItem::WII_DISC: if (!SConfig::GetInstance().m_ListWii) list = false; break; case GameListItem::WII_WAD: if (!SConfig::GetInstance().m_ListWad) list = false; break; default: if (!SConfig::GetInstance().m_ListGC) list = false; break; } switch(iso_file->GetCountry()) { case DiscIO::IVolume::COUNTRY_AUSTRALIA: if (!SConfig::GetInstance().m_ListAustralia) list = false; break; case DiscIO::IVolume::COUNTRY_GERMANY: if (!SConfig::GetInstance().m_ListGermany) list = false; break; case DiscIO::IVolume::COUNTRY_RUSSIA: if (!SConfig::GetInstance().m_ListRussia) list = false; break; case DiscIO::IVolume::COUNTRY_UNKNOWN: if (!SConfig::GetInstance().m_ListUnknown) list = false; break; case DiscIO::IVolume::COUNTRY_TAIWAN: if (!SConfig::GetInstance().m_ListTaiwan) list = false; break; case DiscIO::IVolume::COUNTRY_KOREA: if (!SConfig::GetInstance().m_ListKorea) list = false; break; case DiscIO::IVolume::COUNTRY_JAPAN: if (!SConfig::GetInstance().m_ListJap) list = false; break; case DiscIO::IVolume::COUNTRY_USA: if (!SConfig::GetInstance().m_ListUsa) list = false; break; case DiscIO::IVolume::COUNTRY_FRANCE: if (!SConfig::GetInstance().m_ListFrance) list = false; break; case DiscIO::IVolume::COUNTRY_ITALY: if (!SConfig::GetInstance().m_ListItaly) list = false; break; case DiscIO::IVolume::COUNTRY_SPAIN: if (!SConfig::GetInstance().m_ListSpain) list = false; break; case DiscIO::IVolume::COUNTRY_NETHERLANDS: if (!SConfig::GetInstance().m_ListNetherlands) list = false; break; default: if (!SConfig::GetInstance().m_ListPal) list = false; break; } if (list) m_ISOFiles.push_back(iso_file.release()); } } } if (SConfig::GetInstance().m_ListDrives) { const std::vector<std::string> drives = cdio_get_devices(); for (const auto& drive : drives) { auto gli = std::make_unique<GameListItem>(drive); if (gli->IsValid()) m_ISOFiles.push_back(gli.release()); } } std::sort(m_ISOFiles.begin(), m_ISOFiles.end()); }