Jump to content

Ruby/Saphire Berry Glitch Fix Zigzagoon Legality


Sabresite

Recommended Posts

Recently I have been finding out more about the Ruby/Saphire Berry Glitch Zigzagoons. It uses the restricted uncommon gba event (ABDE), where every seed seems to be below 0xFFFF.

Currently I have identified that the lower part of the PID actually does not utilize the B call to the RNG, however does conform to (A ^ ( TID ^ SID ) ) which ensures that it is shiny. However to keep the genders proper (female for ruby, and male for sapphire), there are more alterations done to the PID.

I do not have a significant number of test zagoons to check, however it is possible that the high PID and low PID are altered (similar to chain shinies) in a way that would ensure the gender as well.

I will bring everyone more info as I get it. If anyone is interested in helping, simply email your berry glitch zigzagoons to sabresite [a@t] projectpokemon.org and please make sure the zigs are 100% legit.

Link to comment
Share on other sites

Thanks to McFizzle and GodZilla, who brought me unique zigzagoons, here is a partial compilation of the Seed acquisition of the RESTRICTED UNCOMMON GBA EVENT pokemon.

030317 = USA

21121 = JAP

It seems that there "can" be an extra step between the SEED, and generating the PID. I don't know what this depends on, so more research will need to be done. In this you can clearly see the IVs and PID, while going backwards in the random number generation.

Some of the high PID numbers and calculated shiny low PID are off, this is due to an unknown variable causing it to shift. More analysis should reveal how it has been shifted once we acquire more to test.

Edited by Sabresite
Link to comment
Share on other sites

According to some tests, if the PID that is calculated does not match the required gender, it will modify the low PID and then modify the high pid to compensate.

This is a postulate to how this works, and with my single pair to test from, so far so good:

calc_lowpid = highpid ^ tid ^ sid

new_lowpid = calc_lowpid - ( calc_lowpid % 256 ) + ( female ? 1 : 384 )

new_highpid = new_lowpid ^ tid ^ sid

the new_lowpid and calc_lowpid both utilize an extra step, which modifies the lowest bit, meaning it can be anything. This can easily be accounted for in calculations, if necessary.

Link to comment
Share on other sites

I have refined the calculation and finalized the first scenario. This is the scenario where the gender of the lowpid matches that of what it is supposed to be. I haven't figured out a way of determining what the gender should be without using the original PID that we are checking against (which assumes that it is legit).

1 - 21121 - Female
IVs 1:		A211 DF42
IVs 2:		15E6 0CAB
Found Variance:	FD2C 5A18
Found Unknown:	0EC0 F519
Found High PID:	5A65 077E (PID: 5A800806)
Found SEED:	0000 0057
Low PID:	0806 - Var:	7
Calc Low PID:	08E4 - Calc:	0
Conflict Low PID:	0806 - Var: 7
Conflict High PID:	5A80


2 - 21121 - Male
IVs 1:		DF2E 068B
IVs 2:		4BD2 8F78
Found Variance:	7BB3 23F9
Found Unknown:	C6D9 25DE
Found High PID:	9512 1C37 (PID: 9512C793)
Found SEED:	0000 0054
Low PID:	C793 - Var:	0
Calc Low PID:	C793 - Calc:	0


3 - 21121 - Male
IVs 1:		ED7D 775C
IVs 2:		B2C2 ECED
Found Variance:	0DDF 6A22
Found Unknown:	E859 770B
Found High PID:	16BB 71F8 (PID: 17014584)
Found SEED:	0000 0079
Low PID:	4584 - Var:	4
Calc Low PID:	443F - Calc:	5
Conflict Low PID:	4584 - Var: 4
Conflict High PID:	1701


4 - 30317 - Female
IVs 1:		1F0A 3BC9
IVs 2:		C061 7AEE
Found Variance:	8681 5B87
Found Unknown:	80D2 6AE4
Found High PID:	3C1C D995 (PID: 3C1C4A71)
Found SEED:	0000 006A
Low PID:	4A71 - Var:	0
Calc Low PID:	4A71 - Calc:	0


5 - 30317 - Male
IVs 1:		B670 9705
IVs 2:		27DF 8D9A
Found Variance:	7CAE 9D63
Found Unknown:	4C1E 5AB0
Found High PID:	189E B911 (PID: 189E6EF6)
Found SEED:	0000 0056
Low PID:	6EF6 - Var:	5
Calc Low PID:	6EF6 - Calc:	5


6 - 30317 - Female
IVs 1:		B3B0 8910
IVs 2:		E93D 24F1
Found Variance:	F067 2FB6
Found Unknown:	4A3D 466F
Found High PID:	AC41 106C (PID: AC41DA2F)
Found SEED:	0000 003D
Low PID:	DA2F - Var:	3
Calc Low PID:	DA2F - Calc:	3


7 - 30317 - Male
IVs 1:		1BBB 02CC
IVs 2:		53FA C01D
Found Variance:	2572 CC12
Found Unknown:	66D6 6ABB
Found High PID:	6BEA 2668 (PID: 6BEA1D82)
Found SEED:	0000 00A9
Low PID:	1D82 - Var:	5
Calc Low PID:	1D82 - Calc:	5


8 - 30317 - Female
IVs 1:		7085 1AD5
IVs 2:		0847 7EAA
Found Variance:	848A 68B3
Found Unknown:	7648 0140
Found High PID:	3503 9FE1 (PID: 3503436A)
Found SEED:	0000 0066
Low PID:	436A - Var:	4
Calc Low PID:	436A - Calc:	4


9 - 30317 - Male
IVs 1:		F0CC B059
IVs 2:		1F29 A7BE
Found Variance:	6EED F997
Found Unknown:	0255 7734
Found High PID:	E6EE 2525 (PID: E6EE9085)
Found SEED:	0000 003A
Low PID:	9085 - Var:	6
Calc Low PID:	9085 - Calc:	6


10 - 30317 - Female
IVs 1:		163A E6E2
IVs 2:		D6B5 EECB
Found Variance:	0CE3 F0B8
Found Unknown:	6314 4239
Found High PID:	932E D51E (PID: 932EE543)
Found SEED:	0000 0077
Low PID:	E543 - Var:	0
Calc Low PID:	E543 - Calc:	0


11 - 30317 - Female
IVs 1:		D65E B1A4
IVs 2:		6227 0355
Found Variance:	0215 B92A
Found Unknown:	A91A FD33
Found High PID:	EC24 17C0 (PID: EC249A4D)
Found SEED:	0000 0061
Low PID:	9A4D - Var:	4
Calc Low PID:	9A4D - Calc:	4


12 - 30317 - Male
IVs 1:		D30F 78A7
IVs 2:		F5C0 4884
Found Variance:	A107 29B5
Found Unknown:	8F1E FD0A
Found High PID:	1BF1 6493 (PID: 1BF16D9F)
Found SEED:	0000 00A0
Low PID:	6D9F - Var:	3
Calc Low PID:	6D9F - Calc:	3


13 - 30317 - Male
IVs 1:		3EF8 5668
IVs 2:		FAA8 F0A9
Found Variance:	0BE8 774E
Found Unknown:	DDCF 0D67
Found High PID:	0FA2 3844 (PID: FA279C8)
Found SEED:	0000 0075
Low PID:	79C8 - Var:	7
Calc Low PID:	79C8 - Calc:	7


14 - 30317 - Female
IVs 1:		9942 8A5B
IVs 2:		2C3A 8088
Found Variance:	838E EF49
Found Unknown:	F102 CC6E
Found High PID:	B177 0307 (PID: B177C71E)
Found SEED:	0000 0064
Low PID:	C71E - Var:	4
Calc Low PID:	C71E - Calc:	4


15 - 30317 - Male
IVs 1:		1BBB 02CC
IVs 2:		53FA C01D
Found Variance:	2572 CC12
Found Unknown:	66D6 6ABB
Found High PID:	6BEA 2668 (PID: 6BEA1D82)
Found SEED:	0000 00A9
Low PID:	1D82 - Var:	5
Calc Low PID:	1D82 - Calc:	5


16 - 30317 - Male
IVs 1:		87A3 E08D
IVs 2:		58E3 6842
Found Variance:	9054 19AB
Found Unknown:	B586 7B18
Found High PID:	5F9A FA19 (PID: 5F9A29F4)
Found SEED:	0000 007E
Low PID:	29F4 - Var:	3
Calc Low PID:	29F4 - Calc:	3


17 - 30317 - Female
IVs 1:		3C38 4873
IVs 2:		BC06 8800
Found Variance:	7FA1 09A1
Found Unknown:	DBED F926
Found High PID:	A344 8F9F (PID: A344D529)
Found SEED:	0000 005C
Low PID:	D529 - Var:	0
Calc Low PID:	D529 - Calc:	0


18 - 30317 - Male
IVs 1:		30A8 E597
IVs 2:		93B8 9334
Found Variance:	79BC 3125
Found Unknown:	BC4E BC3A
Found High PID:	8DF8 E283 (PID: 8DF8FB94)
Found SEED:	0000 0050
Low PID:	FB94 - Var:	1
Calc Low PID:	FB94 - Calc:	1


19 - 30317 - Female
IVs 1:		DF2E 068B
IVs 2:		4BD2 8F78
Found Variance:	7BB3 23F9
Found Unknown:	C6D9 25DE
Found High PID:	9512 1C37 (PID: 9512E37B)
Found SEED:	0000 0054
Low PID:	E37B - Var:	4
Calc Low PID:	E37B - Calc:	4


20 - 30317 - Male
IVs 1:		9333 4369
IVs 2:		8131 5D0E
Found Variance:	9638 F227
Found Unknown:	D525 B804
Found High PID:	74E6 A735 (PID: 74E60288)
Found SEED:	0000 008A
Low PID:	0288 - Var:	3
Calc Low PID:	0288 - Calc:	3


21 - 30317 - Female
IVs 1:		9EC2 A645
IVs 2:		A97F 51DA
Found Variance:	9C1D CAA3
Found Unknown:	F4C4 F4F0
Found High PID:	8A32 5451 (PID: 8A32FC5D)
Found SEED:	0000 0096
Low PID:	FC5D - Var:	2
Calc Low PID:	FC5D - Calc:	2


22 - 30317 - Male
IVs 1:		7954 6FBC
IVs 2:		F1F3 0ACD
Found Variance:	FE27 D382
Found Unknown:	9406 29EB
Found High PID:	DDF1 A458 (PID: DDF1AB9F)
Found SEED:	0000 0059
Low PID:	AB9F - Var:	3
Calc Low PID:	AB9F - Calc:	3


23 - 30317 - Female
IVs 1:		6726 9AE6
IVs 2:		F0D7 A05F
Found Variance:	3625 DC1C
Found Unknown:	406E ECAD
Found High PID:	2840 90E2 (PID: 28405E2D)
Found SEED:	0000 00CB
Low PID:	5E2D - Var:	0
Calc Low PID:	5E2D - Calc:	0


24 - 30317 - Male
IVs 1:		075C 4B09
IVs 2:		4201 3F2E
Found Variance:	A5F0 88C7
Found Unknown:	2979 0524
Found High PID:	ADB0 74D5 (PID: ADB0DBD8)
Found SEED:	0000 00AA
Low PID:	DBD8 - Var:	5
Calc Low PID:	DBD8 - Calc:	5


25 - 30317 - Female
IVs 1:		BBF0 B2EF
IVs 2:		A524 5EEC
Found Variance:	953D 78BD
Found Unknown:	4FE0 8332
Found High PID:	F15A 0A5B (PID: F15A8735)
Found SEED:	0000 0088
Low PID:	8735 - Var:	2
Calc Low PID:	8735 - Calc:	2


26 - 30317 - Female
IVs 1:		D5CF 869C
IVs 2:		3462 B12D
Found Variance:	2D4E 9762
Found Unknown:	9100 114B
Found High PID:	884F 0D38 (PID: 884FFE26)
Found SEED:	0000 00B9
Low PID:	FE26 - Var:	4
Calc Low PID:	FE26 - Calc:	4


27 - 30317 - Female
IVs 1:		6B04 FEEB
IVs 2:		8B02 AD58
Found Variance:	6BFB 8D59
Found Unknown:	7285 D8BE
Found High PID:	5C48 4E97 (PID: 5C482A23)
Found SEED:	0000 0034
Low PID:	2A23 - Var:	6
Calc Low PID:	2A23 - Calc:	6


28 - 30317 - Male
IVs 1:		A561 183F
IVs 2:		824C C77C
Found Variance:	5E3A E98D
Found Unknown:	28BC F542
Found High PID:	2A97 BAAB (PID: 2A975CFA)
Found SEED:	0000 0018
Low PID:	5CFA - Var:	0
Calc Low PID:	5CFA - Calc:	0


29 - 30317 - Male
IVs 1:		BF3F EBEC
IVs 2:		118B 19BD
Found Variance:	F64C 0832
Found Unknown:	69DC 835B
Found High PID:	C18C BD88 (PID: C18CB7E4)
Found SEED:	0000 0049
Low PID:	B7E4 - Var:	5
Calc Low PID:	B7E4 - Calc:	5


30 - 30317 - Female
IVs 1:		2259 74C6
IVs 2:		2CC8 35BF
Found Variance:	E78F EAFC
Found Unknown:	9ACE 6B0D
Found High PID:	0C4F 8CC2 (PID: C4F7A27)
Found SEED:	0000 002B
Low PID:	7A27 - Var:	5
Calc Low PID:	7A27 - Calc:	5


31 - 30317 - Male
IVs 1:		F99C 0540
IVs 2:		08D5 33E1
Found Variance:	E88B 6466
Found Unknown:	2013 9FDF
Found High PID:	8FDC 299C (PID: 8FDCF9B3)
Found SEED:	0000 002D
Low PID:	F9B3 - Var:	2
Calc Low PID:	F9B3 - Calc:	2


32 - 30317 - Male
IVs 1:		9C91 C358
IVs 2:		98A1 3B59
Found Variance:	E49D 7EBE
Found Unknown:	0AFE CC97
Found High PID:	81A9 B634 (PID: 81A9F7C5)
Found SEED:	0000 0025
Low PID:	F7C5 - Var:	1
Calc Low PID:	F7C5 - Calc:	1


33 - 30317 - Male
IVs 1:		A821 2634
IVs 2:		C0EF 3025
Found Variance:	EA82 573A
Found Unknown:	2A9E 0983
Found High PID:	96F5 6350 (PID: 96F5E09A)
Found SEED:	0000 0031
Low PID:	E09A - Var:	2
Calc Low PID:	E09A - Calc:	2


34 - 30317 - Female
IVs 1:		0DFA BD03
IVs 2:		1ACE B4D0
Found Variance:	680D A7B1
Found Unknown:	5D71 0576
Found High PID:	4E15 DB2F (PID: 4E15387D)
Found SEED:	0000 002C
Low PID:	387D - Var:	5
Calc Low PID:	387D - Calc:	5


35 - 30317 - Male
IVs 1:		DC6D F896
IVs 2:		0D30 26CF
Found Variance:	EF6B B64C
Found Unknown:	C4F8 119D
Found High PID:	28B4 7392 (PID: 28B45EDB)
Found SEED:	0000 003B
Low PID:	5EDB - Var:	2
Calc Low PID:	5EDB - Calc:	2


36 - 30317 - Female
IVs 1:		A211 DF42
IVs 2:		15E6 0CAB
Found Variance:	FD2C 5A18
Found Unknown:	0EC0 F519
Found High PID:	5A65 077E (PID: 5A652C0C)
Found SEED:	0000 0057
Low PID:	2C0C - Var:	4
Calc Low PID:	2C0C - Calc:	4


37 - 30317 - Male
IVs 1:		2DE8 D7A2
IVs 2:		5516 2A8B
Found Variance:	ED74 C378
Found Unknown:	BA6D A7F9
Found High PID:	219B 39DE (PID: 219B57F4)
Found SEED:	0000 0037
Low PID:	57F4 - Var:	2
Calc Low PID:	57F4 - Calc:	2


38 - 30317 - Male
IVs 1:		B9BF D002
IVs 2:		9446 486B
Found Variance:	DDBD 2CD8
Found Unknown:	661A 5AD9
Found High PID:	E8D1 6C3E (PID: E8D19EBD)
Found SEED:	0000 0017
Low PID:	9EBD - Var:	1
Calc Low PID:	9EBD - Calc:	1


39 - 30317 - Male
IVs 1:		6844 F0F6
IVs 2:		4C60 44AF
Found Variance:	DFB4 1FAC
Found Unknown:	70A4 C47D
Found High PID:	EFEA A5F2 (PID: EFEA9984)
Found SEED:	0000 001B
Low PID:	9984 - Var:	3
Calc Low PID:	9984 - Calc:	3

Finished!

As you can see from #6 and #8, sometimes there is an extra step. Until I get more to test, I will have no way of confirming the algorithm for scenario 2, or a way of determining the variance calculation.

Edited by Sabresite
Link to comment
Share on other sites

		public static void ValidateBADEIVs( uint pid, int[] ivs, uint tid, uint sid )
		{
			if ( ( pid % 256 ) < 128 )
				Console.WriteLine( " - Female" );
			else
				Console.WriteLine( "- Male" );

			uint num1 = (uint)((ivs[2] << 0x0A) + (ivs[1] << 0x5) + ivs[0]);
			uint num2 = (uint)((ivs[5] << 0x0A) + (ivs[4] << 0x5) + ivs[3]);
			PokePRNG rand = new PokePRNG();
			List<uint> ids = new List<uint>();
			int nature = -1;
			bool nonature = nature < 0 || nature > 25;
			for ( uint i = 0; i < 2; ++i )
			{
				for ( uint j = 0; j < 0x10000; j++ )
				{
					rand.Seed = (i << 31) + (num2 << 16) + j;
					uint iv1 = rand.Seed;
					uint second = ( rand.SetPrev().Seed >> 0x10 ) & 0x7FFF;
					uint iv2 = rand.Seed;
					if ( second == num1 )
					{
						uint afull = rand.PrevNum(); //Variance
						uint a = rand.HighBits;
						uint bfull = rand.PrevNum(); //Unknown (Gender Check?)
						uint b = rand.HighBits;
						uint cfull = rand.PrevNum(); //High PID
						uint c = rand.HighBits;
						uint dfull = rand.PrevNum(); //Seed
						uint d = rand.HighBits;

						if ( d == 0 && (dfull & 0xFFFF) <= 0xFF )
						{
							Console.WriteLine( "IVs 1:\t\t{0:X4} {1:X4}", iv1 >> 0x10, iv1 & 0xFFFF );
							Console.WriteLine( "IVs 2:\t\t{0:X4} {1:X4}", iv2 >> 0x10, iv2 & 0xFFFF );
							Console.WriteLine( "Found Unknown:\t{0:X4} {1:X4}", a, afull & 0xFFFF );
							Console.WriteLine( "Found Unknown:\t{0:X4} {1:X4}", b, bfull & 0xFFFF );
							Console.WriteLine( "Found High PID:\t{0:X4} {1:X4} (PID: {2:X})", c, cfull & 0xFFFF, pid );
							Console.WriteLine( "Found SEED:\t{0:X4} {1:X4}", d, dfull & 0xFFFF );
							Console.WriteLine( "Low PID:\t{0:X4} - Var:\t{1}", ( pid & 0xFFFF ), ( pid & 0xFFFF ) ^ ( ( pid >> 0x10 ) ^ tid ^ sid ) );
							uint calcshiny = c ^ tid ^ sid;
							uint var = ( ( calcshiny ^ a ) & 0x7 );
							uint calclowpid = calcshiny ^ var;
							Console.WriteLine( "Calc Low PID:\t{0:X4} - Calc:\t{1}", calclowpid, var );
							if ( ( calclowpid % 256 < 128 ) != ( pid % 256 < 128 ) ) //Conflicting gender
							{
								uint newulowpid = ( ( calcshiny & 0xFF00 ) + ( ( calcshiny % 256 < 128 ) ? 384u : 1u ) );
								uint newuhighpid = newulowpid ^ tid ^ sid;
								uint newvar = ( var + 7 ) & 0x7;
								uint newlowpid = newulowpid ^ newvar;
								Console.WriteLine( "Conflict Low PID:\t{0:X4} - Var: {1}", newulowpid ^ newvar, newvar );
								Console.WriteLine( "Conflict High PID:\t{0:X4}", newuhighpid );
							}
						}
					}
				}
			}
		}

This is the general code that I use for determining the Zigzagoons.

Edited by evandixon
Fixed bb code conversion
Link to comment
Share on other sites

I figured the time for secrets is over. Everyone should understand what I am doing, and what steps are required to figure out the legality of event Pokemon.

Additional Note: The scenario #2 (theoretical) shiny zigzagoons only appear on a pair japanese from an unknown source. Another pair ended up being hacked, so I am not quite sure what to make of it. So far I have collected over 30, not including the japanese ones, which all pass the scenario #1 tests.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...