From d45fd7fdd2c257446a39f5c143155b76be98111d Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 3 Jun 2017 16:10:29 -0400 Subject: [PATCH 1/8] Added savefile and screenshot support. --- scripts/games/app.js | 66 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/scripts/games/app.js b/scripts/games/app.js index 3f97cfa..f021a3d 100644 --- a/scripts/games/app.js +++ b/scripts/games/app.js @@ -16,6 +16,8 @@ const inputDirectoryWiki = './citra-games-wiki.wiki'; const outputDirectoryMd = '../../site/content/game'; const outputDirectoryBoxart = '../../site/static/images/game/boxart'; const outputDirectoryIcons = '../../site/static/images/game/icons'; +const outputDirectoryScreenshots = '../../site/static/images/screenshots0'; +const outputDirectorySavefiles = '../../site/static/savefiles/'; // The URL function url(title) { @@ -25,9 +27,11 @@ function url(title) { function gitPull(directory, repository) { if (fs.existsSync(directory)) { logger.info(`Fetching latest from Github : ${directory}`); + logger.info(`git --git-dir=${directory} pull`); exec(`git --git-dir=${directory} pull`); } else { logger.info(`Cloning repository from Github : ${directory}`); + logger.info(`git clone ${repository}`); exec(`git clone ${repository}`); } } @@ -59,6 +63,16 @@ if (fs.existsSync(outputDirectoryIcons) == false) { fs.mkdirSync(outputDirectoryIcons); } +if (fs.existsSync(outputDirectorySavefiles) == false) { + logger.info(`Creating missing output directory: ${outputDirectorySavefiles}`); + fs.mkdirSync(outputDirectorySavefiles); +} + +if (fs.existsSync(outputDirectoryScreenshots) == false) { + logger.info(`Creating missing output directory: ${outputDirectoryScreenshots}`); + fs.mkdirSync(outputDirectoryScreenshots); +} + try { // Loop through each game folder. getDirectories(inputDirectoryGame).forEach(function(game) { @@ -77,10 +91,52 @@ try { if (fs.existsSync(iconPath)) { fsextra.copySync(iconPath, `${outputDirectoryIcons}/${game}.png`); } + + // Copy the savefiles for the game. + let inputDirectorySavefilesGame = `${inputDirectoryGame}/${game}/savefiles/`; + let outputDirectorySavefilesGame = `${outputDirectorySavefiles}/${game}/`; + let savefileMetadataContents = []; + + if (fs.existsSync(inputDirectorySavefilesGame)) { + // Create the savefile directory for each game. + if (fs.existsSync(outputDirectorySavefilesGame) == false) { + fs.mkdirSync(outputDirectorySavefilesGame); + } + + // Copy all savefiles into the output folder and store their contents. + fs.readdirSync(inputDirectorySavefilesGame).forEach(file => { + if (file.slice(-5) == '.csav') { + fsextra.copySync(`${inputDirectorySavefilesGame}/${file}`, `${outputDirectorySavefilesGame}/${file}`); + } else if (file.slice(-4) == '.dat') { + // Store the contents of the file in memory for adding it into the markdown later. + savefileMetadataContents.push({ filename: file.replace('.dat', '.csav'), contents: fs.readFileSync(`${inputDirectorySavefilesGame}/${file}`, 'utf8') }); + } + }); + } + + // Copy the screenshots for the game. + let inputDirectoryScreenshotsGame = `${inputDirectoryGame}/${game}/screenshots/`; + let outputDirectoryScreenshotsGame = `${outputDirectoryScreenshots}/${game}/`; + + if (fs.existsSync(inputDirectoryScreenshotsGame)) { + // Create the savefile directory for each game. + if (fs.existsSync(outputDirectoryScreenshotsGame) == false) { + fs.mkdirSync(outputDirectoryScreenshotsGame); + } + + // Copy all screenshots into the output folder. + fs.readdirSync(inputDirectoryScreenshotsGame).forEach(file => { + if (file.slice(-4) == '.png') { + fsextra.copySync(`${inputDirectoryScreenshotsGame}/${file}`, `${outputDirectoryScreenshotsGame}/${file}`); + } + }); + } + + // Create the markdown file to be displayed in Hugo. let title = game.replace(/-/g, ' ').slice(0, -3); var stats = fs.statSync(`${inputDirectoryGame}/${game}/game.dat`); - var modified = new Date(util.inspect(stats.mtime)); + let modified = new Date(util.inspect(stats.mtime)); let datContents = fs.readFileSync(`${inputDirectoryGame}/${game}/game.dat`, 'utf8'); let wikiContents = fs.readFileSync(`${inputDirectoryWiki}/${game}.md`, 'utf8'); @@ -89,7 +145,13 @@ try { wikiContents = blackfriday.fixLists(wikiContents); wikiContents = blackfriday.fixLinks(wikiContents); - let output = `+++\r\ndate = "${modified.toISOString()}"\r\n${datContents}+++\r\n\r\n${wikiContents}\r\n`; + // Read all savefiles from array and copy them into the markdown. + savefileMetadataContents.forEach(function(savefile) { + let modified = new Date(util.inspect(stats.mtime)); + datContents += `\r\n\r\n[[ savefiles ]]\r\n${savefile.contents}\r\nfilename = "${savefile.filename}"\r\ndate = "${modified.toISOString()}"\r\n`; + }); + + let output = `+++\r\ndate = "${modified.toISOString()}"\r\n${datContents}\r\n+++\r\n\r\n${wikiContents}\r\n`; fs.writeFileSync(`${outputDirectoryMd}/${game}.md`, output); }); } catch (ex) { From fda7c4657236dee059333f6e4d4ed0d8ec9c1256 Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 3 Jun 2017 16:10:55 -0400 Subject: [PATCH 2/8] Added layout for screenshots and savefiles. --- .../citra-bs-theme/layouts/game/single.html | 81 ++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/site/themes/citra-bs-theme/layouts/game/single.html b/site/themes/citra-bs-theme/layouts/game/single.html index ca6961e..d8b9156 100644 --- a/site/themes/citra-bs-theme/layouts/game/single.html +++ b/site/themes/citra-bs-theme/layouts/game/single.html @@ -1,5 +1,7 @@ {{ define "main" }} + {{ $gameName := .File.BaseFileName }} {{ $rating := index .Site.Data.compatibility ( string .Params.compatibility | default "0" ) }} +
@@ -44,6 +46,10 @@ Tested Version {{ .Params.tested_version }} + + Game Icon + + Title IDs @@ -64,6 +70,79 @@
-

{{ .Params.Description }}

+ +

{{ .Params.Description }}

{{ .Content }} + + {{ if (where (readDir "/static/savefiles") "Name" .File.BaseFileName) }} +
+
+

Savefiles

+ + + + + + + + + + + {{ range .Params.savefiles }} + + + + + + + {{ end }} + +
NameDescriptionUploaded ByDate
{{ .title }}{{ .description }}{{ .author }}{{ dateFormat "January 2, 2006" .date }}
+
+
+ {{ end }} + + {{ if (where (readDir "/static/images/screenshots0") "Name" .File.BaseFileName) }} +
+
+

Screenshots

+ {{ $files := readDir (printf "/static/images/screenshots0/%s/" .File.BaseFileName) }} + {{ range $index, $element := $files }} + + {{ end }} +
+
+ {{ end }} + +{{ end }} + +{{ define "scripts" }} + + + + {{ end }} From 0dfe4a2b633344496acd64bf043f0a0f6deb3b83 Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 3 Jun 2017 16:17:53 -0400 Subject: [PATCH 3/8] Fixed savefile location, added author hyperlink to community forums. --- site/themes/citra-bs-theme/layouts/game/single.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/themes/citra-bs-theme/layouts/game/single.html b/site/themes/citra-bs-theme/layouts/game/single.html index d8b9156..3074983 100644 --- a/site/themes/citra-bs-theme/layouts/game/single.html +++ b/site/themes/citra-bs-theme/layouts/game/single.html @@ -90,9 +90,9 @@ {{ range .Params.savefiles }} - {{ .title }} + {{ .title }} {{ .description }} - {{ .author }} + {{ .author }} {{ dateFormat "January 2, 2006" .date }} {{ end }} From 9dd87b75d37a779a18cae8f1ab26e3f0913cbcde Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 3 Jun 2017 16:48:15 -0400 Subject: [PATCH 4/8] Updates to games template. --- .../citra-bs-theme/layouts/game/single.html | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/site/themes/citra-bs-theme/layouts/game/single.html b/site/themes/citra-bs-theme/layouts/game/single.html index 3074983..60ba126 100644 --- a/site/themes/citra-bs-theme/layouts/game/single.html +++ b/site/themes/citra-bs-theme/layouts/game/single.html @@ -38,14 +38,6 @@ Status {{ $rating.name }}
{{ $rating.description }} - - Tested Date - {{ dateFormat "January 2, 2006" .Params.tested_date }} - - - Tested Version - {{ .Params.tested_version }} - Game Icon @@ -74,6 +66,31 @@

{{ .Params.Description }}

{{ .Content }} + +
+
+

Compatibility

+ + + + + + + + + + + + + + + + + +
DateTested ByCitra VersionRating
{{ dateFormat "January 2, 2006" .Params.tested_date }}{{ .Params.tested_by }}{{ .Params.tested_version }}{{ $rating.name }}
+
+
+ {{ if (where (readDir "/static/savefiles") "Name" .File.BaseFileName) }}
@@ -90,10 +107,10 @@ {{ range .Params.savefiles }} - {{ .title }} - {{ .description }} - {{ .author }} - {{ dateFormat "January 2, 2006" .date }} + {{ .title }} + {{ .description }} + {{ .author }} + {{ dateFormat "January 2, 2006" .date }} {{ end }} From 09c408037038066d8c2b22e21c11e31a1fe9633b Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 3 Jun 2017 17:27:58 -0400 Subject: [PATCH 5/8] Updated boolean values to return N/A on null instead of false. Updated table CSS. --- site/themes/citra-bs-theme/layouts/game/single.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/site/themes/citra-bs-theme/layouts/game/single.html b/site/themes/citra-bs-theme/layouts/game/single.html index 60ba126..152d7f5 100644 --- a/site/themes/citra-bs-theme/layouts/game/single.html +++ b/site/themes/citra-bs-theme/layouts/game/single.html @@ -32,10 +32,10 @@
- +
- + @@ -52,11 +52,11 @@ - + - +
StatusStatus {{ $rating.name }}
{{ $rating.description }}
System Files Required?{{ if eq .Params.needs_system_files true }}Yes{{ else }}No{{ end }}{{ if eq .Params.needs_system_files true }}Yes{{ else if eq .Params.needs_system_files false }}No{{ else }}N/A{{ end }}
Shared Font Required?{{ if eq .Params.needs_shared_font true }}Yes{{ else }}No{{ end }}{{ if eq .Params.needs_shared_font true }}Yes{{ else if eq .Params.needs_shared_font false }}No{{ else }}N/A{{ end }}
From 263a52ce5e77d708b4a29404f8eb7f60496d1755 Mon Sep 17 00:00:00 2001 From: chris062689 Date: Sat, 3 Jun 2017 18:00:44 -0400 Subject: [PATCH 6/8] Added games list. --- .../citra-bs-theme/layouts/game/list.html | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 site/themes/citra-bs-theme/layouts/game/list.html diff --git a/site/themes/citra-bs-theme/layouts/game/list.html b/site/themes/citra-bs-theme/layouts/game/list.html new file mode 100644 index 0000000..2e03fff --- /dev/null +++ b/site/themes/citra-bs-theme/layouts/game/list.html @@ -0,0 +1,27 @@ +{{ define "main" }} + {{ $paginator := .Paginate .Data.Pages }} + + + + + + + + + + + + {{ range $paginator.Pages }} + {{ $rating := index .Site.Data.compatibility ( string .Params.compatibility | default "0" ) }} + + + + + + + {{ end }} + +
TitleCompatibilityDate Tested
{{ .Params.title }}{{ $rating.name }}{{ dateFormat "January 2, 2006" .Params.tested_date }}
+ + {{ partial "pagination" . }} +{{ end }} From 85b7fcaf2fdef61dde5964a2b9fe6c2addea77cd Mon Sep 17 00:00:00 2001 From: Schplee Date: Sat, 3 Jun 2017 15:14:06 -0700 Subject: [PATCH 7/8] update compatibility naming scheme --- site/data/compatibility.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/site/data/compatibility.json b/site/data/compatibility.json index 6e7ab80..9436f87 100644 --- a/site/data/compatibility.json +++ b/site/data/compatibility.json @@ -1,8 +1,9 @@ { "0": { "name": "Won't Boot", "description": "The game crashes when attempting to startup." }, - "1": { "name": "Garbage", "description": "Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start Screen." }, - "2": { "name": "Bronze", "description": "Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches even with workarounds." }, - "3": { "name": "Silver", "description": "Game functions with minor graphical or audio glitches, but game is playable from start to finish with workarounds." }, - "4": { "name": "Gold", "description": "Game functions with minor graphical or audio glitches, game is playable from start to finish without any workarounds needed." }, - "5": { "name": "Platinum", "description": "Game functions flawless with no audio or graphical glitches, all tested functionality works as intended without any workarounds needed." } + "1": { "name": "Intro/Menu", "description": "Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start Screen." }, + "2": { "name": "Bad", "description": "Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches even with workarounds." }, + "3": { "name": "Okay", "description": "Game functions with major graphical or audio glitches, but game is playable from start to finish with workarounds." }, + "4": { "name": "Great", "description": "Game functions with minor graphical or audio glitches, but game is playable from start to finish with workarounds." }, + "5": { "name": "Excellent", "description": "Game functions with minor graphical or audio glitches, game is playable from start to finish without any workarounds needed." }, + "6": { "name": "Perfect", "description": "Game functions flawless with no audio or graphical glitches, all tested functionality works as intended without any workarounds needed." } } From 469f7ce6cf02a6b02cff116dfd593fa739475275 Mon Sep 17 00:00:00 2001 From: Schplee Date: Sat, 3 Jun 2017 16:19:19 -0700 Subject: [PATCH 8/8] Summary of ratings in games list --- .../citra-bs-theme/layouts/game/list.html | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/site/themes/citra-bs-theme/layouts/game/list.html b/site/themes/citra-bs-theme/layouts/game/list.html index 2e03fff..340b570 100644 --- a/site/themes/citra-bs-theme/layouts/game/list.html +++ b/site/themes/citra-bs-theme/layouts/game/list.html @@ -1,6 +1,48 @@ {{ define "main" }} {{ $paginator := .Paginate .Data.Pages }} - +

Game Compatibility List

+

The Citra Emulator compatibility list contains all the games we tested, sorted by how well they work on the emulator.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RatingDescription
PerfectGame functions flawless with no audio or graphical glitches, all tested functionality works as intended without any workarounds needed.
ExcellentGame functions with minor graphical or audio glitches, game is playable from start to finish without any workarounds needed.
GreatGame functions with minor graphical or audio glitches, but game is playable from start to finish with workarounds.
OkayGame functions with major graphical or audio glitches, but game is playable from start to finish with workarounds.
BadGame functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches even with workarounds.
Intro/MenuGame is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start Screen.
Won't BootThe game crashes when attempting to startup.
+ +

Games