Skip to content

Commit

Permalink
New features, improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenGDK committed Jun 19, 2024
1 parent 6def37b commit 9d95cb0
Show file tree
Hide file tree
Showing 62 changed files with 4,971 additions and 1,168 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
bin/
*.suo
*.user
.vs
bin
obj
packages
8 changes: 4 additions & 4 deletions PSX XMB Manager/Application.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PSX_XMB_Manager"
StartupUri="NewMainWindow.xaml">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PSX_XMB_Manager"
StartupUri="NewMainWindow.xaml">
<Application.Resources>

</Application.Resources>
Expand Down
File renamed without changes.
42 changes: 42 additions & 0 deletions PSX XMB Manager/Classes/ImageUtils.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Imports System.Drawing
Imports System.Drawing.Imaging

Imports MColor = System.Windows.Media.Color
Imports DColor = System.Drawing.Color

Public Class ImageUtils

Private Shared Function CalcColorSwap(_base As Byte, _new As Byte) As Single
Return (_new - CInt(_base)) / 255.0!
End Function

Public Shared Function RecolorImage(inBMP As Bitmap, baseColor As MColor, newColor As MColor) As Bitmap
Dim NewBitmap As New Bitmap(inBMP.Width, inBMP.Height)
Dim ColorTransformation As New ColorMatrix(New Single()() {
New Single() {1, 0, 0, 0, 0},
New Single() {0, 1, 0, 0, 0},
New Single() {0, 0, 1, 0, 0},
New Single() {0, 0, 0, 1, 0},
New Single() {CalcColorSwap(baseColor.R, newColor.R), CalcColorSwap(baseColor.G, newColor.G), CalcColorSwap(baseColor.B, newColor.B), 0, 1}
})

Dim NewImageAttributes As New ImageAttributes()
NewImageAttributes.SetColorMatrix(ColorTransformation)

Using NewGraphics As Graphics = Graphics.FromImage(NewBitmap)
NewGraphics.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
NewGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
NewGraphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
NewGraphics.DrawImage(inBMP, New Rectangle(0, 0, inBMP.Width, inBMP.Height), 0, 0, inBMP.Width, inBMP.Height, GraphicsUnit.Pixel, NewImageAttributes)
End Using

Return NewBitmap
End Function

'Converts System.Drawing.Color -> System.Windows.Media.Color
Public Shared Function ToMediaColor(color As DColor) As MColor
Return MColor.FromArgb(color.A, color.R, color.G, color.B)
End Function

End Class

146 changes: 146 additions & 0 deletions PSX XMB Manager/Classes/PS1Game.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
Public Class PS1Game

Private _GameTitle As String
Private _GameID As String
Private _GameSize As String
Private _GameRegion As String
Private _GameFilePath As String
Private _GameFolderPath As String
Private _GameCoverSource As ImageSource
Private _GameGenre As String
Private _GameDescription As String
Private _GameReleaseDate As String
Private _GamePublisher As String
Private _GameDeveloper As String

Public Property GameTitle As String
Get
Return _GameTitle
End Get
Set
_GameTitle = Value
End Set
End Property

Public Property GameID As String
Get
Return _GameID
End Get
Set
_GameID = Value
End Set
End Property

Public Property GameSize As String
Get
Return _GameSize
End Get
Set
_GameSize = Value
End Set
End Property

Public Property GameRegion As String
Get
Return _GameRegion
End Get
Set
_GameRegion = Value
End Set
End Property

Public Property GameFilePath As String
Get
Return _GameFilePath
End Get
Set
_GameFilePath = Value
End Set
End Property

Public Property GameFolderPath As String
Get
Return _GameFolderPath
End Get
Set
_GameFolderPath = Value
End Set
End Property

Public Property GameCoverSource As ImageSource
Get
Return _GameCoverSource
End Get
Set
_GameCoverSource = Value
End Set
End Property

Public Property GameGenre As String
Get
Return _GameGenre
End Get
Set
_GameGenre = Value
End Set
End Property

Public Property GameDeveloper As String
Get
Return _GameDeveloper
End Get
Set
_GameDeveloper = Value
End Set
End Property

Public Property GamePublisher As String
Get
Return _GamePublisher
End Get
Set
_GamePublisher = Value
End Set
End Property

Public Property GameReleaseDate As String
Get
Return _GameReleaseDate
End Get
Set
_GameReleaseDate = Value
End Set
End Property

Public Property GameDescription As String
Get
Return _GameDescription
End Get
Set
_GameDescription = Value
End Set
End Property

Public Shared Function GetRegionChar(GameID As String) As String
If GameID.StartsWith("SLES", StringComparison.OrdinalIgnoreCase) Then
Return "P"
ElseIf GameID.StartsWith("SCES", StringComparison.OrdinalIgnoreCase) Then
Return "P"
ElseIf GameID.StartsWith("SLUS", StringComparison.OrdinalIgnoreCase) Then
Return "U"
ElseIf GameID.StartsWith("SCUS", StringComparison.OrdinalIgnoreCase) Then
Return "U"
ElseIf GameID.StartsWith("SLPS", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SLPM", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SCCS", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SLKA", StringComparison.OrdinalIgnoreCase) Then
Return "J"
Else
Return ""
End If
End Function

End Class
24 changes: 24 additions & 0 deletions PSX XMB Manager/PS2Game.vb → PSX XMB Manager/Classes/PS2Game.vb
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,28 @@
End Set
End Property

Public Shared Function GetGameRegionByGameID(GameID As String) As String
If GameID.StartsWith("SLES", StringComparison.OrdinalIgnoreCase) Then
Return "E"
ElseIf GameID.StartsWith("SCES", StringComparison.OrdinalIgnoreCase) Then
Return "E"
ElseIf GameID.StartsWith("SLUS", StringComparison.OrdinalIgnoreCase) Then
Return "U"
ElseIf GameID.StartsWith("SCUS", StringComparison.OrdinalIgnoreCase) Then
Return "U"
ElseIf GameID.StartsWith("SCPS", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SLPS", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SLPM", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SCCS", StringComparison.OrdinalIgnoreCase) Then
Return "J"
ElseIf GameID.StartsWith("SLKA", StringComparison.OrdinalIgnoreCase) Then
Return "J"
Else
Return ""
End If
End Function

End Class
53 changes: 53 additions & 0 deletions PSX XMB Manager/Structs.vb → PSX XMB Manager/Classes/Structs.vb
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,57 @@

End Structure

Public Enum AssetType
Audio
DIC
Font
Image
Video
XML
End Enum

Public Structure AssetListViewItem
Private _AssetFileName As String
Private _AssetFilePath As String
Private _Type As AssetType
Private _Icon As ImageSource

Public Property AssetFileName As String
Get
Return _AssetFileName
End Get
Set
_AssetFileName = Value
End Set
End Property

Public Property AssetFilePath As String
Get
Return _AssetFilePath
End Get
Set
_AssetFilePath = Value
End Set
End Property

Public Property Type As AssetType
Get
Return _Type
End Get
Set
_Type = Value
End Set
End Property

Public Property Icon As ImageSource
Get
Return _Icon
End Get
Set
_Icon = Value
End Set
End Property

End Structure

End Class
82 changes: 82 additions & 0 deletions PSX XMB Manager/Classes/Translations.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Public Class Translations

Public Class TranslationRequest
Private _q As String
Private _source As String
Private _target As String

Public Property q As String
Get
Return _q
End Get
Set
_q = Value
End Set
End Property

Public Property source As String
Get
Return _source
End Get
Set
_source = Value
End Set
End Property

Public Property target As String
Get
Return _target
End Get
Set
_target = Value
End Set
End Property
End Class

Public Class DetectedLanguage
Private _confidence As Double
Private _language As String

Public Property confidence As Double
Get
Return _confidence
End Get
Set
_confidence = Value
End Set
End Property

Public Property language As String
Get
Return _language
End Get
Set
_language = Value
End Set
End Property
End Class

Public Class ReceivedTranslation
Private _translatedText As String
Private _detectedLanguage As DetectedLanguage

Public Property detectedLanguage As DetectedLanguage
Get
Return _detectedLanguage
End Get
Set
_detectedLanguage = Value
End Set
End Property

Public Property translatedText As String
Get
Return _translatedText
End Get
Set
_translatedText = Value
End Set
End Property
End Class

End Class
Loading

0 comments on commit 9d95cb0

Please sign in to comment.