Page 1 of 1
How can I convert old cheat format?
Posted: Mon Oct 03, 2005 6:14 pm
by Dark Helmet
Hi all

I have a little stupid question. Why in some cheat file of Ultimate patchers the lines start with a colon? For example:
Code: Select all
:apparel:00000001:F406:00000031:FFFFFFFF:1UP Winning hand (01/14-T)
Thank you in advance.
Posted: Tue Oct 04, 2005 4:56 am
by ianpatt
Starting a cheat line with a colon makes that cheat use the new format, which is more flexible but also takes more space.
Posted: Tue Oct 04, 2005 10:18 am
by Dark Helmet
How is the conversion between new and old format?
Posted: Wed Oct 05, 2005 9:13 am
by Dark Helmet
Excuse me the double post, but I want to do a little program that updates cheat.dat automatically... I must know how to convert old cheat format. Can you give me a link to an help, an old discussion, everythink?
Posted: Wed Oct 05, 2005 4:57 pm
by Pugsy
I have a program to convert from old type to new type, but AFAIK it was never released publically. To convert old type to new type is fairly straight forward anyway (just look at the structure in the cheat.c file or the cheat.dat file). The question is why bother the old cheat format still works in the new cheat engine and keeping old-type cheats as is allows some backward compatability with older MAME builds and will keep the cheat file smaller too.
Posted: Wed Oct 05, 2005 7:13 pm
by Dark Helmet
Well, I searched in cheat.c and I fouded this:
Conversion Table:
MSB LSB
33222222 22221111 11111100 0000 0000
10987654 32109876 54321098 7654 3210
000xxxxx 00000000 00000000 0000 0000 000
000xxxxx 00000000 00000000 0000 0001 001
000xxxxx 00000000 00000000 0010 0000 002
000xxxxx 00000000 00000000 0100 0000 003
000xxxxx 00000000 00000000 1010 0000 004
000xxxxx 00000000 00000000 0010 0010 005
000xxxxx 00000000 00000000 0100 0010 006
000xxxxx 00000000 00000000 1010 0010 007
000xxxxx 00000000 00000000 0010 0100 008
000xxxxx 00000000 00000000 0100 0100 009
000xxxxx 00000000 00000000 0110 0100 010
000xxxxx 00000000 00000000 1000 0100 011
000xxxxx 00000000 00000000 0010 0011 015
000xxxxx 00000000 00000000 0100 0011 016
000xxxxx 00000000 00000000 1010 0011 017
000xxxxx 00000000 00000000 0000 0000 020 (mask used)
000xxxxx 00000000 00000000 0000 0001 021 (mask used)
000xxxxx 00000000 00000000 0010 0000 022 (mask used)
000xxxxx 00000000 00000000 0100 0000 023 (mask used)
000xxxxx 00000000 00000000 1010 0000 024 (mask used)
000xxxxx 00000000 00000000 0000 0000 040 (mask used)
000xxxxx 00000000 00000000 0000 0001 041 (mask used)
000xxxxx 00000000 00000000 0010 0000 042 (mask used)
000xxxxx 00000000 00000000 0100 0000 043 (mask used)
000xxxxx 00000000 00000000 1010 0000 044 (mask used)
000xxxxx 00000000 00000001 0000 0011 060
000xxxxx 00000000 00000011 0000 0011 061
000xxxxx 00000000 00000101 0000 0011 062
000xxxxx 00000000 00001001 0000 0011 063
000xxxxx 00000000 00001011 0000 0011 064
000xxxxx 00000000 00001101 0000 0011 065
000xxxxx 00000000 00000001 0000 0001 070
000xxxxx 00000000 00000011 0000 0001 071
000xxxxx 00000000 00000101 0000 0001 072
000xxxxx 00000000 00001001 0000 0001 073
000xxxxx 00000000 00001011 0000 0001 074
000xxxxx 00000000 00001101 0000 0001 075
000xxxxx 00000000 00000000 0000 0011 080
000xxxxx 00000000 00000010 0000 0011 081
000xxxxx 00000000 00000100 0000 0011 082
000xxxxx 00000000 00001000 0000 0011 083
000xxxxx 00000000 00001010 0000 0011 084
000xxxxx 00000000 00001100 0000 0011 085
000xxxxx 00000000 00000000 0000 0001 090
000xxxxx 00000000 00000010 0000 0001 091
000xxxxx 00000000 00000100 0000 0001 092
000xxxxx 00000000 00001000 0000 0001 093
000xxxxx 00000000 00001010 0000 0001 094
000xxxxx 00000000 00001100 0000 0001 095
001xxxxx 10000000 00000000 0000 0000 100
001xxxxx 00000000 00000000 0000 0001 101
001xxxxx 10000000 00000000 0000 0000 102
001xxxxx 00000000 00000000 0000 0001 103
010xxxxx 10000000 00000000 0000 0000 110
010xxxxx 00000000 00000000 0000 0001 111
010xxxxx 10000000 00000000 0000 0000 112
010xxxxx 00000000 00000000 0000 0001 113
01100011 00000000 00000000 0000 0001 120
01100011 00000000 00000000 0000 0001 121 (mask used)
01100011 00000000 00000000 0000 0001 122 (mask used)
00000000 00000001 00000000 0000 0000 5xx
000xxxxx 00000000 00000000 0000 0110 998
01100000 00000000 00000000 0000 0000 999
I think the last three numbers is Cheat Type. But why the conversion table contains only zero and one? And what does means:
MSB LSB
33222222 22221111 11111100 0000 0000
10987654 32109876 54321098 7654 3210
?
Posted: Wed Oct 05, 2005 9:58 pm
by ianpatt
The conversion table lists the new type field as a bitfield. The header at the top is just a list of the bit indices; it's useful if you need to find a bit quickly without counting each one.
Take a look at ConvertOldCode in cheat.c; it's the internal function that's used to convert old-style cheats to the new format. Pass it the old cheat type in 'code', the target cpu in 'cpu', and it will write out the new cheat type field and extended data field in the ints pointed to by the 'data' and 'extendData' pointers.
Posted: Thu Oct 06, 2005 2:21 pm
by Dark Helmet
ianpatt wrote:Take a look at ConvertOldCode in cheat.c; it's the internal function that's used to convert old-style cheats to the new format. Pass it the old cheat type in 'code', the target cpu in 'cpu', and it will write out the new cheat type field and extended data field in the ints pointed to by the 'data' and 'extendData' pointers.
Very well

But the address field? Does it not change from the old to the new format?
Posted: Thu Oct 06, 2005 10:10 pm
by ianpatt
Those are the only fields that are changed. Take a look at LoadCheatFile and how ConvertOldCode is called.
Posted: Fri Oct 07, 2005 9:45 am
by Dark Helmet
Thank you very much
