Remove Ignored Files & Speed Up Image import

Speed image import and some other imports up by improving the free space four aligned search.
This commit is contained in:
Dreuu 2019-01-16 21:24:46 -05:00
parent 93988a1330
commit 8a3527731e
24 changed files with 2830 additions and 268 deletions

253
.gitignore vendored
View File

@ -1,3 +1,6 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
*.ide
*.ide-wal
*.ide-shm
@ -5,3 +8,253 @@
*.application
*.manifest
*.Cache
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml

Binary file not shown.

View File

@ -32,7 +32,7 @@ Public Class BattleFrontierEditor
Else
MsgBox("This ROM is not supported!!!")
End
Me.Close()
End If
End Sub

View File

@ -880,10 +880,12 @@ ErrorHandle:
If Not individualPalettes Then
fs.Position = pOffset
Else
fs.Position = pTableOffset
pOffset = r.ReadInt32 - &H8000000
fs.Position = pOffset
End If
r.Read(Temp, 0, &HFFF)

View File

@ -892,8 +892,6 @@ Module ImportDataFunctions
Public Sub ImportPokemonIconNewOffset(filename As String, PokemonIndex As Integer)
Dim iconpals(2)() As Color
Dim importimg As New Bitmap(filename)
@ -914,21 +912,48 @@ Module ImportDataFunctions
Dim ImgBytes As Byte()
Dim ImgString As String
Dim individualPalettes As Boolean = False
Try
pOffset = Int32.Parse(GetString(GetINIFileLocation(), header, "IconPointerTable2", ""), System.Globalization.NumberStyles.HexNumber)
individualPalettes = True
Catch
End Try
Dim iconpals(Pokemonedit.IconPalCount - 1)() As Color
Using fs As New FileStream(LoadedROM, FileMode.Open, FileAccess.Read)
Using r As New BinaryReader(fs)
fs.Position = sOffset
sOffset = r.ReadInt32 - &H8000000
fs.Position = pOffset
Dim indexvar As Integer = 0
Do
iconpals(indexvar) = LoadPaletteFromROM(fs)
indexvar += 1
Loop While (indexvar <= 2)
If Not individualPalettes Then
fs.Position = sOffset
sOffset = r.ReadInt32 - &H8000000
fs.Position = pOffset
Do
iconpals(indexvar) = LoadPaletteFromROM(fs)
indexvar += 1
Loop While (indexvar <= 2)
Else
Dim pTable As Integer = pOffset
Do
fs.Position = pTable + (8 * indexvar)
pOffset = r.ReadInt32 - &H8000000
fs.Position = pOffset
iconpals(indexvar) = LoadPaletteFromROM(fs)
indexvar += 1
Loop While (indexvar <= Pokemonedit.IconPalCount - 1)
End If
fs.Close()
r.Close()

File diff suppressed because one or more lines are too long

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="HoverInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>603, 17</value>
</metadata>
<metadata name="fileOpenDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
@ -126,6 +129,80 @@
<metadata name="FolderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>405, 17</value>
</metadata>
<metadata name="HoverInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>603, 17</value>
</metadata>
<metadata name="HoverInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>603, 17</value>
</metadata>
<data name="Button14.ToolTip" xml:space="preserve">
<value>Import All Pokemon:
Select a folder containing Pokemon ini files
to import. Files in the folder will be selected for
a Pokemon based on their filename.
Ex: '1.ini' or '1 ~other text~.ini' will be imported
to Pokemon 1.</value>
</data>
<data name="Button28.ToolTip" xml:space="preserve">
<value>Import All Icons:
Choose a folder and import
an icon for each Pokemon.
The filename of each image must
start with the index number of the
Pokemon it will be imported to.
The image will be imported at the
offset of the old icon.
</value>
</data>
<data name="Button39.ToolTip" xml:space="preserve">
<value>Import All Cries:
Choose a folder and import
cries for all Pokemon from .wav
files.
The filename for each cry must
start with the index number of
the Pokemon it corresponds to.
To compress all cries on import,
check the 'Compressed' box
above the import button in the
'Cry Data' tab.</value>
</data>
<data name="Button41.ToolTip" xml:space="preserve">
<value>Import All Icons and Repoint:
Choose a folder and import
an icon for each Pokemon.
The filename of each image must
start with the index number of the
Pokemon it will be imported to.
The image will be imported to
free space and the icon will be
repointed.</value>
</data>
<data name="CheckBox1.ToolTip" xml:space="preserve">
<value>When sprite sheets, sprite palettes,
Pokedex entries, and level up attack lists
are imported, they will be compared to
previous imports from this session. If the
data has already been imported, the data
will be repointed to the previous import,
instead of importing it again.
Imported data is only stored for the time that
this window stays open. Closing and
reopening this window will clear all
'remembered' data.</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>48</value>
</metadata>

View File

@ -15,7 +15,6 @@ Public Class Pokemonedit
Dim AnimationPointers As Integer
Dim IconPointers As Integer
Dim IconPalTable As Integer
Dim IconPalCount As Integer
Dim EvoData As Integer
Dim TMHMAttacks As Integer
Dim TMHMCompoLoc As Integer
@ -37,6 +36,9 @@ Public Class Pokemonedit
Dim Tab5LoadedMon As Integer
Dim Tab6LoadedMon As Integer
Public Shared IconPalCount As Integer
Public Shared PicStrings As List(Of String)
Public Shared PicOffsets As List(Of String)
Public Shared PalStrings As List(Of String)
@ -978,7 +980,7 @@ Public Class Pokemonedit
TextBox6.Enabled = False
EvoTypes.SelectedIndex = Int32.Parse(((ReverseHEX(ReadHEX(LoadedROM, (EvoData) + (8 * (GetString(GetINIFileLocation(), header, "NumberOfEvolutionsPerPokemon", ""))) + ((PKMNames.SelectedIndex) * (8 * (GetString(GetINIFileLocation(), header, "NumberOfEvolutionsPerPokemon", "")))) + (EvoSlots.SelectedIndex * 8), 2)))), System.Globalization.NumberStyles.HexNumber)
EvoTypes.SelectedIndex = Int32.Parse(((ReverseHEX(ReadHEX(LoadedROM, (EvoData) + ((PKMNames.SelectedIndex + 1) * (8 * (GetString(GetINIFileLocation(), header, "NumberOfEvolutionsPerPokemon", "")))) + (EvoSlots.SelectedIndex * 8), 2)))), System.Globalization.NumberStyles.HexNumber)
'This will enable the right stuff
@ -1719,26 +1721,30 @@ Public Class Pokemonedit
End If
Dim LoopVar As Integer
Dim oldIndex As Integer = PKMNames.SelectedIndex
LoopVar = 0
'TabControl1.SelectedTab = TabPage2
Me.Enabled = False
While LoopVar < (GetString(GetINIFileLocation(), header, "NumberOfPokemon", "")) - 1 = True
' PKMNames.SelectedIndex = LoopVar
'PKMNames.SelectedIndex = LoopVar
'TabChanged()
LoopVar = LoopVar + 1
ExportPokemonINI(FolderBrowserDialog.SelectedPath & "\Pokemon\" & LoopVar & ".ini", LoopVar)
ProgressBar.Value = (LoopVar / (GetString(GetINIFileLocation(), header, "NumberOfPokemon", ""))) * 100
QuickRefresh(ProgressBar)
DoEvents()
End While
Me.Text = "Pokemon Editor"
Me.UseWaitCursor = False
PKMNames.SelectedIndex = oldIndex
Me.Enabled = True
ProgressBar.Visible = False
Me.BringToFront()
@ -2443,18 +2449,19 @@ Public Class Pokemonedit
ProgressBar.Visible = True
Dim LoopVar As Integer
Dim oldIndex As Integer = PKMNames.SelectedIndex
LoopVar = 0
'TabControl1.SelectedTab = TabPage2
Me.Enabled = False
While LoopVar < (GetString(GetINIFileLocation(), header, "NumberOfPokemon", "")) - 1 = True
'PKMNames.SelectedIndex = LoopVar
'TabChanged()
LoopVar = LoopVar + 1
If System.IO.File.Exists(FolderBrowserDialog.SelectedPath & "\" & LoopVar & ".ini") Then
ImportPokemonINI(FolderBrowserDialog.SelectedPath & "\" & LoopVar & ".ini", LoopVar)
End If
@ -2462,6 +2469,7 @@ Public Class Pokemonedit
ProgressBar.Value = (LoopVar / (GetString(GetINIFileLocation(), header, "NumberOfPokemon", ""))) * 100
QuickRefresh(ProgressBar)
DoEvents()
End While
LoopVar = 0
@ -2484,6 +2492,7 @@ Public Class Pokemonedit
Me.Text = "Pokemon Editor"
Me.UseWaitCursor = False
PKMNames.SelectedIndex = oldIndex
Me.Enabled = True
ProgressBar.Visible = False
Me.BringToFront()
@ -3476,6 +3485,7 @@ Public Class Pokemonedit
ImportPokemonIcon(fileOpenDialog.FileName, PKMNames.SelectedIndex + 1)
i = PKMNames.SelectedIndex
IconPointers = Int32.Parse((GetString(GetINIFileLocation(), header, "IconPointerTable", "")), System.Globalization.NumberStyles.HexNumber)
@ -3618,24 +3628,30 @@ Public Class Pokemonedit
End If
Dim LoopVar As Integer
Dim oldIndex As Integer = PKMNames.SelectedIndex
LoopVar = 0
'TabControl1.SelectedTab = TabPage1
Me.Enabled = False
While LoopVar < (GetString(GetINIFileLocation(), header, "NumberOfPokemon", "")) - 1 = True
' PKMNames.SelectedIndex = LoopVar
'PKMNames.SelectedIndex = LoopVar
'TabChanged()
LoopVar = LoopVar + 1
ExportAseriesSheet(FolderBrowserDialog.SelectedPath & "\Sprites\" & LoopVar & ".png", LoopVar)
ProgressBar.Value = (LoopVar / (GetString(GetINIFileLocation(), header, "NumberOfPokemon", ""))) * 100
QuickRefresh(ProgressBar)
DoEvents()
End While
Me.Text = "Pokemon Editor"
Me.UseWaitCursor = False
PKMNames.SelectedIndex = oldIndex
Me.Enabled = True
ProgressBar.Visible = False
Me.BringToFront()
@ -3652,18 +3668,19 @@ Public Class Pokemonedit
ProgressBar.Visible = True
Dim LoopVar As Integer
Dim oldIndex As Integer = PKMNames.SelectedIndex
LoopVar = 0
'TabControl1.SelectedTab = TabPage1
Me.Enabled = False
While LoopVar < (GetString(GetINIFileLocation(), header, "NumberOfPokemon", "")) - 1 = True
'PKMNames.SelectedIndex = LoopVar
'TabChanged()
LoopVar = LoopVar + 1
If System.IO.File.Exists(FolderBrowserDialog.SelectedPath & "\" & LoopVar & ".png") Then
ImportAseriesSheet(FolderBrowserDialog.SelectedPath & "\" & LoopVar & ".png", LoopVar)
ElseIf System.IO.File.Exists(FolderBrowserDialog.SelectedPath & "\" & VB.Right("000" & LoopVar, 3) & ".png") Then
@ -3673,6 +3690,7 @@ Public Class Pokemonedit
ProgressBar.Value = (LoopVar / (GetString(GetINIFileLocation(), header, "NumberOfPokemon", ""))) * 100
QuickRefresh(ProgressBar)
DoEvents()
End While
PKMNames.SelectedIndex = 1
@ -3680,6 +3698,7 @@ Public Class Pokemonedit
Me.Text = "Pokemon Editor"
Me.UseWaitCursor = False
PKMNames.SelectedIndex = oldIndex
Me.Enabled = True
ProgressBar.Visible = False
Me.BringToFront()
@ -4475,6 +4494,7 @@ Public Class Pokemonedit
ImportPokemonIconNewOffset(fileOpenDialog.FileName, PKMNames.SelectedIndex + 1)
i = PKMNames.SelectedIndex
TabChanged()
IconPointers = Int32.Parse((GetString(GetINIFileLocation(), header, "IconPointerTable", "")), System.Globalization.NumberStyles.HexNumber)
IconPalTable = Int32.Parse((GetString(GetINIFileLocation(), header, "IconPalTable", "")), System.Globalization.NumberStyles.HexNumber)
@ -4538,7 +4558,4 @@ Public Class Pokemonedit
MenuItem.Update()
End Sub
Private Sub chkCompressed1_CheckedChanged(sender As Object, e As EventArgs) Handles chkCompressed1.CheckedChanged
End Sub
End Class

View File

@ -16,7 +16,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>uFG9UyHFT13g3GzXLA4C8EN70Cg0jtMnZ2It27IfpR8=</dsig:DigestValue>
<dsig:DigestValue>ehVhr8b6SNFpvx4SOnc/tZuedgPlUQT8cN54mrdAMuA=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2117120">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2122240">
<assemblyIdentity name="PokemonGameEditor" version="3.8.1.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>VippOqsNNYyZ4j4Q25AvUhut3hlhz8X5p98jODWx8+I=</dsig:DigestValue>
<dsig:DigestValue>wJQjHctEQDskqPzinLBkLYbqhqq6ZXisVLyptagCu1I=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

File diff suppressed because it is too large Load Diff

View File

@ -149,7 +149,7 @@ Module modSearchFreeSpace
' MsgBox(CInt("&H" & CurSearchOffset) + CInt(SearchIncrement))
CurSearchOffset = Hex(FindFreeSpace(FileName, FreeSpaceByte, NeededBytes, CInt("&H" & CurSearchOffset) + CInt(SearchIncrement)))
CurSearchOffset = Hex(FindFreeSpace(FileName, FreeSpaceByte, NeededBytes, CInt("&H" & CurSearchOffset) + CInt(SearchIncrement), True))
SearchIncrement = SearchIncrement + 1
@ -159,7 +159,7 @@ Module modSearchFreeSpace
End Function
Private Function FindFreeSpace(selectedROMPath As String, freeSpaceByte As Byte, dataSize As Integer, startLocation As Integer) As Integer
Private Function FindFreeSpace(selectedROMPath As String, freeSpaceByte As Byte, dataSize As Integer, startLocation As Integer, Optional alignFour As Boolean = False) As Integer
Dim rom As Byte() = File.ReadAllBytes(selectedROMPath)
@ -168,6 +168,7 @@ Module modSearchFreeSpace
For i As Integer = 0 To dataSize
If startLocation + dataSize <= rom.Length Then
If rom(startLocation + i) <> freeSpaceByte Then
startLocation += i + 1
Exit For
ElseIf i = dataSize Then
spaceFound = True
@ -181,7 +182,9 @@ Module modSearchFreeSpace
End If
Next
If Not spaceFound Then
startLocation += 1
If alignFour Then
startLocation += 4 - (startLocation Mod 4)
End If
End If
End While
Return startLocation

View File

@ -16,7 +16,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>uFG9UyHFT13g3GzXLA4C8EN70Cg0jtMnZ2It27IfpR8=</dsig:DigestValue>
<dsig:DigestValue>ehVhr8b6SNFpvx4SOnc/tZuedgPlUQT8cN54mrdAMuA=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2117120">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="PokemonGameEditor.exe" size="2122240">
<assemblyIdentity name="PokemonGameEditor" version="3.8.1.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>VippOqsNNYyZ4j4Q25AvUhut3hlhz8X5p98jODWx8+I=</dsig:DigestValue>
<dsig:DigestValue>wJQjHctEQDskqPzinLBkLYbqhqq6ZXisVLyptagCu1I=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>