diff --git a/Minecraft.Client/AbstractTexturePack.cpp b/Minecraft.Client/AbstractTexturePack.cpp index a3c67727..03144117 100644 --- a/Minecraft.Client/AbstractTexturePack.cpp +++ b/Minecraft.Client/AbstractTexturePack.cpp @@ -43,7 +43,7 @@ void AbstractTexturePack::loadIcon() WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); - swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); + swprintf_s(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); UINT size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size); @@ -59,7 +59,7 @@ void AbstractTexturePack::loadComparison() WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); - swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png"); + swprintf_s(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png"); UINT size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_comparisonData, &size); @@ -238,7 +238,7 @@ void AbstractTexturePack::loadDefaultUI() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur"); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur"); XuiFreeVisuals(L""); app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); @@ -381,7 +381,7 @@ wstring AbstractTexturePack::getXuiRootPath() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); return szResourceLocator; } diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index 7a64065a..8800f8e3 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -870,6 +870,7 @@ enum EControllerActions MINECRAFT_ACTION_CRAFTING, MINECRAFT_ACTION_RENDER_THIRD_PERSON, MINECRAFT_ACTION_GAME_INFO, + MINECRAFT_ACTION_SCREENSHOT, MINECRAFT_ACTION_DPAD_LEFT, MINECRAFT_ACTION_DPAD_RIGHT, MINECRAFT_ACTION_DPAD_UP, diff --git a/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h b/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h index 9a1ae372..5e8feebe 100644 --- a/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h +++ b/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h @@ -65,8 +65,8 @@ public: virtual bool GetIsPlayingNetherMusic() ; virtual void SetIsPlayingEndMusic(bool bVal) ; virtual void SetIsPlayingNetherMusic(bool bVal) ; - static const WCHAR *wchSoundNames[eSoundType_MAX]; - static const WCHAR *wchUISoundNames[eSFX_MAX]; + static const wchar_t *wchSoundNames[eSoundType_MAX]; + static const wchar_t *wchUISoundNames[eSFX_MAX]; public: void tick(); diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index fb8944eb..bfff29e7 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #ifdef __ORBIS__ #include @@ -525,8 +524,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa char basePlusExt[256]; sprintf_s(basePlusExt, "%s%s", basePath, extensions[extIdx]); - DWORD attr = GetFileAttributesA(basePlusExt); - if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) + if (fs::exists(basePlusExt)) { sprintf_s(finalPath, "%s", basePlusExt); found = true; @@ -545,11 +543,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa char numberedPath[256]; sprintf_s(numberedPath, "%s%d%s", basePath, i, extensions[extIdx]); - DWORD attr = GetFileAttributesA(numberedPath); - if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) - { + if (fs::exists(numberedPath)) count = i; - } } } @@ -561,8 +556,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa char numberedPath[256]; sprintf_s(numberedPath, "%s%d%s", basePath, chosen, extensions[extIdx]); - DWORD attr = GetFileAttributesA(numberedPath); - if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) + if (fs::exists(numberedPath)) { sprintf_s(finalPath, "%s", numberedPath); found = true; @@ -653,10 +647,11 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) const char* extensions[] = { ".ogg", ".wav", ".mp3" }; size_t count = sizeof(extensions) / sizeof(extensions[0]); bool found = false; + for (size_t i = 0; i < count; i++) { sprintf_s(finalPath, "%s%s", basePath, extensions[i]); - if (FileExists(finalPath)) + if (fs::exists(finalPath)) { found = true; break; @@ -1055,15 +1050,15 @@ void SoundEngine::playMusicUpdate() // 4J-PB - Need to check if we are a patched BD build if(app.GetBootedFromDiscPatch()) { - sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szMusicPath), m_szMusicPath ); + sprintf_s(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szMusicPath), m_szMusicPath ); app.DebugPrintf("SoundEngine::playMusicUpdate - (booted from disc patch) music path - %s",m_szStreamName); } else { - sprintf(m_szStreamName,"%s/%s",getUsrDirPath(), m_szMusicPath ); + sprintf_s(m_szStreamName,"%s/%s",getUsrDirPath(), m_szMusicPath ); } #else - sprintf(m_szStreamName,"%s/%s",getUsrDirPath(), m_szMusicPath ); + sprintf_s(m_szStreamName,"%s/%s",getUsrDirPath(), m_szMusicPath ); #endif #else @@ -1134,7 +1129,7 @@ void SoundEngine::playMusicUpdate() strcat((char *)m_szStreamName,".wav"); // check if this is in the patch data - sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szStreamName), m_szMusicPath ); + sprintf_s(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szStreamName), m_szMusicPath ); strcat((char *)m_szStreamName,"music/"); strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]); strcat((char *)m_szStreamName,".wav"); diff --git a/Minecraft.Client/Common/Audio/SoundNames.cpp b/Minecraft.Client/Common/Audio/SoundNames.cpp index fb51669b..748f64d1 100644 --- a/Minecraft.Client/Common/Audio/SoundNames.cpp +++ b/Minecraft.Client/Common/Audio/SoundNames.cpp @@ -4,7 +4,7 @@ -const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]= +const wchar_t *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]= { L"mob.chicken.say", // eSoundType_MOB_CHICKEN_AMBIENT L"mob.chicken.hurt", // eSoundType_MOB_CHICKEN_HURT diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index abe5deac..d6236952 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -1711,7 +1711,7 @@ DWORD CMinecraftApp::GetPlayerSkinId(int iPad) if( GET_IS_DLC_SKIN_FROM_BITMASK(dwSkin) ) { // 4J Stu - DLC skins are numbered using decimal rather than hex to make it easier to number manually - swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(dwSkin)); + swprintf_s(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(dwSkin)); Pack=app.m_dlcManager.getPackContainingSkin(chars); @@ -1824,7 +1824,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad) for(unsigned int i=0;iGetOnlineName()); + swprintf_s(wchFormat, 40, L"%ls\n\n%%ls",player->GetOnlineName()); C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_BANNED_LEVEL_TITLE, IDS_PLAYER_BANNED_LEVEL, uiIDA,2,i,&CMinecraftApp::BannedLevelDialogReturned,this, wchFormat); if(result != C4JStorage::EMessage_Busy) SetAction(i,eAppAction_Idle); @@ -6241,9 +6241,9 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. // So we assume the first sku for the product is the one we want #ifdef __ORBIS__ - sprintf(chName,"%s",pSONYDLCInfo->chDLCKeyname); + sprintf_s(chName,"%s",pSONYDLCInfo->chDLCKeyname); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); // 4J-PB - need to check for an empty store @@ -6606,49 +6606,49 @@ wstring CMinecraftApp::FormatHTMLString(int iPad, const wstring &desc, int shado wchar_t replacements[64]; // We will also insert line breaks here as couldn't figure out how to get them to come through from strings.resx ! text = replaceAll(text, L"{*B*}", L"
" ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_T1)); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_T1)); text = replaceAll(text, L"{*T1*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_T2)); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_T2)); text = replaceAll(text, L"{*T2*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_T3)); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_T3)); text = replaceAll(text, L"{*T3*}", replacements ); // for How To Play - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_Black)); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_Black)); text = replaceAll(text, L"{*ETB*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_White)); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_White)); text = replaceAll(text, L"{*ETW*}", replacements ); text = replaceAll(text, L"{*EF*}", L"" ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_0), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_0), shadowColour); text = replaceAll(text, L"{*C0*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_1), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_1), shadowColour); text = replaceAll(text, L"{*C1*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_2), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_2), shadowColour); text = replaceAll(text, L"{*C2*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_3), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_3), shadowColour); text = replaceAll(text, L"{*C3*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_4), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_4), shadowColour); text = replaceAll(text, L"{*C4*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_5), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_5), shadowColour); text = replaceAll(text, L"{*C5*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_6), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_6), shadowColour); text = replaceAll(text, L"{*C6*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_7), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_7), shadowColour); text = replaceAll(text, L"{*C7*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_8), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_8), shadowColour); text = replaceAll(text, L"{*C8*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_9), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_9), shadowColour); text = replaceAll(text, L"{*C9*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_a), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_a), shadowColour); text = replaceAll(text, L"{*CA*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_b), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_b), shadowColour); text = replaceAll(text, L"{*CB*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_c), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_c), shadowColour); text = replaceAll(text, L"{*CC*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_d), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_d), shadowColour); text = replaceAll(text, L"{*CD*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_e), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_e), shadowColour); text = replaceAll(text, L"{*CE*}", replacements ); - swprintf(replacements,64,L"", GetHTMLColour(eHTMLColor_f), shadowColour); + swprintf_s(replacements,64,L"", GetHTMLColour(eHTMLColor_f), shadowColour); text = replaceAll(text, L"{*CF*}", replacements ); // Swap for southpaw. @@ -6824,7 +6824,7 @@ wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction) int size = 45; #endif - swprintf(string,128,L"", replacement.c_str(), size, size); + swprintf_s(string,128,L"", replacement.c_str(), size, size); return string; #endif @@ -6953,7 +6953,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) int size = 45; #endif - swprintf(string,128,L"", replacement.c_str(), size, size); + swprintf_s(string,128,L"", replacement.c_str(), size, size); return string; #endif @@ -6984,7 +6984,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) int size = 33; #endif - swprintf(string,128,L"", size, size); + swprintf_s(string,128,L"", size, size); wstring result = L""; switch(uiIcon) { @@ -9491,7 +9491,7 @@ wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) if( GET_IS_DLC_SKIN_FROM_BITMASK(skinId) ) { // 4J Stu - DLC skins are numbered using decimal rather than hex to make it easier to number manually - swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(skinId)); + swprintf_s(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(skinId)); } else @@ -9500,11 +9500,11 @@ wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(skinId); if( ugcSkinIndex == 0 ) { - swprintf(chars, 256, L"defskin%08X.png",defaultSkinIndex); + swprintf_s(chars, 256, L"defskin%08X.png",defaultSkinIndex); } else { - swprintf(chars, 256, L"ugcskin%08X.png",ugcSkinIndex); + swprintf_s(chars, 256, L"ugcskin%08X.png",ugcSkinIndex); } } return chars; @@ -9542,7 +9542,7 @@ int CMinecraftApp::TexturePackDialogReturned(void* pParam, int iPad, C4JStorage: #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); + sprintf_s(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); #endif app.GetDLCSkuIDFromProductList(chName, chSkuID); diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 6e5ff20f..3172a6a8 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -297,7 +297,7 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { // pass in the pack format string WCHAR wchFormat[132]; - swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); + swprintf_s(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,wchFormat); diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index d2221a52..f8856535 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -817,7 +817,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() if(!pQNetPlayer->IsLocal()) { ZeroMemory(stat,32*sizeof(WCHAR)); - swprintf(stat, 32, L"%d: %d/", i, pQNetPlayer->GetCurrentRtt() ); + swprintf_s(stat, 32, L"%d: %d/", i, pQNetPlayer->GetCurrentRtt() ); stats.append(stat); } } diff --git a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp index 1e6fa6fa..de58f278 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp @@ -214,7 +214,7 @@ void IUIScene_AnvilMenu::handleTick() { LPCWSTR costString = app.GetString(IDS_REPAIR_COST); wchar_t temp[256]; - swprintf(temp, 256, costString, m_repairMenu->cost); + swprintf_s(temp, 256, costString, m_repairMenu->cost); m_costString = temp; if(!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast(m_inventory->player->shared_from_this()))) { diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp index 6fddece9..eae58d98 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp @@ -1284,7 +1284,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade) size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; - swprintf(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_Black)); + swprintf_s(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_Black)); wsText= startTags + wsText + L"

"; setDescriptionText(wsText.c_str()); diff --git a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp index e88ed08c..9ba3adb3 100644 --- a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp @@ -258,9 +258,9 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. // So we assume the first sku for the product is the one we want #ifdef __ORBIS__ - sprintf(chName,"%s",pSONYDLCInfo->chDLCKeyname); + sprintf_s(chName,"%s",pSONYDLCInfo->chDLCKeyname); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); // 4J-PB - need to check for an empty store diff --git a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp index 735da438..c4d35b08 100644 --- a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp @@ -35,7 +35,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() if(dwImageBytes > 0 && pbImageData) { wchar_t imageName[64]; - swprintf(imageName,64,L"tpack%08x",tp->getId()); + swprintf_s(imageName,64,L"tpack%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); m_texturePackList.addPack(i,imageName); } @@ -190,14 +190,14 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) //} wchar_t imageName[64]; - swprintf(imageName,64,L"tpack%08x",tp->getId()); + swprintf_s(imageName,64,L"tpack%08x",tp->getId()); m_bitmapTexturePackIcon.setTextureName(imageName); pbImageData = tp->getPackComparison(dwImageBytes); if(dwImageBytes > 0 && pbImageData) { - swprintf(imageName,64,L"texturePackComparison%08x",tp->getId()); + swprintf_s(imageName,64,L"texturePackComparison%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); m_bitmapComparison.setTextureName(imageName); } diff --git a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp index 76d3babf..b7a5e0f1 100644 --- a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp @@ -168,8 +168,8 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws // set the text colour wchar_t formatting[40]; // 4J Stu - Don't set HTML font size, that's set at design time in flash - //swprintf(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); - swprintf(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White)); + //swprintf_s(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); + swprintf_s(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White)); text = formatting + text; m_labelDescription.setLabel( text, true ); @@ -181,8 +181,8 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws // set the text colour wchar_t formatting[40]; // 4J Stu - Don't set HTML font size, that's set at design time in flash - //swprintf(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); - swprintf(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White)); + //swprintf_s(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); + swprintf_s(formatting, 40, L"",app.GetHTMLColour(eHTMLColor_White)); text = formatting + text; m_labelDescription.setLabel( text, true ); diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 63391b68..d266ab4b 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -2801,7 +2801,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) { int iMins=dwTimeTicks/60; int iSeconds=dwTimeTicks%60; - swprintf( wcTime, 20, L"%d:%02d",iMins,iSeconds); + swprintf_s( wcTime, 20, L"%d:%02d",iMins,iSeconds); if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(wcTime); } else @@ -2844,7 +2844,7 @@ void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { #if !(defined(_XBOX_ONE) || defined(__ORBIS__)) WCHAR wcAutosaveCountdown[100]; - swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); + swprintf_s( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); if(m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()) m_groups[static_cast(eUIGroup_Fullscreen)]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif } diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp index a3fb0d2d..66dd468b 100644 --- a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp @@ -54,7 +54,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL { LPCWSTR costString = app.GetString(IDS_REPAIR_COST); wchar_t temp[256]; - swprintf(temp, 256, costString, m_repairMenu->cost); + swprintf_s(temp, 256, costString, m_repairMenu->cost); m_costString = temp; if(!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast(m_inventory->player->shared_from_this()))) { diff --git a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp index 939efde1..1396d983 100644 --- a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp @@ -30,7 +30,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa if(bNotInGame) { LPWSTR layoutString = new wchar_t[ 128 ]; - swprintf( layoutString, 128, L"%ls", VER_PRODUCTVERSION_STR_W); + swprintf_s( layoutString, 128, L"%ls", VER_PRODUCTVERSION_STR_W); m_labelVersion.init(layoutString); delete [] layoutString; } @@ -64,7 +64,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa #ifndef __PSVITA__ LPWSTR layoutString = new wchar_t[ 128 ]; - swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[iSelected])); + swprintf_s( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[iSelected])); #ifdef __ORBIS__ if (!InputManager.UsingRemoteVita()) #endif @@ -202,7 +202,7 @@ void UIScene_ControlsMenu::handlePress(F64 controlId, F64 childId) case eControl_Button2: app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,static_cast(control)); LPWSTR layoutString = new wchar_t[ 128 ]; - swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[control])); + swprintf_s( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[control])); #ifdef __ORBIS__ if (!InputManager.UsingRemoteVita()) #endif diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index c576a044..5f56de81 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -64,10 +64,10 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay m_labelTexturePackDescription.init(L""); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[0])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[0])); m_sliderGamemode.init(TempString,eControl_GameModeToggle,0,2,0); m_MoreOptionsParams.bGenerateOptions=TRUE; @@ -183,7 +183,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay if(dwImageBytes > 0 && pbImageData) { wchar_t imageName[64]; - swprintf(imageName,64,L"tpack%08x",tp->getId()); + swprintf_s(imageName,64,L"tpack%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); m_texturePackList.addPack(i,imageName); app.DebugPrintf("Adding texture pack %ls at %d\n",imageName,i); @@ -645,7 +645,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderDifficulty.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); m_sliderDifficulty.setLabel(TempString); break; case eControl_GameModeToggle: @@ -667,7 +667,7 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_iGameModeId = GameType::SURVIVAL->getId(); } - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[value])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[value])); m_sliderGamemode.setLabel(TempString); break; diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Common/UI/UIScene_Credits.cpp index 02dc6620..06fe8d1c 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Credits.cpp @@ -538,11 +538,11 @@ UIScene_Credits::UIScene_Credits(int iPad, void *initData, UILayer *parentLayer) LPWSTR creditsString = new wchar_t[ 128 ]; if(gs_aCreditDefs[i].m_iStringID[1]!=NO_TRANSLATED_STRING) { - swprintf( creditsString, 128, gs_aCreditDefs[i].m_Text, app.GetString( gs_aCreditDefs[i].m_iStringID[0] ), app.GetString( gs_aCreditDefs[i].m_iStringID[1] ) ); + swprintf_s( creditsString, 128, gs_aCreditDefs[i].m_Text, app.GetString( gs_aCreditDefs[i].m_iStringID[0] ), app.GetString( gs_aCreditDefs[i].m_iStringID[1] ) ); } else { - swprintf( creditsString, 128, gs_aCreditDefs[i].m_Text, app.GetString( gs_aCreditDefs[i].m_iStringID[0] ) ); + swprintf_s( creditsString, 128, gs_aCreditDefs[i].m_Text, app.GetString( gs_aCreditDefs[i].m_iStringID[0] ) ); } setNextLabel(creditsString,gs_aCreditDefs[i].m_eType); delete [] creditsString; @@ -629,11 +629,11 @@ void UIScene_Credits::tick() } else if(pDef->m_iStringID[1]!=NO_TRANSLATED_STRING) { - swprintf( creditsString, 128, sanitisedString.c_str(), app.GetString( pDef->m_iStringID[0] ), app.GetString( pDef->m_iStringID[1] ) ); + swprintf_s( creditsString, 128, sanitisedString.c_str(), app.GetString( pDef->m_iStringID[0] ), app.GetString( pDef->m_iStringID[1] ) ); } else { - swprintf( creditsString, 128, sanitisedString.c_str(), app.GetString( pDef->m_iStringID[0] ) ); + swprintf_s( creditsString, 128, sanitisedString.c_str(), app.GetString( pDef->m_iStringID[0] ) ); } setNextLabel(creditsString,pDef->m_eType); diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index 5e644803..437cdd66 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -780,7 +780,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) wchar_t formatting[40]; wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS); -// swprintf(formatting, 40, L"", m_bIsSD?12:14); +// swprintf_s(formatting, 40, L"", m_bIsSD?12:14); // wstrTemp = formatting + wstrTemp; m_labelHTMLSellText.setLabel(wstrTemp); diff --git a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp index d698b51f..ffc490e6 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -78,9 +78,9 @@ void UIScene_DebugCreateSchematic::onDirectEditFinished(UIControl_TextInput *inp if (input == &m_textInputName) { if (!value.empty()) - swprintf(m_data->name, 64, L"%ls", value.c_str()); + swprintf_s(m_data->name, 64, L"%ls", value.c_str()); else - swprintf(m_data->name, 64, L"schematic"); + swprintf_s(m_data->name, 64, L"schematic"); } else if (input == &m_textInputStartX) m_data->startX = iVal; else if (input == &m_textInputStartY) m_data->startY = iVal; @@ -260,11 +260,11 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b pClass->m_textInputName.setLabel(value); if(!value.empty()) { - swprintf(pClass->m_data->name,64,L"%ls", value.c_str()); + swprintf_s(pClass->m_data->name,64,L"%ls", value.c_str()); } else { - swprintf(pClass->m_data->name,64,L"schematic"); + swprintf_s(pClass->m_data->name,64,L"schematic"); } break; case eControl_StartX: diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index 550757e3..9bc52f21 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -25,11 +25,11 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa WCHAR tempString[256]; const int fovSliderVal = app.GetGameSettings(m_iPad, eGameSetting_FOV); const int fovDeg = 70 + fovSliderVal * 40 / 100; - swprintf( tempString, 256, L"Set fov (%d)", fovDeg); + swprintf_s( tempString, 256, L"Set fov (%d)", fovDeg); m_sliderFov.init(tempString,eControl_FOV,0,100,fovSliderVal); const float currentTime = pMinecraft->level->getLevelData()->getGameTime() % 24000; - swprintf( tempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); + swprintf_s( tempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); m_sliderTime.init(tempString,eControl_Time,0,240,currentTime/100); m_buttonRain.init(L"Toggle Rain",eControl_Rain); @@ -270,7 +270,7 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) WCHAR tempString[256]; float currentTime = currentValue * 100; - swprintf( tempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); + swprintf_s( tempString, 256, L"Set time (unsafe) (%d)", static_cast(currentTime)); m_sliderTime.setLabel(tempString); } break; @@ -285,7 +285,7 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) app.SetGameSettings(m_iPad, eGameSetting_FOV, v); WCHAR tempString[256]; - swprintf( tempString, 256, L"Set fov (%d)", fovDeg); + swprintf_s( tempString, 256, L"Set fov (%d)", fovDeg); m_sliderFov.setLabel(tempString); } break; diff --git a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp index 51eab5aa..2d4de8cf 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp @@ -31,19 +31,19 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camX); + swprintf_s( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camX); m_textInputX.init(TempString, eControl_CamX); - swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camY); + swprintf_s( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camY); m_textInputY.init(TempString, eControl_CamY); - swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camZ); + swprintf_s( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_camZ); m_textInputZ.init(TempString, eControl_CamZ); - swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_yRot); + swprintf_s( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_yRot); m_textInputYRot.init(TempString, eControl_YRot); - swprintf( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_elev); + swprintf_s( (WCHAR *)TempString, 256, L"%.2f", currentPosition->m_elev); m_textInputElevation.init(TempString, eControl_Elevation); m_checkboxLockPlayer.init(L"Lock Player", eControl_LockPlayer, app.GetFreezePlayers()); diff --git a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp index ead86c3d..29a79634 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -33,7 +33,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) #endif //wchar_t startTags[64]; - //swprintf(startTags,64,L"",app.GetHTMLFontSize(eHTMLSize_EndPoem)); + //swprintf_s(startTags,64,L"",app.GetHTMLFontSize(eHTMLSize_EndPoem)); //noNoiseString.append(halfScreenLineBreaks); //noNoiseString.append(halfScreenLineBreaks); noNoiseString.append( app.GetString(IDS_WIN_TEXT) ); @@ -267,7 +267,7 @@ void UIScene_EndPoem::updateNoise() if(randomVal == 1) colour = eHTMLColor_9; else if(randomVal == 2) colour = eHTMLColor_a; ZeroMemory(replacements,64*sizeof(wchar_t)); - swprintf(replacements,64,L"%ls",app.GetHTMLColour(colour),randomCharStr.c_str()); + swprintf_s(replacements,64,L"%ls",app.GetHTMLColour(colour),randomCharStr.c_str()); replaceString.append(replacements); } diff --git a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp index e39869a1..e4c75657 100644 --- a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp @@ -49,7 +49,7 @@ UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void *initData, wstring wsText= app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; - swprintf(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"

"; m_labelTip.init(wsText); @@ -353,7 +353,7 @@ void UIScene_FullscreenProgress::handleTimerComplete(int id) // display the next tip wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip())); wchar_t startTags[64]; - swprintf(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"

",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText + L"

"; m_labelTip.setLabel(wsText); } diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp index bc721802..cfb818ed 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp @@ -296,7 +296,7 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage ) // Set the text colour wstring finalText(replacedText.c_str() ); wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); finalText = startTags + finalText; vector paragraphs; diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 5b83ea7c..f152e78a 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -94,7 +94,7 @@ void UIScene_JoinMenu::tick() if( m_selectedSession->data.players[i].isSignedIntoPSN() == false ) { char suffix[5]; - sprintf(suffix, " (%d)", m_selectedSession->data.players[i].getQuadrant() + 1); + sprintf_s(suffix, " (%d)", m_selectedSession->data.players[i].getQuadrant() + 1); playerName.append(suffix); } #endif @@ -798,7 +798,7 @@ int UIScene_JoinMenu::EditServerKeyboardCallback(LPVOID lpParam, bool bRes) pClass->m_editServerPhase = eEditServer_Port; wchar_t wDefaultPort[16] = {}; - swprintf(wDefaultPort, 16, L"%d", pClass->m_selectedSession->data.hostPort); + swprintf_s(wDefaultPort, 16, L"%d", pClass->m_selectedSession->data.hostPort); UIKeyboardInitData kbData; kbData.title = L"Server Port"; diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 1832e40c..d8fad3f9 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -152,7 +152,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText; if (m_tabIndex == TAB_WORLD_OPTIONS) m_labelDescription_WorldOptions.setLabel(wsText); @@ -513,7 +513,7 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); wsText = startTags + wsText; if (m_tabIndex == TAB_WORLD_OPTIONS) diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp index ed0b3151..8eff769e 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -69,11 +69,11 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void *initData, UIL m_currentFilter = LeaderboardManager::eFM_Friends; wchar_t filterBuffer[40]; - swprintf(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_FRIENDS)); + swprintf_s(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_FRIENDS)); m_labelFilter.init(filterBuffer); wchar_t entriesBuffer[40]; - swprintf(entriesBuffer, 40, L"%ls%i", app.GetString(IDS_LEADERBOARD_ENTRIES), 0); + swprintf_s(entriesBuffer, 40, L"%ls%i", app.GetString(IDS_LEADERBOARD_ENTRIES), 0); m_labelEntries.init(entriesBuffer); ReadStats(-1); @@ -332,7 +332,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, bool { m_currentFilter = LeaderboardManager::eFM_MyScore; wchar_t filterBuffer[40]; - swprintf(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_MYSCORE)); + swprintf_s(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_MYSCORE)); m_labelFilter.setLabel(filterBuffer); } break; @@ -340,7 +340,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, bool { m_currentFilter = LeaderboardManager::eFM_TopRank; wchar_t filterBuffer[40]; - swprintf(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_OVERALL)); + swprintf_s(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_OVERALL)); m_labelFilter.setLabel(filterBuffer); } break; @@ -348,7 +348,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, bool { m_currentFilter = LeaderboardManager::eFM_Friends; wchar_t filterBuffer[40]; - swprintf(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_FRIENDS)); + swprintf_s(filterBuffer, 40, L"%ls%ls", app.GetString(IDS_LEADERBOARD_FILTER), app.GetString(IDS_LEADERBOARD_FILTER_FRIENDS)); m_labelFilter.setLabel(filterBuffer); } break; @@ -540,9 +540,9 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() m_leaderboard.m_entries[entryIndex].m_row = entryIndex; m_leaderboard.m_entries[entryIndex].m_rank = entryIndex+1; - swprintf(m_leaderboard.m_entries[entryIndex].m_wcRank, 12, L"12345678");//(int)m_leaderboard.m_entries[entryIndex].m_rank); + swprintf_s(m_leaderboard.m_entries[entryIndex].m_wcRank, 12, L"12345678");//(int)m_leaderboard.m_entries[entryIndex].m_rank); - swprintf(m_leaderboard.m_entries[entryIndex].m_gamerTag, 17, L"WWWWWWWWWWWWWWWW"); + swprintf_s(m_leaderboard.m_entries[entryIndex].m_gamerTag, 17, L"WWWWWWWWWWWWWWWW"); //m_leaderboard.m_entries[entryIndex].m_locale = (entryIndex % 37) + 1; @@ -553,12 +553,12 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() if( !isDistanceLeaderboard ) { m_leaderboard.m_entries[entryIndex].m_columns[i] = USHRT_MAX; - swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%u", m_leaderboard.m_entries[entryIndex].m_columns[i]); + swprintf_s(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%u", m_leaderboard.m_entries[entryIndex].m_columns[i]); } else { m_leaderboard.m_entries[entryIndex].m_columns[i] = UINT_MAX; - swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", static_cast(m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); + swprintf_s(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", static_cast(m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f); } } @@ -706,7 +706,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor leaderboardEntry->m_rank = statsRow->m_rank; DWORD displayRank = leaderboardEntry->m_rank; if(displayRank > 9999999) displayRank = 9999999; - swprintf(leaderboardEntry->m_wcRank, 12, L"%u", displayRank); + swprintf_s(leaderboardEntry->m_wcRank, 12, L"%u", displayRank); leaderboardEntry->m_idsErrorMessage = statsRow->m_idsErrorMessage; @@ -734,7 +734,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor #ifdef __PS3__ // m_name can be unicode characters somehow for Japan - should use m_onlineID wstring wstr=convStringToWstring(statsRow->m_uid.getOnlineID()); - swprintf(leaderboardEntry->m_gamerTag, XUSER_NAME_SIZE, L"%ls",wstr.c_str()); + swprintf_s(leaderboardEntry->m_gamerTag, XUSER_NAME_SIZE, L"%ls",wstr.c_str()); #else memcpy(leaderboardEntry->m_gamerTag, statsRow->m_name.data(), statsRow->m_name.size() * sizeof(wchar_t)); #endif @@ -748,7 +748,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor { DWORD displayValue = leaderboardEntry->m_columns[i]; if(displayValue > 99999) displayValue = 99999; - swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%u",displayValue); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%u",displayValue); #ifdef _DEBUG //app.DebugPrintf("Value - %d\n",leaderboardEntry->m_columns[i]); #endif @@ -773,7 +773,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor if(iDigitC<4) { // m - swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%um", leaderboardEntry->m_columns[i]); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%um", leaderboardEntry->m_columns[i]); #ifdef _DEBUG //app.DebugPrintf("Display - %um\n", leaderboardEntry->m_columns[i]); #endif @@ -781,7 +781,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor else if(iDigitC<8) { // km with a .X - swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG //app.DebugPrintf("Display - %.1fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif @@ -789,7 +789,7 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry(LeaderboardManager::ReadScor else { // bigger than that, so no decimal point - swprintf(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); + swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast(leaderboardEntry->m_columns[i])/1000.f); #ifdef _DEBUG //app.DebugPrintf("Display - %.0fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f); #endif @@ -855,11 +855,11 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet wchar_t entriesBuffer[40]; if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< 0 && pbImageData) { wchar_t imageName[64]; - swprintf(imageName,64,L"tpack%08x",tp->getId()); + swprintf_s(imageName,64,L"tpack%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); m_buttonListSaves.setTextureName( m_buttonListSaves.getItemCount() - 1, imageName ); } @@ -2075,7 +2075,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); if(dwImageBytes > 0 && pbImageData) { - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); + swprintf_s(textureName,64,L"%ls",sessionInfo->displayLabel); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); } } @@ -2084,7 +2084,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() pbImageData = tp->getPackIcon(dwImageBytes); if(dwImageBytes > 0 && pbImageData) { - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); + swprintf_s(textureName,64,L"%ls",sessionInfo->displayLabel); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); } } @@ -2100,7 +2100,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() if(dwImageBytes > 0 && pbImageData) { - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); + swprintf_s(textureName,64,L"%ls",sessionInfo->displayLabel); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); } } @@ -2658,7 +2658,7 @@ int UIScene_LoadCreateJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); // 4J-PB - need to check for an empty store @@ -2721,7 +2721,7 @@ int UIScene_LoadCreateJoinMenu::TexturePackDialogReturned(void *pParam,int iPad, #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); // 4J-PB - need to check for an empty store @@ -3036,7 +3036,7 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame if(pClass->m_saveTransferDownloadCancelled) { WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + swprintf_s(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3051,7 +3051,7 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame if(pClass->m_saveTransferDownloadCancelled) { WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + swprintf_s(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3090,8 +3090,8 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame int dataProgress = app.getRemoteStorage()->getDataProgress(); pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - //swprintf(wcTemp, 256, L"Downloading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),dataProgress); + //swprintf_s(wcTemp, 256, L"Downloading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); + swprintf_s(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),dataProgress); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); if(pClass->m_saveTransferDownloadCancelled && bAbortCalled == false) @@ -3251,7 +3251,7 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame if(pClass->m_saveTransferDownloadCancelled) { WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + swprintf_s(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3455,8 +3455,8 @@ int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParamete int dataProgress = app.getRemoteStorage()->getDataProgress(); pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - //swprintf(wcTemp, 256, L"Uploading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_PUT_DATA),dataProgress); + //swprintf_s(wcTemp, 256, L"Uploading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); + swprintf_s(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_PUT_DATA),dataProgress); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3794,7 +3794,7 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete WCHAR wcTemp[256]; pStateContainer->m_bSaveTransferCancelled=false; - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); + swprintf_s(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3847,7 +3847,7 @@ void UIScene_LoadCreateJoinMenu::RequestFileData( SaveTransferStateContainer *pC pMinecraft->progressRenderer->progressStagePercentage(0); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadCreateJoinMenu::s_ulFileSize); + swprintf_s(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadCreateJoinMenu::s_ulFileSize); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3916,7 +3916,7 @@ int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsign if(pClass->m_bSaveTransferCancelled) // was cancelled { pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); + swprintf_s(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3925,7 +3925,7 @@ int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsign unsigned int uiProgress=(unsigned int)(((float)ulBytesReceived/float(UIScene_LoadCreateJoinMenu::s_ulFileSize))*100.0f); pMinecraft->progressRenderer->progressStagePercentage(uiProgress); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadCreateJoinMenu::s_ulFileSize)/1024000.0f); + swprintf_s(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadCreateJoinMenu::s_ulFileSize)/1024000.0f); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp index 846696b4..6eadb7e9 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp @@ -1134,7 +1134,7 @@ void UIScene_LoadCreateJoinMenu::AddDefaultButtons() if(dwImageBytes > 0 && pbImageData) { wchar_t imageName[64]; - swprintf(imageName,64,L"tpack%08x",tp->getId()); + swprintf_s(imageName,64,L"tpack%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); m_buttonListLoad.SetTextureName( m_buttonListLoad.getItemCount() - 1, imageName ); } @@ -2077,7 +2077,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); if(dwImageBytes > 0 && pbImageData) { - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); + swprintf_s(textureName,64,L"%ls",sessionInfo->displayLabel); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); } } @@ -2086,7 +2086,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() pbImageData = tp->getPackIcon(dwImageBytes); if(dwImageBytes > 0 && pbImageData) { - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); + swprintf_s(textureName,64,L"%ls",sessionInfo->displayLabel); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); } } @@ -2102,7 +2102,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() if(dwImageBytes > 0 && pbImageData) { - swprintf(textureName,64,L"%ls",sessionInfo->displayLabel); + swprintf_s(textureName,64,L"%ls",sessionInfo->displayLabel); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); } } @@ -2660,7 +2660,7 @@ int UIScene_LoadCreateJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); // 4J-PB - need to check for an empty store @@ -2723,7 +2723,7 @@ int UIScene_LoadCreateJoinMenu::TexturePackDialogReturned(void *pParam,int iPad, #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); // 4J-PB - need to check for an empty store @@ -3038,7 +3038,7 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame if(pClass->m_saveTransferDownloadCancelled) { WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + swprintf_s(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3053,7 +3053,7 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame if(pClass->m_saveTransferDownloadCancelled) { WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + swprintf_s(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3092,8 +3092,8 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame int dataProgress = app.getRemoteStorage()->getDataProgress(); pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - //swprintf(wcTemp, 256, L"Downloading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),dataProgress); + //swprintf_s(wcTemp, 256, L"Downloading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); + swprintf_s(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),dataProgress); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); if(pClass->m_saveTransferDownloadCancelled && bAbortCalled == false) @@ -3253,7 +3253,7 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame if(pClass->m_saveTransferDownloadCancelled) { WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + swprintf_s(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3457,8 +3457,8 @@ int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParamete int dataProgress = app.getRemoteStorage()->getDataProgress(); pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - //swprintf(wcTemp, 256, L"Uploading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_PUT_DATA),dataProgress); + //swprintf_s(wcTemp, 256, L"Uploading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); + swprintf_s(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_PUT_DATA),dataProgress); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3796,7 +3796,7 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete WCHAR wcTemp[256]; pStateContainer->m_bSaveTransferCancelled=false; - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); + swprintf_s(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3849,7 +3849,7 @@ void UIScene_LoadCreateJoinMenu::RequestFileData( SaveTransferStateContainer *pC pMinecraft->progressRenderer->progressStagePercentage(0); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadCreateJoinMenu::s_ulFileSize); + swprintf_s(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadCreateJoinMenu::s_ulFileSize); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3918,7 +3918,7 @@ int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsign if(pClass->m_bSaveTransferCancelled) // was cancelled { pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); + swprintf_s(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3927,7 +3927,7 @@ int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsign unsigned int uiProgress=(unsigned int)(((float)ulBytesReceived/float(UIScene_LoadCreateJoinMenu::s_ulFileSize))*100.0f); pMinecraft->progressRenderer->progressStagePercentage(uiProgress); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadCreateJoinMenu::s_ulFileSize)/1024000.0f); + swprintf_s(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadCreateJoinMenu::s_ulFileSize)/1024000.0f); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 8d396c1a..d6d66e7e 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -86,10 +86,10 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[0])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[0])); m_sliderGamemode.init(TempString,eControl_GameModeToggle,0,2,0); m_MoreOptionsParams.bGenerateOptions=FALSE; @@ -189,7 +189,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye if(dwImageBytes > 0 && pbImageData) { wchar_t textureName[64]; - swprintf(textureName,64,L"loadsave"); + swprintf_s(textureName,64,L"loadsave"); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); m_bitmapIcon.setTextureName( textureName ); } @@ -296,7 +296,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye if(dwImageBytes > 0 && pbImageData) { wchar_t imageName[64]; - swprintf(imageName,64,L"tpack%08x",tp->getId()); + swprintf_s(imageName,64,L"tpack%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); m_texturePackList.addPack(i,imageName); } @@ -471,7 +471,7 @@ void UIScene_LoadMenu::tick() if(szSeed[0]!=0) { WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %hs", app.GetString( IDS_SEED ),szSeed); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %hs", app.GetString( IDS_SEED ),szSeed); m_labelSeed.setLabel(TempString); } else @@ -920,7 +920,7 @@ void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderDifficulty.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); m_sliderDifficulty.setLabel(TempString); break; case eControl_GameModeToggle: @@ -942,7 +942,7 @@ void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_iGameModeId = GameType::SURVIVAL->getId(); } - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[value])); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[value])); m_sliderGamemode.setLabel(TempString); break; diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index 7ef2a316..ab725b09 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -56,8 +56,8 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa // 4J-TomK - check for all possible labels being fed into BUTTON_PAUSE_SAVEGAME (Bug 163775) // this has to be done before button initialisation! wchar_t saveButtonLabels[2][256]; - swprintf( saveButtonLabels[0], 256, L"%ls", app.GetString( IDS_SAVE_GAME )); - swprintf( saveButtonLabels[1], 256, L"%ls", app.GetString( IDS_DISABLE_AUTOSAVE )); + swprintf_s( saveButtonLabels[0], 256, L"%ls", app.GetString( IDS_SAVE_GAME )); + swprintf_s( saveButtonLabels[1], 256, L"%ls", app.GetString( IDS_DISABLE_AUTOSAVE )); m_buttons[BUTTON_PAUSE_SAVEGAME].setAllPossibleLabels(2,saveButtonLabels); if(app.GetGameHostOption(eGameHostOption_DisableSaving) || m_bTrialTexturePack) @@ -245,8 +245,8 @@ void UIScene_PauseMenu::handlePreReload() // 4J-TomK - check for all possible labels being fed into BUTTON_PAUSE_SAVEGAME (Bug 163775) // this has to be done before button initialisation! wchar_t saveButtonLabels[2][256]; - swprintf( saveButtonLabels[0], 256, L"%ls", app.GetString( IDS_SAVE_GAME )); - swprintf( saveButtonLabels[1], 256, L"%ls", app.GetString( IDS_DISABLE_AUTOSAVE )); + swprintf_s( saveButtonLabels[0], 256, L"%ls", app.GetString( IDS_SAVE_GAME )); + swprintf_s( saveButtonLabels[1], 256, L"%ls", app.GetString( IDS_DISABLE_AUTOSAVE )); m_buttons[BUTTON_PAUSE_SAVEGAME].setAllPossibleLabels(2,saveButtonLabels); } #endif @@ -1223,7 +1223,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); @@ -1300,7 +1300,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); diff --git a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp index 76676561..db679818 100644 --- a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp @@ -280,7 +280,7 @@ int UIScene_QuadrantSignin::AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWOR static unsigned int quadrantImageCount = 0; wchar_t iconName[32]; - swprintf(iconName,32,L"quadrantImage%05d",quadrantImageCount++); + swprintf_s(iconName,32,L"quadrantImage%05d",quadrantImageCount++); pClass->registerSubstitutionTexture(iconName,pbThumbnail,dwThumbnailBytes,true); pClass->m_bitmapIcon[pClass->m_lastRequestedAvatar].setTextureName(iconName); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp index 850e1303..5248724d 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -8,10 +8,10 @@ UIScene_SettingsAudioMenu::UIScene_SettingsAudioMenu(int iPad, void *initData, U initialiseMovie(); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),app.GetGameSettings(m_iPad,eGameSetting_MusicVolume)); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),app.GetGameSettings(m_iPad,eGameSetting_MusicVolume)); m_sliderMusic.init(TempString,eControl_Music,0,100,app.GetGameSettings(m_iPad,eGameSetting_MusicVolume)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); m_sliderSound.init(TempString,eControl_Sound,0,100,app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); m_checkboxCaveSounds.init(L"Cave Sounds", eControl_CaveSounds,(app.GetGameSettings(m_iPad,eGameSetting_CaveSounds)!=0)); @@ -105,7 +105,7 @@ void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderMusic.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_MusicVolume,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),value); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),value); m_sliderMusic.setLabel(TempString); break; @@ -113,7 +113,7 @@ void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) m_sliderSound.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_SoundFXVolume,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),value); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),value); m_sliderSound.setLabel(TempString); break; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp index 7dbd243b..f68b1cfc 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp @@ -8,10 +8,10 @@ UIScene_SettingsControlMenu::UIScene_SettingsControlMenu(int iPad, void *initDat initialiseMovie(); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame)); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame)); m_sliderSensitivityInGame.init(TempString,eControl_SensitivityInGame,0,200,app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu)); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu)); m_sliderSensitivityInMenu.init(TempString,eControl_SensitivityInMenu,0,200,app.GetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu)); doHorizontalResizeCheck(); @@ -100,7 +100,7 @@ void UIScene_SettingsControlMenu::handleSliderMove(F64 sliderId, F64 currentValu m_sliderSensitivityInGame.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),value); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),value); m_sliderSensitivityInGame.setLabel(TempString); break; @@ -108,7 +108,7 @@ void UIScene_SettingsControlMenu::handleSliderMove(F64 sliderId, F64 currentValu m_sliderSensitivityInMenu.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu,value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),value); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),value); m_sliderSensitivityInMenu.setLabel(TempString); break; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 039bd940..755a74a5 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -66,18 +66,18 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD WCHAR TempString[256]; - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); + swprintf_s( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma)); m_sliderGamma.init(TempString,eControl_Gamma,0,100,app.GetGameSettings(m_iPad,eGameSetting_Gamma)); const int initialFovSlider = app.GetGameSettings(m_iPad, eGameSetting_FOV); const int initialFovDeg = sliderValueToFov(initialFovSlider); - swprintf(TempString, 256, L"FOV: %d", initialFovDeg); + swprintf_s(TempString, 256, L"FOV: %d", initialFovDeg); m_sliderFOV.init(TempString, eControl_FOV, 0, FOV_SLIDER_MAX, initialFovSlider); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); + swprintf_s( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); m_sliderInterfaceOpacity.init(TempString,eControl_InterfaceOpacity,0,100,app.GetGameSettings(m_iPad,eGameSetting_InterfaceOpacity)); - swprintf(TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); + swprintf_s(TempString, 256, L"Render Distance: %d",app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,3,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance))); int currentGraphics = app.GetGameSettings(m_iPad, eGameSetting_GraphicsMode); @@ -88,7 +88,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD else if (currentGraphics == 2) graphicsText = L"Graphics: Fancy"; else graphicsText = L"Graphics: Extra"; - swprintf(TempString, 256, L"%ls", graphicsText); + swprintf_s(TempString, 256, L"%ls", graphicsText); m_sliderGraphicsMode.init(TempString, eControl_GraphicsMode, 0, 3, currentGraphics); doHorizontalResizeCheck(); @@ -206,7 +206,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderGamma.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_Gamma,value); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); + swprintf_s( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),value); m_sliderGamma.setLabel(TempString); break; @@ -218,7 +218,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal const int fovValue = sliderValueToFov(value); pMinecraft->gameRenderer->SetFovVal(static_cast(fovValue)); app.SetGameSettings(m_iPad, eGameSetting_FOV, value); - swprintf(TempString, 256, L"FOV: %d", fovValue); + swprintf_s(TempString, 256, L"FOV: %d", fovValue); m_sliderFOV.setLabel(TempString); } break; @@ -227,7 +227,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal m_sliderInterfaceOpacity.handleSliderMove(value); app.SetGameSettings(m_iPad,eGameSetting_InterfaceOpacity,value); - swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); + swprintf_s( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),value); m_sliderInterfaceOpacity.setLabel(TempString); break; @@ -242,7 +242,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal const Minecraft* mc = Minecraft::GetInstance(); mc->options->viewDistance = 3 - value; - swprintf(TempString,256,L"Render Distance: %d",dist); + swprintf_s(TempString,256,L"Render Distance: %d",dist); m_sliderRenderDistance.setLabel(TempString); } break; @@ -258,7 +258,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal else if (value == 2) modeName = L"Fancy"; else if (value == 3) modeName = L"Extra"; - swprintf(TempString, 256, L"Graphics: %ls", modeName); + swprintf_s(TempString, 256, L"Graphics: %ls", modeName); m_sliderGraphicsMode.setLabel(TempString); } diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp index e015768e..1f7b5e5d 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -44,11 +44,11 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat { if(i==0) { - swprintf( autosaveLabels[i], 256, L"%ls", app.GetString( IDS_SLIDER_AUTOSAVE_OFF )); + swprintf_s( autosaveLabels[i], 256, L"%ls", app.GetString( IDS_SLIDER_AUTOSAVE_OFF )); } else { - swprintf( autosaveLabels[i], 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),i*15, app.GetString( IDS_MINUTES )); + swprintf_s( autosaveLabels[i], 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),i*15, app.GetString( IDS_MINUTES )); } } @@ -63,7 +63,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat wchar_t difficultyLabels[4][256]; for(unsigned int i = 0; i < 4; ++i) { - swprintf( difficultyLabels[i], 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[i])); + swprintf_s( difficultyLabels[i], 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[i])); } m_sliderDifficulty.setAllPossibleLabels(4,difficultyLabels); m_sliderDifficulty.init(difficultyLabels[ucValue],eControl_Difficulty,0,3,ucValue); @@ -75,7 +75,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText; m_labelDifficultyText.init(wsText); @@ -255,11 +255,11 @@ void UIScene_SettingsOptionsMenu::handleReload() { if(i==0) { - swprintf( autosaveLabels[i], 256, L"%ls", app.GetString( IDS_SLIDER_AUTOSAVE_OFF )); + swprintf_s( autosaveLabels[i], 256, L"%ls", app.GetString( IDS_SLIDER_AUTOSAVE_OFF )); } else { - swprintf( autosaveLabels[i], 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),i*15, app.GetString( IDS_MINUTES )); + swprintf_s( autosaveLabels[i], 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),i*15, app.GetString( IDS_MINUTES )); } } @@ -275,7 +275,7 @@ void UIScene_SettingsOptionsMenu::handleReload() wchar_t difficultyLabels[4][256]; for(unsigned int i = 0; i < 4; ++i) { - swprintf( difficultyLabels[i], 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[i])); + swprintf_s( difficultyLabels[i], 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[i])); } m_sliderDifficulty.setAllPossibleLabels(4,difficultyLabels); m_sliderDifficulty.init(difficultyLabels[ucValue],eControl_Difficulty,0,3,ucValue); @@ -287,7 +287,7 @@ void UIScene_SettingsOptionsMenu::handleReload() size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText; m_labelDifficultyText.init(wsText); @@ -376,7 +376,7 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValu size = eHTMLSize_Splitscreen; } wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + swprintf_s(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText; m_labelDifficultyText.setLabel(wsText.c_str()); break; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp index 6cb9b862..35577a4a 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -19,10 +19,10 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),app.GetGameSettings(m_iPad,eGameSetting_UISize)+1); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),app.GetGameSettings(m_iPad,eGameSetting_UISize)+1); m_sliderUISize.init(TempString,eControl_UISize,1,3,app.GetGameSettings(m_iPad,eGameSetting_UISize)+1); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1); m_sliderUISizeSplitscreen.init(TempString,eControl_UISizeSplitscreen,1,3,app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1); doHorizontalResizeCheck(); @@ -154,7 +154,7 @@ void UIScene_SettingsUIMenu::handleSliderMove(F64 sliderId, F64 currentValue) case eControl_UISize: m_sliderUISize.handleSliderMove(value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),value); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),value); m_sliderUISize.setLabel(TempString); // is this different from the current value? @@ -169,7 +169,7 @@ void UIScene_SettingsUIMenu::handleSliderMove(F64 sliderId, F64 currentValue) case eControl_UISizeSplitscreen: m_sliderUISizeSplitscreen.handleSliderMove(value); - swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),value); + swprintf_s( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),value); m_sliderUISizeSplitscreen.setLabel(TempString); if(value != app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1) diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 52fa87d5..b309f907 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -419,7 +419,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) { // get the pack number from the skin id wchar_t chars[256]; - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(iPad,m_skinIndex)); + swprintf_s(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(iPad,m_skinIndex)); DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); @@ -706,7 +706,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { // get the pack number from the skin id wchar_t chars[256]; - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,m_skinIndex)); + swprintf_s(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,m_skinIndex)); Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) @@ -850,7 +850,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(uiCurrentFavoriteC>0) { // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,nextIndex)); + swprintf_s(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,nextIndex)); Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) @@ -921,7 +921,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(uiCurrentFavoriteC>0) { // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,previousIndex)); + swprintf_s(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,previousIndex)); Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) @@ -1109,7 +1109,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() bool found; wchar_t chars[256]; // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,app.GetPlayerFavoriteSkinsPos(m_iPad))); + swprintf_s(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,app.GetPlayerFavoriteSkinsPos(m_iPad))); DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) @@ -1576,7 +1576,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: // So we assume the first sku for the product is the one we want // while the store is screwed, hardcode the sku - //sprintf(chName,"%s-%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname,"EURO"); + //sprintf_s(chName,"%s-%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname,"EURO"); // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); @@ -1585,7 +1585,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: #ifdef __ORBIS__ strcpy(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf_s(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif app.GetDLCSkuIDFromProductList(chName,chSkuID); diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index c6457511..0fa5ed7d 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -192,7 +192,7 @@ void DLCTexturePack::loadColourTable() WCHAR szResourceLocator[ LOCATOR_SIZE ]; // Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable - swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#HTMLColours.col",pbData, dwSize); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#HTMLColours.col",pbData, dwSize); BYTE *data; UINT dataLength; if(XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK) @@ -204,7 +204,7 @@ void DLCTexturePack::loadColourTable() else { - swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#xuiscene_colourtable.xur",pbData, dwSize); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#xuiscene_colourtable.xur",pbData, dwSize); HXUIOBJ hScene; HRESULT hr = XuiSceneCreate(szResourceLocator,szResourceLocator, nullptr, &hScene); @@ -568,7 +568,7 @@ void DLCTexturePack::loadUI() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#skin_Minecraft.xur",pbData, dwSize); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#skin_Minecraft.xur",pbData, dwSize); XuiFreeVisuals(L""); @@ -642,7 +642,7 @@ wstring DLCTexturePack::getXuiRootPath() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#",pbData, dwSize); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#",pbData, dwSize); path = szResourceLocator; } return path; diff --git a/Minecraft.Client/DefaultTexturePack.cpp b/Minecraft.Client/DefaultTexturePack.cpp index d2712404..dab2abd8 100644 --- a/Minecraft.Client/DefaultTexturePack.cpp +++ b/Minecraft.Client/DefaultTexturePack.cpp @@ -21,7 +21,7 @@ void DefaultTexturePack::loadIcon() WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); - swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); + swprintf_s(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png"); UINT size = 0; HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size); diff --git a/Minecraft.Client/FolderTexturePack.cpp b/Minecraft.Client/FolderTexturePack.cpp index 05feca66..d447ba95 100644 --- a/Minecraft.Client/FolderTexturePack.cpp +++ b/Minecraft.Client/FolderTexturePack.cpp @@ -82,7 +82,7 @@ void FolderTexturePack::loadUI() const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; - swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str()); + swprintf_s(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str()); XuiFreeVisuals(L""); app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index 517e8fab..60141c9a 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -693,7 +693,7 @@ void Font::loadUnicodePage(int page) { wchar_t fileName[25]; //String fileName = String.format("/1_2_2/font/glyph_%02X.png", page); - swprintf(fileName,25,L"/1_2_2/font/glyph_%02X.png",page); + swprintf_s(fileName,25,L"/1_2_2/font/glyph_%02X.png",page); BufferedImage *image = new BufferedImage(fileName); //try //{ diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index a11a9834..f71fb9e5 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -775,7 +775,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) bool blink = false; int col = blink ? 0xffffff : 0x80ff20; wchar_t formatted[10]; - swprintf(formatted, 10, L"%d",minecraft->player->experienceLevel); + swprintf_s(formatted, 10, L"%d",minecraft->player->experienceLevel); wstring str = formatted; int x = iWidthOffset + (screenWidth - font->width(str)) / 2; diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index 1844bd7e..73de2b98 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -3707,7 +3707,7 @@ void LevelRenderer::staticCtor() char threadName[256]; for(unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i) { - sprintf(threadName,"Rebuild Chunk Thread %d\n",i); + sprintf_s(threadName,"Rebuild Chunk Thread %d\n",i); rebuildThreads[i] = new C4JThread(rebuildChunkThreadProc,(void *)i,threadName); s_activationEventA[i] = new C4JThread::Event(); diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index 5309e664..d28ed130 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -562,7 +562,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst else { memset(wchName,0,sizeof(WCHAR)*2); - swprintf(wchName, 2, L"%d",player->getPlayerIndex()+1); + swprintf_s(wchName, 2, L"%d",player->getPlayerIndex()+1); playerName=wchName; player->SetPlayerNameValidState(false); } @@ -572,7 +572,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst break; case Player::ePlayerNameValid_False: memset(wchName,0,sizeof(WCHAR)*2); - swprintf(wchName, 2, L"%d",player->getPlayerIndex()+1); + swprintf_s(wchName, 2, L"%d",player->getPlayerIndex()+1); playerName=wchName; break; } diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 5d6fca8f..dd55c083 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1546,9 +1546,10 @@ void Minecraft::run_middle() localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<< MINECRAFT_ACTION_SCREENSHOT; // In flying mode, Shift held = sneak/descend if(g_KBMInput.IsKBMActive() && g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SNEAK)) @@ -3778,6 +3779,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) //options->thirdPersonView = !options->thirdPersonView; } + if (player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_SCREENSHOT)) + RenderManager.DoScreenGrabOnNextPresent(); + if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_GAME_INFO)) { ui.NavigateToScene(iPad,eUIScene_InGameInfoMenu); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 31d830d9..08bbbbb5 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -2000,7 +2000,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) if(!targetFileDir.exists()) targetFileDir.mkdir(); wchar_t filename[128]; - swprintf(filename,128,L"%ls%dx%dx%d.sch",initData->name,(initData->endX - initData->startX + 1), (initData->endY - initData->startY + 1), (initData->endZ - initData->startZ + 1)); + swprintf_s(filename,128,L"%ls%dx%dx%d.sch",initData->name,(initData->endX - initData->startX + 1), (initData->endY - initData->startY + 1), (initData->endZ - initData->startZ + 1)); File dataFile = File( targetFileDir, wstring(filename) ); if(dataFile.exists()) dataFile._delete(); diff --git a/Minecraft.Client/Minimap.cpp b/Minecraft.Client/Minimap.cpp index 1110e7ed..9cb5e7d7 100644 --- a/Minecraft.Client/Minimap.cpp +++ b/Minecraft.Client/Minimap.cpp @@ -246,7 +246,7 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrx); int posy = floor(player->y); int posz = floor(player->z); - swprintf(playerPosText, 32, L"X: %d, Y: %d, Z: %d", posx, posy, posz); + swprintf_s(playerPosText, 32, L"X: %d, Y: %d, Z: %d", posx, posy, posz); font->draw(playerPosText, x, y, Minecraft::GetInstance()->getColourTable()->getColour(eMinecraftColour_Map_Text)); } diff --git a/Minecraft.Client/PlayerConnection.cpp b/Minecraft.Client/PlayerConnection.cpp index eb376e6d..7281a1d6 100644 --- a/Minecraft.Client/PlayerConnection.cpp +++ b/Minecraft.Client/PlayerConnection.cpp @@ -1254,7 +1254,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrgetAuxValue()); + swprintf_s(buf,64,L"map_%d", item->getAuxValue()); std::wstring id = wstring(buf); if( data == nullptr ) { diff --git a/Minecraft.Client/SelectWorldScreen.cpp b/Minecraft.Client/SelectWorldScreen.cpp index c6d417c5..03f037c0 100644 --- a/Minecraft.Client/SelectWorldScreen.cpp +++ b/Minecraft.Client/SelectWorldScreen.cpp @@ -291,7 +291,7 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, int wchar_t buffer[20]; // 4J Stu - Currently shows years as 4 digits, where java only showed 2 - swprintf(buffer,20,L"%d/%d/%d %d:%02d",time.wDay, time.wMonth, time.wYear, time.wHour, time.wMinute); // 4J - TODO Localise this + swprintf_s(buffer,20,L"%d/%d/%d %d:%02d",time.wDay, time.wMonth, time.wYear, time.wHour, time.wMinute); // 4J - TODO Localise this id = id + L" (" + buffer; int64_t size = levelSummary->getSizeOnDisk(); diff --git a/Minecraft.Client/ServerChunkCache.cpp b/Minecraft.Client/ServerChunkCache.cpp index e96e63a2..2bb54353 100644 --- a/Minecraft.Client/ServerChunkCache.cpp +++ b/Minecraft.Client/ServerChunkCache.cpp @@ -808,7 +808,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) if(saveThreads[j] == nullptr) { char threadName[256]; - sprintf(threadName,"Save thread %d\n",j); + sprintf_s(threadName,"Save thread %d\n",j); SetThreadName(threadId[j], threadName); //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index e8b5f588..705173fd 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -30,6 +30,7 @@ public: static const int KEY_CANCEL = VK_ESCAPE; static const int KEY_PAUSE = VK_ESCAPE; static const int KEY_TOGGLE_HUD = VK_F1; + static const int KEY_SCREENSHOT = VK_F2; static const int KEY_DEBUG_INFO = VK_F3; static const int KEY_DEBUG_MENU = VK_F4; static const int KEY_THIRD_PERSON = VK_F5; @@ -37,9 +38,6 @@ public: static const int KEY_HOST_SETTINGS = VK_TAB; static const int KEY_FULLSCREEN = VK_F11; - // todo: implement and shi - static const int KEY_SCREENSHOT = VK_F2; - void Init(); void Tick(); void ClearAllState(); diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index 0694c1bd..1eab99f3 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -143,6 +143,8 @@ typedef XUID GameSessionUID; #include #include +#include +namespace fs = std::filesystem; #ifdef _XBOX #include diff --git a/Minecraft.World/AttributeModifier.cpp b/Minecraft.World/AttributeModifier.cpp index ae8a6aab..14e4ba04 100644 --- a/Minecraft.World/AttributeModifier.cpp +++ b/Minecraft.World/AttributeModifier.cpp @@ -125,11 +125,11 @@ HtmlString AttributeModifier::getHoverText(eATTRIBUTE_ID attribute) wchar_t formatted[256]; if (percentage) { - swprintf(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), static_cast(displayAmount), L"%", app.GetString(Attribute::getName(attribute))); + swprintf_s(formatted, 256, L"%ls%d%ls %ls", (amount > 0 ? L"+" : L"-"), static_cast(displayAmount), L"%", app.GetString(Attribute::getName(attribute))); } else { - swprintf(formatted, 256, L"%ls%.1g %ls", (amount > 0 ? L"+" : L"-"), displayAmount, app.GetString(Attribute::getName(attribute))); + swprintf_s(formatted, 256, L"%ls%.1g %ls", (amount > 0 ? L"+" : L"-"), displayAmount, app.GetString(Attribute::getName(attribute))); } return HtmlString(formatted, color); diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index 05dfd4b3..a2f6fc76 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -525,7 +525,7 @@ int64_t BiomeSource::findSeed(LevelType *generator) srcInfo.Height = 54 * 16; char buf[256]; - sprintf(buf,"GAME:\\BiomeTest%d.bmp",k); + sprintf_s(buf,"GAME:\\BiomeTest%d.bmp",k); RenderManager.SaveTextureData(buf, &srcInfo, (int *)pixels); delete [] pixels; diff --git a/Minecraft.World/ByteArrayTag.h b/Minecraft.World/ByteArrayTag.h index b134c53f..cb5716a9 100644 --- a/Minecraft.World/ByteArrayTag.h +++ b/Minecraft.World/ByteArrayTag.h @@ -33,7 +33,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf, 32, L"[%d bytes]",data.length); + swprintf_s(buf, 32, L"[%d bytes]",data.length); return wstring( buf ); } diff --git a/Minecraft.World/ByteTag.h b/Minecraft.World/ByteTag.h index 372ff131..2455ca89 100644 --- a/Minecraft.World/ByteTag.h +++ b/Minecraft.World/ByteTag.h @@ -15,7 +15,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf,32,L"%d",data); + swprintf_s(buf,32,L"%d",data); return wstring( buf ); } diff --git a/Minecraft.World/C4JThread.cpp b/Minecraft.World/C4JThread.cpp index 322bdaf3..b199ca9a 100644 --- a/Minecraft.World/C4JThread.cpp +++ b/Minecraft.World/C4JThread.cpp @@ -55,7 +55,7 @@ C4JThread::C4JThread( C4JThreadStartFunc* startFunc, void* param, const char* th m_stackSize = 16384; #ifdef __PS3__ - sprintf(m_threadName, "(4J) %s", threadName ); + sprintf_s(m_threadName, "(4J) %s", threadName ); #else sprintf_s(m_threadName,64, "(4J) %s", threadName ); #endif @@ -133,7 +133,7 @@ C4JThread::C4JThread( const char* mainThreadName) m_stackSize = 0; #ifdef __PS3__ - sprintf(m_threadName, "(4J) %s", mainThreadName); + sprintf_s(m_threadName, "(4J) %s", mainThreadName); #else sprintf_s(m_threadName, 64, "(4J) %s", mainThreadName); #endif diff --git a/Minecraft.World/ChunkStorageProfileDecorator.cpp b/Minecraft.World/ChunkStorageProfileDecorator.cpp index 375048db..12ebcd13 100644 --- a/Minecraft.World/ChunkStorageProfileDecorator.cpp +++ b/Minecraft.World/ChunkStorageProfileDecorator.cpp @@ -43,9 +43,9 @@ void ChunkStorageProfilerDecorator::tick() { #ifndef _CONTENT_PACKAGE #ifdef __PSVITA__ - sprintf(buf,"Average load time: %f (%lld)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount); + sprintf_s(buf,"Average load time: %f (%lld)",0.000001 * (double) timeSpentLoading / (double) loadCount, loadCount); #else - sprintf(buf,"Average load time: %f (%I64d)",0.000001 * static_cast(timeSpentLoading) / static_cast(loadCount), loadCount); + sprintf_s(buf,"Average load time: %f (%I64d)",0.000001 * static_cast(timeSpentLoading) / static_cast(loadCount), loadCount); #endif app.DebugPrintf(buf); #endif @@ -54,9 +54,9 @@ void ChunkStorageProfilerDecorator::tick() { #ifndef _CONTENT_PACKAGE #ifdef __PSVITA__ - sprintf(buf,"Average save time: %f (%lld)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); + sprintf_s(buf,"Average save time: %f (%lld)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount); #else - sprintf(buf,"Average save time: %f (%I64d)",0.000001 * static_cast(timeSpentSaving) / static_cast(loadCount), loadCount); + sprintf_s(buf,"Average save time: %f (%I64d)",0.000001 * static_cast(timeSpentSaving) / static_cast(loadCount), loadCount); #endif app.DebugPrintf(buf); #endif diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index c9e2f646..7e3293fa 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -226,7 +226,7 @@ public: { static const int bufSize = 32; static wchar_t buf[bufSize]; - swprintf(buf,bufSize,L"%zu entries",tags.size()); + swprintf_s(buf,bufSize,L"%zu entries",tags.size()); return wstring( buf ); } /* diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index 611d06e9..08feef74 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -980,7 +980,7 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= nullptr* { cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25); } - swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); + swprintf_s(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); #ifdef _UNICODE wstring wtemp = targetFileDir.getPath() + wstring(fileName); diff --git a/Minecraft.World/DoubleTag.h b/Minecraft.World/DoubleTag.h index f122695c..4a367158 100644 --- a/Minecraft.World/DoubleTag.h +++ b/Minecraft.World/DoubleTag.h @@ -16,7 +16,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf,32,L"%f",data); + swprintf_s(buf,32,L"%f",data); return wstring( buf ); } diff --git a/Minecraft.World/Enchantment.cpp b/Minecraft.World/Enchantment.cpp index c2f981a6..a213dd53 100644 --- a/Minecraft.World/Enchantment.cpp +++ b/Minecraft.World/Enchantment.cpp @@ -154,7 +154,7 @@ int Enchantment::getDescriptionId() HtmlString Enchantment::getFullname(int level) { wchar_t formatted[256]; - swprintf(formatted, 256, L"%ls %ls", app.GetString(getDescriptionId()), getLevelString(level).c_str()); + swprintf_s(formatted, 256, L"%ls %ls", app.GetString(getDescriptionId()), getLevelString(level).c_str()); return HtmlString(formatted, eHTMLColor_f); } diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index 11871e42..3ca7e1b4 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -291,7 +291,7 @@ std::vector *File::listFiles() const else if(lpFileName[0] == '/') // already fully qualified path strcpy(filePath, lpFileName ); else - sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); + sprintf_s(filePath,"%s/%s",getUsrDirPath(), lpFileName ); int fd; CellFsErrno err = cellFsOpendir(filePath , &fd); @@ -319,7 +319,7 @@ std::vector *File::listFiles() const else if(lpFileName[0] == '/') // already fully qualified path strcpy(filePath, lpFileName ); else - sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); + sprintf_s(filePath,"%s/%s",getUsrDirPath(), lpFileName ); bool exists = sceFiosDirectoryExistsSync( nullptr, filePath ); if( !exists ) @@ -371,7 +371,7 @@ std::vector *File::listFiles() const #ifdef _UNICODE WCHAR path[MAX_PATH]; - swprintf( path, L"%ls\\*", getPath().c_str() ); + swprintf_s( path, L"%ls\\*", getPath().c_str() ); HANDLE hFind = FindFirstFile( path, &wfd); if(hFind != INVALID_HANDLE_VALUE) { @@ -434,7 +434,7 @@ std::vector *File::listFiles(FileFilter *filter) const else if(lpFileName[0] == '/') // already fully qualified path strcpy(filePath, lpFileName ); else - sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); + sprintf_s(filePath,"%s/%s",getUsrDirPath(), lpFileName ); int fd; CellFsErrno err = cellFsOpendir(filePath, &fd); @@ -463,7 +463,7 @@ std::vector *File::listFiles(FileFilter *filter) const WIN32_FIND_DATA wfd; DWORD dwAttr = FILE_ATTRIBUTE_DIRECTORY; - swprintf( path, L"%ls\\*", getPath().c_str() ); + swprintf_s( path, L"%ls\\*", getPath().c_str() ); HANDLE hFind = FindFirstFile( path, &wfd); if(hFind != INVALID_HANDLE_VALUE) { @@ -484,7 +484,7 @@ std::vector *File::listFiles(FileFilter *filter) const WIN32_FIND_DATA wfd; //DWORD dwAttr = FILE_ATTRIBUTE_DIRECTORY; - sprintf( path, "%s\\*", wstringtofilename( getPath() ) ); + sprintf_s( path, "%s\\*", wstringtofilename( getPath() ) ); HANDLE hFind = FindFirstFile( path, &wfd); if(hFind != INVALID_HANDLE_VALUE) { @@ -536,7 +536,7 @@ int64_t File::length() else if(lpFileName[0] == '/') // already fully qualified path strcpy(filePath, lpFileName ); else - sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); + sprintf_s(filePath,"%s/%s",getUsrDirPath(), lpFileName ); #ifndef _CONTENT_PACKAGE //printf("+++File::length - %s\n",filePath); @@ -572,7 +572,7 @@ int64_t File::length() else if(lpFileName[0] == '/') // already fully qualified path strcpy(filePath, lpFileName ); else - sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); + sprintf_s(filePath,"%s/%s",getUsrDirPath(), lpFileName ); // check if the file exists first SceFiosStat statData; diff --git a/Minecraft.World/FloatTag.h b/Minecraft.World/FloatTag.h index 4aed70bc..4a69d6b8 100644 --- a/Minecraft.World/FloatTag.h +++ b/Minecraft.World/FloatTag.h @@ -16,7 +16,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf, 32, L"%f",data); + swprintf_s(buf, 32, L"%f",data); return wstring( buf ); } diff --git a/Minecraft.World/HangingEntityItem.cpp b/Minecraft.World/HangingEntityItem.cpp index 97ddb31d..f7a8a528 100644 --- a/Minecraft.World/HangingEntityItem.cpp +++ b/Minecraft.World/HangingEntityItem.cpp @@ -103,7 +103,7 @@ void HangingEntityItem::appendHoverText(shared_ptr itemInstance, s wchar_t formatted[256]; ZeroMemory(formatted, 256 * sizeof(wchar_t)); - swprintf(formatted, 256, L"** %ls %dx%d",Painting::Motive::values[motive]->name.c_str(),Painting::Motive::values[motive]->w/16,Painting::Motive::values[motive]->h/16); + swprintf_s(formatted, 256, L"** %ls %dx%d",Painting::Motive::values[motive]->name.c_str(),Painting::Motive::values[motive]->w/16,Painting::Motive::values[motive]->h/16); wstring motiveName = formatted; diff --git a/Minecraft.World/IntArrayTag.h b/Minecraft.World/IntArrayTag.h index 6a4f1113..4a692d22 100644 --- a/Minecraft.World/IntArrayTag.h +++ b/Minecraft.World/IntArrayTag.h @@ -51,7 +51,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf, 32, L"[%d bytes]",data.length); + swprintf_s(buf, 32, L"[%d bytes]",data.length); return wstring( buf ); } diff --git a/Minecraft.World/IntTag.h b/Minecraft.World/IntTag.h index 47d78eba..17a9a0a6 100644 --- a/Minecraft.World/IntTag.h +++ b/Minecraft.World/IntTag.h @@ -15,7 +15,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf, 32, L"%d", data); + swprintf_s(buf, 32, L"%d", data); return wstring( buf ); } diff --git a/Minecraft.World/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index 97128707..07a33d73 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -615,7 +615,7 @@ vector *ItemInstance::getHoverText(shared_ptr player, bool a // if (advanced) // { // wchar_t text [256]; - // swprintf(text, 256, L"Color: LOCALISE #%08X", display->getInt(L"color")); + // swprintf_s(text, 256, L"Color: LOCALISE #%08X", display->getInt(L"color")); // lines->push_back(HtmlString(text)); // } // else diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index d5936ef8..309941a4 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -2885,7 +2885,7 @@ wstring Level::gatherStats() { wchar_t buf[64]; EnterCriticalSection(&m_entitiesCS); - swprintf(buf,64,L"All:%d",entities.size()); + swprintf_s(buf,64,L"All:%d",entities.size()); LeaveCriticalSection(&m_entitiesCS); return wstring(buf); } diff --git a/Minecraft.World/ListTag.h b/Minecraft.World/ListTag.h index de833479..b84326a0 100644 --- a/Minecraft.World/ListTag.h +++ b/Minecraft.World/ListTag.h @@ -46,7 +46,7 @@ public: wstring toString() { static wchar_t buf[64]; - swprintf(buf,64,L"%zu entries of type %ls",list.size(),Tag::getTagName(type)); + swprintf_s(buf,64,L"%zu entries of type %ls",list.size(),Tag::getTagName(type)); return wstring( buf ); } /* diff --git a/Minecraft.World/LongTag.h b/Minecraft.World/LongTag.h index 0da2d074..721214a0 100644 --- a/Minecraft.World/LongTag.h +++ b/Minecraft.World/LongTag.h @@ -15,7 +15,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf,32,L"%I64d",data); + swprintf_s(buf,32,L"%I64d",data); return wstring(buf); } diff --git a/Minecraft.World/MapItem.cpp b/Minecraft.World/MapItem.cpp index b7f521b8..e17a3269 100644 --- a/Minecraft.World/MapItem.cpp +++ b/Minecraft.World/MapItem.cpp @@ -319,7 +319,7 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s itemInstance->setAuxValue(level->getAuxValueForMap(player->getXuid(), player->dimension, centreXC, centreZC, mapScale)); - swprintf(buf,64,L"map_%d", itemInstance->getAuxValue()); + swprintf_s(buf,64,L"map_%d", itemInstance->getAuxValue()); std::wstring id = wstring(buf); shared_ptr data = getSavedData(itemInstance->getAuxValue(), level); diff --git a/Minecraft.World/McRegionChunkStorage.cpp b/Minecraft.World/McRegionChunkStorage.cpp index ad07a66e..994cf83e 100644 --- a/Minecraft.World/McRegionChunkStorage.cpp +++ b/Minecraft.World/McRegionChunkStorage.cpp @@ -122,7 +122,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) if (!chunkData->contains(L"Level")) { char buf[256]; - sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x, z); + sprintf_s(buf,"Chunk file at %d, %d is missing level data, skipping\n",x, z); app.DebugPrintf(buf); delete chunkData; return nullptr; @@ -130,7 +130,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) if (!chunkData->getCompound(L"Level")->contains(L"Blocks")) { char buf[256]; - sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x, z); + sprintf_s(buf,"Chunk file at %d, %d is missing block data, skipping\n",x, z); app.DebugPrintf(buf); delete chunkData; return nullptr; @@ -141,7 +141,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) if (!levelChunk->isAt(x, z)) { char buf[256]; - sprintf(buf,"Chunk file at %d, %d is in the wrong location; relocating. Expected %d, %d, got %d, %d\n", + sprintf_s(buf,"Chunk file at %d, %d is in the wrong location; relocating. Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); app.DebugPrintf(buf); delete levelChunk; @@ -327,7 +327,7 @@ void McRegionChunkStorage::staticCtor() for(unsigned int i = 0; i < 3; ++i) { char threadName[256]; - sprintf(threadName,"McRegion Save thread %d\n",i); + sprintf_s(threadName,"McRegion Save thread %d\n",i); SetThreadName(0, threadName); //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); diff --git a/Minecraft.World/MobEffect.cpp b/Minecraft.World/MobEffect.cpp index 4ded9c41..21d64348 100644 --- a/Minecraft.World/MobEffect.cpp +++ b/Minecraft.World/MobEffect.cpp @@ -302,12 +302,12 @@ wstring MobEffect::formatDuration(MobEffectInstance *instance) if (seconds < 10) { - swprintf(temp, 8, L"%d:0%d",minutes,seconds); + swprintf_s(temp, 8, L"%d:0%d",minutes,seconds); //return minutes + ":0" + seconds; } else { - swprintf(temp, 8, L"%d:%d",minutes,seconds); + swprintf_s(temp, 8, L"%d:%d",minutes,seconds); //return minutes + ":" + seconds; } diff --git a/Minecraft.World/NbtSlotFile.cpp b/Minecraft.World/NbtSlotFile.cpp index 96a27993..33174522 100644 --- a/Minecraft.World/NbtSlotFile.cpp +++ b/Minecraft.World/NbtSlotFile.cpp @@ -168,7 +168,7 @@ void NbtSlotFile::replaceSlot(int slot, vector *tags) wchar_t buf[256]; largest = compressed.length; #ifndef _CONTENT_PACKAGE - swprintf(buf, 256, L"New largest: %I64d (%ls)\n",largest,tag->getString(L"id").c_str() ); + swprintf_s(buf, 256, L"New largest: %I64d (%ls)\n",largest,tag->getString(L"id").c_str() ); OutputDebugStringW(buf); #endif } diff --git a/Minecraft.World/NumberFormaters.h b/Minecraft.World/NumberFormaters.h index 5f641819..3e2fcc7d 100644 --- a/Minecraft.World/NumberFormaters.h +++ b/Minecraft.World/NumberFormaters.h @@ -9,7 +9,7 @@ public: { // TODO 4J Stu - Change the length of the formatted number wchar_t output[256]; - swprintf( output, 256, L"%d", value); + swprintf_s( output, 256, L"%d", value); wstring result = wstring( output ); return result; } @@ -25,7 +25,7 @@ public: { // TODO 4J Stu - Change the length of the formatted number wchar_t output[256]; - swprintf( output, 256, formatString.c_str(), value); + swprintf_s( output, 256, formatString.c_str(), value); wstring result = wstring( output ); return result; } diff --git a/Minecraft.World/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index a3ba13d4..7f12213e 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/OldChunkStorage.cpp @@ -70,11 +70,11 @@ File OldChunkStorage::getFile(int x, int z) #else _itow(x,xRadix36,36); _itow(z,zRadix36,36); - swprintf(name,MAX_PATH_SIZE,L"c.%ls.%ls.dat",xRadix36,zRadix36); + swprintf_s(name,MAX_PATH_SIZE,L"c.%ls.%ls.dat",xRadix36,zRadix36); _itow(x & 63,path1,36); _itow(z & 63,path2,36); #endif - //sprintf(file,"%s\\%s",dir,path1); + //sprintf_s(file,"%s\\%s",dir,path1); File file( dir, wstring( path1 ) ); if( !file.exists() ) { @@ -99,7 +99,7 @@ File OldChunkStorage::getFile(int x, int z) //strcat(file,"\\"); //strcat(file,name); - //sprintf(file,"%s\\%s",file,name); + //sprintf_s(file,"%s\\%s",file,name); file = File( file, wstring( name ) ); if ( !file.exists() ) { @@ -124,14 +124,14 @@ LevelChunk *OldChunkStorage::load(Level *level, int x, int z) if (!tag->contains(L"Level")) { char buf[256]; - sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x,z); + sprintf_s(buf,"Chunk file at %d, %d is missing level data, skipping\n",x,z); app.DebugPrintf(buf); return nullptr; } if (!tag->getCompound(L"Level")->contains(L"Blocks")) { char buf[256]; - sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x,z); + sprintf_s(buf,"Chunk file at %d, %d is missing block data, skipping\n",x,z); app.DebugPrintf(buf); return nullptr; } @@ -139,7 +139,7 @@ LevelChunk *OldChunkStorage::load(Level *level, int x, int z) if (!levelChunk->isAt(x, z)) { char buf[256]; - sprintf(buf,"Chunk fileat %d, %d is in the wrong location; relocating. Expected %d, %d, got %d, %d\n", + sprintf_s(buf,"Chunk fileat %d, %d is in the wrong location; relocating. Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); app.DebugPrintf(buf); tag->putInt(L"xPos", x); @@ -168,7 +168,7 @@ void OldChunkStorage::save(Level *level, LevelChunk *levelChunk) // 4J - removed try/catch // try { //char tmpFileName[MAX_PATH_SIZE]; - //sprintf(tmpFileName,"%s\\%s",dir,"tmp_chunk.dat"); + //sprintf_s(tmpFileName,"%s\\%s",dir,"tmp_chunk.dat"); File tmpFile( dir, L"tmp_chunk.dat" ); // System.out.println("Saving chunk "+levelChunk.x+", "+levelChunk.z); diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 03e361fa..b2bf352e 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -854,7 +854,7 @@ wstring Player::getCapePathFromId(DWORD capeId) if( GET_IS_DLC_SKIN_FROM_BITMASK(capeId) ) { // 4J Stu - DLC skins are numbered using decimal rather than hex to make it easier to number manually - swprintf(chars,256,L"dlccape%08d.png",GET_DLC_SKIN_ID_FROM_BITMASK(capeId)); + swprintf_s(chars,256,L"dlccape%08d.png",GET_DLC_SKIN_ID_FROM_BITMASK(capeId)); } else @@ -863,11 +863,11 @@ wstring Player::getCapePathFromId(DWORD capeId) DWORD defaultCapeIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(capeId); if( ugcCapeIndex == 0 ) { - swprintf(chars,256,L"defcape%08X.png",defaultCapeIndex); + swprintf_s(chars,256,L"defcape%08X.png",defaultCapeIndex); } else { - swprintf(chars,256,L"ugccape%08X.png",ugcCapeIndex); + swprintf_s(chars,256,L"ugccape%08X.png",ugcCapeIndex); } } return chars; diff --git a/Minecraft.World/RecordingItem.cpp b/Minecraft.World/RecordingItem.cpp index 3475263f..c014e1cf 100644 --- a/Minecraft.World/RecordingItem.cpp +++ b/Minecraft.World/RecordingItem.cpp @@ -49,7 +49,7 @@ void RecordingItem::appendHoverText(shared_ptr itemInstance, share eMinecraftColour color = getRarity(shared_ptr())->color; wchar_t text[256]; - swprintf(text, 256, L"%ls %ls", L"C418 -", recording.c_str()); + swprintf_s(text, 256, L"%ls %ls", L"C418 -", recording.c_str()); lines->push_back(HtmlString(text, color)); } diff --git a/Minecraft.World/RegionFileCache.cpp b/Minecraft.World/RegionFileCache.cpp index c7931146..bb066f23 100644 --- a/Minecraft.World/RegionFileCache.cpp +++ b/Minecraft.World/RegionFileCache.cpp @@ -22,7 +22,7 @@ RegionFile *RegionFileCache::_getRegionFile(ConsoleSaveFile *saveFile, const wst { // 4J Jev - changed back to use of the File class. //char file[MAX_PATH_SIZE]; - //sprintf(file,"%s\\region\\r.%d.%d.mcr",basePath,chunkX >> 5,chunkZ >> 5); + //sprintf_s(file,"%s\\region\\r.%d.%d.mcr",basePath,chunkX >> 5,chunkZ >> 5); //File regionDir(basePath, L"region"); diff --git a/Minecraft.World/ShortTag.h b/Minecraft.World/ShortTag.h index e00dfd9c..5fb488f6 100644 --- a/Minecraft.World/ShortTag.h +++ b/Minecraft.World/ShortTag.h @@ -15,7 +15,7 @@ public: wstring toString() { static wchar_t buf[32]; - swprintf(buf,32,L"%d",data); + swprintf_s(buf,32,L"%d",data); return wstring( buf ); } diff --git a/Minecraft.World/SignTileEntity.cpp b/Minecraft.World/SignTileEntity.cpp index b949e429..57c1fbd2 100644 --- a/Minecraft.World/SignTileEntity.cpp +++ b/Minecraft.World/SignTileEntity.cpp @@ -66,7 +66,7 @@ void SignTileEntity::load(CompoundTag *tag) for (int i = 0; i < MAX_SIGN_LINES; i++) { wchar_t buf[16]; - swprintf(buf, 16, L"Text%d", (i+1) ); + swprintf_s(buf, 16, L"Text%d", (i+1) ); m_wsmessages[i] = tag->getString( buf ); if (m_wsmessages[i].length() > MAX_LINE_LENGTH) m_wsmessages[i] = m_wsmessages[i].substr(0, MAX_LINE_LENGTH); } diff --git a/Minecraft.World/ZonedChunkStorage.cpp b/Minecraft.World/ZonedChunkStorage.cpp index 75df6a0c..fd3557f6 100644 --- a/Minecraft.World/ZonedChunkStorage.cpp +++ b/Minecraft.World/ZonedChunkStorage.cpp @@ -161,7 +161,7 @@ void ZonedChunkStorage::tick() for ( int64_t key : toClose ) { char buf[256]; - sprintf(buf,"Closing zone %I64d\n",key); + sprintf_s(buf,"Closing zone %I64d\n",key); app.DebugPrintf(buf); zoneFiles[key]->close(); zoneFiles.erase(zoneFiles.find(key)); diff --git a/cmake/CommonSources.cmake b/cmake/CommonSources.cmake index e6ad7d3d..7b4a7341 100644 --- a/cmake/CommonSources.cmake +++ b/cmake/CommonSources.cmake @@ -1,15 +1,8 @@ -set(_INCLUDE_LCE_FILESYSTEM - "${CMAKE_SOURCE_DIR}/include/lce_filesystem/lce_filesystem.cpp" - "${CMAKE_SOURCE_DIR}/include/lce_filesystem/lce_filesystem.h" -) -source_group("include/lce_filesystem" FILES ${_INCLUDE_LCE_FILESYSTEM}) - set(_INCLUDE_BUILDVER "${CMAKE_SOURCE_DIR}/include/Common/BuildVer.h" ) source_group("Common" FILES ${_INCLUDE_BUILDVER}) set(SOURCES_COMMON - ${_INCLUDE_LCE_FILESYSTEM} ${_INCLUDE_BUILDVER} ) \ No newline at end of file