1*e221c09eSPhilippe Houdoin 2*e221c09eSPhilippe Houdoin// "what" code should default to 0. 3*e221c09eSPhilippe Houdoinresource(401) message { "field1" = "value1" }; 4*e221c09eSPhilippe Houdoin 5*e221c09eSPhilippe Houdoin// Fields with casts, type codes, and nested compound data. 6*e221c09eSPhilippe Houdoinresource(402) message(1000) 7*e221c09eSPhilippe Houdoin{ 8*e221c09eSPhilippe Houdoin "small1" = (int8) 257, // 1 9*e221c09eSPhilippe Houdoin int8 "small2" = 257, // 1 10*e221c09eSPhilippe Houdoin int8 "small3" = (int8) 257, // 1 11*e221c09eSPhilippe Houdoin uint8 "small4" = (int8) -1, // (uint8)255 12*e221c09eSPhilippe Houdoin int8 "small5" = (uint8) -1, // -1 13*e221c09eSPhilippe Houdoin int8 "small6" = (int8) -1, // -1 14*e221c09eSPhilippe Houdoin uint8 "small7" = (uint8) -1, // (uint8)255 15*e221c09eSPhilippe Houdoin 16*e221c09eSPhilippe Houdoin "large1" = (int64) 3, 17*e221c09eSPhilippe Houdoin int64 "large2" = 3, 18*e221c09eSPhilippe Houdoin int64 "large3" = (int32) 3, 19*e221c09eSPhilippe Houdoin int32 "large4" = (int64) 3, 20*e221c09eSPhilippe Houdoin 21*e221c09eSPhilippe Houdoin "string1" = "some text", 22*e221c09eSPhilippe Houdoin// string "string2" = 123, // invalid cast 23*e221c09eSPhilippe Houdoin// int32 "string3" = "text", // invalid cast 24*e221c09eSPhilippe Houdoin 25*e221c09eSPhilippe Houdoin #'BYTE' "typecode1" = 1234, // does not become "(int8)-46" 26*e221c09eSPhilippe Houdoin #'blah' int16 "typecode2" = 1234, // becomes 16-bit, but raw encoded 27*e221c09eSPhilippe Houdoin 28*e221c09eSPhilippe Houdoin "array1" = array { $"40", $"41" }, 29*e221c09eSPhilippe Houdoin buffer "array2" = array { $"50" $"51" }, 30*e221c09eSPhilippe Houdoin raw "array3" = array { "w00t", "dude" }, 31*e221c09eSPhilippe Houdoin array "array4" = array { "w00t", 1234 }, 32*e221c09eSPhilippe Houdoin array "array5" = (array) array { "w00t", 1234 }, 33*e221c09eSPhilippe Houdoin //raw "array3" = { "w00t", "dude" }, // syntax error 34*e221c09eSPhilippe Houdoin 35*e221c09eSPhilippe Houdoin "msg1" = message { "field" = "value" }, 36*e221c09eSPhilippe Houdoin message "msg2" = message(2000) { "field" = "value" }, 37*e221c09eSPhilippe Houdoin message "msg3" = (message) message(2000) { "field" = "value" }, 38*e221c09eSPhilippe Houdoin #'blah' message "msg4" = message { "field" = "value" } 39*e221c09eSPhilippe Houdoin// ,message(2000) "msg5" = message(2000) { "fld" = "val" } // not supported 40*e221c09eSPhilippe Houdoin}; 41*e221c09eSPhilippe Houdoin 42*e221c09eSPhilippe Houdoin// "Arrays" of fields, i.e. multiple fields with the same name. 43*e221c09eSPhilippe Houdoinresource(403) message('blah') 44*e221c09eSPhilippe Houdoin{ 45*e221c09eSPhilippe Houdoin "integer" = 1, 46*e221c09eSPhilippe Houdoin "integer" = 3, 47*e221c09eSPhilippe Houdoin "integer" = 2 48*e221c09eSPhilippe Houdoin// ,"integer" = "hi there" // type conflict 49*e221c09eSPhilippe Houdoin}; 50*e221c09eSPhilippe Houdoin 51*e221c09eSPhilippe Houdoin// Tests whether the decompiler correctly outputs nested messages. 52*e221c09eSPhilippe Houdoinresource(404) message('blah') 53*e221c09eSPhilippe Houdoin{ 54*e221c09eSPhilippe Houdoin "sub1" = message('bla1') { "string1" = "value1" }, 55*e221c09eSPhilippe Houdoin "sub1" = message('bla2') { "string2" = "value2" }, 56*e221c09eSPhilippe Houdoin "sub1" = message('bla2') { "string2" = "value2", "string3" = "value3" }, 57*e221c09eSPhilippe Houdoin "SomeField" = 2, 58*e221c09eSPhilippe Houdoin "sub2" = message('bla3') { "string3" = "value3" } 59*e221c09eSPhilippe Houdoin}; 60*e221c09eSPhilippe Houdoin 61*e221c09eSPhilippe Houdoin// Another comma test for the decompiler. 62*e221c09eSPhilippe Houdoinresource(405) #'w00t' message('blah') 63*e221c09eSPhilippe Houdoin{ 64*e221c09eSPhilippe Houdoin "integer1" = 1, 65*e221c09eSPhilippe Houdoin "sub" = message { "string1" = "woot1" }, 66*e221c09eSPhilippe Houdoin "integer2" = 2 67*e221c09eSPhilippe Houdoin}; 68*e221c09eSPhilippe Houdoin 69*e221c09eSPhilippe Houdoin// The decompiler should still recognize this as a message. 70*e221c09eSPhilippe Houdoinresource(406) #'RAWT' message { "field" = "value" }; 71*e221c09eSPhilippe Houdoin 72*e221c09eSPhilippe Houdoin//resource(407) (int32) message { "field" = "value" }; // invalid cast 73*e221c09eSPhilippe Houdoin//resource(407) (buffer) message { "field" = "value" }; // invalid cast 74*e221c09eSPhilippe Houdoin 75*e221c09eSPhilippe Houdoin// beres allows you to specify a what code inside the cast, 76*e221c09eSPhilippe Houdoin// but we don't (beres ignores it anyway): 77*e221c09eSPhilippe Houdoin//resource(407) (message('blah')) message { "field" = "value"; } 78*e221c09eSPhilippe Houdoin 79*e221c09eSPhilippe Houdoin// Decompiler turns the very long string into an array. 80*e221c09eSPhilippe Houdoinresource(408) message 81*e221c09eSPhilippe Houdoin{ 82*e221c09eSPhilippe Houdoin "longstring" = "alongstring-alongstringg\000-alongstringg-alongstringg-alongstringgalongstringg-alongstringg-alongstringg-alongstringg-alongstring", 83*e221c09eSPhilippe Houdoin "longarray" = array { $"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabb" }, 84*e221c09eSPhilippe Houdoin #'blah' "longblah" = array { $"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabb" }, 85*e221c09eSPhilippe Houdoin "textarray" = array { "pompiedom" } 86*e221c09eSPhilippe Houdoin}; 87*e221c09eSPhilippe Houdoin 88*e221c09eSPhilippe Houdoin// Note: negative "what" values are allowed, but the decompiler converts 89*e221c09eSPhilippe Houdoin// them to unsigned, just like type codes (which cannot be negative). 90*e221c09eSPhilippe Houdoinresource(409) message(-1) { "field" = "value" }; 91*e221c09eSPhilippe Houdoinresource(410) message(0x80000000) { "field" = "value" }; 92*e221c09eSPhilippe Houdoinresource(411) message(0x7FFFFFFF) { "field" = "value" }; 93*e221c09eSPhilippe Houdoinresource(412) message(-100001) { "field" = "value" }; 94*e221c09eSPhilippe Houdoinresource(413) #100001 message(-100001) { "field" = "value" }; 95*e221c09eSPhilippe Houdoin//resource(414) #-100001 message { "f" = "v" }; // syntax error 96*e221c09eSPhilippe Houdoin 97*e221c09eSPhilippe Houdoinresource(415) message { }; 98*e221c09eSPhilippe Houdoinresource(416) message; 99*e221c09eSPhilippe Houdoinresource(417) message('blah') { }; 100*e221c09eSPhilippe Houdoinresource(418) message('blah'); 101*e221c09eSPhilippe Houdoin 102*e221c09eSPhilippe Houdoin// Decompiles to an empty message. 103*e221c09eSPhilippe Houdoinresource(419) $"31424F460100001212000000000000000100"; 104*e221c09eSPhilippe Houdoin 105*e221c09eSPhilippe Houdoinresource(420) message('blah') { 106*e221c09eSPhilippe Houdoin "sub" = message('bla1') { "string1" = "woot1" }, 107*e221c09eSPhilippe Houdoin "sub" = message('bla2') { "string2" = "woot2" }, 108*e221c09eSPhilippe Houdoin int8 "small integer" = 1, 109*e221c09eSPhilippe Houdoin "integer" = 2, 110*e221c09eSPhilippe Houdoin "integer" = 3, 111*e221c09eSPhilippe Houdoin "large integer" = (int64)3, 112*e221c09eSPhilippe Houdoin "string" = "some text", 113*e221c09eSPhilippe Houdoin "sub2" = message('bla3') { "string3" = "woot3" } 114*e221c09eSPhilippe Houdoin}; 115*e221c09eSPhilippe Houdoin 116*e221c09eSPhilippe Houdoinresource(421) #'w00t' message('blah') { 117*e221c09eSPhilippe Houdoin "integer1" = 1, 118*e221c09eSPhilippe Houdoin "sub" = message('bla1') { "string1" = "woot1" }, 119*e221c09eSPhilippe Houdoin "integer2" = 2 120*e221c09eSPhilippe Houdoin}; 121*e221c09eSPhilippe Houdoin 122*e221c09eSPhilippe Houdoin//------------------------------------------------------------------------------ 123*e221c09eSPhilippe Houdoin 124*e221c09eSPhilippe Houdoinresource(701) #'BBMP' archive BSomeClass { "data" = 123 }; 125*e221c09eSPhilippe Houdoinresource(702) archive BSomeClass { "data" = 123 }; 126*e221c09eSPhilippe Houdoinresource(703) archive("dynamic", 'blah') BSomeClass { "data" = 123 }; 127*e221c09eSPhilippe Houdoinresource(704) archive("dynamic") BSomeClass { "data" = 123 }; 128*e221c09eSPhilippe Houdoinresource(705) archive(, 200) BSomeClass { "data" = 123 }; 129*e221c09eSPhilippe Houdoinresource(706) (archive BSomeClass) archive BSomeClass { "data" = 123 }; 130*e221c09eSPhilippe Houdoinresource(707) archive(, -1) BSomeClass { "data" = 123 }; 131*e221c09eSPhilippe Houdoinresource(700) archive BSomeClass { "" = $"" }; // empty archive trick 132*e221c09eSPhilippe Houdoin 133*e221c09eSPhilippe Houdoin// When you cast an archive to a message, beres strips the 134*e221c09eSPhilippe Houdoin// "class" field from the message (so it will no longer be 135*e221c09eSPhilippe Houdoin// recognized as an archive), but we don't. 136*e221c09eSPhilippe Houdoinresource(708) (message) archive BSomeClass { "data" = 123 }; 137*e221c09eSPhilippe Houdoin 138*e221c09eSPhilippe Houdoin// beres allows you to specify the add_on name and what code 139*e221c09eSPhilippe Houdoin// inside the cast, but we don't (beres ignores it anyway). 140*e221c09eSPhilippe Houdoin//resource(709) (archive("t", 1) BSomeClass) archive BSomeClass { "d" = 123 }; 141*e221c09eSPhilippe Houdoin 142*e221c09eSPhilippe Houdoin//resource(709) (archive) archive BSomeClass { "d" = 123 }; // syntax error 143*e221c09eSPhilippe Houdoin//resource(709) archive("dynamic",) BSomeClass { "d" = 123 }; // syntax error 144*e221c09eSPhilippe Houdoin 145*e221c09eSPhilippe Houdoin//------------------------------------------------------------------------------ 146*e221c09eSPhilippe Houdoin 147*e221c09eSPhilippe Houdoinenum { 148*e221c09eSPhilippe Houdoin R_BBMP_kLargeNewGroupIcon = 516, 149*e221c09eSPhilippe Houdoin R_BBMP_kSmallNewGroupIcon = 517, 150*e221c09eSPhilippe Houdoin}; 151*e221c09eSPhilippe Houdoin 152*e221c09eSPhilippe Houdoinresource(R_BBMP_kLargeNewGroupIcon) #'BBMP' archive BBitmap { 153*e221c09eSPhilippe Houdoin "_frame" = rect { 0.0, 0.0, 31.0, 31.0 }, 154*e221c09eSPhilippe Houdoin "_cspace" = 4, 155*e221c09eSPhilippe Houdoin "_bmflags" = 1, 156*e221c09eSPhilippe Houdoin "_rowbytes" = 32, 157*e221c09eSPhilippe Houdoin "_data" = array { 158*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 159*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 160*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFF00FAFA0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 161*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFF00FAF8FAFA0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 162*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFF000000FAF8F8F8FAFA0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 163*e221c09eSPhilippe Houdoin $"FFFFFFFFFF00FAFA0000F8F8F8F8F8FAFA00FFFFFFFFFFFFFFFFFFFFFFFFFFFF" 164*e221c09eSPhilippe Houdoin $"FFFFFFFFFF00FAF8FAFA0000F8F8F8F8F800FFFFFFFFFFFFFFFFFFFFFFFFFFFF" 165*e221c09eSPhilippe Houdoin $"FFFFFFFFFF00FAF8F8F8FAFA0000F8F8F800FFFFFFFFFFFFFFFFFFFFFFFFFFFF" 166*e221c09eSPhilippe Houdoin $"FFFFFFFFFF00FAF8F8F8F8F8FAFA00F8F80000FFFFFFFFFFFFFFFFFFFFFFFFFF" 167*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001BF8F8F8F8F8F8F8000E0F1C1C0000FFFFFFFFFFFFFFFFFFFFFF" 168*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F0F0FF8F8F8F8003F3F0E0F1C1C0000FFFFFFFFFFFFFFFFFF" 169*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F0E0FF8F800003F3F3F0E0F1C1C0000FFFFFFFFFFFFFF" 170*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F0E0F1C1C00003F3F3F0E0F1A190000FFFFFFFFFF" 171*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F0E0F1C1C00003F3F3F0E1A1900FFFFFFFFFF" 172*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F3F3F0E0F1C1C00003F3F171900FFFFFFFFFF" 173*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F3F3F3F3F0E0F1A190000171900FFFFFFFFFF" 174*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F3F3F3F3F3F3F0E1A1900171900FFFFFFFFFF" 175*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F3F3F3F3F3F3F3F171900171900FFFFFFFFFF" 176*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F3F3F3F3F3F3F3F171900171900FFFFFFFFFF" 177*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B0F3F3F3F3F3F3F3F3F3F3F3F3F3F171900171900FFFFFFFFFF" 178*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B183F3F3F3F3F3F3F3F3F3F3F3F3F171900171900FFFFFFFFFF" 179*e221c09eSPhilippe Houdoin $"FFFFFFFFFF001B1C17183F3F3F3F3F3F3F3F3F3F3F171900171900FFFFFFFFFF" 180*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFF00001B1C17183F3F3F3F3F3F3F3F3F171900171900FFFFFFFFFF" 181*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFF0000191A17173F3F3F3F3F3F3F171900171900FFFFFFFFFF" 182*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFF0000191A17173F3F3F3F3F171900171A00FFFFFFFFFF" 183*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFF0000191A17173F3F3F1719001A1900FFFFFFFFFF" 184*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000191A17173F171900001900FFFFFFFFFF" 185*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000191A17171A00FF0000FFFFFFFFFF" 186*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000191A1900FFFFFFFFFFFFFFFF" 187*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00001900FFFFFFFFFFFFFFFF" 188*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF" 189*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 190*e221c09eSPhilippe Houdoin } 191*e221c09eSPhilippe Houdoin}; 192*e221c09eSPhilippe Houdoin 193*e221c09eSPhilippe Houdoinresource(R_BBMP_kSmallNewGroupIcon) #'BBMP' archive BBitmap { 194*e221c09eSPhilippe Houdoin "_frame" = rect { 0.0, 0.0, 15.0, 15.0 }, 195*e221c09eSPhilippe Houdoin "_cspace" = 4, 196*e221c09eSPhilippe Houdoin "_bmflags" = 1, 197*e221c09eSPhilippe Houdoin "_rowbytes" = 16, 198*e221c09eSPhilippe Houdoin "_data" = array { 199*e221c09eSPhilippe Houdoin $"FFFFFFFF0E0EFFFFFFFFFFFFFFFFFFFFFFFFFF0EFAFA0E0EFFFFFFFFFFFFFFFF" 200*e221c09eSPhilippe Houdoin $"FFFF0E0EF8F8FAFA0EFFFFFFFFFFFFFFFFFF0EFAFA0EF8F80EFFFFFFFFFFFFFF" 201*e221c09eSPhilippe Houdoin $"FFFF0EF8F8FAFA0E0E0EFFFFFFFFFFFFFFFF0E1818F8F80E3F3F0E0EFFFFFFFF" 202*e221c09eSPhilippe Houdoin $"FFFF0E183F18180F0F3F3F0E12FFFFFFFFFF0E183F3F3F18180F0F0E12FFFFFF" 203*e221c09eSPhilippe Houdoin $"FFFF0E183F3F3F3F3F18180E12FFFFFFFFFF0E183F3F3F3F3F3F1C0E12FFFFFF" 204*e221c09eSPhilippe Houdoin $"FFFF0E0E181C3F3F3F3F1C0E12FFFFFFFFFFFFFF0E0E171C3F3F1C0E12FFFFFF" 205*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFF0E0E171C1C0E12FFFFFFFFFFFFFFFFFFFFFF0E0E170E12FFFFFF" 206*e221c09eSPhilippe Houdoin $"FFFFFFFFFFFFFFFFFFFF0E0EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 207*e221c09eSPhilippe Houdoin } 208*e221c09eSPhilippe Houdoin}; 209