We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
User:GimmickCellar/RetroArch Cheats
Jump to navigation
Jump to search
RetroArch Cheats are used to modify the currently running game's state.
Why is this an article here?
Well, first, let me explain what they are made up of. Each cheat can do the following:
- Set a specific address to a specific value.
- Increase the value of the specific address by a value.
- Decrease the value of the specific address by a value.
- Run the next cheat only if the specific address is equal to a value.
- Run the next cheat only if the specific address is NOT equal to a value.
- Run the next cheat only if the specific address is less than a value.
- Run the next cheat only if the specific address is greater than a value.
These are seven total "instructions". An assembly-like syntax will be used:
set address,value # Set inc address,value # Increment dec address,value # Decrement rie address,value # Run If Equal rne address,value # Run Not Equal ril address,value # Run If Less rig address,value # Run If Greater
Examples
Python Generator for Rule 110 as a CHT (load the output in RetroArch)
L=range
def C(num_cells):
H='rie';G=num_cells;F='set';J=0;M=G;I=G*2;R={F:'1','inc':'2','dec':'3',H:'4','ril':'6','rig':'7'};C=[]
for D in L(G):C.append((F,M+D,0,f"init_n{D}"))
S=[(1,1,0),(1,0,1),(0,1,1),(0,1,0),(0,0,1)] # Change this to change what conditions make a 1 (left,center,right)
for D in L(G):
T=(D-1+G)%G;U=(D+1)%G;V=J+T;K=J+D;W=J+U;N=M+D
for(O,P,Q)in S:E=f"c{D}_p{O}{P}{Q}";C.append((F,I,0,f"{E}_init_t"));C.append((H,V,O,f"{E}_chk_l"));C.append((F,I,1,f"{E}_set_t1"));X=1-P;C.append((H,K,X,f"{E}_chk_c"));C.append((F,I,0,f"{E}_rst_t_c"));Y=1-Q;C.append((H,W,Y,f"{E}_chk_r"));C.append((F,I,0,f"{E}_rst_t_r"));C.append((H,I,1,f"{E}_chk_t"));C.append((F,N,1,f"{E}_set_n1"))
for D in L(G):K=J+D;N=M+D;C.append((F,K,0,f"copy_c{D}_clear"));C.append((H,N,1,f"copy_c{D}_check"));C.append((F,K,1,f"copy_c{D}_set"))
A=[]
for(B,(Z,a,b,c))in enumerate(C):A.append(f'cheat{B}_address = "{a}"');A.append(f'cheat{B}_address_bit_position = "0"');A.append(f'cheat{B}_big_endian = "false"');A.append(f'cheat{B}_cheat_type = "{R[Z]}"');A.append(f'cheat{B}_code = ""');A.append(f'cheat{B}_desc = "{c}"');A.append(f'cheat{B}_enable = "true"');A.append(f'cheat{B}_handler = "1"');A.append(f'cheat{B}_memory_search_size = "3"');A.append(f'cheat{B}_repeat_add_to_address = "1"');A.append(f'cheat{B}_repeat_add_to_value = "0"');A.append(f'cheat{B}_repeat_count = "1"');A.append(f'cheat{B}_rumble_port = "0"');A.append(f'cheat{B}_rumble_primary_duration = "0"');A.append(f'cheat{B}_rumble_primary_strength = "0"');A.append(f'cheat{B}_rumble_secondary_duration = "0"');A.append(f'cheat{B}_rumble_secondary_strength = "0"');A.append(f'cheat{B}_rumble_type = "0"');A.append(f'cheat{B}_rumble_value = "0"');A.append(f'cheat{B}_value = "{b}"')
A.append(f'cheats = "{len(C)}"');return'\n'.join(A)
A=15 # Change this variable to change the number of cells
D=C(A)
B=f"rule110_{A}_cells.cht"
with open(B,'w')as E:E.write(D)
print(f"saved to '{B}', now open in retroarch")
Interpreters/Implementations
- RetroArch, obviously.
- Libretro, same thing.
Known Issues
If you have more than 6,000 cheats, the rest do not work, as they leak into other parts of the settings.