Finished work for windows

This commit is contained in:
Steven Cherry committed 2013-08-23 22:29:12 -05:00
1 parent edcde85cee
commit 082ff4b359
4 files changed
+47 -40

No files matched your search

+1 -1
View File
@@ -10,6 +10,7 @@
const static std::string CHEATS_DIR = "cheats";
static int CheatEvent = -1;
std::string gameTitle;
std::string activeCheatFile;
static CWCheatEngine *cheatEngine;
void hleCheat(u64 userdata, int cyclesLate);
void trim2(std::string& str);
@@ -73,7 +74,6 @@ void CWCheatEngine::CreateCodeList() { //Creates code list to be used in functio
initialCodesList = GetCodesList();
std::string currentcode, codename;
std::vector<std::string> codelist;
for (size_t i = 0; i < initialCodesList.size(); i ++) {
if (initialCodesList[i].substr(0,2) == "_S") {
continue; //Line indicates Disc ID, not needed for cheats
-3
View File
@@ -11,7 +11,6 @@
void __CheatInit();
void __CheatShutdown();
static std::string activeCheatFile;
std::vector<std::string> makeCodeParts(std::vector<std::string> CodesList);
class CWCheatEngine {
@@ -24,9 +23,7 @@ public:
void Exit();
void Run();
std::vector<int> GetNextCode();
static std::string gActiveCheatFile;
void ActiveFileCopy();
private:
void SkipCodes(int count);
+37 -33
View File
@@ -16,29 +16,13 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "android/app-android.h"
#include "base/logging.h"
#include "gfx_es2/glsl_program.h"
#include "gfx_es2/gl_state.h"
#include "gfx_es2/fbo.h"
#include "input/input_state.h"
#include "ui/ui.h"
#include "i18n/i18n.h"
#include "Common/KeyMap.h"
#include "Core/Config.h"
#include "Core/CoreTiming.h"
#include "Core/CoreParameter.h"
#include "Core/Core.h"
#include "Core/Host.h"
#include "Core/System.h"
#include "GPU/GPUState.h"
#include "GPU/GPUInterface.h"
#include "Core/HLE/sceCtrl.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/Debugger/SymbolMap.h"
#include "UI/OnScreenDisplay.h"
#include "UI/ui_atlas.h"
@@ -52,26 +36,27 @@
#include "UI/CwCheatScreen.h"
#include "UI/view.h"
static std::vector<std::string> cheatList;
extern void DrawBackground(float alpha);
static CWCheatEngine *cheatEngine2;
std::vector<std::string> CwCheatScreen::CreateCodeList() {
cheatEngine2 = new CWCheatEngine();
cheatList = cheatEngine2->GetCodesList();
int j = 0;
for (size_t i = 0; i < cheatList.size(); i++) {
if (cheatList[i].substr(0, 3) == "_C1") {
formattedList.push_back(cheatList[i].substr(3));
enableCheat[i] = true;
formattedList.push_back(cheatList[i].substr(4));
enableCheat[j++] = true;
locations.push_back(i);
}
if (cheatList[i].substr(0, 3) == "_C0") {
formattedList.push_back(cheatList[i].substr(3));
enableCheat[i] = false;
formattedList.push_back(cheatList[i].substr(4));
enableCheat[j++] = false;
}
}
delete cheatEngine2;
return formattedList;
}
void CwCheatScreen::CreateViews() {
@@ -82,7 +67,7 @@ void CwCheatScreen::CreateViews() {
root_ = new LinearLayout(ORIENT_HORIZONTAL);
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT));
leftColumn->Add(new Choice(k->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
leftColumn->Add(new Choice(k->T("Back")))->OnClick.Handle<CwCheatScreen>(this, &CwCheatScreen::OnBack);
ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
@@ -99,32 +84,51 @@ void CwCheatScreen::CreateViews() {
}
}
UI::EventReturn CwCheatScreen::OnBack(UI::EventParams &params)
{
screenManager()->finishDialog(this, DR_OK);
g_Config.bReloadCheats = true;
return UI::EVENT_DONE;
}
UI::EventReturn CwCheatScreen::OnCheckBox(UI::EventParams &params) {
return UI::EVENT_DONE;
}
void CwCheatScreen::processFileOn(std::string activatedCheat) {
//visible test
//bool check;
//LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
//rightColumn->Add(new CheatCheckBox(&check, "name"));
is.open(activeCheatFile.c_str());
for (int i = 0; i < cheatList.size(); i++) {
if (cheatList[i].substr(4) == activatedCheat) {
cheatList[i] = "_C1 " + activatedCheat;
}
}
is.close();
os.open(activeCheatFile.c_str());
for (int j = 0; j < cheatList.size(); j++) {
os << cheatList[j];
if (j < cheatList.size() - 1) {
os << "\n";
}
}
os.close();
}
void CwCheatScreen::processFileOff(std::string deactivatedString) {
is.open(activeCheatFile.c_str());
void CwCheatScreen::processFileOff(std::string deactivatedCheat) {
for (int i = 0; i < cheatList.size(); i++) {
if (cheatList[i].substr(4) == deactivatedCheat) {
cheatList[i] = "_C0 " + deactivatedCheat;
}
}
os.open(activeCheatFile.c_str());
for (int j = 0; j < cheatList.size(); j++) {
os << cheatList[j];
if (j < cheatList.size() - 1) {
os << "\n";
}
}
os.close();
}
void CheatCheckBox::Draw(UIContext &dc) {
+9 -3
View File
@@ -21,7 +21,9 @@
#include "ui/ui_context.h"
#include "../Core/CwCheat.h"
#include "UI/MiscScreens.h"
#include "UI/GameSettingsScreen.h"
using namespace UI;
extern std::string activeCheatFile;
class CwCheatScreen : public UIDialogScreenWithBackground {
public:
@@ -33,13 +35,15 @@ public:
void processFileOff(std::string deactivatedCheat);
const char * name;
std::string activatedCheat, deactivatedCheat;
UI::EventReturn OnBack(UI::EventParams &params);
protected:
virtual void CreateViews();
private:
UI::EventReturn OnCheckBox(UI::EventParams &params);
bool enableCheat [64];
std::vector<std::string> cheatList, formattedList;
std::vector<std::string> formattedList;
std::vector<int> locations;
};
@@ -57,12 +61,14 @@ public:
if (toggle_) {
*toggle_ = !(*toggle_);
}
if (*toggle_ == true)
bool temp;
temp = *toggle_;
if (temp == 1)
{
activatedCheat = text_;
processFileOn(activatedCheat);
}
if (*toggle_ == false)
if (temp == 0)
{
deactivatedCheat = text_;
processFileOff(deactivatedCheat);