File tree 1 file changed +43
-0
lines changed
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ _ "embed"
5
+ "strings"
6
+
7
+ "gopkg.in/ini.v1"
8
+ )
9
+
10
+ //go:embed "data/mupen64plus.ini"
11
+ var romdb []byte
12
+
13
+ type RomDBGame struct {
14
+ Name string
15
+ CRC string
16
+ Mempak bool
17
+ Rumble bool
18
+ SaveType string
19
+ }
20
+
21
+ func romdb_search (rommd5 string ) RomDBGame {
22
+ cfg , err := ini .Load (romdb )
23
+ if err != nil {
24
+ panic (err )
25
+ }
26
+
27
+ game := RomDBGame {}
28
+
29
+ sec := cfg .Section (strings .ToUpper (rommd5 ))
30
+ game .Name = sec .Key ("GoodName" ).String ()
31
+ game .CRC = sec .Key ("CRC" ).String ()
32
+
33
+ refmd5 := sec .Key ("RefMD5" ).String ()
34
+ if refmd5 != "" {
35
+ sec = cfg .Section (refmd5 )
36
+ }
37
+
38
+ game .Mempak , _ = sec .Key ("Mempak" ).Bool ()
39
+ game .Rumble , _ = sec .Key ("Rumble" ).Bool ()
40
+ game .SaveType = sec .Key ("SaveType" ).String ()
41
+
42
+ return game
43
+ }
You can’t perform that action at this time.
0 commit comments