changed normalized form of games ids

opl seems to work mostly with this format
This commit is contained in:
2026-01-05 16:08:39 +01:00
parent 1d766a843e
commit bbd765bccb
2 changed files with 16 additions and 16 deletions

View File

@@ -53,9 +53,9 @@ func normalizeGameID(id string) string {
}
prefix := strings.ToUpper(matches[1])
number := matches[2] + matches[3]
number := matches[2] + "." + matches[3]
return prefix + "-" + number
return prefix + "_" + number
}
func renameGameFile(filePath, gameName string) (string, error) {

View File

@@ -12,37 +12,37 @@ func TestParseCases(t *testing.T) {
{
name: "SLUS with underscore and dot",
content: []byte("Some binary data\x00\x00SLUS_123.45\x00\x00more data"),
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
name: "SLUS with hyphen",
content: []byte("\x00\x00\x00SLUS-12345\x00\x00\x00"),
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
name: "SLES format",
content: []byte("Header data\x00SLES_987.65\x00footer"),
expected: "SLES-98765",
expected: "SLES_987.65",
},
{
name: "SLPS format",
content: []byte("\xFF\xFESLPS_456.78\x00"),
expected: "SLPS-45678",
expected: "SLPS_456.78",
},
{
name: "SCUS format",
content: []byte("SCUS-97512"),
expected: "SCUS-97512",
expected: "SCUS_975.12",
},
{
name: "No separator format",
content: []byte("\x00\x00SLUS12345\x00\x00"),
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
name: "With spaces",
content: []byte("SLUS 123.45"),
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
name: "No game ID found",
@@ -82,31 +82,31 @@ func TestNormalize(t *testing.T) {
}{
{
input: "SLUS-12345",
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
input: "SLES_987.65",
expected: "SLES-98765",
expected: "SLES_987.65",
},
{
input: "SLPS_456.78",
expected: "SLPS-45678",
expected: "SLPS_456.78",
},
{
input: "scus-97512",
expected: "SCUS-97512",
expected: "SCUS_975.12",
},
{
input: "SLUS12345",
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
input: "SLUS123.45",
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
{
input: "SLUs123.45",
expected: "SLUS-12345",
expected: "SLUS_123.45",
},
}