Skip to content

Commit

Permalink
GTK*: Action Replay cheat menu (+ other cheat improvements) (#847)
Browse files Browse the repository at this point in the history
* GTK cheats UI inputs/displays hex for address (offset)

* Added range bound to keep internal cheat data within specified size
The decision to change the value column to store G_TYPE_UINT is purely pragmatic--having all data be treated and displayed as unsized is simpler than writing a custom display to handle signedness and cleaner than 1-3 byte ints appearing unsigned and 4 byte int appearing signed.

* Added index and cheat type data to ListStore
My implementation plan is to use a GtkTreeModelFilter to create separate section for internal and ActionReplay cheats, but I was not convinced the indices in the tree path would correspond to the indices in , hence the additional column.

* Filter raw and AR cheats, display both filters in UI, patch up raw update/delete

* Action Replay UI elements [GTK]

* Memory leak fixes
+ some additional clean-up comments and small bug patches

* Backport to GTK2
  • Loading branch information
En-En-Code authored Oct 25, 2024
1 parent 2bc5b0d commit efdd938
Show file tree
Hide file tree
Showing 12 changed files with 1,317 additions and 140 deletions.
12 changes: 11 additions & 1 deletion desmume/src/cheatSystem.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2009-2023 DeSmuME team
Copyright (C) 2009-2024 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
Expand Down Expand Up @@ -849,6 +849,16 @@ bool CHEATS::remove(const size_t pos)
return didRemoveItem;
}

void CHEATS::toggle(bool enabled, const size_t pos)
{
this->_list[pos].enabled = (enabled) ? 1 : 0;
}

void CHEATS::toggle(u8 enabled, const size_t pos)
{
this->toggle((enabled != 0), pos);
}

void CHEATS::getListReset()
{
this->_currentGet = 0;
Expand Down
5 changes: 4 additions & 1 deletion desmume/src/cheatSystem.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2009-2023 DeSmuME team
Copyright (C) 2009-2024 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
Expand Down Expand Up @@ -120,6 +120,9 @@ class CHEATS

bool remove(const size_t pos);

void toggle(bool enabled, const size_t pos);
void toggle(u8 enablbed, const size_t pos);

void getListReset();
bool getList(CHEATS_LIST *cheat);
CHEATS_LIST* getListPtr();
Expand Down
1 change: 1 addition & 0 deletions desmume/src/frontend/posix/gtk/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ desmume_SOURCES = \
desmume.h desmume.cpp \
dTool.h dToolsList.cpp \
tools/ioregsView.cpp tools/ioregsView.h \
utilsGTK.h utilsGTK.cpp \
cheatsGTK.h cheatsGTK.cpp \
main.cpp main.h

Expand Down
Loading

0 comments on commit efdd938

Please sign in to comment.