Fix UIC processing logic (#885)

* Fix UIC title field

* the sabre approved way

* Better UIC test_disc.txt

* Fix UIC category logic

* Fix GetUMDCategoryTest

* Final test tweak
This commit is contained in:
Deterous
2025-09-04 21:27:13 +09:00
committed by GitHub
parent b76b2a69f5
commit 102acb9ebf
7 changed files with 33 additions and 21 deletions

View File

@@ -20,6 +20,7 @@
- Update RedumpLib to 1.7.1
- Support multisession cache files
- Update DIC to 20250901 (Windows/Linux only)
- Fix UIC processing logic
### 3.3.3 (2025-07-18)

View File

@@ -471,12 +471,9 @@ namespace MPF.Processors.Test
[Theory]
[InlineData(null, null)]
[InlineData("", null)]
[InlineData("GAME", DiscCategory.Games)]
[InlineData("game", DiscCategory.Games)]
[InlineData("VIDEO", DiscCategory.Video)]
[InlineData("video", DiscCategory.Video)]
[InlineData("AUDIO", DiscCategory.Audio)]
[InlineData("audio", DiscCategory.Audio)]
[InlineData("(GAME)", DiscCategory.Games)]
[InlineData("(VIDEO)", DiscCategory.Video)]
[InlineData("(AUDIO)", DiscCategory.Audio)]
[InlineData("INVALID", null)]
public void GetUMDCategoryTest(string? category, DiscCategory? expected)
{

View File

@@ -1,7 +1,21 @@
<< GetUMDAuxInfo >>
TITLE title
DISC_ID serial
DISC_VERSION version
pspUmdTypes GAME
L0 length 12345
FileSize: 12345
disc0:/PSP_GAME/PARAM.SFO
magic: PSF
version: 1.01
BOOTABLE: 1
CATEGORY: UG
DISC_ID: ABCD12345
DISC_NUMBER: 1
DISC_TOTAL: 1
DISC_VERSION: 1.01
PARENTAL_LEVEL: 1
PSP_SYSTEM_VER: 1.00
REGION: 32768
TITLE: title
pspUmdTypes: 0x10 (GAME)
L0 length: 442560 (0x6c0c0)
L1 length: 276096 (0x43680)
---------------------------
Total: 718656 (0xaf740)
FileSize: 1471807488 (0x57ba0000)

View File

@@ -291,10 +291,10 @@ namespace MPF.Processors.Test
{
string? expectedTitle = "title";
DiscCategory? expectedCategory = DiscCategory.Games;
string? expectedSerial = "seri-al";
string? expectedVersion = "version";
string? expectedLayer = "12345";
long expectedSize = 12345;
string? expectedSerial = "ABCD-12345";
string? expectedVersion = "1.01";
string? expectedLayer = "442560";
long expectedSize = 1471807488;
string disc = Path.Combine(Environment.CurrentDirectory, "TestData", "UmdImageCreator", "UMD", "test_disc.txt");
bool actual = UmdImageCreator.GetUMDAuxInfo(disc,

View File

@@ -375,9 +375,9 @@ namespace MPF.Processors
{
return category?.ToLowerInvariant() switch
{
"game" => DiscCategory.Games,
"video" => DiscCategory.Video,
"audio" => DiscCategory.Audio,
"(game)" => DiscCategory.Games,
"(video)" => DiscCategory.Video,
"(audio)" => DiscCategory.Audio,
_ => null,
};
}

View File

@@ -184,13 +184,13 @@ namespace MPF.Processors
break;
if (line.StartsWith("TITLE") && title == null)
title = line.Split(' ')[1];
title = line.Substring("TITLE: ".Length);
else if (line.StartsWith("DISC_ID") && version == null)
serial = line.Split(' ')[1];
else if (line.StartsWith("DISC_VERSION") && version == null)
version = line.Split(' ')[1];
else if (line.StartsWith("pspUmdTypes"))
category = ProcessingTool.GetUMDCategory(line.Split(' ')[1]);
category = ProcessingTool.GetUMDCategory(line.Split(' ')[2]);
else if (line.StartsWith("L0 length"))
layer = line.Split(' ')[2];
else if (line.StartsWith("FileSize:"))