106 Commits

Author SHA1 Message Date
RuiFPB 21361dacf9 Test setting the run container
PR build check / Build (pull_request) Has been cancelled
PR C++ format check / Check clang format (pull_request) Failing after 51s
2026-06-11 01:32:14 +01:00
RuiFPB 71a3cf92ee Second attempt to fix format-check
PR build check / Build (pull_request) Successful in 3m36s
PR C++ format check / Check clang format (pull_request) Failing after 23s
2026-06-11 01:24:18 +01:00
RuiFPB 7f3e46c66f Update format check workflow and use 4 jobs for pr-build-check
PR build check / Build (pull_request) Successful in 3m50s
PR C++ format check / Check clang format (pull_request) Failing after 3s
2026-06-11 01:13:37 +01:00
RuiFPB 3b2f25c6c4 Template as submodule
PR C++ format check / Check clang format (push) Failing after 22s
PR build check / Build (pull_request) Successful in 8m16s
PR C++ format check / Check clang format (pull_request) Failing after 4s
2026-06-11 01:02:28 +01:00
RuiFPB c1d4f7b9db Add linux config to template folder
Official build / Build (push) Successful in 8m24s
2026-06-11 00:47:22 +01:00
RuiFPB a5e3fc57b3 Remove CUSTOM_PCSX2_PATH setup from script.
Official build / Build (push) Successful in 8m30s
Now setting the environment variable before should work
2026-06-11 00:24:47 +01:00
RuiFPB 92c58f28b8 Fix TZData setup on dependency install of actions workflow
Official build / Build (push) Successful in 8m6s
2026-05-24 21:58:56 +01:00
RuiFPB d4dc1ac4c5 Fix dependency install on actions scripts.
Official build / Build (push) Has been cancelled
(Generated by Gemini 3.5 Flash)
2026-05-24 21:56:09 +01:00
RuiFPB bf1c41f3e1 Adding bash scripts to the project.
Official build / Build (push) Failing after 1m20s
(Scripts generated by Antigravity with Gemini Flash 3.5)
2026-05-24 21:42:26 +01:00
Sandro Sobczyński 92734168a2 Update README.MD 2025-07-23 18:34:49 +02:00
Sandro Sobczyński c0f5f06eb4 Update README.MD 2025-07-23 18:34:34 +02:00
Sandro Sobczyński b7bc5f2f0a Merge pull request #199 from GDQR/Texture-Buffer
Fix: width of texture buffer for pallete color
2024-10-01 19:33:18 +02:00
Guido Diego Quispe Robles e8c0cfce1f Fix: width of texture buffer for pallete color 2024-09-01 18:54:42 -03:00
Sandro Sobczyński 1e396fb1a3 Update README.MD 2024-02-12 00:55:51 +01:00
Sandro Sobczyński 2b5839a4a8 Merge pull request #185 from h4570/178-vcl-problem-link
Dockerfile fix
2024-02-12 00:46:45 +01:00
h4570 0810f12949 Dockerfile fix 2024-02-12 00:45:59 +01:00
Sandro Sobczyński 04d105ca0e Merge pull request #183 from h4570/182-glitched-texture-on-skybox
Fix glitched textures
2024-02-12 00:21:22 +01:00
h4570 93e7aa5e19 Remove debug code 2024-02-12 00:14:33 +01:00
h4570 3c2ad09870 Docs changes 2024-02-12 00:10:59 +01:00
h4570 1dbd2d6a5a Fix glitched texture 2024-02-12 00:10:40 +01:00
Sandro Sobczyński 4f21626136 Merge pull request #181 from h4570/new-rel
new-rel -> master
2024-02-11 14:14:49 +01:00
Sandro Sobczyński 50a9070d2d Merge pull request #180 from Wellinator/feature/texture_wraping
Adds support for texture region repeat
2024-02-11 13:38:20 +01:00
Sandro Sobczyński 8ed34abb83 Merge pull request #175 from GuidoDQR/texture-generation-id
Texture generation id
2024-02-11 13:36:18 +01:00
Sandro Sobczyński f6ebd079f5 Merge pull request #174 from GuidoDQR/fix-load-sprite
Fix sprite loading
2024-02-11 13:35:29 +01:00
Wellinator 0f7083aa5b chore: fix cppcheck validation 2024-02-01 10:30:13 -03:00
Wellinator 9baad8199a Merge branch 'master' into feature/texture_wraping 2024-01-31 18:28:19 -03:00
Wellinator 5eafc0bdba chore: add tutorial 11, texture region repeat 2024-01-31 18:27:34 -03:00
Wellinator c3c649dcdc chore: add tutorial 11 ignore files 2024-01-31 18:15:36 -03:00
Wellinator 1c4a84dffa chore: implements updateTextureInfo for texture packet update 2024-01-31 17:57:19 -03:00
Wellinator f727dae150 refactore: change method from private to public 2024-01-31 17:53:20 -03:00
Wellinator 9b24ea3bb6 feat: allow changing the texture wrap settings 2024-01-31 14:27:48 -03:00
Guido Diego Quispe Robles 586180764e Update png_loader.cpp
optimization
2024-01-25 01:33:15 -03:00
Guido Diego Quispe Robles a329ea73cc new namespace 2024-01-24 12:13:01 -03:00
Guido Diego Quispe Robles 5418e28b73 Update texture.cpp
initial texturecounter is 0 because texture buffer can't be 0.
if id is 0 always create a texture buffer.
2024-01-18 22:27:03 -03:00
Guido Diego Quispe Robles d773173ece id generation texture 2024-01-18 21:53:38 -03:00
Guido Diego Quispe Robles aa21baaaf2 change core width and clut width 2024-01-04 22:11:10 -03:00
Sandro Sobczyński 0c0fcd697f Merge pull request #173 from GuidoDQR/rsync
Fixed rsync warning from copy source code to docker volume
2024-01-02 21:10:17 +01:00
Guido Diego Quispe Robles e07cfc502a Update tasks.json
fixes rsync issue and prevents files from disappearing:
rsync warning: some files vanished before they could be transferred (code 24)
2023-12-28 09:16:44 -03:00
Sandro Sobczyński ab08a385a6 Merge pull request #172 from h4570/support-new-pcsx2
Add support for new PCSX2
2023-11-25 16:55:36 +01:00
h4570 8642959d70 run in background 2023-11-25 16:36:08 +01:00
h4570 19ae6de1c7 add support for new pcsx2 2023-11-25 16:12:55 +01:00
h4570 c40558bd54 move vcl from my server to github repo 2023-11-25 14:12:42 +01:00
Sandro Sobczyński 700e878e61 Merge pull request #170 from h4570/misc-cleanup-wolf
Minor fixes
2023-11-13 20:15:10 +01:00
h4570 9ee1df81e6 Merge branch 'master' into misc-cleanup-wolf 2023-11-13 20:08:33 +01:00
Sandro Sobczyński 22ecaffe1b Merge pull request #155 from Wolf3s/Cleanup
misc cleanup
2023-11-13 19:53:02 +01:00
h4570 26285c54e9 add israpps to readme 2023-11-13 19:46:44 +01:00
h4570 a52e2bec0e move assets to github repo 2023-11-13 19:40:19 +01:00
Sandro Sobczyński 5583c7bc92 remove sha step 2023-11-13 19:12:39 +01:00
Sandro Sobczyński b8e5309119 rename artifacts 2023-11-13 19:11:05 +01:00
Sandro Sobczyński fdc5450181 Merge pull request #169 from h4570/github-actions
Github Actions refactor
2023-11-13 19:02:22 +01:00
Sandro Sobczyński 39a962c59b github actions bugfixes 2023-11-13 18:53:35 +01:00
Sandro Sobczyński b84bd99059 fix job name 2023-11-13 18:29:46 +01:00
Sandro Sobczyński caa0fd4db3 refactor github actions 2023-11-13 18:27:38 +01:00
Sandro Sobczyński daee3b4971 Merge pull request #168 from israpps/patch-5
add continous integration
2023-11-13 17:57:50 +01:00
Matías Israelson 02a23cd415 add continous integration 2023-11-13 10:23:57 -03:00
André Guilherme c2e653c059 Merge branch 'h4570:master' into Cleanup 2023-11-12 09:57:00 -03:00
Sandro Sobczyński 676ac34ec3 Merge pull request #151 from Wellinator/feature/posix-drivers
Feature posix drivers loading
2023-11-11 17:37:41 +01:00
Wellinator e229b34ad3 refactore: rename loadPOSIX to loadIO 2023-11-11 13:34:50 -03:00
Wellinator 67f70f80d8 Merge branch 'master' into feature/posix-drivers 2023-11-11 12:35:19 -03:00
Wellinator 1e046d9dda merge: merge changes from upstream master 2023-11-11 12:32:04 -03:00
Sandro Sobczyński 383cdb3675 Merge pull request #166 from israpps/patch-4
Compact IRX externs
2023-11-11 11:34:28 +01:00
israpps 795910de69 Update irx_loader.cpp 2023-11-10 14:45:57 -03:00
Matías Israelson b344fd4141 Compact IRX externs 2023-11-10 13:09:28 -03:00
Sandro Sobczyński b3ff38af06 Merge pull request #162 from GuidoDQR/screenDebug
Screen debug
2023-11-08 22:53:16 +01:00
Guido Diego Quispe Robles 19c673767c Debug Update
Screen debug for errors
2023-11-08 16:07:37 -03:00
Sandro Sobczyński 15a2dbb854 Merge pull request #161 from GuidoDQR/master
Fixed writeLogsToFile
2023-11-05 14:47:23 +01:00
Guido Diego Quispe Robles f4f527b877 Update debug.hpp
clang format
2023-11-04 23:28:09 -03:00
Guido Diego Quispe Robles ce4e2f663f optimization code
created writeInLogFile function

tested in real PS2 and emulator
2023-11-04 23:27:16 -03:00
Guido Diego Quispe Robles 7736f00d71 Update debug.hpp
formatted with clang
2023-11-04 22:40:13 -03:00
Guido Diego Quispe Robles 878adf5dbb Fix writeLogsToFile
Deleted logFile smart pointer and getLogFile function.
logfile created inside of the statics functions.
Debug.cpp can be deleted.
2023-11-04 22:35:13 -03:00
Sandro Sobczyński d2da130771 Update README.MD 2023-10-19 21:22:56 +02:00
Sandro Sobczyński 588f45e870 Update README.MD 2023-10-19 21:22:20 +02:00
André Guilherme b19d4f42f5 Merge branch 'h4570:master' into Cleanup 2023-07-27 10:10:31 -03:00
André Guilherme ea5849095e Update README.MD 2023-07-25 23:25:28 -03:00
Sandro Sobczyński e2790d93b6 Merge pull request #158 from freebytego/master
Fix music going too fast for first few seconds
2023-07-25 21:21:58 +02:00
freebytego 7401926202 Fix music going too fast for first few seconds 2023-07-25 08:51:43 +06:00
Wellinator 200a68e219 fix: accelerated audio 2023-07-24 14:43:21 -03:00
Wolf3s 699e5f0ff5 misc cleanup 2023-06-04 09:36:57 -03:00
Sandro Sobczyński e63ae14792 Merge pull request #154 from GuidoDQR/sprite-offset
* Added offset to 2D sprite (Guido Diego Quispe Robles)
* Added tutorial with font and texture atlas (Guido Diego Quispe Robles)
2023-05-29 18:59:48 +02:00
h4570 87b983153a change tyra version 2023-05-29 18:53:30 +02:00
h4570 cab934763f minor adjustments 2023-05-28 22:55:42 +02:00
Guido Diego Quispe Robles 20d2291a88 Update Tyra copyright 2023-05-28 16:46:32 -03:00
Guido Diego Quispe Robles 4f6e55c0b0 new Tutorial
tutorial with sprite offset, sprite sheet and texture filtering
2023-05-28 13:47:48 -03:00
Guido Diego Quispe Robles fbcb38d37a tutorial 10 2023-05-26 18:04:23 -03:00
Sandro Sobczyński a25594b95c Merge pull request #153 from nicholas477/master
Updated tyra install directions to include downloading assets
2023-04-22 23:38:26 +02:00
Nicholas 86c0ab74f1 Updated tyra install directions to include downloading assets 2023-04-14 12:52:42 -04:00
Wellinator 17d2d93d45 fix: irx loading order 2023-01-23 14:54:20 -03:00
Wellinator f546604ba3 fix: redefinition of ret 2023-01-23 10:27:55 -03:00
Wellinator d196290a3f fix: extern variables names 2023-01-23 10:24:24 -03:00
Wellinator 481ccd0cf9 feat: load fileXio and iomanX iop drivers 2023-01-23 10:19:18 -03:00
Declan Hopkins e3726600fd fix memory leak (#150) 2022-12-23 23:20:09 +01:00
Sandro Sobczyński 8b8500a1c9 Update README.MD 2022-09-05 00:08:38 +02:00
Sandro Sobczyński 789c795c14 Update README.MD 2022-09-04 22:59:11 +02:00
h4570 a0be9022ff Merge branch 'master' of https://github.com/h4570/tyra 2022-09-02 17:44:24 +02:00
h4570 77c6702f80 remove duplicated comments 2022-09-02 17:44:15 +02:00
Sandro Sobczyński d54cba9e58 Update README.MD 2022-09-02 11:21:56 +02:00
Wolf3s 958ddb4ab7 add some missing links on credits (#142) 2022-09-01 08:54:12 +02:00
Sandro Sobczyński edff3a85d5 Update README.MD 2022-08-31 09:37:42 +02:00
Sandro Sobczyński 165cc4221e Update README.MD 2022-08-31 09:36:42 +02:00
Wolf3s cc42bbf56b Update readme (#139) 2022-08-31 09:32:12 +02:00
Wolf3s a340540d55 Fix version (#138) 2022-08-30 22:40:04 +02:00
Sandro Sobczyński d790349ab9 Update README.MD 2022-08-30 11:26:12 +02:00
Wolf3s 0cecbf0a7d add ci cpp-check and clang format on tutorial_08.hpp (#137)
* Create check-format.yml

* Fix
2022-08-29 23:13:23 +02:00
Sandro Sobczyński f46b058ecf Update README.MD 2022-08-29 20:24:27 +02:00
Sandro Sobczyński c833f93db2 Update README.MD 2022-08-29 19:19:40 +02:00
Sandro Sobczyński 6dc73982f9 Update README.MD 2022-08-29 19:19:29 +02:00
100 changed files with 1534 additions and 438 deletions
+70
View File
@@ -0,0 +1,70 @@
name: Official build
on:
push:
branches: [ master ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: h4570/tyra
steps:
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y git make wget nodejs
- name: Set git safe directory
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout
uses: actions/checkout@v3
- name: Compile engine
run: |
make clean all -C engine
- name: Compile tutorials
run: |
make clean all -C tutorials/01-hello
make clean all -C tutorials/02-sprite
make clean all -C tutorials/03-minecraft
make clean all -C tutorials/04-de_dust2
make clean all -C tutorials/05-animation
make clean all -C tutorials/06-audio
make clean all -C tutorials/07-lighting
make clean all -C tutorials/08-skybox-debug
make clean all -C tutorials/09-manual-mode
make clean all -C tutorials/10-sprite-sheet
- name: Compile demo
run: |
make clean all -C demo
- name: Upload tutorials
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: tutorials-elf
path: |
tutorials/01-hello/bin
tutorials/02-sprite/bin
tutorials/03-minecraft/bin
tutorials/04-de_dust2/bin
tutorials/05-animation/bin
tutorials/06-audio/bin
tutorials/07-lighting/bin
tutorials/08-skybox-debug/bin
tutorials/09-manual-mode/bin
tutorials/10-sprite-sheet/bin
- name: Upload demo
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: demo-elf
path: |
demo/bin
+74
View File
@@ -0,0 +1,74 @@
name: PR build check
on:
pull_request:
branches: [ master ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: h4570/tyra
steps:
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y git make wget nodejs
- name: Set git safe directory
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout
uses: actions/checkout@v3
- name: Compile engine
run: |
make clean all -j4 -C engine
- name: Compile tutorials
run: |
make clean all -j4 -C tutorials/01-hello
make clean all -j4 -C tutorials/02-sprite
make clean all -j4 -C tutorials/03-minecraft
make clean all -j4 -C tutorials/04-de_dust2
make clean all -j4 -C tutorials/05-animation
make clean all -j4 -C tutorials/06-audio
make clean all -j4 -C tutorials/07-lighting
make clean all -j4 -C tutorials/08-skybox-debug
make clean all -j4 -C tutorials/09-manual-mode
make clean all -j4 -C tutorials/10-sprite-sheet
- name: Compile demo
run: |
make clean all -j4 -C demo
- name: Get short SHA
id: slug
run: |
echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Get branch
id: branch
run: |
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/refs\///g' | sed 's/\//_/g')
echo "BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV
- name: Upload build artifacts
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: binaries-${{ env.SHA8 }}-${{ env.BRANCH }}
path: |
tutorials/01-hello/bin
tutorials/02-sprite/bin
tutorials/03-minecraft/bin
tutorials/04-de_dust2/bin
tutorials/05-animation/bin
tutorials/06-audio/bin
tutorials/07-lighting/bin
tutorials/08-skybox-debug/bin
tutorials/09-manual-mode/bin
tutorials/10-sprite-sheet/bin
demo/bin
+38
View File
@@ -0,0 +1,38 @@
#This is a modified version of the clang format check used on Open-PS2-Loader
name: PR C++ format check
on:
push:
paths:
- '**.hpp'
- '**.cpp'
- '**.'
- '**.h'
- './engine/inc/tyra'
- '.github/workflows/check-format.yml'
- '.clang-format'
pull_request:
paths:
- '**.hpp'
- '**.cpp'
- '**.'
- '**.h'
- './engine/inc/tyra'
- '.github/workflows/check-format.yml'
- '.clang-format'
jobs:
check-format:
name: Check clang format
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.12
with:
source: '.'
extensions: 'hpp, cpp, h'
clangFormatVersion: 12
inplace: False
+3
View File
@@ -0,0 +1,3 @@
[submodule "template"]
path = template
url = https://git.ruifpb.pt/RuiFPB/tyra-linux-template
+1
View File
@@ -4,3 +4,4 @@
/c_cpp_properties.json
/tasks.json
/settings.json
/ps2dev-intellisense
@@ -0,0 +1,41 @@
{
"configurations": [
{
"name": "Docker PS2SDK (Linux)",
"includePath": [
"${workspaceFolder}/**",
"~/ps2dev-intellisense/ps2sdk/common/include/**",
"~/ps2dev-intellisense/ps2sdk/ee/include/**",
"~/ps2dev-intellisense/ps2sdk/iop/include/**",
"~/ps2dev-intellisense/ps2sdk/ports/include/**",
"~/ps2dev-intellisense/ee/include/**",
"~/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/include/**",
"~/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/include-fixed/**",
"~/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/install-tools/include/**",
"~/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/plugin/include/**",
"~/ps2dev-intellisense/ee/mips64r5900el-ps2-elf/include/**",
"~/ps2dev-intellisense/ee/mips64r5900el-ps2-elf/sys-include/**",
"~/ps2dev-intellisense/gsKit/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/install-tools/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/plugin/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/include-fixed/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/install-tools/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/plugin/include/**",
"~/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/include-fixed/**"
],
"defines": [
"_EE",
"_IOP",
"__SPU__",
"INTELLISENSE"
],
"cppStandard": "c++20",
"compilerPath": "", // Should be empty
"intelliSenseMode": "linux-gcc-x86",
"configurationProvider": "ms-vscode.cpptools"
}
],
"version": 4
}
@@ -1,5 +1,5 @@
{
"buildDirectory": "./",
"buildDirectory": "demo",
"C_Cpp.default.intelliSenseMode": "gcc-x86",
"files.associations": {
"*.vcl": "asm-collection",
@@ -18,12 +18,12 @@
{
"type": "shell",
"label": "1. Copy source code to docker volume",
"command": "docker exec -t tyra-game-compiler sh -c 'rsync -ac --delete --exclude \".git\" --exclude \".vscode\" --exclude \"*obj*/**\" --exclude \"*bin*/**\" /host/ /src/'"
"command": "docker exec -t tyra-compiler sh -c 'rsync -ac --delete --exclude \".git\" --exclude \"docs\" --exclude \".vscode\" --exclude \"tools\" --exclude \"obj\" --exclude \"bin\" /host/ /src/'"
},
{
"type": "shell",
"label": "2. Compile via docker container",
"command": "docker exec -t tyra-game-compiler sh -c 'cd ${config:buildDirectory} && make'",
"command": "docker exec -t tyra-compiler sh -c 'cd ${config:buildDirectory} && make build-engine all'",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
@@ -34,7 +34,7 @@
{
"type": "shell",
"label": "3. Copy binaries to host",
"command": "docker exec -t tyra-game-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"*bin*/**\" --exclude=\"*\" /src/ /host/'",
"command": "docker exec -t tyra-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"bin/**\" --exclude=\"*\" /src/ /host/'"
},
{
"type": "shell",
@@ -42,7 +42,7 @@
"options": {
"cwd": "${config:buildDirectory}"
},
"command": "./run.ps1"
"command": "./run.sh"
},
{
"type": "shell",
@@ -50,27 +50,22 @@
"dependsOn": [
"1. Copy source code to docker volume"
],
"command": "docker exec -t tyra-game-compiler sh -c 'adpenc ${input:wav2adpcmSource} ${input:wav2adpcmTarget} && rsync -zac /src/${input:wav2adpcmTarget} /host/${input:wav2adpcmTarget}'"
"command": "docker exec -t tyra-compiler sh -c 'adpenc ${input:wav2adpcmSource} ${input:wav2adpcmTarget} && rsync -zac /src/${input:wav2adpcmTarget} /host/${input:wav2adpcmTarget}'"
},
{
"type": "shell",
"label": "Cleanup",
"command": "docker exec -t tyra-game-compiler sh -c 'rm -rf /src/*'"
},
{
"type": "shell",
"label": "Update Tyra",
"command": "docker exec -t tyra-game-compiler sh -c 'rm -rf /tyra && mkdir -p /tyra && git clone https://github.com/h4570/tyra.git /tyra && cd /tyra && git checkout ${input:tyraBranch} && cd engine && make'"
"command": "docker exec -t tyra-compiler sh -c 'rm -rf /src/*'"
},
{
"type": "shell",
"label": "Send to PS2",
"command": "docker exec -t tyra-game-compiler sh -c 'cd ${config:buildDirectory}/bin && killall -v ps2client || $true && ps2client -h ${input:ps2Ip} reset && ps2client -h ${input:ps2Ip} reset && ps2client -h ${input:ps2Ip} execee host:$(find . -maxdepth 1 -type f -name \"*.elf\")'"
"command": "docker exec -t tyra-compiler sh -c 'cd ${config:buildDirectory}/bin && killall -v ps2client || true && ps2client -h ${input:ps2Ip} reset && ps2client -h ${input:ps2Ip} reset && ps2client -h ${input:ps2Ip} execee host:$(find . -maxdepth 1 -type f -name \"*.elf\")'"
},
{
"type": "shell",
"label": "Open PS2 output logger",
"command": "docker stop ps2-logs || $true && docker run -t --rm --name=ps2-logs -p ${input:local2Ip}:18194:18194/udp h4570/tyra sh -c 'ps2client -h ${input:ps2Ip} listen'",
"command": "docker stop ps2-logs || true && docker run -t --rm --name=ps2-logs -p ${input:local2Ip}:18194:18194/udp h4570/tyra sh -c 'ps2client -h ${input:ps2Ip} listen'",
"runOptions": {
"instanceLimit": 1
},
@@ -92,20 +87,20 @@
{
"type": "shell",
"label": "[Debug] Copy obj directory to host",
"command": "docker exec -t tyra-game-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"obj/**\" --exclude=\"*\" /src/ /host/'"
"command": "docker exec -t tyra-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"obj/**\" --exclude=\"*\" /src/ /host/'"
}
],
"inputs": [
{
"id": "wav2adpcmSource",
"description": "Source file path (ex. ):",
"default": "res/sound.wav",
"default": "demo/res/sound.wav",
"type": "promptString"
},
{
"id": "wav2adpcmTarget",
"description": "Target file path (ex. ):",
"default": "res/sound.adpcm",
"default": "demo/res/sound.adpcm",
"type": "promptString"
},
{
@@ -119,12 +114,6 @@
"description": "Local ip address:",
"default": "192.168.1.245",
"type": "promptString"
},
{
"id": "tyraBranch",
"description": "Tyra branch:",
"default": "master",
"type": "promptString"
}
]
}
+1 -1
View File
@@ -42,7 +42,7 @@
"options": {
"cwd": "${config:buildDirectory}"
},
"command": "./run.ps1"
"command": "Start-Job { ./run.ps1 } | Receive-Job -Wait"
},
{
"type": "shell",
+1 -2
View File
@@ -31,8 +31,7 @@ RUN make
# Download VCL
RUN mkdir -p /temp/vcl
WORKDIR "/temp/vcl"
RUN wget http://apgcglz.cluster028.hosting.ovh.net/tyra/vcl.zip
RUN unzip vcl.zip
RUN wget https://github.com/h4570/tyra/raw/master/assets/vcl
# ------------------------------------------------------------------------------
+1 -1
View File
@@ -16,7 +16,7 @@ IRXEMBEDDEDEXT := irx-em
CFLAGS += -D_EE -Wall -O3
LINKFLAGS += -O3 -Wl,-zmax-page-size=128
ASFLAGS += -O3
LIB += -lstdc++ -ldma -lpacket2 -lgraph -ldraw -lmath3d -lpng -lz -lpad -laudsrv -lpatches -lcdvd
LIB += -lstdc++ -ldma -lpacket2 -lgraph -ldraw -lmath3d -lpng -ldebug -lz -lpad -laudsrv -lpatches -lcdvd
INC += -I$(PS2DEV)/ps2sdk/ee/include -I$(PS2DEV)/ps2sdk/common/include -I$(PS2DEV)/ps2sdk/ports/include
#---------------------------------------------------------------------------------
+24 -25
View File
@@ -7,14 +7,16 @@
<br />
<p align="center">
<a href="https://github.com/h4570/tyra">
<img src="http://apgcglz.cluster028.hosting.ovh.net/tyra/github-splash.png" alt="Logo" width="100%" height="auto">
<img src="https://raw.githubusercontent.com/h4570/tyra/master/assets/github-splash.png" alt="Logo" width="100%" height="auto">
</a>
<h3 align="center">Tyra - 2.0.0</h3>
<h3 align="center">Tyra</h3>
<p align="center">
Open source game engine for PlayStation 2™
<br />
<a href="https://www.youtube.com/watch?v=DGR4vWDjkmc"><strong>Showcase video »</strong></a>
&nbsp;
<a href="https://youtube.com/playlist?list=PLdQVLBcXRRWvtMi-OqccDWLTEFEisD5RH"><strong>YouTube tutorials »</strong></a>
&nbsp;
<br />
@@ -25,15 +27,12 @@
</p>
</p>
[![Stargazers repo roster for h4570/tyra](https://reporoster.com/stars/h4570/tyra)](https://github.com/h4570/tyra/stargazers)
## Table of Contents
* [About the project](#about-the-project)
* [Description](#description)
* [Tutorials](#tutorials)
* [Features](#features)
* [Branches](#branches)
* [Contributing](#contributing)
* [Games](#games)
* [License](#license)
@@ -43,8 +42,8 @@
## About the Project
<p align="center">
<img src="http://apgcglz.cluster028.hosting.ovh.net/tyra/tyra_code.gif" alt="Sample code" width="500" height="auto">
<img src="http://apgcglz.cluster028.hosting.ovh.net/tyra/showcase.gif " alt="Sample game" width="500" height="auto">
<img src="https://raw.githubusercontent.com/h4570/tyra/master/assets/tyra_code.gif" alt="Sample code" width="500" height="auto">
<img src="https://raw.githubusercontent.com/h4570/tyra/master/assets/showcase.gif " alt="Sample game" width="500" height="auto">
</p>
---
@@ -56,7 +55,7 @@ Decision was simple - I need to create an engine which will handle 3D file loadi
### Tutorials
* 01 - Setup environment - [Text tutorial](https://github.com/h4570/tyra/tree/master/docs/install) or [Video](https://www.youtube.com/watch?v=9IXOU1SPdzc)
* 02 - Cooking game assets - [Video](https://www.youtube.com/watch?v=LjO71ovPFJs)
* 02 - Cooking game assets - [Video](https://www.youtube.com/watch?v=hpVDeTTLyjI)
* 03 - Create a game repository - [Video](https://www.youtube.com/watch?v=DKfIKar3GUM)
* 04 - Run game from USB in PS2 - [Video](https://www.youtube.com/watch?v=ZX8fTQqiNho)
---
@@ -69,6 +68,8 @@ Decision was simple - I need to create an engine which will handle 3D file loadi
* 07 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/07-lighting) - Static lightmap and dynamic directional lights
* 08 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/08-skybox-debug) - Skybox and debug rendering
* 09 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/09-manual-mode) - Manual rendering (a'la OpenGL)
* 10 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/10-sprite-sheet) - Sprite sheet (font)
* 11 - [Code](https://github.com/h4570/tyra/tree/master/tutorials/11-texture-region-repeat) - Texture repeating
* Demo game - [Code](https://github.com/h4570/tyra/tree/master/demo)
---
@@ -97,14 +98,10 @@ Decision was simple - I need to create an engine which will handle 3D file loadi
* `.md2` 3D file support
* `.png` Texture file support
### Branches
* `master` - stable releases - tested on PS2 & PCSX2.
* `develop` - daily builds.
## Contributing
See the [open issues](https://github.com/h4570/tyra/issues) for a list of proposed features (and known issues).
## Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
1. Fork the Project
@@ -118,7 +115,10 @@ Contributions are what make the open source community such an amazing place to b
List of games developed with Tyra.
If you created one, please contact me - I will add it to the list :)
* [Tyracraft](https://github.com/Wellinator/tyracraft)
* [Tyracraft](https://github.com/Wellinator/tyracraft) by [Wellinator](https://github.com/Wellinator)
* [Game with car](https://github.com/freebytego/gwc-ps2) by [freebytego](https://github.com/freebytego)
* [Rock, paper, scissors](https://github.com/GuidoDQR/my-ps2-game) by [GuidoDQR](https://github.com/GuidoDQR)
* [TyraTale](https://github.com/Br4k2n/TyraTale) by [Br4k2n](https://github.com/Br4k2n)
## License
@@ -141,24 +141,23 @@ Distributed under the Apache License 2.0 License. See `LICENSE` for more informa
## Credits
Without these guys, Tyra would not happen:
* Dr Henry Fortuna - for code sources, PS2 academy tutorials
* Rick Gaiser, fjtrujy - for maintaining PS2DEV
* Wellington Carvalho - for testing, contributing to Tyra and sharing cool ideas!
* Leonardo Ono - for software renderer example (with clipping!)
* Lukasz D.K. - for huge archive of PS2 stuff
* Guilherme Lampert - for code sources
* Jesper Svennevid, Daniel Collin - for openvcl's code samples
* Whole PS2DEV team
* Manieq - for nice splash screens!
* [Dr Henry Fortuna](http://ps2-edu.tensioncore.com/index.html) - for code sources, PS2 academy tutorials
* Whole [PS2DEV](https://github.com/ps2dev) team, and specially to [Rick Gaiser](https://github.com/rickgaiser), [fjtrujy](https://github.com/fjtrujy) - for a lot of good tips!
* [Wellington Carvalho](https://github.com/Wellinator), [André Guilheme](https://github.com/Wolf3s), [Matías Israelson](https://github.com/israpps), [Guido Diego Quispe Robles](https://github.com/israpps) - for testing, contributing to Tyra and sharing cool ideas!
* [Leonardo Ono](https://github.com/leonardo-ono) - for software renderer example (with clipping!)
* [Lukasz D.K.](https://github.com/lukaszdk) - for huge archive of PS2 stuff
* [Guilherme Lampert](https://github.com/glampert) - for code sources
* [Jesper Svennevid](https://github.com/jsvennevid), [Daniel Collin](https://github.com/emoon) - for openvcl's code samples
* [Manieq](https://www.facebook.com/mvnieq) - for nice splash screens!
* And so many other guys. Thanks!
Project Link: [https://github.com/h4570/tyra](https://github.com/h4570/tyra)
Sandro Sobczyński - sandro.sobczynski@gmail.com
Sandro Sobczyński - sandro.sobczynski@gmail.com (<a href="https://hasto.pl">hasto.pl</a>)
[![LinkedIn][linkedin-shield]](https://linkedin.com/in/sandro-sobczyński-28820b15a)
<br />
<a href="https://github.com/h4570/tyra">
<img src="http://apgcglz.cluster028.hosting.ovh.net/tyra/github-splash2.png" alt="Logo" width="100%" height="auto">
<img src="https://raw.githubusercontent.com/h4570/tyra/master/assets/github-splash2.png" alt="Logo" width="100%" height="auto">
</a>
[contributors-shield]: https://img.shields.io/github/contributors/h4570/tyra.svg?style=flat-square
Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
View File
Binary file not shown.
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../linux-pcsx2.sh
+1 -1
View File
@@ -11,4 +11,4 @@ services:
container_name: tyra-compiler
volumes:
- tyra-volume:/src
- ./:/host
- ./:/host:z
+8 -7
View File
@@ -6,7 +6,7 @@
1. Git
2. VSCode
3. Docker with PowerShell as a default terminal
4. [PCSX2](https://github.com/h4570/tyra/blob/master/docs/install/pcsx2.md#)
4. [Configured PCSX2](https://github.com/h4570/tyra/blob/master/docs/install/pcsx2.md#)
---
@@ -17,9 +17,10 @@
docker pull h4570/tyra
git clone https://github.com/h4570/tyra.git
```
3. Open `VSCode` and open previously cloned directory.
4. In `VSCode` open `.vscode/configurations/windows-docker` and copy configuration files into `.vscode/`
5. In `c_cpp_properties.json` fix all `YOUR-INTELLISENSE-PATH` with path from point 2.
6. Click `CTRL+SHIFT+P`, type `Tasks: Run task` and run `Start docker container` - Repeat this step every time you want to start working with Tyra (every reboot)
7. Click `CTRL+SHIFT+P`, type `Tasks: Run build task`
8. Tyra should automatically compile engine, `demo` game and run `PCSX2`. If you want to compile & run tutorials, please change `buildDirectory` in `settings.json` to example `tutorials/01-hello`
3. Download the [assets.zip](https://github.com/h4570/tyra/releases) file and unzip it into the tyra directory
4. Open `VSCode` and open previously cloned directory.
5. In `VSCode` open `.vscode/configurations/windows-docker` and copy configuration files into `.vscode/`
6. In `c_cpp_properties.json` fix all `YOUR-INTELLISENSE-PATH` with path from point 2.
7. Click `CTRL+SHIFT+P`, type `Tasks: Run task` and run `Start docker container` - Repeat this step every time you want to start working with Tyra (every reboot)
8. Click `CTRL+SHIFT+P`, type `Tasks: Run build task`
9. Tyra should automatically compile engine, `demo` game and run `PCSX2`. If you want to compile & run tutorials, please change `buildDirectory` in `settings.json` to example `tutorials/01-hello`
+15 -11
View File
@@ -1,15 +1,9 @@
## Install & configure PCSX2
## PCSX2 preparation
- Download & install PCSX2 (1.6+ version) from https://pcsx2.net/
- Download PCSX2 from https://pcsx2.net/
- Install
- Extract bios files from https://romsmania.cc/bios/pcsx2-playstation-2-bios-3 to `%UserProfile%\Documents\PCSX2\bios`
- Close `PCSX2` if you have opened!
- Open `%UserProfile%\Documents\PCSX2\inis\PCSX2_vm.ini` in notepad
```
HostFs=enabled
```
- Open PCSX2 and map pad to your keyboard, for example:
- Map pad to your keyboard, for example:
```
WASD = Left joy
@@ -18,4 +12,14 @@ Space = X
Circle = C
```
- Enable **"EE timing hack"** in PCSX2 hacks!
### For PCSX2 1.6.X
- Close `PCSX2` if you have opened!
- Open `%UserProfile%\Documents\PCSX2\inis\PCSX2_vm.ini` in notepad and change HostFs option:
```
HostFs=enabled
```
### For PCSX2 1.7.X
- Open `PCSX2`
- Go to Settings -> Emulation -> Enable `Host file system`
+23 -14
View File
@@ -20,6 +20,7 @@
#else // IF Debug
#include <stdio.h>
#include <debug.h>
#include <string>
#include <sstream>
#include <fstream>
@@ -48,9 +49,7 @@ class TyraDebug {
(void)expander{0, (void(ss << std::forward<Args>(args)), 0)...};
if (Tyra::Info::writeLogsToFile) {
auto* logFile = getLogFile();
*logFile << ss.str();
logFile->flush();
writeInLogFile(&ss);
} else {
printf("%s", ss.str().c_str());
}
@@ -65,9 +64,7 @@ class TyraDebug {
ss1 << "|\n";
if (Tyra::Info::writeLogsToFile) {
auto* logFile = getLogFile();
*logFile << ss1.str();
logFile->flush();
writeInLogFile(&ss1);
} else {
printf("%s", ss1.str().c_str());
}
@@ -80,20 +77,22 @@ class TyraDebug {
ss2 << "====================================\n\n";
if (Tyra::Info::writeLogsToFile) {
auto* logFile = getLogFile();
*logFile << ss2.str();
logFile->flush();
writeInLogFile(&ss2);
} else {
printf("%s", ss2.str().c_str());
}
init_scr();
for (;;) {
scr_setXY(20, 10);
scr_printf(ss1.str().c_str());
writeAssertLinesInScreen(args...);
scr_printf(ss2.str().c_str());
}
}
private:
static std::unique_ptr<std::ofstream> logFile;
static std::ofstream* getLogFile();
static void writeInLogFile(std::stringstream* ss);
template <typename Arg, typename... Args>
static void writeAssertLines(Arg&& arg, Args&&... args) {
@@ -105,13 +104,23 @@ class TyraDebug {
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};
if (Tyra::Info::writeLogsToFile) {
auto* logfile = getLogFile();
*logfile << ss.str();
logFile->flush();
writeInLogFile(&ss);
} else {
printf("%s", ss.str().c_str());
}
}
template <typename Arg, typename... Args>
static void writeAssertLinesInScreen(Arg&& arg, Args&&... args) {
std::stringstream ss;
ss << "| " << std::forward<Arg>(arg) << "\n";
using expander = int[];
(void)expander{
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};
scr_printf(ss.str().c_str());
}
};
#endif // NDEBUG
+5 -3
View File
@@ -11,6 +11,8 @@
#pragma once
#include <string>
#include <limits.h>
#include <syslimits.h>
namespace Tyra {
@@ -42,9 +44,9 @@ class FileUtils {
private:
// Argv name+path & just path
char cwd[255];
char elfName[255];
char elfPath[255 - 14];
char cwd[NAME_MAX];
char elfName[NAME_MAX];
char elfPath[NAME_MAX - 14];
void setPathInfo(const char* path);
};
+1 -1
View File
@@ -21,7 +21,7 @@ class Version {
~Version() {}
static const u8 major = 2;
static const u8 minor = 0;
static const u8 minor = 2;
static const u8 patch = 0;
static std::string toString() {
+1
View File
@@ -27,6 +27,7 @@ class IrxLoader {
void loadSio2man(const bool& verbose);
void loadPadman(const bool& verbose);
void loadLibsd(const bool& verbose);
void loadIO(const bool& verbose);
void loadUsbModules(const bool& verbose);
void loadAudsrv(const bool& verbose);
@@ -33,4 +33,5 @@ class TextureBuilderData {
TextureBpp clutBpp;
unsigned char clutGsComponents;
};
} // namespace Tyra
-3
View File
@@ -36,9 +36,6 @@ class Math {
static int randomi(const int& min, const int& max);
static bool equalf(const float& a, const float& b,
const float& epsilon = 0.00001F);
private:
Math();
};
} // namespace Tyra
@@ -13,6 +13,7 @@
#include "debug/debug.hpp"
#include "renderer/core/2d/sprite/sprite.hpp"
#include "renderer/core/texture/renderer_core_texture_buffers.hpp"
#include "renderer/3d/pipeline/shared/pipeline_texture_mapping_type.hpp"
#include "renderer/core/texture/models/texture.hpp"
#include "renderer/renderer_settings.hpp"
#include <packet2_utils.h>
@@ -30,6 +31,9 @@ class RendererCore2D {
void render(const Sprite& sprite,
const RendererCoreTextureBuffers& texBuffers, Texture* texture);
void setTextureMappingType(
const PipelineTextureMappingType textureMappingType);
private:
void setPrim();
void setLod();
@@ -24,7 +24,7 @@ class Sprite {
~Sprite();
u32 id;
Vec2 position, size;
Vec2 position, size, offset;
float scale;
Color color;
SpriteMode mode;
@@ -62,7 +62,8 @@ class Texture {
/** Set texture wrapping */
void setWrapSettings(const TextureWrap t_horizontal,
const TextureWrap t_vertical);
const TextureWrap t_vertical, int minu = 0, int minv = 0,
int maxu = 0, int maxv = 0);
// ----
// Other
@@ -96,9 +97,10 @@ class Texture {
void print(const std::string& name) const { print(name.c_str()); }
std::string getPrint(const char* name = nullptr) const;
void setDefaultWrapSettings();
private:
void setPsm();
void setDefaultWrapSettings();
texwrap_t wrap;
};
@@ -29,6 +29,12 @@ class RendererCoreTexture {
RendererCoreTextureBuffers useTexture(const Texture* t_tex);
/**
* Called by user after changing texture wrap settings
* Updates texture packet without reallocate it
*/
RendererCoreTextureBuffers updateTextureInfo(const Texture* t_tex);
/** Called by renderer during initialization */
void init(RendererCoreGS* gs, Path3* path3);
@@ -16,6 +16,7 @@
#include "./models/texture.hpp"
#include "renderer/3d/mesh/mesh.hpp"
#include "renderer/core/2d/sprite/sprite.hpp"
#include "./renderer_core_texture_buffers.hpp"
#include "loaders/texture/base/texture_loader_selector.hpp"
#include <string>
@@ -25,6 +26,8 @@ class TextureRepository {
TextureRepository();
~TextureRepository();
void init(std::vector<RendererCoreTextureBuffers>* textureBuffers);
/** Returns all repository textures. */
std::vector<Texture*>* getAll() { return &textures; }
@@ -99,6 +102,13 @@ class TextureRepository {
void freeByMesh(const Mesh& mesh);
void freeByMesh(const Mesh* mesh);
/**
* remove texture buffer id if exist.
* Texture buffer is NOT destructed.
* easy way to create another texture buffer.
*/
int removeBufferId(const u32& t_texId);
/**
* Remove texture from repository.
* Texture is NOT destructed.
@@ -110,6 +120,7 @@ class TextureRepository {
void removeByIndex(const u32& t_index);
std::vector<Texture*> textures;
std::vector<RendererCoreTextureBuffers>* textureBuffers;
TextureLoaderSelector texLoaderSelector;
};
} // namespace Tyra
-1
View File
@@ -6,7 +6,6 @@
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "audio/audio.hpp"
-1
View File
@@ -6,7 +6,6 @@
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "audio/audio_adpcm.hpp"
+1 -1
View File
@@ -6,7 +6,6 @@
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "audio/audio_song.hpp"
@@ -149,6 +148,7 @@ void AudioSong::work() {
if (chunkReadStatus > 0) {
WaitSema(fillbufferSema); // wait until previous chunk wasn't finished
audsrv_wait_audio(chunkReadStatus);
audsrv_play_audio(chunk, chunkReadStatus);
for (u32 i = 0; i < getListenersCount(); i++)
songListeners[i]->listener->onAudioTick();
+8 -13
View File
@@ -10,16 +10,11 @@
#include "debug/debug.hpp"
std::unique_ptr<std::ofstream> TyraDebug::logFile;
std::ofstream* TyraDebug::getLogFile() {
if (logFile) {
return logFile.get();
} else {
logFile = std::make_unique<std::ofstream>();
logFile->open(Tyra::FileUtils::fromCwd("log.txt"),
std::ofstream::out | std::ofstream::app);
return logFile.get();
}
} // namespace Tyra
void TyraDebug::writeInLogFile(std::stringstream* ss) {
std::ofstream logFile;
logFile.open(Tyra::FileUtils::fromCwd("log.txt"),
std::ofstream::out | std::ofstream::app);
logFile << ss->str();
logFile.flush();
// logFile.close();
}
+1 -2
View File
@@ -12,8 +12,7 @@
#include <tamtypes.h>
#include <cstdio>
#include <kernel.h>
#include <limits.h>
#include <syslimits.h>
#include <unistd.h>
#include <cstring>
#include "file/file_utils.hpp"
+2
View File
@@ -0,0 +1,2 @@
$PS2SDK/iop/irx/fileXio.irx
fileXio_irx
+2
View File
@@ -0,0 +1,2 @@
$PS2SDK/iop/irx/iomanX.irx
iomanX_irx
+32 -23
View File
@@ -20,30 +20,20 @@
#include "file/file_utils.hpp"
// external IRX modules
#define EXTERN_IRX(_irx) \
extern u8 _irx[]; \
extern int size_##_irx
extern u8 sio2man_irx[];
extern int size_sio2man_irx;
extern u8 padman_irx[];
extern int size_padman_irx;
extern u8 audsrv_irx[];
extern int size_audsrv_irx;
extern u8 libsd_irx[];
extern int size_libsd_irx;
extern u8 bdm_irx[];
extern int size_bdm_irx;
extern u8 bdmfs_fatfs_irx[];
extern int size_bdmfs_fatfs_irx;
extern u8 usbd_irx[];
extern int size_usbd_irx;
extern u8 usbmass_bd_irx[];
extern int size_usbmass_bd_irx;
EXTERN_IRX(sio2man_irx);
EXTERN_IRX(padman_irx);
EXTERN_IRX(audsrv_irx);
EXTERN_IRX(libsd_irx);
EXTERN_IRX(fileXio_irx);
EXTERN_IRX(iomanX_irx);
EXTERN_IRX(bdm_irx);
EXTERN_IRX(bdmfs_fatfs_irx);
EXTERN_IRX(usbd_irx);
EXTERN_IRX(usbmass_bd_irx);
namespace Tyra {
@@ -70,6 +60,7 @@ void IrxLoader::loadAll(const bool& withUsb, const bool& isLoggingToFile) {
return;
}
loadIO(!isLoggingToFile);
loadSio2man(!isLoggingToFile);
loadPadman(!isLoggingToFile);
loadLibsd(!isLoggingToFile);
@@ -116,6 +107,24 @@ void IrxLoader::loadLibsd(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Libsd loaded!");
}
void IrxLoader::loadIO(const bool& verbose) {
int ret;
if (verbose) TYRA_LOG("IRX: Loading iomanX...");
SifExecModuleBuffer(&iomanX_irx, size_iomanX_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: iomanX_irx");
if (verbose) TYRA_LOG("IRX: iomanX loaded!");
if (verbose) TYRA_LOG("IRX: Loading fileXio...");
SifExecModuleBuffer(&fileXio_irx, size_fileXio_irx, 0, nullptr, &ret);
TYRA_ASSERT(ret >= 0, "Failed to load module: fileXio_irx");
if (verbose) TYRA_LOG("IRX: fileXio_irx loaded!");
}
void IrxLoader::loadUsbModules(const bool& verbose) {
if (verbose) TYRA_LOG("IRX: Loading usb modules...");
@@ -211,10 +211,6 @@ void PngLoader::handle8bppPalletized(TextureBuilderData* result,
auto* pixel = static_cast<unsigned char*>(result->data);
struct PngClut* clut = (struct PngClut*)result->clut;
for (int i = numPallete; i < 256; i++) {
memset(&clut[i], 0, sizeof(clut[i]));
}
for (int i = 0; i < numPallete; i++) {
clut[i].r = palette[i].red;
clut[i].g = palette[i].green;
@@ -273,10 +269,6 @@ void PngLoader::handle4bppPalletized(TextureBuilderData* result,
auto* pixel = static_cast<unsigned char*>(result->data);
struct PngClut* clut = (struct PngClut*)result->clut;
for (int i = numPallete; i < 16; i++) {
memset(&clut[i], 0, sizeof(clut[i]));
}
for (int i = 0; i < numPallete; i++) {
clut[i].r = palette[i].red;
clut[i].g = palette[i].green;
@@ -189,6 +189,8 @@ void DynPipRenderer::addBufferDataToPacket(DynPipBag** bags, const u32& count) {
void DynPipRenderer::sendPacket() {
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
dma_channel_wait(DMA_CHANNEL_GIF, 0); // Wait for texture. Issue #182.
// dma_wait_fast(); // This have no impact on performance
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
@@ -168,6 +168,8 @@ void BlockizerProgramsManager::sendPacket(McpipProgram* program) {
packet2_utils_vu_add_end_tag(currentPacket);
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
dma_channel_wait(DMA_CHANNEL_GIF, 0); // Wait for texture. Issue #182.
// dma_wait_fast(); // This have no impact on performance
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
@@ -365,6 +365,8 @@ void StaPipQBufferRenderer::sendPacket() {
"Packet is too big. Internal error");
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
dma_channel_wait(DMA_CHANNEL_GIF, 0); // Wait for texture. Issue #182.
// dma_wait_fast(); // This have no impact on performance
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
@@ -77,6 +77,10 @@ void StaticPipeline::render(const StaticMesh* mesh,
if (frame->bbox->frustumCheck(
rendererCore->renderer3D.frustumPlanes.getAll(), model) ==
CoreBBoxFrustum::OUTSIDE_FRUSTUM) {
if (options && optionsManuallyAllocated) {
delete options;
}
delete infoBag;
return;
}
}
@@ -84,10 +84,12 @@ void RendererCore2D::render(const Sprite& sprite,
else if (sizeY > sizeX)
texS = texMax / (sizeY / sizeX);
rect->t0.s = sprite.flipHorizontal ? texS : 0.0F;
rect->t0.t = sprite.flipVertical ? texT : 0.0F;
rect->t1.s = sprite.flipHorizontal ? 0.0F : texS;
rect->t1.t = sprite.flipVertical ? 0.0F : texT;
rect->t0.s =
sprite.flipHorizontal ? (texS + sprite.offset.x) : sprite.offset.x;
rect->t0.t = sprite.flipVertical ? (texT + sprite.offset.y) : sprite.offset.y;
rect->t1.s =
sprite.flipHorizontal ? sprite.offset.x : (texS + sprite.offset.x);
rect->t1.t = sprite.flipVertical ? sprite.offset.y : (texT + sprite.offset.y);
rect->color.r = sprite.color.r;
rect->color.g = sprite.color.g;
@@ -131,4 +133,10 @@ void RendererCore2D::render(const Sprite& sprite,
context = !context;
}
void RendererCore2D::setTextureMappingType(
const PipelineTextureMappingType textureMappingType) {
lod.mag_filter = textureMappingType;
lod.min_filter = textureMappingType;
}
} // namespace Tyra
@@ -18,6 +18,7 @@ Sprite::Sprite() {
flipVertical = false;
size.set(32.0F, 32.0F);
position.set(100.0F, 100.0F);
offset.set(0.0F, 0.0F);
scale = 1.0F;
mode = MODE_REPEAT;
setDefaultColor();
+11 -11
View File
@@ -65,20 +65,20 @@ void Path3::sendTexture(const Texture* texture,
const RendererCoreTextureBuffers& texBuffers) {
packet2_reset(texturePacket, false);
int coreWidth = texBuffers.core->width <= 64 ? 64 : texBuffers.core->width;
packet2_update(texturePacket,
draw_texture_transfer(texturePacket->base, texture->core->data,
texture->getWidth(),
texture->getHeight(), texture->core->psm,
texBuffers.core->address, coreWidth));
packet2_update(
texturePacket,
draw_texture_transfer(texturePacket->base, texture->core->data,
texture->getWidth(), texture->getHeight(),
texture->core->psm, texBuffers.core->address,
texBuffers.core->width));
if (texBuffers.clut != nullptr) {
auto* clut = texture->clut;
int clutWidth = texBuffers.clut->width <= 64 ? 64 : texBuffers.clut->width;
packet2_update(texturePacket,
draw_texture_transfer(texturePacket->next, clut->data,
clut->width, clut->height, clut->psm,
texBuffers.clut->address, clutWidth));
packet2_update(
texturePacket,
draw_texture_transfer(texturePacket->next, clut->data, clut->width,
clut->height, clut->psm, texBuffers.clut->address,
texBuffers.clut->width));
}
packet2_chain_open_cnt(texturePacket, 0, 0, 0);
@@ -19,8 +19,18 @@
namespace Tyra {
namespace TyraTexture {
u32 textureCounter = 1;
std::vector<u32> deletedIDs;
} // namespace TyraTexture
Texture::Texture(TextureBuilderData* t_data) {
id = rand() % 1000000;
if (TyraTexture::deletedIDs.empty() == false) {
id = TyraTexture::deletedIDs.front();
TyraTexture::deletedIDs.erase(TyraTexture::deletedIDs.begin());
} else {
id = TyraTexture::textureCounter++;
}
name = t_data->name;
@@ -50,6 +60,7 @@ Texture::Texture(TextureBuilderData* t_data) {
}
Texture::~Texture() {
TyraTexture::deletedIDs.push_back(id);
if (links.size() > 0) links.clear();
if (core) delete core;
if (clut) delete clut;
@@ -167,9 +178,14 @@ void Texture::setDefaultWrapSettings() {
}
void Texture::setWrapSettings(const TextureWrap t_horizontal,
const TextureWrap t_vertical) {
const TextureWrap t_vertical, int minu, int minv,
int maxu, int maxv) {
wrap.horizontal = t_horizontal;
wrap.vertical = t_vertical;
wrap.minu = minu;
wrap.minv = minv;
wrap.maxu = maxu;
wrap.maxv = maxv;
}
void Texture::addLink(const u32& t_id) {
@@ -19,6 +19,7 @@ RendererCoreTexture::~RendererCoreTexture() {}
void RendererCoreTexture::init(RendererCoreGS* t_gs, Path3* t_path3) {
gs = t_gs;
sender.init(t_path3, t_gs);
repository.init(&currentAllocations);
path3 = t_path3;
initClut();
}
@@ -56,6 +57,17 @@ RendererCoreTextureBuffers RendererCoreTexture::useTexture(
return newTexBuffer;
}
RendererCoreTextureBuffers RendererCoreTexture::updateTextureInfo(
const Texture* t_tex) {
TYRA_ASSERT(t_tex != nullptr, "Provided nullptr texture!");
auto allocated = getAllocatedBuffersByTextureId(t_tex->id);
TYRA_ASSERT(allocated.id != 0, "Can't update an unallocated texture!");
path3->sendTexture(t_tex, allocated);
return allocated;
}
RendererCoreTextureBuffers RendererCoreTexture::getAllocatedBuffersByTextureId(
const u32& t_id) {
for (u32 i = 0; i < currentAllocations.size(); i++)
@@ -58,7 +58,19 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureCore(
auto* result = new texbuffer_t;
const auto* core = t_texture->core;
result->width = t_texture->getWidth();
switch (core->psm) {
case GS_PSM_8:
case GS_PSM_4:
case GS_PSM_8H:
case GS_PSM_4HL:
case GS_PSM_4HH:
result->width = -128 & (core->width + 127);
break;
default:
result->width = -64 & (core->width + 63);
break;
}
result->psm = core->psm;
result->info.components = core->components;
@@ -77,7 +89,9 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureClut(
auto* result = new texbuffer_t;
const auto* clut = t_texture->clut;
result->width = clut->width;
int clutWidth = clut->width <= 64 ? 64 : clut->width;
result->width = clutWidth;
result->psm = clut->psm;
result->info.components = clut->components;
@@ -22,6 +22,11 @@ TextureRepository::~TextureRepository() {
}
}
void TextureRepository::init(
std::vector<RendererCoreTextureBuffers>* t_textureBuffers) {
textureBuffers = t_textureBuffers;
}
Texture* TextureRepository::getBySpriteId(const u32& t_id) const {
for (u32 i = 0; i < textures.size(); i++) {
if (textures[i]->isLinkedWith(t_id)) return textures[i];
@@ -57,10 +62,20 @@ void TextureRepository::removeByIndex(const u32& t_index) {
textures.erase(textures.begin() + t_index);
}
int TextureRepository::removeBufferId(const u32& t_texId) {
for (u32 i = 0; i < textureBuffers->size(); i++)
if ((*textureBuffers)[i].id == t_texId) {
(*textureBuffers)[i].id = -1;
return 0;
}
return -1;
}
void TextureRepository::removeById(const u32& t_texId) {
s32 index = getIndexOf(t_texId);
TYRA_ASSERT(index != -1, "Cant remove texture, because it was not found!");
removeByIndex(index);
removeBufferId(t_texId);
}
void TextureRepository::freeByMesh(const Mesh& mesh) {
@@ -93,6 +108,7 @@ void TextureRepository::free(const u32& t_texId) {
TYRA_ASSERT(index != -1, "Cant remove texture, because it was not found!");
removeByIndex(index);
removeBufferId(t_texId);
delete tex;
}
@@ -116,7 +132,7 @@ void TextureRepository::addByMesh(const Mesh* mesh, const char* directory,
if (dirFixed.back() != '/' && dirFixed.back() != ':') dirFixed += "/";
for (u32 i = 0; i < mesh->materials.size(); i++) {
if (!mesh->materials[i]->textureName.has_value()) {
if (!mesh->materials[i]->textureName.has_value()) {
continue;
}
Executable
+74
View File
@@ -0,0 +1,74 @@
#!/bin/bash
get_target_elf_name() {
if [ -f "./Makefile" ]; then
grep -oP '\S+\.elf' Makefile | head -n 1
else
echo ""
fi
}
find_pcsx2() {
if [ -n "$CUSTOM_PCSX2_PATH" ]; then
echo "$CUSTOM_PCSX2_PATH"
return 0
fi
# Check flatpak
if command -v flatpak >/dev/null 2>&1 && flatpak list | grep -q "net.pcsx2.PCSX2"; then
echo "flatpak run net.pcsx2.PCSX2"
return 0
fi
# Check if pcsx2-qt is in PATH
if command -v pcsx2-qt >/dev/null 2>&1; then
echo "pcsx2-qt"
return 0
fi
# Check if pcsx2 is in PATH
if command -v pcsx2 >/dev/null 2>&1; then
echo "pcsx2"
return 0
fi
echo "Error: PCSX2 not found! Please install it, put it in PATH, or specify CUSTOM_PCSX2_PATH in this script." >&2
exit 1
}
run_pcsx2() {
local pcsx2_cmd
pcsx2_cmd=$(find_pcsx2)
local elf_name
elf_name=$(get_target_elf_name)
if [ -z "$elf_name" ]; then
echo "Error: Could not find target ELF name in Makefile!" >&2
exit 1
fi
local target_file
target_file="$(pwd)/bin/$elf_name"
if [ ! -f "$target_file" ]; then
echo "Error: ELF file not found at $target_file. Did you build the project?" >&2
exit 1
fi
# Kill existing PCSX2 instances
if [[ "$pcsx2_cmd" == *"flatpak"* ]]; then
pkill -f "net.pcsx2.PCSX2" >/dev/null 2>&1 || true
pkill -f "pcsx2-qt" >/dev/null 2>&1 || true
else
local bin_name
bin_name=$(basename "$pcsx2_cmd")
pkill "$bin_name" >/dev/null 2>&1 || true
fi
echo "Running PCSX2: $pcsx2_cmd -elf $target_file"
# Run PCSX2 in the background
$pcsx2_cmd -elf "$target_file" &
}
run_pcsx2
Submodule
+1
Submodule template added at 401fce7918
-40
View File
@@ -1,40 +0,0 @@
# Use the Google style in this project.
BasedOnStyle: Google
# Some folks prefer to write "int& foo" while others prefer "int &foo". The
# Google Style Guide only asks for consistency within a project, we chose
# "int& foo" for this project:
DerivePointerAlignment: false
PointerAlignment: Left
SortIncludes: false
IncludeBlocks: Merge
IncludeCategories:
# Matches common headers first, but sorts them after project includes
- Regex: '^\"google/cloud/internal/disable_deprecation_warnings.inc\"$'
Priority: -1
- Regex: '^\"google/cloud/(internal/|grpc_utils/|testing_util/|[^/]+\.h)'
Priority: 1000
- Regex: '^\"google/cloud/' # project includes should sort first
Priority: 500
- Regex: '^\"'
Priority: 1500
- Regex: '^<grpc/'
Priority: 2000
- Regex: '^<google/*'
Priority: 3000
- Regex: '^<.*/.*'
Priority: 4000
- Regex: '^<[^/]*>'
Priority: 5000
# Format raw string literals with a `pb` or `proto` tag as proto.
RawStringFormats:
- Language: TextProto
Delimiters:
- 'pb'
- 'proto'
BasedOnStyle: Google
CommentPragmas: '(@copydoc)'
-5
View File
@@ -1,5 +0,0 @@
*.elf
.git/
.vscode/
docs/
tools/
-2
View File
@@ -1,2 +0,0 @@
# Ignore all differences in line endings
* -crlf
-32
View File
@@ -1,32 +0,0 @@
# ---
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.vsm
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.erl
*.elf
-6
View File
@@ -1,6 +0,0 @@
*.log
# Configuration files
/c_cpp_properties.json
/tasks.json
/settings.json
@@ -1,42 +0,0 @@
{
"configurations": [
{
"name": "Docker PS2SDK",
"includePath": [
"${workspaceFolder}/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/tyra/inc/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ps2sdk/common/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ps2sdk/ee/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ps2sdk/iop/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ps2sdk/ports/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/include-fixed/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/install-tools/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/lib/gcc/mips64r5900el-ps2-elf/11.3.0/plugin/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/mips64r5900el-ps2-elf/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/ee/mips64r5900el-ps2-elf/sys-include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/gsKit/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/install-tools/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/plugin/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-elf/11.3.0/include-fixed/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/install-tools/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/plugin/include/**",
"C:/Users/YOUR-INTELLISENSE-PATH/ps2dev-intellisense/iop/lib/gcc/mipsel-ps2-irx/11.3.0/include-fixed/**"
],
"defines": [
"_EE",
"_IOP",
"__SPU__",
"INTELLISENSE"
],
"cppStandard": "c++20",
"compilerPath": "", // Should be empty
"intelliSenseMode": "linux-gcc-x86",
"configurationProvider": "ms-vscode.cpptools"
}
],
"version": 4
}
-9
View File
@@ -1,9 +0,0 @@
{
"recommendations": [
"ms-vscode.cpptools-extension-pack",
"ryzngard.vscode-header-source",
"maziac.asm-code-lens",
"dmnsgn.vscode-wavefront",
"spmeesseman.vscode-taskexplorer"
]
}
-8
View File
@@ -1,8 +0,0 @@
# syntax=docker/dockerfile:1
FROM h4570/tyra
RUN apt-get update
RUN apt-get install git -y
WORKDIR /src
CMD ["/bin/bash"]
-33
View File
@@ -1,33 +0,0 @@
TARGET := racer.elf
ENGINEDIR := /tyra/engine
#The Directories, Source, Includes, Objects, Binary and Resources
SRCDIR := src
INCDIR := inc
BUILDDIR := obj
TARGETDIR := bin
RESDIR := res
SRCEXT := cpp
VSMEXT := vsm
VCLEXT := vcl
VCLPPEXT := vclpp
DEPEXT := d
OBJEXT := o
#Flags, Libraries and Includes
CFLAGS :=
LIB := -ltyra
LIBDIRS := -L$(ENGINEDIR)/bin
INC := -I$(INCDIR) -I$(ENGINEDIR)/inc
INCDEP := -I$(INCDIR) -I$(ENGINEDIR)/inc
include /tyra/Makefile.base
clean-engine:
cd $(ENGINEDIR) && $(MAKE) cleaner
build-engine:
cd $(ENGINEDIR) && $(MAKE)
build-release-engine:
cd $(ENGINEDIR) && $(MAKE) release
-16
View File
@@ -1,16 +0,0 @@
version: "3.9"
volumes:
tyra-game-volume:
services:
compiler:
environment:
TERM: xterm-256color
network_mode: host
build:
context: ./
dockerfile: Dockerfile
tty: true
container_name: tyra-game-compiler
volumes:
- tyra-game-volume:/src
- ./:/host
-19
View File
@@ -1,19 +0,0 @@
#pragma once
#include <tyra>
namespace Racer {
class RacerGame : public Tyra::Game {
public:
RacerGame(Tyra::Engine* engine);
~RacerGame();
void init();
void loop();
private:
Tyra::Engine* engine;
};
} // namespace Racer
-4
View File
@@ -1,4 +0,0 @@
$ConfigFile = Join-Path $PSScriptRoot './windows-pcsx2.ps1'
. $ConfigFile
RunPCSX2
-10
View File
@@ -1,10 +0,0 @@
#include <tyra>
#include "racer_game.hpp"
int main() {
Tyra::Engine engine;
Racer::RacerGame game(&engine);
engine.run(&game);
SleepThread();
return 0;
}
-14
View File
@@ -1,14 +0,0 @@
#include "racer_game.hpp"
namespace Racer {
using namespace Tyra;
RacerGame::RacerGame(Engine* t_engine) { engine = t_engine; }
RacerGame::~RacerGame() {}
void RacerGame::init() { TYRA_LOG("Hello!"); }
void RacerGame::loop() { TYRA_LOG("Loop!"); }
} // namespace Racer
-12
View File
@@ -1,12 +0,0 @@
$PCSX2_PATH = "${Env:ProgramFiles(x86)}/PCSX2"
$PCSX2_EXE = 'pcsx2.exe'
function GetTargetELFName {
return (Select-String -Path './Makefile' -Pattern "[^ ]*.elf").Matches.Value
}
function RunPCSX2 {
$PCSX2_EXE_WITHOUT_EXT = (Split-Path $PCSX2_EXE -Leaf).Split('.')[0]
Stop-Process -Name $PCSX2_EXE_WITHOUT_EXT -ErrorAction 'SilentlyContinue'
Start-Process -FilePath "$PCSX2_PATH/$PCSX2_EXE" -ArgumentList "--elf=$PWD/bin/$(GetTargetELFName)"
}
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
@@ -26,10 +26,10 @@ class Tutorial08 : public Game {
void loadCupMesh();
void loadSkyboxMesh();
Vec4 cameraPosition, cameraLookAt;
Vec4 cameraPosition;
Vec4 cameraLookAt;
Engine* engine;
u8 fpsCounter;
StaticPipeline stapip;
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
+24
View File
@@ -0,0 +1,24 @@
TARGET := tutorial_10.elf
ENGINEDIR := ../../engine
#The Directories, Source, Includes, Objects, Binary and Resources
SRCDIR := src
INCDIR := inc
BUILDDIR := obj
TARGETDIR := bin
RESDIR := res
SRCEXT := cpp
VSMEXT := vsm
VCLEXT := vcl
VCLPPEXT := vclpp
DEPEXT := d
OBJEXT := o
#Flags, Libraries and Includes
CFLAGS :=
LIB :=
LIBDIRS :=
INC := -I$(INCDIR)
INCDEP := -I$(INCDIR)
include ../Makefile.tutorials-base
@@ -0,0 +1,37 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Guido Diego Quispe Robles
*/
#pragma once
#include <tyra>
#define FONT_CHAR_SIZE 96
namespace Tyra {
class Font {
public:
Font();
void load(TextureRepository& repository, Renderer2D* renderer);
void free(TextureRepository& repository);
void drawText(const char* text, const int& x, const int& y, Color color);
void drawText(const std::string& text, const int& x, const int& y,
Color color);
private:
const static int chars[FONT_CHAR_SIZE];
const static int charWidths[FONT_CHAR_SIZE];
Renderer2D* renderer2D;
Sprite allFont;
std::array<Sprite, FONT_CHAR_SIZE> font;
};
} // namespace Tyra
@@ -0,0 +1,45 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Guido Diego Quispe Robles
*/
#pragma once
#include <tyra>
#include "font_sprite.hpp"
namespace Tyra {
class Tutorial10 : public Game {
public:
explicit Tutorial10(Engine* engine);
~Tutorial10();
void init();
void loop();
private:
void loadTexture();
void loadSprite();
void handlePad();
int padTimer;
Engine* engine;
Pad* pad;
Font font;
Sprite sprite;
Sprite spriteFlip;
Sprite spriteScale;
Sprite spriteStretch;
std::string strFilter;
PipelineTextureMappingType textureFilter;
};
} // namespace Tyra
+4
View File
@@ -0,0 +1,4 @@
$ConfigFile = Join-Path $PSScriptRoot '../../windows-pcsx2.ps1'
. $ConfigFile
RunPCSX2
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
@@ -0,0 +1,109 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Guido Diego Quispe Robles
*/
#include "font_sprite.hpp"
namespace Tyra {
const int Font::chars[FONT_CHAR_SIZE]{
' ', '!', '"', ' ', '$', '%', ' ', '{', '(', ')', ' ', '+', ',', '-',
'.', '/', '0', '1', '2', '3', '4', '5', '6', '2', '8', '9', ':', ';',
'<', '=', '>', '?', ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', ' ', ' ', ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '}', ']', '~', ' '};
const int Font::charWidths[FONT_CHAR_SIZE]{
0, 1, 3, 0, 5, 9, 0, 9, 3, 3, 0, 5, 2, 2, 1, 4, 4, 2, 4, 4, 5, 4, 4, 4,
4, 4, 1, 2, 4, 5, 4, 4, 0, 6, 5, 5, 5, 4, 4, 5, 5, 1, 4, 5, 4, 7, 5, 5,
5, 5, 5, 5, 5, 5, 6, 7, 5, 5, 4, 0, 0, 0, 0, 0, 0, 5, 4, 4, 4, 4, 3, 4,
4, 1, 2, 4, 1, 7, 4, 4, 4, 4, 3, 4, 3, 4, 5, 7, 4, 4, 4, 2, 5, 2, 6, 0,
};
Font::Font() {}
void Font::load(TextureRepository& repository, Renderer2D* renderer) {
renderer2D = renderer;
float height = 16.0F;
float width = 16.0F;
allFont.mode = MODE_REPEAT;
allFont.size = Vec2(255, 127);
auto filepath = FileUtils::fromCwd("earthbound-Font.png");
auto* texture = repository.add(filepath);
texture->addLink(allFont.id);
int column = 0;
int arrow = 0;
for (int i = 0; i < FONT_CHAR_SIZE; i++) {
font[i].id = allFont.id;
font[i].mode = MODE_REPEAT;
font[i].size = Vec2(width, height);
font[i].offset = Vec2(width * column, height * arrow);
column++;
if (column == 16) {
arrow++;
column = 0;
}
}
}
void Font::free(TextureRepository& repository) {
repository.freeBySprite(allFont);
for (int i = 0; i < FONT_CHAR_SIZE; i++) {
repository.freeBySprite(font[i]);
}
}
void Font::drawText(const char* text, const int& x, const int& y, Color color) {
drawText(std::string(text), x, y, color);
}
void Font::drawText(const std::string& text, const int& x, const int& y,
Color color) {
int sizeText = text.size();
int offsetY = 0;
int offsetX = 0;
for (int i = 0; i < sizeText; i++) {
int fontPos = text[i];
Sprite fontSpr = font[0];
for (int j = 0; j < FONT_CHAR_SIZE; j++) {
if (fontPos == chars[j]) {
fontPos = j;
fontSpr = font[j];
fontSpr.color = color;
fontSpr.position = Vec2(x + offsetX, y + offsetY);
break;
}
}
if (fontPos == '\n') {
offsetY += 18;
offsetX = 0.0f;
} else {
if ((fontPos != ' ') && (fontPos != '\t')) {
renderer2D->render(fontSpr);
offsetX += charWidths[fontPos] + 2;
} else {
offsetX += 2;
}
}
}
}
} // namespace Tyra
+26
View File
@@ -0,0 +1,26 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Guido Diego Quispe Robles
*/
#include "engine.hpp"
#include "tutorial_10.hpp"
/**
* In this tutorial we will learn:
* - How works the offset of the sprite
* - How works the texture mapping
* - How to write text (font)
*/
int main() {
Tyra::Engine engine;
Tyra::Tutorial10 game(&engine);
engine.run(&game);
return 0;
}
@@ -0,0 +1,290 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Guido Diego Quispe Robles
*/
#include <tyra>
#include "tutorial_10.hpp"
namespace Tyra {
Tutorial10::Tutorial10(Engine* t_engine)
: padTimer(0), engine(t_engine), pad(&t_engine->pad) {}
Tutorial10::~Tutorial10() {
engine->renderer.getTextureRepository().freeBySprite(sprite);
engine->renderer.getTextureRepository().freeBySprite(spriteFlip);
engine->renderer.getTextureRepository().freeBySprite(spriteScale);
engine->renderer.getTextureRepository().freeBySprite(spriteStretch);
font.free(engine->renderer.getTextureRepository());
}
void Tutorial10::init() {
engine->renderer.setClearScreenColor(Color(32.0F, 32.0F, 32.0F));
/** Load all the sprites of the sprite sheet. */
font.load(engine->renderer.getTextureRepository(),
&engine->renderer.renderer2D);
/** Sprite contains rectangle information. */
loadSprite();
/** Texture contains png image. */
loadTexture();
/** Set the texture filtering. */
textureFilter = TyraNearest;
engine->renderer.core.renderer2D.setTextureMappingType(textureFilter);
}
void Tutorial10::loop() {
auto& renderer = engine->renderer;
/** Change the texture filtering of the texture.
*
* The options are:
* TyraNearest (Point Sampling):
* uses the color of the texel closest to the pixel center for the pixel
* color.
*
* TyraLinear (Bilinear Sampling):
* the four nearest texels to the pixel center are sampled
* and their colors are combined by weighted average according to distance.
*
* By default it is linear.
*/
renderer.core.renderer2D.setTextureMappingType(textureFilter);
handlePad();
/** Begin frame will clear our screen. */
renderer.beginFrame();
/** Render sprite. */
renderer.renderer2D.render(sprite);
renderer.core.renderer2D.setTextureMappingType(TyraLinear);
renderer.renderer2D.render(spriteFlip);
renderer.core.renderer2D.setTextureMappingType(textureFilter);
renderer.renderer2D.render(spriteScale);
renderer.renderer2D.render(spriteStretch);
font.drawText("tests with sprite sheet", (512 / 2) - 60, 10,
Color(255, 255, 255));
font.drawText("Press Cross for nearest filter", (512 / 2) - 70, 50,
Color(255, 255, 255));
font.drawText("Press Circle for linear filter", (512 / 2) - 65, 70,
Color(255, 255, 255));
font.drawText("Use left stick for move the offsets of the sprites",
(512 / 2) - 110, 90, Color(255, 255, 255));
font.drawText("sprite 32x32\n scaled x3", sprite.position.x + 16,
sprite.position.y - 40, Color(255, 255, 255));
font.drawText("sprite 32x32\nscaled x3 with flip", spriteFlip.position.x + 4,
spriteFlip.position.y - 40, Color(255, 255, 255));
font.drawText("sprite 96x96 with\n repeat mode", spriteScale.position.x + 6,
spriteScale.position.y - 40, Color(255, 255, 255));
font.drawText("sprite 96x96 with\n stretch mode",
spriteStretch.position.x + 6, spriteStretch.position.y - 40,
Color(255, 255, 255));
if (textureFilter == TyraLinear) {
strFilter = "Filter: Linear";
} else {
strFilter = "Filter: Nearest";
}
int posX1 = sprite.position.x + 16;
int posX2 = spriteFlip.position.x + 16;
int posX3 = spriteStretch.position.x + 16;
int posX4 = spriteScale.position.x + 16;
int posY1 = sprite.position.y + (sprite.size.y * sprite.scale) + 16;
int posY2 =
spriteFlip.position.y + (spriteFlip.size.y * spriteFlip.scale) + 16;
int posY3 = spriteStretch.position.y +
(spriteStretch.size.y * spriteStretch.scale) + 16;
int posY4 =
spriteScale.position.y + (spriteScale.size.y * spriteScale.scale) + 16;
font.drawText(strFilter, posX1, posY1, Color(255, 255, 255));
font.drawText("Filter: Linear", posX2, posY2, Color(255, 255, 255));
font.drawText(strFilter, posX3, posY3, Color(255, 255, 255));
font.drawText(strFilter, posX4, posY4, Color(255, 255, 255));
/** End frame will perform vsync. */
renderer.endFrame();
}
void Tutorial10::handlePad() {
if (engine->pad.getClicked().Cross) {
textureFilter = TyraNearest;
} else if (engine->pad.getClicked().Circle) {
textureFilter = TyraLinear;
}
/** Move the offset of the sprites.
*
* The offset of the sprite need to be equal or greater to zero
* or a graphical error occurs.
*
* And the sum of the sprite size and the offset must be less than 1024
* or a graphical error occurs.
*
* Sum with repeat mode:
* Max = sprite.size + sprite.offset.
*
* Sum with strecth mode:
* Max = original size of the image + sprite.offset.
*
* If it continues moving past these values
* in a moment it will return to normal but
* the error will be repeated with another value.
*/
if (padTimer <= 0) {
if (pad->getLeftJoyPad().v <= 100) { // up
sprite.offset -= Vec2(0, 16);
spriteFlip.offset -= Vec2(0, 16);
spriteScale.offset -= Vec2(0, 16);
spriteStretch.offset -= Vec2(0, 16);
padTimer = 20;
printf("New offset: %f,%f\n", sprite.offset.x, sprite.offset.y);
} else if (pad->getLeftJoyPad().v >= 200) { // down
sprite.offset += Vec2(0, 16);
spriteFlip.offset += Vec2(0, 16);
spriteScale.offset += Vec2(0, 16);
spriteStretch.offset += Vec2(0, 16);
padTimer = 20;
printf("New offset: %f,%f\n", sprite.offset.x, sprite.offset.y);
}
if (pad->getLeftJoyPad().h <= 100) { // left
sprite.offset -= Vec2(16, 0);
spriteFlip.offset -= Vec2(16, 0);
spriteScale.offset -= Vec2(16, 0);
spriteStretch.offset -= Vec2(16, 0);
padTimer = 20;
printf("New offset: %f,%f\n", sprite.offset.x, sprite.offset.y);
} else if (pad->getLeftJoyPad().h >= 200) { // right
sprite.offset += Vec2(16, 0);
spriteFlip.offset += Vec2(16, 0);
spriteScale.offset += Vec2(16, 0);
spriteStretch.offset += Vec2(16, 0);
padTimer = 20;
printf("New offset: %f,%f\n", sprite.offset.x, sprite.offset.y);
}
} else {
padTimer--;
}
}
void Tutorial10::loadSprite() {
const auto& screenSettings = engine->renderer.core.getSettings();
int offset = 25;
sprite.mode = SpriteMode::MODE_REPEAT;
/** Let's scale it down */
sprite.size = Vec2(32.0F, 32.0F);
sprite.scale = 3;
/** Set the position */
sprite.position =
Vec2(offset, screenSettings.getHeight() / 2.0F - sprite.size.y / 2.0F);
spriteFlip.mode = SpriteMode::MODE_REPEAT;
spriteFlip.flipHorizontal = true;
spriteFlip.flipVertical = true;
spriteFlip.size = Vec2(32.0F, 32.0F);
spriteFlip.scale = 3;
spriteFlip.position =
Vec2(((offset * 2) + (32.0F * 3)),
screenSettings.getHeight() / 2.0F - sprite.size.y / 2.0F);
spriteScale.mode = SpriteMode::MODE_REPEAT;
spriteScale.size = Vec2(96.0F, 96.0F);
spriteScale.position =
Vec2(((offset * 3) + ((32.0F * 3) * 2)),
screenSettings.getHeight() / 2.0F - sprite.size.y / 2.0F);
spriteStretch.mode = SpriteMode::MODE_STRETCH;
spriteStretch.size = Vec2(96.0F, 96.0F);
spriteStretch.position =
Vec2(((offset * 4) + ((32.0F * 3) * 3)),
screenSettings.getHeight() / 2.0F - sprite.size.y / 2.0F);
TYRA_LOG("Sprite created!");
}
void Tutorial10::loadTexture() {
/**
* Renderer has high layer functions,
* which allows to render:
* - Sprite (2D)
* - Mesh (3D)
*
* It uses ONLY low layer functions which are in renderer.core
*/
auto& renderer = engine->renderer;
/**
* TextureRepository is a repository of textures.
* It is a singleton class, with all game textures.
* We are linking these textures with sprite's (2D) and mesh (3D) materials.
*/
auto& textureRepository = renderer.getTextureRepository();
/**
* Texture is stored in "res" directory.
* Content of "res" directory is automatically copied into
* "bin" directory, which contains our final game.
*
* File utils automatically add's device prefix to the path,
* based on current working directory.
*
* In PS2 world:
* - USB has a "mass:" prefix
* - Our PC in PS2Link has a "host:" prefix
* - Our PC in PCSX2 has a "host:" prefix
*/
auto filepath = FileUtils::fromCwd("atlas.png");
/**
* Tyra supports following PNG formats:
* 32bpp (RGBA)
* 24bpp (RGB)
* 8bpp, palletized (RGBA)
* 4bpp, palletized (RGBA)
*
* 8bpp and 4bpp are the fastest.
* All of these formats can be easily exported via GIMP.
*/
auto* texture = textureRepository.add(filepath);
/** Let's assign this texture to sprite. */
texture->addLink(sprite.id);
spriteFlip.id = sprite.id;
spriteScale.id = sprite.id;
spriteStretch.id = sprite.id;
TYRA_LOG("Texture loaded!");
}
} // namespace Tyra
@@ -0,0 +1,24 @@
TARGET := tutorial_11.elf
ENGINEDIR := ../../engine
#The Directories, Source, Includes, Objects, Binary and Resources
SRCDIR := src
INCDIR := inc
BUILDDIR := obj
TARGETDIR := bin
RESDIR := res
SRCEXT := cpp
VSMEXT := vsm
VCLEXT := vcl
VCLPPEXT := vclpp
DEPEXT := d
OBJEXT := o
#Flags, Libraries and Includes
CFLAGS :=
LIB :=
LIBDIRS :=
INC := -I$(INCDIR)
INCDEP := -I$(INCDIR)
include ../Makefile.tutorials-base
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
@@ -0,0 +1,58 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2024, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Wellington Carvalho <wellcoj@gmail.com>
*/
#pragma once
#include <tyra>
#include <memory>
namespace Tyra {
class Tutorial11 : public Game {
public:
explicit Tutorial11(Engine* engine);
~Tutorial11();
void init();
void loop();
private:
void setDrawData();
void loadBags();
void setTextureRegionRepeat();
void setTextureDefaultWrap();
const u8 MAX_TILES = 4;
u8 TILE_COL = 0;
u8 TILE_ROW = 0;
u8 shouldFlipTextureSettings = false;
float limitTimeToFlip = 2.00f;
float elapsedTime = 0;
Engine* engine;
Vec4 cameraPosition, cameraLookAt;
M4x4 translation, rotation, scale, model;
Texture* UVCheckerTex;
std::array<Vec4, 6> vertices;
std::array<Color, 6> colors;
std::array<Vec4, 6> uvMap;
StaticPipeline stapip;
std::unique_ptr<StaPipBag> bag;
std::unique_ptr<StaPipInfoBag> infoBag;
std::unique_ptr<StaPipColorBag> colorBag;
std::unique_ptr<StaPipTextureBag> texBag;
};
} // namespace Tyra
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
@@ -0,0 +1,4 @@
$ConfigFile = Join-Path $PSScriptRoot '../../windows-pcsx2.ps1'
. $ConfigFile
RunPCSX2
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR" || exit 1
../../linux-pcsx2.sh
@@ -0,0 +1,24 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2024, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Wellington Carvalho <wellcoj@gmail.com>
*/
#include "engine.hpp"
#include "tutorial_11.hpp"
/**
* In this tutorial we will learn:
* - How to use texture in repeate mode of GS
*/
int main() {
Tyra::Engine engine;
Tyra::Tutorial11 game(&engine);
engine.run(&game);
return 0;
}
@@ -0,0 +1,178 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2024, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Wellington Carvalho <wellcoj@gmail.com>
*/
#include <tyra>
#include "tutorial_11.hpp"
namespace Tyra {
Tutorial11::Tutorial11(Engine* t_engine) : engine(t_engine) {
translation = M4x4::Identity;
rotation = M4x4::Identity;
scale = M4x4::Identity;
model = M4x4::Identity;
rotation.rotateY(Math::PI);
}
Tutorial11::~Tutorial11() {}
void Tutorial11::init() {
stapip.setRenderer(&engine->renderer.core);
cameraPosition = Vec4(0.0F, 0.0F, -10.0F);
cameraLookAt.unit();
UVCheckerTex = engine->renderer.getTextureRepository().add(
FileUtils::fromCwd("uv_checker.png"));
setDrawData();
loadBags();
}
void Tutorial11::loop() {
const auto deltaTime =
std::min(1.0f / static_cast<float>(engine->info.getFps()),
static_cast<float>(1.0 / 60.0f));
elapsedTime += deltaTime;
if (elapsedTime > limitTimeToFlip) {
elapsedTime -= limitTimeToFlip;
shouldFlipTextureSettings = !shouldFlipTextureSettings;
shouldFlipTextureSettings ? setTextureRegionRepeat()
: setTextureDefaultWrap();
// Update texture packet info after change wrap settings
engine->renderer.core.texture.updateTextureInfo(UVCheckerTex);
}
model = translation * rotation * scale;
engine->renderer.beginFrame(CameraInfo3D(&cameraPosition, &cameraLookAt));
{
engine->renderer.renderer3D.usePipeline(stapip);
/**
* Lets draw manually via "bags".
* You can do the same thing with dynamic pipeline.
*/
stapip.core.render(bag.get());
}
engine->renderer.endFrame();
}
void Tutorial11::setDrawData() {
vertices = {
// Tri 1
Vec4(-3.0F, -3.0F, 0.0F),
Vec4(3.0F, -3.0F, 0.0F),
Vec4(-3.0F, 3.0F, 0.0F),
// Tri 2
Vec4(3.0F, -3.0F, 0.0F),
Vec4(-3.0F, 3.0F, 0.0F),
Vec4(3.0F, 3.0F, 0.0F),
};
colors = {
Color(128.0F, 128.0F, 128.0F), Color(128.0F, 128.0F, 128.0F),
Color(128.0F, 128.0F, 128.0F), Color(128.0F, 128.0F, 128.0F),
Color(128.0F, 128.0F, 128.0F), Color(128.0F, 128.0F, 128.0F),
};
setTextureDefaultWrap();
}
void Tutorial11::setTextureDefaultWrap() {
uvMap = {Vec4(0.0f, 1.0F, 1.0F, 0.0f), Vec4(0.0f + 1, 1.0F, 1.0F, 0.0f),
Vec4(0.0f, 0.0f, 1.0F, 0.0f),
Vec4(0.0f + 1, 1.0F, 1.0F, 0.0f), Vec4(0.0f, 0.0f, 1.0F, 0.0f),
Vec4(0.0f + 1.0F, 0.0f, 1.0F, 0.0f)};
TYRA_LOG("Reseting texture wrap settings");
UVCheckerTex->setDefaultWrapSettings();
}
void Tutorial11::setTextureRegionRepeat() {
const float _scale = 1.0f / (float)MAX_TILES;
const Vec4 scale =
Vec4(MAX_TILES > 0 ? _scale * MAX_TILES : _scale,
MAX_TILES > 0 ? _scale * MAX_TILES : _scale, 1.0f, 0.0f);
uvMap = {
Vec4(TILE_COL, TILE_ROW + 1.0F, 1.0F, 0.0f) * scale,
Vec4(TILE_COL + 1, TILE_ROW + 1.0F, 1.0F, 0.0f) * scale,
Vec4(TILE_COL, TILE_ROW, 1.0F, 0.0f) * scale,
Vec4(TILE_COL + 1, TILE_ROW + 1.0F, 1.0F, 0.0f) * scale,
Vec4(TILE_COL, TILE_ROW, 1.0F, 0.0f) * scale,
Vec4(TILE_COL + 1.0F, TILE_ROW, 1.0F, 0.0f) * scale,
};
const auto tileW = (UVCheckerTex->getWidth() * _scale) - 1;
const auto tileH = (UVCheckerTex->getHeight() * _scale) - 1;
const auto tileU = TILE_COL * tileW + TILE_COL;
const auto tileV = TILE_ROW * tileH + TILE_ROW;
int minu = tileW;
int minv = tileH;
int maxu = tileU;
int maxv = tileV;
TYRA_LOG("Changing the texture wraping...");
UVCheckerTex->setWrapSettings(TextureWrap::RegionRepeat,
TextureWrap::RegionRepeat, minu, minv, maxu,
maxv);
TILE_COL++;
if (TILE_COL >= MAX_TILES) {
TILE_COL %= MAX_TILES;
TILE_ROW = (TILE_ROW + 1) % MAX_TILES;
}
}
void Tutorial11::loadBags() {
/**
* Create info bag and fill it with model matrix and shading type.
* Keep rest of the options as default.
*/
infoBag = std::make_unique<StaPipInfoBag>();
infoBag->model = &model;
infoBag->shadingType = TyraShadingGouraud;
infoBag->textureMappingType = TyraNearest;
/** Create colors bag and set data pointer */
colorBag = std::make_unique<StaPipColorBag>();
colorBag->many = colors.begin();
texBag = std::make_unique<StaPipTextureBag>();
texBag.get()->texture = UVCheckerTex;
texBag.get()->coordinates = uvMap.data();
/**
* Create main bag and set:
* - vertices data
* - vertices count
* - pointers to other bags
*
* You can add here lighting and texture bag as well.
* If you want to have deeper look of this feature, please
* read static_pipeline.cpp code file.
*/
bag = std::make_unique<StaPipBag>();
bag->color = colorBag.get();
bag->texture = texBag.get();
bag->info = infoBag.get();
bag->vertices = vertices.begin();
bag->count = vertices.size();
}
} // namespace Tyra
+70 -6
View File
@@ -1,12 +1,76 @@
$PCSX2_PATH = "${Env:ProgramFiles(x86)}/PCSX2"
$PCSX2_EXE = 'pcsx2.exe'
# =======================
$CUSTOM_PCSX2_PATH = "" # "D:/My/Path/To/PCSX2"
# =======================
function GetTargetELFName {
return (Select-String -Path './Makefile' -Pattern "[^ ]*.elf").Matches.Value
}
function RunPCSX2 {
$PCSX2_EXE_WITHOUT_EXT = (Split-Path $PCSX2_EXE -Leaf).Split('.')[0]
Stop-Process -Name $PCSX2_EXE_WITHOUT_EXT -ErrorAction 'SilentlyContinue'
Start-Process -FilePath "$PCSX2_PATH/$PCSX2_EXE" -ArgumentList "--elf=$PWD/bin/$(GetTargetELFName)"
function FindPCSX2Directory {
if (-not [string]::IsNullOrEmpty($CUSTOM_PCSX2_PATH)) {
return $CUSTOM_PCSX2_PATH
}
else {
# Try to find in program files
$pcsx2Path = "${Env:ProgramFiles}/PCSX2"
$pcsx2Pathx86 = "${Env:ProgramFiles(x86)}/PCSX2"
if (Test-Path -Path $pcsx2Path) {
return $pcsx2Path
}
elseif (Test-Path -Path $pcsx2Pathx86) {
return $pcsx2Pathx86
}
else {
throw "PCSX2 directory not found!"
return $null
}
}
}
function IsNewQtVersionOfPCSX2 {
param (
[string]$path
)
return Test-Path -Path "$path/qt.conf"
}
function FindPCSX2Executable {
param (
[string]$directory
)
$pcsx2ExePath = Join-Path -Path $directory -ChildPath 'pcsx2.exe'
$pcsx2QtExePath = Join-Path -Path $directory -ChildPath 'pcsx2-qt.exe'
if (Test-Path -Path $pcsx2ExePath) {
return 'pcsx2.exe'
}
elseif (Test-Path -Path $pcsx2QtExePath) {
return 'pcsx2-qt.exe'
}
else {
throw "PCSX2 executable not found in: $directory!"
return $null
}
}
function RunPCSX2 {
$dirPath = FindPCSX2Directory
$isNewVersion = IsNewQtVersionOfPCSX2 -path $dirPath
$executableName = FindPCSX2Executable -directory $dirPath
$executableNameWithoutExt = (Split-Path $executableName -Leaf).Split('.')[0]
$targetFileName = "$PWD/bin/$(GetTargetELFName)"
Stop-Process -Name $executableNameWithoutExt -ErrorAction 'SilentlyContinue'
if ($isNewVersion) {
Start-Process -FilePath "$dirPath/$executableName" -ArgumentList "-elf", $targetFileName
}
else { # Old version of PCSX2
Start-Process -FilePath "$dirPath/$executableName" -ArgumentList "--elf=$targetFileName"
}
}
RunPCSX2