botanyaki Posted March 8, 2016 Posted March 8, 2016 Hi : ) I'm new to this forum. Could you tell me How can I compile this code? I don't have any knowledge for programing. Help me. I really want to know how to compile this C# code. I modified the code for my convenience. Thank you for your help. ushort hl = 0x2598; ushort bc = 0x0F9A; byte a = 0x01; byte d = 0x00; while (true) { a = savedata[hl]; hl++; a = (byte)(a + d); d = a; bc--; byte[] temp = BitConverter.GetBytes(bc); a = temp[1]; if ((a | temp[0]) == 0) break; } a = d; a = (byte)(a ^ 0xFF); savedata[0x3594] = a;
ReignOfComputer Posted March 8, 2016 Posted March 8, 2016 This code is part of PokeSavRBG: https://github.com/ekx/PokeSavRBG/blob/master/PokeSavRBG/MainView.cs Compiled it for you.
Kaphotics Posted March 8, 2016 Posted March 8, 2016 https://github.com/ekx/PokeSavRBG/blob/master/PokeSavRBG/MainView.cs#L111-L138 You didn't modify anything... http://bulbapedia.bulbagarden.net/wiki/Save_data_structure_in_Generation_I#Checksum A more concise checksum calculation is as follows: private byte getCHK(byte[] data) { byte chk = 0; for (int i = 0x2598; i <= 0x3522; i++) chk += data[i]; return (byte)~chk; } private byte getCHKSub(byte[] data) { byte chk = 0xFF; for (int i = 0x2598; i <= 0x3522; i++) chk -= data[i]; return chk; }
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now