Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux - GTK3/GTK2] Action Replay code menu (+ other cheat menu improvements) #847

Merged
merged 11 commits into from
Oct 25, 2024
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo. do we really need an overloaded func for this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not, but the entire cheatSystem overloaded enabled this way: add L99-100, update L103-104, add_AR L109-110, etc. I followed suit, assuming there was a design reason behind it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then it's probably fine.


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