Skip to content

Commit

Permalink
Prepare for alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
moruzerinho6 committed Jun 18, 2021
1 parent 9f1792a commit e04123c
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 19 deletions.
86 changes: 85 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,85 @@
# stepmaniaCheck
# stepmaniaCheck

## Introduction

StepMania check is console program made to log information about given StepMania installation.

As of now, only Windows 7 64-bit is supported, while it's possible to compile the code for linux and mac it was not been tested yet, if you're able to please follow the building tutorial.

## Setup

After downloading the latest release, open `config.ini` and edit the needed preferences.

- stepmaniaPath (REQUIRED)

The path to your stepmania installation folder (outside of the program folder).

- savePath (REQUIRED if there's no 'portable.ini' inside stepmania installation folder)

The path to the save folder of your stepmania installation.

- preferenceName (Required for NotITG)

The name of Preferences.ini for given stepmania installation.

- programName (Required for when the executable is not named stepmania)

The name of the main executable of the stepmania installation.

- programDataName (Required if savePath is not given)

The name of the save folder of your stepmania in appdata of your OS.

- clearConsole

Use for debugging only, makes so console is never cleared.

After executing the program and the table is shown, the content will be written on `log.txt`, it's useful for sharing on Discord. **(copy the file itself, not the content inside it)**
## Supported StepMania

stepmaniaCheck officialy supports any version of SM5+, NotITG and OpenITG. Older versions and forks might work but they haven't been tested.

### Config Examples

#### [Project OutFox](https://projectmoon.dance/)

```Ini
stepmaniaPath=C:/Games/StepMania OutFox 5.3
```

#### StepMania 5.1

```Ini
stepmaniaPath=C:/Games/StepMania 5.1

# If you have portable enabled then this is not needed
savePath=C:\Users\USERNAME\AppData\Roaming\StepMania 5.1\Save
```

#### StepMania 5

```Ini
stepmaniaPath=C:/Games/StepMania 5

# If you have portable enabled then this is not needed
savePath=C:\Users\USERNAME\AppData\Roaming\StepMania 5\Save
```
#### NotITG

```Ini
stepmaniaPath=C:/Games/NotITG
savePath=C:/Games/NotITG/Data
preferenceName=StepMania
```

## Building

stepmaniaCheck uses [pkg](https://www.npmjs.com/package/pkg) to bundle its releases. Only 64 bit versions were able to be built as unknown errors appears while bulding 32 bit executables. It will be required to require [fs](https://nodejs.org/api/fs.html) package inside of ini-parser package as it assumes its a global.
### Steps

Make sure you have at least NodeJS 14 installed.
Have [pkg](https://www.npmjs.com/package/pkg) **globally**

1. Clone the repository
2. Open your console inside of the clonned repository
3. To build you can use `npm run buildWin` to build just like the current releases or `pkg -t node14-OS-ARCH .` (see the target options [here](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#platform-list))
15 changes: 11 additions & 4 deletions config.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[variables]
# Use this variable to implement the stepmania installation path
# This IS required.
# Example: D:\JOGOS\League of Legends\thing\nitg
# Example: C:\Games\Project OutFox

stepmaniaPath=

# This is only required when your game IS NOT running on portable mode.
# Q: "How can I know if my game is running on portable mode?"
# R: Go to your game folder, if there's a file named "portable" or "portable.ini", then you're running portable mode.
# Example: savePath=C:\Users\user\AppData\Roaming\StepMania 5.3/Save
# Example: savePath=C:\Users\user\AppData\Roaming\StepMania 5.3\Save

savePath=

Expand All @@ -24,7 +24,7 @@ preferenceName=
# Similiar to PreferenceName, this will change what the program looks for as
# the program name, this is again applicable to NotITG but also Etterna since
# they change the program name.
# Example: ProgramName=Etterna
# Example: ProgramName=NotITG-4-2

programName=

Expand All @@ -34,4 +34,11 @@ programName=
# saves as StepMania 5.1 on appdata while SM5 saves as
# StepMania 5
# Example: StepMania 5
programDataName=
programDataName=


# This makes so the console never clears and you're able to see all warnings.
# Only enable this to detect errors. It shouldn't break anything even if you enable.
# Example: clearConsole=0
# please use only 0 and 1 as value
clearConsole=1
18 changes: 11 additions & 7 deletions src/checks/stepmania.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,17 @@ exports.main = async (Data, args) => {
)

// Prepare for wall of text.
Data.properties.forEach(async (prop) => {
await addIfExists(Data, save.Options[prop], prop)
})

Data.properties.forEach(async (prop) => {
await Data.checkForErrors(Data.infoStorage, prop, args)
})
try {
Data.properties.forEach(async (prop) => {
await addIfExists(Data, save.Options[prop], prop)
})

Data.properties.forEach(async (prop) => {
await Data.checkForErrors(Data.infoStorage, prop, args)
})
} catch (e) {
console.log(e)
}

return Data.infoStorage
} catch (e) {
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ const defineArguments = (config, args) => {
const preferenceName = args[2] || config.variables.preferenceName || "Preferences"
const programName = args[3] || config.variables.programName || "StepMania"
const programDataName = args[4] || config.variables.programDataName || "StepMania"
let clearConsole = args[5] || Number(config.variables.clearConsole) || 0

return { stepmaniaPath, savePath, preferenceName, programName, programDataName }
if (clearConsole && clearConsole !== 0) {
clearConsole = 1
}

return { stepmaniaPath, savePath, preferenceName, programName, programDataName, clearConsole }
}

const args = defineArguments(config, givenArguments)
Expand Down
6 changes: 3 additions & 3 deletions src/stepmaniaCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ exports.main = async (si, args) => {
await Data.allPropertyToDefault()
Merine.display(Data, 'do')
const result = await checkModule.main(Data, args, si)
Merine.display(Data, 'stop')
Merine.display(Data, 'stop', args)

if (!result) {
Merine.screen = 'failed'
Merine.display(Data, 'do')
Merine.display(Data, 'do', args)
console.log('Unable to get any info, giving up.')
return null
}

Merine.screen = 'stats'
Merine.display(Data, 'do')
Merine.display(Data, 'do', args)
// TODO: Execute UI first and make interactions based errors.
}
6 changes: 3 additions & 3 deletions src/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.Merine = class {
this.animation = null
}

display(Data, order) {
display(Data, order, args) {
switch (this.screen) {
case 'loading':
if (order === 'stop') {
Expand All @@ -43,10 +43,10 @@ exports.Merine = class {
break
case 'failed':
console.log(chalk.red('Failed'))
// console.clear()
if (args.clearConsole) console.clear()
break
case 'stats':
console.clear()
if (args.clearConsole) console.clear()
let displayData = [
['Property', 'Value', 'Status']
]
Expand Down

0 comments on commit e04123c

Please sign in to comment.