Skip to content

Commit

Permalink
Merge pull request #91 from Tarnadas/dev
Browse files Browse the repository at this point in the history
2.2.0
  • Loading branch information
Mario Reder authored Feb 26, 2019
2 parents 9040160 + 8426618 commit 045ee0e
Show file tree
Hide file tree
Showing 106 changed files with 5,593 additions and 2,760 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"presets": [
["env", {
"targets": {
"electron": "1.8.3"
"electron": "2.0.17"
},
"useBuiltIns": true
}]
Expand Down
15 changes: 12 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"parser": "typescript-eslint-parser",
"extends": [
"standard-with-typescript",
"plugin:react/recommended"
],
"plugins": [
Expand All @@ -10,13 +9,17 @@
"jsdoc"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
"jsx": true,
"modules": true
}
},
"rules": {
"indent": "off",
"indent-legacy": ["error", 2, { "SwitchCase": 1 }],
"no-unused-vars": "off",
"react/prop-types": "off",
"react/jsx-no-target-blank": "off",
"jsdoc/check-param-names": 1,
Expand All @@ -30,11 +33,17 @@
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1,
"typescript/explicit-member-accessibility": "off"
"typescript/explicit-member-accessibility": "off",
"typescript/no-empty-interface": "off"
},
"env": {
"browser": true,
"worker": true,
"jest": true
},
"settings": {
"react": {
"version": "detect"
}
}
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.credentials
/.idea/
/node_modules/
/build/*
#!/build/patches/
!/build/winprocess/
!/build/patches/
!/build/img/
!/build/styles/
/build/styles/renderer.*
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Mario Reder
Copyright (c) 2017-2019 Mario Reder

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 0 additions & 1 deletion build-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ packager({
fs.createReadStream(file).pipe(fs.createWriteStream(path.join(appPaths[0], `patches/${file.split('patches/')[1]}`)))
})
rimraf(path.join(appPaths[0], 'resources/app/patches'), () => {})
rimraf(path.join(appPaths[0], 'resources/app/package-lock.json'), () => {})
})
1 change: 1 addition & 0 deletions build/img/host.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/img/load.gif
Binary file not shown.
1 change: 1 addition & 0 deletions build/img/pc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions build/img/server.svg
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 build/patches/253710
Binary file not shown.
1 change: 1 addition & 0 deletions build/patches/37eb80
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�C$
Binary file added build/patches/800000
Binary file not shown.
Binary file added build/patches/840000
Binary file not shown.
Binary file added build/patches/862000
Binary file not shown.
Binary file added build/patches/884000
Binary file not shown.
Binary file added build/patches/8a4000
Binary file not shown.
Binary file added build/patches/8c4000
Binary file not shown.
Binary file added build/patches/8e4000
Binary file not shown.
Binary file added build/patches/909000
Binary file not shown.
Binary file added build/patches/9b0000
Binary file not shown.
Binary file added build/patches/9b4000
Binary file not shown.
Binary file added build/patches/9b4200
Binary file not shown.
Binary file added build/patches/9ce000
Binary file not shown.
Binary file added build/patches/9e5600
Binary file not shown.
Binary file added build/patches/ff9400
Binary file not shown.
Binary file added build/patches/ff9800
Binary file not shown.
Binary file added build/patches/ff9d00
Binary file not shown.
Binary file added build/patches/ff9d80
Binary file not shown.
Binary file added build/patches/ff9e80
Binary file not shown.
Binary file added build/patches/ff9f00
Binary file not shown.
Binary file added build/patches/ff9f40
Binary file not shown.
Binary file added build/patches/ff9f80
Binary file not shown.
Binary file added build/patches/ffa000
Binary file not shown.
Binary file added build/patches/fff000
Binary file not shown.
1 change: 1 addition & 0 deletions compat-list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = function getCompatMin (currentVersion) {
const [ major, minor ] = currentVersion.split('.').map(n => Number(n))
if (major === 2 && minor === 1) return [ '2', '0' ]
if (major === 2 && minor === 2) return [ '2', '0' ]
throw new Error(`Compatibility list found unknown version ${currentVersion}`)
}
78 changes: 43 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{
"name": "net64plus",
"version": "2.1.1",
"version": "2.2.0",
"compatVersion": "1.0.0",
"description": "Net64+ client",
"main": "index.js",
"scripts": {
"start": "webpack --env=dev && cd ./build && electron .",
"start:debug": "webpack --env=dev",
"build": "webpack --env=prod && node ./build-app",
"build:dev": "webpack --env=dev && node ./build-app",
"build": "yarn clean && webpack --env=prod && node ./build-app",
"build:dev": "yarn clean && webpack --env=dev && node ./build-app",
"build:proto": "pbjs -t static-module -w commonjs -p ./proto -o ./proto/ServerClientMessage.js ./proto/ServerClientMessage.proto && pbts -o ./proto/ServerClientMessage.d.ts ./proto/ServerClientMessage.js && pbjs -t static-module -w commonjs -p ./proto -o ./proto/ClientServerMessage.js ./proto/ClientServerMessage.proto && pbts -o ./proto/ClientServerMessage.d.ts ./proto/ClientServerMessage.js",
"rebuild": "electron-rebuild -v 1.8.3 -f -w winprocess,process-list",
"prebuild:win": "electron-rebuild -v 2.0.17 -f -w winprocess,process-list",
"prebuild:linux": "electron-rebuild -v 2.0.17 -f -w process-list",
"prebuild:move": "mv node_modules/process-list/bin/linux-x64-57/process-list.node build/processlist-linux.node",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src",
"test": "jest spec"
"test": "jest spec",
"tsc": "tsc --noEmit",
"clean": "git clean -x -f build"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -50,28 +54,28 @@
]
},
"dependencies": {
"axios": "^0.17.1",
"bufferutil": "^3.0.3",
"csv-parse": "https://github.com/Tarnadas/node-csv-parse.git",
"axios": "^0.18.0",
"bufferutil": "^4.0.1",
"csv-parse": "3",
"deepmerge": "^2.0.1",
"dompurify": "^1.0.4",
"electron": "1.8",
"electron": "2",
"history": "^4.7.2",
"immer": "^1.3.1",
"immer": "^2.0.0",
"marked": "^0.4.0",
"node-emoji": "^1.8.1",
"process-list": "^1.2.3",
"protobufjs": "^6.8.4",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-redux": "^5.0.6",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-redux": "5",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.6",
"redux": "^3.7.2",
"react-router-redux": "^5.0.0-alpha.9",
"redux": "^4.0.1",
"rimraf": "^2.6.2",
"utf-8-validate": "^4.0.0",
"winprocess": "0.0.2",
"tar": "^4.4.8",
"utf-8-validate": "^5.0.2",
"ws": "^3.2.0"
},
"devDependencies": {
Expand All @@ -82,14 +86,15 @@
"@types/jest": "^22.0.1",
"@types/marked": "^0.3.0",
"@types/node-emoji": "^1.8.0",
"@types/react": "^16.0.34",
"@types/react-dom": "^16.0.3",
"@types/react": "^16.8.4",
"@types/react-dom": "^16.8.2",
"@types/react-redux": "^5.0.14",
"@types/react-router": "^4.0.20",
"@types/react-router-dom": "^4.2.3",
"@types/react-router-redux": "^5.0.11",
"@types/rimraf": "^2.0.2",
"@types/text-encoding": "^0.0.32",
"@types/tar": "^4.0.0",
"@types/text-encoding": "^0.0.35",
"@types/ws": "^4.0.0",
"autoprefixer": "^8.2.0",
"awesome-typescript-loader": "^3.4.1",
Expand All @@ -102,19 +107,19 @@
"core-js": "^2.5.1",
"css-loader": "^0.28.11",
"devtron": "^1.4.0",
"electron-debug": "^1.4.0",
"electron-debug": "2",
"electron-packager": "^9.1.0",
"electron-rebuild": "^1.6.0",
"eslint": "4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-config-standard-with-typescript": "^2.0.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsdoc": "^3.3.1",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-typescript": "^0.8.1",
"electron-rebuild": "^1.8.2",
"eslint": "^5.14.1",
"eslint-config-standard": "^12.0.0",
"eslint-config-standard-with-typescript": "^6.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsdoc": "^4.1.1",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-typescript": "^0.14.0",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.5",
"html-webpack-plugin": "^2.30.1",
Expand All @@ -125,12 +130,15 @@
"sass-loader": "^6.0.7",
"standard": "^10.0.3",
"style-loader": "^0.20.3",
"text-encoding": "^0.6.4",
"text-encoding": "^0.7.0",
"ts-jest": "^22.0.1",
"typescript": "^2.8.0-dev.20180126",
"typescript-eslint-parser": "^12.0.0",
"typescript": "3.2",
"typescript-eslint-parser": "^22.0.0",
"url-loader": "^0.6.2",
"webpack": "^3.6.0",
"webpack-sources": "^1.0.1"
},
"optionalDependencies": {
"winprocess": "0.0.2"
}
}
11 changes: 0 additions & 11 deletions src/declarations/winprocess.d.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/declarations/winprocess.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type winProcess = {
Process: (processId: number) => Process
}
export interface Process {
open: () => void
readMemory: (offset: number, length: number) => Buffer | number
writeMemory: (offset: number, buffer: Buffer) => void
}
export default winProcess
10 changes: 7 additions & 3 deletions src/main/Emulator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import winProcess, { Process } from 'winprocess'
import { snapshot } from 'process-list'
import * as parse from 'csv-parse'

Expand All @@ -10,8 +9,13 @@ import { spawn } from 'child_process'
import { connector, deleteEmulator } from '.'
import { FilteredEmulator } from '../models/Emulator.model'
import { buf2hex } from '../utils/Buffer.util'
import winprocess, { Process } from '../declarations/winprocess'

const tasklist = promisify(snapshot)
let winProcess: winprocess
if (process.platform === 'win32') {
winProcess = require('winprocess')
}

enum ConnectionFlag {
IS_DISCONNECTED = 0,
Expand Down Expand Up @@ -57,7 +61,7 @@ export class Emulator {
console.warn(`tasklist process exited with code ${code}`)
return
}
parse(stdout, {}, (err: Error, data: string[][]) => {
parse(stdout, {}, (err: Error | undefined, data: string[][]) => {
if (err) reject(err)
resolve(data)
})
Expand All @@ -82,7 +86,7 @@ export class Emulator {
if (code !== 0) {
console.warn(`tasklist process exited with code ${code}`)
}
parse(stdout, {}, (err: Error, data: string[][]) => {
parse(stdout, {}, (err: Error | undefined, data: string[][]) => {
if (err) reject(err)
if (data.length === 0) reject(new Error(`tasklist couldn't find process with PID ${process[1]}`))
resolve(data[0])
Expand Down
32 changes: 1 addition & 31 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { app, BrowserWindow } from 'electron'
import * as rimraf from 'rimraf'

import * as path from 'path'
import * as fs from 'fs'
Expand Down Expand Up @@ -50,36 +49,7 @@ export const deleteConnection = () => {
connection = undefined
}

;(async () => {
const appSavePath = path.resolve(`${app.getPath('appData')}/net64plus`)
if (!fs.existsSync(appSavePath)) {
fs.mkdirSync(appSavePath)
}
(global as Global).save = {
appSavePath
}
if (fs.existsSync(path.join(appSavePath, 'save.json'))) {
try {
const appSaveData = JSON.parse(fs.readFileSync(path.join(appSavePath, 'save.json'), {
encoding: 'utf8'
}))
if (appSaveData == null) {
await new Promise(resolve => {
rimraf(appSavePath, err => {
if (err) {
console.error(err)
} else {
fs.mkdirSync(appSavePath)
}
resolve()
})
})
} else {
(global as Global).save.appSaveData = appSaveData
}
} catch (err) {}
}

;(() => {
const onReady = () => {
const mainWindow = new BrowserWindow({
width: process.env.NODE_ENV === 'development' ? 1400 : 670,
Expand Down
1 change: 1 addition & 0 deletions src/models/Server.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export interface Server {
gameMode?: number
version?: string
passwordRequired?: boolean | null
isDedicated?: boolean
}
Loading

0 comments on commit 045ee0e

Please sign in to comment.