PS1: Slightly optimise rendering (9 to 13 FPS)

This commit is contained in:
UnknownShadow200 2024-06-30 09:30:18 +10:00
parent 39e5b04a4d
commit 1caf0fa518
28 changed files with 425 additions and 224 deletions

View file

@ -19,7 +19,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install prerequisites
run: apt install wget unzip
run: |
apt-get update
apt-get -y install zip wget
- name: Retrieve OpenGL and X11 dev files (64 bit)
run: |
mkdir src/netbsd64

View file

@ -39,23 +39,23 @@ jobs:
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.elf'
SOURCE_FILE: 'misc/ps1/build/ClassiCube.elf'
DEST_NAME: 'ClassiCube-PS1.elf'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.exe'
SOURCE_FILE: 'misc/ps1/build/ClassiCube.exe'
DEST_NAME: 'ClassiCube-PS1.exe'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.bin'
SOURCE_FILE: 'misc/ps1/build/ClassiCube.bin'
DEST_NAME: 'ClassiCube-PS1.bin'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'misc/ps1/build/template.cue'
SOURCE_FILE: 'misc/ps1/build/ClassiCube.cue'
DEST_NAME: 'ClassiCube-PS1.cue'

View file

@ -1,64 +0,0 @@
from http.server import HTTPServer, SimpleHTTPRequestHandler
import os
import subprocess
build_files = {
'/ClassiCube.exe' : 'cc-w32-d3d.exe', '/ClassiCube.opengl.exe' : 'cc-w32-ogl.exe',
'/ClassiCube.64.exe' : 'cc-w64-d3d.exe', '/ClassiCube.64-opengl.exe' : 'cc-w64-ogl.exe',
'/ClassiCube.32' : 'cc-nix32', '/ClassiCube' : 'cc-nix64',
'/ClassiCube.osx' : 'cc-osx32', '/ClassiCube.64.osx' : 'cc-osx64',
'/ClassiCube.js' : 'cc.js', '/ClassiCube.apk' : 'cc.apk',
'/ClassiCube.rpi' : 'cc-rpi',
'/cc-nix32-gl2' : 'cc-nix32-gl2', '/cc-nix64-gl2' : 'cc-nix64-gl2',
'/cc-osx32-gl2' : 'cc-osx32-gl2', '/cc-osx64-gl2' : 'cc-osx64-gl2',
}
release_files = {
'/win32' : 'win32/ClassiCube.exe', '/win64' : 'win64/ClassiCube.exe',
'/osx32' : 'osx32/ClassiCube.tar.gz', '/osx64' : 'osx64/ClassiCube.tar.gz',
'/mac32' : 'mac32/ClassiCube.tar.gz', '/mac64' : 'mac64/ClassiCube.tar.gz',
'/nix32' : 'nix32/ClassiCube.tar.gz', '/nix64' : 'nix64/ClassiCube.tar.gz',
'/rpi32' : 'rpi32/ClassiCube.tar.gz',
}
def run_script(file):
args = ["sh", file]
su = subprocess.Popen(args)
return su.wait()
class Handler(SimpleHTTPRequestHandler):
def serve_script(self, file, msg):
ret = run_script(file)
self.send_response(200)
self.end_headers()
self.wfile.write(msg % ret)
def do_GET(self):
if self.path in build_files:
self.serve_exe('client/src/' + build_files[self.path])
elif self.path in release_files:
self.serve_exe('client/release/' + release_files[self.path])
elif self.path == '/rebuild':
self.serve_script('build.sh', 'Rebuild client (%s)')
elif self.path == '/release':
self.serve_script('build_release.sh', 'Package release (%s)')
else:
self.send_error(404, "Unknown action")
return
def serve_exe(self, path):
try:
f = open(path, 'rb')
fs = os.fstat(f.fileno())
self.send_response(200)
self.send_header("Content-type", "application/octet-stream")
self.send_header("Content-Length", str(fs[6]))
self.end_headers()
self.copyfile(f, self.wfile)
f.close()
except IOError:
self.send_error(404, "File not found")
httpd = HTTPServer(('', 80), Handler)
httpd.serve_forever()

View file

@ -1,60 +0,0 @@
#!/bin/bash
# paths, change these as needed
SOURCE_DIR=~/client/src
MISC_DIR=~/client/misc
BUILDS_DIR=~/client/release
# ./ClassiCube
make_nix_tar() {
cp $SOURCE_DIR/$1 ClassiCube
chmod +x ClassiCube
tar -zcvf ClassiCube.tar.gz ClassiCube
rm ClassiCube
}
# ./ClassiCube.app/Info.plist
# ./ClassiCube.app/Contents/MacOS/ClassiCube
# ./ClassiCube.app/Resources/ClassiCube.icns
make_mac_tar() {
mkdir ClassiCube.app
mkdir ClassiCube.app/Contents
mkdir ClassiCube.app/Contents/MacOS
mkdir ClassiCube.app/Contents/Resources
cp $SOURCE_DIR/$1 ClassiCube.app/Contents/MacOS/ClassiCube
chmod +x ClassiCube.app/Contents/MacOS/ClassiCube
cp $MISC_DIR/info.plist ClassiCube.app/Contents/Info.plist
cp $MISC_DIR/CCIcon.icns ClassiCube.app/Contents/Resources/ClassiCube.icns
tar -zcvf ClassiCube.tar.gz ClassiCube.app
rm -rf ClassiCube.app
}
mkdir -p $BUILDS_DIR
mkdir -p $BUILDS_DIR/win32 $BUILDS_DIR/win64 $BUILDS_DIR/osx32 $BUILDS_DIR/osx64
mkdir -p $BUILDS_DIR/nix32 $BUILDS_DIR/nix64 $BUILDS_DIR/mac32 $BUILDS_DIR/mac64
mkdir -p $BUILDS_DIR/rpi32
# edge doesn't respect download attribute, and having ClassiCube.64.exe breaks plugins
cp $SOURCE_DIR/cc-w32-d3d.exe $BUILDS_DIR/win32/ClassiCube.exe
cp $SOURCE_DIR/cc-w64-d3d.exe $BUILDS_DIR/win64/ClassiCube.exe
# use tar to preserve chmod +x, so users don't have to manually do it
cd $BUILDS_DIR/osx32/
make_nix_tar cc-osx32
cd $BUILDS_DIR/osx64/
make_nix_tar cc-osx64
cd $BUILDS_DIR/nix32/
make_nix_tar cc-nix32
cd $BUILDS_DIR/nix64/
make_nix_tar cc-nix64
cd $BUILDS_DIR/rpi32/
make_nix_tar cc-rpi
# generate ClassiCube.app for mac users
cd $BUILDS_DIR/mac32/
make_mac_tar cc-osx32
cd $BUILDS_DIR/mac64/
make_mac_tar cc-osx64

View file

@ -1,34 +0,0 @@
import requests, re, datetime, json, time, os
# Any resemblence to any discord bots written by 123DMWM is purely coincidental. I swear.
# The URL of the discord channel webhook to notify
# You can generate a webhook by right clicking channel -> Edit Channel -> Webhooks
WEBHOOK_URL = ''
# The ID of the user you want to ping on a build failure
# You can get this by right clicking user -> Copy ID
# You may have to go to settings -> Appearance -> Check Developer Mode to see this option
TARGET_USER = ''
def notify_webhook(body):
try:
webhook_data = {
"username": "CC BuildBot",
"avatar_url": "https://static.classicube.net/img/cc-cube-small.png",
"content" : body
}
r = requests.post(WEBHOOK_URL, json=webhook_data)
print("BuildNotify response: " + r.text)
except Exception as e:
print("BuildNotify failed: %s" % (e))
cc_errors = None
try:
with open(sys.argv[1], 'r') as file:
cc_errors = file.read()
except FileNotFoundError:
# nothing to as no compile errors
pass
if cc_errors:
notify_webhook('**Houston, we have a problem** <@%s>\n\n%s' % (TARGET_USER, cc_errors))

View file

@ -2,8 +2,5 @@ This folder contains build scripts for automatically compiling ClassiCube
|File|Description|
|--------|-------|
|buildbot.sh | Compiles the game to optimised executables (with icons) |
|buildbot_plugin.sh | Compiles specified plugin for various platforms |
|buildtestplugin.sh | Example script for how to use buildbot_plugin.sh |
|makerelease.sh | Packages the executables to produce files for a release |
|notify.py | Notifies a user on Discord if buildbot fails |
|buildtestplugin.sh | Example script for how to use buildbot_plugin.sh |

View file

@ -1,13 +0,0 @@
# upload_build.sh [TARGET NAME] [SOURCE FILE]
# e.g. ~/upload_build.sh latest/ClassiCube.ipa cc.ipa
API_URL=
API_KEY=
if [ -s $2 ]; then
curl $API_URL \
--header "X-Build-Key:$API_KEY" \
--header "X-Build-Name:$1" \
--data-binary @$2
else
echo "Missing or empty file: $2"
fi

View file

@ -11,11 +11,11 @@ project(
add_definitions(-DPLAT_PS1)
file(GLOB _sources ../../src/*.c)
psn00bsdk_add_executable(template GPREL ${_sources})
psn00bsdk_add_executable(ClassiCube GPREL ${_sources})
psn00bsdk_add_cd_image(
iso # Target name
template # Output file name (= template.bin + template.cue)
iso.xml # Path to config file
DEPENDS template system.cnf
iso # Target name
ClassiCube # Output file name (= ClassiCube.bin + ClassiCube.cue)
iso.xml # Path to config file
DEPENDS ClassiCube system.cnf
)

View file

@ -1,4 +1,4 @@
BOOT=cdrom:\template.exe;1
BOOT=cdrom:\ClassiCube.exe;1
TCB=4
EVENT=10
STACK=801FFFF0

View file

@ -1,4 +1,4 @@
/* Generated using misc/linux_icon_gen.cs */
/* Generated using misc/x11_icon_gen.cs */
static const unsigned long CCIcon_Data[] = {
64,64,

View file

@ -0,0 +1,78 @@
{
"id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "ClassiCubeLauncher",
"finish-args": [
"--socket=wayland",
"--socket=fallback-x11",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=pulseaudio"
],
"modules": [
{
"name": "SDL3",
"buildsystem": "cmake-ninja",
"builddir": true,
"sources": [
{
"type": "git",
"url": "https://github.com/libsdl-org/SDL.git",
"branch": "main"
}
],
"cleanup": [
"/bin/sdl3-config",
"/include",
"/lib/libSDL3.la",
"/lib/libSDL3main.a",
"/lib/libSDL3main.la",
"/lib/libSDL3_test.a",
"/lib/libSDL3_test.la",
"/lib/cmake",
"/share/aclocal",
"/lib/pkgconfig"
],
"modules": [
{
"name": "libdecor",
"buildsystem": "meson",
"config-opts": [
"-Ddemo=false"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.freedesktop.org/libdecor/libdecor.git"
}
],
"cleanup": [
"/include",
"/lib/pkgconfig"
]
}
]
},
{
"name": "ClassiCube",
"buildsystem": "simple",
"build-commands": [
"gcc -fno-math-errno src/*.c -o src/ClassiCube -rdynamic -lpthread -lGL -DCC_WIN_BACKEND=CC_WIN_BACKEND_SDL3 -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -DCC_BUILD_FLATPAK -L /app/lib -lSDL3",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ClassiCube/ClassiCube.git"
}
]
}
]
}

View file

@ -0,0 +1,34 @@
{
"id": "net.classicube.flatpak.client",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "ClassiCubeLauncher",
"finish-args": [
"--socket=x11",
"--device=dri",
"--share=network",
"--share=ipc",
"--socket=pulseaudio"
],
"modules": [
{
"name": "ClassiCube",
"buildsystem": "simple",
"build-commands": [
"gcc -fno-math-errno src/*.c -o src/ClassiCube -O1 -DCC_BUILD_FLATPAK -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -rdynamic -lm -lpthread -lX11 -lXi -lGL -ldl",
"install -Dm755 src/ClassiCube -t ${FLATPAK_DEST}/bin",
"install -Dm755 misc/linux/flatpak/ClassiCubeLauncher -t ${FLATPAK_DEST}/bin",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/net.classicube.flatpak.client.svg",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.desktop ${FLATPAK_DEST}/share/applications/net.classicube.flatpak.client.desktop",
"install -Dm644 misc/linux/flatpak/net.classicube.flatpak.client.metainfo.xml ${FLATPAK_DEST}/share/metainfo/net.classicube.flatpak.client.metainfo.xml"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ClassiCube/ClassiCube.git"
}
]
}
]
}

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=ClassiCube
Exec=ClassiCubeLauncher
Comment=Sandbox building-block game
Type=Application
Icon=net.classicube.flatpak.client
Categories=Game;ActionGame;
Terminal=false
MimeType=x-scheme-handler/mc;
StartupWMClass=net.classicube.flatpak.client

View file

@ -0,0 +1,133 @@
<?xml version='1.0' encoding='utf-8'?>
<component type="desktop-application">
<id>net.classicube.flatpak.client</id>
<name>ClassiCube</name>
<summary>Sandbox building-block game</summary>
<developer id="net.classicube">
<name>The ClassiCube Project</name>
</developer>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-3-Clause</project_license>
<description>
<p>ClassiCube brings you back to the days of 2009 where one block game ruled them all, it includes such features as:</p>
<ul>
<li>Loads of blocks and items to choose from</li>
<li>Chatting with other players</li>
<li>An extremely simple network protocol to tinker with</li>
<li>Hundreds of creative and inventive worlds to explore online</li>
<li>A growing community</li>
<li>Hundreds of hours of entertainment</li>
</ul>
</description>
<screenshots>
<screenshot type="default">
<caption>Classic mode features faithful classic gameplay</caption>
<image type="source">https://github.com/ClassiCube/ClassiCube/assets/6509348/eedee53f-f53e-456f-b51c-92c62079eee0</image>
</screenshot>
<screenshot>
<caption>Enhanced mode allows hacks like flying and noclipping, it also allows servers to provide many custom features</caption>
<image type="source">https://github.com/ClassiCube/ClassiCube/assets/6509348/b2fe0e2b-5d76-41ab-909f-048d0ad15f37</image>
</screenshot>
</screenshots>
<releases>
<release version="1.3.6" date="2023-08-28" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.6</url>
</release>
<release version="1.3.5" date="2023-01-06" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.5</url>
</release>
<release version="1.3.4" date="2022-11-01" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.4</url>
</release>
<release version="1.3.3" date="2022-10-08" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.3</url>
</release>
<release version="1.3.2" date="2022-05-26" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.2</url>
</release>
<release version="1.3.1" date="2022-01-11" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.1</url>
</release>
<release version="1.3.0" date="2022-01-04" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.3.0</url>
</release>
<release version="1.2.9" date="2021-10-18" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.9</url>
</release>
<release version="1.2.8" date="2021-09-18" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.8</url>
</release>
<release version="1.2.7" date="2021-07-22" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.7</url>
</release>
<release version="1.2.6" date="2021-07-02" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.6</url>
</release>
<release version="1.2.5" date="2021-04-02" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.5</url>
</release>
<release version="1.2.4" date="2021-01-23" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.4</url>
</release>
<release version="1.2.3" date="2020-12-12" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.3</url>
</release>
<release version="1.2.2" date="2020-12-11" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.2</url>
</release>
<release version="1.2.1" date="2020-11-28" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.1</url>
</release>
<release version="1.2.0" date="2020-10-01" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.2.0</url>
</release>
<release version="1.1.9" date="2020-08-16" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.9</url>
</release>
<release version="1.1.8" date="2020-08-05" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.8</url>
</release>
<release version="1.1.7" date="2020-06-13" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.7</url>
</release>
<release version="1.1.6" date="2020-05-07" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.6</url>
</release>
<release version="1.1.5" date="2020-05-01" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.5</url>
</release>
<release version="1.1.4" date="2020-04-21" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.4</url>
</release>
<release version="1.1.3" date="2020-03-08" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.3</url>
</release>
<release version="1.1.2" date="2020-01-26" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.2</url>
</release>
<release version="1.1.1" date="2019-12-16" type="stable">
<url>https://github.com/ClassiCube/ClassiCube/releases/tag/1.1.1</url>
</release>
</releases>
<url type="homepage">https://www.classicube.net/</url>
<url type="bugtracker">https://github.com/ClassiCube/ClassiCube/issues</url>
<url type="donation">https://www.patreon.com/ClassiCube</url>
<url type="vcs-browser">https://github.com/ClassiCube/ClassiCube</url>
<categories>
<category>Game</category>
<category>AdventureGame</category>
<category>ActionGame</category>
</categories>
<recommends>
<control>pointing</control>
<control>keyboard</control>
</recommends>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">moderate</content_attribute>
<content_attribute id="social-chat">intense</content_attribute>
</content_rating>
<launchable type="desktop-id">net.classicube.flatpak.client.desktop</launchable>
<provides>
<binary>ClassiCube</binary>
</provides>
</component>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="128"
height="127.99999"
viewBox="0 0 33.866667 33.866664"
version="1.1"
id="svg8"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="translate(5.8338447,-13.20144)">
<g
id="g4741"
transform="matrix(0.12177585,0,0,0.12056875,-1.6325083,12.971524)">
<path
id="path4737"
d="M -5.8338447,207.40561 V 78.28894 L 106.61407,13.20144 218.79741,78.28894 V 207.40561 L 106.61407,272.4931 Z"
style="fill:#f6f6f6;stroke:#000000;stroke-width:8.0626;stroke-dasharray:none;stroke-opacity:1" />
<path
id="path179"
d="m 104.07502,141.52929 110.68965,-60.9215 1.62598,125.47985 -109.78346,61.73499 z m 20.61272,94.64566 c 8.561,-1.36503 22.58979,-6.90566 34.77207,-13.73314 8.44846,-4.73489 17.45957,-10.82064 25.81752,-17.43613 8.72093,-6.90281 17.22731,-15.21726 18.55921,-18.14047 0.26981,-0.59217 0.24879,-0.77358 -0.13391,-1.15568 -0.36305,-0.36248 -0.91552,-0.44887 -2.7589,-0.43139 -3.71393,0.0352 -9.27509,1.35366 -16.28846,3.86168 -2.01562,0.7208 -3.69686,1.27297 -3.73608,1.22704 -0.16881,-0.19764 3.44601,-29.37179 6.84564,-55.24912 1.21398,-9.24057 2.15592,-16.89033 2.09321,-16.99948 -0.19747,-0.34365 -6.05941,-0.21541 -8.74964,0.19141 -11.67357,1.7653 -26.1385,9.31897 -38.83406,20.27938 -3.00232,2.59198 -8.66363,8.37481 -10.38554,10.60847 l -1.13332,1.47013 1.06078,5.78494 c 1.66864,9.09991 3.21014,18.62874 5.55847,34.35994 1.6265,10.89577 2.70193,17.7159 2.81167,17.83099 0.23021,0.24143 9.15704,-3.22834 13.96159,-5.42672 4.01374,-1.83655 7.38001,-3.77497 13.6069,-7.83534 5.39432,-3.51748 6.57616,-4.09382 7.18285,-3.50281 1.32604,1.29178 -3.92898,6.46583 -11.75312,11.57204 -5.59387,3.65069 -11.90727,6.67998 -18.54423,8.8979 -3.61228,1.20714 -3.99351,1.40207 -6.48521,3.316 -7.13359,5.47947 -15.77323,13.5129 -18.33378,17.04736 -1.39429,1.92461 -1.60126,3.07547 -0.62376,3.46838 0.81553,0.3278 3.41645,0.32525 5.4901,-0.005 z"
style="fill:#cbcbcb;fill-opacity:1;stroke-width:0.264583" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,34 @@
DESKTOP_FILE=ClassiCube.desktop
GAME_DIR=`pwd`
# remove existing ClassiCube desktop entry file
rm $DESKTOP_FILE
# download ClassiCube icon from github if necessary
if [ -f "CCicon.png" ]
then
echo "CCicon.png exists already. Skipping download."
else
echo "CCicon.png doesn't exist. Attempting to download it.."
wget "https://raw.githubusercontent.com/ClassiCube/classicube/master/misc/CCicon.png"
fi
# create ClassiCube desktop entry
echo 'Creating ClassiCube.desktop..'
cat >> $DESKTOP_FILE << EOF
[Desktop Entry]
Type=Application
Comment=Minecraft Classic inspired sandbox game
Name=ClassiCube
Exec=$GAME_DIR/ClassiCube
Icon=$GAME_DIR/CCicon.png
Path=$GAME_DIR
Terminal=false
Categories=Game
EOF
chmod +x $DESKTOP_FILE
echo 'Installing ClassiCube.desktop..'
# install ClassiCube desktop entry into the system
sudo desktop-file-install --dir=/usr/share/applications ClassiCube.desktop
sudo update-desktop-database /usr/share/applications

View file

@ -363,8 +363,41 @@ void Gfx_DeleteIb(GfxResourceID* ib) { }
/*########################################################################################################################*
*-------------------------------------------------------Vertex buffers----------------------------------------------------*
*#########################################################################################################################*/
// Preprocess vertex buffers into optimised layout for PS1
struct PS1VertexTextured { float x, y, z; PackedCol Col; int u, v; };
static VertexFormat buf_fmt;
static int buf_count;
static void* gfx_vertices;
static int ToUVFixed(float value) {
return ((int)(value * 1024.0f) & 0x3FF); // U/V wrapping not supported
}
static void PreprocessTexturedVertices(void) {
struct PS1VertexTextured* dst = gfx_vertices;
struct VertexTextured* src = gfx_vertices;
// PS1 need to use raw U/V coordinates
// i.e. U = (src->U * tex->width) % tex->width
// To avoid expensive floating point conversions,
// convert the U coordinates to fixed point
// (using 10 bits for the fractional coordinate)
// Converting from fixed point using 1024 as base
// to tex->width/height as base is relatively simple:
// value / 1024 = X / tex_size
// X = value * tex_size / 1024
for (int i = 0; i < buf_count; i++, src++, dst++)
{
dst->u = ToUVFixed(src->U * 0.99f);
dst->v = ToUVFixed(src->V );
}
}
static void PreprocessColouredVertices(void) {
}
static GfxResourceID Gfx_AllocStaticVb(VertexFormat fmt, int count) {
return Mem_TryAlloc(count, strideSizes[fmt]);
}
@ -378,11 +411,19 @@ void Gfx_DeleteVb(GfxResourceID* vb) {
}
void* Gfx_LockVb(GfxResourceID vb, VertexFormat fmt, int count) {
buf_fmt = fmt;
buf_count = count;
return vb;
}
void Gfx_UnlockVb(GfxResourceID vb) {
gfx_vertices = vb;
gfx_vertices = vb;
if (buf_fmt == VERTEX_FORMAT_TEXTURED) {
PreprocessTexturedVertices();
} else {
PreprocessColouredVertices();
}
}
@ -393,16 +434,15 @@ static GfxResourceID Gfx_AllocDynamicVb(VertexFormat fmt, int maxVertices) {
void Gfx_BindDynamicVb(GfxResourceID vb) { Gfx_BindVb(vb); }
void* Gfx_LockDynamicVb(GfxResourceID vb, VertexFormat fmt, int count) {
return vb;
return Gfx_LockVb(vb, fmt, count);
}
void Gfx_UnlockDynamicVb(GfxResourceID vb) {
gfx_vertices = vb;
}
void Gfx_UnlockDynamicVb(GfxResourceID vb) { Gfx_UnlockVb(vb); }
void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); }
/*########################################################################################################################*
*---------------------------------------------------------Matrices--------------------------------------------------------*
*#########################################################################################################################*/
@ -417,11 +457,11 @@ static void LoadTransformMatrix(struct Matrix* src) {
mtx.t[1] = ToFixed(src->row4.y);
mtx.t[2] = ToFixed(src->row4.z);
Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row1.x, &src->row1.y, &src->row1.z);
Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row2.x, &src->row2.y, &src->row2.z);
Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row3.x, &src->row3.y, &src->row3.z);
Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row4.x, &src->row4.y, &src->row4.z);
Platform_LogConst("====");
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row1.x, &src->row1.y, &src->row1.z);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row2.x, &src->row2.y, &src->row2.z);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row3.x, &src->row3.y, &src->row3.z);
//Platform_Log3("X: %f3, Y: %f3, Z: %f3", &src->row4.x, &src->row4.y, &src->row4.z);
//Platform_LogConst("====");
mtx.m[0][0] = ToFixed(src->row1.x);
mtx.m[0][1] = ToFixed(src->row1.y);
@ -548,7 +588,7 @@ static void DrawTexturedQuads2D(int verticesCount, int startVertex) {
for (int i = 0; i < verticesCount; i += 4)
{
struct VertexTextured* v = (struct VertexTextured*)gfx_vertices + startVertex + i;
struct PS1VertexTextured* v = (struct PS1VertexTextured*)gfx_vertices + startVertex + i;
POLY_FT4* poly = new_primitive(sizeof(POLY_FT4));
setPolyFT4(poly);
@ -561,14 +601,14 @@ static void DrawTexturedQuads2D(int verticesCount, int startVertex) {
poly->x2 = v[2].x; poly->y2 = v[2].y;
poly->x3 = v[3].x; poly->y3 = v[3].y;
poly->u0 = ((int)(v[1].U * 0.99f * curTex->width) & curTex->width_mask) + uOffset;
poly->v0 = ((int)(v[1].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u1 = ((int)(v[0].U * 0.99f * curTex->width) & curTex->width_mask) + uOffset;
poly->v1 = ((int)(v[0].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u2 = ((int)(v[2].U * 0.99f * curTex->width) & curTex->width_mask) + uOffset;
poly->v2 = ((int)(v[2].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u3 = ((int)(v[3].U * 0.99f * curTex->width) & curTex->width_mask) + uOffset;
poly->v3 = ((int)(v[3].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u0 = ((v[1].u * curTex->width) >> 10) + uOffset;
poly->v0 = ((v[1].v * curTex->height) >> 10) + vOffset;
poly->u1 = ((v[0].u * curTex->width) >> 10) + uOffset;
poly->v1 = ((v[0].v * curTex->height) >> 10) + vOffset;
poly->u2 = ((v[2].u * curTex->width) >> 10) + uOffset;
poly->v2 = ((v[2].v * curTex->height) >> 10) + vOffset;
poly->u3 = ((v[3].u * curTex->width) >> 10) + uOffset;
poly->v3 = ((v[3].v * curTex->height) >> 10) + vOffset;
// https://problemkaputt.de/psxspx-gpu-rendering-attributes.htm
// "For untextured graphics, 8bit RGB values of FFh are brightest. However, for texture blending, 8bit values of 80h are brightest"
@ -625,7 +665,7 @@ static void DrawTexturedQuads3D(int verticesCount, int startVertex) {
for (int i = 0; i < verticesCount; i += 4)
{
struct VertexTextured* v = (struct VertexTextured*)gfx_vertices + startVertex + i;
struct PS1VertexTextured* v = (struct PS1VertexTextured*)gfx_vertices + startVertex + i;
POLY_FT4* poly = new_primitive(sizeof(POLY_FT4));
setPolyFT4(poly);
@ -651,14 +691,14 @@ static void DrawTexturedQuads3D(int verticesCount, int startVertex) {
if (signA > signB) continue;
}
poly->u0 = ((int)(v[1].U * curTex->width) & curTex->width_mask) + uOffset;
poly->v0 = ((int)(v[1].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u1 = ((int)(v[0].U * curTex->width) & curTex->width_mask) + uOffset;
poly->v1 = ((int)(v[0].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u2 = ((int)(v[2].U * curTex->width) & curTex->width_mask) + uOffset;
poly->v2 = ((int)(v[2].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u3 = ((int)(v[3].U * curTex->width) & curTex->width_mask) + uOffset;
poly->v3 = ((int)(v[3].V * curTex->height) & curTex->height_mask) + vOffset;
poly->u0 = ((v[1].u * curTex->width) >> 10) + uOffset;
poly->v0 = ((v[1].v * curTex->height) >> 10) + vOffset;
poly->u1 = ((v[0].u * curTex->width) >> 10) + uOffset;
poly->v1 = ((v[0].v * curTex->height) >> 10) + vOffset;
poly->u2 = ((v[2].u * curTex->width) >> 10) + uOffset;
poly->v2 = ((v[2].v * curTex->height) >> 10) + vOffset;
poly->u3 = ((v[3].u * curTex->width) >> 10) + uOffset;
poly->v3 = ((v[3].v * curTex->height) >> 10) + vOffset;
//int P = curTex->height, page = poly->tpage & 0xFF, ll = curTex->yOffset;
//Platform_Log4("XYZ: %f3 x %i, %i, %i", &v[0].V, &P, &page, &ll);

View file

@ -237,7 +237,7 @@ void Gfx_DeleteIb(GfxResourceID* ib) { }
/*########################################################################################################################*
*-------------------------------------------------------Vertex buffers----------------------------------------------------*
*#########################################################################################################################*/
// Preprocess vertex buffers into optimised layout for DS
// Preprocess vertex buffers into optimised layout for Saturn
static VertexFormat buf_fmt;
static int buf_count;

View file

@ -16,12 +16,12 @@
#include <X11/extensions/XInput2.h>
#endif
*/
#include "../misc/linux/min-xlib.h"
#include "../misc/linux/min-keysymdef.h"
#include "../misc/linux/min-xutil.h"
#include "../misc/linux/min-xkblib.h"
#include "../misc/linux/min-xinput2.h"
#include "../misc/linux/min-XF86keysym.h"
#include "../misc/x11/min-xlib.h"
#include "../misc/x11/min-keysymdef.h"
#include "../misc/x11/min-xutil.h"
#include "../misc/x11/min-xkblib.h"
#include "../misc/x11/min-xinput2.h"
#include "../misc/x11/min-XF86keysym.h"
#include <stdio.h>
#ifdef X_HAVE_UTF8_STRING
@ -318,8 +318,8 @@ void Window_Init(void) {
void Window_Free(void) { }
#ifdef CC_BUILD_ICON
/* See misc/linux/linux_icon_gen.cs for how to generate this file */
#include "../misc/linux/CCIcon_X11.h"
/* See misc/x11/x11_icon_gen.cs for how to generate this file */
#include "../misc/x11/CCIcon_X11.h"
static void ApplyIcon(void) {
Atom net_wm_icon = XInternAtom(win_display, "_NET_WM_ICON", false);