Cheat System: Do some code cleanup and silence all of the compiler warnings (on Windows and Cocoa ports only).
- Some minor API changes were made, but only Windows and Cocoa were actually tested. Tried to make sure that Linux ports were updated to the new API, but haven't tested it.
This commit is contained in:
parent
cedc1c9f38
commit
aa21454373
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2009-2021 DeSmuME team
|
||||
Copyright (C) 2009-2023 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,7 +42,7 @@ struct CHEATS_LIST
|
|||
type = 0xFF;
|
||||
}
|
||||
u8 type;
|
||||
BOOL enabled;
|
||||
u8 enabled;
|
||||
// TODO
|
||||
u8 freezeType; // 0 - normal freeze
|
||||
// 1 - can decrease
|
||||
|
@ -56,9 +56,9 @@ struct CHEATS_LIST
|
|||
class CHEATS
|
||||
{
|
||||
private:
|
||||
std::vector<CHEATS_LIST> list;
|
||||
u8 filename[MAX_PATH];
|
||||
u32 currentGet;
|
||||
std::vector<CHEATS_LIST> _list;
|
||||
u8 _filename[MAX_PATH];
|
||||
size_t _currentGet;
|
||||
|
||||
void clear();
|
||||
void ARparser(CHEATS_LIST& cheat);
|
||||
|
@ -66,46 +66,65 @@ private:
|
|||
|
||||
public:
|
||||
CHEATS()
|
||||
: currentGet(0)
|
||||
: _currentGet(0)
|
||||
{
|
||||
memset(filename, 0, sizeof(filename));
|
||||
memset(_filename, 0, sizeof(_filename));
|
||||
}
|
||||
~CHEATS() {}
|
||||
|
||||
void init(char *path);
|
||||
BOOL add(u8 size, u32 address, u32 val, char *description, BOOL enabled);
|
||||
BOOL update(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
|
||||
BOOL move(u32 srcPos, u32 dstPos);
|
||||
BOOL add_AR(char *code, char *description, BOOL enabled);
|
||||
BOOL update_AR(char *code, char *description, BOOL enabled, u32 pos);
|
||||
BOOL add_AR_Direct(CHEATS_LIST cheat);
|
||||
BOOL add_CB(char *code, char *description, BOOL enabled);
|
||||
BOOL update_CB(char *code, char *description, BOOL enabled, u32 pos);
|
||||
BOOL remove(u32 pos);
|
||||
void init(const char *thePath);
|
||||
const char* getFilePath() const;
|
||||
void setFilePath(const char *thePath);
|
||||
|
||||
size_t addItem(const CHEATS_LIST &srcCheat);
|
||||
bool add(u8 size, u32 address, u32 val, char *description, bool enabled);
|
||||
bool add(u8 size, u32 address, u32 val, char *description, u8 enabled);
|
||||
|
||||
bool updateItemAtIndex(const CHEATS_LIST &srcCheat, const size_t pos);
|
||||
bool update(u8 size, u32 address, u32 val, char *description, bool enabled, const size_t pos);
|
||||
bool update(u8 size, u32 address, u32 val, char *description, u8 enabled, const size_t pos);
|
||||
|
||||
bool move(size_t srcPos, size_t dstPos);
|
||||
|
||||
size_t add_AR_Direct(const CHEATS_LIST &srcCheat);
|
||||
bool add_AR(char *code, char *description, bool enabled);
|
||||
bool add_AR(char *code, char *description, u8 enabled);
|
||||
|
||||
bool update_AR(char *code, char *description, bool enabled, const size_t pos);
|
||||
bool update_AR(char *code, char *description, u8 enabled, const size_t pos);
|
||||
|
||||
bool add_CB(char *code, char *description, bool enabled);
|
||||
bool add_CB(char *code, char *description, u8 enabled);
|
||||
|
||||
bool update_CB(char *code, char *description, bool enabled, const size_t pos);
|
||||
bool update_CB(char *code, char *description, u8 enabled, const size_t pos);
|
||||
|
||||
bool remove(const size_t pos);
|
||||
|
||||
void getListReset();
|
||||
BOOL getList(CHEATS_LIST *cheat);
|
||||
bool getList(CHEATS_LIST *cheat);
|
||||
CHEATS_LIST* getListPtr();
|
||||
BOOL get(CHEATS_LIST *cheat, u32 pos);
|
||||
CHEATS_LIST* getItemByIndex(const u32 pos);
|
||||
u32 getSize();
|
||||
bool copyItemFromIndex(const size_t pos, CHEATS_LIST &outCheatItem);
|
||||
CHEATS_LIST* getItemPtrAtIndex(const size_t pos);
|
||||
size_t getListSize();
|
||||
size_t getActiveCount();
|
||||
void setDescription(const char *description, u32 pos);
|
||||
BOOL save();
|
||||
BOOL load();
|
||||
void setDescription(const char *description, const size_t pos);
|
||||
bool save();
|
||||
bool load();
|
||||
void process(int targetType);
|
||||
void getXXcodeString(CHEATS_LIST theList, char *res_buf);
|
||||
|
||||
static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const std::string codeString);
|
||||
static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const char *codeString);
|
||||
static bool XXCodeFromString(const std::string codeString, CHEATS_LIST &outCheatItem);
|
||||
static bool XXCodeFromString(const char *codeString, CHEATS_LIST &outCheatItem);
|
||||
};
|
||||
|
||||
class CHEATSEARCH
|
||||
{
|
||||
private:
|
||||
u8 *statMem;
|
||||
u8 *mem;
|
||||
u32 amount;
|
||||
u32 lastRecord;
|
||||
u8 *_statMem;
|
||||
u8 *_mem;
|
||||
u32 _amount;
|
||||
u32 _lastRecord;
|
||||
|
||||
u32 _type;
|
||||
u32 _size;
|
||||
|
@ -113,15 +132,15 @@ private:
|
|||
|
||||
public:
|
||||
CHEATSEARCH()
|
||||
: statMem(0), mem(0), amount(0), lastRecord(0), _type(0), _size(0), _sign(0)
|
||||
: _statMem(0), _mem(0), _amount(0), _lastRecord(0), _type(0), _size(0), _sign(0)
|
||||
{}
|
||||
~CHEATSEARCH() { close(); }
|
||||
BOOL start(u8 type, u8 size, u8 sign);
|
||||
BOOL close();
|
||||
~CHEATSEARCH() { this->close(); }
|
||||
bool start(u8 type, u8 size, u8 sign);
|
||||
void close();
|
||||
u32 search(u32 val);
|
||||
u32 search(u8 comp);
|
||||
u32 getAmount();
|
||||
BOOL getList(u32 *address, u32 *curVal);
|
||||
bool getList(u32 *address, u32 *curVal);
|
||||
void getListReset();
|
||||
};
|
||||
|
||||
|
@ -146,13 +165,13 @@ private:
|
|||
CHEATS_DB_TYPE type;
|
||||
bool encrypted;
|
||||
FILE *fp;
|
||||
u32 fsize;
|
||||
u32 dataSize;
|
||||
u32 encOffset;
|
||||
size_t fsize;
|
||||
u64 dataSize;
|
||||
u64 encOffset;
|
||||
FAT_R4 fat;
|
||||
bool search();
|
||||
bool getCodes();
|
||||
void R4decrypt(u8 *buf, u32 len, u32 n);
|
||||
void R4decrypt(u8 *buf, const size_t len, u64 n);
|
||||
|
||||
u32 numCheats;
|
||||
CHEATS_LIST *cheats;
|
||||
|
@ -176,17 +195,12 @@ public:
|
|||
CRC(0),
|
||||
error(0)
|
||||
{
|
||||
memset(&fat, 0, sizeof(fat));
|
||||
memset(gametitle, 0, sizeof(gametitle));
|
||||
memset(date, 0, sizeof(date));
|
||||
gametitle = (u8 *)malloc(CHEAT_DB_GAME_TITLE_SIZE);
|
||||
memset(gametitle, 0, CHEAT_DB_GAME_TITLE_SIZE);
|
||||
}
|
||||
~CHEATSEXPORT()
|
||||
{
|
||||
free(gametitle);
|
||||
gametitle = NULL;
|
||||
}
|
||||
|
||||
u8 *gametitle;
|
||||
u8 gametitle[CHEAT_DB_GAME_TITLE_SIZE];
|
||||
u8 date[17];
|
||||
u32 CRC;
|
||||
bool load(char *path);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2012-2022 DeSmuME team
|
||||
Copyright (C) 2012-2023 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -169,12 +169,12 @@ static NSImage *iconCodeBreaker = nil;
|
|||
|
||||
- (BOOL) enabled
|
||||
{
|
||||
return data->enabled;
|
||||
return (data->enabled != 0) ? YES : NO;
|
||||
}
|
||||
|
||||
- (void) setEnabled:(BOOL)theState
|
||||
{
|
||||
data->enabled = theState;
|
||||
data->enabled = (theState) ? 1 : 0;
|
||||
|
||||
if (workingCopy != nil)
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
char *codeCString = (char *)calloc(codeCStringSize, 1);
|
||||
[theCode getCString:codeCString maxLength:codeCStringSize encoding:NSUTF8StringEncoding];
|
||||
|
||||
CHEATS::XXCodeFromString(data, codeCString);
|
||||
CHEATS::XXCodeFromString(codeCString, *data);
|
||||
|
||||
free(codeCString);
|
||||
codeCString = NULL;
|
||||
|
@ -589,7 +589,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
NSNumber *memAddressNumber = (NSNumber *)[dataDict valueForKey:@"memAddress"];
|
||||
if (memAddressNumber != nil)
|
||||
{
|
||||
self.memAddress = [memAddressNumber unsignedIntegerValue];
|
||||
self.memAddress = (u32)[memAddressNumber unsignedIntegerValue];
|
||||
}
|
||||
|
||||
NSNumber *valueNumber = (NSNumber *)[dataDict valueForKey:@"value"];
|
||||
|
@ -796,11 +796,12 @@ static NSImage *iconCodeBreaker = nil;
|
|||
CHEATS_LIST *cheatListData = self.listData->getListPtr();
|
||||
|
||||
pthread_rwlock_wrlock(self.rwlockCoreExecute);
|
||||
const bool cheatItemEnabled = (cheatItem.enabled) ? true : false;
|
||||
|
||||
switch (cheatItem.cheatType)
|
||||
{
|
||||
case CHEAT_TYPE_INTERNAL:
|
||||
result = self.listData->add(cheatItem.bytes - 1, cheatItem.memAddress, cheatItem.value, [cheatItem descriptionCString], cheatItem.enabled);
|
||||
result = self.listData->add(cheatItem.bytes - 1, cheatItem.memAddress, (u32)cheatItem.value, [cheatItem descriptionCString], cheatItemEnabled);
|
||||
break;
|
||||
|
||||
case CHEAT_TYPE_ACTION_REPLAY:
|
||||
|
@ -808,7 +809,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
char *cheatCodes = (char *)[cheatItem.code cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if (cheatCodes != nil)
|
||||
{
|
||||
result = self.listData->add_AR(cheatCodes, [cheatItem descriptionCString], cheatItem.enabled);
|
||||
result = self.listData->add_AR(cheatCodes, [cheatItem descriptionCString], cheatItemEnabled);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -818,7 +819,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
char *cheatCodes = (char *)[cheatItem.code cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if (cheatCodes != nil)
|
||||
{
|
||||
result = self.listData->add_CB(cheatCodes, [cheatItem descriptionCString], cheatItem.enabled);
|
||||
result = self.listData->add_CB(cheatCodes, [cheatItem descriptionCString], cheatItemEnabled);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -839,16 +840,16 @@ static NSImage *iconCodeBreaker = nil;
|
|||
// reset the data pointers for each item.
|
||||
if (cheatListData != self.listData->getListPtr())
|
||||
{
|
||||
NSUInteger listCount = self.listData->getSize();
|
||||
NSUInteger listCount = self.listData->getListSize();
|
||||
for (NSUInteger i = 0; i < listCount; i++)
|
||||
{
|
||||
CocoaDSCheatItem *itemInList = (CocoaDSCheatItem *)[self.list objectAtIndex:i];
|
||||
itemInList.data = self.listData->getItemByIndex(i);
|
||||
itemInList.data = self.listData->getItemPtrAtIndex(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cheatItem.data = self.listData->getItemByIndex(self.listData->getSize() - 1);
|
||||
cheatItem.data = self.listData->getItemPtrAtIndex(self.listData->getListSize() - 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -873,10 +874,10 @@ static NSImage *iconCodeBreaker = nil;
|
|||
|
||||
// Removing an item from the raw cheat list data shifts all higher elements
|
||||
// by one, so we need to do the same.
|
||||
NSUInteger listCount = self.listData->getSize();
|
||||
NSUInteger listCount = self.listData->getListSize();
|
||||
for (NSUInteger i = selectionIndex; i < listCount; i++)
|
||||
{
|
||||
[(CocoaDSCheatItem *)[self.list objectAtIndex:(i + 1)] setData:self.listData->getItemByIndex(i)];
|
||||
[(CocoaDSCheatItem *)[self.list objectAtIndex:(i + 1)] setData:self.listData->getItemPtrAtIndex(i)];
|
||||
}
|
||||
|
||||
cheatItem.data = nil;
|
||||
|
@ -899,11 +900,12 @@ static NSImage *iconCodeBreaker = nil;
|
|||
}
|
||||
|
||||
pthread_rwlock_wrlock(self.rwlockCoreExecute);
|
||||
const bool cheatItemEnabled = (cheatItem.enabled) ? true : false;
|
||||
|
||||
switch (cheatItem.cheatType)
|
||||
{
|
||||
case CHEAT_TYPE_INTERNAL:
|
||||
result = self.listData->update(cheatItem.bytes - 1, cheatItem.memAddress, cheatItem.value, [cheatItem descriptionCString], cheatItem.enabled, selectionIndex);
|
||||
result = self.listData->update(cheatItem.bytes - 1, cheatItem.memAddress, (u32)cheatItem.value, [cheatItem descriptionCString], cheatItemEnabled, selectionIndex);
|
||||
break;
|
||||
|
||||
case CHEAT_TYPE_ACTION_REPLAY:
|
||||
|
@ -911,7 +913,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
char *cheatCodes = (char *)[cheatItem.code cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if (cheatCodes != nil)
|
||||
{
|
||||
result = self.listData->update_AR(cheatCodes, [cheatItem descriptionCString], cheatItem.enabled, selectionIndex);
|
||||
result = self.listData->update_AR(cheatCodes, [cheatItem descriptionCString], cheatItemEnabled, selectionIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -921,7 +923,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
char *cheatCodes = (char *)[cheatItem.code cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if (cheatCodes != nil)
|
||||
{
|
||||
result = self.listData->update_CB(cheatCodes, [cheatItem descriptionCString], cheatItem.enabled, selectionIndex);
|
||||
result = self.listData->update_CB(cheatCodes, [cheatItem descriptionCString], cheatItemEnabled, selectionIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1014,7 +1016,7 @@ static NSImage *iconCodeBreaker = nil;
|
|||
|
||||
+ (void) applyInternalCheatWithItem:(CocoaDSCheatItem *)cheatItem
|
||||
{
|
||||
[CocoaDSCheatManager applyInternalCheatWithAddress:cheatItem.memAddress value:cheatItem.value bytes:cheatItem.bytes];
|
||||
[CocoaDSCheatManager applyInternalCheatWithAddress:cheatItem.memAddress value:(u32)cheatItem.value bytes:cheatItem.bytes];
|
||||
}
|
||||
|
||||
+ (void) applyInternalCheatWithAddress:(UInt32)address value:(UInt32)value bytes:(NSUInteger)bytes
|
||||
|
@ -1069,10 +1071,10 @@ static NSImage *iconCodeBreaker = nil;
|
|||
return newList;
|
||||
}
|
||||
|
||||
u32 itemCount = cheatList->getSize();
|
||||
for (u32 i = 0; i < itemCount; i++)
|
||||
size_t itemCount = cheatList->getListSize();
|
||||
for (size_t i = 0; i < itemCount; i++)
|
||||
{
|
||||
CocoaDSCheatItem *newItem = [[CocoaDSCheatItem alloc] initWithCheatData:cheatList->getItemByIndex(i)];
|
||||
CocoaDSCheatItem *newItem = [[CocoaDSCheatItem alloc] initWithCheatData:cheatList->getItemPtrAtIndex(i)];
|
||||
|
||||
if (newItem != nil)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* cheats.cpp - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2006-2009 DeSmuME Team
|
||||
* Copyright (C) 2006-2023 DeSmuME Team
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -90,7 +90,7 @@ enabled_toggled(GtkCellRendererToggle * cell,
|
|||
path1 = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
cheats->get(&cheat, ii);
|
||||
cheats->copyItemFromIndex(ii, cheat);
|
||||
|
||||
cheats->update(cheat.size, cheat.code[0][0], cheat.code[0][1], cheat.description,
|
||||
enabled, ii);
|
||||
|
@ -121,7 +121,7 @@ static void cheat_list_modify_cheat(GtkCellRendererText * cell,
|
|||
path1 = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
cheats->get(&cheat, ii);
|
||||
cheats->copyItemFromIndex(ii, cheat);
|
||||
|
||||
gtk_tree_path_free (path1);
|
||||
|
||||
|
@ -285,10 +285,10 @@ static GtkListStore *cheat_list_populate()
|
|||
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING);
|
||||
|
||||
CHEATS_LIST cheat;
|
||||
u32 chsize = cheats->getSize();
|
||||
u32 chsize = cheats->getListSize();
|
||||
for(u32 ii = 0; ii < chsize; ii++){
|
||||
GtkTreeIter iter;
|
||||
cheats->get(&cheat, ii);
|
||||
cheats->copyItemFromIndex(ii, cheat);
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
COLUMN_ENABLED, cheat.enabled,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* cheats.cpp - this file is part of DeSmuME
|
||||
*
|
||||
* Copyright (C) 2006-2009 DeSmuME Team
|
||||
* Copyright (C) 2006-2023 DeSmuME Team
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -90,7 +90,7 @@ enabled_toggled(GtkCellRendererToggle * cell,
|
|||
path1 = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
cheats->get(&cheat, ii);
|
||||
cheats->copyItemFromIndex(ii, cheat);
|
||||
|
||||
cheats->update(cheat.size, cheat.code[0][0], cheat.code[0][1], cheat.description,
|
||||
enabled, ii);
|
||||
|
@ -121,7 +121,7 @@ static void cheat_list_modify_cheat(GtkCellRendererText * cell,
|
|||
path1 = gtk_tree_model_get_path (model, &iter);
|
||||
ii = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
cheats->get(&cheat, ii);
|
||||
cheats->copyItemFromIndex(ii, cheat);
|
||||
|
||||
gtk_tree_path_free (path1);
|
||||
|
||||
|
@ -285,10 +285,10 @@ static GtkListStore *cheat_list_populate()
|
|||
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING);
|
||||
|
||||
CHEATS_LIST cheat;
|
||||
u32 chsize = cheats->getSize();
|
||||
u32 chsize = cheats->getListSize();
|
||||
for(u32 ii = 0; ii < chsize; ii++){
|
||||
GtkTreeIter iter;
|
||||
cheats->get(&cheat, ii);
|
||||
cheats->copyItemFromIndex(ii, cheat);
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
COLUMN_ENABLED, cheat.enabled,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2009-2016 DeSmuME team
|
||||
Copyright (C) 2009-2023 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -392,7 +392,7 @@ INT_PTR CALLBACK CheatsEditProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara
|
|||
oldEditProcHEX = SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)EditValueHEXProc);
|
||||
oldEditProc = SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT2), GWLP_WNDPROC, (LONG_PTR)EditValueProc);
|
||||
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
cheats->copyItemFromIndex(cheatEditPos, tempCheat);
|
||||
|
||||
memset(buf, 0, 100);
|
||||
memset(buf2, 0, 100);
|
||||
|
@ -832,10 +832,12 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
{
|
||||
bool checked = (newStateImage == INDEXTOSTATEIMAGEMASK(2));
|
||||
cheatEditPos = pNMListView->iItem;
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
if ((bool)tempCheat.enabled != checked)
|
||||
cheats->copyItemFromIndex(cheatEditPos, tempCheat);
|
||||
|
||||
const bool tempCheatEnabledBool = (tempCheat.enabled != 0);
|
||||
if (tempCheatEnabledBool != checked)
|
||||
{
|
||||
tempCheat.enabled = checked;
|
||||
tempCheat.enabled = (checked) ? 1 : 0;
|
||||
switch (tempCheat.type)
|
||||
{
|
||||
case 0: // internal
|
||||
|
@ -1035,16 +1037,16 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
case IDC_BEDIT:
|
||||
{
|
||||
cheatEditPos = ListView_GetNextItem(cheatListView, -1, LVNI_SELECTED|LVNI_FOCUSED);
|
||||
if (cheatEditPos > cheats->getSize()) return TRUE;
|
||||
if (cheatEditPos > cheats->getListSize()) return TRUE;
|
||||
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
cheats->copyItemFromIndex(cheatEditPos, tempCheat);
|
||||
switch (tempCheat.type)
|
||||
{
|
||||
case 0: // internal
|
||||
if (DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_CHEAT_ADD), dialog, (DLGPROC) CheatsEditProc))
|
||||
{
|
||||
char buf[256];
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
cheats->copyItemFromIndex(cheatEditPos, tempCheat);
|
||||
ListView_SetCheckState(cheatListView, cheatEditPos, tempCheat.enabled);
|
||||
wsprintf(buf, "0x0%07X", tempCheat.code[0][0]);
|
||||
ListView_SetItemText(cheatListView, cheatEditPos, 1, buf);
|
||||
|
@ -1065,7 +1067,7 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
|
||||
if (DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_CHEAT_ADD_XX_CODE), dialog, (DLGPROC) CheatsAdd_XX_Proc))
|
||||
{
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
cheats->copyItemFromIndex(cheatEditPos, tempCheat);
|
||||
ListView_SetCheckState(cheatListView, cheatEditPos, tempCheat.enabled);
|
||||
|
||||
if (cheatXXtype == 0)
|
||||
|
|
Loading…
Reference in New Issue