Guest User

Untitled

a guest
Jun 20th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.73 KB | None | 0 0
  1. #include <gccore.h>
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <dirent.h>
  7.  
  8.  
  9. #include "gameinfo.h"
  10.  
  11. #include "menu.h"
  12. #include "filelist.h"
  13. #include "sys.h"
  14. #include "wpad.h"
  15. #include "wbfs.h"
  16. #include "language.h"
  17. #include "libwiigui/gui.h"
  18. #include "fatmounter.h"
  19. #include "listfiles.h"
  20.  
  21. #include "xml.h"
  22.  
  23. /*** Extern variables ***/
  24. extern GuiWindow * mainWindow;
  25. extern GuiSound * bgMusic;
  26. extern u8 shutdown;
  27. extern u8 reset;
  28.  
  29. /*** Extern functions ***/
  30. extern void ResumeGui();
  31. extern void HaltGui();
  32.  
  33.  
  34. /****************************************************************************
  35. * gameinfo
  36. ***************************************************************************/
  37. int
  38. showGameInfo(char *ID, u8 *headerID)
  39. {
  40. u8 nodata=1;
  41. //load the xml shit
  42. char pathname[100];
  43. snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
  44. bool fileexists = OpenXMLFile(pathname);
  45. if(!fileexists) {
  46. snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml");
  47. fileexists = OpenXMLFile(pathname);
  48. }
  49. if(fileexists) {
  50. snprintf(pathname, sizeof(pathname), "English");
  51. LoadTitlesFromXML(pathname, false); // options can be added to set force title language to any language and force Japanese title to English
  52.  
  53. int choice = -1;
  54. //int i = 0;
  55. int y = 0, y1 = 32;
  56. int intputX =200, inputY=-30, txtXOffset = 90;
  57. u8 nunchuk=0,
  58. classiccontroller=0,
  59. balanceboard=0,
  60. dancepad=0,
  61. guitar=0,
  62. gamecube=0,
  63. wheel=0,
  64. motionplus=0,
  65. drums=0,
  66. microphone=0;
  67. int newline=1;
  68. u8 page =1;
  69.  
  70. // GuiText * debugTxt = NULL;
  71.  
  72. GuiImageData * playersImgData = NULL;
  73. GuiImage * playersImg = NULL;
  74.  
  75. GuiImageData * wifiplayersImgData = NULL;
  76. GuiImage * wifiplayersImg = NULL;
  77. GuiImage * ratingImg = NULL;
  78.  
  79. GuiImage * classiccontrollerImg = NULL;
  80. GuiImage * nunchuckImg = NULL;
  81. GuiImage * guitarImg = NULL;
  82. GuiImage * drumsImg = NULL;
  83. GuiImage * dancepadImg = NULL;
  84. GuiImage * motionplusImg = NULL;
  85. GuiImage * wheelImg = NULL;
  86. GuiImage * balanceboardImg = NULL;
  87. GuiImage * microphoneImg = NULL;
  88. GuiImage * gcImg = NULL;
  89. GuiImage * dialogBoxImg1 = NULL;
  90. GuiImage * dialogBoxImg2 = NULL;
  91. GuiImage * dialogBoxImg3 = NULL;
  92. GuiImage * dialogBoxImg4 = NULL;
  93. GuiImage * dialogBoxImg11 = NULL;
  94. GuiImage * dialogBoxImg22 = NULL;
  95. GuiImage * dialogBoxImg33 = NULL;
  96. GuiImage * dialogBoxImg44 = NULL;
  97. GuiImage * coverImg = NULL;
  98. GuiImage * coverImg2 = NULL;
  99.  
  100. GuiImageData * classiccontrollerImgData = NULL;
  101. GuiImageData * nunchuckImgData = NULL;
  102. GuiImageData * guitarImgData = NULL;
  103. GuiImageData * drumsImgData = NULL;
  104. GuiImageData * motionplusImgData = NULL;
  105. GuiImageData * wheelImgData = NULL;
  106. GuiImageData * balanceboardImgData = NULL;
  107. GuiImageData * dancepadImgData = NULL;
  108. GuiImageData * microphoneImgData = NULL;
  109. GuiImageData * gamecubeImgData = NULL;
  110. GuiImageData * ratingImgData = NULL;
  111. GuiImageData * cover = NULL;
  112.  
  113. GuiText * releasedTxt = NULL;
  114. GuiText * publisherTxt = NULL;
  115. GuiText * developerTxt = NULL;
  116. GuiText * titleTxt = NULL;
  117. GuiText * synopsisTxt = NULL;
  118. GuiText * genreTxt = NULL;
  119. GuiText * betaTxt = NULL;
  120. GuiText * beta1Txt = NULL;
  121.  
  122. GuiWindow gameinfoWindow(600,308);
  123. gameinfoWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
  124. gameinfoWindow.SetPosition(0, -50);
  125.  
  126. GuiWindow gameinfoWindow2(600,308);
  127. gameinfoWindow2.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
  128. gameinfoWindow2.SetPosition(0, -50);
  129.  
  130. GuiWindow txtWindow(350,270);
  131. txtWindow.SetAlignment(ALIGN_CENTRE, ALIGN_RIGHT);
  132. txtWindow.SetPosition(85, 50);
  133.  
  134.  
  135. GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
  136. GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
  137. char imgPath[50];
  138. snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
  139. GuiImageData btnOutline(imgPath, button_dialogue_box_png);
  140. snprintf(imgPath, sizeof(imgPath), "%sgameinfo1_png.png", CFG.theme_path);
  141. GuiImageData dialogBox1(imgPath, gameinfo1_png);
  142. snprintf(imgPath, sizeof(imgPath), "%sgameinfo1a_png.png", CFG.theme_path);
  143. GuiImageData dialogBox2(imgPath, gameinfo1a_png);
  144. snprintf(imgPath, sizeof(imgPath), "%sgameinfo2_png.png", CFG.theme_path);
  145. GuiImageData dialogBox3(imgPath, gameinfo2_png);
  146. snprintf(imgPath, sizeof(imgPath), "%sgameinfo2a_png.png", CFG.theme_path);
  147. GuiImageData dialogBox4(imgPath, gameinfo2a_png);
  148.  
  149. GuiTrigger trigA;
  150. trigA.SetButtonOnlyTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
  151. GuiTrigger trigB;
  152. trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
  153.  
  154.  
  155. GuiButton backBtn(0,0);
  156. backBtn.SetPosition(-20,-20);
  157. backBtn.SetTrigger(&trigB);
  158. gameinfoWindow.Append(&backBtn);
  159.  
  160. GuiButton nextBtn(0,0);
  161. nextBtn.SetPosition(20,20);
  162. nextBtn.SetTrigger(&trigA);
  163. gameinfoWindow.Append(&nextBtn);
  164.  
  165. /*struct Game_CFG *game_cfg = NULL;
  166. int opt_lang;
  167. char langtexttmp[11][22] =
  168. {{"Console Default"},
  169. {"Japanese"},
  170. {"English"},
  171. {"German"},
  172. {"French"},
  173. {"Spanish"},
  174. {"Italian"},
  175. {"Dutch"},
  176. {"S. Chinese"},
  177. {"T. Chinese"},
  178. {"Korean"}};
  179. game_cfg = CFG_get_game_opt(headerID);
  180. if (game_cfg) {
  181. opt_lang = game_cfg->language;
  182. } else {
  183. opt_lang = Settings.language;
  184. }*/
  185. if (LoadGameInfoFromXML(ID,pathname))nodata=0;
  186. //LoadGameInfoFromXML(ID,langtexttmp[opt_lang]);
  187. char linebuf[1000] = "";
  188. char linebuf2[100] = "";
  189.  
  190. // set images for required input
  191. for (int i=0;strcmp(gameinfo.accessories_required[i+1],"") != 0;i++)
  192. {
  193. if (strcmp(gameinfo.accessories_required[i+1],"nunchuk")==0)
  194. {nunchuckImgData = new GuiImageData(nunchuckR_png);nunchuk=1;}
  195. else
  196. nunchuckImgData = new GuiImageData(nunchuck_png);
  197.  
  198. if (strcmp(gameinfo.accessories_required[i+1],"classiccontroller")==0)
  199. {classiccontrollerImgData = new GuiImageData(classiccontrollerR_png);classiccontroller=1;}
  200. else
  201. classiccontrollerImgData = new GuiImageData(classiccontroller_png);
  202.  
  203. if (strcmp(gameinfo.accessories_required[i+1],"guitar")==0)
  204. {guitarImgData = new GuiImageData(guitarR_png);guitar=1;}
  205. else
  206. guitarImgData = new GuiImageData(guitar_png);
  207.  
  208. if (strcmp(gameinfo.accessories_required[i+1],"gamecube")==0)
  209. {gamecubeImgData = new GuiImageData(gcncontrollerR_png);gamecube=1;}
  210. else
  211. gamecubeImgData = new GuiImageData(gcncontroller_png);
  212.  
  213. if (strcmp(gameinfo.accessories_required[i+1],"wheel")==0)
  214. {wheelImgData = new GuiImageData(wheelR_png);wheel=1;}
  215. else
  216. wheelImgData = new GuiImageData(wheel_png);
  217.  
  218. if (strcmp(gameinfo.accessories_required[i+1],"motionplus")==0)
  219. {motionplusImgData = new GuiImageData(motionplusR_png);motionplus=1;}
  220. else
  221. motionplusImgData = new GuiImageData(motionplus_png);
  222.  
  223. if (strcmp(gameinfo.accessories_required[i+1],"drums")==0)
  224. {drumsImgData = new GuiImageData(drumsR_png);drums=1;}
  225. else
  226. drumsImgData = new GuiImageData(drums_png);
  227.  
  228. if (strcmp(gameinfo.accessories_required[i+1],"microphone")==0)
  229. {microphoneImgData = new GuiImageData(microphoneR_png);microphone=1;}
  230. else
  231. microphoneImgData = new GuiImageData(microphone_png);
  232.  
  233. if (strcmp(gameinfo.accessories_required[i+1],"balanceboard")==0)
  234. {balanceboardImgData = new GuiImageData(balanceboardR_png);balanceboard=1;}
  235. else
  236. balanceboardImgData = new GuiImageData(balanceboard_png);
  237.  
  238. if (strcmp(gameinfo.accessories_required[i+1],"dancepad")==0)
  239. {dancepadImgData = new GuiImageData(dancepadR_png);dancepad=1;}
  240. else
  241. dancepadImgData = new GuiImageData(dancepad_png);
  242.  
  243. }
  244. for (int i=0;strcmp(gameinfo.accessories[i+1],"") != 0;i++)
  245. {
  246.  
  247. if (strcmp(gameinfo.accessories_required[i],"classiccontroller")==0)
  248. classiccontroller=1;
  249.  
  250. if (strcmp(gameinfo.accessories[i+1],"nunchuk")==0)
  251. {nunchuk=1;}
  252.  
  253. if (strcmp(gameinfo.accessories[i+1],"guitar")==0)
  254. guitar=1;
  255.  
  256. if (strcmp(gameinfo.accessories_required[i],"drums")==0)
  257. drums=1;
  258.  
  259. if (strcmp(gameinfo.accessories_required[i],"dancepad")==0)
  260. dancepad=1;
  261.  
  262. if (strcmp(gameinfo.accessories_required[i],"motionplus")==0)
  263. motionplus=1;
  264.  
  265. if (strcmp(gameinfo.accessories_required[i],"wheel")==0)
  266. wheel=1;
  267.  
  268. if (strcmp(gameinfo.accessories_required[i],"balanceboard")==0)
  269. balanceboard=1;
  270.  
  271. if (strcmp(gameinfo.accessories_required[i],"microphone")==0)
  272. microphone=1;
  273.  
  274. if (strcmp(gameinfo.accessories_required[i],"gamecube")==0)
  275. gamecube=1;
  276. }
  277.  
  278.  
  279.  
  280.  
  281. dialogBoxImg1 = new GuiImage(&dialogBox1);
  282. dialogBoxImg1->SetAlignment(0,3);
  283. dialogBoxImg1->SetPosition(-9,0);
  284.  
  285. dialogBoxImg2 = new GuiImage(&dialogBox2);
  286. dialogBoxImg2->SetAlignment(0,3);
  287. dialogBoxImg2->SetPosition(145,0);
  288.  
  289. dialogBoxImg3 = new GuiImage(&dialogBox3);
  290. dialogBoxImg3->SetAlignment(0,3);
  291. dialogBoxImg3->SetPosition(301,0);
  292.  
  293. dialogBoxImg4 = new GuiImage(&dialogBox4);
  294. dialogBoxImg4->SetAlignment(0,3);
  295. dialogBoxImg4->SetPosition(457,0);
  296.  
  297.  
  298. gameinfoWindow.Append(dialogBoxImg1);
  299. gameinfoWindow.Append(dialogBoxImg2);
  300. gameinfoWindow.Append(dialogBoxImg3);
  301. gameinfoWindow.Append(dialogBoxImg4);
  302.  
  303. snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
  304. cover = new GuiImageData(imgPath, 0); //load full id image
  305. if (!cover->GetImage())
  306. {
  307. delete cover;
  308. snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path);
  309. cover = new GuiImageData(imgPath, nocover_png); //load no image
  310. }
  311. delete coverImg;
  312. coverImg = NULL;
  313.  
  314. coverImg = new GuiImage(cover);
  315. coverImg->SetWidescreen(CFG.widescreen);
  316. coverImg->SetPosition(15,30);
  317. gameinfoWindow.Append(coverImg);
  318.  
  319. // # of players
  320. if (strcmp(gameinfo.players,"") != 0) {
  321. playersImgData = new GuiImageData(Wiimote1_png);
  322. if (atoi(gameinfo.players)>1){
  323. playersImgData= new GuiImageData(Wiimote2_png);}
  324. if (atoi(gameinfo.players)>2){
  325. playersImgData= new GuiImageData(Wiimote4_png);}
  326.  
  327. playersImg = new GuiImage(playersImgData);
  328. playersImg->SetWidescreen(CFG.widescreen);
  329. playersImg->SetPosition(intputX , inputY);
  330. playersImg->SetAlignment(0,4);
  331. gameinfoWindow.Append(playersImg);
  332. intputX += (CFG.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth())+5;
  333. }
  334.  
  335. //draw the inupt types for this game
  336. if (nunchuk==1){
  337. nunchuckImg = new GuiImage(nunchuckImgData);
  338. nunchuckImg->SetWidescreen(CFG.widescreen);
  339. nunchuckImg->SetPosition(intputX , inputY);
  340. nunchuckImg->SetAlignment(0,4);
  341. gameinfoWindow.Append(nunchuckImg);
  342. intputX += (CFG.widescreen ? nunchuckImg->GetWidth() * .8 : nunchuckImg->GetWidth())+5;}
  343.  
  344. if (classiccontroller==1){
  345. classiccontrollerImg = new GuiImage(classiccontrollerImgData);
  346. classiccontrollerImg->SetWidescreen(CFG.widescreen);
  347. classiccontrollerImg->SetPosition(intputX , inputY);
  348. classiccontrollerImg->SetAlignment(0,4);
  349. gameinfoWindow.Append(classiccontrollerImg);
  350. intputX += (CFG.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth())+5;}
  351.  
  352. if (gamecube==1){
  353. gcImg = new GuiImage(gamecubeImgData);
  354. gcImg->SetWidescreen(CFG.widescreen);
  355. gcImg->SetPosition(intputX , inputY);
  356. gcImg->SetAlignment(0,4);
  357. gameinfoWindow.Append(gcImg);
  358. intputX += (CFG.widescreen ? gcImg->GetWidth() * .8 : gcImg->GetWidth())+5;}
  359.  
  360. if (wheel==1){
  361. wheelImg = new GuiImage(wheelImgData);
  362. wheelImg->SetWidescreen(CFG.widescreen);
  363. wheelImg->SetPosition(intputX , inputY);
  364. wheelImg->SetAlignment(0,4);
  365. gameinfoWindow.Append(wheelImg);
  366. intputX += (CFG.widescreen ? wheelImg->GetWidth() * .8 : wheelImg->GetWidth())+5;}
  367.  
  368. if (guitar==1){
  369. guitarImg = new GuiImage(guitarImgData);
  370. guitarImg->SetWidescreen(CFG.widescreen);
  371. guitarImg->SetPosition(intputX , inputY);
  372. guitarImg->SetAlignment(0,4);
  373. gameinfoWindow.Append(guitarImg);
  374. intputX += (CFG.widescreen ? guitarImg->GetWidth() * .8 : guitarImg->GetWidth())+5;}
  375.  
  376. if (drums==1){
  377. drumsImg = new GuiImage(drumsImgData);
  378. drumsImg->SetWidescreen(CFG.widescreen);
  379. drumsImg->SetPosition(intputX , inputY);
  380. drumsImg->SetAlignment(0,4);
  381. gameinfoWindow.Append(drumsImg);
  382. intputX += (CFG.widescreen ? drumsImg->GetWidth() * .8 : drumsImg->GetWidth())+5;}
  383.  
  384. if (microphone==1){
  385. microphoneImg = new GuiImage(microphoneImgData);
  386. microphoneImg->SetWidescreen(CFG.widescreen);
  387. microphoneImg->SetPosition(intputX , inputY);
  388. microphoneImg->SetAlignment(0,4);
  389. gameinfoWindow.Append(microphoneImg);
  390. intputX += (CFG.widescreen ? microphoneImg->GetWidth() * .8 : microphoneImg->GetWidth())+5;}
  391.  
  392. if (dancepad==1){
  393. dancepadImg = new GuiImage(dancepadImgData);
  394. dancepadImg->SetWidescreen(CFG.widescreen);
  395. dancepadImg->SetPosition(intputX , inputY);
  396. dancepadImg->SetAlignment(0,4);
  397. gameinfoWindow.Append(dancepadImg);
  398. intputX += (CFG.widescreen ? dancepadImg->GetWidth() * .8 : dancepadImg->GetWidth())+5;}
  399.  
  400. if (motionplus==1){
  401. motionplusImg = new GuiImage(motionplusImgData);
  402. motionplusImg->SetWidescreen(CFG.widescreen);
  403. motionplusImg->SetPosition(intputX , inputY);
  404. motionplusImg->SetAlignment(0,4);
  405. gameinfoWindow.Append(motionplusImg);
  406. intputX += (CFG.widescreen ? motionplusImg->GetWidth() * .8 : motionplusImg->GetWidth())+5;}
  407.  
  408.  
  409.  
  410.  
  411. // # online players
  412. if ((strcmp(gameinfo.wifiplayers,"") != 0) && (strcmp(gameinfo.wifiplayers,"0") != 0)){
  413. wifiplayersImgData = new GuiImageData(wifi1_png);
  414. if (atoi(gameinfo.wifiplayers)>1){
  415. wifiplayersImgData= new GuiImageData(wifi2_png);}
  416. if (atoi(gameinfo.wifiplayers)>2){
  417. wifiplayersImgData= new GuiImageData(wifi4_png);}
  418. if (atoi(gameinfo.wifiplayers)>4){
  419. wifiplayersImgData= new GuiImageData(wifi8_png);}
  420. wifiplayersImg = new GuiImage(wifiplayersImgData);
  421. wifiplayersImg->SetWidescreen(CFG.widescreen);
  422. wifiplayersImg->SetPosition(intputX , inputY);
  423. wifiplayersImg->SetAlignment(0,4);
  424. gameinfoWindow.Append(wifiplayersImg);
  425. intputX += (CFG.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth())+5;
  426. }
  427.  
  428. // ratings
  429. if (strcmp(gameinfo.ratingtype,"") !=0){
  430. if (strcmp(gameinfo.ratingtype,"ESRB")==0) {
  431. if (strcmp(gameinfo.ratingvalueESRB,"EC")==0)
  432. ratingImgData = new GuiImageData(esrb_ec_png);
  433. else if (strcmp(gameinfo.ratingvalueESRB,"E")==0)
  434. ratingImgData = new GuiImageData(esrb_e_png);
  435. else if (strcmp(gameinfo.ratingvalueESRB,"E10+")==0)
  436. ratingImgData = new GuiImageData(esrb_eten_png);
  437. else if (strcmp(gameinfo.ratingvalueESRB,"T")==0)
  438. ratingImgData = new GuiImageData(esrb_t_png);
  439. else if (strcmp(gameinfo.ratingvalueESRB,"M")==0)
  440. ratingImgData = new GuiImageData(esrb_m_png);
  441. else if (strcmp(gameinfo.ratingvalueESRB,"AO")==0)
  442. ratingImgData = new GuiImageData(esrb_ao_png);
  443. else {ratingImgData = new GuiImageData(norating_png);}
  444. } //there are 2 values here cause some countries are stupid and
  445. else if (strcmp(gameinfo.ratingtype,"PEGI")==0) {//can't use the same as everybody else
  446. if ((strcmp(gameinfo.ratingvaluePEGI,"3")==0)||(strcmp(gameinfo.ratingvaluePEGI,"4")==0))
  447. ratingImgData = new GuiImageData(pegi_3_png);
  448. else if ((strcmp(gameinfo.ratingvaluePEGI,"7")==0)||(strcmp(gameinfo.ratingvaluePEGI,"7")==0))
  449. ratingImgData = new GuiImageData(pegi_7_png);
  450. else if (strcmp(gameinfo.ratingvaluePEGI,"12")==0)
  451. ratingImgData = new GuiImageData(pegi_12_png);
  452. else if ((strcmp(gameinfo.ratingvaluePEGI,"16")==0)||(strcmp(gameinfo.ratingvaluePEGI,"15")==0))
  453. ratingImgData = new GuiImageData(pegi_16_png);
  454. else if (strcmp(gameinfo.ratingvaluePEGI,"18")==0)
  455. ratingImgData = new GuiImageData(pegi_18_png);
  456. else {ratingImgData = new GuiImageData(norating_png);}
  457. }
  458.  
  459. else if (strcmp(gameinfo.ratingtype,"CERO")==0) {
  460. if (strcmp(gameinfo.ratingvalueCERO,"A")==0)
  461. ratingImgData = new GuiImageData(cero_a_png);
  462. //ratingImgData = new GuiImageData(cero_b_png);
  463. else if (strcmp(gameinfo.ratingvalueCERO,"B")==0)
  464. ratingImgData = new GuiImageData(cero_b_png);
  465. else if (strcmp(gameinfo.ratingvalueCERO,"C")==0)
  466. ratingImgData = new GuiImageData(cero_c_png);
  467. else if (strcmp(gameinfo.ratingvalueCERO,"D")==0)
  468. ratingImgData = new GuiImageData(cero_d_png);
  469. else if (strcmp(gameinfo.ratingvalueCERO,"Z")==0)
  470. ratingImgData = new GuiImageData(cero_z_png);
  471. else {ratingImgData = new GuiImageData(norating_png);}
  472. }
  473.  
  474. else {ratingImgData = new GuiImageData(norating_png);}
  475. ratingImg = new GuiImage(ratingImgData);
  476. ratingImg->SetWidescreen(CFG.widescreen);
  477. ratingImg->SetPosition(-25 , inputY);
  478. ratingImg->SetAlignment(1,4);
  479. gameinfoWindow.Append(ratingImg);
  480. intputX += (CFG.widescreen ? ratingImg->GetWidth() * .8 : ratingImg->GetWidth())+5;
  481.  
  482. }
  483.  
  484. //////////debugging line
  485. /* snprintf(linebuf, sizeof(linebuf), "%s %s %s %s %i %s",gameinfo.ratingtype ,gameinfo.ratingvalueESRB,gameinfo.ratingvaluePEGI,gameinfo.ratingvalueCERO, ass,LANGUAGE.released);
  486.  
  487. for (int i=0;strcmp(gameinfo.accessories_required[i+1],"") != 0;i++)
  488. {
  489. snprintf(linebuf, sizeof(linebuf), "%s %s",linebuf, gameinfo.accessories_required[i+1]);
  490. }
  491.  
  492. debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255});
  493. debugTxt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); debugTxt->SetPosition(0,0);
  494. gameinfoWindow.Append(debugTxt);*/
  495.  
  496. if (strcmp(gameinfo.title,"") != 0)
  497. {snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.title);
  498. titleTxt = new GuiText(linebuf, 22, (GXColor){0,0,0, 255});
  499. if (titleTxt->GetWidth()>300)titleTxt->SetFontSize(18);
  500. titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt->SetPosition(txtXOffset,12+y); y+=24;
  501. gameinfoWindow.Append(titleTxt);}
  502.  
  503.  
  504.  
  505. //date
  506. snprintf(linebuf2, sizeof(linebuf2), " ");
  507. if (strcmp(gameinfo.day,"") != 0)
  508. {snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);}
  509. if (strcmp(gameinfo.month,"") != 0){
  510. switch (atoi(gameinfo.month))
  511. {
  512. case 1:
  513. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.january);
  514. break;
  515. case 2:
  516. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.february);
  517. break;
  518. case 3:
  519. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.march);
  520. break;
  521. case 4:
  522. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.april);
  523. break;
  524. case 5:
  525. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.may);
  526. break;
  527. case 6:
  528. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.june);
  529. break;
  530. case 7:
  531. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.july);
  532. break;
  533. case 8:
  534. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.august);
  535. break;
  536. case 9:
  537. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.september);
  538. break;
  539. case 10:
  540. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.october);
  541. break;
  542. case 11:
  543. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.november);
  544. break;
  545. case 12:
  546. snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.december);
  547. break;
  548. }
  549. }
  550. if (strcmp(gameinfo.year,"") != 0){newline=1;
  551. snprintf(linebuf, sizeof(linebuf), "%s : %s%s", LANGUAGE.released, linebuf2, gameinfo.year);
  552. releasedTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  553. if (releasedTxt->GetWidth()>300) newline=2;
  554. releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
  555. gameinfoWindow.Append(releasedTxt);}
  556. //genre
  557. if (strcmp(gameinfo.genre,"") != 0)
  558. {snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.genre);
  559. genreTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  560. if (genreTxt->GetWidth()>300) newline=2;
  561. genreTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); genreTxt->SetPosition(205,12+y1); y1+=(25 * newline);newline=1;
  562. gameinfoWindow.Append(genreTxt);}
  563.  
  564. //developer
  565. if (strcmp(gameinfo.developer,"") != 0 && strcmp(gameinfo.developer,gameinfo.publisher) != 0)
  566. {snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.developedby, gameinfo.developer);
  567. developerTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  568. if (developerTxt->GetWidth()>250) newline=2;
  569. developerTxt->SetMaxWidth(250,GuiText::WRAP);
  570. developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); developerTxt->SetPosition(-17,12+y); y+=(40 * newline);newline=1;
  571. gameinfoWindow.Append(developerTxt);}
  572.  
  573. //publisher
  574. if (strcmp(gameinfo.publisher,"") != 0)
  575. {snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.publishedby, gameinfo.publisher);
  576. publisherTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  577. if (publisherTxt->GetWidth()>250) newline=2;
  578. publisherTxt->SetMaxWidth(250,GuiText::WRAP);
  579. publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); publisherTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
  580. gameinfoWindow.Append(publisherTxt);}
  581.  
  582. //don't bother us txt
  583. snprintf(linebuf, sizeof(linebuf), "Don't bother the USB Loader GX Team about errors in this file.");
  584. betaTxt = new GuiText(linebuf, 14, (GXColor){0,0,0, 255});
  585. betaTxt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); betaTxt->SetPosition(-17,-20);//
  586. gameinfoWindow.Append(betaTxt);
  587. snprintf(linebuf, sizeof(linebuf), "A site will be available in the near nuture to submit changes.");
  588. beta1Txt = new GuiText(linebuf, 14, (GXColor){0,0,0, 255});
  589. beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); beta1Txt->SetPosition(-17,-10);
  590. gameinfoWindow.Append(beta1Txt);
  591.  
  592. // WiFi Shit commented out cause it has a code dump in it still
  593. if (strcmp(gameinfo.wififeatures[0],"") != 0){
  594. snprintf(linebuf, sizeof(linebuf), "%s:",LANGUAGE.wififeatures);
  595. wifiTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  596. wifiTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt->SetPosition(205,12+y); y+=(20 * newline);
  597. gameinfoWindow.Append(wifiTxt);}
  598. for (int i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++)
  599. {
  600. snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
  601. wifiTxt[i] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  602. wifiTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[i]->SetPosition(210,12+y); y+=(20 * newline);
  603. gameinfoWindow.Append(wifiTxt[i]);}
  604.  
  605. //synopsis
  606. if (strcmp(gameinfo.synopsis,"") != 0)
  607. {snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
  608. synopsisTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
  609. synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
  610. synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetPosition(0,0);
  611. dialogBoxImg11 = new GuiImage(&dialogBox1);
  612. dialogBoxImg11->SetAlignment(0,3);
  613. dialogBoxImg11->SetPosition(-9,0);
  614.  
  615. dialogBoxImg22 = new GuiImage(&dialogBox2);
  616. dialogBoxImg22->SetAlignment(0,3);
  617. dialogBoxImg22->SetPosition(145,0);
  618.  
  619. dialogBoxImg33 = new GuiImage(&dialogBox3);
  620. dialogBoxImg33->SetAlignment(0,3);
  621. dialogBoxImg33->SetPosition(301,0);
  622.  
  623. dialogBoxImg44 = new GuiImage(&dialogBox4);
  624. dialogBoxImg44->SetAlignment(0,3);
  625. dialogBoxImg44->SetPosition(457,0);
  626.  
  627.  
  628. gameinfoWindow2.Append(dialogBoxImg11);
  629. gameinfoWindow2.Append(dialogBoxImg22);
  630. gameinfoWindow2.Append(dialogBoxImg33);
  631. gameinfoWindow2.Append(dialogBoxImg44);
  632.  
  633. txtWindow.Append(synopsisTxt);
  634. coverImg2 = new GuiImage(cover);
  635. coverImg2->SetWidescreen(CFG.widescreen);
  636. coverImg2->SetPosition(15,30);
  637. gameinfoWindow2.Append(coverImg2);
  638. gameinfoWindow2.Append(&txtWindow);
  639. }
  640.  
  641.  
  642.  
  643. gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
  644. HaltGui();
  645. mainWindow->SetState(STATE_DISABLED);
  646. mainWindow->Append(&gameinfoWindow);
  647. mainWindow->ChangeFocus(&gameinfoWindow);
  648. ResumeGui();
  649.  
  650. while(choice == -1)
  651. {
  652. VIDEO_WaitVSync();
  653. if(shutdown == 1)
  654. {
  655. wiilight(0);
  656. Sys_Shutdown();
  657. }
  658. if(reset == 1)
  659. Sys_Reboot();
  660.  
  661.  
  662. if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)){
  663. choice=1;
  664. synopsisTxt = NULL;
  665. break;}
  666.  
  667. else if (((nextBtn.GetState()==STATE_CLICKED)||(nextBtn.GetState()==STATE_HELD))&&
  668. (strcmp(gameinfo.synopsis,"") != 0)){
  669.  
  670. if (page==1){
  671. nextBtn.ResetState();
  672. HaltGui();
  673. gameinfoWindow.SetVisible(false);
  674. gameinfoWindow2.SetVisible(true);
  675. coverImg->SetPosition(15,30);
  676.  
  677. backBtn.SetClickable(false);
  678. gameinfoWindow2.Append(&nextBtn);
  679. mainWindow->Append(&gameinfoWindow2);
  680. ResumeGui();
  681. page=2;
  682. }
  683. else {
  684. nextBtn.ResetState();
  685. HaltGui();
  686. backBtn.SetClickable(true);
  687. gameinfoWindow2.SetVisible(false);
  688. gameinfoWindow.SetVisible(true);
  689. gameinfoWindow.Append(&backBtn);
  690. gameinfoWindow.Append(&nextBtn);
  691. mainWindow->Remove(&gameinfoWindow2);
  692. ResumeGui();
  693. page=1;
  694. }
  695. nextBtn.ResetState();
  696. }
  697. }
  698. if (page==1){
  699. gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
  700. while(gameinfoWindow.GetEffect() > 0) usleep(50);
  701. HaltGui();
  702. mainWindow->Remove(&gameinfoWindow);
  703. mainWindow->SetState(STATE_DEFAULT);
  704.  
  705. // use this to display variables on the window GuiText * debugTxt = NULL;
  706. delete playersImgData;
  707. delete playersImg;
  708.  
  709. delete wifiplayersImgData;
  710. delete wifiplayersImg;
  711. delete ratingImg;
  712.  
  713. delete classiccontrollerImg;
  714. delete nunchuckImg;
  715. delete guitarImg;
  716. delete drumsImg;
  717. delete dancepadImg;
  718. delete motionplusImg;
  719. delete wheelImg;
  720. delete balanceboardImg;
  721. delete microphoneImg;
  722. delete gcImg;
  723. delete dialogBoxImg1;
  724. delete dialogBoxImg2;
  725. delete dialogBoxImg3;
  726. delete dialogBoxImg4;
  727. delete dialogBoxImg11;
  728. delete dialogBoxImg22;
  729. delete dialogBoxImg33;
  730. delete dialogBoxImg44;
  731. delete coverImg;
  732. delete coverImg2;
  733.  
  734. delete classiccontrollerImgData;
  735. delete nunchuckImgData;
  736. delete guitarImgData;
  737. delete drumsImgData;
  738. delete motionplusImgData;
  739. delete wheelImgData;
  740. delete balanceboardImgData;
  741. delete dancepadImgData;
  742. delete microphoneImgData;
  743. delete gamecubeImgData;
  744. delete ratingImgData;
  745. delete cover;
  746.  
  747. delete releasedTxt;
  748. delete publisherTxt;
  749. delete developerTxt;
  750. delete titleTxt;
  751. delete synopsisTxt;
  752. delete genreTxt;
  753. delete betaTxt;
  754. delete beta1Txt;
  755. if (nodata==0)FreeXMLMemory();
  756.  
  757. ResumeGui();}
  758. else {
  759. gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
  760. while(gameinfoWindow2.GetEffect() > 0) usleep(50);
  761. HaltGui();
  762. mainWindow->Remove(&gameinfoWindow2);
  763. mainWindow->SetState(STATE_DEFAULT);
  764. ResumeGui();}
  765. //FreeXMLMemory();
  766. return choice;
  767.  
  768. /* File not found */
  769. } else {
  770. return -1;
  771. }
  772. }
Add Comment
Please, Sign In to add comment