Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Net Yaroze under psy-q tab #1536

Merged
merged 4 commits into from
Jan 9, 2024
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
5 changes: 5 additions & 0 deletions tools/vscode-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ The panel will have the ability to install the tools on the most popular platfor

### Changelog

- 0.3.3
- Adding Net Yaroze template.
- Refactored the template panel page a bit.
- 0.3.2
- Fixing PSYQo's template.
- 0.3.1
- Fixing EASTL paths in PSYQo template for Unix-like systems.
- 0.3.0
Expand Down
3 changes: 2 additions & 1 deletion tools/vscode-extension/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
case 'getTemplates':
this._panel.webview.postMessage({
command: 'templates',
templates: templates.list
templates: templates.list,
categories: templates.categories

Check warning on line 72 in tools/vscode-extension/extension.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

PSXDevPanel.constructor already has high cyclomatic complexity, and now it increases in Lines of Code from 114 to 115. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
})
break
case 'refreshTools':
Expand Down
13 changes: 11 additions & 2 deletions tools/vscode-extension/media/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,94 +90,103 @@
}
for (const [category, templateKeys] of Object.entries(categories)) {
const panel = document.createElement('vscode-panel-view')
const panelDiv = document.createElement('div')
panelDiv.className = 'templatespanel'
if (message.categories[category] !== undefined) {
const categoryDescription = document.createElement('h3')
categoryDescription.textContent =
message.categories[category].description
panelDiv.appendChild(categoryDescription)
}
for (const key of templateKeys) {
const template = templates[key]
const templateDiv = document.createElement('div')
templateDiv.className = 'template'
const templateName = document.createElement('h3')
const templateName = document.createElement('h2')
templateName.textContent = template.name
templateDiv.appendChild(templateName)
const templateDescription = document.createElement('p')
templateDescription.textContent = template.description
templateDiv.appendChild(templateDescription)
const templateDocumentation =
document.createElement('vscode-button')
templateDocumentation.textContent = 'Documentation'
templateDocumentation.appearance = 'secondary'
if (template.url) {
templateDocumentation.addEventListener('click', () => {
vscode.postMessage({ command: 'openUrl', url: template.url })
})
} else {
templateDocumentation.disabled = true
}
templateDiv.appendChild(templateDocumentation)
const spaceTextNode0 = document.createTextNode(' ')
templateDiv.appendChild(spaceTextNode0)
const templateExamples = document.createElement('vscode-button')
templateExamples.textContent = 'Examples'
templateExamples.appearance = 'secondary'
if (template.examples) {
templateExamples.addEventListener('click', () => {
vscode.postMessage({
command: 'openUrl',
url: template.examples
})
})
} else {
templateExamples.disabled = true
}
templateDiv.appendChild(templateExamples)
const spaceTextNode1 = document.createTextNode(' ')
templateDiv.appendChild(spaceTextNode1)
const templateInstallRequiredTools =
document.createElement('vscode-button')
templateInstallRequiredTools.textContent =
'Install required tools'
templateInstallRequiredTools.appearance = 'secondary'
templateInstallRequiredTools.addEventListener('click', () => {
vscode.postMessage({
command: 'installTools',
tools: template.requiredTools
})
})
templateDiv.appendChild(templateInstallRequiredTools)
const spaceTextNode2 = document.createTextNode(' ')
templateDiv.appendChild(spaceTextNode2)
const templateInstallRecommendedTools =
document.createElement('vscode-button')
templateInstallRecommendedTools.textContent =
'Install recommended tools'
templateInstallRecommendedTools.appearance = 'secondary'
templateInstallRecommendedTools.addEventListener('click', () => {
vscode.postMessage({
command: 'installTools',
tools: [
...template.recommendedTools,
...template.requiredTools
]
})
})
templateDiv.appendChild(templateInstallRecommendedTools)
const spaceTextNode3 = document.createTextNode(' ')
templateDiv.appendChild(spaceTextNode3)
const templateCreate = document.createElement('vscode-button')
templateCreate.textContent = 'Create'
templateCreate.id = 'create-' + key
templateCreate.disabled = true
templateCreate.addEventListener('click', () => {
vscode.postMessage({
command: 'createProjectFromTemplate',
template: key,
path: document.getElementById('project-path').value,
name: document.getElementById('project-name').value
})
})
templateDiv.appendChild(templateCreate)
const hr = document.createElement('hr')
templateDiv.appendChild(hr)
panel.appendChild(templateDiv)
panelDiv.appendChild(templateDiv)
}
panel.appendChild(panelDiv)

Check warning on line 189 in tools/vscode-extension/media/main.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

'message' has a cyclomatic complexity of 20, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 189 in tools/vscode-extension/media/main.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Bumpy Road Ahead

'message' has 6 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 189 in tools/vscode-extension/media/main.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Deep, Nested Complexity

'message' has a nested complexity depth of 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.
panels.appendChild(panel)
}
templatesDiv.appendChild(panels)
Expand Down
2 changes: 1 addition & 1 deletion tools/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "psx-dev",
"displayName": "PSX.Dev",
"description": "PlayStation 1 development made easy",
"version": "0.3.2",
"version": "0.3.3",
"engines": {
"vscode": "^1.75.0"
},
Expand Down
73 changes: 70 additions & 3 deletions tools/vscode-extension/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,36 @@
}
]
})

const netyarozeTemplate = combine(psyqTemplate, {
files: [
{
name: '.vscode/c_cpp_properties.json',
content: {
configurations: [
{
includePath: [
'${workspaceFolder}/third_party/net-yaroze/include'
],
name: 'Win32'
},
{
includePath: [
'${workspaceFolder}/third_party/net-yaroze/include'
],
name: 'linux'
}
]
}
}
],
modules: [
{
name: 'third_party/net-yaroze',
url: 'https://github.com/gwald/psyq_to_netyaroze.git'
}
]
})
/* eslint-enable no-template-curly-in-string */

async function createGitRepository (fullPath, template, progressReporter) {
Expand Down Expand Up @@ -354,7 +384,7 @@
name: 'Psy-Q Cube',
category: 'Psy-Q SDK',
description:
'A project showing a spinning cube using the Psy-Q SDK. Please note that while it is probably considered abandonware at this point, you will not receive a proper license from Sony. Use it at your own risk. Additionally, while the project folder on your harddrive will have the SDK installed on it, the created git repository will not. If you publish the created git repository, users who clone it will need to restore the SDK using the WELCOME page button.',
'A project showing a spinning cube using the Psy-Q SDK.',
url: 'https://psx.arthus.net/sdk/Psy-Q/DOCS/',
examples: 'https://github.com/ABelliqueux/nolibgs_hello_worlds',
requiredTools: ['git', 'make', 'toolchain', 'psyq'],
Expand All @@ -380,7 +410,7 @@
name: 'PSYQo Hello World',
category: 'PSYQo SDK',
description:
'A project simply displaying Hello World using the PSYQo SDK. The PSYQo library is a C++-20 MIT-licensed framework cleanly written from scratch, allowing you to write modern, readable code targeting the PlayStation 1, while still being efficient. Additionally, you will have access to the EASTL library, which is a BSD-3-Clause licensed implementation of the C++ Standard Template Library.',
'A project simply displaying Hello World using the PSYQo SDK.',
url: 'https://github.com/pcsx-redux/nugget/tree/main/psyqo#how',
examples:
'https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips/psyqo/examples',
Expand All @@ -400,11 +430,48 @@
{ projectName: name }
)
}
},
psyq_netyaroze: {
name: 'Net Yaroze Sprite',
category: 'Psy-Q SDK',
description:
'A SCEE Net Yaroze tutorial showing 2D sprite movement, scaling and rotation using a subset of Psy-Q SDK (full compatibility is still Work In Progress).',
url: 'https://github.com/gwald/psyq_to_netyaroze/',
examples: 'https://github.com/gwald/netyaroze_demo',
requiredTools: ['git', 'make', 'toolchain', 'psyq'],
recommendedTools: ['gdb', 'debugger', 'redux'],
create: async function (fullPath, name, progressReporter, tools) {
const git = await createGitRepository(
fullPath,
netyarozeTemplate,
progressReporter
)

await copyTemplateDirectory(
git,
fullPath,
name,
path.join(extensionUri.fsPath, 'templates', 'psyq', 'net-yaroze'),
{ projectName: name }
)
progressReporter.report({ message: 'Unpacking Net Yaroze...' })
await tools.psyq.unpack(path.join(fullPath, 'third_party', 'psyq'))
}

Check warning on line 459 in tools/vscode-extension/templates.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Code Duplication

The module contains 2 functions with similar structure: create,create. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
}
}

exports.list = templates

exports.categories = {
'Bare metal': {
description: 'Bare metal projects. These examples are using little to no external dependencies to work.'
},
'Psy-Q SDK': {
description: 'Projects using the Psy-Q SDK. This SDK was the original one published by Sony to create software for the PlayStation 1. Please note that while it is probably considered abandonware at this point, you will not receive a proper license from Sony. Use it at your own risk. Additionally, while the project folder on your harddrive will have the SDK installed on it, the created git repository will not. If you publish the created git repository, users who clone it will need to restore the SDK using the WELCOME page button.'
},
'PSYQo SDK': {
description: 'Projects using the PSYQo SDK. The PSYQo library is a C++-20 MIT-licensed framework cleanly written from scratch, allowing you to write modern, readable code targeting the PlayStation 1, while still being efficient. Additionally, you will have access to the EASTL library, which is a BSD-3-Clause licensed implementation of the C++ Standard Template Library.'
}
}
exports.createProjectFromTemplate = async function (tools, options) {
const fullPath = path.join(options.path, options.name)
const template = templates[options.template]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-m32
-I.
-Ithird_party/net-yaroze/include
-Ithird_party/nugget
-Ithird_party/psyq-iwyu/include
Loading
Loading