Compare commits
78 Commits
v2.2.0
..
c1d4f7b9db
| Author | SHA1 | Date | |
|---|---|---|---|
|
c1d4f7b9db
|
|||
|
a5e3fc57b3
|
|||
| 92c58f28b8 | |||
| d4dc1ac4c5 | |||
| bf1c41f3e1 | |||
| 92734168a2 | |||
| c0f5f06eb4 | |||
| b7bc5f2f0a | |||
| e8c0cfce1f | |||
| 1e396fb1a3 | |||
| 2b5839a4a8 | |||
| 0810f12949 | |||
| 04d105ca0e | |||
| 93e7aa5e19 | |||
| 3c2ad09870 | |||
| 1dbd2d6a5a | |||
| 4f21626136 | |||
| 50a9070d2d | |||
| 8ed34abb83 | |||
| f6ebd079f5 | |||
| 0f7083aa5b | |||
| 9baad8199a | |||
| 5eafc0bdba | |||
| c3c649dcdc | |||
| 1c4a84dffa | |||
| f727dae150 | |||
| 9b24ea3bb6 | |||
| 586180764e | |||
| a329ea73cc | |||
| 5418e28b73 | |||
| d773173ece | |||
| aa21baaaf2 | |||
| 0c0fcd697f | |||
| e07cfc502a | |||
| ab08a385a6 | |||
| 8642959d70 | |||
| 19ae6de1c7 | |||
| c40558bd54 | |||
| 700e878e61 | |||
| 9ee1df81e6 | |||
| 22ecaffe1b | |||
| 26285c54e9 | |||
| a52e2bec0e | |||
| 5583c7bc92 | |||
| b8e5309119 | |||
| fdc5450181 | |||
| 39a962c59b | |||
| b84bd99059 | |||
| caa0fd4db3 | |||
| daee3b4971 | |||
| 02a23cd415 | |||
| c2e653c059 | |||
| 676ac34ec3 | |||
| e229b34ad3 | |||
| 67f70f80d8 | |||
| 1e046d9dda | |||
| 383cdb3675 | |||
| 795910de69 | |||
| b344fd4141 | |||
| b3ff38af06 | |||
| 19c673767c | |||
| 15a2dbb854 | |||
| f4f527b877 | |||
| ce4e2f663f | |||
| 7736f00d71 | |||
| 878adf5dbb | |||
| d2da130771 | |||
| 588f45e870 | |||
| b19d4f42f5 | |||
| ea5849095e | |||
| e2790d93b6 | |||
| 7401926202 | |||
| 200a68e219 | |||
| 699e5f0ff5 | |||
| 17d2d93d45 | |||
| f546604ba3 | |||
| d196290a3f | |||
| 481ccd0cf9 |
@@ -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
|
||||||
@@ -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 -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: 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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#This is a modified version of the clang format check used on Open-PS2-Loader
|
#This is a modified version of the clang format check used on Open-PS2-Loader
|
||||||
name: CI-cpp-check
|
name: PR C++ format check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -23,6 +23,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-format:
|
check-format:
|
||||||
|
name: Check clang format
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -4,3 +4,4 @@
|
|||||||
/c_cpp_properties.json
|
/c_cpp_properties.json
|
||||||
/tasks.json
|
/tasks.json
|
||||||
/settings.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
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"buildDirectory": "demo",
|
||||||
|
"C_Cpp.default.intelliSenseMode": "gcc-x86",
|
||||||
|
"files.associations": {
|
||||||
|
"*.vcl": "asm-collection",
|
||||||
|
"*.i": "asm-collection",
|
||||||
|
"*.vsm": "asm-collection",
|
||||||
|
"*.vclpp": "asm-collection",
|
||||||
|
"*.hpp": "cpp",
|
||||||
|
"*.cpp": "cpp",
|
||||||
|
"*.h": "c",
|
||||||
|
"*.c": "c"
|
||||||
|
}
|
||||||
|
}
|
||||||
+119
@@ -0,0 +1,119 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build & run",
|
||||||
|
"dependsOrder": "sequence",
|
||||||
|
"dependsOn": [
|
||||||
|
"1. Copy source code to docker volume",
|
||||||
|
"2. Compile via docker container",
|
||||||
|
"3. Copy binaries to host",
|
||||||
|
"4. Run PCSX2"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "1. Copy source code to docker volume",
|
||||||
|
"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-compiler sh -c 'cd ${config:buildDirectory} && make build-engine all'",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"fileLocation": [
|
||||||
|
"autoDetect"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "3. Copy binaries to host",
|
||||||
|
"command": "docker exec -t tyra-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"bin/**\" --exclude=\"*\" /src/ /host/'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "4. Run PCSX2",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${config:buildDirectory}"
|
||||||
|
},
|
||||||
|
"command": "./run.sh"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Convert WAV to ADPCM",
|
||||||
|
"dependsOn": [
|
||||||
|
"1. Copy source code to docker volume"
|
||||||
|
],
|
||||||
|
"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-compiler sh -c 'rm -rf /src/*'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Send to PS2",
|
||||||
|
"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'",
|
||||||
|
"runOptions": {
|
||||||
|
"instanceLimit": 1
|
||||||
|
},
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "new"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Start docker container",
|
||||||
|
"command": "docker compose up -d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Stop docker container",
|
||||||
|
"command": "docker compose down"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "[Debug] Copy obj directory to 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": "demo/res/sound.wav",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "wav2adpcmTarget",
|
||||||
|
"description": "Target file path (ex. ):",
|
||||||
|
"default": "demo/res/sound.adpcm",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ps2Ip",
|
||||||
|
"description": "PS2link ip address:",
|
||||||
|
"default": "192.168.1.200",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "local2Ip",
|
||||||
|
"description": "Local ip address:",
|
||||||
|
"default": "192.168.1.245",
|
||||||
|
"type": "promptString"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"cwd": "${config:buildDirectory}"
|
"cwd": "${config:buildDirectory}"
|
||||||
},
|
},
|
||||||
"command": "./run.ps1"
|
"command": "Start-Job { ./run.ps1 } | Receive-Job -Wait"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
|||||||
+1
-2
@@ -31,8 +31,7 @@ RUN make
|
|||||||
# Download VCL
|
# Download VCL
|
||||||
RUN mkdir -p /temp/vcl
|
RUN mkdir -p /temp/vcl
|
||||||
WORKDIR "/temp/vcl"
|
WORKDIR "/temp/vcl"
|
||||||
RUN wget http://apgcglz.cluster028.hosting.ovh.net/tyra/vcl.zip
|
RUN wget https://github.com/h4570/tyra/raw/master/assets/vcl
|
||||||
RUN unzip vcl.zip
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ IRXEMBEDDEDEXT := irx-em
|
|||||||
CFLAGS += -D_EE -Wall -O3
|
CFLAGS += -D_EE -Wall -O3
|
||||||
LINKFLAGS += -O3 -Wl,-zmax-page-size=128
|
LINKFLAGS += -O3 -Wl,-zmax-page-size=128
|
||||||
ASFLAGS += -O3
|
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
|
INC += -I$(PS2DEV)/ps2sdk/ee/include -I$(PS2DEV)/ps2sdk/common/include -I$(PS2DEV)/ps2sdk/ports/include
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/h4570/tyra">
|
<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>
|
</a>
|
||||||
|
|
||||||
<h3 align="center">Tyra</h3>
|
<h3 align="center">Tyra</h3>
|
||||||
@@ -27,15 +27,12 @@
|
|||||||
</p>
|
</p>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/h4570/tyra/stargazers)
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
* [About the project](#about-the-project)
|
* [About the project](#about-the-project)
|
||||||
* [Description](#description)
|
* [Description](#description)
|
||||||
* [Tutorials](#tutorials)
|
* [Tutorials](#tutorials)
|
||||||
* [Features](#features)
|
* [Features](#features)
|
||||||
* [Branches](#branches)
|
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
* [Games](#games)
|
* [Games](#games)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
@@ -45,8 +42,8 @@
|
|||||||
|
|
||||||
## About the Project
|
## About the Project
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="http://apgcglz.cluster028.hosting.ovh.net/tyra/tyra_code.gif" alt="Sample code" 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="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/showcase.gif " alt="Sample game" width="500" height="auto">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -71,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
|
* 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
|
* 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)
|
* 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)
|
* Demo game - [Code](https://github.com/h4570/tyra/tree/master/demo)
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -99,14 +98,10 @@ Decision was simple - I need to create an engine which will handle 3D file loadi
|
|||||||
* `.md2` 3D file support
|
* `.md2` 3D file support
|
||||||
* `.png` Texture file support
|
* `.png` Texture file support
|
||||||
|
|
||||||
### Branches
|
## Contributing
|
||||||
* `master` - stable releases - tested on PS2 & PCSX2.
|
|
||||||
* `develop` - daily builds.
|
|
||||||
|
|
||||||
See the [open issues](https://github.com/h4570/tyra/issues) for a list of proposed features (and known issues).
|
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**.
|
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
|
1. Fork the Project
|
||||||
@@ -121,6 +116,7 @@ List of games developed with Tyra.
|
|||||||
If you created one, please contact me - I will add it to the list :)
|
If you created one, please contact me - I will add it to the list :)
|
||||||
|
|
||||||
* [Tyracraft](https://github.com/Wellinator/tyracraft) by [Wellinator](https://github.com/Wellinator)
|
* [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)
|
* [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)
|
* [TyraTale](https://github.com/Br4k2n/TyraTale) by [Br4k2n](https://github.com/Br4k2n)
|
||||||
|
|
||||||
@@ -147,7 +143,7 @@ Distributed under the Apache License 2.0 License. See `LICENSE` for more informa
|
|||||||
Without these guys, Tyra would not happen:
|
Without these guys, Tyra would not happen:
|
||||||
* [Dr Henry Fortuna](http://ps2-edu.tensioncore.com/index.html) - for code sources, PS2 academy tutorials
|
* [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!
|
* 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/wolfysdl) - for testing, contributing to Tyra and sharing cool ideas!
|
* [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!)
|
* [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
|
* [Lukasz D.K.](https://github.com/lukaszdk) - for huge archive of PS2 stuff
|
||||||
* [Guilherme Lampert](https://github.com/glampert) - for code sources
|
* [Guilherme Lampert](https://github.com/glampert) - for code sources
|
||||||
@@ -156,12 +152,12 @@ Without these guys, Tyra would not happen:
|
|||||||
* And so many other guys. Thanks!
|
* And so many other guys. Thanks!
|
||||||
|
|
||||||
Project Link: [https://github.com/h4570/tyra](https://github.com/h4570/tyra)
|
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)
|
[![LinkedIn][linkedin-shield]](https://linkedin.com/in/sandro-sobczyński-28820b15a)
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<a href="https://github.com/h4570/tyra">
|
<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>
|
</a>
|
||||||
|
|
||||||
[contributors-shield]: https://img.shields.io/github/contributors/h4570/tyra.svg?style=flat-square
|
[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
Binary file not shown.
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../linux-pcsx2.sh
|
||||||
+1
-1
@@ -11,4 +11,4 @@ services:
|
|||||||
container_name: tyra-compiler
|
container_name: tyra-compiler
|
||||||
volumes:
|
volumes:
|
||||||
- tyra-volume:/src
|
- tyra-volume:/src
|
||||||
- ./:/host
|
- ./:/host:z
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
1. Git
|
1. Git
|
||||||
2. VSCode
|
2. VSCode
|
||||||
3. Docker with PowerShell as a default terminal
|
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#)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+15
-11
@@ -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`
|
- Extract bios files from https://romsmania.cc/bios/pcsx2-playstation-2-bios-3 to `%UserProfile%\Documents\PCSX2\bios`
|
||||||
- Close `PCSX2` if you have opened!
|
- Map pad to your keyboard, for example:
|
||||||
- Open `%UserProfile%\Documents\PCSX2\inis\PCSX2_vm.ini` in notepad
|
|
||||||
|
|
||||||
```
|
|
||||||
HostFs=enabled
|
|
||||||
```
|
|
||||||
|
|
||||||
- Open PCSX2 and map pad to your keyboard, for example:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
WASD = Left joy
|
WASD = Left joy
|
||||||
@@ -18,4 +12,14 @@ Space = X
|
|||||||
Circle = C
|
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
@@ -20,6 +20,7 @@
|
|||||||
#else // IF Debug
|
#else // IF Debug
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <debug.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -48,9 +49,7 @@ class TyraDebug {
|
|||||||
(void)expander{0, (void(ss << std::forward<Args>(args)), 0)...};
|
(void)expander{0, (void(ss << std::forward<Args>(args)), 0)...};
|
||||||
|
|
||||||
if (Tyra::Info::writeLogsToFile) {
|
if (Tyra::Info::writeLogsToFile) {
|
||||||
auto* logFile = getLogFile();
|
writeInLogFile(&ss);
|
||||||
*logFile << ss.str();
|
|
||||||
logFile->flush();
|
|
||||||
} else {
|
} else {
|
||||||
printf("%s", ss.str().c_str());
|
printf("%s", ss.str().c_str());
|
||||||
}
|
}
|
||||||
@@ -65,9 +64,7 @@ class TyraDebug {
|
|||||||
ss1 << "|\n";
|
ss1 << "|\n";
|
||||||
|
|
||||||
if (Tyra::Info::writeLogsToFile) {
|
if (Tyra::Info::writeLogsToFile) {
|
||||||
auto* logFile = getLogFile();
|
writeInLogFile(&ss1);
|
||||||
*logFile << ss1.str();
|
|
||||||
logFile->flush();
|
|
||||||
} else {
|
} else {
|
||||||
printf("%s", ss1.str().c_str());
|
printf("%s", ss1.str().c_str());
|
||||||
}
|
}
|
||||||
@@ -80,20 +77,22 @@ class TyraDebug {
|
|||||||
ss2 << "====================================\n\n";
|
ss2 << "====================================\n\n";
|
||||||
|
|
||||||
if (Tyra::Info::writeLogsToFile) {
|
if (Tyra::Info::writeLogsToFile) {
|
||||||
auto* logFile = getLogFile();
|
writeInLogFile(&ss2);
|
||||||
*logFile << ss2.str();
|
|
||||||
logFile->flush();
|
|
||||||
} else {
|
} else {
|
||||||
printf("%s", ss2.str().c_str());
|
printf("%s", ss2.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init_scr();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
scr_setXY(20, 10);
|
||||||
|
scr_printf(ss1.str().c_str());
|
||||||
|
writeAssertLinesInScreen(args...);
|
||||||
|
scr_printf(ss2.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::unique_ptr<std::ofstream> logFile;
|
static void writeInLogFile(std::stringstream* ss);
|
||||||
static std::ofstream* getLogFile();
|
|
||||||
|
|
||||||
template <typename Arg, typename... Args>
|
template <typename Arg, typename... Args>
|
||||||
static void writeAssertLines(Arg&& arg, Args&&... args) {
|
static void writeAssertLines(Arg&& arg, Args&&... args) {
|
||||||
@@ -105,13 +104,23 @@ class TyraDebug {
|
|||||||
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};
|
0, (void(ss << "| " << std::forward<Args>(args) << "\n"), 0)...};
|
||||||
|
|
||||||
if (Tyra::Info::writeLogsToFile) {
|
if (Tyra::Info::writeLogsToFile) {
|
||||||
auto* logfile = getLogFile();
|
writeInLogFile(&ss);
|
||||||
*logfile << ss.str();
|
|
||||||
logFile->flush();
|
|
||||||
} else {
|
} else {
|
||||||
printf("%s", ss.str().c_str());
|
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
|
#endif // NDEBUG
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <syslimits.h>
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
@@ -42,9 +44,9 @@ class FileUtils {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Argv name+path & just path
|
// Argv name+path & just path
|
||||||
char cwd[255];
|
char cwd[NAME_MAX];
|
||||||
char elfName[255];
|
char elfName[NAME_MAX];
|
||||||
char elfPath[255 - 14];
|
char elfPath[NAME_MAX - 14];
|
||||||
|
|
||||||
void setPathInfo(const char* path);
|
void setPathInfo(const char* path);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class IrxLoader {
|
|||||||
void loadSio2man(const bool& verbose);
|
void loadSio2man(const bool& verbose);
|
||||||
void loadPadman(const bool& verbose);
|
void loadPadman(const bool& verbose);
|
||||||
void loadLibsd(const bool& verbose);
|
void loadLibsd(const bool& verbose);
|
||||||
|
void loadIO(const bool& verbose);
|
||||||
void loadUsbModules(const bool& verbose);
|
void loadUsbModules(const bool& verbose);
|
||||||
void loadAudsrv(const bool& verbose);
|
void loadAudsrv(const bool& verbose);
|
||||||
|
|
||||||
|
|||||||
@@ -33,4 +33,5 @@ class TextureBuilderData {
|
|||||||
TextureBpp clutBpp;
|
TextureBpp clutBpp;
|
||||||
unsigned char clutGsComponents;
|
unsigned char clutGsComponents;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ class Math {
|
|||||||
static int randomi(const int& min, const int& max);
|
static int randomi(const int& min, const int& max);
|
||||||
static bool equalf(const float& a, const float& b,
|
static bool equalf(const float& a, const float& b,
|
||||||
const float& epsilon = 0.00001F);
|
const float& epsilon = 0.00001F);
|
||||||
|
|
||||||
private:
|
|
||||||
Math();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ class Texture {
|
|||||||
|
|
||||||
/** Set texture wrapping */
|
/** Set texture wrapping */
|
||||||
void setWrapSettings(const TextureWrap t_horizontal,
|
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
|
// Other
|
||||||
@@ -96,9 +97,10 @@ class Texture {
|
|||||||
void print(const std::string& name) const { print(name.c_str()); }
|
void print(const std::string& name) const { print(name.c_str()); }
|
||||||
std::string getPrint(const char* name = nullptr) const;
|
std::string getPrint(const char* name = nullptr) const;
|
||||||
|
|
||||||
|
void setDefaultWrapSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setPsm();
|
void setPsm();
|
||||||
void setDefaultWrapSettings();
|
|
||||||
|
|
||||||
texwrap_t wrap;
|
texwrap_t wrap;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ class RendererCoreTexture {
|
|||||||
|
|
||||||
RendererCoreTextureBuffers useTexture(const Texture* t_tex);
|
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 */
|
/** Called by renderer during initialization */
|
||||||
void init(RendererCoreGS* gs, Path3* path3);
|
void init(RendererCoreGS* gs, Path3* path3);
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "./models/texture.hpp"
|
#include "./models/texture.hpp"
|
||||||
#include "renderer/3d/mesh/mesh.hpp"
|
#include "renderer/3d/mesh/mesh.hpp"
|
||||||
#include "renderer/core/2d/sprite/sprite.hpp"
|
#include "renderer/core/2d/sprite/sprite.hpp"
|
||||||
|
#include "./renderer_core_texture_buffers.hpp"
|
||||||
#include "loaders/texture/base/texture_loader_selector.hpp"
|
#include "loaders/texture/base/texture_loader_selector.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -25,6 +26,8 @@ class TextureRepository {
|
|||||||
TextureRepository();
|
TextureRepository();
|
||||||
~TextureRepository();
|
~TextureRepository();
|
||||||
|
|
||||||
|
void init(std::vector<RendererCoreTextureBuffers>* textureBuffers);
|
||||||
|
|
||||||
/** Returns all repository textures. */
|
/** Returns all repository textures. */
|
||||||
std::vector<Texture*>* getAll() { return &textures; }
|
std::vector<Texture*>* getAll() { return &textures; }
|
||||||
|
|
||||||
@@ -99,6 +102,13 @@ class TextureRepository {
|
|||||||
void freeByMesh(const Mesh& mesh);
|
void freeByMesh(const Mesh& mesh);
|
||||||
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.
|
* Remove texture from repository.
|
||||||
* Texture is NOT destructed.
|
* Texture is NOT destructed.
|
||||||
@@ -110,6 +120,7 @@ class TextureRepository {
|
|||||||
void removeByIndex(const u32& t_index);
|
void removeByIndex(const u32& t_index);
|
||||||
|
|
||||||
std::vector<Texture*> textures;
|
std::vector<Texture*> textures;
|
||||||
|
std::vector<RendererCoreTextureBuffers>* textureBuffers;
|
||||||
TextureLoaderSelector texLoaderSelector;
|
TextureLoaderSelector texLoaderSelector;
|
||||||
};
|
};
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ void AudioSong::work() {
|
|||||||
|
|
||||||
if (chunkReadStatus > 0) {
|
if (chunkReadStatus > 0) {
|
||||||
WaitSema(fillbufferSema); // wait until previous chunk wasn't finished
|
WaitSema(fillbufferSema); // wait until previous chunk wasn't finished
|
||||||
|
audsrv_wait_audio(chunkReadStatus);
|
||||||
audsrv_play_audio(chunk, chunkReadStatus);
|
audsrv_play_audio(chunk, chunkReadStatus);
|
||||||
for (u32 i = 0; i < getListenersCount(); i++)
|
for (u32 i = 0; i < getListenersCount(); i++)
|
||||||
songListeners[i]->listener->onAudioTick();
|
songListeners[i]->listener->onAudioTick();
|
||||||
|
|||||||
@@ -10,16 +10,11 @@
|
|||||||
|
|
||||||
#include "debug/debug.hpp"
|
#include "debug/debug.hpp"
|
||||||
|
|
||||||
std::unique_ptr<std::ofstream> TyraDebug::logFile;
|
void TyraDebug::writeInLogFile(std::stringstream* ss) {
|
||||||
|
std::ofstream logFile;
|
||||||
std::ofstream* TyraDebug::getLogFile() {
|
logFile.open(Tyra::FileUtils::fromCwd("log.txt"),
|
||||||
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);
|
std::ofstream::out | std::ofstream::app);
|
||||||
return logFile.get();
|
logFile << ss->str();
|
||||||
|
logFile.flush();
|
||||||
|
// logFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tyra
|
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
#include <tamtypes.h>
|
#include <tamtypes.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <limits.h>
|
|
||||||
#include <syslimits.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "file/file_utils.hpp"
|
#include "file/file_utils.hpp"
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
$PS2SDK/iop/irx/fileXio.irx
|
||||||
|
fileXio_irx
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
$PS2SDK/iop/irx/iomanX.irx
|
||||||
|
iomanX_irx
|
||||||
@@ -20,30 +20,20 @@
|
|||||||
#include "file/file_utils.hpp"
|
#include "file/file_utils.hpp"
|
||||||
|
|
||||||
// external IRX modules
|
// external IRX modules
|
||||||
|
#define EXTERN_IRX(_irx) \
|
||||||
|
extern u8 _irx[]; \
|
||||||
|
extern int size_##_irx
|
||||||
|
|
||||||
extern u8 sio2man_irx[];
|
EXTERN_IRX(sio2man_irx);
|
||||||
extern int size_sio2man_irx;
|
EXTERN_IRX(padman_irx);
|
||||||
|
EXTERN_IRX(audsrv_irx);
|
||||||
extern u8 padman_irx[];
|
EXTERN_IRX(libsd_irx);
|
||||||
extern int size_padman_irx;
|
EXTERN_IRX(fileXio_irx);
|
||||||
|
EXTERN_IRX(iomanX_irx);
|
||||||
extern u8 audsrv_irx[];
|
EXTERN_IRX(bdm_irx);
|
||||||
extern int size_audsrv_irx;
|
EXTERN_IRX(bdmfs_fatfs_irx);
|
||||||
|
EXTERN_IRX(usbd_irx);
|
||||||
extern u8 libsd_irx[];
|
EXTERN_IRX(usbmass_bd_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;
|
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
@@ -70,6 +60,7 @@ void IrxLoader::loadAll(const bool& withUsb, const bool& isLoggingToFile) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadIO(!isLoggingToFile);
|
||||||
loadSio2man(!isLoggingToFile);
|
loadSio2man(!isLoggingToFile);
|
||||||
loadPadman(!isLoggingToFile);
|
loadPadman(!isLoggingToFile);
|
||||||
loadLibsd(!isLoggingToFile);
|
loadLibsd(!isLoggingToFile);
|
||||||
@@ -116,6 +107,24 @@ void IrxLoader::loadLibsd(const bool& verbose) {
|
|||||||
if (verbose) TYRA_LOG("IRX: Libsd loaded!");
|
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) {
|
void IrxLoader::loadUsbModules(const bool& verbose) {
|
||||||
if (verbose) TYRA_LOG("IRX: Loading usb modules...");
|
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);
|
auto* pixel = static_cast<unsigned char*>(result->data);
|
||||||
struct PngClut* clut = (struct PngClut*)result->clut;
|
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++) {
|
for (int i = 0; i < numPallete; i++) {
|
||||||
clut[i].r = palette[i].red;
|
clut[i].r = palette[i].red;
|
||||||
clut[i].g = palette[i].green;
|
clut[i].g = palette[i].green;
|
||||||
@@ -273,10 +269,6 @@ void PngLoader::handle4bppPalletized(TextureBuilderData* result,
|
|||||||
auto* pixel = static_cast<unsigned char*>(result->data);
|
auto* pixel = static_cast<unsigned char*>(result->data);
|
||||||
struct PngClut* clut = (struct PngClut*)result->clut;
|
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++) {
|
for (int i = 0; i < numPallete; i++) {
|
||||||
clut[i].r = palette[i].red;
|
clut[i].r = palette[i].red;
|
||||||
clut[i].g = palette[i].green;
|
clut[i].g = palette[i].green;
|
||||||
|
|||||||
@@ -189,6 +189,8 @@ void DynPipRenderer::addBufferDataToPacket(DynPipBag** bags, const u32& count) {
|
|||||||
|
|
||||||
void DynPipRenderer::sendPacket() {
|
void DynPipRenderer::sendPacket() {
|
||||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
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_wait_fast(); // This have no impact on performance
|
||||||
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
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);
|
packet2_utils_vu_add_end_tag(currentPacket);
|
||||||
|
|
||||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
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_wait_fast(); // This have no impact on performance
|
||||||
|
|
||||||
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
||||||
|
|||||||
@@ -365,6 +365,8 @@ void StaPipQBufferRenderer::sendPacket() {
|
|||||||
"Packet is too big. Internal error");
|
"Packet is too big. Internal error");
|
||||||
|
|
||||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
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_wait_fast(); // This have no impact on performance
|
||||||
|
|
||||||
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
||||||
|
|||||||
@@ -65,20 +65,20 @@ void Path3::sendTexture(const Texture* texture,
|
|||||||
const RendererCoreTextureBuffers& texBuffers) {
|
const RendererCoreTextureBuffers& texBuffers) {
|
||||||
packet2_reset(texturePacket, false);
|
packet2_reset(texturePacket, false);
|
||||||
|
|
||||||
int coreWidth = texBuffers.core->width <= 64 ? 64 : texBuffers.core->width;
|
packet2_update(
|
||||||
packet2_update(texturePacket,
|
texturePacket,
|
||||||
draw_texture_transfer(texturePacket->base, texture->core->data,
|
draw_texture_transfer(texturePacket->base, texture->core->data,
|
||||||
texture->getWidth(),
|
texture->getWidth(), texture->getHeight(),
|
||||||
texture->getHeight(), texture->core->psm,
|
texture->core->psm, texBuffers.core->address,
|
||||||
texBuffers.core->address, coreWidth));
|
texBuffers.core->width));
|
||||||
|
|
||||||
if (texBuffers.clut != nullptr) {
|
if (texBuffers.clut != nullptr) {
|
||||||
auto* clut = texture->clut;
|
auto* clut = texture->clut;
|
||||||
int clutWidth = texBuffers.clut->width <= 64 ? 64 : texBuffers.clut->width;
|
packet2_update(
|
||||||
packet2_update(texturePacket,
|
texturePacket,
|
||||||
draw_texture_transfer(texturePacket->next, clut->data,
|
draw_texture_transfer(texturePacket->next, clut->data, clut->width,
|
||||||
clut->width, clut->height, clut->psm,
|
clut->height, clut->psm, texBuffers.clut->address,
|
||||||
texBuffers.clut->address, clutWidth));
|
texBuffers.clut->width));
|
||||||
}
|
}
|
||||||
|
|
||||||
packet2_chain_open_cnt(texturePacket, 0, 0, 0);
|
packet2_chain_open_cnt(texturePacket, 0, 0, 0);
|
||||||
|
|||||||
@@ -19,8 +19,18 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
|
namespace TyraTexture {
|
||||||
|
u32 textureCounter = 1;
|
||||||
|
std::vector<u32> deletedIDs;
|
||||||
|
} // namespace TyraTexture
|
||||||
|
|
||||||
Texture::Texture(TextureBuilderData* t_data) {
|
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;
|
name = t_data->name;
|
||||||
|
|
||||||
@@ -50,6 +60,7 @@ Texture::Texture(TextureBuilderData* t_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Texture::~Texture() {
|
Texture::~Texture() {
|
||||||
|
TyraTexture::deletedIDs.push_back(id);
|
||||||
if (links.size() > 0) links.clear();
|
if (links.size() > 0) links.clear();
|
||||||
if (core) delete core;
|
if (core) delete core;
|
||||||
if (clut) delete clut;
|
if (clut) delete clut;
|
||||||
@@ -167,9 +178,14 @@ void Texture::setDefaultWrapSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Texture::setWrapSettings(const TextureWrap t_horizontal,
|
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.horizontal = t_horizontal;
|
||||||
wrap.vertical = t_vertical;
|
wrap.vertical = t_vertical;
|
||||||
|
wrap.minu = minu;
|
||||||
|
wrap.minv = minv;
|
||||||
|
wrap.maxu = maxu;
|
||||||
|
wrap.maxv = maxv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::addLink(const u32& t_id) {
|
void Texture::addLink(const u32& t_id) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ RendererCoreTexture::~RendererCoreTexture() {}
|
|||||||
void RendererCoreTexture::init(RendererCoreGS* t_gs, Path3* t_path3) {
|
void RendererCoreTexture::init(RendererCoreGS* t_gs, Path3* t_path3) {
|
||||||
gs = t_gs;
|
gs = t_gs;
|
||||||
sender.init(t_path3, t_gs);
|
sender.init(t_path3, t_gs);
|
||||||
|
repository.init(¤tAllocations);
|
||||||
path3 = t_path3;
|
path3 = t_path3;
|
||||||
initClut();
|
initClut();
|
||||||
}
|
}
|
||||||
@@ -56,6 +57,17 @@ RendererCoreTextureBuffers RendererCoreTexture::useTexture(
|
|||||||
return newTexBuffer;
|
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(
|
RendererCoreTextureBuffers RendererCoreTexture::getAllocatedBuffersByTextureId(
|
||||||
const u32& t_id) {
|
const u32& t_id) {
|
||||||
for (u32 i = 0; i < currentAllocations.size(); i++)
|
for (u32 i = 0; i < currentAllocations.size(); i++)
|
||||||
|
|||||||
@@ -58,7 +58,19 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureCore(
|
|||||||
auto* result = new texbuffer_t;
|
auto* result = new texbuffer_t;
|
||||||
const auto* core = t_texture->core;
|
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->psm = core->psm;
|
||||||
result->info.components = core->components;
|
result->info.components = core->components;
|
||||||
|
|
||||||
@@ -77,7 +89,9 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureClut(
|
|||||||
auto* result = new texbuffer_t;
|
auto* result = new texbuffer_t;
|
||||||
const auto* clut = t_texture->clut;
|
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->psm = clut->psm;
|
||||||
result->info.components = clut->components;
|
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 {
|
Texture* TextureRepository::getBySpriteId(const u32& t_id) const {
|
||||||
for (u32 i = 0; i < textures.size(); i++) {
|
for (u32 i = 0; i < textures.size(); i++) {
|
||||||
if (textures[i]->isLinkedWith(t_id)) return textures[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);
|
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) {
|
void TextureRepository::removeById(const u32& t_texId) {
|
||||||
s32 index = getIndexOf(t_texId);
|
s32 index = getIndexOf(t_texId);
|
||||||
TYRA_ASSERT(index != -1, "Cant remove texture, because it was not found!");
|
TYRA_ASSERT(index != -1, "Cant remove texture, because it was not found!");
|
||||||
removeByIndex(index);
|
removeByIndex(index);
|
||||||
|
removeBufferId(t_texId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureRepository::freeByMesh(const Mesh& mesh) {
|
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!");
|
TYRA_ASSERT(index != -1, "Cant remove texture, because it was not found!");
|
||||||
removeByIndex(index);
|
removeByIndex(index);
|
||||||
|
removeBufferId(t_texId);
|
||||||
|
|
||||||
delete tex;
|
delete tex;
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+74
@@ -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
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"buildDirectory": "./",
|
||||||
|
"C_Cpp.default.intelliSenseMode": "gcc-x86",
|
||||||
|
"files.associations": {
|
||||||
|
"*.vcl": "asm-collection",
|
||||||
|
"*.i": "asm-collection",
|
||||||
|
"*.vsm": "asm-collection",
|
||||||
|
"*.vclpp": "asm-collection",
|
||||||
|
"*.hpp": "cpp",
|
||||||
|
"*.cpp": "cpp",
|
||||||
|
"*.h": "c",
|
||||||
|
"*.c": "c"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build & run",
|
||||||
|
"dependsOrder": "sequence",
|
||||||
|
"dependsOn": [
|
||||||
|
"1. Copy source code to docker volume",
|
||||||
|
"2. Compile via docker container",
|
||||||
|
"3. Copy binaries to host",
|
||||||
|
"4. Run PCSX2"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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/'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "2. Compile via docker container",
|
||||||
|
"command": "docker exec -t tyra-game-compiler sh -c 'cd ${config:buildDirectory} && make'",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"fileLocation": [
|
||||||
|
"autoDetect"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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/'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "4. Run PCSX2",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${config:buildDirectory}"
|
||||||
|
},
|
||||||
|
"command": "./run.ps1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Convert WAV to ADPCM",
|
||||||
|
"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}'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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\")'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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'",
|
||||||
|
"runOptions": {
|
||||||
|
"instanceLimit": 1
|
||||||
|
},
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "new"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Start docker container",
|
||||||
|
"command": "docker compose up -d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Stop docker container",
|
||||||
|
"command": "docker compose down"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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/'"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"id": "wav2adpcmSource",
|
||||||
|
"description": "Source file path (ex. ):",
|
||||||
|
"default": "res/sound.wav",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "wav2adpcmTarget",
|
||||||
|
"description": "Target file path (ex. ):",
|
||||||
|
"default": "res/sound.adpcm",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ps2Ip",
|
||||||
|
"description": "PS2link ip address:",
|
||||||
|
"default": "192.168.1.200",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "local2Ip",
|
||||||
|
"description": "Local ip address:",
|
||||||
|
"default": "192.168.1.245",
|
||||||
|
"type": "promptString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tyraBranch",
|
||||||
|
"description": "Tyra branch:",
|
||||||
|
"default": "master",
|
||||||
|
"type": "promptString"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "1. Copy source code to docker volume",
|
"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-game-compiler sh -c 'rsync -ac --delete --exclude=\".git\" --exclude=\".vscode\" --exclude=\"*obj*/**\" --exclude=\"*bin*/**\" /host/ /src/'"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "3. Copy binaries to host",
|
"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-game-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"*bin*/**\" --exclude=\"*\" /src/ /host/'"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
|
|||||||
Executable
+77
@@ -0,0 +1,77 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# =======================
|
||||||
|
CUSTOM_PCSX2_PATH="" # e.g. "/usr/bin/pcsx2" or "flatpak run net.pcsx2.PCSX2"
|
||||||
|
# =======================
|
||||||
|
|
||||||
|
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
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
./linux-pcsx2.sh
|
||||||
@@ -1,12 +1,76 @@
|
|||||||
$PCSX2_PATH = "${Env:ProgramFiles(x86)}/PCSX2"
|
# =======================
|
||||||
$PCSX2_EXE = 'pcsx2.exe'
|
$CUSTOM_PCSX2_PATH = "" # "D:/My/Path/To/PCSX2"
|
||||||
|
# =======================
|
||||||
|
|
||||||
function GetTargetELFName {
|
function GetTargetELFName {
|
||||||
return (Select-String -Path './Makefile' -Pattern "[^ ]*.elf").Matches.Value
|
return (Select-String -Path './Makefile' -Pattern "[^ ]*.elf").Matches.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
function RunPCSX2 {
|
function FindPCSX2Directory {
|
||||||
$PCSX2_EXE_WITHOUT_EXT = (Split-Path $PCSX2_EXE -Leaf).Split('.')[0]
|
if (-not [string]::IsNullOrEmpty($CUSTOM_PCSX2_PATH)) {
|
||||||
Stop-Process -Name $PCSX2_EXE_WITHOUT_EXT -ErrorAction 'SilentlyContinue'
|
return $CUSTOM_PCSX2_PATH
|
||||||
Start-Process -FilePath "$PCSX2_PATH/$PCSX2_EXE" -ArgumentList "--elf=$PWD/bin/$(GetTargetELFName)"
|
|
||||||
}
|
}
|
||||||
|
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
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
|
cd "$SCRIPT_DIR" || exit 1
|
||||||
|
../../linux-pcsx2.sh
|
||||||
@@ -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
|
||||||
Executable
+4
@@ -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
@@ -1,12 +1,76 @@
|
|||||||
$PCSX2_PATH = "${Env:ProgramFiles(x86)}/PCSX2"
|
# =======================
|
||||||
$PCSX2_EXE = 'pcsx2.exe'
|
$CUSTOM_PCSX2_PATH = "" # "D:/My/Path/To/PCSX2"
|
||||||
|
# =======================
|
||||||
|
|
||||||
function GetTargetELFName {
|
function GetTargetELFName {
|
||||||
return (Select-String -Path './Makefile' -Pattern "[^ ]*.elf").Matches.Value
|
return (Select-String -Path './Makefile' -Pattern "[^ ]*.elf").Matches.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
function RunPCSX2 {
|
function FindPCSX2Directory {
|
||||||
$PCSX2_EXE_WITHOUT_EXT = (Split-Path $PCSX2_EXE -Leaf).Split('.')[0]
|
if (-not [string]::IsNullOrEmpty($CUSTOM_PCSX2_PATH)) {
|
||||||
Stop-Process -Name $PCSX2_EXE_WITHOUT_EXT -ErrorAction 'SilentlyContinue'
|
return $CUSTOM_PCSX2_PATH
|
||||||
Start-Process -FilePath "$PCSX2_PATH/$PCSX2_EXE" -ArgumentList "--elf=$PWD/bin/$(GetTargetELFName)"
|
|
||||||
}
|
}
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user