Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions constants/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ var TouchGenIDs = []string{
"RFN", "RFP", "R64", "RYW",
}

var PaynPlayIDs = []string{
"WFC", "R3B", "WR9", "WRX", "SJD", "SD2", "SJX",
"SJO", "SE3", "SZA", "SZB", "R9J", "SXE", "SXI", "R36",
"SXA", "SWA", "SWB", "SXF", "R9O", "SUS", "SU3", "R83",

}
var DevAppIDs = []string{
"007E", "091E", "410E", "413E", "5NEA", "RAAE",
}
Expand Down
232 changes: 232 additions & 0 deletions constants/rating_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,238 @@ var (
//go:embed ratings/cero/Z.jpg
CEROZ []byte

//go:embed ratings/esrb/descriptors/alcohol_reference.jpg
ESRBAlcoholReference []byte

//go:embed ratings/esrb/descriptors/animated_blood.jpg
ESRBAnimatedBlood []byte

//go:embed ratings/esrb/descriptors/animated_violence.jpg
ESRBAnimatedViolence []byte

//go:embed ratings/esrb/descriptors/blood_and_gore.jpg
ESRBBloodandGore []byte

//go:embed ratings/esrb/descriptors/blood.jpg
ESRBBlood []byte

//go:embed ratings/esrb/descriptors/cartoon_violence.jpg
ESRBCartoonViolence []byte

//go:embed ratings/esrb/descriptors/comic_mischief.jpg
ESRBComicMischief []byte

//go:embed ratings/esrb/descriptors/crude_humor.jpg
ESRBCrudeHumor []byte

//go:embed ratings/esrb/descriptors/drug_reference.jpg
ESRBDrugReference []byte

//go:embed ratings/esrb/descriptors/edutainment.jpg
ESRBEdutainment []byte

//go:embed ratings/esrb/descriptors/fantasy_violence.jpg
ESRBFantasyViolence []byte

//go:embed ratings/esrb/descriptors/intense_violence.jpg
ESRBIntenseViolence []byte

//go:embed ratings/esrb/descriptors/language.jpg
ESRBLanguage []byte

//go:embed ratings/esrb/descriptors/lyrics.jpg
ESRBLyrics []byte

//go:embed ratings/esrb/descriptors/mature_humor.jpg
ESRBMatureHumor []byte

//go:embed ratings/esrb/descriptors/mild_animated_violence.jpg
ESRBMildAnimatedViolence []byte

//go:embed ratings/esrb/descriptors/mild_blood.jpg
ESRBMildBlood []byte

//go:embed ratings/esrb/descriptors/mild_cartoon_violence.jpg
ESRBMildCartoonViolence []byte

//go:embed ratings/esrb/descriptors/mild_fantasy_violence.jpg
ESRBMildFantasyViolence []byte

//go:embed ratings/esrb/descriptors/mild_language.jpg
ESRBMildLanguage []byte

//go:embed ratings/esrb/descriptors/mild_lyrics.jpg
ESRBMildLyrics []byte

//go:embed ratings/esrb/descriptors/mild_sexual_themes.jpg
ESRBMildSexualThemes []byte

//go:embed ratings/esrb/descriptors/mild_suggestive_themes.jpg
ESRBMildSuggestiveThemes []byte

//go:embed ratings/esrb/descriptors/mild_violence.jpg
ESRBMildViolence []byte

//go:embed ratings/esrb/descriptors/partial_nudity.jpg
ESRBPartialNudity []byte

//go:embed ratings/esrb/descriptors/sexual_content.jpg
ESRBSexualContent []byte

//go:embed ratings/esrb/descriptors/sexual_themes.jpg
ESRBSexualThemes []byte

//go:embed ratings/esrb/descriptors/simulated_gambling.jpg
ESRBSimulatedGambling []byte

//go:embed ratings/esrb/descriptors/some_adult_assistance_may_be_needed.jpg
ESRBSomeAdultAssistanceMayBeNeeded []byte

//go:embed ratings/esrb/descriptors/strong_language.jpg
ESRBStrongLanguage []byte

//go:embed ratings/esrb/descriptors/strong_lyrics.jpg
ESRBStrongLyrics []byte

//go:embed ratings/esrb/descriptors/strong_sexual_content.jpg
ESRBStrongSexualContent []byte

//go:embed ratings/esrb/descriptors/suggestive_themes.jpg
ESRBSuggestiveThemes []byte

//go:embed ratings/esrb/descriptors/tobacco_reference.jpg
ESRBTobaccoReference []byte

//go:embed ratings/esrb/descriptors/use_of_alcohol.jpg
ESRBUseofAlcohol []byte

//go:embed ratings/esrb/descriptors/use_of_drugs.jpg
ESRBUseofDrugs []byte

//go:embed ratings/esrb/descriptors/use_of_tobacco.jpg
ESRBUseofTobacco []byte

//go:embed ratings/esrb/descriptors/violence.jpg
ESRBViolence []byte

//go:embed ratings/esrb/descriptors/violent_references.jpg
ESRBViolentReferences []byte

ESRBDescriptors = map[string][]byte{
"alcohol reference": ESRBAlcoholReference,
"animated blood": ESRBAnimatedBlood,
"animated violence": ESRBAnimatedViolence,
"blood and gore": ESRBBloodandGore,
"blood": ESRBBlood,
"cartoon violence": ESRBCartoonViolence,
"comic mischief": ESRBComicMischief,
"crude humor": ESRBCrudeHumor,
"drug reference": ESRBDrugReference,
"edutainment": ESRBEdutainment,
"fantasy violence": ESRBFantasyViolence,
"intense violence": ESRBIntenseViolence,
"language": ESRBLanguage,
"lyrics": ESRBLyrics,
"mature humor": ESRBMatureHumor,
"mild animated violence": ESRBMildAnimatedViolence,
"mild blood": ESRBMildBlood,
"mild cartoon violence": ESRBMildCartoonViolence,
"mild fantasy violence": ESRBMildFantasyViolence,
"mild language": ESRBMildLanguage,
"mild lyrics": ESRBMildLyrics,
"mild sexual themes": ESRBMildSexualThemes,
"mild suggestive themes": ESRBMildSuggestiveThemes,
"mild violence": ESRBMildViolence,
"partial nudity": ESRBPartialNudity,
"sexual content": ESRBSexualContent,
"sexual themes": ESRBSexualThemes,
"simulated gambling": ESRBSimulatedGambling,
"some adult assistance may be needed": ESRBSomeAdultAssistanceMayBeNeeded,
"strong language": ESRBStrongLanguage,
"strong lyrics": ESRBStrongLyrics,
"strong sexual content": ESRBStrongSexualContent,
"suggestive themes": ESRBSuggestiveThemes,
"tobacco reference": ESRBTobaccoReference,
"use of alcohol": ESRBUseofAlcohol,
"use of drugs": ESRBUseofDrugs,
"use of tobacco": ESRBUseofTobacco,
"violence": ESRBViolence,
"violent references": ESRBViolentReferences,
}
//go:embed ratings/pegi/descriptors/discrimination.jpg
PEGIDiscrimination []byte

//go:embed ratings/pegi/descriptors/drugs.jpg
PEGIDrugs []byte

//go:embed ratings/pegi/descriptors/fear.jpg
PEGIFear []byte

//go:embed ratings/pegi/descriptors/gambling.jpg
PEGIGambling []byte

//go:embed ratings/pegi/descriptors/bad-language.jpg
PEGILanguage []byte

//go:embed ratings/pegi/descriptors/sexual-content.jpg
PEGISexualContent []byte

//go:embed ratings/pegi/descriptors/violence.jpg
PEGIViolence []byte

//go:embed ratings/pegi/descriptors/online.jpg
PEGIOnline []byte

PEGIDescriptors = map[string][]byte{
"discrimination": PEGIDiscrimination,
"drugs": PEGIDrugs,
"fear": PEGIFear,
"gambling": PEGIGambling,
"language": PEGILanguage,
"sex": PEGISexualContent,
"violence": PEGIViolence,
"online": PEGIOnline,
}

//go:embed ratings/cero/descriptors/crime.jpg
CEROCrime []byte

//go:embed ratings/cero/descriptors/drinkingandsmoking.jpg
CERODrinkingAndSmoking []byte

//go:embed ratings/cero/descriptors/drugs.jpg
CERODrugs []byte

//go:embed ratings/cero/descriptors/fright.jpg
CEROFright []byte

//go:embed ratings/cero/descriptors/gambling.jpg
CEROGambling []byte

//go:embed ratings/cero/descriptors/language.jpg
CEROLanguage []byte

//go:embed ratings/cero/descriptors/love.jpg
CEROLove []byte

//go:embed ratings/cero/descriptors/sex.jpg
CEROSex []byte

//go:embed ratings/cero/descriptors/violence.jpg
CEROViolence []byte

CERODescriptors = map[string][]byte{
"crime": CEROCrime,
"alcohol/tobacco": CERODrinkingAndSmoking,
"drugs": CERODrugs,
"horror": CEROFright,
"gambling": CEROGambling,
"language": CEROLanguage,
"love": CEROLove,
"sex": CEROSex,
"violence": CEROViolence,
}

Images = map[RatingGroup][][]byte{
CERO: {CEROA, CEROB, CEROC, CEROD, CEROZ},
ESRB: {ECImage, EImage, E10Image, TImage, MImage},
Expand Down
Binary file added constants/ratings/cero/descriptors/crime.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/drugs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/fright.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/gambling.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/language.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/love.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/sex.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/cero/descriptors/violence.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/esrb/descriptors/blood.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/esrb/descriptors/language.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/esrb/descriptors/lyrics.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added constants/ratings/esrb/descriptors/mild_blood.jpg
Binary file added constants/ratings/esrb/descriptors/violence.jpg
Binary file modified constants/ratings/pegi/12.jpg
Binary file modified constants/ratings/pegi/16.jpg
Binary file modified constants/ratings/pegi/18.jpg
Binary file modified constants/ratings/pegi/3.jpg
Binary file modified constants/ratings/pegi/7.jpg
Binary file added constants/ratings/pegi/descriptors/drugs.jpg
Binary file added constants/ratings/pegi/descriptors/fear.jpg
Binary file added constants/ratings/pegi/descriptors/gambling.jpg
Binary file added constants/ratings/pegi/descriptors/online.jpg
Binary file added constants/ratings/pegi/descriptors/violence.jpg
5 changes: 3 additions & 2 deletions gametdb/gametdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ type Date struct {
}

type Rating struct {
Type string `xml:"type,attr"`
Value string `xml:"value,attr"`
Type string `xml:"type,attr"`
Value string `xml:"value,attr"`
Descriptor []string `xml:"descriptor"`
}

type Controllers struct {
Expand Down
5 changes: 3 additions & 2 deletions v6/dllist/titles.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ func (l *List) GenerateTitleStruct(games *[]gametdb.Game, defaultTitleType const
}

i := info.Info{}
i.MakeHeader(titleID, game.Controllers.Players, companyID, table.TitleType, table.ReleaseYear, table.ReleaseMonth, table.ReleaseDay)
i.MakeHeader(id, titleID, game.Controllers.Players, companyID, table.TitleType, table.ReleaseYear, table.ReleaseMonth, table.ReleaseDay)
i.RatingID = table.RatingID
i.MakeInfo(id, &game, fullTitle, synopsis, l.region, l.language, defaultTitleType, recommendations)

i.MakeInfo(id, &game, fullTitle, synopsis, l.region, l.language, defaultTitleType, game.Rating.Descriptor, recommendations)
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions v6/info/controllers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package info

import (
"NintendoChannel/constants"
"NintendoChannel/gametdb"
"unicode/utf16"
)
Expand Down Expand Up @@ -49,4 +50,15 @@ func (i *Info) GetSupportedControllers(controllers *gametdb.Controllers) {
break
}
}
// The WiiTDB XML labels the "wiimote" as a required accessory, therefore, this confuses the generator into mislabeling
// certain VC titles as supporting a Wii Remote when they do not.
switch i.Header.TitleType {
case constants.SNES,
constants.Nintendo64,
constants.Genesis:
i.SupportedControllers.WiiRemote = 0
i.SupportedControllers.Nunchuk = 0
case constants.NES:
i.SupportedControllers.Nunchuk = 0
}
}
4 changes: 4 additions & 0 deletions v6/info/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func (i *Info) GetSupportedFeatures(game *gametdb.Game) {
}
}

if slices.Contains(constants.PaynPlayIDs, game.ID[:3]) {
i.SupportedFeatures.NintendoWifiConnection = 2
}

if game.Controllers.MultiCart > 1 {
i.SupportedFeatures.WirelessPlay = 1
}
Expand Down
4 changes: 2 additions & 2 deletions v6/info/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Header struct {
NumberOfPlayers uint8
}

func (i *Info) MakeHeader(gameID [4]byte, numberOfPlayers uint8, companyID uint32, titleType constants.TitleType, releaseYear uint16, releaseMonth, releaseDay uint8) {
func (i *Info) MakeHeader(softwareID uint32, gameID [4]byte, numberOfPlayers uint8, companyID uint32, titleType constants.TitleType, releaseYear uint16, releaseMonth, releaseDay uint8) {
i.Header = Header{
Version: 6,
Unknown: 2,
Expand All @@ -70,7 +70,7 @@ func (i *Info) MakeHeader(gameID [4]byte, numberOfPlayers uint8, companyID uint3
RatingPictureOffset: 0,
RatingPictureSize: 0,
DetailedRatingPictureTable: [7]DetailedRatingPictureTable{},
SoftwareID: 0,
SoftwareID: softwareID,
GameID: gameID,
TitleType: titleType,
CompanyID: companyID,
Expand Down
34 changes: 32 additions & 2 deletions v6/info/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
"bytes"
_ "embed"
"fmt"
"golang.org/x/image/draw"
"image"
"image/color"
"image/jpeg"
"image/png"
"net/http"
"os"

"golang.org/x/image/draw"
)

var regionToStr = map[constants.Region]string{
Expand Down Expand Up @@ -88,7 +89,7 @@ func (i *Info) WriteCoverArt(buffer *bytes.Buffer, titleType constants.TitleType
// Creates a blank white image which will then be layered by the cover
newImage := image.NewRGBA(image.Rect(0, 0, 384, 384))
draw.Draw(newImage, newImage.Bounds(), &image.Uniform{C: color.RGBA{R: 255, G: 255, B: 255, A: 255}}, image.Point{}, draw.Src)
draw.Draw(newImage, img.Bounds().Add(offset), img, image.Point{}, draw.Src)
draw.Draw(newImage, img.Bounds().Add(offset), img, image.Point{}, draw.Over)

err = jpeg.Encode(buffer, newImage, nil)
common.CheckError(err)
Expand Down Expand Up @@ -119,3 +120,32 @@ func resize(origImage image.Image, x, y int) image.Image {
draw.BiLinear.Scale(newImage, newImage.Bounds(), origImage, origImage.Bounds(), draw.Over, nil)
return newImage
}

func (i *Info) WriteRatingDescriptor(buffer *bytes.Buffer, region constants.Region, RatingDescriptors []string) {
// Cap
maxDescriptors := min(len(RatingDescriptors), 7)
for j := 0; j < maxDescriptors; j++ {
s := RatingDescriptors[j]

// Skip empty strings
if s == "" {
continue
}

// Find matching descriptor image
var descriptorImage []byte
switch region {
case constants.Japan:
descriptorImage = constants.CERODescriptors[s]
case constants.PAL:
descriptorImage = constants.PEGIDescriptors[s]
case constants.NTSC:
descriptorImage = constants.ESRBDescriptors[s]
}

// Set picture table entry
i.Header.DetailedRatingPictureTable[j].PictureOffset = i.GetCurrentSize(buffer)
buffer.Write(descriptorImage)
i.Header.DetailedRatingPictureTable[j].PictureSize = uint32(len(descriptorImage))
}
}
Loading