the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1
2#include "stdafx.h"
3#include "..\Common\Consoles_App.h"
4#include "..\User.h"
5#include "..\..\Minecraft.Client\Minecraft.h"
6#include "..\..\Minecraft.Client\MinecraftServer.h"
7#include "..\..\Minecraft.Client\PlayerList.h"
8#include "..\..\Minecraft.Client\ServerPlayer.h"
9#include "..\..\Minecraft.World\Level.h"
10#include "..\..\Minecraft.World\LevelSettings.h"
11#include "..\..\Minecraft.World\BiomeSource.h"
12#include "..\..\Minecraft.World\LevelType.h"
13#include "..\..\PS3\Network\SonyCommerce_PS3.h"
14#include "..\..\Minecraft.World\StringHelpers.h"
15#include "PS3Extras\ShutdownManager.h"
16#include "PS3\Network\SonyRemoteStorage_PS3.h"
17
18
19
20// #define SAVE_GAME_TO_LOAD L"Saves\\v0170-39728.00.109.56268.00.mcs"
21
22CConsoleMinecraftApp app;
23
24CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp()
25{
26 memset(&m_ThumbnailBuffer,0,sizeof(ImageFileBuffer));
27 memset(&m_SaveImageBuffer,0,sizeof(ImageFileBuffer));
28 memset(&m_ScreenshotBuffer,0,sizeof(ImageFileBuffer));
29
30 memset(&ProductCodes,0,sizeof(PRODUCTCODES));
31
32 m_bVoiceChatAndUGCRestricted=false;
33 m_bDisplayFullVersionPurchase=false;
34// #ifdef _DEBUG_MENUS_ENABLED
35// debugOverlayCreated = false;
36// #endif
37
38 m_ProductListA=NULL;
39 m_bBootedFromDiscPatch=false;
40 memset(m_usrdirPathBDPatch,0,128);
41 m_pRemoteStorage = new SonyRemoteStorage_PS3;
42
43}
44
45void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId)
46{
47 ProfileManager.SetRichPresenceContextValue(iPad,CONTEXT_GAME_STATE,contextId);
48}
49
50char *CConsoleMinecraftApp::GetProductCode()
51{
52 return ProductCodes.chProductCode;
53}
54char *CConsoleMinecraftApp::GetDiscProductCode()
55{
56 return ProductCodes.chDiscProductCode;
57}
58char *CConsoleMinecraftApp::GetSaveFolderPrefix()
59{
60 //4J-PB - need to check if we are the disc version
61 if(StorageManager.GetBootTypeDisc())
62 {
63 return ProductCodes.chDiscSaveFolderPrefix;
64 }
65 else
66 {
67 return ProductCodes.chSaveFolderPrefix;
68 }
69}
70char *CConsoleMinecraftApp::GetCommerceCategory()
71{
72 return ProductCodes.chCommerceCategory;
73}
74char *CConsoleMinecraftApp::GetTexturePacksCategoryID()
75{
76 return ProductCodes.chTexturePackID;
77}
78char *CConsoleMinecraftApp::GetUpgradeKey()
79{
80 return ProductCodes.chUpgradeKey;
81}
82EProductSKU CConsoleMinecraftApp::GetProductSKU()
83{
84 return ProductCodes.eProductSKU;
85}
86bool CConsoleMinecraftApp::IsJapaneseSKU()
87{
88 return ProductCodes.eProductSKU == e_sku_SCEJ;
89
90}
91bool CConsoleMinecraftApp::IsEuropeanSKU()
92{
93 return ProductCodes.eProductSKU == e_sku_SCEE;
94
95}
96bool CConsoleMinecraftApp::IsAmericanSKU()
97{
98 return ProductCodes.eProductSKU == e_sku_SCEA;
99
100}
101// char *CConsoleMinecraftApp::GetSKUPostfix()
102// {
103// return ProductCodes.chSkuPostfix;
104// }
105
106SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle)
107{
108 wstring wstrTemp=convStringToWstring(pchTitle);
109 SONYDLC *pTemp=m_SONYDLCMap.at(wstrTemp);
110
111 return pTemp;
112}
113
114#define WRAPPED_READFILE(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped) {if(ReadFile(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped)==FALSE) { return FALSE;}}
115BOOL CConsoleMinecraftApp::ReadProductCodes()
116{
117 char chDLCTitle[64];
118
119 // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds
120 HANDLE file = CreateFile("PS3/PS3ProductCodes.bin", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
121 if( file == INVALID_HANDLE_VALUE )
122 {
123 //DWORD error = GetLastError();
124 app.DebugPrintf("Failed to open ProductCodes.bin\n");// with error code %d (%x)\n", error, error);
125 return FALSE;
126 }
127
128 DWORD dwHigh=0;
129 DWORD dwFileSize = GetFileSize(file,&dwHigh);
130
131 if(dwFileSize!=0)
132 {
133 DWORD bytesRead;
134
135 WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,NULL);
136 WRAPPED_READFILE(file,ProductCodes.chDiscProductCode,PRODUCT_CODE_SIZE,&bytesRead,NULL);
137 WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL);
138 WRAPPED_READFILE(file,ProductCodes.chDiscSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL);
139 WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,NULL);
140 WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,NULL);
141 WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,NULL);
142 WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,NULL);
143
144 app.DebugPrintf("ProductCodes.chProductCode %s\n",ProductCodes.chProductCode);
145 app.DebugPrintf("ProductCodes.chDiscProductCode %s\n",ProductCodes.chDiscProductCode);
146 app.DebugPrintf("ProductCodes.chSaveFolderPrefix %s\n",ProductCodes.chSaveFolderPrefix);
147 app.DebugPrintf("ProductCodes.chDiscSaveFolderPrefix %s\n",ProductCodes.chDiscSaveFolderPrefix);
148 app.DebugPrintf("ProductCodes.chCommerceCategory %s\n",ProductCodes.chCommerceCategory);
149 app.DebugPrintf("ProductCodes.chTexturePackID %s\n",ProductCodes.chTexturePackID);
150 app.DebugPrintf("ProductCodes.chUpgradeKey %s\n",ProductCodes.chUpgradeKey);
151 app.DebugPrintf("ProductCodes.chSkuPostfix %s\n",ProductCodes.chSkuPostfix);
152
153 // DLC
154 unsigned int uiDLC;
155 WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,NULL);
156
157 for(unsigned int i=0;i<uiDLC;i++)
158 {
159 SONYDLC *pDLCInfo= new SONYDLC;
160 memset(pDLCInfo,0,sizeof(SONYDLC));
161 memset(chDLCTitle,0,64);
162
163 unsigned int uiVal;
164 WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL);
165 WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL);
166
167 WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL);
168 WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL);
169 app.DebugPrintf("DLC title %s\n",chDLCTitle);
170
171 WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL);
172 WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL);
173 WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL);
174
175 // push this into a vector
176
177 wstring wstrTemp=convStringToWstring(chDLCTitle);
178 m_SONYDLCMap[wstrTemp]=pDLCInfo;
179 }
180 CloseHandle(file);
181 }
182
183 if(strcmp(ProductCodes.chProductCode, "NPEB01899") == 0)
184 ProductCodes.eProductSKU = e_sku_SCEE;
185 else if(strcmp(ProductCodes.chProductCode, "NPUB31419") == 0)
186 ProductCodes.eProductSKU = e_sku_SCEA;
187 else if(strcmp(ProductCodes.chProductCode, "NPJB00549") == 0)
188 ProductCodes.eProductSKU = e_sku_SCEJ;
189 else
190 {
191 // unknown product ID
192 assert(0);
193 }
194
195 return TRUE;
196}
197
198
199void CConsoleMinecraftApp::StoreLaunchData()
200{
201}
202void CConsoleMinecraftApp::ExitGame()
203{
204
205}
206void CConsoleMinecraftApp::FatalLoadError()
207{
208 wchar_t *aStrings[3];
209 LPCWSTR wszButtons[1];
210
211 app.DebugPrintf("CConsoleMinecraftApp::FatalLoadError\n");
212
213 // IDS_FATAL_ERROR_TITLE
214 // IDS_FATAL_ERROR_TEXT
215 // IDS_EXIT_GAME
216
217 switch (XGetLanguage())
218 {
219 case XC_LANGUAGE_GERMAN:
220 aStrings[0] = L"Ladefehler";
221 aStrings[1] = L"Minecraft: PlayStation®3 Edition konnte nicht geladen werden und kann daher nicht fortgesetzt werden.";
222 aStrings[2] = L"Spiel verlassen";
223 break;
224 case XC_LANGUAGE_SPANISH:
225 aStrings[0] = L"Error al cargar";
226 aStrings[1] = L"Se ha producido un error al cargar Minecraft: PlayStation®3 Edition y no es posible continuar.";
227 aStrings[2] = L"Salir del juego";
228 break;
229 case XC_LANGUAGE_FRENCH:
230 aStrings[0] = L"Échec du chargement";
231 aStrings[1] = L"Le chargement de Minecraft: PlayStation®3 Edition a échoué : impossible de continuer.";
232 aStrings[2] = L"Quitter le jeu";
233 break;
234 case XC_LANGUAGE_ITALIAN:
235 aStrings[0] = L"Errore caricamento";
236 aStrings[1] = L"Caricamento \"Minecraft: PlayStation®3 Edition\" non riuscito, impossibile continuare.";
237 aStrings[2] = L"Esci dal gioco";
238 break;
239 case XC_LANGUAGE_JAPANESE:
240 aStrings[0] = L"ロード エラー";
241 aStrings[1] = L"Minecraft PlayStation®3 版のロードに失敗しました。続行できません";
242 aStrings[2] = L"ゲームを終了";
243 break;
244 case XC_LANGUAGE_KOREAN:
245 aStrings[0] = L"불러오기 오류";
246 aStrings[1] = L"\"Minecraft: PlayStation®3 Edition\"을 불러오는 중에 오류가 발생하여 계속할 수 없습니다.";
247 aStrings[2] = L"게임 나가기";
248 break;
249 case XC_LANGUAGE_PORTUGUESE:
250 // can only tell if it's brazilian when we've read the productcodes.bin, which might have failed, so stick with Portuguese
251
252 aStrings[0] = L"Erro de Carregamento";
253 aStrings[1] = L"Não foi possível carregar Minecraft: PlayStation®3 Edition e não é possível continuar.";
254 aStrings[2] = L"Sair do Jogo";
255 break;
256 // can only tell if it's brazilian when we've read the productcodes.bin, which might have failed
257/* case XC_LANGUAGE_BRAZILIAN:
258 // Brazilian Portuguese
259 aStrings[0] = L"Erro de carregamento";
260 aStrings[1] = L"\"Minecraft: PlayStation®3 Edition\" falhou ao carregar e não é possível continuar.";
261 aStrings[2] = L"Sair do Jogo";
262 break;*/
263 case XC_LANGUAGE_RUSSIAN:
264 // Brazilian Portuguese
265 aStrings[0] = L"Ошибка при загрузке";
266 aStrings[1] = L"Не удалось загрузить игру \"Minecraft: PlayStation®3 Edition\". Продолжить загрузку невозможно.";
267 aStrings[2] = L"Выйти из игры";
268 break;
269 case XC_LANGUAGE_TCHINESE:
270 aStrings[0] = L"載入錯誤";
271 aStrings[1] = L"無法載入「Minecraft: PlayStation®3 Edition」,因此無法繼續。";
272 aStrings[2] = L"離開遊戲";
273 break;
274
275 // new TU14 languages
276 case XC_LANGUAGE_DUTCH:
277 aStrings[0] = L"Fout tijdens het laden";
278 aStrings[1] = L"Minecraft: PlayStation®3 Edition kan niet worden geladen.";
279 aStrings[2] = L"Game afsluiten";
280 break;
281 case XC_LANGUAGE_FINISH:
282 aStrings[0] = L"Latausvirhe";
283 aStrings[1] = L"\"Minecraft: PlayStation®3 Edition\" -pelin lataaminen ei onnistunut, eikä sitä voi jatkaa.";
284 aStrings[2] = L"Poistu pelistä";
285 break;
286 case XC_LANGUAGE_SWEDISH:
287 aStrings[0] = L"Laddningsfel";
288 aStrings[1] = L"\"Minecraft: PlayStation®3 Edition\" kunde inte laddas och kan inte fortsätta.";
289 aStrings[2] = L"Avsluta";
290 break;
291 case XC_LANGUAGE_DANISH:
292 aStrings[0] = L"Indlæsningsfejl";
293 aStrings[1] = L"\"Minecraft: PlayStation®3 Edition\" kunne ikke blive indlæst og kan derfor ikke fortsætte.";
294 aStrings[2] = L"Afslut spil";
295 break;
296 case XC_LANGUAGE_BNORWEGIAN:
297 aStrings[0] = L"Innlastingsfeil";
298 aStrings[1] = L"Feil under innlasting av Minecraft: PlayStation®3 Edition. Kan ikke fortsette.";
299 aStrings[2] = L"Avslutt spill";
300 break;
301 case XC_LANGUAGE_POLISH:
302 aStrings[0] = L"Błąd wczytywania";
303 aStrings[1] = L"Wystąpił błąd podczas wczytywania Minecraft: Edycja PlayStation®3. Dalsze działanie jest niemożliwe.";
304 aStrings[2] = L"Wyjdź z gry";
305 break;
306 case XC_LANGUAGE_TURKISH:
307 aStrings[0] = L"Yükleme Hatası";
308 aStrings[1] = L"Minecraft: PlayStation®3 Edition yüklenemedi ve devam edemiyor.";
309 aStrings[2] = L"Oyundan Çık";
310 break;
311 case XC_LANGUAGE_LATINAMERICANSPANISH:
312 aStrings[0] = L"Error al cargar";
313 aStrings[1] = L"Se produjo un error al cargar Minecraft: PlayStation®3 Edition y no es posible continuar.";
314 aStrings[2] = L"Salir de la partida";
315 break;
316
317 default:
318 aStrings[0] = L"Loading Error";
319 aStrings[1] = L"\"Minecraft: PlayStation®3 Edition\" has failed to load, and cannot continue.";
320 aStrings[2] = L"Exit Game";
321 break;
322 }
323 wszButtons[0] = aStrings[2];
324
325 //MESSAGEBOX_RESULT MessageResult;
326
327 // convert to utf8
328 uint8_t u8Message[256];
329 size_t srclen,dstlen;
330 srclen=256;
331 dstlen=256;
332 L10nResult lres= UTF16stoUTF8s((uint16_t *)aStrings[1],&srclen,u8Message,&dstlen);
333
334 // 4J-PB - let's have a sleep here, to give any disc eject system message time to come in
335 Sleep(250);
336 // Get the system events if there are any
337 cellSysutilCheckCallback() ;
338
339 if(ShutdownManager::ShouldRun(ShutdownManager::eMainThread)==false)
340 {
341 app.DebugPrintf("Disc Eject received\n");
342 app.DebugPrintf("The Fatal Error message box will possibly fail, so just exit\n");
343 ShutdownManager::MainThreadHandleShutdown();
344 _Exit(0);
345 }
346
347 app.DebugPrintf("Requesting Message Box for Fatal Error\n");
348 EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0);
349
350 while ((eResult==EMsgBox_Busy) || (eResult==EMsgBox_SysUtilBusy))
351 {
352 Sleep(250);
353 // Get the system events if there are any
354 cellSysutilCheckCallback() ;
355 // Check if we should shutdown due to a disc eject
356 if(!ShutdownManager::ShouldRun(ShutdownManager::eMainThread))
357 {
358 ShutdownManager::MainThreadHandleShutdown();
359 _Exit(0);
360 }
361 app.DebugPrintf("Requesting Message Box for Fatal Error again due to BUSY\n");
362 eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0);
363 }
364
365 while(1)
366 {
367 RenderManager.Tick();
368
369 RenderManager.Present();
370 Sleep(250);
371 // Get the system events if there are any
372 cellSysutilCheckCallback() ;
373
374 // Check if we should shutdown due to a disc eject
375 if(!ShutdownManager::ShouldRun(ShutdownManager::eMainThread))
376 {
377 ShutdownManager::MainThreadHandleShutdown();
378 _Exit(0);
379 }
380 }
381}
382
383void CConsoleMinecraftApp::CaptureSaveThumbnail()
384{
385 MemSect(53);
386#ifdef __PS3__
387 RenderManager.CaptureThumbnail(&m_ThumbnailBuffer,&m_SaveImageBuffer);
388#else
389 RenderManager.CaptureThumbnail(&m_ThumbnailBuffer);
390#endif
391 MemSect(0);
392}
393
394void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *ppbThumbnailData,DWORD *pdwThumbnailSize,PBYTE *ppbDataImage,DWORD *pdwSizeImage)
395{
396 // on a save caused by a create world, the thumbnail capture won't have happened
397 if(m_ThumbnailBuffer.Allocated())
398 {
399 if( ppbThumbnailData )
400 {
401 *ppbThumbnailData= new BYTE [m_ThumbnailBuffer.GetBufferSize()];
402 *pdwThumbnailSize=m_ThumbnailBuffer.GetBufferSize();
403 memcpy(*ppbThumbnailData,m_ThumbnailBuffer.GetBufferPointer(),*pdwThumbnailSize);
404 }
405 m_ThumbnailBuffer.Release();
406 }
407 else
408 {
409 if( ppbThumbnailData )
410 {
411 // use the default image
412 StorageManager.GetDefaultSaveThumbnail(ppbThumbnailData,pdwThumbnailSize);
413 }
414 }
415
416 if(m_SaveImageBuffer.Allocated())
417 {
418 if( ppbDataImage )
419 {
420 *ppbDataImage= new BYTE [m_SaveImageBuffer.GetBufferSize()];
421 *pdwSizeImage=m_SaveImageBuffer.GetBufferSize();
422 memcpy(*ppbDataImage,m_SaveImageBuffer.GetBufferPointer(),*pdwSizeImage);
423 }
424 m_SaveImageBuffer.Release();
425 }
426 else
427 {
428 if( ppbDataImage )
429 {
430 // use the default image
431 StorageManager.GetDefaultSaveImage(ppbDataImage,pdwSizeImage);
432 }
433 }
434}
435void CConsoleMinecraftApp::ReleaseSaveThumbnail()
436{
437 if(m_ThumbnailBuffer.Allocated())
438 {
439 m_ThumbnailBuffer.Release();
440 }
441}
442
443void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)
444{
445
446}
447
448int CConsoleMinecraftApp::GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)
449{
450 return -1;
451}
452
453
454int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile)
455{
456 return -1;
457}
458
459int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)
460{
461 return -1;
462}
463
464void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType)
465{
466
467}
468
469LoadSaveDataThreadParam* LoadSaveFromDisk(const wstring& pathName)
470{
471 File saveFile(pathName);
472 __int64 fileSize = saveFile.length();
473 FileInputStream fis(saveFile);
474 byteArray ba(fileSize);
475 fis.read(ba);
476 fis.close();
477
478 LoadSaveDataThreadParam *saveData = new LoadSaveDataThreadParam(ba.data, ba.length, saveFile.getName());
479 return saveData;
480}
481
482void CConsoleMinecraftApp::TemporaryCreateGameStart()
483{
484 ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit
485
486 app.setLevelGenerationOptions(NULL);
487
488 // From CScene_Main::RunPlayGame
489 Minecraft *pMinecraft=Minecraft::GetInstance();
490 app.ReleaseSaveThumbnail();
491 ProfileManager.SetLockedProfile(0);
492 pMinecraft->user->name = L"PS3";
493 app.ApplyGameSettingsChanged(0);
494
495 ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameJoinLoad::OnInit
496 MinecraftServer::resetFlags();
497
498 // From CScene_MultiGameJoinLoad::OnNotifyPressEx
499 app.SetTutorialMode( false );
500 app.SetCorruptSaveDeleted(false);
501
502 ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_MultiGameCreate::CreateGame
503
504 app.ClearTerrainFeaturePosition(); wstring wWorldName = L"TestWorld";
505
506 StorageManager.ResetSaveData();
507 StorageManager.SetSaveTitle(wWorldName.c_str());
508
509 bool isFlat = false;
510 __int64 seedValue = 0;//BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
511// __int64 seedValue = 0xfd97203ebdbf5c6f;
512 unsigned int seedLow = (unsigned int )(seedValue & 0xffffffff);
513 unsigned int seedHigh = (unsigned int )(seedValue>>32);
514#ifndef _CONTENT_PACKAGE
515 printf("----------------------------------------------------------------\n");
516 printf(" Seed value - 0x%08x%08x\n", seedHigh, seedLow);
517 printf("----------------------------------------------------------------\n");
518#endif
519 NetworkGameInitData *param = new NetworkGameInitData();
520 param->seed = seedValue;
521#ifdef SAVE_GAME_TO_LOAD
522 param->saveData = LoadSaveFromDisk(wstring(SAVE_GAME_TO_LOAD));
523#else
524 param->saveData = NULL;
525#endif
526 app.SetGameHostOption(eGameHostOption_Difficulty,0);
527 app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0);
528 app.SetGameHostOption(eGameHostOption_Gamertags,1);
529 app.SetGameHostOption(eGameHostOption_BedrockFog,1);
530
531 app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId());
532 app.SetGameHostOption(eGameHostOption_LevelType, 0 );
533 app.SetGameHostOption(eGameHostOption_Structures, 1 );
534 app.SetGameHostOption(eGameHostOption_BonusChest, 0 );
535
536 app.SetGameHostOption(eGameHostOption_PvP, 1);
537 app.SetGameHostOption(eGameHostOption_TrustPlayers, 1 );
538 app.SetGameHostOption(eGameHostOption_FireSpreads, 1 );
539 app.SetGameHostOption(eGameHostOption_TNT, 1 );
540 app.SetGameHostOption(eGameHostOption_HostCanFly, 1);
541 app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1);
542 app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1 );
543
544 param->settings = app.GetGameHostOption( eGameHostOption_All );
545
546 g_NetworkManager.HostGame(3, true, false, 8, 0);
547
548 LoadingInputParams *loadingParams = new LoadingInputParams();
549 loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
550 loadingParams->lpParam = (LPVOID)param;
551
552 // Reset the autosave time
553 app.SetAutosaveTimerTime();
554
555 C4JThread* thread = new C4JThread(loadingParams->func, loadingParams->lpParam, "RunNetworkGame");
556 thread->Run();
557}
558
559// COMMERCE / DLC
560
561void CConsoleMinecraftApp::CommerceInit()
562{
563 m_bCommerceCategoriesRetrieved=false;
564 m_bCommerceProductListRetrieved=false;
565 m_bCommerceInitialised=false;
566 m_bProductListAdditionalDetailsRetrieved=false;
567 m_pCommerce= new SonyCommerce_PS3;
568 m_eCommerce_State=eCommerce_State_Offline; // can only init when we have a PSN user
569 m_ProductListRetrievedC=0;
570 m_ProductListAdditionalDetailsC=0;
571 m_ProductListCategoriesC=0;
572 m_iCurrentCategory=0;
573 m_iCurrentProduct=0;
574 memset(m_pchSkuID,0,48);
575}
576
577void CConsoleMinecraftApp::CommerceTick()
578{
579 // only tick this if the primary user is signed in to the PSN
580 if(ProfileManager.IsSignedInLive(0))
581 {
582 switch(m_eCommerce_State)
583 {
584 case eCommerce_State_Offline:
585 m_eCommerce_State=eCommerce_State_Init;
586 break;
587 case eCommerce_State_Init:
588 m_eCommerce_State=eCommerce_State_Init_Pending;
589 m_pCommerce->CreateSession(&CConsoleMinecraftApp::CommerceInitCallback, this);
590 break;
591 case eCommerce_State_GetCategories:
592 m_eCommerce_State=eCommerce_State_GetCategories_Pending;
593 // get all categories for this product
594 m_pCommerce->GetCategoryInfo(&CConsoleMinecraftApp::CommerceGetCategoriesCallback, this, &m_CategoryInfo,app.GetCommerceCategory());
595
596 break;
597 case eCommerce_State_GetProductList:
598 {
599 m_eCommerce_State=eCommerce_State_GetProductList_Pending;
600 SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
601 std::list<SonyCommerce::CategoryInfoSub>::iterator iter = pCategories->subCategories.begin();
602
603 for(int i=0;i<m_ProductListRetrievedC;i++)
604 {
605 iter++;
606 }
607 SonyCommerce::CategoryInfoSub category = (SonyCommerce::CategoryInfoSub)(*iter);
608
609 m_pCommerce->GetProductList(&CConsoleMinecraftApp::CommerceGetProductListCallback, this, &m_ProductListA[m_ProductListRetrievedC],category.categoryId);
610 }
611
612 break;
613 case eCommerce_State_AddProductInfoDetailed:
614 {
615 m_eCommerce_State=eCommerce_State_AddProductInfoDetailed_Pending;
616
617 // for each of the products in the categories, get the detailed info. We really only need the long description and price info.
618 SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
619 std::list<SonyCommerce::CategoryInfoSub>::iterator iter = pCategories->subCategories.begin();
620 for(int i=0;i<m_iCurrentCategory;i++)
621 {
622 iter++;
623 }
624
625 SonyCommerce::CategoryInfoSub category = (SonyCommerce::CategoryInfoSub)(*iter);
626 std::vector<SonyCommerce::ProductInfo>*pvProductList=&m_ProductListA[m_iCurrentCategory];
627
628 // 4J-PB - there may be no products in the category
629 if(pvProductList->size()==0)
630 {
631 CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(this,0);
632 }
633 else
634 {
635 assert(pvProductList->size() > m_iCurrentProduct);
636 SonyCommerce::ProductInfo *pProductInfo=&(pvProductList->at(m_iCurrentProduct));
637 m_pCommerce->AddDetailedProductInfo(&CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback, this, pProductInfo,pProductInfo->productId,category.categoryId);
638 }
639 }
640 break;
641 case eCommerce_State_Checkout:
642 m_pCommerce->CreateSession(&CConsoleMinecraftApp::CheckoutSessionStartedCallback, this);
643 m_eCommerce_State=eCommerce_State_Checkout_WaitingForSession;
644 break;
645 case eCommerce_State_Checkout_SessionStarted:
646 m_eCommerce_State=eCommerce_State_Checkout_Pending;
647 m_pCommerce->Checkout(&CConsoleMinecraftApp::CommerceCheckoutCallback, this,m_pchSkuID);
648 break;
649
650 case eCommerce_State_RegisterDLC:
651 {
652 m_eCommerce_State=eCommerce_State_Online;
653 // register the DLC info
654 SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
655 std::list<SonyCommerce::CategoryInfoSub>::iterator iter = pCategories->subCategories.begin();
656 for(int i=0;i<m_iCurrentCategory;i++)
657 {
658 std::vector<SonyCommerce::ProductInfo>*pvProductList=&m_ProductListA[i];
659 for(int j=0;j<pvProductList->size();j++)
660 {
661 SonyCommerce::ProductInfo *pProductInfo=&(pvProductList->at(j));
662 // just want the final 16 characters of the product id
663 RegisterDLCData(&pProductInfo->productId[20],0,pProductInfo->imageUrl);
664 }
665 iter++;
666 }
667 }
668 break;
669
670 case eCommerce_State_DownloadAlreadyPurchased:
671 m_pCommerce->CreateSession(&CConsoleMinecraftApp::DownloadAlreadyPurchasedSessionStartedCallback, this);
672 m_eCommerce_State=eCommerce_State_DownloadAlreadyPurchased_WaitingForSession;
673 break;
674 case eCommerce_State_DownloadAlreadyPurchased_SessionStarted:
675 m_eCommerce_State=eCommerce_State_DownloadAlreadyPurchased_Pending;
676 m_pCommerce->DownloadAlreadyPurchased(&CConsoleMinecraftApp::CommerceCheckoutCallback, this,m_pchSkuID);
677 break;
678
679
680 case eCommerce_State_UpgradeTrial:
681 m_pCommerce->CreateSession(&CConsoleMinecraftApp::UpgradeTrialSessionStartedCallback, this);
682 m_eCommerce_State=eCommerce_State_UpgradeTrial_WaitingForSession;
683 break;
684 case eCommerce_State_UpgradeTrial_SessionStarted:
685 m_pCommerce->UpgradeTrial(&CConsoleMinecraftApp::CommerceCheckoutCallback, this);
686 m_eCommerce_State=eCommerce_State_UpgradeTrial_Pending;
687 break;
688 }
689
690 // 4J-PB - bit of a hack to display the full version purchase after signing in during a trial trophy popup
691 if(m_bDisplayFullVersionPurchase && ((m_eCommerce_State==eCommerce_State_Online) || (m_eCommerce_State==eCommerce_State_Error)))
692 {
693 m_bDisplayFullVersionPurchase=false;
694 ProfileManager.DisplayFullVersionPurchase(false,ProfileManager.GetPrimaryPad(),eSen_UpsellID_Full_Version_Of_Game);
695 }
696 }
697 else
698 {
699 // was the primary player signed in and is now signed out?
700 if(m_eCommerce_State!=eCommerce_State_Offline)
701 {
702 m_eCommerce_State=eCommerce_State_Offline;
703
704 // clear out all the product info
705 ClearCommerceDetails();
706
707 m_pCommerce->CloseSession();
708 }
709 }
710}
711
712bool CConsoleMinecraftApp::GetCommerceCategoriesRetrieved()
713{
714 return m_bCommerceCategoriesRetrieved;
715}
716
717bool CConsoleMinecraftApp::GetCommerceProductListRetrieved()
718{
719 return m_bCommerceProductListRetrieved;
720}
721
722bool CConsoleMinecraftApp::GetCommerceProductListInfoRetrieved()
723{
724 return m_bProductListAdditionalDetailsRetrieved;
725}
726
727SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo()
728{
729 if(m_bCommerceCategoriesRetrieved==false)
730 {
731 return NULL;
732 }
733
734 return &m_CategoryInfo;
735}
736
737void CConsoleMinecraftApp::ClearCommerceDetails()
738{
739 for(int i=0;i<m_ProductListCategoriesC;i++)
740 {
741 std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
742 pProductList->clear();
743 }
744
745 if(m_ProductListA!=NULL)
746 {
747 delete [] m_ProductListA;
748 m_ProductListA=NULL;
749 }
750
751 m_ProductListRetrievedC=0;
752 m_ProductListAdditionalDetailsC=0;
753 m_ProductListCategoriesC=0;
754 m_iCurrentCategory=0;
755 m_iCurrentProduct=0;
756 m_bCommerceCategoriesRetrieved=false;
757 m_bCommerceInitialised=false;
758 m_bCommerceProductListRetrieved=false;
759 m_bProductListAdditionalDetailsRetrieved=false;
760
761 m_CategoryInfo.subCategories.clear();
762
763}
764
765
766void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, char *pchSkuID)
767{
768
769 // find the DLC
770 for(int i=0;i<m_ProductListCategoriesC;i++)
771 {
772 for(int j=0;j<m_ProductListA[i].size();j++)
773 {
774 std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
775 AUTO_VAR(itEnd, pProductList->end());
776
777 for (AUTO_VAR(it, pProductList->begin()); it != itEnd; it++)
778 {
779 SonyCommerce::ProductInfo Info=*it;
780 if(strcmp(pchDLCProductID,Info.productId)==0)
781 {
782 memcpy(pchSkuID,Info.skuId,SCE_NP_COMMERCE2_SKU_ID_LEN);
783 return;
784 }
785 }
786 }
787 }
788 return;
789}
790
791void CConsoleMinecraftApp::Checkout(char *pchSkuID)
792{
793 if(m_eCommerce_State==eCommerce_State_Online)
794 {
795 strcpy(m_pchSkuID,pchSkuID);
796 m_eCommerce_State=eCommerce_State_Checkout;
797 }
798}
799
800void CConsoleMinecraftApp::DownloadAlreadyPurchased(char *pchSkuID)
801{
802 if(m_eCommerce_State==eCommerce_State_Online)
803 {
804 strcpy(m_pchSkuID,pchSkuID);
805 m_eCommerce_State=eCommerce_State_DownloadAlreadyPurchased;
806 }
807}
808
809bool CConsoleMinecraftApp::UpgradeTrial()
810{
811 if(m_eCommerce_State==eCommerce_State_Online)
812 {
813 m_eCommerce_State=eCommerce_State_UpgradeTrial;
814 return true;
815 }
816 else if(m_eCommerce_State==eCommerce_State_Error)
817 {
818 UINT uiIDA[1];
819 uiIDA[0]=IDS_CONFIRM_OK;
820 C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_PRO_UNLOCKGAME_TITLE, IDS_NO_DLCOFFERS, uiIDA,1,ProfileManager.GetPrimaryPad());
821 return true;
822 }
823 else
824 {
825 // commerce is busy
826 return false;
827 }
828}
829
830std::vector<SonyCommerce::ProductInfo>* CConsoleMinecraftApp::GetProductList(int iIndex)
831{
832 if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) )
833 {
834 return NULL;
835 }
836
837 return &m_ProductListA[iIndex];
838}
839
840bool CConsoleMinecraftApp::DLCAlreadyPurchased(char *pchTitle)
841{
842 // find the DLC
843 for(int i=0;i<m_ProductListCategoriesC;i++)
844 {
845 for(int j=0;j<m_ProductListA[i].size();j++)
846 {
847 std::vector<SonyCommerce::ProductInfo>* pProductList=&m_ProductListA[i];
848 AUTO_VAR(itEnd, pProductList->end());
849
850 for (AUTO_VAR(it, pProductList->begin()); it != itEnd; it++)
851 {
852 SonyCommerce::ProductInfo Info=*it;
853 if(strcmp(pchTitle,Info.skuId)==0)
854 {
855 if(Info.purchasabilityFlag==SCE_NP_COMMERCE2_SKU_PURCHASABILITY_FLAG_OFF)
856 {
857 return true;
858 }
859 else
860 {
861 return false;
862 }
863 }
864 }
865 }
866 }
867 return false;
868}
869
870
871
872////////////////////
873// Commerce callbacks
874/////////////////////
875void CConsoleMinecraftApp::CommerceInitCallback(LPVOID lpParam,int err)
876{
877 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
878
879 if(err==0)
880 {
881 pClass->m_eCommerce_State=eCommerce_State_GetCategories;
882 }
883 else
884 {
885 pClass->m_eCommerce_State=eCommerce_State_Error;
886 pClass->m_ProductListCategoriesC=0;
887 pClass->m_bCommerceCategoriesRetrieved=true;
888 }
889}
890
891
892void CConsoleMinecraftApp::CommerceGetCategoriesCallback(LPVOID lpParam,int err)
893{
894 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
895
896 if(err==0)
897 {
898 pClass->m_ProductListCategoriesC=pClass->m_CategoryInfo.countOfSubCategories;
899 // allocate the memory for the product info for each categories
900 if(pClass->m_CategoryInfo.countOfSubCategories>0)
901 {
902 pClass->m_ProductListA = (std::vector<SonyCommerce::ProductInfo> *) new std::vector<SonyCommerce::ProductInfo> [pClass->m_CategoryInfo.countOfSubCategories];
903 pClass->m_eCommerce_State=eCommerce_State_GetProductList;
904 }
905 else
906 {
907 pClass->m_eCommerce_State=eCommerce_State_Online;
908 }
909 }
910 else
911 {
912 pClass->m_ProductListCategoriesC=0;
913 pClass->m_eCommerce_State=eCommerce_State_Error;
914 }
915
916 pClass->m_bCommerceCategoriesRetrieved=true;
917}
918
919void CConsoleMinecraftApp::CommerceGetProductListCallback(LPVOID lpParam,int err)
920{
921 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
922
923 if(err==0)
924 {
925 pClass->m_ProductListRetrievedC++;
926 // if we have more info to get, keep going with the next call
927 if(pClass->m_ProductListRetrievedC==pClass->m_CategoryInfo.countOfSubCategories)
928 {
929 // we're done, so now retrieve the additional product details for each product
930 pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed;
931 pClass->m_bCommerceProductListRetrieved=true;
932 }
933 else
934 {
935 pClass->m_eCommerce_State=eCommerce_State_GetProductList;
936 }
937 }
938 else
939 {
940 pClass->m_eCommerce_State=eCommerce_State_Error;
941 pClass->m_bCommerceProductListRetrieved=true;
942 }
943}
944
945// void CConsoleMinecraftApp::CommerceGetDetailedProductInfoCallback(LPVOID lpParam,int err)
946// {
947// CConsoleMinecraftApp *pScene=(CConsoleMinecraftApp *)lpParam;
948//
949// if(err==0)
950// {
951// pScene->m_eCommerce_State=eCommerce_State_Idle;
952// //pScene->m_bCommerceProductListRetrieved=true;
953// }
954// //printf("Callback hit, error 0x%08x\n", err);
955//
956// }
957
958void CConsoleMinecraftApp::CommerceAddDetailedProductInfoCallback(LPVOID lpParam,int err)
959{
960 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
961
962 if(err==0)
963 {
964 // increment the current product counter. When this gets to the end of the products, move to the next category
965 pClass->m_iCurrentProduct++;
966
967 std::vector<SonyCommerce::ProductInfo>*pvProductList=&pClass->m_ProductListA[pClass->m_iCurrentCategory];
968
969 // if there are no more products in this category, move to the next category (there may be no products in the category)
970 if(pClass->m_iCurrentProduct>=pvProductList->size())
971 {
972 // MGH - change this to a while loop so we can skip empty categories.
973 do
974 {
975 pClass->m_iCurrentCategory++;
976 }while(pClass->m_ProductListA[pClass->m_iCurrentCategory].size() == 0 && pClass->m_iCurrentCategory<pClass->m_ProductListCategoriesC);
977
978 pClass->m_iCurrentProduct=0;
979 if(pClass->m_iCurrentCategory==pClass->m_ProductListCategoriesC)
980 {
981 // there are no more categories, so we're done
982 pClass->m_eCommerce_State=eCommerce_State_RegisterDLC;
983 pClass->m_bProductListAdditionalDetailsRetrieved=true;
984 }
985 else
986 {
987 // continue with the next category
988 pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed;
989 }
990 }
991 else
992 {
993 // continue with the next product
994 pClass->m_eCommerce_State=eCommerce_State_AddProductInfoDetailed;
995 }
996 }
997 else
998 {
999 pClass->m_eCommerce_State=eCommerce_State_Error;
1000 pClass->m_bProductListAdditionalDetailsRetrieved=true;
1001 pClass->m_iCurrentProduct=0;
1002 pClass->m_iCurrentCategory=0;
1003 }
1004}
1005
1006void CConsoleMinecraftApp::CommerceCheckoutCallback(LPVOID lpParam,int err)
1007{
1008 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
1009
1010 if(err==0)
1011 {
1012 }
1013 pClass->m_eCommerce_State=eCommerce_State_Online;
1014}
1015
1016void CConsoleMinecraftApp::CheckoutSessionStartedCallback(LPVOID lpParam,int err)
1017{
1018 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
1019 if(err==0)
1020 pClass->m_eCommerce_State=eCommerce_State_Checkout_SessionStarted;
1021 else
1022 pClass->m_eCommerce_State=eCommerce_State_Error;
1023}
1024
1025void CConsoleMinecraftApp::DownloadAlreadyPurchasedSessionStartedCallback(LPVOID lpParam,int err)
1026{
1027 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
1028 if(err==0)
1029 pClass->m_eCommerce_State=eCommerce_State_DownloadAlreadyPurchased_SessionStarted;
1030 else
1031 pClass->m_eCommerce_State=eCommerce_State_Error;
1032}
1033
1034void CConsoleMinecraftApp::UpgradeTrialSessionStartedCallback(LPVOID lpParam,int err)
1035{
1036 CConsoleMinecraftApp *pClass=(CConsoleMinecraftApp *)lpParam;
1037 if(err==0)
1038 pClass->m_eCommerce_State=eCommerce_State_UpgradeTrial_SessionStarted;
1039 else
1040 pClass->m_eCommerce_State=eCommerce_State_Error;
1041}
1042
1043
1044bool CConsoleMinecraftApp::GetTrialFromName(char *pchDLCName)
1045{
1046 if(pchDLCName[0]=='T')
1047 {
1048 return true;
1049 }
1050
1051 return false;
1052}
1053
1054eDLCContentType CConsoleMinecraftApp::GetDLCTypeFromName(char *pchDLCName)
1055{
1056 char chDLCType[3];
1057
1058 chDLCType[0]=pchDLCName[1];
1059 chDLCType[1]=pchDLCName[2];
1060 chDLCType[2]=0;
1061
1062 app.DebugPrintf(6,"DLC - %s\n",pchDLCName);
1063
1064 if(strcmp(chDLCType,"SP")==0)
1065 {
1066 return e_DLC_SkinPack;
1067 }
1068 else if(strcmp(chDLCType,"GP")==0)
1069 {
1070 return e_DLC_Gamerpics;
1071 }
1072 else if(strcmp(chDLCType,"TH")==0)
1073 {
1074 return e_DLC_Themes;
1075 }
1076 else if(strcmp(chDLCType,"AV")==0)
1077 {
1078 return e_DLC_AvatarItems;
1079 }
1080 else if(strcmp(chDLCType,"MP")==0)
1081 {
1082 return e_DLC_MashupPacks;
1083 }
1084 else if(strcmp(chDLCType,"TP")==0)
1085 {
1086 return e_DLC_TexturePacks;
1087 }
1088 else
1089 {
1090 return e_DLC_NotDefined;
1091 }
1092}
1093
1094int CConsoleMinecraftApp::GetiConfigFromName(char *pchName)
1095{
1096 char pchiConfig[5];
1097 int iStrlen=strlen(pchName);
1098 // last four character of DLC product name are the iConfig value
1099 pchiConfig[0]=pchName[iStrlen-4];
1100 pchiConfig[1]=pchName[iStrlen-3];
1101 pchiConfig[2]=pchName[iStrlen-2];
1102 pchiConfig[3]=pchName[iStrlen-1];
1103 pchiConfig[4]=0;
1104
1105 return atoi(pchiConfig);
1106}
1107
1108int CConsoleMinecraftApp::GetiFirstSkinFromName(char *pchName)
1109{
1110 char pchiFirstSkin[5];
1111 int iStrlen=strlen(pchName);
1112 // last four character of DLC product name are the iConfig value
1113 // four before that are the first skin id
1114 pchiFirstSkin[0]=pchName[iStrlen-8];
1115 pchiFirstSkin[1]=pchName[iStrlen-7];
1116 pchiFirstSkin[2]=pchName[iStrlen-6];
1117 pchiFirstSkin[3]=pchName[iStrlen-5];
1118 pchiFirstSkin[4]=0;
1119
1120 return atoi(pchiFirstSkin);
1121}
1122
1123// void CConsoleMinecraftApp::SetVoiceChatAndUGCRestricted(bool bRestricted)
1124//{
1125// m_bVoiceChatAndUGCRestricted=bRestricted;
1126//}
1127
1128// bool CConsoleMinecraftApp::GetVoiceChatAndUGCRestricted(void)
1129//{
1130// return m_bVoiceChatAndUGCRestricted;
1131//}
1132
1133
1134int CConsoleMinecraftApp::GetCommerceState()
1135{
1136 return m_eCommerce_State;
1137}
1138
1139void CConsoleMinecraftApp::SetBootedFromDiscPatch()
1140{
1141 m_bBootedFromDiscPatch=true;
1142}
1143bool CConsoleMinecraftApp::GetBootedFromDiscPatch()
1144{
1145 return m_bBootedFromDiscPatch;
1146}
1147
1148void CConsoleMinecraftApp::SetDiscPatchUsrDir(char *chPatchDir)
1149{
1150 strcpy(m_usrdirPathBDPatch,chPatchDir);
1151}
1152char * CConsoleMinecraftApp::GetDiscPatchUsrDir()
1153{
1154 return m_usrdirPathBDPatch;
1155}
1156
1157char *PatchFilelist[] =
1158{
1159 "PS3/PS3ProductCodes.bin",
1160 "Common/Media/MediaPS3.arc",
1161 // patch 7
1162 "PS3/Sound/Minecraft.msscmp",
1163 "font/Default.png",
1164// "font/Mojangles_7.png",
1165// "font/Mojangles_11.png",
1166// "/TitleUpdate/res/font/Default.png",
1167 "/TitleUpdate/res/font/Mojangles_7.png",
1168 "/TitleUpdate/res/font/Mojangles_11.png",
1169
1170 "music/music/creative1.binka",
1171 "music/music/creative2.binka",
1172 "music/music/creative3.binka",
1173 "music/music/creative4.binka",
1174 "music/music/creative5.binka",
1175 "music/music/creative6.binka",
1176 "music/music/menu1.binka",
1177 "music/music/menu2.binka",
1178 "music/music/menu3.binka",
1179 "music/music/menu4.binka",
1180
1181
1182
1183
1184 NULL
1185};
1186
1187bool CConsoleMinecraftApp::IsFileInPatchList(LPCSTR lpFileName)
1188{
1189 int i = 0;
1190 app.DebugPrintf("*** CConsoleMinecraftApp::IsFileInPatchList\n");
1191 while(PatchFilelist[i])
1192 {
1193#ifndef _CONTENT_PACKAGE
1194 app.DebugPrintf("*** Patch file? Comparing %s to %s\n",lpFileName,PatchFilelist[i]);
1195#endif
1196 if(strcmp(lpFileName,PatchFilelist[i])==0)
1197 {
1198 return true;
1199 }
1200 i++;
1201 }
1202 return false;
1203}
1204
1205char * CConsoleMinecraftApp::GetBDUsrDirPath(const char *pchFilename)
1206{
1207 char *pchUsrDir;
1208
1209 DebugPrintf("*** CConsoleMinecraftApp::GetBDUsrDirPath - check %s\n",pchFilename);
1210
1211 if(IsFileInPatchList(pchFilename))
1212 {
1213 // does this file need to be loaded from the patch directory?
1214 DebugPrintf("*** BufferedImage::BufferedImage - Found a patched file %s\n",pchFilename);
1215
1216 return GetDiscPatchUsrDir();
1217 }
1218 else
1219 {
1220 return getUsrDirPath();
1221 }
1222}
1223
1224bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad)
1225{
1226 SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo();
1227
1228 bool bEmptyStore=true;
1229 if(pCategories!=NULL)
1230 {
1231 if(pCategories->countOfProducts>0)
1232 {
1233 bEmptyStore=false;
1234 }
1235 else
1236 {
1237 for(int i=0;i<pCategories->countOfSubCategories;i++)
1238 {
1239 std::vector<SonyCommerce::ProductInfo>*pvProductInfo=app.GetProductList(i);
1240 if(pvProductInfo->size()>0)
1241 {
1242 bEmptyStore=false;
1243 break;
1244 }
1245 }
1246 }
1247 }
1248
1249 if(bEmptyStore)
1250 {
1251 UINT uiIDA[1];
1252 uiIDA[0]=IDS_CONFIRM_OK;
1253 C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_DOWNLOADABLE_CONTENT_OFFERS, IDS_NO_DLCOFFERS, uiIDA,1,iPad);
1254 }
1255
1256 return bEmptyStore;
1257}