Skip to content

Commit

Permalink
change decode name
Browse files Browse the repository at this point in the history
  • Loading branch information
ran-j committed Nov 8, 2020
1 parent d7023a0 commit c20f9d4
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ var app = new Vue({
gamesListMeta: [],
gameList: [], // { name: '', image: '', path: '', filename: '', configPath: '', region: '' }
apiKey: secrets.apiKey,
regionTypes: ['SLUS', 'SLES'],
regionTyeps2: ['SCUS'],
regionTypes: ['SLUS', 'SCUS', 'SLES', 'PAL'],
emulatorStarded: false,
usingGamePad: false,
gamePadButtons: {
Expand Down Expand Up @@ -205,9 +204,20 @@ var app = new Vue({
},
async decodeName({ region }, { NTSCJ, NTSCU, PAL }) {
const regionIdentify = this.regionTypes.indexOf(region.split('-')[0]);
const regionIdentify2 = this.regionTyeps2.indexOf(region.split('-')[0]);
const regionCode = region;
const regionList = regionIdentify === 0 ? NTSCU : regionIdentify === 1 ? PAL : regionIdentify2 === 0 ? NTSCU : NTSCJ

var regionList = []

if (regionIdentify === 1 || regionIdentify === 0) {
regionList = NTSCU
} else if (regionIdentify === 2) {
regionList = NTSCJ
} else if (regionIdentify === 3) {
regionList = PAL
} else {
regionList = [ ...NTSCU, ...NTSCJ, ...PAL ]
}

return regionList.find((gameInfo) => gameInfo.code === regionCode)
},
async refreshLibrary() {
Expand Down Expand Up @@ -269,14 +279,17 @@ var app = new Vue({
console.log(error)
var extension = path.extname(file);
var fileNameNoExtension = path.basename(file, extension);
this.gameList.push({
let index = (this.gameList.push({
name: fileNameNoExtension,
region: 'Unknow',
image: blanckImg,
filename: file,
path: config.gamesPath,
configPath: ''
})
}) - 1)
this.getImage(fileNameNoExtension).then((image) => {
this.gameList[index].image = image ? image.basePath + image.filename : blanckImg
}).catch(console.error)
}
}
// console.log(this.gameList)
Expand Down

0 comments on commit c20f9d4

Please # to comment.