mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 20:56:53 +01:00
This commit is contained in:
parent
8e42f68cae
commit
6e3bc5607e
@ -27,7 +27,6 @@ int CheatMenu(const char * gameID) {
|
||||
bool exit = false;
|
||||
int ret = 1;
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
char imgPath[100];
|
||||
@ -35,25 +34,24 @@ int CheatMenu(const char * gameID) {
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -140, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -140, 400, &trigA, NULL, &btnClick,1);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
|
||||
GuiText createBtnTxt(tr("Create") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
createBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage createBtnImg(&btnOutline);
|
||||
GuiButton createBtn(&createBtnImg,&createBtnImg, 2, 3, 160, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
GuiButton createBtn(&createBtnImg,&createBtnImg, 2, 3, 160, 400, &trigA, NULL, &btnClick,1);
|
||||
createBtn.SetLabel(&createBtnTxt);
|
||||
|
||||
char txtfilename[55];
|
||||
@ -63,8 +61,6 @@ int CheatMenu(const char * gameID) {
|
||||
int check = c.openTxtfile(txtfilename);
|
||||
|
||||
int download =0;
|
||||
//char tmp[10];
|
||||
|
||||
|
||||
switch (check) {
|
||||
case -1:
|
||||
@ -72,9 +68,7 @@ int CheatMenu(const char * gameID) {
|
||||
break;
|
||||
case 0:
|
||||
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),tr("Download Now"));
|
||||
//snprintf(tmp, sizeof(tmp), "%i",download);
|
||||
|
||||
//WindowPrompt(0,tmp,tr("OK"),tr("Download Now"));
|
||||
if (download==0)
|
||||
download = CodeDownload(gameID);
|
||||
break;
|
||||
@ -133,7 +127,6 @@ int CheatMenu(const char * gameID) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
string chtpath = Settings.Cheatcodespath;
|
||||
string gctfname = chtpath + c.getGameID() + ".gct";
|
||||
c.createGCT(selectednrs,x,gctfname.c_str());
|
||||
@ -141,7 +134,6 @@ int CheatMenu(const char * gameID) {
|
||||
exit = true;
|
||||
break;
|
||||
} else WindowPrompt(tr("Error"),tr("Could not create GCT file"),tr("OK"));
|
||||
|
||||
}
|
||||
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
@ -154,7 +146,6 @@ int CheatMenu(const char * gameID) {
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,26 @@
|
||||
/*
|
||||
* gct.h
|
||||
* Class to handle Ocarina TXT Cheatfiles
|
||||
* nIxx
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "gct.h"
|
||||
|
||||
#define OUTOFRANGE "Error:Range"
|
||||
#define ERRORRANGE "Error: CheatNr out of range"
|
||||
|
||||
GCTCheats::GCTCheats(void) {
|
||||
iCntCheats = 0;
|
||||
}
|
||||
|
||||
GCTCheats::~GCTCheats(void) {
|
||||
|
||||
string sGameID ="";
|
||||
string sGameTitle = "";
|
||||
/*string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
string sCheatComment[MAXCHEATS];*/
|
||||
}
|
||||
|
||||
int GCTCheats::getCnt() {
|
||||
@ -27,7 +39,7 @@ string GCTCheats::getCheat(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheats[nr];
|
||||
} else {
|
||||
return OUTOFRANGE;//"Error: CheatNr out of range";
|
||||
return ERRORRANGE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +47,7 @@ string GCTCheats::getCheatName(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheatName[nr];
|
||||
} else {
|
||||
return "Error: CheatNr out of range";
|
||||
return ERRORRANGE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +55,7 @@ string GCTCheats::getCheatComment(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheatComment[nr];
|
||||
} else {
|
||||
return "Error: CheatNr out of range";
|
||||
return ERRORRANGE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +66,7 @@ int GCTCheats::createGCT(int nr,const char * filename) {
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
//Reversed Header and Footer
|
||||
//Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
@ -85,7 +97,7 @@ int GCTCheats::createGCT(const char * chtbuffer,const char * filename) {
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
//Reversed Header and Footer
|
||||
//Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
@ -119,7 +131,7 @@ int GCTCheats::createGCT(int nr[],int cnt,const char * filename) {
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
//Reversed Header and Footer
|
||||
//Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
@ -204,90 +216,3 @@ int GCTCheats::openTxtfile(const char * filename) {
|
||||
filestr.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*int GCTCheats::openTxtfile(const char * filename)
|
||||
{
|
||||
ifstream filestr;
|
||||
int i = 0;
|
||||
string str;
|
||||
filestr.open(filename);
|
||||
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
filestr.seekg(0,ios_base::end);
|
||||
int size = filestr.tellg();
|
||||
if (size <= 0) return -1;
|
||||
filestr.seekg(0,ios_base::beg);
|
||||
|
||||
getline(filestr,sGameID);
|
||||
getline(filestr,sGameTitle);
|
||||
filestr.ignore();
|
||||
|
||||
while(!filestr.eof())
|
||||
{
|
||||
getline(filestr,sCheatName[i]);
|
||||
string cheatdata;
|
||||
bool emptyline = false;
|
||||
|
||||
do
|
||||
{
|
||||
getline(filestr,str,'\n');
|
||||
cheatdata.append(str);
|
||||
|
||||
if (str == "")
|
||||
{
|
||||
emptyline = true;
|
||||
break;
|
||||
}
|
||||
|
||||
size_t found=cheatdata.find(' ');
|
||||
cheatdata.replace(found,1,"");
|
||||
|
||||
if (filestr.eof()) break;
|
||||
} while(!emptyline);
|
||||
|
||||
sCheats[i] = cheatdata;
|
||||
i++;
|
||||
}
|
||||
iCntCheats = i;
|
||||
filestr.close();
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(void) {
|
||||
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
|
||||
while (i < iCntCheats) {
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
}
|
||||
return cheatlist;
|
||||
}
|
||||
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename) {
|
||||
openTxtfile(filename);
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
cheatlist.iCntCheats = iCntCheats;
|
||||
|
||||
while (i < iCntCheats) {
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
}
|
||||
return cheatlist;
|
||||
}
|
||||
|
||||
int GCTCheats::download_txtcheat(int id) {
|
||||
//ToDo
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
/*
|
||||
* gct.h
|
||||
* Class to handle Ocarina TXT Cheatfiles
|
||||
* WIP: Actually it´s needed to call fatInitDefault() or the file will not be found
|
||||
* and no Comments supported for now
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GCT_H
|
||||
@ -14,19 +13,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct chtentrie {
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
string sCheatComment[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
};
|
||||
|
||||
//!Handles Ocarina TXT Cheatfiles
|
||||
class GCTCheats {
|
||||
private:
|
||||
chtentrie ccc;
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
@ -35,15 +24,6 @@ private:
|
||||
int iCntCheats;
|
||||
|
||||
public:
|
||||
|
||||
struct chtentries {
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
};
|
||||
|
||||
//!Constructor
|
||||
GCTCheats(void);
|
||||
//!Destructor
|
||||
@ -86,18 +66,6 @@ public:
|
||||
//!Gets Cheat Comment
|
||||
//!\return Cheat Comment
|
||||
string getCheatComment(int nr);
|
||||
//!Gets Cheat List
|
||||
//!\return struct chtentrie
|
||||
//struct chtentrie getCheatList2(void);
|
||||
//!Gets Cheat List
|
||||
//!\return struct chtentries
|
||||
struct chtentries getCheatList(void);
|
||||
//!Gets Cheat List from file
|
||||
//!\param filename name of TXT file
|
||||
//!\return struct chtentries
|
||||
struct chtentries getCheatList(const char * filename);
|
||||
|
||||
int download_txtcheat(int id);
|
||||
};
|
||||
|
||||
#endif /* _GCT_H */
|
||||
|
@ -322,7 +322,6 @@ int MenuHomebrewBrowse() {
|
||||
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
|
||||
|
||||
/*** XML Variables ***/
|
||||
HomebrewXML XMLInfo[4];
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "fstfile.h"
|
||||
|
||||
/** Alternate dolloader made by WiiPower modified by dimok **/
|
||||
|
||||
bool Load_Dol(void **buffer, int* dollen, char * filepath) {
|
||||
int ret;
|
||||
FILE* file;
|
||||
|
Loading…
Reference in New Issue
Block a user