From b4a622e7843ecbb5d7d8572912ee5be113241f76 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 31 Jul 2016 18:15:58 -0700 Subject: [PATCH 01/34] Minor refactoring Expression body & ternary for less lines --- MainWindow/Main.cs | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 4a7849b87..bf12ae5de 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -177,43 +177,11 @@ namespace PKHeX #region Path Variables - public static string WorkingDirectory { - get - { - if (ApplicationDeployment.IsNetworkDeployed) - { - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PKHeX"); - } - else - { - return Environment.CurrentDirectory; - } - } - } + public static string WorkingDirectory => ApplicationDeployment.IsNetworkDeployed ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PKHeX") : Environment.CurrentDirectory; + public static string DatabasePath => Path.Combine(WorkingDirectory, "db"); + private static string WC6DatabasePath => Path.Combine(WorkingDirectory, "wc6"); + private static string BackupPath => Path.Combine(WorkingDirectory, "bak"); - public static string DatabasePath - { - get - { - return Path.Combine(WorkingDirectory, "db"); - } - } - - private static string WC6DatabasePath - { - get - { - return Path.Combine(WorkingDirectory, "wc6"); - } - } - - private static string BackupPath - { - get - { - return Path.Combine(WorkingDirectory, "bak"); - } - } #endregion #region //// MAIN MENU FUNCTIONS //// From ea83159370c76e7cb351aa36a9522d813c1bddd5 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 31 Jul 2016 20:31:43 -0700 Subject: [PATCH 02/34] Add drop mysterygift into box slot Converts to pkm (pgt/pcd -> pk4, etc), then is attempted to convert to the format of the save file. --- MainWindow/Main.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index bf12ae5de..a30627081 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -3326,11 +3326,13 @@ namespace PKHeX if (files.Length <= 0) return; string file = files[0]; - if (!PKX.getIsPKM(new FileInfo(file).Length)) + FileInfo fi = new FileInfo(file); + if (!PKX.getIsPKM(fi.Length)) { openQuick(file); return; } byte[] data = File.ReadAllBytes(file); - PKM temp = PKMConverter.getPKMfromBytes(data); + MysteryGift mg = MysteryGift.getMysteryGift(data, fi.Extension); + PKM temp = mg != null ? mg.convertToPKM(SAV) : PKMConverter.getPKMfromBytes(data); string c; PKM pk = PKMConverter.convertToFormat(temp, SAV.Generation, out c); From 43135ae274fbbdd4a872e1dde6ebc23f66c99b4c Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Mon, 1 Aug 2016 20:38:55 -0700 Subject: [PATCH 03/34] Fix empty savedatabackup folder Expects a 'main' on launch, none found throws an exception before the form is shown. --- MainWindow/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index a30627081..e4c911af4 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -116,7 +116,7 @@ namespace PKHeX if (!SAV.Exportable) // No SAV loaded from exe args { string path = detectSaveFile(); - if (path != null) + if (path != null && File.Exists(path)) openQuick(path, force: true); else GB_SAVtools.Visible = false; From 685e2e639a190dc44f2c895a5738035c75c9389a Mon Sep 17 00:00:00 2001 From: ajtudela Date: Tue, 2 Aug 2016 16:37:02 +0200 Subject: [PATCH 04/34] Better translations for spanish language --- MainWindow/Main.Designer.cs | 8 +- Resources/text/es/lang_es.txt | 558 ++++++++++++++++++-- Resources/text/es/text_EncounterType_es.txt | 18 +- Resources/text/es/text_Games_es.txt | 8 +- 4 files changed, 522 insertions(+), 70 deletions(-) diff --git a/MainWindow/Main.Designer.cs b/MainWindow/Main.Designer.cs index d07b01920..2f84afa00 100644 --- a/MainWindow/Main.Designer.cs +++ b/MainWindow/Main.Designer.cs @@ -851,7 +851,7 @@ // CHK_IsEgg // this.CHK_IsEgg.AutoSize = true; - this.CHK_IsEgg.Location = new System.Drawing.Point(43, 196); + this.CHK_IsEgg.Location = new System.Drawing.Point(35, 196); this.CHK_IsEgg.Name = "CHK_IsEgg"; this.CHK_IsEgg.Size = new System.Drawing.Size(56, 17); this.CHK_IsEgg.TabIndex = 16; @@ -872,7 +872,7 @@ // Label_Form // this.Label_Form.AutoSize = true; - this.Label_Form.Location = new System.Drawing.Point(128, 136); + this.Label_Form.Location = new System.Drawing.Point(125, 136); this.Label_Form.Name = "Label_Form"; this.Label_Form.Size = new System.Drawing.Size(33, 13); this.Label_Form.TabIndex = 11; @@ -2644,9 +2644,9 @@ // // Label_EncryptionConstant // - this.Label_EncryptionConstant.Location = new System.Drawing.Point(29, 279); + this.Label_EncryptionConstant.Location = new System.Drawing.Point(20, 279); this.Label_EncryptionConstant.Name = "Label_EncryptionConstant"; - this.Label_EncryptionConstant.Size = new System.Drawing.Size(105, 13); + this.Label_EncryptionConstant.Size = new System.Drawing.Size(120, 13); this.Label_EncryptionConstant.TabIndex = 1; this.Label_EncryptionConstant.Text = "Encryption Constant:"; this.Label_EncryptionConstant.TextAlign = System.Drawing.ContentAlignment.MiddleRight; diff --git a/Resources/text/es/lang_es.txt b/Resources/text/es/lang_es.txt index da2424e42..348239b9f 100644 --- a/Resources/text/es/lang_es.txt +++ b/Resources/text/es/lang_es.txt @@ -1,10 +1,10 @@ ! PKHeX Interface Customization File ! Languages: Save this file accordingly and put it in the same folder as PKHeX's executable. -! lang_en.txt = English -! lang_jp.txt = Japanese +! lang_en.txt = Inglés +! lang_jp.txt = Japonés ! lang_fr.txt = French -! lang_de.txt = German -! lang_es.txt = Spanish +! lang_de.txt = Alemán +! lang_es.txt = Español ! lang_it.txt = Italian ! lang_ko.txt = Korean ! lang_zh.txt = Chinese @@ -26,18 +26,18 @@ Menu_Exit = Salir -- Menu_Tools = Útiles Menu_Showdown = Showdown -Menu_ShowdownImportPKM = Import Set from Clipboard -Menu_ShowdownExportPKM = Export Set to Clipboard -Menu_ShowdownExportParty = Export Party to Clipboard -Menu_ShowdownExportBattleBox = Export Battle Box to Clipboard +Menu_ShowdownImportPKM = Importar set desde el portapapeles +Menu_ShowdownExportPKM = Exportar set desde el portapapeles +Menu_ShowdownExportParty = Exportar equipo desde el portapapeles +Menu_ShowdownExportBattleBox = Exportar caja de combate desde el portapapeles Menu_CyberGadget = CyberGadget Menu_OpenTemp = Abrir carpeta Temp Menu_OpenCache = Abrir carpeta Cache Menu_Data = Data Menu_LoadBoxes = Cargar Cajas Menu_DumpBoxes = Exportar Cajas -Menu_Report = Reporte de la caja -Menu_Database = PKM Database +Menu_Report = Informe de la caja +Menu_Database = Base de datos de PKM Menu_Other = Otro Menu_OpenSDF = Abrir carpeta SaveDataFiler Menu_OpenSDB = Abrir carpeta SaveDataBackup @@ -46,7 +46,7 @@ Menu_Options = Opciones Menu_Language = Idioma Menu_Modify = Ajuste a SAV Menu_ModifyDex = Modificar Pokédex -Menu_ModifyPKM = Modificar PKM Info +Menu_ModifyPKM = Modificar info PKM Menu_Unicode = Unicode Menu_About = Sobre PKHeX --------------------Context Menus---------------------- @@ -68,14 +68,14 @@ Label_Friendship = Felicidad: Label_Form = Forma: Label_Ability = Habilidad: Label_Language = Idioma: -CHK_IsEgg = Es Huevo +CHK_IsEgg = Huevo CHK_Infected = Infectado CHK_Cured = Curado Label_PKRS = PkRs: Label_PKRSdays = d: Label_Country = País: -Label_SubRegion = Sub Region: -Label_3DSRegion = 3DS Region: +Label_SubRegion = Subregión: +Label_3DSRegion = Región 3DS: ---------------------Met Tab Data----------------------- Tab_Met = Conocido Label_OriginGame = Juego Original: @@ -94,7 +94,7 @@ Label_EggDate = Fecha: Tab_Stats = Estadísticas Label_IVs = IVs Label_EVs = EVs -Label_Stats = Estadísticas +Label_Stats = Estad. Label_HP = PS: Label_ATK = Atq: Label_DEF = Def: @@ -102,10 +102,10 @@ Label_SPA = Atq E: Label_SPD = Def E: Label_SPE = Velo: Label_Total = Total: -Label_HiddenPowerPrefix = Poder Oculto Tipo: +Label_HiddenPowerPrefix = Tipo del Poder Oculto: Label_CharacteristicPrefix = Características: -BTN_RandomIVs = Randomizar IVs -BTN_RandomEVs = Randomizar EVs +BTN_RandomIVs = Aleatorizar IVs +BTN_RandomEVs = Aleatorizar EVs Label_ContestStats = Estadísticas de concurso Label_Cool = Carisma Label_Beauty = Belleza @@ -121,18 +121,18 @@ Label_PPups = Más PP GB_RelearnMoves = Recordar Movimientos -------------------OT/Misc Tab Data--------------------- Tab_OTMisc = EO/Misc -GB_OT = Trainer Information +GB_OT = Info del Entrenador Label_TID = ID: Label_SID = IDS: Label_OT = EO: -GB_nOT = Ultimo dueño (no OT) -Label_PrevOT = OT: +GB_nOT = Ultimo dueño (no EO) +Label_PrevOT = EO: GB_ExtraBytes = Bytes Extras GB_Markings = Marcas -BTN_Ribbons = Listones -BTN_Medals = Medales +BTN_Ribbons = Cintas +BTN_Medals = Medallas BTN_History = Memorias -Label_EncryptionConstant = Constante de Encryption: +Label_EncryptionConstant = Cte. de Encriptación: BTN_RerollEC = Generar -----------------Save Data Interface-------------------- Tab_Box = Caja @@ -140,17 +140,17 @@ Tab_PartyBattle = Caja de combate Tab_Other = Otro Tab_SAV = SAV B_OpenPokePuffs = ‎Pokélito -B_OpenItemPouch = Objeto -B_OpenTrainerInfo = Info del Entrenador -B_OpenBoxLayout = Box Layout +B_OpenItemPouch = Inventario +B_OpenTrainerInfo = Entrenador +B_OpenBoxLayout = Fondos Cajas B_OpenWondercards = Tarjetas Misteriosas -B_OpenBerryField = Cultivo de Bayas +B_OpenBerryField = C. de Bayas B_OpenOPowers = Poder O -B_OpenEventFlags = Event Flags +B_OpenEventFlags = Eventos B_OpenPokedex = Pokédex -B_OpenSuperTraining = Super Train +B_OpenSuperTraining = Superentren. -- -B_OpenSecretBase = Secret Base +B_OpenSecretBase = Base Secreta --------------------Tab Internals----------------------- L_Party = Equipo: L_BattleBox = Caja de Combate: @@ -173,13 +173,13 @@ L_Secure2 = Secure Value 2: ! End ! ----------------------------------------------------- - DO NOT CHANGE THIS SECTION. -! RibbonEditor = Ribbon Editor +! RibbonEditor = Editor de Cintas - Change stuff below this line, not above. ----------------------Buttons-------------------------- -BTN_All = Dar todos -BTN_None = Quitar todos -BTN_Cancel = Cancelar -BTN_Save = Guardar +B_All = Dar todos +B_None = Quitar todos +B_Cancel = Cancelar +B_Save = Guardar ----------------------Ribbons-------------------------- L_RibbonChampionKalos = Campeón de Kalos L_RibbonChampionG3Hoenn = Campeón de Hoenn (RSE) @@ -220,13 +220,13 @@ L_RibbonChampionNational = Campeón Nacional L_RibbonChampionWorld = Campeón Mundial L_RibbonCountMemoryContest = Cintas de concursos anteriores L_RibbonCountMemoryBattle = Cintas de batallas anteriores -L_RibbonChampionG6Hoenn = Hoenn Champion (ORAS) -L_RibbonContestStar = Contest Star -L_RibbonMasterCoolness = Coolness Master -L_RibbonMasterBeauty = Beauty Master -L_RibbonMasterCuteness = Cuteness Master -L_RibbonMasterCleverness = Cleverness Master -L_RibbonMasterToughness = Toughness Master +L_RibbonChampionG6Hoenn = Campeón de Hoenn (ORAS) +L_RibbonContestStar = Cinta estelar de los concursos +L_RibbonMasterCoolness = Cinta estrella del carisma +L_RibbonMasterBeauty = Cinta estrella de la belleza +L_RibbonMasterCuteness = Cinta estrella de la dulzura +L_RibbonMasterCleverness = Cinta estrella del ingenio +L_RibbonMasterToughness = Cinta estrella de la dureza ----------------Contest/Battle (PAST)------------------- L_RibbonG3Cool = Cool (G3) L_RibbonG3CoolSuper = Cool Super @@ -283,13 +283,13 @@ L_RibbonCountG3Smart = Smart L_RibbonCountG3Tough = Tough ! ----------------------------------------------------- - DO NOT CHANGE THIS SECTION. -! SuperTrainingEditor = Medal Editor +! SuperTrainingEditor = Editor de Medallas - Change stuff below this line, not above. ----------------------Buttons-------------------------- -B_All = Give All -B_None = Remove All -B_Cancel = Cancel -B_Save = Save +B_All = Dar todos +B_None = Quitar todos +B_Cancel = Cancelar +B_Save = Guardar ------------------Super Training----------------------- L_SuperTraining = Superentrenamiento Normal L_SuperTrain1_HP = Nv. 1: PS @@ -324,12 +324,12 @@ L_SuperTrain7_2 = Nv. 7: Bombardeo L_SuperTrain7_3 = Nv. 7: Hydreigon L_SuperTrain8_1 = Nv. 8: X/Y --- -L_Bag = Last Used Bag: -L_Hits = Hits Remaining: +L_Bag = Último saco usado: +L_Hits = Golpes restantes: ! End ! ----------------------------------------------------- -- DO NOT CHANGE THIS SECTION. Memories / Amie UI Below -! MemoryAmie +- DO NOT CHANGE THIS SECTION. +! MemoryAmie = Editor de Memorias / Amigos - Change stuff below this line, not above. ---------------------Bottom UI------------------------- BTN_Cancel = Cancelar @@ -339,11 +339,463 @@ L_Handler = Manejador Actual: Tab_OTMemory = Memorias con: EO L_OT_Friendship = Amistad: L_OT_Affection = Cariño: -Tab_CTMemory = Memorias con: notEO +Tab_CTMemory = Memorias con: noEO L_CT_Friendship = Amistad: L_cT_Affection = Cariño: Tab_Residence = Residencia -- +L_Country = País +L_Region = Región +L_Geo0 = Último: +L_Geo1 = Anterior 1: +L_Geo2 = Anterior 2: +L_Geo3 = Anterior 3: +L_Geo4 = Anterior 4: -- L_Arguments = Disabled ; Never left ; OT ; Past Gen ; Memories with ; Pokémon ; Area ; Item(s) ; Move ; Location ; ! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! f2_Text = Special Characters +- Change stuff below this line, not above. +------------------------------------------------------- +-- No Elements to rename here. +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_BerryField = Visor de Campos de Bayas +- Change stuff below this line, not above. +------------------------------------------------------- +L_Berry = Baya: +L_Field = Campo: +L_Unfinished = Unfinished: Needs More Research +L_u1 = 1 +L_u2 = 2 +L_u3 = 3 +L_u4 = 4 +L_u5 = 5 +L_u6 = 6 +L_u7 = 7 +B_Cancel = Cancelar +B_Save = Guardar +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. Memories / Amie UI Below +! SAV_BoxLayout = Box Layout Editor +- Change stuff below this line, not above. +------------------------------------------------------- +L_Unlocked = Unlocked: +B_Cancel = Cancel +B_Save = Save +L_Flags = Unlocked BG Flags: +L_BG = BG: +L_BoxName = Box Name: +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_EventFlagsORAS = Editor de Eventos (ORAS) +- Change stuff below this line, not above. +------------------------------------------------------ +L_Ash = Asho volcánico: +GB_Misc = Misc +flag_0288 = Multi Statuette +flag_0287 = Rotation Statuette +flag_0286 = Triples Statuette +flag_0293 = Super Multi Unlocked +flag_0292 = Super Rotation Unlocked +flag_0291 = Super Triples Unlocked +flag_0290 = Super Doubles Unlocked +flag_0289 = Super Singles Unlocked +flag_0285 = Doubles Statuette +flag_0284 = Singles Statuette +GB_Rebattle = Rebattle +flag_2835 = (AS) Latios Capturado +flag_0420 = (AS) Latios Derrotado +L_SkyTower = *Sky Tower +flag_2834 = (OR) Latias Capturado +flag_0419 = (OR) Latias Derrotado +flag_2828 = (OR) Tornadus Capturado +flag_2830 = (OR) Reshiram Capturado +flag_0182 = (OR) Reshiram Derrotado +flag_2820 = (OR) Palkia Capturado +flag_2839 = (OR) Groudon Capturado +flag_0648 = (OR) Groudon Derrotado +flag_2815 = (OR) Ho-Oh Capturado +flag_0208 = (OR) Ho-Oh Derrotado +flag_2824 = Cresselia Capturado +flag_0172 = Cresselia Derrotado +flag_2821 = Heatran Capturado +flag_0260 = Heatran Derrotado +flag_2842 = Deoxys Capturado +flag_0945 = Deoxys Derrotado +flag_2838 = Registeel Capturado +flag_0958 = Registeel Derrotado +flag_2836 = Regirock Capturado +flag_0956 = Regirock Derrotado +flag_2837 = Regice Capturado +flag_0957 = Regice Derrotado +flag_2813 = Suicune Capturado +flag_0175 = Suicune Derrotado +flag_2811 = Raikou Capturado +flag_0173 = Raikou Derrotado +flag_2812 = Entei Capturado +flag_0174 = Entei Derrotado +flag_2832 = Landorus Capturado +flag_2829 = (AS) Thundurus Capturado +flag_2822 = Regigigas Capturado +flag_0252 = Regigigas Derrotado +flag_2827 = Virizion Capturado +flag_0178 = Virizion Derrotado +flag_2826 = Terrakion Capturado +flag_0177 = Terrakion Derrotado +flag_2823 = Giratina Capturado +flag_2819 = (AS) Dialga Capturado +flag_2833 = Kyurem Capturado +flag_0184 = Kyurem Derrotado +flag_2816 = Uxie Capturado +flag_0179 = Uxie Derrotado +flag_2817 = Mesprit Capturado +flag_0180 = Mesprit Derrotado +flag_2825 = Cobalion Capturado +flag_0176 = Cobalion Derrotado +flag_2814 = (AS) Lugia Capturado +flag_0209 = (AS) Lugia Derrotado +flag_2818 = Azelf Capturado +flag_0181 = Azelf Derrotado +flag_2831 = (AS) Zekrom Capturado +flag_0183 = (AS) Zekrom Derrotado +flag_2840 = (AS) Kyogre Capturado +flag_0647 = (AS) Kyogre Derrotado +GB_Researcher = FlagDiff Researcher +L_UnSet = UnSet +L_IsSet = IsSet +B_LoadNew = Carg. Nuevo +B_LoadOld = Carg. Antiguo +GB_FlagStatus = Check Flag Status +L_Flag = Flag: +CHK_CustomFlag = Estado: +B_Save = Guardar +B_Cancel = Cancelar +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_EventFlagsXY = Editor de Eventos (XY) +- Change stuff below this line, not above. +------------------------------------------------------- +flag_2546 = Pokédex Obtained +GB_Misc = Misc +flag_0289 = Multi Statuette +flag_0288 = Rotation Statuette +flag_0287 = Triples Statuette +flag_0294 = Super Multi Unlocked +flag_0293 = Super Rotation Unlocked +flag_0292 = Super Triples Unlocked +flag_0291 = Super Doubles Unlocked +flag_0290 = Super Singles Unlocked +flag_0675 = 50: Beat Chatelaine +flag_0286 = Doubles Statuette +flag_0285 = Singles Statuette +GB_Rebattle = Rebattle +flag_0114 = Zygarde Capturado +flag_0790 = Zygarde Derrotado +flag_0115 = Mewtwo Capturado +flag_0963 = Mewtwo Derrotado +GB_Researcher = FlagDiff Researcher +L_UnSet = UnSet +L_IsSet = IsSet +B_LoadNew = Carg. Nuevo +B_LoadOld = Carg. Antiguo +flag_2239 = 2239 +flag_2238 = 2238 +flag_2237 = 2237 +B_Save = Guardar +flag_0005 = Flag5 +flag_0004 = Flag4 +flag_0003 = Flag3 +flag_0002 = Flag2 +flag_0001 = Flag1 +GB_FlagStatus = Check Flag Status +L_Flag = Flag: +CHK_CustomFlag = Estado: +B_Cancel = Cancelar +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_PokedexORAS = Editor de Pokédex (ORAS) +- Change stuff below this line, not above. +------------------------------------------------------ +L_goto = goto: +GB_Owned = Obtenido +CHK_P1 = Obtenido +CHK_P2 = Macho +CHK_P3 = Hembra +CHK_P4 = Macho brillante +CHK_P5 = Hembra brillante +GB_Encountered = Encontrado +CHK_P6 = Macho +CHK_P7 = Hembra +CHK_P8 = Macho brillante +CHK_P9 = Hembra brillante +L_DexNav = Nvl. DexNav: +GB_Language = Idiomas +CHK_L1 = Japonés +CHK_L2 = Inglés +CHK_L3 = Francés +CHK_L4 = Italiano +CHK_L5 = Alemán +CHK_L6 = Español +CHK_L7 = Coreano +B_Modify = Modificar... +B_GiveAll = Marcar todos +L_Spinda = Spinda: +B_Save = Guardar +B_Cancel = Cancelar +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_PokedexXY = Editor de Pokédex (XY) +- Change stuff below this line, not above. +------------------------------------------------------- +L_goto = goto: +GB_Owned = Obtenido +CHK_F1 = Extranjero (Pre) +CHK_P1 = Nativo (Kalos) +GB_Encountered = Encontrado +CHK_P2 = Macho +CHK_P3 = Hembra +CHK_P4 = Macho brillante +CHK_P5 = Hembra brillante +GB_Displayed = Mostrado +CHK_P6 = Macho +CHK_P7 = Hembra +CHK_P8 = Macho brillante +CHK_P9 = Hembra brillante +GB_Language = Idiomas +CHK_L1 = Japonés +CHK_L2 = Inglés +CHK_L3 = Francés +CHK_L4 = Italiano +CHK_L5 = Alemán +CHK_L6 = Español +CHK_L7 = Coreano +B_Modify = Modificar... +B_GiveAll = Marcar todos +L_Spinda = Spinda: +B_Save = Guardar +B_Cancel = Cancelar +! End +------------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_HallOfFame = Editor de Hall de la Fama +- Change stuff below this line, not above. +------------------------------------------------------- +B_CopyText = Copiar txt +L_Level = Nivel: +L_Shiny = Brillante: +Label_Form = Forma: +B_Cancel = Canceler +Label_MetDate = Fecha: +L_Victory = Núm. Victorias: +GB_OT = Info del Entrenador +Label_OT = OT: +Label_SID = SID: +Label_TID = TID: +Label_HeldItem = Objeto: +GB_CurrentMoves = Mov. actuales +Label_EncryptionConstant = Cte. de Encriptación: +CHK_Nicknamed = Apodo: +Label_Species = Especie: +L_PartyNum = N. equipo: +B_Close = Guardar +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_Inventory = Editor de Inventario +- Change stuff below this line, not above. +------------------------------------------------------- +GB_Pouch = Pokélitos +B_DisplayBerries = Bayas +B_DisplayMedicine = Medicinas +B_DisplayTMHM = MT/MO +B_DisplayKeyItems = Objetos clave +B_DisplayItems = Objetos +B_Save = Guardar +B_Cancel = Cancelar +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_OPower = Editor de Poder O +- Change stuff below this line, not above. +------------------------------------------------------- +GB_Regular = Regular +B_MaxP = Give All +L_1 = Hatching: +L_2 = Bargain: +L_3 = ?Prize: +L_4 = EXP: +L_5 = Capture: +L_6 = ?Encounter +L_7 = ?Stealth: +L_8 = HP Restore: +L_9 = ?PP: +L_10 = ?Befriend: +L_11 = ?Attack: +L_12 = ?Defense: +L_13 = ?Sp. Atk: +L_14 = ?Sp. Def: +L_15 = ?Speed: +L_16 = ?Critical Hit: +L_17 = ?Accuracy: +GB_Event = Event +CHK_1 = ?Bargain MAX +CHK_2 = ?EXP MAX +CHK_3 = ?Prize MAX +CHK_4 = ?Hatch MAX +CHK_5 = ?Capture MAX +CHK_6 = ?Restore MAX +CHK_7 = ?Befriend MAX +CHK_8 = ?Unused +B_AllMax = Give All +B_Save = Save +B_Cancel = Cancel +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_Pokepuff = ‎Poké Puffs Editor +- Change stuff below this line, not above. +------------------------------------------------------- +L_Count = CNT: +B_None = None +B_Sort = Sort +B_All = All +B_Cancel = Cancel +B_Save = Save +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_SecretBase = Secret Base Editor +- Change stuff below this line, not above. +------------------------------------------------------- +L_FlagsCaptured = Flags Captured: +B_FSave = < +B_GiveDecor = Give All Decorations +B_Cancel = Cancel +B_Save = Save +B_FDisplay = > +L_Favorite = Favorites: +-- +f_MAIN = Main +L_TrName = Trainer Name: +L_BaseLocation = Secret Base Location: +L_Happy = Happy: +L_Encourage = Encourage: +L_Blackboard = Blackboard: +L_Confetti = Confetti: +L_TeamName = Team Name: +L_TeamSlogan = Team Slogan: +-- +GB_Object = Object Layout +L_Index = Index: +L_Decoration = Decoration: +L_Rotation = Rotation Val: +L_X = X Coordinate: +L_Y = Y Coordinate: +-- +f_PKM = Trainer Pokémon +GB_PKM = PKM +L_Participant = Participant: +L_EncryptionConstant = ENC: +L_IVs = IVs +L_EVs = EVs +L_HP = HP +L_ATK = ATK +L_DEF = DEF +L_SpA = SpA +L_SpD = SpD +L_SPE = SPE +L_PKFriendship = Friendship: +L_PPUps = PPUps +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_Trainer = Trainer Data Editor +- Change stuff below this line, not above. +------------------------------------------------------- +Tab_Multiplayer = Multiplayer +L_MultiplayerSprite = Multiplayer Sprite: +L_Style = Style: +Tab_BadgeMap = Badges/Map +GB_Map = Map Position +L_CurrentMap = Current Map: +L_X = X Coordinate: +L_Z = Z Coordinate: +L_Y = Y Coordinate: +L_Offset = (offset) +Tab_Appearance = Current Appearance (X/Y) +L_Outfit = Outfit Vals +B_GiveAccessories = Give All Accessories +L_Dress = Dress: +L_Accessory = Accessory: +L_Bag = Bag: +L_Socks = Socks: +L_Pants = Pants: +L_Shirt = Shirt: +L_Hat = Hat: +L_FacialHair = Facial Hair: +L_Hairstyle = Hairstyle: +L_HairColor = Hair Color: +L_SkinColor = Skin Color: +GB_MaisonCurrent = Maison Streaks (Current) +L_SuperC = Super +L_NormalC = Normal +L_MultiC = Multi: +L_RotationC = Rotation: +L_TriplesC = Triples: +L_DoublesC = Doubles: +L_SinglesC = Singles: +GB_MaisonBest = Maison Streaks (Best) +L_SuperB = Super +L_NormalB = Normal +L_MultiB = Multi: +L_RotationB = Rotation: +L_TriplesB = Triples: +L_DoublesB = Doubles: +L_SinglesB = Singles: +B_Save = Save +L_Stats = Stats +B_Cancel = Cancel +Tab_Overview = Overview +L_Seconds = Sec: +L_Minutes = Min: +L_Hours = Hrs: +L_Language = Language: +L_PM = PokéMiles: +L_Region = Region: +L_BP = BP: +L_Country = Country: +B_MaxCash = + +L_3DSReg = 3DS Region: +L_Money = $: +L_SID = SID: +L_TID = TID: +L_TrainerName = Trainer Name: +L_Value = Value +GB_Sayings = Saved Sayings +L_Saying1 = 1: +L_Saying2 = 2: +L_Saying3 = 3: +L_Saying4 = 4: +L_Saying5 = 5: +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! SAV_Wondercard = Wonder Card I/O +- Change stuff below this line, not above. +------------------------------------------------------- +L_Details = Details: +L_Received = Received List: +B_Import = Import +B_Output = Export +B_Cancel = Cancel +B_Save = Save +! End \ No newline at end of file diff --git a/Resources/text/es/text_EncounterType_es.txt b/Resources/text/es/text_EncounterType_es.txt index 99492d953..c0c7536c4 100644 --- a/Resources/text/es/text_EncounterType_es.txt +++ b/Resources/text/es/text_EncounterType_es.txt @@ -1,16 +1,16 @@ None -Rock Smash (HGSS) -Tall Grass +Golpe roca (HGSS) +Hierba Alta Dialga/Palkia -Cave/Hall of Origin +Cueva/Sala del Origen -Surfing/Fishing +Surfeando/Pescando -Building/Enigma Stone -Marsh/Safari +Edificio/Misticristal +Pantano/Safari -Starter/Fossil/Gift (DP) +Inicial/Fosil/Regalo (DP) @@ -21,5 +21,5 @@ Starter/Fossil/Gift (DP) -Distortion World (Pt) -Starter/Fossil/Gift (Pt/DP Trio) \ No newline at end of file +Mundo Distorsion (Pt) +Inicial/Fosil/Regalo (Pt/DP Trio) \ No newline at end of file diff --git a/Resources/text/es/text_Games_es.txt b/Resources/text/es/text_Games_es.txt index 2edc80d22..d25560725 100644 --- a/Resources/text/es/text_Games_es.txt +++ b/Resources/text/es/text_Games_es.txt @@ -5,8 +5,8 @@ Esmeralda RojoFuego VerdeHoja -HeartGold -SoulSilver +Oro HeartGold +Plata SoulSilver Diamante Perla @@ -24,5 +24,5 @@ Blanca2 Negra2 X Y -AS -OR \ No newline at end of file +Zafiro Alfa +Rubí Omega \ No newline at end of file From 116840b32e65e0565f302894d38a4a0dca9dc275 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Tue, 2 Aug 2016 17:40:20 -0700 Subject: [PATCH 05/34] Cleanup Remove unnecessary complexity Fix exporting pk* (DecryptedBoxData instead of 0xE8) --- Subforms/SAV_Database.cs | 128 +++------------------------------------ 1 file changed, 9 insertions(+), 119 deletions(-) diff --git a/Subforms/SAV_Database.cs b/Subforms/SAV_Database.cs index f9c0f5b2d..abcc6bef1 100644 --- a/Subforms/SAV_Database.cs +++ b/Subforms/SAV_Database.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; -using System.Text; using System.Windows.Forms; namespace PKHeX @@ -80,41 +79,33 @@ namespace PKHeX foreach (PictureBox p in PKXBOXES) p.ContextMenuStrip = mnu; - // Load initial database - Database.Add(new DatabaseList - { - Version = 0, - Title = "Misc", - Description = "Individual pkm files present in the db/sav.", - }); - - // Load databases + // Load Data + RawDB = new List(); foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories)) { FileInfo fi = new FileInfo(file); if (fi.Extension.Contains(".pk") && PKX.getIsPKM(fi.Length)) - Database[0].Slot.Add(PKMConverter.getPKMfromBytes(File.ReadAllBytes(file), file)); - else - loadDatabase(File.ReadAllBytes(file)); + RawDB.Add(PKMConverter.getPKMfromBytes(File.ReadAllBytes(file), file)); } // Fetch from save file foreach (var pkm in Main.SAV.BoxData.Where(pk => pk.Species != 0)) - Database[0].Slot.Add(pkm); + RawDB.Add(pkm); // Prepare Database - prepareDBForSearch(); + RawDB = new List(RawDB.Where(pk => pk.ChecksumValid && pk.Species != 0 && pk.Sanity == 0)); + RawDB = new List(RawDB.Distinct()); + setResults(RawDB); + Menu_SearchSettings.DropDown.Closing += (sender, e) => { if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked) e.Cancel = true; }; - B_Search.PerformClick(); CenterToParent(); } private readonly Main m_parent; private readonly PictureBox[] PKXBOXES; private readonly string DatabasePath = Main.DatabasePath; - private readonly List Database = new List(); private List Results; private List RawDB; private int slotSelected = -1; // = null; @@ -323,80 +314,6 @@ namespace PKHeX } // IO Usage - private class DatabaseList - { - public readonly List Slot = new List(); - public int Version; - private readonly bool Unicode; - private readonly byte[] Unused; - public string Title; - public string Description; - - public DatabaseList() { } - public DatabaseList(byte[] data) - { - if ((data.Length < 0x100 + 0xE8) || (data.Length - 0x100)%0xE8 != 0) - return; - - Version = BitConverter.ToInt32(data, 0); - Unicode = data[0x5] == 1; - Unused = data.Skip(4).Take(0xB).ToArray(); - - if (Unicode) - { - Title = Encoding.Unicode.GetString(data, 0x10, 0x30).Trim(); - Description = Encoding.Unicode.GetString(data, 0x40, 0x60).Trim(); - } - else - { - Title = Encoding.ASCII.GetString(data, 0x10, 0x30).Trim(); - Description = Encoding.ASCII.GetString(data, 0x40, 0x60).Trim(); - } - - int count = (data.Length - 0x100)/0xE8; - for (int i = 0; i < count; i++) - Slot.Add(new PK6(data.Skip(0x100 + i * 0xE8).Take(0xE8).ToArray())); - } - public byte[] Write() - { - using (MemoryStream ms = new MemoryStream()) - using (BinaryWriter bw = new BinaryWriter(ms)) - { - bw.Write(Version); - bw.Write(Unused); - - byte[] title = Unicode ? Encoding.Unicode.GetBytes(Title) : Encoding.ASCII.GetBytes(Title); - Array.Resize(ref title, 0x30); - bw.Write(title); - - byte[] desc = Unicode ? Encoding.Unicode.GetBytes(Description) : Encoding.ASCII.GetBytes(Description); - Array.Resize(ref title, 0x60); - bw.Write(desc); - - foreach (var pk6 in Slot) - bw.Write(pk6.Data.Take(0xE8).ToArray()); - - return ms.ToArray(); - } - } - } - private void loadDatabase(byte[] data) - { - var db = new DatabaseList(data); - if (db.Slot.Count > 0) - Database.Add(db); - } - private void prepareDBForSearch() - { - RawDB = new List(); - - foreach (var db in Database) - RawDB.AddRange(db.Slot); - - RawDB = new List(RawDB.Where(pk => pk.ChecksumValid && pk.Species != 0 && pk.Sanity == 0)); - RawDB = new List(RawDB.Distinct()); - setResults(RawDB); - } private void openDB(object sender, EventArgs e) { if (Directory.Exists(DatabasePath)) @@ -419,8 +336,7 @@ namespace PKHeX Directory.CreateDirectory(path); foreach (PKM pkm in Results) - File.WriteAllBytes(Path.Combine(path, Util.CleanFileName(pkm.FileName)), - pkm.Data.Take(0xE8).ToArray()); + File.WriteAllBytes(Path.Combine(path, Util.CleanFileName(pkm.FileName)), pkm.DecryptedBoxData); } // View Updates @@ -644,32 +560,6 @@ namespace PKHeX CB_GameOrigin.SelectedIndex = 0; } - // Debug - private void testQuery() - { - var query = from db in Database - select db.Slot.Where(p => p.Move1 == 1).ToArray(); - - var result = query.ToArray(); - if (!result[0].Any()) - return; - - var any = result[0][0]; - m_parent.populateFields(any); - } - private void testUnique() - { - var query = from db in Database - select db.Slot.GroupBy(p => p.Checksum + p.EncryptionConstant + p.Species) // Unique criteria - .Select(grp => grp.First()).ToArray(); - - var result = query.ToArray(); - if (!result[0].Any()) - return; - - var any = result[0][0]; - m_parent.populateFields(any); - } private void Menu_SearchAdvanced_Click(object sender, EventArgs e) { if (!Menu_SearchAdvanced.Checked) From a7d188894304262441f038defecd7dd4c71053e3 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Tue, 2 Aug 2016 18:46:41 -0700 Subject: [PATCH 06/34] Fix Open/Save filters Filter for opening allows past gen pkm files to be selected. Removes old 'pokemon.ekx' injection method which nobody should be using (use QRs!) --- MainWindow/Main.cs | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index e4c911af4..a4dd545c2 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -188,11 +188,22 @@ namespace PKHeX // Main Menu Strip UI Functions private void mainMenuOpen(object sender, EventArgs e) { + string pkx = pkm.Extension; + string ekx = 'e' + pkx.Substring(1, pkx.Length-1); + + string supported = "*.pkm;"; + for (int i = 3; i <= SAV.Generation; i++) + { + supported += $"*.pk{i}"; + if (i != pkm.Format) + supported += ";"; + } + OpenFileDialog ofd = new OpenFileDialog { - Filter = "PKX File|*.pk6;*.pkx" + - "|EKX File|*.ek6;*.ekx" + - "|BIN File|*.bin" + + Filter = $"Decrypted PKM File|{supported}" + + $"|Encrypted PKM File|*.{ekx}" + + "|Binary File|*.bin" + "|All Files|*.*", RestoreDirectory = true, FilterIndex = 4, @@ -219,32 +230,32 @@ namespace PKHeX { if (!verifiedPKM()) return; PKM pk = preparePKM(); + string pkx = pk.Extension; + string ekx = 'e' + pkx.Substring(1, pkx.Length - 1); SaveFileDialog sfd = new SaveFileDialog { - Filter = "PKX File|*.pk6;*.pkx" + - "|EKX File|*.ek6;*.ekx" + - "|BIN File|*.bin" + + Filter = $"Decrypted PKM File|*.{pkx}" + + $"|Encrypted PKM File|*.{ekx}" + + "|Binary File|*.bin" + "|All Files|*.*", - DefaultExt = "pk6", + DefaultExt = pkx, FileName = Util.CleanFileName(pk.FileName) }; if (sfd.ShowDialog() != DialogResult.OK) return; string path = sfd.FileName; - // Injection Dummy Override - if (path.Contains("pokemon.ekx")) path = Path.Combine(Path.GetDirectoryName(path), "pokemon.ekx"); string ext = Path.GetExtension(path); - if (File.Exists(path) && !path.Contains("pokemon.ekx")) + if (File.Exists(path)) { // File already exists, save a .bak byte[] backupfile = File.ReadAllBytes(path); File.WriteAllBytes(path + ".bak", backupfile); } - if (new[] {".ekx", ".ek6", ".bin"}.Contains(ext)) + if (new[] {".ekx", ekx, ".bin"}.Contains(ext)) File.WriteAllBytes(path, pk.EncryptedPartyData); - else if (new[] { ".pkx", ".pk6" }.Contains(ext)) - File.WriteAllBytes(path, pk.Data); + else if (new[] { pkx }.Contains(ext)) + File.WriteAllBytes(path, pk.DecryptedBoxData); else { Util.Error($"Foreign File Extension: {ext}", "Exporting as encrypted."); From 3e7d694128a030f4ad64a413cbe0599eaa4a3d22 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Tue, 2 Aug 2016 23:51:58 -0700 Subject: [PATCH 07/34] Fix party disappearing Thanks ashrobb & MichiS97 ! --- MainWindow/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index a4dd545c2..af65bcbdc 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -2798,7 +2798,7 @@ namespace PKHeX for (int i = 0; i < battle.Length; i++) getQuickFiller(SlotPictureBoxes[i + 36], battle[i]); for (int i = battle.Length; i < 6; i++) - SlotPictureBoxes[i + 30].Image = null; + SlotPictureBoxes[i + 36].Image = null; } } private int getPKXOffset(int slot) From 8d6525dfe9ef844a923ad12c45c8202a128a65f5 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Wed, 3 Aug 2016 00:10:38 -0700 Subject: [PATCH 08/34] Add hot spring wynaut OT memory case Adding 60004 to the "WasEgg" check qualifies the pkm to be checked for having egg relearn moves; since this was a gift egg it wasn't a daycareEgg. --- Legality/Checks.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Legality/Checks.cs b/Legality/Checks.cs index 5c33a70c4..69d08b97a 100644 --- a/Legality/Checks.cs +++ b/Legality/Checks.cs @@ -710,7 +710,7 @@ namespace PKHeX switch (pk6.OT_Memory) { case 2: // {0} hatched from an Egg and saw {1} for the first time at... {2}. {4} that {3}. - if (!pk6.WasEgg) + if (!pk6.WasEgg && pk6.Egg_Location != 60004) return new LegalityCheck(Severity.Invalid, "OT Memory: OT did not hatch this."); return new LegalityCheck(Severity.Valid, "OT Memory is valid."); case 4: // {0} became {1}’s friend when it arrived via Link Trade at... {2}. {4} that {3}. From e6a8e9fed6c162a5185c840455d0c07a96bf1cd7 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Wed, 3 Aug 2016 08:35:13 -0700 Subject: [PATCH 09/34] Fix gen3 Met Level 70 & 0x3F = 6 Thanks Destinyy! --- PKM/PK3.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKM/PK3.cs b/PKM/PK3.cs index 46d11ded7..4f647dd2a 100644 --- a/PKM/PK3.cs +++ b/PKM/PK3.cs @@ -105,7 +105,7 @@ namespace PKHeX public override int Met_Location { get { return Data[0x45]; } set { Data[0x45] = (byte)value; } } // Origins private ushort Origins { get { return BitConverter.ToUInt16(Data, 0x46); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x46); } } - public override int Met_Level { get { return Origins & 0x3F; } set { Origins = (ushort)((Origins & ~0x3F) | value); } } + public override int Met_Level { get { return Origins & 0x7F; } set { Origins = (ushort)((Origins & ~0x7F) | value); } } public override int Version { get { return (Origins >> 7) & 0xF; } set { Origins = (ushort)((Origins & ~0x780) | ((value & 0xF) << 7));} } public override int Ball { get { return (Origins >> 11) & 0xF; } set { Origins = (ushort)((Origins & ~0x7800) | ((value & 0xF) << 11)); } } public override int OT_Gender { get { return (Origins >> 15) & 1; } set { Origins = (ushort)(Origins & ~(1 << 15) | ((value & 1) << 15)); } } From 3f5d8fad953e05a65cad02b54aa43acd40bbe723 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Wed, 3 Aug 2016 17:48:13 -0700 Subject: [PATCH 10/34] Fix pk* save extension detection A period is before the extension. Fixes #163, thanks @JHorbach ! --- MainWindow/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index af65bcbdc..dd5cf8184 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -252,9 +252,9 @@ namespace PKHeX File.WriteAllBytes(path + ".bak", backupfile); } - if (new[] {".ekx", ekx, ".bin"}.Contains(ext)) + if (new[] {".ekx", "."+ekx, ".bin"}.Contains(ext)) File.WriteAllBytes(path, pk.EncryptedPartyData); - else if (new[] { pkx }.Contains(ext)) + else if (new[] { "."+pkx }.Contains(ext)) File.WriteAllBytes(path, pk.DecryptedBoxData); else { From 0dd6b05f1d00e3cd1ce7a81dd85324677e14c069 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Wed, 3 Aug 2016 17:56:15 -0700 Subject: [PATCH 11/34] Fix event flag retrieval Thanks CaliberDR! --- Saves/SaveFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Saves/SaveFile.cs b/Saves/SaveFile.cs index bd6c70f09..6775c7716 100644 --- a/Saves/SaveFile.cs +++ b/Saves/SaveFile.cs @@ -235,7 +235,7 @@ namespace PKHeX ushort[] Constants = new ushort[EventConstMax]; for (int i = 0; i < Constants.Length; i++) - Constants[i] = BitConverter.ToUInt16(Data, EventConst + i); + Constants[i] = BitConverter.ToUInt16(Data, EventConst + i * 2); return Constants; } set From 8924dd09401b69f8281041885a8d45c2ed251008 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 4 Aug 2016 19:16:13 -0700 Subject: [PATCH 12/34] Fix fateful celebi transfer Don't assign as crown unless it was received in gen4 (movie celebi only). --- PKM/PK4.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKM/PK4.cs b/PKM/PK4.cs index f7e450e31..877a0b76e 100644 --- a/PKM/PK4.cs +++ b/PKM/PK4.cs @@ -392,7 +392,7 @@ namespace PKHeX BitConverter.GetBytes((uint)0).CopyTo(pk5.Data, 0x44); // Met / Crown Data Detection - pk5.Met_Location = pk5.FatefulEncounter && Array.IndexOf(new[] {251, 243, 244, 245}, pk5.Species) >= 0 + pk5.Met_Location = pk5.Gen4 && pk5.FatefulEncounter && Array.IndexOf(new[] {251, 243, 244, 245}, pk5.Species) >= 0 ? (pk5.Species == 251 ? 30010 : 30012) // Celebi : Beast : 30001; // Pokétransfer (not Crown) From 30047a1cb6dfd4bc48207005b5a8eb10b1520dd5 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 4 Aug 2016 19:18:32 -0700 Subject: [PATCH 13/34] Fix manaphy hatching from egg Can't receive a manaphy egg from Daycare or other non-Mystery Gift source. A wc6 Manaphy egg would not satisfy "WasEgg" anyway. So far no manaphy eggs have been given out, and none will be (probably). Thanks RustInPeace! --- Legality/Tables.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Legality/Tables.cs b/Legality/Tables.cs index 4ab3f3d22..8bb92c9bb 100644 --- a/Legality/Tables.cs +++ b/Legality/Tables.cs @@ -444,6 +444,7 @@ namespace PKHeX 486, // Regigigas 487, // Giratina 488, // Cresselia + 490, // Manaphy 491, // Darkrai 492, // Shaymin 493, // Arceus From 2acd1c5d21bd31725a5a3d06e9a28440aeb200ab Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 4 Aug 2016 20:48:52 -0700 Subject: [PATCH 14/34] Tweak savefile detection Remove old cybergadget temp folder (interrupt is no longer used, now using Cache), fix/modify current methods for a more maintainable method. If GameFreak changes the filename, it'd only have to be changed in one place. --- MainWindow/Main.cs | 39 +++++++------------------------------ Saves/SAV6.cs | 1 + Saves/SaveUtil.cs | 48 ++++++++++++++++++++++++++++++++++++++++++++++ Util/PathUtil.cs | 37 ----------------------------------- 4 files changed, 56 insertions(+), 69 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index dd5cf8184..932f5e086 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -115,7 +115,7 @@ namespace PKHeX } if (!SAV.Exportable) // No SAV loaded from exe args { - string path = detectSaveFile(); + string path = SaveUtil.detectSaveFile(); if (path != null && File.Exists(path)) openQuick(path, force: true); else @@ -215,7 +215,7 @@ namespace PKHeX ofd.InitialDirectory = WorkingDirectory; // Detect main - string path = detectSaveFile(); + string path = SaveUtil.detectSaveFile(); if (path != null) { ofd.InitialDirectory = Path.GetDirectoryName(path); } else if (File.Exists(Path.Combine(ofd.InitialDirectory, "main"))) @@ -499,17 +499,17 @@ namespace PKHeX } private void clickOpenSDFFolder(object sender, EventArgs e) { - string path; - if (Util.get3DSLocation() != null && Directory.Exists(path = Util.GetSDFLocation())) + string path = Path.GetPathRoot(Util.get3DSLocation()); + if (path != null && Directory.Exists(path = Path.Combine(path, "filer", "UserSaveData"))) Process.Start("explorer.exe", path); else Util.Alert("Can't find the SaveDataFiler folder."); } private void clickOpenSDBFolder(object sender, EventArgs e) { - string path3DS = Util.get3DSLocation(); + string path3DS = Path.GetPathRoot(Util.get3DSLocation()); string path; - if (path3DS != null && Directory.Exists(path = Path.Combine(Path.GetPathRoot(path3DS), "SaveDataBackup"))) + if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "SaveDataBackup"))) Process.Start("explorer.exe", path); else Util.Alert("Can't find the SaveDataBackup folder."); @@ -3248,36 +3248,11 @@ namespace PKHeX // Save Folder Related private void clickSaveFileName(object sender, EventArgs e) { - string path = detectSaveFile(); + string path = SaveUtil.detectSaveFile(); if (path == null || !File.Exists(path)) return; if (Util.Prompt(MessageBoxButtons.YesNo, "Open save file from the following location?", path) == DialogResult.Yes) openQuick(path); // load save } - private static string detectSaveFile() - { - string pathSDF = Util.GetSDFLocation(); - string path3DS = Util.get3DSLocation(); - string pathCache = Util.GetCacheFolder(); - - if (path3DS != null && Directory.Exists(Path.Combine(path3DS, "SaveDataBackup")) && ModifierKeys != Keys.Control) - return Path.Combine(Path.GetPathRoot(path3DS), "SaveDataBackup", "main"); - if (pathSDF != null && ModifierKeys != Keys.Shift) // if we have a result - return Path.Combine(pathSDF, "main"); - if (path3DS != null && Directory.Exists(Path.Combine(Path.GetPathRoot(path3DS), "JKSV", "Saves"))) - return Directory.GetFiles(Path.Combine(Path.GetPathRoot(path3DS), "JKSV", "Saves"), "main", SearchOption.AllDirectories) - .Where(f => SaveUtil.SizeValidSAV6((int)new FileInfo(f).Length)) // filter - .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); - if (Directory.Exists(pathCache)) - return Directory.GetFiles(pathCache).Where(f => SaveUtil.SizeValidSAV6((int)new FileInfo(f).Length)) // filter - .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); - try - { - if (File.Exists(Util.NormalizePath(Path.Combine(Util.GetTempFolder(), "root", "main")))) // if cgse exists - return Util.NormalizePath(Path.Combine(Util.GetTempFolder(), "root", "main")); - } catch { } - - return null; - } // Drag & Drop within Box private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e) diff --git a/Saves/SAV6.cs b/Saves/SAV6.cs index df076efb0..0e1064940 100644 --- a/Saves/SAV6.cs +++ b/Saves/SAV6.cs @@ -7,6 +7,7 @@ namespace PKHeX public sealed class SAV6 : SaveFile { // Save Data Attributes + public const string DefaultFileName = "main"; public override string BAKName => $"{FileName} [{OT} ({Version}) - {LastSavedTime}].bak"; public override string Filter => "Main SAV|*.*"; public override string Extension => ""; diff --git a/Saves/SaveUtil.cs b/Saves/SaveUtil.cs index 0413eab07..e4fc2cea9 100644 --- a/Saves/SaveUtil.cs +++ b/Saves/SaveUtil.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Text; @@ -176,6 +177,53 @@ namespace PKHeX } } + /// + /// Detects a save file. + /// + /// File Name to look for. + /// Full path of a save file. Returns null if unable to find any. + public static string detectSaveFile(string fileName = SAV6.DefaultFileName) + { + string path; + string path3DS = Path.GetPathRoot(Util.get3DSLocation()); + + // save_manager + if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "saveDataBackup"))) + if (File.Exists(path = Path.Combine(path, fileName))) + return path; + + // SaveDataFiler + if (path3DS != null && Directory.Exists(Path.Combine(path3DS, "filer", "UserSaveData"))) + return getNewestSavePath(Path.Combine(path3DS, "filer", "UserSaveData"), fileName); + + // JKSV + if (path3DS != null && Directory.Exists(Path.Combine(path3DS, "JKSV", "Saves"))) + return getNewestSavePath(Path.Combine(path3DS, "JKSV", "Saves"), "main"); + + // CyberGadget (Cache) + string pathCache = Util.GetCacheFolder(); + if (Directory.Exists(pathCache)) + return Directory.GetFiles(pathCache).Where(f => SizeValidSAV6((int)new FileInfo(f).Length)) // filter + .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); + + return null; + } + /// + /// Retrieves the full path of the most recent file based on LastWriteTime. + /// + /// Folder to look within + /// Filename to look for, if null can be named anything + /// Search all subfolders + /// Full path of a save file. Returns null if unable to find any. + public static string getNewestSavePath(string folderPath, string fileName, bool deep = true) + { + if (!Directory.Exists(folderPath)) + return null; + return Directory.GetFiles(folderPath, fileName ?? "*", deep ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) + .Where(f => SizeValidSAV6((int)new FileInfo(f).Length)) // filter + .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); + } + /// /// Determines whether the save data size is valid for 6th generation saves. /// diff --git a/Util/PathUtil.cs b/Util/PathUtil.cs index 741f16d21..6159fc92b 100644 --- a/Util/PathUtil.cs +++ b/Util/PathUtil.cs @@ -6,11 +6,6 @@ namespace PKHeX { public partial class Util { - internal static string NormalizePath(string path) - { - return Path.GetFullPath(new Uri(path).LocalPath) - .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); - } internal static string GetTempFolder() { return Path.Combine(Path.GetTempPath(), "3DSSE"); @@ -62,38 +57,6 @@ namespace PKHeX catch { } return null; } - internal static string GetSDFLocation() - { - try - { - // Start by checking if the 3DS file path exists or not. - string path_SDF = null; - string[] DriveList = Environment.GetLogicalDrives(); - for (int i = 1; i < DriveList.Length; i++) // Skip first drive (some users still have floppy drives and would chew up time!) - { - string potentialPath_SDF = NormalizePath(Path.Combine(DriveList[i], "filer", "UserSaveData")); - if (!Directory.Exists(potentialPath_SDF)) continue; - - path_SDF = potentialPath_SDF; break; - } - if (path_SDF == null) - return null; - // 3DS data found in SD card reader. Let's get the title folder location! - string[] folders = Directory.GetDirectories(path_SDF, "*", SearchOption.TopDirectoryOnly); - Array.Sort(folders); // Don't need Modified Date, sort by path names just in case. - - // Loop through all the folders in the Nintendo 3DS folder to see if any of them contain 'title'. - for (int i = folders.Length - 1; i >= 0; i--) - { - if (File.Exists(Path.Combine(folders[i], "000011c4", "main"))) return Path.Combine(folders[i], "000011c4"); // OR - if (File.Exists(Path.Combine(folders[i], "000011c5", "main"))) return Path.Combine(folders[i], "000011c5"); // AS - if (File.Exists(Path.Combine(folders[i], "0000055d", "main"))) return Path.Combine(folders[i], "0000055d"); // X - if (File.Exists(Path.Combine(folders[i], "0000055e", "main"))) return Path.Combine(folders[i], "0000055e"); // Y - } - return null; // Fallthrough - } - catch { return null; } - } internal static string CleanFileName(string fileName) { return Path.GetInvalidFileNameChars().Aggregate(fileName, (current, c) => current.Replace(c.ToString(), string.Empty)); From 5ceafc21e17aa168d8f10a384260f35945af7008 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 4 Aug 2016 21:12:16 -0700 Subject: [PATCH 15/34] Add TWLSaveTool support A little more computationally intensive, but checking for the first valid save file after checking for valid save paths seems legit. --- Saves/SaveUtil.cs | 50 +++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/Saves/SaveUtil.cs b/Saves/SaveUtil.cs index e4fc2cea9..5b7976b7b 100644 --- a/Saves/SaveUtil.cs +++ b/Saves/SaveUtil.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; @@ -139,7 +140,7 @@ namespace PKHeX /// Version Identifier or Invalid if type cannot be determined. public static GameVersion getIsG6SAV(byte[] data) { - if (!SizeValidSAV6(data.Length)) + if (!new []{SIZE_G6XY, SIZE_G6ORAS, SIZE_G6ORASDEMO}.Contains(data.Length)) return GameVersion.Invalid; if (BitConverter.ToUInt32(data, data.Length - 0x1F0) != BEEF) @@ -180,48 +181,50 @@ namespace PKHeX /// /// Detects a save file. /// - /// File Name to look for. /// Full path of a save file. Returns null if unable to find any. - public static string detectSaveFile(string fileName = SAV6.DefaultFileName) + public static string detectSaveFile() { string path; string path3DS = Path.GetPathRoot(Util.get3DSLocation()); - + List possiblePaths = new List(); + // save_manager if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "saveDataBackup"))) - if (File.Exists(path = Path.Combine(path, fileName))) - return path; + if (File.Exists(path = Path.Combine(path))) + possiblePaths.Add(path); // SaveDataFiler - if (path3DS != null && Directory.Exists(Path.Combine(path3DS, "filer", "UserSaveData"))) - return getNewestSavePath(Path.Combine(path3DS, "filer", "UserSaveData"), fileName); + if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "filer", "UserSaveData"))) + possiblePaths.AddRange(getSavesFromFolder(path, true)); // JKSV - if (path3DS != null && Directory.Exists(Path.Combine(path3DS, "JKSV", "Saves"))) - return getNewestSavePath(Path.Combine(path3DS, "JKSV", "Saves"), "main"); + if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "JKSV", "Saves"))) + possiblePaths.AddRange(getSavesFromFolder(path, true)); + + // TWL Save Tool + if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "TWLSaveTool"))) + possiblePaths.AddRange(getSavesFromFolder(path, false)); // CyberGadget (Cache) string pathCache = Util.GetCacheFolder(); if (Directory.Exists(pathCache)) - return Directory.GetFiles(pathCache).Where(f => SizeValidSAV6((int)new FileInfo(f).Length)) // filter - .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); + possiblePaths.AddRange(getSavesFromFolder(Path.Combine(pathCache), false)); - return null; + // return newest save file path that is valid (oh man) + return possiblePaths.OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(p => getVariantSAV(File.ReadAllBytes(p)).ChecksumsValid); } /// /// Retrieves the full path of the most recent file based on LastWriteTime. /// /// Folder to look within - /// Filename to look for, if null can be named anything /// Search all subfolders - /// Full path of a save file. Returns null if unable to find any. - public static string getNewestSavePath(string folderPath, string fileName, bool deep = true) + /// Full path of all save files that match criteria. + public static IEnumerable getSavesFromFolder(string folderPath, bool deep) { if (!Directory.Exists(folderPath)) return null; - return Directory.GetFiles(folderPath, fileName ?? "*", deep ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) - .Where(f => SizeValidSAV6((int)new FileInfo(f).Length)) // filter - .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); + return Directory.GetFiles(folderPath, "*", deep ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) + .Where(f => SizeValidSAV((int)new FileInfo(f).Length)); } /// @@ -229,16 +232,21 @@ namespace PKHeX /// /// Size in bytes of the save data /// A boolean indicating whether or not the save data size is valid. - public static bool SizeValidSAV6(int size) + public static bool SizeValidSAV(int size) { switch (size) { case SIZE_G6XY: case SIZE_G6ORASDEMO: case SIZE_G6ORAS: + case SIZE_G5B2W2: + case SIZE_G4RAW: + case SIZE_G3RAW: + case SIZE_G3RAWHALF: return true; + default: + return false; } - return false; } // SAV Manipulation From a8d76fa9fb0fc092e91ce13108d2809d476e60d8 Mon Sep 17 00:00:00 2001 From: Elias Carrillo Date: Fri, 5 Aug 2016 04:04:56 -0700 Subject: [PATCH 16/34] Improved the way drag and drop is initiated. Temp pkx file is not generated until user left-clicks and moves. Prevents drag and drop of blank pokemon from slots previously held by dragged pokemon. Response for left-click actions moved into left-click event. --- MainWindow/Main.Designer.cs | 188 ++++++++++++++++++++++++++++++++++++ MainWindow/Main.cs | 178 ++++++++++++++++++++++------------ 2 files changed, 303 insertions(+), 63 deletions(-) diff --git a/MainWindow/Main.Designer.cs b/MainWindow/Main.Designer.cs index 2f84afa00..91bf1f5d5 100644 --- a/MainWindow/Main.Designer.cs +++ b/MainWindow/Main.Designer.cs @@ -3072,7 +3072,11 @@ this.bpkx30.TabStop = false; this.bpkx30.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx30.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx30.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx30.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx30.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx30.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx30.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // mnuVSD // @@ -3116,7 +3120,11 @@ this.bpkx29.TabStop = false; this.bpkx29.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx29.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx29.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx29.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx29.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx29.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx29.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx28 // @@ -3130,7 +3138,11 @@ this.bpkx28.TabStop = false; this.bpkx28.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx28.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx28.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx28.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx28.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx28.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx28.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx27 // @@ -3144,7 +3156,11 @@ this.bpkx27.TabStop = false; this.bpkx27.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx27.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx27.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx27.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx27.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx27.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx27.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx26 // @@ -3158,7 +3174,11 @@ this.bpkx26.TabStop = false; this.bpkx26.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx26.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx26.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx26.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx26.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx26.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx26.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx25 // @@ -3172,7 +3192,11 @@ this.bpkx25.TabStop = false; this.bpkx25.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx25.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx25.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx25.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx25.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx25.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx25.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx24 // @@ -3186,7 +3210,11 @@ this.bpkx24.TabStop = false; this.bpkx24.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx24.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx24.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx24.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx24.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx24.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx24.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx23 // @@ -3200,7 +3228,11 @@ this.bpkx23.TabStop = false; this.bpkx23.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx23.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx23.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx23.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx23.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx23.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx23.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx22 // @@ -3214,7 +3246,11 @@ this.bpkx22.TabStop = false; this.bpkx22.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx22.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx22.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx22.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx22.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx22.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx22.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx21 // @@ -3228,7 +3264,11 @@ this.bpkx21.TabStop = false; this.bpkx21.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx21.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx21.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx21.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx21.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx21.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx21.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx20 // @@ -3242,7 +3282,11 @@ this.bpkx20.TabStop = false; this.bpkx20.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx20.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx20.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx20.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx20.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx20.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx20.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx19 // @@ -3256,7 +3300,11 @@ this.bpkx19.TabStop = false; this.bpkx19.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx19.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx19.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx19.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx19.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx19.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx19.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx18 // @@ -3270,7 +3318,11 @@ this.bpkx18.TabStop = false; this.bpkx18.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx18.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx18.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx18.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx18.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx18.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx18.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx17 // @@ -3284,7 +3336,11 @@ this.bpkx17.TabStop = false; this.bpkx17.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx17.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx17.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx17.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx17.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx17.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx17.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx16 // @@ -3298,7 +3354,11 @@ this.bpkx16.TabStop = false; this.bpkx16.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx16.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx16.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx16.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx16.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx16.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx16.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx15 // @@ -3312,7 +3372,11 @@ this.bpkx15.TabStop = false; this.bpkx15.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx15.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx15.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx15.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx15.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx15.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx15.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx14 // @@ -3326,7 +3390,11 @@ this.bpkx14.TabStop = false; this.bpkx14.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx14.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx14.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx14.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx14.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx14.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx14.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx13 // @@ -3340,7 +3408,11 @@ this.bpkx13.TabStop = false; this.bpkx13.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx13.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx13.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx13.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx13.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx13.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx13.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx12 // @@ -3354,7 +3426,11 @@ this.bpkx12.TabStop = false; this.bpkx12.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx12.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx12.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx12.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx12.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx12.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx12.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx11 // @@ -3368,7 +3444,11 @@ this.bpkx11.TabStop = false; this.bpkx11.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx11.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx11.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx11.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx11.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx11.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx11.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx10 // @@ -3382,7 +3462,11 @@ this.bpkx10.TabStop = false; this.bpkx10.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx10.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx10.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx10.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx10.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx10.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx10.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx9 // @@ -3396,7 +3480,11 @@ this.bpkx9.TabStop = false; this.bpkx9.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx9.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx9.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx9.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx9.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx9.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx9.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx8 // @@ -3410,7 +3498,11 @@ this.bpkx8.TabStop = false; this.bpkx8.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx8.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx8.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx8.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx8.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx8.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx8.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx7 // @@ -3424,7 +3516,11 @@ this.bpkx7.TabStop = false; this.bpkx7.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx7.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx7.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx7.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx7.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx7.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx7.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx6 // @@ -3438,7 +3534,11 @@ this.bpkx6.TabStop = false; this.bpkx6.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx6.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx5 // @@ -3452,7 +3552,11 @@ this.bpkx5.TabStop = false; this.bpkx5.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx5.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx4 // @@ -3466,7 +3570,11 @@ this.bpkx4.TabStop = false; this.bpkx4.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx4.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx3 // @@ -3480,7 +3588,11 @@ this.bpkx3.TabStop = false; this.bpkx3.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx3.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx2 // @@ -3494,7 +3606,11 @@ this.bpkx2.TabStop = false; this.bpkx2.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx2.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bpkx1 // @@ -3508,7 +3624,11 @@ this.bpkx1.TabStop = false; this.bpkx1.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx1.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); + this.bpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bpkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // B_BoxRight // @@ -3624,7 +3744,11 @@ this.bbpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx1.TabIndex = 8; this.bbpkx1.TabStop = false; + this.bbpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bbpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bbpkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bbpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bbpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // mnuV // @@ -3649,7 +3773,11 @@ this.bbpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx2.TabIndex = 9; this.bbpkx2.TabStop = false; + this.bbpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bbpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bbpkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bbpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bbpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bbpkx3 // @@ -3660,7 +3788,11 @@ this.bbpkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx3.TabIndex = 10; this.bbpkx3.TabStop = false; + this.bbpkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bbpkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bbpkx3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bbpkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bbpkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bbpkx4 // @@ -3671,7 +3803,11 @@ this.bbpkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx4.TabIndex = 11; this.bbpkx4.TabStop = false; + this.bbpkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bbpkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bbpkx4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bbpkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bbpkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bbpkx5 // @@ -3682,7 +3818,11 @@ this.bbpkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx5.TabIndex = 12; this.bbpkx5.TabStop = false; + this.bbpkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bbpkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bbpkx5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bbpkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bbpkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // bbpkx6 // @@ -3693,7 +3833,11 @@ this.bbpkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx6.TabIndex = 13; this.bbpkx6.TabStop = false; + this.bbpkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.bbpkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.bbpkx6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.bbpkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.bbpkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // L_ReadOnlyPBB // @@ -3749,7 +3893,11 @@ this.ppkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx1.TabIndex = 2; this.ppkx1.TabStop = false; + this.ppkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.ppkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.ppkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.ppkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.ppkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // ppkx2 // @@ -3760,7 +3908,11 @@ this.ppkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx2.TabIndex = 3; this.ppkx2.TabStop = false; + this.ppkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.ppkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.ppkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.ppkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.ppkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // ppkx3 // @@ -3771,7 +3923,11 @@ this.ppkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx3.TabIndex = 4; this.ppkx3.TabStop = false; + this.ppkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.ppkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.ppkx3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.ppkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.ppkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // ppkx4 // @@ -3782,7 +3938,11 @@ this.ppkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx4.TabIndex = 5; this.ppkx4.TabStop = false; + this.ppkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.ppkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.ppkx4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.ppkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.ppkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // ppkx5 // @@ -3793,7 +3953,11 @@ this.ppkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx5.TabIndex = 6; this.ppkx5.TabStop = false; + this.ppkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.ppkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.ppkx5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.ppkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.ppkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // ppkx6 // @@ -3804,7 +3968,11 @@ this.ppkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx6.TabIndex = 7; this.ppkx6.TabStop = false; + this.ppkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.ppkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.ppkx6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.ppkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.ppkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // Tab_Other // @@ -3922,7 +4090,11 @@ this.dcpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.dcpkx2.TabIndex = 11; this.dcpkx2.TabStop = false; + this.dcpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.dcpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.dcpkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.dcpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.dcpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // dcpkx1 // @@ -3934,7 +4106,11 @@ this.dcpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.dcpkx1.TabIndex = 10; this.dcpkx1.TabStop = false; + this.dcpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.dcpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.dcpkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.dcpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.dcpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // DayCare_HasEgg // @@ -3967,7 +4143,11 @@ this.gtspkx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.gtspkx.TabIndex = 23; this.gtspkx.TabStop = false; + this.gtspkx.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.gtspkx.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.gtspkx.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.gtspkx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.gtspkx.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // GB_Fused // @@ -3989,7 +4169,11 @@ this.fusedpkx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.fusedpkx.TabIndex = 24; this.fusedpkx.TabStop = false; + this.fusedpkx.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.fusedpkx.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.fusedpkx.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.fusedpkx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.fusedpkx.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // L_ReadOnlyOther // @@ -4023,7 +4207,11 @@ this.subepkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.subepkx1.TabIndex = 18; this.subepkx1.TabStop = false; + this.subepkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); this.subepkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); + this.subepkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); + this.subepkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); + this.subepkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); // // subepkx2 // diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index dd5cf8184..d48cbcf08 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -18,7 +18,7 @@ namespace PKHeX { #region Initialize Form new Thread(() => new SplashScreen().ShowDialog()).Start(); - pkm_from = SAV.BlankPKM.EncryptedPartyData; + slotPkmSource = SAV.BlankPKM.EncryptedPartyData; InitializeComponent(); CB_ExtraBytes.SelectedIndex = 0; SaveFile.SetUpdateDex = Menu_ModifyDex.Checked; @@ -3279,60 +3279,91 @@ namespace PKHeX return null; } - // Drag & Drop within Box + // Drag and drop related functions + private void pbBoxSlot_MouseClick(object sender, MouseEventArgs e) + { + if (slotDragDropInProgress) + return; + + clickSlot(sender, e); + } + private void pbBoxSlot_MouseUp(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + slotLeftMouseIsDown = false; + if (e.Button == MouseButtons.Right) + slotRightMouseIsDown = false; + } private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e) { - if (e.Button != MouseButtons.Left || e.Clicks != 1) return; - if (ModifierKeys == Keys.Control || ModifierKeys == Keys.Alt || ModifierKeys == Keys.Shift || ModifierKeys == (Keys.Control | Keys.Alt)) - { clickSlot(sender, e); return; } - PictureBox pb = (PictureBox)sender; - if (pb.Image == null) + if (e.Button == MouseButtons.Left) + slotLeftMouseIsDown = true; + if (e.Button == MouseButtons.Right) + slotRightMouseIsDown = true; + } + private void pbBoxSlot_MouseMove(object sender, MouseEventArgs e) + { + if (slotDragDropInProgress) return; - pkm_from_slot = getSlot(sender); - int offset = getPKXOffset(pkm_from_slot); - // Create Temp File to Drag - Cursor.Current = Cursors.Hand; - - // Prepare Data - pkm_from = SAV.getData(offset, SAV.SIZE_STORED); - pkm_from_offset = offset; - - // Make a new file name based off the PID - byte[] dragdata = SAV.decryptPKM(pkm_from); - Array.Resize(ref dragdata, SAV.SIZE_STORED); - PKM pkx = SAV.getPKM(dragdata); - string filename = pkx.FileName; - - // Make File - string newfile = Path.Combine(Path.GetTempPath(), Util.CleanFileName(filename)); - try + if (slotLeftMouseIsDown) { - File.WriteAllBytes(newfile, dragdata); - DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newfile }), DragDropEffects.Move); + // The goal is to create a temporary PKX file for the underlying Pokemon + // and use that file to perform a drag drop operation. + + // Abort if there is no Pokemon in the given slot. + if (((PictureBox)sender).Image == null) + return; + + // Set flag to prevent re-entering. + slotDragDropInProgress = true; + + slotSourceSlotNumber = getSlot(sender); + int offset = getPKXOffset(slotSourceSlotNumber); + + // Prepare Data + slotPkmSource = SAV.getData(offset, SAV.SIZE_STORED); + slotSourceOffset = offset; + + // Make a new file name based off the PID + byte[] dragdata = SAV.decryptPKM(slotPkmSource); + Array.Resize(ref dragdata, SAV.SIZE_STORED); + PKM pkx = SAV.getPKM(dragdata); + string filename = pkx.FileName; + + // Make File + string newfile = Path.Combine(Path.GetTempPath(), Util.CleanFileName(filename)); + try + { + File.WriteAllBytes(newfile, dragdata); + // Thread Blocks on DoDragDrop + ((PictureBox)sender).DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newfile }), DragDropEffects.Move); + } + catch (Exception x) + { + Util.Error("Drag & Drop Error:", x.ToString()); + } + slotSourceOffset = 0; + + // Browser apps need time to load data since the file isn't moved to a location on the user's local storage. + // Tested 10ms -> too quick, 100ms was fine. 500ms should be safe? + new Thread(() => + { + Thread.Sleep(500); + if (File.Exists(newfile)) + File.Delete(newfile); + }).Start(); } - catch (ArgumentException x) - { Util.Error("Drag & Drop Error:", x.ToString()); } - pkm_from_offset = 0; - - // Browser apps need time to load data since the file isn't moved to a location on the user's local storage. - // Tested 10ms -> too quick, 100ms was fine. 500ms should be safe? - new Thread(() => - { - Thread.Sleep(500); - if (File.Exists(newfile)) - File.Delete(newfile); - }).Start(); } private void pbBoxSlot_DragDrop(object sender, DragEventArgs e) { - int slot = getSlot(sender); - int offset = getPKXOffset(slot); + int slotDestinationSlotNumber = getSlot(sender); + int slotDestinationOffset = getPKXOffset(slotDestinationSlotNumber); // Check for In-Dropped files (PKX,SAV,ETC) string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (Directory.Exists(files[0])) { loadBoxesFromDB(files[0]); return; } - if (pkm_from_offset == 0) + if (slotSourceOffset == 0) { if (files.Length <= 0) return; @@ -3358,36 +3389,45 @@ namespace PKHeX { Console.WriteLine(c); Console.WriteLine(concat); return; } } - SAV.setStoredSlot(pk, offset); - getQuickFiller(SlotPictureBoxes[slot], pk); - getSlotColor(slot, Properties.Resources.slotSet); + SAV.setStoredSlot(pk, slotDestinationOffset); + getQuickFiller(SlotPictureBoxes[slotDestinationSlotNumber], pk); + getSlotColor(slotDestinationSlotNumber, Properties.Resources.slotSet); Console.WriteLine(c); } else { - PKM pkz = SAV.getStoredSlot(pkm_from_offset); - if (ModifierKeys == Keys.Alt && slot > -1) // overwrite delete old slot + PKM pkz = SAV.getStoredSlot(slotSourceOffset); + if (ModifierKeys == Keys.Alt && slotDestinationSlotNumber > -1) // overwrite delete old slot { // Clear from slot - getQuickFiller(SlotPictureBoxes[pkm_from_slot], SAV.BlankPKM); // picturebox - SAV.setStoredSlot(SAV.BlankPKM, pkm_from_offset); // savefile + getQuickFiller(SlotPictureBoxes[slotSourceSlotNumber], SAV.BlankPKM); // picturebox + SAV.setStoredSlot(SAV.BlankPKM, slotSourceOffset); // savefile } - else if (ModifierKeys != Keys.Control && slot > -1) + else if (ModifierKeys != Keys.Control && slotDestinationSlotNumber > -1) { - // Load data from destination - PKM pk = SAV.getStoredSlot(offset); + if (((PictureBox)sender).Image != null) + { + // Load data from destination + PKM pk = SAV.getStoredSlot(slotDestinationOffset); - // Swap slot picture - getQuickFiller(SlotPictureBoxes[pkm_from_slot], pk); + // Set destination pokemon image to source picture box + getQuickFiller(SlotPictureBoxes[slotSourceSlotNumber], pk); - // Swap slot data to source - SAV.setStoredSlot(pk, pkm_from_offset); + // Set destination pokemon data to source slot + SAV.setStoredSlot(pk, slotSourceOffset); + } + else + { + // Set blank to source slot + SAV.setStoredSlot(SAV.BlankPKM, slotSourceOffset); + SlotPictureBoxes[slotSourceSlotNumber].Image = null; + } } - // Copy from temp slot to new. - SAV.setStoredSlot(pkz, offset); - getQuickFiller(SlotPictureBoxes[slot], pkz); + // Copy from temp to destination slot. + SAV.setStoredSlot(pkz, slotDestinationOffset); + getQuickFiller(SlotPictureBoxes[slotDestinationSlotNumber], pkz); - pkm_from_offset = 0; // Clear offset value + slotSourceOffset = 0; // Clear offset value } } private void pbBoxSlot_DragEnter(object sender, DragEventArgs e) @@ -3397,10 +3437,22 @@ namespace PKHeX else if (e.Data != null) // within e.Effect = DragDropEffects.Move; } + private void pbBoxSlot_QueryContinueDrag(object sender, QueryContinueDragEventArgs e) + { + if (e.Action == DragAction.Cancel || e.Action == DragAction.Drop) + { + slotLeftMouseIsDown = false; + slotRightMouseIsDown = false; + slotDragDropInProgress = false; + } + } - private byte[] pkm_from; - private int pkm_from_offset; - private int pkm_from_slot = -1; + private static bool slotLeftMouseIsDown = false; + private static bool slotRightMouseIsDown = false; + private static bool slotDragDropInProgress = false; + private byte[] slotPkmSource; + private int slotSourceOffset; + private int slotSourceSlotNumber = -1; #endregion } } From fdbeada3b767c5c65dc63929a876e775228ad579 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 5 Aug 2016 05:51:55 -0700 Subject: [PATCH 17/34] Improve dragdrop from box to tabs Previously only allowed dragging to the Preview box to load to tabs, now if a box slot is dragged to anywhere in the window it will load. Unrelated to previous pull request :) --- MainWindow/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 7273f2462..51b675fd5 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -2402,7 +2402,7 @@ namespace PKHeX // Drag & Drop Events private void tabMain_DragEnter(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; + if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Move; } private void tabMain_DragDrop(object sender, DragEventArgs e) { From 034da95ff4986fc4795e379cef6a2fe3deeb071c Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 5 Aug 2016 16:21:15 -0700 Subject: [PATCH 18/34] Re-enable Vivillon form editing Dunno why it was disabled. Thanks Majickhat55! --- Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs b/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs index 736bf6990..401b769f7 100644 --- a/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs +++ b/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs @@ -1669,7 +1669,6 @@ namespace PKHeX // CB_Vivillon // this.CB_Vivillon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_Vivillon.Enabled = false; this.CB_Vivillon.FormattingEnabled = true; this.CB_Vivillon.Location = new System.Drawing.Point(287, 73); this.CB_Vivillon.Name = "CB_Vivillon"; From 61573301d6cc9af3d29acfe1dd65d80f26c35641 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 5 Aug 2016 21:02:54 -0700 Subject: [PATCH 19/34] Fix Ho-Oh fullwidth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gen3 changes to gen4: - to - Just display as short width Fix unknown character (0xFF => early termination) throwing an exception Chartables were not spaced correctly (hex table), fixed now. --- PKM/PKX.cs | 69 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/PKM/PKX.cs b/PKM/PKX.cs index 05d988355..76b26ba21 100644 --- a/PKM/PKX.cs +++ b/PKM/PKX.cs @@ -1043,7 +1043,8 @@ namespace PKHeX { Array.Resize(ref strdata, i); break; } strdata[i] = val; } - strdata[str.Length] = 0xFF; + if (strdata.Length > 0) + strdata[strdata.Length - 1] = 0xFF; return strdata; } @@ -1469,44 +1470,42 @@ namespace PKHeX internal static readonly ushort[] G34_4E = { - 478, 351, 352, 353, 358, 359, 360, 361, 362, 363, 020, 365, 366, 369, 370, - 371, 415, 376, 377, 378, 368, 382, 383, 384, 046, 358, 359, 392, 393, 394, - 395, 396, 397, 398, 401, 402, 403, 416, 408, 409, 410, 400, 420, 419, 479, - 450, 445, 003, 004, 006, 008, 010, 068, 449, 072, 013, 015, 017, 019, 021, - 023, 025, 027, 029, 031, 033, 035, 038, 040, 042, 049, 052, 055, 058, 061, - 050, 053, 056, 059, 062, 036, 426, 425, 480, 481, 091, 092, 094, 096, 098, - 364, 100, 102, 106, 108, 110, 112, 114, 117, 119, 121, 123, 124, 125, 385, - 127, 128, 131, 134, 137, 140, 396, 144, 145, 146, 147, 149, 151, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 082, 084, 086, 088, 090, 148, 150, 152, - 093, 095, 097, 099, 101, 103, 105, 107, 109, 111, 113, 115, 118, 120, 122, - 129, 132, 135, 138, 141, 130, 133, 136, 139, 142, 116, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 427, 428, 430, 241, 230, 431, 436, 437, 434, - 435, 443, 444, 424, 429, 242, 433, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 289, - 452, 355, 373, 379, 387, 405, 411 + 478, 351, 352, 353, 358, 359, 360, 361, 362, 363, 020, 365, 366, 369, 370, 371, // 0 + 415, 376, 377, 378, 368, 382, 383, 384, 046, 358, 359, 392, 393, 394, 395, 396, // 1 + 397, 398, 401, 402, 403, 416, 408, 409, 410, 400, 420, 419, 479, 450, 445, 003, // 2 + 004, 006, 008, 010, 068, 449, 072, 013, 015, 017, 019, 021, 023, 025, 027, 029, // 3 + 031, 033, 035, 038, 040, 042, 049, 052, 055, 058, 061, 050, 053, 056, 059, 062, // 4 + 036, 426, 425, 480, 481, 091, 092, 094, 096, 098, 364, 100, 102, 106, 108, 110, // 5 + 112, 114, 117, 119, 121, 123, 124, 125, 385, 127, 128, 131, 134, 137, 140, 396, // 6 + 144, 145, 146, 147, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 082, // 7 + 084, 086, 088, 090, 148, 150, 152, 093, 095, 097, 099, 101, 103, 105, 107, 109, // 8 + 111, 113, 115, 118, 120, 122, 129, 132, 135, 138, 141, 130, 133, 136, 139, 142, // 9 + 116, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 427, 428, 430, 446, 230, // A + 431, 436, 437, 434, 435, 443, 444, 424, 429, 242, 433, 299, 300, 301, 302, 303, // B + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, // C + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, // D + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 289, // E + 452, 355, 373, 379, 387, 405, 411 // F }; internal static readonly ushort[] G34_4J = { - 001, 003, 005, 007, 009, 011, 012, 014, 016, 018, 020, 022, 024, 026, 028, - 030, 032, 034, 037, 039, 041, 043, 044, 045, 046, 047, 048, 051, 054, 057, - 060, 063, 064, 065, 066, 067, 069, 071, 073, 074, 075, 076, 077, 078, 079, - 080, 081, 002, 004, 006, 008, 010, 068, 070, 072, 013, 015, 017, 019, 021, - 023, 025, 027, 029, 031, 033, 035, 038, 040, 042, 049, 052, 055, 058, 061, - 050, 053, 056, 059, 062, 036, 083, 085, 087, 089, 091, 092, 094, 096, 098, - 100, 102, 104, 106, 108, 110, 112, 114, 117, 119, 121, 123, 124, 125, 126, - 127, 128, 131, 134, 137, 140, 143, 144, 145, 146, 147, 149, 151, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 082, 084, 086, 088, 090, 148, 150, 152, - 093, 095, 097, 099, 101, 103, 105, 107, 109, 111, 113, 115, 118, 120, 122, - 129, 132, 135, 138, 141, 130, 133, 136, 139, 142, 116, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 225, 226, 228, 241, 230, 229, 234, 235, 232, - 233, 443, 444, 424, 430, 242, 433, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 289, - 452, 355, 373, 379, 387, 405, 411 + 001, 003, 005, 007, 009, 011, 012, 014, 016, 018, 020, 022, 024, 026, 028, 030, // 0 + 032, 034, 037, 039, 041, 043, 044, 045, 046, 047, 048, 051, 054, 057, 060, 063, // 1 + 064, 065, 066, 067, 069, 071, 073, 074, 075, 076, 077, 078, 079, 080, 081, 002, // 2 + 004, 006, 008, 010, 068, 070, 072, 013, 015, 017, 019, 021, 023, 025, 027, 029, // 3 + 031, 033, 035, 038, 040, 042, 049, 052, 055, 058, 061, 050, 053, 056, 059, 062, // 4 + 036, 083, 085, 087, 089, 091, 092, 094, 096, 098, 100, 102, 104, 106, 108, 110, // 5 + 112, 114, 117, 119, 121, 123, 124, 125, 126, 127, 128, 131, 134, 137, 140, 143, // 6 + 144, 145, 146, 147, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 082, // 7 + 084, 086, 088, 090, 148, 150, 152, 093, 095, 097, 099, 101, 103, 105, 107, 109, // 8 + 111, 113, 115, 118, 120, 122, 129, 132, 135, 138, 141, 130, 133, 136, 139, 142, // 9 + 116, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 225, 226, 228, 446, 230, // A + 229, 234, 235, 232, 233, 443, 444, 424, 430, 242, 433, 172, 173, 174, 175, 176, // B + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, // C + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, // D + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 289, // E + 452, 355, 373, 379, 387, 405, 411 // F }; #endregion From 98e72aefc813ebdd2d1c6c19f6f0a8a8e3445156 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 5 Aug 2016 21:36:51 -0700 Subject: [PATCH 20/34] Fix gen3 unknown game data setting Grab the original data, not the expanded data. Could always call 'clone' but the data hasn't been modified, so get the original data. --- MainWindow/Main.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 51b675fd5..546a41676 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -720,11 +720,11 @@ namespace PKHeX "Cancel: FireRed / LeafGreen"); if (drGame == DialogResult.Yes) - sav = new SAV3(sav.Data, GameVersion.RS); + sav = new SAV3(sav.BAK, GameVersion.RS); else if (drGame == DialogResult.No) - sav = new SAV3(sav.Data, GameVersion.E); + sav = new SAV3(sav.BAK, GameVersion.E); else - sav = new SAV3(sav.Data, GameVersion.FRLG); + sav = new SAV3(sav.BAK, GameVersion.FRLG); } var drJP = Util.Prompt(MessageBoxButtons.YesNoCancel, $"Generation 3 ({sav.Version}) Save File detected. Select Origins:", "Yes: International" + Environment.NewLine + "No: Japanese"); if (drJP == DialogResult.Cancel) From fcd28937365dbfa829e6783618b8f27c51c76c4d Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 5 Aug 2016 22:59:02 -0700 Subject: [PATCH 21/34] Remove unused property Was used in the save detection method which was redesigned to not need a filename. --- Saves/SAV6.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Saves/SAV6.cs b/Saves/SAV6.cs index 0e1064940..df076efb0 100644 --- a/Saves/SAV6.cs +++ b/Saves/SAV6.cs @@ -7,7 +7,6 @@ namespace PKHeX public sealed class SAV6 : SaveFile { // Save Data Attributes - public const string DefaultFileName = "main"; public override string BAKName => $"{FileName} [{OT} ({Version}) - {LastSavedTime}].bak"; public override string Filter => "Main SAV|*.*"; public override string Extension => ""; From a8a0060c2e31dfe21f5a994c14a310f4a428d302 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 5 Aug 2016 23:21:27 -0700 Subject: [PATCH 22/34] Fix gen4 pkm location/ball interaction Met Location fixed from Daycare Couple to "Faraway Place" (2000 -> 3002) Check no egg location before writing faraway place. HGSSBall handled directly by Ball property (like met location) Constrain balls and met locations for DP Thanks BeyondTheHorizon for the initial bug report prompting this improvement. --- PKM/PK4.cs | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- PKM/PKM.cs | 3 ++- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/PKM/PK4.cs b/PKM/PK4.cs index 877a0b76e..bc0a04c36 100644 --- a/PKM/PK4.cs +++ b/PKM/PK4.cs @@ -261,10 +261,21 @@ namespace PKHeX } set { - if (PtHGSS) + if (value == 0) + { + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x44); + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x7E); + } + else if (PtHGSS) { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x44); - BitConverter.GetBytes(0x7D0).CopyTo(Data, 0x7E); + BitConverter.GetBytes(0xBBA).CopyTo(Data, 0x7E); // Faraway Place (for DP display) + } + else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010)) + { + // Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x44); + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x7E); } else { @@ -284,10 +295,21 @@ namespace PKHeX } set { - if (PtHGSS) + if (value == 0) + { + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x46); + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x80); + } + else if (PtHGSS) { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x46); - BitConverter.GetBytes(0x7D0).CopyTo(Data, 0x80); + BitConverter.GetBytes(0xBBA).CopyTo(Data, 0x80); // Faraway Place (for DP display) + } + else if ((value < 2000 && value > 111) || (value < 3000 && value > 2010)) + { + // Met location not in DP, set to Mystery Zone (0, illegal) as opposed to Faraway Place + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x46); + BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x80); } else { @@ -299,11 +321,26 @@ namespace PKHeX private byte PKRS { get { return Data[0x82]; } set { Data[0x82] = value; } } public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } } - public override int Ball { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } } + public override int Ball + { + get { return Data[HGSS ? 0x86 : 0x83]; } + set + { + if (HGSS) + { + Data[0x83] = (byte)(value <= 0x10 ? value : 4); // Ball to display in DP (cap at Cherish) + Data[0x86] = (byte)(value <= 0x18 ? value : 4); // Cap at Comp Ball + } + else + { + Data[0x83] = (byte)(value <= 0x10 ? value : 4); // Cap at Cherish Ball + Data[0x86] = 0; // Unused + } + } + } public override int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } } public override int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } } public override int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } } - public int HGSSBall { get { return Data[0x86]; } set { Data[0x86] = (byte)value; } } // Unused 0x87 #endregion @@ -398,8 +435,7 @@ namespace PKHeX // Delete HGSS Data BitConverter.GetBytes((ushort)0).CopyTo(pk5.Data, 0x86); - if (HGSSBall > 0 && HGSSBall != 4) - pk5.Ball = HGSSBall; + pk5.Ball = Ball; // Transfer Nickname and OT Name pk5.Nickname = Nickname; diff --git a/PKM/PKM.cs b/PKM/PKM.cs index d5b946a8e..2b5f121bf 100644 --- a/PKM/PKM.cs +++ b/PKM/PKM.cs @@ -147,7 +147,8 @@ namespace PKHeX public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y; public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR; public bool SM => Version == (int)GameVersion.SN || Version == (int)GameVersion.MN; - public bool PtHGSS => new[] {GameVersion.Pt, GameVersion.HG, GameVersion.SS}.Contains((GameVersion)Version); + protected bool PtHGSS => GameVersion.Pt == (GameVersion)Version || HGSS; + public bool HGSS => new[] {GameVersion.HG, GameVersion.SS}.Contains((GameVersion)Version); public bool Gen5 => Version >= 20 && Version <= 23; public bool Gen4 => Version >= 10 && Version < 12 || Version >= 7 && Version <= 8; public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15; From 01051d7b9f8a52c6548af8746e2d25d212fc0919 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 09:34:41 -0700 Subject: [PATCH 23/34] Allow TMs to be held in gen4 saves Thanks javier_himura! --- Legality/Tables4.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Legality/Tables4.cs b/Legality/Tables4.cs index 5ac132dc5..f3fe5724b 100644 --- a/Legality/Tables4.cs +++ b/Legality/Tables4.cs @@ -30,7 +30,7 @@ namespace PKHeX internal static readonly ushort[] Pouch_Battle_DP = { 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67 }; - internal static readonly ushort[] HeldItems_DP = new ushort[1].Concat(Pouch_Items_DP).Concat(Pouch_Mail_DP).Concat(Pouch_Medicine_DP).Concat(Pouch_Berries_DP).Concat(Pouch_Ball_DP).ToArray(); + internal static readonly ushort[] HeldItems_DP = new ushort[1].Concat(Pouch_Items_DP).Concat(Pouch_Mail_DP).Concat(Pouch_Medicine_DP).Concat(Pouch_Berries_DP).Concat(Pouch_Ball_DP).Concat(Pouch_TMHM_DP.Take(Pouch_TMHM_DP.Length - 8)).ToArray(); #endregion #region Pt @@ -47,7 +47,7 @@ namespace PKHeX internal static readonly ushort[] Pouch_Ball_Pt = Pouch_Ball_DP; internal static readonly ushort[] Pouch_Battle_Pt = Pouch_Battle_DP; - internal static readonly ushort[] HeldItems_Pt = new ushort[1].Concat(Pouch_Items_Pt).Concat(Pouch_Mail_Pt).Concat(Pouch_Medicine_Pt).Concat(Pouch_Berries_Pt).Concat(Pouch_Ball_Pt).ToArray(); + internal static readonly ushort[] HeldItems_Pt = new ushort[1].Concat(Pouch_Items_Pt).Concat(Pouch_Mail_Pt).Concat(Pouch_Medicine_Pt).Concat(Pouch_Berries_Pt).Concat(Pouch_Ball_Pt).Concat(Pouch_TMHM_Pt.Take(Pouch_TMHM_Pt.Length - 8)).ToArray(); #endregion #region HGSS @@ -64,7 +64,7 @@ namespace PKHeX }; internal static readonly ushort[] Pouch_Battle_HGSS = Pouch_Battle_DP; - internal static readonly ushort[] HeldItems_HGSS = new ushort[1].Concat(Pouch_Items_HGSS).Concat(Pouch_Mail_HGSS).Concat(Pouch_Medicine_HGSS).Concat(Pouch_Berries_HGSS).Concat(Pouch_Ball_Pt).ToArray(); + internal static readonly ushort[] HeldItems_HGSS = new ushort[1].Concat(Pouch_Items_HGSS).Concat(Pouch_Mail_HGSS).Concat(Pouch_Medicine_HGSS).Concat(Pouch_Berries_HGSS).Concat(Pouch_Ball_Pt).Concat(Pouch_TMHM_HGSS.Take(Pouch_TMHM_HGSS.Length - 8)).ToArray(); #endregion internal static readonly int[] MovePP_DP = From 08a58964db12152a5801105d4c84fbf41954bc2a Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 09:35:05 -0700 Subject: [PATCH 24/34] Allow gen3 item transfer 3->4 Thanks javier_himura! --- PKM/PK3.cs | 4 ++++ PKM/PKX.cs | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/PKM/PK3.cs b/PKM/PK3.cs index 4f647dd2a..2dfebeb80 100644 --- a/PKM/PK3.cs +++ b/PKM/PK3.cs @@ -296,6 +296,10 @@ namespace PKHeX // Unown Form pk4.AltForm = AltForm; + int item = HeldItem; + if (HeldItem > 0) + pk4.HeldItem = item; + // Remove HM moves int[] banned = { 15, 19, 57, 70, 148, 249, 127, 291 }; int[] newMoves = pk4.Moves; diff --git a/PKM/PKX.cs b/PKM/PKX.cs index 76b26ba21..b06ffdc95 100644 --- a/PKM/PKX.cs +++ b/PKM/PKX.cs @@ -1576,7 +1576,7 @@ namespace PKHeX 66,67,68,69,43,44,70,71,72,73, 74,75,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF, 0xFFFF,0xFFFF,0xFFFF,45,46,47,48,49,50,51, - 52,53,0xFFFF,55,56,57,58,59,60,0xFFFF, + 52,53,0xFFFF,55,56,57,58,59,60,61, 63,64,0xFFFF,76,77,78,79,0xFFFF,0xFFFF,0xFFFF, 0xFFFF,0xFFFF,0xFFFF,80,81,82,83,84,85,0xFFFF, 0xFFFF,0xFFFF,0xFFFF,86,87,0xFFFF,88,89,90,91, @@ -1595,6 +1595,15 @@ namespace PKHeX 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF, 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF, 0xFFFF,0xFFFF,0xFFFF,0xFFFF,260,261,262,263,264, + + 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF, + 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF, + 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF, + 328,329,330,331,332,333,334,335,336,337, + 338,339,340,341,342,343,344,345,346,347, + 348,349,350,351,352,353,354,355,356,357, + 358,359,360,361,362,363,364,365,366,367, + 368,369,370,371,372,373,374,375,376,377, }; if (g3val > arr.Length) return 0xFFFF; From 8410ea4b9e0faea53bf8b61bbf2269a13f86dd68 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 09:41:46 -0700 Subject: [PATCH 25/34] Tweak transfer HM banlist for clarity No change in functionality, easier to understand --- PKM/PK4.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PKM/PK4.cs b/PKM/PK4.cs index bc0a04c36..f5a73b823 100644 --- a/PKM/PK4.cs +++ b/PKM/PK4.cs @@ -445,9 +445,9 @@ namespace PKHeX pk5.Met_Level = PKX.getLevel(pk5.Species, pk5.EXP); // Remove HM moves; Defog should be kept if both are learned. - int[] banned = Moves.Contains(250) /*Whirlpool*/ && !Moves.Contains(432) /*Defog*/ - ? new[] {15, 19, 57, 70, 432, 249, 127, 431} // No Defog - : new[] {15, 19, 57, 70, 250, 249, 127, 431};// No Whirlpool + int[] banned = Moves.Contains(250) && Moves.Contains(432) // Whirlpool & Defog + ? new[] {15, 19, 57, 70, 250, 249, 127, 431} // No Whirlpool + : new[] {15, 19, 57, 70, 249, 127, 431};// Transfer via advantageous game int[] newMoves = pk5.Moves; for (int i = 0; i < 4; i++) From dab1bf44aede86c81a5cdc9214e5eba4a41df239 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 10:01:40 -0700 Subject: [PATCH 26/34] Add tm sprite for held item No longer uses the generic 'unknown' item sprite --- PKHeX.csproj | 1 + PKM/PKX.cs | 7 ++- Properties/Resources.Designer.cs | 98 ++++++++++++++----------------- Properties/Resources.resx | 3 + Resources/img/item/item_tm.png | Bin 0 -> 777 bytes 5 files changed, 53 insertions(+), 56 deletions(-) create mode 100644 Resources/img/item/item_tm.png diff --git a/PKHeX.csproj b/PKHeX.csproj index b01803dcf..9e8f5b4d6 100644 --- a/PKHeX.csproj +++ b/PKHeX.csproj @@ -708,6 +708,7 @@ + diff --git a/PKM/PKX.cs b/PKM/PKX.cs index b06ffdc95..7ba8fffa6 100644 --- a/PKM/PKX.cs +++ b/PKM/PKX.cs @@ -457,7 +457,7 @@ namespace PKHeX } // Data Requests - internal static Image getSprite(int species, int form, int gender, int item, bool isegg, bool shiny) + internal static Image getSprite(int species, int form, int gender, int item, bool isegg, bool shiny, int generation = -1) { if (species == 0) return (Image)Resources.ResourceManager.GetObject("_0"); @@ -499,6 +499,9 @@ namespace PKHeX if (item > 0) { Image itemimg = (Image)Resources.ResourceManager.GetObject("item_" + item) ?? Resources.helditem; + if ((generation == 3 || generation == 4) && 328 <= item && item <= 419) // gen3/4 TM + itemimg = Resources.item_tm; + // Redraw baseImage = Util.LayerImage(baseImage, itemimg, 22 + (15 - itemimg.Width) / 2, 15 + (15 - itemimg.Height), 1); } @@ -506,7 +509,7 @@ namespace PKHeX } internal static Image getSprite(PKM pkm) { - return getSprite(pkm.Species, pkm.AltForm, pkm.Gender, pkm.HeldItem, pkm.IsEgg, pkm.IsShiny); + return getSprite(pkm.Species, pkm.AltForm, pkm.Gender, pkm.HeldItem, pkm.IsEgg, pkm.IsShiny, pkm.Format); } // Font Related diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 131bc6ca5..3e10c76ee 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -15132,6 +15132,16 @@ namespace PKHeX.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap item_tm { + get { + object obj = ResourceManager.GetObject("item_tm", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized string similar to ! PKHeX Interface Customization File ///! Languages: Save this file accordingly and put it in the same folder as PKHeX's executable. @@ -15181,11 +15191,11 @@ namespace PKHeX.Properties { /// /// Looks up a localized string similar to ! PKHeX Interface Customization File ///! Languages: Save this file accordingly and put it in the same folder as PKHeX's executable. - ///! lang_en.txt = English - ///! lang_jp.txt = Japanese + ///! lang_en.txt = Inglés + ///! lang_jp.txt = Japonés ///! lang_fr.txt = French - ///! lang_de.txt = German - ///! lang_es.txt = Spanish + ///! lang_de.txt = Alemán + ///! lang_es.txt = Español ///! lang_it.txt = Italian ///! lang_ko.txt = Korean ///! lang_zh.txt = Chinese @@ -15193,7 +15203,7 @@ namespace PKHeX.Properties { ///! Make sure that each edit has a ' = ' between Control name and new Text! ///! ///! ----------------------------------------------------- - ///- DO NOT CHANGE THI [rest of string was truncated]";. + ///- DO NOT CHANGE THIS [rest of string was truncated]";. /// internal static string lang_es { get { @@ -20500,18 +20510,18 @@ namespace PKHeX.Properties { /// /// Looks up a localized string similar to None - ///Rock Smash (HGSS) - ///Tall Grass + ///Golpe roca (HGSS) + ///Hierba Alta /// ///Dialga/Palkia - ///Cave/Hall of Origin + ///Cueva/Sala del Origen /// - ///Surfing/Fishing + ///Surfeando/Pescando /// - ///Building/Enigma Stone - ///Marsh/Safari + ///Edificio/Misticristal + ///Pantano/Safari /// - ///Starter/Fossil/Gift (DP) + ///Inicial/Fosil/Regalo (DP) /// /// /// @@ -20522,8 +20532,8 @@ namespace PKHeX.Properties { /// /// /// - ///Distortion World (Pt) - ///Starter/Fossil/Gift (Pt/DP Trio). + ///Mundo Distorsion (Pt) + ///Inicial/Fosil/Regalo (Pt/DP Trio). /// internal static string text_encountertype_es { get { @@ -20697,7 +20707,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -20949,9 +20959,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// /// [rest of string was truncated]";. + /// [rest of string was truncated]";. /// internal static string text_forms_de { get { @@ -20960,7 +20968,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -21212,9 +21220,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// /// [rest of string was truncated]";. + /// [rest of string was truncated]";. /// internal static string text_forms_en { get { @@ -21223,7 +21229,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -21474,10 +21480,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// - /// [rest of string was truncated]";. + /// /// [rest of string was truncated]";. /// internal static string text_forms_es { get { @@ -21486,7 +21489,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -21736,10 +21739,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// - /// [rest of string was truncated]";. + /// /// [rest of string was truncated]";. /// internal static string text_forms_fr { get { @@ -21748,7 +21748,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -21999,10 +21999,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// - /// [rest of string was truncated]";. + /// /// [rest of string was truncated]";. /// internal static string text_forms_it { get { @@ -22011,7 +22008,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -22262,9 +22259,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// /// [rest of string was truncated]";. + /// [rest of string was truncated]";. /// internal static string text_forms_ja { get { @@ -22273,7 +22268,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -22525,9 +22520,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// /// [rest of string was truncated]";. + /// [rest of string was truncated]";. /// internal static string text_forms_ko { get { @@ -22536,7 +22529,7 @@ namespace PKHeX.Properties { } /// - /// Looks up a localized string similar to + /// Looks up a localized string similar to Spiky /// /// /// @@ -22787,10 +22780,7 @@ namespace PKHeX.Properties { /// /// /// - /// - /// - /// - /// [rest of string was truncated]";. + /// /// [rest of string was truncated]";. /// internal static string text_forms_zh { get { @@ -22878,8 +22868,8 @@ namespace PKHeX.Properties { ///RojoFuego ///VerdeHoja /// - ///HeartGold - ///SoulSilver + ///Oro HeartGold + ///Plata SoulSilver /// ///Diamante ///Perla @@ -22897,8 +22887,8 @@ namespace PKHeX.Properties { ///Negra2 ///X ///Y - ///AS - ///OR. + ///Zafiro Alfa + ///Rubí Omega. /// internal static string text_games_es { get { diff --git a/Properties/Resources.resx b/Properties/Resources.resx index da26da620..10d5e449e 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -6382,4 +6382,7 @@ ..\Resources\img\box\slotView.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\img\item\item_tm.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Resources/img/item/item_tm.png b/Resources/img/item/item_tm.png new file mode 100644 index 0000000000000000000000000000000000000000..1d170e8b7dd1f19e594f5332522ee465ee6b28f3 GIT binary patch literal 777 zcmV+k1NQuhP)pF7<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%heMIczh2P5=M`heK8m7FE%!OSY6%0`1p4y%3BzX6{lHQS&y%gt7>a&Q;o)F{L|Lf4uZiD&d>iLoldhZ zE-s*HM;IFVin6j7Nm-WfGe{i?92js4a0{xc3Rn~HUj{EPFA8vc z`$(1?4#z3k*xcOAsIPDM3a+lU!R7iPQr%#`6jXhE3$8)C)9Fm_?(Sk~X(^+wu0EJd zW=O@wX3@zFzu(V3qtPf%PU5JntUMhV8A-D0$`;)k^5;QkAzobkg zx>Y(kx|~4Zh`Zjvkw`?0u3>t54xOF747Rto^A<8iw@N2hRaJ-H-p?2wcJVrTdiv4Y z`kp<~sF{v;i*B{Cu~D{KZOF@ef}EUOUI(R0;jqVBB}xAQ5tSue<)qV%00000NkvXX Hu0mjfNv2!v literal 0 HcmV?d00001 From be41727a6e8dee7848e64a4a8206d9bd02943db1 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 11:37:16 -0700 Subject: [PATCH 27/34] Fix numpad typo Pal park transfer friendship is 70 not 40 789 456 123 Fixes #165 --- PKM/PK3.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKM/PK3.cs b/PKM/PK3.cs index 2dfebeb80..a6f20bc4c 100644 --- a/PKM/PK3.cs +++ b/PKM/PK3.cs @@ -196,7 +196,7 @@ namespace PKHeX SID = SID, EXP = IsEgg ? PKX.getEXP(5, Species) : EXP, IsEgg = false, - OT_Friendship = 40, + OT_Friendship = 70, MarkCircle = MarkCircle, MarkSquare = MarkSquare, MarkTriangle = MarkTriangle, From 29c4497603bdb2910292d3232c35003b967e1ba9 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 12:30:00 -0700 Subject: [PATCH 28/34] Only write pkm out if species is not zero (empty) --- Subforms/PKM Editors/BatchEditor.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Subforms/PKM Editors/BatchEditor.cs b/Subforms/PKM Editors/BatchEditor.cs index c3a4ed7ea..67613c4d5 100644 --- a/Subforms/PKM Editors/BatchEditor.cs +++ b/Subforms/PKM Editors/BatchEditor.cs @@ -194,8 +194,11 @@ namespace PKHeX err++; if (r == ModifyResult.Modified) { - ctr++; - File.WriteAllBytes(Path.Combine(destPath, Path.GetFileName(file)), pkm.DecryptedBoxData); + if (pkm.Species > 0) + { + ctr++; + File.WriteAllBytes(Path.Combine(destPath, Path.GetFileName(file)), pkm.DecryptedBoxData); + } } b.ReportProgress(i); From f83cfbaae10ccf6a61d7761de5ccb6dd62ea11b3 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 12:57:53 -0700 Subject: [PATCH 29/34] Add mystery gift file drag&drop to slot pgt was a pkm size, check all sizes --- MainWindow/Main.cs | 2 +- MysteryGifts/MysteryGift.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 546a41676..d9f6a1c08 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -3344,7 +3344,7 @@ namespace PKHeX return; string file = files[0]; FileInfo fi = new FileInfo(file); - if (!PKX.getIsPKM(fi.Length)) + if (!PKX.getIsPKM(fi.Length) && !MysteryGift.getIsMysteryGift(fi.Length)) { openQuick(file); return; } byte[] data = File.ReadAllBytes(file); diff --git a/MysteryGifts/MysteryGift.cs b/MysteryGifts/MysteryGift.cs index cff746126..e7a82211d 100644 --- a/MysteryGifts/MysteryGift.cs +++ b/MysteryGifts/MysteryGift.cs @@ -5,6 +5,10 @@ namespace PKHeX { public abstract class MysteryGift { + internal static bool getIsMysteryGift(long len) + { + return new[] { WC6.SizeFull, WC6.Size, PGF.Size, PGT.Size, PCD.Size }.Contains((int)len); + } internal static MysteryGift getMysteryGift(byte[] data, string ext) { if (data.Length == WC6.SizeFull && ext == ".wc6full") From ecfb5626eab2baa02112c0303cd70b63812f64c6 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 6 Aug 2016 13:18:23 -0700 Subject: [PATCH 30/34] Release 08-07-16 Updated with latest event contributions. --- Resources/byte/wc6.pkl | Bin 244728 -> 247368 bytes Resources/byte/wc6full.pkl | Bin 186592 -> 192080 bytes Resources/text/changelog.txt | 16 ++++++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Resources/byte/wc6.pkl b/Resources/byte/wc6.pkl index 741fee4e69ab6ba1f5fda89c6361071de24e68ba..e29dc62e28b92d4f3b219a1f1ebcec59e03edd83 100644 GIT binary patch delta 5384 zcmd^?dvMcL7RP&kzqXW6FqVg<6b#6tDB!R1uBZ`w&>Ap8b!(|?bb*#qAPQ=ExCBKW zwQ3;9Egggu6-q%3{YfuKz<`e_oz5DSb)my(WLzu-H7Y9B3j6&AT_4Lo&d%)a%)-ov zlXLDp_uO;OJ-^G@Z#&hOUm{M)`)l+89VW-kjGKeMbK{CuXLe8MQ#DkK^i^3d>yedy zDk1KtKQ?RJ#yBbNj!PAOvCns)S5FzSip0^yabqtGId`6a#JHHZ`QW`jP5tp-j?*$` zefFahxET1q5yHLI`ruz@q4U3=g?r;>BL^k;`|CVhBn#b6B}5MPeajY?Yu>cq7B{Lf zZin%bbEogXh@nZy+3!1$F26mH4S@}ft24V@a*>5EJ(Zx0uZ$XFixD!~jQ5N-`NeMi z+TXePuD@MT8J`*rzTUmNUTn>drxJcqaB_PU{w@_1g6GJK+%aHPhF%1880vZr<^Bx_H?AAGcr_K%T(o=-o5zx=6 zS4}FK6o-I`LOBcQa{Ls!ADd4(>u&OzJPlUl40_9CYW|rs$jBM2o*SvZK=%zCS$sV; z`C}MhP8I?*!y9e!0QTvx$VgDu?=)LHiDB-MjQ0YaLn%j|){t5dviEUNx|V2(>ZxT~ zyikumhBc-05zQe>9@h4&w1+foYs>=eoVv1<;-H7Mb24k8mZQoSX>VaWi#P#(9CF7J zOvwK;M=f583B?|YB}=q6WqpwAMCM?WW1hBOHqF*@CMI zeOxRMTU$>HT%c0|p&VJqa&oT%Wx%aFWchvioih7&eWpsghcy=3!BxZ0aF}ZaxGrC> zlG~=}h02pnrR_S-4H=jlZ|Fhkd>r=m3t{(`&>sB*?Y1rmZ%=22=Q%GdLS}s{Xs(PK(@0T2rvPbpL?R+y5Y*7SjHeSgQ7X$qjivfVTSw)JB^{ zi)#Ip8w#vuPK>2wjwL|x`jP|+c*sg}V|sHUq}Qw;-IQ?`j5?dn1rSF=4BPUK9b zIH(yriL~4XN)TDh5kb?o5>2XP>CuH`!E)WbimQ}?ZBgJVu3{8Bg1bqYLNa9QR8`&8W3~* zy5>+_+EY9euLaGb_bw=ted#wP$;L$Oj6@4?$Z4Hn48Ml%V?`f1dKvqOyBkjj#Ahc= z7b^8A9YtEi1lg|zo#e>N_-&4V8z$##SlYDKGo_{2y|le6(&eiYe*Iu7JM_P|+FireGz3{dwD+5%+TozX^La@P7wNv0AEM%0^htP4+>EYfy_V|0kXUgJ zW_*Qd9PObrOx zp6y1KCW254^Xof9_hd<$|0Yhj+Yf)QdNAK z6{@_OxXGj}(m#kadXdqtq&oqW?!CC8<@-fE4&w!$r{7N+Ye@S%zAghU%Bd4r7CDo7 z$5J^HPp==>vEN94kzp*erlBme(gD;s`*0jqi&v++=vV=ZL0w%%R%{}hSAsJ9xELWn z@QA~*#v_Kw#O2~$6)mFObr&L7mm^Z8^9~U;lh}9NMJ(L#WYV}HCSSv)8#1}HyFcaP zew1zLv_?9|0!zWQQ0XZQ3B-p|r#fHbK<{f@Z1;1dyOJ9%UXP8|m5VN#YAX{?{4b;o zmtgn3VpKcj%*D8XMeO9az%_%HE`K`R1a7BXGg03v6lxJ27%WuIaa<{9EQZvLrr0`? zv5XnXSU@~(ujItCfxNkm8Bo}5RAgNq^V(5Q(^aKK@1`qndnVR?9{-7w=z0!$<{-kV z2r=-YSIOpWpbTt=t#7r!e|ENt9F@M6%C^mXA5?IA`I6Ur!#b)#e2l%^YWmaMYQa-b zL{`uS4v~o~M3eG9A`nH{Vlh^%DX^-xrQ)!zN*Bg*Rm$#>I)}xQR6Zv{;+KG~*cEnq8TO%vAXK+-fIkY^;;j)l;CeTrrt OzYbE<7@*ajDEED#GP=m{%fx)6kMurk#B^$2dFxT~Tuqit=6uA@&e^uXvD*PGt@8 zi%f^C_>)bAq8g3A4r2o}UeP(>tg) zYBE)Op6)Yj+4U3Y>>wSd$?SHp_7u(bAIQu}vgLa+eS&QKj!b39hHuGOE4zyP$3P(< zl<+Z7dXE@oGX13y)xo3KEb`S}qCloE5m75V$gekk!N|2~My@zw6v*V~Mze+m6_Mb= z&uGtWX2h&dv3*?kq9Y0V<q#vNU4aGKiny+Bg1LU8RW=*+Z{(NW}*LNYSa<`J?YNqSZb)D+*qEO4vP z*R6vsi-O{F?Ri?nvvhQxh+)~w7?_;JKoF_X8C1d{QIsWL3?bY*m4Yis0r{ocJBe}W zEzAL7yK>3+F)FS*Sa9}4D$d(UhacSD0I2Lu*`nqZ818DowH0t~0UVnVmsu(>VDEP3 zgOI}t3z~EZzuY@QBs469xi4ZsYz%A(R>_fLM5!v9iTKP-fah9fKK3gdSGuxl#yO0d zaZpnE-fSIAP4sWwAqKWaw%$M?P|uc~<9NC~y*^+ZYe} z<-#7KUKaNhy`_7UnUP+H$d|LOHiyVH7mIq0M1*^S=fZR4n%B%TI&%Y0ABbZf+G_U2 zYHnc}ldmM(Cz~U>>GUw#flWC6672;$U*00LEB1^lg7~$!Q^DG_f%)au5 z^=7M1ZR3{0H`?C+nt|R^&zt?SWYbV{nCv>#Jfu4+&EBTYyvPWsT`{YcIZ*z%#%$8C zkliqt%-naL>3d8Z#e#dyq)x0hv#`F;LC|f_nhio1{Dw;MRd(FT=t|yNk>zHdq4!TR zyBj)QO>ZY-TX?S9wixyL9S`Tn)dxMvI}LgFms-PNpuP-pOP) zv?+@_uscdli8k%&OWJ&j@H8VEC-H-|gL;8DI!2m9Da8A6;x^(yeOQC*8&7 zXuS|By*p1>t-GZ)d-rs!?(BMN>9JBP`Ad~Led1AJ1;4MdmhPEuwSKwYg0Q)z6)Dk1 zbdcGD$0oDKcB|GevF?FUMwK-^U8-T^2+No8$6;|?y?NiAkIYKS?7;_Qb zg|VsBE;N(c1?R5mx_C5JK*fGScHuYct;;^1t_r_FP~B(OAgH-jmH!LTb%{<_T>@k7 z7=#oVZpK+#(~cuj{uxiyv@<-yP;=!9r^uFTKNlx;;4~)_A{M;Qah%K8ZVK@(m@muo zwO_WGM!i*C=d%q}*@0R-Un3%R6z5k}f6AiMEIND$8R0`!s%R(XD892w7IiU{Y&(iZ zqb0mUBELRJ_t*s8~gwp(-UxTm1sC?0FlgKmA8|Qzh{3{{yslih;WOZO}W0-cj@x z(mRrl5jNnBIN*(-1XbPx+IfU7!l#WXxv*>$UkK|Qm^%rdWp^QWW`MzWGVTuSgJ2Z% z+(*<~#n1XQjD13H=)=)eUJlB-D}+z2UA0e0d}HsfO6c&7a9G|Iez|ri@_Z|CcMcb4 zb@4Fjh0A@mu6!%et#<`_EL_fo%4efXE)%`*vO5u8ekp~Sy+Ji(8DiZ_5!-JGtmK?t z!a6hGYvs-jsi)>WWM^bs&2xWLb>--z=_#Koi0s48EB9HW7t||bAd*wi+!r?N#t}a@L6q7CRAnvx@)b1YyV3=tDvfZqsXzoS$|S> zyo@4J>$(ed;H4~NyzH}bUrMORmxknwFl@s!0*(1eA*k2(~j?990=Q8V@JP1I#y8!QQ71; z18-tdN>B*C0U_0o5g>$VH9(mKgje(PIl%j{yNeYYUS$>CSgK;fk>Qzd;-!z@$(y&6 zE#r|bX>WF1W}??djwrl=|Crnn#yRF8r*@86Vo3iSJOq_~zA@2>d>NW2LZ}{q%e&Ue z*z8Z39gHzMu#SurQSW4XZ`$c6SVOD;cJ0RuZ&!Agx6v84S#dq>)GR)1$(elEPF%tV z!n+ntstF%5>5$#itqcs>jP{2uK^&nOW=M|hZ{Drz9%EiSY(Jng%zd~WdQtIIvL){U zWM}@#mI61krA|iNw4;x(`*cs*t_qID@q&S!R`?I(w|vB;NXUMALni*`oqo`qZK(cj z*sQLv@O{{8K8oAA30peWg#Ck0na(p`RHqL@+WOvfee@vjbI;$=P^JdWDMtekd+Qu( z*RaIMDNI&iD*FL()Ab*V>6htSh2JVUUT;+%#yhea??~}Ml$E-e)p``y6!go2@ggKw z9W*BCmN(c%_Ip57pM%ak$37g#(YogcUaVdx9$6JS+1sr7FFu2PkR-t>>w+IpaRDn1 zq>%3Z03D6Eln?E)-x_#wwolhE;ErsEo6r##+`9Y}3EjaF?p&7x}k+bn9%4+Ns!D@f6r&4ab|ZKCRa-YhDXDn6>c zk!7*VY!=IBc}!A@t9a-5mskNAX0c*6oh36P+sKA06-#)x*x}?ehfN`KF`LOsl;nEe zIWf856PTsq3aB zrt`$4!ATdRSj(SeW*e9yyuuO%pRh;p)FlnMB`}e(87w{QbMqGdgvg{?g2Vse$9olC zX;Jai^;)}w&(Dc?wqEows&fh@FX_p<^yCYuIEmfW1--NaVz^}Zpaps>l-Y5-TM8-< z8zpLAKAT3pLRZiaC#~=9%H=kj<#1QpRq~X`t|*=fy#If02~MOXy~w7t(h|iyn#Y+; za^qg>eu+6$`-=(kOHpCMyAP^NvYzT{n`cWflZT%lg!e%|x0QtG&{%+oMAWpPEg2RYPN ziL~={)jT%u-WWE$Z0NDx|6gC4w(%G47?P`p`LMBfmfKT5{=45_c*Wo8C(*!QfG|2} zM?|}oUuFvNU9-rXNAIzD`gR7nh3ARhYh?qD{2rh6#=Wy5Zs!^QTRSv)l3)=v%d7ax zGrTOsiQ37LLI+U`42LCT;U-aQc!ZNreFsjKKn&<_OH@PSO`=+vZ5GSSqCs;%0bidT zdfuUkc0UWf`AWbbbq3 zzXBZxLHjY{CTD|}c)nN1Ip!Z|Y?E_sOf|j>H z!<%5UoAT32WOQLt3b&JIAAXuEB}So0>)S=x$~8j|-SIIn^r(JtNhr-5r8kg+u3Ol3 z-T z?8$%Pn$1cFqYjxxd$vMy?J>QBs9N$V(lFU1mif*`srebPl-DPE7Vm(DC7^d2Xw61^ z?Qawy9U?T;5K2EI$m{9%mXyt-)$^;2v`XgDRnbNoK|jXDxf;>U3qiLNw2am*oxtD; zj7#lCcsf?W5}FUX@<2lt7)S&CsoW-Ny9e@1TnlV~#l8{@&IO$l!R8U9Mx{inyM8r_ zs`&tASF2IQuC0{2^ghyFNl)^xgSTx3r{UUP!ZDcRVF?XGjlQ#Hac4dGRt6G8b?Rm) zt%cGG3iZARN9%GhFcY-rg28k=n(mb9{h2hHYAL{1g@f2+5_i&uTDhFU-S5KLQVRNK zfVLd4{y99k^fdW3?jfw%L811KptKrFrIga2WNQ9{J~>Yk9LEXv27>K7g6l_ou;r6B9*samThK6;~>%^|3y#+D+tQYlq2* zrd5JST?r&$=DcS7!gjaE+GWI$(-G6UaTzXoXeaFTi*%L?xuTY|R5-}BU05Tp7xhe-f~uY z4>IC@B$Bd}o2MoH7iYFezot^sx9$S9B}mi_(c-@uAd$WY+b%B`3BR(qRjTR@nt|E( zYe}h!_i|iV!G8HWHJqlmpDTwqYME)uScDZ+?mU5-pp7f*hgq2|VQyt11DSJaxrH_k zGMRR1<2pvtXVG=X(fW^!cRxexSF@#MGVTao;&`3Qnoo06V+$DXI)e`U%lhgMH1!l6 zxS4bF%b3kBrFI{6^4x6o3XW5=;7G0`q56+%t^bcI6Bt#VV2kcUY+)W?skMZfi>a|6 z`ql}+Or+$f-jz`H5wso2q*th(4Z;&6>6d#|=PP12zQqdydG~qFbW`jboM4wc{JH;NM^lj+sH-81u zFCaVuj1Pf52CPqkxfkd)Q1}ky$3gZh;O+ypLm)T+y#2tL1kEalc7bpwHek--U1u+% z_65{BpBm>-eKu{LNu$%D?=1rELf~8v3fF-AReUj9 Date: Sat, 6 Aug 2016 15:39:26 -0700 Subject: [PATCH 31/34] Fix saveDataBackup detection Thanks IamAVeryNicePereson! --- Saves/SaveUtil.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Saves/SaveUtil.cs b/Saves/SaveUtil.cs index 5b7976b7b..0a2b8aad4 100644 --- a/Saves/SaveUtil.cs +++ b/Saves/SaveUtil.cs @@ -190,8 +190,7 @@ namespace PKHeX // save_manager if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "saveDataBackup"))) - if (File.Exists(path = Path.Combine(path))) - possiblePaths.Add(path); + possiblePaths.AddRange(getSavesFromFolder(path, false)); // SaveDataFiler if (path3DS != null && Directory.Exists(path = Path.Combine(path3DS, "filer", "UserSaveData"))) From 73f3fef4ca65f778f1590108482660cc7ba183f4 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 7 Aug 2016 22:46:07 -0700 Subject: [PATCH 32/34] Add C-Gear skin i/o (WIP) Currently only works on saves that already have c-gear skin data, more research to follow at a later date to set the necessary info for enabling c-gear skins. Allows for importing images, although a memory spike exists (due to rotated images not being collected until after import) --- MainWindow/Main.Designer.cs | 295 ++++++++------- MainWindow/Main.cs | 5 + MainWindow/Main.resx | 3 + PKHeX.csproj | 10 + Saves/SAV5.cs | 9 +- Subforms/Save Editors/Gen5/CGearBackground.cs | 356 ++++++++++++++++++ .../Gen5/SAV_CGearSkin.Designer.cs | 156 ++++++++ Subforms/Save Editors/Gen5/SAV_CGearSkin.cs | 134 +++++++ Subforms/Save Editors/Gen5/SAV_CGearSkin.resx | 216 +++++++++++ 9 files changed, 1041 insertions(+), 143 deletions(-) create mode 100644 Subforms/Save Editors/Gen5/CGearBackground.cs create mode 100644 Subforms/Save Editors/Gen5/SAV_CGearSkin.Designer.cs create mode 100644 Subforms/Save Editors/Gen5/SAV_CGearSkin.cs create mode 100644 Subforms/Save Editors/Gen5/SAV_CGearSkin.resx diff --git a/MainWindow/Main.Designer.cs b/MainWindow/Main.Designer.cs index 91bf1f5d5..4c8015464 100644 --- a/MainWindow/Main.Designer.cs +++ b/MainWindow/Main.Designer.cs @@ -356,6 +356,7 @@ this.B_OpenSecretBase = new System.Windows.Forms.Button(); this.B_Pokeblocks = new System.Windows.Forms.Button(); this.B_LinkInfo = new System.Windows.Forms.Button(); + this.B_CGearSkin = new System.Windows.Forms.Button(); this.dragout = new System.Windows.Forms.PictureBox(); this.mnuL = new System.Windows.Forms.ContextMenuStrip(this.components); this.mnuLLegality = new System.Windows.Forms.ToolStripMenuItem(); @@ -3072,11 +3073,11 @@ this.bpkx30.TabStop = false; this.bpkx30.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx30.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx30.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx30.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx30.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx30.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx30.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx30.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx30.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx30.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // mnuVSD // @@ -3120,11 +3121,11 @@ this.bpkx29.TabStop = false; this.bpkx29.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx29.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx29.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx29.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx29.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx29.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx29.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx29.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx29.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx29.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx28 // @@ -3138,11 +3139,11 @@ this.bpkx28.TabStop = false; this.bpkx28.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx28.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx28.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx28.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx28.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx28.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx28.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx28.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx28.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx28.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx27 // @@ -3156,11 +3157,11 @@ this.bpkx27.TabStop = false; this.bpkx27.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx27.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx27.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx27.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx27.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx27.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx27.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx27.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx27.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx27.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx26 // @@ -3174,11 +3175,11 @@ this.bpkx26.TabStop = false; this.bpkx26.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx26.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx26.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx26.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx26.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx26.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx26.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx26.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx26.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx26.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx25 // @@ -3192,11 +3193,11 @@ this.bpkx25.TabStop = false; this.bpkx25.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx25.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx25.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx25.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx25.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx25.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx25.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx25.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx25.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx25.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx24 // @@ -3210,11 +3211,11 @@ this.bpkx24.TabStop = false; this.bpkx24.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx24.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx24.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx24.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx24.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx24.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx24.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx24.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx24.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx24.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx23 // @@ -3228,11 +3229,11 @@ this.bpkx23.TabStop = false; this.bpkx23.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx23.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx23.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx23.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx23.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx23.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx23.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx23.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx23.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx23.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx22 // @@ -3246,11 +3247,11 @@ this.bpkx22.TabStop = false; this.bpkx22.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx22.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx22.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx22.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx22.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx22.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx22.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx22.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx22.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx22.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx21 // @@ -3264,11 +3265,11 @@ this.bpkx21.TabStop = false; this.bpkx21.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx21.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx21.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx21.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx21.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx21.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx21.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx21.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx21.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx21.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx20 // @@ -3282,11 +3283,11 @@ this.bpkx20.TabStop = false; this.bpkx20.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx20.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx20.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx20.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx20.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx20.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx20.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx20.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx20.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx20.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx19 // @@ -3300,11 +3301,11 @@ this.bpkx19.TabStop = false; this.bpkx19.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx19.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx19.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx19.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx19.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx19.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx19.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx19.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx19.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx19.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx18 // @@ -3318,11 +3319,11 @@ this.bpkx18.TabStop = false; this.bpkx18.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx18.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx18.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx18.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx18.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx18.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx18.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx18.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx18.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx18.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx17 // @@ -3336,11 +3337,11 @@ this.bpkx17.TabStop = false; this.bpkx17.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx17.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx17.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx17.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx17.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx17.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx17.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx17.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx17.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx17.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx16 // @@ -3354,11 +3355,11 @@ this.bpkx16.TabStop = false; this.bpkx16.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx16.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx16.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx16.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx16.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx16.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx16.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx16.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx16.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx16.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx15 // @@ -3372,11 +3373,11 @@ this.bpkx15.TabStop = false; this.bpkx15.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx15.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx15.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx15.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx15.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx15.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx15.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx15.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx15.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx15.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx14 // @@ -3390,11 +3391,11 @@ this.bpkx14.TabStop = false; this.bpkx14.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx14.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx14.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx14.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx14.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx14.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx14.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx14.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx14.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx14.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx13 // @@ -3408,11 +3409,11 @@ this.bpkx13.TabStop = false; this.bpkx13.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx13.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx13.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx13.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx13.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx13.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx13.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx13.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx13.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx13.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx12 // @@ -3426,11 +3427,11 @@ this.bpkx12.TabStop = false; this.bpkx12.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx12.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx12.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx12.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx12.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx12.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx12.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx12.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx12.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx12.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx11 // @@ -3444,11 +3445,11 @@ this.bpkx11.TabStop = false; this.bpkx11.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx11.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx11.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx11.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx11.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx11.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx11.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx11.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx11.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx11.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx10 // @@ -3462,11 +3463,11 @@ this.bpkx10.TabStop = false; this.bpkx10.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx10.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx10.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx10.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx10.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx10.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx10.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx10.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx10.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx10.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx9 // @@ -3480,11 +3481,11 @@ this.bpkx9.TabStop = false; this.bpkx9.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx9.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx9.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx9.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx9.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx9.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx9.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx9.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx9.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx9.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx8 // @@ -3498,11 +3499,11 @@ this.bpkx8.TabStop = false; this.bpkx8.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx8.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx8.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx8.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx8.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx8.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx8.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx8.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx8.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx8.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx7 // @@ -3516,11 +3517,11 @@ this.bpkx7.TabStop = false; this.bpkx7.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx7.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx7.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx7.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx7.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx7.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx7.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx7.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx7.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx7.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx6 // @@ -3534,11 +3535,11 @@ this.bpkx6.TabStop = false; this.bpkx6.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx6.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx5 // @@ -3552,11 +3553,11 @@ this.bpkx5.TabStop = false; this.bpkx5.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx5.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx4 // @@ -3570,11 +3571,11 @@ this.bpkx4.TabStop = false; this.bpkx4.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx4.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx3 // @@ -3588,11 +3589,11 @@ this.bpkx3.TabStop = false; this.bpkx3.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx3.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx2 // @@ -3606,11 +3607,11 @@ this.bpkx2.TabStop = false; this.bpkx2.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx2.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bpkx1 // @@ -3624,11 +3625,11 @@ this.bpkx1.TabStop = false; this.bpkx1.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop); this.bpkx1.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter); - this.bpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bpkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // B_BoxRight // @@ -3744,11 +3745,11 @@ this.bbpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx1.TabIndex = 8; this.bbpkx1.TabStop = false; - this.bbpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bbpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bbpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bbpkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bbpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bbpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // mnuV // @@ -3773,11 +3774,11 @@ this.bbpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx2.TabIndex = 9; this.bbpkx2.TabStop = false; - this.bbpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bbpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bbpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bbpkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bbpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bbpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bbpkx3 // @@ -3788,11 +3789,11 @@ this.bbpkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx3.TabIndex = 10; this.bbpkx3.TabStop = false; - this.bbpkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bbpkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bbpkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bbpkx3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bbpkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bbpkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bbpkx4 // @@ -3803,11 +3804,11 @@ this.bbpkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx4.TabIndex = 11; this.bbpkx4.TabStop = false; - this.bbpkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bbpkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bbpkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bbpkx4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bbpkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bbpkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bbpkx5 // @@ -3818,11 +3819,11 @@ this.bbpkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx5.TabIndex = 12; this.bbpkx5.TabStop = false; - this.bbpkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bbpkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bbpkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bbpkx5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bbpkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bbpkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // bbpkx6 // @@ -3833,11 +3834,11 @@ this.bbpkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.bbpkx6.TabIndex = 13; this.bbpkx6.TabStop = false; - this.bbpkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.bbpkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.bbpkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.bbpkx6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.bbpkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.bbpkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.bbpkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // L_ReadOnlyPBB // @@ -3893,11 +3894,11 @@ this.ppkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx1.TabIndex = 2; this.ppkx1.TabStop = false; - this.ppkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.ppkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.ppkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.ppkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.ppkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.ppkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // ppkx2 // @@ -3908,11 +3909,11 @@ this.ppkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx2.TabIndex = 3; this.ppkx2.TabStop = false; - this.ppkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.ppkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.ppkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.ppkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.ppkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.ppkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // ppkx3 // @@ -3923,11 +3924,11 @@ this.ppkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx3.TabIndex = 4; this.ppkx3.TabStop = false; - this.ppkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.ppkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.ppkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.ppkx3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.ppkx3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.ppkx3.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // ppkx4 // @@ -3938,11 +3939,11 @@ this.ppkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx4.TabIndex = 5; this.ppkx4.TabStop = false; - this.ppkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.ppkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.ppkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.ppkx4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.ppkx4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.ppkx4.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // ppkx5 // @@ -3953,11 +3954,11 @@ this.ppkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx5.TabIndex = 6; this.ppkx5.TabStop = false; - this.ppkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.ppkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.ppkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.ppkx5.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.ppkx5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.ppkx5.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // ppkx6 // @@ -3968,11 +3969,11 @@ this.ppkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.ppkx6.TabIndex = 7; this.ppkx6.TabStop = false; - this.ppkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.ppkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.ppkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.ppkx6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.ppkx6.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.ppkx6.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.ppkx6.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // Tab_Other // @@ -4090,11 +4091,11 @@ this.dcpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.dcpkx2.TabIndex = 11; this.dcpkx2.TabStop = false; - this.dcpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.dcpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.dcpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.dcpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.dcpkx2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.dcpkx2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.dcpkx2.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.dcpkx2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // dcpkx1 // @@ -4106,11 +4107,11 @@ this.dcpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.dcpkx1.TabIndex = 10; this.dcpkx1.TabStop = false; - this.dcpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.dcpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.dcpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.dcpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.dcpkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.dcpkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.dcpkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.dcpkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // DayCare_HasEgg // @@ -4143,11 +4144,11 @@ this.gtspkx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.gtspkx.TabIndex = 23; this.gtspkx.TabStop = false; - this.gtspkx.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.gtspkx.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.gtspkx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.gtspkx.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.gtspkx.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.gtspkx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.gtspkx.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.gtspkx.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // GB_Fused // @@ -4169,11 +4170,11 @@ this.fusedpkx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.fusedpkx.TabIndex = 24; this.fusedpkx.TabStop = false; - this.fusedpkx.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.fusedpkx.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.fusedpkx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.fusedpkx.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.fusedpkx.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.fusedpkx.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.fusedpkx.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.fusedpkx.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // L_ReadOnlyOther // @@ -4207,11 +4208,11 @@ this.subepkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.subepkx1.TabIndex = 18; this.subepkx1.TabStop = false; - this.subepkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); + this.subepkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.subepkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); this.subepkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown); this.subepkx1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseMove); - this.subepkx1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseClick); - this.subepkx1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.pbBoxSlot_QueryContinueDrag); + this.subepkx1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseUp); // // subepkx2 // @@ -4377,6 +4378,7 @@ this.FLP_SAVtools.Controls.Add(this.B_OpenSecretBase); this.FLP_SAVtools.Controls.Add(this.B_Pokeblocks); this.FLP_SAVtools.Controls.Add(this.B_LinkInfo); + this.FLP_SAVtools.Controls.Add(this.B_CGearSkin); this.FLP_SAVtools.Location = new System.Drawing.Point(6, 10); this.FLP_SAVtools.Name = "FLP_SAVtools"; this.FLP_SAVtools.Size = new System.Drawing.Size(297, 87); @@ -4535,6 +4537,16 @@ this.B_LinkInfo.UseVisualStyleBackColor = true; this.B_LinkInfo.Click += new System.EventHandler(this.B_LinkInfo_Click); // + // B_CGearSkin + // + this.B_CGearSkin.Location = new System.Drawing.Point(3, 148); + this.B_CGearSkin.Name = "B_CGearSkin"; + this.B_CGearSkin.Size = new System.Drawing.Size(87, 23); + this.B_CGearSkin.TabIndex = 24; + this.B_CGearSkin.Text = "C-Gear Skin"; + this.B_CGearSkin.UseVisualStyleBackColor = true; + this.B_CGearSkin.Click += new System.EventHandler(this.B_CGearSkin_Click); + // // dragout // this.dragout.BackColor = System.Drawing.Color.Transparent; @@ -5071,6 +5083,7 @@ private System.Windows.Forms.Button BTN_Medals; private System.Windows.Forms.FlowLayoutPanel FLP_PKMEditors; private System.Windows.Forms.Button B_LinkInfo; + private System.Windows.Forms.Button B_CGearSkin; } } diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index d9f6a1c08..ad0aaac30 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -786,6 +786,7 @@ namespace PKHeX B_JPEG.Visible = SAV.HasJPEG; B_OpenEventFlags.Visible = SAV.HasEvents; B_LinkInfo.Visible = SAV.HasLink; + B_CGearSkin.Visible = SAV.Generation == 5; // Generational Interface byte[] extraBytes = new byte[1]; @@ -3235,6 +3236,10 @@ namespace PKHeX { new SAV_Link6().ShowDialog(); } + private void B_CGearSkin_Click(object sender, EventArgs e) + { + new SAV_CGearSkin().ShowDialog(); + } private void B_JPEG_Click(object sender, EventArgs e) { byte[] jpeg = SAV.JPEGData; diff --git a/MainWindow/Main.resx b/MainWindow/Main.resx index 4332f0e62..4916aa9d4 100644 --- a/MainWindow/Main.resx +++ b/MainWindow/Main.resx @@ -1306,6 +1306,9 @@ True + + True + True diff --git a/PKHeX.csproj b/PKHeX.csproj index 9e8f5b4d6..7fec0743d 100644 --- a/PKHeX.csproj +++ b/PKHeX.csproj @@ -173,6 +173,13 @@ + + + Form + + + SAV_CGearSkin.cs + Form @@ -324,6 +331,9 @@ MemoryAmie.cs + + SAV_CGearSkin.cs + SAV_Link6.cs diff --git a/Saves/SAV5.cs b/Saves/SAV5.cs index d4dc3b12b..9d2b68d0d 100644 --- a/Saves/SAV5.cs +++ b/Saves/SAV5.cs @@ -42,6 +42,8 @@ namespace PKHeX Daycare = 0x20E00; PokeDex = 0x21600; PokeDexLanguageFlags = PokeDex + 0x320; + CGearInfoOffset = 0x1C000; + CGearDataOffset = 0x52000; // Inventory offsets are the same for each game. OFS_PouchHeldItem = 0x18400; // 0x188D7 @@ -65,6 +67,8 @@ namespace PKHeX Daycare = 0x20D00; PokeDex = 0x21400; PokeDexLanguageFlags = PokeDex + 0x328; // forme flags size is + 8 from bw with new formes (therians) + CGearInfoOffset = 0x1C000; + CGearDataOffset = 0x52800; // Inventory offsets are the same for each game. OFS_PouchHeldItem = 0x18400; // 0x188D7 @@ -152,7 +156,7 @@ namespace PKHeX new BlockInfo(0x19600, 0x1338, 0x1A93A, 0x23F3A), // ??? new BlockInfo(0x1AA00, 0x07C4, 0x1B1C6, 0x23F3C), // ??? new BlockInfo(0x1B200, 0x0D54, 0x1BF56, 0x23F3E), // ??? - new BlockInfo(0x1C000, 0x002C, 0x1C02E, 0x23F40), // ??? + new BlockInfo(0x1C000, 0x002C, 0x1C02E, 0x23F40), // Skin Info new BlockInfo(0x1C100, 0x0658, 0x1C75A, 0x23F42), // ??? Gym badge data new BlockInfo(0x1C800, 0x0A94, 0x1D296, 0x23F44), // ??? new BlockInfo(0x1D300, 0x01AC, 0x1D4AE, 0x23F46), // ??? @@ -229,7 +233,7 @@ namespace PKHeX new BlockInfo(0x19600, 0x1338, 0x1A93A, 0x25F3A), // Unity Tower and survey stuff new BlockInfo(0x1AA00, 0x07c4, 0x1B1C6, 0x25F3C), // Pal Pad Player Data (30d) new BlockInfo(0x1B200, 0x0d54, 0x1BF56, 0x25F3E), // Pal Pad Friend Data - new BlockInfo(0x1C000, 0x0094, 0x1C096, 0x25F40), // C-Gear + new BlockInfo(0x1C000, 0x0094, 0x1C096, 0x25F40), // Skin Info new BlockInfo(0x1C100, 0x0658, 0x1C75A, 0x25F42), // Card Signature Block & ???? new BlockInfo(0x1C800, 0x0a94, 0x1D296, 0x25F44), // Mystery Gift new BlockInfo(0x1D300, 0x01ac, 0x1D4AE, 0x25F46), // Dream World Stuff (Catalog) @@ -353,6 +357,7 @@ namespace PKHeX private const int wcSeed = 0x1D290; + public readonly int CGearInfoOffset, CGearDataOffset; private readonly int Trainer2, AdventureInfo, PokeDexLanguageFlags; public override bool HasBoxWallpapers => false; public override bool HasPokeDex => false; diff --git a/Subforms/Save Editors/Gen5/CGearBackground.cs b/Subforms/Save Editors/Gen5/CGearBackground.cs new file mode 100644 index 000000000..cdcbdf7ba --- /dev/null +++ b/Subforms/Save Editors/Gen5/CGearBackground.cs @@ -0,0 +1,356 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; + +namespace PKHeX +{ + public class CGearBackground + { + public const string Extension = "cgb"; + public const string Filter = "C-Gear Background|*.cgb"; + public const int Width = 256; // px + public const int Height = 192; // px + public const int SIZE_CGB = 0x2600; + + /* CGearBackground Documentation + * CGearBackgrounds (.cgb) are tiled images. + * Tiles are 8x8, and serve as a tileset for building the image. + * The first 0x2000 bytes are the tile building region. + * A tile to have two pixels defined in one byte of space. + * A tile takes up 64 pixels, 32 bytes, 0x20 chunks. + * The last tile is actually the colors used in the image (16bit). + * Only 16 colors can be used for the entire image. + * 255 tiles may be chosen from, as (0x2000-(0x20))/0x20 = 0xFF + * The last 0x600 bytes are the tiles used. + * 256/8 = 32, 192/8 = 24 + * 32 * 24 = 0x300 + * The tiles are chosen based on the 16bit index of the tile. + * 0x300 * 2 = 0x600! + * + * CGearBackgrounds tilemap (when stored) employs odd obfuscation. + * BW obfuscates by adding 0xA0A0, B2W2 adds 0xA000 + * The obfuscated number is then tweaked by adding 15*(i/17) + * To reverse, use a similar reverse calculation + * PSK files are basically raw game rips (obfuscated) + * CGB files are un-obfuscated. + * Due to BW and B2W2 using different obfuscation adds, PSK files are incompatible between the versions. + */ + + public CGearBackground(byte[] data) + { + if (data.Length != SIZE_CGB) + return; + + byte[] Region1 = data.Take(0x1FE0).ToArray(); + byte[] ColorData = data.Skip(0x1FE0).Take(0x20).ToArray(); + byte[] Region2 = data.Skip(0x2000).Take(0x600).ToArray(); + + ColorPalette = new Color[0x10]; + for (int i = 0; i < 0x10; i++) + ColorPalette[i] = getRGB555(BitConverter.ToUInt16(ColorData, i * 2)); + + Tiles = new Tile[0xFF]; + for (int i = 0; i < 0xFF; i++) + { + Tiles[i] = new Tile(Region1.Skip(i * Tile.SIZE_TILE).Take(Tile.SIZE_TILE).ToArray()); + Tiles[i].setTile(ColorPalette); + } + + Map = new TileMap(Region2); + } + + public byte[] Write() + { + byte[] data = new byte[SIZE_CGB]; + for (int i = 0; i < Tiles.Length; i++) + Array.Copy(Tiles[i].Write(), 0, data, i*Tile.SIZE_TILE, Tile.SIZE_TILE); + + for (int i = 0; i < ColorPalette.Length; i++) + BitConverter.GetBytes(getRGB555(ColorPalette[i])).CopyTo(data, 0x1FE0 + i*2); + + Array.Copy(Map.Write(), 0, data, 0x2000, 0x600); + + return data; + } + + public static bool getIsCGB(byte[] data) + { + return data[0x2001] == 0; + } + public static byte[] CGBtoPSK(byte[] cgb, bool B2W2) + { + byte[] psk = (byte[])cgb.Clone(); + int shiftVal = B2W2 ? 0xA000 : 0xA0A0; + for (int i = 0x2000; i < 0x2600; i += 2) + { + int index = BitConverter.ToUInt16(cgb, i); + int val = IndexToVal(index, shiftVal); + BitConverter.GetBytes((ushort)val).CopyTo(psk, i); + } + return psk; + } + public static byte[] PSKtoCGB(byte[] psk, bool B2W2) + { + byte[] cgb = (byte[])psk.Clone(); + int shiftVal = B2W2 ? 0xA000 : 0xA0A0; + for (int i = 0x2000; i < 0x2600; i += 2) + { + int val = BitConverter.ToUInt16(psk, i); + int index = ValToIndex(val, shiftVal); + BitConverter.GetBytes((ushort)index).CopyTo(cgb, i); + } + return cgb; + } + + private Color[] ColorPalette; + private Tile[] Tiles; + private TileMap Map; + + public Bitmap GetImage() + { + Bitmap img = new Bitmap(Width, Height, PixelFormat.Format32bppArgb); + + // Fill Data + using (Graphics g = Graphics.FromImage(img)) + for (int i = 0; i < Map.TileChoices.Length; i++) + { + int x = (i*8)%Width; + int y = 8*((i*8)/Width); + + Bitmap b = Tiles[Map.TileChoices[i] % Tiles.Length].Rotate(Map.Rotations[i]); + g.DrawImage(b, new Point(x, y)); + } + return img; + } + public void SetImage(Bitmap img) + { + if (img.Width != Width) + throw new ArgumentException($"Invalid image width. Expected {Width} pixels wide."); + if (img.Height != Height) + throw new ArgumentException($"Invalid image height. Expected {Height} pixels high."); + + // get raw bytes of image + BitmapData bData = img.LockBits(new Rectangle(0, 0, Width, Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + byte[] data = new byte[bData.Stride * bData.Height]; + Marshal.Copy(bData.Scan0, data, 0, data.Length); + + int bpp = bData.Stride/Width; + // get colors + Color[] colors = new Color[Width*Height]; + for (int i = 0; i < data.Length; i += bpp) + { + uint val = BitConverter.ToUInt32(data, i); + colors[i/bpp] = getRGB555(val); + } + + Color[] Palette = colors.Distinct().ToArray(); + if (Palette.Length > 0x10) + throw new ArgumentException($"Too many unique colors. Expected <= 16, got {Palette.Length}"); + + // Build Tiles + Tile[] tiles = new Tile[0x300]; + for (int i = 0; i < tiles.Length; i++) + { + int x = (i*8)%Width; + int y = 8*((i*8)/Width); + + Tile t = new Tile(); + for (uint ix = 0; ix < 8; ix++) + for (uint iy = 0; iy < 8; iy++) + { + int index = (int)(y + iy)*Width + (int)(x + ix); + Color c = colors[index]; + + t.ColorChoices[ix%8 + iy*8] = Array.IndexOf(Palette, c); + } + t.setTile(Palette); + tiles[i] = t; + } + + List tilelist = new List {tiles[0]}; + TileMap tm = new TileMap(new byte[2*Width*Height/64]); + for (int i = 1; i < tm.TileChoices.Length; i++) + { + for (int j = 0; j < tilelist.Count; j++) + { + int rotVal = tiles[i].getRotationValue(tilelist[j].PixelData); + if (rotVal <= -1) continue; + tm.TileChoices[i] = j; + tm.Rotations[i] = rotVal; + goto next; + } + if (tilelist.Count == 0xFF) + throw new ArgumentException($"Too many unique tiles. Expected < 256, ran out of tiles at {i + 1} of {tm.TileChoices.Length}"); + tilelist.Add(tiles[i]); + + next:; + } + + // Finished! + Map = tm; + ColorPalette = Palette; + Tiles = tilelist.ToArray(); + } + + private class Tile + { + public const int SIZE_TILE = 0x20; + private const int TileWidth = 8; + private const int TileHeight = 8; + public readonly int[] ColorChoices; + private Bitmap img; + public byte[] PixelData; + + public Tile(byte[] data = null) + { + if (data == null) + data = new byte[SIZE_TILE]; + if (data.Length != SIZE_TILE) + return; + + ColorChoices = new int[TileWidth*TileHeight]; + for (int i = 0; i < data.Length; i++) + { + ColorChoices[i*2+0] = data[i] & 0xF; + ColorChoices[i*2+1] = data[i] >> 4; + } + } + public void setTile(Color[] Palette) + { + img = new Bitmap(8, 8); + for (int x = 0; x < 8; x++) + for (int y = 0; y < 8; y++) + { + var index = ColorChoices[x%8 + y*8]; + var choice = Palette[index]; + img.SetPixel(x, y, choice); + } + + PixelData = getTileRAW(img); + } + public byte[] Write() + { + byte[] data = new byte[SIZE_TILE]; + for (int i = 0; i < data.Length; i++) + { + data[i] |= (byte)(ColorChoices[i*2+0] & 0xF); + data[i] |= (byte)((ColorChoices[i*2+1] & 0xF) << 4); + } + return data; + } + + public Bitmap Rotate(int rotFlip) + { + if (rotFlip == 0) + return img; + Bitmap tile = (Bitmap)img.Clone(); + if ((rotFlip & 4) > 0) + tile.RotateFlip(RotateFlipType.RotateNoneFlipX); + if ((rotFlip & 8) > 0) + tile.RotateFlip(RotateFlipType.RotateNoneFlipY); + return tile; + } + private static byte[] getTileRAW(Bitmap tile) + { + BitmapData bData = tile.LockBits(new Rectangle(0, 0, tile.Width, tile.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + byte[] data = new byte[bData.Stride * bData.Height]; + Marshal.Copy(bData.Scan0, data, 0, data.Length); + tile.UnlockBits(bData); + return data; + } + + public int getRotationValue(byte[] data) + { + // Check all rotation types + if (PixelData.SequenceEqual(data)) + return 0; + + if (getTileRAW(Rotate(4)).SequenceEqual(data)) + return 4; + if (getTileRAW(Rotate(8)).SequenceEqual(data)) + return 8; + if (getTileRAW(Rotate(12)).SequenceEqual(data)) + return 12; + return -1; + } + } + private class TileMap + { + public readonly int[] TileChoices; + public readonly int[] Rotations; + + public TileMap(byte[] data) + { + TileChoices = new int[data.Length/2]; + Rotations = new int[data.Length/2]; + for (int i = 0; i < data.Length; i += 2) + { + TileChoices[i/2] = data[i]; + Rotations[i/2] = data[i+1]; + } + } + public byte[] Write() + { + using (MemoryStream ms = new MemoryStream()) + using (BinaryWriter bw = new BinaryWriter(ms)) + { + for (int i = 0; i < TileChoices.Length; i++) + { + bw.Write((byte)TileChoices[i]); + bw.Write((byte)Rotations[i]); + } + return ms.ToArray(); + } + } + } + + private static int IndexToVal(int index, int shiftVal) + { + int val = index + shiftVal; + return val + 15*(index/17); + } + private static int ValToIndex(int val, int shiftVal) + { + int index = val - shiftVal; + return index - 15*(index/32); + } + + private static byte convert8to5(int colorval) + { + byte i = 0; + while (colorval > Convert5To8[i]) i++; + return i; + } + private static Color getRGB555(uint val) + { + int R = (int)(val >> 0 >> 3) & 0x1F; + int G = (int)(val >> 8 >> 3) & 0x1F; + int B = (int)(val >> 16 >> 3) & 0x1F; + return Color.FromArgb(0xFF, Convert5To8[R], Convert5To8[G], Convert5To8[B]); + } + private static Color getRGB555(ushort val) + { + int R = (val >> 0) & 0x1F; + int G = (val >> 5) & 0x1F; + int B = (val >> 10) & 0x1F; + return Color.FromArgb(0xFF, Convert5To8[R], Convert5To8[G], Convert5To8[B]); + } + private static ushort getRGB555(Color c) + { + int val = 0; + // val += c.A >> 8; // unused + val |= convert8to5(c.R) << 0; + val |= convert8to5(c.G) << 5; + val |= convert8to5(c.B) << 10; + return (ushort)val; + } + private static readonly int[] Convert5To8 = { 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, + 0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B, + 0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD, + 0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF }; + } +} diff --git a/Subforms/Save Editors/Gen5/SAV_CGearSkin.Designer.cs b/Subforms/Save Editors/Gen5/SAV_CGearSkin.Designer.cs new file mode 100644 index 000000000..9707291cf --- /dev/null +++ b/Subforms/Save Editors/Gen5/SAV_CGearSkin.Designer.cs @@ -0,0 +1,156 @@ +namespace PKHeX +{ + partial class SAV_CGearSkin + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_CGearSkin)); + this.PB_Background = new System.Windows.Forms.PictureBox(); + this.B_Cancel = new System.Windows.Forms.Button(); + this.B_Save = new System.Windows.Forms.Button(); + this.B_ImportPNG = new System.Windows.Forms.Button(); + this.B_ExportPNG = new System.Windows.Forms.Button(); + this.B_ExportCGB = new System.Windows.Forms.Button(); + this.B_ImportCGB = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.PB_Background)).BeginInit(); + this.SuspendLayout(); + // + // PB_Background + // + this.PB_Background.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.PB_Background.Location = new System.Drawing.Point(12, 12); + this.PB_Background.Name = "PB_Background"; + this.PB_Background.Size = new System.Drawing.Size(258, 194); + this.PB_Background.TabIndex = 0; + this.PB_Background.TabStop = false; + // + // B_Cancel + // + this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_Cancel.Location = new System.Drawing.Point(276, 183); + this.B_Cancel.Name = "B_Cancel"; + this.B_Cancel.Size = new System.Drawing.Size(103, 23); + this.B_Cancel.TabIndex = 1; + this.B_Cancel.Text = "Cancel"; + this.B_Cancel.UseVisualStyleBackColor = true; + this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); + // + // B_Save + // + this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_Save.Location = new System.Drawing.Point(276, 154); + this.B_Save.Name = "B_Save"; + this.B_Save.Size = new System.Drawing.Size(103, 23); + this.B_Save.TabIndex = 2; + this.B_Save.Text = "Save"; + this.B_Save.UseVisualStyleBackColor = true; + this.B_Save.Click += new System.EventHandler(this.B_Save_Click); + // + // B_ImportPNG + // + this.B_ImportPNG.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_ImportPNG.Location = new System.Drawing.Point(276, 12); + this.B_ImportPNG.Name = "B_ImportPNG"; + this.B_ImportPNG.Size = new System.Drawing.Size(103, 23); + this.B_ImportPNG.TabIndex = 3; + this.B_ImportPNG.Text = "Import .png"; + this.B_ImportPNG.UseVisualStyleBackColor = true; + this.B_ImportPNG.Click += new System.EventHandler(this.B_ImportPNG_Click); + // + // B_ExportPNG + // + this.B_ExportPNG.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_ExportPNG.Location = new System.Drawing.Point(276, 41); + this.B_ExportPNG.Name = "B_ExportPNG"; + this.B_ExportPNG.Size = new System.Drawing.Size(103, 23); + this.B_ExportPNG.TabIndex = 4; + this.B_ExportPNG.Text = "Export .png"; + this.B_ExportPNG.UseVisualStyleBackColor = true; + this.B_ExportPNG.Click += new System.EventHandler(this.B_ExportPNG_Click); + // + // B_ExportCGB + // + this.B_ExportCGB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_ExportCGB.Location = new System.Drawing.Point(276, 112); + this.B_ExportCGB.Name = "B_ExportCGB"; + this.B_ExportCGB.Size = new System.Drawing.Size(103, 23); + this.B_ExportCGB.TabIndex = 6; + this.B_ExportCGB.Text = "Export .cgb"; + this.B_ExportCGB.UseVisualStyleBackColor = true; + this.B_ExportCGB.Click += new System.EventHandler(this.B_ExportCGB_Click); + // + // B_ImportCGB + // + this.B_ImportCGB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_ImportCGB.Location = new System.Drawing.Point(276, 83); + this.B_ImportCGB.Name = "B_ImportCGB"; + this.B_ImportCGB.Size = new System.Drawing.Size(103, 23); + this.B_ImportCGB.TabIndex = 5; + this.B_ImportCGB.Text = "Import .cgb/.psk"; + this.B_ImportCGB.UseVisualStyleBackColor = true; + this.B_ImportCGB.Click += new System.EventHandler(this.B_ImportCGB_Click); + // + // SAV_CGearSkin + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(391, 216); + this.Controls.Add(this.B_ExportCGB); + this.Controls.Add(this.B_ImportCGB); + this.Controls.Add(this.B_ExportPNG); + this.Controls.Add(this.B_ImportPNG); + this.Controls.Add(this.B_Save); + this.Controls.Add(this.B_Cancel); + this.Controls.Add(this.PB_Background); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "SAV_CGearSkin"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "C-Gear Skin"; + ((System.ComponentModel.ISupportInitialize)(this.PB_Background)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox PB_Background; + private System.Windows.Forms.Button B_Cancel; + private System.Windows.Forms.Button B_Save; + private System.Windows.Forms.Button B_ImportPNG; + private System.Windows.Forms.Button B_ExportPNG; + private System.Windows.Forms.Button B_ExportCGB; + private System.Windows.Forms.Button B_ImportCGB; + } +} \ No newline at end of file diff --git a/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs b/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs new file mode 100644 index 000000000..3d0b6ea42 --- /dev/null +++ b/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs @@ -0,0 +1,134 @@ +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Windows.Forms; + +namespace PKHeX +{ + public partial class SAV_CGearSkin : Form + { + public SAV_CGearSkin() + { + InitializeComponent(); + + SAV = (SAV5)Main.SAV.Clone(); + + bool cgearPresent = SAV.Data[SAV.CGearInfoOffset + 0x26] == 1; + bg = new CGearBackground(cgearPresent ? + CGearBackground.PSKtoCGB(SAV.Data.Skip(SAV.CGearDataOffset).Take(CGearBackground.SIZE_CGB).ToArray(), SAV.B2W2) + : new byte[CGearBackground.SIZE_CGB]); + + PB_Background.Image = bg.GetImage(); + } + + private readonly SAV5 SAV; + private CGearBackground bg; + + private void B_ImportPNG_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog + { + Filter = "PNG File|*.png", + FileName = "Background.png", + }; + + if (ofd.ShowDialog() != DialogResult.OK) + return; + + Bitmap img = (Bitmap)Image.FromFile(ofd.FileName); + + try + { + bg.SetImage(img); + PB_Background.Image = bg.GetImage(); + } + catch (Exception ex) + { + Util.Error(ex.Message); + } + } + private void B_ExportPNG_Click(object sender, EventArgs e) + { + Image png = PB_Background.Image; + SaveFileDialog sfd = new SaveFileDialog + { + Filter = "PNG File|*.png", + FileName = "Background.png", + }; + + if (sfd.ShowDialog() != DialogResult.OK) + return; + + png.Save(sfd.FileName, ImageFormat.Png); + } + private void B_ImportCGB_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog + { + Filter = CGearBackground.Filter + "|PokeStock C-Gear Skin|*.psk" + }; + + if (ofd.ShowDialog() != DialogResult.OK) + return; + + var len = new FileInfo(ofd.FileName).Length; + if (len != CGearBackground.SIZE_CGB) + { + Util.Error($"Incorrect size, got {len} bytes, expected {CGearBackground.SIZE_CGB} bytes."); + return; + } + + byte[] data = File.ReadAllBytes(ofd.FileName); + if (!CGearBackground.getIsCGB(data)) + { + bool B2W2 = data[0x2000] != 0x00; + data = CGearBackground.PSKtoCGB(data, B2W2); + } + + bg = new CGearBackground(data); + PB_Background.Image = bg.GetImage(); + } + private void B_ExportCGB_Click(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog + { + Filter = CGearBackground.Filter, + }; + + if (sfd.ShowDialog() != DialogResult.OK) + return; + + byte[] data = bg.Write(); + File.WriteAllBytes(sfd.FileName, data); + } + private void B_Save_Click(object sender, EventArgs e) + { + byte[] bgdata = bg.Write(); + if (bgdata.SequenceEqual(new byte[CGearBackground.SIZE_CGB])) + return; + + bgdata = CGearBackground.CGBtoPSK(bgdata, SAV.B2W2); + + Array.Copy(bgdata, 0, Main.SAV.Data, SAV.CGearDataOffset, bgdata.Length); + ushort chk = SaveUtil.ccitt16(bgdata); + BitConverter.GetBytes(chk).CopyTo(Main.SAV.Data, SAV.CGearDataOffset + bgdata.Length + 2); + BitConverter.GetBytes(chk).CopyTo(Main.SAV.Data, SAV.CGearDataOffset + bgdata.Length + 0x100); + + byte[] skinchkdata = Main.SAV.Data.Skip(SAV.CGearDataOffset + bgdata.Length + 0x100).Take(4).ToArray(); + ushort skinchkval = SaveUtil.ccitt16(skinchkdata); + BitConverter.GetBytes(skinchkval).CopyTo(Main.SAV.Data, SAV.CGearDataOffset + bgdata.Length + 0x112); + + Main.SAV.Data[SAV.CGearInfoOffset + 0x26] = 1; // data present + BitConverter.GetBytes(chk).CopyTo(Main.SAV.Data, SAV.CGearInfoOffset + 0x24); + + Main.SAV.Edited = true; + Close(); + } + private void B_Cancel_Click(object sender, EventArgs e) + { + Close(); + } + } +} diff --git a/Subforms/Save Editors/Gen5/SAV_CGearSkin.resx b/Subforms/Save Editors/Gen5/SAV_CGearSkin.resx new file mode 100644 index 000000000..603f660be --- /dev/null +++ b/Subforms/Save Editors/Gen5/SAV_CGearSkin.resx @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAE + AAAAAAAAAAAAAAAAAAAAAAAAIyMjAQAAAAALCwsPJiYmJysrKycqKionKSkpJykpKScpKSknKioqJyoq + KicrKysnJycnJw0ODQ8AAAAAJiYmAQAAAABpaWlHq6ur17+/v+6+vr7svr6+7b6+vu2+vr7tvr6+7b6+ + vu2+vr7tvr6+7L+/v+6rq6vXampqSAAAAAAoKSgXvr++3eLi4v/g4OD94eHh/+Hh4f/i4uL/4uLi/+Li + 4v/i4uL/4eHh/+Dh4P/g4OD94uLi/7+/v90sLCwXfn5+PNna2frg4OD/39/f/uHh4f7h4eH+39/f/uDg + 4P7g4OD+39/f/uHh4f7h4OH+39/f/t/g3//a2tr6g4ODPoOCgz7X19f64+Pj/+Li4v7k5OT/4+Tj//Ly + 8v/19fX/9PT0//T09P/k5OT/5OTk/+Pj4/7j4+P/19jX+4qLikCDhIM+2tra++Xl5f/k5eT+5OTk//Lz + 8v+urq7/RUVF/z4+Pv+Zmpn/8fHx/+Xm5f/k5eT+5eXl/9ra2vyLi4tAhYWFPuXm5vvx8vP/7+/w/v// + //+sra3/AgIC/15eXv9tbG3/BQUF/4yMjP//////7+/w/vHy8//l5ub8jY2NQC4uLD5LS0f7UFBL/09P + Sv5YWVP/FBUS/29wcP///////////5SUlP8PDw//U1NO/1BQS/5PT0r/S0tH/DIyMEAAAAs+AAAM+wAA + Dv8AAA/+AwMS/wAAAP+UlJX///////////+3t7n/AAAA/wAAD/8BAQ/+AAAO/wAADPwCAg5ABARSPgoK + k/sNDab/DQ2o/hAQvP8CAmj/IiIW/7Kzrv/Cw8D/NDQm/wAATf8QELz/DQ2q/gwMp/8LC5T8Dg5bQAUF + Xj4KCpz7DQ2u/w0NsP4NDbX/Dw+//wUFYf8CAhL/AwMP/wMDTf8ODrj/Dg64/w0NsP4MDK7/Cwud/A8P + aEEGBmU9DAyl+w4Otf8ODrf+Dw+6/xAQvv8TE8v/EhK+/xAQvP8TE8v/EBDA/w8Puf8PD7f+Dg61/w0N + pvsREW9ACAhtQA8PsfsTE77/ExO//xQUwP8UFML/FBTD/xUVyP8WFsn/FRXE/xQUw/8UFMH/ExO//xMT + vv8QELL7ERF3QxkZdCgXF771ExPH/xUVyPwVFcn9FhbL/RcXzP0XF8z9FxfM/RcXy/0XF8v9FhbJ/RUV + yPwTE8f/Fxe+9RkZdykAAAAAIyOtghsbx/8ZGcj+GRnJ/xoayf8aGsn/GhrK/xoayv8aGsn/GhrJ/xkZ + yf8ZGcj+GxvH/yMjrYQAAAAAAADHAQAAAAAzM51FLCyscCoqrGwqKqxtKSmsbSoqrG0qKqxtKSmsbSoq + rG0qKqxsLCyscDMznUUAAAAAAAAAAP//AADAAwAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIAB + AACAAQAAgAEAAIABAACAAQAAgAEAAP//AAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKysrCR0dHSMWFhY3GBgYORgYGDkYGBg5GBgYORgY + GDkYGBg5GBgYORgYGDkYGBg5GBgYORgYGDkYGBg5GBgYORgYGDkYGBg5GBgYORgYGDkYGBg5FxcXNx4e + HiQuLi4JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASEhIARYWFis7OzuVkJCQ2ampqeqqqqrsqqqq7Kqq + quyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqq + quypqanqkZGR2j09PZcXFxcsUFBQAQAAAAAAAAAAAAAAAAAAAAASEhIuhISEytvb2/7W1tb/19fX/9jY + 2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9jY + 2P/Y2Nj/2NjY/9fX1//W1tb/29vb/oeHh8sTExMvAAAAAAAAAAAAAAAAPDw8DGtra6zZ2dn/2dnZ/9ra + 2v/b29v/29vb/9vb2//c3Nz/3Nzc/9zc3P/c3Nz/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc + 3P/c3Nz/3Nzc/9vb2//b29v/29vb/9ra2v/Z2dn/2dnZ/21tba5DQ0MNAAAAAAAAAAAiIiIx1NXU9tna + 2f/c3Nz/3d3d/93e3f/e3t7/3t7e/9/f3//f39//39/f/9/g3//g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg + 4P/g4OD/39/f/9/f3//f39//3t/e/97e3v/d3t3/3d3d/9zc3P/Z2tn/1dXV9icnJzMAAAAAAAAAAFhZ + WFzf4N//3Nzc/97e3v/f39//39/f/9/g3//g4OD/4ODg/+Hh4f/h4eH/4eHh/+Li4v/i4uL/4uLi/+Li + 4v/i4uL/4uLi/+Hi4f/h4eH/4eHh/+Dg4P/g4OD/3+Df/9/f3//f39//3t7e/9zc3P/f39//XV1dXQAA + AAAAAAAAZmZmZdvc2//e3t7/3+Df/+Dg4P/g4eD/4eHh/+Hi4f/i4uL/4uPi/+Pj4//j4+P/5OTk/+Tk + 5P/k5OT/5OTk/+Tk5P/k5OT/4+Pj/+Pj4//j4+P/4uLi/+Li4v/h4eH/4eHh/+Dg4P/f4N//3t7e/9vb + 2/9wcHBoAAAAAAAAAABoaGhl3d3d/9/f3//h4eH/4eLh/+Li4v/j4+P/4+Pj/+Tk5P/k5OT/5eXl/+Xl + 5f/l5uX/5ubm/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Tk5P/k5OT/4+Pj/+Pj4//i4uL/4uLi/+Hh + 4f/f39//3N3c/3Nzc2kAAAAAAAAAAGhoaGXe3t7/4ODg/+Li4v/j4+P/4+Pj/+Tk5P/l5eX/5eXl/+bm + 5v/m5+b/5+fn/+fn5//n6Of/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5ubm/+Xl5f/l5eX/5OTk/+Pk + 4//j4+P/4uLi/+Dg4P/e3t7/c3NzaQAAAAAAAAAAaGhoZd/g3//i4uL/5OTk/+Tl5P/l5eX/5ebl/+bn + 5v/n5+f/5+jn/+jp6P/p6en/7Ozs/8LCwv+Tk5P/ioqK/66urv/o6ej/6enp/+jp6P/o6Oj/5+jn/+bn + 5v/m5ub/5ebl/+Tl5P/k5OT/4uLi/9/g3/9zdHNpAAAAAAAAAABoaWhl4eLh/+Pk4//m5ub/5ubm/+fn + 5//n6Of/6Ojo/+np6f/p6un/6urq/8bGxv8yMjL/AAAA/wAAAP8AAAD/AAAA/xMTE/+ZmZn/7Ozs/+rq + 6v/p6en/6Ojo/+jo6P/n5+f/5ubm/+bm5v/k5OT/4eHh/3R0dGkAAAAAAAAAAGhpaGXj4+P/5eXl/+fn + 5//n6Of/6Ojo/+np6f/q6ur/6urq/+vr6//Dw8P/DAwM/wAAAP8AAAD/Gxsb/ygoKP8BAQH/AAAA/wAA + AP+FhYX/7O3s/+rr6v/q6ur/6enp/+jo6P/o6Oj/5+fn/+Xl5f/i4+L/dHR0aQAAAAAAAAAAYWFhZeTl + 5P/m5+b/6Ono/+np6f/p6un/6uvq/+vr6//s7Oz/7e7t/ycnJ/8AAAD/Ghoa/7S0tP/m5ub/5OTk/9HR + 0f9GRkb/AAAA/wICAv/IyMj/7Ozs/+vs6//q6+r/6urq/+nq6f/o6ej/5+fn/+Tk5P9sbGxpAAAAAAAA + AAA9Pj1lj4+P/5OTk/+VlZX/lpaW/5eXl/+YmJj/mZmZ/5qamv92dnb/AAAA/wEBAf+/wL//3Nzc/+Tk + 5P/l5eX/3d3d/+Li4v8mJib/AAAA/0ZGRv+ampr/mZmZ/5iYmP+Xl5f/lpaW/5WVlf+Tk5P/j4+P/0ZG + RmoAAAAAAAAAAAwMDGUAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/Nzc3/+fn + 5//q6ur/7O3s/+zt7P/v7+//39/f/4WFhf8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA + AP8AAAD/EBAQagAAAAAAAAAAAwMHZQAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA + AP9NTU3/5ufm//Lz8v/z9PP/8/Tz//X19f/l5eX/nZ2d/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA + AP8AAAD/AAAA/wAAAP8GBgpqAAAAAAAAAAAAABZlAQEk/wEBJ/8CAin/AgIq/wICKv8CAiv/AgIs/wIC + LP8BAR3/AAAA/xwcHP/w8PD/6+zr//r6+v/6+vr/9PT0/+vr6/9lZWX/AAAA/wAAD/8CAi3/AgIs/wIC + K/8CAir/AgIq/wICKf8BASf/AQEl/wUFG2oAAAAAAAAAAAICQGUGBpL/Bwec/wgIo/8JCaf/CQmq/wkJ + rf8JCa//Cgqz/wkJqP8AAAL/AAAA/4CAgP/y8/L/6+zr/+3t7f/u7u7/xMTE/wcHB/8AAAD/BgZz/woK + s/8JCbD/CQmt/wkJqv8JCaj/CAik/wcHnf8HB5P/Dg5MagAAAAAAAAAAAwNHZQgIk/8JCZ3/Cgqj/wsL + p/8LC6n/Cwus/wsLr/8MDLL/DAy2/wYGW/8AAAD/AAAA/1JSUv+sraz/tra2/3h4eP8KCgr/AAAA/wIC + Iv8MDLb/DAyy/wsLsP8LC63/Cwuq/wsLp/8KCqT/CQmd/wgIk/8PD1VrAAAAAAAAAAAEBE1lCQmY/woK + ov8LC6j/DAyr/wwMrf8MDLD/DAyy/w0Ntf8NDbf/Dg67/wUFSv8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA + AP8CAiH/DQ2q/w0NuP8NDbX/DQ2z/wwMsP8MDK7/DAyr/wsLqP8KCqL/CQmZ/xAQWmsAAAAAAAAAAAQE + UGUKCp7/Cwum/wwMrP8NDa//DQ2w/w0Ns/8ODrX/Dg63/w4Ouf8ODrv/Dw/A/wwMiv8FBTj/AAAG/wAA + AP8DAyb/CQls/w8Pu/8PD7z/Dg66/w4OuP8ODrX/DQ2z/w0Nsf8NDa//DAys/wsLp/8KCp7/ERFeawAA + AAAAAAAABQVTZQsLpP8MDKv/DQ2w/w4Os/8ODrT/Dg62/w8PuP8PD7r/Dw+8/w8Pvf8QEL//EBDA/xER + w/8SEsn/ERHJ/xERxf8QEMD/EBC//w8Pvv8PD7z/Dw+6/w8PuP8ODrf/Dg61/w4Os/8NDbH/DAyr/wsL + pP8SEmFrAAAAAAAAAAAGBlZlDAyq/w4OsP8PD7X/Dw+3/w8PuP8QELr/EBC7/xAQvf8REb7/ERHA/xER + wf8REcL/EhLC/xISw/8SEsP/EhLC/xERwv8REcH/ERHA/xERvv8QEL3/EBC7/xAQuv8QELj/Dw+3/w8P + tf8ODrD/DAyq/xMTZWsAAAAAAAAAAAcHWmUODrD/EBC2/xERuv8REbz/ERG9/xISvv8SEr//EhLA/xMT + wf8TE8P/ExPD/xMTxP8TE8X/FBTF/xQUxf8UFMX/ExPE/xMTxP8TE8P/ExPC/xISwf8SEr//EhK+/xER + vf8REbz/ERG6/xAQtv8ODrD/FBRpawAAAAAAAAAACAhcYxAQtf8SErv/ExO+/xQUwP8UFMD/FBTB/xUV + wv8VFcP/FRXE/xUVxf8WFsb/FhbG/xYWx/8WFsf/FhbH/xYWx/8WFsf/FhbG/xYWxf8VFcT/FRXD/xUV + wv8UFMH/FBTB/xQUwP8TE77/EhK7/xAQtf8TE2hoAAAAAAAAAAAQEFNUFRXC/xMTv/8UFMP/FRXE/xUV + xP8VFcX/FRXG/xYWx/8WFsf/FhbI/xYWyf8XF8n/FxfK/xcXyv8XF8r/FxfK/xcXyf8XF8n/FhbI/xYW + yP8WFsf/FhbG/xUVxf8VFcT/FRXE/xQUw/8TE7//FRXB/xAQV1UAAAAAAAAAAA0NPxkjI8byFBTD/xUV + x/8WFsj/FxfJ/xcXyf8XF8r/FxfK/xcXy/8YGMz/GBjM/xgYzP8YGM3/GBjN/xgYzf8YGM3/GBjM/xgY + zP8YGMz/GBjL/xcXy/8XF8r/FxfJ/xcXyf8WFsj/FRXH/xQUw/8jI8f0Dg5GGwAAAAAAAAAAFhZxAiUl + eIUZGcr/FBTI/xUVyv8WFsv/FhbM/xYWzP8WFsz/FhbN/xcXzf8XF83/FxfN/xcXzv8XF87/FxfO/xcX + zv8XF87/FxfN/xcXzf8WFs3/FhbM/xYWzP8WFsz/FhbL/xUVyv8UFMj/GBjJ/yYmeogWFnYCAAAAAAAA + AAAAAAAAGBh1BzMzk50kJNP+FxfK/xgYzP8YGMz/GBjN/xgYzf8YGM3/GBjN/xgYzf8ZGc7/GRnO/xkZ + zv8ZGc7/GRnO/xkZzv8YGM3/GBjN/xgYzf8YGM3/GBjN/xgYzP8YGMz/FxfK/yMj0v4zM5WfFBRkBwAA + AAAAAAAAAAAAAAAAAAAAAAAAHBx7Ay0tdkg3N5emMTGpxSwsp8gsLKfILCynyCwsp8gsLKfILCynyCws + p8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyDExqcU2NpenLi54Shsb + ewMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////8AAAD+AAAAfAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAAD4AAAB/gAAB////// + + + \ No newline at end of file From 801300adf2725d8f45c0621d56a4be12223f645b Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Mon, 8 Aug 2016 00:40:54 -0700 Subject: [PATCH 33/34] Fix image import Fix not setting tile choice for new tile, fix tile speed by comparing colors instead (manual rotation no fun) --- Subforms/Save Editors/Gen5/CGearBackground.cs | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/Subforms/Save Editors/Gen5/CGearBackground.cs b/Subforms/Save Editors/Gen5/CGearBackground.cs index cdcbdf7ba..fffd17cd7 100644 --- a/Subforms/Save Editors/Gen5/CGearBackground.cs +++ b/Subforms/Save Editors/Gen5/CGearBackground.cs @@ -139,6 +139,7 @@ namespace PKHeX Marshal.Copy(bData.Scan0, data, 0, data.Length); int bpp = bData.Stride/Width; + img.UnlockBits(bData); // get colors Color[] colors = new Color[Width*Height]; for (int i = 0; i < data.Length; i += bpp) @@ -177,7 +178,7 @@ namespace PKHeX { for (int j = 0; j < tilelist.Count; j++) { - int rotVal = tiles[i].getRotationValue(tilelist[j].PixelData); + int rotVal = tiles[i].getRotationValue(tilelist[j].ColorChoices); if (rotVal <= -1) continue; tm.TileChoices[i] = j; tm.Rotations[i] = rotVal; @@ -186,6 +187,7 @@ namespace PKHeX if (tilelist.Count == 0xFF) throw new ArgumentException($"Too many unique tiles. Expected < 256, ran out of tiles at {i + 1} of {tm.TileChoices.Length}"); tilelist.Add(tiles[i]); + tm.TileChoices[i] = tilelist.Count - 1; next:; } @@ -203,7 +205,6 @@ namespace PKHeX private const int TileHeight = 8; public readonly int[] ColorChoices; private Bitmap img; - public byte[] PixelData; public Tile(byte[] data = null) { @@ -229,8 +230,6 @@ namespace PKHeX var choice = Palette[index]; img.SetPixel(x, y, choice); } - - PixelData = getTileRAW(img); } public byte[] Write() { @@ -254,28 +253,32 @@ namespace PKHeX tile.RotateFlip(RotateFlipType.RotateNoneFlipY); return tile; } - private static byte[] getTileRAW(Bitmap tile) - { - BitmapData bData = tile.LockBits(new Rectangle(0, 0, tile.Width, tile.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - byte[] data = new byte[bData.Stride * bData.Height]; - Marshal.Copy(bData.Scan0, data, 0, data.Length); - tile.UnlockBits(bData); - return data; - } - public int getRotationValue(byte[] data) + public int getRotationValue(int[] tileColors) { // Check all rotation types - if (PixelData.SequenceEqual(data)) + if (ColorChoices.SequenceEqual(tileColors)) return 0; - if (getTileRAW(Rotate(4)).SequenceEqual(data)) - return 4; - if (getTileRAW(Rotate(8)).SequenceEqual(data)) - return 8; - if (getTileRAW(Rotate(12)).SequenceEqual(data)) - return 12; - return -1; + // flip x + for (int i = 0; i < 64; i++) + if (ColorChoices[(7 - (i & 7)) + 8 * (i / 8)] != tileColors[i]) + goto check8; + return 4; + + // flip y + check8: + for (int i = 0; i < 64; i++) + if (ColorChoices[64 - 8 * (1 + (i / 8)) + (i & 7)] != tileColors[i]) + goto check12; + return 8; + + // flip xy + check12: + for (int i = 0; i < 64; i++) + if (ColorChoices[63 - i] != tileColors[i]) + return -1; + return 12; } } private class TileMap @@ -332,13 +335,6 @@ namespace PKHeX int B = (int)(val >> 16 >> 3) & 0x1F; return Color.FromArgb(0xFF, Convert5To8[R], Convert5To8[G], Convert5To8[B]); } - private static Color getRGB555(ushort val) - { - int R = (val >> 0) & 0x1F; - int G = (val >> 5) & 0x1F; - int B = (val >> 10) & 0x1F; - return Color.FromArgb(0xFF, Convert5To8[R], Convert5To8[G], Convert5To8[B]); - } private static ushort getRGB555(Color c) { int val = 0; From 2ce5e442b1651e42b0dfe2af6e71208447e451bd Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Mon, 8 Aug 2016 00:45:30 -0700 Subject: [PATCH 34/34] Fix colors disappearing Thanks SciresM! --- Subforms/Save Editors/Gen5/CGearBackground.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Subforms/Save Editors/Gen5/CGearBackground.cs b/Subforms/Save Editors/Gen5/CGearBackground.cs index fffd17cd7..33f5a816d 100644 --- a/Subforms/Save Editors/Gen5/CGearBackground.cs +++ b/Subforms/Save Editors/Gen5/CGearBackground.cs @@ -51,7 +51,7 @@ namespace PKHeX ColorPalette = new Color[0x10]; for (int i = 0; i < 0x10; i++) - ColorPalette[i] = getRGB555(BitConverter.ToUInt16(ColorData, i * 2)); + ColorPalette[i] = getRGB555_16(BitConverter.ToUInt16(ColorData, i * 2)); Tiles = new Tile[0xFF]; for (int i = 0; i < 0xFF; i++) @@ -145,7 +145,7 @@ namespace PKHeX for (int i = 0; i < data.Length; i += bpp) { uint val = BitConverter.ToUInt32(data, i); - colors[i/bpp] = getRGB555(val); + colors[i/bpp] = getRGB555_32(val); } Color[] Palette = colors.Distinct().ToArray(); @@ -328,13 +328,20 @@ namespace PKHeX while (colorval > Convert5To8[i]) i++; return i; } - private static Color getRGB555(uint val) + private static Color getRGB555_32(uint val) { int R = (int)(val >> 0 >> 3) & 0x1F; int G = (int)(val >> 8 >> 3) & 0x1F; int B = (int)(val >> 16 >> 3) & 0x1F; return Color.FromArgb(0xFF, Convert5To8[R], Convert5To8[G], Convert5To8[B]); } + private static Color getRGB555_16(ushort val) + { + int R = (val >> 0) & 0x1F; + int G = (val >> 5) & 0x1F; + int B = (val >> 10) & 0x1F; + return Color.FromArgb(0xFF, Convert5To8[R], Convert5To8[G], Convert5To8[B]); + } private static ushort getRGB555(Color c) { int val = 0;